From c778d91cc686e748ea77d37af869e9ca76ef48f4 Mon Sep 17 00:00:00 2001 From: sb-rohitdesai Date: Wed, 24 Jul 2024 19:17:33 +0530 Subject: [PATCH] fix: yalc version of json --- examples/example-customer-without-error.json | 8268 +++++++++++++++++ packages/cli/.yalc/@stoplight/json/LICENSE | 190 + packages/cli/.yalc/@stoplight/json/README.md | 70 + .../json/__tests__/bundle.spec.d.ts | 1 + .../json/__tests__/decodePointer.d.ts | 1 + .../json/__tests__/decodePointerFragment.d.ts | 1 + .../json/__tests__/decycle.spec.d.ts | 1 + .../json/__tests__/encodePointer.d.ts | 1 + .../json/__tests__/encodePointerFragment.d.ts | 1 + .../__tests__/extractPointerFromRef.spec.d.ts | 1 + .../__tests__/extractSourceFromRef.spec.d.ts | 1 + .../json/__tests__/fixtures/json.d.ts | 6 + .../__tests__/getFirstPrimitiveProperty.d.ts | 1 + .../getJsonPathForPosition.spec.d.ts | 1 + .../__tests__/getLastPathSegment.spec.d.ts | 1 + .../getLocationForJsonPath.spec.d.ts | 1 + .../json/__tests__/hasRef.spec.d.ts | 1 + .../json/__tests__/isLocalRef.spec.d.ts | 1 + .../json/__tests__/isPlainObject.spec.d.ts | 1 + .../json/__tests__/parseWithPointers.d.ts | 1 + .../json/__tests__/pathToPointer.d.ts | 1 + .../json/__tests__/pointerToPath.d.ts | 1 + .../json/__tests__/renameObjectKeys.spec.d.ts | 1 + .../__tests__/reparentBundleTarget.spec.d.ts | 1 + .../__tests__/resolveExternalRef.spec.d.ts | 1 + .../json/__tests__/resolveInlineRef.spec.d.ts | 1 + .../@stoplight/json/__tests__/safeParse.d.ts | 1 + .../json/__tests__/safeStringify.d.ts | 1 + .../json/__tests__/startsWith.spec.d.ts | 1 + .../json/__tests__/stringify.spec.d.ts | 1 + .../json/__tests__/toPropertyPath.spec.d.ts | 1 + .../@stoplight/json/__tests__/trapAccess.d.ts | 1 + .../json/__tests__/traverse.spec.d.ts | 1 + .../json/__tests__/trimStart.spec.d.ts | 1 + .../cli/.yalc/@stoplight/json/_utils.d.ts | 1 + .../cli/.yalc/@stoplight/json/bundle.d.ts | 16 + .../.yalc/@stoplight/json/decodePointer.d.ts | 1 + .../json/decodePointerFragment.d.ts | 1 + .../json/decodePointerUriFragment.d.ts | 1 + .../cli/.yalc/@stoplight/json/decycle.d.ts | 1 + .../cli/.yalc/@stoplight/json/decycle2.d.ts | 0 .../.yalc/@stoplight/json/encodePointer.d.ts | 1 + .../json/encodePointerFragment.d.ts | 2 + .../json/encodePointerUriFragment.d.ts | 2 + .../@stoplight/json/encodeUriPointer.d.ts | 1 + .../json/extractPointerFromRef.d.ts | 1 + .../@stoplight/json/extractSourceFromRef.d.ts | 1 + .../json/getFirstPrimitiveProperty.d.ts | 2 + .../json/getJsonPathForPosition.d.ts | 3 + .../@stoplight/json/getLastPathSegment.d.ts | 1 + .../json/getLocationForJsonPath.d.ts | 3 + .../cli/.yalc/@stoplight/json/hasRef.d.ts | 3 + .../cli/.yalc/@stoplight/json/index.cjs.js | 1 + packages/cli/.yalc/@stoplight/json/index.d.ts | 36 + .../cli/.yalc/@stoplight/json/index.es.js | 1 + .../.yalc/@stoplight/json/isExternalRef.d.ts | 1 + .../cli/.yalc/@stoplight/json/isLocalRef.d.ts | 1 + .../.yalc/@stoplight/json/isPlainObject.d.ts | 1 + .../cli/.yalc/@stoplight/json/package.json | 37 + .../@stoplight/json/parseWithPointers.d.ts | 4 + .../.yalc/@stoplight/json/pathToPointer.d.ts | 2 + .../.yalc/@stoplight/json/pointerToPath.d.ts | 2 + .../cli/.yalc/@stoplight/json/remapRefs.d.ts | 1 + .../@stoplight/json/renameObjectKey.d.ts | 1 + .../@stoplight/json/reparentBundleTarget.d.ts | 1 + .../__tests__/resolveSource.spec.d.ts | 1 + .../@stoplight/json/resolvers/guards.d.ts | 8 + .../json/resolvers/resolveExternalRef.d.ts | 9 + .../json/resolvers/resolveInlineRef.d.ts | 4 + .../@stoplight/json/resolvers/types.d.ts | 6 + .../@stoplight/json/resolvers/utils.d.ts | 8 + .../cli/.yalc/@stoplight/json/safeParse.d.ts | 1 + .../.yalc/@stoplight/json/safeStringify.d.ts | 2 + .../cli/.yalc/@stoplight/json/startsWith.d.ts | 1 + .../cli/.yalc/@stoplight/json/stringify.d.ts | 1 + .../.yalc/@stoplight/json/toPropertyPath.d.ts | 1 + .../cli/.yalc/@stoplight/json/trapAccess.d.ts | 2 + .../cli/.yalc/@stoplight/json/traverse.d.ts | 19 + .../cli/.yalc/@stoplight/json/trimStart.d.ts | 2 + packages/cli/.yalc/@stoplight/json/types.d.ts | 17 + packages/cli/.yalc/@stoplight/json/yalc.sig | 1 + packages/cli/package.json | 2 +- packages/cli/src/extensions.ts | 99 + packages/cli/yalc.lock | 11 + packages/http/.yalc/@stoplight/json/LICENSE | 190 + packages/http/.yalc/@stoplight/json/README.md | 70 + .../json/__tests__/bundle.spec.d.ts | 1 + .../json/__tests__/decodePointer.d.ts | 1 + .../json/__tests__/decodePointerFragment.d.ts | 1 + .../json/__tests__/decycle.spec.d.ts | 1 + .../json/__tests__/encodePointer.d.ts | 1 + .../json/__tests__/encodePointerFragment.d.ts | 1 + .../__tests__/extractPointerFromRef.spec.d.ts | 1 + .../__tests__/extractSourceFromRef.spec.d.ts | 1 + .../json/__tests__/fixtures/json.d.ts | 6 + .../__tests__/getFirstPrimitiveProperty.d.ts | 1 + .../getJsonPathForPosition.spec.d.ts | 1 + .../__tests__/getLastPathSegment.spec.d.ts | 1 + .../getLocationForJsonPath.spec.d.ts | 1 + .../json/__tests__/hasRef.spec.d.ts | 1 + .../json/__tests__/isLocalRef.spec.d.ts | 1 + .../json/__tests__/isPlainObject.spec.d.ts | 1 + .../json/__tests__/parseWithPointers.d.ts | 1 + .../json/__tests__/pathToPointer.d.ts | 1 + .../json/__tests__/pointerToPath.d.ts | 1 + .../json/__tests__/renameObjectKeys.spec.d.ts | 1 + .../__tests__/reparentBundleTarget.spec.d.ts | 1 + .../__tests__/resolveExternalRef.spec.d.ts | 1 + .../json/__tests__/resolveInlineRef.spec.d.ts | 1 + .../@stoplight/json/__tests__/safeParse.d.ts | 1 + .../json/__tests__/safeStringify.d.ts | 1 + .../json/__tests__/startsWith.spec.d.ts | 1 + .../json/__tests__/stringify.spec.d.ts | 1 + .../json/__tests__/toPropertyPath.spec.d.ts | 1 + .../@stoplight/json/__tests__/trapAccess.d.ts | 1 + .../json/__tests__/traverse.spec.d.ts | 1 + .../json/__tests__/trimStart.spec.d.ts | 1 + .../http/.yalc/@stoplight/json/_utils.d.ts | 1 + .../http/.yalc/@stoplight/json/bundle.d.ts | 16 + .../.yalc/@stoplight/json/decodePointer.d.ts | 1 + .../json/decodePointerFragment.d.ts | 1 + .../json/decodePointerUriFragment.d.ts | 1 + .../http/.yalc/@stoplight/json/decycle.d.ts | 1 + .../http/.yalc/@stoplight/json/decycle2.d.ts | 0 .../.yalc/@stoplight/json/encodePointer.d.ts | 1 + .../json/encodePointerFragment.d.ts | 2 + .../json/encodePointerUriFragment.d.ts | 2 + .../@stoplight/json/encodeUriPointer.d.ts | 1 + .../json/extractPointerFromRef.d.ts | 1 + .../@stoplight/json/extractSourceFromRef.d.ts | 1 + .../json/getFirstPrimitiveProperty.d.ts | 2 + .../json/getJsonPathForPosition.d.ts | 3 + .../@stoplight/json/getLastPathSegment.d.ts | 1 + .../json/getLocationForJsonPath.d.ts | 3 + .../http/.yalc/@stoplight/json/hasRef.d.ts | 3 + .../http/.yalc/@stoplight/json/index.cjs.js | 1 + .../http/.yalc/@stoplight/json/index.d.ts | 36 + .../http/.yalc/@stoplight/json/index.es.js | 1 + .../.yalc/@stoplight/json/isExternalRef.d.ts | 1 + .../.yalc/@stoplight/json/isLocalRef.d.ts | 1 + .../.yalc/@stoplight/json/isPlainObject.d.ts | 1 + .../http/.yalc/@stoplight/json/package.json | 37 + .../@stoplight/json/parseWithPointers.d.ts | 4 + .../.yalc/@stoplight/json/pathToPointer.d.ts | 2 + .../.yalc/@stoplight/json/pointerToPath.d.ts | 2 + .../http/.yalc/@stoplight/json/remapRefs.d.ts | 1 + .../@stoplight/json/renameObjectKey.d.ts | 1 + .../@stoplight/json/reparentBundleTarget.d.ts | 1 + .../__tests__/resolveSource.spec.d.ts | 1 + .../@stoplight/json/resolvers/guards.d.ts | 8 + .../json/resolvers/resolveExternalRef.d.ts | 9 + .../json/resolvers/resolveInlineRef.d.ts | 4 + .../@stoplight/json/resolvers/types.d.ts | 6 + .../@stoplight/json/resolvers/utils.d.ts | 8 + .../http/.yalc/@stoplight/json/safeParse.d.ts | 1 + .../.yalc/@stoplight/json/safeStringify.d.ts | 2 + .../.yalc/@stoplight/json/startsWith.d.ts | 1 + .../http/.yalc/@stoplight/json/stringify.d.ts | 1 + .../.yalc/@stoplight/json/toPropertyPath.d.ts | 1 + .../.yalc/@stoplight/json/trapAccess.d.ts | 2 + .../http/.yalc/@stoplight/json/traverse.d.ts | 19 + .../http/.yalc/@stoplight/json/trimStart.d.ts | 2 + .../http/.yalc/@stoplight/json/types.d.ts | 17 + packages/http/.yalc/@stoplight/json/yalc.sig | 1 + packages/http/package.json | 6 +- packages/http/yalc.lock | 11 + yarn.lock | 20 + 167 files changed, 9431 insertions(+), 4 deletions(-) create mode 100644 examples/example-customer-without-error.json create mode 100644 packages/cli/.yalc/@stoplight/json/LICENSE create mode 100644 packages/cli/.yalc/@stoplight/json/README.md create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/bundle.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/decodePointer.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/decodePointerFragment.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/decycle.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/encodePointer.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/encodePointerFragment.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/extractPointerFromRef.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/extractSourceFromRef.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/fixtures/json.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/getFirstPrimitiveProperty.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/getJsonPathForPosition.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/getLastPathSegment.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/getLocationForJsonPath.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/hasRef.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/isLocalRef.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/isPlainObject.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/parseWithPointers.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/pathToPointer.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/pointerToPath.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/renameObjectKeys.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/reparentBundleTarget.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/resolveExternalRef.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/resolveInlineRef.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/safeParse.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/safeStringify.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/startsWith.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/stringify.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/toPropertyPath.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/trapAccess.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/traverse.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/__tests__/trimStart.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/_utils.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/bundle.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/decodePointer.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/decodePointerFragment.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/decodePointerUriFragment.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/decycle.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/decycle2.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/encodePointer.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/encodePointerFragment.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/encodePointerUriFragment.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/encodeUriPointer.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/extractPointerFromRef.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/extractSourceFromRef.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/getFirstPrimitiveProperty.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/getJsonPathForPosition.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/getLastPathSegment.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/getLocationForJsonPath.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/hasRef.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/index.cjs.js create mode 100644 packages/cli/.yalc/@stoplight/json/index.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/index.es.js create mode 100644 packages/cli/.yalc/@stoplight/json/isExternalRef.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/isLocalRef.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/isPlainObject.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/package.json create mode 100644 packages/cli/.yalc/@stoplight/json/parseWithPointers.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/pathToPointer.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/pointerToPath.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/remapRefs.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/renameObjectKey.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/reparentBundleTarget.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/resolvers/__tests__/resolveSource.spec.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/resolvers/guards.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/resolvers/resolveExternalRef.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/resolvers/resolveInlineRef.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/resolvers/types.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/resolvers/utils.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/safeParse.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/safeStringify.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/startsWith.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/stringify.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/toPropertyPath.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/trapAccess.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/traverse.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/trimStart.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/types.d.ts create mode 100644 packages/cli/.yalc/@stoplight/json/yalc.sig create mode 100644 packages/cli/yalc.lock create mode 100644 packages/http/.yalc/@stoplight/json/LICENSE create mode 100644 packages/http/.yalc/@stoplight/json/README.md create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/bundle.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/decodePointer.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/decodePointerFragment.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/decycle.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/encodePointer.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/encodePointerFragment.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/extractPointerFromRef.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/extractSourceFromRef.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/fixtures/json.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/getFirstPrimitiveProperty.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/getJsonPathForPosition.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/getLastPathSegment.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/getLocationForJsonPath.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/hasRef.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/isLocalRef.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/isPlainObject.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/parseWithPointers.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/pathToPointer.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/pointerToPath.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/renameObjectKeys.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/reparentBundleTarget.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/resolveExternalRef.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/resolveInlineRef.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/safeParse.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/safeStringify.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/startsWith.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/stringify.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/toPropertyPath.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/trapAccess.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/traverse.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/__tests__/trimStart.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/_utils.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/bundle.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/decodePointer.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/decodePointerFragment.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/decodePointerUriFragment.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/decycle.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/decycle2.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/encodePointer.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/encodePointerFragment.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/encodePointerUriFragment.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/encodeUriPointer.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/extractPointerFromRef.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/extractSourceFromRef.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/getFirstPrimitiveProperty.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/getJsonPathForPosition.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/getLastPathSegment.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/getLocationForJsonPath.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/hasRef.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/index.cjs.js create mode 100644 packages/http/.yalc/@stoplight/json/index.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/index.es.js create mode 100644 packages/http/.yalc/@stoplight/json/isExternalRef.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/isLocalRef.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/isPlainObject.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/package.json create mode 100644 packages/http/.yalc/@stoplight/json/parseWithPointers.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/pathToPointer.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/pointerToPath.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/remapRefs.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/renameObjectKey.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/reparentBundleTarget.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/resolvers/__tests__/resolveSource.spec.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/resolvers/guards.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/resolvers/resolveExternalRef.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/resolvers/resolveInlineRef.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/resolvers/types.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/resolvers/utils.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/safeParse.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/safeStringify.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/startsWith.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/stringify.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/toPropertyPath.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/trapAccess.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/traverse.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/trimStart.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/types.d.ts create mode 100644 packages/http/.yalc/@stoplight/json/yalc.sig create mode 100644 packages/http/yalc.lock diff --git a/examples/example-customer-without-error.json b/examples/example-customer-without-error.json new file mode 100644 index 000000000..21b3a006c --- /dev/null +++ b/examples/example-customer-without-error.json @@ -0,0 +1,8268 @@ +{ + "openapi": "3.0.1", + "x-stoplight": { + "id": "5vt75regolge6" + }, + "info": { + "title": "인어교주해적단 물류 API", + "description": "인어교주 해적단 물류 플랫폼 API", + "version": "v1" + }, + "servers": [ + { + "url": "http://localhost:8080", + "description": "로컬" + }, + { + "url": "https://api.test.tpirates.com", + "description": "개발" + } + ], + "paths": { + "/v2/distribution/{partnerCode}/cart/{cartItemId}": { + "put": { + "tags": ["장바구니(Cart)"], + "summary": "장바구니 상품 수정", + "operationId": "updateCartItem", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "cartItemId", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CartItemRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "장바구니 상품 수정 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetCartItemListResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "ar9zwnq2e69qf" + } + }, + "delete": { + "tags": ["장바구니(Cart)"], + "summary": "장바구니 상품 삭제", + "operationId": "deleteCartItem", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "cartItemId", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "장바구니 상품 삭제 성공", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/Unit" + } + } + } + } + }, + "x-stoplight": { + "id": "dzhgo63e8wxx6" + } + } + }, + "/v2/distribution/{partnerCode}/cart/packing-fee": { + "put": { + "tags": ["장바구니(Cart)"], + "summary": "포장비 수정", + "operationId": "updatePackingFee", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdatePackingFeeRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "포장비 수정 성공", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/Unit" + } + } + } + } + }, + "x-stoplight": { + "id": "5jbxkuvvyuvh9" + } + } + }, + "/v2/distribution/orders/{partnerCode}/cancel": { + "put": { + "tags": ["고객 주문(Order)"], + "summary": "주문 취소", + "operationId": "cancelOrder", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrderEntryIds" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/Unit" + } + } + } + } + }, + "x-stoplight": { + "id": "vh8ybm5121w3y" + } + } + }, + "/v2/distribution/buyers/{partnerCode}/manager": { + "get": { + "tags": ["점포(Buyer)"], + "summary": "매니저 조회", + "operationId": "getManagers", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-stoplight": { + "id": "fzf2wm2sdxorx" + } + }, + "put": { + "tags": ["점포(Buyer)"], + "summary": "매니저 수정", + "operationId": "updateManagers", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ManagerRequest" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-stoplight": { + "id": "m5pr1mwar4rpe" + } + } + }, + "/v2/distribution/buyers/{partnerCode}/favorite/seq": { + "put": { + "tags": ["점포(Buyer)"], + "summary": "즐거찾기 순서 변경", + "operationId": "reorderFavorite", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReorderFavoriteRequest" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-stoplight": { + "id": "66v4ln9hh0q6c" + } + } + }, + "/v2/distribution/buyers/{partnerCode}/deliveryNote": { + "get": { + "tags": ["점포(Buyer)"], + "summary": "배송 특이사항 조회", + "operationId": "getDeliveryNote", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "배송 특이사항 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeliveryNoteResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "gwktdb27juqwu" + } + }, + "put": { + "tags": ["점포(Buyer)"], + "summary": "배송 특이사항 작성", + "operationId": "updateDeliveryNote", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeliveryNoteRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-stoplight": { + "id": "iddtp0apxuo2g" + } + } + }, + "/v2/distribution/buyers/{partnerCode}/address": { + "get": { + "tags": ["점포(Buyer)"], + "summary": "점포 주소 조회", + "operationId": "getAddress", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-stoplight": { + "id": "u2sj5lklavkvn" + } + }, + "put": { + "tags": ["점포(Buyer)"], + "summary": "주소 변경", + "operationId": "updateAddress", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Address" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-stoplight": { + "id": "aunm020m0briq" + } + } + }, + "/v1/distribution/orders/cancel/{orderId}": { + "put": { + "tags": ["고객 주문(Order)"], + "summary": "주문 취소", + "operationId": "cancelOrder_1", + "parameters": [ + { + "name": "orderId", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/Unit" + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "nzb9atz14zv2n" + } + } + }, + "/v1/distribution/buyers/{partnerCode}/address": { + "put": { + "tags": ["점포(Buyer)"], + "summary": "주소 변경", + "operationId": "updateAddress_1", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Address" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "h4vhwkw5gg9pb" + } + } + }, + "/v1/distribution/buyers/{id}/deliveryNote": { + "put": { + "tags": ["점포(Buyer)"], + "summary": "배송 특이사항 작성", + "operationId": "updateDeliveryNote_1", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeliveryNoteRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "4axsbmimimmse" + } + } + }, + "/v2/distribution/{partnerCode}/cart": { + "get": { + "tags": ["장바구니(Cart)"], + "summary": "장바구니 조회", + "operationId": "getCart", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "장바구니 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetCartResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "qbkzka6nv1son" + } + }, + "post": { + "tags": ["장바구니(Cart)"], + "summary": "장바구니 상품 추가", + "operationId": "addCartItem", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CartItemRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "장바구니 상품 추가 성공", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/Unit" + } + } + } + } + }, + "x-stoplight": { + "id": "av7643sn529gu" + } + } + }, + "/v2/distribution/{partnerCode}/cart/re-order": { + "post": { + "tags": ["장바구니(Cart)"], + "summary": "장바구니 상품 재주문", + "operationId": "reOrderEntry", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReOrderRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "장바구니 상품 재주문 성공", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/Unit" + } + } + } + } + }, + "x-stoplight": { + "id": "cdbcgrjzk5jkf" + } + } + }, + "/v2/distribution/orders/{partnerCode}": { + "get": { + "tags": ["고객 주문(Order)"], + "summary": "주문 목록", + "operationId": "getOrderHistory", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "start", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date" + } + }, + { + "name": "end", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date" + } + }, + { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "direction", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": ["ASC", "DESC"] + } + }, + { + "name": "properties", + "in": "query", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PageGetBuyerOrderHistoryResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "c05zcwd7enbqx" + } + }, + "post": { + "tags": ["고객 주문(Order)"], + "summary": "주문", + "operationId": "registerOrder", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CartOrderRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/OrderCompleteResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "bxxk80kgdu9yx" + } + } + }, + "/v2/distribution/buyers/{partnerCode}/favorite": { + "get": { + "tags": ["점포(Buyer)"], + "summary": "즐겨찾기 목록 조회", + "operationId": "getFavoriteList", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "direction", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": ["ASC", "DESC"] + } + }, + { + "name": "properties", + "in": "query", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-stoplight": { + "id": "mxnyef5n7eg77" + } + }, + "post": { + "tags": ["점포(Buyer)"], + "summary": "즐겨찾기 추가", + "operationId": "addBuyerFavorite", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddFavoriteRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/BuyerFavoriteDetail" + } + } + } + } + }, + "x-stoplight": { + "id": "nnwk8175c5zgj" + } + } + }, + "/v2/distribution/{partnerCode}/products/{id}": { + "get": { + "tags": ["상품조회(Product)"], + "summary": "상품 상세 조회", + "operationId": "getProduct", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/WholeSaleProductDetail" + } + } + } + } + }, + "x-stoplight": { + "id": "9i4ywl5epq4cn" + } + } + }, + "/v2/distribution/{partnerCode}/products/{id}/price": { + "get": { + "tags": ["상품조회(Product)"], + "summary": "상품 단가 조회", + "operationId": "getProductPrice", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PriceDataTableResponse" + } + } + } + } + } + }, + "x-stoplight": { + "id": "41z9y1s4y6z7b" + } + } + }, + "/v2/distribution/{partnerCode}/products/search": { + "get": { + "tags": ["상품조회(Product)"], + "summary": "상품 조회", + "operationId": "getProducts", + "parameters": [ + { + "name": "keyword", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "direction", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": ["ASC", "DESC"] + } + }, + { + "name": "properties", + "in": "query", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PageSearchProductResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "26n72paz030dd" + } + } + }, + "/v2/distribution/{partnerCode}/products/often-buy": { + "get": { + "tags": ["상품조회(Product)"], + "summary": "자주사는 상품, 늘 사던 상품", + "operationId": "getOftenBuyProducts", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "direction", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": ["ASC", "DESC"] + } + }, + { + "name": "properties", + "in": "query", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PageBuyOftenProductSaleUnit" + } + } + } + } + }, + "x-stoplight": { + "id": "1forvocl49wnf" + } + } + }, + "/v2/distribution/{partnerCode}/driver/list": { + "get": { + "tags": ["배송(Driver)"], + "summary": "배송 리스트", + "operationId": "getDeliveryList", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "deliveryDate", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-stoplight": { + "id": "x8h0cqwlvpoyp" + } + } + }, + "/v2/distribution/{partnerCode}/driver/detail": { + "get": { + "tags": ["배송(Driver)"], + "summary": "배송 상세", + "operationId": "getDeliveryDetail", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "deliveryDate", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "date" + } + }, + { + "name": "deliveryVehicleId", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/GetDeliveryDetailResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "96ompaziyelh9" + } + } + }, + "/v2/distribution/{partnerCode}/cart/order-price": { + "get": { + "tags": ["장바구니(Cart)"], + "summary": "장바구니 상품 금액 조회", + "operationId": "getOrderPrice", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "장바구니 상품 금액 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CartPriceResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "lroaznua12846" + } + } + }, + "/v2/distribution/{partnerCode}/cart/button": { + "get": { + "tags": ["장바구니(Cart)"], + "summary": "주문전 필요정보 조회", + "operationId": "getCartButtonInfo", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "주문전 필요정보 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CartButtonResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "r492t2wkjzitf" + } + } + }, + "/v2/distribution/vehicle": { + "get": { + "tags": ["vehicle"], + "operationId": "selectDeliveryVehicle", + "parameters": [ + { + "name": "selectDeliveryVehicleRequest", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/SelectDeliveryVehicleRequest" + } + }, + { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "direction", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": ["ASC", "DESC"] + } + }, + { + "name": "properties", + "in": "query", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PageSelectDeliveryVehicleResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "3oq57mwoigp8f" + } + } + }, + "/v2/distribution/sellers/holiday": { + "get": { + "tags": ["판매자(Seller)"], + "summary": "판매자 상세 조회", + "operationId": "getSellerDetail", + "responses": { + "200": { + "description": "판매자 상세 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SelectClosedDayResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "lkrw23gl0n6xw" + } + } + }, + "/v2/distribution/orders/{partnerCode}/{orderCode}": { + "get": { + "tags": ["고객 주문(Order)"], + "summary": "주문 상세", + "operationId": "getOrderHistoryDetail", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "orderCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/OrderDetailResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "30k92bg1sw6c3" + } + } + }, + "/v2/distribution/buyers": { + "get": { + "tags": ["점포(Buyer)"], + "summary": "점포 조회", + "operationId": "getBuyers", + "parameters": [ + { + "name": "selectBuyerRequest", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/SelectBuyerRequest" + } + }, + { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "direction", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": ["ASC", "DESC"] + } + }, + { + "name": "properties", + "in": "query", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-stoplight": { + "id": "d5r6xn7wjg8fz" + } + } + }, + "/v2/distribution/buyers/{partnerCode}": { + "get": { + "tags": ["점포(Buyer)"], + "summary": "점포 상세 조회", + "operationId": "getBuyerDetail", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "점포 상세 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BuyerDetail" + } + } + } + } + }, + "x-stoplight": { + "id": "mm9k2udegowuh" + } + } + }, + "/v2/distribution/buyers/{partnerCode}/favorite/{id}": { + "get": { + "tags": ["점포(Buyer)"], + "summary": "즐겨찾기 상품 조회", + "operationId": "getFavoriteDetail", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/BuyerFavoriteDetail" + } + } + } + } + }, + "x-stoplight": { + "id": "ez4ak3v3xmu9z" + } + }, + "delete": { + "tags": ["점포(Buyer)"], + "summary": "즐겨찾기 삭제", + "operationId": "updateAddress_2", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/Unit" + } + } + } + } + }, + "x-stoplight": { + "id": "elc2pr9juj2y1" + } + } + }, + "/v1/distribution/{partnerCode}/driver/list": { + "get": { + "tags": ["배송(Driver)"], + "summary": "배송 리스트", + "operationId": "getDeliveryList_1", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "deliveryDate", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/OldGetDeliveryList" + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "4ie5nz7q7ztl9" + } + } + }, + "/v1/distribution/{partnerCode}/driver/detail": { + "get": { + "tags": ["배송(Driver)"], + "summary": "배송 상세", + "operationId": "getDeliveryDetail_1", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "deliveryDate", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "date" + } + }, + { + "name": "deliveryVehicleId", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/OldGetDeliveryDetail" + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "u2b3u8qjo9dai" + } + } + }, + "/v1/distribution/settings": { + "get": { + "tags": ["설정(Setting)"], + "operationId": "selectSetting", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/SettingResponse" + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "vql5g9dqfiiw6" + } + } + }, + "/v1/distribution/sellers/{sellerId}": { + "get": { + "tags": ["판매자(Seller)"], + "summary": "판매자 상세 조회", + "operationId": "getSellerDetail_1", + "parameters": [ + { + "name": "sellerId", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/SelectSellerDetailResponse" + } + } + } + } + }, + "x-stoplight": { + "id": "6yt6ewnd88a4w" + } + } + }, + "/v1/distribution/products/{partnerCode}": { + "get": { + "tags": ["상품조회(Product)"], + "summary": "상품 조회", + "operationId": "selectProducts", + "parameters": [ + { + "name": "selectProductRequest", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/SelectProductRequest" + } + }, + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "direction", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": ["ASC", "DESC"] + } + }, + { + "name": "properties", + "in": "query", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PageSelectProductResponse" + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "mml0lkz9ml7tj" + } + } + }, + "/v1/distribution/orders/{partnerCode}/orderEntry/previous": { + "get": { + "tags": ["고객 주문(Order)"], + "summary": "이전주문담기", + "operationId": "selectProductSaleUnits", + "parameters": [ + { + "name": "ids", + "in": "query", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + }, + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WholeSalePlaceOrderResponse" + } + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "cxurzk3d80whd" + } + } + }, + "/v1/distribution/orders/{partnerCode}/history": { + "get": { + "tags": ["고객 주문(Order)"], + "summary": "주문 내역", + "operationId": "getOrderHistory_1", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "selectOrderRequest", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/SelectOrderRequest" + } + }, + { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "direction", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": ["ASC", "DESC"] + } + }, + { + "name": "properties", + "in": "query", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PageSelectOrdersResponseForHistory" + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "z8a93ggrrhhw1" + } + } + }, + "/v1/distribution/orders/purchase/{partnerCode}": { + "get": { + "tags": ["고객 주문(Order)"], + "summary": "주문내역", + "description": "수정필요", + "operationId": "getPurchaseOrder", + "parameters": [ + { + "name": "partnerCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "vgvzhpt7m569z" + } + } + }, + "/v1/distribution/buyers": { + "get": { + "tags": ["점포(Buyer)"], + "summary": "점포 조회", + "operationId": "getBuyers_1", + "parameters": [ + { + "name": "selectBuyerRequest", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/SelectBuyerRequest" + } + }, + { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "size", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "direction", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": ["ASC", "DESC"] + } + }, + { + "name": "properties", + "in": "query", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "object" + } + } + } + } + }, + "deprecated": true, + "x-stoplight": { + "id": "5na1hplyt07lg" + } + } + } + }, + "components": { + "schemas": { + "CartItemRequest": { + "required": ["amount", "buyerOrderComment", "isSelected", "option", "productSaleUnitId", "quantity"], + "type": "object", + "properties": { + "productSaleUnitId": { + "type": "integer", + "description": "상품 판매 단위 ID", + "format": "int64", + "example": 1209 + }, + "quantity": { + "type": "integer", + "description": "수량", + "format": "int32", + "example": 1 + }, + "amount": { + "type": "number", + "description": "중량", + "example": 0.4 + }, + "option": { + "type": "string", + "description": "상품 옵션", + "example": "BLEEDING", + "enum": ["BLEEDING", "WATER_PACK", "NONE", "COLD_PACK"] + }, + "isSaveOption": { + "type": "boolean", + "description": "상품 옵션 저장 여부", + "example": true + }, + "isSelected": { + "type": "boolean", + "example": true + }, + "buyerOrderComment": { + "type": "string", + "example": "캐나다산 우니 없으면 미입고 해주세요" + } + }, + "x-stoplight": { + "id": "th1iavkplw10y" + } + }, + "GetCartItemListResponse": { + "x-stoplight": { + "id": "qrs1xhm0vvdwv" + }, + "properties": { + "cartItemId": { + "type": "integer", + "format": "int64", + "example": 411 + }, + "productId": { + "type": "integer", + "format": "int64", + "example": 1002 + }, + "productSaleUnitId": { + "type": "integer", + "format": "int64", + "example": 1209 + }, + "isPriceInquiry": { + "type": "boolean", + "example": false + }, + "quantity": { + "type": "integer", + "format": "int32", + "example": 1 + }, + "minQty": { + "type": "integer", + "format": "int32", + "example": 1 + }, + "amount": { + "type": "number", + "example": 0.4 + }, + "productLabel": { + "type": "string", + "example": "국산 제주 광어 400~500g" + }, + "productType": { + "type": "string", + "example": "LIVE", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "saleUnit": { + "type": "string", + "example": "kg", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "calcUnit": { + "type": "string", + "example": "kg", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "option": { + "type": "string", + "example": "BLEEDING", + "enum": ["BLEEDING", "WATER_PACK", "NONE", "COLD_PACK"] + }, + "unitPrice": { + "type": "number", + "example": 5360 + }, + "isOrderAvailable": { + "type": "boolean", + "example": true + }, + "isSelected": { + "type": "boolean", + "example": true + }, + "isSaveOption": { + "type": "boolean", + "example": true + }, + "buyerOrderComment": { + "type": "string", + "example": "캐나다산 우니 없으면 미입고 해주세요" + }, + "deliveryType": { + "type": "string", + "example": "COLD", + "enum": ["COLD", "LIVE", "PARCEL", "ETC"] + } + }, + "description": "" + }, + "UpdatePackingFeeRequest": { + "required": ["packingFee"], + "type": "object", + "properties": { + "packingFee": { + "type": "boolean", + "example": true + } + }, + "x-stoplight": { + "id": "rfgitd5xgkcrh" + } + }, + "Unit": { + "type": "object", + "x-stoplight": { + "id": "dolk41kx3bcbk" + } + }, + "OrderEntryIds": { + "required": ["ids"], + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + }, + "x-stoplight": { + "id": "u8gp01cre2743" + } + }, + "ManagerRequest": { + "required": ["cellular", "dmlStatus", "id", "memberEmail", "memberId", "name", "phone", "role", "status"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "memberId": { + "type": "string" + }, + "memberEmail": { + "type": "string" + }, + "cellular": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "role": { + "type": "string", + "enum": ["OWNER", "MANAGER", "CLERK"] + }, + "dmlStatus": { + "type": "string", + "enum": ["ADD", "UPDATE", "DELETE", "NOTHING"] + } + }, + "x-stoplight": { + "id": "j8v98olhfbldp" + } + }, + "ReorderFavoriteRequest": { + "required": ["id", "seq"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "seq": { + "type": "integer", + "format": "int64" + } + }, + "x-stoplight": { + "id": "kshxdgnxgavft" + } + }, + "DeliveryNoteAttachmentRequest": { + "required": ["comment", "dmlStatus", "file", "id", "seq"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 123 + }, + "comment": { + "type": "string", + "example": "와우123" + }, + "dmlStatus": { + "type": "string", + "example": "NOTHING", + "enum": ["ADD", "UPDATE", "DELETE", "NOTHING"] + }, + "file": { + "$ref": "#/components/schemas/FileRequest" + }, + "seq": { + "type": "integer", + "format": "int32", + "example": 1 + } + }, + "x-stoplight": { + "id": "qoqg71ox7ru6t" + } + }, + "DeliveryNoteRequest": { + "required": ["attachments", "deliveryNote"], + "type": "object", + "properties": { + "deliveryNote": { + "type": "string", + "example": "테스트 주문입니다.\n테스트테스트..32123" + }, + "attachments": { + "uniqueItems": true, + "type": "array", + "items": { + "$ref": "#/components/schemas/DeliveryNoteAttachmentRequest" + } + } + }, + "x-stoplight": { + "id": "ibvvr6zb72vg0" + } + }, + "FileRequest": { + "required": ["contentType", "data", "id", "name", "path"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 477 + }, + "data": { + "type": "string", + "example": "06.jpg" + }, + "name": { + "type": "string", + "example": "image/jpeg" + }, + "path": { + "type": "string", + "example": "member-review-images/s3_873A659D15_20220412112155692478_1" + }, + "contentType": { + "type": "string", + "example": "image/jpeg" + } + }, + "x-stoplight": { + "id": "vclbpr1cqd2p7" + } + }, + "Address": { + "required": ["excelAddress", "fullAddress", "location", "street"], + "type": "object", + "properties": { + "street": { + "type": "string" + }, + "location": { + "type": "string" + }, + "zipCode": { + "type": "string" + }, + "fullAddress": { + "type": "string" + }, + "excelAddress": { + "type": "string" + } + }, + "x-stoplight": { + "id": "oo9hvprty9vs6" + } + }, + "ReOrderRequest": { + "required": ["orderEntryId"], + "type": "object", + "properties": { + "orderEntryId": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + }, + "x-stoplight": { + "id": "2wknbza8lbs1i" + } + }, + "CartOrderRequest": { + "required": ["cartId", "cartItemIds", "deliveryDate", "orderedByAdmin", "todayDeliveryNote", "totalOrderPrice"], + "type": "object", + "properties": { + "cartId": { + "type": "integer", + "format": "int64" + }, + "cartItemIds": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "deliveryDate": { + "type": "string", + "format": "date-time" + }, + "todayDeliveryNote": { + "type": "string" + }, + "orderedByAdmin": { + "type": "boolean" + }, + "totalOrderPrice": { + "type": "number" + } + }, + "x-stoplight": { + "id": "gsrfynwexts0l" + } + }, + "AbstractBuyTempHistory": { + "required": [ + "amount", + "buyCheckQuantityForExcel", + "buyHistories", + "buyNeedQuantityForExcel", + "buyStatus", + "createdAt", + "deleted", + "id", + "needQuantity", + "orderEntry", + "orderedQuantity", + "quantity", + "sort_BY_CREATED_AT_DESC", + "status", + "tempHistoryType" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "number" + }, + "orderEntry": { + "$ref": "#/components/schemas/OrderEntry" + }, + "historyType": { + "type": "string", + "writeOnly": true, + "enum": ["RECEIVE_IN_STOCK", "RECEIVE_BUY", "CHECK_IN_STOCK", "CHECK_BUY"] + }, + "buyHistories": { + "$ref": "#/components/schemas/BuyHistoryList" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "tempHistoryType": { + "type": "string", + "enum": ["RECEIVE_IN_STOCK", "RECEIVE_BUY", "CHECK_IN_STOCK", "CHECK_BUY"] + }, + "stock": { + "$ref": "#/components/schemas/AbstractStock" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "buyStatus": { + "type": "boolean" + }, + "needQuantity": { + "type": "integer", + "format": "int32" + }, + "buyNeedQuantityForExcel": { + "type": "integer", + "format": "int32" + }, + "buyCheckQuantityForExcel": { + "type": "integer", + "format": "int32" + }, + "orderedQuantity": { + "type": "integer", + "format": "int32" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "i6gj5mhsn8wr5" + } + }, + "AbstractStock": { + "required": [ + "amount", + "basicUnit", + "checkInStockAvailableAmount", + "checkInStockAvailableQuantity", + "checkInStockAvailableQuantityForResponse", + "checkInStockTotalAmount", + "checkInStockTotalQuantity", + "childList", + "createdAt", + "deleted", + "firstReceiveDate", + "id", + "isExhausted", + "label", + "parentsStock", + "price", + "priceUnit", + "productList", + "quantity", + "remainReceiveQuantity", + "sort_BY_CREATED_AT_DESC", + "stockGrade", + "stockHistoryList", + "stockNote", + "stockType", + "tempHistories", + "totalAmount", + "totalQuantity", + "tradeCompanyImporter", + "tradeCompanySeller", + "wareHouseAndWarehouseInventoryAndWarehouseAgencyLabel", + "wareHouseAndWarehouseInventoryLabel", + "warehouseInventory" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "stockGrade": { + "$ref": "#/components/schemas/StockGrade" + }, + "firstReceiveDate": { + "type": "string", + "format": "date" + }, + "label": { + "type": "string" + }, + "warehouseInventory": { + "$ref": "#/components/schemas/WarehouseInventory" + }, + "tradeCompanySeller": { + "$ref": "#/components/schemas/TradeCompany" + }, + "tradeCompanyImporter": { + "$ref": "#/components/schemas/TradeCompany" + }, + "stockHistoryList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StockHistory" + } + }, + "stockNote": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StockNote" + } + }, + "priceUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "price": { + "type": "number" + }, + "basicUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "number" + }, + "productList": { + "uniqueItems": true, + "type": "array", + "items": { + "$ref": "#/components/schemas/StockProduct" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "stockType": { + "type": "string", + "enum": ["BUNDLE", "BASIC"] + }, + "tempHistories": { + "$ref": "#/components/schemas/StockTempHistoryList" + }, + "parents": { + "$ref": "#/components/schemas/AbstractStock" + }, + "childList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AbstractStock" + } + }, + "isExhausted": { + "type": "boolean" + }, + "checkInStockAvailableQuantityForResponse": { + "type": "integer", + "format": "int32" + }, + "wareHouseAndWarehouseInventoryAndWarehouseAgencyLabel": { + "type": "string" + }, + "stockQtyPerUnit": { + "type": "integer", + "format": "int32" + }, + "remainReceiveQuantity": { + "type": "boolean" + }, + "bundleUnits": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "totalAmount": { + "type": "number" + }, + "totalQuantity": { + "type": "integer", + "format": "int32" + }, + "parentsStock": { + "$ref": "#/components/schemas/AbstractStock" + }, + "checkInStockTotalAmount": { + "type": "number" + }, + "checkInStockTotalQuantity": { + "type": "integer", + "format": "int32" + }, + "wareHouseAndWarehouseInventoryLabel": { + "type": "string" + }, + "checkInStockAvailableAmount": { + "type": "number" + }, + "checkInStockAvailableQuantity": { + "type": "integer", + "format": "int32" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "8a840g1cj61si" + } + }, + "AbstractTempHistory": { + "required": [ + "amount", + "createdAt", + "deleted", + "id", + "orderEntry", + "orderedQuantity", + "quantity", + "sort_BY_CREATED_AT_DESC", + "status", + "tempHistoryType" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "number" + }, + "orderEntry": { + "$ref": "#/components/schemas/OrderEntry" + }, + "tempHistoryType": { + "type": "string", + "enum": ["RECEIVE_IN_STOCK", "RECEIVE_BUY", "CHECK_IN_STOCK", "CHECK_BUY"] + }, + "stock": { + "$ref": "#/components/schemas/AbstractStock" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "orderedQuantity": { + "type": "integer", + "format": "int32" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "qo4nt5irxxikq" + } + }, + "Amount": { + "required": ["ordered"], + "type": "object", + "properties": { + "ordered": { + "type": "number" + }, + "measured": { + "type": "number" + } + }, + "x-stoplight": { + "id": "op8blg9ultkyg" + } + }, + "BuyHistory": { + "required": [ + "amount", + "buyTempHistory", + "createdAt", + "deleted", + "excessAmount", + "excessQuantity", + "id", + "importer", + "orderEntryId", + "price", + "priceUnit", + "quantity", + "sort_BY_CREATED_AT_DESC", + "warehouseInventory" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "number" + }, + "importer": { + "$ref": "#/components/schemas/TradeCompany" + }, + "price": { + "type": "number" + }, + "excessQuantity": { + "type": "integer", + "format": "int32" + }, + "excessAmount": { + "type": "number" + }, + "warehouseInventory": { + "$ref": "#/components/schemas/WarehouseInventory" + }, + "buyTempHistory": { + "$ref": "#/components/schemas/AbstractBuyTempHistory" + }, + "priceUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "stock": { + "$ref": "#/components/schemas/AbstractStock" + }, + "orderEntryId": { + "type": "integer", + "format": "int64" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "625pv004pwv1f" + } + }, + "BuyHistoryList": { + "required": [ + "buyHistories", + "buyHistoriesAmount", + "buyHistoriesExcessAmount", + "buyHistoriesExcessQuantity", + "buyHistoriesQuantity", + "empty", + "notEmpty" + ], + "type": "object", + "properties": { + "buyHistories": { + "uniqueItems": true, + "type": "array", + "items": { + "$ref": "#/components/schemas/BuyHistory" + } + }, + "empty": { + "type": "boolean" + }, + "buyHistoriesAmount": { + "type": "number" + }, + "notEmpty": { + "type": "boolean" + }, + "buyHistoriesQuantity": { + "type": "integer", + "format": "int32" + }, + "buyHistoriesExcessAmount": { + "type": "number" + }, + "buyHistoriesExcessQuantity": { + "type": "integer", + "format": "int32" + } + }, + "x-stoplight": { + "id": "a1v97km93fx9v" + } + }, + "Buyer": { + "required": [ + "address", + "businessLicenseCompanyName", + "businessNumber", + "buyerNotes", + "classAutoSetting", + "createdAt", + "deleted", + "deliveryNote", + "deliveryTime", + "dormantCount", + "id", + "isAutoDormant", + "isParcel", + "isSundayDelivery", + "label", + "lastMontOrderPrice", + "managerList", + "marginClass", + "marginClassSettingDate", + "mobileNumber", + "owner", + "partnerCode", + "paymentMethod", + "phoneNumber", + "productList", + "sendOrderAlarmTime", + "sort_BY_CREATED_AT_DESC", + "status", + "storeType", + "tpiratesManager" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "deliveryNote": { + "$ref": "#/components/schemas/DeliveryNote" + }, + "buyerNotes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BuyerNote" + } + }, + "businessLicenseCompanyName": { + "type": "string" + }, + "isParcel": { + "type": "boolean" + }, + "buyerGroupId": { + "type": "integer", + "format": "int64" + }, + "douzoneCode": { + "type": "string" + }, + "classAutoSetting": { + "type": "boolean" + }, + "isSundayDelivery": { + "type": "boolean" + }, + "marginClass": { + "$ref": "#/components/schemas/MarginClass" + }, + "marginClassSettingDate": { + "type": "string", + "format": "date-time" + }, + "lastMontOrderPrice": { + "type": "integer", + "format": "int64" + }, + "sendOrderAlarmTime": { + "type": "object", + "example": {} + }, + "paymentMethod": { + "type": "string", + "enum": ["PRE", "POST"] + }, + "storeType": { + "type": "string", + "enum": ["MARKETSTORE", "GENERALSTORE"] + }, + "deliveryTime": { + "type": "string", + "enum": ["DAY", "NIGHT", "REALTIME", "PARCEL"] + }, + "tpiratesManager": { + "$ref": "#/components/schemas/TpiratesManager" + }, + "productList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BuyerProduct" + } + }, + "managerList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BuyerManager" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "label": { + "type": "string" + }, + "businessNumber": { + "type": "string" + }, + "address": { + "$ref": "#/components/schemas/Address" + }, + "phoneNumber": { + "type": "string" + }, + "mobileNumber": { + "type": "string" + }, + "partnerCode": { + "type": "string" + }, + "isAutoDormant": { + "type": "boolean" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE", "DORMANT"] + }, + "dormantDate": { + "type": "string", + "format": "date" + }, + "dormantCount": { + "type": "integer", + "format": "int32" + }, + "dormantMessageSendDate": { + "type": "string", + "format": "date" + }, + "owner": { + "$ref": "#/components/schemas/BuyerManager" + }, + "businessManagerCode": { + "type": "string" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "q5hzol3ko2e1k" + } + }, + "BuyerManager": { + "required": [ + "active", + "cellular", + "createdAt", + "deleted", + "id", + "manager", + "name", + "partner", + "phone", + "role", + "sort_BY_CREATED_AT_DESC", + "status" + ], + "type": "object", + "properties": { + "partner": { + "$ref": "#/components/schemas/Buyer" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "manager": { + "$ref": "#/components/schemas/Member" + }, + "name": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "phone": { + "type": "string" + }, + "cellular": { + "type": "string" + }, + "role": { + "type": "string", + "enum": ["OWNER", "MANAGER", "CLERK"] + }, + "active": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "vv29kbnizsh1z" + } + }, + "BuyerNote": { + "required": ["buyer", "createdAt", "deleted", "id", "note", "sort_BY_CREATED_AT_DESC", "writer"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "note": { + "type": "string" + }, + "writer": { + "$ref": "#/components/schemas/Member" + }, + "buyer": { + "$ref": "#/components/schemas/Buyer" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "diht2umccs3bc" + } + }, + "BuyerProduct": { + "required": ["buyer", "createdAt", "deleted", "id", "product", "sort_BY_CREATED_AT_DESC"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "buyer": { + "$ref": "#/components/schemas/Buyer" + }, + "product": { + "$ref": "#/components/schemas/Product" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "qze2o3j9mdk7t" + } + }, + "CheckBuyTempHistory": { + "required": [ + "amount", + "buyCheckQuantityForExcel", + "buyHistories", + "buyNeedQuantityForExcel", + "buyStatus", + "comment", + "createdAt", + "deleted", + "id", + "needQuantity", + "orderEntry", + "orderedQuantity", + "quantity", + "sort_BY_CREATED_AT_DESC", + "status", + "tempHistoryType" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "number" + }, + "orderEntry": { + "$ref": "#/components/schemas/OrderEntry" + }, + "buyHistories": { + "$ref": "#/components/schemas/BuyHistoryList" + }, + "comment": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "tempHistoryType": { + "type": "string", + "enum": ["RECEIVE_IN_STOCK", "RECEIVE_BUY", "CHECK_IN_STOCK", "CHECK_BUY"] + }, + "stock": { + "$ref": "#/components/schemas/AbstractStock" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "buyStatus": { + "type": "boolean" + }, + "needQuantity": { + "type": "integer", + "format": "int32" + }, + "buyNeedQuantityForExcel": { + "type": "integer", + "format": "int32" + }, + "buyCheckQuantityForExcel": { + "type": "integer", + "format": "int32" + }, + "orderedQuantity": { + "type": "integer", + "format": "int32" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "2skkbpl9tmdrs" + } + }, + "CheckInStockTempHistory": { + "required": [ + "amount", + "comment", + "createdAt", + "deleted", + "id", + "isForced", + "orderEntry", + "orderedQuantity", + "packingLoc", + "packingPrice", + "quantity", + "sort_BY_CREATED_AT_DESC", + "status", + "tempHistoryType" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "number" + }, + "orderEntry": { + "$ref": "#/components/schemas/OrderEntry" + }, + "stock": { + "$ref": "#/components/schemas/AbstractStock" + }, + "isForced": { + "type": "boolean" + }, + "packingLoc": { + "type": "string" + }, + "packingPrice": { + "type": "string" + }, + "comment": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "tempHistoryType": { + "type": "string", + "enum": ["RECEIVE_IN_STOCK", "RECEIVE_BUY", "CHECK_IN_STOCK", "CHECK_BUY"] + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "orderedQuantity": { + "type": "integer", + "format": "int32" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "wbs9eb35e1ixu" + } + }, + "DeliveryNote": { + "required": ["attachments", "deliveryNote", "new"], + "type": "object", + "properties": { + "deliveryNoteModifiedAt": { + "type": "string", + "format": "date-time" + }, + "deliveryNote": { + "type": "string" + }, + "attachments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DeliveryNoteAttachment" + } + }, + "new": { + "type": "boolean" + } + }, + "x-stoplight": { + "id": "drt9gxmtgv72z" + } + }, + "DeliveryNoteAttachment": { + "required": [ + "buyer", + "comment", + "contentType", + "createdAt", + "deleted", + "file", + "id", + "name", + "path", + "seq", + "sort_BY_CREATED_AT_DESC" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "comment": { + "type": "string" + }, + "seq": { + "type": "integer", + "format": "int32" + }, + "buyer": { + "$ref": "#/components/schemas/Buyer" + }, + "file": { + "$ref": "#/components/schemas/FileEntity" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "contentType": { + "type": "string" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "h2c9g5pp97zoz" + } + }, + "DeliveryPolicy": { + "required": ["description", "priceData", "priceType", "type"], + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "배송유형", + "example": "PIRATES", + "enum": ["DIRECT", "PIRATES", "PARCEL"] + }, + "description": { + "type": "string", + "description": "배송정책", + "example": "배송정책" + }, + "priceType": { + "type": "string", + "description": "배송가격", + "example": "FEE", + "enum": ["FREE", "CONDITIONAL", "UNIT", "FEE"] + }, + "priceData": { + "type": "string", + "description": "배송가격정보", + "example": "배송가격정보" + } + }, + "x-stoplight": { + "id": "n4t45g7t4z4jv" + } + }, + "DeliveryVehicle": { + "required": [ + "createdAt", + "deleted", + "deliveryTime", + "deliveryType", + "id", + "label", + "productType", + "shortLabel", + "sort_BY_CREATED_AT_DESC" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "label": { + "type": "string" + }, + "shortLabel": { + "type": "string" + }, + "deliveryTime": { + "type": "string", + "enum": ["DAY", "NIGHT", "REALTIME", "PARCEL"] + }, + "productType": { + "type": "string", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "deliveryType": { + "type": "string", + "enum": ["DIRECT", "PIRATES", "PARCEL"] + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "gw3lcyngfizp1" + } + }, + "FileEntity": { + "required": ["contentType", "createdAt", "deleted", "id", "name", "path", "sort_BY_CREATED_AT_DESC"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "contentType": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "gq1vzpii8qy01" + } + }, + "Item": { + "required": [ + "category", + "createdAt", + "deleted", + "id", + "itemGradeList", + "label", + "marginItemList", + "origin", + "raised", + "region", + "seq", + "sort_BY_CREATED_AT_DESC", + "status", + "stockGradeList", + "tag" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "category": { + "$ref": "#/components/schemas/ItemCategory" + }, + "label": { + "type": "string" + }, + "nickname": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "origin": { + "type": "string" + }, + "raised": { + "type": "string", + "enum": ["자연산", "양식", ""] + }, + "region": { + "type": "string" + }, + "saleUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "tag": { + "type": "string" + }, + "seq": { + "type": "integer", + "format": "int32" + }, + "itemGroup": { + "$ref": "#/components/schemas/ItemGroup" + }, + "itemGradeList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemGrade" + } + }, + "stockGradeList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StockGrade" + } + }, + "marginItemList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarginItem" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "5f5w0l9ob67w8" + } + }, + "ItemCategory": { + "required": [ + "createdAt", + "deleted", + "id", + "itemList", + "label", + "marginItemList", + "seq", + "sort_BY_CREATED_AT_DESC", + "status" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "label": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "seq": { + "type": "integer", + "format": "int32" + }, + "marginItemList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarginItem" + } + }, + "itemList": { + "uniqueItems": true, + "type": "array", + "items": { + "$ref": "#/components/schemas/Item" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "rs6g6jwkuidpe" + } + }, + "ItemGrade": { + "required": [ + "createdAt", + "deleted", + "dummyGrade", + "id", + "item", + "label", + "marginItemList", + "productList", + "seq", + "sort_BY_CREATED_AT_DESC", + "status" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "item": { + "$ref": "#/components/schemas/Item" + }, + "label": { + "type": "string" + }, + "seq": { + "type": "integer", + "format": "int32" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "dummyGrade": { + "type": "boolean" + }, + "productList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Product" + } + }, + "marginItemList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarginItem" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "81rsgegcauh3y" + } + }, + "ItemGroup": { + "required": ["createdAt", "deleted", "id", "itemList", "label", "marginItemList", "sort_BY_CREATED_AT_DESC"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "label": { + "type": "string" + }, + "itemList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Item" + } + }, + "marginItemList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarginItem" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "162z5f3pa0t7h" + } + }, + "Margin": { + "required": ["price", "rate", "status"], + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": ["PRICE", "RATE"] + }, + "price": { + "type": "number" + }, + "rate": { + "type": "number" + } + }, + "x-stoplight": { + "id": "zqhmj6kcb57o0" + } + }, + "MarginClass": { + "required": [ + "autoClassSet", + "autoClassSetMode", + "createdAt", + "deleted", + "id", + "isColdDeliveryFeeCharge", + "isLiveDeliveryFeeCharge", + "isPackingFeeCharged", + "isRegularMarginClass", + "label", + "margin", + "marginItemList", + "packingFee", + "showPriceFlag", + "sort_BY_CREATED_AT_DESC", + "status", + "storeType", + "totalPaymentMax", + "totalPaymentMin" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "label": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["INUSE", "UNUSED"] + }, + "storeType": { + "type": "string", + "enum": ["MARKETSTORE", "GENERALSTORE"] + }, + "autoClassSet": { + "type": "boolean" + }, + "autoClassSetMode": { + "type": "string", + "enum": ["PAYMENTAMOUNT", "NONE"] + }, + "totalPaymentMin": { + "type": "integer", + "format": "int64" + }, + "totalPaymentMax": { + "type": "integer", + "format": "int64" + }, + "showPriceFlag": { + "type": "boolean" + }, + "isPackingFeeCharged": { + "type": "boolean" + }, + "isLiveDeliveryFeeCharge": { + "type": "boolean" + }, + "isColdDeliveryFeeCharge": { + "type": "boolean" + }, + "packingFee": { + "type": "number" + }, + "margin": { + "$ref": "#/components/schemas/Margin" + }, + "marginItemList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarginItem" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "isRegularMarginClass": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "0habb7io9rfpb" + } + }, + "MarginItem": { + "required": ["createdAt", "deleted", "id", "kind", "margin", "sort_BY_CREATED_AT_DESC"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "kind": { + "type": "string", + "enum": ["CATEGORY", "ITEM_GROUP"] + }, + "itemCategory": { + "$ref": "#/components/schemas/ItemCategory" + }, + "item": { + "$ref": "#/components/schemas/Item" + }, + "itemGrade": { + "$ref": "#/components/schemas/ItemGrade" + }, + "productSaleUnit": { + "$ref": "#/components/schemas/ProductSaleUnit" + }, + "itemGroup": { + "$ref": "#/components/schemas/ItemGroup" + }, + "margin": { + "$ref": "#/components/schemas/Margin" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "19fuu1x30uyn4" + } + }, + "Member": { + "required": ["email", "id"], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "x-stoplight": { + "id": "7saec6ovbpsvx" + } + }, + "Order": { + "required": [ + "buyer", + "calculated", + "createdAt", + "deleted", + "deliveryDate", + "entries", + "id", + "isPacking", + "orderCode", + "orderDate", + "orderer", + "packingFee", + "price", + "remark", + "sort_BY_CREATED_AT_DESC", + "status", + "todayDeliveryNote" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "buyer": { + "$ref": "#/components/schemas/Buyer" + }, + "orderer": { + "$ref": "#/components/schemas/BuyerManager" + }, + "orderCode": { + "type": "string" + }, + "price": { + "$ref": "#/components/schemas/OrderPrice" + }, + "orderDate": { + "type": "string", + "format": "date-time" + }, + "deliveryDate": { + "type": "string", + "format": "date-time" + }, + "remark": { + "type": "string", + "enum": ["COLD_LIVE", "COLD", "LIVE", "SUCCESS"] + }, + "status": { + "type": "string", + "enum": ["PREPARED", "PROGRESS", "COMPLETED", "CANCELED"] + }, + "todayDeliveryNote": { + "type": "string" + }, + "entries": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrderEntry" + } + }, + "deliveryTime": { + "type": "string", + "enum": ["DAY", "NIGHT", "REALTIME", "PARCEL"] + }, + "calculated": { + "type": "boolean" + }, + "isPacking": { + "type": "boolean" + }, + "packingFee": { + "type": "number" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "j2pr7ty61joxk" + } + }, + "OrderCompleteResponse": { + "required": ["orderCode"], + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/Order" + }, + "orderCode": { + "type": "string" + } + }, + "x-stoplight": { + "id": "g6d48c6iupkz5" + } + }, + "OrderConstraints": { + "required": ["minQty", "orderUnit"], + "type": "object", + "properties": { + "minQty": { + "type": "integer", + "format": "int32", + "example": 1 + }, + "orderUnit": { + "type": "integer", + "format": "int32", + "example": 1 + } + }, + "x-stoplight": { + "id": "tjt9bmyogklom" + } + }, + "OrderEntry": { + "required": [ + "amount", + "amountUnit", + "calcUnit", + "checkAmount", + "checkNeedInStockQuantity", + "checkQuantityDivQtyPerUnit", + "createdAt", + "deleted", + "deliveryVehicle", + "deliveryVehicleType", + "id", + "isCheckSatisfied", + "isDelayed", + "isPriceInquiry", + "isReceiveComplete", + "isReceiveSatisfied", + "margin", + "order", + "orderEntryCode", + "orderEntryNoteList", + "orderedPriceByIsPriceInquiry", + "ordererType", + "origin", + "price", + "productLabel", + "productOption", + "productSaleUnit", + "productType", + "qtyPerUnit", + "quantityForStockManagement", + "quantityForViewAndPricing", + "raised", + "receiveNeedAmount", + "receiveNeedQuantity", + "region", + "regionOrOriginIfRegionIsEmpty", + "saleUnit", + "sort_BY_CREATED_AT_DESC", + "status", + "stockRemainQuantity", + "tempHistories", + "unitPrice", + "weightProduct" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "order": { + "$ref": "#/components/schemas/Order" + }, + "orderEntryCode": { + "type": "string" + }, + "productSaleUnit": { + "$ref": "#/components/schemas/ProductSaleUnit" + }, + "quantity": { + "type": "integer", + "format": "int32", + "writeOnly": true + }, + "margin": { + "type": "number" + }, + "unitPrice": { + "type": "number" + }, + "price": { + "$ref": "#/components/schemas/OrderEntryPrice" + }, + "status": { + "type": "string", + "enum": [ + "PREPARED", + "RECEPTION", + "WEIGHT_CHECK", + "QUANTITY_CHECK", + "BUY_CHECK", + "READY", + "WEIGHT_READY", + "QUANTITY_READY", + "BUY_READY", + "WEIGHT_COMPLETE", + "QUANTITY_COMPLETE", + "BUY_COMPLETE", + "COMPLETE", + "CANCELED" + ] + }, + "delayComment": { + "type": "string" + }, + "productOption": { + "type": "string", + "enum": ["BLEEDING", "WATER_PACK", "NONE", "COLD_PACK"] + }, + "orderType": { + "type": "string", + "enum": ["NORMAL", "ADDITIONAL", "COMPENSATION"] + }, + "ordererType": { + "type": "string", + "enum": ["SALES_TEAM", "ADMIN", "BUYER"] + }, + "deliveryVehicle": { + "$ref": "#/components/schemas/DeliveryVehicle" + }, + "deliveryDate": { + "type": "string", + "format": "date-time" + }, + "deliveryTime": { + "type": "string", + "enum": ["DAY", "NIGHT", "REALTIME", "PARCEL"] + }, + "calcUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "saleUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "amountUnit": { + "type": "number" + }, + "parentsOrderEntryId": { + "type": "integer", + "format": "int64" + }, + "productLabel": { + "type": "string" + }, + "isDelayed": { + "type": "boolean" + }, + "productType": { + "type": "string" + }, + "qtyPerUnit": { + "type": "integer", + "format": "int32" + }, + "isBuyerCommentRead": { + "type": "boolean" + }, + "isPriceInquiry": { + "type": "boolean" + }, + "origin": { + "type": "string" + }, + "region": { + "type": "string" + }, + "raised": { + "type": "string", + "enum": ["자연산", "양식", ""] + }, + "productOptionLabel": { + "type": "boolean" + }, + "productOptionAddPrice": { + "type": "number" + }, + "productOptionAddDate": { + "type": "integer", + "format": "int32" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "amount": { + "$ref": "#/components/schemas/Amount" + }, + "orderEntryNoteList": { + "$ref": "#/components/schemas/OrderEntryNoteList" + }, + "tempHistories": { + "$ref": "#/components/schemas/OrderEntryTempHistoryList" + }, + "isReceiveSatisfied": { + "type": "boolean" + }, + "isCheckSatisfied": { + "type": "boolean" + }, + "pbsupplier": { + "type": "string" + }, + "stockRemainQuantity": { + "type": "integer", + "format": "int32" + }, + "isReceiveComplete": { + "type": "boolean" + }, + "deliveryVehicleType": { + "type": "string", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "stockBasicUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "stockBundleUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "stockQtyPerUnit": { + "type": "integer", + "format": "int32" + }, + "checkAmount": { + "type": "number" + }, + "estimatedPrice": { + "type": "number", + "writeOnly": true + }, + "priceUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "receiveNeedAmount": { + "type": "number" + }, + "receiveNeedQuantity": { + "type": "integer", + "format": "int32" + }, + "stockUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "weightProduct": { + "type": "boolean" + }, + "checkQuantityDivQtyPerUnit": { + "type": "integer", + "format": "int32" + }, + "checkNeedInStockQuantity": { + "type": "integer", + "format": "int32" + }, + "quantityForViewAndPricing": { + "type": "integer", + "format": "int32" + }, + "regionOrOriginIfRegionIsEmpty": { + "type": "string" + }, + "quantityForStockManagement": { + "type": "integer", + "format": "int32" + }, + "orderedPriceByIsPriceInquiry": { + "type": "number" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "39d990ll9x4iq" + } + }, + "OrderEntryNote": { + "required": ["comment", "commentWriter", "createdAt", "deleted", "id", "orderEntry", "sort_BY_CREATED_AT_DESC"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "orderEntry": { + "$ref": "#/components/schemas/OrderEntry" + }, + "parentsCommentId": { + "type": "integer", + "format": "int64" + }, + "comment": { + "type": "string" + }, + "commentWriter": { + "type": "string", + "enum": ["ADMIN", "BUYER"] + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "o9bw7vfm58hii" + } + }, + "OrderEntryNoteList": { + "required": ["notEmpty"], + "type": "object", + "properties": { + "orderEntryNotes": { + "type": "array", + "writeOnly": true, + "items": { + "$ref": "#/components/schemas/OrderEntryNote" + } + }, + "childComment": { + "$ref": "#/components/schemas/OrderEntryNote" + }, + "notEmpty": { + "type": "boolean" + }, + "parentCommnet": { + "$ref": "#/components/schemas/OrderEntryNote" + } + }, + "x-stoplight": { + "id": "vowmb5y0h4a2d" + } + }, + "OrderEntryPrice": { + "required": ["lastPrice", "lastPriceNotContainSettlementPrice", "ordered"], + "type": "object", + "properties": { + "ordered": { + "type": "number" + }, + "measured": { + "type": "number" + }, + "adjust": { + "type": "number" + }, + "settlement": { + "type": "number" + }, + "lastPrice": { + "type": "number" + }, + "lastPriceNotContainSettlementPrice": { + "type": "number" + } + }, + "x-stoplight": { + "id": "e1fyvyu1vlh9x" + } + }, + "OrderEntryTempHistoryList": { + "required": [ + "allBuyTempHistory", + "buyComplete", + "checkHistory", + "checkInStockAmount", + "checkInStockHistory", + "checkInStockInventoryList", + "checkInStockQuantity", + "checkTotalQuantity", + "lastTempHistory", + "notEmpty", + "receiveBuyTempAmount", + "receiveBuyTempQuantity", + "receiveHistory", + "receiveInStockAmount", + "receiveInStockHistory", + "receiveInStockQuantity", + "receiveTotalAmount", + "receiveTotalQuantity" + ], + "type": "object", + "properties": { + "receiveTotalQuantity": { + "type": "integer", + "format": "int32" + }, + "receiveTotalAmount": { + "type": "number" + }, + "checkTotalQuantity": { + "type": "integer", + "format": "int32" + }, + "buyComplete": { + "type": "boolean" + }, + "notEmpty": { + "type": "boolean" + }, + "receiveInStockHistory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReceiveInStockTempHistory" + } + }, + "receiveBuyTempAmount": { + "type": "number" + }, + "receiveBuyTempQuantity": { + "type": "integer", + "format": "int32" + }, + "checkInStockAmount": { + "type": "number" + }, + "checkInStockQuantity": { + "type": "integer", + "format": "int32" + }, + "receiveHistory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AbstractTempHistory" + } + }, + "checkHistory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AbstractTempHistory" + } + }, + "allBuyTempHistory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AbstractBuyTempHistory" + } + }, + "checkInStockHistory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CheckInStockTempHistory" + } + }, + "checkBuyHistory": { + "$ref": "#/components/schemas/CheckBuyTempHistory" + }, + "lastTempHistory": { + "$ref": "#/components/schemas/AbstractTempHistory" + }, + "receiveBuyTempHistory": { + "$ref": "#/components/schemas/AbstractBuyTempHistory" + }, + "receiveInStockAmount": { + "type": "number" + }, + "receiveInStockQuantity": { + "type": "integer", + "format": "int32" + }, + "checkInStockInventoryList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WarehouseInventory" + } + } + }, + "x-stoplight": { + "id": "r9onu9kyu3atz" + } + }, + "OrderPrice": { + "required": ["ordered"], + "type": "object", + "properties": { + "ordered": { + "type": "number" + }, + "settlement": { + "type": "number" + } + }, + "x-stoplight": { + "id": "6atdron8rgcop" + } + }, + "PriceData": { + "required": [ + "comment", + "createdAt", + "deleted", + "id", + "price", + "priceDate", + "productSaleUnit", + "sort_BY_CREATED_AT_DESC", + "todayData" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "priceDate": { + "type": "string", + "format": "date-time" + }, + "price": { + "type": "number" + }, + "comment": { + "type": "string" + }, + "productSaleUnit": { + "$ref": "#/components/schemas/ProductSaleUnit" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "todayData": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "0vr24ctzdx7xn" + } + }, + "Product": { + "required": [ + "attachments", + "buyers", + "comment", + "createdAt", + "deleted", + "deliveryType", + "excelExposureUnit", + "id", + "isPackingFeeCharged", + "isPriceInquiry", + "itemGrade", + "label", + "productOption", + "productOptionAssociate", + "productSaleUnit", + "productStatusReservation", + "productType", + "seller", + "sort_BY_CREATED_AT_DESC", + "status", + "stockList", + "surtax" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "status": { + "type": "string", + "enum": ["PREPARING", "ON_SALE", "STOPPED", "PRIVATE", "SOLD_OUT"] + }, + "itemGrade": { + "$ref": "#/components/schemas/ItemGrade" + }, + "label": { + "type": "string" + }, + "seller": { + "$ref": "#/components/schemas/Seller" + }, + "deliveryType": { + "type": "string", + "enum": ["DIRECT", "PIRATES", "PARCEL"] + }, + "productType": { + "type": "string", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "productOption": { + "type": "string", + "enum": ["BLEEDING", "WATER_PACK", "NONE", "COLD_PACK"] + }, + "surtax": { + "type": "string", + "enum": ["IMPOSE", "EXEMPT"] + }, + "comment": { + "type": "string" + }, + "isPriceInquiry": { + "type": "boolean" + }, + "productSaleUnit": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductSaleUnit" + } + }, + "productStatusReservation": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductStatusReservation" + } + }, + "attachments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductAttachment" + } + }, + "buyers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BuyerProduct" + } + }, + "isPackingFeeCharged": { + "type": "boolean" + }, + "excelExposureUnit": { + "type": "string", + "enum": ["SALE_UNIT", "CALC_UNIT"] + }, + "productOptionAssociate": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductAndProductOption" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "stockList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StockProduct" + } + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "8r92gvppomn4g" + } + }, + "ProductAndProductOption": { + "required": ["deleted", "id", "product", "productOption"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "deleted": { + "type": "boolean" + }, + "product": { + "$ref": "#/components/schemas/Product" + }, + "productOption": { + "$ref": "#/components/schemas/ProductOption" + } + }, + "x-stoplight": { + "id": "j26g46u6tf0wi" + } + }, + "ProductAttachment": { + "required": [ + "contentType", + "createdAt", + "deleted", + "file", + "id", + "imageType", + "name", + "path", + "product", + "sort_BY_CREATED_AT_DESC" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "product": { + "$ref": "#/components/schemas/Product" + }, + "imageType": { + "type": "string", + "enum": ["FULL_SIZE", "SMALL_SIZE", "THUMB_NAIL"] + }, + "file": { + "$ref": "#/components/schemas/FileEntity" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "contentType": { + "type": "string" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "t837ehttp2zt6" + } + }, + "ProductOption": { + "required": [ + "addedPriceWhenIsAddPriceTrue", + "appLabel", + "consoleLabel", + "createdAt", + "deleted", + "id", + "isAddDate", + "isAddPrice", + "isChangeProductType", + "productOptionAssociate", + "sort_BY_CREATED_AT_DESC", + "status" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "status": { + "type": "string", + "enum": ["ACTIVE", "INACTIVE"] + }, + "consoleLabel": { + "type": "string" + }, + "appLabel": { + "type": "string" + }, + "isAddPrice": { + "type": "boolean" + }, + "addedPrice": { + "type": "number" + }, + "isChangeProductType": { + "type": "boolean" + }, + "productType": { + "type": "string", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "isAddDate": { + "type": "boolean" + }, + "baseTime": { + "type": "object", + "example": {} + }, + "noBaseTimeAddDate": { + "type": "integer", + "format": "int32" + }, + "beforeAddDate": { + "type": "integer", + "format": "int32" + }, + "afterAddDate": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "productOptionAssociate": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductAndProductOption" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "addedPriceWhenIsAddPriceTrue": { + "type": "number" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "cumcccd19q8ci" + } + }, + "ProductPriceReservation": { + "required": [ + "afterPrice", + "beforePrice", + "createdAt", + "deleted", + "id", + "productSaleUnit", + "reservationDateTime", + "reservationStatus", + "sort_BY_CREATED_AT_DESC" + ], + "type": "object", + "properties": { + "price": { + "type": "number", + "writeOnly": true + }, + "productSaleUnit": { + "$ref": "#/components/schemas/ProductSaleUnit" + }, + "reservationDateTime": { + "type": "string", + "format": "date-time" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "reservationStatus": { + "type": "string", + "enum": ["PREPARING", "PROGRESS", "REPEAT", "COMPLETED"] + }, + "productStatusReservation": { + "$ref": "#/components/schemas/ProductStatusReservation" + }, + "productPriceReservation": { + "$ref": "#/components/schemas/ProductPriceReservation" + }, + "beforePrice": { + "type": "number" + }, + "afterPrice": { + "type": "number" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "0b4gj8do8lwgy" + } + }, + "ProductSaleUnit": { + "required": [ + "amountUnit", + "calcUnit", + "constraints", + "createdAt", + "deleted", + "id", + "itemCategoryId", + "itemGradeId", + "itemId", + "marginItemList", + "price", + "priceDataList", + "product", + "qtyPerUnit", + "saleUnit", + "sort_BY_CREATED_AT_DESC", + "weightProduct" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "product": { + "$ref": "#/components/schemas/Product" + }, + "saleUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "douzoneCode": { + "type": "string" + }, + "amountUnit": { + "type": "number" + }, + "calcUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "price": { + "type": "number" + }, + "qtyPerUnit": { + "type": "integer", + "format": "int32" + }, + "constraints": { + "$ref": "#/components/schemas/OrderConstraints" + }, + "priceDataList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PriceData" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "marginItemList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarginItem" + } + }, + "itemId": { + "type": "integer", + "format": "int64" + }, + "todayPriceData": { + "$ref": "#/components/schemas/PriceData" + }, + "lastPriceData": { + "$ref": "#/components/schemas/PriceData" + }, + "itemGroupId": { + "type": "integer", + "format": "int64" + }, + "itemCategoryId": { + "type": "integer", + "format": "int64" + }, + "itemGradeId": { + "type": "integer", + "format": "int64" + }, + "weightProduct": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "js4kuwoc6zoqr" + } + }, + "ProductStatusReservation": { + "required": [ + "alterStatus", + "createdAt", + "curStatus", + "dateFlag", + "deleted", + "endTimeFlag", + "endTimeIsNextDay", + "id", + "product", + "reservationStatus", + "sort_BY_CREATED_AT_DESC", + "startTime", + "timeFlag" + ], + "type": "object", + "properties": { + "product": { + "$ref": "#/components/schemas/Product" + }, + "date": { + "type": "string", + "format": "date" + }, + "startTime": { + "type": "object", + "example": {} + }, + "endTime": { + "type": "object", + "example": {} + }, + "curStatus": { + "type": "string", + "enum": ["PREPARING", "ON_SALE", "STOPPED", "PRIVATE", "SOLD_OUT"] + }, + "alterStatus": { + "type": "string", + "enum": ["PREPARING", "ON_SALE", "STOPPED", "PRIVATE", "SOLD_OUT"] + }, + "dateFlag": { + "type": "boolean" + }, + "endTimeFlag": { + "type": "boolean" + }, + "timeFlag": { + "type": "boolean" + }, + "endTimeIsNextDay": { + "type": "boolean" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "reservationStatus": { + "type": "string", + "enum": ["PREPARING", "PROGRESS", "REPEAT", "COMPLETED"] + }, + "productStatusReservation": { + "$ref": "#/components/schemas/ProductStatusReservation" + }, + "productPriceReservation": { + "$ref": "#/components/schemas/ProductPriceReservation" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "rbvg1cqj9fnvw" + } + }, + "ReceiveInStockTempHistory": { + "required": [ + "amount", + "createdAt", + "deleted", + "id", + "orderEntry", + "orderedQuantity", + "quantity", + "sort_BY_CREATED_AT_DESC", + "status", + "tempHistoryType" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "number" + }, + "orderEntry": { + "$ref": "#/components/schemas/OrderEntry" + }, + "stock": { + "$ref": "#/components/schemas/AbstractStock" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "tempHistoryType": { + "type": "string", + "enum": ["RECEIVE_IN_STOCK", "RECEIVE_BUY", "CHECK_IN_STOCK", "CHECK_BUY"] + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "orderedQuantity": { + "type": "integer", + "format": "int32" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "tki3s4x06env8" + } + }, + "Seller": { + "required": [ + "address", + "businessNumber", + "createdAt", + "deleted", + "deliveryPolicy", + "deliveryZones", + "id", + "isAutoDormant", + "label", + "managerList", + "mobileNumber", + "owner", + "partnerCode", + "phoneNumber", + "products", + "sort_BY_CREATED_AT_DESC", + "status" + ], + "type": "object", + "properties": { + "deliveryZones": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SellerDeliveryZone" + } + }, + "deliveryPolicy": { + "$ref": "#/components/schemas/DeliveryPolicy" + }, + "products": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Product" + } + }, + "managerList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SellerManager" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "label": { + "type": "string" + }, + "businessNumber": { + "type": "string" + }, + "address": { + "$ref": "#/components/schemas/Address" + }, + "phoneNumber": { + "type": "string" + }, + "mobileNumber": { + "type": "string" + }, + "partnerCode": { + "type": "string" + }, + "isAutoDormant": { + "type": "boolean" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE", "DORMANT"] + }, + "owner": { + "$ref": "#/components/schemas/SellerManager" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "xh26bco5nj3c8" + } + }, + "SellerDeliveryZone": { + "required": ["createdAt", "deleted", "id", "label", "seller", "seq", "sort_BY_CREATED_AT_DESC", "status"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "seller": { + "$ref": "#/components/schemas/Seller" + }, + "label": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "seq": { + "type": "integer", + "format": "int32" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "u5shges1ouucc" + } + }, + "SellerManager": { + "required": [ + "cellular", + "createdAt", + "deleted", + "id", + "manager", + "name", + "partner", + "phone", + "role", + "sort_BY_CREATED_AT_DESC", + "status" + ], + "type": "object", + "properties": { + "partner": { + "$ref": "#/components/schemas/Seller" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "manager": { + "$ref": "#/components/schemas/Member" + }, + "name": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "phone": { + "type": "string" + }, + "cellular": { + "type": "string" + }, + "role": { + "type": "string", + "enum": ["OWNER", "MANAGER", "CLERK"] + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "lsppeu2d9asd0" + } + }, + "SortObject": { + "type": "object", + "properties": { + "empty": { + "type": "boolean" + }, + "sorted": { + "type": "boolean" + }, + "unsorted": { + "type": "boolean" + } + }, + "x-stoplight": { + "id": "xsb4h51srh0no" + } + }, + "StockGrade": { + "required": ["createdAt", "deleted", "id", "item", "label", "sort_BY_CREATED_AT_DESC", "status", "stockList"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "item": { + "$ref": "#/components/schemas/Item" + }, + "label": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE"] + }, + "stockList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AbstractStock" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "uo27cfebq1knb" + } + }, + "StockHistory": { + "required": [ + "amount", + "comment", + "createdAt", + "deleted", + "historyDate", + "id", + "quantity", + "sort_BY_CREATED_AT_DESC", + "stock", + "type" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "type": { + "type": "string", + "enum": [ + "IN", + "OUT", + "MOVE", + "LOSS", + "DEAD", + "RESET", + "EXHAUSTED", + "CORRECTION_IN", + "CORRECTION_OUT", + "MOVE_IN", + "MOVE_OUT", + "CHANGE_INVENTORY" + ] + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "number" + }, + "comment": { + "type": "string" + }, + "historyDate": { + "type": "string", + "format": "date-time" + }, + "stock": { + "$ref": "#/components/schemas/AbstractStock" + }, + "orderEntryId": { + "type": "integer", + "format": "int64" + }, + "stockTempHistoryId": { + "type": "integer", + "format": "int64" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "xcsos1sr3gcmf" + } + }, + "StockNote": { + "required": ["comment", "createdAt", "deleted", "id", "sort_BY_CREATED_AT_DESC", "stock"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "stock": { + "$ref": "#/components/schemas/AbstractStock" + }, + "comment": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "wqn5xn2x6xb4f" + } + }, + "StockProduct": { + "required": ["createdAt", "deleted", "id", "product", "sort_BY_CREATED_AT_DESC", "stock"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "stock": { + "$ref": "#/components/schemas/AbstractStock" + }, + "product": { + "$ref": "#/components/schemas/Product" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "ppzf1yooswzco" + } + }, + "StockTempHistoryList": { + "required": [ + "checkInStockHistory", + "notEmpty", + "receiveHistory", + "receiveInStockAmount", + "receiveInStockQuantity" + ], + "type": "object", + "properties": { + "tempHistories": { + "uniqueItems": true, + "type": "array", + "writeOnly": true, + "items": { + "$ref": "#/components/schemas/AbstractTempHistory" + } + }, + "notEmpty": { + "type": "boolean" + }, + "receiveHistory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AbstractTempHistory" + } + }, + "checkInStockHistory": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AbstractTempHistory" + } + }, + "receiveInStockAmount": { + "type": "number" + }, + "receiveInStockQuantity": { + "type": "integer", + "format": "int32" + } + }, + "x-stoplight": { + "id": "nmdo2z1jwmkx9" + } + }, + "TpiratesManager": { + "required": [ + "buyerList", + "createdAt", + "deleted", + "email", + "id", + "managerCode", + "name", + "phone", + "role", + "sendMessageOption", + "sort_BY_CREATED_AT_DESC", + "team" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "email": { + "type": "string" + }, + "team": { + "type": "string", + "enum": [ + "DEFAULT", + "ALLIANCE", + "DEVELOPMENT", + "PLANNING", + "MANAGEMENT", + "MARKET", + "SALES", + "PRODUCTOPERATION" + ] + }, + "role": { + "type": "string", + "enum": ["DEFAULT", "TEAMLEADER", "PARTLEADER", "STAFF"] + }, + "buyerList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Buyer" + } + }, + "sendMessageOption": { + "type": "string", + "enum": ["ALL", "SALES", "BUYERS", "NONE"] + }, + "managerCode": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "pmez6rx0ltsgc" + } + }, + "TradeCompany": { + "required": [ + "address", + "businessNumber", + "createdAt", + "deleted", + "id", + "label", + "owner", + "phone", + "sort_BY_CREATED_AT_DESC", + "stockImporterList", + "stockSellerList", + "tradeCompanyCode" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "label": { + "type": "string" + }, + "businessNumber": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "douzoneCode": { + "type": "string" + }, + "address": { + "$ref": "#/components/schemas/Address" + }, + "tradeCompanyCode": { + "type": "string" + }, + "stockSellerList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AbstractStock" + } + }, + "stockImporterList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AbstractStock" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "6h9o3my7vxgoz" + } + }, + "Warehouse": { + "required": [ + "address", + "createdAt", + "deleted", + "id", + "label", + "sort_BY_CREATED_AT_DESC", + "type", + "warehouseAgency", + "warehouseInventory" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "label": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["LIVE", "COLD", "FREEZE", "TUNA"] + }, + "address": { + "$ref": "#/components/schemas/Address" + }, + "warehouseInventory": { + "uniqueItems": true, + "type": "array", + "items": { + "$ref": "#/components/schemas/WarehouseInventory" + } + }, + "warehouseAgency": { + "$ref": "#/components/schemas/WarehouseAgency" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "nk4xswx4ys80k" + } + }, + "WarehouseAgency": { + "required": [ + "address", + "businessNumber", + "createdAt", + "deleted", + "id", + "label", + "owner", + "phone", + "sort_BY_CREATED_AT_DESC", + "warehouseList" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "warehouseList": { + "uniqueItems": true, + "type": "array", + "items": { + "$ref": "#/components/schemas/Warehouse" + } + }, + "label": { + "type": "string" + }, + "businessNumber": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "address": { + "$ref": "#/components/schemas/Address" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "jwvvznflg467a" + } + }, + "WarehouseInventory": { + "required": [ + "createdAt", + "deleted", + "id", + "label", + "sort_BY_CREATED_AT_DESC", + "stockList", + "wareHouseAndWarehouseInventoryAndWarehouseAgencyLabel", + "warehouse" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "warehouse": { + "$ref": "#/components/schemas/Warehouse" + }, + "stockList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AbstractStock" + } + }, + "label": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "wareHouseAndWarehouseInventoryAndWarehouseAgencyLabel": { + "type": "string" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "tbbgpeeijojlo" + } + }, + "AddFavoriteRequest": { + "required": ["productId"], + "type": "object", + "properties": { + "productId": { + "type": "integer", + "format": "int64" + } + }, + "x-stoplight": { + "id": "789zgf7f86wts" + } + }, + "BuyerFavorite": { + "required": ["buyer", "createdAt", "deleted", "id", "product", "seq", "sort_BY_CREATED_AT_DESC"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "buyer": { + "$ref": "#/components/schemas/Buyer" + }, + "product": { + "$ref": "#/components/schemas/Product" + }, + "seq": { + "type": "integer", + "format": "int64" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "z9lxu83rxsl47" + } + }, + "BuyerFavoriteDetail": { + "type": "object", + "properties": { + "favorite": { + "$ref": "#/components/schemas/BuyerFavorite" + }, + "favoriteId": { + "type": "integer", + "format": "int64" + } + }, + "x-stoplight": { + "id": "ixpugq7hbmxec" + } + }, + "CategoryResponse": { + "required": ["id", "label"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 1 + }, + "label": { + "type": "string", + "example": "활어" + } + }, + "x-stoplight": { + "id": "x1x3knfao92qm" + } + }, + "ItemGradeResponse": { + "required": ["id", "label"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 1151 + }, + "label": { + "type": "string", + "example": "400~500g" + } + }, + "x-stoplight": { + "id": "uqo1w5t7lq9b2" + } + }, + "ItemResponse": { + "required": ["id", "label", "raised", "region"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 555 + }, + "label": { + "type": "string", + "example": "제주 광어" + }, + "raised": { + "type": "string", + "example": "", + "enum": ["자연산", "양식", ""] + }, + "region": { + "type": "string", + "example": "4412" + } + }, + "x-stoplight": { + "id": "ypd1vht8i5jim" + } + }, + "ProductSaleUnitResponse": { + "required": [ + "amountUnit", + "calcUnit", + "constraints", + "id", + "isPriceInquiry", + "qtyPerUnit", + "saleUnit", + "unitPrice" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 1209 + }, + "unitPrice": { + "type": "number", + "example": 5360 + }, + "unitPricePerKg": { + "type": "number", + "example": 5360 + }, + "isPriceInquiry": { + "type": "boolean", + "example": false + }, + "priceDate": { + "type": "string", + "format": "date-time" + }, + "constraints": { + "$ref": "#/components/schemas/OrderConstraints" + }, + "saleUnit": { + "type": "string", + "example": "kg", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "amountUnit": { + "type": "number", + "example": 0.4 + }, + "calcUnit": { + "type": "string", + "example": "kg", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "qtyPerUnit": { + "type": "integer", + "format": "int32", + "example": 1 + } + }, + "x-stoplight": { + "id": "hjr04w4jdxlo7" + } + }, + "WholeSaleProductDetail": { + "required": [ + "buyerSavedProductOption", + "category", + "comment", + "deliveryType", + "id", + "item", + "itemGrade", + "productLabel", + "productOption", + "productSaleUnit", + "productType", + "status" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "example": 1002 + }, + "category": { + "$ref": "#/components/schemas/CategoryResponse" + }, + "item": { + "$ref": "#/components/schemas/ItemResponse" + }, + "itemGrade": { + "$ref": "#/components/schemas/ItemGradeResponse" + }, + "productLabel": { + "type": "string", + "example": "국산 제주 광어 400~500g" + }, + "deliveryType": { + "type": "string", + "example": "PIRATES", + "enum": ["DIRECT", "PIRATES", "PARCEL"] + }, + "status": { + "type": "string", + "example": "ON_SALE", + "enum": ["PREPARING", "ON_SALE", "STOPPED", "PRIVATE", "SOLD_OUT"] + }, + "productOption": { + "type": "string", + "example": "BLEEDING", + "enum": ["BLEEDING", "WATER_PACK", "NONE", "COLD_PACK"] + }, + "buyerSavedProductOption": { + "type": "string", + "example": "INITIALIZE", + "enum": ["INITIALIZE", "ALWAYS_DONE", "ALWAYS_NONE"] + }, + "productType": { + "type": "string", + "example": "LIVE", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "comment": { + "type": "string", + "example": "nothing to comment" + }, + "productSaleUnit": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductSaleUnitResponse" + } + }, + "note": { + "type": "string", + "example": "nothing to note" + } + }, + "x-stoplight": { + "id": "6fyl7179w0wxv" + } + }, + "PriceDataTableResponse": { + "required": ["changeYesterDay", "date"], + "type": "object", + "properties": { + "price": { + "type": "number" + }, + "date": { + "type": "string", + "format": "date" + }, + "changeYesterDay": { + "type": "number" + } + }, + "x-stoplight": { + "id": "pihekt2d5cvmj" + } + }, + "PageSearchProductResponse": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SearchProductResponse" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "$ref": "#/components/schemas/SortObject" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "empty": { + "type": "boolean" + } + }, + "x-stoplight": { + "id": "8fhi09amhttfk" + } + }, + "PageableObject": { + "type": "object", + "properties": { + "offset": { + "type": "integer", + "format": "int64" + }, + "sort": { + "$ref": "#/components/schemas/SortObject" + }, + "paged": { + "type": "boolean" + }, + "unpaged": { + "type": "boolean" + }, + "pageNumber": { + "type": "integer", + "format": "int32" + }, + "pageSize": { + "type": "integer", + "format": "int32" + } + }, + "x-stoplight": { + "id": "lb796r88cqu34" + } + }, + "ProductSaleUnitInProductResponse": { + "required": ["amountUnit", "calcUnit", "isPriceInquiry", "qtyPerUnit", "saleUnit", "unitPrice"], + "type": "object", + "properties": { + "isPriceInquiry": { + "type": "boolean" + }, + "unitPricePerKg": { + "type": "number" + }, + "unitPrice": { + "type": "number" + }, + "saleUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "calcUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "qtyPerUnit": { + "type": "integer", + "format": "int32" + }, + "amountUnit": { + "type": "number" + } + }, + "x-stoplight": { + "id": "vuprulaxwodsp" + } + }, + "SearchProductResponse": { + "required": ["id", "label", "productSaleUnit", "productType", "status"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "productType": { + "type": "string", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "label": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["PREPARING", "ON_SALE", "STOPPED", "PRIVATE", "SOLD_OUT"] + }, + "productSaleUnit": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductSaleUnitInProductResponse" + } + } + }, + "x-stoplight": { + "id": "uffc15amqpq2j" + } + }, + "BuyOftenProductSaleUnit": { + "required": [ + "isOrderAvailable", + "isPriceInquiry", + "label", + "productId", + "productSaleUnitId", + "productType", + "saleUnit", + "status", + "unitPrice" + ], + "type": "object", + "properties": { + "productSaleUnitId": { + "type": "integer", + "format": "int64" + }, + "productId": { + "type": "integer", + "format": "int64" + }, + "productType": { + "type": "string", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "label": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["PREPARING", "ON_SALE", "STOPPED", "PRIVATE", "SOLD_OUT"] + }, + "isOrderAvailable": { + "type": "boolean" + }, + "unitPricePerKg": { + "type": "number" + }, + "isPriceInquiry": { + "type": "boolean" + }, + "unitPrice": { + "type": "number" + }, + "saleUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + } + }, + "x-stoplight": { + "id": "3ttysmurt4yhs" + } + }, + "PageBuyOftenProductSaleUnit": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BuyOftenProductSaleUnit" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "$ref": "#/components/schemas/SortObject" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "empty": { + "type": "boolean" + } + }, + "x-stoplight": { + "id": "wszq56avgnwqj" + } + }, + "BuyerManagerResponse": { + "required": ["id", "name", "phone", "role"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "role": { + "type": "string", + "enum": ["OWNER", "MANAGER", "CLERK"] + } + }, + "x-stoplight": { + "id": "u5gyq1y2k0ewg" + } + }, + "DeliveryBuyerResponse": { + "required": ["address", "businessNumber", "deliveryNote", "label", "managers", "ownerName", "ownerPhoneNumber"], + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "businessNumber": { + "type": "string" + }, + "ownerName": { + "type": "string" + }, + "ownerPhoneNumber": { + "type": "string" + }, + "address": { + "$ref": "#/components/schemas/Address" + }, + "deliveryNote": { + "$ref": "#/components/schemas/DeliveryNoteResponse" + }, + "managers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BuyerManagerResponse" + } + } + }, + "x-stoplight": { + "id": "agveewzdj5cuv" + } + }, + "DeliveryNoteAttachmentResponse": { + "required": ["comment", "file", "id", "seq"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "첨부파일 id", + "format": "int64", + "example": 335 + }, + "comment": { + "type": "string", + "description": "첨부파일 코멘트", + "example": "생선 사진123" + }, + "file": { + "$ref": "#/components/schemas/FileResponse" + }, + "seq": { + "type": "integer", + "description": "첨부파일 순서", + "format": "int32", + "example": 2 + } + }, + "x-stoplight": { + "id": "ob81t48ijnbk6" + } + }, + "DeliveryNoteResponse": { + "x-stoplight": { + "id": "bdkikvb3eur3k" + }, + "properties": { + "deliveryNote": { + "type": "string", + "description": "배송 특이사항", + "example": "테스트 주문입니다.\\n테스트테스트..321" + }, + "attachments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DeliveryNoteAttachmentResponse" + } + } + } + }, + "DeliveryOrderResponse": { + "required": ["deliveryVehicleId", "orderDate", "orderEntryList", "orderId", "todayDeliveryNote"], + "type": "object", + "properties": { + "orderId": { + "type": "integer", + "format": "int64" + }, + "deliveryVehicleId": { + "type": "integer", + "format": "int64" + }, + "todayDeliveryNote": { + "type": "string" + }, + "orderDate": { + "type": "string", + "format": "date" + }, + "orderEntryList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrderEntryResponse" + } + } + }, + "x-stoplight": { + "id": "cybfq2kns7g2g" + } + }, + "FileResponse": { + "required": ["contentType", "id", "name", "path"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "파일 id", + "format": "int64", + "example": 467 + }, + "name": { + "type": "string", + "description": "파일 이름", + "example": "물고기2.jpeg" + }, + "path": { + "type": "string", + "description": "파일 경로", + "example": "member-review-images/s3_472C7F7145_20220322121141482721_1" + }, + "contentType": { + "type": "string", + "description": "파일 타입", + "example": "image/jpeg" + } + }, + "x-stoplight": { + "id": "kayw71gt28a5v" + } + }, + "GetDeliveryDetailResponse": { + "required": ["buyer", "order"], + "type": "object", + "properties": { + "order": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DeliveryOrderResponse" + } + }, + "buyer": { + "$ref": "#/components/schemas/DeliveryBuyerResponse" + } + }, + "x-stoplight": { + "id": "6qumtqqenrvmb" + } + }, + "OrderEntryResponse": { + "required": [ + "amount", + "calcUnit", + "itemGradeLabel", + "label", + "origin", + "productOption", + "quantity", + "region", + "saleUnit" + ], + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "productOption": { + "type": "string", + "enum": ["BLEEDING", "WATER_PACK", "NONE", "COLD_PACK"] + }, + "origin": { + "type": "string" + }, + "region": { + "type": "string" + }, + "itemGradeLabel": { + "type": "string" + }, + "calcUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "saleUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "number" + } + }, + "x-stoplight": { + "id": "vks8yd62j3mhs" + } + }, + "GetCartResponse": { + "x-stoplight": { + "id": "vme9ah0zxfbga" + }, + "properties": { + "cartId": { + "type": "integer", + "format": "int64", + "example": 213 + }, + "isPackingFeeCharged": { + "type": "boolean", + "example": false + }, + "packingFee": { + "type": "number", + "example": 0 + }, + "isUsingPacking": { + "type": "boolean", + "example": false + }, + "cartItems": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GetCartItemListResponse" + } + } + } + }, + "CartPriceResponse": { + "required": [ + "packingFee", + "parcelDeliveryFee", + "parcelOrderPrice", + "piratesDeliveryFee", + "piratesOrderPrice", + "totalDeliveryFee", + "totalOrderPrice" + ], + "properties": { + "piratesOrderPrice": { + "type": "number", + "example": 5360 + }, + "parcelOrderPrice": { + "type": "number", + "example": 0 + }, + "piratesDeliveryFee": { + "type": "number", + "example": 25000 + }, + "parcelDeliveryFee": { + "type": "number", + "example": 0 + }, + "packingFee": { + "type": "number", + "example": 0 + }, + "totalDeliveryFee": { + "type": "number", + "example": 25000 + }, + "totalOrderPrice": { + "type": "number", + "example": 5360 + } + }, + "x-stoplight": { + "id": "g3slge0n5pf0a" + } + }, + "CartButtonResponse": { + "properties": { + "totalOrderPrice": { + "type": "number", + "example": 5360 + }, + "cartItemCount": { + "type": "integer", + "format": "int32", + "example": 1 + }, + "packingCheckNeed": { + "type": "boolean", + "example": true + } + }, + "x-stoplight": { + "id": "tqafcy1jxyqff" + } + }, + "SelectDeliveryVehicleRequest": { + "required": ["label"], + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + } + }, + "x-stoplight": { + "id": "5snfvmy4t5zuy" + } + }, + "PageSelectDeliveryVehicleResponse": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SelectDeliveryVehicleResponse" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "$ref": "#/components/schemas/SortObject" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "empty": { + "type": "boolean" + } + }, + "x-stoplight": { + "id": "i2qulecbx9500" + } + }, + "SelectDeliveryVehicleResponse": { + "required": ["deliveryTime", "id", "label", "shortLabel", "type"], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "배송차량 id", + "format": "int64", + "example": 1 + }, + "label": { + "type": "string", + "description": "배송차량 이름", + "example": "1t" + }, + "shortLabel": { + "type": "string", + "description": "배송차량 단축이름", + "example": "1t" + }, + "type": { + "type": "string", + "description": "배송차량 타입", + "example": "LIVE", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "deliveryTime": { + "type": "string", + "description": "배송차량 배송시간", + "example": "NIGHT", + "enum": ["DAY", "NIGHT", "REALTIME", "PARCEL"] + } + }, + "x-stoplight": { + "id": "cprw1y63yvuds" + } + }, + "SelectClosedDayResponse": { + "x-stoplight": { + "id": "hucrtr8txaop2" + } + }, + "GetBuyerOrderHistoryResponse": { + "required": ["count", "orderCode", "orderDate", "orderId", "price", "productLabel", "status"], + "type": "object", + "properties": { + "orderId": { + "type": "integer", + "description": "주문번호", + "format": "int64", + "example": 38607 + }, + "orderDate": { + "type": "string", + "description": "주문일시", + "format": "date-time", + "example": "2023-12-11T15:38:19+09:00" + }, + "productLabel": { + "type": "string", + "description": "상품명", + "example": "노르웨이 연어(원물) 6~7kg (2미 이상)" + }, + "count": { + "type": "integer", + "description": "주문수량", + "format": "int32", + "example": 1 + }, + "orderCode": { + "type": "string", + "description": "주문코드", + "example": "12B7B6848F" + }, + "price": { + "$ref": "#/components/schemas/OrderPrice" + }, + "status": { + "type": "string", + "description": "주문상태", + "example": "CANCELED", + "enum": ["PREPARED", "PROGRESS", "COMPLETED", "CANCELED"] + } + }, + "x-stoplight": { + "id": "tvkl11imxxte0" + } + }, + "PageGetBuyerOrderHistoryResponse": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GetBuyerOrderHistoryResponse" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "$ref": "#/components/schemas/SortObject" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "empty": { + "type": "boolean" + } + }, + "x-stoplight": { + "id": "2kb4k2a0d96gh" + } + }, + "OrderDetailResponse": { + "required": [ + "deliveryFee", + "id", + "orderCode", + "orderDate", + "orderEntries", + "ordinaryOrderPrice", + "packingFee", + "price", + "status", + "todayDeliveryNote" + ], + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/Order" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "orderCode": { + "type": "string" + }, + "orderDate": { + "type": "string", + "format": "date-time" + }, + "orderEntries": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrderEntryDetailResponse" + } + }, + "ordinaryOrderPrice": { + "type": "number" + }, + "packingFee": { + "type": "number" + }, + "status": { + "type": "string", + "enum": ["PREPARED", "PROGRESS", "COMPLETED", "CANCELED"] + }, + "deliveryFee": { + "type": "number" + }, + "price": { + "$ref": "#/components/schemas/OrderPrice" + }, + "todayDeliveryNote": { + "type": "string" + } + }, + "x-stoplight": { + "id": "fbr0oxziqzlt6" + } + }, + "OrderEntryDetailResponse": { + "required": [ + "amount", + "calcUnit", + "id", + "isOrderAvailable", + "isPriceInquiry", + "price", + "productLabel", + "productOption", + "productType", + "quantity", + "saleUnit", + "status", + "unitPrice" + ], + "type": "object", + "properties": { + "orderEntry": { + "$ref": "#/components/schemas/OrderEntry" + }, + "buyerId": { + "type": "integer", + "format": "int64", + "writeOnly": true + }, + "id": { + "type": "integer", + "format": "int64" + }, + "productLabel": { + "type": "string" + }, + "productOption": { + "type": "string", + "enum": ["BLEEDING", "WATER_PACK", "NONE", "COLD_PACK"] + }, + "productType": { + "type": "string" + }, + "saleUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "isOrderAvailable": { + "type": "boolean" + }, + "isPriceInquiry": { + "type": "boolean" + }, + "deliveryDate": { + "type": "string", + "format": "date-time" + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "price": { + "$ref": "#/components/schemas/OrderEntryPrice" + }, + "unitPrice": { + "type": "number" + }, + "amount": { + "type": "number" + }, + "status": { + "type": "string", + "enum": [ + "PREPARED", + "RECEPTION", + "WEIGHT_CHECK", + "QUANTITY_CHECK", + "BUY_CHECK", + "READY", + "WEIGHT_READY", + "QUANTITY_READY", + "BUY_READY", + "WEIGHT_COMPLETE", + "QUANTITY_COMPLETE", + "BUY_COMPLETE", + "COMPLETE", + "CANCELED" + ] + }, + "calcUnit": { + "type": "string", + "enum": ["kg", "마리", "팩", "박스", "블록", "피스", "개", "봉", "줄", "망"] + }, + "orderEntryNote": { + "type": "string" + } + }, + "x-stoplight": { + "id": "0wkghj6femmct" + } + }, + "SelectBuyerRequest": { + "required": ["address", "businessNumber", "buyerGroupLabel", "label", "paymentMax", "paymentMin"], + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "businessNumber": { + "type": "string" + }, + "address": { + "type": "string" + }, + "tpiratesManagerId": { + "type": "integer", + "format": "int64" + }, + "status": { + "type": "string", + "enum": ["INACTIVE", "ACTIVE", "DORMANT"] + }, + "buyerGroupLabel": { + "type": "string" + }, + "paymentMin": { + "type": "number" + }, + "paymentMax": { + "type": "number" + }, + "storeType": { + "type": "string", + "enum": ["MARKETSTORE", "GENERALSTORE"] + } + }, + "x-stoplight": { + "id": "wy1kvotkltatm" + } + }, + "BuyerDetail": { + "required": ["id", "isSundayDelivery", "label", "lastOrderTime"], + "properties": { + "buyer": { + "$ref": "#/components/schemas/Buyer" + }, + "setting": { + "$ref": "#/components/schemas/Setting" + }, + "id": { + "type": "integer", + "format": "int64", + "example": 363 + }, + "label": { + "type": "string", + "example": "인어교주해적단" + }, + "isSundayDelivery": { + "type": "boolean", + "example": false + }, + "lastOrderTime": { + "type": "object", + "example": {} + } + }, + "x-stoplight": { + "id": "7d4secgh6sl0a" + } + }, + "Setting": { + "required": [ + "alarmMessageTime", + "coldMinPrice", + "createdAt", + "deleted", + "id", + "lastOrderTime", + "liveMinPrice", + "orderMessageTime", + "sort_BY_CREATED_AT_DESC" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "lastOrderTime": { + "type": "string", + "format": "date-time" + }, + "orderMessageTime": { + "type": "string", + "format": "date-time" + }, + "alarmMessageTime": { + "type": "string", + "format": "date-time" + }, + "coldMinPrice": { + "type": "integer", + "format": "int32" + }, + "liveMinPrice": { + "type": "integer", + "format": "int32" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time" + }, + "deleted": { + "type": "boolean" + }, + "sort_BY_CREATED_AT_DESC": { + "$ref": "#/components/schemas/SortObject" + } + }, + "x-stoplight": { + "id": "oh6wah8qkjtcc" + } + }, + "DeliveryListResponse": { + "required": ["count", "deliveryDate", "deliveryVehicleId", "orderCode", "orderCount", "orderDate"], + "type": "object", + "properties": { + "deliveryDate": { + "type": "string", + "format": "date" + }, + "deliveryVehicleId": { + "type": "integer", + "format": "int64" + }, + "count": { + "type": "integer", + "format": "int64" + }, + "orderCode": { + "type": "string" + }, + "orderCount": { + "type": "integer", + "format": "int64" + }, + "orderDate": { + "type": "string", + "format": "date" + } + }, + "x-stoplight": { + "id": "d3hozg5oosqei" + } + }, + "OldGetDeliveryList": { + "required": ["order"], + "type": "object", + "properties": { + "order": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DeliveryListResponse" + } + }, + "lastOrderDate": { + "type": "string", + "format": "date" + } + }, + "x-stoplight": { + "id": "nerme363v78t8" + } + }, + "OldGetDeliveryDetail": { + "required": ["buyer", "order"], + "type": "object", + "properties": { + "order": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DeliveryOrderResponse" + } + }, + "buyer": { + "$ref": "#/components/schemas/DeliveryBuyerResponse" + } + }, + "x-stoplight": { + "id": "rpiqovpo8czeg" + } + }, + "SettingResponse": { + "required": ["alarmMessageTime", "coldMinPrice", "id", "lastOrderTime", "liveMinPrice", "orderMessageTime"], + "type": "object", + "properties": { + "setting": { + "$ref": "#/components/schemas/Setting" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "lastOrderTime": { + "type": "string", + "format": "date-time" + }, + "orderMessageTime": { + "type": "string", + "format": "date-time" + }, + "alarmMessageTime": { + "type": "string", + "format": "date-time" + }, + "coldMinPrice": { + "type": "integer", + "format": "int32" + }, + "liveMinPrice": { + "type": "integer", + "format": "int32" + } + }, + "x-stoplight": { + "id": "8n37c36b8x5ut" + } + }, + "SelectSellerDetailResponse": { + "required": [ + "address", + "businessNumber", + "deliveryPolicy", + "deliveryZones", + "holidays", + "id", + "label", + "mobileNumber", + "partnerCode", + "phoneNumber", + "productCount", + "status" + ], + "type": "object", + "properties": { + "seller": { + "$ref": "#/components/schemas/Seller" + }, + "id": { + "type": "integer", + "description": "판매처 id", + "format": "int64", + "example": 1 + }, + "label": { + "type": "string", + "description": "판매처 이름", + "example": "인어교주해적단" + }, + "businessNumber": { + "type": "string", + "description": "사업자 번호", + "example": "1168600992" + }, + "address": { + "$ref": "#/components/schemas/Address" + }, + "phoneNumber": { + "type": "string", + "description": "전화번호" + }, + "mobileNumber": { + "type": "string", + "description": "휴대폰번호" + }, + "partnerCode": { + "type": "string", + "description": "파트너 코드", + "example": "3EF54521C1" + }, + "status": { + "type": "string", + "description": "판매처 상태", + "example": "INACTIVE", + "enum": ["INACTIVE", "ACTIVE", "DORMANT"] + }, + "deliveryZones": { + "type": "array", + "description": "배송지역", + "items": { + "$ref": "#/components/schemas/SellerDeliveryZoneResponse" + } + }, + "deliveryPolicy": { + "$ref": "#/components/schemas/DeliveryPolicy" + }, + "productCount": { + "type": "integer", + "description": "상품 수", + "format": "int32", + "example": 1723 + }, + "holidays": { + "type": "array", + "description": "휴무일", + "items": { + "$ref": "#/components/schemas/SelectClosedDayResponse" + } + } + }, + "x-stoplight": { + "id": "v28i9cespkby4" + } + }, + "SellerDeliveryZoneResponse": { + "required": ["id", "label", "status"], + "type": "object", + "properties": { + "sellerDeliveryZone": { + "$ref": "#/components/schemas/SellerDeliveryZone" + }, + "id": { + "type": "integer", + "description": "배송지역 id", + "format": "int64", + "example": 4 + }, + "label": { + "type": "string", + "description": "배송지역 이름", + "example": "인천권" + }, + "status": { + "type": "string", + "description": "배송지역 상태", + "example": "ACTIVE", + "enum": ["INACTIVE", "ACTIVE"] + } + }, + "description": "배송지역", + "x-stoplight": { + "id": "m8ww3iuuna1i3" + } + }, + "SelectProductRequest": { + "required": ["keyword"], + "type": "object", + "properties": { + "keyword": { + "type": "string" + }, + "categoryId": { + "type": "integer", + "format": "int64" + }, + "itemId": { + "type": "integer", + "format": "int64" + }, + "itemGradeId": { + "type": "integer", + "format": "int64" + }, + "sellerId": { + "type": "integer", + "format": "int64" + }, + "status": { + "type": "string", + "enum": ["PREPARING", "ON_SALE", "STOPPED", "PRIVATE", "SOLD_OUT"] + }, + "productId": { + "type": "integer", + "format": "int64" + } + }, + "x-stoplight": { + "id": "61rk254qxn7ij" + } + }, + "MarginFinder": { + "type": "object", + "properties": { + "marginItemList": { + "type": "array", + "writeOnly": true, + "items": { + "$ref": "#/components/schemas/MarginItem" + } + }, + "margin": { + "$ref": "#/components/schemas/Margin" + }, + "categoryMargin": { + "$ref": "#/components/schemas/MarginItem" + }, + "itemGroupMargin": { + "$ref": "#/components/schemas/MarginItem" + } + }, + "x-stoplight": { + "id": "ieliujh31ltcw" + } + }, + "PageSelectProductResponse": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SelectProductResponse" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "$ref": "#/components/schemas/SortObject" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "empty": { + "type": "boolean" + } + }, + "x-stoplight": { + "id": "rzwz4ahnyqiwr" + } + }, + "SelectProductResponse": { + "required": [ + "comment", + "deliveryType", + "id", + "itemGrade", + "label", + "productOption", + "productSaleUnitResponse", + "productType", + "seller", + "status" + ], + "type": "object", + "properties": { + "product": { + "$ref": "#/components/schemas/Product" + }, + "marginFinder": { + "$ref": "#/components/schemas/MarginFinder" + }, + "buyerSavedProductOption": { + "type": "string", + "enum": ["INITIALIZE", "ALWAYS_DONE", "ALWAYS_NONE"] + }, + "id": { + "type": "integer", + "format": "int64" + }, + "itemGrade": { + "$ref": "#/components/schemas/ItemGradeResponse" + }, + "label": { + "type": "string" + }, + "seller": { + "type": "string" + }, + "deliveryType": { + "type": "string", + "enum": ["DIRECT", "PIRATES", "PARCEL"] + }, + "status": { + "type": "string", + "enum": ["PREPARING", "ON_SALE", "STOPPED", "PRIVATE", "SOLD_OUT"] + }, + "productOption": { + "type": "string", + "enum": ["BLEEDING", "WATER_PACK", "NONE", "COLD_PACK"] + }, + "productType": { + "type": "string", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "comment": { + "type": "string" + }, + "productSaleUnitResponse": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductSaleUnitInProductResponse" + } + } + }, + "x-stoplight": { + "id": "6usqxmfr808o4" + } + }, + "BuyerRepository": { + "type": "object", + "x-stoplight": { + "id": "6iime9otmcvvt" + } + }, + "BuyerSavedProductOptionHelper": { + "type": "object", + "properties": { + "buyerSavedProductOptionRepository": { + "$ref": "#/components/schemas/BuyerSavedProductOptionRepository" + }, + "productRepository": { + "$ref": "#/components/schemas/ProductRepository" + }, + "itemRepository": { + "$ref": "#/components/schemas/ItemRepository" + }, + "buyerRepository": { + "$ref": "#/components/schemas/BuyerRepository" + } + }, + "x-stoplight": { + "id": "03vk0njbltz46" + } + }, + "BuyerSavedProductOptionRepository": { + "type": "object", + "x-stoplight": { + "id": "1plr0vigpe1b1" + } + }, + "DetailResponse": { + "required": [ + "comment", + "id", + "itemGrade", + "label", + "productOption", + "productType", + "seller", + "status", + "uiLabel", + "value" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "value": { + "type": "integer", + "format": "int64" + }, + "uiLabel": { + "type": "string" + }, + "label": { + "type": "string" + }, + "seller": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["PREPARING", "ON_SALE", "STOPPED", "PRIVATE", "SOLD_OUT"] + }, + "productOption": { + "type": "string", + "enum": ["BLEEDING", "WATER_PACK", "NONE", "COLD_PACK"] + }, + "productType": { + "type": "string", + "enum": ["LIVE", "COLD", "FREEZE", "ETC"] + }, + "comment": { + "type": "string" + }, + "itemGrade": { + "$ref": "#/components/schemas/ItemGradeResponse" + } + }, + "x-stoplight": { + "id": "vmqdlxni9oee9" + } + }, + "ItemRepository": { + "type": "object", + "x-stoplight": { + "id": "g085on7amo7di" + } + }, + "ProductRepository": { + "type": "object", + "x-stoplight": { + "id": "0zupq5u4995tk" + } + }, + "WholeSalePlaceOrderResponse": { + "required": [ + "amount", + "buyerSavedProductOption", + "count", + "detail", + "id", + "price", + "product", + "productOption", + "productSaleUnitResponse", + "unitSelect" + ], + "type": "object", + "properties": { + "orderEntry": { + "$ref": "#/components/schemas/OrderEntry" + }, + "marginFinder": { + "$ref": "#/components/schemas/MarginFinder" + }, + "buyerId": { + "type": "integer", + "format": "int64", + "writeOnly": true + }, + "buyerSavedProductOptionHelper": { + "$ref": "#/components/schemas/BuyerSavedProductOptionHelper" + }, + "product": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "price": { + "type": "number" + }, + "amount": { + "type": "number" + }, + "count": { + "type": "integer", + "format": "int32" + }, + "unitSelect": { + "type": "integer", + "format": "int32" + }, + "detail": { + "$ref": "#/components/schemas/DetailResponse" + }, + "productSaleUnitResponse": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductSaleUnitResponse" + } + }, + "productOption": { + "type": "boolean" + }, + "buyerSavedProductOption": { + "type": "string", + "enum": ["INITIALIZE", "ALWAYS_DONE", "ALWAYS_NONE"] + } + }, + "x-stoplight": { + "id": "nixxeuo8yhgpu" + } + }, + "SelectOrderRequest": { + "required": ["keyword", "partnerCode"], + "type": "object", + "properties": { + "keyword": { + "type": "string" + }, + "status": { + "type": "string", + "enum": ["PREPARED", "PROGRESS", "COMPLETED", "CANCELED"] + }, + "start": { + "type": "string", + "format": "date" + }, + "end": { + "type": "string", + "format": "date" + }, + "partnerCode": { + "type": "string" + }, + "calculated": { + "type": "boolean" + }, + "dateType": { + "type": "string" + }, + "hasBuyerComment": { + "type": "boolean" + } + }, + "x-stoplight": { + "id": "kcnjku2t65tfm" + } + }, + "OrdererResponse": { + "required": ["id", "name", "partner", "phone"], + "type": "object", + "properties": { + "orderer": { + "$ref": "#/components/schemas/BuyerManager" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "partner": { + "$ref": "#/components/schemas/PartnerResponse" + } + }, + "x-stoplight": { + "id": "t0uf22uq27pvo" + } + }, + "PageSelectOrdersResponseForHistory": { + "type": "object", + "properties": { + "totalPages": { + "type": "integer", + "format": "int32" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "int32" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SelectOrdersResponseForHistory" + } + }, + "number": { + "type": "integer", + "format": "int32" + }, + "sort": { + "$ref": "#/components/schemas/SortObject" + }, + "pageable": { + "$ref": "#/components/schemas/PageableObject" + }, + "numberOfElements": { + "type": "integer", + "format": "int32" + }, + "first": { + "type": "boolean" + }, + "last": { + "type": "boolean" + }, + "empty": { + "type": "boolean" + } + }, + "x-stoplight": { + "id": "sfjqyspmtt8av" + } + }, + "PartnerResponse": { + "required": ["deliveryNoteIsNew", "id", "label", "partnerCode"], + "type": "object", + "properties": { + "buyer": { + "$ref": "#/components/schemas/Buyer" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "label": { + "type": "string" + }, + "partnerCode": { + "type": "string" + }, + "deliveryNoteIsNew": { + "type": "boolean" + } + }, + "x-stoplight": { + "id": "t2a6h20xuosme" + } + }, + "SelectOrdersResponseForHistory": { + "required": ["calculated", "deliveryDate", "entries", "id", "orderCode", "orderDate", "remark", "status"], + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/Order" + }, + "buyerSavedProductOptionHelper": { + "$ref": "#/components/schemas/BuyerSavedProductOptionHelper" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "orderer": { + "$ref": "#/components/schemas/OrdererResponse" + }, + "orderCode": { + "type": "string" + }, + "orderDate": { + "type": "string", + "format": "date-time" + }, + "deliveryDate": { + "type": "string", + "format": "date-time" + }, + "status": { + "type": "string", + "enum": ["PREPARED", "PROGRESS", "COMPLETED", "CANCELED"] + }, + "calculated": { + "type": "boolean" + }, + "entries": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrderEntryResponse" + } + }, + "remark": { + "type": "string", + "enum": ["COLD_LIVE", "COLD", "LIVE", "SUCCESS"] + } + }, + "x-stoplight": { + "id": "qckxv4u1fwhe3" + } + } + } + } +} diff --git a/packages/cli/.yalc/@stoplight/json/LICENSE b/packages/cli/.yalc/@stoplight/json/LICENSE new file mode 100644 index 000000000..ba50e461e --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/LICENSE @@ -0,0 +1,190 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2018 Stoplight, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/cli/.yalc/@stoplight/json/README.md b/packages/cli/.yalc/@stoplight/json/README.md new file mode 100644 index 000000000..44f8408e6 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/README.md @@ -0,0 +1,70 @@ +# @stoplight/json + +[![Maintainability](https://api.codeclimate.com/v1/badges/85d2215f8b1e8a15214f/maintainability)](https://codeclimate.com/github/stoplightio/json/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/85d2215f8b1e8a15214f/test_coverage)](https://codeclimate.com/github/stoplightio/json/test_coverage) + +Useful functions when working with JSON. + +- View the changelog: [Releases](https://github.com/stoplightio/json/releases) + +### Installation + +Supported in modern browsers and node. + +```bash +# latest stable version +yarn add @stoplight/json +``` + +### Usage + +- **[parseWithPointers](https://stoplightio.github.io/json/globals.html#parsewithpointers)**: Like `JSON.parse(val)` but also returns parsing errors as well as full ast with line information. +- **[pathToPointer](https://stoplightio.github.io/json/globals.html#pathtopointer)**: Turns an array of path segments into a json pointer IE `['paths', '/user', 'get']` -> `#/paths/~1user/get`. +- **[pointerToPath](https://stoplightio.github.io/json/globals.html#pointertopath)**: Turns a json pointer into an array of path segments IE `#/paths/~1user/get` -> `['paths', '/user', 'get']`. +- **[safeParse](https://stoplightio.github.io/json/globals.html#safeparse)**: Like `JSON.parse(val)` but does not throw on invalid JSON. +- **[safeStringify](https://stoplightio.github.io/json/globals.html#safestringify)**: Like `JSON.stringify(val)` but handles circular references. +- **[startsWith](https://stoplightio.github.io/json/globals.html#startswith)**: Like native JS `x.startsWith(y)` but works with strings AND arrays. +- **[trimStart](https://stoplightio.github.io/json/globals.html#trimstart)**: Like `lodash.startsWith(x, y)` but works with strings AND arrays. +- **[getJsonPathForPosition](https://stoplightio.github.io/json/globals.html#getjsonpathforposition)**: Computes JSON path for given position. +- **[getLocationForJsonPath](https://stoplightio.github.io/json/globals.html#getlocationforjsonpath)**: Retrieves location of node matching given JSON path. + +#### Example `parseWithPointers` + +```ts +import { parseWithPointers } from "@stoplight/json"; + +const result = parseWithPointers('{"foo": "bar"}'); + +console.log(result.data); // => the {foo: "bar"} JS object +console.log(result.pointers); // => the source map with a single "#/foo" pointer that has position info for the foo property +``` + +```ts +// basic example of getJsonPathForPosition and getLocationForJsonPath +import { getJsonPathForPosition, getLocationForJsonPath, parseWithPointers } from "@stoplight/json"; + +const result = parseWithPointers(`{ + "hello": "world", + "address": { + "street": 123 + } +}`); + +const path = getJsonPathForPosition(result, { line: 3, character: 15 }); // line and character are 0-based +console.log(path); // -> ["address", "street"]; + +const position = getLocationForJsonPath(result, ["address"]); +console.log(position.range.start); // { line: 2, character: 13 } line and character are 0-based +console.log(position.range.end); // { line: 4, character: 3 } line and character are 0-based +``` + +### Contributing + +1. Clone repo. +2. Create / checkout `feature/{name}`, `chore/{name}`, or `fix/{name}` branch. +3. Install deps: `yarn`. +4. Make your changes. +5. Run tests: `yarn test.prod`. +6. Stage relevant files to git. +7. Commit: `yarn commit`. _NOTE: Commits that don't follow the [conventional](https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional) format will be rejected. `yarn commit` creates this format for you, or you can put it together manually and then do a regular `git commit`._ +8. Push: `git push`. +9. Open PR targeting the `next` branch. diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/bundle.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/bundle.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/bundle.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/decodePointer.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/decodePointer.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/decodePointer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/decodePointerFragment.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/decodePointerFragment.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/decodePointerFragment.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/decycle.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/decycle.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/decycle.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/encodePointer.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/encodePointer.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/encodePointer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/encodePointerFragment.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/encodePointerFragment.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/encodePointerFragment.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/extractPointerFromRef.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/extractPointerFromRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/extractPointerFromRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/extractSourceFromRef.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/extractSourceFromRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/extractSourceFromRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/fixtures/json.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/fixtures/json.d.ts new file mode 100644 index 000000000..33c736823 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/fixtures/json.d.ts @@ -0,0 +1,6 @@ +export declare const small: any; +export declare const smallString: string; +export declare const smallCircular: any; +export declare const large: any; +export declare const largeString: string; +export declare const largeCircular: any; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/getFirstPrimitiveProperty.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/getFirstPrimitiveProperty.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/getFirstPrimitiveProperty.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/getJsonPathForPosition.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/getJsonPathForPosition.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/getJsonPathForPosition.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/getLastPathSegment.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/getLastPathSegment.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/getLastPathSegment.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/getLocationForJsonPath.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/getLocationForJsonPath.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/getLocationForJsonPath.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/hasRef.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/hasRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/hasRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/isLocalRef.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/isLocalRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/isLocalRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/isPlainObject.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/isPlainObject.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/isPlainObject.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/parseWithPointers.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/parseWithPointers.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/parseWithPointers.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/pathToPointer.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/pathToPointer.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/pathToPointer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/pointerToPath.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/pointerToPath.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/pointerToPath.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/renameObjectKeys.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/renameObjectKeys.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/renameObjectKeys.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/reparentBundleTarget.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/reparentBundleTarget.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/reparentBundleTarget.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/resolveExternalRef.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/resolveExternalRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/resolveExternalRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/resolveInlineRef.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/resolveInlineRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/resolveInlineRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/safeParse.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/safeParse.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/safeParse.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/safeStringify.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/safeStringify.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/safeStringify.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/startsWith.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/startsWith.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/startsWith.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/stringify.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/stringify.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/stringify.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/toPropertyPath.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/toPropertyPath.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/toPropertyPath.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/trapAccess.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/trapAccess.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/trapAccess.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/traverse.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/traverse.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/traverse.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/__tests__/trimStart.spec.d.ts b/packages/cli/.yalc/@stoplight/json/__tests__/trimStart.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/__tests__/trimStart.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/_utils.d.ts b/packages/cli/.yalc/@stoplight/json/_utils.d.ts new file mode 100644 index 000000000..e1dd24868 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/_utils.d.ts @@ -0,0 +1 @@ +export declare const replaceInString: (str: string, find: string, repl: string) => string; diff --git a/packages/cli/.yalc/@stoplight/json/bundle.d.ts b/packages/cli/.yalc/@stoplight/json/bundle.d.ts new file mode 100644 index 000000000..68290bcaf --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/bundle.d.ts @@ -0,0 +1,16 @@ +import { JsonPath } from '@stoplight/types'; +export declare const BUNDLE_ROOT = "#/__bundled__"; +export declare const ERRORS_ROOT = "#/__errors__"; +declare type KeyProviderFn = (props: { + document: unknown; + path: JsonPath; +}) => string | void | undefined | null; +export declare const bundleTarget: ({ document, path, bundleRoot, errorsRoot, cloneDocument, keyProvider, }: { + document: T; + path: string; + bundleRoot?: string | undefined; + errorsRoot?: string | undefined; + cloneDocument?: boolean | undefined; + keyProvider?: KeyProviderFn | undefined; +}, cur?: unknown) => any; +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/decodePointer.d.ts b/packages/cli/.yalc/@stoplight/json/decodePointer.d.ts new file mode 100644 index 000000000..8dbccbe31 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/decodePointer.d.ts @@ -0,0 +1 @@ +export declare const decodePointer: (value: string) => string; diff --git a/packages/cli/.yalc/@stoplight/json/decodePointerFragment.d.ts b/packages/cli/.yalc/@stoplight/json/decodePointerFragment.d.ts new file mode 100644 index 000000000..c68f4e89c --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/decodePointerFragment.d.ts @@ -0,0 +1 @@ +export declare const decodePointerFragment: (value: string) => string; diff --git a/packages/cli/.yalc/@stoplight/json/decodePointerUriFragment.d.ts b/packages/cli/.yalc/@stoplight/json/decodePointerUriFragment.d.ts new file mode 100644 index 000000000..d94c9f511 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/decodePointerUriFragment.d.ts @@ -0,0 +1 @@ +export { decodePointer as decodePointerUriFragment } from './decodePointer'; diff --git a/packages/cli/.yalc/@stoplight/json/decycle.d.ts b/packages/cli/.yalc/@stoplight/json/decycle.d.ts new file mode 100644 index 000000000..cfc0e945e --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/decycle.d.ts @@ -0,0 +1 @@ +export declare function decycle(obj: unknown, replacer?: (value: any) => any): any; diff --git a/packages/cli/.yalc/@stoplight/json/decycle2.d.ts b/packages/cli/.yalc/@stoplight/json/decycle2.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/cli/.yalc/@stoplight/json/encodePointer.d.ts b/packages/cli/.yalc/@stoplight/json/encodePointer.d.ts new file mode 100644 index 000000000..dcbbede68 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/encodePointer.d.ts @@ -0,0 +1 @@ +export declare const encodePointer: (value: string) => string; diff --git a/packages/cli/.yalc/@stoplight/json/encodePointerFragment.d.ts b/packages/cli/.yalc/@stoplight/json/encodePointerFragment.d.ts new file mode 100644 index 000000000..f27f9b933 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/encodePointerFragment.d.ts @@ -0,0 +1,2 @@ +import { Segment } from '@stoplight/types'; +export declare const encodePointerFragment: (value: Segment) => Segment; diff --git a/packages/cli/.yalc/@stoplight/json/encodePointerUriFragment.d.ts b/packages/cli/.yalc/@stoplight/json/encodePointerUriFragment.d.ts new file mode 100644 index 000000000..12d7497ff --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/encodePointerUriFragment.d.ts @@ -0,0 +1,2 @@ +import { Segment } from '@stoplight/types'; +export declare const encodePointerUriFragment: (value: Segment) => Segment; diff --git a/packages/cli/.yalc/@stoplight/json/encodeUriPointer.d.ts b/packages/cli/.yalc/@stoplight/json/encodeUriPointer.d.ts new file mode 100644 index 000000000..6dc085426 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/encodeUriPointer.d.ts @@ -0,0 +1 @@ +export declare function encodeUriPointer(pointer: string): string; diff --git a/packages/cli/.yalc/@stoplight/json/extractPointerFromRef.d.ts b/packages/cli/.yalc/@stoplight/json/extractPointerFromRef.d.ts new file mode 100644 index 000000000..9f81d06ca --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/extractPointerFromRef.d.ts @@ -0,0 +1 @@ +export declare const extractPointerFromRef: (ref: string) => string | null; diff --git a/packages/cli/.yalc/@stoplight/json/extractSourceFromRef.d.ts b/packages/cli/.yalc/@stoplight/json/extractSourceFromRef.d.ts new file mode 100644 index 000000000..230017304 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/extractSourceFromRef.d.ts @@ -0,0 +1 @@ +export declare const extractSourceFromRef: (ref: unknown) => string | null; diff --git a/packages/cli/.yalc/@stoplight/json/getFirstPrimitiveProperty.d.ts b/packages/cli/.yalc/@stoplight/json/getFirstPrimitiveProperty.d.ts new file mode 100644 index 000000000..b33ffbea5 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/getFirstPrimitiveProperty.d.ts @@ -0,0 +1,2 @@ +import { Optional } from '@stoplight/types'; +export declare const getFirstPrimitiveProperty: (text: string) => Optional<[string, string | number | boolean | null]>; diff --git a/packages/cli/.yalc/@stoplight/json/getJsonPathForPosition.d.ts b/packages/cli/.yalc/@stoplight/json/getJsonPathForPosition.d.ts new file mode 100644 index 000000000..e292beb44 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/getJsonPathForPosition.d.ts @@ -0,0 +1,3 @@ +import { GetJsonPathForPosition } from '@stoplight/types'; +import { JsonParserResult } from './types'; +export declare const getJsonPathForPosition: GetJsonPathForPosition>; diff --git a/packages/cli/.yalc/@stoplight/json/getLastPathSegment.d.ts b/packages/cli/.yalc/@stoplight/json/getLastPathSegment.d.ts new file mode 100644 index 000000000..3e15d6536 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/getLastPathSegment.d.ts @@ -0,0 +1 @@ +export declare function getLastPathSegment(path: string): string; diff --git a/packages/cli/.yalc/@stoplight/json/getLocationForJsonPath.d.ts b/packages/cli/.yalc/@stoplight/json/getLocationForJsonPath.d.ts new file mode 100644 index 000000000..a997f535d --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/getLocationForJsonPath.d.ts @@ -0,0 +1,3 @@ +import { GetLocationForJsonPath } from '@stoplight/types'; +import { JsonParserResult } from './types'; +export declare const getLocationForJsonPath: GetLocationForJsonPath>; diff --git a/packages/cli/.yalc/@stoplight/json/hasRef.d.ts b/packages/cli/.yalc/@stoplight/json/hasRef.d.ts new file mode 100644 index 000000000..3047ec4ce --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/hasRef.d.ts @@ -0,0 +1,3 @@ +export declare const hasRef: (obj: unknown) => obj is Record & { + $ref: string; +}; diff --git a/packages/cli/.yalc/@stoplight/json/index.cjs.js b/packages/cli/.yalc/@stoplight/json/index.cjs.js new file mode 100644 index 000000000..d4eb87f19 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/index.cjs.js @@ -0,0 +1 @@ +"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var lodash=require("lodash"),path=require("@stoplight/path"),jsoncParser=require("jsonc-parser"),createOrderedObject=require("@stoplight/ordered-object-literal"),createOrderedObject__default=_interopDefault(createOrderedObject),types=require("@stoplight/types"),fastStringify=_interopDefault(require("safe-stable-stringify"));function isPlainObject(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype||"function"==typeof e.constructor&&Function.toString.call(Object)===Function.toString.call(e.constructor)}function assertResolvableInput(e,t,r){if(!isPlainObject(e)&&!Array.isArray(e)||!(t in e))throw new ReferenceError(`Could not resolve '${r}'`)}function assertObjectWithValidRef(e){if("string"!=typeof e.$ref)throw new TypeError("$ref should be a string")}const hasSomeRef=e=>isPlainObject(e)&&"$ref"in e,hasRef=e=>hasSomeRef(e)&&"string"==typeof e.$ref,isLocalRef=e=>e.length>0&&("#"===e||/^#\S*$/.test(e)),replaceInString=(e,t,r)=>{const n=e.toString();let o="",i=n,a=0,s=i.indexOf(t);for(;s>-1;)o+=n.substring(a,a+s)+r,i=i.substring(s+t.length,i.length),a+=s+t.length,s=i.indexOf(t);return i.length>0&&(o+=n.substring(n.length-i.length,n.length)),o},encodePointerFragment=e=>"number"==typeof e?e:replaceInString(replaceInString(e,"~","~0"),"/","~1"),ENCODABLE_CHAR=/[^a-zA–Z0–9_.!~*'()\/\-\u{D800}-\u{DFFF}]/gu;function encodeUriPointer(e){return e.replace(ENCODABLE_CHAR,encodeURIComponent)}const encodePointerUriFragment=e=>{const t=encodePointerFragment(e);return"number"==typeof t?t:encodeUriPointer(t)},pathToPointer=e=>encodeUriFragmentIdentifier(e),encodeUriFragmentIdentifier=e=>{if(e&&"object"!=typeof e)throw new TypeError("Invalid type: path must be an array of segments.");return 0===e.length?"#":`#/${e.map(encodePointerUriFragment).join("/")}`};function safeDecodeURIComponent(e){try{return decodeURIComponent(e)}catch(t){return e}}const PERCENT_ENCODING_OCTET=/%[0-9a-f]+/gi,decodePointer=e=>{let t;try{t=decodeURIComponent(e)}catch(r){t=e.replace(PERCENT_ENCODING_OCTET,safeDecodeURIComponent)}return replaceInString(replaceInString(t,"~1","/"),"~0","~")},pointerToPath=e=>decodeUriFragmentIdentifier(e),decodeFragmentSegments=e=>{const t=e.length,r=[];let n=-1;for(;++n{if("string"!=typeof e)throw new TypeError("Invalid type: JSON Pointers are represented as strings.");if(0===e.length||"#"!==e[0])throw new URIError("Invalid JSON Pointer syntax; URI fragment identifiers must begin with a hash.");if(1===e.length)return[];if("/"!==e[1])throw new URIError("Invalid JSON Pointer syntax.");return decodeFragmentSegments(e.substring(2).split("/"))},_traverse=(e,t,r)=>{const n={value:e,path:r};t.onEnter&&t.onEnter(n);for(const n of Object.keys(e)){const o=e[n];t.onProperty&&t.onProperty({parent:e,parentPath:r,property:n,propertyValue:o}),"object"==typeof o&&null!==o&&_traverse(o,t,r.concat(n))}t.onLeave&&t.onLeave(n)},traverse=(e,t)=>{"object"==typeof e&&null!==e&&_traverse(e,"function"==typeof t?{onProperty:t}:t,[])};function remapRefs(e,t,r){traverse(e,{onProperty({property:e,propertyValue:n,parent:o}){"$ref"===e&&"string"==typeof n&&n.startsWith(t)&&(o.$ref=`${r}${n.slice(t.length)}`)}})}const isExternalRef=e=>e.length>0&&"#"!==e[0],extractSourceFromRef=e=>{if("string"!=typeof e||0===e.length||!isExternalRef(e))return null;const t=e.indexOf("#");return-1===t?e:e.slice(0,t)};function applyOverrides(e,t){return isPlainObject(t)&&isPlainObject(e)&&("summary"in e||"description"in e)?Object.assign(Object.assign(Object.assign({},t),"description"in e?{description:e.description}:null),"summary"in e?{summary:e.summary}:null):t}function resolveSource(e,t){const r=extractSourceFromRef(t);return null===r?e:path.isAbsolute(r)?r:path.join(path.dirname(e),r)}function*traverse$1(e,t,r){hasSomeRef(e.value)&&(assertObjectWithValidRef(e.value),yield[-1,e.value]);for(const[n,o]of t.entries())assertResolvableInput(e.value,o,r),e.value=e.value[o],hasSomeRef(e.value)&&(assertObjectWithValidRef(e.value),yield[n,e.value])}function _resolveInlineRefWithLocation(e,t,r,n){if(null!==extractSourceFromRef(t))throw new ReferenceError("Cannot resolve external references");const o=pointerToPath(t);let i=[...o];"#"===t&&hasSomeRef(e)&&(assertObjectWithValidRef(e),o.unshift(...pointerToPath(e.$ref)));const a={value:e};for(const[s,c]of traverse$1(a,o,t)){if(r.includes(c))return{source:null,location:null!=n?n:i,value:r[r.length-1]};r.push(c);const t=_resolveInlineRefWithLocation(e,c.$ref,r,i);a.value=t.value,(i=t.location).push(...o.slice(s+1))}return{source:null,location:i,value:r.length>0?applyOverrides(r[r.length-1],a.value):a.value}}function resolveInlineRef(e,t){return resolveInlineRefWithLocation(e,t).value}function resolveInlineRefWithLocation(e,t){return _resolveInlineRefWithLocation(e,t,[])}const BUNDLE_ROOT="#/__bundled__",ERRORS_ROOT="#/__errors__",bundleTarget=({document:e,path:t,bundleRoot:r=BUNDLE_ROOT,errorsRoot:n=ERRORS_ROOT,cloneDocument:o=!0,keyProvider:i},a)=>{if(t===r||t===n)throw new Error("Roots do not make any sense");const s=o?lodash.cloneDeep(e):e;return bundle(s,pointerToPath(r),pointerToPath(n),t,i)(t,{[t]:!0},a)},defaultKeyProvider=({document:e,path:t})=>{if(0===t.length)return"root";if(Array.isArray(lodash.get(e,t.slice(0,-1)))){return`${t[t.length-2]}_${t[t.length-1]}`}return String(t[t.length-1])},bundle=(e,t,r,n,o)=>{const i=new Set,a=(s,c,l,f={},u={},p={})=>{const h=pointerToPath(s),d=lodash.get(e,h);traverse(l||d,{onEnter:({value:r})=>{if(hasRef(r)&&isLocalRef(r.$ref)){const l=r.$ref;if(p[l])return;if(l===s&&(f[l]="#"),f[l])return void(r.$ref=f[l]);let h,d,g,y,P;try{let r;h=pointerToPath(l),o&&(r=o({document:e,path:h})),r||(r=defaultKeyProvider({document:e,path:h})),g=r;let n=1;for(;i.has(g);)if(g=`${r}_${++n}`,n>20)throw new Error(`Keys ${r}_2 through ${r}_20 already taken.`);i.add(g),d=[...t,g],y=pathToPointer(d)}catch(e){p[l]=e instanceof Error?e.message:String(e)}if(!h||!d||!y)return;if("object"==typeof e&&null!==e&&!(P=lodash.get(e,h)))try{P=resolveInlineRef(Object(e),l)}catch(e){}void 0!==P&&(f[l]=y,r.$ref=y,lodash.has(u,d)||(Array.isArray(P)?lodash.set(u,d,new Array(P.length).fill(null)):"object"==typeof P&&lodash.setWith(u,d,{},Object),lodash.set(u,d,P),"#"===l?bundleRootDocument(e,u,pointerToPath(n),d):c[l]||(c[l]=!0,a(s,c,P,f,u,p),c[l]=!1)))}}});const g=lodash.get(u,t);return g&&Object.keys(g).length&&lodash.set(d,t,g),(Object.keys(p).length||lodash.has(e,r))&&lodash.set(d,r,lodash.has(e,r)?lodash.get(e,r):p),d};return a};function bundleRootDocument(e,t,r,n){const o=r.map(e=>`[${JSON.stringify(e)}]`).join(""),i=JSON.parse(JSON.stringify(lodash.omit(Object(e),o))),a={};lodash.set(t,n,i),lodash.set(i,r,a),remapRefs(i,"#",pathToPointer(n)),a.$ref="#"}const decodePointerFragment=e=>replaceInString(replaceInString(e,"~1","/"),"~0","~");function decycle(e,t){const r=new WeakMap,n=new WeakSet;return function e(o,i){if(t&&(o=t(o)),isPlainObject(o)||Array.isArray(o)){const t=r.get(o);if(t)return{$ref:t};if(r.set(o,pathToPointer(i)),Array.isArray(o))return o.map((t,r)=>e(t,[...i,r]));const a={};for(const t in o)Object.prototype.hasOwnProperty.call(o,t)&&(a[t]=e(o[t],[...i,t]));return n.has(o)||r.delete(o),n.add(o),a}return o}(e,[])}const encodePointer=e=>replaceInString(replaceInString(e,"~","~0"),"//","/~1"),extractPointerFromRef=e=>{if("string"!=typeof e||0===e.length)return null;const t=e.indexOf("#");return-1===t?null:e.slice(t)},getFirstPrimitiveProperty=e=>{const t=jsoncParser.createScanner(e,!0);if(t.scan(),1!==t.getToken())return;if(t.scan(),2===t.getToken())return;if(10!==t.getToken())throw new SyntaxError("Unexpected character");const r=t.getTokenValue();if(t.scan(),6!==t.getToken())throw new SyntaxError("Colon expected");switch(t.scan(),t.getToken()){case 10:return[r,t.getTokenValue()];case 11:return[r,Number(t.getTokenValue())];case 8:return[r,!0];case 9:return[r,!1];case 7:return[r,null];case 16:throw new SyntaxError("Unexpected character");case 17:throw new SyntaxError("Unexpected end of file");default:return}},getJsonPathForPosition=({lineMap:e,ast:t},r)=>{const n=e[r.line],o=e[r.line+1];if(void 0===n)return;const i=jsoncParser.findNodeAtOffset(t,void 0===o?n+r.character:Math.min(o,n+r.character),!0);if(void 0===i)return;const a=jsoncParser.getNodePath(i);return 0!==a.length?a:void 0};function getLastPathSegment(e){return decodePointerFragment(e.split("/").pop()||"")}const getLocationForJsonPath=({ast:e},t,r=!1)=>{const n=findNodeAtPath(e,t,r);if(void 0!==n&&void 0!==n.range)return{range:n.range}};function findNodeAtPath(e,t,r){e:for(const n of t){const t=Number.isInteger(Number(n))?Number(n):n;if("string"==typeof t||"number"==typeof t&&"array"!==e.type){if("object"!==e.type||!Array.isArray(e.children))return r?e:void 0;for(const r of e.children)if(Array.isArray(r.children)&&r.children[0].value===String(t)&&2===r.children.length){e=r.children[1];continue e}return r?e:void 0}if("array"!==e.type||t<0||!Array.isArray(e.children)||t>=e.children.length)return r?e:void 0;e=e.children[t]}return e}const parseWithPointers=(e,t={disallowComments:!0})=>{const r=[],{ast:n,data:o,lineMap:i}=parseTree(e,r,t);return{data:o,diagnostics:r,ast:n,lineMap:i}};function parseTree(e,t=[],r){const n=computeLineMap(e);let o={type:"array",offset:-1,length:-1,children:[],parent:void 0},i=null,a=[];const s=new WeakMap,c=[];function l(e){"property"===o.type&&(o.length=e-o.offset,o=o.parent)}function f(e,t,r){return{start:{line:e,character:t},end:{line:e,character:t+r}}}function u(e){return o.children.push(e),e}function p(e){Array.isArray(a)?a.push(e):null!==i&&(a[i]=e)}function h(e){p(e),c.push(a),a=e,i=null}function d(){a=c.pop()}const g={onObjectBegin:(e,t,n,i)=>{o=u({type:"object",offset:e,length:-1,parent:o,children:[],range:f(n,i,t)}),!1===r.ignoreDuplicateKeys&&s.set(o,[]),h(createObjectLiteral(!0===r.preserveKeyOrder))},onObjectProperty:(e,n,c,l,p)=>{if((o=u({type:"property",offset:n,length:-1,parent:o,children:[]})).children.push({type:"string",value:e,offset:n,length:c,parent:o}),!1===r.ignoreDuplicateKeys){const r=s.get(o.parent);r&&(0!==r.length&&r.includes(e)?t.push({range:f(l,p,c),message:"DuplicateKey",severity:types.DiagnosticSeverity.Error,path:getJsonPath(o),code:20}):r.push(e))}!0===r.preserveKeyOrder&&swapKey(a,e),i=e},onObjectEnd:(e,t,n,i)=>{!1===r.ignoreDuplicateKeys&&s.delete(o),o.length=e+t-o.offset,o.range&&(o.range.end.line=n,o.range.end.character=i+t),o=o.parent,l(e+t),d()},onArrayBegin:(e,t,r,n)=>{o=u({type:"array",offset:e,length:-1,parent:o,children:[],range:f(r,n,t)}),h([])},onArrayEnd:(e,t,r,n)=>{o.length=e+t-o.offset,o.range&&(o.range.end.line=r,o.range.end.character=n+t),o=o.parent,l(e+t),d()},onLiteralValue:(e,t,r,n,i)=>{u({type:getLiteralNodeType(e),offset:t,length:r,parent:o,value:e,range:f(n,i,r)}),l(t+r),p(e)},onSeparator:(e,t)=>{"property"===o.type&&(":"===e?o.colonOffset=t:","===e&&l(t))},onError:(e,r,n,o,i)=>{t.push({range:f(o,i,n),message:jsoncParser.printParseErrorCode(e),severity:types.DiagnosticSeverity.Error,code:e})}};jsoncParser.visit(e,g,r);const y=o.children[0];return y&&delete y.parent,{ast:y,data:a[0],lineMap:n}}function getLiteralNodeType(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";default:return"null"}}const computeLineMap=e=>{const t=[0];let r=0;for(;r{if(!e||!Object.hasOwnProperty.call(e,t)||t===r)return e;const n={};for(const[o,i]of Object.entries(e))o===t?n[r]=i:o in n||(n[o]=i);return n};function isObject(e){return isPlainObject(e)||Array.isArray(e)}function reparentBundleTarget(e,t,r){if(r.length<=1||t.length<=1)throw Error("Source/target path must not be empty and point at root");if(0===t.indexOf(r))throw Error("Target path cannot be contained within source");const n=pointerToPath(t);let o=e;for(const e of n){if(!isObject(o))return;o=o[e]}if(!isObject(o))return;const i=pointerToPath(r);let a=e;for(const[e,t]of i.entries()){if(!isObject(a)||t in a)return;const r=e===i.length-1?o:{};a[t]=r,a=r}delete e[n[0]],_reparentBundleTarget(e,t,r)}function _reparentBundleTarget(e,t,r){for(const n of Object.keys(e)){const o=e[n];if("$ref"!==n)isObject(o)&&_reparentBundleTarget(o,t,r);else{if("string"!=typeof o||!isLocalRef(o))continue;0===o.indexOf(t)&&(e[n]=o.replace(t,r))}}}async function _resolveExternalRefWithLocation(e,t,r,n,o){let i=resolveSource(t,r);const a=extractPointerFromRef(r)||"#",s=await e[i],c=pointerToPath(a);let l=[...c];const f={value:s};for(const[r,s]of traverse$1(f,c,a)){if(n.includes(s))return{source:t,location:null!=o?o:l,value:n[n.length-1]};n.push(s);const a=await _resolveExternalRefWithLocation(e,i,s.$ref,n,l);({source:i,location:l}=a),f.value=a.value,l.push(...c.slice(r+1))}return{source:i,location:l,value:n.length>0?applyOverrides(n[n.length-1],f.value):f.value}}async function resolveExternalRef(e,t,r){return(await resolveExternalRefWithLocation(e,t,r)).value}function resolveExternalRefWithLocation(e,t,r){return _resolveExternalRefWithLocation(e,t,r,[])}const safeParse=(e,t)=>{if("string"!=typeof e)return e;try{const r=parseNumber(e);return"string"==typeof r?r:JSON.parse(e,t)}catch(e){return}},parseNumber=e=>{const t=Number(e);return Number.isFinite(t)?String(t)===e?t:e:NaN},safeStringify=(e,t,r)=>{if("string"==typeof e)return e;try{return JSON.stringify(e,t,r)}catch(n){return fastStringify(e,t,r)}},startsWith=(e,t)=>{if(e instanceof Array){if(t instanceof Array){if(t.length>e.length)return!1;for(const r in t){if(!t.hasOwnProperty(r))continue;const n=parseInt(e[r]),o=parseInt(t[r]);if(isNaN(n)&&isNaN(o)){if(e[r]!==t[r])return!1}else if(n!==o)return!1}}}else{if("string"!=typeof e)return!1;if("string"==typeof t)return e.startsWith(t)}return!0},stringify=(e,t,r)=>{const n=safeStringify(e,t,r);if(void 0===n)throw new Error("The value could not be stringified");return n};function toPropertyPath(e){return e.replace(/^(\/|#\/)/,"").split("/").map(decodePointerFragment).map(sanitize).join(".")}function sanitize(e){return e.includes(".")?`["${e.replace(/"/g,'\\"')}"]`:e}const KEYS=Symbol.for(createOrderedObject.ORDER_KEY_ID),traps={ownKeys:e=>KEYS in e?e[KEYS]:Reflect.ownKeys(e)},trapAccess=e=>new Proxy(e,traps);function trimStart(e,t){if("string"==typeof e&&"string"==typeof t)return lodash.trimStart(e,t);if(!(e&&Array.isArray(e)&&e.length&&t&&Array.isArray(t)&&t.length))return e;let r=0;for(const n in e)if(e.hasOwnProperty(n)){if(e[n]!==t[n])break;r++}return e.slice(r)}exports.BUNDLE_ROOT=BUNDLE_ROOT,exports.ERRORS_ROOT=ERRORS_ROOT,exports.KEYS=KEYS,exports.bundleTarget=bundleTarget,exports.decodePointer=decodePointer,exports.decodePointerFragment=decodePointerFragment,exports.decodePointerUriFragment=decodePointer,exports.decycle=decycle,exports.encodePointer=encodePointer,exports.encodePointerFragment=encodePointerFragment,exports.encodePointerUriFragment=encodePointerUriFragment,exports.encodeUriPointer=encodeUriPointer,exports.extractPointerFromRef=extractPointerFromRef,exports.extractSourceFromRef=extractSourceFromRef,exports.getFirstPrimitiveProperty=getFirstPrimitiveProperty,exports.getJsonPathForPosition=getJsonPathForPosition,exports.getLastPathSegment=getLastPathSegment,exports.getLocationForJsonPath=getLocationForJsonPath,exports.hasRef=hasRef,exports.isExternalRef=isExternalRef,exports.isLocalRef=isLocalRef,exports.isPlainObject=isPlainObject,exports.parseTree=parseTree,exports.parseWithPointers=parseWithPointers,exports.pathToPointer=pathToPointer,exports.pointerToPath=pointerToPath,exports.remapRefs=remapRefs,exports.renameObjectKey=renameObjectKey,exports.reparentBundleTarget=reparentBundleTarget,exports.resolveExternalRef=resolveExternalRef,exports.resolveExternalRefWithLocation=resolveExternalRefWithLocation,exports.resolveInlineRef=resolveInlineRef,exports.resolveInlineRefWithLocation=resolveInlineRefWithLocation,exports.safeParse=safeParse,exports.safeStringify=safeStringify,exports.startsWith=startsWith,exports.stringify=stringify,exports.toPropertyPath=toPropertyPath,exports.trapAccess=trapAccess,exports.traverse=traverse,exports.trimStart=trimStart; diff --git a/packages/cli/.yalc/@stoplight/json/index.d.ts b/packages/cli/.yalc/@stoplight/json/index.d.ts new file mode 100644 index 000000000..5a5f11593 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/index.d.ts @@ -0,0 +1,36 @@ +export * from './bundle'; +export * from './decodePointer'; +export * from './decodePointerFragment'; +export * from './decodePointerUriFragment'; +export * from './decycle'; +export * from './encodePointer'; +export * from './encodePointerFragment'; +export * from './encodePointerUriFragment'; +export * from './encodeUriPointer'; +export * from './extractPointerFromRef'; +export * from './extractSourceFromRef'; +export * from './getFirstPrimitiveProperty'; +export * from './getJsonPathForPosition'; +export * from './getLastPathSegment'; +export * from './getLocationForJsonPath'; +export * from './hasRef'; +export * from './isExternalRef'; +export * from './isLocalRef'; +export * from './isPlainObject'; +export * from './parseWithPointers'; +export * from './pathToPointer'; +export * from './pointerToPath'; +export * from './remapRefs'; +export * from './renameObjectKey'; +export * from './reparentBundleTarget'; +export * from './resolvers/resolveExternalRef'; +export * from './resolvers/resolveInlineRef'; +export * from './safeParse'; +export * from './safeStringify'; +export * from './startsWith'; +export * from './stringify'; +export * from './toPropertyPath'; +export * from './trapAccess'; +export * from './traverse'; +export * from './trimStart'; +export * from './types'; diff --git a/packages/cli/.yalc/@stoplight/json/index.es.js b/packages/cli/.yalc/@stoplight/json/index.es.js new file mode 100644 index 000000000..8becaf052 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/index.es.js @@ -0,0 +1 @@ +import{cloneDeep as e,get as t,set as r,has as n,setWith as o,omit as i,trimStart as a}from"lodash";import{isAbsolute as s,join as c,dirname as u}from"@stoplight/path";import{createScanner as l,findNodeAtOffset as f,getNodePath as p,visit as h,printParseErrorCode as y}from"jsonc-parser";import g,{getOrder as d,ORDER_KEY_ID as m}from"@stoplight/ordered-object-literal";import{DiagnosticSeverity as v}from"@stoplight/types";import b from"safe-stable-stringify";function w(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype||"function"==typeof e.constructor&&Function.toString.call(Object)===Function.toString.call(e.constructor)}function O(e,t,r){if(!w(e)&&!Array.isArray(e)||!(t in e))throw new ReferenceError(`Could not resolve '${r}'`)}function j(e){if("string"!=typeof e.$ref)throw new TypeError("$ref should be a string")}const A=e=>w(e)&&"$ref"in e,$=e=>A(e)&&"string"==typeof e.$ref,S=e=>e.length>0&&("#"===e||/^#\S*$/.test(e)),E=(e,t,r)=>{const n=e.toString();let o="",i=n,a=0,s=i.indexOf(t);for(;s>-1;)o+=n.substring(a,a+s)+r,i=i.substring(s+t.length,i.length),a+=s+t.length,s=i.indexOf(t);return i.length>0&&(o+=n.substring(n.length-i.length,n.length)),o},x=e=>"number"==typeof e?e:E(E(e,"~","~0"),"/","~1"),_=/[^a-zA–Z0–9_.!~*'()\/\-\u{D800}-\u{DFFF}]/gu;function N(e){return e.replace(_,encodeURIComponent)}const k=e=>{const t=x(e);return"number"==typeof t?t:N(t)},P=e=>I(e),I=e=>{if(e&&"object"!=typeof e)throw new TypeError("Invalid type: path must be an array of segments.");return 0===e.length?"#":`#/${e.map(k).join("/")}`};function T(e){try{return decodeURIComponent(e)}catch(t){return e}}const R=/%[0-9a-f]+/gi,U=e=>{let t;try{t=decodeURIComponent(e)}catch(r){t=e.replace(R,T)}return E(E(t,"~1","/"),"~0","~")},K=e=>J(e),J=e=>{if("string"!=typeof e)throw new TypeError("Invalid type: JSON Pointers are represented as strings.");if(0===e.length||"#"!==e[0])throw new URIError("Invalid JSON Pointer syntax; URI fragment identifiers must begin with a hash.");if(1===e.length)return[];if("/"!==e[1])throw new URIError("Invalid JSON Pointer syntax.");return(e=>{const t=e.length,r=[];let n=-1;for(;++n{const n={value:e,path:r};t.onEnter&&t.onEnter(n);for(const n of Object.keys(e)){const o=e[n];t.onProperty&&t.onProperty({parent:e,parentPath:r,property:n,propertyValue:o}),"object"==typeof o&&null!==o&&C(o,t,r.concat(n))}t.onLeave&&t.onLeave(n)},D=(e,t)=>{"object"==typeof e&&null!==e&&C(e,"function"==typeof t?{onProperty:t}:t,[])};function F(e,t,r){D(e,{onProperty({property:e,propertyValue:n,parent:o}){"$ref"===e&&"string"==typeof n&&n.startsWith(t)&&(o.$ref=`${r}${n.slice(t.length)}`)}})}const M=e=>e.length>0&&"#"!==e[0],V=e=>{if("string"!=typeof e||0===e.length||!M(e))return null;const t=e.indexOf("#");return-1===t?e:e.slice(0,t)};function W(e,t){return w(t)&&w(e)&&("summary"in e||"description"in e)?Object.assign(Object.assign(Object.assign({},t),"description"in e?{description:e.description}:null),"summary"in e?{summary:e.summary}:null):t}function*L(e,t,r){A(e.value)&&(j(e.value),yield[-1,e.value]);for(const[n,o]of t.entries())O(e.value,o,r),e.value=e.value[o],A(e.value)&&(j(e.value),yield[n,e.value])}function B(e,t){return z(e,t).value}function z(e,t){return function e(t,r,n,o){if(null!==V(r))throw new ReferenceError("Cannot resolve external references");const i=K(r);let a=[...i];"#"===r&&A(t)&&(j(t),i.unshift(...K(t.$ref)));const s={value:t};for(const[c,u]of L(s,i,r)){if(n.includes(u))return{source:null,location:null!=o?o:a,value:n[n.length-1]};n.push(u);const r=e(t,u.$ref,n,a);s.value=r.value,(a=r.location).push(...i.slice(c+1))}return{source:null,location:a,value:n.length>0?W(n[n.length-1],s.value):s.value}}(e,t,[])}const Z="#/__bundled__",q="#/__errors__",G=({document:t,path:r,bundleRoot:n="#/__bundled__",errorsRoot:o="#/__errors__",cloneDocument:i=!0,keyProvider:a},s)=>{if(r===n||r===o)throw new Error("Roots do not make any sense");const c=i?e(t):t;return H(c,K(n),K(o),r,a)(r,{[r]:!0},s)},H=(e,a,s,c,u)=>{const l=new Set,f=(p,h,y,g={},d={},m={})=>{const v=K(p),b=t(e,v);D(y||b,{onEnter:({value:s})=>{if($(s)&&S(s.$ref)){const y=s.$ref;if(m[y])return;if(y===p&&(g[y]="#"),g[y])return void(s.$ref=g[y]);let v,b,w,O,j;try{let r;v=K(y),u&&(r=u({document:e,path:v})),r||(r=(({document:e,path:r})=>{if(0===r.length)return"root";if(Array.isArray(t(e,r.slice(0,-1))))return`${r[r.length-2]}_${r[r.length-1]}`;return String(r[r.length-1])})({document:e,path:v})),w=r;let n=1;for(;l.has(w);)if(w=`${r}_${++n}`,n>20)throw new Error(`Keys ${r}_2 through ${r}_20 already taken.`);l.add(w),b=[...a,w],O=P(b)}catch(e){m[y]=e instanceof Error?e.message:String(e)}if(!v||!b||!O)return;if("object"==typeof e&&null!==e&&!(j=t(e,v)))try{j=B(Object(e),y)}catch(e){}void 0!==j&&(g[y]=O,s.$ref=O,n(d,b)||(Array.isArray(j)?r(d,b,new Array(j.length).fill(null)):"object"==typeof j&&o(d,b,{},Object),r(d,b,j),"#"===y?function(e,t,n,o){const a=n.map(e=>`[${JSON.stringify(e)}]`).join(""),s=JSON.parse(JSON.stringify(i(Object(e),a))),c={};r(t,o,s),r(s,n,c),F(s,"#",P(o)),c.$ref="#"}(e,d,K(c),b):h[y]||(h[y]=!0,f(p,h,j,g,d,m),h[y]=!1)))}}});const w=t(d,a);return w&&Object.keys(w).length&&r(b,a,w),(Object.keys(m).length||n(e,s))&&r(b,s,n(e,s)?t(e,s):m),b};return f};const Q=e=>E(E(e,"~1","/"),"~0","~");function X(e,t){const r=new WeakMap,n=new WeakSet;return function e(o,i){if(t&&(o=t(o)),w(o)||Array.isArray(o)){const t=r.get(o);if(t)return{$ref:t};if(r.set(o,P(i)),Array.isArray(o))return o.map((t,r)=>e(t,[...i,r]));const a={};for(const t in o)Object.prototype.hasOwnProperty.call(o,t)&&(a[t]=e(o[t],[...i,t]));return n.has(o)||r.delete(o),n.add(o),a}return o}(e,[])}const Y=e=>E(E(e,"~","~0"),"//","/~1"),ee=e=>{if("string"!=typeof e||0===e.length)return null;const t=e.indexOf("#");return-1===t?null:e.slice(t)},te=e=>{const t=l(e,!0);if(t.scan(),1!==t.getToken())return;if(t.scan(),2===t.getToken())return;if(10!==t.getToken())throw new SyntaxError("Unexpected character");const r=t.getTokenValue();if(t.scan(),6!==t.getToken())throw new SyntaxError("Colon expected");switch(t.scan(),t.getToken()){case 10:return[r,t.getTokenValue()];case 11:return[r,Number(t.getTokenValue())];case 8:return[r,!0];case 9:return[r,!1];case 7:return[r,null];case 16:throw new SyntaxError("Unexpected character");case 17:throw new SyntaxError("Unexpected end of file");default:return}},re=({lineMap:e,ast:t},r)=>{const n=e[r.line],o=e[r.line+1];if(void 0===n)return;const i=f(t,void 0===o?n+r.character:Math.min(o,n+r.character),!0);if(void 0===i)return;const a=p(i);return 0!==a.length?a:void 0};function ne(e){return Q(e.split("/").pop()||"")}const oe=({ast:e},t,r=!1)=>{const n=function(e,t,r){e:for(const n of t){const t=Number.isInteger(Number(n))?Number(n):n;if("string"==typeof t||"number"==typeof t&&"array"!==e.type){if("object"!==e.type||!Array.isArray(e.children))return r?e:void 0;for(const r of e.children)if(Array.isArray(r.children)&&r.children[0].value===String(t)&&2===r.children.length){e=r.children[1];continue e}return r?e:void 0}if("array"!==e.type||t<0||!Array.isArray(e.children)||t>=e.children.length)return r?e:void 0;e=e.children[t]}return e}(e,t,r);if(void 0!==n&&void 0!==n.range)return{range:n.range}};const ie=(e,t={disallowComments:!0})=>{const r=[],{ast:n,data:o,lineMap:i}=ae(e,r,t);return{data:o,diagnostics:r,ast:n,lineMap:i}};function ae(e,t=[],r){const n=ce(e);let o={type:"array",offset:-1,length:-1,children:[],parent:void 0},i=null,a=[];const s=new WeakMap,c=[];function u(e){"property"===o.type&&(o.length=e-o.offset,o=o.parent)}function l(e,t,r){return{start:{line:e,character:t},end:{line:e,character:t+r}}}function f(e){return o.children.push(e),e}function p(e){Array.isArray(a)?a.push(e):null!==i&&(a[i]=e)}function m(e){p(e),c.push(a),a=e,i=null}function b(){a=c.pop()}h(e,{onObjectBegin:(e,t,n,i)=>{o=f({type:"object",offset:e,length:-1,parent:o,children:[],range:l(n,i,t)}),!1===r.ignoreDuplicateKeys&&s.set(o,[]),m(function(e){return e?g({}):{}}(!0===r.preserveKeyOrder))},onObjectProperty:(e,n,c,u,p)=>{if((o=f({type:"property",offset:n,length:-1,parent:o,children:[]})).children.push({type:"string",value:e,offset:n,length:c,parent:o}),!1===r.ignoreDuplicateKeys){const r=s.get(o.parent);r&&(0!==r.length&&r.includes(e)?t.push({range:l(u,p,c),message:"DuplicateKey",severity:v.Error,path:ue(o),code:20}):r.push(e))}!0===r.preserveKeyOrder&&function(e,t){if(!(t in e))return;const r=d(e),n=r.indexOf(t);-1!==n&&(r.splice(n,1),r.push(t))}(a,e),i=e},onObjectEnd:(e,t,n,i)=>{!1===r.ignoreDuplicateKeys&&s.delete(o),o.length=e+t-o.offset,o.range&&(o.range.end.line=n,o.range.end.character=i+t),o=o.parent,u(e+t),b()},onArrayBegin:(e,t,r,n)=>{o=f({type:"array",offset:e,length:-1,parent:o,children:[],range:l(r,n,t)}),m([])},onArrayEnd:(e,t,r,n)=>{o.length=e+t-o.offset,o.range&&(o.range.end.line=r,o.range.end.character=n+t),o=o.parent,u(e+t),b()},onLiteralValue:(e,t,r,n,i)=>{f({type:se(e),offset:t,length:r,parent:o,value:e,range:l(n,i,r)}),u(t+r),p(e)},onSeparator:(e,t)=>{"property"===o.type&&(":"===e?o.colonOffset=t:","===e&&u(t))},onError:(e,r,n,o,i)=>{t.push({range:l(o,i,n),message:y(e),severity:v.Error,code:e})}},r);const w=o.children[0];return w&&delete w.parent,{ast:w,data:a[0],lineMap:n}}function se(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";default:return"null"}}const ce=e=>{const t=[0];let r=0;for(;r{if(!e||!Object.hasOwnProperty.call(e,t)||t===r)return e;const n={};for(const[o,i]of Object.entries(e))o===t?n[r]=i:o in n||(n[o]=i);return n};function fe(e){return w(e)||Array.isArray(e)}function pe(e,t,r){if(r.length<=1||t.length<=1)throw Error("Source/target path must not be empty and point at root");if(0===t.indexOf(r))throw Error("Target path cannot be contained within source");const n=K(t);let o=e;for(const e of n){if(!fe(o))return;o=o[e]}if(!fe(o))return;const i=K(r);let a=e;for(const[e,t]of i.entries()){if(!fe(a)||t in a)return;const r=e===i.length-1?o:{};a[t]=r,a=r}delete e[n[0]],function e(t,r,n){for(const o of Object.keys(t)){const i=t[o];if("$ref"!==o)fe(i)&&e(i,r,n);else{if("string"!=typeof i||!S(i))continue;0===i.indexOf(r)&&(t[o]=i.replace(r,n))}}}(e,t,r)}async function he(e,t,r,n,o){let i=function(e,t){const r=V(t);return null===r?e:s(r)?r:c(u(e),r)}(t,r);const a=ee(r)||"#",l=await e[i],f=K(a);let p=[...f];const h={value:l};for(const[r,s]of L(h,f,a)){if(n.includes(s))return{source:t,location:null!=o?o:p,value:n[n.length-1]};n.push(s);const a=await he(e,i,s.$ref,n,p);({source:i,location:p}=a),h.value=a.value,p.push(...f.slice(r+1))}return{source:i,location:p,value:n.length>0?W(n[n.length-1],h.value):h.value}}async function ye(e,t,r){return(await ge(e,t,r)).value}function ge(e,t,r){return he(e,t,r,[])}const de=(e,t)=>{if("string"!=typeof e)return e;try{const r=me(e);return"string"==typeof r?r:JSON.parse(e,t)}catch(e){return}},me=e=>{const t=Number(e);return Number.isFinite(t)?String(t)===e?t:e:NaN},ve=(e,t,r)=>{if("string"==typeof e)return e;try{return JSON.stringify(e,t,r)}catch(n){return b(e,t,r)}},be=(e,t)=>{if(e instanceof Array){if(t instanceof Array){if(t.length>e.length)return!1;for(const r in t){if(!t.hasOwnProperty(r))continue;const n=parseInt(e[r]),o=parseInt(t[r]);if(isNaN(n)&&isNaN(o)){if(e[r]!==t[r])return!1}else if(n!==o)return!1}}}else{if("string"!=typeof e)return!1;if("string"==typeof t)return e.startsWith(t)}return!0},we=(e,t,r)=>{const n=ve(e,t,r);if(void 0===n)throw new Error("The value could not be stringified");return n};function Oe(e){return e.replace(/^(\/|#\/)/,"").split("/").map(Q).map(je).join(".")}function je(e){return e.includes(".")?`["${e.replace(/"/g,'\\"')}"]`:e}const Ae=Symbol.for(m),$e={ownKeys:e=>Ae in e?e[Ae]:Reflect.ownKeys(e)},Se=e=>new Proxy(e,$e);function Ee(e,t){if("string"==typeof e&&"string"==typeof t)return a(e,t);if(!(e&&Array.isArray(e)&&e.length&&t&&Array.isArray(t)&&t.length))return e;let r=0;for(const n in e)if(e.hasOwnProperty(n)){if(e[n]!==t[n])break;r++}return e.slice(r)}export{Z as BUNDLE_ROOT,q as ERRORS_ROOT,Ae as KEYS,G as bundleTarget,U as decodePointer,Q as decodePointerFragment,U as decodePointerUriFragment,X as decycle,Y as encodePointer,x as encodePointerFragment,k as encodePointerUriFragment,N as encodeUriPointer,ee as extractPointerFromRef,V as extractSourceFromRef,te as getFirstPrimitiveProperty,re as getJsonPathForPosition,ne as getLastPathSegment,oe as getLocationForJsonPath,$ as hasRef,M as isExternalRef,S as isLocalRef,w as isPlainObject,ae as parseTree,ie as parseWithPointers,P as pathToPointer,K as pointerToPath,F as remapRefs,le as renameObjectKey,pe as reparentBundleTarget,ye as resolveExternalRef,ge as resolveExternalRefWithLocation,B as resolveInlineRef,z as resolveInlineRefWithLocation,de as safeParse,ve as safeStringify,be as startsWith,we as stringify,Oe as toPropertyPath,Se as trapAccess,D as traverse,Ee as trimStart}; diff --git a/packages/cli/.yalc/@stoplight/json/isExternalRef.d.ts b/packages/cli/.yalc/@stoplight/json/isExternalRef.d.ts new file mode 100644 index 000000000..a0c2efdb0 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/isExternalRef.d.ts @@ -0,0 +1 @@ +export declare const isExternalRef: (pointer: string) => boolean; diff --git a/packages/cli/.yalc/@stoplight/json/isLocalRef.d.ts b/packages/cli/.yalc/@stoplight/json/isLocalRef.d.ts new file mode 100644 index 000000000..241af9cd1 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/isLocalRef.d.ts @@ -0,0 +1 @@ +export declare const isLocalRef: (pointer: string) => boolean; diff --git a/packages/cli/.yalc/@stoplight/json/isPlainObject.d.ts b/packages/cli/.yalc/@stoplight/json/isPlainObject.d.ts new file mode 100644 index 000000000..421f7a4fd --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/isPlainObject.d.ts @@ -0,0 +1 @@ +export declare function isPlainObject(maybeObj: unknown): maybeObj is Record; diff --git a/packages/cli/.yalc/@stoplight/json/package.json b/packages/cli/.yalc/@stoplight/json/package.json new file mode 100644 index 000000000..b4528b99f --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/package.json @@ -0,0 +1,37 @@ +{ + "name": "@stoplight/json", + "version": "0.0.0", + "description": "Useful functions when working with JSON.", + "keywords": [ + "json", + "json parser", + "json.parse", + "parser", + "sourcemap" + ], + "sideEffects": false, + "files": [ + "**/*" + ], + "author": "Stoplight ", + "repository": { + "type": "git", + "url": "https://github.com/stoplightio/json" + }, + "license": "Apache-2.0", + "engines": { + "node": ">=8.3.0" + }, + "dependencies": { + "@stoplight/ordered-object-literal": "^1.0.3", + "@stoplight/path": "^1.3.2", + "@stoplight/types": "^13.6.0", + "jsonc-parser": "~2.2.1", + "lodash": "^4.17.21", + "safe-stable-stringify": "^1.1" + }, + "main": "index.cjs.js", + "module": "index.es.js", + "typings": "index.d.ts", + "yalcSig": "b57e6c9ef2c538fab0be04b6337078e6" +} diff --git a/packages/cli/.yalc/@stoplight/json/parseWithPointers.d.ts b/packages/cli/.yalc/@stoplight/json/parseWithPointers.d.ts new file mode 100644 index 000000000..d3a7cc20d --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/parseWithPointers.d.ts @@ -0,0 +1,4 @@ +import { IDiagnostic, IParserASTResult } from '@stoplight/types'; +import { IJsonASTNode, IParseOptions, JsonParserResult } from './types'; +export declare const parseWithPointers: (value: string, options?: IParseOptions) => JsonParserResult; +export declare function parseTree(text: string, errors: IDiagnostic[] | undefined, options: IParseOptions): IParserASTResult; diff --git a/packages/cli/.yalc/@stoplight/json/pathToPointer.d.ts b/packages/cli/.yalc/@stoplight/json/pathToPointer.d.ts new file mode 100644 index 000000000..3d2b1d937 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/pathToPointer.d.ts @@ -0,0 +1,2 @@ +import { JsonPath } from '@stoplight/types'; +export declare const pathToPointer: (path: JsonPath) => string; diff --git a/packages/cli/.yalc/@stoplight/json/pointerToPath.d.ts b/packages/cli/.yalc/@stoplight/json/pointerToPath.d.ts new file mode 100644 index 000000000..0fea2114a --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/pointerToPath.d.ts @@ -0,0 +1,2 @@ +import { JsonPath } from '@stoplight/types'; +export declare const pointerToPath: (pointer: string) => JsonPath; diff --git a/packages/cli/.yalc/@stoplight/json/remapRefs.d.ts b/packages/cli/.yalc/@stoplight/json/remapRefs.d.ts new file mode 100644 index 000000000..84e776aaf --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/remapRefs.d.ts @@ -0,0 +1 @@ +export declare function remapRefs(document: unknown, from: string, to: string): void; diff --git a/packages/cli/.yalc/@stoplight/json/renameObjectKey.d.ts b/packages/cli/.yalc/@stoplight/json/renameObjectKey.d.ts new file mode 100644 index 000000000..f2230af37 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/renameObjectKey.d.ts @@ -0,0 +1 @@ +export declare const renameObjectKey: (obj: object, oldKey: string, newKey: string) => object; diff --git a/packages/cli/.yalc/@stoplight/json/reparentBundleTarget.d.ts b/packages/cli/.yalc/@stoplight/json/reparentBundleTarget.d.ts new file mode 100644 index 000000000..021b2c14a --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/reparentBundleTarget.d.ts @@ -0,0 +1 @@ +export declare function reparentBundleTarget(document: Record, from: string, to: string): void; diff --git a/packages/cli/.yalc/@stoplight/json/resolvers/__tests__/resolveSource.spec.d.ts b/packages/cli/.yalc/@stoplight/json/resolvers/__tests__/resolveSource.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/resolvers/__tests__/resolveSource.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/resolvers/guards.d.ts b/packages/cli/.yalc/@stoplight/json/resolvers/guards.d.ts new file mode 100644 index 000000000..9546865e8 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/resolvers/guards.d.ts @@ -0,0 +1,8 @@ +import { Segment } from '@stoplight/types'; +export declare function assertResolvableInput(value: unknown, segment: Segment, pointer: string): asserts value is Record | unknown[]; +export declare function assertObjectWithValidRef(value: Record): asserts value is Record & { + $ref: string; +}; +export declare const hasSomeRef: (obj: unknown) => obj is Record & { + $ref: unknown; +}; diff --git a/packages/cli/.yalc/@stoplight/json/resolvers/resolveExternalRef.d.ts b/packages/cli/.yalc/@stoplight/json/resolvers/resolveExternalRef.d.ts new file mode 100644 index 000000000..ed12a5ba2 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/resolvers/resolveExternalRef.d.ts @@ -0,0 +1,9 @@ +import type { JsonPath } from '@stoplight/types'; +declare type Document = Record | unknown[]; +export declare function resolveExternalRef(inventory: Record>, origin: string, ref: string): Promise; +export declare function resolveExternalRefWithLocation(inventory: Record>, origin: string, ref: string): Promise<{ + source: string; + location: JsonPath; + value: unknown; +}>; +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/resolvers/resolveInlineRef.d.ts b/packages/cli/.yalc/@stoplight/json/resolvers/resolveInlineRef.d.ts new file mode 100644 index 000000000..2b970b97a --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/resolvers/resolveInlineRef.d.ts @@ -0,0 +1,4 @@ +import { Dictionary } from '@stoplight/types'; +import { ResolvedRef } from './types'; +export declare function resolveInlineRef(document: Record, pointer: string): unknown; +export declare function resolveInlineRefWithLocation(document: Dictionary, pointer: string): ResolvedRef; diff --git a/packages/cli/.yalc/@stoplight/json/resolvers/types.d.ts b/packages/cli/.yalc/@stoplight/json/resolvers/types.d.ts new file mode 100644 index 000000000..42924beee --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/resolvers/types.d.ts @@ -0,0 +1,6 @@ +import { JsonPath } from '@stoplight/types'; +export declare type ResolvedRef = { + source: Source; + location: JsonPath; + value: unknown; +}; diff --git a/packages/cli/.yalc/@stoplight/json/resolvers/utils.d.ts b/packages/cli/.yalc/@stoplight/json/resolvers/utils.d.ts new file mode 100644 index 000000000..9ab59b39b --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/resolvers/utils.d.ts @@ -0,0 +1,8 @@ +import { JsonPath } from '@stoplight/types'; +export declare function applyOverrides(document: unknown, value: unknown): unknown; +export declare function resolveSource(origin: string, ref: string): string; +export declare function traverse(ctx: { + value: unknown; +}, path: JsonPath, pointer: string): IterableIterator<[index: number, value: Record & { + $ref: string; +}]>; diff --git a/packages/cli/.yalc/@stoplight/json/safeParse.d.ts b/packages/cli/.yalc/@stoplight/json/safeParse.d.ts new file mode 100644 index 000000000..974939611 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/safeParse.d.ts @@ -0,0 +1 @@ +export declare const safeParse: JSON['parse']; diff --git a/packages/cli/.yalc/@stoplight/json/safeStringify.d.ts b/packages/cli/.yalc/@stoplight/json/safeStringify.d.ts new file mode 100644 index 000000000..1f66afff2 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/safeStringify.d.ts @@ -0,0 +1,2 @@ +import { Optional } from '@stoplight/types'; +export declare const safeStringify: (value: any, replacer?: ((key: string, value: any) => any | Array | null) | undefined, space?: string | number) => Optional; diff --git a/packages/cli/.yalc/@stoplight/json/startsWith.d.ts b/packages/cli/.yalc/@stoplight/json/startsWith.d.ts new file mode 100644 index 000000000..9b552bfba --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/startsWith.d.ts @@ -0,0 +1 @@ +export declare const startsWith: (source: any[] | string, val: any[] | string) => boolean; diff --git a/packages/cli/.yalc/@stoplight/json/stringify.d.ts b/packages/cli/.yalc/@stoplight/json/stringify.d.ts new file mode 100644 index 000000000..5ca21a730 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/stringify.d.ts @@ -0,0 +1 @@ +export declare const stringify: (value: any, replacer?: ((key: string, value: any) => any | Array | null) | undefined, space?: string | number) => string; diff --git a/packages/cli/.yalc/@stoplight/json/toPropertyPath.d.ts b/packages/cli/.yalc/@stoplight/json/toPropertyPath.d.ts new file mode 100644 index 000000000..9711c2818 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/toPropertyPath.d.ts @@ -0,0 +1 @@ +export declare function toPropertyPath(path: string): string; diff --git a/packages/cli/.yalc/@stoplight/json/trapAccess.d.ts b/packages/cli/.yalc/@stoplight/json/trapAccess.d.ts new file mode 100644 index 000000000..765365913 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/trapAccess.d.ts @@ -0,0 +1,2 @@ +export declare const KEYS: unique symbol; +export declare const trapAccess: (target: T) => T; diff --git a/packages/cli/.yalc/@stoplight/json/traverse.d.ts b/packages/cli/.yalc/@stoplight/json/traverse.d.ts new file mode 100644 index 000000000..c6782da9e --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/traverse.d.ts @@ -0,0 +1,19 @@ +import { JsonPath, Segment } from '@stoplight/types'; +declare type Hooks = { + onEnter(ctx: Readonly<{ + value: object; + path: JsonPath; + }>): void; + onLeave(ctx: Readonly<{ + value: object; + path: JsonPath; + }>): void; + onProperty(ctx: Readonly<{ + parent: object; + parentPath: JsonPath; + property: Segment; + propertyValue: unknown; + }>): void; +}; +export declare const traverse: (obj: unknown, hooks: Partial | Hooks['onProperty']) => void; +export {}; diff --git a/packages/cli/.yalc/@stoplight/json/trimStart.d.ts b/packages/cli/.yalc/@stoplight/json/trimStart.d.ts new file mode 100644 index 000000000..5f8de9925 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/trimStart.d.ts @@ -0,0 +1,2 @@ +export declare function trimStart(target: any[], elems: any[]): any[]; +export declare function trimStart(target: string, elems: string): string; diff --git a/packages/cli/.yalc/@stoplight/json/types.d.ts b/packages/cli/.yalc/@stoplight/json/types.d.ts new file mode 100644 index 000000000..6d47f37f8 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/types.d.ts @@ -0,0 +1,17 @@ +import { IParserResult, IRange } from '@stoplight/types'; +import { Node, NodeType, ParseOptions } from 'jsonc-parser'; +export interface IJsonASTNode extends Node { + type: NodeType; + value?: any; + offset: number; + length: number; + range?: IRange; + colonOffset?: number; + parent?: IJsonASTNode; + children?: IJsonASTNode[]; +} +export interface IParseOptions extends ParseOptions { + ignoreDuplicateKeys?: boolean; + preserveKeyOrder?: boolean; +} +export declare type JsonParserResult = IParserResult; diff --git a/packages/cli/.yalc/@stoplight/json/yalc.sig b/packages/cli/.yalc/@stoplight/json/yalc.sig new file mode 100644 index 000000000..eb1962de3 --- /dev/null +++ b/packages/cli/.yalc/@stoplight/json/yalc.sig @@ -0,0 +1 @@ +b57e6c9ef2c538fab0be04b6337078e6 \ No newline at end of file diff --git a/packages/cli/package.json b/packages/cli/package.json index e57fb8ee1..653f441ed 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -7,7 +7,7 @@ }, "bugs": "https://github.com/stoplightio/prism/issues", "dependencies": { - "@stoplight/json": "^3.18.1", + "@stoplight/json": "file:.yalc/@stoplight/json", "@stoplight/json-schema-ref-parser": "9.2.7", "@stoplight/prism-core": "^5.8.0", "@stoplight/prism-http": "^5.8.3", diff --git a/packages/cli/src/extensions.ts b/packages/cli/src/extensions.ts index b8b3ba8da..dd95994a3 100644 --- a/packages/cli/src/extensions.ts +++ b/packages/cli/src/extensions.ts @@ -4,6 +4,7 @@ import { get, camelCase, forOwn } from 'lodash'; import { JSONSchemaFaker } from 'json-schema-faker'; import type { JSONSchemaFakerOptions } from 'json-schema-faker'; import { resetJSONSchemaGenerator } from '@stoplight/prism-http'; +import { JsonPath, Segment } from '@stoplight/types'; export async function configureExtensionsUserProvided( specFilePathOrObject: string | object, @@ -35,3 +36,101 @@ function setFakerValue(option: string, value: any) { // @ts-ignore JSONSchemaFaker.option(camelCase(option) as keyof JSONSchemaFakerOptions, value); } + +// export function decycle(obj: unknown, replacer?: (value: any) => any) { +// console.log('IN MY CODE DECYCLE FUNCTION'); +// const objs = new WeakMap(); +// const processedObjs = new WeakSet(); +// function derez(value: any, path: (string | number)[]): any { +// if (replacer) { +// value = replacer(value); +// } +// if (isPlainObject(value) || Array.isArray(value)) { +// // The path of an earlier occurance of value +// const oldPath = objs.get(value); +// // If the value is an object or array, look to see if we have already // encountered it. If so, return a {"$ref":PATH} object. +// if (oldPath) { +// return { $ref: oldPath }; +// } +// objs.set(value, pathToPointer(path)); +// // If it is an array, replicate the array. +// if (Array.isArray(value)) { +// return value.map((element, i) => derez(element, [...path, i])); +// } +// const newObj: Record = {}; +// for (const name in value) { +// if (Object.prototype.hasOwnProperty.call(value, name)) { +// newObj[name] = derez(value[name], [...path, name]); +// } +// } +// // Only delete the object from the map if it has not been processed before +// if (!processedObjs.has(value)) { +// objs.delete(value); +// } +// processedObjs.add(value); +// return newObj; +// } +// return value; +// } +// return derez(obj, []); +// } + +// export function isPlainObject(maybeObj: unknown): maybeObj is Record { +// if (typeof maybeObj !== 'object' || maybeObj === null) { +// return false; +// } +// const proto = Object.getPrototypeOf(maybeObj); +// return ( +// proto === null || +// proto === Object.prototype || +// // this is to be more compatible with Lodash.isPlainObject that also checks the constructor +// (typeof maybeObj.constructor === 'function' && +// Function.toString.call(Object) === Function.toString.call(maybeObj.constructor)) +// ); +// } + +// export const pathToPointer = (path: JsonPath): string => { +// const encodeUriFragmentIdentifier = (path: JsonPath): string => { +// if (path && typeof path !== 'object') { +// throw new TypeError('Invalid type: path must be an array of segments.'); +// } +// if (path.length === 0) { +// return '#'; +// } +// return `#/${path.map(encodePointerUriFragment).join('/')}`; +// }; + +// return encodeUriFragmentIdentifier(path); +// }; + +// export const encodePointerUriFragment = (value: Segment): Segment => { +// const encoded = encodePointerFragment(value); +// return typeof encoded === 'number' ? encoded : encodeUriPointer(encoded); +// }; + +// export const encodePointerFragment = (value: Segment): Segment => { +// return typeof value === 'number' ? value : replaceInString(replaceInString(value, '~', '~0'), '/', '~1'); +// }; + +// export const replaceInString = (str: string, find: string, repl: string): string => { +// const orig = str.toString(); +// let res = ''; +// let rem = orig; +// let beg = 0; +// let end = rem.indexOf(find); +// while (end > -1) { +// res += orig.substring(beg, beg + end) + repl; +// rem = rem.substring(end + find.length, rem.length); +// beg += end + find.length; +// end = rem.indexOf(find); +// } +// if (rem.length > 0) { +// res += orig.substring(orig.length - rem.length, orig.length); +// } +// return res; +// }; + +// export function encodeUriPointer(pointer: string): string { +// const ENCODABLE_CHAR = /[^a-zA–Z0–9_.!~*'()\/\-\u{D800}-\u{DFFF}]/gu; +// return pointer.replace(ENCODABLE_CHAR, encodeURIComponent); +// } diff --git a/packages/cli/yalc.lock b/packages/cli/yalc.lock new file mode 100644 index 000000000..82c8bc4e2 --- /dev/null +++ b/packages/cli/yalc.lock @@ -0,0 +1,11 @@ +{ + "version": "v1", + "packages": { + "@stoplight/json": { + "version": "0.0.0", + "signature": "b57e6c9ef2c538fab0be04b6337078e6", + "file": true, + "replaced": "^3.18.1" + } + } +} \ No newline at end of file diff --git a/packages/http/.yalc/@stoplight/json/LICENSE b/packages/http/.yalc/@stoplight/json/LICENSE new file mode 100644 index 000000000..ba50e461e --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/LICENSE @@ -0,0 +1,190 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2018 Stoplight, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/http/.yalc/@stoplight/json/README.md b/packages/http/.yalc/@stoplight/json/README.md new file mode 100644 index 000000000..44f8408e6 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/README.md @@ -0,0 +1,70 @@ +# @stoplight/json + +[![Maintainability](https://api.codeclimate.com/v1/badges/85d2215f8b1e8a15214f/maintainability)](https://codeclimate.com/github/stoplightio/json/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/85d2215f8b1e8a15214f/test_coverage)](https://codeclimate.com/github/stoplightio/json/test_coverage) + +Useful functions when working with JSON. + +- View the changelog: [Releases](https://github.com/stoplightio/json/releases) + +### Installation + +Supported in modern browsers and node. + +```bash +# latest stable version +yarn add @stoplight/json +``` + +### Usage + +- **[parseWithPointers](https://stoplightio.github.io/json/globals.html#parsewithpointers)**: Like `JSON.parse(val)` but also returns parsing errors as well as full ast with line information. +- **[pathToPointer](https://stoplightio.github.io/json/globals.html#pathtopointer)**: Turns an array of path segments into a json pointer IE `['paths', '/user', 'get']` -> `#/paths/~1user/get`. +- **[pointerToPath](https://stoplightio.github.io/json/globals.html#pointertopath)**: Turns a json pointer into an array of path segments IE `#/paths/~1user/get` -> `['paths', '/user', 'get']`. +- **[safeParse](https://stoplightio.github.io/json/globals.html#safeparse)**: Like `JSON.parse(val)` but does not throw on invalid JSON. +- **[safeStringify](https://stoplightio.github.io/json/globals.html#safestringify)**: Like `JSON.stringify(val)` but handles circular references. +- **[startsWith](https://stoplightio.github.io/json/globals.html#startswith)**: Like native JS `x.startsWith(y)` but works with strings AND arrays. +- **[trimStart](https://stoplightio.github.io/json/globals.html#trimstart)**: Like `lodash.startsWith(x, y)` but works with strings AND arrays. +- **[getJsonPathForPosition](https://stoplightio.github.io/json/globals.html#getjsonpathforposition)**: Computes JSON path for given position. +- **[getLocationForJsonPath](https://stoplightio.github.io/json/globals.html#getlocationforjsonpath)**: Retrieves location of node matching given JSON path. + +#### Example `parseWithPointers` + +```ts +import { parseWithPointers } from "@stoplight/json"; + +const result = parseWithPointers('{"foo": "bar"}'); + +console.log(result.data); // => the {foo: "bar"} JS object +console.log(result.pointers); // => the source map with a single "#/foo" pointer that has position info for the foo property +``` + +```ts +// basic example of getJsonPathForPosition and getLocationForJsonPath +import { getJsonPathForPosition, getLocationForJsonPath, parseWithPointers } from "@stoplight/json"; + +const result = parseWithPointers(`{ + "hello": "world", + "address": { + "street": 123 + } +}`); + +const path = getJsonPathForPosition(result, { line: 3, character: 15 }); // line and character are 0-based +console.log(path); // -> ["address", "street"]; + +const position = getLocationForJsonPath(result, ["address"]); +console.log(position.range.start); // { line: 2, character: 13 } line and character are 0-based +console.log(position.range.end); // { line: 4, character: 3 } line and character are 0-based +``` + +### Contributing + +1. Clone repo. +2. Create / checkout `feature/{name}`, `chore/{name}`, or `fix/{name}` branch. +3. Install deps: `yarn`. +4. Make your changes. +5. Run tests: `yarn test.prod`. +6. Stage relevant files to git. +7. Commit: `yarn commit`. _NOTE: Commits that don't follow the [conventional](https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional) format will be rejected. `yarn commit` creates this format for you, or you can put it together manually and then do a regular `git commit`._ +8. Push: `git push`. +9. Open PR targeting the `next` branch. diff --git a/packages/http/.yalc/@stoplight/json/__tests__/bundle.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/bundle.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/bundle.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/decodePointer.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/decodePointer.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/decodePointer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/decodePointerFragment.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/decodePointerFragment.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/decodePointerFragment.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/decycle.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/decycle.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/decycle.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/encodePointer.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/encodePointer.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/encodePointer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/encodePointerFragment.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/encodePointerFragment.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/encodePointerFragment.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/extractPointerFromRef.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/extractPointerFromRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/extractPointerFromRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/extractSourceFromRef.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/extractSourceFromRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/extractSourceFromRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/fixtures/json.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/fixtures/json.d.ts new file mode 100644 index 000000000..33c736823 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/fixtures/json.d.ts @@ -0,0 +1,6 @@ +export declare const small: any; +export declare const smallString: string; +export declare const smallCircular: any; +export declare const large: any; +export declare const largeString: string; +export declare const largeCircular: any; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/getFirstPrimitiveProperty.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/getFirstPrimitiveProperty.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/getFirstPrimitiveProperty.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/getJsonPathForPosition.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/getJsonPathForPosition.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/getJsonPathForPosition.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/getLastPathSegment.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/getLastPathSegment.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/getLastPathSegment.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/getLocationForJsonPath.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/getLocationForJsonPath.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/getLocationForJsonPath.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/hasRef.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/hasRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/hasRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/isLocalRef.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/isLocalRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/isLocalRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/isPlainObject.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/isPlainObject.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/isPlainObject.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/parseWithPointers.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/parseWithPointers.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/parseWithPointers.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/pathToPointer.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/pathToPointer.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/pathToPointer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/pointerToPath.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/pointerToPath.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/pointerToPath.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/renameObjectKeys.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/renameObjectKeys.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/renameObjectKeys.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/reparentBundleTarget.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/reparentBundleTarget.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/reparentBundleTarget.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/resolveExternalRef.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/resolveExternalRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/resolveExternalRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/resolveInlineRef.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/resolveInlineRef.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/resolveInlineRef.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/safeParse.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/safeParse.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/safeParse.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/safeStringify.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/safeStringify.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/safeStringify.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/startsWith.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/startsWith.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/startsWith.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/stringify.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/stringify.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/stringify.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/toPropertyPath.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/toPropertyPath.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/toPropertyPath.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/trapAccess.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/trapAccess.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/trapAccess.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/traverse.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/traverse.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/traverse.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/__tests__/trimStart.spec.d.ts b/packages/http/.yalc/@stoplight/json/__tests__/trimStart.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/__tests__/trimStart.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/_utils.d.ts b/packages/http/.yalc/@stoplight/json/_utils.d.ts new file mode 100644 index 000000000..e1dd24868 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/_utils.d.ts @@ -0,0 +1 @@ +export declare const replaceInString: (str: string, find: string, repl: string) => string; diff --git a/packages/http/.yalc/@stoplight/json/bundle.d.ts b/packages/http/.yalc/@stoplight/json/bundle.d.ts new file mode 100644 index 000000000..68290bcaf --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/bundle.d.ts @@ -0,0 +1,16 @@ +import { JsonPath } from '@stoplight/types'; +export declare const BUNDLE_ROOT = "#/__bundled__"; +export declare const ERRORS_ROOT = "#/__errors__"; +declare type KeyProviderFn = (props: { + document: unknown; + path: JsonPath; +}) => string | void | undefined | null; +export declare const bundleTarget: ({ document, path, bundleRoot, errorsRoot, cloneDocument, keyProvider, }: { + document: T; + path: string; + bundleRoot?: string | undefined; + errorsRoot?: string | undefined; + cloneDocument?: boolean | undefined; + keyProvider?: KeyProviderFn | undefined; +}, cur?: unknown) => any; +export {}; diff --git a/packages/http/.yalc/@stoplight/json/decodePointer.d.ts b/packages/http/.yalc/@stoplight/json/decodePointer.d.ts new file mode 100644 index 000000000..8dbccbe31 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/decodePointer.d.ts @@ -0,0 +1 @@ +export declare const decodePointer: (value: string) => string; diff --git a/packages/http/.yalc/@stoplight/json/decodePointerFragment.d.ts b/packages/http/.yalc/@stoplight/json/decodePointerFragment.d.ts new file mode 100644 index 000000000..c68f4e89c --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/decodePointerFragment.d.ts @@ -0,0 +1 @@ +export declare const decodePointerFragment: (value: string) => string; diff --git a/packages/http/.yalc/@stoplight/json/decodePointerUriFragment.d.ts b/packages/http/.yalc/@stoplight/json/decodePointerUriFragment.d.ts new file mode 100644 index 000000000..d94c9f511 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/decodePointerUriFragment.d.ts @@ -0,0 +1 @@ +export { decodePointer as decodePointerUriFragment } from './decodePointer'; diff --git a/packages/http/.yalc/@stoplight/json/decycle.d.ts b/packages/http/.yalc/@stoplight/json/decycle.d.ts new file mode 100644 index 000000000..cfc0e945e --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/decycle.d.ts @@ -0,0 +1 @@ +export declare function decycle(obj: unknown, replacer?: (value: any) => any): any; diff --git a/packages/http/.yalc/@stoplight/json/decycle2.d.ts b/packages/http/.yalc/@stoplight/json/decycle2.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/http/.yalc/@stoplight/json/encodePointer.d.ts b/packages/http/.yalc/@stoplight/json/encodePointer.d.ts new file mode 100644 index 000000000..dcbbede68 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/encodePointer.d.ts @@ -0,0 +1 @@ +export declare const encodePointer: (value: string) => string; diff --git a/packages/http/.yalc/@stoplight/json/encodePointerFragment.d.ts b/packages/http/.yalc/@stoplight/json/encodePointerFragment.d.ts new file mode 100644 index 000000000..f27f9b933 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/encodePointerFragment.d.ts @@ -0,0 +1,2 @@ +import { Segment } from '@stoplight/types'; +export declare const encodePointerFragment: (value: Segment) => Segment; diff --git a/packages/http/.yalc/@stoplight/json/encodePointerUriFragment.d.ts b/packages/http/.yalc/@stoplight/json/encodePointerUriFragment.d.ts new file mode 100644 index 000000000..12d7497ff --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/encodePointerUriFragment.d.ts @@ -0,0 +1,2 @@ +import { Segment } from '@stoplight/types'; +export declare const encodePointerUriFragment: (value: Segment) => Segment; diff --git a/packages/http/.yalc/@stoplight/json/encodeUriPointer.d.ts b/packages/http/.yalc/@stoplight/json/encodeUriPointer.d.ts new file mode 100644 index 000000000..6dc085426 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/encodeUriPointer.d.ts @@ -0,0 +1 @@ +export declare function encodeUriPointer(pointer: string): string; diff --git a/packages/http/.yalc/@stoplight/json/extractPointerFromRef.d.ts b/packages/http/.yalc/@stoplight/json/extractPointerFromRef.d.ts new file mode 100644 index 000000000..9f81d06ca --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/extractPointerFromRef.d.ts @@ -0,0 +1 @@ +export declare const extractPointerFromRef: (ref: string) => string | null; diff --git a/packages/http/.yalc/@stoplight/json/extractSourceFromRef.d.ts b/packages/http/.yalc/@stoplight/json/extractSourceFromRef.d.ts new file mode 100644 index 000000000..230017304 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/extractSourceFromRef.d.ts @@ -0,0 +1 @@ +export declare const extractSourceFromRef: (ref: unknown) => string | null; diff --git a/packages/http/.yalc/@stoplight/json/getFirstPrimitiveProperty.d.ts b/packages/http/.yalc/@stoplight/json/getFirstPrimitiveProperty.d.ts new file mode 100644 index 000000000..b33ffbea5 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/getFirstPrimitiveProperty.d.ts @@ -0,0 +1,2 @@ +import { Optional } from '@stoplight/types'; +export declare const getFirstPrimitiveProperty: (text: string) => Optional<[string, string | number | boolean | null]>; diff --git a/packages/http/.yalc/@stoplight/json/getJsonPathForPosition.d.ts b/packages/http/.yalc/@stoplight/json/getJsonPathForPosition.d.ts new file mode 100644 index 000000000..e292beb44 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/getJsonPathForPosition.d.ts @@ -0,0 +1,3 @@ +import { GetJsonPathForPosition } from '@stoplight/types'; +import { JsonParserResult } from './types'; +export declare const getJsonPathForPosition: GetJsonPathForPosition>; diff --git a/packages/http/.yalc/@stoplight/json/getLastPathSegment.d.ts b/packages/http/.yalc/@stoplight/json/getLastPathSegment.d.ts new file mode 100644 index 000000000..3e15d6536 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/getLastPathSegment.d.ts @@ -0,0 +1 @@ +export declare function getLastPathSegment(path: string): string; diff --git a/packages/http/.yalc/@stoplight/json/getLocationForJsonPath.d.ts b/packages/http/.yalc/@stoplight/json/getLocationForJsonPath.d.ts new file mode 100644 index 000000000..a997f535d --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/getLocationForJsonPath.d.ts @@ -0,0 +1,3 @@ +import { GetLocationForJsonPath } from '@stoplight/types'; +import { JsonParserResult } from './types'; +export declare const getLocationForJsonPath: GetLocationForJsonPath>; diff --git a/packages/http/.yalc/@stoplight/json/hasRef.d.ts b/packages/http/.yalc/@stoplight/json/hasRef.d.ts new file mode 100644 index 000000000..3047ec4ce --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/hasRef.d.ts @@ -0,0 +1,3 @@ +export declare const hasRef: (obj: unknown) => obj is Record & { + $ref: string; +}; diff --git a/packages/http/.yalc/@stoplight/json/index.cjs.js b/packages/http/.yalc/@stoplight/json/index.cjs.js new file mode 100644 index 000000000..d4eb87f19 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/index.cjs.js @@ -0,0 +1 @@ +"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var lodash=require("lodash"),path=require("@stoplight/path"),jsoncParser=require("jsonc-parser"),createOrderedObject=require("@stoplight/ordered-object-literal"),createOrderedObject__default=_interopDefault(createOrderedObject),types=require("@stoplight/types"),fastStringify=_interopDefault(require("safe-stable-stringify"));function isPlainObject(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype||"function"==typeof e.constructor&&Function.toString.call(Object)===Function.toString.call(e.constructor)}function assertResolvableInput(e,t,r){if(!isPlainObject(e)&&!Array.isArray(e)||!(t in e))throw new ReferenceError(`Could not resolve '${r}'`)}function assertObjectWithValidRef(e){if("string"!=typeof e.$ref)throw new TypeError("$ref should be a string")}const hasSomeRef=e=>isPlainObject(e)&&"$ref"in e,hasRef=e=>hasSomeRef(e)&&"string"==typeof e.$ref,isLocalRef=e=>e.length>0&&("#"===e||/^#\S*$/.test(e)),replaceInString=(e,t,r)=>{const n=e.toString();let o="",i=n,a=0,s=i.indexOf(t);for(;s>-1;)o+=n.substring(a,a+s)+r,i=i.substring(s+t.length,i.length),a+=s+t.length,s=i.indexOf(t);return i.length>0&&(o+=n.substring(n.length-i.length,n.length)),o},encodePointerFragment=e=>"number"==typeof e?e:replaceInString(replaceInString(e,"~","~0"),"/","~1"),ENCODABLE_CHAR=/[^a-zA–Z0–9_.!~*'()\/\-\u{D800}-\u{DFFF}]/gu;function encodeUriPointer(e){return e.replace(ENCODABLE_CHAR,encodeURIComponent)}const encodePointerUriFragment=e=>{const t=encodePointerFragment(e);return"number"==typeof t?t:encodeUriPointer(t)},pathToPointer=e=>encodeUriFragmentIdentifier(e),encodeUriFragmentIdentifier=e=>{if(e&&"object"!=typeof e)throw new TypeError("Invalid type: path must be an array of segments.");return 0===e.length?"#":`#/${e.map(encodePointerUriFragment).join("/")}`};function safeDecodeURIComponent(e){try{return decodeURIComponent(e)}catch(t){return e}}const PERCENT_ENCODING_OCTET=/%[0-9a-f]+/gi,decodePointer=e=>{let t;try{t=decodeURIComponent(e)}catch(r){t=e.replace(PERCENT_ENCODING_OCTET,safeDecodeURIComponent)}return replaceInString(replaceInString(t,"~1","/"),"~0","~")},pointerToPath=e=>decodeUriFragmentIdentifier(e),decodeFragmentSegments=e=>{const t=e.length,r=[];let n=-1;for(;++n{if("string"!=typeof e)throw new TypeError("Invalid type: JSON Pointers are represented as strings.");if(0===e.length||"#"!==e[0])throw new URIError("Invalid JSON Pointer syntax; URI fragment identifiers must begin with a hash.");if(1===e.length)return[];if("/"!==e[1])throw new URIError("Invalid JSON Pointer syntax.");return decodeFragmentSegments(e.substring(2).split("/"))},_traverse=(e,t,r)=>{const n={value:e,path:r};t.onEnter&&t.onEnter(n);for(const n of Object.keys(e)){const o=e[n];t.onProperty&&t.onProperty({parent:e,parentPath:r,property:n,propertyValue:o}),"object"==typeof o&&null!==o&&_traverse(o,t,r.concat(n))}t.onLeave&&t.onLeave(n)},traverse=(e,t)=>{"object"==typeof e&&null!==e&&_traverse(e,"function"==typeof t?{onProperty:t}:t,[])};function remapRefs(e,t,r){traverse(e,{onProperty({property:e,propertyValue:n,parent:o}){"$ref"===e&&"string"==typeof n&&n.startsWith(t)&&(o.$ref=`${r}${n.slice(t.length)}`)}})}const isExternalRef=e=>e.length>0&&"#"!==e[0],extractSourceFromRef=e=>{if("string"!=typeof e||0===e.length||!isExternalRef(e))return null;const t=e.indexOf("#");return-1===t?e:e.slice(0,t)};function applyOverrides(e,t){return isPlainObject(t)&&isPlainObject(e)&&("summary"in e||"description"in e)?Object.assign(Object.assign(Object.assign({},t),"description"in e?{description:e.description}:null),"summary"in e?{summary:e.summary}:null):t}function resolveSource(e,t){const r=extractSourceFromRef(t);return null===r?e:path.isAbsolute(r)?r:path.join(path.dirname(e),r)}function*traverse$1(e,t,r){hasSomeRef(e.value)&&(assertObjectWithValidRef(e.value),yield[-1,e.value]);for(const[n,o]of t.entries())assertResolvableInput(e.value,o,r),e.value=e.value[o],hasSomeRef(e.value)&&(assertObjectWithValidRef(e.value),yield[n,e.value])}function _resolveInlineRefWithLocation(e,t,r,n){if(null!==extractSourceFromRef(t))throw new ReferenceError("Cannot resolve external references");const o=pointerToPath(t);let i=[...o];"#"===t&&hasSomeRef(e)&&(assertObjectWithValidRef(e),o.unshift(...pointerToPath(e.$ref)));const a={value:e};for(const[s,c]of traverse$1(a,o,t)){if(r.includes(c))return{source:null,location:null!=n?n:i,value:r[r.length-1]};r.push(c);const t=_resolveInlineRefWithLocation(e,c.$ref,r,i);a.value=t.value,(i=t.location).push(...o.slice(s+1))}return{source:null,location:i,value:r.length>0?applyOverrides(r[r.length-1],a.value):a.value}}function resolveInlineRef(e,t){return resolveInlineRefWithLocation(e,t).value}function resolveInlineRefWithLocation(e,t){return _resolveInlineRefWithLocation(e,t,[])}const BUNDLE_ROOT="#/__bundled__",ERRORS_ROOT="#/__errors__",bundleTarget=({document:e,path:t,bundleRoot:r=BUNDLE_ROOT,errorsRoot:n=ERRORS_ROOT,cloneDocument:o=!0,keyProvider:i},a)=>{if(t===r||t===n)throw new Error("Roots do not make any sense");const s=o?lodash.cloneDeep(e):e;return bundle(s,pointerToPath(r),pointerToPath(n),t,i)(t,{[t]:!0},a)},defaultKeyProvider=({document:e,path:t})=>{if(0===t.length)return"root";if(Array.isArray(lodash.get(e,t.slice(0,-1)))){return`${t[t.length-2]}_${t[t.length-1]}`}return String(t[t.length-1])},bundle=(e,t,r,n,o)=>{const i=new Set,a=(s,c,l,f={},u={},p={})=>{const h=pointerToPath(s),d=lodash.get(e,h);traverse(l||d,{onEnter:({value:r})=>{if(hasRef(r)&&isLocalRef(r.$ref)){const l=r.$ref;if(p[l])return;if(l===s&&(f[l]="#"),f[l])return void(r.$ref=f[l]);let h,d,g,y,P;try{let r;h=pointerToPath(l),o&&(r=o({document:e,path:h})),r||(r=defaultKeyProvider({document:e,path:h})),g=r;let n=1;for(;i.has(g);)if(g=`${r}_${++n}`,n>20)throw new Error(`Keys ${r}_2 through ${r}_20 already taken.`);i.add(g),d=[...t,g],y=pathToPointer(d)}catch(e){p[l]=e instanceof Error?e.message:String(e)}if(!h||!d||!y)return;if("object"==typeof e&&null!==e&&!(P=lodash.get(e,h)))try{P=resolveInlineRef(Object(e),l)}catch(e){}void 0!==P&&(f[l]=y,r.$ref=y,lodash.has(u,d)||(Array.isArray(P)?lodash.set(u,d,new Array(P.length).fill(null)):"object"==typeof P&&lodash.setWith(u,d,{},Object),lodash.set(u,d,P),"#"===l?bundleRootDocument(e,u,pointerToPath(n),d):c[l]||(c[l]=!0,a(s,c,P,f,u,p),c[l]=!1)))}}});const g=lodash.get(u,t);return g&&Object.keys(g).length&&lodash.set(d,t,g),(Object.keys(p).length||lodash.has(e,r))&&lodash.set(d,r,lodash.has(e,r)?lodash.get(e,r):p),d};return a};function bundleRootDocument(e,t,r,n){const o=r.map(e=>`[${JSON.stringify(e)}]`).join(""),i=JSON.parse(JSON.stringify(lodash.omit(Object(e),o))),a={};lodash.set(t,n,i),lodash.set(i,r,a),remapRefs(i,"#",pathToPointer(n)),a.$ref="#"}const decodePointerFragment=e=>replaceInString(replaceInString(e,"~1","/"),"~0","~");function decycle(e,t){const r=new WeakMap,n=new WeakSet;return function e(o,i){if(t&&(o=t(o)),isPlainObject(o)||Array.isArray(o)){const t=r.get(o);if(t)return{$ref:t};if(r.set(o,pathToPointer(i)),Array.isArray(o))return o.map((t,r)=>e(t,[...i,r]));const a={};for(const t in o)Object.prototype.hasOwnProperty.call(o,t)&&(a[t]=e(o[t],[...i,t]));return n.has(o)||r.delete(o),n.add(o),a}return o}(e,[])}const encodePointer=e=>replaceInString(replaceInString(e,"~","~0"),"//","/~1"),extractPointerFromRef=e=>{if("string"!=typeof e||0===e.length)return null;const t=e.indexOf("#");return-1===t?null:e.slice(t)},getFirstPrimitiveProperty=e=>{const t=jsoncParser.createScanner(e,!0);if(t.scan(),1!==t.getToken())return;if(t.scan(),2===t.getToken())return;if(10!==t.getToken())throw new SyntaxError("Unexpected character");const r=t.getTokenValue();if(t.scan(),6!==t.getToken())throw new SyntaxError("Colon expected");switch(t.scan(),t.getToken()){case 10:return[r,t.getTokenValue()];case 11:return[r,Number(t.getTokenValue())];case 8:return[r,!0];case 9:return[r,!1];case 7:return[r,null];case 16:throw new SyntaxError("Unexpected character");case 17:throw new SyntaxError("Unexpected end of file");default:return}},getJsonPathForPosition=({lineMap:e,ast:t},r)=>{const n=e[r.line],o=e[r.line+1];if(void 0===n)return;const i=jsoncParser.findNodeAtOffset(t,void 0===o?n+r.character:Math.min(o,n+r.character),!0);if(void 0===i)return;const a=jsoncParser.getNodePath(i);return 0!==a.length?a:void 0};function getLastPathSegment(e){return decodePointerFragment(e.split("/").pop()||"")}const getLocationForJsonPath=({ast:e},t,r=!1)=>{const n=findNodeAtPath(e,t,r);if(void 0!==n&&void 0!==n.range)return{range:n.range}};function findNodeAtPath(e,t,r){e:for(const n of t){const t=Number.isInteger(Number(n))?Number(n):n;if("string"==typeof t||"number"==typeof t&&"array"!==e.type){if("object"!==e.type||!Array.isArray(e.children))return r?e:void 0;for(const r of e.children)if(Array.isArray(r.children)&&r.children[0].value===String(t)&&2===r.children.length){e=r.children[1];continue e}return r?e:void 0}if("array"!==e.type||t<0||!Array.isArray(e.children)||t>=e.children.length)return r?e:void 0;e=e.children[t]}return e}const parseWithPointers=(e,t={disallowComments:!0})=>{const r=[],{ast:n,data:o,lineMap:i}=parseTree(e,r,t);return{data:o,diagnostics:r,ast:n,lineMap:i}};function parseTree(e,t=[],r){const n=computeLineMap(e);let o={type:"array",offset:-1,length:-1,children:[],parent:void 0},i=null,a=[];const s=new WeakMap,c=[];function l(e){"property"===o.type&&(o.length=e-o.offset,o=o.parent)}function f(e,t,r){return{start:{line:e,character:t},end:{line:e,character:t+r}}}function u(e){return o.children.push(e),e}function p(e){Array.isArray(a)?a.push(e):null!==i&&(a[i]=e)}function h(e){p(e),c.push(a),a=e,i=null}function d(){a=c.pop()}const g={onObjectBegin:(e,t,n,i)=>{o=u({type:"object",offset:e,length:-1,parent:o,children:[],range:f(n,i,t)}),!1===r.ignoreDuplicateKeys&&s.set(o,[]),h(createObjectLiteral(!0===r.preserveKeyOrder))},onObjectProperty:(e,n,c,l,p)=>{if((o=u({type:"property",offset:n,length:-1,parent:o,children:[]})).children.push({type:"string",value:e,offset:n,length:c,parent:o}),!1===r.ignoreDuplicateKeys){const r=s.get(o.parent);r&&(0!==r.length&&r.includes(e)?t.push({range:f(l,p,c),message:"DuplicateKey",severity:types.DiagnosticSeverity.Error,path:getJsonPath(o),code:20}):r.push(e))}!0===r.preserveKeyOrder&&swapKey(a,e),i=e},onObjectEnd:(e,t,n,i)=>{!1===r.ignoreDuplicateKeys&&s.delete(o),o.length=e+t-o.offset,o.range&&(o.range.end.line=n,o.range.end.character=i+t),o=o.parent,l(e+t),d()},onArrayBegin:(e,t,r,n)=>{o=u({type:"array",offset:e,length:-1,parent:o,children:[],range:f(r,n,t)}),h([])},onArrayEnd:(e,t,r,n)=>{o.length=e+t-o.offset,o.range&&(o.range.end.line=r,o.range.end.character=n+t),o=o.parent,l(e+t),d()},onLiteralValue:(e,t,r,n,i)=>{u({type:getLiteralNodeType(e),offset:t,length:r,parent:o,value:e,range:f(n,i,r)}),l(t+r),p(e)},onSeparator:(e,t)=>{"property"===o.type&&(":"===e?o.colonOffset=t:","===e&&l(t))},onError:(e,r,n,o,i)=>{t.push({range:f(o,i,n),message:jsoncParser.printParseErrorCode(e),severity:types.DiagnosticSeverity.Error,code:e})}};jsoncParser.visit(e,g,r);const y=o.children[0];return y&&delete y.parent,{ast:y,data:a[0],lineMap:n}}function getLiteralNodeType(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";default:return"null"}}const computeLineMap=e=>{const t=[0];let r=0;for(;r{if(!e||!Object.hasOwnProperty.call(e,t)||t===r)return e;const n={};for(const[o,i]of Object.entries(e))o===t?n[r]=i:o in n||(n[o]=i);return n};function isObject(e){return isPlainObject(e)||Array.isArray(e)}function reparentBundleTarget(e,t,r){if(r.length<=1||t.length<=1)throw Error("Source/target path must not be empty and point at root");if(0===t.indexOf(r))throw Error("Target path cannot be contained within source");const n=pointerToPath(t);let o=e;for(const e of n){if(!isObject(o))return;o=o[e]}if(!isObject(o))return;const i=pointerToPath(r);let a=e;for(const[e,t]of i.entries()){if(!isObject(a)||t in a)return;const r=e===i.length-1?o:{};a[t]=r,a=r}delete e[n[0]],_reparentBundleTarget(e,t,r)}function _reparentBundleTarget(e,t,r){for(const n of Object.keys(e)){const o=e[n];if("$ref"!==n)isObject(o)&&_reparentBundleTarget(o,t,r);else{if("string"!=typeof o||!isLocalRef(o))continue;0===o.indexOf(t)&&(e[n]=o.replace(t,r))}}}async function _resolveExternalRefWithLocation(e,t,r,n,o){let i=resolveSource(t,r);const a=extractPointerFromRef(r)||"#",s=await e[i],c=pointerToPath(a);let l=[...c];const f={value:s};for(const[r,s]of traverse$1(f,c,a)){if(n.includes(s))return{source:t,location:null!=o?o:l,value:n[n.length-1]};n.push(s);const a=await _resolveExternalRefWithLocation(e,i,s.$ref,n,l);({source:i,location:l}=a),f.value=a.value,l.push(...c.slice(r+1))}return{source:i,location:l,value:n.length>0?applyOverrides(n[n.length-1],f.value):f.value}}async function resolveExternalRef(e,t,r){return(await resolveExternalRefWithLocation(e,t,r)).value}function resolveExternalRefWithLocation(e,t,r){return _resolveExternalRefWithLocation(e,t,r,[])}const safeParse=(e,t)=>{if("string"!=typeof e)return e;try{const r=parseNumber(e);return"string"==typeof r?r:JSON.parse(e,t)}catch(e){return}},parseNumber=e=>{const t=Number(e);return Number.isFinite(t)?String(t)===e?t:e:NaN},safeStringify=(e,t,r)=>{if("string"==typeof e)return e;try{return JSON.stringify(e,t,r)}catch(n){return fastStringify(e,t,r)}},startsWith=(e,t)=>{if(e instanceof Array){if(t instanceof Array){if(t.length>e.length)return!1;for(const r in t){if(!t.hasOwnProperty(r))continue;const n=parseInt(e[r]),o=parseInt(t[r]);if(isNaN(n)&&isNaN(o)){if(e[r]!==t[r])return!1}else if(n!==o)return!1}}}else{if("string"!=typeof e)return!1;if("string"==typeof t)return e.startsWith(t)}return!0},stringify=(e,t,r)=>{const n=safeStringify(e,t,r);if(void 0===n)throw new Error("The value could not be stringified");return n};function toPropertyPath(e){return e.replace(/^(\/|#\/)/,"").split("/").map(decodePointerFragment).map(sanitize).join(".")}function sanitize(e){return e.includes(".")?`["${e.replace(/"/g,'\\"')}"]`:e}const KEYS=Symbol.for(createOrderedObject.ORDER_KEY_ID),traps={ownKeys:e=>KEYS in e?e[KEYS]:Reflect.ownKeys(e)},trapAccess=e=>new Proxy(e,traps);function trimStart(e,t){if("string"==typeof e&&"string"==typeof t)return lodash.trimStart(e,t);if(!(e&&Array.isArray(e)&&e.length&&t&&Array.isArray(t)&&t.length))return e;let r=0;for(const n in e)if(e.hasOwnProperty(n)){if(e[n]!==t[n])break;r++}return e.slice(r)}exports.BUNDLE_ROOT=BUNDLE_ROOT,exports.ERRORS_ROOT=ERRORS_ROOT,exports.KEYS=KEYS,exports.bundleTarget=bundleTarget,exports.decodePointer=decodePointer,exports.decodePointerFragment=decodePointerFragment,exports.decodePointerUriFragment=decodePointer,exports.decycle=decycle,exports.encodePointer=encodePointer,exports.encodePointerFragment=encodePointerFragment,exports.encodePointerUriFragment=encodePointerUriFragment,exports.encodeUriPointer=encodeUriPointer,exports.extractPointerFromRef=extractPointerFromRef,exports.extractSourceFromRef=extractSourceFromRef,exports.getFirstPrimitiveProperty=getFirstPrimitiveProperty,exports.getJsonPathForPosition=getJsonPathForPosition,exports.getLastPathSegment=getLastPathSegment,exports.getLocationForJsonPath=getLocationForJsonPath,exports.hasRef=hasRef,exports.isExternalRef=isExternalRef,exports.isLocalRef=isLocalRef,exports.isPlainObject=isPlainObject,exports.parseTree=parseTree,exports.parseWithPointers=parseWithPointers,exports.pathToPointer=pathToPointer,exports.pointerToPath=pointerToPath,exports.remapRefs=remapRefs,exports.renameObjectKey=renameObjectKey,exports.reparentBundleTarget=reparentBundleTarget,exports.resolveExternalRef=resolveExternalRef,exports.resolveExternalRefWithLocation=resolveExternalRefWithLocation,exports.resolveInlineRef=resolveInlineRef,exports.resolveInlineRefWithLocation=resolveInlineRefWithLocation,exports.safeParse=safeParse,exports.safeStringify=safeStringify,exports.startsWith=startsWith,exports.stringify=stringify,exports.toPropertyPath=toPropertyPath,exports.trapAccess=trapAccess,exports.traverse=traverse,exports.trimStart=trimStart; diff --git a/packages/http/.yalc/@stoplight/json/index.d.ts b/packages/http/.yalc/@stoplight/json/index.d.ts new file mode 100644 index 000000000..5a5f11593 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/index.d.ts @@ -0,0 +1,36 @@ +export * from './bundle'; +export * from './decodePointer'; +export * from './decodePointerFragment'; +export * from './decodePointerUriFragment'; +export * from './decycle'; +export * from './encodePointer'; +export * from './encodePointerFragment'; +export * from './encodePointerUriFragment'; +export * from './encodeUriPointer'; +export * from './extractPointerFromRef'; +export * from './extractSourceFromRef'; +export * from './getFirstPrimitiveProperty'; +export * from './getJsonPathForPosition'; +export * from './getLastPathSegment'; +export * from './getLocationForJsonPath'; +export * from './hasRef'; +export * from './isExternalRef'; +export * from './isLocalRef'; +export * from './isPlainObject'; +export * from './parseWithPointers'; +export * from './pathToPointer'; +export * from './pointerToPath'; +export * from './remapRefs'; +export * from './renameObjectKey'; +export * from './reparentBundleTarget'; +export * from './resolvers/resolveExternalRef'; +export * from './resolvers/resolveInlineRef'; +export * from './safeParse'; +export * from './safeStringify'; +export * from './startsWith'; +export * from './stringify'; +export * from './toPropertyPath'; +export * from './trapAccess'; +export * from './traverse'; +export * from './trimStart'; +export * from './types'; diff --git a/packages/http/.yalc/@stoplight/json/index.es.js b/packages/http/.yalc/@stoplight/json/index.es.js new file mode 100644 index 000000000..8becaf052 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/index.es.js @@ -0,0 +1 @@ +import{cloneDeep as e,get as t,set as r,has as n,setWith as o,omit as i,trimStart as a}from"lodash";import{isAbsolute as s,join as c,dirname as u}from"@stoplight/path";import{createScanner as l,findNodeAtOffset as f,getNodePath as p,visit as h,printParseErrorCode as y}from"jsonc-parser";import g,{getOrder as d,ORDER_KEY_ID as m}from"@stoplight/ordered-object-literal";import{DiagnosticSeverity as v}from"@stoplight/types";import b from"safe-stable-stringify";function w(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype||"function"==typeof e.constructor&&Function.toString.call(Object)===Function.toString.call(e.constructor)}function O(e,t,r){if(!w(e)&&!Array.isArray(e)||!(t in e))throw new ReferenceError(`Could not resolve '${r}'`)}function j(e){if("string"!=typeof e.$ref)throw new TypeError("$ref should be a string")}const A=e=>w(e)&&"$ref"in e,$=e=>A(e)&&"string"==typeof e.$ref,S=e=>e.length>0&&("#"===e||/^#\S*$/.test(e)),E=(e,t,r)=>{const n=e.toString();let o="",i=n,a=0,s=i.indexOf(t);for(;s>-1;)o+=n.substring(a,a+s)+r,i=i.substring(s+t.length,i.length),a+=s+t.length,s=i.indexOf(t);return i.length>0&&(o+=n.substring(n.length-i.length,n.length)),o},x=e=>"number"==typeof e?e:E(E(e,"~","~0"),"/","~1"),_=/[^a-zA–Z0–9_.!~*'()\/\-\u{D800}-\u{DFFF}]/gu;function N(e){return e.replace(_,encodeURIComponent)}const k=e=>{const t=x(e);return"number"==typeof t?t:N(t)},P=e=>I(e),I=e=>{if(e&&"object"!=typeof e)throw new TypeError("Invalid type: path must be an array of segments.");return 0===e.length?"#":`#/${e.map(k).join("/")}`};function T(e){try{return decodeURIComponent(e)}catch(t){return e}}const R=/%[0-9a-f]+/gi,U=e=>{let t;try{t=decodeURIComponent(e)}catch(r){t=e.replace(R,T)}return E(E(t,"~1","/"),"~0","~")},K=e=>J(e),J=e=>{if("string"!=typeof e)throw new TypeError("Invalid type: JSON Pointers are represented as strings.");if(0===e.length||"#"!==e[0])throw new URIError("Invalid JSON Pointer syntax; URI fragment identifiers must begin with a hash.");if(1===e.length)return[];if("/"!==e[1])throw new URIError("Invalid JSON Pointer syntax.");return(e=>{const t=e.length,r=[];let n=-1;for(;++n{const n={value:e,path:r};t.onEnter&&t.onEnter(n);for(const n of Object.keys(e)){const o=e[n];t.onProperty&&t.onProperty({parent:e,parentPath:r,property:n,propertyValue:o}),"object"==typeof o&&null!==o&&C(o,t,r.concat(n))}t.onLeave&&t.onLeave(n)},D=(e,t)=>{"object"==typeof e&&null!==e&&C(e,"function"==typeof t?{onProperty:t}:t,[])};function F(e,t,r){D(e,{onProperty({property:e,propertyValue:n,parent:o}){"$ref"===e&&"string"==typeof n&&n.startsWith(t)&&(o.$ref=`${r}${n.slice(t.length)}`)}})}const M=e=>e.length>0&&"#"!==e[0],V=e=>{if("string"!=typeof e||0===e.length||!M(e))return null;const t=e.indexOf("#");return-1===t?e:e.slice(0,t)};function W(e,t){return w(t)&&w(e)&&("summary"in e||"description"in e)?Object.assign(Object.assign(Object.assign({},t),"description"in e?{description:e.description}:null),"summary"in e?{summary:e.summary}:null):t}function*L(e,t,r){A(e.value)&&(j(e.value),yield[-1,e.value]);for(const[n,o]of t.entries())O(e.value,o,r),e.value=e.value[o],A(e.value)&&(j(e.value),yield[n,e.value])}function B(e,t){return z(e,t).value}function z(e,t){return function e(t,r,n,o){if(null!==V(r))throw new ReferenceError("Cannot resolve external references");const i=K(r);let a=[...i];"#"===r&&A(t)&&(j(t),i.unshift(...K(t.$ref)));const s={value:t};for(const[c,u]of L(s,i,r)){if(n.includes(u))return{source:null,location:null!=o?o:a,value:n[n.length-1]};n.push(u);const r=e(t,u.$ref,n,a);s.value=r.value,(a=r.location).push(...i.slice(c+1))}return{source:null,location:a,value:n.length>0?W(n[n.length-1],s.value):s.value}}(e,t,[])}const Z="#/__bundled__",q="#/__errors__",G=({document:t,path:r,bundleRoot:n="#/__bundled__",errorsRoot:o="#/__errors__",cloneDocument:i=!0,keyProvider:a},s)=>{if(r===n||r===o)throw new Error("Roots do not make any sense");const c=i?e(t):t;return H(c,K(n),K(o),r,a)(r,{[r]:!0},s)},H=(e,a,s,c,u)=>{const l=new Set,f=(p,h,y,g={},d={},m={})=>{const v=K(p),b=t(e,v);D(y||b,{onEnter:({value:s})=>{if($(s)&&S(s.$ref)){const y=s.$ref;if(m[y])return;if(y===p&&(g[y]="#"),g[y])return void(s.$ref=g[y]);let v,b,w,O,j;try{let r;v=K(y),u&&(r=u({document:e,path:v})),r||(r=(({document:e,path:r})=>{if(0===r.length)return"root";if(Array.isArray(t(e,r.slice(0,-1))))return`${r[r.length-2]}_${r[r.length-1]}`;return String(r[r.length-1])})({document:e,path:v})),w=r;let n=1;for(;l.has(w);)if(w=`${r}_${++n}`,n>20)throw new Error(`Keys ${r}_2 through ${r}_20 already taken.`);l.add(w),b=[...a,w],O=P(b)}catch(e){m[y]=e instanceof Error?e.message:String(e)}if(!v||!b||!O)return;if("object"==typeof e&&null!==e&&!(j=t(e,v)))try{j=B(Object(e),y)}catch(e){}void 0!==j&&(g[y]=O,s.$ref=O,n(d,b)||(Array.isArray(j)?r(d,b,new Array(j.length).fill(null)):"object"==typeof j&&o(d,b,{},Object),r(d,b,j),"#"===y?function(e,t,n,o){const a=n.map(e=>`[${JSON.stringify(e)}]`).join(""),s=JSON.parse(JSON.stringify(i(Object(e),a))),c={};r(t,o,s),r(s,n,c),F(s,"#",P(o)),c.$ref="#"}(e,d,K(c),b):h[y]||(h[y]=!0,f(p,h,j,g,d,m),h[y]=!1)))}}});const w=t(d,a);return w&&Object.keys(w).length&&r(b,a,w),(Object.keys(m).length||n(e,s))&&r(b,s,n(e,s)?t(e,s):m),b};return f};const Q=e=>E(E(e,"~1","/"),"~0","~");function X(e,t){const r=new WeakMap,n=new WeakSet;return function e(o,i){if(t&&(o=t(o)),w(o)||Array.isArray(o)){const t=r.get(o);if(t)return{$ref:t};if(r.set(o,P(i)),Array.isArray(o))return o.map((t,r)=>e(t,[...i,r]));const a={};for(const t in o)Object.prototype.hasOwnProperty.call(o,t)&&(a[t]=e(o[t],[...i,t]));return n.has(o)||r.delete(o),n.add(o),a}return o}(e,[])}const Y=e=>E(E(e,"~","~0"),"//","/~1"),ee=e=>{if("string"!=typeof e||0===e.length)return null;const t=e.indexOf("#");return-1===t?null:e.slice(t)},te=e=>{const t=l(e,!0);if(t.scan(),1!==t.getToken())return;if(t.scan(),2===t.getToken())return;if(10!==t.getToken())throw new SyntaxError("Unexpected character");const r=t.getTokenValue();if(t.scan(),6!==t.getToken())throw new SyntaxError("Colon expected");switch(t.scan(),t.getToken()){case 10:return[r,t.getTokenValue()];case 11:return[r,Number(t.getTokenValue())];case 8:return[r,!0];case 9:return[r,!1];case 7:return[r,null];case 16:throw new SyntaxError("Unexpected character");case 17:throw new SyntaxError("Unexpected end of file");default:return}},re=({lineMap:e,ast:t},r)=>{const n=e[r.line],o=e[r.line+1];if(void 0===n)return;const i=f(t,void 0===o?n+r.character:Math.min(o,n+r.character),!0);if(void 0===i)return;const a=p(i);return 0!==a.length?a:void 0};function ne(e){return Q(e.split("/").pop()||"")}const oe=({ast:e},t,r=!1)=>{const n=function(e,t,r){e:for(const n of t){const t=Number.isInteger(Number(n))?Number(n):n;if("string"==typeof t||"number"==typeof t&&"array"!==e.type){if("object"!==e.type||!Array.isArray(e.children))return r?e:void 0;for(const r of e.children)if(Array.isArray(r.children)&&r.children[0].value===String(t)&&2===r.children.length){e=r.children[1];continue e}return r?e:void 0}if("array"!==e.type||t<0||!Array.isArray(e.children)||t>=e.children.length)return r?e:void 0;e=e.children[t]}return e}(e,t,r);if(void 0!==n&&void 0!==n.range)return{range:n.range}};const ie=(e,t={disallowComments:!0})=>{const r=[],{ast:n,data:o,lineMap:i}=ae(e,r,t);return{data:o,diagnostics:r,ast:n,lineMap:i}};function ae(e,t=[],r){const n=ce(e);let o={type:"array",offset:-1,length:-1,children:[],parent:void 0},i=null,a=[];const s=new WeakMap,c=[];function u(e){"property"===o.type&&(o.length=e-o.offset,o=o.parent)}function l(e,t,r){return{start:{line:e,character:t},end:{line:e,character:t+r}}}function f(e){return o.children.push(e),e}function p(e){Array.isArray(a)?a.push(e):null!==i&&(a[i]=e)}function m(e){p(e),c.push(a),a=e,i=null}function b(){a=c.pop()}h(e,{onObjectBegin:(e,t,n,i)=>{o=f({type:"object",offset:e,length:-1,parent:o,children:[],range:l(n,i,t)}),!1===r.ignoreDuplicateKeys&&s.set(o,[]),m(function(e){return e?g({}):{}}(!0===r.preserveKeyOrder))},onObjectProperty:(e,n,c,u,p)=>{if((o=f({type:"property",offset:n,length:-1,parent:o,children:[]})).children.push({type:"string",value:e,offset:n,length:c,parent:o}),!1===r.ignoreDuplicateKeys){const r=s.get(o.parent);r&&(0!==r.length&&r.includes(e)?t.push({range:l(u,p,c),message:"DuplicateKey",severity:v.Error,path:ue(o),code:20}):r.push(e))}!0===r.preserveKeyOrder&&function(e,t){if(!(t in e))return;const r=d(e),n=r.indexOf(t);-1!==n&&(r.splice(n,1),r.push(t))}(a,e),i=e},onObjectEnd:(e,t,n,i)=>{!1===r.ignoreDuplicateKeys&&s.delete(o),o.length=e+t-o.offset,o.range&&(o.range.end.line=n,o.range.end.character=i+t),o=o.parent,u(e+t),b()},onArrayBegin:(e,t,r,n)=>{o=f({type:"array",offset:e,length:-1,parent:o,children:[],range:l(r,n,t)}),m([])},onArrayEnd:(e,t,r,n)=>{o.length=e+t-o.offset,o.range&&(o.range.end.line=r,o.range.end.character=n+t),o=o.parent,u(e+t),b()},onLiteralValue:(e,t,r,n,i)=>{f({type:se(e),offset:t,length:r,parent:o,value:e,range:l(n,i,r)}),u(t+r),p(e)},onSeparator:(e,t)=>{"property"===o.type&&(":"===e?o.colonOffset=t:","===e&&u(t))},onError:(e,r,n,o,i)=>{t.push({range:l(o,i,n),message:y(e),severity:v.Error,code:e})}},r);const w=o.children[0];return w&&delete w.parent,{ast:w,data:a[0],lineMap:n}}function se(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";default:return"null"}}const ce=e=>{const t=[0];let r=0;for(;r{if(!e||!Object.hasOwnProperty.call(e,t)||t===r)return e;const n={};for(const[o,i]of Object.entries(e))o===t?n[r]=i:o in n||(n[o]=i);return n};function fe(e){return w(e)||Array.isArray(e)}function pe(e,t,r){if(r.length<=1||t.length<=1)throw Error("Source/target path must not be empty and point at root");if(0===t.indexOf(r))throw Error("Target path cannot be contained within source");const n=K(t);let o=e;for(const e of n){if(!fe(o))return;o=o[e]}if(!fe(o))return;const i=K(r);let a=e;for(const[e,t]of i.entries()){if(!fe(a)||t in a)return;const r=e===i.length-1?o:{};a[t]=r,a=r}delete e[n[0]],function e(t,r,n){for(const o of Object.keys(t)){const i=t[o];if("$ref"!==o)fe(i)&&e(i,r,n);else{if("string"!=typeof i||!S(i))continue;0===i.indexOf(r)&&(t[o]=i.replace(r,n))}}}(e,t,r)}async function he(e,t,r,n,o){let i=function(e,t){const r=V(t);return null===r?e:s(r)?r:c(u(e),r)}(t,r);const a=ee(r)||"#",l=await e[i],f=K(a);let p=[...f];const h={value:l};for(const[r,s]of L(h,f,a)){if(n.includes(s))return{source:t,location:null!=o?o:p,value:n[n.length-1]};n.push(s);const a=await he(e,i,s.$ref,n,p);({source:i,location:p}=a),h.value=a.value,p.push(...f.slice(r+1))}return{source:i,location:p,value:n.length>0?W(n[n.length-1],h.value):h.value}}async function ye(e,t,r){return(await ge(e,t,r)).value}function ge(e,t,r){return he(e,t,r,[])}const de=(e,t)=>{if("string"!=typeof e)return e;try{const r=me(e);return"string"==typeof r?r:JSON.parse(e,t)}catch(e){return}},me=e=>{const t=Number(e);return Number.isFinite(t)?String(t)===e?t:e:NaN},ve=(e,t,r)=>{if("string"==typeof e)return e;try{return JSON.stringify(e,t,r)}catch(n){return b(e,t,r)}},be=(e,t)=>{if(e instanceof Array){if(t instanceof Array){if(t.length>e.length)return!1;for(const r in t){if(!t.hasOwnProperty(r))continue;const n=parseInt(e[r]),o=parseInt(t[r]);if(isNaN(n)&&isNaN(o)){if(e[r]!==t[r])return!1}else if(n!==o)return!1}}}else{if("string"!=typeof e)return!1;if("string"==typeof t)return e.startsWith(t)}return!0},we=(e,t,r)=>{const n=ve(e,t,r);if(void 0===n)throw new Error("The value could not be stringified");return n};function Oe(e){return e.replace(/^(\/|#\/)/,"").split("/").map(Q).map(je).join(".")}function je(e){return e.includes(".")?`["${e.replace(/"/g,'\\"')}"]`:e}const Ae=Symbol.for(m),$e={ownKeys:e=>Ae in e?e[Ae]:Reflect.ownKeys(e)},Se=e=>new Proxy(e,$e);function Ee(e,t){if("string"==typeof e&&"string"==typeof t)return a(e,t);if(!(e&&Array.isArray(e)&&e.length&&t&&Array.isArray(t)&&t.length))return e;let r=0;for(const n in e)if(e.hasOwnProperty(n)){if(e[n]!==t[n])break;r++}return e.slice(r)}export{Z as BUNDLE_ROOT,q as ERRORS_ROOT,Ae as KEYS,G as bundleTarget,U as decodePointer,Q as decodePointerFragment,U as decodePointerUriFragment,X as decycle,Y as encodePointer,x as encodePointerFragment,k as encodePointerUriFragment,N as encodeUriPointer,ee as extractPointerFromRef,V as extractSourceFromRef,te as getFirstPrimitiveProperty,re as getJsonPathForPosition,ne as getLastPathSegment,oe as getLocationForJsonPath,$ as hasRef,M as isExternalRef,S as isLocalRef,w as isPlainObject,ae as parseTree,ie as parseWithPointers,P as pathToPointer,K as pointerToPath,F as remapRefs,le as renameObjectKey,pe as reparentBundleTarget,ye as resolveExternalRef,ge as resolveExternalRefWithLocation,B as resolveInlineRef,z as resolveInlineRefWithLocation,de as safeParse,ve as safeStringify,be as startsWith,we as stringify,Oe as toPropertyPath,Se as trapAccess,D as traverse,Ee as trimStart}; diff --git a/packages/http/.yalc/@stoplight/json/isExternalRef.d.ts b/packages/http/.yalc/@stoplight/json/isExternalRef.d.ts new file mode 100644 index 000000000..a0c2efdb0 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/isExternalRef.d.ts @@ -0,0 +1 @@ +export declare const isExternalRef: (pointer: string) => boolean; diff --git a/packages/http/.yalc/@stoplight/json/isLocalRef.d.ts b/packages/http/.yalc/@stoplight/json/isLocalRef.d.ts new file mode 100644 index 000000000..241af9cd1 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/isLocalRef.d.ts @@ -0,0 +1 @@ +export declare const isLocalRef: (pointer: string) => boolean; diff --git a/packages/http/.yalc/@stoplight/json/isPlainObject.d.ts b/packages/http/.yalc/@stoplight/json/isPlainObject.d.ts new file mode 100644 index 000000000..421f7a4fd --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/isPlainObject.d.ts @@ -0,0 +1 @@ +export declare function isPlainObject(maybeObj: unknown): maybeObj is Record; diff --git a/packages/http/.yalc/@stoplight/json/package.json b/packages/http/.yalc/@stoplight/json/package.json new file mode 100644 index 000000000..b4528b99f --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/package.json @@ -0,0 +1,37 @@ +{ + "name": "@stoplight/json", + "version": "0.0.0", + "description": "Useful functions when working with JSON.", + "keywords": [ + "json", + "json parser", + "json.parse", + "parser", + "sourcemap" + ], + "sideEffects": false, + "files": [ + "**/*" + ], + "author": "Stoplight ", + "repository": { + "type": "git", + "url": "https://github.com/stoplightio/json" + }, + "license": "Apache-2.0", + "engines": { + "node": ">=8.3.0" + }, + "dependencies": { + "@stoplight/ordered-object-literal": "^1.0.3", + "@stoplight/path": "^1.3.2", + "@stoplight/types": "^13.6.0", + "jsonc-parser": "~2.2.1", + "lodash": "^4.17.21", + "safe-stable-stringify": "^1.1" + }, + "main": "index.cjs.js", + "module": "index.es.js", + "typings": "index.d.ts", + "yalcSig": "b57e6c9ef2c538fab0be04b6337078e6" +} diff --git a/packages/http/.yalc/@stoplight/json/parseWithPointers.d.ts b/packages/http/.yalc/@stoplight/json/parseWithPointers.d.ts new file mode 100644 index 000000000..d3a7cc20d --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/parseWithPointers.d.ts @@ -0,0 +1,4 @@ +import { IDiagnostic, IParserASTResult } from '@stoplight/types'; +import { IJsonASTNode, IParseOptions, JsonParserResult } from './types'; +export declare const parseWithPointers: (value: string, options?: IParseOptions) => JsonParserResult; +export declare function parseTree(text: string, errors: IDiagnostic[] | undefined, options: IParseOptions): IParserASTResult; diff --git a/packages/http/.yalc/@stoplight/json/pathToPointer.d.ts b/packages/http/.yalc/@stoplight/json/pathToPointer.d.ts new file mode 100644 index 000000000..3d2b1d937 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/pathToPointer.d.ts @@ -0,0 +1,2 @@ +import { JsonPath } from '@stoplight/types'; +export declare const pathToPointer: (path: JsonPath) => string; diff --git a/packages/http/.yalc/@stoplight/json/pointerToPath.d.ts b/packages/http/.yalc/@stoplight/json/pointerToPath.d.ts new file mode 100644 index 000000000..0fea2114a --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/pointerToPath.d.ts @@ -0,0 +1,2 @@ +import { JsonPath } from '@stoplight/types'; +export declare const pointerToPath: (pointer: string) => JsonPath; diff --git a/packages/http/.yalc/@stoplight/json/remapRefs.d.ts b/packages/http/.yalc/@stoplight/json/remapRefs.d.ts new file mode 100644 index 000000000..84e776aaf --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/remapRefs.d.ts @@ -0,0 +1 @@ +export declare function remapRefs(document: unknown, from: string, to: string): void; diff --git a/packages/http/.yalc/@stoplight/json/renameObjectKey.d.ts b/packages/http/.yalc/@stoplight/json/renameObjectKey.d.ts new file mode 100644 index 000000000..f2230af37 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/renameObjectKey.d.ts @@ -0,0 +1 @@ +export declare const renameObjectKey: (obj: object, oldKey: string, newKey: string) => object; diff --git a/packages/http/.yalc/@stoplight/json/reparentBundleTarget.d.ts b/packages/http/.yalc/@stoplight/json/reparentBundleTarget.d.ts new file mode 100644 index 000000000..021b2c14a --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/reparentBundleTarget.d.ts @@ -0,0 +1 @@ +export declare function reparentBundleTarget(document: Record, from: string, to: string): void; diff --git a/packages/http/.yalc/@stoplight/json/resolvers/__tests__/resolveSource.spec.d.ts b/packages/http/.yalc/@stoplight/json/resolvers/__tests__/resolveSource.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/resolvers/__tests__/resolveSource.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/http/.yalc/@stoplight/json/resolvers/guards.d.ts b/packages/http/.yalc/@stoplight/json/resolvers/guards.d.ts new file mode 100644 index 000000000..9546865e8 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/resolvers/guards.d.ts @@ -0,0 +1,8 @@ +import { Segment } from '@stoplight/types'; +export declare function assertResolvableInput(value: unknown, segment: Segment, pointer: string): asserts value is Record | unknown[]; +export declare function assertObjectWithValidRef(value: Record): asserts value is Record & { + $ref: string; +}; +export declare const hasSomeRef: (obj: unknown) => obj is Record & { + $ref: unknown; +}; diff --git a/packages/http/.yalc/@stoplight/json/resolvers/resolveExternalRef.d.ts b/packages/http/.yalc/@stoplight/json/resolvers/resolveExternalRef.d.ts new file mode 100644 index 000000000..ed12a5ba2 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/resolvers/resolveExternalRef.d.ts @@ -0,0 +1,9 @@ +import type { JsonPath } from '@stoplight/types'; +declare type Document = Record | unknown[]; +export declare function resolveExternalRef(inventory: Record>, origin: string, ref: string): Promise; +export declare function resolveExternalRefWithLocation(inventory: Record>, origin: string, ref: string): Promise<{ + source: string; + location: JsonPath; + value: unknown; +}>; +export {}; diff --git a/packages/http/.yalc/@stoplight/json/resolvers/resolveInlineRef.d.ts b/packages/http/.yalc/@stoplight/json/resolvers/resolveInlineRef.d.ts new file mode 100644 index 000000000..2b970b97a --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/resolvers/resolveInlineRef.d.ts @@ -0,0 +1,4 @@ +import { Dictionary } from '@stoplight/types'; +import { ResolvedRef } from './types'; +export declare function resolveInlineRef(document: Record, pointer: string): unknown; +export declare function resolveInlineRefWithLocation(document: Dictionary, pointer: string): ResolvedRef; diff --git a/packages/http/.yalc/@stoplight/json/resolvers/types.d.ts b/packages/http/.yalc/@stoplight/json/resolvers/types.d.ts new file mode 100644 index 000000000..42924beee --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/resolvers/types.d.ts @@ -0,0 +1,6 @@ +import { JsonPath } from '@stoplight/types'; +export declare type ResolvedRef = { + source: Source; + location: JsonPath; + value: unknown; +}; diff --git a/packages/http/.yalc/@stoplight/json/resolvers/utils.d.ts b/packages/http/.yalc/@stoplight/json/resolvers/utils.d.ts new file mode 100644 index 000000000..9ab59b39b --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/resolvers/utils.d.ts @@ -0,0 +1,8 @@ +import { JsonPath } from '@stoplight/types'; +export declare function applyOverrides(document: unknown, value: unknown): unknown; +export declare function resolveSource(origin: string, ref: string): string; +export declare function traverse(ctx: { + value: unknown; +}, path: JsonPath, pointer: string): IterableIterator<[index: number, value: Record & { + $ref: string; +}]>; diff --git a/packages/http/.yalc/@stoplight/json/safeParse.d.ts b/packages/http/.yalc/@stoplight/json/safeParse.d.ts new file mode 100644 index 000000000..974939611 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/safeParse.d.ts @@ -0,0 +1 @@ +export declare const safeParse: JSON['parse']; diff --git a/packages/http/.yalc/@stoplight/json/safeStringify.d.ts b/packages/http/.yalc/@stoplight/json/safeStringify.d.ts new file mode 100644 index 000000000..1f66afff2 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/safeStringify.d.ts @@ -0,0 +1,2 @@ +import { Optional } from '@stoplight/types'; +export declare const safeStringify: (value: any, replacer?: ((key: string, value: any) => any | Array | null) | undefined, space?: string | number) => Optional; diff --git a/packages/http/.yalc/@stoplight/json/startsWith.d.ts b/packages/http/.yalc/@stoplight/json/startsWith.d.ts new file mode 100644 index 000000000..9b552bfba --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/startsWith.d.ts @@ -0,0 +1 @@ +export declare const startsWith: (source: any[] | string, val: any[] | string) => boolean; diff --git a/packages/http/.yalc/@stoplight/json/stringify.d.ts b/packages/http/.yalc/@stoplight/json/stringify.d.ts new file mode 100644 index 000000000..5ca21a730 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/stringify.d.ts @@ -0,0 +1 @@ +export declare const stringify: (value: any, replacer?: ((key: string, value: any) => any | Array | null) | undefined, space?: string | number) => string; diff --git a/packages/http/.yalc/@stoplight/json/toPropertyPath.d.ts b/packages/http/.yalc/@stoplight/json/toPropertyPath.d.ts new file mode 100644 index 000000000..9711c2818 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/toPropertyPath.d.ts @@ -0,0 +1 @@ +export declare function toPropertyPath(path: string): string; diff --git a/packages/http/.yalc/@stoplight/json/trapAccess.d.ts b/packages/http/.yalc/@stoplight/json/trapAccess.d.ts new file mode 100644 index 000000000..765365913 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/trapAccess.d.ts @@ -0,0 +1,2 @@ +export declare const KEYS: unique symbol; +export declare const trapAccess: (target: T) => T; diff --git a/packages/http/.yalc/@stoplight/json/traverse.d.ts b/packages/http/.yalc/@stoplight/json/traverse.d.ts new file mode 100644 index 000000000..c6782da9e --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/traverse.d.ts @@ -0,0 +1,19 @@ +import { JsonPath, Segment } from '@stoplight/types'; +declare type Hooks = { + onEnter(ctx: Readonly<{ + value: object; + path: JsonPath; + }>): void; + onLeave(ctx: Readonly<{ + value: object; + path: JsonPath; + }>): void; + onProperty(ctx: Readonly<{ + parent: object; + parentPath: JsonPath; + property: Segment; + propertyValue: unknown; + }>): void; +}; +export declare const traverse: (obj: unknown, hooks: Partial | Hooks['onProperty']) => void; +export {}; diff --git a/packages/http/.yalc/@stoplight/json/trimStart.d.ts b/packages/http/.yalc/@stoplight/json/trimStart.d.ts new file mode 100644 index 000000000..5f8de9925 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/trimStart.d.ts @@ -0,0 +1,2 @@ +export declare function trimStart(target: any[], elems: any[]): any[]; +export declare function trimStart(target: string, elems: string): string; diff --git a/packages/http/.yalc/@stoplight/json/types.d.ts b/packages/http/.yalc/@stoplight/json/types.d.ts new file mode 100644 index 000000000..6d47f37f8 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/types.d.ts @@ -0,0 +1,17 @@ +import { IParserResult, IRange } from '@stoplight/types'; +import { Node, NodeType, ParseOptions } from 'jsonc-parser'; +export interface IJsonASTNode extends Node { + type: NodeType; + value?: any; + offset: number; + length: number; + range?: IRange; + colonOffset?: number; + parent?: IJsonASTNode; + children?: IJsonASTNode[]; +} +export interface IParseOptions extends ParseOptions { + ignoreDuplicateKeys?: boolean; + preserveKeyOrder?: boolean; +} +export declare type JsonParserResult = IParserResult; diff --git a/packages/http/.yalc/@stoplight/json/yalc.sig b/packages/http/.yalc/@stoplight/json/yalc.sig new file mode 100644 index 000000000..eb1962de3 --- /dev/null +++ b/packages/http/.yalc/@stoplight/json/yalc.sig @@ -0,0 +1 @@ +b57e6c9ef2c538fab0be04b6337078e6 \ No newline at end of file diff --git a/packages/http/package.json b/packages/http/package.json index a9042cb95..53a6aa846 100644 --- a/packages/http/package.json +++ b/packages/http/package.json @@ -17,12 +17,12 @@ }, "dependencies": { "@faker-js/faker": "^6.0.0", - "@stoplight/json": "^3.18.1", + "@stoplight/http-spec": "^7.0.3", + "@stoplight/json": "file:.yalc/@stoplight/json", "@stoplight/json-schema-merge-allof": "0.7.8", + "@stoplight/json-schema-ref-parser": "9.2.7", "@stoplight/json-schema-sampler": "0.3.0", "@stoplight/prism-core": "^5.8.0", - "@stoplight/http-spec": "^7.0.3", - "@stoplight/json-schema-ref-parser": "9.2.7", "@stoplight/types": "^14.1.0", "@stoplight/yaml": "^4.2.3", "abstract-logging": "^2.0.1", diff --git a/packages/http/yalc.lock b/packages/http/yalc.lock new file mode 100644 index 000000000..82c8bc4e2 --- /dev/null +++ b/packages/http/yalc.lock @@ -0,0 +1,11 @@ +{ + "version": "v1", + "packages": { + "@stoplight/json": { + "version": "0.0.0", + "signature": "b57e6c9ef2c538fab0be04b6337078e6", + "file": true, + "replaced": "^3.18.1" + } + } +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 74f2482f3..8f1bb5e78 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1177,6 +1177,26 @@ lodash "^4.17.21" safe-stable-stringify "^1.1" +"@stoplight/json@file:packages/cli/.yalc/@stoplight/json": + version "0.0.0" + dependencies: + "@stoplight/ordered-object-literal" "^1.0.3" + "@stoplight/path" "^1.3.2" + "@stoplight/types" "^13.6.0" + jsonc-parser "~2.2.1" + lodash "^4.17.21" + safe-stable-stringify "^1.1" + +"@stoplight/json@file:packages/http/.yalc/@stoplight/json": + version "0.0.0" + dependencies: + "@stoplight/ordered-object-literal" "^1.0.3" + "@stoplight/path" "^1.3.2" + "@stoplight/types" "^13.6.0" + jsonc-parser "~2.2.1" + lodash "^4.17.21" + safe-stable-stringify "^1.1" + "@stoplight/ordered-object-literal@^1.0.1", "@stoplight/ordered-object-literal@^1.0.3": version "1.0.4" resolved "https://registry.npmjs.org/@stoplight/ordered-object-literal/-/ordered-object-literal-1.0.4.tgz"