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,141 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_code } from "./code.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js
|
|
4
|
+
var require_scope = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
|
|
7
|
+
const code_1 = require_code();
|
|
8
|
+
var ValueError = class extends Error {
|
|
9
|
+
constructor(name) {
|
|
10
|
+
super(`CodeGen: "code" for ${name} not defined`);
|
|
11
|
+
this.value = name.value;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var UsedValueState;
|
|
15
|
+
(function(UsedValueState) {
|
|
16
|
+
UsedValueState[UsedValueState["Started"] = 0] = "Started";
|
|
17
|
+
UsedValueState[UsedValueState["Completed"] = 1] = "Completed";
|
|
18
|
+
})(UsedValueState || (exports.UsedValueState = UsedValueState = {}));
|
|
19
|
+
exports.varKinds = {
|
|
20
|
+
const: new code_1.Name("const"),
|
|
21
|
+
let: new code_1.Name("let"),
|
|
22
|
+
var: new code_1.Name("var")
|
|
23
|
+
};
|
|
24
|
+
var Scope = class {
|
|
25
|
+
constructor({ prefixes, parent } = {}) {
|
|
26
|
+
this._names = {};
|
|
27
|
+
this._prefixes = prefixes;
|
|
28
|
+
this._parent = parent;
|
|
29
|
+
}
|
|
30
|
+
toName(nameOrPrefix) {
|
|
31
|
+
return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix);
|
|
32
|
+
}
|
|
33
|
+
name(prefix) {
|
|
34
|
+
return new code_1.Name(this._newName(prefix));
|
|
35
|
+
}
|
|
36
|
+
_newName(prefix) {
|
|
37
|
+
const ng = this._names[prefix] || this._nameGroup(prefix);
|
|
38
|
+
return `${prefix}${ng.index++}`;
|
|
39
|
+
}
|
|
40
|
+
_nameGroup(prefix) {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
|
|
43
|
+
return this._names[prefix] = {
|
|
44
|
+
prefix,
|
|
45
|
+
index: 0
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.Scope = Scope;
|
|
50
|
+
var ValueScopeName = class extends code_1.Name {
|
|
51
|
+
constructor(prefix, nameStr) {
|
|
52
|
+
super(nameStr);
|
|
53
|
+
this.prefix = prefix;
|
|
54
|
+
}
|
|
55
|
+
setValue(value, { property, itemIndex }) {
|
|
56
|
+
this.value = value;
|
|
57
|
+
this.scopePath = (0, code_1._)`.${new code_1.Name(property)}[${itemIndex}]`;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.ValueScopeName = ValueScopeName;
|
|
61
|
+
const line = (0, code_1._)`\n`;
|
|
62
|
+
var ValueScope = class extends Scope {
|
|
63
|
+
constructor(opts) {
|
|
64
|
+
super(opts);
|
|
65
|
+
this._values = {};
|
|
66
|
+
this._scope = opts.scope;
|
|
67
|
+
this.opts = {
|
|
68
|
+
...opts,
|
|
69
|
+
_n: opts.lines ? line : code_1.nil
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
get() {
|
|
73
|
+
return this._scope;
|
|
74
|
+
}
|
|
75
|
+
name(prefix) {
|
|
76
|
+
return new ValueScopeName(prefix, this._newName(prefix));
|
|
77
|
+
}
|
|
78
|
+
value(nameOrPrefix, value) {
|
|
79
|
+
var _a;
|
|
80
|
+
if (value.ref === void 0) throw new Error("CodeGen: ref must be passed in value");
|
|
81
|
+
const name = this.toName(nameOrPrefix);
|
|
82
|
+
const { prefix } = name;
|
|
83
|
+
const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref;
|
|
84
|
+
let vs = this._values[prefix];
|
|
85
|
+
if (vs) {
|
|
86
|
+
const _name = vs.get(valueKey);
|
|
87
|
+
if (_name) return _name;
|
|
88
|
+
} else vs = this._values[prefix] = /* @__PURE__ */ new Map();
|
|
89
|
+
vs.set(valueKey, name);
|
|
90
|
+
const s = this._scope[prefix] || (this._scope[prefix] = []);
|
|
91
|
+
const itemIndex = s.length;
|
|
92
|
+
s[itemIndex] = value.ref;
|
|
93
|
+
name.setValue(value, {
|
|
94
|
+
property: prefix,
|
|
95
|
+
itemIndex
|
|
96
|
+
});
|
|
97
|
+
return name;
|
|
98
|
+
}
|
|
99
|
+
getValue(prefix, keyOrRef) {
|
|
100
|
+
const vs = this._values[prefix];
|
|
101
|
+
if (!vs) return;
|
|
102
|
+
return vs.get(keyOrRef);
|
|
103
|
+
}
|
|
104
|
+
scopeRefs(scopeName, values = this._values) {
|
|
105
|
+
return this._reduceValues(values, (name) => {
|
|
106
|
+
if (name.scopePath === void 0) throw new Error(`CodeGen: name "${name}" has no value`);
|
|
107
|
+
return (0, code_1._)`${scopeName}${name.scopePath}`;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
scopeCode(values = this._values, usedValues, getCode) {
|
|
111
|
+
return this._reduceValues(values, (name) => {
|
|
112
|
+
if (name.value === void 0) throw new Error(`CodeGen: name "${name}" has no value`);
|
|
113
|
+
return name.value.code;
|
|
114
|
+
}, usedValues, getCode);
|
|
115
|
+
}
|
|
116
|
+
_reduceValues(values, valueCode, usedValues = {}, getCode) {
|
|
117
|
+
let code = code_1.nil;
|
|
118
|
+
for (const prefix in values) {
|
|
119
|
+
const vs = values[prefix];
|
|
120
|
+
if (!vs) continue;
|
|
121
|
+
const nameSet = usedValues[prefix] = usedValues[prefix] || /* @__PURE__ */ new Map();
|
|
122
|
+
vs.forEach((name) => {
|
|
123
|
+
if (nameSet.has(name)) return;
|
|
124
|
+
nameSet.set(name, UsedValueState.Started);
|
|
125
|
+
let c = valueCode(name);
|
|
126
|
+
if (c) {
|
|
127
|
+
const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
|
|
128
|
+
code = (0, code_1._)`${code}${def} ${name} = ${c};${this.opts._n}`;
|
|
129
|
+
} else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(name)) code = (0, code_1._)`${code}${c}${this.opts._n}`;
|
|
130
|
+
else throw new ValueError(name);
|
|
131
|
+
nameSet.set(name, UsedValueState.Completed);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return code;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
exports.ValueScope = ValueScope;
|
|
138
|
+
}));
|
|
139
|
+
//#endregion
|
|
140
|
+
export default require_scope();
|
|
141
|
+
export { require_scope };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_codegen } from "./codegen/index.js";
|
|
3
|
+
import { require_util } from "./util.js";
|
|
4
|
+
import { require_names } from "./names.js";
|
|
5
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js
|
|
6
|
+
var require_errors = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
|
|
9
|
+
const codegen_1 = require_codegen();
|
|
10
|
+
const util_1 = require_util();
|
|
11
|
+
const names_1 = require_names();
|
|
12
|
+
exports.keywordError = { message: ({ keyword }) => (0, codegen_1.str)`must pass "${keyword}" keyword validation` };
|
|
13
|
+
exports.keyword$DataError = { message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)` };
|
|
14
|
+
function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {
|
|
15
|
+
const { it } = cxt;
|
|
16
|
+
const { gen, compositeRule, allErrors } = it;
|
|
17
|
+
const errObj = errorObjectCode(cxt, error, errorPaths);
|
|
18
|
+
if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) addError(gen, errObj);
|
|
19
|
+
else returnErrors(it, (0, codegen_1._)`[${errObj}]`);
|
|
20
|
+
}
|
|
21
|
+
exports.reportError = reportError;
|
|
22
|
+
function reportExtraError(cxt, error = exports.keywordError, errorPaths) {
|
|
23
|
+
const { it } = cxt;
|
|
24
|
+
const { gen, compositeRule, allErrors } = it;
|
|
25
|
+
addError(gen, errorObjectCode(cxt, error, errorPaths));
|
|
26
|
+
if (!(compositeRule || allErrors)) returnErrors(it, names_1.default.vErrors);
|
|
27
|
+
}
|
|
28
|
+
exports.reportExtraError = reportExtraError;
|
|
29
|
+
function resetErrorsCount(gen, errsCount) {
|
|
30
|
+
gen.assign(names_1.default.errors, errsCount);
|
|
31
|
+
gen.if((0, codegen_1._)`${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._)`${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null)));
|
|
32
|
+
}
|
|
33
|
+
exports.resetErrorsCount = resetErrorsCount;
|
|
34
|
+
function extendErrors({ gen, keyword, schemaValue, data, errsCount, it }) {
|
|
35
|
+
/* istanbul ignore if */
|
|
36
|
+
if (errsCount === void 0) throw new Error("ajv implementation error");
|
|
37
|
+
const err = gen.name("err");
|
|
38
|
+
gen.forRange("i", errsCount, names_1.default.errors, (i) => {
|
|
39
|
+
gen.const(err, (0, codegen_1._)`${names_1.default.vErrors}[${i}]`);
|
|
40
|
+
gen.if((0, codegen_1._)`${err}.instancePath === undefined`, () => gen.assign((0, codegen_1._)`${err}.instancePath`, (0, codegen_1.strConcat)(names_1.default.instancePath, it.errorPath)));
|
|
41
|
+
gen.assign((0, codegen_1._)`${err}.schemaPath`, (0, codegen_1.str)`${it.errSchemaPath}/${keyword}`);
|
|
42
|
+
if (it.opts.verbose) {
|
|
43
|
+
gen.assign((0, codegen_1._)`${err}.schema`, schemaValue);
|
|
44
|
+
gen.assign((0, codegen_1._)`${err}.data`, data);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
exports.extendErrors = extendErrors;
|
|
49
|
+
function addError(gen, errObj) {
|
|
50
|
+
const err = gen.const("err", errObj);
|
|
51
|
+
gen.if((0, codegen_1._)`${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._)`[${err}]`), (0, codegen_1._)`${names_1.default.vErrors}.push(${err})`);
|
|
52
|
+
gen.code((0, codegen_1._)`${names_1.default.errors}++`);
|
|
53
|
+
}
|
|
54
|
+
function returnErrors(it, errs) {
|
|
55
|
+
const { gen, validateName, schemaEnv } = it;
|
|
56
|
+
if (schemaEnv.$async) gen.throw((0, codegen_1._)`new ${it.ValidationError}(${errs})`);
|
|
57
|
+
else {
|
|
58
|
+
gen.assign((0, codegen_1._)`${validateName}.errors`, errs);
|
|
59
|
+
gen.return(false);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const E = {
|
|
63
|
+
keyword: new codegen_1.Name("keyword"),
|
|
64
|
+
schemaPath: new codegen_1.Name("schemaPath"),
|
|
65
|
+
params: new codegen_1.Name("params"),
|
|
66
|
+
propertyName: new codegen_1.Name("propertyName"),
|
|
67
|
+
message: new codegen_1.Name("message"),
|
|
68
|
+
schema: new codegen_1.Name("schema"),
|
|
69
|
+
parentSchema: new codegen_1.Name("parentSchema")
|
|
70
|
+
};
|
|
71
|
+
function errorObjectCode(cxt, error, errorPaths) {
|
|
72
|
+
const { createErrors } = cxt.it;
|
|
73
|
+
if (createErrors === false) return (0, codegen_1._)`{}`;
|
|
74
|
+
return errorObject(cxt, error, errorPaths);
|
|
75
|
+
}
|
|
76
|
+
function errorObject(cxt, error, errorPaths = {}) {
|
|
77
|
+
const { gen, it } = cxt;
|
|
78
|
+
const keyValues = [errorInstancePath(it, errorPaths), errorSchemaPath(cxt, errorPaths)];
|
|
79
|
+
extraErrorProps(cxt, error, keyValues);
|
|
80
|
+
return gen.object(...keyValues);
|
|
81
|
+
}
|
|
82
|
+
function errorInstancePath({ errorPath }, { instancePath }) {
|
|
83
|
+
const instPath = instancePath ? (0, codegen_1.str)`${errorPath}${(0, util_1.getErrorPath)(instancePath, util_1.Type.Str)}` : errorPath;
|
|
84
|
+
return [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, instPath)];
|
|
85
|
+
}
|
|
86
|
+
function errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) {
|
|
87
|
+
let schPath = parentSchema ? errSchemaPath : (0, codegen_1.str)`${errSchemaPath}/${keyword}`;
|
|
88
|
+
if (schemaPath) schPath = (0, codegen_1.str)`${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`;
|
|
89
|
+
return [E.schemaPath, schPath];
|
|
90
|
+
}
|
|
91
|
+
function extraErrorProps(cxt, { params, message }, keyValues) {
|
|
92
|
+
const { keyword, data, schemaValue, it } = cxt;
|
|
93
|
+
const { opts, propertyName, topSchemaRef, schemaPath } = it;
|
|
94
|
+
keyValues.push([E.keyword, keyword], [E.params, typeof params == "function" ? params(cxt) : params || (0, codegen_1._)`{}`]);
|
|
95
|
+
if (opts.messages) keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]);
|
|
96
|
+
if (opts.verbose) keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._)`${topSchemaRef}${schemaPath}`], [names_1.default.data, data]);
|
|
97
|
+
if (propertyName) keyValues.push([E.propertyName, propertyName]);
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
//#endregion
|
|
101
|
+
export default require_errors();
|
|
102
|
+
export { require_errors };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_codegen } from "./codegen/index.js";
|
|
3
|
+
import { require_util } from "./util.js";
|
|
4
|
+
import { require_names } from "./names.js";
|
|
5
|
+
import { require_resolve } from "./resolve.js";
|
|
6
|
+
import { require_validate } from "./validate/index.js";
|
|
7
|
+
import { require_validation_error } from "../runtime/validation_error.js";
|
|
8
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js
|
|
9
|
+
var require_compile = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0;
|
|
12
|
+
const codegen_1 = require_codegen();
|
|
13
|
+
const validation_error_1 = require_validation_error();
|
|
14
|
+
const names_1 = require_names();
|
|
15
|
+
const resolve_1 = require_resolve();
|
|
16
|
+
const util_1 = require_util();
|
|
17
|
+
const validate_1 = require_validate();
|
|
18
|
+
var SchemaEnv = class {
|
|
19
|
+
constructor(env) {
|
|
20
|
+
var _a;
|
|
21
|
+
this.refs = {};
|
|
22
|
+
this.dynamicAnchors = {};
|
|
23
|
+
let schema;
|
|
24
|
+
if (typeof env.schema == "object") schema = env.schema;
|
|
25
|
+
this.schema = env.schema;
|
|
26
|
+
this.schemaId = env.schemaId;
|
|
27
|
+
this.root = env.root || this;
|
|
28
|
+
this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
|
|
29
|
+
this.schemaPath = env.schemaPath;
|
|
30
|
+
this.localRefs = env.localRefs;
|
|
31
|
+
this.meta = env.meta;
|
|
32
|
+
this.$async = schema === null || schema === void 0 ? void 0 : schema.$async;
|
|
33
|
+
this.refs = {};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.SchemaEnv = SchemaEnv;
|
|
37
|
+
function compileSchema(sch) {
|
|
38
|
+
const _sch = getCompilingSchema.call(this, sch);
|
|
39
|
+
if (_sch) return _sch;
|
|
40
|
+
const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId);
|
|
41
|
+
const { es5, lines } = this.opts.code;
|
|
42
|
+
const { ownProperties } = this.opts;
|
|
43
|
+
const gen = new codegen_1.CodeGen(this.scope, {
|
|
44
|
+
es5,
|
|
45
|
+
lines,
|
|
46
|
+
ownProperties
|
|
47
|
+
});
|
|
48
|
+
let _ValidationError;
|
|
49
|
+
if (sch.$async) _ValidationError = gen.scopeValue("Error", {
|
|
50
|
+
ref: validation_error_1.default,
|
|
51
|
+
code: (0, codegen_1._)`require("ajv/dist/runtime/validation_error").default`
|
|
52
|
+
});
|
|
53
|
+
const validateName = gen.scopeName("validate");
|
|
54
|
+
sch.validateName = validateName;
|
|
55
|
+
const schemaCxt = {
|
|
56
|
+
gen,
|
|
57
|
+
allErrors: this.opts.allErrors,
|
|
58
|
+
data: names_1.default.data,
|
|
59
|
+
parentData: names_1.default.parentData,
|
|
60
|
+
parentDataProperty: names_1.default.parentDataProperty,
|
|
61
|
+
dataNames: [names_1.default.data],
|
|
62
|
+
dataPathArr: [codegen_1.nil],
|
|
63
|
+
dataLevel: 0,
|
|
64
|
+
dataTypes: [],
|
|
65
|
+
definedProperties: /* @__PURE__ */ new Set(),
|
|
66
|
+
topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true ? {
|
|
67
|
+
ref: sch.schema,
|
|
68
|
+
code: (0, codegen_1.stringify)(sch.schema)
|
|
69
|
+
} : { ref: sch.schema }),
|
|
70
|
+
validateName,
|
|
71
|
+
ValidationError: _ValidationError,
|
|
72
|
+
schema: sch.schema,
|
|
73
|
+
schemaEnv: sch,
|
|
74
|
+
rootId,
|
|
75
|
+
baseId: sch.baseId || rootId,
|
|
76
|
+
schemaPath: codegen_1.nil,
|
|
77
|
+
errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"),
|
|
78
|
+
errorPath: (0, codegen_1._)`""`,
|
|
79
|
+
opts: this.opts,
|
|
80
|
+
self: this
|
|
81
|
+
};
|
|
82
|
+
let sourceCode;
|
|
83
|
+
try {
|
|
84
|
+
this._compilations.add(sch);
|
|
85
|
+
(0, validate_1.validateFunctionCode)(schemaCxt);
|
|
86
|
+
gen.optimize(this.opts.code.optimize);
|
|
87
|
+
const validateCode = gen.toString();
|
|
88
|
+
sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`;
|
|
89
|
+
if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch);
|
|
90
|
+
const validate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode)(this, this.scope.get());
|
|
91
|
+
this.scope.value(validateName, { ref: validate });
|
|
92
|
+
validate.errors = null;
|
|
93
|
+
validate.schema = sch.schema;
|
|
94
|
+
validate.schemaEnv = sch;
|
|
95
|
+
if (sch.$async) validate.$async = true;
|
|
96
|
+
if (this.opts.code.source === true) validate.source = {
|
|
97
|
+
validateName,
|
|
98
|
+
validateCode,
|
|
99
|
+
scopeValues: gen._values
|
|
100
|
+
};
|
|
101
|
+
if (this.opts.unevaluated) {
|
|
102
|
+
const { props, items } = schemaCxt;
|
|
103
|
+
validate.evaluated = {
|
|
104
|
+
props: props instanceof codegen_1.Name ? void 0 : props,
|
|
105
|
+
items: items instanceof codegen_1.Name ? void 0 : items,
|
|
106
|
+
dynamicProps: props instanceof codegen_1.Name,
|
|
107
|
+
dynamicItems: items instanceof codegen_1.Name
|
|
108
|
+
};
|
|
109
|
+
if (validate.source) validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);
|
|
110
|
+
}
|
|
111
|
+
sch.validate = validate;
|
|
112
|
+
return sch;
|
|
113
|
+
} catch (e) {
|
|
114
|
+
delete sch.validate;
|
|
115
|
+
delete sch.validateName;
|
|
116
|
+
if (sourceCode) this.logger.error("Error compiling schema, function code:", sourceCode);
|
|
117
|
+
throw e;
|
|
118
|
+
} finally {
|
|
119
|
+
this._compilations.delete(sch);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.compileSchema = compileSchema;
|
|
123
|
+
function resolveRef(root, baseId, ref) {
|
|
124
|
+
var _a;
|
|
125
|
+
ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
|
|
126
|
+
const schOrFunc = root.refs[ref];
|
|
127
|
+
if (schOrFunc) return schOrFunc;
|
|
128
|
+
let _sch = resolve.call(this, root, ref);
|
|
129
|
+
if (_sch === void 0) {
|
|
130
|
+
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
131
|
+
const { schemaId } = this.opts;
|
|
132
|
+
if (schema) _sch = new SchemaEnv({
|
|
133
|
+
schema,
|
|
134
|
+
schemaId,
|
|
135
|
+
root,
|
|
136
|
+
baseId
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (_sch === void 0) return;
|
|
140
|
+
return root.refs[ref] = inlineOrCompile.call(this, _sch);
|
|
141
|
+
}
|
|
142
|
+
exports.resolveRef = resolveRef;
|
|
143
|
+
function inlineOrCompile(sch) {
|
|
144
|
+
if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs)) return sch.schema;
|
|
145
|
+
return sch.validate ? sch : compileSchema.call(this, sch);
|
|
146
|
+
}
|
|
147
|
+
function getCompilingSchema(schEnv) {
|
|
148
|
+
for (const sch of this._compilations) if (sameSchemaEnv(sch, schEnv)) return sch;
|
|
149
|
+
}
|
|
150
|
+
exports.getCompilingSchema = getCompilingSchema;
|
|
151
|
+
function sameSchemaEnv(s1, s2) {
|
|
152
|
+
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
153
|
+
}
|
|
154
|
+
function resolve(root, ref) {
|
|
155
|
+
let sch;
|
|
156
|
+
while (typeof (sch = this.refs[ref]) == "string") ref = sch;
|
|
157
|
+
return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
|
|
158
|
+
}
|
|
159
|
+
function resolveSchema(root, ref) {
|
|
160
|
+
const p = this.opts.uriResolver.parse(ref);
|
|
161
|
+
const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);
|
|
162
|
+
let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, void 0);
|
|
163
|
+
if (Object.keys(root.schema).length > 0 && refPath === baseId) return getJsonPointer.call(this, p, root);
|
|
164
|
+
const id = (0, resolve_1.normalizeId)(refPath);
|
|
165
|
+
const schOrRef = this.refs[id] || this.schemas[id];
|
|
166
|
+
if (typeof schOrRef == "string") {
|
|
167
|
+
const sch = resolveSchema.call(this, root, schOrRef);
|
|
168
|
+
if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object") return;
|
|
169
|
+
return getJsonPointer.call(this, p, sch);
|
|
170
|
+
}
|
|
171
|
+
if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object") return;
|
|
172
|
+
if (!schOrRef.validate) compileSchema.call(this, schOrRef);
|
|
173
|
+
if (id === (0, resolve_1.normalizeId)(ref)) {
|
|
174
|
+
const { schema } = schOrRef;
|
|
175
|
+
const { schemaId } = this.opts;
|
|
176
|
+
const schId = schema[schemaId];
|
|
177
|
+
if (schId) baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
178
|
+
return new SchemaEnv({
|
|
179
|
+
schema,
|
|
180
|
+
schemaId,
|
|
181
|
+
root,
|
|
182
|
+
baseId
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
return getJsonPointer.call(this, p, schOrRef);
|
|
186
|
+
}
|
|
187
|
+
exports.resolveSchema = resolveSchema;
|
|
188
|
+
const PREVENT_SCOPE_CHANGE = new Set([
|
|
189
|
+
"properties",
|
|
190
|
+
"patternProperties",
|
|
191
|
+
"enum",
|
|
192
|
+
"dependencies",
|
|
193
|
+
"definitions"
|
|
194
|
+
]);
|
|
195
|
+
function getJsonPointer(parsedRef, { baseId, schema, root }) {
|
|
196
|
+
var _a;
|
|
197
|
+
if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/") return;
|
|
198
|
+
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
199
|
+
if (typeof schema === "boolean") return;
|
|
200
|
+
const partSchema = schema[(0, util_1.unescapeFragment)(part)];
|
|
201
|
+
if (partSchema === void 0) return;
|
|
202
|
+
schema = partSchema;
|
|
203
|
+
const schId = typeof schema === "object" && schema[this.opts.schemaId];
|
|
204
|
+
if (!PREVENT_SCOPE_CHANGE.has(part) && schId) baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
205
|
+
}
|
|
206
|
+
let env;
|
|
207
|
+
if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) {
|
|
208
|
+
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref);
|
|
209
|
+
env = resolveSchema.call(this, root, $ref);
|
|
210
|
+
}
|
|
211
|
+
const { schemaId } = this.opts;
|
|
212
|
+
env = env || new SchemaEnv({
|
|
213
|
+
schema,
|
|
214
|
+
schemaId,
|
|
215
|
+
root,
|
|
216
|
+
baseId
|
|
217
|
+
});
|
|
218
|
+
if (env.schema !== env.root.schema) return env;
|
|
219
|
+
}
|
|
220
|
+
}));
|
|
221
|
+
//#endregion
|
|
222
|
+
export default require_compile();
|
|
223
|
+
export { require_compile };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_codegen } from "./codegen/index.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js
|
|
4
|
+
var require_names = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const codegen_1 = require_codegen();
|
|
7
|
+
exports.default = {
|
|
8
|
+
data: new codegen_1.Name("data"),
|
|
9
|
+
valCxt: new codegen_1.Name("valCxt"),
|
|
10
|
+
instancePath: new codegen_1.Name("instancePath"),
|
|
11
|
+
parentData: new codegen_1.Name("parentData"),
|
|
12
|
+
parentDataProperty: new codegen_1.Name("parentDataProperty"),
|
|
13
|
+
rootData: new codegen_1.Name("rootData"),
|
|
14
|
+
dynamicAnchors: new codegen_1.Name("dynamicAnchors"),
|
|
15
|
+
vErrors: new codegen_1.Name("vErrors"),
|
|
16
|
+
errors: new codegen_1.Name("errors"),
|
|
17
|
+
this: new codegen_1.Name("this"),
|
|
18
|
+
self: new codegen_1.Name("self"),
|
|
19
|
+
scope: new codegen_1.Name("scope"),
|
|
20
|
+
json: new codegen_1.Name("json"),
|
|
21
|
+
jsonPos: new codegen_1.Name("jsonPos"),
|
|
22
|
+
jsonLen: new codegen_1.Name("jsonLen"),
|
|
23
|
+
jsonPart: new codegen_1.Name("jsonPart")
|
|
24
|
+
};
|
|
25
|
+
}));
|
|
26
|
+
//#endregion
|
|
27
|
+
export default require_names();
|
|
28
|
+
export { require_names };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_resolve } from "./resolve.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js
|
|
4
|
+
var require_ref_error = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const resolve_1 = require_resolve();
|
|
7
|
+
var MissingRefError = class extends Error {
|
|
8
|
+
constructor(resolver, baseId, ref, msg) {
|
|
9
|
+
super(msg || `can't resolve reference ${ref} from id ${baseId}`);
|
|
10
|
+
this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref);
|
|
11
|
+
this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef));
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
exports.default = MissingRefError;
|
|
15
|
+
}));
|
|
16
|
+
//#endregion
|
|
17
|
+
export default require_ref_error();
|
|
18
|
+
export { require_ref_error };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_util } from "./util.js";
|
|
3
|
+
import { require_fast_deep_equal } from "../../../../../fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js";
|
|
4
|
+
import { require_json_schema_traverse } from "../../../../../json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js";
|
|
5
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js
|
|
6
|
+
var require_resolve = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0;
|
|
9
|
+
const util_1 = require_util();
|
|
10
|
+
const equal = require_fast_deep_equal();
|
|
11
|
+
const traverse = require_json_schema_traverse();
|
|
12
|
+
const SIMPLE_INLINED = new Set([
|
|
13
|
+
"type",
|
|
14
|
+
"format",
|
|
15
|
+
"pattern",
|
|
16
|
+
"maxLength",
|
|
17
|
+
"minLength",
|
|
18
|
+
"maxProperties",
|
|
19
|
+
"minProperties",
|
|
20
|
+
"maxItems",
|
|
21
|
+
"minItems",
|
|
22
|
+
"maximum",
|
|
23
|
+
"minimum",
|
|
24
|
+
"uniqueItems",
|
|
25
|
+
"multipleOf",
|
|
26
|
+
"required",
|
|
27
|
+
"enum",
|
|
28
|
+
"const"
|
|
29
|
+
]);
|
|
30
|
+
function inlineRef(schema, limit = true) {
|
|
31
|
+
if (typeof schema == "boolean") return true;
|
|
32
|
+
if (limit === true) return !hasRef(schema);
|
|
33
|
+
if (!limit) return false;
|
|
34
|
+
return countKeys(schema) <= limit;
|
|
35
|
+
}
|
|
36
|
+
exports.inlineRef = inlineRef;
|
|
37
|
+
const REF_KEYWORDS = new Set([
|
|
38
|
+
"$ref",
|
|
39
|
+
"$recursiveRef",
|
|
40
|
+
"$recursiveAnchor",
|
|
41
|
+
"$dynamicRef",
|
|
42
|
+
"$dynamicAnchor"
|
|
43
|
+
]);
|
|
44
|
+
function hasRef(schema) {
|
|
45
|
+
for (const key in schema) {
|
|
46
|
+
if (REF_KEYWORDS.has(key)) return true;
|
|
47
|
+
const sch = schema[key];
|
|
48
|
+
if (Array.isArray(sch) && sch.some(hasRef)) return true;
|
|
49
|
+
if (typeof sch == "object" && hasRef(sch)) return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
function countKeys(schema) {
|
|
54
|
+
let count = 0;
|
|
55
|
+
for (const key in schema) {
|
|
56
|
+
if (key === "$ref") return Infinity;
|
|
57
|
+
count++;
|
|
58
|
+
if (SIMPLE_INLINED.has(key)) continue;
|
|
59
|
+
if (typeof schema[key] == "object") (0, util_1.eachItem)(schema[key], (sch) => count += countKeys(sch));
|
|
60
|
+
if (count === Infinity) return Infinity;
|
|
61
|
+
}
|
|
62
|
+
return count;
|
|
63
|
+
}
|
|
64
|
+
function getFullPath(resolver, id = "", normalize) {
|
|
65
|
+
if (normalize !== false) id = normalizeId(id);
|
|
66
|
+
return _getFullPath(resolver, resolver.parse(id));
|
|
67
|
+
}
|
|
68
|
+
exports.getFullPath = getFullPath;
|
|
69
|
+
function _getFullPath(resolver, p) {
|
|
70
|
+
return resolver.serialize(p).split("#")[0] + "#";
|
|
71
|
+
}
|
|
72
|
+
exports._getFullPath = _getFullPath;
|
|
73
|
+
const TRAILING_SLASH_HASH = /#\/?$/;
|
|
74
|
+
function normalizeId(id) {
|
|
75
|
+
return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
|
|
76
|
+
}
|
|
77
|
+
exports.normalizeId = normalizeId;
|
|
78
|
+
function resolveUrl(resolver, baseId, id) {
|
|
79
|
+
id = normalizeId(id);
|
|
80
|
+
return resolver.resolve(baseId, id);
|
|
81
|
+
}
|
|
82
|
+
exports.resolveUrl = resolveUrl;
|
|
83
|
+
const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
84
|
+
function getSchemaRefs(schema, baseId) {
|
|
85
|
+
if (typeof schema == "boolean") return {};
|
|
86
|
+
const { schemaId, uriResolver } = this.opts;
|
|
87
|
+
const schId = normalizeId(schema[schemaId] || baseId);
|
|
88
|
+
const baseIds = { "": schId };
|
|
89
|
+
const pathPrefix = getFullPath(uriResolver, schId, false);
|
|
90
|
+
const localRefs = {};
|
|
91
|
+
const schemaRefs = /* @__PURE__ */ new Set();
|
|
92
|
+
traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
|
|
93
|
+
if (parentJsonPtr === void 0) return;
|
|
94
|
+
const fullPath = pathPrefix + jsonPtr;
|
|
95
|
+
let innerBaseId = baseIds[parentJsonPtr];
|
|
96
|
+
if (typeof sch[schemaId] == "string") innerBaseId = addRef.call(this, sch[schemaId]);
|
|
97
|
+
addAnchor.call(this, sch.$anchor);
|
|
98
|
+
addAnchor.call(this, sch.$dynamicAnchor);
|
|
99
|
+
baseIds[jsonPtr] = innerBaseId;
|
|
100
|
+
function addRef(ref) {
|
|
101
|
+
const _resolve = this.opts.uriResolver.resolve;
|
|
102
|
+
ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref);
|
|
103
|
+
if (schemaRefs.has(ref)) throw ambiguos(ref);
|
|
104
|
+
schemaRefs.add(ref);
|
|
105
|
+
let schOrRef = this.refs[ref];
|
|
106
|
+
if (typeof schOrRef == "string") schOrRef = this.refs[schOrRef];
|
|
107
|
+
if (typeof schOrRef == "object") checkAmbiguosRef(sch, schOrRef.schema, ref);
|
|
108
|
+
else if (ref !== normalizeId(fullPath)) if (ref[0] === "#") {
|
|
109
|
+
checkAmbiguosRef(sch, localRefs[ref], ref);
|
|
110
|
+
localRefs[ref] = sch;
|
|
111
|
+
} else this.refs[ref] = fullPath;
|
|
112
|
+
return ref;
|
|
113
|
+
}
|
|
114
|
+
function addAnchor(anchor) {
|
|
115
|
+
if (typeof anchor == "string") {
|
|
116
|
+
if (!ANCHOR.test(anchor)) throw new Error(`invalid anchor "${anchor}"`);
|
|
117
|
+
addRef.call(this, `#${anchor}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return localRefs;
|
|
122
|
+
function checkAmbiguosRef(sch1, sch2, ref) {
|
|
123
|
+
if (sch2 !== void 0 && !equal(sch1, sch2)) throw ambiguos(ref);
|
|
124
|
+
}
|
|
125
|
+
function ambiguos(ref) {
|
|
126
|
+
return /* @__PURE__ */ new Error(`reference "${ref}" resolves to more than one schema`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.getSchemaRefs = getSchemaRefs;
|
|
130
|
+
}));
|
|
131
|
+
//#endregion
|
|
132
|
+
export default require_resolve();
|
|
133
|
+
export { require_resolve };
|