@fumadocs/api-docs 0.0.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/LICENSE +21 -0
- package/css/generated/shared.css +1 -0
- package/css/preset.css +1 -0
- package/dist/.translations/index.d.ts +28 -0
- package/dist/.translations/keys.js +28 -0
- package/dist/_virtual/_rolldown/runtime.js +4 -0
- package/dist/auto-anchor/client.d.ts +16 -0
- package/dist/auto-anchor/client.js +20 -0
- package/dist/auto-anchor/index.d.ts +9 -0
- package/dist/auto-anchor/index.js +17 -0
- package/dist/codegen.d.ts +38 -0
- package/dist/codegen.js +35 -0
- package/dist/components/accordion.d.ts +22 -0
- package/dist/components/accordion.js +67 -0
- package/dist/components/dialog.d.ts +39 -0
- package/dist/components/dialog.js +61 -0
- package/dist/components/input.d.ts +8 -0
- package/dist/components/input.js +17 -0
- package/dist/components/playground/inputs.d.ts +50 -0
- package/dist/components/playground/inputs.js +426 -0
- package/dist/components/playground/schema.d.ts +66 -0
- package/dist/components/playground/schema.js +144 -0
- package/dist/components/schema/client.d.ts +17 -0
- package/dist/components/schema/client.js +415 -0
- package/dist/components/schema/index.d.ts +102 -0
- package/dist/components/schema/index.js +276 -0
- package/dist/components/select-tab.d.ts +33 -0
- package/dist/components/select-tab.js +56 -0
- package/dist/components/select.d.ts +16 -0
- package/dist/components/select.js +72 -0
- package/dist/components/spinner.d.ts +7 -0
- package/dist/components/spinner.js +14 -0
- package/dist/i18n.d.ts +7 -0
- package/dist/i18n.js +7 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js +239 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js +187 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.d.ts +157 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js +136 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js +41 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.d.ts +166 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js +124 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js +109 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js +30 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/json.js +46 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js +36 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/yaml.js +49 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.d.ts +96 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js +242 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.d.ts +190 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js +247 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.d.ts +134 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js +210 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolve-external.js +100 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js +41 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js +112 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/types/index.d.ts +133 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js +8 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.d.ts +34 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.js +146 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js +5 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/maybe.js +18 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/next.js +11 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/plugins.js +99 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/schema-resources.js +30 -0
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js +315 -0
- package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +108 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +110 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +138 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +674 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +141 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +102 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +223 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +28 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +18 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +133 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +61 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +146 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +23 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +48 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +172 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +31 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +433 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +113 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +72 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +583 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +18 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +42 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +50 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +20 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +51 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +16 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +36 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +19 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +85 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +59 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +12 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +25 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +12 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +16 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +57 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +96 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +29 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +16 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +89 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +87 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +16 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +62 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +60 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +59 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +34 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +31 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +51 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +61 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +17 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +52 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +41 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +17 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +130 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +14 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +22 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +112 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +101 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +14 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +35 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +46 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +45 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +22 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +20 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +15 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +10 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +23 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +19 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +13 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +46 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +59 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +27 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +17 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +49 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +48 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +18 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +28 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +33 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +47 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +28 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +27 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +38 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +72 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +70 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +33 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +236 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +187 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +282 -0
- package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +78 -0
- package/dist/schema/bundle.d.ts +2 -0
- package/dist/schema/bundle.js +2 -0
- package/dist/schema/dereference.d.ts +19 -0
- package/dist/schema/dereference.js +49 -0
- package/dist/schema/index.d.ts +21 -0
- package/dist/schema/index.js +0 -0
- package/dist/schema/merge.d.ts +12 -0
- package/dist/schema/merge.js +156 -0
- package/dist/schema/ref.d.ts +20 -0
- package/dist/schema/ref.js +43 -0
- package/dist/schema/resolve-ref.d.ts +4 -0
- package/dist/schema/resolve-ref.js +11 -0
- package/dist/schema/sample.d.ts +12 -0
- package/dist/schema/sample.js +442 -0
- package/dist/schema/to-string.d.ts +10 -0
- package/dist/schema/to-string.js +51 -0
- package/dist/utils/cn.js +2 -0
- package/dist/utils/deep-equal.js +21 -0
- package/dist/utils/id-to-title.d.ts +4 -0
- package/dist/utils/id-to-title.js +12 -0
- package/dist/utils/is-plain-object.js +8 -0
- package/dist/utils/merge-refs.js +11 -0
- package/dist/utils/url.d.ts +5 -0
- package/dist/utils/url.js +13 -0
- package/package.json +105 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isFileSystemPath, toFileSystemPath } from "../util/url.js";
|
|
2
|
+
import { ResolverError } from "../util/errors.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js
|
|
4
|
+
var file_default = {
|
|
5
|
+
/**
|
|
6
|
+
* The order that this resolver will run, in relation to other resolvers.
|
|
7
|
+
*/
|
|
8
|
+
order: 100,
|
|
9
|
+
/**
|
|
10
|
+
* Determines whether this resolver can read a given file reference.
|
|
11
|
+
* Resolvers that return true will be tried, in order, until one successfully resolves the file.
|
|
12
|
+
* Resolvers that return false will not be given a chance to resolve the file.
|
|
13
|
+
*/
|
|
14
|
+
canRead(file) {
|
|
15
|
+
return isFileSystemPath(file.url);
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Reads the given file and returns its raw contents as a Buffer.
|
|
19
|
+
*/
|
|
20
|
+
async read(file) {
|
|
21
|
+
let path;
|
|
22
|
+
const fs = await import("fs");
|
|
23
|
+
try {
|
|
24
|
+
path = toFileSystemPath(file.url);
|
|
25
|
+
} catch (err) {
|
|
26
|
+
const e = err;
|
|
27
|
+
e.message = `Malformed URI: ${file.url}: ${e.message}`;
|
|
28
|
+
throw new ResolverError(e, file.url);
|
|
29
|
+
}
|
|
30
|
+
if (path.endsWith("/") || path.endsWith("\\")) path = path.slice(0, -1);
|
|
31
|
+
try {
|
|
32
|
+
return await fs.promises.readFile(path);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
const e = err;
|
|
35
|
+
e.message = `Error opening file ${path}: ${e.message}`;
|
|
36
|
+
throw new ResolverError(e, path);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { file_default as default };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { isHttp, isUnsafeUrl, parse, resolve } from "../util/url.js";
|
|
2
|
+
import { ResolverError } from "../util/errors.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js
|
|
4
|
+
var http_default = {
|
|
5
|
+
/**
|
|
6
|
+
* The order that this resolver will run, in relation to other resolvers.
|
|
7
|
+
*/
|
|
8
|
+
order: 200,
|
|
9
|
+
/**
|
|
10
|
+
* HTTP headers to send when downloading files.
|
|
11
|
+
*
|
|
12
|
+
* @example:
|
|
13
|
+
* {
|
|
14
|
+
* "User-Agent": "JSON Schema $Ref Parser",
|
|
15
|
+
* Accept: "application/json"
|
|
16
|
+
* }
|
|
17
|
+
*/
|
|
18
|
+
headers: null,
|
|
19
|
+
/**
|
|
20
|
+
* HTTP request timeout (in milliseconds).
|
|
21
|
+
*/
|
|
22
|
+
timeout: 6e4,
|
|
23
|
+
/**
|
|
24
|
+
* The maximum number of HTTP redirects to follow.
|
|
25
|
+
* To disable automatic following of redirects, set this to zero.
|
|
26
|
+
*/
|
|
27
|
+
redirects: 5,
|
|
28
|
+
/**
|
|
29
|
+
* The `withCredentials` option of XMLHttpRequest.
|
|
30
|
+
* Set this to `true` if you're downloading files from a CORS-enabled server that requires authentication
|
|
31
|
+
*/
|
|
32
|
+
withCredentials: false,
|
|
33
|
+
/**
|
|
34
|
+
* Set this to `false` if you want to allow unsafe URLs (e.g., `127.0.0.1`, localhost, and other internal URLs).
|
|
35
|
+
*/
|
|
36
|
+
safeUrlResolver: true,
|
|
37
|
+
/**
|
|
38
|
+
* Determines whether this resolver can read a given file reference.
|
|
39
|
+
* Resolvers that return true will be tried in order, until one successfully resolves the file.
|
|
40
|
+
* Resolvers that return false will not be given a chance to resolve the file.
|
|
41
|
+
*/
|
|
42
|
+
canRead(file) {
|
|
43
|
+
return isHttp(file.url) && (!this.safeUrlResolver || !isUnsafeUrl(file.url));
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Reads the given URL and returns its raw contents as a Buffer.
|
|
47
|
+
*/
|
|
48
|
+
read(file) {
|
|
49
|
+
const u = parse(file.url);
|
|
50
|
+
if (typeof window !== "undefined" && !u.protocol) u.protocol = parse(location.href).protocol;
|
|
51
|
+
return download(u, this);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Downloads the given file.
|
|
56
|
+
* @returns
|
|
57
|
+
* The promise resolves with the raw downloaded data, or rejects if there is an HTTP error.
|
|
58
|
+
*/
|
|
59
|
+
async function download(u, httpOptions, _redirects) {
|
|
60
|
+
u = parse(u);
|
|
61
|
+
const redirects = _redirects || [];
|
|
62
|
+
redirects.push(u.href);
|
|
63
|
+
try {
|
|
64
|
+
const res = await get(u, httpOptions);
|
|
65
|
+
if (res.status >= 400) {
|
|
66
|
+
const error = /* @__PURE__ */ new Error(`HTTP ERROR ${res.status}`);
|
|
67
|
+
error.status = res.status;
|
|
68
|
+
throw error;
|
|
69
|
+
} else if (res.status >= 300) if (!Number.isNaN(httpOptions.redirects) && redirects.length > httpOptions.redirects) {
|
|
70
|
+
const error = /* @__PURE__ */ new Error(`Error downloading ${redirects[0]}. \nToo many redirects: \n ${redirects.join(" \n ")}`);
|
|
71
|
+
error.status = res.status;
|
|
72
|
+
throw new ResolverError(error);
|
|
73
|
+
} else if (!("location" in res.headers) || !res.headers.location) {
|
|
74
|
+
const error = /* @__PURE__ */ new Error(`HTTP ${res.status} redirect with no location header`);
|
|
75
|
+
error.status = res.status;
|
|
76
|
+
throw error;
|
|
77
|
+
} else return download(resolve(u.href, res.headers.location), httpOptions, redirects);
|
|
78
|
+
else {
|
|
79
|
+
if (res.body) {
|
|
80
|
+
const buf = await res.arrayBuffer();
|
|
81
|
+
return Buffer.from(buf);
|
|
82
|
+
}
|
|
83
|
+
return Buffer.alloc(0);
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
const e = err;
|
|
87
|
+
e.message = `Error downloading ${u.href}: ${e.message}`;
|
|
88
|
+
throw new ResolverError(e, u.href);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Sends an HTTP GET request.
|
|
93
|
+
* The promise resolves with the HTTP Response object.
|
|
94
|
+
*/
|
|
95
|
+
async function get(u, httpOptions) {
|
|
96
|
+
let controller;
|
|
97
|
+
let timeoutId;
|
|
98
|
+
if (httpOptions.timeout && typeof AbortController !== "undefined") {
|
|
99
|
+
controller = new AbortController();
|
|
100
|
+
timeoutId = setTimeout(() => controller.abort(), httpOptions.timeout);
|
|
101
|
+
}
|
|
102
|
+
const response = await fetch(u, {
|
|
103
|
+
method: "GET",
|
|
104
|
+
headers: httpOptions.headers || {},
|
|
105
|
+
credentials: httpOptions.withCredentials ? "include" : "same-origin",
|
|
106
|
+
signal: controller ? controller.signal : null
|
|
107
|
+
});
|
|
108
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
109
|
+
return response;
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
export { http_default as default };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ParserOptions } from "../options.js";
|
|
2
|
+
import { $Refs } from "../refs.js";
|
|
3
|
+
import { JSONSchema4, JSONSchema4Object, JSONSchema6, JSONSchema6Object, JSONSchema7, JSONSchema7Object } from "json-schema";
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/types/index.d.ts
|
|
6
|
+
type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
|
|
7
|
+
type JSONSchemaObject = JSONSchema4Object | JSONSchema6Object | JSONSchema7Object;
|
|
8
|
+
type SchemaCallback<S extends object = JSONSchema> = (err: Error | null, schema?: S | object | null) => any;
|
|
9
|
+
type $RefsCallback<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> = (err: Error | null, $refs?: $Refs<S, O>) => any;
|
|
10
|
+
/**
|
|
11
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/options.html
|
|
12
|
+
*/
|
|
13
|
+
interface HTTPResolverOptions<S extends object = JSONSchema> extends Partial<ResolverOptions<S>> {
|
|
14
|
+
/**
|
|
15
|
+
* You can specify any HTTP headers that should be sent when downloading files. For example, some servers may require you to set the `Accept` or `Referrer` header.
|
|
16
|
+
*/
|
|
17
|
+
headers?: RequestInit["headers"] | null;
|
|
18
|
+
/**
|
|
19
|
+
* The amount of time (in milliseconds) to wait for a response from the server when downloading files. The default is 5 seconds.
|
|
20
|
+
*/
|
|
21
|
+
timeout?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The maximum number of HTTP redirects to follow per file. The default is 5. To disable automatic following of redirects, set this to zero.
|
|
24
|
+
*/
|
|
25
|
+
redirects?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Set this to `true` if you're downloading files from a CORS-enabled server that requires authentication
|
|
28
|
+
*/
|
|
29
|
+
withCredentials?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Set this to `false` if you want to allow unsafe URLs (e.g., `127.0.0.1`, localhost, and other internal URLs).
|
|
32
|
+
*/
|
|
33
|
+
safeUrlResolver?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* JSON Schema `$Ref` Parser comes with built-in resolvers for HTTP and HTTPS URLs, as well as local filesystem paths (when running in Node.js). You can add your own custom resolvers to support additional protocols, or even replace any of the built-in resolvers with your own custom implementation.
|
|
37
|
+
*
|
|
38
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/plugins/resolvers.html
|
|
39
|
+
*/
|
|
40
|
+
interface ResolverOptions<S extends object = JSONSchema> {
|
|
41
|
+
name?: string;
|
|
42
|
+
/**
|
|
43
|
+
* All resolvers have an order property, even the built-in resolvers. If you don't specify an order property, then your resolver will run last. Specifying `order: 1`, like we did in this example, will make your resolver run first. Or you can squeeze your resolver in-between some of the built-in resolvers. For example, `order: 101` would make it run after the file resolver, but before the HTTP resolver. You can see the order of all the built-in resolvers by looking at their source code.
|
|
44
|
+
*
|
|
45
|
+
* The order property and canRead property are related to each other. For each file that JSON Schema $Ref Parser needs to resolve, it first determines which resolvers can read that file by checking their canRead property. If only one resolver matches a file, then only that one resolver is called, regardless of its order. If multiple resolvers match a file, then those resolvers are tried in order until one of them successfully reads the file. Once a resolver successfully reads the file, the rest of the resolvers are skipped.
|
|
46
|
+
*/
|
|
47
|
+
order?: number;
|
|
48
|
+
/**
|
|
49
|
+
* The `canRead` property tells JSON Schema `$Ref` Parser what kind of files your resolver can read. In this example, we've simply specified a regular expression that matches "mogodb://" URLs, but we could have used a simple boolean, or even a function with custom logic to determine which files to resolve. Here are examples of each approach:
|
|
50
|
+
*/
|
|
51
|
+
canRead: boolean | RegExp | string | string[] | ((file: FileInfo) => boolean);
|
|
52
|
+
/**
|
|
53
|
+
* This is where the real work of a resolver happens. The `read` method accepts the same file info object as the `canRead` function, but rather than returning a boolean value, the `read` method should return the contents of the file. The file contents should be returned in as raw a form as possible, such as a string or a byte array. Any further parsing or processing should be done by parsers.
|
|
54
|
+
*
|
|
55
|
+
* Unlike the `canRead` function, the `read` method can also be asynchronous. This might be important if your resolver needs to read data from a database or some other external source. You can return your asynchronous value using either an ES6 Promise or a Node.js-style error-first callback. Of course, if your resolver has the ability to return its data synchronously, then that's fine too. Here are examples of all three approaches:
|
|
56
|
+
*/
|
|
57
|
+
read: string | object | ((file: FileInfo, callback?: (error: Error | null, data: string | null) => any) => string | Buffer | S | Promise<string | Buffer | S>);
|
|
58
|
+
}
|
|
59
|
+
interface Plugin {
|
|
60
|
+
name?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Parsers run in a specific order, relative to other parsers. For example, a parser with `order: 5` will run before a parser with `order: 10`. If a parser is unable to successfully parse a file, then the next parser is tried, until one succeeds or they all fail.
|
|
63
|
+
*
|
|
64
|
+
* You can change the order in which parsers run, which is useful if you know that most of your referenced files will be a certain type, or if you add your own custom parser that you want to run first.
|
|
65
|
+
*/
|
|
66
|
+
order?: number;
|
|
67
|
+
/**
|
|
68
|
+
* All of the built-in parsers allow empty files by default. The JSON and YAML parsers will parse empty files as `undefined`. The text parser will parse empty files as an empty string. The binary parser will parse empty files as an empty byte array.
|
|
69
|
+
*
|
|
70
|
+
* You can set `allowEmpty: false` on any parser, which will cause an error to be thrown if a file empty.
|
|
71
|
+
*/
|
|
72
|
+
allowEmpty?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Specifies whether a Byte Order Mark (BOM) is allowed or not. Only applies to JSON parsing
|
|
75
|
+
*
|
|
76
|
+
* @type {boolean} @default true
|
|
77
|
+
*/
|
|
78
|
+
allowBOM?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The encoding that the text is expected to be in.
|
|
81
|
+
*/
|
|
82
|
+
encoding?: BufferEncoding;
|
|
83
|
+
/**
|
|
84
|
+
* Determines which parsers will be used for which files.
|
|
85
|
+
*
|
|
86
|
+
* A regular expression can be used to match files by their full path. A string (or array of strings) can be used to match files by their file extension. Or a function can be used to perform more complex matching logic. See the custom parser docs for details.
|
|
87
|
+
*/
|
|
88
|
+
canParse?: boolean | RegExp | string | string[] | ((file: FileInfo) => boolean);
|
|
89
|
+
/**
|
|
90
|
+
* This is where the real work of a parser happens. The `parse` method accepts the same file info object as the `canParse` function, but rather than returning a boolean value, the `parse` method should return a JavaScript representation of the file contents. For our CSV parser, that is a two-dimensional array of lines and values. For your parser, it might be an object, a string, a custom class, or anything else.
|
|
91
|
+
*
|
|
92
|
+
* Unlike the `canParse` function, the `parse` method can also be asynchronous. This might be important if your parser needs to retrieve data from a database or if it relies on an external HTTP service to return the parsed value. You can return your asynchronous value via a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) or a Node.js-style error-first callback. Here are examples of both approaches:
|
|
93
|
+
*/
|
|
94
|
+
parse: ((file: FileInfo, callback?: (error: Error | null, data: string | null) => any) => unknown | Promise<unknown>) | number | string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* JSON Schema `$Ref` Parser supports plug-ins, such as resolvers and parsers. These plug-ins can have methods such as `canRead()`, `read()`, `canParse()`, and `parse()`. All of these methods accept the same object as their parameter: an object containing information about the file being read or parsed.
|
|
98
|
+
*
|
|
99
|
+
* The file info object currently only consists of a few properties, but it may grow in the future if plug-ins end up needing more information.
|
|
100
|
+
*
|
|
101
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/plugins/file-info-object.html
|
|
102
|
+
*/
|
|
103
|
+
interface FileInfo {
|
|
104
|
+
/**
|
|
105
|
+
* The full URL of the file. This could be any type of URL, including "http://", "https://", "file://", "ftp://", "mongodb://", or even a local filesystem path (when running in Node.js).
|
|
106
|
+
*/
|
|
107
|
+
url: string;
|
|
108
|
+
/**
|
|
109
|
+
* The unresolved `$ref` value exactly as it appeared in the parent schema, without the hash.
|
|
110
|
+
* This is useful for custom resolvers that need to preserve relative reference semantics instead
|
|
111
|
+
* of relying on the already-resolved `url`.
|
|
112
|
+
*/
|
|
113
|
+
reference?: string;
|
|
114
|
+
/**
|
|
115
|
+
* The URL that `reference` was resolved against to produce `url`.
|
|
116
|
+
* This may include a JSON Pointer fragment when the reference originated from a nested location.
|
|
117
|
+
*/
|
|
118
|
+
baseUrl?: string;
|
|
119
|
+
/**
|
|
120
|
+
* The hash (URL fragment) of the file URL, including the # symbol. If the URL doesn't have a hash, then this will be an empty string.
|
|
121
|
+
*/
|
|
122
|
+
hash: string;
|
|
123
|
+
/**
|
|
124
|
+
* The lowercase file extension, such as ".json", ".yaml", ".txt", etc.
|
|
125
|
+
*/
|
|
126
|
+
extension: string;
|
|
127
|
+
/**
|
|
128
|
+
* The raw file contents, in whatever form they were returned by the resolver that read the file.
|
|
129
|
+
*/
|
|
130
|
+
data: string | Buffer;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
export { $RefsCallback, FileInfo, HTTPResolverOptions, JSONSchema, JSONSchemaObject, Plugin, ResolverOptions, SchemaCallback };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js
|
|
2
|
+
const win32Sep = "\\";
|
|
3
|
+
function convertPathToPosix(filePath) {
|
|
4
|
+
if (filePath.startsWith("\\\\?\\")) return filePath;
|
|
5
|
+
return filePath.split(win32Sep).join("/");
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { convertPathToPosix as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.d.ts
|
|
2
|
+
type JSONParserErrorType = "EUNKNOWN" | "EPARSER" | "EUNMATCHEDPARSER" | "ETIMEOUT" | "ERESOLVER" | "EUNMATCHEDRESOLVER" | "EMISSINGPOINTER" | "EINVALIDPOINTER";
|
|
3
|
+
declare class JSONParserError extends Error {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
source: string | undefined;
|
|
7
|
+
path: Array<string | number> | null;
|
|
8
|
+
readonly code: JSONParserErrorType;
|
|
9
|
+
constructor(message: string, source?: string);
|
|
10
|
+
toJSON: () => Error;
|
|
11
|
+
get footprint(): string;
|
|
12
|
+
}
|
|
13
|
+
declare class ParserError extends JSONParserError {
|
|
14
|
+
code: JSONParserErrorType;
|
|
15
|
+
name: string;
|
|
16
|
+
constructor(message: any, source: any);
|
|
17
|
+
}
|
|
18
|
+
declare class ResolverError extends JSONParserError {
|
|
19
|
+
code: JSONParserErrorType;
|
|
20
|
+
name: string;
|
|
21
|
+
ioErrorCode?: string;
|
|
22
|
+
constructor(ex: Error | any, source?: string);
|
|
23
|
+
}
|
|
24
|
+
declare class MissingPointerError extends JSONParserError {
|
|
25
|
+
code: JSONParserErrorType;
|
|
26
|
+
name: string;
|
|
27
|
+
targetToken: any;
|
|
28
|
+
targetRef: string;
|
|
29
|
+
targetFound: string;
|
|
30
|
+
parentPath: string;
|
|
31
|
+
constructor(token: any, path: any, targetRef: any, targetFound: any, parentPath: any);
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { JSONParserError, MissingPointerError, ParserError, ResolverError };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { getHash, stripHash, toFileSystemPath } from "./url.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.js
|
|
3
|
+
const nonJsonTypes = [
|
|
4
|
+
"function",
|
|
5
|
+
"symbol",
|
|
6
|
+
"undefined"
|
|
7
|
+
];
|
|
8
|
+
const protectedProps = [
|
|
9
|
+
"constructor",
|
|
10
|
+
"prototype",
|
|
11
|
+
"__proto__"
|
|
12
|
+
];
|
|
13
|
+
const objectPrototype = Object.getPrototypeOf({});
|
|
14
|
+
/**
|
|
15
|
+
* Custom JSON serializer for Error objects.
|
|
16
|
+
* Returns all built-in error properties, as well as extended properties.
|
|
17
|
+
*/
|
|
18
|
+
function toJSON() {
|
|
19
|
+
const pojo = {};
|
|
20
|
+
const error = this;
|
|
21
|
+
for (const key of getDeepKeys(error)) if (typeof key === "string") {
|
|
22
|
+
const value = error[key];
|
|
23
|
+
const type = typeof value;
|
|
24
|
+
if (!nonJsonTypes.includes(type)) pojo[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return pojo;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns own, inherited, enumerable, non-enumerable, string, and symbol keys of `obj`.
|
|
30
|
+
* Does NOT return members of the base Object prototype, or the specified omitted keys.
|
|
31
|
+
*/
|
|
32
|
+
function getDeepKeys(obj, omit = []) {
|
|
33
|
+
let keys = [];
|
|
34
|
+
while (obj && obj !== objectPrototype) {
|
|
35
|
+
keys = keys.concat(Object.getOwnPropertyNames(obj), Object.getOwnPropertySymbols(obj));
|
|
36
|
+
obj = Object.getPrototypeOf(obj);
|
|
37
|
+
}
|
|
38
|
+
const uniqueKeys = new Set(keys);
|
|
39
|
+
for (const key of omit.concat(protectedProps)) uniqueKeys.delete(key);
|
|
40
|
+
return uniqueKeys;
|
|
41
|
+
}
|
|
42
|
+
var JSONParserError = class extends Error {
|
|
43
|
+
name;
|
|
44
|
+
message;
|
|
45
|
+
source;
|
|
46
|
+
path;
|
|
47
|
+
code;
|
|
48
|
+
constructor(message, source) {
|
|
49
|
+
super();
|
|
50
|
+
this.code = "EUNKNOWN";
|
|
51
|
+
this.name = "JSONParserError";
|
|
52
|
+
this.message = message;
|
|
53
|
+
this.source = source;
|
|
54
|
+
this.path = null;
|
|
55
|
+
}
|
|
56
|
+
toJSON = toJSON.bind(this);
|
|
57
|
+
get footprint() {
|
|
58
|
+
return `${this.path}+${this.source}+${this.code}+${this.message}`;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var JSONParserErrorGroup = class JSONParserErrorGroup extends Error {
|
|
62
|
+
files;
|
|
63
|
+
constructor(parser) {
|
|
64
|
+
super();
|
|
65
|
+
this.files = parser;
|
|
66
|
+
this.name = "JSONParserErrorGroup";
|
|
67
|
+
this.message = `${this.errors.length} error${this.errors.length > 1 ? "s" : ""} occurred while reading '${toFileSystemPath(parser.$refs._root$Ref.path)}'`;
|
|
68
|
+
}
|
|
69
|
+
toJSON = toJSON.bind(this);
|
|
70
|
+
static getParserErrors(parser) {
|
|
71
|
+
const errors = [];
|
|
72
|
+
for (const $ref of Object.values(parser.$refs._$refs)) if ($ref.errors) errors.push(...$ref.errors);
|
|
73
|
+
return errors;
|
|
74
|
+
}
|
|
75
|
+
get errors() {
|
|
76
|
+
return JSONParserErrorGroup.getParserErrors(this.files);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var ParserError = class extends JSONParserError {
|
|
80
|
+
code = "EPARSER";
|
|
81
|
+
name = "ParserError";
|
|
82
|
+
constructor(message, source) {
|
|
83
|
+
super(`Error parsing ${source}: ${message}`, source);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var UnmatchedParserError = class extends JSONParserError {
|
|
87
|
+
code = "EUNMATCHEDPARSER";
|
|
88
|
+
name = "UnmatchedParserError";
|
|
89
|
+
constructor(source) {
|
|
90
|
+
super(`Could not find parser for "${source}"`, source);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var ResolverError = class extends JSONParserError {
|
|
94
|
+
code = "ERESOLVER";
|
|
95
|
+
name = "ResolverError";
|
|
96
|
+
ioErrorCode;
|
|
97
|
+
constructor(ex, source) {
|
|
98
|
+
super(ex.message || `Error reading file "${source}"`, source);
|
|
99
|
+
if ("code" in ex) this.ioErrorCode = String(ex.code);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var UnmatchedResolverError = class extends JSONParserError {
|
|
103
|
+
code = "EUNMATCHEDRESOLVER";
|
|
104
|
+
name = "UnmatchedResolverError";
|
|
105
|
+
constructor(source) {
|
|
106
|
+
super(`Could not find resolver for "${source}"`, source);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var MissingPointerError = class extends JSONParserError {
|
|
110
|
+
code = "EMISSINGPOINTER";
|
|
111
|
+
name = "MissingPointerError";
|
|
112
|
+
targetToken;
|
|
113
|
+
targetRef;
|
|
114
|
+
targetFound;
|
|
115
|
+
parentPath;
|
|
116
|
+
constructor(token, path, targetRef, targetFound, parentPath) {
|
|
117
|
+
super(`Missing $ref pointer "${getHash(path)}". Token "${token}" does not exist.`, stripHash(path));
|
|
118
|
+
this.targetToken = token;
|
|
119
|
+
this.targetRef = targetRef;
|
|
120
|
+
this.targetFound = targetFound;
|
|
121
|
+
this.parentPath = parentPath;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var TimeoutError = class extends JSONParserError {
|
|
125
|
+
code = "ETIMEOUT";
|
|
126
|
+
name = "TimeoutError";
|
|
127
|
+
constructor(timeout) {
|
|
128
|
+
super(`Dereferencing timeout reached: ${timeout}ms`);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var InvalidPointerError = class extends JSONParserError {
|
|
132
|
+
code = "EUNMATCHEDRESOLVER";
|
|
133
|
+
name = "InvalidPointerError";
|
|
134
|
+
constructor(pointer, path) {
|
|
135
|
+
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, stripHash(path));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
function isHandledError(err) {
|
|
139
|
+
return err instanceof JSONParserError || err instanceof JSONParserErrorGroup;
|
|
140
|
+
}
|
|
141
|
+
function normalizeError(err) {
|
|
142
|
+
if (err.path === null) err.path = [];
|
|
143
|
+
return err;
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
export { InvalidPointerError, JSONParserError, JSONParserErrorGroup, MissingPointerError, ParserError, ResolverError, TimeoutError, UnmatchedParserError, UnmatchedResolverError, isHandledError, normalizeError };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js
|
|
2
|
+
const isWindowsConst = /^win/.test(globalThis.process ? globalThis.process.platform : "");
|
|
3
|
+
const isWindows = () => isWindowsConst;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { isWindows };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import next_default from "./next.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/maybe.js
|
|
3
|
+
function maybe(cb, promise) {
|
|
4
|
+
if (cb) {
|
|
5
|
+
promise.then(function(result) {
|
|
6
|
+
next_default(function() {
|
|
7
|
+
cb(null, result);
|
|
8
|
+
});
|
|
9
|
+
}, function(err) {
|
|
10
|
+
next_default(function() {
|
|
11
|
+
cb(err);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
return;
|
|
15
|
+
} else return promise;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { maybe as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/next.js
|
|
2
|
+
function makeNext() {
|
|
3
|
+
if (typeof process === "object" && typeof process.nextTick === "function") return process.nextTick;
|
|
4
|
+
else if (typeof setImmediate === "function") return setImmediate;
|
|
5
|
+
else return function next(f) {
|
|
6
|
+
setTimeout(f, 0);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
var next_default = makeNext();
|
|
10
|
+
//#endregion
|
|
11
|
+
export { next_default as default };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/plugins.js
|
|
2
|
+
/**
|
|
3
|
+
* Returns the given plugins as an array, rather than an object map.
|
|
4
|
+
* All other methods in this module expect an array of plugins rather than an object map.
|
|
5
|
+
*
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
function all(plugins) {
|
|
9
|
+
return Object.keys(plugins || {}).filter((key) => {
|
|
10
|
+
return typeof plugins[key] === "object";
|
|
11
|
+
}).map((key) => {
|
|
12
|
+
plugins[key].name = key;
|
|
13
|
+
return plugins[key];
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Filters the given plugins, returning only the ones return `true` for the given method.
|
|
18
|
+
*/
|
|
19
|
+
function filter(plugins, method, file, callback, $refs) {
|
|
20
|
+
return plugins.filter((plugin) => {
|
|
21
|
+
return !!getResult(plugin, method, file, callback, $refs);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Sorts the given plugins, in place, by their `order` property.
|
|
26
|
+
*/
|
|
27
|
+
function sort(plugins) {
|
|
28
|
+
for (const plugin of plugins) plugin.order = plugin.order || Number.MAX_SAFE_INTEGER;
|
|
29
|
+
return plugins.sort((a, b) => {
|
|
30
|
+
return a.order - b.order;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Runs the specified method of the given plugins, in order, until one of them returns a successful result.
|
|
35
|
+
* Each method can return a synchronous value, a Promise, or call an error-first callback.
|
|
36
|
+
* If the promise resolves successfully, or the callback is called without an error, then the result
|
|
37
|
+
* is immediately returned and no further plugins are called.
|
|
38
|
+
* If the promise rejects, or the callback is called with an error, then the next plugin is called.
|
|
39
|
+
* If ALL plugins fail, then the last error is thrown.
|
|
40
|
+
*/
|
|
41
|
+
async function run(plugins, method, file, $refs) {
|
|
42
|
+
let plugin;
|
|
43
|
+
let lastError;
|
|
44
|
+
let index = 0;
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
runNextPlugin();
|
|
47
|
+
function runNextPlugin() {
|
|
48
|
+
plugin = plugins[index++];
|
|
49
|
+
if (!plugin) return reject(lastError);
|
|
50
|
+
try {
|
|
51
|
+
const result = getResult(plugin, method, file, callback, $refs);
|
|
52
|
+
if (result && typeof result.then === "function") result.then(onSuccess, onError);
|
|
53
|
+
else if (result !== void 0) onSuccess(result);
|
|
54
|
+
else if (index === plugins.length) throw new Error("No promise has been returned or callback has been called.");
|
|
55
|
+
} catch (e) {
|
|
56
|
+
onError(e);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function callback(err, result) {
|
|
60
|
+
if (err) onError(err);
|
|
61
|
+
else onSuccess(result);
|
|
62
|
+
}
|
|
63
|
+
function onSuccess(result) {
|
|
64
|
+
resolve({
|
|
65
|
+
plugin,
|
|
66
|
+
result
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function onError(error) {
|
|
70
|
+
lastError = {
|
|
71
|
+
plugin,
|
|
72
|
+
error
|
|
73
|
+
};
|
|
74
|
+
runNextPlugin();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the value of the given property.
|
|
80
|
+
* If the property is a function, then the result of the function is returned.
|
|
81
|
+
* If the value is a RegExp, then it will be tested against the file URL.
|
|
82
|
+
* If the value is an array, then it will be compared against the file extension.
|
|
83
|
+
*/
|
|
84
|
+
function getResult(obj, prop, file, callback, $refs) {
|
|
85
|
+
const value = obj[prop];
|
|
86
|
+
if (typeof value === "function") return value.apply(obj, [
|
|
87
|
+
file,
|
|
88
|
+
callback,
|
|
89
|
+
$refs
|
|
90
|
+
]);
|
|
91
|
+
if (!callback) {
|
|
92
|
+
if (value instanceof RegExp) return value.test(file.url);
|
|
93
|
+
else if (typeof value === "string") return value === file.extension;
|
|
94
|
+
else if (Array.isArray(value)) return value.indexOf(file.extension) !== -1;
|
|
95
|
+
}
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { all, filter, run, sort };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { resolve } from "./url.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/schema-resources.js
|
|
3
|
+
function getSchemaBasePath(basePath, value) {
|
|
4
|
+
const schemaId = getSchemaId(value);
|
|
5
|
+
return schemaId ? resolve(basePath, schemaId) : basePath;
|
|
6
|
+
}
|
|
7
|
+
function usesDynamicIdScope(value) {
|
|
8
|
+
if (!value || typeof value !== "object" || ArrayBuffer.isView(value)) return false;
|
|
9
|
+
const schema = value.$schema;
|
|
10
|
+
if (typeof schema === "string" && (schema.includes("draft/2019-09/") || schema.includes("draft/2020-12/") || schema.includes("oas/3.1/"))) return true;
|
|
11
|
+
const openapi = value.openapi;
|
|
12
|
+
return typeof openapi === "string" && /^3\.1(?:\.|$)/.test(openapi);
|
|
13
|
+
}
|
|
14
|
+
function registerSchemaResources($refs, basePath, value, pathType, dynamicIdScope = false) {
|
|
15
|
+
if (!dynamicIdScope) return;
|
|
16
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17
|
+
const visit = (node, scopeBase) => {
|
|
18
|
+
if (!node || typeof node !== "object" || ArrayBuffer.isView(node) || seen.has(node)) return;
|
|
19
|
+
seen.add(node);
|
|
20
|
+
const nextScopeBase = getSchemaBasePath(scopeBase, node);
|
|
21
|
+
if (nextScopeBase !== scopeBase) $refs._addAlias(nextScopeBase, node, pathType, dynamicIdScope);
|
|
22
|
+
for (const key of Object.keys(node)) visit(node[key], nextScopeBase);
|
|
23
|
+
};
|
|
24
|
+
visit(value, basePath);
|
|
25
|
+
}
|
|
26
|
+
function getSchemaId(value) {
|
|
27
|
+
if (value && typeof value === "object" && "$id" in value && typeof value.$id === "string" && value.$id.length > 0) return value.$id;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { getSchemaBasePath, registerSchemaResources, usesDynamicIdScope };
|