fumadocs-openapi 10.8.4 → 10.8.6
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/css/generated/shared.css +22 -1
- package/dist/generate-file.d.ts +1 -1
- package/dist/generate-file.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/node_modules/.pnpm/{@scalar_helpers@0.6.0 → @scalar_helpers@0.8.0}/node_modules/@scalar/helpers/dist/general/create-limiter.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_helpers@0.6.0 → @scalar_helpers@0.8.0}/node_modules/@scalar/helpers/dist/object/is-object.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_helpers@0.6.0 → @scalar_helpers@0.8.0}/node_modules/@scalar/helpers/dist/object/prevent-pollution.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_helpers@0.6.0 → @scalar_helpers@0.8.0}/node_modules/@scalar/helpers/dist/queue/queue.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_helpers@0.6.0 → @scalar_helpers@0.8.0}/node_modules/@scalar/helpers/dist/string/generate-hash.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/bundle/bundle.js +2 -2
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js +2 -2
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/bundle/value-generator.js +2 -2
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/convert-to-local-ref.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/escape-json-pointer.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/get-schemas.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/get-segments-from-path.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/get-value-by-path.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/is-file-path.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/is-http-url.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/is-json-object.js +2 -2
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/is-yaml.js +1 -1
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/normalize.js +33 -0
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/resolve-reference-path.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/set-value-at-path.js +2 -2
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/to-relative-path.js +1 -1
- package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/unescape-json-pointer.js +1 -1
- 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/playground/client.js +1 -1
- package/dist/playground/schema.d.ts +0 -2
- package/dist/playground/schema.js +3 -2
- package/dist/server/index.d.ts +108 -3
- package/dist/server/index.js +181 -2
- package/dist/server/proxy.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/ui/base.d.ts +1 -1
- package/dist/ui/components/method-label.js +1 -4
- package/dist/ui/index.d.ts +1 -1
- package/dist/utils/document/process.js +4 -4
- package/dist/utils/pages/builder.d.ts +4 -3
- package/dist/utils/pages/builder.js +20 -1
- package/dist/utils/pages/to-text.d.ts +1 -1
- package/dist/utils/pages/to-text.js +23 -42
- package/package.json +12 -8
- package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.12/node_modules/@scalar/json-magic/dist/helpers/normalize.js +0 -26
- package/dist/server/create.d.ts +0 -40
- package/dist/server/create.js +0 -42
- package/dist/server/source-api.d.ts +0 -55
- package/dist/server/source-api.js +0 -149
- /package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js +0 -0
- /package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/bundle/plugins/parse-yaml/index.js +0 -0
|
@@ -0,0 +1,583 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_codegen } from "./compile/codegen/index.js";
|
|
3
|
+
import { require_util } from "./compile/util.js";
|
|
4
|
+
import { require_rules } from "./compile/rules.js";
|
|
5
|
+
import { require_dataType } from "./compile/validate/dataType.js";
|
|
6
|
+
import { require_resolve } from "./compile/resolve.js";
|
|
7
|
+
import { require_validate } from "./compile/validate/index.js";
|
|
8
|
+
import { require_validation_error } from "./runtime/validation_error.js";
|
|
9
|
+
import { require_ref_error } from "./compile/ref_error.js";
|
|
10
|
+
import { require_compile } from "./compile/index.js";
|
|
11
|
+
import { require_data } from "./refs/data.js";
|
|
12
|
+
import { require_uri } from "./runtime/uri.js";
|
|
13
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js
|
|
14
|
+
var require_core = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
|
17
|
+
var validate_1 = require_validate();
|
|
18
|
+
Object.defineProperty(exports, "KeywordCxt", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function() {
|
|
21
|
+
return validate_1.KeywordCxt;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var codegen_1 = require_codegen();
|
|
25
|
+
Object.defineProperty(exports, "_", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function() {
|
|
28
|
+
return codegen_1._;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "str", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function() {
|
|
34
|
+
return codegen_1.str;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "stringify", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function() {
|
|
40
|
+
return codegen_1.stringify;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "nil", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function() {
|
|
46
|
+
return codegen_1.nil;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "Name", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function() {
|
|
52
|
+
return codegen_1.Name;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "CodeGen", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function() {
|
|
58
|
+
return codegen_1.CodeGen;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const validation_error_1 = require_validation_error();
|
|
62
|
+
const ref_error_1 = require_ref_error();
|
|
63
|
+
const rules_1 = require_rules();
|
|
64
|
+
const compile_1 = require_compile();
|
|
65
|
+
const codegen_2 = require_codegen();
|
|
66
|
+
const resolve_1 = require_resolve();
|
|
67
|
+
const dataType_1 = require_dataType();
|
|
68
|
+
const util_1 = require_util();
|
|
69
|
+
const $dataRefSchema = require_data();
|
|
70
|
+
const uri_1 = require_uri();
|
|
71
|
+
const defaultRegExp = (str, flags) => new RegExp(str, flags);
|
|
72
|
+
defaultRegExp.code = "new RegExp";
|
|
73
|
+
const META_IGNORE_OPTIONS = [
|
|
74
|
+
"removeAdditional",
|
|
75
|
+
"useDefaults",
|
|
76
|
+
"coerceTypes"
|
|
77
|
+
];
|
|
78
|
+
const EXT_SCOPE_NAMES = new Set([
|
|
79
|
+
"validate",
|
|
80
|
+
"serialize",
|
|
81
|
+
"parse",
|
|
82
|
+
"wrapper",
|
|
83
|
+
"root",
|
|
84
|
+
"schema",
|
|
85
|
+
"keyword",
|
|
86
|
+
"pattern",
|
|
87
|
+
"formats",
|
|
88
|
+
"validate$data",
|
|
89
|
+
"func",
|
|
90
|
+
"obj",
|
|
91
|
+
"Error"
|
|
92
|
+
]);
|
|
93
|
+
const removedOptions = {
|
|
94
|
+
errorDataPath: "",
|
|
95
|
+
format: "`validateFormats: false` can be used instead.",
|
|
96
|
+
nullable: "\"nullable\" keyword is supported by default.",
|
|
97
|
+
jsonPointers: "Deprecated jsPropertySyntax can be used instead.",
|
|
98
|
+
extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.",
|
|
99
|
+
missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.",
|
|
100
|
+
processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`",
|
|
101
|
+
sourceCode: "Use option `code: {source: true}`",
|
|
102
|
+
strictDefaults: "It is default now, see option `strict`.",
|
|
103
|
+
strictKeywords: "It is default now, see option `strict`.",
|
|
104
|
+
uniqueItems: "\"uniqueItems\" keyword is always validated.",
|
|
105
|
+
unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
|
|
106
|
+
cache: "Map is used as cache, schema object as key.",
|
|
107
|
+
serialize: "Map is used as cache, schema object as key.",
|
|
108
|
+
ajvErrors: "It is default now."
|
|
109
|
+
};
|
|
110
|
+
const deprecatedOptions = {
|
|
111
|
+
ignoreKeywordsWithRef: "",
|
|
112
|
+
jsPropertySyntax: "",
|
|
113
|
+
unicode: "\"minLength\"/\"maxLength\" account for unicode characters by default."
|
|
114
|
+
};
|
|
115
|
+
const MAX_EXPRESSION = 200;
|
|
116
|
+
function requiredOptions(o) {
|
|
117
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
118
|
+
const s = o.strict;
|
|
119
|
+
const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
|
|
120
|
+
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
121
|
+
const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
|
|
122
|
+
const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
|
|
123
|
+
return {
|
|
124
|
+
strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true,
|
|
125
|
+
strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,
|
|
126
|
+
strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log",
|
|
127
|
+
strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log",
|
|
128
|
+
strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false,
|
|
129
|
+
code: o.code ? {
|
|
130
|
+
...o.code,
|
|
131
|
+
optimize,
|
|
132
|
+
regExp
|
|
133
|
+
} : {
|
|
134
|
+
optimize,
|
|
135
|
+
regExp
|
|
136
|
+
},
|
|
137
|
+
loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,
|
|
138
|
+
loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
|
|
139
|
+
meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,
|
|
140
|
+
messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,
|
|
141
|
+
inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,
|
|
142
|
+
schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id",
|
|
143
|
+
addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true,
|
|
144
|
+
validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true,
|
|
145
|
+
validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true,
|
|
146
|
+
unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true,
|
|
147
|
+
int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true,
|
|
148
|
+
uriResolver
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
var Ajv = class {
|
|
152
|
+
constructor(opts = {}) {
|
|
153
|
+
this.schemas = {};
|
|
154
|
+
this.refs = {};
|
|
155
|
+
this.formats = Object.create(null);
|
|
156
|
+
this._compilations = /* @__PURE__ */ new Set();
|
|
157
|
+
this._loading = {};
|
|
158
|
+
this._cache = /* @__PURE__ */ new Map();
|
|
159
|
+
opts = this.opts = {
|
|
160
|
+
...opts,
|
|
161
|
+
...requiredOptions(opts)
|
|
162
|
+
};
|
|
163
|
+
const { es5, lines } = this.opts.code;
|
|
164
|
+
this.scope = new codegen_2.ValueScope({
|
|
165
|
+
scope: {},
|
|
166
|
+
prefixes: EXT_SCOPE_NAMES,
|
|
167
|
+
es5,
|
|
168
|
+
lines
|
|
169
|
+
});
|
|
170
|
+
this.logger = getLogger(opts.logger);
|
|
171
|
+
const formatOpt = opts.validateFormats;
|
|
172
|
+
opts.validateFormats = false;
|
|
173
|
+
this.RULES = (0, rules_1.getRules)();
|
|
174
|
+
checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED");
|
|
175
|
+
checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn");
|
|
176
|
+
this._metaOpts = getMetaSchemaOptions.call(this);
|
|
177
|
+
if (opts.formats) addInitialFormats.call(this);
|
|
178
|
+
this._addVocabularies();
|
|
179
|
+
this._addDefaultMetaSchema();
|
|
180
|
+
if (opts.keywords) addInitialKeywords.call(this, opts.keywords);
|
|
181
|
+
if (typeof opts.meta == "object") this.addMetaSchema(opts.meta);
|
|
182
|
+
addInitialSchemas.call(this);
|
|
183
|
+
opts.validateFormats = formatOpt;
|
|
184
|
+
}
|
|
185
|
+
_addVocabularies() {
|
|
186
|
+
this.addKeyword("$async");
|
|
187
|
+
}
|
|
188
|
+
_addDefaultMetaSchema() {
|
|
189
|
+
const { $data, meta, schemaId } = this.opts;
|
|
190
|
+
let _dataRefSchema = $dataRefSchema;
|
|
191
|
+
if (schemaId === "id") {
|
|
192
|
+
_dataRefSchema = { ...$dataRefSchema };
|
|
193
|
+
_dataRefSchema.id = _dataRefSchema.$id;
|
|
194
|
+
delete _dataRefSchema.$id;
|
|
195
|
+
}
|
|
196
|
+
if (meta && $data) this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
|
|
197
|
+
}
|
|
198
|
+
defaultMeta() {
|
|
199
|
+
const { meta, schemaId } = this.opts;
|
|
200
|
+
return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : void 0;
|
|
201
|
+
}
|
|
202
|
+
validate(schemaKeyRef, data) {
|
|
203
|
+
let v;
|
|
204
|
+
if (typeof schemaKeyRef == "string") {
|
|
205
|
+
v = this.getSchema(schemaKeyRef);
|
|
206
|
+
if (!v) throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
|
|
207
|
+
} else v = this.compile(schemaKeyRef);
|
|
208
|
+
const valid = v(data);
|
|
209
|
+
if (!("$async" in v)) this.errors = v.errors;
|
|
210
|
+
return valid;
|
|
211
|
+
}
|
|
212
|
+
compile(schema, _meta) {
|
|
213
|
+
const sch = this._addSchema(schema, _meta);
|
|
214
|
+
return sch.validate || this._compileSchemaEnv(sch);
|
|
215
|
+
}
|
|
216
|
+
compileAsync(schema, meta) {
|
|
217
|
+
if (typeof this.opts.loadSchema != "function") throw new Error("options.loadSchema should be a function");
|
|
218
|
+
const { loadSchema } = this.opts;
|
|
219
|
+
return runCompileAsync.call(this, schema, meta);
|
|
220
|
+
async function runCompileAsync(_schema, _meta) {
|
|
221
|
+
await loadMetaSchema.call(this, _schema.$schema);
|
|
222
|
+
const sch = this._addSchema(_schema, _meta);
|
|
223
|
+
return sch.validate || _compileAsync.call(this, sch);
|
|
224
|
+
}
|
|
225
|
+
async function loadMetaSchema($ref) {
|
|
226
|
+
if ($ref && !this.getSchema($ref)) await runCompileAsync.call(this, { $ref }, true);
|
|
227
|
+
}
|
|
228
|
+
async function _compileAsync(sch) {
|
|
229
|
+
try {
|
|
230
|
+
return this._compileSchemaEnv(sch);
|
|
231
|
+
} catch (e) {
|
|
232
|
+
if (!(e instanceof ref_error_1.default)) throw e;
|
|
233
|
+
checkLoaded.call(this, e);
|
|
234
|
+
await loadMissingSchema.call(this, e.missingSchema);
|
|
235
|
+
return _compileAsync.call(this, sch);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function checkLoaded({ missingSchema: ref, missingRef }) {
|
|
239
|
+
if (this.refs[ref]) throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`);
|
|
240
|
+
}
|
|
241
|
+
async function loadMissingSchema(ref) {
|
|
242
|
+
const _schema = await _loadSchema.call(this, ref);
|
|
243
|
+
if (!this.refs[ref]) await loadMetaSchema.call(this, _schema.$schema);
|
|
244
|
+
if (!this.refs[ref]) this.addSchema(_schema, ref, meta);
|
|
245
|
+
}
|
|
246
|
+
async function _loadSchema(ref) {
|
|
247
|
+
const p = this._loading[ref];
|
|
248
|
+
if (p) return p;
|
|
249
|
+
try {
|
|
250
|
+
return await (this._loading[ref] = loadSchema(ref));
|
|
251
|
+
} finally {
|
|
252
|
+
delete this._loading[ref];
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
addSchema(schema, key, _meta, _validateSchema = this.opts.validateSchema) {
|
|
257
|
+
if (Array.isArray(schema)) {
|
|
258
|
+
for (const sch of schema) this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
259
|
+
return this;
|
|
260
|
+
}
|
|
261
|
+
let id;
|
|
262
|
+
if (typeof schema === "object") {
|
|
263
|
+
const { schemaId } = this.opts;
|
|
264
|
+
id = schema[schemaId];
|
|
265
|
+
if (id !== void 0 && typeof id != "string") throw new Error(`schema ${schemaId} must be string`);
|
|
266
|
+
}
|
|
267
|
+
key = (0, resolve_1.normalizeId)(key || id);
|
|
268
|
+
this._checkUnique(key);
|
|
269
|
+
this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
|
|
270
|
+
return this;
|
|
271
|
+
}
|
|
272
|
+
addMetaSchema(schema, key, _validateSchema = this.opts.validateSchema) {
|
|
273
|
+
this.addSchema(schema, key, true, _validateSchema);
|
|
274
|
+
return this;
|
|
275
|
+
}
|
|
276
|
+
validateSchema(schema, throwOrLogError) {
|
|
277
|
+
if (typeof schema == "boolean") return true;
|
|
278
|
+
let $schema;
|
|
279
|
+
$schema = schema.$schema;
|
|
280
|
+
if ($schema !== void 0 && typeof $schema != "string") throw new Error("$schema must be a string");
|
|
281
|
+
$schema = $schema || this.opts.defaultMeta || this.defaultMeta();
|
|
282
|
+
if (!$schema) {
|
|
283
|
+
this.logger.warn("meta-schema not available");
|
|
284
|
+
this.errors = null;
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
const valid = this.validate($schema, schema);
|
|
288
|
+
if (!valid && throwOrLogError) {
|
|
289
|
+
const message = "schema is invalid: " + this.errorsText();
|
|
290
|
+
if (this.opts.validateSchema === "log") this.logger.error(message);
|
|
291
|
+
else throw new Error(message);
|
|
292
|
+
}
|
|
293
|
+
return valid;
|
|
294
|
+
}
|
|
295
|
+
getSchema(keyRef) {
|
|
296
|
+
let sch;
|
|
297
|
+
while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") keyRef = sch;
|
|
298
|
+
if (sch === void 0) {
|
|
299
|
+
const { schemaId } = this.opts;
|
|
300
|
+
const root = new compile_1.SchemaEnv({
|
|
301
|
+
schema: {},
|
|
302
|
+
schemaId
|
|
303
|
+
});
|
|
304
|
+
sch = compile_1.resolveSchema.call(this, root, keyRef);
|
|
305
|
+
if (!sch) return;
|
|
306
|
+
this.refs[keyRef] = sch;
|
|
307
|
+
}
|
|
308
|
+
return sch.validate || this._compileSchemaEnv(sch);
|
|
309
|
+
}
|
|
310
|
+
removeSchema(schemaKeyRef) {
|
|
311
|
+
if (schemaKeyRef instanceof RegExp) {
|
|
312
|
+
this._removeAllSchemas(this.schemas, schemaKeyRef);
|
|
313
|
+
this._removeAllSchemas(this.refs, schemaKeyRef);
|
|
314
|
+
return this;
|
|
315
|
+
}
|
|
316
|
+
switch (typeof schemaKeyRef) {
|
|
317
|
+
case "undefined":
|
|
318
|
+
this._removeAllSchemas(this.schemas);
|
|
319
|
+
this._removeAllSchemas(this.refs);
|
|
320
|
+
this._cache.clear();
|
|
321
|
+
return this;
|
|
322
|
+
case "string": {
|
|
323
|
+
const sch = getSchEnv.call(this, schemaKeyRef);
|
|
324
|
+
if (typeof sch == "object") this._cache.delete(sch.schema);
|
|
325
|
+
delete this.schemas[schemaKeyRef];
|
|
326
|
+
delete this.refs[schemaKeyRef];
|
|
327
|
+
return this;
|
|
328
|
+
}
|
|
329
|
+
case "object": {
|
|
330
|
+
const cacheKey = schemaKeyRef;
|
|
331
|
+
this._cache.delete(cacheKey);
|
|
332
|
+
let id = schemaKeyRef[this.opts.schemaId];
|
|
333
|
+
if (id) {
|
|
334
|
+
id = (0, resolve_1.normalizeId)(id);
|
|
335
|
+
delete this.schemas[id];
|
|
336
|
+
delete this.refs[id];
|
|
337
|
+
}
|
|
338
|
+
return this;
|
|
339
|
+
}
|
|
340
|
+
default: throw new Error("ajv.removeSchema: invalid parameter");
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
addVocabulary(definitions) {
|
|
344
|
+
for (const def of definitions) this.addKeyword(def);
|
|
345
|
+
return this;
|
|
346
|
+
}
|
|
347
|
+
addKeyword(kwdOrDef, def) {
|
|
348
|
+
let keyword;
|
|
349
|
+
if (typeof kwdOrDef == "string") {
|
|
350
|
+
keyword = kwdOrDef;
|
|
351
|
+
if (typeof def == "object") {
|
|
352
|
+
this.logger.warn("these parameters are deprecated, see docs for addKeyword");
|
|
353
|
+
def.keyword = keyword;
|
|
354
|
+
}
|
|
355
|
+
} else if (typeof kwdOrDef == "object" && def === void 0) {
|
|
356
|
+
def = kwdOrDef;
|
|
357
|
+
keyword = def.keyword;
|
|
358
|
+
if (Array.isArray(keyword) && !keyword.length) throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
359
|
+
} else throw new Error("invalid addKeywords parameters");
|
|
360
|
+
checkKeyword.call(this, keyword, def);
|
|
361
|
+
if (!def) {
|
|
362
|
+
(0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd));
|
|
363
|
+
return this;
|
|
364
|
+
}
|
|
365
|
+
keywordMetaschema.call(this, def);
|
|
366
|
+
const definition = {
|
|
367
|
+
...def,
|
|
368
|
+
type: (0, dataType_1.getJSONTypes)(def.type),
|
|
369
|
+
schemaType: (0, dataType_1.getJSONTypes)(def.schemaType)
|
|
370
|
+
};
|
|
371
|
+
(0, util_1.eachItem)(keyword, definition.type.length === 0 ? (k) => addRule.call(this, k, definition) : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)));
|
|
372
|
+
return this;
|
|
373
|
+
}
|
|
374
|
+
getKeyword(keyword) {
|
|
375
|
+
const rule = this.RULES.all[keyword];
|
|
376
|
+
return typeof rule == "object" ? rule.definition : !!rule;
|
|
377
|
+
}
|
|
378
|
+
removeKeyword(keyword) {
|
|
379
|
+
const { RULES } = this;
|
|
380
|
+
delete RULES.keywords[keyword];
|
|
381
|
+
delete RULES.all[keyword];
|
|
382
|
+
for (const group of RULES.rules) {
|
|
383
|
+
const i = group.rules.findIndex((rule) => rule.keyword === keyword);
|
|
384
|
+
if (i >= 0) group.rules.splice(i, 1);
|
|
385
|
+
}
|
|
386
|
+
return this;
|
|
387
|
+
}
|
|
388
|
+
addFormat(name, format) {
|
|
389
|
+
if (typeof format == "string") format = new RegExp(format);
|
|
390
|
+
this.formats[name] = format;
|
|
391
|
+
return this;
|
|
392
|
+
}
|
|
393
|
+
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
394
|
+
if (!errors || errors.length === 0) return "No errors";
|
|
395
|
+
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text, msg) => text + separator + msg);
|
|
396
|
+
}
|
|
397
|
+
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
398
|
+
const rules = this.RULES.all;
|
|
399
|
+
metaSchema = JSON.parse(JSON.stringify(metaSchema));
|
|
400
|
+
for (const jsonPointer of keywordsJsonPointers) {
|
|
401
|
+
const segments = jsonPointer.split("/").slice(1);
|
|
402
|
+
let keywords = metaSchema;
|
|
403
|
+
for (const seg of segments) keywords = keywords[seg];
|
|
404
|
+
for (const key in rules) {
|
|
405
|
+
const rule = rules[key];
|
|
406
|
+
if (typeof rule != "object") continue;
|
|
407
|
+
const { $data } = rule.definition;
|
|
408
|
+
const schema = keywords[key];
|
|
409
|
+
if ($data && schema) keywords[key] = schemaOrData(schema);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return metaSchema;
|
|
413
|
+
}
|
|
414
|
+
_removeAllSchemas(schemas, regex) {
|
|
415
|
+
for (const keyRef in schemas) {
|
|
416
|
+
const sch = schemas[keyRef];
|
|
417
|
+
if (!regex || regex.test(keyRef)) {
|
|
418
|
+
if (typeof sch == "string") delete schemas[keyRef];
|
|
419
|
+
else if (sch && !sch.meta) {
|
|
420
|
+
this._cache.delete(sch.schema);
|
|
421
|
+
delete schemas[keyRef];
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
_addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
427
|
+
let id;
|
|
428
|
+
const { schemaId } = this.opts;
|
|
429
|
+
if (typeof schema == "object") id = schema[schemaId];
|
|
430
|
+
else if (this.opts.jtd) throw new Error("schema must be object");
|
|
431
|
+
else if (typeof schema != "boolean") throw new Error("schema must be object or boolean");
|
|
432
|
+
let sch = this._cache.get(schema);
|
|
433
|
+
if (sch !== void 0) return sch;
|
|
434
|
+
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
435
|
+
const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
|
|
436
|
+
sch = new compile_1.SchemaEnv({
|
|
437
|
+
schema,
|
|
438
|
+
schemaId,
|
|
439
|
+
meta,
|
|
440
|
+
baseId,
|
|
441
|
+
localRefs
|
|
442
|
+
});
|
|
443
|
+
this._cache.set(sch.schema, sch);
|
|
444
|
+
if (addSchema && !baseId.startsWith("#")) {
|
|
445
|
+
if (baseId) this._checkUnique(baseId);
|
|
446
|
+
this.refs[baseId] = sch;
|
|
447
|
+
}
|
|
448
|
+
if (validateSchema) this.validateSchema(schema, true);
|
|
449
|
+
return sch;
|
|
450
|
+
}
|
|
451
|
+
_checkUnique(id) {
|
|
452
|
+
if (this.schemas[id] || this.refs[id]) throw new Error(`schema with key or id "${id}" already exists`);
|
|
453
|
+
}
|
|
454
|
+
_compileSchemaEnv(sch) {
|
|
455
|
+
if (sch.meta) this._compileMetaSchema(sch);
|
|
456
|
+
else compile_1.compileSchema.call(this, sch);
|
|
457
|
+
/* istanbul ignore if */
|
|
458
|
+
if (!sch.validate) throw new Error("ajv implementation error");
|
|
459
|
+
return sch.validate;
|
|
460
|
+
}
|
|
461
|
+
_compileMetaSchema(sch) {
|
|
462
|
+
const currentOpts = this.opts;
|
|
463
|
+
this.opts = this._metaOpts;
|
|
464
|
+
try {
|
|
465
|
+
compile_1.compileSchema.call(this, sch);
|
|
466
|
+
} finally {
|
|
467
|
+
this.opts = currentOpts;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
Ajv.ValidationError = validation_error_1.default;
|
|
472
|
+
Ajv.MissingRefError = ref_error_1.default;
|
|
473
|
+
exports.default = Ajv;
|
|
474
|
+
function checkOptions(checkOpts, options, msg, log = "error") {
|
|
475
|
+
for (const key in checkOpts) {
|
|
476
|
+
const opt = key;
|
|
477
|
+
if (opt in options) this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
function getSchEnv(keyRef) {
|
|
481
|
+
keyRef = (0, resolve_1.normalizeId)(keyRef);
|
|
482
|
+
return this.schemas[keyRef] || this.refs[keyRef];
|
|
483
|
+
}
|
|
484
|
+
function addInitialSchemas() {
|
|
485
|
+
const optsSchemas = this.opts.schemas;
|
|
486
|
+
if (!optsSchemas) return;
|
|
487
|
+
if (Array.isArray(optsSchemas)) this.addSchema(optsSchemas);
|
|
488
|
+
else for (const key in optsSchemas) this.addSchema(optsSchemas[key], key);
|
|
489
|
+
}
|
|
490
|
+
function addInitialFormats() {
|
|
491
|
+
for (const name in this.opts.formats) {
|
|
492
|
+
const format = this.opts.formats[name];
|
|
493
|
+
if (format) this.addFormat(name, format);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
function addInitialKeywords(defs) {
|
|
497
|
+
if (Array.isArray(defs)) {
|
|
498
|
+
this.addVocabulary(defs);
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
502
|
+
for (const keyword in defs) {
|
|
503
|
+
const def = defs[keyword];
|
|
504
|
+
if (!def.keyword) def.keyword = keyword;
|
|
505
|
+
this.addKeyword(def);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
function getMetaSchemaOptions() {
|
|
509
|
+
const metaOpts = { ...this.opts };
|
|
510
|
+
for (const opt of META_IGNORE_OPTIONS) delete metaOpts[opt];
|
|
511
|
+
return metaOpts;
|
|
512
|
+
}
|
|
513
|
+
const noLogs = {
|
|
514
|
+
log() {},
|
|
515
|
+
warn() {},
|
|
516
|
+
error() {}
|
|
517
|
+
};
|
|
518
|
+
function getLogger(logger) {
|
|
519
|
+
if (logger === false) return noLogs;
|
|
520
|
+
if (logger === void 0) return console;
|
|
521
|
+
if (logger.log && logger.warn && logger.error) return logger;
|
|
522
|
+
throw new Error("logger must implement log, warn and error methods");
|
|
523
|
+
}
|
|
524
|
+
const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
525
|
+
function checkKeyword(keyword, def) {
|
|
526
|
+
const { RULES } = this;
|
|
527
|
+
(0, util_1.eachItem)(keyword, (kwd) => {
|
|
528
|
+
if (RULES.keywords[kwd]) throw new Error(`Keyword ${kwd} is already defined`);
|
|
529
|
+
if (!KEYWORD_NAME.test(kwd)) throw new Error(`Keyword ${kwd} has invalid name`);
|
|
530
|
+
});
|
|
531
|
+
if (!def) return;
|
|
532
|
+
if (def.$data && !("code" in def || "validate" in def)) throw new Error("$data keyword must have \"code\" or \"validate\" function");
|
|
533
|
+
}
|
|
534
|
+
function addRule(keyword, definition, dataType) {
|
|
535
|
+
var _a;
|
|
536
|
+
const post = definition === null || definition === void 0 ? void 0 : definition.post;
|
|
537
|
+
if (dataType && post) throw new Error("keyword with \"post\" flag cannot have \"type\"");
|
|
538
|
+
const { RULES } = this;
|
|
539
|
+
let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType);
|
|
540
|
+
if (!ruleGroup) {
|
|
541
|
+
ruleGroup = {
|
|
542
|
+
type: dataType,
|
|
543
|
+
rules: []
|
|
544
|
+
};
|
|
545
|
+
RULES.rules.push(ruleGroup);
|
|
546
|
+
}
|
|
547
|
+
RULES.keywords[keyword] = true;
|
|
548
|
+
if (!definition) return;
|
|
549
|
+
const rule = {
|
|
550
|
+
keyword,
|
|
551
|
+
definition: {
|
|
552
|
+
...definition,
|
|
553
|
+
type: (0, dataType_1.getJSONTypes)(definition.type),
|
|
554
|
+
schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType)
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
if (definition.before) addBeforeRule.call(this, ruleGroup, rule, definition.before);
|
|
558
|
+
else ruleGroup.rules.push(rule);
|
|
559
|
+
RULES.all[keyword] = rule;
|
|
560
|
+
(_a = definition.implements) === null || _a === void 0 || _a.forEach((kwd) => this.addKeyword(kwd));
|
|
561
|
+
}
|
|
562
|
+
function addBeforeRule(ruleGroup, rule, before) {
|
|
563
|
+
const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
|
|
564
|
+
if (i >= 0) ruleGroup.rules.splice(i, 0, rule);
|
|
565
|
+
else {
|
|
566
|
+
ruleGroup.rules.push(rule);
|
|
567
|
+
this.logger.warn(`rule ${before} is not defined`);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
function keywordMetaschema(def) {
|
|
571
|
+
let { metaSchema } = def;
|
|
572
|
+
if (metaSchema === void 0) return;
|
|
573
|
+
if (def.$data && this.opts.$data) metaSchema = schemaOrData(metaSchema);
|
|
574
|
+
def.validateSchema = this.compile(metaSchema, true);
|
|
575
|
+
}
|
|
576
|
+
const $dataRef = { $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" };
|
|
577
|
+
function schemaOrData(schema) {
|
|
578
|
+
return { anyOf: [schema, $dataRef] };
|
|
579
|
+
}
|
|
580
|
+
}));
|
|
581
|
+
//#endregion
|
|
582
|
+
export default require_core();
|
|
583
|
+
export { require_core };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.json
|
|
3
|
+
var require_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
module.exports = {
|
|
5
|
+
"$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
|
|
6
|
+
"description": "Meta-schema for $data reference (JSON AnySchema extension proposal)",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"required": ["$data"],
|
|
9
|
+
"properties": { "$data": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"anyOf": [{ "format": "relative-json-pointer" }, { "format": "json-pointer" }]
|
|
12
|
+
} },
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
};
|
|
15
|
+
}));
|
|
16
|
+
//#endregion
|
|
17
|
+
export default require_data();
|
|
18
|
+
export { require_data };
|
package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_schema } from "./schema.js";
|
|
3
|
+
import { require_applicator } from "./meta/applicator.js";
|
|
4
|
+
import { require_unevaluated } from "./meta/unevaluated.js";
|
|
5
|
+
import { require_content } from "./meta/content.js";
|
|
6
|
+
import { require_core } from "./meta/core.js";
|
|
7
|
+
import { require_format_annotation } from "./meta/format-annotation.js";
|
|
8
|
+
import { require_meta_data } from "./meta/meta-data.js";
|
|
9
|
+
import { require_validation } from "./meta/validation.js";
|
|
10
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js
|
|
11
|
+
var require_json_schema_2020_12 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
const metaSchema = require_schema();
|
|
14
|
+
const applicator = require_applicator();
|
|
15
|
+
const unevaluated = require_unevaluated();
|
|
16
|
+
const content = require_content();
|
|
17
|
+
const core = require_core();
|
|
18
|
+
const format = require_format_annotation();
|
|
19
|
+
const metadata = require_meta_data();
|
|
20
|
+
const validation = require_validation();
|
|
21
|
+
const META_SUPPORT_DATA = ["/properties"];
|
|
22
|
+
function addMetaSchema2020($data) {
|
|
23
|
+
[
|
|
24
|
+
metaSchema,
|
|
25
|
+
applicator,
|
|
26
|
+
unevaluated,
|
|
27
|
+
content,
|
|
28
|
+
core,
|
|
29
|
+
with$data(this, format),
|
|
30
|
+
metadata,
|
|
31
|
+
with$data(this, validation)
|
|
32
|
+
].forEach((sch) => this.addMetaSchema(sch, void 0, false));
|
|
33
|
+
return this;
|
|
34
|
+
function with$data(ajv, sch) {
|
|
35
|
+
return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.default = addMetaSchema2020;
|
|
39
|
+
}));
|
|
40
|
+
//#endregion
|
|
41
|
+
export default require_json_schema_2020_12();
|
|
42
|
+
export { require_json_schema_2020_12 };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json
|
|
3
|
+
var require_applicator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
module.exports = {
|
|
5
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
6
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/applicator",
|
|
7
|
+
"$vocabulary": { "https://json-schema.org/draft/2020-12/vocab/applicator": true },
|
|
8
|
+
"$dynamicAnchor": "meta",
|
|
9
|
+
"title": "Applicator vocabulary meta-schema",
|
|
10
|
+
"type": ["object", "boolean"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"prefixItems": { "$ref": "#/$defs/schemaArray" },
|
|
13
|
+
"items": { "$dynamicRef": "#meta" },
|
|
14
|
+
"contains": { "$dynamicRef": "#meta" },
|
|
15
|
+
"additionalProperties": { "$dynamicRef": "#meta" },
|
|
16
|
+
"properties": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"additionalProperties": { "$dynamicRef": "#meta" },
|
|
19
|
+
"default": {}
|
|
20
|
+
},
|
|
21
|
+
"patternProperties": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"additionalProperties": { "$dynamicRef": "#meta" },
|
|
24
|
+
"propertyNames": { "format": "regex" },
|
|
25
|
+
"default": {}
|
|
26
|
+
},
|
|
27
|
+
"dependentSchemas": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": { "$dynamicRef": "#meta" },
|
|
30
|
+
"default": {}
|
|
31
|
+
},
|
|
32
|
+
"propertyNames": { "$dynamicRef": "#meta" },
|
|
33
|
+
"if": { "$dynamicRef": "#meta" },
|
|
34
|
+
"then": { "$dynamicRef": "#meta" },
|
|
35
|
+
"else": { "$dynamicRef": "#meta" },
|
|
36
|
+
"allOf": { "$ref": "#/$defs/schemaArray" },
|
|
37
|
+
"anyOf": { "$ref": "#/$defs/schemaArray" },
|
|
38
|
+
"oneOf": { "$ref": "#/$defs/schemaArray" },
|
|
39
|
+
"not": { "$dynamicRef": "#meta" }
|
|
40
|
+
},
|
|
41
|
+
"$defs": { "schemaArray": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"minItems": 1,
|
|
44
|
+
"items": { "$dynamicRef": "#meta" }
|
|
45
|
+
} }
|
|
46
|
+
};
|
|
47
|
+
}));
|
|
48
|
+
//#endregion
|
|
49
|
+
export default require_applicator();
|
|
50
|
+
export { require_applicator };
|