@lakphy/local-router 0.2.0 → 0.3.0
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/cli.js +1043 -40
- package/dist/entry.js +758 -207
- package/package.json +1 -1
package/dist/entry.js
CHANGED
|
@@ -2093,13 +2093,13 @@ var require_code = __commonJS((exports) => {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
get str() {
|
|
2095
2095
|
var _a21;
|
|
2096
|
-
return (_a21 = this._str) !== null && _a21 !== undefined ? _a21 : this._str = this._items.reduce((s,
|
|
2096
|
+
return (_a21 = this._str) !== null && _a21 !== undefined ? _a21 : this._str = this._items.reduce((s, c2) => `${s}${c2}`, "");
|
|
2097
2097
|
}
|
|
2098
2098
|
get names() {
|
|
2099
2099
|
var _a21;
|
|
2100
|
-
return (_a21 = this._names) !== null && _a21 !== undefined ? _a21 : this._names = this._items.reduce((names,
|
|
2101
|
-
if (
|
|
2102
|
-
names[
|
|
2100
|
+
return (_a21 = this._names) !== null && _a21 !== undefined ? _a21 : this._names = this._items.reduce((names, c2) => {
|
|
2101
|
+
if (c2 instanceof Name)
|
|
2102
|
+
names[c2.str] = (names[c2.str] || 0) + 1;
|
|
2103
2103
|
return names;
|
|
2104
2104
|
}, {});
|
|
2105
2105
|
}
|
|
@@ -2177,23 +2177,23 @@ var require_code = __commonJS((exports) => {
|
|
|
2177
2177
|
function interpolate(x) {
|
|
2178
2178
|
return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify(Array.isArray(x) ? x.join(",") : x);
|
|
2179
2179
|
}
|
|
2180
|
-
function
|
|
2180
|
+
function stringify3(x) {
|
|
2181
2181
|
return new _Code(safeStringify(x));
|
|
2182
2182
|
}
|
|
2183
|
-
exports.stringify =
|
|
2183
|
+
exports.stringify = stringify3;
|
|
2184
2184
|
function safeStringify(x) {
|
|
2185
2185
|
return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
2186
2186
|
}
|
|
2187
2187
|
exports.safeStringify = safeStringify;
|
|
2188
|
-
function getProperty(
|
|
2189
|
-
return typeof
|
|
2188
|
+
function getProperty(key2) {
|
|
2189
|
+
return typeof key2 == "string" && exports.IDENTIFIER.test(key2) ? new _Code(`.${key2}`) : _`[${key2}]`;
|
|
2190
2190
|
}
|
|
2191
2191
|
exports.getProperty = getProperty;
|
|
2192
|
-
function getEsmExportName(
|
|
2193
|
-
if (typeof
|
|
2194
|
-
return new _Code(`${
|
|
2192
|
+
function getEsmExportName(key2) {
|
|
2193
|
+
if (typeof key2 == "string" && exports.IDENTIFIER.test(key2)) {
|
|
2194
|
+
return new _Code(`${key2}`);
|
|
2195
2195
|
}
|
|
2196
|
-
throw new Error(`CodeGen: invalid export name: ${
|
|
2196
|
+
throw new Error(`CodeGen: invalid export name: ${key2}, use explicit $id name mapping`);
|
|
2197
2197
|
}
|
|
2198
2198
|
exports.getEsmExportName = getEsmExportName;
|
|
2199
2199
|
function regexpCode(rx) {
|
|
@@ -2262,14 +2262,14 @@ var require_scope = __commonJS((exports) => {
|
|
|
2262
2262
|
}
|
|
2263
2263
|
}
|
|
2264
2264
|
exports.ValueScopeName = ValueScopeName;
|
|
2265
|
-
var
|
|
2265
|
+
var line2 = (0, code_1._)`\n`;
|
|
2266
2266
|
|
|
2267
2267
|
class ValueScope extends Scope {
|
|
2268
2268
|
constructor(opts) {
|
|
2269
2269
|
super(opts);
|
|
2270
2270
|
this._values = {};
|
|
2271
2271
|
this._scope = opts.scope;
|
|
2272
|
-
this.opts = { ...opts, _n: opts.lines ?
|
|
2272
|
+
this.opts = { ...opts, _n: opts.lines ? line2 : code_1.nil };
|
|
2273
2273
|
}
|
|
2274
2274
|
get() {
|
|
2275
2275
|
return this._scope;
|
|
@@ -2330,12 +2330,12 @@ var require_scope = __commonJS((exports) => {
|
|
|
2330
2330
|
if (nameSet.has(name21))
|
|
2331
2331
|
return;
|
|
2332
2332
|
nameSet.set(name21, UsedValueState.Started);
|
|
2333
|
-
let
|
|
2334
|
-
if (
|
|
2333
|
+
let c2 = valueCode(name21);
|
|
2334
|
+
if (c2) {
|
|
2335
2335
|
const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
|
|
2336
|
-
code = (0, code_1._)`${code}${def} ${name21} = ${
|
|
2337
|
-
} else if (
|
|
2338
|
-
code = (0, code_1._)`${code}${
|
|
2336
|
+
code = (0, code_1._)`${code}${def} ${name21} = ${c2};${this.opts._n}`;
|
|
2337
|
+
} else if (c2 = getCode === null || getCode === undefined ? undefined : getCode(name21)) {
|
|
2338
|
+
code = (0, code_1._)`${code}${c2}${this.opts._n}`;
|
|
2339
2339
|
} else {
|
|
2340
2340
|
throw new ValueError(name21);
|
|
2341
2341
|
}
|
|
@@ -2405,7 +2405,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2405
2405
|
ADD: new code_1._Code("+")
|
|
2406
2406
|
};
|
|
2407
2407
|
|
|
2408
|
-
class
|
|
2408
|
+
class Node3 {
|
|
2409
2409
|
optimizeNodes() {
|
|
2410
2410
|
return this;
|
|
2411
2411
|
}
|
|
@@ -2414,7 +2414,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2414
2414
|
}
|
|
2415
2415
|
}
|
|
2416
2416
|
|
|
2417
|
-
class Def extends
|
|
2417
|
+
class Def extends Node3 {
|
|
2418
2418
|
constructor(varKind, name21, rhs) {
|
|
2419
2419
|
super();
|
|
2420
2420
|
this.varKind = varKind;
|
|
@@ -2438,7 +2438,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2438
2438
|
}
|
|
2439
2439
|
}
|
|
2440
2440
|
|
|
2441
|
-
class Assign extends
|
|
2441
|
+
class Assign extends Node3 {
|
|
2442
2442
|
constructor(lhs, rhs, sideEffects) {
|
|
2443
2443
|
super();
|
|
2444
2444
|
this.lhs = lhs;
|
|
@@ -2470,7 +2470,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2470
2470
|
}
|
|
2471
2471
|
}
|
|
2472
2472
|
|
|
2473
|
-
class Label extends
|
|
2473
|
+
class Label extends Node3 {
|
|
2474
2474
|
constructor(label) {
|
|
2475
2475
|
super();
|
|
2476
2476
|
this.label = label;
|
|
@@ -2481,7 +2481,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2481
2481
|
}
|
|
2482
2482
|
}
|
|
2483
2483
|
|
|
2484
|
-
class Break extends
|
|
2484
|
+
class Break extends Node3 {
|
|
2485
2485
|
constructor(label) {
|
|
2486
2486
|
super();
|
|
2487
2487
|
this.label = label;
|
|
@@ -2493,7 +2493,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2493
2493
|
}
|
|
2494
2494
|
}
|
|
2495
2495
|
|
|
2496
|
-
class Throw extends
|
|
2496
|
+
class Throw extends Node3 {
|
|
2497
2497
|
constructor(error48) {
|
|
2498
2498
|
super();
|
|
2499
2499
|
this.error = error48;
|
|
@@ -2506,7 +2506,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2506
2506
|
}
|
|
2507
2507
|
}
|
|
2508
2508
|
|
|
2509
|
-
class AnyCode extends
|
|
2509
|
+
class AnyCode extends Node3 {
|
|
2510
2510
|
constructor(code) {
|
|
2511
2511
|
super();
|
|
2512
2512
|
this.code = code;
|
|
@@ -2526,7 +2526,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2526
2526
|
}
|
|
2527
2527
|
}
|
|
2528
2528
|
|
|
2529
|
-
class ParentNode extends
|
|
2529
|
+
class ParentNode extends Node3 {
|
|
2530
2530
|
constructor(nodes = []) {
|
|
2531
2531
|
super();
|
|
2532
2532
|
this.nodes = nodes;
|
|
@@ -2821,20 +2821,20 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2821
2821
|
add(lhs, rhs) {
|
|
2822
2822
|
return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs));
|
|
2823
2823
|
}
|
|
2824
|
-
code(
|
|
2825
|
-
if (typeof
|
|
2826
|
-
|
|
2827
|
-
else if (
|
|
2828
|
-
this._leafNode(new AnyCode(
|
|
2824
|
+
code(c2) {
|
|
2825
|
+
if (typeof c2 == "function")
|
|
2826
|
+
c2();
|
|
2827
|
+
else if (c2 !== code_1.nil)
|
|
2828
|
+
this._leafNode(new AnyCode(c2));
|
|
2829
2829
|
return this;
|
|
2830
2830
|
}
|
|
2831
2831
|
object(...keyValues) {
|
|
2832
2832
|
const code = ["{"];
|
|
2833
|
-
for (const [
|
|
2833
|
+
for (const [key2, value] of keyValues) {
|
|
2834
2834
|
if (code.length > 1)
|
|
2835
2835
|
code.push(",");
|
|
2836
|
-
code.push(
|
|
2837
|
-
if (
|
|
2836
|
+
code.push(key2);
|
|
2837
|
+
if (key2 !== value || this.opts.es5) {
|
|
2838
2838
|
code.push(":");
|
|
2839
2839
|
(0, code_1.addCodeArg)(code, value);
|
|
2840
2840
|
}
|
|
@@ -3012,24 +3012,24 @@ var require_codegen = __commonJS((exports) => {
|
|
|
3012
3012
|
return replaceName(expr);
|
|
3013
3013
|
if (!canOptimize(expr))
|
|
3014
3014
|
return expr;
|
|
3015
|
-
return new code_1._Code(expr._items.reduce((items,
|
|
3016
|
-
if (
|
|
3017
|
-
|
|
3018
|
-
if (
|
|
3019
|
-
items.push(...
|
|
3015
|
+
return new code_1._Code(expr._items.reduce((items, c2) => {
|
|
3016
|
+
if (c2 instanceof code_1.Name)
|
|
3017
|
+
c2 = replaceName(c2);
|
|
3018
|
+
if (c2 instanceof code_1._Code)
|
|
3019
|
+
items.push(...c2._items);
|
|
3020
3020
|
else
|
|
3021
|
-
items.push(
|
|
3021
|
+
items.push(c2);
|
|
3022
3022
|
return items;
|
|
3023
3023
|
}, []));
|
|
3024
3024
|
function replaceName(n) {
|
|
3025
|
-
const
|
|
3026
|
-
if (
|
|
3025
|
+
const c2 = constants[n.str];
|
|
3026
|
+
if (c2 === undefined || names[n.str] !== 1)
|
|
3027
3027
|
return n;
|
|
3028
3028
|
delete names[n.str];
|
|
3029
|
-
return
|
|
3029
|
+
return c2;
|
|
3030
3030
|
}
|
|
3031
3031
|
function canOptimize(e) {
|
|
3032
|
-
return e instanceof code_1._Code && e._items.some((
|
|
3032
|
+
return e instanceof code_1._Code && e._items.some((c2) => c2 instanceof code_1.Name && names[c2.str] === 1 && constants[c2.str] !== undefined);
|
|
3033
3033
|
}
|
|
3034
3034
|
}
|
|
3035
3035
|
function subtractNames(names, from) {
|
|
@@ -3087,17 +3087,17 @@ var require_util = __commonJS((exports) => {
|
|
|
3087
3087
|
if (typeof schema === "boolean")
|
|
3088
3088
|
return;
|
|
3089
3089
|
const rules = self.RULES.keywords;
|
|
3090
|
-
for (const
|
|
3091
|
-
if (!rules[
|
|
3092
|
-
checkStrictMode(it, `unknown keyword: "${
|
|
3090
|
+
for (const key2 in schema) {
|
|
3091
|
+
if (!rules[key2])
|
|
3092
|
+
checkStrictMode(it, `unknown keyword: "${key2}"`);
|
|
3093
3093
|
}
|
|
3094
3094
|
}
|
|
3095
3095
|
exports.checkUnknownRules = checkUnknownRules;
|
|
3096
3096
|
function schemaHasRules(schema, rules) {
|
|
3097
3097
|
if (typeof schema == "boolean")
|
|
3098
3098
|
return !schema;
|
|
3099
|
-
for (const
|
|
3100
|
-
if (rules[
|
|
3099
|
+
for (const key2 in schema)
|
|
3100
|
+
if (rules[key2])
|
|
3101
3101
|
return true;
|
|
3102
3102
|
return false;
|
|
3103
3103
|
}
|
|
@@ -3105,8 +3105,8 @@ var require_util = __commonJS((exports) => {
|
|
|
3105
3105
|
function schemaHasRulesButRef(schema, RULES) {
|
|
3106
3106
|
if (typeof schema == "boolean")
|
|
3107
3107
|
return !schema;
|
|
3108
|
-
for (const
|
|
3109
|
-
if (
|
|
3108
|
+
for (const key2 in schema)
|
|
3109
|
+
if (key2 !== "$ref" && RULES.all[key2])
|
|
3110
3110
|
return true;
|
|
3111
3111
|
return false;
|
|
3112
3112
|
}
|
|
@@ -3651,8 +3651,8 @@ var require_defaults = __commonJS((exports) => {
|
|
|
3651
3651
|
function assignDefaults(it, ty) {
|
|
3652
3652
|
const { properties, items } = it.schema;
|
|
3653
3653
|
if (ty === "object" && properties) {
|
|
3654
|
-
for (const
|
|
3655
|
-
assignDefault(it,
|
|
3654
|
+
for (const key2 in properties) {
|
|
3655
|
+
assignDefault(it, key2, properties[key2].default);
|
|
3656
3656
|
}
|
|
3657
3657
|
} else if (ty === "array" && Array.isArray(items)) {
|
|
3658
3658
|
items.forEach((sch, i) => assignDefault(it, i, sch.default));
|
|
@@ -4032,8 +4032,8 @@ var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
|
4032
4032
|
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
4033
4033
|
return false;
|
|
4034
4034
|
for (i = length;i-- !== 0; ) {
|
|
4035
|
-
var
|
|
4036
|
-
if (!equal(a[
|
|
4035
|
+
var key2 = keys[i];
|
|
4036
|
+
if (!equal(a[key2], b[key2]))
|
|
4037
4037
|
return false;
|
|
4038
4038
|
}
|
|
4039
4039
|
return true;
|
|
@@ -4101,20 +4101,20 @@ var require_json_schema_traverse = __commonJS((exports, module) => {
|
|
|
4101
4101
|
function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
4102
4102
|
if (schema && typeof schema == "object" && !Array.isArray(schema)) {
|
|
4103
4103
|
pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
4104
|
-
for (var
|
|
4105
|
-
var sch = schema[
|
|
4104
|
+
for (var key2 in schema) {
|
|
4105
|
+
var sch = schema[key2];
|
|
4106
4106
|
if (Array.isArray(sch)) {
|
|
4107
|
-
if (
|
|
4107
|
+
if (key2 in traverse.arrayKeywords) {
|
|
4108
4108
|
for (var i = 0;i < sch.length; i++)
|
|
4109
|
-
_traverse(opts, pre, post, sch[i], jsonPtr + "/" +
|
|
4109
|
+
_traverse(opts, pre, post, sch[i], jsonPtr + "/" + key2 + "/" + i, rootSchema, jsonPtr, key2, schema, i);
|
|
4110
4110
|
}
|
|
4111
|
-
} else if (
|
|
4111
|
+
} else if (key2 in traverse.propsKeywords) {
|
|
4112
4112
|
if (sch && typeof sch == "object") {
|
|
4113
4113
|
for (var prop in sch)
|
|
4114
|
-
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" +
|
|
4114
|
+
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key2 + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key2, schema, prop);
|
|
4115
4115
|
}
|
|
4116
|
-
} else if (
|
|
4117
|
-
_traverse(opts, pre, post, sch, jsonPtr + "/" +
|
|
4116
|
+
} else if (key2 in traverse.keywords || opts.allKeys && !(key2 in traverse.skipKeywords)) {
|
|
4117
|
+
_traverse(opts, pre, post, sch, jsonPtr + "/" + key2, rootSchema, jsonPtr, key2, schema);
|
|
4118
4118
|
}
|
|
4119
4119
|
}
|
|
4120
4120
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
@@ -4168,10 +4168,10 @@ var require_resolve = __commonJS((exports) => {
|
|
|
4168
4168
|
"$dynamicAnchor"
|
|
4169
4169
|
]);
|
|
4170
4170
|
function hasRef(schema) {
|
|
4171
|
-
for (const
|
|
4172
|
-
if (REF_KEYWORDS.has(
|
|
4171
|
+
for (const key2 in schema) {
|
|
4172
|
+
if (REF_KEYWORDS.has(key2))
|
|
4173
4173
|
return true;
|
|
4174
|
-
const sch = schema[
|
|
4174
|
+
const sch = schema[key2];
|
|
4175
4175
|
if (Array.isArray(sch) && sch.some(hasRef))
|
|
4176
4176
|
return true;
|
|
4177
4177
|
if (typeof sch == "object" && hasRef(sch))
|
|
@@ -4181,14 +4181,14 @@ var require_resolve = __commonJS((exports) => {
|
|
|
4181
4181
|
}
|
|
4182
4182
|
function countKeys(schema) {
|
|
4183
4183
|
let count = 0;
|
|
4184
|
-
for (const
|
|
4185
|
-
if (
|
|
4184
|
+
for (const key2 in schema) {
|
|
4185
|
+
if (key2 === "$ref")
|
|
4186
4186
|
return Infinity;
|
|
4187
4187
|
count++;
|
|
4188
|
-
if (SIMPLE_INLINED.has(
|
|
4188
|
+
if (SIMPLE_INLINED.has(key2))
|
|
4189
4189
|
continue;
|
|
4190
|
-
if (typeof schema[
|
|
4191
|
-
(0, util_1.eachItem)(schema[
|
|
4190
|
+
if (typeof schema[key2] == "object") {
|
|
4191
|
+
(0, util_1.eachItem)(schema[key2], (sch) => count += countKeys(sch));
|
|
4192
4192
|
}
|
|
4193
4193
|
if (count === Infinity)
|
|
4194
4194
|
return Infinity;
|
|
@@ -4374,8 +4374,8 @@ var require_validate = __commonJS((exports) => {
|
|
|
4374
4374
|
function schemaCxtHasRules({ schema, self }) {
|
|
4375
4375
|
if (typeof schema == "boolean")
|
|
4376
4376
|
return !schema;
|
|
4377
|
-
for (const
|
|
4378
|
-
if (self.RULES.all[
|
|
4377
|
+
for (const key2 in schema)
|
|
4378
|
+
if (self.RULES.all[key2])
|
|
4379
4379
|
return true;
|
|
4380
4380
|
return false;
|
|
4381
4381
|
}
|
|
@@ -4928,22 +4928,22 @@ var require_compile = __commonJS((exports) => {
|
|
|
4928
4928
|
}
|
|
4929
4929
|
}
|
|
4930
4930
|
exports.compileSchema = compileSchema;
|
|
4931
|
-
function resolveRef2(
|
|
4931
|
+
function resolveRef2(root2, baseId, ref) {
|
|
4932
4932
|
var _a21;
|
|
4933
4933
|
ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
|
|
4934
|
-
const schOrFunc =
|
|
4934
|
+
const schOrFunc = root2.refs[ref];
|
|
4935
4935
|
if (schOrFunc)
|
|
4936
4936
|
return schOrFunc;
|
|
4937
|
-
let _sch =
|
|
4937
|
+
let _sch = resolve5.call(this, root2, ref);
|
|
4938
4938
|
if (_sch === undefined) {
|
|
4939
|
-
const schema = (_a21 =
|
|
4939
|
+
const schema = (_a21 = root2.localRefs) === null || _a21 === undefined ? undefined : _a21[ref];
|
|
4940
4940
|
const { schemaId } = this.opts;
|
|
4941
4941
|
if (schema)
|
|
4942
|
-
_sch = new SchemaEnv({ schema, schemaId, root, baseId });
|
|
4942
|
+
_sch = new SchemaEnv({ schema, schemaId, root: root2, baseId });
|
|
4943
4943
|
}
|
|
4944
4944
|
if (_sch === undefined)
|
|
4945
4945
|
return;
|
|
4946
|
-
return
|
|
4946
|
+
return root2.refs[ref] = inlineOrCompile.call(this, _sch);
|
|
4947
4947
|
}
|
|
4948
4948
|
exports.resolveRef = resolveRef2;
|
|
4949
4949
|
function inlineOrCompile(sch) {
|
|
@@ -4961,23 +4961,23 @@ var require_compile = __commonJS((exports) => {
|
|
|
4961
4961
|
function sameSchemaEnv(s1, s2) {
|
|
4962
4962
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
4963
4963
|
}
|
|
4964
|
-
function
|
|
4964
|
+
function resolve5(root2, ref) {
|
|
4965
4965
|
let sch;
|
|
4966
4966
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
4967
4967
|
ref = sch;
|
|
4968
|
-
return sch || this.schemas[ref] || resolveSchema.call(this,
|
|
4968
|
+
return sch || this.schemas[ref] || resolveSchema.call(this, root2, ref);
|
|
4969
4969
|
}
|
|
4970
|
-
function resolveSchema(
|
|
4970
|
+
function resolveSchema(root2, ref) {
|
|
4971
4971
|
const p = this.opts.uriResolver.parse(ref);
|
|
4972
4972
|
const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);
|
|
4973
|
-
let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver,
|
|
4974
|
-
if (Object.keys(
|
|
4975
|
-
return getJsonPointer.call(this, p,
|
|
4973
|
+
let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root2.baseId, undefined);
|
|
4974
|
+
if (Object.keys(root2.schema).length > 0 && refPath === baseId) {
|
|
4975
|
+
return getJsonPointer.call(this, p, root2);
|
|
4976
4976
|
}
|
|
4977
4977
|
const id = (0, resolve_1.normalizeId)(refPath);
|
|
4978
4978
|
const schOrRef = this.refs[id] || this.schemas[id];
|
|
4979
4979
|
if (typeof schOrRef == "string") {
|
|
4980
|
-
const sch = resolveSchema.call(this,
|
|
4980
|
+
const sch = resolveSchema.call(this, root2, schOrRef);
|
|
4981
4981
|
if (typeof (sch === null || sch === undefined ? undefined : sch.schema) !== "object")
|
|
4982
4982
|
return;
|
|
4983
4983
|
return getJsonPointer.call(this, p, sch);
|
|
@@ -4992,7 +4992,7 @@ var require_compile = __commonJS((exports) => {
|
|
|
4992
4992
|
const schId = schema[schemaId];
|
|
4993
4993
|
if (schId)
|
|
4994
4994
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
4995
|
-
return new SchemaEnv({ schema, schemaId, root, baseId });
|
|
4995
|
+
return new SchemaEnv({ schema, schemaId, root: root2, baseId });
|
|
4996
4996
|
}
|
|
4997
4997
|
return getJsonPointer.call(this, p, schOrRef);
|
|
4998
4998
|
}
|
|
@@ -5004,7 +5004,7 @@ var require_compile = __commonJS((exports) => {
|
|
|
5004
5004
|
"dependencies",
|
|
5005
5005
|
"definitions"
|
|
5006
5006
|
]);
|
|
5007
|
-
function getJsonPointer(parsedRef, { baseId, schema, root }) {
|
|
5007
|
+
function getJsonPointer(parsedRef, { baseId, schema, root: root2 }) {
|
|
5008
5008
|
var _a21;
|
|
5009
5009
|
if (((_a21 = parsedRef.fragment) === null || _a21 === undefined ? undefined : _a21[0]) !== "/")
|
|
5010
5010
|
return;
|
|
@@ -5023,10 +5023,10 @@ var require_compile = __commonJS((exports) => {
|
|
|
5023
5023
|
let env;
|
|
5024
5024
|
if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) {
|
|
5025
5025
|
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref);
|
|
5026
|
-
env = resolveSchema.call(this,
|
|
5026
|
+
env = resolveSchema.call(this, root2, $ref);
|
|
5027
5027
|
}
|
|
5028
5028
|
const { schemaId } = this.opts;
|
|
5029
|
-
env = env || new SchemaEnv({ schema, schemaId, root, baseId });
|
|
5029
|
+
env = env || new SchemaEnv({ schema, schemaId, root: root2, baseId });
|
|
5030
5030
|
if (env.schema !== env.root.schema)
|
|
5031
5031
|
return env;
|
|
5032
5032
|
return;
|
|
@@ -5079,20 +5079,20 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
5079
5079
|
return acc;
|
|
5080
5080
|
}
|
|
5081
5081
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
5082
|
-
function consumeIsZone(
|
|
5083
|
-
|
|
5082
|
+
function consumeIsZone(buffer2) {
|
|
5083
|
+
buffer2.length = 0;
|
|
5084
5084
|
return true;
|
|
5085
5085
|
}
|
|
5086
|
-
function consumeHextets(
|
|
5087
|
-
if (
|
|
5088
|
-
const hex3 = stringArrayToHexStripped(
|
|
5086
|
+
function consumeHextets(buffer2, address, output) {
|
|
5087
|
+
if (buffer2.length) {
|
|
5088
|
+
const hex3 = stringArrayToHexStripped(buffer2);
|
|
5089
5089
|
if (hex3 !== "") {
|
|
5090
5090
|
address.push(hex3);
|
|
5091
5091
|
} else {
|
|
5092
5092
|
output.error = true;
|
|
5093
5093
|
return false;
|
|
5094
5094
|
}
|
|
5095
|
-
|
|
5095
|
+
buffer2.length = 0;
|
|
5096
5096
|
}
|
|
5097
5097
|
return true;
|
|
5098
5098
|
}
|
|
@@ -5100,7 +5100,7 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
5100
5100
|
let tokenCount = 0;
|
|
5101
5101
|
const output = { error: false, address: "", zone: "" };
|
|
5102
5102
|
const address = [];
|
|
5103
|
-
const
|
|
5103
|
+
const buffer2 = [];
|
|
5104
5104
|
let endipv6Encountered = false;
|
|
5105
5105
|
let endIpv6 = false;
|
|
5106
5106
|
let consume = consumeHextets;
|
|
@@ -5113,7 +5113,7 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
5113
5113
|
if (endipv6Encountered === true) {
|
|
5114
5114
|
endIpv6 = true;
|
|
5115
5115
|
}
|
|
5116
|
-
if (!consume(
|
|
5116
|
+
if (!consume(buffer2, address, output)) {
|
|
5117
5117
|
break;
|
|
5118
5118
|
}
|
|
5119
5119
|
if (++tokenCount > 7) {
|
|
@@ -5126,22 +5126,22 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
5126
5126
|
address.push(":");
|
|
5127
5127
|
continue;
|
|
5128
5128
|
} else if (cursor === "%") {
|
|
5129
|
-
if (!consume(
|
|
5129
|
+
if (!consume(buffer2, address, output)) {
|
|
5130
5130
|
break;
|
|
5131
5131
|
}
|
|
5132
5132
|
consume = consumeIsZone;
|
|
5133
5133
|
} else {
|
|
5134
|
-
|
|
5134
|
+
buffer2.push(cursor);
|
|
5135
5135
|
continue;
|
|
5136
5136
|
}
|
|
5137
5137
|
}
|
|
5138
|
-
if (
|
|
5138
|
+
if (buffer2.length) {
|
|
5139
5139
|
if (consume === consumeIsZone) {
|
|
5140
|
-
output.zone =
|
|
5140
|
+
output.zone = buffer2.join("");
|
|
5141
5141
|
} else if (endIpv6) {
|
|
5142
|
-
address.push(
|
|
5142
|
+
address.push(buffer2.join(""));
|
|
5143
5143
|
} else {
|
|
5144
|
-
address.push(stringArrayToHexStripped(
|
|
5144
|
+
address.push(stringArrayToHexStripped(buffer2));
|
|
5145
5145
|
}
|
|
5146
5146
|
}
|
|
5147
5147
|
output.address = address.join("");
|
|
@@ -5164,10 +5164,10 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
5164
5164
|
return { host, isIPV6: false };
|
|
5165
5165
|
}
|
|
5166
5166
|
}
|
|
5167
|
-
function findToken(str,
|
|
5167
|
+
function findToken(str, token2) {
|
|
5168
5168
|
let ind = 0;
|
|
5169
5169
|
for (let i = 0;i < str.length; i++) {
|
|
5170
|
-
if (str[i] ===
|
|
5170
|
+
if (str[i] === token2)
|
|
5171
5171
|
ind++;
|
|
5172
5172
|
}
|
|
5173
5173
|
return ind;
|
|
@@ -5485,23 +5485,23 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
5485
5485
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
5486
5486
|
function normalize(uri, options) {
|
|
5487
5487
|
if (typeof uri === "string") {
|
|
5488
|
-
uri = serialize(
|
|
5488
|
+
uri = serialize(parse7(uri, options), options);
|
|
5489
5489
|
} else if (typeof uri === "object") {
|
|
5490
|
-
uri =
|
|
5490
|
+
uri = parse7(serialize(uri, options), options);
|
|
5491
5491
|
}
|
|
5492
5492
|
return uri;
|
|
5493
5493
|
}
|
|
5494
|
-
function
|
|
5494
|
+
function resolve5(baseURI, relativeURI, options) {
|
|
5495
5495
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
5496
|
-
const resolved = resolveComponent(
|
|
5496
|
+
const resolved = resolveComponent(parse7(baseURI, schemelessOptions), parse7(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
5497
5497
|
schemelessOptions.skipEscape = true;
|
|
5498
5498
|
return serialize(resolved, schemelessOptions);
|
|
5499
5499
|
}
|
|
5500
5500
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
5501
5501
|
const target = {};
|
|
5502
5502
|
if (!skipNormalization) {
|
|
5503
|
-
base =
|
|
5504
|
-
relative =
|
|
5503
|
+
base = parse7(serialize(base, options), options);
|
|
5504
|
+
relative = parse7(serialize(relative, options), options);
|
|
5505
5505
|
}
|
|
5506
5506
|
options = options || {};
|
|
5507
5507
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -5553,13 +5553,13 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
5553
5553
|
function equal(uriA, uriB, options) {
|
|
5554
5554
|
if (typeof uriA === "string") {
|
|
5555
5555
|
uriA = unescape(uriA);
|
|
5556
|
-
uriA = serialize(normalizeComponentEncoding(
|
|
5556
|
+
uriA = serialize(normalizeComponentEncoding(parse7(uriA, options), true), { ...options, skipEscape: true });
|
|
5557
5557
|
} else if (typeof uriA === "object") {
|
|
5558
5558
|
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
5559
5559
|
}
|
|
5560
5560
|
if (typeof uriB === "string") {
|
|
5561
5561
|
uriB = unescape(uriB);
|
|
5562
|
-
uriB = serialize(normalizeComponentEncoding(
|
|
5562
|
+
uriB = serialize(normalizeComponentEncoding(parse7(uriB, options), true), { ...options, skipEscape: true });
|
|
5563
5563
|
} else if (typeof uriB === "object") {
|
|
5564
5564
|
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
5565
5565
|
}
|
|
@@ -5629,7 +5629,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
5629
5629
|
return uriTokens.join("");
|
|
5630
5630
|
}
|
|
5631
5631
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
5632
|
-
function
|
|
5632
|
+
function parse7(uri, opts) {
|
|
5633
5633
|
const options = Object.assign({}, opts);
|
|
5634
5634
|
const parsed = {
|
|
5635
5635
|
scheme: undefined,
|
|
@@ -5719,11 +5719,11 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
5719
5719
|
var fastUri = {
|
|
5720
5720
|
SCHEMES,
|
|
5721
5721
|
normalize,
|
|
5722
|
-
resolve:
|
|
5722
|
+
resolve: resolve5,
|
|
5723
5723
|
resolveComponent,
|
|
5724
5724
|
equal,
|
|
5725
5725
|
serialize,
|
|
5726
|
-
parse:
|
|
5726
|
+
parse: parse7
|
|
5727
5727
|
};
|
|
5728
5728
|
module.exports = fastUri;
|
|
5729
5729
|
module.exports.default = fastUri;
|
|
@@ -5856,7 +5856,7 @@ var require_core = __commonJS((exports) => {
|
|
|
5856
5856
|
opts = this.opts = { ...opts, ...requiredOptions(opts) };
|
|
5857
5857
|
const { es5, lines } = this.opts.code;
|
|
5858
5858
|
this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines });
|
|
5859
|
-
this.logger =
|
|
5859
|
+
this.logger = getLogger2(opts.logger);
|
|
5860
5860
|
const formatOpt = opts.validateFormats;
|
|
5861
5861
|
opts.validateFormats = false;
|
|
5862
5862
|
this.RULES = (0, rules_1.getRules)();
|
|
@@ -5960,7 +5960,7 @@ var require_core = __commonJS((exports) => {
|
|
|
5960
5960
|
}
|
|
5961
5961
|
}
|
|
5962
5962
|
}
|
|
5963
|
-
addSchema(schema,
|
|
5963
|
+
addSchema(schema, key2, _meta, _validateSchema = this.opts.validateSchema) {
|
|
5964
5964
|
if (Array.isArray(schema)) {
|
|
5965
5965
|
for (const sch of schema)
|
|
5966
5966
|
this.addSchema(sch, undefined, _meta, _validateSchema);
|
|
@@ -5974,13 +5974,13 @@ var require_core = __commonJS((exports) => {
|
|
|
5974
5974
|
throw new Error(`schema ${schemaId} must be string`);
|
|
5975
5975
|
}
|
|
5976
5976
|
}
|
|
5977
|
-
|
|
5978
|
-
this._checkUnique(
|
|
5979
|
-
this.schemas[
|
|
5977
|
+
key2 = (0, resolve_1.normalizeId)(key2 || id);
|
|
5978
|
+
this._checkUnique(key2);
|
|
5979
|
+
this.schemas[key2] = this._addSchema(schema, _meta, key2, _validateSchema, true);
|
|
5980
5980
|
return this;
|
|
5981
5981
|
}
|
|
5982
|
-
addMetaSchema(schema,
|
|
5983
|
-
this.addSchema(schema,
|
|
5982
|
+
addMetaSchema(schema, key2, _validateSchema = this.opts.validateSchema) {
|
|
5983
|
+
this.addSchema(schema, key2, true, _validateSchema);
|
|
5984
5984
|
return this;
|
|
5985
5985
|
}
|
|
5986
5986
|
validateSchema(schema, throwOrLogError) {
|
|
@@ -6013,8 +6013,8 @@ var require_core = __commonJS((exports) => {
|
|
|
6013
6013
|
keyRef = sch;
|
|
6014
6014
|
if (sch === undefined) {
|
|
6015
6015
|
const { schemaId } = this.opts;
|
|
6016
|
-
const
|
|
6017
|
-
sch = compile_1.resolveSchema.call(this,
|
|
6016
|
+
const root2 = new compile_1.SchemaEnv({ schema: {}, schemaId });
|
|
6017
|
+
sch = compile_1.resolveSchema.call(this, root2, keyRef);
|
|
6018
6018
|
if (!sch)
|
|
6019
6019
|
return;
|
|
6020
6020
|
this.refs[keyRef] = sch;
|
|
@@ -6126,14 +6126,14 @@ var require_core = __commonJS((exports) => {
|
|
|
6126
6126
|
let keywords = metaSchema;
|
|
6127
6127
|
for (const seg of segments)
|
|
6128
6128
|
keywords = keywords[seg];
|
|
6129
|
-
for (const
|
|
6130
|
-
const rule = rules[
|
|
6129
|
+
for (const key2 in rules) {
|
|
6130
|
+
const rule = rules[key2];
|
|
6131
6131
|
if (typeof rule != "object")
|
|
6132
6132
|
continue;
|
|
6133
6133
|
const { $data } = rule.definition;
|
|
6134
|
-
const schema = keywords[
|
|
6134
|
+
const schema = keywords[key2];
|
|
6135
6135
|
if ($data && schema)
|
|
6136
|
-
keywords[
|
|
6136
|
+
keywords[key2] = schemaOrData(schema);
|
|
6137
6137
|
}
|
|
6138
6138
|
}
|
|
6139
6139
|
return metaSchema;
|
|
@@ -6206,10 +6206,10 @@ var require_core = __commonJS((exports) => {
|
|
|
6206
6206
|
Ajv.MissingRefError = ref_error_1.default;
|
|
6207
6207
|
exports.default = Ajv;
|
|
6208
6208
|
function checkOptions(checkOpts, options, msg, log = "error") {
|
|
6209
|
-
for (const
|
|
6210
|
-
const opt =
|
|
6209
|
+
for (const key2 in checkOpts) {
|
|
6210
|
+
const opt = key2;
|
|
6211
6211
|
if (opt in options)
|
|
6212
|
-
this.logger[log](`${msg}: option ${
|
|
6212
|
+
this.logger[log](`${msg}: option ${key2}. ${checkOpts[opt]}`);
|
|
6213
6213
|
}
|
|
6214
6214
|
}
|
|
6215
6215
|
function getSchEnv(keyRef) {
|
|
@@ -6223,8 +6223,8 @@ var require_core = __commonJS((exports) => {
|
|
|
6223
6223
|
if (Array.isArray(optsSchemas))
|
|
6224
6224
|
this.addSchema(optsSchemas);
|
|
6225
6225
|
else
|
|
6226
|
-
for (const
|
|
6227
|
-
this.addSchema(optsSchemas[
|
|
6226
|
+
for (const key2 in optsSchemas)
|
|
6227
|
+
this.addSchema(optsSchemas[key2], key2);
|
|
6228
6228
|
}
|
|
6229
6229
|
function addInitialFormats() {
|
|
6230
6230
|
for (const name21 in this.opts.formats) {
|
|
@@ -6253,7 +6253,7 @@ var require_core = __commonJS((exports) => {
|
|
|
6253
6253
|
return metaOpts;
|
|
6254
6254
|
}
|
|
6255
6255
|
var noLogs = { log() {}, warn() {}, error() {} };
|
|
6256
|
-
function
|
|
6256
|
+
function getLogger2(logger) {
|
|
6257
6257
|
if (logger === false)
|
|
6258
6258
|
return noLogs;
|
|
6259
6259
|
if (logger === undefined)
|
|
@@ -6359,20 +6359,20 @@ var require_ref = __commonJS((exports) => {
|
|
|
6359
6359
|
code(cxt) {
|
|
6360
6360
|
const { gen, schema: $ref, it } = cxt;
|
|
6361
6361
|
const { baseId, schemaEnv: env, validateName, opts, self } = it;
|
|
6362
|
-
const { root } = env;
|
|
6363
|
-
if (($ref === "#" || $ref === "#/") && baseId ===
|
|
6362
|
+
const { root: root2 } = env;
|
|
6363
|
+
if (($ref === "#" || $ref === "#/") && baseId === root2.baseId)
|
|
6364
6364
|
return callRootRef();
|
|
6365
|
-
const schOrEnv = compile_1.resolveRef.call(self,
|
|
6365
|
+
const schOrEnv = compile_1.resolveRef.call(self, root2, baseId, $ref);
|
|
6366
6366
|
if (schOrEnv === undefined)
|
|
6367
6367
|
throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref);
|
|
6368
6368
|
if (schOrEnv instanceof compile_1.SchemaEnv)
|
|
6369
6369
|
return callValidate(schOrEnv);
|
|
6370
6370
|
return inlineRefSchema(schOrEnv);
|
|
6371
6371
|
function callRootRef() {
|
|
6372
|
-
if (env ===
|
|
6372
|
+
if (env === root2)
|
|
6373
6373
|
return callRef(cxt, validateName, env, env.$async);
|
|
6374
|
-
const rootName = gen.scopeValue("root", { ref:
|
|
6375
|
-
return callRef(cxt, (0, codegen_1._)`${rootName}.validate`,
|
|
6374
|
+
const rootName = gen.scopeValue("root", { ref: root2 });
|
|
6375
|
+
return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root2, root2.$async);
|
|
6376
6376
|
}
|
|
6377
6377
|
function callValidate(sch) {
|
|
6378
6378
|
const v = getValidate(cxt, sch);
|
|
@@ -6426,12 +6426,12 @@ var require_ref = __commonJS((exports) => {
|
|
|
6426
6426
|
function callSyncRef() {
|
|
6427
6427
|
cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v));
|
|
6428
6428
|
}
|
|
6429
|
-
function addErrorsFrom(
|
|
6430
|
-
const errs = (0, codegen_1._)`${
|
|
6429
|
+
function addErrorsFrom(source2) {
|
|
6430
|
+
const errs = (0, codegen_1._)`${source2}.errors`;
|
|
6431
6431
|
gen.assign(names_1.default.vErrors, (0, codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`);
|
|
6432
6432
|
gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
|
|
6433
6433
|
}
|
|
6434
|
-
function addEvaluatedFrom(
|
|
6434
|
+
function addEvaluatedFrom(source2) {
|
|
6435
6435
|
var _a21;
|
|
6436
6436
|
if (!it.opts.unevaluated)
|
|
6437
6437
|
return;
|
|
@@ -6442,7 +6442,7 @@ var require_ref = __commonJS((exports) => {
|
|
|
6442
6442
|
it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props);
|
|
6443
6443
|
}
|
|
6444
6444
|
} else {
|
|
6445
|
-
const props = gen.var("props", (0, codegen_1._)`${
|
|
6445
|
+
const props = gen.var("props", (0, codegen_1._)`${source2}.evaluated.props`);
|
|
6446
6446
|
it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name);
|
|
6447
6447
|
}
|
|
6448
6448
|
}
|
|
@@ -6452,7 +6452,7 @@ var require_ref = __commonJS((exports) => {
|
|
|
6452
6452
|
it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items);
|
|
6453
6453
|
}
|
|
6454
6454
|
} else {
|
|
6455
|
-
const items = gen.var("items", (0, codegen_1._)`${
|
|
6455
|
+
const items = gen.var("items", (0, codegen_1._)`${source2}.evaluated.items`);
|
|
6456
6456
|
it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name);
|
|
6457
6457
|
}
|
|
6458
6458
|
}
|
|
@@ -6540,15 +6540,15 @@ var require_ucs2length = __commonJS((exports) => {
|
|
|
6540
6540
|
function ucs2length(str) {
|
|
6541
6541
|
const len = str.length;
|
|
6542
6542
|
let length = 0;
|
|
6543
|
-
let
|
|
6543
|
+
let pos2 = 0;
|
|
6544
6544
|
let value;
|
|
6545
|
-
while (
|
|
6545
|
+
while (pos2 < len) {
|
|
6546
6546
|
length++;
|
|
6547
|
-
value = str.charCodeAt(
|
|
6548
|
-
if (value >= 55296 && value <= 56319 &&
|
|
6549
|
-
value = str.charCodeAt(
|
|
6547
|
+
value = str.charCodeAt(pos2++);
|
|
6548
|
+
if (value >= 55296 && value <= 56319 && pos2 < len) {
|
|
6549
|
+
value = str.charCodeAt(pos2);
|
|
6550
6550
|
if ((value & 64512) === 56320)
|
|
6551
|
-
|
|
6551
|
+
pos2++;
|
|
6552
6552
|
}
|
|
6553
6553
|
}
|
|
6554
6554
|
return length;
|
|
@@ -7197,11 +7197,11 @@ var require_dependencies = __commonJS((exports) => {
|
|
|
7197
7197
|
function splitDependencies({ schema }) {
|
|
7198
7198
|
const propertyDeps = {};
|
|
7199
7199
|
const schemaDeps = {};
|
|
7200
|
-
for (const
|
|
7201
|
-
if (
|
|
7200
|
+
for (const key2 in schema) {
|
|
7201
|
+
if (key2 === "__proto__")
|
|
7202
7202
|
continue;
|
|
7203
|
-
const deps = Array.isArray(schema[
|
|
7204
|
-
deps[
|
|
7203
|
+
const deps = Array.isArray(schema[key2]) ? propertyDeps : schemaDeps;
|
|
7204
|
+
deps[key2] = schema[key2];
|
|
7205
7205
|
}
|
|
7206
7206
|
return [propertyDeps, schemaDeps];
|
|
7207
7207
|
}
|
|
@@ -7270,13 +7270,13 @@ var require_propertyNames = __commonJS((exports) => {
|
|
|
7270
7270
|
if ((0, util_1.alwaysValidSchema)(it, schema))
|
|
7271
7271
|
return;
|
|
7272
7272
|
const valid = gen.name("valid");
|
|
7273
|
-
gen.forIn("key", data, (
|
|
7274
|
-
cxt.setParams({ propertyName:
|
|
7273
|
+
gen.forIn("key", data, (key2) => {
|
|
7274
|
+
cxt.setParams({ propertyName: key2 });
|
|
7275
7275
|
cxt.subschema({
|
|
7276
7276
|
keyword: "propertyNames",
|
|
7277
|
-
data:
|
|
7277
|
+
data: key2,
|
|
7278
7278
|
dataTypes: ["string"],
|
|
7279
|
-
propertyName:
|
|
7279
|
+
propertyName: key2,
|
|
7280
7280
|
compositeRule: true
|
|
7281
7281
|
}, valid);
|
|
7282
7282
|
gen.if((0, codegen_1.not)(valid), () => {
|
|
@@ -7322,38 +7322,38 @@ var require_additionalProperties = __commonJS((exports) => {
|
|
|
7322
7322
|
checkAdditionalProperties();
|
|
7323
7323
|
cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
|
|
7324
7324
|
function checkAdditionalProperties() {
|
|
7325
|
-
gen.forIn("key", data, (
|
|
7325
|
+
gen.forIn("key", data, (key2) => {
|
|
7326
7326
|
if (!props.length && !patProps.length)
|
|
7327
|
-
additionalPropertyCode(
|
|
7327
|
+
additionalPropertyCode(key2);
|
|
7328
7328
|
else
|
|
7329
|
-
gen.if(isAdditional(
|
|
7329
|
+
gen.if(isAdditional(key2), () => additionalPropertyCode(key2));
|
|
7330
7330
|
});
|
|
7331
7331
|
}
|
|
7332
|
-
function isAdditional(
|
|
7332
|
+
function isAdditional(key2) {
|
|
7333
7333
|
let definedProp;
|
|
7334
7334
|
if (props.length > 8) {
|
|
7335
7335
|
const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
|
|
7336
|
-
definedProp = (0, code_1.isOwnProperty)(gen, propsSchema,
|
|
7336
|
+
definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key2);
|
|
7337
7337
|
} else if (props.length) {
|
|
7338
|
-
definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${
|
|
7338
|
+
definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${key2} === ${p}`));
|
|
7339
7339
|
} else {
|
|
7340
7340
|
definedProp = codegen_1.nil;
|
|
7341
7341
|
}
|
|
7342
7342
|
if (patProps.length) {
|
|
7343
|
-
definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${
|
|
7343
|
+
definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${key2})`));
|
|
7344
7344
|
}
|
|
7345
7345
|
return (0, codegen_1.not)(definedProp);
|
|
7346
7346
|
}
|
|
7347
|
-
function deleteAdditional(
|
|
7348
|
-
gen.code((0, codegen_1._)`delete ${data}[${
|
|
7347
|
+
function deleteAdditional(key2) {
|
|
7348
|
+
gen.code((0, codegen_1._)`delete ${data}[${key2}]`);
|
|
7349
7349
|
}
|
|
7350
|
-
function additionalPropertyCode(
|
|
7350
|
+
function additionalPropertyCode(key2) {
|
|
7351
7351
|
if (opts.removeAdditional === "all" || opts.removeAdditional && schema === false) {
|
|
7352
|
-
deleteAdditional(
|
|
7352
|
+
deleteAdditional(key2);
|
|
7353
7353
|
return;
|
|
7354
7354
|
}
|
|
7355
7355
|
if (schema === false) {
|
|
7356
|
-
cxt.setParams({ additionalProperty:
|
|
7356
|
+
cxt.setParams({ additionalProperty: key2 });
|
|
7357
7357
|
cxt.error();
|
|
7358
7358
|
if (!allErrors)
|
|
7359
7359
|
gen.break();
|
|
@@ -7362,22 +7362,22 @@ var require_additionalProperties = __commonJS((exports) => {
|
|
|
7362
7362
|
if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
|
|
7363
7363
|
const valid = gen.name("valid");
|
|
7364
7364
|
if (opts.removeAdditional === "failing") {
|
|
7365
|
-
applyAdditionalSchema(
|
|
7365
|
+
applyAdditionalSchema(key2, valid, false);
|
|
7366
7366
|
gen.if((0, codegen_1.not)(valid), () => {
|
|
7367
7367
|
cxt.reset();
|
|
7368
|
-
deleteAdditional(
|
|
7368
|
+
deleteAdditional(key2);
|
|
7369
7369
|
});
|
|
7370
7370
|
} else {
|
|
7371
|
-
applyAdditionalSchema(
|
|
7371
|
+
applyAdditionalSchema(key2, valid);
|
|
7372
7372
|
if (!allErrors)
|
|
7373
7373
|
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
7374
7374
|
}
|
|
7375
7375
|
}
|
|
7376
7376
|
}
|
|
7377
|
-
function applyAdditionalSchema(
|
|
7377
|
+
function applyAdditionalSchema(key2, valid, errors3) {
|
|
7378
7378
|
const subschema = {
|
|
7379
7379
|
keyword: "additionalProperties",
|
|
7380
|
-
dataProp:
|
|
7380
|
+
dataProp: key2,
|
|
7381
7381
|
dataPropType: util_1.Type.Str
|
|
7382
7382
|
};
|
|
7383
7383
|
if (errors3 === false) {
|
|
@@ -7496,19 +7496,19 @@ var require_patternProperties = __commonJS((exports) => {
|
|
|
7496
7496
|
}
|
|
7497
7497
|
}
|
|
7498
7498
|
function validateProperties(pat) {
|
|
7499
|
-
gen.forIn("key", data, (
|
|
7500
|
-
gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${
|
|
7499
|
+
gen.forIn("key", data, (key2) => {
|
|
7500
|
+
gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key2})`, () => {
|
|
7501
7501
|
const alwaysValid = alwaysValidPatterns.includes(pat);
|
|
7502
7502
|
if (!alwaysValid) {
|
|
7503
7503
|
cxt.subschema({
|
|
7504
7504
|
keyword: "patternProperties",
|
|
7505
7505
|
schemaProp: pat,
|
|
7506
|
-
dataProp:
|
|
7506
|
+
dataProp: key2,
|
|
7507
7507
|
dataPropType: util_2.Type.Str
|
|
7508
7508
|
}, valid);
|
|
7509
7509
|
}
|
|
7510
7510
|
if (it.opts.unevaluated && props !== true) {
|
|
7511
|
-
gen.assign((0, codegen_1._)`${props}[${
|
|
7511
|
+
gen.assign((0, codegen_1._)`${props}[${key2}]`, true);
|
|
7512
7512
|
} else if (!alwaysValid && !it.allErrors) {
|
|
7513
7513
|
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
7514
7514
|
}
|
|
@@ -7788,9 +7788,9 @@ var require_dynamicAnchor = __commonJS((exports) => {
|
|
|
7788
7788
|
exports.dynamicAnchor = dynamicAnchor;
|
|
7789
7789
|
function _getValidate(cxt) {
|
|
7790
7790
|
const { schemaEnv, schema, self } = cxt.it;
|
|
7791
|
-
const { root, baseId, localRefs, meta: meta3 } = schemaEnv.root;
|
|
7791
|
+
const { root: root2, baseId, localRefs, meta: meta3 } = schemaEnv.root;
|
|
7792
7792
|
const { schemaId } = self.opts;
|
|
7793
|
-
const sch = new compile_1.SchemaEnv({ schema, schemaId, root, baseId, localRefs, meta: meta3 });
|
|
7793
|
+
const sch = new compile_1.SchemaEnv({ schema, schemaId, root: root2, baseId, localRefs, meta: meta3 });
|
|
7794
7794
|
compile_1.compileSchema.call(self, sch);
|
|
7795
7795
|
return (0, ref_1.getValidate)(cxt, sch);
|
|
7796
7796
|
}
|
|
@@ -7957,15 +7957,15 @@ var require_unevaluatedProperties = __commonJS((exports) => {
|
|
|
7957
7957
|
throw new Error("ajv implementation error");
|
|
7958
7958
|
const { allErrors, props } = it;
|
|
7959
7959
|
if (props instanceof codegen_1.Name) {
|
|
7960
|
-
gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (
|
|
7960
|
+
gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key2) => gen.if(unevaluatedDynamic(props, key2), () => unevaluatedPropCode(key2))));
|
|
7961
7961
|
} else if (props !== true) {
|
|
7962
|
-
gen.forIn("key", data, (
|
|
7962
|
+
gen.forIn("key", data, (key2) => props === undefined ? unevaluatedPropCode(key2) : gen.if(unevaluatedStatic(props, key2), () => unevaluatedPropCode(key2)));
|
|
7963
7963
|
}
|
|
7964
7964
|
it.props = true;
|
|
7965
7965
|
cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
|
|
7966
|
-
function unevaluatedPropCode(
|
|
7966
|
+
function unevaluatedPropCode(key2) {
|
|
7967
7967
|
if (schema === false) {
|
|
7968
|
-
cxt.setParams({ unevaluatedProperty:
|
|
7968
|
+
cxt.setParams({ unevaluatedProperty: key2 });
|
|
7969
7969
|
cxt.error();
|
|
7970
7970
|
if (!allErrors)
|
|
7971
7971
|
gen.break();
|
|
@@ -7975,21 +7975,21 @@ var require_unevaluatedProperties = __commonJS((exports) => {
|
|
|
7975
7975
|
const valid = gen.name("valid");
|
|
7976
7976
|
cxt.subschema({
|
|
7977
7977
|
keyword: "unevaluatedProperties",
|
|
7978
|
-
dataProp:
|
|
7978
|
+
dataProp: key2,
|
|
7979
7979
|
dataPropType: util_1.Type.Str
|
|
7980
7980
|
}, valid);
|
|
7981
7981
|
if (!allErrors)
|
|
7982
7982
|
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
7983
7983
|
}
|
|
7984
7984
|
}
|
|
7985
|
-
function unevaluatedDynamic(evaluatedProps,
|
|
7986
|
-
return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${
|
|
7985
|
+
function unevaluatedDynamic(evaluatedProps, key2) {
|
|
7986
|
+
return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key2}]`;
|
|
7987
7987
|
}
|
|
7988
|
-
function unevaluatedStatic(evaluatedProps,
|
|
7988
|
+
function unevaluatedStatic(evaluatedProps, key2) {
|
|
7989
7989
|
const ps = [];
|
|
7990
7990
|
for (const p in evaluatedProps) {
|
|
7991
7991
|
if (evaluatedProps[p] === true)
|
|
7992
|
-
ps.push((0, codegen_1._)`${
|
|
7992
|
+
ps.push((0, codegen_1._)`${key2} !== ${p}`);
|
|
7993
7993
|
}
|
|
7994
7994
|
return (0, codegen_1.and)(...ps);
|
|
7995
7995
|
}
|
|
@@ -8756,8 +8756,535 @@ var require_2020 = __commonJS((exports, module) => {
|
|
|
8756
8756
|
} });
|
|
8757
8757
|
});
|
|
8758
8758
|
|
|
8759
|
+
// node_modules/.bun/ajv-formats@3.0.1/node_modules/ajv-formats/dist/formats.js
|
|
8760
|
+
var require_formats = __commonJS((exports) => {
|
|
8761
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8762
|
+
exports.formatNames = exports.fastFormats = exports.fullFormats = undefined;
|
|
8763
|
+
function fmtDef(validate, compare) {
|
|
8764
|
+
return { validate, compare };
|
|
8765
|
+
}
|
|
8766
|
+
exports.fullFormats = {
|
|
8767
|
+
date: fmtDef(date5, compareDate),
|
|
8768
|
+
time: fmtDef(getTime(true), compareTime),
|
|
8769
|
+
"date-time": fmtDef(getDateTime(true), compareDateTime),
|
|
8770
|
+
"iso-time": fmtDef(getTime(), compareIsoTime),
|
|
8771
|
+
"iso-date-time": fmtDef(getDateTime(), compareIsoDateTime),
|
|
8772
|
+
duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
|
|
8773
|
+
uri,
|
|
8774
|
+
"uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,
|
|
8775
|
+
"uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,
|
|
8776
|
+
url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,
|
|
8777
|
+
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
|
8778
|
+
hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,
|
|
8779
|
+
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,
|
|
8780
|
+
ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
|
|
8781
|
+
regex,
|
|
8782
|
+
uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
|
|
8783
|
+
"json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/,
|
|
8784
|
+
"json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,
|
|
8785
|
+
"relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,
|
|
8786
|
+
byte,
|
|
8787
|
+
int32: { type: "number", validate: validateInt32 },
|
|
8788
|
+
int64: { type: "number", validate: validateInt64 },
|
|
8789
|
+
float: { type: "number", validate: validateNumber },
|
|
8790
|
+
double: { type: "number", validate: validateNumber },
|
|
8791
|
+
password: true,
|
|
8792
|
+
binary: true
|
|
8793
|
+
};
|
|
8794
|
+
exports.fastFormats = {
|
|
8795
|
+
...exports.fullFormats,
|
|
8796
|
+
date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate),
|
|
8797
|
+
time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime),
|
|
8798
|
+
"date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime),
|
|
8799
|
+
"iso-time": fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoTime),
|
|
8800
|
+
"iso-date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoDateTime),
|
|
8801
|
+
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
|
8802
|
+
"uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
|
8803
|
+
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
|
|
8804
|
+
};
|
|
8805
|
+
exports.formatNames = Object.keys(exports.fullFormats);
|
|
8806
|
+
function isLeapYear(year) {
|
|
8807
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
8808
|
+
}
|
|
8809
|
+
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
8810
|
+
var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
8811
|
+
function date5(str) {
|
|
8812
|
+
const matches = DATE.exec(str);
|
|
8813
|
+
if (!matches)
|
|
8814
|
+
return false;
|
|
8815
|
+
const year = +matches[1];
|
|
8816
|
+
const month = +matches[2];
|
|
8817
|
+
const day = +matches[3];
|
|
8818
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
|
8819
|
+
}
|
|
8820
|
+
function compareDate(d1, d2) {
|
|
8821
|
+
if (!(d1 && d2))
|
|
8822
|
+
return;
|
|
8823
|
+
if (d1 > d2)
|
|
8824
|
+
return 1;
|
|
8825
|
+
if (d1 < d2)
|
|
8826
|
+
return -1;
|
|
8827
|
+
return 0;
|
|
8828
|
+
}
|
|
8829
|
+
var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
8830
|
+
function getTime(strictTimeZone) {
|
|
8831
|
+
return function time3(str) {
|
|
8832
|
+
const matches = TIME.exec(str);
|
|
8833
|
+
if (!matches)
|
|
8834
|
+
return false;
|
|
8835
|
+
const hr = +matches[1];
|
|
8836
|
+
const min = +matches[2];
|
|
8837
|
+
const sec = +matches[3];
|
|
8838
|
+
const tz = matches[4];
|
|
8839
|
+
const tzSign = matches[5] === "-" ? -1 : 1;
|
|
8840
|
+
const tzH = +(matches[6] || 0);
|
|
8841
|
+
const tzM = +(matches[7] || 0);
|
|
8842
|
+
if (tzH > 23 || tzM > 59 || strictTimeZone && !tz)
|
|
8843
|
+
return false;
|
|
8844
|
+
if (hr <= 23 && min <= 59 && sec < 60)
|
|
8845
|
+
return true;
|
|
8846
|
+
const utcMin = min - tzM * tzSign;
|
|
8847
|
+
const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
|
|
8848
|
+
return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
|
|
8849
|
+
};
|
|
8850
|
+
}
|
|
8851
|
+
function compareTime(s1, s2) {
|
|
8852
|
+
if (!(s1 && s2))
|
|
8853
|
+
return;
|
|
8854
|
+
const t1 = new Date("2020-01-01T" + s1).valueOf();
|
|
8855
|
+
const t2 = new Date("2020-01-01T" + s2).valueOf();
|
|
8856
|
+
if (!(t1 && t2))
|
|
8857
|
+
return;
|
|
8858
|
+
return t1 - t2;
|
|
8859
|
+
}
|
|
8860
|
+
function compareIsoTime(t1, t2) {
|
|
8861
|
+
if (!(t1 && t2))
|
|
8862
|
+
return;
|
|
8863
|
+
const a1 = TIME.exec(t1);
|
|
8864
|
+
const a2 = TIME.exec(t2);
|
|
8865
|
+
if (!(a1 && a2))
|
|
8866
|
+
return;
|
|
8867
|
+
t1 = a1[1] + a1[2] + a1[3];
|
|
8868
|
+
t2 = a2[1] + a2[2] + a2[3];
|
|
8869
|
+
if (t1 > t2)
|
|
8870
|
+
return 1;
|
|
8871
|
+
if (t1 < t2)
|
|
8872
|
+
return -1;
|
|
8873
|
+
return 0;
|
|
8874
|
+
}
|
|
8875
|
+
var DATE_TIME_SEPARATOR = /t|\s/i;
|
|
8876
|
+
function getDateTime(strictTimeZone) {
|
|
8877
|
+
const time3 = getTime(strictTimeZone);
|
|
8878
|
+
return function date_time(str) {
|
|
8879
|
+
const dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
8880
|
+
return dateTime.length === 2 && date5(dateTime[0]) && time3(dateTime[1]);
|
|
8881
|
+
};
|
|
8882
|
+
}
|
|
8883
|
+
function compareDateTime(dt1, dt2) {
|
|
8884
|
+
if (!(dt1 && dt2))
|
|
8885
|
+
return;
|
|
8886
|
+
const d1 = new Date(dt1).valueOf();
|
|
8887
|
+
const d2 = new Date(dt2).valueOf();
|
|
8888
|
+
if (!(d1 && d2))
|
|
8889
|
+
return;
|
|
8890
|
+
return d1 - d2;
|
|
8891
|
+
}
|
|
8892
|
+
function compareIsoDateTime(dt1, dt2) {
|
|
8893
|
+
if (!(dt1 && dt2))
|
|
8894
|
+
return;
|
|
8895
|
+
const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);
|
|
8896
|
+
const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);
|
|
8897
|
+
const res = compareDate(d1, d2);
|
|
8898
|
+
if (res === undefined)
|
|
8899
|
+
return;
|
|
8900
|
+
return res || compareTime(t1, t2);
|
|
8901
|
+
}
|
|
8902
|
+
var NOT_URI_FRAGMENT = /\/|:/;
|
|
8903
|
+
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
8904
|
+
function uri(str) {
|
|
8905
|
+
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
|
8906
|
+
}
|
|
8907
|
+
var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
8908
|
+
function byte(str) {
|
|
8909
|
+
BYTE.lastIndex = 0;
|
|
8910
|
+
return BYTE.test(str);
|
|
8911
|
+
}
|
|
8912
|
+
var MIN_INT32 = -(2 ** 31);
|
|
8913
|
+
var MAX_INT32 = 2 ** 31 - 1;
|
|
8914
|
+
function validateInt32(value) {
|
|
8915
|
+
return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32;
|
|
8916
|
+
}
|
|
8917
|
+
function validateInt64(value) {
|
|
8918
|
+
return Number.isInteger(value);
|
|
8919
|
+
}
|
|
8920
|
+
function validateNumber() {
|
|
8921
|
+
return true;
|
|
8922
|
+
}
|
|
8923
|
+
var Z_ANCHOR = /[^\\]\\Z/;
|
|
8924
|
+
function regex(str) {
|
|
8925
|
+
if (Z_ANCHOR.test(str))
|
|
8926
|
+
return false;
|
|
8927
|
+
try {
|
|
8928
|
+
new RegExp(str);
|
|
8929
|
+
return true;
|
|
8930
|
+
} catch (e) {
|
|
8931
|
+
return false;
|
|
8932
|
+
}
|
|
8933
|
+
}
|
|
8934
|
+
});
|
|
8935
|
+
|
|
8936
|
+
// node_modules/.bun/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js
|
|
8937
|
+
var require_draft7 = __commonJS((exports) => {
|
|
8938
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8939
|
+
var core_1 = require_core2();
|
|
8940
|
+
var validation_1 = require_validation();
|
|
8941
|
+
var applicator_1 = require_applicator();
|
|
8942
|
+
var format_1 = require_format2();
|
|
8943
|
+
var metadata_1 = require_metadata();
|
|
8944
|
+
var draft7Vocabularies = [
|
|
8945
|
+
core_1.default,
|
|
8946
|
+
validation_1.default,
|
|
8947
|
+
(0, applicator_1.default)(),
|
|
8948
|
+
format_1.default,
|
|
8949
|
+
metadata_1.metadataVocabulary,
|
|
8950
|
+
metadata_1.contentVocabulary
|
|
8951
|
+
];
|
|
8952
|
+
exports.default = draft7Vocabularies;
|
|
8953
|
+
});
|
|
8954
|
+
|
|
8955
|
+
// node_modules/.bun/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.json
|
|
8956
|
+
var require_json_schema_draft_07 = __commonJS((exports, module) => {
|
|
8957
|
+
module.exports = {
|
|
8958
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
8959
|
+
$id: "http://json-schema.org/draft-07/schema#",
|
|
8960
|
+
title: "Core schema meta-schema",
|
|
8961
|
+
definitions: {
|
|
8962
|
+
schemaArray: {
|
|
8963
|
+
type: "array",
|
|
8964
|
+
minItems: 1,
|
|
8965
|
+
items: { $ref: "#" }
|
|
8966
|
+
},
|
|
8967
|
+
nonNegativeInteger: {
|
|
8968
|
+
type: "integer",
|
|
8969
|
+
minimum: 0
|
|
8970
|
+
},
|
|
8971
|
+
nonNegativeIntegerDefault0: {
|
|
8972
|
+
allOf: [{ $ref: "#/definitions/nonNegativeInteger" }, { default: 0 }]
|
|
8973
|
+
},
|
|
8974
|
+
simpleTypes: {
|
|
8975
|
+
enum: ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
8976
|
+
},
|
|
8977
|
+
stringArray: {
|
|
8978
|
+
type: "array",
|
|
8979
|
+
items: { type: "string" },
|
|
8980
|
+
uniqueItems: true,
|
|
8981
|
+
default: []
|
|
8982
|
+
}
|
|
8983
|
+
},
|
|
8984
|
+
type: ["object", "boolean"],
|
|
8985
|
+
properties: {
|
|
8986
|
+
$id: {
|
|
8987
|
+
type: "string",
|
|
8988
|
+
format: "uri-reference"
|
|
8989
|
+
},
|
|
8990
|
+
$schema: {
|
|
8991
|
+
type: "string",
|
|
8992
|
+
format: "uri"
|
|
8993
|
+
},
|
|
8994
|
+
$ref: {
|
|
8995
|
+
type: "string",
|
|
8996
|
+
format: "uri-reference"
|
|
8997
|
+
},
|
|
8998
|
+
$comment: {
|
|
8999
|
+
type: "string"
|
|
9000
|
+
},
|
|
9001
|
+
title: {
|
|
9002
|
+
type: "string"
|
|
9003
|
+
},
|
|
9004
|
+
description: {
|
|
9005
|
+
type: "string"
|
|
9006
|
+
},
|
|
9007
|
+
default: true,
|
|
9008
|
+
readOnly: {
|
|
9009
|
+
type: "boolean",
|
|
9010
|
+
default: false
|
|
9011
|
+
},
|
|
9012
|
+
examples: {
|
|
9013
|
+
type: "array",
|
|
9014
|
+
items: true
|
|
9015
|
+
},
|
|
9016
|
+
multipleOf: {
|
|
9017
|
+
type: "number",
|
|
9018
|
+
exclusiveMinimum: 0
|
|
9019
|
+
},
|
|
9020
|
+
maximum: {
|
|
9021
|
+
type: "number"
|
|
9022
|
+
},
|
|
9023
|
+
exclusiveMaximum: {
|
|
9024
|
+
type: "number"
|
|
9025
|
+
},
|
|
9026
|
+
minimum: {
|
|
9027
|
+
type: "number"
|
|
9028
|
+
},
|
|
9029
|
+
exclusiveMinimum: {
|
|
9030
|
+
type: "number"
|
|
9031
|
+
},
|
|
9032
|
+
maxLength: { $ref: "#/definitions/nonNegativeInteger" },
|
|
9033
|
+
minLength: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
|
|
9034
|
+
pattern: {
|
|
9035
|
+
type: "string",
|
|
9036
|
+
format: "regex"
|
|
9037
|
+
},
|
|
9038
|
+
additionalItems: { $ref: "#" },
|
|
9039
|
+
items: {
|
|
9040
|
+
anyOf: [{ $ref: "#" }, { $ref: "#/definitions/schemaArray" }],
|
|
9041
|
+
default: true
|
|
9042
|
+
},
|
|
9043
|
+
maxItems: { $ref: "#/definitions/nonNegativeInteger" },
|
|
9044
|
+
minItems: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
|
|
9045
|
+
uniqueItems: {
|
|
9046
|
+
type: "boolean",
|
|
9047
|
+
default: false
|
|
9048
|
+
},
|
|
9049
|
+
contains: { $ref: "#" },
|
|
9050
|
+
maxProperties: { $ref: "#/definitions/nonNegativeInteger" },
|
|
9051
|
+
minProperties: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
|
|
9052
|
+
required: { $ref: "#/definitions/stringArray" },
|
|
9053
|
+
additionalProperties: { $ref: "#" },
|
|
9054
|
+
definitions: {
|
|
9055
|
+
type: "object",
|
|
9056
|
+
additionalProperties: { $ref: "#" },
|
|
9057
|
+
default: {}
|
|
9058
|
+
},
|
|
9059
|
+
properties: {
|
|
9060
|
+
type: "object",
|
|
9061
|
+
additionalProperties: { $ref: "#" },
|
|
9062
|
+
default: {}
|
|
9063
|
+
},
|
|
9064
|
+
patternProperties: {
|
|
9065
|
+
type: "object",
|
|
9066
|
+
additionalProperties: { $ref: "#" },
|
|
9067
|
+
propertyNames: { format: "regex" },
|
|
9068
|
+
default: {}
|
|
9069
|
+
},
|
|
9070
|
+
dependencies: {
|
|
9071
|
+
type: "object",
|
|
9072
|
+
additionalProperties: {
|
|
9073
|
+
anyOf: [{ $ref: "#" }, { $ref: "#/definitions/stringArray" }]
|
|
9074
|
+
}
|
|
9075
|
+
},
|
|
9076
|
+
propertyNames: { $ref: "#" },
|
|
9077
|
+
const: true,
|
|
9078
|
+
enum: {
|
|
9079
|
+
type: "array",
|
|
9080
|
+
items: true,
|
|
9081
|
+
minItems: 1,
|
|
9082
|
+
uniqueItems: true
|
|
9083
|
+
},
|
|
9084
|
+
type: {
|
|
9085
|
+
anyOf: [
|
|
9086
|
+
{ $ref: "#/definitions/simpleTypes" },
|
|
9087
|
+
{
|
|
9088
|
+
type: "array",
|
|
9089
|
+
items: { $ref: "#/definitions/simpleTypes" },
|
|
9090
|
+
minItems: 1,
|
|
9091
|
+
uniqueItems: true
|
|
9092
|
+
}
|
|
9093
|
+
]
|
|
9094
|
+
},
|
|
9095
|
+
format: { type: "string" },
|
|
9096
|
+
contentMediaType: { type: "string" },
|
|
9097
|
+
contentEncoding: { type: "string" },
|
|
9098
|
+
if: { $ref: "#" },
|
|
9099
|
+
then: { $ref: "#" },
|
|
9100
|
+
else: { $ref: "#" },
|
|
9101
|
+
allOf: { $ref: "#/definitions/schemaArray" },
|
|
9102
|
+
anyOf: { $ref: "#/definitions/schemaArray" },
|
|
9103
|
+
oneOf: { $ref: "#/definitions/schemaArray" },
|
|
9104
|
+
not: { $ref: "#" }
|
|
9105
|
+
},
|
|
9106
|
+
default: true
|
|
9107
|
+
};
|
|
9108
|
+
});
|
|
9109
|
+
|
|
9110
|
+
// node_modules/.bun/ajv@8.18.0/node_modules/ajv/dist/ajv.js
|
|
9111
|
+
var require_ajv = __commonJS((exports, module) => {
|
|
9112
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9113
|
+
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = undefined;
|
|
9114
|
+
var core_1 = require_core();
|
|
9115
|
+
var draft7_1 = require_draft7();
|
|
9116
|
+
var discriminator_1 = require_discriminator();
|
|
9117
|
+
var draft7MetaSchema = require_json_schema_draft_07();
|
|
9118
|
+
var META_SUPPORT_DATA = ["/properties"];
|
|
9119
|
+
var META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
|
|
9120
|
+
|
|
9121
|
+
class Ajv extends core_1.default {
|
|
9122
|
+
_addVocabularies() {
|
|
9123
|
+
super._addVocabularies();
|
|
9124
|
+
draft7_1.default.forEach((v) => this.addVocabulary(v));
|
|
9125
|
+
if (this.opts.discriminator)
|
|
9126
|
+
this.addKeyword(discriminator_1.default);
|
|
9127
|
+
}
|
|
9128
|
+
_addDefaultMetaSchema() {
|
|
9129
|
+
super._addDefaultMetaSchema();
|
|
9130
|
+
if (!this.opts.meta)
|
|
9131
|
+
return;
|
|
9132
|
+
const metaSchema = this.opts.$data ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) : draft7MetaSchema;
|
|
9133
|
+
this.addMetaSchema(metaSchema, META_SCHEMA_ID, false);
|
|
9134
|
+
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
|
9135
|
+
}
|
|
9136
|
+
defaultMeta() {
|
|
9137
|
+
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined);
|
|
9138
|
+
}
|
|
9139
|
+
}
|
|
9140
|
+
exports.Ajv = Ajv;
|
|
9141
|
+
module.exports = exports = Ajv;
|
|
9142
|
+
module.exports.Ajv = Ajv;
|
|
9143
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9144
|
+
exports.default = Ajv;
|
|
9145
|
+
var validate_1 = require_validate();
|
|
9146
|
+
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
|
|
9147
|
+
return validate_1.KeywordCxt;
|
|
9148
|
+
} });
|
|
9149
|
+
var codegen_1 = require_codegen();
|
|
9150
|
+
Object.defineProperty(exports, "_", { enumerable: true, get: function() {
|
|
9151
|
+
return codegen_1._;
|
|
9152
|
+
} });
|
|
9153
|
+
Object.defineProperty(exports, "str", { enumerable: true, get: function() {
|
|
9154
|
+
return codegen_1.str;
|
|
9155
|
+
} });
|
|
9156
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function() {
|
|
9157
|
+
return codegen_1.stringify;
|
|
9158
|
+
} });
|
|
9159
|
+
Object.defineProperty(exports, "nil", { enumerable: true, get: function() {
|
|
9160
|
+
return codegen_1.nil;
|
|
9161
|
+
} });
|
|
9162
|
+
Object.defineProperty(exports, "Name", { enumerable: true, get: function() {
|
|
9163
|
+
return codegen_1.Name;
|
|
9164
|
+
} });
|
|
9165
|
+
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
|
|
9166
|
+
return codegen_1.CodeGen;
|
|
9167
|
+
} });
|
|
9168
|
+
var validation_error_1 = require_validation_error();
|
|
9169
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() {
|
|
9170
|
+
return validation_error_1.default;
|
|
9171
|
+
} });
|
|
9172
|
+
var ref_error_1 = require_ref_error();
|
|
9173
|
+
Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function() {
|
|
9174
|
+
return ref_error_1.default;
|
|
9175
|
+
} });
|
|
9176
|
+
});
|
|
9177
|
+
|
|
9178
|
+
// node_modules/.bun/ajv-formats@3.0.1/node_modules/ajv-formats/dist/limit.js
|
|
9179
|
+
var require_limit = __commonJS((exports) => {
|
|
9180
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9181
|
+
exports.formatLimitDefinition = undefined;
|
|
9182
|
+
var ajv_1 = require_ajv();
|
|
9183
|
+
var codegen_1 = require_codegen();
|
|
9184
|
+
var ops = codegen_1.operators;
|
|
9185
|
+
var KWDs = {
|
|
9186
|
+
formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
|
|
9187
|
+
formatMinimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT },
|
|
9188
|
+
formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
|
|
9189
|
+
formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
|
|
9190
|
+
};
|
|
9191
|
+
var error48 = {
|
|
9192
|
+
message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`,
|
|
9193
|
+
params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
|
|
9194
|
+
};
|
|
9195
|
+
exports.formatLimitDefinition = {
|
|
9196
|
+
keyword: Object.keys(KWDs),
|
|
9197
|
+
type: "string",
|
|
9198
|
+
schemaType: "string",
|
|
9199
|
+
$data: true,
|
|
9200
|
+
error: error48,
|
|
9201
|
+
code(cxt) {
|
|
9202
|
+
const { gen, data, schemaCode, keyword, it } = cxt;
|
|
9203
|
+
const { opts, self } = it;
|
|
9204
|
+
if (!opts.validateFormats)
|
|
9205
|
+
return;
|
|
9206
|
+
const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format");
|
|
9207
|
+
if (fCxt.$data)
|
|
9208
|
+
validate$DataFormat();
|
|
9209
|
+
else
|
|
9210
|
+
validateFormat();
|
|
9211
|
+
function validate$DataFormat() {
|
|
9212
|
+
const fmts = gen.scopeValue("formats", {
|
|
9213
|
+
ref: self.formats,
|
|
9214
|
+
code: opts.code.formats
|
|
9215
|
+
});
|
|
9216
|
+
const fmt = gen.const("fmt", (0, codegen_1._)`${fmts}[${fCxt.schemaCode}]`);
|
|
9217
|
+
cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt} != "object"`, (0, codegen_1._)`${fmt} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt}.compare != "function"`, compareCode(fmt)));
|
|
9218
|
+
}
|
|
9219
|
+
function validateFormat() {
|
|
9220
|
+
const format = fCxt.schema;
|
|
9221
|
+
const fmtDef = self.formats[format];
|
|
9222
|
+
if (!fmtDef || fmtDef === true)
|
|
9223
|
+
return;
|
|
9224
|
+
if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") {
|
|
9225
|
+
throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
|
|
9226
|
+
}
|
|
9227
|
+
const fmt = gen.scopeValue("formats", {
|
|
9228
|
+
key: format,
|
|
9229
|
+
ref: fmtDef,
|
|
9230
|
+
code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : undefined
|
|
9231
|
+
});
|
|
9232
|
+
cxt.fail$data(compareCode(fmt));
|
|
9233
|
+
}
|
|
9234
|
+
function compareCode(fmt) {
|
|
9235
|
+
return (0, codegen_1._)`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;
|
|
9236
|
+
}
|
|
9237
|
+
},
|
|
9238
|
+
dependencies: ["format"]
|
|
9239
|
+
};
|
|
9240
|
+
var formatLimitPlugin = (ajv) => {
|
|
9241
|
+
ajv.addKeyword(exports.formatLimitDefinition);
|
|
9242
|
+
return ajv;
|
|
9243
|
+
};
|
|
9244
|
+
exports.default = formatLimitPlugin;
|
|
9245
|
+
});
|
|
9246
|
+
|
|
9247
|
+
// node_modules/.bun/ajv-formats@3.0.1/node_modules/ajv-formats/dist/index.js
|
|
9248
|
+
var require_dist2 = __commonJS((exports, module) => {
|
|
9249
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9250
|
+
var formats_1 = require_formats();
|
|
9251
|
+
var limit_1 = require_limit();
|
|
9252
|
+
var codegen_1 = require_codegen();
|
|
9253
|
+
var fullName = new codegen_1.Name("fullFormats");
|
|
9254
|
+
var fastName = new codegen_1.Name("fastFormats");
|
|
9255
|
+
var formatsPlugin = (ajv, opts = { keywords: true }) => {
|
|
9256
|
+
if (Array.isArray(opts)) {
|
|
9257
|
+
addFormats(ajv, opts, formats_1.fullFormats, fullName);
|
|
9258
|
+
return ajv;
|
|
9259
|
+
}
|
|
9260
|
+
const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName];
|
|
9261
|
+
const list = opts.formats || formats_1.formatNames;
|
|
9262
|
+
addFormats(ajv, list, formats, exportName);
|
|
9263
|
+
if (opts.keywords)
|
|
9264
|
+
(0, limit_1.default)(ajv);
|
|
9265
|
+
return ajv;
|
|
9266
|
+
};
|
|
9267
|
+
formatsPlugin.get = (name21, mode = "full") => {
|
|
9268
|
+
const formats = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats;
|
|
9269
|
+
const f = formats[name21];
|
|
9270
|
+
if (!f)
|
|
9271
|
+
throw new Error(`Unknown format "${name21}"`);
|
|
9272
|
+
return f;
|
|
9273
|
+
};
|
|
9274
|
+
function addFormats(ajv, list, fs, exportName) {
|
|
9275
|
+
var _a21;
|
|
9276
|
+
var _b16;
|
|
9277
|
+
(_a21 = (_b16 = ajv.opts.code).formats) !== null && _a21 !== undefined || (_b16.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
|
|
9278
|
+
for (const f of list)
|
|
9279
|
+
ajv.addFormat(f, fs[f]);
|
|
9280
|
+
}
|
|
9281
|
+
module.exports = exports = formatsPlugin;
|
|
9282
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9283
|
+
exports.default = formatsPlugin;
|
|
9284
|
+
});
|
|
9285
|
+
|
|
8759
9286
|
// src/index.ts
|
|
8760
|
-
import { readFileSync as
|
|
9287
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
8761
9288
|
|
|
8762
9289
|
// node_modules/.bun/@ai-sdk+provider@3.0.8/node_modules/@ai-sdk/provider/dist/index.mjs
|
|
8763
9290
|
var marker = "vercel.ai.error";
|
|
@@ -47833,9 +48360,6 @@ var middleware = (options) => async (c) => {
|
|
|
47833
48360
|
`);
|
|
47834
48361
|
};
|
|
47835
48362
|
|
|
47836
|
-
// src/index.ts
|
|
47837
|
-
var import__2020 = __toESM(require_2020(), 1);
|
|
47838
|
-
|
|
47839
48363
|
// node_modules/.bun/hono@4.12.5/node_modules/hono/dist/compose.js
|
|
47840
48364
|
var compose = (middleware2, onError, onNotFound) => {
|
|
47841
48365
|
return (context2, next) => {
|
|
@@ -53903,6 +54427,37 @@ function getBundledWebRoot() {
|
|
|
53903
54427
|
return resolveBundledAssetPath("../dist/web/");
|
|
53904
54428
|
}
|
|
53905
54429
|
|
|
54430
|
+
// src/config-validate.ts
|
|
54431
|
+
var import__2020 = __toESM(require_2020(), 1);
|
|
54432
|
+
var import_ajv_formats = __toESM(require_dist2(), 1);
|
|
54433
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
54434
|
+
function validateBusinessRules(config2) {
|
|
54435
|
+
for (const [routeType, modelMap] of Object.entries(config2.routes)) {
|
|
54436
|
+
if (!modelMap["*"]) {
|
|
54437
|
+
throw new Error(`\u8DEF\u7531 "${routeType}" \u7F3A\u5C11 "*" \u515C\u5E95\u89C4\u5219`);
|
|
54438
|
+
}
|
|
54439
|
+
for (const target of Object.values(modelMap)) {
|
|
54440
|
+
if (!config2.providers[target.provider]) {
|
|
54441
|
+
throw new Error(`\u8DEF\u7531 "${routeType}" \u5F15\u7528\u4E86\u4E0D\u5B58\u5728\u7684 provider "${target.provider}"`);
|
|
54442
|
+
}
|
|
54443
|
+
}
|
|
54444
|
+
}
|
|
54445
|
+
}
|
|
54446
|
+
function validateConfigOrThrow(config2) {
|
|
54447
|
+
validateBusinessRules(config2);
|
|
54448
|
+
const ajv = new import__2020.default({ allErrors: true, strict: false });
|
|
54449
|
+
import_ajv_formats.default(ajv);
|
|
54450
|
+
const schemaJson = JSON.parse(readFileSync3(getBundledSchemaPath(), "utf-8"));
|
|
54451
|
+
const validateBySchema = ajv.compile(schemaJson);
|
|
54452
|
+
const valid = validateBySchema(config2);
|
|
54453
|
+
if (!valid) {
|
|
54454
|
+
const firstError = validateBySchema.errors?.[0];
|
|
54455
|
+
const path = firstError?.instancePath || "(root)";
|
|
54456
|
+
const message = firstError?.message ?? "unknown schema validation error";
|
|
54457
|
+
throw new Error(`Schema \u6821\u9A8C\u5931\u8D25: ${path} ${message}`);
|
|
54458
|
+
}
|
|
54459
|
+
}
|
|
54460
|
+
|
|
53906
54461
|
// src/index.ts
|
|
53907
54462
|
var ROUTE_REGISTRY = {
|
|
53908
54463
|
"openai-completions": {
|
|
@@ -54021,10 +54576,8 @@ function createAdminApiRoutes(store, registerCleanup) {
|
|
|
54021
54576
|
const cryptoSessions = new Map;
|
|
54022
54577
|
const CRYPTO_SESSION_TTL_MS = 2 * 60 * 1000;
|
|
54023
54578
|
const CRYPTO_SESSION_MAX = 512;
|
|
54024
|
-
const ajv = new import__2020.default({ allErrors: true, strict: false });
|
|
54025
54579
|
const schemaPath = getBundledSchemaPath();
|
|
54026
|
-
const schemaJson = JSON.parse(
|
|
54027
|
-
const validateBySchema = ajv.compile(schemaJson);
|
|
54580
|
+
const schemaJson = JSON.parse(readFileSync4(schemaPath, "utf-8"));
|
|
54028
54581
|
const pruneExpiredCryptoSessions = (now2 = Date.now()) => {
|
|
54029
54582
|
for (const [id, record2] of Array.from(cryptoSessions.entries())) {
|
|
54030
54583
|
if (now2 - record2.createdAt > CRYPTO_SESSION_TTL_MS) {
|
|
@@ -54118,12 +54671,10 @@ function createAdminApiRoutes(store, registerCleanup) {
|
|
|
54118
54671
|
} catch (err) {
|
|
54119
54672
|
return c2.json({ error: `\u914D\u7F6E\u6821\u9A8C\u5931\u8D25: ${err instanceof Error ? err.message : err}` }, 400);
|
|
54120
54673
|
}
|
|
54121
|
-
|
|
54122
|
-
|
|
54123
|
-
|
|
54124
|
-
|
|
54125
|
-
const message = firstError?.message ?? "unknown schema validation error";
|
|
54126
|
-
return c2.json({ error: `Schema \u6821\u9A8C\u5931\u8D25: ${path} ${message}` }, 400);
|
|
54674
|
+
try {
|
|
54675
|
+
validateConfigOrThrow(candidate);
|
|
54676
|
+
} catch (err) {
|
|
54677
|
+
return c2.json({ error: `\u914D\u7F6E\u6821\u9A8C\u5931\u8D25: ${err instanceof Error ? err.message : err}` }, 400);
|
|
54127
54678
|
}
|
|
54128
54679
|
store.save(candidate);
|
|
54129
54680
|
return c2.json({ ok: true });
|