@scalar/openapi-parser 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/configuration/index.js.map +1 -1
- package/dist/index.d.ts +17 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +2 -2
- package/dist/lib/Validator/Validator.d.ts.map +1 -1
- package/dist/lib/Validator/Validator.js +2 -2
- package/dist/lib/Validator/Validator.js.map +1 -1
- package/dist/lib/Validator/index.d.ts +1 -2
- package/dist/lib/Validator/index.d.ts.map +1 -1
- package/dist/lib/Validator/index.js +4 -2
- package/dist/lib/Validator/index.js.map +2 -2
- package/dist/plugins/fetch-urls/{fetchUrls.d.ts → fetch-urls.d.ts} +1 -1
- package/dist/plugins/fetch-urls/fetch-urls.d.ts.map +1 -0
- package/dist/plugins/fetch-urls/{fetchUrls.js → fetch-urls.js} +1 -1
- package/dist/plugins/fetch-urls/fetch-urls.js.map +7 -0
- package/dist/plugins/fetch-urls/{fetchUrls.test.js → fetch-urls.test.js} +2 -2
- package/dist/plugins/fetch-urls/fetch-urls.test.js.map +7 -0
- package/dist/plugins/fetch-urls/index.d.ts +1 -1
- package/dist/plugins/fetch-urls/index.d.ts.map +1 -1
- package/dist/plugins/fetch-urls/index.js +5 -1
- package/dist/plugins/fetch-urls/index.js.map +2 -2
- package/dist/plugins/read-files/index.d.ts +1 -1
- package/dist/plugins/read-files/index.d.ts.map +1 -1
- package/dist/plugins/read-files/index.js +4 -1
- package/dist/plugins/read-files/index.js.map +2 -2
- package/dist/plugins/read-files/{readFiles.d.ts → read-files.d.ts} +1 -1
- package/dist/plugins/read-files/read-files.d.ts.map +1 -0
- package/dist/plugins/read-files/{readFiles.js → read-files.js} +3 -3
- package/dist/plugins/read-files/read-files.js.map +7 -0
- package/dist/plugins/read-files/{readFiles.test.js → read-files.test.js} +2 -2
- package/dist/plugins/read-files/read-files.test.js.map +7 -0
- package/dist/polyfills/index.d.ts +1 -1
- package/dist/polyfills/index.d.ts.map +1 -1
- package/dist/polyfills/index.js +22 -2
- package/dist/polyfills/index.js.map +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/betterAjvErrors/validation-errors/base.js.map +1 -1
- package/dist/utils/dereference.d.ts +1 -1
- package/dist/utils/dereference.d.ts.map +1 -1
- package/dist/utils/dereference.js +3 -3
- package/dist/utils/dereference.js.map +1 -1
- package/dist/utils/details.d.ts.map +1 -1
- package/dist/utils/details.js.map +1 -1
- package/dist/utils/{escapeJsonPointer.d.ts → escape-json-pointer.d.ts} +1 -1
- package/dist/utils/escape-json-pointer.d.ts.map +1 -0
- package/dist/utils/{escapeJsonPointer.js → escape-json-pointer.js} +1 -1
- package/dist/utils/{escapeJsonPointer.js.map → escape-json-pointer.js.map} +1 -1
- package/dist/utils/{escapeJsonPointer.test.js → escape-json-pointer.test.js} +2 -2
- package/dist/utils/escape-json-pointer.test.js.map +7 -0
- package/dist/utils/filter.d.ts.map +1 -1
- package/dist/utils/filter.js +2 -2
- package/dist/utils/filter.js.map +1 -1
- package/dist/utils/{getEntrypoint.d.ts → get-entrypoint.d.ts} +1 -1
- package/dist/utils/get-entrypoint.d.ts.map +1 -0
- package/dist/utils/{getEntrypoint.js → get-entrypoint.js} +1 -1
- package/dist/utils/get-entrypoint.js.map +7 -0
- package/dist/utils/{getEntrypoint.test.js → get-entrypoint.test.js} +3 -3
- package/dist/utils/get-entrypoint.test.js.map +7 -0
- package/dist/utils/{getListOfReferences.d.ts → get-list-of-references.d.ts} +1 -1
- package/dist/utils/get-list-of-references.d.ts.map +1 -0
- package/dist/utils/{getListOfReferences.js → get-list-of-references.js} +1 -1
- package/dist/utils/get-list-of-references.js.map +7 -0
- package/dist/utils/{getSegmentsFromPath.d.ts → get-segments-from-path.d.ts} +1 -1
- package/dist/utils/get-segments-from-path.d.ts.map +1 -0
- package/dist/utils/{getSegmentsFromPath.js → get-segments-from-path.js} +2 -2
- package/dist/utils/get-segments-from-path.js.map +7 -0
- package/dist/utils/{getSegmentsFromPath.test.js → get-segments-from-path.test.js} +2 -2
- package/dist/utils/get-segments-from-path.test.js.map +7 -0
- package/dist/utils/{isFilesystem.d.ts → is-filesystem.d.ts} +1 -1
- package/dist/utils/is-filesystem.d.ts.map +1 -0
- package/dist/utils/{isFilesystem.js → is-filesystem.js} +1 -1
- package/dist/utils/is-filesystem.js.map +7 -0
- package/dist/utils/{makeFilesystem.test.js → is-filesystem.test.js} +3 -3
- package/dist/utils/is-filesystem.test.js.map +7 -0
- package/dist/utils/{isJson.d.ts → is-json.d.ts} +1 -1
- package/dist/utils/is-json.d.ts.map +1 -0
- package/dist/utils/{isJson.js → is-json.js} +1 -1
- package/dist/utils/{isJson.js.map → is-json.js.map} +1 -1
- package/dist/utils/{isObject.d.ts → is-object.d.ts} +1 -1
- package/dist/utils/is-object.d.ts.map +1 -0
- package/dist/utils/{isObject.js → is-object.js} +1 -1
- package/dist/utils/{isObject.js.map → is-object.js.map} +1 -1
- package/dist/utils/{isObject.test.js → is-object.test.js} +2 -2
- package/dist/utils/is-object.test.js.map +7 -0
- package/dist/utils/{isYaml.d.ts → is-yaml.d.ts} +1 -1
- package/dist/utils/is-yaml.d.ts.map +1 -0
- package/dist/utils/{isYaml.js → is-yaml.js} +1 -1
- package/dist/utils/{isYaml.js.map → is-yaml.js.map} +1 -1
- package/dist/utils/load/index.d.ts +1 -1
- package/dist/utils/load/index.d.ts.map +1 -1
- package/dist/utils/load/index.js +4 -1
- package/dist/utils/load/index.js.map +2 -2
- package/dist/utils/load/load.d.ts.map +1 -1
- package/dist/utils/load/load.js +4 -4
- package/dist/utils/load/load.js.map +1 -1
- package/dist/utils/load/load.test.js +3 -3
- package/dist/utils/load/load.test.js.map +1 -1
- package/dist/utils/{makeFilesystem.d.ts → make-filesystem.d.ts} +1 -1
- package/dist/utils/make-filesystem.d.ts.map +1 -0
- package/dist/utils/{makeFilesystem.js → make-filesystem.js} +3 -3
- package/dist/utils/make-filesystem.js.map +7 -0
- package/dist/utils/normalize.d.ts.map +1 -1
- package/dist/utils/normalize.js +1 -1
- package/dist/utils/normalize.js.map +1 -1
- package/dist/utils/{resolveReferences.d.ts → resolve-references.d.ts} +1 -1
- package/dist/utils/{resolveReferences.d.ts.map → resolve-references.d.ts.map} +1 -1
- package/dist/utils/{resolveReferences.js → resolve-references.js} +4 -4
- package/dist/utils/resolve-references.js.map +7 -0
- package/dist/utils/{resolveReferences.test.js → resolve-references.test.js} +4 -4
- package/dist/utils/{resolveReferences.test.js.map → resolve-references.test.js.map} +3 -3
- package/dist/utils/{toJson.d.ts → to-json.d.ts} +1 -1
- package/dist/utils/to-json.d.ts.map +1 -0
- package/dist/utils/{toJson.js → to-json.js} +1 -1
- package/dist/utils/to-json.js.map +7 -0
- package/dist/utils/{toYaml.d.ts → to-yaml.d.ts} +1 -1
- package/dist/utils/to-yaml.d.ts.map +1 -0
- package/dist/utils/{toYaml.js → to-yaml.js} +1 -1
- package/dist/utils/{toYaml.js.map → to-yaml.js.map} +2 -2
- package/dist/utils/transform/sanitize.d.ts +2 -0
- package/dist/utils/transform/sanitize.d.ts.map +1 -1
- package/dist/utils/transform/sanitize.js.map +2 -2
- package/dist/utils/transform/utils/addInfoObject.d.ts.map +1 -1
- package/dist/utils/transform/utils/addInfoObject.js.map +1 -1
- package/dist/utils/transform/utils/addLatestOpenApiVersion.d.ts.map +1 -1
- package/dist/utils/transform/utils/addLatestOpenApiVersion.js.map +1 -1
- package/dist/utils/transform/utils/addMissingTags.d.ts.map +1 -1
- package/dist/utils/transform/utils/addMissingTags.js.map +1 -1
- package/dist/utils/transform/utils/normalizeSecuritySchemes.d.ts.map +1 -1
- package/dist/utils/transform/utils/normalizeSecuritySchemes.js.map +1 -1
- package/dist/utils/transform/utils/rejectSwaggerDocuments.d.ts.map +1 -1
- package/dist/utils/transform/utils/rejectSwaggerDocuments.js.map +1 -1
- package/dist/utils/{transformErrors.d.ts → transform-errors.d.ts} +1 -1
- package/dist/utils/transform-errors.d.ts.map +1 -0
- package/dist/utils/{transformErrors.js → transform-errors.js} +1 -1
- package/dist/utils/transform-errors.js.map +7 -0
- package/dist/utils/{transformErrors.test.js → transform-errors.test.js} +3 -3
- package/dist/utils/transform-errors.test.js.map +7 -0
- package/dist/utils/traverse.d.ts.map +1 -1
- package/dist/utils/traverse.js.map +1 -1
- package/dist/utils/{unescapeJsonPointer.d.ts → unescape-json-pointer.d.ts} +1 -1
- package/dist/utils/unescape-json-pointer.d.ts.map +1 -0
- package/dist/utils/{unescapeJsonPointer.js → unescape-json-pointer.js} +1 -1
- package/dist/utils/{unescapeJsonPointer.js.map → unescape-json-pointer.js.map} +1 -1
- package/dist/utils/{unescapeJsonPointer.test.js → unescape-json-pointer.test.js} +2 -2
- package/dist/utils/unescape-json-pointer.test.js.map +7 -0
- package/dist/utils/{upgradeFromThreeToThreeOne.d.ts → upgrade-from-three-to-three-one.d.ts} +1 -1
- package/dist/utils/upgrade-from-three-to-three-one.d.ts.map +1 -0
- package/dist/utils/{upgradeFromThreeToThreeOne.js → upgrade-from-three-to-three-one.js} +1 -2
- package/dist/utils/upgrade-from-three-to-three-one.js.map +7 -0
- package/dist/utils/{upgradeFromThreeToThreeOne.test.js → upgrade-from-three-to-three-one.test.js} +2 -2
- package/dist/utils/upgrade-from-three-to-three-one.test.js.map +7 -0
- package/dist/utils/{upgradeFromTwoToThree.d.ts → upgrade-from-two-to-three.d.ts} +1 -1
- package/dist/utils/upgrade-from-two-to-three.d.ts.map +1 -0
- package/dist/utils/{upgradeFromTwoToThree.js → upgrade-from-two-to-three.js} +1 -1
- package/dist/utils/{upgradeFromTwoToThree.js.map → upgrade-from-two-to-three.js.map} +1 -1
- package/dist/utils/{upgradeFromTwoToThree.test.js → upgrade-from-two-to-three.test.js} +2 -2
- package/dist/utils/upgrade-from-two-to-three.test.js.map +7 -0
- package/dist/utils/upgrade.bench.js +1 -1
- package/dist/utils/upgrade.bench.js.map +1 -1
- package/dist/utils/upgrade.d.ts.map +1 -1
- package/dist/utils/upgrade.js +4 -4
- package/dist/utils/upgrade.js.map +1 -1
- package/dist/utils/upgrade.test.js +1 -1
- package/dist/utils/upgrade.test.js.map +1 -1
- package/dist/utils/validate.d.ts.map +1 -1
- package/dist/utils/validate.js +1 -1
- package/dist/utils/validate.js.map +1 -1
- package/package.json +2 -2
- package/dist/plugins/fetch-urls/fetchUrls.d.ts.map +0 -1
- package/dist/plugins/fetch-urls/fetchUrls.js.map +0 -7
- package/dist/plugins/fetch-urls/fetchUrls.test.js.map +0 -7
- package/dist/plugins/read-files/readFiles.d.ts.map +0 -1
- package/dist/plugins/read-files/readFiles.js.map +0 -7
- package/dist/plugins/read-files/readFiles.test.js.map +0 -7
- package/dist/utils/escapeJsonPointer.d.ts.map +0 -1
- package/dist/utils/escapeJsonPointer.test.js.map +0 -7
- package/dist/utils/getEntrypoint.d.ts.map +0 -1
- package/dist/utils/getEntrypoint.js.map +0 -7
- package/dist/utils/getEntrypoint.test.js.map +0 -7
- package/dist/utils/getListOfReferences.d.ts.map +0 -1
- package/dist/utils/getListOfReferences.js.map +0 -7
- package/dist/utils/getSegmentsFromPath.d.ts.map +0 -1
- package/dist/utils/getSegmentsFromPath.js.map +0 -7
- package/dist/utils/getSegmentsFromPath.test.js.map +0 -7
- package/dist/utils/index.d.ts +0 -27
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -27
- package/dist/utils/index.js.map +0 -7
- package/dist/utils/isFilesystem.d.ts.map +0 -1
- package/dist/utils/isFilesystem.js.map +0 -7
- package/dist/utils/isJson.d.ts.map +0 -1
- package/dist/utils/isObject.d.ts.map +0 -1
- package/dist/utils/isObject.test.js.map +0 -7
- package/dist/utils/isYaml.d.ts.map +0 -1
- package/dist/utils/makeFilesystem.d.ts.map +0 -1
- package/dist/utils/makeFilesystem.js.map +0 -7
- package/dist/utils/makeFilesystem.test.js.map +0 -7
- package/dist/utils/openapi/actions/details.d.ts +0 -7
- package/dist/utils/openapi/actions/details.d.ts.map +0 -1
- package/dist/utils/openapi/actions/details.js +0 -11
- package/dist/utils/openapi/actions/details.js.map +0 -7
- package/dist/utils/openapi/actions/files.d.ts +0 -6
- package/dist/utils/openapi/actions/files.d.ts.map +0 -1
- package/dist/utils/openapi/actions/files.js +0 -9
- package/dist/utils/openapi/actions/files.js.map +0 -7
- package/dist/utils/openapi/actions/get.d.ts +0 -6
- package/dist/utils/openapi/actions/get.d.ts.map +0 -1
- package/dist/utils/openapi/actions/get.js +0 -11
- package/dist/utils/openapi/actions/get.js.map +0 -7
- package/dist/utils/openapi/actions/toJson.d.ts +0 -6
- package/dist/utils/openapi/actions/toJson.d.ts.map +0 -1
- package/dist/utils/openapi/actions/toJson.js +0 -11
- package/dist/utils/openapi/actions/toJson.js.map +0 -7
- package/dist/utils/openapi/actions/toYaml.d.ts +0 -6
- package/dist/utils/openapi/actions/toYaml.d.ts.map +0 -1
- package/dist/utils/openapi/actions/toYaml.js +0 -11
- package/dist/utils/openapi/actions/toYaml.js.map +0 -7
- package/dist/utils/openapi/commands/dereferenceCommand.d.ts +0 -27
- package/dist/utils/openapi/commands/dereferenceCommand.d.ts.map +0 -1
- package/dist/utils/openapi/commands/dereferenceCommand.js +0 -27
- package/dist/utils/openapi/commands/dereferenceCommand.js.map +0 -7
- package/dist/utils/openapi/commands/filterCommand.d.ts +0 -41
- package/dist/utils/openapi/commands/filterCommand.d.ts.map +0 -1
- package/dist/utils/openapi/commands/filterCommand.js +0 -26
- package/dist/utils/openapi/commands/filterCommand.js.map +0 -7
- package/dist/utils/openapi/commands/loadCommand.d.ts +0 -8321
- package/dist/utils/openapi/commands/loadCommand.d.ts.map +0 -1
- package/dist/utils/openapi/commands/loadCommand.js +0 -42
- package/dist/utils/openapi/commands/loadCommand.js.map +0 -7
- package/dist/utils/openapi/commands/upgradeCommand.d.ts +0 -3406
- package/dist/utils/openapi/commands/upgradeCommand.d.ts.map +0 -1
- package/dist/utils/openapi/commands/upgradeCommand.js +0 -29
- package/dist/utils/openapi/commands/upgradeCommand.js.map +0 -7
- package/dist/utils/openapi/commands/validateCommand.d.ts +0 -3451
- package/dist/utils/openapi/commands/validateCommand.d.ts.map +0 -1
- package/dist/utils/openapi/commands/validateCommand.js +0 -33
- package/dist/utils/openapi/commands/validateCommand.js.map +0 -7
- package/dist/utils/openapi/index.d.ts +0 -2
- package/dist/utils/openapi/index.d.ts.map +0 -1
- package/dist/utils/openapi/index.js +0 -2
- package/dist/utils/openapi/index.js.map +0 -7
- package/dist/utils/openapi/openapi.d.ts +0 -1272
- package/dist/utils/openapi/openapi.d.ts.map +0 -1
- package/dist/utils/openapi/openapi.js +0 -15
- package/dist/utils/openapi/openapi.js.map +0 -7
- package/dist/utils/openapi/openapi.test-d.d.ts +0 -2
- package/dist/utils/openapi/openapi.test-d.d.ts.map +0 -1
- package/dist/utils/openapi/openapi.test-d.js +0 -14
- package/dist/utils/openapi/openapi.test-d.js.map +0 -7
- package/dist/utils/openapi/openapi.test.js +0 -309
- package/dist/utils/openapi/openapi.test.js.map +0 -7
- package/dist/utils/openapi/utils/queueTask.d.ts +0 -6
- package/dist/utils/openapi/utils/queueTask.d.ts.map +0 -1
- package/dist/utils/openapi/utils/queueTask.js +0 -10
- package/dist/utils/openapi/utils/queueTask.js.map +0 -7
- package/dist/utils/openapi/utils/workThroughQueue.d.ts +0 -6
- package/dist/utils/openapi/utils/workThroughQueue.d.ts.map +0 -1
- package/dist/utils/openapi/utils/workThroughQueue.js +0 -52
- package/dist/utils/openapi/utils/workThroughQueue.js.map +0 -7
- package/dist/utils/openapi/utils/workThroughQueue.test.js +0 -244
- package/dist/utils/openapi/utils/workThroughQueue.test.js.map +0 -7
- package/dist/utils/resolveReferences.js.map +0 -7
- package/dist/utils/toJson.d.ts.map +0 -1
- package/dist/utils/toJson.js.map +0 -7
- package/dist/utils/toYaml.d.ts.map +0 -1
- package/dist/utils/transform/index.d.ts +0 -2
- package/dist/utils/transform/index.d.ts.map +0 -1
- package/dist/utils/transform/index.js +0 -2
- package/dist/utils/transform/index.js.map +0 -7
- package/dist/utils/transformErrors.d.ts.map +0 -1
- package/dist/utils/transformErrors.js.map +0 -7
- package/dist/utils/transformErrors.test.js.map +0 -7
- package/dist/utils/unescapeJsonPointer.d.ts.map +0 -1
- package/dist/utils/unescapeJsonPointer.test.js.map +0 -7
- package/dist/utils/upgradeFromThreeToThreeOne.d.ts.map +0 -1
- package/dist/utils/upgradeFromThreeToThreeOne.js.map +0 -7
- package/dist/utils/upgradeFromThreeToThreeOne.test.js.map +0 -7
- package/dist/utils/upgradeFromTwoToThree.d.ts.map +0 -1
- package/dist/utils/upgradeFromTwoToThree.test.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/configuration/index.ts"],
|
|
4
|
-
"sourcesContent": ["import Swagger20 from '
|
|
4
|
+
"sourcesContent": ["import Swagger20 from '@/schemas/v2.0/schema'\nimport OpenApi30 from '@/schemas/v3.0/schema'\nimport OpenApi31 from '@/schemas/v3.1/schema'\n\n/**\n * A list of the supported OpenAPI specifications\n */\nexport const OpenApiSpecifications = {\n '2.0': Swagger20,\n '3.0': OpenApi30,\n '3.1': OpenApi31,\n}\n\nexport type OpenApiVersion = keyof typeof OpenApiSpecifications\n\nexport const OpenApiVersions = Object.keys(OpenApiSpecifications) as OpenApiVersion[]\n\n/**\n * List of error messages used in the Validator\n */\nexport const ERRORS = {\n EMPTY_OR_INVALID: 'Can\u2019t find JSON, YAML or filename in data',\n // URI_MUST_BE_STRING: 'uri parameter or $id attribute must be a string',\n OPENAPI_VERSION_NOT_SUPPORTED:\n 'Can\u2019t find supported Swagger/OpenAPI version in specification, version must be a string.',\n INVALID_REFERENCE: 'Can\u2019t resolve reference: %s',\n EXTERNAL_REFERENCE_NOT_FOUND: 'Can\u2019t resolve external reference: %s',\n FILE_DOES_NOT_EXIST: 'File does not exist: %s',\n NO_CONTENT: 'No content found',\n} as const\n\nexport type ValidationError = keyof typeof ERRORS\n"],
|
|
5
5
|
"mappings": "AAAA,OAAO,eAAe;AACtB,OAAO,eAAe;AACtB,OAAO,eAAe;AAKf,MAAM,wBAAwB;AAAA,EACnC,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;AAIO,MAAM,kBAAkB,OAAO,KAAK,qBAAqB;AAKzD,MAAM,SAAS;AAAA,EACpB,kBAAkB;AAAA;AAAA,EAElB,+BACE;AAAA,EACF,mBAAmB;AAAA,EACnB,8BAA8B;AAAA,EAC9B,qBAAqB;AAAA,EACrB,YAAY;AACd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export { dereference } from './utils/dereference.js';
|
|
2
|
+
export { escapeJsonPointer } from './utils/escape-json-pointer.js';
|
|
3
|
+
export { filter } from './utils/filter.js';
|
|
4
|
+
export { isJson } from './utils/is-json.js';
|
|
5
|
+
export { isYaml } from './utils/is-yaml.js';
|
|
6
|
+
export { load } from './utils/load/index.js';
|
|
7
|
+
export { normalize } from './utils/normalize.js';
|
|
8
|
+
export { sanitize } from './utils/transform/sanitize.js';
|
|
9
|
+
export { toJson } from './utils/to-json.js';
|
|
10
|
+
export { toYaml } from './utils/to-yaml.js';
|
|
11
|
+
export { traverse } from './utils/traverse.js';
|
|
12
|
+
export { unescapeJsonPointer } from './utils/unescape-json-pointer.js';
|
|
13
|
+
export { upgrade } from './utils/upgrade.js';
|
|
14
|
+
export { upgradeFromThreeToThreeOne } from './utils/upgrade-from-three-to-three-one.js';
|
|
15
|
+
export { upgradeFromTwoToThree } from './utils/upgrade-from-two-to-three.js';
|
|
16
|
+
export { validate } from './utils/validate.js';
|
|
17
|
+
export type { LoadResult, Filesystem, AnyObject, ErrorObject } from './types/index.js';
|
|
5
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAA;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { dereference } from "./utils/dereference.js";
|
|
2
|
+
import { escapeJsonPointer } from "./utils/escape-json-pointer.js";
|
|
3
|
+
import { filter } from "./utils/filter.js";
|
|
4
|
+
import { isJson } from "./utils/is-json.js";
|
|
5
|
+
import { isYaml } from "./utils/is-yaml.js";
|
|
6
|
+
import { load } from "./utils/load/index.js";
|
|
7
|
+
import { normalize } from "./utils/normalize.js";
|
|
8
|
+
import { sanitize } from "./utils/transform/sanitize.js";
|
|
9
|
+
import { toJson } from "./utils/to-json.js";
|
|
10
|
+
import { toYaml } from "./utils/to-yaml.js";
|
|
11
|
+
import { traverse } from "./utils/traverse.js";
|
|
12
|
+
import { unescapeJsonPointer } from "./utils/unescape-json-pointer.js";
|
|
13
|
+
import { upgrade } from "./utils/upgrade.js";
|
|
14
|
+
import { upgradeFromThreeToThreeOne } from "./utils/upgrade-from-three-to-three-one.js";
|
|
15
|
+
import { upgradeFromTwoToThree } from "./utils/upgrade-from-two-to-three.js";
|
|
16
|
+
import { validate } from "./utils/validate.js";
|
|
17
|
+
export {
|
|
18
|
+
dereference,
|
|
19
|
+
escapeJsonPointer,
|
|
20
|
+
filter,
|
|
21
|
+
isJson,
|
|
22
|
+
isYaml,
|
|
23
|
+
load,
|
|
24
|
+
normalize,
|
|
25
|
+
sanitize,
|
|
26
|
+
toJson,
|
|
27
|
+
toYaml,
|
|
28
|
+
traverse,
|
|
29
|
+
unescapeJsonPointer,
|
|
30
|
+
upgrade,
|
|
31
|
+
upgradeFromThreeToThreeOne,
|
|
32
|
+
upgradeFromTwoToThree,
|
|
33
|
+
validate
|
|
34
|
+
};
|
|
5
35
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "AAAA,cAAc;
|
|
4
|
+
"sourcesContent": ["export { dereference } from './utils/dereference'\nexport { escapeJsonPointer } from './utils/escape-json-pointer'\nexport { filter } from './utils/filter'\nexport { isJson } from './utils/is-json'\nexport { isYaml } from './utils/is-yaml'\nexport { load } from './utils/load'\nexport { normalize } from './utils/normalize'\nexport { sanitize } from './utils/transform/sanitize'\nexport { toJson } from './utils/to-json'\nexport { toYaml } from './utils/to-yaml'\nexport { traverse } from './utils/traverse'\nexport { unescapeJsonPointer } from './utils/unescape-json-pointer'\nexport { upgrade } from './utils/upgrade'\nexport { upgradeFromThreeToThreeOne } from './utils/upgrade-from-three-to-three-one'\nexport { upgradeFromTwoToThree } from './utils/upgrade-from-two-to-three'\nexport { validate } from './utils/validate'\nexport type { LoadResult, Filesystem, AnyObject, ErrorObject } from './types'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AACpC,SAAS,eAAe;AACxB,SAAS,kCAAkC;AAC3C,SAAS,6BAA6B;AACtC,SAAS,gBAAgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.d.ts","sourceRoot":"","sources":["../../../src/lib/Validator/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,cAAc,CAAA;AAEhC,OAAO,OAAO,MAAM,kBAAkB,CAAA;AAEtC,OAAO,EAAiC,KAAK,cAAc,EAAmB,MAAM,
|
|
1
|
+
{"version":3,"file":"Validator.d.ts","sourceRoot":"","sources":["../../../src/lib/Validator/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,cAAc,CAAA;AAEhC,OAAO,OAAO,MAAM,kBAAkB,CAAA;AAEtC,OAAO,EAAiC,KAAK,cAAc,EAAmB,MAAM,iBAAiB,CAAA;AACrG,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAK9F;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;CAG9B,CAAA;AAED,qBAAa,SAAS;IACb,OAAO,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAA;IAErC,OAAc,iBAAiB,4BAAkB;IAGjD,SAAS,CAAC,aAAa,EAAE,MAAM,CAC7B,MAAM,EACN,CAAC,CAAC,aAAa,EAAE,SAAS,KAAK,OAAO,CAAC,GAAG;QACxC,MAAM,EAAE,MAAM,CAAA;KACf,CACF,CAAK;IAEN,SAAS,CAAC,MAAM,EAAE,MAAM,CAAA;IAExB,SAAS,CAAC,oBAAoB,EAAE,MAAM,CAAA;IAEtC,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAE5B,aAAa,EAAE,SAAS,CAAA;IAE/B;;OAEG;IACG,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IAoF7F;;OAEG;IACG,eAAe,CAAC,OAAO,EAAE,cAAc;CA8B9C"}
|
|
@@ -3,8 +3,8 @@ import addFormats from "ajv-formats";
|
|
|
3
3
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
4
4
|
import { ERRORS, OpenApiSpecifications, OpenApiVersions } from "../../configuration/index.js";
|
|
5
5
|
import { details as getOpenApiVersion } from "../../utils/details.js";
|
|
6
|
-
import { resolveReferences } from "../../utils/
|
|
7
|
-
import { transformErrors } from "../../utils/
|
|
6
|
+
import { resolveReferences } from "../../utils/resolve-references.js";
|
|
7
|
+
import { transformErrors } from "../../utils/transform-errors.js";
|
|
8
8
|
const jsonSchemaVersions = {
|
|
9
9
|
"http://json-schema.org/draft-04/schema#": Ajv04,
|
|
10
10
|
"https://json-schema.org/draft/2020-12/schema": Ajv2020
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/Validator/Validator.ts"],
|
|
4
|
-
"sourcesContent": ["import Ajv04 from 'ajv-draft-04'\nimport addFormats from 'ajv-formats'\nimport Ajv2020 from 'ajv/dist/2020.js'\n\nimport { ERRORS, OpenApiSpecifications, type OpenApiVersion, OpenApiVersions } from '
|
|
4
|
+
"sourcesContent": ["import Ajv04 from 'ajv-draft-04'\nimport addFormats from 'ajv-formats'\nimport Ajv2020 from 'ajv/dist/2020.js'\n\nimport { ERRORS, OpenApiSpecifications, type OpenApiVersion, OpenApiVersions } from '@/configuration'\nimport type { AnyObject, Filesystem, ThrowOnErrorOption, ValidateResult } from '@/types/index'\nimport { details as getOpenApiVersion } from '@/utils/details'\nimport { resolveReferences } from '@/utils/resolve-references'\nimport { transformErrors } from '@/utils/transform-errors'\n\n/**\n * Configure available JSON Schema versions\n */\nexport const jsonSchemaVersions = {\n 'http://json-schema.org/draft-04/schema#': Ajv04,\n 'https://json-schema.org/draft/2020-12/schema': Ajv2020,\n}\n\nexport class Validator {\n public version: '2.0' | '3.0' | '3.1'\n\n public static supportedVersions = OpenApiVersions\n\n // Object with function *or* object { errors: string }\n protected ajvValidators: Record<\n string,\n ((specification: AnyObject) => boolean) & {\n errors: string\n }\n > = {}\n\n protected errors: string\n\n protected specificationVersion: string\n\n protected specificationType: string\n\n public specification: AnyObject\n\n /**\n * Checks whether a specification is valid and all references can be resolved.\n */\n async validate(filesystem: Filesystem, options?: ThrowOnErrorOption): Promise<ValidateResult> {\n const entrypoint = filesystem.find((file) => file.isEntrypoint)\n const specification = entrypoint?.specification\n\n // TODO: How does this work with a filesystem?\n this.specification = specification\n\n // TODO: defaulting info.version to keep parser compatible with the previous one\n // we should bubble this error up and not throw on it\n if (this.specification?.info && !this.specification.info.version) {\n this.specification.info.version = '0.0.1'\n }\n\n try {\n // AnyObject is empty or invalid\n if (specification === undefined || specification === null) {\n if (options?.throwOnError) {\n throw new Error(ERRORS.EMPTY_OR_INVALID)\n }\n\n return {\n valid: false,\n errors: transformErrors(entrypoint, ERRORS.EMPTY_OR_INVALID),\n }\n }\n\n // Meta data about the specification\n const { version, specificationType, specificationVersion } = getOpenApiVersion(specification)\n\n this.version = version\n this.specificationVersion = specificationVersion\n this.specificationType = specificationType\n\n // AnyObject is not supported\n if (!version) {\n if (options?.throwOnError) {\n throw new Error(ERRORS.OPENAPI_VERSION_NOT_SUPPORTED)\n }\n\n return {\n valid: false,\n errors: transformErrors(entrypoint, ERRORS.OPENAPI_VERSION_NOT_SUPPORTED),\n }\n }\n\n // Get the correct OpenAPI validator\n const validateSchema = await this.getAjvValidator(version)\n const schemaResult = validateSchema(specification)\n\n // Error handling\n if (validateSchema.errors) {\n if (validateSchema.errors.length > 0) {\n if (options?.throwOnError) {\n throw new Error(validateSchema.errors[0])\n }\n\n return {\n valid: false,\n errors: transformErrors(entrypoint, validateSchema.errors),\n }\n }\n }\n\n // Check if the references are valid\n const resolvedReferences = resolveReferences(filesystem, options)\n\n return {\n valid: schemaResult && resolvedReferences.valid,\n errors: [...(schemaResult.errors ?? []), ...resolvedReferences.errors],\n schema: resolvedReferences.schema,\n }\n } catch (error) {\n // Something went horribly wrong!\n if (options?.throwOnError) {\n throw error\n }\n\n return {\n valid: false,\n errors: transformErrors(entrypoint, error.message ?? error),\n }\n }\n }\n\n /**\n * Ajv JSON schema validator\n */\n async getAjvValidator(version: OpenApiVersion) {\n // Schema loaded already\n if (this.ajvValidators[version]) {\n return this.ajvValidators[version]\n }\n\n // Load OpenAPI Schema\n const schema = OpenApiSpecifications[version]\n\n // Load JSON Schema\n const AjvClass = jsonSchemaVersions[schema.$schema]\n\n // Get the correct Ajv validator\n const ajv = new AjvClass({\n // Ajv is a bit too strict in its strict validation of OpenAPI schemas.\n // Switch strict mode off.\n strict: false,\n })\n\n // Register formats\n // https://ajv.js.org/packages/ajv-formats.html#formats\n addFormats(ajv)\n\n // OpenAPI 3.1 uses media-range format\n if (version === '3.1') {\n ajv.addFormat('media-range', true)\n }\n\n return (this.ajvValidators[version] = ajv.compile(schema))\n }\n}\n"],
|
|
5
5
|
"mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,OAAO,aAAa;AAEpB,SAAS,QAAQ,uBAA4C,uBAAuB;AAEpF,SAAS,WAAW,yBAAyB;AAC7C,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAKzB,MAAM,qBAAqB;AAAA,EAChC,2CAA2C;AAAA,EAC3C,gDAAgD;AAClD;AAEO,MAAM,UAAU;AAAA,EACd;AAAA,EAEP,OAAc,oBAAoB;AAAA;AAAA,EAGxB,gBAKN,CAAC;AAAA,EAEK;AAAA,EAEA;AAAA,EAEA;AAAA,EAEH;AAAA;AAAA;AAAA;AAAA,EAKP,MAAM,SAAS,YAAwB,SAAuD;AAC5F,UAAM,aAAa,WAAW,KAAK,CAAC,SAAS,KAAK,YAAY;AAC9D,UAAM,gBAAgB,YAAY;AAGlC,SAAK,gBAAgB;AAIrB,QAAI,KAAK,eAAe,QAAQ,CAAC,KAAK,cAAc,KAAK,SAAS;AAChE,WAAK,cAAc,KAAK,UAAU;AAAA,IACpC;AAEA,QAAI;AAEF,UAAI,kBAAkB,UAAa,kBAAkB,MAAM;AACzD,YAAI,SAAS,cAAc;AACzB,gBAAM,IAAI,MAAM,OAAO,gBAAgB;AAAA,QACzC;AAEA,eAAO;AAAA,UACL,OAAO;AAAA,UACP,QAAQ,gBAAgB,YAAY,OAAO,gBAAgB;AAAA,QAC7D;AAAA,MACF;AAGA,YAAM,EAAE,SAAS,mBAAmB,qBAAqB,IAAI,kBAAkB,aAAa;AAE5F,WAAK,UAAU;AACf,WAAK,uBAAuB;AAC5B,WAAK,oBAAoB;AAGzB,UAAI,CAAC,SAAS;AACZ,YAAI,SAAS,cAAc;AACzB,gBAAM,IAAI,MAAM,OAAO,6BAA6B;AAAA,QACtD;AAEA,eAAO;AAAA,UACL,OAAO;AAAA,UACP,QAAQ,gBAAgB,YAAY,OAAO,6BAA6B;AAAA,QAC1E;AAAA,MACF;AAGA,YAAM,iBAAiB,MAAM,KAAK,gBAAgB,OAAO;AACzD,YAAM,eAAe,eAAe,aAAa;AAGjD,UAAI,eAAe,QAAQ;AACzB,YAAI,eAAe,OAAO,SAAS,GAAG;AACpC,cAAI,SAAS,cAAc;AACzB,kBAAM,IAAI,MAAM,eAAe,OAAO,CAAC,CAAC;AAAA,UAC1C;AAEA,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,QAAQ,gBAAgB,YAAY,eAAe,MAAM;AAAA,UAC3D;AAAA,QACF;AAAA,MACF;AAGA,YAAM,qBAAqB,kBAAkB,YAAY,OAAO;AAEhE,aAAO;AAAA,QACL,OAAO,gBAAgB,mBAAmB;AAAA,QAC1C,QAAQ,CAAC,GAAI,aAAa,UAAU,CAAC,GAAI,GAAG,mBAAmB,MAAM;AAAA,QACrE,QAAQ,mBAAmB;AAAA,MAC7B;AAAA,IACF,SAAS,OAAO;AAEd,UAAI,SAAS,cAAc;AACzB,cAAM;AAAA,MACR;AAEA,aAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ,gBAAgB,YAAY,MAAM,WAAW,KAAK;AAAA,MAC5D;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,gBAAgB,SAAyB;AAE7C,QAAI,KAAK,cAAc,OAAO,GAAG;AAC/B,aAAO,KAAK,cAAc,OAAO;AAAA,IACnC;AAGA,UAAM,SAAS,sBAAsB,OAAO;AAG5C,UAAM,WAAW,mBAAmB,OAAO,OAAO;AAGlD,UAAM,MAAM,IAAI,SAAS;AAAA;AAAA;AAAA,MAGvB,QAAQ;AAAA,IACV,CAAC;AAID,eAAW,GAAG;AAGd,QAAI,YAAY,OAAO;AACrB,UAAI,UAAU,eAAe,IAAI;AAAA,IACnC;AAEA,WAAQ,KAAK,cAAc,OAAO,IAAI,IAAI,QAAQ,MAAM;AAAA,EAC1D;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/Validator/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/Validator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/Validator/index.ts"],
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["export { Validator } from './Validator'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-urls.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch-urls/fetch-urls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,eAAO,MAAM,6BAA6B;;CAEzC,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,CAAC,mBAAmB,CAAC,EAAE;IAC7C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CAC3C,KAAK,UA2CL,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/fetch-urls/fetch-urls.ts"],
|
|
4
|
+
"sourcesContent": ["import type { LoadPlugin } from '@/utils/load/load'\n\nexport const fetchUrlsDefaultConfiguration = {\n limit: 20,\n}\n\nexport const fetchUrls: (customConfiguration?: {\n /**\n * Limit the number of requests. Set to `false` to disable the limit.\n */\n limit?: number | false\n /**\n * Fetch function to use instead of the global fetch. Use this to intercept requests.\n */\n fetch?: (url: string) => Promise<Response>\n}) => LoadPlugin = (customConfiguration) => {\n // State\n let numberOfRequests = 0\n\n // Configuration\n const configuration = {\n ...fetchUrlsDefaultConfiguration,\n ...customConfiguration,\n }\n\n return {\n check(value?: any) {\n // Not a string\n if (typeof value !== 'string') {\n return false\n }\n\n // Not http/https\n if (!value.startsWith('http://') && !value.startsWith('https://')) {\n return false\n }\n\n return true\n },\n async get(value?: any) {\n // Limit ht enumber of requests\n if (configuration?.limit !== false && numberOfRequests >= configuration?.limit) {\n console.warn(`[fetchUrls] Maximum number of requests reeached (${configuration?.limit}), skipping request`)\n return undefined\n }\n\n try {\n numberOfRequests++\n\n const response = await (configuration?.fetch ? configuration.fetch(value) : fetch(value))\n\n return await response.text()\n } catch (error) {\n console.error('[fetchUrls]', error.message, `(${value})`)\n return undefined\n }\n },\n }\n}\n"],
|
|
5
|
+
"mappings": "AAEO,MAAM,gCAAgC;AAAA,EAC3C,OAAO;AACT;AAEO,MAAM,YASM,CAAC,wBAAwB;AAE1C,MAAI,mBAAmB;AAGvB,QAAM,gBAAgB;AAAA,IACpB,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,SAAO;AAAA,IACL,MAAM,OAAa;AAEjB,UAAI,OAAO,UAAU,UAAU;AAC7B,eAAO;AAAA,MACT;AAGA,UAAI,CAAC,MAAM,WAAW,SAAS,KAAK,CAAC,MAAM,WAAW,UAAU,GAAG;AACjE,eAAO;AAAA,MACT;AAEA,aAAO;AAAA,IACT;AAAA,IACA,MAAM,IAAI,OAAa;AAErB,UAAI,eAAe,UAAU,SAAS,oBAAoB,eAAe,OAAO;AAC9E,gBAAQ,KAAK,oDAAoD,eAAe,KAAK,qBAAqB;AAC1G,eAAO;AAAA,MACT;AAEA,UAAI;AACF;AAEA,cAAM,WAAW,OAAO,eAAe,QAAQ,cAAc,MAAM,KAAK,IAAI,MAAM,KAAK;AAEvF,eAAO,MAAM,SAAS,KAAK;AAAA,MAC7B,SAAS,OAAO;AACd,gBAAQ,MAAM,eAAe,MAAM,SAAS,IAAI,KAAK,GAAG;AACxD,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { fetchUrls } from "./
|
|
2
|
+
import { fetchUrls } from "./fetch-urls.js";
|
|
3
3
|
global.fetch = vi.fn();
|
|
4
4
|
describe("fetchUrls", async () => {
|
|
5
5
|
beforeEach(() => {
|
|
@@ -47,4 +47,4 @@ describe("fetchUrls", async () => {
|
|
|
47
47
|
).toBe("OK");
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
-
//# sourceMappingURL=
|
|
50
|
+
//# sourceMappingURL=fetch-urls.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/fetch-urls/fetch-urls.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { beforeEach, describe, expect, it, vi } from 'vitest'\n\nimport { fetchUrls } from './fetch-urls'\n\nglobal.fetch = vi.fn()\n\ndescribe('fetchUrls', async () => {\n beforeEach(() => {\n // @ts-expect-error\n global.fetch.mockReset()\n })\n\n it('returns true for an url', async () => {\n expect(fetchUrls().check('http://example.com/specification/openapi.yaml')).toBe(true)\n })\n\n it('returns false for a filename', async () => {\n expect(fetchUrls().check('openapi.yaml')).toBe(false)\n })\n\n it('returns false for a path', async () => {\n expect(fetchUrls().check('specification/openapi.yaml')).toBe(false)\n })\n\n it('returns false for an object', async () => {\n expect(fetchUrls().check({})).toBe(false)\n })\n\n it('returns false for undefinded', async () => {\n expect(fetchUrls().check()).toBe(false)\n })\n\n it('fetches the URL', async () => {\n // @ts-expect-error\n fetch.mockImplementation(async (url: string) => ({\n text: async () => {\n if (url === 'http://example.com/specification/openapi.yaml') {\n return 'OK'\n }\n\n throw new Error('Not found')\n },\n }))\n\n expect(await fetchUrls().get('http://example.com/specification/openapi.yaml')).toBe('OK')\n })\n\n it('rewrites the URL', async () => {\n // @ts-expect-error\n fetch.mockImplementation(async (url: string) => ({\n text: async () => {\n if (url === 'http://foobar.com/specification/openapi.yaml') {\n return 'OK'\n }\n throw new Error('Not found')\n },\n }))\n\n expect(\n await fetchUrls({\n fetch: (url) => fetch(url.replace('example', 'foobar')),\n }).get('http://foobar.com/specification/openapi.yaml'),\n ).toBe('OK')\n })\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,UAAU,QAAQ,IAAI,UAAU;AAErD,SAAS,iBAAiB;AAE1B,OAAO,QAAQ,GAAG,GAAG;AAErB,SAAS,aAAa,YAAY;AAChC,aAAW,MAAM;AAEf,WAAO,MAAM,UAAU;AAAA,EACzB,CAAC;AAED,KAAG,2BAA2B,YAAY;AACxC,WAAO,UAAU,EAAE,MAAM,+CAA+C,CAAC,EAAE,KAAK,IAAI;AAAA,EACtF,CAAC;AAED,KAAG,gCAAgC,YAAY;AAC7C,WAAO,UAAU,EAAE,MAAM,cAAc,CAAC,EAAE,KAAK,KAAK;AAAA,EACtD,CAAC;AAED,KAAG,4BAA4B,YAAY;AACzC,WAAO,UAAU,EAAE,MAAM,4BAA4B,CAAC,EAAE,KAAK,KAAK;AAAA,EACpE,CAAC;AAED,KAAG,+BAA+B,YAAY;AAC5C,WAAO,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK;AAAA,EAC1C,CAAC;AAED,KAAG,gCAAgC,YAAY;AAC7C,WAAO,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,KAAK;AAAA,EACxC,CAAC;AAED,KAAG,mBAAmB,YAAY;AAEhC,UAAM,mBAAmB,OAAO,SAAiB;AAAA,MAC/C,MAAM,YAAY;AAChB,YAAI,QAAQ,iDAAiD;AAC3D,iBAAO;AAAA,QACT;AAEA,cAAM,IAAI,MAAM,WAAW;AAAA,MAC7B;AAAA,IACF,EAAE;AAEF,WAAO,MAAM,UAAU,EAAE,IAAI,+CAA+C,CAAC,EAAE,KAAK,IAAI;AAAA,EAC1F,CAAC;AAED,KAAG,oBAAoB,YAAY;AAEjC,UAAM,mBAAmB,OAAO,SAAiB;AAAA,MAC/C,MAAM,YAAY;AAChB,YAAI,QAAQ,gDAAgD;AAC1D,iBAAO;AAAA,QACT;AACA,cAAM,IAAI,MAAM,WAAW;AAAA,MAC7B;AAAA,IACF,EAAE;AAEF;AAAA,MACE,MAAM,UAAU;AAAA,QACd,OAAO,CAAC,QAAQ,MAAM,IAAI,QAAQ,WAAW,QAAQ,CAAC;AAAA,MACxD,CAAC,EAAE,IAAI,8CAA8C;AAAA,IACvD,EAAE,KAAK,IAAI;AAAA,EACb,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { fetchUrls, fetchUrlsDefaultConfiguration } from './fetch-urls.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch-urls/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch-urls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/fetch-urls/index.ts"],
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["export { fetchUrls, fetchUrlsDefaultConfiguration } from './fetch-urls'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW,qCAAqC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { readFiles } from './read-files.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/read-files/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/read-files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/read-files/index.ts"],
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["export { readFiles } from './read-files'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-files.d.ts","sourceRoot":"","sources":["../../../src/plugins/read-files/read-files.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,eAAO,MAAM,SAAS,EAAE,MAAM,UAqD7B,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import { ERRORS } from "../../configuration/index.js";
|
|
3
3
|
import { dirname, join } from "../../polyfills/path.js";
|
|
4
|
-
import { isJson } from "../../utils/
|
|
5
|
-
import { isYaml } from "../../utils/
|
|
4
|
+
import { isJson } from "../../utils/is-json.js";
|
|
5
|
+
import { isYaml } from "../../utils/is-yaml.js";
|
|
6
6
|
const readFiles = () => {
|
|
7
7
|
return {
|
|
8
8
|
check(value) {
|
|
@@ -49,4 +49,4 @@ const readFiles = () => {
|
|
|
49
49
|
export {
|
|
50
50
|
readFiles
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=
|
|
52
|
+
//# sourceMappingURL=read-files.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/read-files/read-files.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'node:fs'\n\nimport { ERRORS } from '@/configuration'\nimport { dirname, join } from '@/polyfills/path'\nimport { isJson } from '@/utils/is-json'\nimport { isYaml } from '@/utils/is-yaml'\nimport type { LoadPlugin } from '@/utils/load/load'\n\nexport const readFiles: () => LoadPlugin = () => {\n return {\n check(value?: any) {\n // Not a string\n if (typeof value !== 'string') {\n return false\n }\n\n // URL\n if (value.startsWith('http://') || value.startsWith('https://')) {\n return false\n }\n\n // Line breaks\n if (value.includes('\\n')) {\n return false\n }\n\n // JSON\n if (isJson(value)) {\n return false\n }\n\n // YAML (run through YAML.parse)\n if (isYaml(value)) {\n return false\n }\n\n return true\n },\n async get(value?: any) {\n if (!fs.existsSync(value)) {\n throw new Error(ERRORS.FILE_DOES_NOT_EXIST.replace('%s', value))\n }\n\n try {\n return fs.readFileSync(value, 'utf-8')\n } catch (error) {\n console.error('[readFiles]', error)\n return false\n }\n },\n resolvePath(value: any, reference: string) {\n const dir = dirname(value)\n return join(dir, reference)\n },\n getDir(value: any) {\n return dirname(value)\n },\n getFilename(value: any) {\n return value.split('/').pop()\n },\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AAEf,SAAS,cAAc;AACvB,SAAS,SAAS,YAAY;AAC9B,SAAS,cAAc;AACvB,SAAS,cAAc;AAGhB,MAAM,YAA8B,MAAM;AAC/C,SAAO;AAAA,IACL,MAAM,OAAa;AAEjB,UAAI,OAAO,UAAU,UAAU;AAC7B,eAAO;AAAA,MACT;AAGA,UAAI,MAAM,WAAW,SAAS,KAAK,MAAM,WAAW,UAAU,GAAG;AAC/D,eAAO;AAAA,MACT;AAGA,UAAI,MAAM,SAAS,IAAI,GAAG;AACxB,eAAO;AAAA,MACT;AAGA,UAAI,OAAO,KAAK,GAAG;AACjB,eAAO;AAAA,MACT;AAGA,UAAI,OAAO,KAAK,GAAG;AACjB,eAAO;AAAA,MACT;AAEA,aAAO;AAAA,IACT;AAAA,IACA,MAAM,IAAI,OAAa;AACrB,UAAI,CAAC,GAAG,WAAW,KAAK,GAAG;AACzB,cAAM,IAAI,MAAM,OAAO,oBAAoB,QAAQ,MAAM,KAAK,CAAC;AAAA,MACjE;AAEA,UAAI;AACF,eAAO,GAAG,aAAa,OAAO,OAAO;AAAA,MACvC,SAAS,OAAO;AACd,gBAAQ,MAAM,eAAe,KAAK;AAClC,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,YAAY,OAAY,WAAmB;AACzC,YAAM,MAAM,QAAQ,KAAK;AACzB,aAAO,KAAK,KAAK,SAAS;AAAA,IAC5B;AAAA,IACA,OAAO,OAAY;AACjB,aAAO,QAAQ,KAAK;AAAA,IACtB;AAAA,IACA,YAAY,OAAY;AACtB,aAAO,MAAM,MAAM,GAAG,EAAE,IAAI;AAAA,IAC9B;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { readFiles } from "./
|
|
2
|
+
import { readFiles } from "./read-files.js";
|
|
3
3
|
describe("readFiles", async () => {
|
|
4
4
|
it("returns true for a filename", async () => {
|
|
5
5
|
expect(readFiles().check("openapi.yaml")).toBe(true);
|
|
@@ -17,4 +17,4 @@ describe("readFiles", async () => {
|
|
|
17
17
|
expect(readFiles().check("http://example.com/specification/openapi.yaml")).toBe(false);
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=read-files.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/read-files/read-files.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { readFiles } from './read-files'\n\ndescribe('readFiles', async () => {\n it('returns true for a filename', async () => {\n expect(readFiles().check('openapi.yaml')).toBe(true)\n })\n\n it('returns true for a path', async () => {\n expect(readFiles().check('../specification/openapi.yaml')).toBe(true)\n })\n\n it('returns false for an object', async () => {\n expect(readFiles().check({})).toBe(false)\n })\n\n it('returns false for undefinded', async () => {\n expect(readFiles().check()).toBe(false)\n })\n\n it('returns false for an url', async () => {\n expect(readFiles().check('http://example.com/specification/openapi.yaml')).toBe(false)\n })\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,iBAAiB;AAE1B,SAAS,aAAa,YAAY;AAChC,KAAG,+BAA+B,YAAY;AAC5C,WAAO,UAAU,EAAE,MAAM,cAAc,CAAC,EAAE,KAAK,IAAI;AAAA,EACrD,CAAC;AAED,KAAG,2BAA2B,YAAY;AACxC,WAAO,UAAU,EAAE,MAAM,+BAA+B,CAAC,EAAE,KAAK,IAAI;AAAA,EACtE,CAAC;AAED,KAAG,+BAA+B,YAAY;AAC5C,WAAO,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK;AAAA,EAC1C,CAAC;AAED,KAAG,gCAAgC,YAAY;AAC7C,WAAO,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,KAAK;AAAA,EACxC,CAAC;AAED,KAAG,4BAA4B,YAAY;AACzC,WAAO,UAAU,EAAE,MAAM,+CAA+C,CAAC,EAAE,KAAK,KAAK;AAAA,EACvF,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { resolve, normalize, isAbsolute, join, relative, sep, delimiter, dirname, basename, extname, } from './path.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/polyfills/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/polyfills/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,GAAG,EACH,SAAS,EACT,OAAO,EACP,QAAQ,EACR,OAAO,GACR,MAAM,QAAQ,CAAA"}
|
package/dist/polyfills/index.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
resolve,
|
|
3
|
+
normalize,
|
|
4
|
+
isAbsolute,
|
|
5
|
+
join,
|
|
6
|
+
relative,
|
|
7
|
+
sep,
|
|
8
|
+
delimiter,
|
|
9
|
+
dirname,
|
|
10
|
+
basename,
|
|
11
|
+
extname
|
|
12
|
+
} from "./path.js";
|
|
2
13
|
export {
|
|
3
|
-
|
|
14
|
+
basename,
|
|
15
|
+
delimiter,
|
|
16
|
+
dirname,
|
|
17
|
+
extname,
|
|
18
|
+
isAbsolute,
|
|
19
|
+
join,
|
|
20
|
+
normalize,
|
|
21
|
+
relative,
|
|
22
|
+
resolve,
|
|
23
|
+
sep
|
|
4
24
|
};
|
|
5
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/polyfills/index.ts"],
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["export {\n resolve,\n normalize,\n isAbsolute,\n join,\n relative,\n sep,\n delimiter,\n dirname,\n basename,\n extname,\n} from './path'\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAEpD,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/utils/betterAjvErrors/validation-errors/base.js"],
|
|
4
|
-
"sourcesContent": ["// import { codeFrameColumns } from '@babel/code-frame';\n// import chalk from 'chalk';\n// import { getMetaFromPath } from '
|
|
4
|
+
"sourcesContent": ["// import { codeFrameColumns } from '@babel/code-frame';\n// import chalk from 'chalk';\n// import { getMetaFromPath } from '@/json/index'\n\nexport default class BaseValidationError {\n constructor(options = { isIdentifierLocation: false }, { data, schema, jsonAst, jsonRaw }) {\n this.options = options\n this.data = data\n this.schema = schema\n this.jsonAst = jsonAst\n this.jsonRaw = jsonRaw\n }\n\n /**\n * @return {string}\n */\n get instancePath() {\n return typeof this.options.instancePath !== 'undefined' ? this.options.instancePath : this.options.dataPath\n }\n\n getError() {\n throw new Error(`Implement the 'getError' method inside ${this.constructor.name}!`)\n }\n}\n"],
|
|
5
5
|
"mappings": "AAIA,MAAO,oBAAkC;AAAA,EACvC,YAAY,UAAU,EAAE,sBAAsB,MAAM,GAAG,EAAE,MAAM,QAAQ,SAAS,QAAQ,GAAG;AACzF,SAAK,UAAU;AACf,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,UAAU;AACf,SAAK,UAAU;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,eAAe;AACjB,WAAO,OAAO,KAAK,QAAQ,iBAAiB,cAAc,KAAK,QAAQ,eAAe,KAAK,QAAQ;AAAA,EACrG;AAAA,EAEA,WAAW;AACT,UAAM,IAAI,MAAM,0CAA0C,KAAK,YAAY,IAAI,GAAG;AAAA,EACpF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyApiDefinitionFormat, DereferenceResult, Filesystem } from '../types/index.js';
|
|
2
|
-
import { type ResolveReferencesOptions } from './
|
|
2
|
+
import { type ResolveReferencesOptions } from './resolve-references.js';
|
|
3
3
|
export type DereferenceOptions = ResolveReferencesOptions;
|
|
4
4
|
/**
|
|
5
5
|
* Resolves all references in an OpenAPI document
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dereference.d.ts","sourceRoot":"","sources":["../../src/utils/dereference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"dereference.d.ts","sourceRoot":"","sources":["../../src/utils/dereference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAI1F,OAAO,EAAE,KAAK,wBAAwB,EAAqB,MAAM,sBAAsB,CAAA;AAEvF,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,CAAA;AAEzD;;GAEG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,sBAAsB,GAAG,UAAU,EAC1C,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAY5B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { details } from "./details.js";
|
|
2
|
-
import { getEntrypoint } from "./
|
|
3
|
-
import { makeFilesystem } from "./
|
|
4
|
-
import { resolveReferences } from "./
|
|
2
|
+
import { getEntrypoint } from "./get-entrypoint.js";
|
|
3
|
+
import { makeFilesystem } from "./make-filesystem.js";
|
|
4
|
+
import { resolveReferences } from "./resolve-references.js";
|
|
5
5
|
async function dereference(value, options) {
|
|
6
6
|
const filesystem = makeFilesystem(value);
|
|
7
7
|
const entrypoint = getEntrypoint(filesystem);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/dereference.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyApiDefinitionFormat, DereferenceResult, Filesystem } from '
|
|
4
|
+
"sourcesContent": ["import type { AnyApiDefinitionFormat, DereferenceResult, Filesystem } from '@/types/index'\nimport { details } from './details'\nimport { getEntrypoint } from './get-entrypoint'\nimport { makeFilesystem } from './make-filesystem'\nimport { type ResolveReferencesOptions, resolveReferences } from './resolve-references'\n\nexport type DereferenceOptions = ResolveReferencesOptions\n\n/**\n * Resolves all references in an OpenAPI document\n */\nexport async function dereference(\n value: AnyApiDefinitionFormat | Filesystem,\n options?: DereferenceOptions,\n): Promise<DereferenceResult> {\n const filesystem = makeFilesystem(value)\n\n const entrypoint = getEntrypoint(filesystem)\n const result = resolveReferences(filesystem, options)\n\n return {\n specification: entrypoint.specification,\n errors: result.errors,\n schema: result.schema,\n ...details(entrypoint.specification),\n }\n}\n"],
|
|
5
5
|
"mappings": "AACA,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAwC,yBAAyB;AAOjE,eAAsB,YACpB,OACA,SAC4B;AAC5B,QAAM,aAAa,eAAe,KAAK;AAEvC,QAAM,aAAa,cAAc,UAAU;AAC3C,QAAM,SAAS,kBAAkB,YAAY,OAAO;AAEpD,SAAO;AAAA,IACL,eAAe,WAAW;AAAA,IAC1B,QAAQ,OAAO;AAAA,IACf,QAAQ,OAAO;AAAA,IACf,GAAG,QAAQ,WAAW,aAAa;AAAA,EACrC;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"details.d.ts","sourceRoot":"","sources":["../../src/utils/details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"details.d.ts","sourceRoot":"","sources":["../../src/utils/details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD;;GAEG;AACH,wBAAgB,OAAO,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,CA2BnE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/details.ts"],
|
|
4
|
-
"sourcesContent": ["import type { UnknownObject } from '@scalar/types/utils'\n\nimport { OpenApiVersions } from '
|
|
4
|
+
"sourcesContent": ["import type { UnknownObject } from '@scalar/types/utils'\n\nimport { OpenApiVersions } from '@/configuration'\nimport type { DetailsResult } from '@/types/index'\n\n/**\n * Get versions of the OpenAPI document.\n */\nexport function details(specification: UnknownObject): DetailsResult {\n if (specification === null) {\n return {\n version: undefined,\n specificationType: undefined,\n specificationVersion: undefined,\n }\n }\n\n for (const version of new Set(OpenApiVersions)) {\n const specificationType = version === '2.0' ? 'swagger' : 'openapi'\n const value = specification[specificationType]\n\n if (typeof value === 'string' && value.startsWith(version)) {\n return {\n version: version,\n specificationType,\n specificationVersion: value,\n }\n }\n }\n\n return {\n version: undefined,\n specificationType: undefined,\n specificationVersion: undefined,\n }\n}\n"],
|
|
5
5
|
"mappings": "AAEA,SAAS,uBAAuB;AAMzB,SAAS,QAAQ,eAA6C;AACnE,MAAI,kBAAkB,MAAM;AAC1B,WAAO;AAAA,MACL,SAAS;AAAA,MACT,mBAAmB;AAAA,MACnB,sBAAsB;AAAA,IACxB;AAAA,EACF;AAEA,aAAW,WAAW,IAAI,IAAI,eAAe,GAAG;AAC9C,UAAM,oBAAoB,YAAY,QAAQ,YAAY;AAC1D,UAAM,QAAQ,cAAc,iBAAiB;AAE7C,QAAI,OAAO,UAAU,YAAY,MAAM,WAAW,OAAO,GAAG;AAC1D,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA,sBAAsB;AAAA,MACxB;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,sBAAsB;AAAA,EACxB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escape-json-pointer.d.ts","sourceRoot":"","sources":["../../src/utils/escape-json-pointer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,UAE5C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/
|
|
3
|
+
"sources": ["../../src/utils/escape-json-pointer.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Escapes a JSON pointer string.\n *\n * Example: `/foo/bar~baz` -> `/foo~1bar~0baz`\n */\nexport function escapeJsonPointer(str: string) {\n return str.replace(/~/g, '~0').replace(/\\//g, '~1')\n}\n"],
|
|
5
5
|
"mappings": "AAKO,SAAS,kBAAkB,KAAa;AAC7C,SAAO,IAAI,QAAQ,MAAM,IAAI,EAAE,QAAQ,OAAO,IAAI;AACpD;",
|
|
6
6
|
"names": []
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { escapeJsonPointer } from "./
|
|
2
|
+
import { escapeJsonPointer } from "./escape-json-pointer.js";
|
|
3
3
|
describe("escapeJsonPointer", async () => {
|
|
4
4
|
it("should escape a slash", () => {
|
|
5
5
|
expect(escapeJsonPointer("application/json")).toBe("application~1json");
|
|
@@ -8,4 +8,4 @@ describe("escapeJsonPointer", async () => {
|
|
|
8
8
|
expect(escapeJsonPointer("/api/users/{id}/reports")).toBe("~1api~1users~1{id}~1reports");
|
|
9
9
|
});
|
|
10
10
|
});
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=escape-json-pointer.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/escape-json-pointer.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { escapeJsonPointer } from './escape-json-pointer'\n\ndescribe('escapeJsonPointer', async () => {\n it('should escape a slash', () => {\n expect(escapeJsonPointer('application/json')).toBe('application~1json')\n })\n\n it('should escape multiple slashes', () => {\n expect(escapeJsonPointer('/api/users/{id}/reports')).toBe('~1api~1users~1{id}~1reports')\n })\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,yBAAyB;AAElC,SAAS,qBAAqB,YAAY;AACxC,KAAG,yBAAyB,MAAM;AAChC,WAAO,kBAAkB,kBAAkB,CAAC,EAAE,KAAK,mBAAmB;AAAA,EACxE,CAAC;AAED,KAAG,kCAAkC,MAAM;AACzC,WAAO,kBAAkB,yBAAyB,CAAC,EAAE,KAAK,6BAA6B;AAAA,EACzF,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/utils/filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/utils/filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAKpF,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAA;AAE3D;;GAEG;AACH,wBAAgB,MAAM,CAAC,aAAa,EAAE,sBAAsB,EAAE,QAAQ,EAAE,cAAc,GAAG,YAAY,CAQpG"}
|