fumadocs-openapi 10.8.4 → 10.8.5
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/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/schema.d.ts +0 -2
- package/dist/playground/schema.js +3 -2
- package/package.json +7 -3
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js
|
|
3
|
+
var require_rules = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.getRules = exports.isJSONType = void 0;
|
|
6
|
+
const jsonTypes = new Set([
|
|
7
|
+
"string",
|
|
8
|
+
"number",
|
|
9
|
+
"integer",
|
|
10
|
+
"boolean",
|
|
11
|
+
"null",
|
|
12
|
+
"object",
|
|
13
|
+
"array"
|
|
14
|
+
]);
|
|
15
|
+
function isJSONType(x) {
|
|
16
|
+
return typeof x == "string" && jsonTypes.has(x);
|
|
17
|
+
}
|
|
18
|
+
exports.isJSONType = isJSONType;
|
|
19
|
+
function getRules() {
|
|
20
|
+
const groups = {
|
|
21
|
+
number: {
|
|
22
|
+
type: "number",
|
|
23
|
+
rules: []
|
|
24
|
+
},
|
|
25
|
+
string: {
|
|
26
|
+
type: "string",
|
|
27
|
+
rules: []
|
|
28
|
+
},
|
|
29
|
+
array: {
|
|
30
|
+
type: "array",
|
|
31
|
+
rules: []
|
|
32
|
+
},
|
|
33
|
+
object: {
|
|
34
|
+
type: "object",
|
|
35
|
+
rules: []
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
types: {
|
|
40
|
+
...groups,
|
|
41
|
+
integer: true,
|
|
42
|
+
boolean: true,
|
|
43
|
+
null: true
|
|
44
|
+
},
|
|
45
|
+
rules: [
|
|
46
|
+
{ rules: [] },
|
|
47
|
+
groups.number,
|
|
48
|
+
groups.string,
|
|
49
|
+
groups.array,
|
|
50
|
+
groups.object
|
|
51
|
+
],
|
|
52
|
+
post: { rules: [] },
|
|
53
|
+
all: {},
|
|
54
|
+
keywords: {}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
exports.getRules = getRules;
|
|
58
|
+
}));
|
|
59
|
+
//#endregion
|
|
60
|
+
export default require_rules();
|
|
61
|
+
export { require_rules };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_code } from "./codegen/code.js";
|
|
3
|
+
import { require_codegen } from "./codegen/index.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js
|
|
5
|
+
var require_util = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0;
|
|
8
|
+
const codegen_1 = require_codegen();
|
|
9
|
+
const code_1 = require_code();
|
|
10
|
+
function toHash(arr) {
|
|
11
|
+
const hash = {};
|
|
12
|
+
for (const item of arr) hash[item] = true;
|
|
13
|
+
return hash;
|
|
14
|
+
}
|
|
15
|
+
exports.toHash = toHash;
|
|
16
|
+
function alwaysValidSchema(it, schema) {
|
|
17
|
+
if (typeof schema == "boolean") return schema;
|
|
18
|
+
if (Object.keys(schema).length === 0) return true;
|
|
19
|
+
checkUnknownRules(it, schema);
|
|
20
|
+
return !schemaHasRules(schema, it.self.RULES.all);
|
|
21
|
+
}
|
|
22
|
+
exports.alwaysValidSchema = alwaysValidSchema;
|
|
23
|
+
function checkUnknownRules(it, schema = it.schema) {
|
|
24
|
+
const { opts, self } = it;
|
|
25
|
+
if (!opts.strictSchema) return;
|
|
26
|
+
if (typeof schema === "boolean") return;
|
|
27
|
+
const rules = self.RULES.keywords;
|
|
28
|
+
for (const key in schema) if (!rules[key]) checkStrictMode(it, `unknown keyword: "${key}"`);
|
|
29
|
+
}
|
|
30
|
+
exports.checkUnknownRules = checkUnknownRules;
|
|
31
|
+
function schemaHasRules(schema, rules) {
|
|
32
|
+
if (typeof schema == "boolean") return !schema;
|
|
33
|
+
for (const key in schema) if (rules[key]) return true;
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
exports.schemaHasRules = schemaHasRules;
|
|
37
|
+
function schemaHasRulesButRef(schema, RULES) {
|
|
38
|
+
if (typeof schema == "boolean") return !schema;
|
|
39
|
+
for (const key in schema) if (key !== "$ref" && RULES.all[key]) return true;
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
exports.schemaHasRulesButRef = schemaHasRulesButRef;
|
|
43
|
+
function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) {
|
|
44
|
+
if (!$data) {
|
|
45
|
+
if (typeof schema == "number" || typeof schema == "boolean") return schema;
|
|
46
|
+
if (typeof schema == "string") return (0, codegen_1._)`${schema}`;
|
|
47
|
+
}
|
|
48
|
+
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
49
|
+
}
|
|
50
|
+
exports.schemaRefOrVal = schemaRefOrVal;
|
|
51
|
+
function unescapeFragment(str) {
|
|
52
|
+
return unescapeJsonPointer(decodeURIComponent(str));
|
|
53
|
+
}
|
|
54
|
+
exports.unescapeFragment = unescapeFragment;
|
|
55
|
+
function escapeFragment(str) {
|
|
56
|
+
return encodeURIComponent(escapeJsonPointer(str));
|
|
57
|
+
}
|
|
58
|
+
exports.escapeFragment = escapeFragment;
|
|
59
|
+
function escapeJsonPointer(str) {
|
|
60
|
+
if (typeof str == "number") return `${str}`;
|
|
61
|
+
return str.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
62
|
+
}
|
|
63
|
+
exports.escapeJsonPointer = escapeJsonPointer;
|
|
64
|
+
function unescapeJsonPointer(str) {
|
|
65
|
+
return str.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
66
|
+
}
|
|
67
|
+
exports.unescapeJsonPointer = unescapeJsonPointer;
|
|
68
|
+
function eachItem(xs, f) {
|
|
69
|
+
if (Array.isArray(xs)) for (const x of xs) f(x);
|
|
70
|
+
else f(xs);
|
|
71
|
+
}
|
|
72
|
+
exports.eachItem = eachItem;
|
|
73
|
+
function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName }) {
|
|
74
|
+
return (gen, from, to, toName) => {
|
|
75
|
+
const res = to === void 0 ? from : to instanceof codegen_1.Name ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1.Name ? (mergeToName(gen, to, from), from) : mergeValues(from, to);
|
|
76
|
+
return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
exports.mergeEvaluated = {
|
|
80
|
+
props: makeMergeEvaluated({
|
|
81
|
+
mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => {
|
|
82
|
+
gen.if((0, codegen_1._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._)`${to} || {}`).code((0, codegen_1._)`Object.assign(${to}, ${from})`));
|
|
83
|
+
}),
|
|
84
|
+
mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => {
|
|
85
|
+
if (from === true) gen.assign(to, true);
|
|
86
|
+
else {
|
|
87
|
+
gen.assign(to, (0, codegen_1._)`${to} || {}`);
|
|
88
|
+
setEvaluated(gen, to, from);
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
mergeValues: (from, to) => from === true ? true : {
|
|
92
|
+
...from,
|
|
93
|
+
...to
|
|
94
|
+
},
|
|
95
|
+
resultToName: evaluatedPropsToName
|
|
96
|
+
}),
|
|
97
|
+
items: makeMergeEvaluated({
|
|
98
|
+
mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
|
|
99
|
+
mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._)`${to} > ${from} ? ${to} : ${from}`)),
|
|
100
|
+
mergeValues: (from, to) => from === true ? true : Math.max(from, to),
|
|
101
|
+
resultToName: (gen, items) => gen.var("items", items)
|
|
102
|
+
})
|
|
103
|
+
};
|
|
104
|
+
function evaluatedPropsToName(gen, ps) {
|
|
105
|
+
if (ps === true) return gen.var("props", true);
|
|
106
|
+
const props = gen.var("props", (0, codegen_1._)`{}`);
|
|
107
|
+
if (ps !== void 0) setEvaluated(gen, props, ps);
|
|
108
|
+
return props;
|
|
109
|
+
}
|
|
110
|
+
exports.evaluatedPropsToName = evaluatedPropsToName;
|
|
111
|
+
function setEvaluated(gen, props, ps) {
|
|
112
|
+
Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._)`${props}${(0, codegen_1.getProperty)(p)}`, true));
|
|
113
|
+
}
|
|
114
|
+
exports.setEvaluated = setEvaluated;
|
|
115
|
+
const snippets = {};
|
|
116
|
+
function useFunc(gen, f) {
|
|
117
|
+
return gen.scopeValue("func", {
|
|
118
|
+
ref: f,
|
|
119
|
+
code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code))
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
exports.useFunc = useFunc;
|
|
123
|
+
var Type;
|
|
124
|
+
(function(Type) {
|
|
125
|
+
Type[Type["Num"] = 0] = "Num";
|
|
126
|
+
Type[Type["Str"] = 1] = "Str";
|
|
127
|
+
})(Type || (exports.Type = Type = {}));
|
|
128
|
+
function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
|
|
129
|
+
if (dataProp instanceof codegen_1.Name) {
|
|
130
|
+
const isNumber = dataPropType === Type.Num;
|
|
131
|
+
return jsPropertySyntax ? isNumber ? (0, codegen_1._)`"[" + ${dataProp} + "]"` : (0, codegen_1._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1._)`"/" + ${dataProp}` : (0, codegen_1._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
132
|
+
}
|
|
133
|
+
return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
|
|
134
|
+
}
|
|
135
|
+
exports.getErrorPath = getErrorPath;
|
|
136
|
+
function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
|
|
137
|
+
if (!mode) return;
|
|
138
|
+
msg = `strict mode: ${msg}`;
|
|
139
|
+
if (mode === true) throw new Error(msg);
|
|
140
|
+
it.self.logger.warn(msg);
|
|
141
|
+
}
|
|
142
|
+
exports.checkStrictMode = checkStrictMode;
|
|
143
|
+
}));
|
|
144
|
+
//#endregion
|
|
145
|
+
export default require_util();
|
|
146
|
+
export { require_util };
|
package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js
|
|
3
|
+
var require_applicability = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
|
|
6
|
+
function schemaHasRulesForType({ schema, self }, type) {
|
|
7
|
+
const group = self.RULES.types[type];
|
|
8
|
+
return group && group !== true && shouldUseGroup(schema, group);
|
|
9
|
+
}
|
|
10
|
+
exports.schemaHasRulesForType = schemaHasRulesForType;
|
|
11
|
+
function shouldUseGroup(schema, group) {
|
|
12
|
+
return group.rules.some((rule) => shouldUseRule(schema, rule));
|
|
13
|
+
}
|
|
14
|
+
exports.shouldUseGroup = shouldUseGroup;
|
|
15
|
+
function shouldUseRule(schema, rule) {
|
|
16
|
+
var _a;
|
|
17
|
+
return schema[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== void 0));
|
|
18
|
+
}
|
|
19
|
+
exports.shouldUseRule = shouldUseRule;
|
|
20
|
+
}));
|
|
21
|
+
//#endregion
|
|
22
|
+
export default require_applicability();
|
|
23
|
+
export { require_applicability };
|
package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_codegen } from "../codegen/index.js";
|
|
3
|
+
import { require_names } from "../names.js";
|
|
4
|
+
import { require_errors } from "../errors.js";
|
|
5
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js
|
|
6
|
+
var require_boolSchema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0;
|
|
9
|
+
const errors_1 = require_errors();
|
|
10
|
+
const codegen_1 = require_codegen();
|
|
11
|
+
const names_1 = require_names();
|
|
12
|
+
const boolError = { message: "boolean schema is false" };
|
|
13
|
+
function topBoolOrEmptySchema(it) {
|
|
14
|
+
const { gen, schema, validateName } = it;
|
|
15
|
+
if (schema === false) falseSchemaError(it, false);
|
|
16
|
+
else if (typeof schema == "object" && schema.$async === true) gen.return(names_1.default.data);
|
|
17
|
+
else {
|
|
18
|
+
gen.assign((0, codegen_1._)`${validateName}.errors`, null);
|
|
19
|
+
gen.return(true);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.topBoolOrEmptySchema = topBoolOrEmptySchema;
|
|
23
|
+
function boolOrEmptySchema(it, valid) {
|
|
24
|
+
const { gen, schema } = it;
|
|
25
|
+
if (schema === false) {
|
|
26
|
+
gen.var(valid, false);
|
|
27
|
+
falseSchemaError(it);
|
|
28
|
+
} else gen.var(valid, true);
|
|
29
|
+
}
|
|
30
|
+
exports.boolOrEmptySchema = boolOrEmptySchema;
|
|
31
|
+
function falseSchemaError(it, overrideAllErrors) {
|
|
32
|
+
const { gen, data } = it;
|
|
33
|
+
const cxt = {
|
|
34
|
+
gen,
|
|
35
|
+
keyword: "false schema",
|
|
36
|
+
data,
|
|
37
|
+
schema: false,
|
|
38
|
+
schemaCode: false,
|
|
39
|
+
schemaValue: false,
|
|
40
|
+
params: {},
|
|
41
|
+
it
|
|
42
|
+
};
|
|
43
|
+
(0, errors_1.reportError)(cxt, boolError, void 0, overrideAllErrors);
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
//#endregion
|
|
47
|
+
export default require_boolSchema();
|
|
48
|
+
export { require_boolSchema };
|
|
@@ -0,0 +1,172 @@
|
|
|
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_errors } from "../errors.js";
|
|
5
|
+
import { require_rules } from "../rules.js";
|
|
6
|
+
import { require_applicability } from "./applicability.js";
|
|
7
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js
|
|
8
|
+
var require_dataType = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0;
|
|
11
|
+
const rules_1 = require_rules();
|
|
12
|
+
const applicability_1 = require_applicability();
|
|
13
|
+
const errors_1 = require_errors();
|
|
14
|
+
const codegen_1 = require_codegen();
|
|
15
|
+
const util_1 = require_util();
|
|
16
|
+
var DataType;
|
|
17
|
+
(function(DataType) {
|
|
18
|
+
DataType[DataType["Correct"] = 0] = "Correct";
|
|
19
|
+
DataType[DataType["Wrong"] = 1] = "Wrong";
|
|
20
|
+
})(DataType || (exports.DataType = DataType = {}));
|
|
21
|
+
function getSchemaTypes(schema) {
|
|
22
|
+
const types = getJSONTypes(schema.type);
|
|
23
|
+
if (types.includes("null")) {
|
|
24
|
+
if (schema.nullable === false) throw new Error("type: null contradicts nullable: false");
|
|
25
|
+
} else {
|
|
26
|
+
if (!types.length && schema.nullable !== void 0) throw new Error("\"nullable\" cannot be used without \"type\"");
|
|
27
|
+
if (schema.nullable === true) types.push("null");
|
|
28
|
+
}
|
|
29
|
+
return types;
|
|
30
|
+
}
|
|
31
|
+
exports.getSchemaTypes = getSchemaTypes;
|
|
32
|
+
function getJSONTypes(ts) {
|
|
33
|
+
const types = Array.isArray(ts) ? ts : ts ? [ts] : [];
|
|
34
|
+
if (types.every(rules_1.isJSONType)) return types;
|
|
35
|
+
throw new Error("type must be JSONType or JSONType[]: " + types.join(","));
|
|
36
|
+
}
|
|
37
|
+
exports.getJSONTypes = getJSONTypes;
|
|
38
|
+
function coerceAndCheckDataType(it, types) {
|
|
39
|
+
const { gen, data, opts } = it;
|
|
40
|
+
const coerceTo = coerceToTypes(types, opts.coerceTypes);
|
|
41
|
+
const checkTypes = types.length > 0 && !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0]));
|
|
42
|
+
if (checkTypes) {
|
|
43
|
+
const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong);
|
|
44
|
+
gen.if(wrongType, () => {
|
|
45
|
+
if (coerceTo.length) coerceData(it, types, coerceTo);
|
|
46
|
+
else reportTypeError(it);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return checkTypes;
|
|
50
|
+
}
|
|
51
|
+
exports.coerceAndCheckDataType = coerceAndCheckDataType;
|
|
52
|
+
const COERCIBLE = new Set([
|
|
53
|
+
"string",
|
|
54
|
+
"number",
|
|
55
|
+
"integer",
|
|
56
|
+
"boolean",
|
|
57
|
+
"null"
|
|
58
|
+
]);
|
|
59
|
+
function coerceToTypes(types, coerceTypes) {
|
|
60
|
+
return coerceTypes ? types.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
|
|
61
|
+
}
|
|
62
|
+
function coerceData(it, types, coerceTo) {
|
|
63
|
+
const { gen, data, opts } = it;
|
|
64
|
+
const dataType = gen.let("dataType", (0, codegen_1._)`typeof ${data}`);
|
|
65
|
+
const coerced = gen.let("coerced", (0, codegen_1._)`undefined`);
|
|
66
|
+
if (opts.coerceTypes === "array") gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)));
|
|
67
|
+
gen.if((0, codegen_1._)`${coerced} !== undefined`);
|
|
68
|
+
for (const t of coerceTo) if (COERCIBLE.has(t) || t === "array" && opts.coerceTypes === "array") coerceSpecificType(t);
|
|
69
|
+
gen.else();
|
|
70
|
+
reportTypeError(it);
|
|
71
|
+
gen.endIf();
|
|
72
|
+
gen.if((0, codegen_1._)`${coerced} !== undefined`, () => {
|
|
73
|
+
gen.assign(data, coerced);
|
|
74
|
+
assignParentData(it, coerced);
|
|
75
|
+
});
|
|
76
|
+
function coerceSpecificType(t) {
|
|
77
|
+
switch (t) {
|
|
78
|
+
case "string":
|
|
79
|
+
gen.elseIf((0, codegen_1._)`${dataType} == "number" || ${dataType} == "boolean"`).assign(coerced, (0, codegen_1._)`"" + ${data}`).elseIf((0, codegen_1._)`${data} === null`).assign(coerced, (0, codegen_1._)`""`);
|
|
80
|
+
return;
|
|
81
|
+
case "number":
|
|
82
|
+
gen.elseIf((0, codegen_1._)`${dataType} == "boolean" || ${data} === null
|
|
83
|
+
|| (${dataType} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1._)`+${data}`);
|
|
84
|
+
return;
|
|
85
|
+
case "integer":
|
|
86
|
+
gen.elseIf((0, codegen_1._)`${dataType} === "boolean" || ${data} === null
|
|
87
|
+
|| (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1._)`+${data}`);
|
|
88
|
+
return;
|
|
89
|
+
case "boolean":
|
|
90
|
+
gen.elseIf((0, codegen_1._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
|
|
91
|
+
return;
|
|
92
|
+
case "null":
|
|
93
|
+
gen.elseIf((0, codegen_1._)`${data} === "" || ${data} === 0 || ${data} === false`);
|
|
94
|
+
gen.assign(coerced, null);
|
|
95
|
+
return;
|
|
96
|
+
case "array": gen.elseIf((0, codegen_1._)`${dataType} === "string" || ${dataType} === "number"
|
|
97
|
+
|| ${dataType} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1._)`[${data}]`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function assignParentData({ gen, parentData, parentDataProperty }, expr) {
|
|
102
|
+
gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr));
|
|
103
|
+
}
|
|
104
|
+
function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
|
105
|
+
const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
|
|
106
|
+
let cond;
|
|
107
|
+
switch (dataType) {
|
|
108
|
+
case "null": return (0, codegen_1._)`${data} ${EQ} null`;
|
|
109
|
+
case "array":
|
|
110
|
+
cond = (0, codegen_1._)`Array.isArray(${data})`;
|
|
111
|
+
break;
|
|
112
|
+
case "object":
|
|
113
|
+
cond = (0, codegen_1._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
|
|
114
|
+
break;
|
|
115
|
+
case "integer":
|
|
116
|
+
cond = numCond((0, codegen_1._)`!(${data} % 1) && !isNaN(${data})`);
|
|
117
|
+
break;
|
|
118
|
+
case "number":
|
|
119
|
+
cond = numCond();
|
|
120
|
+
break;
|
|
121
|
+
default: return (0, codegen_1._)`typeof ${data} ${EQ} ${dataType}`;
|
|
122
|
+
}
|
|
123
|
+
return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
|
|
124
|
+
function numCond(_cond = codegen_1.nil) {
|
|
125
|
+
return (0, codegen_1.and)((0, codegen_1._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._)`isFinite(${data})` : codegen_1.nil);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.checkDataType = checkDataType;
|
|
129
|
+
function checkDataTypes(dataTypes, data, strictNums, correct) {
|
|
130
|
+
if (dataTypes.length === 1) return checkDataType(dataTypes[0], data, strictNums, correct);
|
|
131
|
+
let cond;
|
|
132
|
+
const types = (0, util_1.toHash)(dataTypes);
|
|
133
|
+
if (types.array && types.object) {
|
|
134
|
+
const notObj = (0, codegen_1._)`typeof ${data} != "object"`;
|
|
135
|
+
cond = types.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`;
|
|
136
|
+
delete types.null;
|
|
137
|
+
delete types.array;
|
|
138
|
+
delete types.object;
|
|
139
|
+
} else cond = codegen_1.nil;
|
|
140
|
+
if (types.number) delete types.integer;
|
|
141
|
+
for (const t in types) cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
|
|
142
|
+
return cond;
|
|
143
|
+
}
|
|
144
|
+
exports.checkDataTypes = checkDataTypes;
|
|
145
|
+
const typeError = {
|
|
146
|
+
message: ({ schema }) => `must be ${schema}`,
|
|
147
|
+
params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._)`{type: ${schema}}` : (0, codegen_1._)`{type: ${schemaValue}}`
|
|
148
|
+
};
|
|
149
|
+
function reportTypeError(it) {
|
|
150
|
+
const cxt = getTypeErrorContext(it);
|
|
151
|
+
(0, errors_1.reportError)(cxt, typeError);
|
|
152
|
+
}
|
|
153
|
+
exports.reportTypeError = reportTypeError;
|
|
154
|
+
function getTypeErrorContext(it) {
|
|
155
|
+
const { gen, data, schema } = it;
|
|
156
|
+
const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type");
|
|
157
|
+
return {
|
|
158
|
+
gen,
|
|
159
|
+
keyword: "type",
|
|
160
|
+
data,
|
|
161
|
+
schema: schema.type,
|
|
162
|
+
schemaCode,
|
|
163
|
+
schemaValue: schemaCode,
|
|
164
|
+
parentSchema: schema,
|
|
165
|
+
params: {},
|
|
166
|
+
it
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
//#endregion
|
|
171
|
+
export default require_dataType();
|
|
172
|
+
export { require_dataType };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_codegen } from "../codegen/index.js";
|
|
3
|
+
import { require_util } from "../util.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js
|
|
5
|
+
var require_defaults = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.assignDefaults = void 0;
|
|
8
|
+
const codegen_1 = require_codegen();
|
|
9
|
+
const util_1 = require_util();
|
|
10
|
+
function assignDefaults(it, ty) {
|
|
11
|
+
const { properties, items } = it.schema;
|
|
12
|
+
if (ty === "object" && properties) for (const key in properties) assignDefault(it, key, properties[key].default);
|
|
13
|
+
else if (ty === "array" && Array.isArray(items)) items.forEach((sch, i) => assignDefault(it, i, sch.default));
|
|
14
|
+
}
|
|
15
|
+
exports.assignDefaults = assignDefaults;
|
|
16
|
+
function assignDefault(it, prop, defaultValue) {
|
|
17
|
+
const { gen, compositeRule, data, opts } = it;
|
|
18
|
+
if (defaultValue === void 0) return;
|
|
19
|
+
const childData = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(prop)}`;
|
|
20
|
+
if (compositeRule) {
|
|
21
|
+
(0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
let condition = (0, codegen_1._)`${childData} === undefined`;
|
|
25
|
+
if (opts.useDefaults === "empty") condition = (0, codegen_1._)`${condition} || ${childData} === null || ${childData} === ""`;
|
|
26
|
+
gen.if(condition, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
//#endregion
|
|
30
|
+
export default require_defaults();
|
|
31
|
+
export { require_defaults };
|