@scalar/openapi-parser 0.7.1 → 0.8.1
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 +26 -0
- package/LICENSE +1 -1
- package/README.md +193 -24
- package/dist/{configuration.d.ts → configuration/index.d.ts} +9 -7
- package/dist/configuration/index.d.ts.map +1 -0
- package/dist/configuration/index.js +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/Validator/Validator.d.ts +6 -8
- package/dist/lib/Validator/Validator.d.ts.map +1 -0
- package/dist/lib/Validator/Validator.js +1 -0
- package/dist/lib/Validator/index.d.ts +3 -0
- package/dist/lib/Validator/index.d.ts.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/polyfills/index.d.ts +2 -0
- package/dist/polyfills/index.d.ts.map +1 -0
- package/dist/polyfills/path.d.ts +24 -0
- package/dist/polyfills/path.d.ts.map +1 -0
- package/dist/polyfills/path.js +1 -0
- package/dist/schemas/v2.0/schema.json.js +1 -1623
- package/dist/schemas/v3.0/schema.json.js +1 -1673
- package/dist/schemas/v3.1/schema.json.js +1 -1452
- package/dist/types/index.d.ts +24 -18
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/helpers.d.ts +7 -0
- package/dist/utils/betterAjvErrors/helpers.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/helpers.js +1 -0
- package/dist/utils/betterAjvErrors/index.d.ts +17 -0
- package/dist/utils/betterAjvErrors/index.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/index.js +1 -0
- package/dist/utils/betterAjvErrors/utils.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/additional-prop.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/base.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/default.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/enum.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/pattern.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/required.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.js +1 -0
- package/dist/utils/dereference.d.ts +3 -5
- package/dist/utils/dereference.d.ts.map +1 -0
- package/dist/utils/dereference.js +1 -0
- package/dist/utils/details.d.ts +3 -5
- package/dist/utils/details.d.ts.map +1 -0
- package/dist/utils/details.js +1 -0
- package/dist/utils/escapeJsonPointer.d.ts +2 -3
- package/dist/utils/escapeJsonPointer.d.ts.map +1 -0
- package/dist/utils/escapeJsonPointer.js +1 -0
- package/dist/utils/filter.d.ts +3 -5
- package/dist/utils/filter.d.ts.map +1 -0
- package/dist/utils/filter.js +1 -0
- package/dist/utils/getEntrypoint.d.ts +3 -5
- package/dist/utils/getEntrypoint.d.ts.map +1 -0
- package/dist/utils/getEntrypoint.js +1 -0
- package/dist/utils/getListOfReferences.d.ts +3 -5
- package/dist/utils/getListOfReferences.d.ts.map +1 -0
- package/dist/utils/getListOfReferences.js +1 -0
- package/dist/utils/getSegmentsFromPath.d.ts +2 -3
- package/dist/utils/getSegmentsFromPath.d.ts.map +1 -0
- package/dist/utils/getSegmentsFromPath.js +1 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/isFilesystem.d.ts +2 -3
- package/dist/utils/isFilesystem.d.ts.map +1 -0
- package/dist/utils/isFilesystem.js +1 -0
- package/dist/utils/isJson.d.ts +2 -3
- package/dist/utils/isJson.d.ts.map +1 -0
- package/dist/utils/isJson.js +1 -0
- package/dist/utils/isObject.d.ts +2 -3
- package/dist/utils/isObject.d.ts.map +1 -0
- package/dist/utils/isObject.js +1 -0
- package/dist/utils/isYaml.d.ts +2 -3
- package/dist/utils/isYaml.d.ts.map +1 -0
- package/dist/utils/isYaml.js +1 -0
- package/dist/utils/load/index.d.ts +2 -0
- package/dist/utils/load/index.d.ts.map +1 -0
- package/dist/utils/load/load.d.ts +5 -7
- package/dist/utils/load/load.d.ts.map +1 -0
- package/dist/utils/load/load.js +1 -0
- package/dist/{src/utils → utils}/load/plugins/fetchUrls.d.ts +4 -6
- package/dist/utils/load/plugins/fetchUrls.d.ts.map +1 -0
- package/dist/utils/load/plugins/fetchUrls.js +1 -0
- package/dist/utils/load/plugins/readFiles.d.ts +3 -0
- package/dist/utils/load/plugins/readFiles.d.ts.map +1 -0
- package/dist/utils/load/plugins/readFiles.js +1 -0
- package/dist/utils/makeFilesystem.d.ts +3 -0
- package/dist/utils/makeFilesystem.d.ts.map +1 -0
- package/dist/utils/makeFilesystem.js +1 -0
- package/dist/utils/normalize.d.ts +3 -5
- package/dist/utils/normalize.d.ts.map +1 -0
- package/dist/utils/normalize.js +1 -0
- package/dist/utils/openapi.d.ts +183 -0
- package/dist/utils/openapi.d.ts.map +1 -0
- package/dist/utils/openapi.js +1 -0
- package/dist/utils/resolveReferences.d.ts +5 -7
- package/dist/utils/resolveReferences.d.ts.map +1 -0
- package/dist/utils/resolveReferences.js +1 -0
- package/dist/utils/toJson.d.ts +3 -5
- package/dist/utils/toJson.d.ts.map +1 -0
- package/dist/utils/toJson.js +1 -0
- package/dist/utils/toYaml.d.ts +3 -5
- package/dist/utils/toYaml.d.ts.map +1 -0
- package/dist/utils/toYaml.js +1 -0
- package/dist/utils/transformErrors.d.ts +3 -5
- package/dist/utils/transformErrors.d.ts.map +1 -0
- package/dist/utils/transformErrors.js +1 -0
- package/dist/utils/traverse.d.ts +3 -5
- package/dist/utils/traverse.d.ts.map +1 -0
- package/dist/utils/traverse.js +1 -0
- package/dist/utils/unescapeJsonPointer.d.ts +2 -3
- package/dist/utils/unescapeJsonPointer.d.ts.map +1 -0
- package/dist/utils/unescapeJsonPointer.js +1 -0
- package/dist/utils/upgrade.d.ts +4 -5
- package/dist/utils/upgrade.d.ts.map +1 -0
- package/dist/utils/upgrade.js +1 -0
- package/dist/utils/upgrade.test-d.d.ts +2 -0
- package/dist/utils/upgrade.test-d.d.ts.map +1 -0
- package/dist/utils/upgradeFromThreeToThreeOne.d.ts +3 -5
- package/dist/utils/upgradeFromThreeToThreeOne.d.ts.map +1 -0
- package/dist/utils/upgradeFromThreeToThreeOne.js +1 -0
- package/dist/utils/upgradeFromTwoToThree.d.ts +3 -5
- package/dist/utils/upgradeFromTwoToThree.d.ts.map +1 -0
- package/dist/utils/upgradeFromTwoToThree.js +1 -0
- package/dist/utils/validate.d.ts +3 -5
- package/dist/utils/validate.d.ts.map +1 -0
- package/dist/utils/validate.js +1 -0
- package/dist/utils/workThroughQueue.d.ts +11 -0
- package/dist/utils/workThroughQueue.d.ts.map +1 -0
- package/dist/utils/workThroughQueue.js +1 -0
- package/package.json +44 -36
- package/dist/pipeline.d.ts +0 -388
- package/dist/src/configuration.js +0 -22
- package/dist/src/index.d.ts +0 -27
- package/dist/src/index.js +0 -25
- package/dist/src/lib/Validator/Validator.js +0 -94
- package/dist/src/pipeline.js +0 -121
- package/dist/src/polyfills/path.js +0 -80
- package/dist/src/utils/betterAjvErrors/helpers.js +0 -89
- package/dist/src/utils/betterAjvErrors/index.js +0 -15
- package/dist/src/utils/betterAjvErrors/utils.js +0 -17
- package/dist/src/utils/betterAjvErrors/validation-errors/additional-prop.js +0 -18
- package/dist/src/utils/betterAjvErrors/validation-errors/base.js +0 -23
- package/dist/src/utils/betterAjvErrors/validation-errors/default.js +0 -18
- package/dist/src/utils/betterAjvErrors/validation-errors/enum.js +0 -41
- package/dist/src/utils/betterAjvErrors/validation-errors/pattern.js +0 -18
- package/dist/src/utils/betterAjvErrors/validation-errors/required.js +0 -17
- package/dist/src/utils/betterAjvErrors/validation-errors/unevaluated-prop.js +0 -18
- package/dist/src/utils/dereference.js +0 -18
- package/dist/src/utils/details.js +0 -22
- package/dist/src/utils/escapeJsonPointer.js +0 -5
- package/dist/src/utils/filter.js +0 -17
- package/dist/src/utils/getEntrypoint.js +0 -5
- package/dist/src/utils/getListOfReferences.js +0 -17
- package/dist/src/utils/getSegmentsFromPath.js +0 -10
- package/dist/src/utils/isFilesystem.js +0 -5
- package/dist/src/utils/isJson.js +0 -10
- package/dist/src/utils/isObject.js +0 -3
- package/dist/src/utils/isYaml.js +0 -17
- package/dist/src/utils/load/load.js +0 -59
- package/dist/src/utils/load/plugins/fetchUrls.js +0 -38
- package/dist/src/utils/load/plugins/readFiles.d.ts +0 -5
- package/dist/src/utils/load/plugins/readFiles.js +0 -50
- package/dist/src/utils/makeFilesystem.js +0 -22
- package/dist/src/utils/normalize.js +0 -20
- package/dist/src/utils/resolveReferences.js +0 -106
- package/dist/src/utils/toJson.js +0 -3
- package/dist/src/utils/toYaml.js +0 -5
- package/dist/src/utils/transformErrors.js +0 -19
- package/dist/src/utils/traverse.js +0 -20
- package/dist/src/utils/unescapeJsonPointer.js +0 -5
- package/dist/src/utils/upgrade.js +0 -19
- package/dist/src/utils/upgradeFromThreeToThreeOne.js +0 -70
- package/dist/src/utils/upgradeFromTwoToThree.js +0 -5
- package/dist/src/utils/validate.js +0 -15
- package/dist/src/utils/workThroughQueue.js +0 -24
- package/dist/types/openapi-types.d.ts +0 -747
- package/dist/webpack-stats.json +0 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -1,57 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
type AnyObject = Record<string, any>;
|
|
6
|
-
type LoadResult = {
|
|
1
|
+
import type { OpenAPI } from '@scalar/openapi-types';
|
|
2
|
+
import type { ERRORS, OpenApiVersion } from '../configuration/index.js';
|
|
3
|
+
export type AnyObject = Record<string, any>;
|
|
4
|
+
export type LoadResult = {
|
|
7
5
|
filesystem: Filesystem;
|
|
6
|
+
errors?: ErrorObject[];
|
|
8
7
|
};
|
|
9
|
-
type ValidateResult = {
|
|
8
|
+
export type ValidateResult = {
|
|
10
9
|
valid: boolean;
|
|
11
10
|
specification?: OpenAPI.Document;
|
|
12
11
|
version?: string;
|
|
13
12
|
errors?: ErrorObject[];
|
|
14
13
|
schema?: OpenAPI.Document;
|
|
15
14
|
};
|
|
16
|
-
type UpgradeResult = {
|
|
17
|
-
specification:
|
|
15
|
+
export type UpgradeResult<T extends OpenAPI.Document = OpenAPI.Document> = {
|
|
16
|
+
specification: T;
|
|
18
17
|
version: string;
|
|
19
18
|
};
|
|
20
|
-
type FilterResult = {
|
|
19
|
+
export type FilterResult = {
|
|
21
20
|
specification: OpenAPI.Document;
|
|
22
21
|
};
|
|
23
|
-
type DetailsResult = {
|
|
22
|
+
export type DetailsResult = {
|
|
24
23
|
version: OpenApiVersion;
|
|
25
24
|
specificationType: string;
|
|
26
25
|
specificationVersion: string;
|
|
27
26
|
};
|
|
28
|
-
type DereferenceResult = {
|
|
27
|
+
export type DereferenceResult = {
|
|
29
28
|
version: string | undefined;
|
|
30
29
|
specification?: OpenAPI.Document;
|
|
31
30
|
schema?: OpenAPI.Document;
|
|
32
31
|
errors?: ErrorObject[];
|
|
33
32
|
};
|
|
34
|
-
type ErrorObject = {
|
|
33
|
+
export type ErrorObject = {
|
|
35
34
|
message: string;
|
|
36
35
|
code?: keyof typeof ERRORS | string;
|
|
37
36
|
};
|
|
38
|
-
type AjvOptions = {
|
|
37
|
+
export type AjvOptions = {
|
|
39
38
|
strict?: boolean | 'log';
|
|
40
39
|
};
|
|
41
40
|
/**
|
|
42
41
|
* Not literally a filesystem, but a list of files with their content.
|
|
43
42
|
* This is an abstraction layer to handle multiple files in the browser (without access to the hard disk).
|
|
44
43
|
*/
|
|
45
|
-
type Filesystem = FilesystemEntry[];
|
|
44
|
+
export type Filesystem = FilesystemEntry[];
|
|
46
45
|
/**
|
|
47
46
|
* Holds all information about a single file (doesn’t have to be a literal file, see Filesystem).
|
|
48
47
|
*/
|
|
49
|
-
type FilesystemEntry = {
|
|
48
|
+
export type FilesystemEntry = {
|
|
50
49
|
dir: string;
|
|
51
50
|
isEntrypoint: boolean;
|
|
52
51
|
references: string[];
|
|
53
52
|
filename: string;
|
|
54
53
|
specification: AnyObject;
|
|
55
54
|
};
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
export type ThrowOnErrorOption = {
|
|
56
|
+
/**
|
|
57
|
+
* If `true`, the function will throw an error if the document is invalid.
|
|
58
|
+
*
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
throwOnError?: boolean;
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,kBAAkB,CAAA;AAE9D,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE3C,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,OAAO,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI;IACzE,aAAa,EAAE,CAAC,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;IACzB,oBAAoB,EAAE,MAAM,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAA;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAA;IACzB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,OAAO,MAAM,GAAG,MAAM,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;CACzB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,eAAe,EAAE,CAAA;AAE1C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,SAAS,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function makeTree(ajvErrors?: any[]): {
|
|
2
|
+
children: {};
|
|
3
|
+
};
|
|
4
|
+
export declare function filterRedundantErrors(root: any, parent: any, key: any): void;
|
|
5
|
+
export declare function createErrorInstances(root: any, options: any): any;
|
|
6
|
+
export default function prettify(ajvErrors: any, options: any): any;
|
|
7
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/betterAjvErrors/helpers.ts"],"names":[],"mappings":"AAuBA,wBAAgB,QAAQ,CAAC,SAAS,QAAK;;EAsBtC;AAED,wBAAgB,qBAAqB,CAAC,IAAI,KAAA,EAAE,MAAM,KAAA,EAAE,GAAG,KAAA,QA+CtD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,KAAA,EAAE,OAAO,KAAA,OAmCjD;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,SAAS,KAAA,EAAE,OAAO,KAAA,OAKlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getErrors as r,isRequiredError as e,isAnyOfError as t,isEnumError as n,getSiblings as o,notUndefined as a,concatAll as i,getChildren as c}from"./utils.js";import s from"./validation-errors/additional-prop.js";import d from"./validation-errors/default.js";import l from"./validation-errors/enum.js";import u from"./validation-errors/pattern.js";import h from"./validation-errors/required.js";import m from"./validation-errors/unevaluated-prop.js";const p=/\/[\w_-]+(\/\d+)?/g;function f(r=[]){const e={children:{}};return r.forEach((r=>{const t=void 0!==r.instancePath?r.instancePath:r.dataPath,n=""===t?[""]:t.match(p);n&&n.reduce(((e,t,o)=>(e.children[t]=e.children[t]||{children:{},errors:[]},o===n.length-1&&e.children[t].errors.push(r),e.children[t])),e)})),e}function w(i,c,s){r(i).forEach((r=>{e(r)&&(i.errors=[r],i.children={})})),r(i).some(t)&&Object.keys(i.children).length>0&&delete i.errors,i.errors?.length&&r(i).every(n)&&o(c)(i).filter(a).some(r)&&delete c.children[s],Object.entries(i.children).forEach((([r,e])=>w(e,i,r)))}function v(e,t){const o=r(e);if(o.length&&o.every(n)){const r=[...new Set(i([])(o.map((r=>r.params.allowedValues))))],e=o[0];return[new l({...e,params:{allowedValues:r}},t)]}return i(o.reduce(((r,e)=>{switch(e.keyword){case"additionalProperties":return r.concat(new s(e,t));case"pattern":return r.concat(new u(e,t));case"required":return r.concat(new h(e,t));case"unevaluatedProperties":return r.concat(new m(e,t));default:return r.concat(new d(e,t))}}),[]))(c(e).map((r=>v(r,t))))}function j(r,e){const t=f(r||[]);return w(t),v(t,e)}export{v as createErrorInstances,j as default,w as filterRedundantErrors,f as makeTree};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type BetterAjvErrorsOptions = {
|
|
2
|
+
indent?: number;
|
|
3
|
+
json?: string;
|
|
4
|
+
};
|
|
5
|
+
type AjvError = {
|
|
6
|
+
keyword: string;
|
|
7
|
+
dataPath: string;
|
|
8
|
+
schemaPath: string;
|
|
9
|
+
params: any;
|
|
10
|
+
message: string;
|
|
11
|
+
schema: any;
|
|
12
|
+
parentSchema: any;
|
|
13
|
+
data: any;
|
|
14
|
+
};
|
|
15
|
+
export declare function betterAjvErrors(schema: any, data: any, errors: AjvError[], options?: BetterAjvErrorsOptions): any;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/betterAjvErrors/index.ts"],"names":[],"mappings":"AAEA,KAAK,sBAAsB,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAGD,KAAK,QAAQ,GAAG;IACd,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,GAAG,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,GAAG,CAAA;IACX,YAAY,EAAE,GAAG,CAAA;IACjB,IAAI,EAAE,GAAG,CAAA;CACV,CAAA;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,QAAQ,EAAE,EAClB,OAAO,GAAE,sBAA2B,OAcrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"./helpers.js";function r(r,t,o,e={}){const{indent:l=null,json:s=null}=e,a=s||JSON.stringify(t,null,l);return n(o,{data:t,schema:r,jsonRaw:a}).map((n=>n.getError()))}export{r as betterAjvErrors};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=r=>void 0!==r,e=r=>e=>e.keyword===r,n=e("required"),t=e("anyOf"),c=e("enum"),o=r=>r&&r.errors||[],u=r=>{return r&&(e=r.children,Object.values(e))||[];var e},a=r=>e=>{return u(r).filter((t=e,n=r=>t===r,r=>!n(r)));var n,t},d=r=>e=>e.reduce(((r,e)=>r.concat(e)),r);export{d as concatAll,u as getChildren,o as getErrors,a as getSiblings,t as isAnyOfError,c as isEnumError,n as isRequiredError,r as notUndefined};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./base.js";class e extends t{constructor(...t){super(...t),this.name="AdditionalPropValidationError",this.options.isIdentifierLocation=!0}getError(){const{params:t}=this.options;return{message:`Property ${t.additionalProperty} is not expected to be here`,path:this.instancePath}}}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class t{constructor(t={isIdentifierLocation:!1},{data:s,schema:o,jsonAst:i,jsonRaw:n}){this.options=t,this.data=s,this.schema=o,this.jsonAst=i,this.jsonRaw=n}get instancePath(){return void 0!==this.options.instancePath?this.options.instancePath:this.options.dataPath}getError(){throw new Error(`Implement the 'getError' method inside ${this.constructor.name}!`)}}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import s from"./base.js";class t extends s{constructor(...s){super(...s),this.name="DefaultValidationError",this.options.isSkipEndLocation=!0}getError(){const{keyword:s,message:t}=this.options;return{message:`${s} ${t}`,path:this.instancePath}}}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"jsonpointer";import e from"leven";import s from"./base.js";class a extends s{constructor(...t){super(...t),this.name="EnumValidationError"}getError(){const{message:t,params:e}=this.options,s=this.findBestMatch(),a={message:`${t}: ${e.allowedValues.join(", ")}`,path:this.instancePath};return null!==s&&(a.suggestion=`Did you mean ${s}?`),a}findBestMatch(){const{params:{allowedValues:s}}=this.options,a=""===this.instancePath?this.data:t.get(this.data,this.instancePath);if(!a)return null;const i=s.map((t=>({value:t,weight:e(t,a.toString())}))).sort(((t,e)=>t.weight>e.weight?1:t.weight<e.weight?-1:0))[0];return 1===s.length||i.weight<i.value.length?i.value:null}}export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./base.js";class r extends t{constructor(...t){super(...t),this.name="PatternValidationError",this.options.isIdentifierLocation=!0}getError(){const{params:t,propertyName:r}=this.options;return{message:`Property "${r}" must match pattern ${t.pattern}`,path:this.instancePath}}}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import s from"./base.js";class t extends s{constructor(...s){super(...s),this.name="RequiredValidationError"}getError(){const{message:s}=this.options;return{message:`${s}`,path:this.instancePath}}}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"./base.js";class e extends t{constructor(...t){super(...t),this.name="UnevaluatedPropValidationError",this.options.isIdentifierLocation=!0}getError(){const{params:t}=this.options;return{message:`Property ${t.unevaluatedProperty} is not expected to be here`,path:this.instancePath}}}export{e as default};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { AnyObject, Filesystem,
|
|
2
|
-
|
|
1
|
+
import type { AnyObject, DereferenceResult, Filesystem, ThrowOnErrorOption } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Validates an OpenAPI schema and resolves all references.
|
|
5
4
|
*/
|
|
6
|
-
declare function dereference(value: string | AnyObject | Filesystem): Promise<DereferenceResult>;
|
|
7
|
-
|
|
8
|
-
export { dereference };
|
|
5
|
+
export declare function dereference(value: string | AnyObject | Filesystem, options?: ThrowOnErrorOption): Promise<DereferenceResult>;
|
|
6
|
+
//# sourceMappingURL=dereference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dereference.d.ts","sourceRoot":"","sources":["../../src/utils/dereference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAMjB;;GAEG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,EACtC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAY5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{details as e}from"./details.js";import{getEntrypoint as r}from"./getEntrypoint.js";import{makeFilesystem as o}from"./makeFilesystem.js";import{resolveReferences as s}from"./resolveReferences.js";async function i(i,t){const c=o(i),m=r(c),n=s(c,t);return{specification:m.specification,errors:n.errors,schema:n.schema,...e(m.specification)}}export{i as dereference};
|
package/dist/utils/details.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { AnyObject, DetailsResult } from '../types
|
|
2
|
-
|
|
1
|
+
import type { AnyObject, DetailsResult } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Get versions of the OpenAPI specification.
|
|
5
4
|
*/
|
|
6
|
-
declare function details(specification: AnyObject): DetailsResult;
|
|
7
|
-
|
|
8
|
-
export { details };
|
|
5
|
+
export declare function details(specification: AnyObject): DetailsResult;
|
|
6
|
+
//# sourceMappingURL=details.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"details.d.ts","sourceRoot":"","sources":["../../src/utils/details.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExD;;GAEG;AACH,wBAAgB,OAAO,CAAC,aAAa,EAAE,SAAS,GAAG,aAAa,CAmB/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{OpenApiVersions as i}from"../configuration/index.js";function o(o){for(const n of new Set(i)){const i="2.0"===n?"swagger":"openapi",e=o[i];if("string"==typeof e&&e.startsWith(n))return{version:n,specificationType:i,specificationVersion:e}}return{version:void 0,specificationType:void 0,specificationVersion:void 0}}export{o as details};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escapeJsonPointer.d.ts","sourceRoot":"","sources":["../../src/utils/escapeJsonPointer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,UAE5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}export{e as escapeJsonPointer};
|
package/dist/utils/filter.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { AnyObject, FilterResult } from '../types
|
|
2
|
-
|
|
1
|
+
import type { AnyObject, FilterResult } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Filter the specification based on the callback
|
|
5
4
|
*/
|
|
6
|
-
declare function filter(specification: AnyObject, callback: (schema: AnyObject) => boolean): FilterResult;
|
|
7
|
-
|
|
8
|
-
export { filter };
|
|
5
|
+
export declare function filter(specification: AnyObject, callback: (schema: AnyObject) => boolean): FilterResult;
|
|
6
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/utils/filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAKvD;;GAEG;AACH,wBAAgB,MAAM,CACpB,aAAa,EAAE,SAAS,EACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,GACvC,YAAY,CAWd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getEntrypoint as t}from"./getEntrypoint.js";import{makeFilesystem as i}from"./makeFilesystem.js";import{traverse as o}from"./traverse.js";function r(r,e){const s=i(r);return{specification:o(t(s).specification,(t=>e(t)?t:void 0))}}export{r as filter};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { Filesystem
|
|
2
|
-
|
|
1
|
+
import type { Filesystem } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Return just the entrypoint of the filesystem.
|
|
5
4
|
*/
|
|
6
|
-
declare function getEntrypoint(filesystem: Filesystem): FilesystemEntry;
|
|
7
|
-
|
|
8
|
-
export { getEntrypoint };
|
|
5
|
+
export declare function getEntrypoint(filesystem: Filesystem): import("../types").FilesystemEntry;
|
|
6
|
+
//# sourceMappingURL=getEntrypoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntrypoint.d.ts","sourceRoot":"","sources":["../../src/utils/getEntrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,UAAU,sCAEnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n){return n.find((n=>n.isEntrypoint))}export{n as getEntrypoint};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { AnyObject } from '../types
|
|
2
|
-
|
|
1
|
+
import type { AnyObject } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Walks through the specification and returns all references as an array.
|
|
5
4
|
*
|
|
6
5
|
* Warning: Doesn’t return internal references.
|
|
7
6
|
*/
|
|
8
|
-
declare function getListOfReferences(specification: AnyObject): string[];
|
|
9
|
-
|
|
10
|
-
export { getListOfReferences };
|
|
7
|
+
export declare function getListOfReferences(specification: AnyObject): string[];
|
|
8
|
+
//# sourceMappingURL=getListOfReferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getListOfReferences.d.ts","sourceRoot":"","sources":["../../src/utils/getListOfReferences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGzC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,SAAS,YAuB3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{traverse as t}from"./traverse.js";function e(e){const r=[];return e&&"object"==typeof e?(t(e,(t=>(t.$ref&&"string"==typeof t.$ref&&!t.$ref.startsWith("#")&&r.push(t.$ref.split("#")[0]),t))),[...new Set(r)]):r}export{e as getListOfReferences};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Translate `/paths/~1test` to `['paths', '/test']`
|
|
3
3
|
*/
|
|
4
|
-
declare function getSegmentsFromPath(path: string): string[];
|
|
5
|
-
|
|
6
|
-
export { getSegmentsFromPath };
|
|
4
|
+
export declare function getSegmentsFromPath(path: string): string[];
|
|
5
|
+
//# sourceMappingURL=getSegmentsFromPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSegmentsFromPath.d.ts","sourceRoot":"","sources":["../../src/utils/getSegmentsFromPath.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,YAW/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{unescapeJsonPointer as e}from"./unescapeJsonPointer.js";function n(n){return n.split("/").slice(1).map(e)}export{n as getSegmentsFromPath};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from './dereference.js';
|
|
2
|
+
export * from './details.js';
|
|
3
|
+
export * from './escapeJsonPointer.js';
|
|
4
|
+
export * from './filter.js';
|
|
5
|
+
export * from './getEntrypoint.js';
|
|
6
|
+
export * from './getListOfReferences.js';
|
|
7
|
+
export * from './getSegmentsFromPath.js';
|
|
8
|
+
export * from './isFilesystem.js';
|
|
9
|
+
export * from './isJson.js';
|
|
10
|
+
export * from './isObject.js';
|
|
11
|
+
export * from './isYaml.js';
|
|
12
|
+
export * from './load';
|
|
13
|
+
export * from './load/load.js';
|
|
14
|
+
export * from './normalize.js';
|
|
15
|
+
export * from './openapi.js';
|
|
16
|
+
export * from './resolveReferences.js';
|
|
17
|
+
export * from './toJson.js';
|
|
18
|
+
export * from './toYaml.js';
|
|
19
|
+
export * from './transformErrors.js';
|
|
20
|
+
export * from './traverse.js';
|
|
21
|
+
export * from './unescapeJsonPointer.js';
|
|
22
|
+
export * from './upgrade.js';
|
|
23
|
+
export * from './upgradeFromThreeToThreeOne.js';
|
|
24
|
+
export * from './upgradeFromTwoToThree.js';
|
|
25
|
+
export * from './validate.js';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,8BAA8B,CAAA;AAC5C,cAAc,yBAAyB,CAAA;AACvC,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isFilesystem.d.ts","sourceRoot":"","sources":["../../src/utils/isFilesystem.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,WAOtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r){return void 0!==r&&Array.isArray(r)&&r.length>0&&r.some((r=>!0===r.isEntrypoint))}export{r as isFilesystem};
|
package/dist/utils/isJson.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
declare function isJson(value: string): boolean;
|
|
2
|
-
|
|
3
|
-
export { isJson };
|
|
1
|
+
export declare function isJson(value: string): boolean;
|
|
2
|
+
//# sourceMappingURL=isJson.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isJson.d.ts","sourceRoot":"","sources":["../../src/utils/isJson.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,WAQnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r){try{return JSON.parse(r),!0}catch{return!1}}export{r as isJson};
|
package/dist/utils/isObject.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isObject.d.ts","sourceRoot":"","sources":["../../src/utils/isObject.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,QAAQ,QAAS,GAAG,YAC+B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=r=>"object"==typeof r&&!Array.isArray(r)&&null!==r;export{r as isObject};
|
package/dist/utils/isYaml.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
declare function isYaml(value: string): boolean;
|
|
2
|
-
|
|
3
|
-
export { isYaml };
|
|
1
|
+
export declare function isYaml(value: string): boolean;
|
|
2
|
+
//# sourceMappingURL=isYaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isYaml.d.ts","sourceRoot":"","sources":["../../src/utils/isYaml.ts"],"names":[],"mappings":"AAEA,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,WAenC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as r}from"yaml";function t(t){if(!t.includes("\n"))return!1;try{return r(t,{maxAliasCount:1e4}),!0}catch(r){return!1}}export{t as isYaml};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/load/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { Filesystem, LoadResult } from '../../types
|
|
2
|
-
|
|
3
|
-
type LoadPlugin = {
|
|
1
|
+
import type { Filesystem, LoadResult, ThrowOnErrorOption } from '../../types';
|
|
2
|
+
export type LoadPlugin = {
|
|
4
3
|
check: (value?: any) => boolean;
|
|
5
4
|
get: (value: any) => any;
|
|
6
5
|
resolvePath?: (value: any, reference: string) => string;
|
|
7
6
|
getDir?: (value: any) => string;
|
|
8
7
|
getFilename?: (value: any) => string;
|
|
9
8
|
};
|
|
10
|
-
declare function load(value: any, options?: {
|
|
9
|
+
export declare function load(value: any, options?: {
|
|
11
10
|
plugins?: LoadPlugin[];
|
|
12
11
|
filename?: string;
|
|
13
12
|
filesystem?: Filesystem;
|
|
14
|
-
}): Promise<LoadResult>;
|
|
15
|
-
|
|
16
|
-
export { type LoadPlugin, load };
|
|
13
|
+
} & ThrowOnErrorOption): Promise<LoadResult>;
|
|
14
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/utils/load/load.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,UAAU,EACV,UAAU,EACV,kBAAkB,EACnB,MAAM,aAAa,CAAA;AAMpB,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,OAAO,CAAA;IAC/B,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;IACxB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAA;IACvD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAA;IAC/B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAA;CACrC,CAAA;AAED,wBAAsB,IAAI,CACxB,KAAK,EAAE,GAAG,EACV,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB,GAAG,kBAAkB,GACrB,OAAO,CAAC,UAAU,CAAC,CA6HrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ERRORS as e}from"../../configuration/index.js";import{getEntrypoint as r}from"../getEntrypoint.js";import{getListOfReferences as s}from"../getListOfReferences.js";import{makeFilesystem as t}from"../makeFilesystem.js";import{normalize as n}from"../normalize.js";async function i(o,f){const m=[];if(f?.filesystem?.find((e=>e.filename===o)))return{filesystem:f.filesystem,errors:m};const l=f?.plugins?.find((e=>e.check(o)));let c;if(l)try{c=n(await l.get(o))}catch(r){if(f?.throwOnError)throw new Error(e.EXTERNAL_REFERENCE_NOT_FOUND.replace("%s",o));return m.push({code:"EXTERNAL_REFERENCE_NOT_FOUND",message:e.EXTERNAL_REFERENCE_NOT_FOUND.replace("%s",o)}),{filesystem:[],errors:m}}else c=n(o);if(void 0===c){if(f?.throwOnError)throw new Error("No content to load");return m.push({code:"NO_CONTENT",message:e.NO_CONTENT}),{filesystem:[],errors:m}}let E=t(c,{filename:f?.filename??null});const a=(f?.filename?E.find((e=>e.filename===f?.filename)):r(E)).references??s(c);if(0===a.length)return{filesystem:E,errors:m};for(const e of a){const r=f?.plugins?.find((r=>r.check(e)));if(!r)continue;const s=r.check(e)&&r.resolvePath?r.resolvePath(o,e):e;if(E.find((r=>r.filename===e)))continue;const{filesystem:t,errors:n}=await i(s,{...f,filename:e});m.push(...n),E=[...E,...t.map((e=>({...e,isEntrypoint:!1})))]}return{filesystem:E,errors:m}}export{i as load};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { LoadPlugin } from '
|
|
2
|
-
|
|
3
|
-
declare const fetchUrlsDefaultConfiguration: {
|
|
1
|
+
import type { LoadPlugin } from '../load.js';
|
|
2
|
+
export declare const fetchUrlsDefaultConfiguration: {
|
|
4
3
|
limit: number;
|
|
5
4
|
};
|
|
6
|
-
declare const fetchUrls: (customConfiguration?: {
|
|
5
|
+
export declare const fetchUrls: (customConfiguration?: {
|
|
7
6
|
/**
|
|
8
7
|
* Limit the number of requests. Set to `false` to disable the limit.
|
|
9
8
|
*/
|
|
@@ -13,5 +12,4 @@ declare const fetchUrls: (customConfiguration?: {
|
|
|
13
12
|
*/
|
|
14
13
|
fetch?: (url: string) => Promise<Response>;
|
|
15
14
|
}) => LoadPlugin;
|
|
16
|
-
|
|
17
|
-
export { fetchUrls, fetchUrlsDefaultConfiguration };
|
|
15
|
+
//# sourceMappingURL=fetchUrls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchUrls.d.ts","sourceRoot":"","sources":["../../../../src/utils/load/plugins/fetchUrls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,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,UAiDL,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={limit:20},e=e=>{let s=0;const r={...t,...e};return{check:t=>"string"==typeof t&&!(!t.startsWith("http://")&&!t.startsWith("https://")),async get(t){if(!1!==r?.limit&&s>=r?.limit)console.warn(`[fetchUrls] Maximum number of requests reeached (${r?.limit}), skipping request`);else try{s++;const e=await(r?.fetch?r.fetch(t):fetch(t));return await e.text()}catch(e){console.error("[fetchUrls]",e.message,`(${t})`)}}}};export{e as fetchUrls,t as fetchUrlsDefaultConfiguration};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readFiles.d.ts","sourceRoot":"","sources":["../../../../src/utils/load/plugins/readFiles.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,eAAO,MAAM,SAAS,EAAE,MAAM,UAoD7B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"node:fs";import{ERRORS as r}from"../../../configuration/index.js";import{dirname as o,join as s}from"../../../polyfills/path.js";import{isJson as e}from"../../isJson.js";import{isYaml as i}from"../../isYaml.js";const n=()=>({check:t=>"string"==typeof t&&(!t.startsWith("http://")&&!t.startsWith("https://")&&(!t.includes("\n")&&(!e(t)&&!i(t)))),async get(o){if(!t.existsSync(o))throw new Error(r.FILE_DOES_NOT_EXIST.replace("%s",o));try{return t.readFileSync(o,"utf-8")}catch(t){console.error("[readFiles]",t)}},resolvePath(t,r){const e=o(t);return s(e,r)},getDir:t=>o(t),getFilename:t=>t.split("/").pop()});export{n as readFiles};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeFilesystem.d.ts","sourceRoot":"","sources":["../../src/utils/makeFilesystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAKtE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,EACtC,UAAU,GAAE,OAAO,CAAC,eAAe,CAAM,GACxC,UAAU,CAoBZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getListOfReferences as e}from"./getListOfReferences.js";import{isFilesystem as r}from"./isFilesystem.js";import{normalize as i}from"./normalize.js";function t(t,n={}){if(r(t))return t;const o=i(t);return[{isEntrypoint:!0,specification:o,filename:null,dir:"./",references:e(o),...n}]}export{t as makeFilesystem};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { AnyObject, Filesystem } from '../types
|
|
2
|
-
|
|
1
|
+
import type { AnyObject, Filesystem } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Normalize the OpenAPI specification to a JavaScript object.
|
|
5
4
|
* Don’t touch the object if it’s a `Filesystem` (multiple files).
|
|
6
5
|
*/
|
|
7
|
-
declare function normalize(specification: string | AnyObject | Filesystem): AnyObject | Filesystem;
|
|
8
|
-
|
|
9
|
-
export { normalize };
|
|
6
|
+
export declare function normalize(specification: string | AnyObject | Filesystem): AnyObject | Filesystem;
|
|
7
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/utils/normalize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAGrD;;;GAGG;AACH,wBAAgB,SAAS,CACvB,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAC7C,SAAS,GAAG,UAAU,CAgBxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as r}from"yaml";import{isFilesystem as t}from"./isFilesystem.js";function e(e){if(t(e))return e;if("string"==typeof e)try{return JSON.parse(e)}catch(t){return r(e,{maxAliasCount:1e4})}return e}export{e as normalize};
|