@reporting-bi/cli 0.1.16 → 0.1.17
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/index.js +721 -682
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3577,52 +3577,52 @@ var require_util = __commonJS({
|
|
|
3577
3577
|
return hash2;
|
|
3578
3578
|
}
|
|
3579
3579
|
exports2.toHash = toHash;
|
|
3580
|
-
function alwaysValidSchema(it,
|
|
3581
|
-
if (typeof
|
|
3582
|
-
return
|
|
3583
|
-
if (Object.keys(
|
|
3580
|
+
function alwaysValidSchema(it, schema2) {
|
|
3581
|
+
if (typeof schema2 == "boolean")
|
|
3582
|
+
return schema2;
|
|
3583
|
+
if (Object.keys(schema2).length === 0)
|
|
3584
3584
|
return true;
|
|
3585
|
-
checkUnknownRules(it,
|
|
3586
|
-
return !schemaHasRules(
|
|
3585
|
+
checkUnknownRules(it, schema2);
|
|
3586
|
+
return !schemaHasRules(schema2, it.self.RULES.all);
|
|
3587
3587
|
}
|
|
3588
3588
|
exports2.alwaysValidSchema = alwaysValidSchema;
|
|
3589
|
-
function checkUnknownRules(it,
|
|
3589
|
+
function checkUnknownRules(it, schema2 = it.schema) {
|
|
3590
3590
|
const { opts, self } = it;
|
|
3591
3591
|
if (!opts.strictSchema)
|
|
3592
3592
|
return;
|
|
3593
|
-
if (typeof
|
|
3593
|
+
if (typeof schema2 === "boolean")
|
|
3594
3594
|
return;
|
|
3595
3595
|
const rules = self.RULES.keywords;
|
|
3596
|
-
for (const key in
|
|
3596
|
+
for (const key in schema2) {
|
|
3597
3597
|
if (!rules[key])
|
|
3598
3598
|
checkStrictMode(it, `unknown keyword: "${key}"`);
|
|
3599
3599
|
}
|
|
3600
3600
|
}
|
|
3601
3601
|
exports2.checkUnknownRules = checkUnknownRules;
|
|
3602
|
-
function schemaHasRules(
|
|
3603
|
-
if (typeof
|
|
3604
|
-
return !
|
|
3605
|
-
for (const key in
|
|
3602
|
+
function schemaHasRules(schema2, rules) {
|
|
3603
|
+
if (typeof schema2 == "boolean")
|
|
3604
|
+
return !schema2;
|
|
3605
|
+
for (const key in schema2)
|
|
3606
3606
|
if (rules[key])
|
|
3607
3607
|
return true;
|
|
3608
3608
|
return false;
|
|
3609
3609
|
}
|
|
3610
3610
|
exports2.schemaHasRules = schemaHasRules;
|
|
3611
|
-
function schemaHasRulesButRef(
|
|
3612
|
-
if (typeof
|
|
3613
|
-
return !
|
|
3614
|
-
for (const key in
|
|
3611
|
+
function schemaHasRulesButRef(schema2, RULES) {
|
|
3612
|
+
if (typeof schema2 == "boolean")
|
|
3613
|
+
return !schema2;
|
|
3614
|
+
for (const key in schema2)
|
|
3615
3615
|
if (key !== "$ref" && RULES.all[key])
|
|
3616
3616
|
return true;
|
|
3617
3617
|
return false;
|
|
3618
3618
|
}
|
|
3619
3619
|
exports2.schemaHasRulesButRef = schemaHasRulesButRef;
|
|
3620
|
-
function schemaRefOrVal({ topSchemaRef, schemaPath },
|
|
3620
|
+
function schemaRefOrVal({ topSchemaRef, schemaPath }, schema2, keyword, $data) {
|
|
3621
3621
|
if (!$data) {
|
|
3622
|
-
if (typeof
|
|
3623
|
-
return
|
|
3624
|
-
if (typeof
|
|
3625
|
-
return (0, codegen_1._)`${
|
|
3622
|
+
if (typeof schema2 == "number" || typeof schema2 == "boolean")
|
|
3623
|
+
return schema2;
|
|
3624
|
+
if (typeof schema2 == "string")
|
|
3625
|
+
return (0, codegen_1._)`${schema2}`;
|
|
3626
3626
|
}
|
|
3627
3627
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
3628
3628
|
}
|
|
@@ -3903,10 +3903,10 @@ var require_boolSchema = __commonJS({
|
|
|
3903
3903
|
message: "boolean schema is false"
|
|
3904
3904
|
};
|
|
3905
3905
|
function topBoolOrEmptySchema(it) {
|
|
3906
|
-
const { gen, schema, validateName } = it;
|
|
3907
|
-
if (
|
|
3906
|
+
const { gen, schema: schema2, validateName } = it;
|
|
3907
|
+
if (schema2 === false) {
|
|
3908
3908
|
falseSchemaError(it, false);
|
|
3909
|
-
} else if (typeof
|
|
3909
|
+
} else if (typeof schema2 == "object" && schema2.$async === true) {
|
|
3910
3910
|
gen.return(names_1.default.data);
|
|
3911
3911
|
} else {
|
|
3912
3912
|
gen.assign((0, codegen_1._)`${validateName}.errors`, null);
|
|
@@ -3915,8 +3915,8 @@ var require_boolSchema = __commonJS({
|
|
|
3915
3915
|
}
|
|
3916
3916
|
exports2.topBoolOrEmptySchema = topBoolOrEmptySchema;
|
|
3917
3917
|
function boolOrEmptySchema(it, valid) {
|
|
3918
|
-
const { gen, schema } = it;
|
|
3919
|
-
if (
|
|
3918
|
+
const { gen, schema: schema2 } = it;
|
|
3919
|
+
if (schema2 === false) {
|
|
3920
3920
|
gen.var(valid, false);
|
|
3921
3921
|
falseSchemaError(it);
|
|
3922
3922
|
} else {
|
|
@@ -3978,18 +3978,18 @@ var require_applicability = __commonJS({
|
|
|
3978
3978
|
"use strict";
|
|
3979
3979
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3980
3980
|
exports2.shouldUseRule = exports2.shouldUseGroup = exports2.schemaHasRulesForType = void 0;
|
|
3981
|
-
function schemaHasRulesForType({ schema, self }, type) {
|
|
3981
|
+
function schemaHasRulesForType({ schema: schema2, self }, type) {
|
|
3982
3982
|
const group = self.RULES.types[type];
|
|
3983
|
-
return group && group !== true && shouldUseGroup(
|
|
3983
|
+
return group && group !== true && shouldUseGroup(schema2, group);
|
|
3984
3984
|
}
|
|
3985
3985
|
exports2.schemaHasRulesForType = schemaHasRulesForType;
|
|
3986
|
-
function shouldUseGroup(
|
|
3987
|
-
return group.rules.some((rule) => shouldUseRule(
|
|
3986
|
+
function shouldUseGroup(schema2, group) {
|
|
3987
|
+
return group.rules.some((rule) => shouldUseRule(schema2, rule));
|
|
3988
3988
|
}
|
|
3989
3989
|
exports2.shouldUseGroup = shouldUseGroup;
|
|
3990
|
-
function shouldUseRule(
|
|
3990
|
+
function shouldUseRule(schema2, rule) {
|
|
3991
3991
|
var _a2;
|
|
3992
|
-
return
|
|
3992
|
+
return schema2[rule.keyword] !== void 0 || ((_a2 = rule.definition.implements) === null || _a2 === void 0 ? void 0 : _a2.some((kwd) => schema2[kwd] !== void 0));
|
|
3993
3993
|
}
|
|
3994
3994
|
exports2.shouldUseRule = shouldUseRule;
|
|
3995
3995
|
}
|
|
@@ -4011,17 +4011,17 @@ var require_dataType = __commonJS({
|
|
|
4011
4011
|
DataType2[DataType2["Correct"] = 0] = "Correct";
|
|
4012
4012
|
DataType2[DataType2["Wrong"] = 1] = "Wrong";
|
|
4013
4013
|
})(DataType || (exports2.DataType = DataType = {}));
|
|
4014
|
-
function getSchemaTypes(
|
|
4015
|
-
const types = getJSONTypes(
|
|
4014
|
+
function getSchemaTypes(schema2) {
|
|
4015
|
+
const types = getJSONTypes(schema2.type);
|
|
4016
4016
|
const hasNull = types.includes("null");
|
|
4017
4017
|
if (hasNull) {
|
|
4018
|
-
if (
|
|
4018
|
+
if (schema2.nullable === false)
|
|
4019
4019
|
throw new Error("type: null contradicts nullable: false");
|
|
4020
4020
|
} else {
|
|
4021
|
-
if (!types.length &&
|
|
4021
|
+
if (!types.length && schema2.nullable !== void 0) {
|
|
4022
4022
|
throw new Error('"nullable" cannot be used without "type"');
|
|
4023
4023
|
}
|
|
4024
|
-
if (
|
|
4024
|
+
if (schema2.nullable === true)
|
|
4025
4025
|
types.push("null");
|
|
4026
4026
|
}
|
|
4027
4027
|
return types;
|
|
@@ -4153,8 +4153,8 @@ var require_dataType = __commonJS({
|
|
|
4153
4153
|
}
|
|
4154
4154
|
exports2.checkDataTypes = checkDataTypes;
|
|
4155
4155
|
var typeError = {
|
|
4156
|
-
message: ({ schema }) => `must be ${
|
|
4157
|
-
params: ({ schema, schemaValue }) => typeof
|
|
4156
|
+
message: ({ schema: schema2 }) => `must be ${schema2}`,
|
|
4157
|
+
params: ({ schema: schema2, schemaValue }) => typeof schema2 == "string" ? (0, codegen_1._)`{type: ${schema2}}` : (0, codegen_1._)`{type: ${schemaValue}}`
|
|
4158
4158
|
};
|
|
4159
4159
|
function reportTypeError(it) {
|
|
4160
4160
|
const cxt = getTypeErrorContext(it);
|
|
@@ -4162,16 +4162,16 @@ var require_dataType = __commonJS({
|
|
|
4162
4162
|
}
|
|
4163
4163
|
exports2.reportTypeError = reportTypeError;
|
|
4164
4164
|
function getTypeErrorContext(it) {
|
|
4165
|
-
const { gen, data, schema } = it;
|
|
4166
|
-
const schemaCode = (0, util_1.schemaRefOrVal)(it,
|
|
4165
|
+
const { gen, data, schema: schema2 } = it;
|
|
4166
|
+
const schemaCode = (0, util_1.schemaRefOrVal)(it, schema2, "type");
|
|
4167
4167
|
return {
|
|
4168
4168
|
gen,
|
|
4169
4169
|
keyword: "type",
|
|
4170
4170
|
data,
|
|
4171
|
-
schema:
|
|
4171
|
+
schema: schema2.type,
|
|
4172
4172
|
schemaCode,
|
|
4173
4173
|
schemaValue: schemaCode,
|
|
4174
|
-
parentSchema:
|
|
4174
|
+
parentSchema: schema2,
|
|
4175
4175
|
params: {},
|
|
4176
4176
|
it
|
|
4177
4177
|
};
|
|
@@ -4324,15 +4324,15 @@ var require_code2 = __commonJS({
|
|
|
4324
4324
|
}
|
|
4325
4325
|
exports2.validateArray = validateArray;
|
|
4326
4326
|
function validateUnion(cxt) {
|
|
4327
|
-
const { gen, schema, keyword, it } = cxt;
|
|
4328
|
-
if (!Array.isArray(
|
|
4327
|
+
const { gen, schema: schema2, keyword, it } = cxt;
|
|
4328
|
+
if (!Array.isArray(schema2))
|
|
4329
4329
|
throw new Error("ajv implementation error");
|
|
4330
|
-
const alwaysValid =
|
|
4330
|
+
const alwaysValid = schema2.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));
|
|
4331
4331
|
if (alwaysValid && !it.opts.unevaluated)
|
|
4332
4332
|
return;
|
|
4333
4333
|
const valid = gen.let("valid", false);
|
|
4334
4334
|
const schValid = gen.name("_valid");
|
|
4335
|
-
gen.block(() =>
|
|
4335
|
+
gen.block(() => schema2.forEach((_sch, i) => {
|
|
4336
4336
|
const schCxt = cxt.subschema({
|
|
4337
4337
|
keyword,
|
|
4338
4338
|
schemaProp: i,
|
|
@@ -4360,8 +4360,8 @@ var require_keyword = __commonJS({
|
|
|
4360
4360
|
var code_1 = require_code2();
|
|
4361
4361
|
var errors_1 = require_errors();
|
|
4362
4362
|
function macroKeywordCode(cxt, def2) {
|
|
4363
|
-
const { gen, keyword, schema, parentSchema, it } = cxt;
|
|
4364
|
-
const macroSchema = def2.macro.call(it.self,
|
|
4363
|
+
const { gen, keyword, schema: schema2, parentSchema, it } = cxt;
|
|
4364
|
+
const macroSchema = def2.macro.call(it.self, schema2, parentSchema, it);
|
|
4365
4365
|
const schemaRef = useKeyword(gen, keyword, macroSchema);
|
|
4366
4366
|
if (it.opts.validateSchema !== false)
|
|
4367
4367
|
it.self.validateSchema(macroSchema, true);
|
|
@@ -4378,9 +4378,9 @@ var require_keyword = __commonJS({
|
|
|
4378
4378
|
exports2.macroKeywordCode = macroKeywordCode;
|
|
4379
4379
|
function funcKeywordCode(cxt, def2) {
|
|
4380
4380
|
var _a2;
|
|
4381
|
-
const { gen, keyword, schema, parentSchema, $data, it } = cxt;
|
|
4381
|
+
const { gen, keyword, schema: schema2, parentSchema, $data, it } = cxt;
|
|
4382
4382
|
checkAsyncKeyword(it, def2);
|
|
4383
|
-
const validate = !$data && def2.compile ? def2.compile.call(it.self,
|
|
4383
|
+
const validate = !$data && def2.compile ? def2.compile.call(it.self, schema2, parentSchema, it) : def2.validate;
|
|
4384
4384
|
const validateRef = useKeyword(gen, keyword, validate);
|
|
4385
4385
|
const valid = gen.let("valid");
|
|
4386
4386
|
cxt.block$data(valid, validateKeyword);
|
|
@@ -4440,20 +4440,20 @@ var require_keyword = __commonJS({
|
|
|
4440
4440
|
throw new Error(`keyword "${keyword}" failed to compile`);
|
|
4441
4441
|
return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) });
|
|
4442
4442
|
}
|
|
4443
|
-
function validSchemaType(
|
|
4444
|
-
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(
|
|
4443
|
+
function validSchemaType(schema2, schemaType, allowUndefined = false) {
|
|
4444
|
+
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema2) : st === "object" ? schema2 && typeof schema2 == "object" && !Array.isArray(schema2) : typeof schema2 == st || allowUndefined && typeof schema2 == "undefined");
|
|
4445
4445
|
}
|
|
4446
4446
|
exports2.validSchemaType = validSchemaType;
|
|
4447
|
-
function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def2, keyword) {
|
|
4447
|
+
function validateKeywordUsage({ schema: schema2, opts, self, errSchemaPath }, def2, keyword) {
|
|
4448
4448
|
if (Array.isArray(def2.keyword) ? !def2.keyword.includes(keyword) : def2.keyword !== keyword) {
|
|
4449
4449
|
throw new Error("ajv implementation error");
|
|
4450
4450
|
}
|
|
4451
4451
|
const deps2 = def2.dependencies;
|
|
4452
|
-
if (deps2 === null || deps2 === void 0 ? void 0 : deps2.some((kwd) => !Object.prototype.hasOwnProperty.call(
|
|
4452
|
+
if (deps2 === null || deps2 === void 0 ? void 0 : deps2.some((kwd) => !Object.prototype.hasOwnProperty.call(schema2, kwd))) {
|
|
4453
4453
|
throw new Error(`parent schema must have dependencies of ${keyword}: ${deps2.join(",")}`);
|
|
4454
4454
|
}
|
|
4455
4455
|
if (def2.validateSchema) {
|
|
4456
|
-
const valid = def2.validateSchema(
|
|
4456
|
+
const valid = def2.validateSchema(schema2[keyword]);
|
|
4457
4457
|
if (!valid) {
|
|
4458
4458
|
const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def2.validateSchema.errors);
|
|
4459
4459
|
if (opts.validateSchema === "log")
|
|
@@ -4475,8 +4475,8 @@ var require_subschema = __commonJS({
|
|
|
4475
4475
|
exports2.extendSubschemaMode = exports2.extendSubschemaData = exports2.getSubschema = void 0;
|
|
4476
4476
|
var codegen_1 = require_codegen();
|
|
4477
4477
|
var util_1 = require_util();
|
|
4478
|
-
function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
|
|
4479
|
-
if (keyword !== void 0 &&
|
|
4478
|
+
function getSubschema(it, { keyword, schemaProp, schema: schema2, schemaPath, errSchemaPath, topSchemaRef }) {
|
|
4479
|
+
if (keyword !== void 0 && schema2 !== void 0) {
|
|
4480
4480
|
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
4481
4481
|
}
|
|
4482
4482
|
if (keyword !== void 0) {
|
|
@@ -4491,12 +4491,12 @@ var require_subschema = __commonJS({
|
|
|
4491
4491
|
errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`
|
|
4492
4492
|
};
|
|
4493
4493
|
}
|
|
4494
|
-
if (
|
|
4494
|
+
if (schema2 !== void 0) {
|
|
4495
4495
|
if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
|
|
4496
4496
|
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
|
4497
4497
|
}
|
|
4498
4498
|
return {
|
|
4499
|
-
schema,
|
|
4499
|
+
schema: schema2,
|
|
4500
4500
|
schemaPath,
|
|
4501
4501
|
topSchemaRef,
|
|
4502
4502
|
errSchemaPath
|
|
@@ -4589,7 +4589,7 @@ var require_fast_deep_equal = __commonJS({
|
|
|
4589
4589
|
var require_json_schema_traverse = __commonJS({
|
|
4590
4590
|
"../../.yarn/cache/json-schema-traverse-npm-1.0.0-fb3684f4f0-71e30015d7.zip/node_modules/json-schema-traverse/index.js"(exports2, module2) {
|
|
4591
4591
|
"use strict";
|
|
4592
|
-
var traverse = module2.exports = function(
|
|
4592
|
+
var traverse = module2.exports = function(schema2, opts, cb) {
|
|
4593
4593
|
if (typeof opts == "function") {
|
|
4594
4594
|
cb = opts;
|
|
4595
4595
|
opts = {};
|
|
@@ -4599,7 +4599,7 @@ var require_json_schema_traverse = __commonJS({
|
|
|
4599
4599
|
};
|
|
4600
4600
|
var post = cb.post || function() {
|
|
4601
4601
|
};
|
|
4602
|
-
_traverse(opts, pre, post,
|
|
4602
|
+
_traverse(opts, pre, post, schema2, "", schema2);
|
|
4603
4603
|
};
|
|
4604
4604
|
traverse.keywords = {
|
|
4605
4605
|
additionalItems: true,
|
|
@@ -4645,26 +4645,26 @@ var require_json_schema_traverse = __commonJS({
|
|
|
4645
4645
|
maxProperties: true,
|
|
4646
4646
|
minProperties: true
|
|
4647
4647
|
};
|
|
4648
|
-
function _traverse(opts, pre, post,
|
|
4649
|
-
if (
|
|
4650
|
-
pre(
|
|
4651
|
-
for (var key in
|
|
4652
|
-
var sch =
|
|
4648
|
+
function _traverse(opts, pre, post, schema2, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
4649
|
+
if (schema2 && typeof schema2 == "object" && !Array.isArray(schema2)) {
|
|
4650
|
+
pre(schema2, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
4651
|
+
for (var key in schema2) {
|
|
4652
|
+
var sch = schema2[key];
|
|
4653
4653
|
if (Array.isArray(sch)) {
|
|
4654
4654
|
if (key in traverse.arrayKeywords) {
|
|
4655
4655
|
for (var i = 0; i < sch.length; i++)
|
|
4656
|
-
_traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key,
|
|
4656
|
+
_traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key, schema2, i);
|
|
4657
4657
|
}
|
|
4658
4658
|
} else if (key in traverse.propsKeywords) {
|
|
4659
4659
|
if (sch && typeof sch == "object") {
|
|
4660
4660
|
for (var prop in sch)
|
|
4661
|
-
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key,
|
|
4661
|
+
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema2, prop);
|
|
4662
4662
|
}
|
|
4663
4663
|
} else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) {
|
|
4664
|
-
_traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key,
|
|
4664
|
+
_traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema2);
|
|
4665
4665
|
}
|
|
4666
4666
|
}
|
|
4667
|
-
post(
|
|
4667
|
+
post(schema2, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
4668
4668
|
}
|
|
4669
4669
|
}
|
|
4670
4670
|
function escapeJsonPtr(str) {
|
|
@@ -4700,14 +4700,14 @@ var require_resolve = __commonJS({
|
|
|
4700
4700
|
"enum",
|
|
4701
4701
|
"const"
|
|
4702
4702
|
]);
|
|
4703
|
-
function inlineRef(
|
|
4704
|
-
if (typeof
|
|
4703
|
+
function inlineRef(schema2, limit = true) {
|
|
4704
|
+
if (typeof schema2 == "boolean")
|
|
4705
4705
|
return true;
|
|
4706
4706
|
if (limit === true)
|
|
4707
|
-
return !hasRef(
|
|
4707
|
+
return !hasRef(schema2);
|
|
4708
4708
|
if (!limit)
|
|
4709
4709
|
return false;
|
|
4710
|
-
return countKeys(
|
|
4710
|
+
return countKeys(schema2) <= limit;
|
|
4711
4711
|
}
|
|
4712
4712
|
exports2.inlineRef = inlineRef;
|
|
4713
4713
|
var REF_KEYWORDS = /* @__PURE__ */ new Set([
|
|
@@ -4717,11 +4717,11 @@ var require_resolve = __commonJS({
|
|
|
4717
4717
|
"$dynamicRef",
|
|
4718
4718
|
"$dynamicAnchor"
|
|
4719
4719
|
]);
|
|
4720
|
-
function hasRef(
|
|
4721
|
-
for (const key in
|
|
4720
|
+
function hasRef(schema2) {
|
|
4721
|
+
for (const key in schema2) {
|
|
4722
4722
|
if (REF_KEYWORDS.has(key))
|
|
4723
4723
|
return true;
|
|
4724
|
-
const sch =
|
|
4724
|
+
const sch = schema2[key];
|
|
4725
4725
|
if (Array.isArray(sch) && sch.some(hasRef))
|
|
4726
4726
|
return true;
|
|
4727
4727
|
if (typeof sch == "object" && hasRef(sch))
|
|
@@ -4729,16 +4729,16 @@ var require_resolve = __commonJS({
|
|
|
4729
4729
|
}
|
|
4730
4730
|
return false;
|
|
4731
4731
|
}
|
|
4732
|
-
function countKeys(
|
|
4732
|
+
function countKeys(schema2) {
|
|
4733
4733
|
let count = 0;
|
|
4734
|
-
for (const key in
|
|
4734
|
+
for (const key in schema2) {
|
|
4735
4735
|
if (key === "$ref")
|
|
4736
4736
|
return Infinity;
|
|
4737
4737
|
count++;
|
|
4738
4738
|
if (SIMPLE_INLINED.has(key))
|
|
4739
4739
|
continue;
|
|
4740
|
-
if (typeof
|
|
4741
|
-
(0, util_1.eachItem)(
|
|
4740
|
+
if (typeof schema2[key] == "object") {
|
|
4741
|
+
(0, util_1.eachItem)(schema2[key], (sch) => count += countKeys(sch));
|
|
4742
4742
|
}
|
|
4743
4743
|
if (count === Infinity)
|
|
4744
4744
|
return Infinity;
|
|
@@ -4768,16 +4768,16 @@ var require_resolve = __commonJS({
|
|
|
4768
4768
|
}
|
|
4769
4769
|
exports2.resolveUrl = resolveUrl;
|
|
4770
4770
|
var ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
4771
|
-
function getSchemaRefs(
|
|
4772
|
-
if (typeof
|
|
4771
|
+
function getSchemaRefs(schema2, baseId) {
|
|
4772
|
+
if (typeof schema2 == "boolean")
|
|
4773
4773
|
return {};
|
|
4774
4774
|
const { schemaId, uriResolver } = this.opts;
|
|
4775
|
-
const schId = normalizeId(
|
|
4775
|
+
const schId = normalizeId(schema2[schemaId] || baseId);
|
|
4776
4776
|
const baseIds = { "": schId };
|
|
4777
4777
|
const pathPrefix = getFullPath(uriResolver, schId, false);
|
|
4778
4778
|
const localRefs = {};
|
|
4779
4779
|
const schemaRefs = /* @__PURE__ */ new Set();
|
|
4780
|
-
traverse(
|
|
4780
|
+
traverse(schema2, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
|
|
4781
4781
|
if (parentJsonPtr === void 0)
|
|
4782
4782
|
return;
|
|
4783
4783
|
const fullPath = pathPrefix + jsonPtr;
|
|
@@ -4858,15 +4858,15 @@ var require_validate = __commonJS({
|
|
|
4858
4858
|
validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
|
|
4859
4859
|
}
|
|
4860
4860
|
exports2.validateFunctionCode = validateFunctionCode;
|
|
4861
|
-
function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
|
|
4861
|
+
function validateFunction({ gen, validateName, schema: schema2, schemaEnv, opts }, body) {
|
|
4862
4862
|
if (opts.code.es5) {
|
|
4863
4863
|
gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
|
|
4864
|
-
gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(
|
|
4864
|
+
gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema2, opts)}`);
|
|
4865
4865
|
destructureValCxtES5(gen, opts);
|
|
4866
4866
|
gen.code(body);
|
|
4867
4867
|
});
|
|
4868
4868
|
} else {
|
|
4869
|
-
gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(
|
|
4869
|
+
gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema2, opts)).code(body));
|
|
4870
4870
|
}
|
|
4871
4871
|
}
|
|
4872
4872
|
function destructureValCxt(opts) {
|
|
@@ -4890,9 +4890,9 @@ var require_validate = __commonJS({
|
|
|
4890
4890
|
});
|
|
4891
4891
|
}
|
|
4892
4892
|
function topSchemaObjCode(it) {
|
|
4893
|
-
const { schema, opts, gen } = it;
|
|
4893
|
+
const { schema: schema2, opts, gen } = it;
|
|
4894
4894
|
validateFunction(it, () => {
|
|
4895
|
-
if (opts.$comment &&
|
|
4895
|
+
if (opts.$comment && schema2.$comment)
|
|
4896
4896
|
commentKeyword(it);
|
|
4897
4897
|
checkNoDefault(it);
|
|
4898
4898
|
gen.let(names_1.default.vErrors, null);
|
|
@@ -4910,8 +4910,8 @@ var require_validate = __commonJS({
|
|
|
4910
4910
|
gen.if((0, codegen_1._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._)`${it.evaluated}.props`, (0, codegen_1._)`undefined`));
|
|
4911
4911
|
gen.if((0, codegen_1._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._)`${it.evaluated}.items`, (0, codegen_1._)`undefined`));
|
|
4912
4912
|
}
|
|
4913
|
-
function funcSourceUrl(
|
|
4914
|
-
const schId = typeof
|
|
4913
|
+
function funcSourceUrl(schema2, opts) {
|
|
4914
|
+
const schId = typeof schema2 == "object" && schema2[opts.schemaId];
|
|
4915
4915
|
return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._)`/*# sourceURL=${schId} */` : codegen_1.nil;
|
|
4916
4916
|
}
|
|
4917
4917
|
function subschemaCode(it, valid) {
|
|
@@ -4924,10 +4924,10 @@ var require_validate = __commonJS({
|
|
|
4924
4924
|
}
|
|
4925
4925
|
(0, boolSchema_1.boolOrEmptySchema)(it, valid);
|
|
4926
4926
|
}
|
|
4927
|
-
function schemaCxtHasRules({ schema, self }) {
|
|
4928
|
-
if (typeof
|
|
4929
|
-
return !
|
|
4930
|
-
for (const key in
|
|
4927
|
+
function schemaCxtHasRules({ schema: schema2, self }) {
|
|
4928
|
+
if (typeof schema2 == "boolean")
|
|
4929
|
+
return !schema2;
|
|
4930
|
+
for (const key in schema2)
|
|
4931
4931
|
if (self.RULES.all[key])
|
|
4932
4932
|
return true;
|
|
4933
4933
|
return false;
|
|
@@ -4936,8 +4936,8 @@ var require_validate = __commonJS({
|
|
|
4936
4936
|
return typeof it.schema != "boolean";
|
|
4937
4937
|
}
|
|
4938
4938
|
function subSchemaObjCode(it, valid) {
|
|
4939
|
-
const { schema, gen, opts } = it;
|
|
4940
|
-
if (opts.$comment &&
|
|
4939
|
+
const { schema: schema2, gen, opts } = it;
|
|
4940
|
+
if (opts.$comment && schema2.$comment)
|
|
4941
4941
|
commentKeyword(it);
|
|
4942
4942
|
updateContext(it);
|
|
4943
4943
|
checkAsyncSchema(it);
|
|
@@ -4957,14 +4957,14 @@ var require_validate = __commonJS({
|
|
|
4957
4957
|
schemaKeywords(it, types, !checkedTypes, errsCount);
|
|
4958
4958
|
}
|
|
4959
4959
|
function checkRefsAndKeywords(it) {
|
|
4960
|
-
const { schema, errSchemaPath, opts, self } = it;
|
|
4961
|
-
if (
|
|
4960
|
+
const { schema: schema2, errSchemaPath, opts, self } = it;
|
|
4961
|
+
if (schema2.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema2, self.RULES)) {
|
|
4962
4962
|
self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
|
|
4963
4963
|
}
|
|
4964
4964
|
}
|
|
4965
4965
|
function checkNoDefault(it) {
|
|
4966
|
-
const { schema, opts } = it;
|
|
4967
|
-
if (
|
|
4966
|
+
const { schema: schema2, opts } = it;
|
|
4967
|
+
if (schema2.default !== void 0 && opts.useDefaults && opts.strictSchema) {
|
|
4968
4968
|
(0, util_1.checkStrictMode)(it, "default is ignored in the schema root");
|
|
4969
4969
|
}
|
|
4970
4970
|
}
|
|
@@ -4977,8 +4977,8 @@ var require_validate = __commonJS({
|
|
|
4977
4977
|
if (it.schema.$async && !it.schemaEnv.$async)
|
|
4978
4978
|
throw new Error("async schema in sync schema");
|
|
4979
4979
|
}
|
|
4980
|
-
function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
|
|
4981
|
-
const msg =
|
|
4980
|
+
function commentKeyword({ gen, schemaEnv, schema: schema2, errSchemaPath, opts }) {
|
|
4981
|
+
const msg = schema2.$comment;
|
|
4982
4982
|
if (opts.$comment === true) {
|
|
4983
4983
|
gen.code((0, codegen_1._)`${names_1.default.self}.logger.log(${msg})`);
|
|
4984
4984
|
} else if (typeof opts.$comment == "function") {
|
|
@@ -5005,9 +5005,9 @@ var require_validate = __commonJS({
|
|
|
5005
5005
|
gen.assign((0, codegen_1._)`${evaluated}.items`, items);
|
|
5006
5006
|
}
|
|
5007
5007
|
function schemaKeywords(it, types, typeErrors, errsCount) {
|
|
5008
|
-
const { gen, schema, data, allErrors, opts, self } = it;
|
|
5008
|
+
const { gen, schema: schema2, data, allErrors, opts, self } = it;
|
|
5009
5009
|
const { RULES } = self;
|
|
5010
|
-
if (
|
|
5010
|
+
if (schema2.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema2, RULES))) {
|
|
5011
5011
|
gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
|
|
5012
5012
|
return;
|
|
5013
5013
|
}
|
|
@@ -5019,7 +5019,7 @@ var require_validate = __commonJS({
|
|
|
5019
5019
|
groupKeywords(RULES.post);
|
|
5020
5020
|
});
|
|
5021
5021
|
function groupKeywords(group) {
|
|
5022
|
-
if (!(0, applicability_1.shouldUseGroup)(
|
|
5022
|
+
if (!(0, applicability_1.shouldUseGroup)(schema2, group))
|
|
5023
5023
|
return;
|
|
5024
5024
|
if (group.type) {
|
|
5025
5025
|
gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
|
|
@@ -5037,12 +5037,12 @@ var require_validate = __commonJS({
|
|
|
5037
5037
|
}
|
|
5038
5038
|
}
|
|
5039
5039
|
function iterateKeywords(it, group) {
|
|
5040
|
-
const { gen, schema, opts: { useDefaults } } = it;
|
|
5040
|
+
const { gen, schema: schema2, opts: { useDefaults } } = it;
|
|
5041
5041
|
if (useDefaults)
|
|
5042
5042
|
(0, defaults_1.assignDefaults)(it, group.type);
|
|
5043
5043
|
gen.block(() => {
|
|
5044
5044
|
for (const rule of group.rules) {
|
|
5045
|
-
if ((0, applicability_1.shouldUseRule)(
|
|
5045
|
+
if ((0, applicability_1.shouldUseRule)(schema2, rule)) {
|
|
5046
5046
|
keywordCode(it, rule.keyword, rule.definition, group.type);
|
|
5047
5047
|
}
|
|
5048
5048
|
}
|
|
@@ -5387,17 +5387,17 @@ var require_compile = __commonJS({
|
|
|
5387
5387
|
var _a2;
|
|
5388
5388
|
this.refs = {};
|
|
5389
5389
|
this.dynamicAnchors = {};
|
|
5390
|
-
let
|
|
5390
|
+
let schema2;
|
|
5391
5391
|
if (typeof env.schema == "object")
|
|
5392
|
-
|
|
5392
|
+
schema2 = env.schema;
|
|
5393
5393
|
this.schema = env.schema;
|
|
5394
5394
|
this.schemaId = env.schemaId;
|
|
5395
5395
|
this.root = env.root || this;
|
|
5396
|
-
this.baseId = (_a2 = env.baseId) !== null && _a2 !== void 0 ? _a2 : (0, resolve_1.normalizeId)(
|
|
5396
|
+
this.baseId = (_a2 = env.baseId) !== null && _a2 !== void 0 ? _a2 : (0, resolve_1.normalizeId)(schema2 === null || schema2 === void 0 ? void 0 : schema2[env.schemaId || "$id"]);
|
|
5397
5397
|
this.schemaPath = env.schemaPath;
|
|
5398
5398
|
this.localRefs = env.localRefs;
|
|
5399
5399
|
this.meta = env.meta;
|
|
5400
|
-
this.$async =
|
|
5400
|
+
this.$async = schema2 === null || schema2 === void 0 ? void 0 : schema2.$async;
|
|
5401
5401
|
this.refs = {};
|
|
5402
5402
|
}
|
|
5403
5403
|
};
|
|
@@ -5496,10 +5496,10 @@ var require_compile = __commonJS({
|
|
|
5496
5496
|
return schOrFunc;
|
|
5497
5497
|
let _sch = resolve8.call(this, root, ref);
|
|
5498
5498
|
if (_sch === void 0) {
|
|
5499
|
-
const
|
|
5499
|
+
const schema2 = (_a2 = root.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
|
|
5500
5500
|
const { schemaId } = this.opts;
|
|
5501
|
-
if (
|
|
5502
|
-
_sch = new SchemaEnv({ schema, schemaId, root, baseId });
|
|
5501
|
+
if (schema2)
|
|
5502
|
+
_sch = new SchemaEnv({ schema: schema2, schemaId, root, baseId });
|
|
5503
5503
|
}
|
|
5504
5504
|
if (_sch === void 0)
|
|
5505
5505
|
return;
|
|
@@ -5547,12 +5547,12 @@ var require_compile = __commonJS({
|
|
|
5547
5547
|
if (!schOrRef.validate)
|
|
5548
5548
|
compileSchema.call(this, schOrRef);
|
|
5549
5549
|
if (id === (0, resolve_1.normalizeId)(ref)) {
|
|
5550
|
-
const { schema } = schOrRef;
|
|
5550
|
+
const { schema: schema2 } = schOrRef;
|
|
5551
5551
|
const { schemaId } = this.opts;
|
|
5552
|
-
const schId =
|
|
5552
|
+
const schId = schema2[schemaId];
|
|
5553
5553
|
if (schId)
|
|
5554
5554
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
5555
|
-
return new SchemaEnv({ schema, schemaId, root, baseId });
|
|
5555
|
+
return new SchemaEnv({ schema: schema2, schemaId, root, baseId });
|
|
5556
5556
|
}
|
|
5557
5557
|
return getJsonPointer.call(this, p, schOrRef);
|
|
5558
5558
|
}
|
|
@@ -5564,29 +5564,29 @@ var require_compile = __commonJS({
|
|
|
5564
5564
|
"dependencies",
|
|
5565
5565
|
"definitions"
|
|
5566
5566
|
]);
|
|
5567
|
-
function getJsonPointer(parsedRef, { baseId, schema, root }) {
|
|
5567
|
+
function getJsonPointer(parsedRef, { baseId, schema: schema2, root }) {
|
|
5568
5568
|
var _a2;
|
|
5569
5569
|
if (((_a2 = parsedRef.fragment) === null || _a2 === void 0 ? void 0 : _a2[0]) !== "/")
|
|
5570
5570
|
return;
|
|
5571
5571
|
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
5572
|
-
if (typeof
|
|
5572
|
+
if (typeof schema2 === "boolean")
|
|
5573
5573
|
return;
|
|
5574
|
-
const partSchema =
|
|
5574
|
+
const partSchema = schema2[(0, util_1.unescapeFragment)(part)];
|
|
5575
5575
|
if (partSchema === void 0)
|
|
5576
5576
|
return;
|
|
5577
|
-
|
|
5578
|
-
const schId = typeof
|
|
5577
|
+
schema2 = partSchema;
|
|
5578
|
+
const schId = typeof schema2 === "object" && schema2[this.opts.schemaId];
|
|
5579
5579
|
if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
|
|
5580
5580
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
5581
5581
|
}
|
|
5582
5582
|
}
|
|
5583
5583
|
let env;
|
|
5584
|
-
if (typeof
|
|
5585
|
-
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId,
|
|
5584
|
+
if (typeof schema2 != "boolean" && schema2.$ref && !(0, util_1.schemaHasRulesButRef)(schema2, this.RULES)) {
|
|
5585
|
+
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema2.$ref);
|
|
5586
5586
|
env = resolveSchema.call(this, root, $ref);
|
|
5587
5587
|
}
|
|
5588
5588
|
const { schemaId } = this.opts;
|
|
5589
|
-
env = env || new SchemaEnv({ schema, schemaId, root, baseId });
|
|
5589
|
+
env = env || new SchemaEnv({ schema: schema2, schemaId, root, baseId });
|
|
5590
5590
|
if (env.schema !== env.root.schema)
|
|
5591
5591
|
return env;
|
|
5592
5592
|
return void 0;
|
|
@@ -6515,16 +6515,16 @@ var require_core = __commonJS({
|
|
|
6515
6515
|
this.errors = v.errors;
|
|
6516
6516
|
return valid;
|
|
6517
6517
|
}
|
|
6518
|
-
compile(
|
|
6519
|
-
const sch = this._addSchema(
|
|
6518
|
+
compile(schema2, _meta) {
|
|
6519
|
+
const sch = this._addSchema(schema2, _meta);
|
|
6520
6520
|
return sch.validate || this._compileSchemaEnv(sch);
|
|
6521
6521
|
}
|
|
6522
|
-
compileAsync(
|
|
6522
|
+
compileAsync(schema2, meta3) {
|
|
6523
6523
|
if (typeof this.opts.loadSchema != "function") {
|
|
6524
6524
|
throw new Error("options.loadSchema should be a function");
|
|
6525
6525
|
}
|
|
6526
6526
|
const { loadSchema } = this.opts;
|
|
6527
|
-
return runCompileAsync.call(this,
|
|
6527
|
+
return runCompileAsync.call(this, schema2, meta3);
|
|
6528
6528
|
async function runCompileAsync(_schema, _meta) {
|
|
6529
6529
|
await loadMetaSchema.call(this, _schema.$schema);
|
|
6530
6530
|
const sch = this._addSchema(_schema, _meta);
|
|
@@ -6570,37 +6570,37 @@ var require_core = __commonJS({
|
|
|
6570
6570
|
}
|
|
6571
6571
|
}
|
|
6572
6572
|
// Adds schema to the instance
|
|
6573
|
-
addSchema(
|
|
6574
|
-
if (Array.isArray(
|
|
6575
|
-
for (const sch of
|
|
6573
|
+
addSchema(schema2, key, _meta, _validateSchema = this.opts.validateSchema) {
|
|
6574
|
+
if (Array.isArray(schema2)) {
|
|
6575
|
+
for (const sch of schema2)
|
|
6576
6576
|
this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
6577
6577
|
return this;
|
|
6578
6578
|
}
|
|
6579
6579
|
let id;
|
|
6580
|
-
if (typeof
|
|
6580
|
+
if (typeof schema2 === "object") {
|
|
6581
6581
|
const { schemaId } = this.opts;
|
|
6582
|
-
id =
|
|
6582
|
+
id = schema2[schemaId];
|
|
6583
6583
|
if (id !== void 0 && typeof id != "string") {
|
|
6584
6584
|
throw new Error(`schema ${schemaId} must be string`);
|
|
6585
6585
|
}
|
|
6586
6586
|
}
|
|
6587
6587
|
key = (0, resolve_1.normalizeId)(key || id);
|
|
6588
6588
|
this._checkUnique(key);
|
|
6589
|
-
this.schemas[key] = this._addSchema(
|
|
6589
|
+
this.schemas[key] = this._addSchema(schema2, _meta, key, _validateSchema, true);
|
|
6590
6590
|
return this;
|
|
6591
6591
|
}
|
|
6592
6592
|
// Add schema that will be used to validate other schemas
|
|
6593
6593
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
6594
|
-
addMetaSchema(
|
|
6595
|
-
this.addSchema(
|
|
6594
|
+
addMetaSchema(schema2, key, _validateSchema = this.opts.validateSchema) {
|
|
6595
|
+
this.addSchema(schema2, key, true, _validateSchema);
|
|
6596
6596
|
return this;
|
|
6597
6597
|
}
|
|
6598
6598
|
// Validate schema against its meta-schema
|
|
6599
|
-
validateSchema(
|
|
6600
|
-
if (typeof
|
|
6599
|
+
validateSchema(schema2, throwOrLogError) {
|
|
6600
|
+
if (typeof schema2 == "boolean")
|
|
6601
6601
|
return true;
|
|
6602
6602
|
let $schema;
|
|
6603
|
-
$schema =
|
|
6603
|
+
$schema = schema2.$schema;
|
|
6604
6604
|
if ($schema !== void 0 && typeof $schema != "string") {
|
|
6605
6605
|
throw new Error("$schema must be a string");
|
|
6606
6606
|
}
|
|
@@ -6610,7 +6610,7 @@ var require_core = __commonJS({
|
|
|
6610
6610
|
this.errors = null;
|
|
6611
6611
|
return true;
|
|
6612
6612
|
}
|
|
6613
|
-
const valid = this.validate($schema,
|
|
6613
|
+
const valid = this.validate($schema, schema2);
|
|
6614
6614
|
if (!valid && throwOrLogError) {
|
|
6615
6615
|
const message = "schema is invalid: " + this.errorsText();
|
|
6616
6616
|
if (this.opts.validateSchema === "log")
|
|
@@ -6753,9 +6753,9 @@ var require_core = __commonJS({
|
|
|
6753
6753
|
if (typeof rule != "object")
|
|
6754
6754
|
continue;
|
|
6755
6755
|
const { $data } = rule.definition;
|
|
6756
|
-
const
|
|
6757
|
-
if ($data &&
|
|
6758
|
-
keywords[key] = schemaOrData(
|
|
6756
|
+
const schema2 = keywords[key];
|
|
6757
|
+
if ($data && schema2)
|
|
6758
|
+
keywords[key] = schemaOrData(schema2);
|
|
6759
6759
|
}
|
|
6760
6760
|
}
|
|
6761
6761
|
return metaSchema;
|
|
@@ -6773,23 +6773,23 @@ var require_core = __commonJS({
|
|
|
6773
6773
|
}
|
|
6774
6774
|
}
|
|
6775
6775
|
}
|
|
6776
|
-
_addSchema(
|
|
6776
|
+
_addSchema(schema2, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
6777
6777
|
let id;
|
|
6778
6778
|
const { schemaId } = this.opts;
|
|
6779
|
-
if (typeof
|
|
6780
|
-
id =
|
|
6779
|
+
if (typeof schema2 == "object") {
|
|
6780
|
+
id = schema2[schemaId];
|
|
6781
6781
|
} else {
|
|
6782
6782
|
if (this.opts.jtd)
|
|
6783
6783
|
throw new Error("schema must be object");
|
|
6784
|
-
else if (typeof
|
|
6784
|
+
else if (typeof schema2 != "boolean")
|
|
6785
6785
|
throw new Error("schema must be object or boolean");
|
|
6786
6786
|
}
|
|
6787
|
-
let sch = this._cache.get(
|
|
6787
|
+
let sch = this._cache.get(schema2);
|
|
6788
6788
|
if (sch !== void 0)
|
|
6789
6789
|
return sch;
|
|
6790
6790
|
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
6791
|
-
const localRefs = resolve_1.getSchemaRefs.call(this,
|
|
6792
|
-
sch = new compile_1.SchemaEnv({ schema, schemaId, meta: meta3, baseId, localRefs });
|
|
6791
|
+
const localRefs = resolve_1.getSchemaRefs.call(this, schema2, baseId);
|
|
6792
|
+
sch = new compile_1.SchemaEnv({ schema: schema2, schemaId, meta: meta3, baseId, localRefs });
|
|
6793
6793
|
this._cache.set(sch.schema, sch);
|
|
6794
6794
|
if (addSchema && !baseId.startsWith("#")) {
|
|
6795
6795
|
if (baseId)
|
|
@@ -6797,7 +6797,7 @@ var require_core = __commonJS({
|
|
|
6797
6797
|
this.refs[baseId] = sch;
|
|
6798
6798
|
}
|
|
6799
6799
|
if (validateSchema)
|
|
6800
|
-
this.validateSchema(
|
|
6800
|
+
this.validateSchema(schema2, true);
|
|
6801
6801
|
return sch;
|
|
6802
6802
|
}
|
|
6803
6803
|
_checkUnique(id) {
|
|
@@ -6951,8 +6951,8 @@ var require_core = __commonJS({
|
|
|
6951
6951
|
var $dataRef = {
|
|
6952
6952
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6953
6953
|
};
|
|
6954
|
-
function schemaOrData(
|
|
6955
|
-
return { anyOf: [
|
|
6954
|
+
function schemaOrData(schema2) {
|
|
6955
|
+
return { anyOf: [schema2, $dataRef] };
|
|
6956
6956
|
}
|
|
6957
6957
|
}
|
|
6958
6958
|
});
|
|
@@ -7252,7 +7252,7 @@ var require_pattern = __commonJS({
|
|
|
7252
7252
|
$data: true,
|
|
7253
7253
|
error: error48,
|
|
7254
7254
|
code(cxt) {
|
|
7255
|
-
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
7255
|
+
const { gen, data, $data, schema: schema2, schemaCode, it } = cxt;
|
|
7256
7256
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
7257
7257
|
if ($data) {
|
|
7258
7258
|
const { regExp } = it.opts.code;
|
|
@@ -7261,7 +7261,7 @@ var require_pattern = __commonJS({
|
|
|
7261
7261
|
gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
|
|
7262
7262
|
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
7263
7263
|
} else {
|
|
7264
|
-
const regExp = (0, code_1.usePattern)(cxt,
|
|
7264
|
+
const regExp = (0, code_1.usePattern)(cxt, schema2);
|
|
7265
7265
|
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
7266
7266
|
}
|
|
7267
7267
|
}
|
|
@@ -7318,11 +7318,11 @@ var require_required = __commonJS({
|
|
|
7318
7318
|
$data: true,
|
|
7319
7319
|
error: error48,
|
|
7320
7320
|
code(cxt) {
|
|
7321
|
-
const { gen, schema, schemaCode, data, $data, it } = cxt;
|
|
7321
|
+
const { gen, schema: schema2, schemaCode, data, $data, it } = cxt;
|
|
7322
7322
|
const { opts } = it;
|
|
7323
|
-
if (!$data &&
|
|
7323
|
+
if (!$data && schema2.length === 0)
|
|
7324
7324
|
return;
|
|
7325
|
-
const useLoop =
|
|
7325
|
+
const useLoop = schema2.length >= opts.loopRequired;
|
|
7326
7326
|
if (it.allErrors)
|
|
7327
7327
|
allErrorsMode();
|
|
7328
7328
|
else
|
|
@@ -7330,7 +7330,7 @@ var require_required = __commonJS({
|
|
|
7330
7330
|
if (opts.strictRequired) {
|
|
7331
7331
|
const props = cxt.parentSchema.properties;
|
|
7332
7332
|
const { definedProperties } = cxt.it;
|
|
7333
|
-
for (const requiredKey of
|
|
7333
|
+
for (const requiredKey of schema2) {
|
|
7334
7334
|
if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === void 0 && !definedProperties.has(requiredKey)) {
|
|
7335
7335
|
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
|
7336
7336
|
const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`;
|
|
@@ -7342,7 +7342,7 @@ var require_required = __commonJS({
|
|
|
7342
7342
|
if (useLoop || $data) {
|
|
7343
7343
|
cxt.block$data(codegen_1.nil, loopAllRequired);
|
|
7344
7344
|
} else {
|
|
7345
|
-
for (const prop of
|
|
7345
|
+
for (const prop of schema2) {
|
|
7346
7346
|
(0, code_1.checkReportMissingProp)(cxt, prop);
|
|
7347
7347
|
}
|
|
7348
7348
|
}
|
|
@@ -7354,7 +7354,7 @@ var require_required = __commonJS({
|
|
|
7354
7354
|
cxt.block$data(valid, () => loopUntilMissing(missing, valid));
|
|
7355
7355
|
cxt.ok(valid);
|
|
7356
7356
|
} else {
|
|
7357
|
-
gen.if((0, code_1.checkMissingProp)(cxt,
|
|
7357
|
+
gen.if((0, code_1.checkMissingProp)(cxt, schema2, missing));
|
|
7358
7358
|
(0, code_1.reportMissingProp)(cxt, missing);
|
|
7359
7359
|
gen.else();
|
|
7360
7360
|
}
|
|
@@ -7441,8 +7441,8 @@ var require_uniqueItems = __commonJS({
|
|
|
7441
7441
|
$data: true,
|
|
7442
7442
|
error: error48,
|
|
7443
7443
|
code(cxt) {
|
|
7444
|
-
const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt;
|
|
7445
|
-
if (!$data && !
|
|
7444
|
+
const { gen, data, $data, schema: schema2, parentSchema, schemaCode, it } = cxt;
|
|
7445
|
+
if (!$data && !schema2)
|
|
7446
7446
|
return;
|
|
7447
7447
|
const valid = gen.let("valid");
|
|
7448
7448
|
const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : [];
|
|
@@ -7505,11 +7505,11 @@ var require_const = __commonJS({
|
|
|
7505
7505
|
$data: true,
|
|
7506
7506
|
error: error48,
|
|
7507
7507
|
code(cxt) {
|
|
7508
|
-
const { gen, data, $data, schemaCode, schema } = cxt;
|
|
7509
|
-
if ($data ||
|
|
7508
|
+
const { gen, data, $data, schemaCode, schema: schema2 } = cxt;
|
|
7509
|
+
if ($data || schema2 && typeof schema2 == "object") {
|
|
7510
7510
|
cxt.fail$data((0, codegen_1._)`!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`);
|
|
7511
7511
|
} else {
|
|
7512
|
-
cxt.fail((0, codegen_1._)`${
|
|
7512
|
+
cxt.fail((0, codegen_1._)`${schema2} !== ${data}`);
|
|
7513
7513
|
}
|
|
7514
7514
|
}
|
|
7515
7515
|
};
|
|
@@ -7535,10 +7535,10 @@ var require_enum = __commonJS({
|
|
|
7535
7535
|
$data: true,
|
|
7536
7536
|
error: error48,
|
|
7537
7537
|
code(cxt) {
|
|
7538
|
-
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
7539
|
-
if (!$data &&
|
|
7538
|
+
const { gen, data, $data, schema: schema2, schemaCode, it } = cxt;
|
|
7539
|
+
if (!$data && schema2.length === 0)
|
|
7540
7540
|
throw new Error("enum must have non-empty array");
|
|
7541
|
-
const useLoop =
|
|
7541
|
+
const useLoop = schema2.length >= it.opts.loopEnum;
|
|
7542
7542
|
let eql;
|
|
7543
7543
|
const getEql = () => eql !== null && eql !== void 0 ? eql : eql = (0, util_1.useFunc)(gen, equal_1.default);
|
|
7544
7544
|
let valid;
|
|
@@ -7546,10 +7546,10 @@ var require_enum = __commonJS({
|
|
|
7546
7546
|
valid = gen.let("valid");
|
|
7547
7547
|
cxt.block$data(valid, loopEnum);
|
|
7548
7548
|
} else {
|
|
7549
|
-
if (!Array.isArray(
|
|
7549
|
+
if (!Array.isArray(schema2))
|
|
7550
7550
|
throw new Error("ajv implementation error");
|
|
7551
7551
|
const vSchema = gen.const("vSchema", schemaCode);
|
|
7552
|
-
valid = (0, codegen_1.or)(...
|
|
7552
|
+
valid = (0, codegen_1.or)(...schema2.map((_x, i) => equalCode(vSchema, i)));
|
|
7553
7553
|
}
|
|
7554
7554
|
cxt.pass(valid);
|
|
7555
7555
|
function loopEnum() {
|
|
@@ -7557,7 +7557,7 @@ var require_enum = __commonJS({
|
|
|
7557
7557
|
gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._)`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()));
|
|
7558
7558
|
}
|
|
7559
7559
|
function equalCode(vSchema, i) {
|
|
7560
|
-
const sch =
|
|
7560
|
+
const sch = schema2[i];
|
|
7561
7561
|
return typeof sch === "object" && sch !== null ? (0, codegen_1._)`${getEql()}(${data}, ${vSchema}[${i}])` : (0, codegen_1._)`${data} === ${sch}`;
|
|
7562
7562
|
}
|
|
7563
7563
|
}
|
|
@@ -7633,13 +7633,13 @@ var require_additionalItems = __commonJS({
|
|
|
7633
7633
|
}
|
|
7634
7634
|
};
|
|
7635
7635
|
function validateAdditionalItems(cxt, items) {
|
|
7636
|
-
const { gen, schema, data, keyword, it } = cxt;
|
|
7636
|
+
const { gen, schema: schema2, data, keyword, it } = cxt;
|
|
7637
7637
|
it.items = true;
|
|
7638
7638
|
const len = gen.const("len", (0, codegen_1._)`${data}.length`);
|
|
7639
|
-
if (
|
|
7639
|
+
if (schema2 === false) {
|
|
7640
7640
|
cxt.setParams({ len: items.length });
|
|
7641
7641
|
cxt.pass((0, codegen_1._)`${len} <= ${items.length}`);
|
|
7642
|
-
} else if (typeof
|
|
7642
|
+
} else if (typeof schema2 == "object" && !(0, util_1.alwaysValidSchema)(it, schema2)) {
|
|
7643
7643
|
const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items.length}`);
|
|
7644
7644
|
gen.if((0, codegen_1.not)(valid), () => validateItems(valid));
|
|
7645
7645
|
cxt.ok(valid);
|
|
@@ -7672,11 +7672,11 @@ var require_items = __commonJS({
|
|
|
7672
7672
|
schemaType: ["object", "array", "boolean"],
|
|
7673
7673
|
before: "uniqueItems",
|
|
7674
7674
|
code(cxt) {
|
|
7675
|
-
const { schema, it } = cxt;
|
|
7676
|
-
if (Array.isArray(
|
|
7677
|
-
return validateTuple(cxt, "additionalItems",
|
|
7675
|
+
const { schema: schema2, it } = cxt;
|
|
7676
|
+
if (Array.isArray(schema2))
|
|
7677
|
+
return validateTuple(cxt, "additionalItems", schema2);
|
|
7678
7678
|
it.items = true;
|
|
7679
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
7679
|
+
if ((0, util_1.alwaysValidSchema)(it, schema2))
|
|
7680
7680
|
return;
|
|
7681
7681
|
cxt.ok((0, code_1.validateArray)(cxt));
|
|
7682
7682
|
}
|
|
@@ -7751,10 +7751,10 @@ var require_items2020 = __commonJS({
|
|
|
7751
7751
|
before: "uniqueItems",
|
|
7752
7752
|
error: error48,
|
|
7753
7753
|
code(cxt) {
|
|
7754
|
-
const { schema, parentSchema, it } = cxt;
|
|
7754
|
+
const { schema: schema2, parentSchema, it } = cxt;
|
|
7755
7755
|
const { prefixItems } = parentSchema;
|
|
7756
7756
|
it.items = true;
|
|
7757
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
7757
|
+
if ((0, util_1.alwaysValidSchema)(it, schema2))
|
|
7758
7758
|
return;
|
|
7759
7759
|
if (prefixItems)
|
|
7760
7760
|
(0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);
|
|
@@ -7785,7 +7785,7 @@ var require_contains = __commonJS({
|
|
|
7785
7785
|
trackErrors: true,
|
|
7786
7786
|
error: error48,
|
|
7787
7787
|
code(cxt) {
|
|
7788
|
-
const { gen, schema, parentSchema, data, it } = cxt;
|
|
7788
|
+
const { gen, schema: schema2, parentSchema, data, it } = cxt;
|
|
7789
7789
|
let min;
|
|
7790
7790
|
let max;
|
|
7791
7791
|
const { minContains, maxContains } = parentSchema;
|
|
@@ -7806,7 +7806,7 @@ var require_contains = __commonJS({
|
|
|
7806
7806
|
cxt.fail();
|
|
7807
7807
|
return;
|
|
7808
7808
|
}
|
|
7809
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
7809
|
+
if ((0, util_1.alwaysValidSchema)(it, schema2)) {
|
|
7810
7810
|
let cond = (0, codegen_1._)`${len} >= ${min}`;
|
|
7811
7811
|
if (max !== void 0)
|
|
7812
7812
|
cond = (0, codegen_1._)`${cond} && ${len} <= ${max}`;
|
|
@@ -7891,14 +7891,14 @@ var require_dependencies = __commonJS({
|
|
|
7891
7891
|
validateSchemaDeps(cxt, schDeps);
|
|
7892
7892
|
}
|
|
7893
7893
|
};
|
|
7894
|
-
function splitDependencies({ schema }) {
|
|
7894
|
+
function splitDependencies({ schema: schema2 }) {
|
|
7895
7895
|
const propertyDeps = {};
|
|
7896
7896
|
const schemaDeps = {};
|
|
7897
|
-
for (const key in
|
|
7897
|
+
for (const key in schema2) {
|
|
7898
7898
|
if (key === "__proto__")
|
|
7899
7899
|
continue;
|
|
7900
|
-
const deps2 = Array.isArray(
|
|
7901
|
-
deps2[key] =
|
|
7900
|
+
const deps2 = Array.isArray(schema2[key]) ? propertyDeps : schemaDeps;
|
|
7901
|
+
deps2[key] = schema2[key];
|
|
7902
7902
|
}
|
|
7903
7903
|
return [propertyDeps, schemaDeps];
|
|
7904
7904
|
}
|
|
@@ -7971,8 +7971,8 @@ var require_propertyNames = __commonJS({
|
|
|
7971
7971
|
schemaType: ["object", "boolean"],
|
|
7972
7972
|
error: error48,
|
|
7973
7973
|
code(cxt) {
|
|
7974
|
-
const { gen, schema, data, it } = cxt;
|
|
7975
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
7974
|
+
const { gen, schema: schema2, data, it } = cxt;
|
|
7975
|
+
if ((0, util_1.alwaysValidSchema)(it, schema2))
|
|
7976
7976
|
return;
|
|
7977
7977
|
const valid = gen.name("valid");
|
|
7978
7978
|
gen.forIn("key", data, (key) => {
|
|
@@ -8018,12 +8018,12 @@ var require_additionalProperties = __commonJS({
|
|
|
8018
8018
|
trackErrors: true,
|
|
8019
8019
|
error: error48,
|
|
8020
8020
|
code(cxt) {
|
|
8021
|
-
const { gen, schema, parentSchema, data, errsCount, it } = cxt;
|
|
8021
|
+
const { gen, schema: schema2, parentSchema, data, errsCount, it } = cxt;
|
|
8022
8022
|
if (!errsCount)
|
|
8023
8023
|
throw new Error("ajv implementation error");
|
|
8024
8024
|
const { allErrors, opts } = it;
|
|
8025
8025
|
it.props = true;
|
|
8026
|
-
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it,
|
|
8026
|
+
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema2))
|
|
8027
8027
|
return;
|
|
8028
8028
|
const props = (0, code_1.allSchemaProperties)(parentSchema.properties);
|
|
8029
8029
|
const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);
|
|
@@ -8056,18 +8056,18 @@ var require_additionalProperties = __commonJS({
|
|
|
8056
8056
|
gen.code((0, codegen_1._)`delete ${data}[${key}]`);
|
|
8057
8057
|
}
|
|
8058
8058
|
function additionalPropertyCode(key) {
|
|
8059
|
-
if (opts.removeAdditional === "all" || opts.removeAdditional &&
|
|
8059
|
+
if (opts.removeAdditional === "all" || opts.removeAdditional && schema2 === false) {
|
|
8060
8060
|
deleteAdditional(key);
|
|
8061
8061
|
return;
|
|
8062
8062
|
}
|
|
8063
|
-
if (
|
|
8063
|
+
if (schema2 === false) {
|
|
8064
8064
|
cxt.setParams({ additionalProperty: key });
|
|
8065
8065
|
cxt.error();
|
|
8066
8066
|
if (!allErrors)
|
|
8067
8067
|
gen.break();
|
|
8068
8068
|
return;
|
|
8069
8069
|
}
|
|
8070
|
-
if (typeof
|
|
8070
|
+
if (typeof schema2 == "object" && !(0, util_1.alwaysValidSchema)(it, schema2)) {
|
|
8071
8071
|
const valid = gen.name("valid");
|
|
8072
8072
|
if (opts.removeAdditional === "failing") {
|
|
8073
8073
|
applyAdditionalSchema(key, valid, false);
|
|
@@ -8117,18 +8117,18 @@ var require_properties = __commonJS({
|
|
|
8117
8117
|
type: "object",
|
|
8118
8118
|
schemaType: "object",
|
|
8119
8119
|
code(cxt) {
|
|
8120
|
-
const { gen, schema, parentSchema, data, it } = cxt;
|
|
8120
|
+
const { gen, schema: schema2, parentSchema, data, it } = cxt;
|
|
8121
8121
|
if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === void 0) {
|
|
8122
8122
|
additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties"));
|
|
8123
8123
|
}
|
|
8124
|
-
const allProps = (0, code_1.allSchemaProperties)(
|
|
8124
|
+
const allProps = (0, code_1.allSchemaProperties)(schema2);
|
|
8125
8125
|
for (const prop of allProps) {
|
|
8126
8126
|
it.definedProperties.add(prop);
|
|
8127
8127
|
}
|
|
8128
8128
|
if (it.opts.unevaluated && allProps.length && it.props !== true) {
|
|
8129
8129
|
it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
|
|
8130
8130
|
}
|
|
8131
|
-
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it,
|
|
8131
|
+
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema2[p]));
|
|
8132
8132
|
if (properties.length === 0)
|
|
8133
8133
|
return;
|
|
8134
8134
|
const valid = gen.name("valid");
|
|
@@ -8146,7 +8146,7 @@ var require_properties = __commonJS({
|
|
|
8146
8146
|
cxt.ok(valid);
|
|
8147
8147
|
}
|
|
8148
8148
|
function hasDefault(prop) {
|
|
8149
|
-
return it.opts.useDefaults && !it.compositeRule &&
|
|
8149
|
+
return it.opts.useDefaults && !it.compositeRule && schema2[prop].default !== void 0;
|
|
8150
8150
|
}
|
|
8151
8151
|
function applyPropertySchema(prop) {
|
|
8152
8152
|
cxt.subschema({
|
|
@@ -8175,10 +8175,10 @@ var require_patternProperties = __commonJS({
|
|
|
8175
8175
|
type: "object",
|
|
8176
8176
|
schemaType: "object",
|
|
8177
8177
|
code(cxt) {
|
|
8178
|
-
const { gen, schema, data, parentSchema, it } = cxt;
|
|
8178
|
+
const { gen, schema: schema2, data, parentSchema, it } = cxt;
|
|
8179
8179
|
const { opts } = it;
|
|
8180
|
-
const patterns = (0, code_1.allSchemaProperties)(
|
|
8181
|
-
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it,
|
|
8180
|
+
const patterns = (0, code_1.allSchemaProperties)(schema2);
|
|
8181
|
+
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema2[p]));
|
|
8182
8182
|
if (patterns.length === 0 || alwaysValidPatterns.length === patterns.length && (!it.opts.unevaluated || it.props === true)) {
|
|
8183
8183
|
return;
|
|
8184
8184
|
}
|
|
@@ -8246,8 +8246,8 @@ var require_not = __commonJS({
|
|
|
8246
8246
|
schemaType: ["object", "boolean"],
|
|
8247
8247
|
trackErrors: true,
|
|
8248
8248
|
code(cxt) {
|
|
8249
|
-
const { gen, schema, it } = cxt;
|
|
8250
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
8249
|
+
const { gen, schema: schema2, it } = cxt;
|
|
8250
|
+
if ((0, util_1.alwaysValidSchema)(it, schema2)) {
|
|
8251
8251
|
cxt.fail();
|
|
8252
8252
|
return;
|
|
8253
8253
|
}
|
|
@@ -8300,12 +8300,12 @@ var require_oneOf = __commonJS({
|
|
|
8300
8300
|
trackErrors: true,
|
|
8301
8301
|
error: error48,
|
|
8302
8302
|
code(cxt) {
|
|
8303
|
-
const { gen, schema, parentSchema, it } = cxt;
|
|
8304
|
-
if (!Array.isArray(
|
|
8303
|
+
const { gen, schema: schema2, parentSchema, it } = cxt;
|
|
8304
|
+
if (!Array.isArray(schema2))
|
|
8305
8305
|
throw new Error("ajv implementation error");
|
|
8306
8306
|
if (it.opts.discriminator && parentSchema.discriminator)
|
|
8307
8307
|
return;
|
|
8308
|
-
const schArr =
|
|
8308
|
+
const schArr = schema2;
|
|
8309
8309
|
const valid = gen.let("valid", false);
|
|
8310
8310
|
const passing = gen.let("passing", null);
|
|
8311
8311
|
const schValid = gen.name("_valid");
|
|
@@ -8351,11 +8351,11 @@ var require_allOf = __commonJS({
|
|
|
8351
8351
|
keyword: "allOf",
|
|
8352
8352
|
schemaType: "array",
|
|
8353
8353
|
code(cxt) {
|
|
8354
|
-
const { gen, schema, it } = cxt;
|
|
8355
|
-
if (!Array.isArray(
|
|
8354
|
+
const { gen, schema: schema2, it } = cxt;
|
|
8355
|
+
if (!Array.isArray(schema2))
|
|
8356
8356
|
throw new Error("ajv implementation error");
|
|
8357
8357
|
const valid = gen.name("valid");
|
|
8358
|
-
|
|
8358
|
+
schema2.forEach((sch, i) => {
|
|
8359
8359
|
if ((0, util_1.alwaysValidSchema)(it, sch))
|
|
8360
8360
|
return;
|
|
8361
8361
|
const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid);
|
|
@@ -8430,8 +8430,8 @@ var require_if = __commonJS({
|
|
|
8430
8430
|
}
|
|
8431
8431
|
};
|
|
8432
8432
|
function hasSchema(it, keyword) {
|
|
8433
|
-
const
|
|
8434
|
-
return
|
|
8433
|
+
const schema2 = it.schema[keyword];
|
|
8434
|
+
return schema2 !== void 0 && !(0, util_1.alwaysValidSchema)(it, schema2);
|
|
8435
8435
|
}
|
|
8436
8436
|
exports2.default = def2;
|
|
8437
8437
|
}
|
|
@@ -8520,7 +8520,7 @@ var require_format = __commonJS({
|
|
|
8520
8520
|
$data: true,
|
|
8521
8521
|
error: error48,
|
|
8522
8522
|
code(cxt, ruleType) {
|
|
8523
|
-
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
8523
|
+
const { gen, data, $data, schema: schema2, schemaCode, it } = cxt;
|
|
8524
8524
|
const { opts, errSchemaPath, schemaEnv, self } = it;
|
|
8525
8525
|
if (!opts.validateFormats)
|
|
8526
8526
|
return;
|
|
@@ -8550,7 +8550,7 @@ var require_format = __commonJS({
|
|
|
8550
8550
|
}
|
|
8551
8551
|
}
|
|
8552
8552
|
function validateFormat() {
|
|
8553
|
-
const formatDef = self.formats[
|
|
8553
|
+
const formatDef = self.formats[schema2];
|
|
8554
8554
|
if (!formatDef) {
|
|
8555
8555
|
unknownFormat();
|
|
8556
8556
|
return;
|
|
@@ -8567,12 +8567,12 @@ var require_format = __commonJS({
|
|
|
8567
8567
|
}
|
|
8568
8568
|
throw new Error(unknownMsg());
|
|
8569
8569
|
function unknownMsg() {
|
|
8570
|
-
return `unknown format "${
|
|
8570
|
+
return `unknown format "${schema2}" ignored in schema at path "${errSchemaPath}"`;
|
|
8571
8571
|
}
|
|
8572
8572
|
}
|
|
8573
8573
|
function getFormat(fmtDef) {
|
|
8574
|
-
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(
|
|
8575
|
-
const fmt = gen.scopeValue("formats", { key:
|
|
8574
|
+
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema2)}` : void 0;
|
|
8575
|
+
const fmt = gen.scopeValue("formats", { key: schema2, ref: fmtDef, code });
|
|
8576
8576
|
if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
|
|
8577
8577
|
return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`];
|
|
8578
8578
|
}
|
|
@@ -8683,15 +8683,15 @@ var require_discriminator = __commonJS({
|
|
|
8683
8683
|
schemaType: "object",
|
|
8684
8684
|
error: error48,
|
|
8685
8685
|
code(cxt) {
|
|
8686
|
-
const { gen, data, schema, parentSchema, it } = cxt;
|
|
8686
|
+
const { gen, data, schema: schema2, parentSchema, it } = cxt;
|
|
8687
8687
|
const { oneOf } = parentSchema;
|
|
8688
8688
|
if (!it.opts.discriminator) {
|
|
8689
8689
|
throw new Error("discriminator: requires discriminator option");
|
|
8690
8690
|
}
|
|
8691
|
-
const tagName =
|
|
8691
|
+
const tagName = schema2.propertyName;
|
|
8692
8692
|
if (typeof tagName != "string")
|
|
8693
8693
|
throw new Error("discriminator: requires propertyName");
|
|
8694
|
-
if (
|
|
8694
|
+
if (schema2.mapping)
|
|
8695
8695
|
throw new Error("discriminator: mapping is not supported");
|
|
8696
8696
|
if (!oneOf)
|
|
8697
8697
|
throw new Error("discriminator: requires oneOf keyword");
|
|
@@ -10325,7 +10325,8 @@ async function accounting(args) {
|
|
|
10325
10325
|
case "list":
|
|
10326
10326
|
return list(flags);
|
|
10327
10327
|
default:
|
|
10328
|
-
console.
|
|
10328
|
+
console.error("Usage: rpbi accounting <list>");
|
|
10329
|
+
process.exitCode = 1;
|
|
10329
10330
|
break;
|
|
10330
10331
|
}
|
|
10331
10332
|
}
|
|
@@ -11477,7 +11478,8 @@ async function wiki(args) {
|
|
|
11477
11478
|
case "watch":
|
|
11478
11479
|
return watch3(flags);
|
|
11479
11480
|
default:
|
|
11480
|
-
console.
|
|
11481
|
+
console.error("Usage: rpbi wiki <list|get|read|search|save|delete|pull|push|status|watch> [options]");
|
|
11482
|
+
process.exitCode = 1;
|
|
11481
11483
|
break;
|
|
11482
11484
|
}
|
|
11483
11485
|
}
|
|
@@ -12016,6 +12018,26 @@ async function params(id, flags) {
|
|
|
12016
12018
|
output(result || [], flags);
|
|
12017
12019
|
}
|
|
12018
12020
|
}
|
|
12021
|
+
async function schema(flags) {
|
|
12022
|
+
const service = await createService("etl", { cwd: flags.dir || "." });
|
|
12023
|
+
const result = await service.get("schema/catalog", flags.version ? { version: flags.version } : void 0).catch((err) => fail(err, "Database objects not loaded"));
|
|
12024
|
+
if (flags.json) {
|
|
12025
|
+
output(result, flags);
|
|
12026
|
+
return;
|
|
12027
|
+
}
|
|
12028
|
+
if (!result?.databases) {
|
|
12029
|
+
console.log(`No change since version ${result?.version ?? "?"}.`);
|
|
12030
|
+
return;
|
|
12031
|
+
}
|
|
12032
|
+
console.log(`Version ${result.version}`);
|
|
12033
|
+
output(Object.entries(result.databases).map(([database, objects]) => ({
|
|
12034
|
+
database,
|
|
12035
|
+
tables: objects.tables.length,
|
|
12036
|
+
views: objects.views.length,
|
|
12037
|
+
procedures: objects.procedures.length,
|
|
12038
|
+
functions: objects.functions.length
|
|
12039
|
+
})), flags);
|
|
12040
|
+
}
|
|
12019
12041
|
async function etl(args) {
|
|
12020
12042
|
const { positional, flags } = parseArgs(args);
|
|
12021
12043
|
const [subcommand, ...rest] = positional;
|
|
@@ -12064,6 +12086,8 @@ async function etl(args) {
|
|
|
12064
12086
|
process.exit(1);
|
|
12065
12087
|
}
|
|
12066
12088
|
return params(rest[0], flags);
|
|
12089
|
+
case "schema":
|
|
12090
|
+
return schema(flags);
|
|
12067
12091
|
case "pull":
|
|
12068
12092
|
return pull2(flags);
|
|
12069
12093
|
case "push":
|
|
@@ -12075,7 +12099,8 @@ async function etl(args) {
|
|
|
12075
12099
|
case "watch":
|
|
12076
12100
|
return watch4(flags);
|
|
12077
12101
|
default:
|
|
12078
|
-
console.
|
|
12102
|
+
console.error("Usage: rpbi etl <list|get|content|exec|parse|abort|search|params|schema|pull|push|context|status|watch> [options]");
|
|
12103
|
+
process.exitCode = 1;
|
|
12079
12104
|
break;
|
|
12080
12105
|
}
|
|
12081
12106
|
}
|
|
@@ -12535,7 +12560,8 @@ async function deployment(args) {
|
|
|
12535
12560
|
case "watch":
|
|
12536
12561
|
return watch5(flags);
|
|
12537
12562
|
default:
|
|
12538
|
-
console.
|
|
12563
|
+
console.error("Usage: rpbi deployment <list|get|content|doc|exec|parse|pull|push|status|watch> [options]");
|
|
12564
|
+
process.exitCode = 1;
|
|
12539
12565
|
break;
|
|
12540
12566
|
}
|
|
12541
12567
|
}
|
|
@@ -13148,7 +13174,8 @@ async function ext(args) {
|
|
|
13148
13174
|
case "watch":
|
|
13149
13175
|
return watch6(flags);
|
|
13150
13176
|
default:
|
|
13151
|
-
console.
|
|
13177
|
+
console.error("Usage: rpbi ext <projects|resources|queries|content|exec|parse|abort|params|deps|pull|push|status|watch> [options]");
|
|
13178
|
+
process.exitCode = 1;
|
|
13152
13179
|
break;
|
|
13153
13180
|
}
|
|
13154
13181
|
}
|
|
@@ -13197,7 +13224,8 @@ async function jobs(args) {
|
|
|
13197
13224
|
case "status":
|
|
13198
13225
|
return statusCmd(flags);
|
|
13199
13226
|
default:
|
|
13200
|
-
console.
|
|
13227
|
+
console.error("Usage: rpbi jobs <list|start|stop|status> [options]");
|
|
13228
|
+
process.exitCode = 1;
|
|
13201
13229
|
break;
|
|
13202
13230
|
}
|
|
13203
13231
|
}
|
|
@@ -13226,7 +13254,8 @@ async function context2(args) {
|
|
|
13226
13254
|
output(ctx, flags);
|
|
13227
13255
|
break;
|
|
13228
13256
|
default:
|
|
13229
|
-
console.
|
|
13257
|
+
console.error("Usage: rpbi context <list|get> [options]");
|
|
13258
|
+
process.exitCode = 1;
|
|
13230
13259
|
break;
|
|
13231
13260
|
}
|
|
13232
13261
|
}
|
|
@@ -13299,7 +13328,8 @@ async function users(args) {
|
|
|
13299
13328
|
case "roles":
|
|
13300
13329
|
return roles(flags);
|
|
13301
13330
|
default:
|
|
13302
|
-
console.
|
|
13331
|
+
console.error("Usage: rpbi users <list|get|me|rights|roles> [options]");
|
|
13332
|
+
process.exitCode = 1;
|
|
13303
13333
|
break;
|
|
13304
13334
|
}
|
|
13305
13335
|
}
|
|
@@ -13364,7 +13394,8 @@ async function def(args) {
|
|
|
13364
13394
|
case "fiscal-years":
|
|
13365
13395
|
return fiscalYears(flags);
|
|
13366
13396
|
default:
|
|
13367
|
-
console.
|
|
13397
|
+
console.error("Usage: rpbi def <statements|statement|dimensions|modules|scenarios|fiscal-years> [options]");
|
|
13398
|
+
process.exitCode = 1;
|
|
13368
13399
|
break;
|
|
13369
13400
|
}
|
|
13370
13401
|
}
|
|
@@ -13428,7 +13459,8 @@ async function mdm(args) {
|
|
|
13428
13459
|
}
|
|
13429
13460
|
return exportCsv(rest[0], flags);
|
|
13430
13461
|
default:
|
|
13431
|
-
console.
|
|
13462
|
+
console.error("Usage: rpbi mdm <tables|table|columns|values|export> [options]");
|
|
13463
|
+
process.exitCode = 1;
|
|
13432
13464
|
break;
|
|
13433
13465
|
}
|
|
13434
13466
|
}
|
|
@@ -13488,7 +13520,8 @@ async function helpdesk(args) {
|
|
|
13488
13520
|
case "create":
|
|
13489
13521
|
return create(flags);
|
|
13490
13522
|
default:
|
|
13491
|
-
console.
|
|
13523
|
+
console.error("Usage: rpbi helpdesk <list|get|messages|create> [options]");
|
|
13524
|
+
process.exitCode = 1;
|
|
13492
13525
|
break;
|
|
13493
13526
|
}
|
|
13494
13527
|
}
|
|
@@ -15705,9 +15738,9 @@ var ZodArray = class _ZodArray extends ZodType {
|
|
|
15705
15738
|
return this.min(1, message);
|
|
15706
15739
|
}
|
|
15707
15740
|
};
|
|
15708
|
-
ZodArray.create = (
|
|
15741
|
+
ZodArray.create = (schema2, params3) => {
|
|
15709
15742
|
return new ZodArray({
|
|
15710
|
-
type:
|
|
15743
|
+
type: schema2,
|
|
15711
15744
|
minLength: null,
|
|
15712
15745
|
maxLength: null,
|
|
15713
15746
|
exactLength: null,
|
|
@@ -15715,30 +15748,30 @@ ZodArray.create = (schema, params3) => {
|
|
|
15715
15748
|
...processCreateParams(params3)
|
|
15716
15749
|
});
|
|
15717
15750
|
};
|
|
15718
|
-
function deepPartialify(
|
|
15719
|
-
if (
|
|
15751
|
+
function deepPartialify(schema2) {
|
|
15752
|
+
if (schema2 instanceof ZodObject) {
|
|
15720
15753
|
const newShape = {};
|
|
15721
|
-
for (const key in
|
|
15722
|
-
const fieldSchema =
|
|
15754
|
+
for (const key in schema2.shape) {
|
|
15755
|
+
const fieldSchema = schema2.shape[key];
|
|
15723
15756
|
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
|
15724
15757
|
}
|
|
15725
15758
|
return new ZodObject({
|
|
15726
|
-
...
|
|
15759
|
+
...schema2._def,
|
|
15727
15760
|
shape: () => newShape
|
|
15728
15761
|
});
|
|
15729
|
-
} else if (
|
|
15762
|
+
} else if (schema2 instanceof ZodArray) {
|
|
15730
15763
|
return new ZodArray({
|
|
15731
|
-
...
|
|
15732
|
-
type: deepPartialify(
|
|
15764
|
+
...schema2._def,
|
|
15765
|
+
type: deepPartialify(schema2.element)
|
|
15733
15766
|
});
|
|
15734
|
-
} else if (
|
|
15735
|
-
return ZodOptional.create(deepPartialify(
|
|
15736
|
-
} else if (
|
|
15737
|
-
return ZodNullable.create(deepPartialify(
|
|
15738
|
-
} else if (
|
|
15739
|
-
return ZodTuple.create(
|
|
15767
|
+
} else if (schema2 instanceof ZodOptional) {
|
|
15768
|
+
return ZodOptional.create(deepPartialify(schema2.unwrap()));
|
|
15769
|
+
} else if (schema2 instanceof ZodNullable) {
|
|
15770
|
+
return ZodNullable.create(deepPartialify(schema2.unwrap()));
|
|
15771
|
+
} else if (schema2 instanceof ZodTuple) {
|
|
15772
|
+
return ZodTuple.create(schema2.items.map((item) => deepPartialify(item)));
|
|
15740
15773
|
} else {
|
|
15741
|
-
return
|
|
15774
|
+
return schema2;
|
|
15742
15775
|
}
|
|
15743
15776
|
}
|
|
15744
15777
|
var ZodObject = class _ZodObject extends ZodType {
|
|
@@ -15954,8 +15987,8 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
15954
15987
|
// }) as any;
|
|
15955
15988
|
// return merged;
|
|
15956
15989
|
// }
|
|
15957
|
-
setKey(key,
|
|
15958
|
-
return this.augment({ [key]:
|
|
15990
|
+
setKey(key, schema2) {
|
|
15991
|
+
return this.augment({ [key]: schema2 });
|
|
15959
15992
|
}
|
|
15960
15993
|
// merge<Incoming extends AnyZodObject>(
|
|
15961
15994
|
// merging: Incoming
|
|
@@ -16401,10 +16434,10 @@ var ZodTuple = class _ZodTuple extends ZodType {
|
|
|
16401
16434
|
status6.dirty();
|
|
16402
16435
|
}
|
|
16403
16436
|
const items = [...ctx.data].map((item, itemIndex) => {
|
|
16404
|
-
const
|
|
16405
|
-
if (!
|
|
16437
|
+
const schema2 = this._def.items[itemIndex] || this._def.rest;
|
|
16438
|
+
if (!schema2)
|
|
16406
16439
|
return null;
|
|
16407
|
-
return
|
|
16440
|
+
return schema2._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
|
16408
16441
|
}).filter((x) => !!x);
|
|
16409
16442
|
if (ctx.common.async) {
|
|
16410
16443
|
return Promise.all(items).then((results) => {
|
|
@@ -16918,9 +16951,9 @@ var ZodPromise = class extends ZodType {
|
|
|
16918
16951
|
}));
|
|
16919
16952
|
}
|
|
16920
16953
|
};
|
|
16921
|
-
ZodPromise.create = (
|
|
16954
|
+
ZodPromise.create = (schema2, params3) => {
|
|
16922
16955
|
return new ZodPromise({
|
|
16923
|
-
type:
|
|
16956
|
+
type: schema2,
|
|
16924
16957
|
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
16925
16958
|
...processCreateParams(params3)
|
|
16926
16959
|
});
|
|
@@ -17048,17 +17081,17 @@ var ZodEffects = class extends ZodType {
|
|
|
17048
17081
|
util.assertNever(effect);
|
|
17049
17082
|
}
|
|
17050
17083
|
};
|
|
17051
|
-
ZodEffects.create = (
|
|
17084
|
+
ZodEffects.create = (schema2, effect, params3) => {
|
|
17052
17085
|
return new ZodEffects({
|
|
17053
|
-
schema,
|
|
17086
|
+
schema: schema2,
|
|
17054
17087
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
17055
17088
|
effect,
|
|
17056
17089
|
...processCreateParams(params3)
|
|
17057
17090
|
});
|
|
17058
17091
|
};
|
|
17059
|
-
ZodEffects.createWithPreprocess = (preprocess2,
|
|
17092
|
+
ZodEffects.createWithPreprocess = (preprocess2, schema2, params3) => {
|
|
17060
17093
|
return new ZodEffects({
|
|
17061
|
-
schema,
|
|
17094
|
+
schema: schema2,
|
|
17062
17095
|
effect: { type: "preprocess", transform: preprocess2 },
|
|
17063
17096
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
17064
17097
|
...processCreateParams(params3)
|
|
@@ -17893,8 +17926,8 @@ function mergeDefs(...defs) {
|
|
|
17893
17926
|
}
|
|
17894
17927
|
return Object.defineProperties({}, mergedDescriptors);
|
|
17895
17928
|
}
|
|
17896
|
-
function cloneDef(
|
|
17897
|
-
return mergeDefs(
|
|
17929
|
+
function cloneDef(schema2) {
|
|
17930
|
+
return mergeDefs(schema2._zod.def);
|
|
17898
17931
|
}
|
|
17899
17932
|
function getElementAtPath(obj, path9) {
|
|
17900
17933
|
if (!path9)
|
|
@@ -18102,14 +18135,14 @@ var BIGINT_FORMAT_RANGES = {
|
|
|
18102
18135
|
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
18103
18136
|
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
18104
18137
|
};
|
|
18105
|
-
function pick(
|
|
18106
|
-
const currDef =
|
|
18138
|
+
function pick(schema2, mask) {
|
|
18139
|
+
const currDef = schema2._zod.def;
|
|
18107
18140
|
const checks = currDef.checks;
|
|
18108
18141
|
const hasChecks = checks && checks.length > 0;
|
|
18109
18142
|
if (hasChecks) {
|
|
18110
18143
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
18111
18144
|
}
|
|
18112
|
-
const def2 = mergeDefs(
|
|
18145
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18113
18146
|
get shape() {
|
|
18114
18147
|
const newShape = {};
|
|
18115
18148
|
for (const key in mask) {
|
|
@@ -18125,18 +18158,18 @@ function pick(schema, mask) {
|
|
|
18125
18158
|
},
|
|
18126
18159
|
checks: []
|
|
18127
18160
|
});
|
|
18128
|
-
return clone(
|
|
18161
|
+
return clone(schema2, def2);
|
|
18129
18162
|
}
|
|
18130
|
-
function omit(
|
|
18131
|
-
const currDef =
|
|
18163
|
+
function omit(schema2, mask) {
|
|
18164
|
+
const currDef = schema2._zod.def;
|
|
18132
18165
|
const checks = currDef.checks;
|
|
18133
18166
|
const hasChecks = checks && checks.length > 0;
|
|
18134
18167
|
if (hasChecks) {
|
|
18135
18168
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
18136
18169
|
}
|
|
18137
|
-
const def2 = mergeDefs(
|
|
18170
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18138
18171
|
get shape() {
|
|
18139
|
-
const newShape = { ...
|
|
18172
|
+
const newShape = { ...schema2._zod.def.shape };
|
|
18140
18173
|
for (const key in mask) {
|
|
18141
18174
|
if (!(key in currDef.shape)) {
|
|
18142
18175
|
throw new Error(`Unrecognized key: "${key}"`);
|
|
@@ -18150,43 +18183,43 @@ function omit(schema, mask) {
|
|
|
18150
18183
|
},
|
|
18151
18184
|
checks: []
|
|
18152
18185
|
});
|
|
18153
|
-
return clone(
|
|
18186
|
+
return clone(schema2, def2);
|
|
18154
18187
|
}
|
|
18155
|
-
function extend(
|
|
18188
|
+
function extend(schema2, shape) {
|
|
18156
18189
|
if (!isPlainObject(shape)) {
|
|
18157
18190
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
18158
18191
|
}
|
|
18159
|
-
const checks =
|
|
18192
|
+
const checks = schema2._zod.def.checks;
|
|
18160
18193
|
const hasChecks = checks && checks.length > 0;
|
|
18161
18194
|
if (hasChecks) {
|
|
18162
|
-
const existingShape =
|
|
18195
|
+
const existingShape = schema2._zod.def.shape;
|
|
18163
18196
|
for (const key in shape) {
|
|
18164
18197
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
18165
18198
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
18166
18199
|
}
|
|
18167
18200
|
}
|
|
18168
18201
|
}
|
|
18169
|
-
const def2 = mergeDefs(
|
|
18202
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18170
18203
|
get shape() {
|
|
18171
|
-
const _shape = { ...
|
|
18204
|
+
const _shape = { ...schema2._zod.def.shape, ...shape };
|
|
18172
18205
|
assignProp(this, "shape", _shape);
|
|
18173
18206
|
return _shape;
|
|
18174
18207
|
}
|
|
18175
18208
|
});
|
|
18176
|
-
return clone(
|
|
18209
|
+
return clone(schema2, def2);
|
|
18177
18210
|
}
|
|
18178
|
-
function safeExtend(
|
|
18211
|
+
function safeExtend(schema2, shape) {
|
|
18179
18212
|
if (!isPlainObject(shape)) {
|
|
18180
18213
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
18181
18214
|
}
|
|
18182
|
-
const def2 = mergeDefs(
|
|
18215
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18183
18216
|
get shape() {
|
|
18184
|
-
const _shape = { ...
|
|
18217
|
+
const _shape = { ...schema2._zod.def.shape, ...shape };
|
|
18185
18218
|
assignProp(this, "shape", _shape);
|
|
18186
18219
|
return _shape;
|
|
18187
18220
|
}
|
|
18188
18221
|
});
|
|
18189
|
-
return clone(
|
|
18222
|
+
return clone(schema2, def2);
|
|
18190
18223
|
}
|
|
18191
18224
|
function merge(a, b) {
|
|
18192
18225
|
const def2 = mergeDefs(a._zod.def, {
|
|
@@ -18203,16 +18236,16 @@ function merge(a, b) {
|
|
|
18203
18236
|
});
|
|
18204
18237
|
return clone(a, def2);
|
|
18205
18238
|
}
|
|
18206
|
-
function partial(Class2,
|
|
18207
|
-
const currDef =
|
|
18239
|
+
function partial(Class2, schema2, mask) {
|
|
18240
|
+
const currDef = schema2._zod.def;
|
|
18208
18241
|
const checks = currDef.checks;
|
|
18209
18242
|
const hasChecks = checks && checks.length > 0;
|
|
18210
18243
|
if (hasChecks) {
|
|
18211
18244
|
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
18212
18245
|
}
|
|
18213
|
-
const def2 = mergeDefs(
|
|
18246
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18214
18247
|
get shape() {
|
|
18215
|
-
const oldShape =
|
|
18248
|
+
const oldShape = schema2._zod.def.shape;
|
|
18216
18249
|
const shape = { ...oldShape };
|
|
18217
18250
|
if (mask) {
|
|
18218
18251
|
for (const key in mask) {
|
|
@@ -18239,12 +18272,12 @@ function partial(Class2, schema, mask) {
|
|
|
18239
18272
|
},
|
|
18240
18273
|
checks: []
|
|
18241
18274
|
});
|
|
18242
|
-
return clone(
|
|
18275
|
+
return clone(schema2, def2);
|
|
18243
18276
|
}
|
|
18244
|
-
function required(Class2,
|
|
18245
|
-
const def2 = mergeDefs(
|
|
18277
|
+
function required(Class2, schema2, mask) {
|
|
18278
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18246
18279
|
get shape() {
|
|
18247
|
-
const oldShape =
|
|
18280
|
+
const oldShape = schema2._zod.def.shape;
|
|
18248
18281
|
const shape = { ...oldShape };
|
|
18249
18282
|
if (mask) {
|
|
18250
18283
|
for (const key in mask) {
|
|
@@ -18270,7 +18303,7 @@ function required(Class2, schema, mask) {
|
|
|
18270
18303
|
return shape;
|
|
18271
18304
|
}
|
|
18272
18305
|
});
|
|
18273
|
-
return clone(
|
|
18306
|
+
return clone(schema2, def2);
|
|
18274
18307
|
}
|
|
18275
18308
|
function aborted(x, startIndex = 0) {
|
|
18276
18309
|
if (x.aborted === true)
|
|
@@ -18539,9 +18572,9 @@ function prettifyError(error48) {
|
|
|
18539
18572
|
}
|
|
18540
18573
|
|
|
18541
18574
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/core/parse.js
|
|
18542
|
-
var _parse = (_Err) => (
|
|
18575
|
+
var _parse = (_Err) => (schema2, value, _ctx, _params) => {
|
|
18543
18576
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
18544
|
-
const result =
|
|
18577
|
+
const result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18545
18578
|
if (result instanceof Promise) {
|
|
18546
18579
|
throw new $ZodAsyncError();
|
|
18547
18580
|
}
|
|
@@ -18553,9 +18586,9 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
18553
18586
|
return result.value;
|
|
18554
18587
|
};
|
|
18555
18588
|
var parse4 = /* @__PURE__ */ _parse($ZodRealError);
|
|
18556
|
-
var _parseAsync = (_Err) => async (
|
|
18589
|
+
var _parseAsync = (_Err) => async (schema2, value, _ctx, params3) => {
|
|
18557
18590
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
18558
|
-
let result =
|
|
18591
|
+
let result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18559
18592
|
if (result instanceof Promise)
|
|
18560
18593
|
result = await result;
|
|
18561
18594
|
if (result.issues.length) {
|
|
@@ -18566,9 +18599,9 @@ var _parseAsync = (_Err) => async (schema, value, _ctx, params3) => {
|
|
|
18566
18599
|
return result.value;
|
|
18567
18600
|
};
|
|
18568
18601
|
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
18569
|
-
var _safeParse = (_Err) => (
|
|
18602
|
+
var _safeParse = (_Err) => (schema2, value, _ctx) => {
|
|
18570
18603
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
18571
|
-
const result =
|
|
18604
|
+
const result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18572
18605
|
if (result instanceof Promise) {
|
|
18573
18606
|
throw new $ZodAsyncError();
|
|
18574
18607
|
}
|
|
@@ -18578,9 +18611,9 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
18578
18611
|
} : { success: true, data: result.value };
|
|
18579
18612
|
};
|
|
18580
18613
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
18581
|
-
var _safeParseAsync = (_Err) => async (
|
|
18614
|
+
var _safeParseAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18582
18615
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
18583
|
-
let result =
|
|
18616
|
+
let result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18584
18617
|
if (result instanceof Promise)
|
|
18585
18618
|
result = await result;
|
|
18586
18619
|
return result.issues.length ? {
|
|
@@ -18589,40 +18622,40 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
18589
18622
|
} : { success: true, data: result.value };
|
|
18590
18623
|
};
|
|
18591
18624
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
18592
|
-
var _encode = (_Err) => (
|
|
18625
|
+
var _encode = (_Err) => (schema2, value, _ctx) => {
|
|
18593
18626
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18594
|
-
return _parse(_Err)(
|
|
18627
|
+
return _parse(_Err)(schema2, value, ctx);
|
|
18595
18628
|
};
|
|
18596
18629
|
var encode = /* @__PURE__ */ _encode($ZodRealError);
|
|
18597
|
-
var _decode = (_Err) => (
|
|
18598
|
-
return _parse(_Err)(
|
|
18630
|
+
var _decode = (_Err) => (schema2, value, _ctx) => {
|
|
18631
|
+
return _parse(_Err)(schema2, value, _ctx);
|
|
18599
18632
|
};
|
|
18600
18633
|
var decode = /* @__PURE__ */ _decode($ZodRealError);
|
|
18601
|
-
var _encodeAsync = (_Err) => async (
|
|
18634
|
+
var _encodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18602
18635
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18603
|
-
return _parseAsync(_Err)(
|
|
18636
|
+
return _parseAsync(_Err)(schema2, value, ctx);
|
|
18604
18637
|
};
|
|
18605
18638
|
var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
18606
|
-
var _decodeAsync = (_Err) => async (
|
|
18607
|
-
return _parseAsync(_Err)(
|
|
18639
|
+
var _decodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18640
|
+
return _parseAsync(_Err)(schema2, value, _ctx);
|
|
18608
18641
|
};
|
|
18609
18642
|
var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
18610
|
-
var _safeEncode = (_Err) => (
|
|
18643
|
+
var _safeEncode = (_Err) => (schema2, value, _ctx) => {
|
|
18611
18644
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18612
|
-
return _safeParse(_Err)(
|
|
18645
|
+
return _safeParse(_Err)(schema2, value, ctx);
|
|
18613
18646
|
};
|
|
18614
18647
|
var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
18615
|
-
var _safeDecode = (_Err) => (
|
|
18616
|
-
return _safeParse(_Err)(
|
|
18648
|
+
var _safeDecode = (_Err) => (schema2, value, _ctx) => {
|
|
18649
|
+
return _safeParse(_Err)(schema2, value, _ctx);
|
|
18617
18650
|
};
|
|
18618
18651
|
var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
18619
|
-
var _safeEncodeAsync = (_Err) => async (
|
|
18652
|
+
var _safeEncodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18620
18653
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18621
|
-
return _safeParseAsync(_Err)(
|
|
18654
|
+
return _safeParseAsync(_Err)(schema2, value, ctx);
|
|
18622
18655
|
};
|
|
18623
18656
|
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
18624
|
-
var _safeDecodeAsync = (_Err) => async (
|
|
18625
|
-
return _safeParseAsync(_Err)(
|
|
18657
|
+
var _safeDecodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18658
|
+
return _safeParseAsync(_Err)(schema2, value, _ctx);
|
|
18626
18659
|
};
|
|
18627
18660
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
18628
18661
|
|
|
@@ -20165,8 +20198,8 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def2) =
|
|
|
20165
20198
|
for (const key of normalized.keys) {
|
|
20166
20199
|
const id = ids[key];
|
|
20167
20200
|
const k = esc(key);
|
|
20168
|
-
const
|
|
20169
|
-
const isOptionalOut =
|
|
20201
|
+
const schema2 = shape[key];
|
|
20202
|
+
const isOptionalOut = schema2?._zod?.optout === "optional";
|
|
20170
20203
|
doc2.write(`const ${id} = ${parseStr(key)};`);
|
|
20171
20204
|
if (isOptionalOut) {
|
|
20172
20205
|
doc2.write(`
|
|
@@ -26931,11 +26964,11 @@ var $ZodRegistry = class {
|
|
|
26931
26964
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
26932
26965
|
this._idmap = /* @__PURE__ */ new Map();
|
|
26933
26966
|
}
|
|
26934
|
-
add(
|
|
26967
|
+
add(schema2, ..._meta) {
|
|
26935
26968
|
const meta3 = _meta[0];
|
|
26936
|
-
this._map.set(
|
|
26969
|
+
this._map.set(schema2, meta3);
|
|
26937
26970
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
26938
|
-
this._idmap.set(meta3.id,
|
|
26971
|
+
this._idmap.set(meta3.id, schema2);
|
|
26939
26972
|
}
|
|
26940
26973
|
return this;
|
|
26941
26974
|
}
|
|
@@ -26944,26 +26977,26 @@ var $ZodRegistry = class {
|
|
|
26944
26977
|
this._idmap = /* @__PURE__ */ new Map();
|
|
26945
26978
|
return this;
|
|
26946
26979
|
}
|
|
26947
|
-
remove(
|
|
26948
|
-
const meta3 = this._map.get(
|
|
26980
|
+
remove(schema2) {
|
|
26981
|
+
const meta3 = this._map.get(schema2);
|
|
26949
26982
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
26950
26983
|
this._idmap.delete(meta3.id);
|
|
26951
26984
|
}
|
|
26952
|
-
this._map.delete(
|
|
26985
|
+
this._map.delete(schema2);
|
|
26953
26986
|
return this;
|
|
26954
26987
|
}
|
|
26955
|
-
get(
|
|
26956
|
-
const p =
|
|
26988
|
+
get(schema2) {
|
|
26989
|
+
const p = schema2._zod.parent;
|
|
26957
26990
|
if (p) {
|
|
26958
26991
|
const pm = { ...this.get(p) ?? {} };
|
|
26959
26992
|
delete pm.id;
|
|
26960
|
-
const f = { ...pm, ...this._map.get(
|
|
26993
|
+
const f = { ...pm, ...this._map.get(schema2) };
|
|
26961
26994
|
return Object.keys(f).length ? f : void 0;
|
|
26962
26995
|
}
|
|
26963
|
-
return this._map.get(
|
|
26996
|
+
return this._map.get(schema2);
|
|
26964
26997
|
}
|
|
26965
|
-
has(
|
|
26966
|
-
return this._map.has(
|
|
26998
|
+
has(schema2) {
|
|
26999
|
+
return this._map.has(schema2);
|
|
26967
27000
|
}
|
|
26968
27001
|
};
|
|
26969
27002
|
function registry() {
|
|
@@ -27616,11 +27649,11 @@ function _endsWith(suffix, params3) {
|
|
|
27616
27649
|
});
|
|
27617
27650
|
}
|
|
27618
27651
|
// @__NO_SIDE_EFFECTS__
|
|
27619
|
-
function _property(property,
|
|
27652
|
+
function _property(property, schema2, params3) {
|
|
27620
27653
|
return new $ZodCheckProperty({
|
|
27621
27654
|
check: "property",
|
|
27622
27655
|
property,
|
|
27623
|
-
schema,
|
|
27656
|
+
schema: schema2,
|
|
27624
27657
|
...normalizeParams(params3)
|
|
27625
27658
|
});
|
|
27626
27659
|
}
|
|
@@ -27868,23 +27901,23 @@ function _promise(Class2, innerType) {
|
|
|
27868
27901
|
function _custom(Class2, fn, _params) {
|
|
27869
27902
|
const norm = normalizeParams(_params);
|
|
27870
27903
|
norm.abort ?? (norm.abort = true);
|
|
27871
|
-
const
|
|
27904
|
+
const schema2 = new Class2({
|
|
27872
27905
|
type: "custom",
|
|
27873
27906
|
check: "custom",
|
|
27874
27907
|
fn,
|
|
27875
27908
|
...norm
|
|
27876
27909
|
});
|
|
27877
|
-
return
|
|
27910
|
+
return schema2;
|
|
27878
27911
|
}
|
|
27879
27912
|
// @__NO_SIDE_EFFECTS__
|
|
27880
27913
|
function _refine(Class2, fn, _params) {
|
|
27881
|
-
const
|
|
27914
|
+
const schema2 = new Class2({
|
|
27882
27915
|
type: "custom",
|
|
27883
27916
|
check: "custom",
|
|
27884
27917
|
fn,
|
|
27885
27918
|
...normalizeParams(_params)
|
|
27886
27919
|
});
|
|
27887
|
-
return
|
|
27920
|
+
return schema2;
|
|
27888
27921
|
}
|
|
27889
27922
|
// @__NO_SIDE_EFFECTS__
|
|
27890
27923
|
function _superRefine(fn) {
|
|
@@ -28033,40 +28066,40 @@ function initializeContext(params3) {
|
|
|
28033
28066
|
external: params3?.external ?? void 0
|
|
28034
28067
|
};
|
|
28035
28068
|
}
|
|
28036
|
-
function process2(
|
|
28069
|
+
function process2(schema2, ctx, _params = { path: [], schemaPath: [] }) {
|
|
28037
28070
|
var _a2;
|
|
28038
|
-
const def2 =
|
|
28039
|
-
const seen = ctx.seen.get(
|
|
28071
|
+
const def2 = schema2._zod.def;
|
|
28072
|
+
const seen = ctx.seen.get(schema2);
|
|
28040
28073
|
if (seen) {
|
|
28041
28074
|
seen.count++;
|
|
28042
|
-
const isCycle = _params.schemaPath.includes(
|
|
28075
|
+
const isCycle = _params.schemaPath.includes(schema2);
|
|
28043
28076
|
if (isCycle) {
|
|
28044
28077
|
seen.cycle = _params.path;
|
|
28045
28078
|
}
|
|
28046
28079
|
return seen.schema;
|
|
28047
28080
|
}
|
|
28048
28081
|
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
28049
|
-
ctx.seen.set(
|
|
28050
|
-
const overrideSchema =
|
|
28082
|
+
ctx.seen.set(schema2, result);
|
|
28083
|
+
const overrideSchema = schema2._zod.toJSONSchema?.();
|
|
28051
28084
|
if (overrideSchema) {
|
|
28052
28085
|
result.schema = overrideSchema;
|
|
28053
28086
|
} else {
|
|
28054
28087
|
const params3 = {
|
|
28055
28088
|
..._params,
|
|
28056
|
-
schemaPath: [..._params.schemaPath,
|
|
28089
|
+
schemaPath: [..._params.schemaPath, schema2],
|
|
28057
28090
|
path: _params.path
|
|
28058
28091
|
};
|
|
28059
|
-
if (
|
|
28060
|
-
|
|
28092
|
+
if (schema2._zod.processJSONSchema) {
|
|
28093
|
+
schema2._zod.processJSONSchema(ctx, result.schema, params3);
|
|
28061
28094
|
} else {
|
|
28062
28095
|
const _json = result.schema;
|
|
28063
28096
|
const processor = ctx.processors[def2.type];
|
|
28064
28097
|
if (!processor) {
|
|
28065
28098
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def2.type}`);
|
|
28066
28099
|
}
|
|
28067
|
-
processor(
|
|
28100
|
+
processor(schema2, ctx, _json, params3);
|
|
28068
28101
|
}
|
|
28069
|
-
const parent =
|
|
28102
|
+
const parent = schema2._zod.parent;
|
|
28070
28103
|
if (parent) {
|
|
28071
28104
|
if (!result.ref)
|
|
28072
28105
|
result.ref = parent;
|
|
@@ -28074,21 +28107,21 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
28074
28107
|
ctx.seen.get(parent).isParent = true;
|
|
28075
28108
|
}
|
|
28076
28109
|
}
|
|
28077
|
-
const meta3 = ctx.metadataRegistry.get(
|
|
28110
|
+
const meta3 = ctx.metadataRegistry.get(schema2);
|
|
28078
28111
|
if (meta3)
|
|
28079
28112
|
Object.assign(result.schema, meta3);
|
|
28080
|
-
if (ctx.io === "input" && isTransforming(
|
|
28113
|
+
if (ctx.io === "input" && isTransforming(schema2)) {
|
|
28081
28114
|
delete result.schema.examples;
|
|
28082
28115
|
delete result.schema.default;
|
|
28083
28116
|
}
|
|
28084
28117
|
if (ctx.io === "input" && result.schema._prefault)
|
|
28085
28118
|
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
|
|
28086
28119
|
delete result.schema._prefault;
|
|
28087
|
-
const _result = ctx.seen.get(
|
|
28120
|
+
const _result = ctx.seen.get(schema2);
|
|
28088
28121
|
return _result.schema;
|
|
28089
28122
|
}
|
|
28090
|
-
function extractDefs(ctx,
|
|
28091
|
-
const root = ctx.seen.get(
|
|
28123
|
+
function extractDefs(ctx, schema2) {
|
|
28124
|
+
const root = ctx.seen.get(schema2);
|
|
28092
28125
|
if (!root)
|
|
28093
28126
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
28094
28127
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
@@ -28131,11 +28164,11 @@ function extractDefs(ctx, schema) {
|
|
|
28131
28164
|
seen.def = { ...seen.schema };
|
|
28132
28165
|
if (defId)
|
|
28133
28166
|
seen.defId = defId;
|
|
28134
|
-
const
|
|
28135
|
-
for (const key in
|
|
28136
|
-
delete
|
|
28167
|
+
const schema3 = seen.schema;
|
|
28168
|
+
for (const key in schema3) {
|
|
28169
|
+
delete schema3[key];
|
|
28137
28170
|
}
|
|
28138
|
-
|
|
28171
|
+
schema3.$ref = ref;
|
|
28139
28172
|
};
|
|
28140
28173
|
if (ctx.cycles === "throw") {
|
|
28141
28174
|
for (const entry of ctx.seen.entries()) {
|
|
@@ -28149,13 +28182,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
28149
28182
|
}
|
|
28150
28183
|
for (const entry of ctx.seen.entries()) {
|
|
28151
28184
|
const seen = entry[1];
|
|
28152
|
-
if (
|
|
28185
|
+
if (schema2 === entry[0]) {
|
|
28153
28186
|
extractToDef(entry);
|
|
28154
28187
|
continue;
|
|
28155
28188
|
}
|
|
28156
28189
|
if (ctx.external) {
|
|
28157
28190
|
const ext2 = ctx.external.registry.get(entry[0])?.id;
|
|
28158
|
-
if (
|
|
28191
|
+
if (schema2 !== entry[0] && ext2) {
|
|
28159
28192
|
extractToDef(entry);
|
|
28160
28193
|
continue;
|
|
28161
28194
|
}
|
|
@@ -28177,16 +28210,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
28177
28210
|
}
|
|
28178
28211
|
}
|
|
28179
28212
|
}
|
|
28180
|
-
function finalize(ctx,
|
|
28181
|
-
const root = ctx.seen.get(
|
|
28213
|
+
function finalize(ctx, schema2) {
|
|
28214
|
+
const root = ctx.seen.get(schema2);
|
|
28182
28215
|
if (!root)
|
|
28183
28216
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
28184
28217
|
const flattenRef = (zodSchema) => {
|
|
28185
28218
|
const seen = ctx.seen.get(zodSchema);
|
|
28186
28219
|
if (seen.ref === null)
|
|
28187
28220
|
return;
|
|
28188
|
-
const
|
|
28189
|
-
const _cached = { ...
|
|
28221
|
+
const schema3 = seen.def ?? seen.schema;
|
|
28222
|
+
const _cached = { ...schema3 };
|
|
28190
28223
|
const ref = seen.ref;
|
|
28191
28224
|
seen.ref = null;
|
|
28192
28225
|
if (ref) {
|
|
@@ -28194,28 +28227,28 @@ function finalize(ctx, schema) {
|
|
|
28194
28227
|
const refSeen = ctx.seen.get(ref);
|
|
28195
28228
|
const refSchema = refSeen.schema;
|
|
28196
28229
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
28197
|
-
|
|
28198
|
-
|
|
28230
|
+
schema3.allOf = schema3.allOf ?? [];
|
|
28231
|
+
schema3.allOf.push(refSchema);
|
|
28199
28232
|
} else {
|
|
28200
|
-
Object.assign(
|
|
28233
|
+
Object.assign(schema3, refSchema);
|
|
28201
28234
|
}
|
|
28202
|
-
Object.assign(
|
|
28235
|
+
Object.assign(schema3, _cached);
|
|
28203
28236
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
28204
28237
|
if (isParentRef) {
|
|
28205
|
-
for (const key in
|
|
28238
|
+
for (const key in schema3) {
|
|
28206
28239
|
if (key === "$ref" || key === "allOf")
|
|
28207
28240
|
continue;
|
|
28208
28241
|
if (!(key in _cached)) {
|
|
28209
|
-
delete
|
|
28242
|
+
delete schema3[key];
|
|
28210
28243
|
}
|
|
28211
28244
|
}
|
|
28212
28245
|
}
|
|
28213
28246
|
if (refSchema.$ref && refSeen.def) {
|
|
28214
|
-
for (const key in
|
|
28247
|
+
for (const key in schema3) {
|
|
28215
28248
|
if (key === "$ref" || key === "allOf")
|
|
28216
28249
|
continue;
|
|
28217
|
-
if (key in refSeen.def && JSON.stringify(
|
|
28218
|
-
delete
|
|
28250
|
+
if (key in refSeen.def && JSON.stringify(schema3[key]) === JSON.stringify(refSeen.def[key])) {
|
|
28251
|
+
delete schema3[key];
|
|
28219
28252
|
}
|
|
28220
28253
|
}
|
|
28221
28254
|
}
|
|
@@ -28225,13 +28258,13 @@ function finalize(ctx, schema) {
|
|
|
28225
28258
|
flattenRef(parent);
|
|
28226
28259
|
const parentSeen = ctx.seen.get(parent);
|
|
28227
28260
|
if (parentSeen?.schema.$ref) {
|
|
28228
|
-
|
|
28261
|
+
schema3.$ref = parentSeen.schema.$ref;
|
|
28229
28262
|
if (parentSeen.def) {
|
|
28230
|
-
for (const key in
|
|
28263
|
+
for (const key in schema3) {
|
|
28231
28264
|
if (key === "$ref" || key === "allOf")
|
|
28232
28265
|
continue;
|
|
28233
|
-
if (key in parentSeen.def && JSON.stringify(
|
|
28234
|
-
delete
|
|
28266
|
+
if (key in parentSeen.def && JSON.stringify(schema3[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
28267
|
+
delete schema3[key];
|
|
28235
28268
|
}
|
|
28236
28269
|
}
|
|
28237
28270
|
}
|
|
@@ -28239,7 +28272,7 @@ function finalize(ctx, schema) {
|
|
|
28239
28272
|
}
|
|
28240
28273
|
ctx.override({
|
|
28241
28274
|
zodSchema,
|
|
28242
|
-
jsonSchema:
|
|
28275
|
+
jsonSchema: schema3,
|
|
28243
28276
|
path: seen.path ?? []
|
|
28244
28277
|
});
|
|
28245
28278
|
};
|
|
@@ -28257,7 +28290,7 @@ function finalize(ctx, schema) {
|
|
|
28257
28290
|
} else {
|
|
28258
28291
|
}
|
|
28259
28292
|
if (ctx.external?.uri) {
|
|
28260
|
-
const id = ctx.external.registry.get(
|
|
28293
|
+
const id = ctx.external.registry.get(schema2)?.id;
|
|
28261
28294
|
if (!id)
|
|
28262
28295
|
throw new Error("Schema is missing an `id` property");
|
|
28263
28296
|
result.$id = ctx.external.uri(id);
|
|
@@ -28284,10 +28317,10 @@ function finalize(ctx, schema) {
|
|
|
28284
28317
|
const finalized = JSON.parse(JSON.stringify(result));
|
|
28285
28318
|
Object.defineProperty(finalized, "~standard", {
|
|
28286
28319
|
value: {
|
|
28287
|
-
...
|
|
28320
|
+
...schema2["~standard"],
|
|
28288
28321
|
jsonSchema: {
|
|
28289
|
-
input: createStandardJSONSchemaMethod(
|
|
28290
|
-
output: createStandardJSONSchemaMethod(
|
|
28322
|
+
input: createStandardJSONSchemaMethod(schema2, "input", ctx.processors),
|
|
28323
|
+
output: createStandardJSONSchemaMethod(schema2, "output", ctx.processors)
|
|
28291
28324
|
}
|
|
28292
28325
|
},
|
|
28293
28326
|
enumerable: false,
|
|
@@ -28349,18 +28382,18 @@ function isTransforming(_schema, _ctx) {
|
|
|
28349
28382
|
}
|
|
28350
28383
|
return false;
|
|
28351
28384
|
}
|
|
28352
|
-
var createToJSONSchemaMethod = (
|
|
28385
|
+
var createToJSONSchemaMethod = (schema2, processors = {}) => (params3) => {
|
|
28353
28386
|
const ctx = initializeContext({ ...params3, processors });
|
|
28354
|
-
process2(
|
|
28355
|
-
extractDefs(ctx,
|
|
28356
|
-
return finalize(ctx,
|
|
28387
|
+
process2(schema2, ctx);
|
|
28388
|
+
extractDefs(ctx, schema2);
|
|
28389
|
+
return finalize(ctx, schema2);
|
|
28357
28390
|
};
|
|
28358
|
-
var createStandardJSONSchemaMethod = (
|
|
28391
|
+
var createStandardJSONSchemaMethod = (schema2, io, processors = {}) => (params3) => {
|
|
28359
28392
|
const { libraryOptions, target } = params3 ?? {};
|
|
28360
28393
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
28361
|
-
process2(
|
|
28362
|
-
extractDefs(ctx,
|
|
28363
|
-
return finalize(ctx,
|
|
28394
|
+
process2(schema2, ctx);
|
|
28395
|
+
extractDefs(ctx, schema2);
|
|
28396
|
+
return finalize(ctx, schema2);
|
|
28364
28397
|
};
|
|
28365
28398
|
|
|
28366
28399
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/core/json-schema-processors.js
|
|
@@ -28372,10 +28405,10 @@ var formatMap = {
|
|
|
28372
28405
|
regex: ""
|
|
28373
28406
|
// do not set
|
|
28374
28407
|
};
|
|
28375
|
-
var stringProcessor = (
|
|
28408
|
+
var stringProcessor = (schema2, ctx, _json, _params) => {
|
|
28376
28409
|
const json3 = _json;
|
|
28377
28410
|
json3.type = "string";
|
|
28378
|
-
const { minimum, maximum, format, patterns, contentEncoding } =
|
|
28411
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema2._zod.bag;
|
|
28379
28412
|
if (typeof minimum === "number")
|
|
28380
28413
|
json3.minLength = minimum;
|
|
28381
28414
|
if (typeof maximum === "number")
|
|
@@ -28404,9 +28437,9 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
28404
28437
|
}
|
|
28405
28438
|
}
|
|
28406
28439
|
};
|
|
28407
|
-
var numberProcessor = (
|
|
28440
|
+
var numberProcessor = (schema2, ctx, _json, _params) => {
|
|
28408
28441
|
const json3 = _json;
|
|
28409
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } =
|
|
28442
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema2._zod.bag;
|
|
28410
28443
|
if (typeof format === "string" && format.includes("int"))
|
|
28411
28444
|
json3.type = "integer";
|
|
28412
28445
|
else
|
|
@@ -28492,8 +28525,8 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
28492
28525
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
28493
28526
|
}
|
|
28494
28527
|
};
|
|
28495
|
-
var enumProcessor = (
|
|
28496
|
-
const def2 =
|
|
28528
|
+
var enumProcessor = (schema2, _ctx, json3, _params) => {
|
|
28529
|
+
const def2 = schema2._zod.def;
|
|
28497
28530
|
const values2 = getEnumValues(def2.entries);
|
|
28498
28531
|
if (values2.every((v) => typeof v === "number"))
|
|
28499
28532
|
json3.type = "number";
|
|
@@ -28501,8 +28534,8 @@ var enumProcessor = (schema, _ctx, json3, _params) => {
|
|
|
28501
28534
|
json3.type = "string";
|
|
28502
28535
|
json3.enum = values2;
|
|
28503
28536
|
};
|
|
28504
|
-
var literalProcessor = (
|
|
28505
|
-
const def2 =
|
|
28537
|
+
var literalProcessor = (schema2, ctx, json3, _params) => {
|
|
28538
|
+
const def2 = schema2._zod.def;
|
|
28506
28539
|
const vals = [];
|
|
28507
28540
|
for (const val of def2.values) {
|
|
28508
28541
|
if (val === void 0) {
|
|
@@ -28546,22 +28579,22 @@ var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
|
28546
28579
|
throw new Error("NaN cannot be represented in JSON Schema");
|
|
28547
28580
|
}
|
|
28548
28581
|
};
|
|
28549
|
-
var templateLiteralProcessor = (
|
|
28582
|
+
var templateLiteralProcessor = (schema2, _ctx, json3, _params) => {
|
|
28550
28583
|
const _json = json3;
|
|
28551
|
-
const pattern =
|
|
28584
|
+
const pattern = schema2._zod.pattern;
|
|
28552
28585
|
if (!pattern)
|
|
28553
28586
|
throw new Error("Pattern not found in template literal");
|
|
28554
28587
|
_json.type = "string";
|
|
28555
28588
|
_json.pattern = pattern.source;
|
|
28556
28589
|
};
|
|
28557
|
-
var fileProcessor = (
|
|
28590
|
+
var fileProcessor = (schema2, _ctx, json3, _params) => {
|
|
28558
28591
|
const _json = json3;
|
|
28559
28592
|
const file2 = {
|
|
28560
28593
|
type: "string",
|
|
28561
28594
|
format: "binary",
|
|
28562
28595
|
contentEncoding: "binary"
|
|
28563
28596
|
};
|
|
28564
|
-
const { minimum, maximum, mime } =
|
|
28597
|
+
const { minimum, maximum, mime } = schema2._zod.bag;
|
|
28565
28598
|
if (minimum !== void 0)
|
|
28566
28599
|
file2.minLength = minimum;
|
|
28567
28600
|
if (maximum !== void 0)
|
|
@@ -28606,10 +28639,10 @@ var setProcessor = (_schema, ctx, _json, _params) => {
|
|
|
28606
28639
|
throw new Error("Set cannot be represented in JSON Schema");
|
|
28607
28640
|
}
|
|
28608
28641
|
};
|
|
28609
|
-
var arrayProcessor = (
|
|
28642
|
+
var arrayProcessor = (schema2, ctx, _json, params3) => {
|
|
28610
28643
|
const json3 = _json;
|
|
28611
|
-
const def2 =
|
|
28612
|
-
const { minimum, maximum } =
|
|
28644
|
+
const def2 = schema2._zod.def;
|
|
28645
|
+
const { minimum, maximum } = schema2._zod.bag;
|
|
28613
28646
|
if (typeof minimum === "number")
|
|
28614
28647
|
json3.minItems = minimum;
|
|
28615
28648
|
if (typeof maximum === "number")
|
|
@@ -28617,9 +28650,9 @@ var arrayProcessor = (schema, ctx, _json, params3) => {
|
|
|
28617
28650
|
json3.type = "array";
|
|
28618
28651
|
json3.items = process2(def2.element, ctx, { ...params3, path: [...params3.path, "items"] });
|
|
28619
28652
|
};
|
|
28620
|
-
var objectProcessor = (
|
|
28653
|
+
var objectProcessor = (schema2, ctx, _json, params3) => {
|
|
28621
28654
|
const json3 = _json;
|
|
28622
|
-
const def2 =
|
|
28655
|
+
const def2 = schema2._zod.def;
|
|
28623
28656
|
json3.type = "object";
|
|
28624
28657
|
json3.properties = {};
|
|
28625
28658
|
const shape = def2.shape;
|
|
@@ -28653,8 +28686,8 @@ var objectProcessor = (schema, ctx, _json, params3) => {
|
|
|
28653
28686
|
});
|
|
28654
28687
|
}
|
|
28655
28688
|
};
|
|
28656
|
-
var unionProcessor = (
|
|
28657
|
-
const def2 =
|
|
28689
|
+
var unionProcessor = (schema2, ctx, json3, params3) => {
|
|
28690
|
+
const def2 = schema2._zod.def;
|
|
28658
28691
|
const isExclusive = def2.inclusive === false;
|
|
28659
28692
|
const options = def2.options.map((x, i) => process2(x, ctx, {
|
|
28660
28693
|
...params3,
|
|
@@ -28666,8 +28699,8 @@ var unionProcessor = (schema, ctx, json3, params3) => {
|
|
|
28666
28699
|
json3.anyOf = options;
|
|
28667
28700
|
}
|
|
28668
28701
|
};
|
|
28669
|
-
var intersectionProcessor = (
|
|
28670
|
-
const def2 =
|
|
28702
|
+
var intersectionProcessor = (schema2, ctx, json3, params3) => {
|
|
28703
|
+
const def2 = schema2._zod.def;
|
|
28671
28704
|
const a = process2(def2.left, ctx, {
|
|
28672
28705
|
...params3,
|
|
28673
28706
|
path: [...params3.path, "allOf", 0]
|
|
@@ -28683,9 +28716,9 @@ var intersectionProcessor = (schema, ctx, json3, params3) => {
|
|
|
28683
28716
|
];
|
|
28684
28717
|
json3.allOf = allOf;
|
|
28685
28718
|
};
|
|
28686
|
-
var tupleProcessor = (
|
|
28719
|
+
var tupleProcessor = (schema2, ctx, _json, params3) => {
|
|
28687
28720
|
const json3 = _json;
|
|
28688
|
-
const def2 =
|
|
28721
|
+
const def2 = schema2._zod.def;
|
|
28689
28722
|
json3.type = "array";
|
|
28690
28723
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
28691
28724
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
@@ -28719,15 +28752,15 @@ var tupleProcessor = (schema, ctx, _json, params3) => {
|
|
|
28719
28752
|
json3.additionalItems = rest;
|
|
28720
28753
|
}
|
|
28721
28754
|
}
|
|
28722
|
-
const { minimum, maximum } =
|
|
28755
|
+
const { minimum, maximum } = schema2._zod.bag;
|
|
28723
28756
|
if (typeof minimum === "number")
|
|
28724
28757
|
json3.minItems = minimum;
|
|
28725
28758
|
if (typeof maximum === "number")
|
|
28726
28759
|
json3.maxItems = maximum;
|
|
28727
28760
|
};
|
|
28728
|
-
var recordProcessor = (
|
|
28761
|
+
var recordProcessor = (schema2, ctx, _json, params3) => {
|
|
28729
28762
|
const json3 = _json;
|
|
28730
|
-
const def2 =
|
|
28763
|
+
const def2 = schema2._zod.def;
|
|
28731
28764
|
json3.type = "object";
|
|
28732
28765
|
const keyType = def2.keyType;
|
|
28733
28766
|
const keyBag = keyType._zod.bag;
|
|
@@ -28761,10 +28794,10 @@ var recordProcessor = (schema, ctx, _json, params3) => {
|
|
|
28761
28794
|
}
|
|
28762
28795
|
}
|
|
28763
28796
|
};
|
|
28764
|
-
var nullableProcessor = (
|
|
28765
|
-
const def2 =
|
|
28797
|
+
var nullableProcessor = (schema2, ctx, json3, params3) => {
|
|
28798
|
+
const def2 = schema2._zod.def;
|
|
28766
28799
|
const inner = process2(def2.innerType, ctx, params3);
|
|
28767
|
-
const seen = ctx.seen.get(
|
|
28800
|
+
const seen = ctx.seen.get(schema2);
|
|
28768
28801
|
if (ctx.target === "openapi-3.0") {
|
|
28769
28802
|
seen.ref = def2.innerType;
|
|
28770
28803
|
json3.nullable = true;
|
|
@@ -28772,31 +28805,31 @@ var nullableProcessor = (schema, ctx, json3, params3) => {
|
|
|
28772
28805
|
json3.anyOf = [inner, { type: "null" }];
|
|
28773
28806
|
}
|
|
28774
28807
|
};
|
|
28775
|
-
var nonoptionalProcessor = (
|
|
28776
|
-
const def2 =
|
|
28808
|
+
var nonoptionalProcessor = (schema2, ctx, _json, params3) => {
|
|
28809
|
+
const def2 = schema2._zod.def;
|
|
28777
28810
|
process2(def2.innerType, ctx, params3);
|
|
28778
|
-
const seen = ctx.seen.get(
|
|
28811
|
+
const seen = ctx.seen.get(schema2);
|
|
28779
28812
|
seen.ref = def2.innerType;
|
|
28780
28813
|
};
|
|
28781
|
-
var defaultProcessor = (
|
|
28782
|
-
const def2 =
|
|
28814
|
+
var defaultProcessor = (schema2, ctx, json3, params3) => {
|
|
28815
|
+
const def2 = schema2._zod.def;
|
|
28783
28816
|
process2(def2.innerType, ctx, params3);
|
|
28784
|
-
const seen = ctx.seen.get(
|
|
28817
|
+
const seen = ctx.seen.get(schema2);
|
|
28785
28818
|
seen.ref = def2.innerType;
|
|
28786
28819
|
json3.default = JSON.parse(JSON.stringify(def2.defaultValue));
|
|
28787
28820
|
};
|
|
28788
|
-
var prefaultProcessor = (
|
|
28789
|
-
const def2 =
|
|
28821
|
+
var prefaultProcessor = (schema2, ctx, json3, params3) => {
|
|
28822
|
+
const def2 = schema2._zod.def;
|
|
28790
28823
|
process2(def2.innerType, ctx, params3);
|
|
28791
|
-
const seen = ctx.seen.get(
|
|
28824
|
+
const seen = ctx.seen.get(schema2);
|
|
28792
28825
|
seen.ref = def2.innerType;
|
|
28793
28826
|
if (ctx.io === "input")
|
|
28794
28827
|
json3._prefault = JSON.parse(JSON.stringify(def2.defaultValue));
|
|
28795
28828
|
};
|
|
28796
|
-
var catchProcessor = (
|
|
28797
|
-
const def2 =
|
|
28829
|
+
var catchProcessor = (schema2, ctx, json3, params3) => {
|
|
28830
|
+
const def2 = schema2._zod.def;
|
|
28798
28831
|
process2(def2.innerType, ctx, params3);
|
|
28799
|
-
const seen = ctx.seen.get(
|
|
28832
|
+
const seen = ctx.seen.get(schema2);
|
|
28800
28833
|
seen.ref = def2.innerType;
|
|
28801
28834
|
let catchValue;
|
|
28802
28835
|
try {
|
|
@@ -28806,36 +28839,36 @@ var catchProcessor = (schema, ctx, json3, params3) => {
|
|
|
28806
28839
|
}
|
|
28807
28840
|
json3.default = catchValue;
|
|
28808
28841
|
};
|
|
28809
|
-
var pipeProcessor = (
|
|
28810
|
-
const def2 =
|
|
28842
|
+
var pipeProcessor = (schema2, ctx, _json, params3) => {
|
|
28843
|
+
const def2 = schema2._zod.def;
|
|
28811
28844
|
const innerType = ctx.io === "input" ? def2.in._zod.def.type === "transform" ? def2.out : def2.in : def2.out;
|
|
28812
28845
|
process2(innerType, ctx, params3);
|
|
28813
|
-
const seen = ctx.seen.get(
|
|
28846
|
+
const seen = ctx.seen.get(schema2);
|
|
28814
28847
|
seen.ref = innerType;
|
|
28815
28848
|
};
|
|
28816
|
-
var readonlyProcessor = (
|
|
28817
|
-
const def2 =
|
|
28849
|
+
var readonlyProcessor = (schema2, ctx, json3, params3) => {
|
|
28850
|
+
const def2 = schema2._zod.def;
|
|
28818
28851
|
process2(def2.innerType, ctx, params3);
|
|
28819
|
-
const seen = ctx.seen.get(
|
|
28852
|
+
const seen = ctx.seen.get(schema2);
|
|
28820
28853
|
seen.ref = def2.innerType;
|
|
28821
28854
|
json3.readOnly = true;
|
|
28822
28855
|
};
|
|
28823
|
-
var promiseProcessor = (
|
|
28824
|
-
const def2 =
|
|
28856
|
+
var promiseProcessor = (schema2, ctx, _json, params3) => {
|
|
28857
|
+
const def2 = schema2._zod.def;
|
|
28825
28858
|
process2(def2.innerType, ctx, params3);
|
|
28826
|
-
const seen = ctx.seen.get(
|
|
28859
|
+
const seen = ctx.seen.get(schema2);
|
|
28827
28860
|
seen.ref = def2.innerType;
|
|
28828
28861
|
};
|
|
28829
|
-
var optionalProcessor = (
|
|
28830
|
-
const def2 =
|
|
28862
|
+
var optionalProcessor = (schema2, ctx, _json, params3) => {
|
|
28863
|
+
const def2 = schema2._zod.def;
|
|
28831
28864
|
process2(def2.innerType, ctx, params3);
|
|
28832
|
-
const seen = ctx.seen.get(
|
|
28865
|
+
const seen = ctx.seen.get(schema2);
|
|
28833
28866
|
seen.ref = def2.innerType;
|
|
28834
28867
|
};
|
|
28835
|
-
var lazyProcessor = (
|
|
28836
|
-
const innerType =
|
|
28868
|
+
var lazyProcessor = (schema2, ctx, _json, params3) => {
|
|
28869
|
+
const innerType = schema2._zod.innerType;
|
|
28837
28870
|
process2(innerType, ctx, params3);
|
|
28838
|
-
const seen = ctx.seen.get(
|
|
28871
|
+
const seen = ctx.seen.get(schema2);
|
|
28839
28872
|
seen.ref = innerType;
|
|
28840
28873
|
};
|
|
28841
28874
|
var allProcessors = {
|
|
@@ -28885,8 +28918,8 @@ function toJSONSchema(input, params3) {
|
|
|
28885
28918
|
const ctx2 = initializeContext({ ...params3, processors: allProcessors });
|
|
28886
28919
|
const defs = {};
|
|
28887
28920
|
for (const entry of registry2._idmap.entries()) {
|
|
28888
|
-
const [_,
|
|
28889
|
-
process2(
|
|
28921
|
+
const [_, schema2] = entry;
|
|
28922
|
+
process2(schema2, ctx2);
|
|
28890
28923
|
}
|
|
28891
28924
|
const schemas = {};
|
|
28892
28925
|
const external = {
|
|
@@ -28896,9 +28929,9 @@ function toJSONSchema(input, params3) {
|
|
|
28896
28929
|
};
|
|
28897
28930
|
ctx2.external = external;
|
|
28898
28931
|
for (const entry of registry2._idmap.entries()) {
|
|
28899
|
-
const [key,
|
|
28900
|
-
extractDefs(ctx2,
|
|
28901
|
-
schemas[key] = finalize(ctx2,
|
|
28932
|
+
const [key, schema2] = entry;
|
|
28933
|
+
extractDefs(ctx2, schema2);
|
|
28934
|
+
schemas[key] = finalize(ctx2, schema2);
|
|
28902
28935
|
}
|
|
28903
28936
|
if (Object.keys(defs).length > 0) {
|
|
28904
28937
|
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
@@ -28966,14 +28999,14 @@ var JSONSchemaGenerator = class {
|
|
|
28966
28999
|
* Process a schema to prepare it for JSON Schema generation.
|
|
28967
29000
|
* This must be called before emit().
|
|
28968
29001
|
*/
|
|
28969
|
-
process(
|
|
28970
|
-
return process2(
|
|
29002
|
+
process(schema2, _params = { path: [], schemaPath: [] }) {
|
|
29003
|
+
return process2(schema2, this.ctx, _params);
|
|
28971
29004
|
}
|
|
28972
29005
|
/**
|
|
28973
29006
|
* Emit the final JSON Schema after processing.
|
|
28974
29007
|
* Must call process() first.
|
|
28975
29008
|
*/
|
|
28976
|
-
emit(
|
|
29009
|
+
emit(schema2, _params) {
|
|
28977
29010
|
if (_params) {
|
|
28978
29011
|
if (_params.cycles)
|
|
28979
29012
|
this.ctx.cycles = _params.cycles;
|
|
@@ -28982,8 +29015,8 @@ var JSONSchemaGenerator = class {
|
|
|
28982
29015
|
if (_params.external)
|
|
28983
29016
|
this.ctx.external = _params.external;
|
|
28984
29017
|
}
|
|
28985
|
-
extractDefs(this.ctx,
|
|
28986
|
-
const result = finalize(this.ctx,
|
|
29018
|
+
extractDefs(this.ctx, schema2);
|
|
29019
|
+
const result = finalize(this.ctx, schema2);
|
|
28987
29020
|
const { "~standard": _, ...plainResult } = result;
|
|
28988
29021
|
return plainResult;
|
|
28989
29022
|
}
|
|
@@ -29038,8 +29071,8 @@ function object(shape, params3) {
|
|
|
29038
29071
|
|
|
29039
29072
|
// ../../.yarn/__virtual__/@modelcontextprotocol-sdk-virtual-4beea6215a/0/cache/@modelcontextprotocol-sdk-npm-1.26.0-380479a6f8-b4098789d9.zip/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
29040
29073
|
function isZ4Schema(s) {
|
|
29041
|
-
const
|
|
29042
|
-
return !!
|
|
29074
|
+
const schema2 = s;
|
|
29075
|
+
return !!schema2._zod;
|
|
29043
29076
|
}
|
|
29044
29077
|
function objectFromShape(shape) {
|
|
29045
29078
|
const values2 = Object.values(shape);
|
|
@@ -29053,33 +29086,33 @@ function objectFromShape(shape) {
|
|
|
29053
29086
|
return objectType(shape);
|
|
29054
29087
|
throw new Error("Mixed Zod versions detected in object shape.");
|
|
29055
29088
|
}
|
|
29056
|
-
function safeParse2(
|
|
29057
|
-
if (isZ4Schema(
|
|
29058
|
-
const result2 = safeParse(
|
|
29089
|
+
function safeParse2(schema2, data) {
|
|
29090
|
+
if (isZ4Schema(schema2)) {
|
|
29091
|
+
const result2 = safeParse(schema2, data);
|
|
29059
29092
|
return result2;
|
|
29060
29093
|
}
|
|
29061
|
-
const v3Schema =
|
|
29094
|
+
const v3Schema = schema2;
|
|
29062
29095
|
const result = v3Schema.safeParse(data);
|
|
29063
29096
|
return result;
|
|
29064
29097
|
}
|
|
29065
|
-
async function safeParseAsync2(
|
|
29066
|
-
if (isZ4Schema(
|
|
29067
|
-
const result2 = await safeParseAsync(
|
|
29098
|
+
async function safeParseAsync2(schema2, data) {
|
|
29099
|
+
if (isZ4Schema(schema2)) {
|
|
29100
|
+
const result2 = await safeParseAsync(schema2, data);
|
|
29068
29101
|
return result2;
|
|
29069
29102
|
}
|
|
29070
|
-
const v3Schema =
|
|
29103
|
+
const v3Schema = schema2;
|
|
29071
29104
|
const result = await v3Schema.safeParseAsync(data);
|
|
29072
29105
|
return result;
|
|
29073
29106
|
}
|
|
29074
|
-
function getObjectShape(
|
|
29075
|
-
if (!
|
|
29107
|
+
function getObjectShape(schema2) {
|
|
29108
|
+
if (!schema2)
|
|
29076
29109
|
return void 0;
|
|
29077
29110
|
let rawShape;
|
|
29078
|
-
if (isZ4Schema(
|
|
29079
|
-
const v4Schema =
|
|
29111
|
+
if (isZ4Schema(schema2)) {
|
|
29112
|
+
const v4Schema = schema2;
|
|
29080
29113
|
rawShape = v4Schema._zod?.def?.shape;
|
|
29081
29114
|
} else {
|
|
29082
|
-
const v3Schema =
|
|
29115
|
+
const v3Schema = schema2;
|
|
29083
29116
|
rawShape = v3Schema.shape;
|
|
29084
29117
|
}
|
|
29085
29118
|
if (!rawShape)
|
|
@@ -29093,29 +29126,29 @@ function getObjectShape(schema) {
|
|
|
29093
29126
|
}
|
|
29094
29127
|
return rawShape;
|
|
29095
29128
|
}
|
|
29096
|
-
function normalizeObjectSchema(
|
|
29097
|
-
if (!
|
|
29129
|
+
function normalizeObjectSchema(schema2) {
|
|
29130
|
+
if (!schema2)
|
|
29098
29131
|
return void 0;
|
|
29099
|
-
if (typeof
|
|
29100
|
-
const asV3 =
|
|
29101
|
-
const asV4 =
|
|
29132
|
+
if (typeof schema2 === "object") {
|
|
29133
|
+
const asV3 = schema2;
|
|
29134
|
+
const asV4 = schema2;
|
|
29102
29135
|
if (!asV3._def && !asV4._zod) {
|
|
29103
|
-
const values2 = Object.values(
|
|
29136
|
+
const values2 = Object.values(schema2);
|
|
29104
29137
|
if (values2.length > 0 && values2.every((v) => typeof v === "object" && v !== null && (v._def !== void 0 || v._zod !== void 0 || typeof v.parse === "function"))) {
|
|
29105
|
-
return objectFromShape(
|
|
29138
|
+
return objectFromShape(schema2);
|
|
29106
29139
|
}
|
|
29107
29140
|
}
|
|
29108
29141
|
}
|
|
29109
|
-
if (isZ4Schema(
|
|
29110
|
-
const v4Schema =
|
|
29142
|
+
if (isZ4Schema(schema2)) {
|
|
29143
|
+
const v4Schema = schema2;
|
|
29111
29144
|
const def2 = v4Schema._zod?.def;
|
|
29112
29145
|
if (def2 && (def2.type === "object" || def2.shape !== void 0)) {
|
|
29113
|
-
return
|
|
29146
|
+
return schema2;
|
|
29114
29147
|
}
|
|
29115
29148
|
} else {
|
|
29116
|
-
const v3Schema =
|
|
29149
|
+
const v3Schema = schema2;
|
|
29117
29150
|
if (v3Schema.shape !== void 0) {
|
|
29118
|
-
return
|
|
29151
|
+
return schema2;
|
|
29119
29152
|
}
|
|
29120
29153
|
}
|
|
29121
29154
|
return void 0;
|
|
@@ -29139,23 +29172,23 @@ function getParseErrorMessage(error48) {
|
|
|
29139
29172
|
}
|
|
29140
29173
|
return String(error48);
|
|
29141
29174
|
}
|
|
29142
|
-
function getSchemaDescription(
|
|
29143
|
-
return
|
|
29175
|
+
function getSchemaDescription(schema2) {
|
|
29176
|
+
return schema2.description;
|
|
29144
29177
|
}
|
|
29145
|
-
function isSchemaOptional(
|
|
29146
|
-
if (isZ4Schema(
|
|
29147
|
-
const v4Schema =
|
|
29178
|
+
function isSchemaOptional(schema2) {
|
|
29179
|
+
if (isZ4Schema(schema2)) {
|
|
29180
|
+
const v4Schema = schema2;
|
|
29148
29181
|
return v4Schema._zod?.def?.type === "optional";
|
|
29149
29182
|
}
|
|
29150
|
-
const v3Schema =
|
|
29151
|
-
if (typeof
|
|
29152
|
-
return
|
|
29183
|
+
const v3Schema = schema2;
|
|
29184
|
+
if (typeof schema2.isOptional === "function") {
|
|
29185
|
+
return schema2.isOptional();
|
|
29153
29186
|
}
|
|
29154
29187
|
return v3Schema._def?.typeName === "ZodOptional";
|
|
29155
29188
|
}
|
|
29156
|
-
function getLiteralValue(
|
|
29157
|
-
if (isZ4Schema(
|
|
29158
|
-
const v4Schema =
|
|
29189
|
+
function getLiteralValue(schema2) {
|
|
29190
|
+
if (isZ4Schema(schema2)) {
|
|
29191
|
+
const v4Schema = schema2;
|
|
29159
29192
|
const def3 = v4Schema._zod?.def;
|
|
29160
29193
|
if (def3) {
|
|
29161
29194
|
if (def3.value !== void 0)
|
|
@@ -29165,7 +29198,7 @@ function getLiteralValue(schema) {
|
|
|
29165
29198
|
}
|
|
29166
29199
|
}
|
|
29167
29200
|
}
|
|
29168
|
-
const v3Schema =
|
|
29201
|
+
const v3Schema = schema2;
|
|
29169
29202
|
const def2 = v3Schema._def;
|
|
29170
29203
|
if (def2) {
|
|
29171
29204
|
if (def2.value !== void 0)
|
|
@@ -29174,7 +29207,7 @@ function getLiteralValue(schema) {
|
|
|
29174
29207
|
return def2.values[0];
|
|
29175
29208
|
}
|
|
29176
29209
|
}
|
|
29177
|
-
const directValue =
|
|
29210
|
+
const directValue = schema2.value;
|
|
29178
29211
|
if (directValue !== void 0)
|
|
29179
29212
|
return directValue;
|
|
29180
29213
|
return void 0;
|
|
@@ -30216,8 +30249,8 @@ var ZodArray2 = /* @__PURE__ */ $constructor("ZodArray", (inst, def2) => {
|
|
|
30216
30249
|
function array(element, params3) {
|
|
30217
30250
|
return _array(ZodArray2, element, params3);
|
|
30218
30251
|
}
|
|
30219
|
-
function keyof(
|
|
30220
|
-
const shape =
|
|
30252
|
+
function keyof(schema2) {
|
|
30253
|
+
const shape = schema2._zod.def.shape;
|
|
30221
30254
|
return _enum2(Object.keys(shape));
|
|
30222
30255
|
}
|
|
30223
30256
|
var ZodObject2 = /* @__PURE__ */ $constructor("ZodObject", (inst, def2) => {
|
|
@@ -30794,8 +30827,8 @@ function json(params3) {
|
|
|
30794
30827
|
});
|
|
30795
30828
|
return jsonSchema;
|
|
30796
30829
|
}
|
|
30797
|
-
function preprocess(fn,
|
|
30798
|
-
return pipe(transform(fn),
|
|
30830
|
+
function preprocess(fn, schema2) {
|
|
30831
|
+
return pipe(transform(fn), schema2);
|
|
30799
30832
|
}
|
|
30800
30833
|
|
|
30801
30834
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/classic/compat.js
|
|
@@ -30901,8 +30934,8 @@ var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
|
|
|
30901
30934
|
"nullable",
|
|
30902
30935
|
"readOnly"
|
|
30903
30936
|
]);
|
|
30904
|
-
function detectVersion(
|
|
30905
|
-
const $schema =
|
|
30937
|
+
function detectVersion(schema2, defaultTarget) {
|
|
30938
|
+
const $schema = schema2.$schema;
|
|
30906
30939
|
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
30907
30940
|
return "draft-2020-12";
|
|
30908
30941
|
}
|
|
@@ -30932,27 +30965,27 @@ function resolveRef(ref, ctx) {
|
|
|
30932
30965
|
}
|
|
30933
30966
|
throw new Error(`Reference not found: ${ref}`);
|
|
30934
30967
|
}
|
|
30935
|
-
function convertBaseSchema(
|
|
30936
|
-
if (
|
|
30937
|
-
if (typeof
|
|
30968
|
+
function convertBaseSchema(schema2, ctx) {
|
|
30969
|
+
if (schema2.not !== void 0) {
|
|
30970
|
+
if (typeof schema2.not === "object" && Object.keys(schema2.not).length === 0) {
|
|
30938
30971
|
return z.never();
|
|
30939
30972
|
}
|
|
30940
30973
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
30941
30974
|
}
|
|
30942
|
-
if (
|
|
30975
|
+
if (schema2.unevaluatedItems !== void 0) {
|
|
30943
30976
|
throw new Error("unevaluatedItems is not supported");
|
|
30944
30977
|
}
|
|
30945
|
-
if (
|
|
30978
|
+
if (schema2.unevaluatedProperties !== void 0) {
|
|
30946
30979
|
throw new Error("unevaluatedProperties is not supported");
|
|
30947
30980
|
}
|
|
30948
|
-
if (
|
|
30981
|
+
if (schema2.if !== void 0 || schema2.then !== void 0 || schema2.else !== void 0) {
|
|
30949
30982
|
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
30950
30983
|
}
|
|
30951
|
-
if (
|
|
30984
|
+
if (schema2.dependentSchemas !== void 0 || schema2.dependentRequired !== void 0) {
|
|
30952
30985
|
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
30953
30986
|
}
|
|
30954
|
-
if (
|
|
30955
|
-
const refPath =
|
|
30987
|
+
if (schema2.$ref) {
|
|
30988
|
+
const refPath = schema2.$ref;
|
|
30956
30989
|
if (ctx.refs.has(refPath)) {
|
|
30957
30990
|
return ctx.refs.get(refPath);
|
|
30958
30991
|
}
|
|
@@ -30971,9 +31004,9 @@ function convertBaseSchema(schema, ctx) {
|
|
|
30971
31004
|
ctx.processing.delete(refPath);
|
|
30972
31005
|
return zodSchema2;
|
|
30973
31006
|
}
|
|
30974
|
-
if (
|
|
30975
|
-
const enumValues =
|
|
30976
|
-
if (ctx.version === "openapi-3.0" &&
|
|
31007
|
+
if (schema2.enum !== void 0) {
|
|
31008
|
+
const enumValues = schema2.enum;
|
|
31009
|
+
if (ctx.version === "openapi-3.0" && schema2.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
30977
31010
|
return z.null();
|
|
30978
31011
|
}
|
|
30979
31012
|
if (enumValues.length === 0) {
|
|
@@ -30991,13 +31024,13 @@ function convertBaseSchema(schema, ctx) {
|
|
|
30991
31024
|
}
|
|
30992
31025
|
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
30993
31026
|
}
|
|
30994
|
-
if (
|
|
30995
|
-
return z.literal(
|
|
31027
|
+
if (schema2.const !== void 0) {
|
|
31028
|
+
return z.literal(schema2.const);
|
|
30996
31029
|
}
|
|
30997
|
-
const type =
|
|
31030
|
+
const type = schema2.type;
|
|
30998
31031
|
if (Array.isArray(type)) {
|
|
30999
31032
|
const typeSchemas = type.map((t) => {
|
|
31000
|
-
const typeSchema = { ...
|
|
31033
|
+
const typeSchema = { ...schema2, type: t };
|
|
31001
31034
|
return convertBaseSchema(typeSchema, ctx);
|
|
31002
31035
|
});
|
|
31003
31036
|
if (typeSchemas.length === 0) {
|
|
@@ -31015,8 +31048,8 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31015
31048
|
switch (type) {
|
|
31016
31049
|
case "string": {
|
|
31017
31050
|
let stringSchema = z.string();
|
|
31018
|
-
if (
|
|
31019
|
-
const format =
|
|
31051
|
+
if (schema2.format) {
|
|
31052
|
+
const format = schema2.format;
|
|
31020
31053
|
if (format === "email") {
|
|
31021
31054
|
stringSchema = stringSchema.check(z.email());
|
|
31022
31055
|
} else if (format === "uri" || format === "uri-reference") {
|
|
@@ -31065,14 +31098,14 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31065
31098
|
stringSchema = stringSchema.check(z.ksuid());
|
|
31066
31099
|
}
|
|
31067
31100
|
}
|
|
31068
|
-
if (typeof
|
|
31069
|
-
stringSchema = stringSchema.min(
|
|
31101
|
+
if (typeof schema2.minLength === "number") {
|
|
31102
|
+
stringSchema = stringSchema.min(schema2.minLength);
|
|
31070
31103
|
}
|
|
31071
|
-
if (typeof
|
|
31072
|
-
stringSchema = stringSchema.max(
|
|
31104
|
+
if (typeof schema2.maxLength === "number") {
|
|
31105
|
+
stringSchema = stringSchema.max(schema2.maxLength);
|
|
31073
31106
|
}
|
|
31074
|
-
if (
|
|
31075
|
-
stringSchema = stringSchema.regex(new RegExp(
|
|
31107
|
+
if (schema2.pattern) {
|
|
31108
|
+
stringSchema = stringSchema.regex(new RegExp(schema2.pattern));
|
|
31076
31109
|
}
|
|
31077
31110
|
zodSchema = stringSchema;
|
|
31078
31111
|
break;
|
|
@@ -31080,24 +31113,24 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31080
31113
|
case "number":
|
|
31081
31114
|
case "integer": {
|
|
31082
31115
|
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
31083
|
-
if (typeof
|
|
31084
|
-
numberSchema = numberSchema.min(
|
|
31116
|
+
if (typeof schema2.minimum === "number") {
|
|
31117
|
+
numberSchema = numberSchema.min(schema2.minimum);
|
|
31085
31118
|
}
|
|
31086
|
-
if (typeof
|
|
31087
|
-
numberSchema = numberSchema.max(
|
|
31119
|
+
if (typeof schema2.maximum === "number") {
|
|
31120
|
+
numberSchema = numberSchema.max(schema2.maximum);
|
|
31088
31121
|
}
|
|
31089
|
-
if (typeof
|
|
31090
|
-
numberSchema = numberSchema.gt(
|
|
31091
|
-
} else if (
|
|
31092
|
-
numberSchema = numberSchema.gt(
|
|
31122
|
+
if (typeof schema2.exclusiveMinimum === "number") {
|
|
31123
|
+
numberSchema = numberSchema.gt(schema2.exclusiveMinimum);
|
|
31124
|
+
} else if (schema2.exclusiveMinimum === true && typeof schema2.minimum === "number") {
|
|
31125
|
+
numberSchema = numberSchema.gt(schema2.minimum);
|
|
31093
31126
|
}
|
|
31094
|
-
if (typeof
|
|
31095
|
-
numberSchema = numberSchema.lt(
|
|
31096
|
-
} else if (
|
|
31097
|
-
numberSchema = numberSchema.lt(
|
|
31127
|
+
if (typeof schema2.exclusiveMaximum === "number") {
|
|
31128
|
+
numberSchema = numberSchema.lt(schema2.exclusiveMaximum);
|
|
31129
|
+
} else if (schema2.exclusiveMaximum === true && typeof schema2.maximum === "number") {
|
|
31130
|
+
numberSchema = numberSchema.lt(schema2.maximum);
|
|
31098
31131
|
}
|
|
31099
|
-
if (typeof
|
|
31100
|
-
numberSchema = numberSchema.multipleOf(
|
|
31132
|
+
if (typeof schema2.multipleOf === "number") {
|
|
31133
|
+
numberSchema = numberSchema.multipleOf(schema2.multipleOf);
|
|
31101
31134
|
}
|
|
31102
31135
|
zodSchema = numberSchema;
|
|
31103
31136
|
break;
|
|
@@ -31112,15 +31145,15 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31112
31145
|
}
|
|
31113
31146
|
case "object": {
|
|
31114
31147
|
const shape = {};
|
|
31115
|
-
const properties =
|
|
31116
|
-
const requiredSet = new Set(
|
|
31148
|
+
const properties = schema2.properties || {};
|
|
31149
|
+
const requiredSet = new Set(schema2.required || []);
|
|
31117
31150
|
for (const [key, propSchema] of Object.entries(properties)) {
|
|
31118
31151
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
31119
31152
|
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
31120
31153
|
}
|
|
31121
|
-
if (
|
|
31122
|
-
const keySchema = convertSchema(
|
|
31123
|
-
const valueSchema =
|
|
31154
|
+
if (schema2.propertyNames) {
|
|
31155
|
+
const keySchema = convertSchema(schema2.propertyNames, ctx);
|
|
31156
|
+
const valueSchema = schema2.additionalProperties && typeof schema2.additionalProperties === "object" ? convertSchema(schema2.additionalProperties, ctx) : z.any();
|
|
31124
31157
|
if (Object.keys(shape).length === 0) {
|
|
31125
31158
|
zodSchema = z.record(keySchema, valueSchema);
|
|
31126
31159
|
break;
|
|
@@ -31130,8 +31163,8 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31130
31163
|
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
31131
31164
|
break;
|
|
31132
31165
|
}
|
|
31133
|
-
if (
|
|
31134
|
-
const patternProps =
|
|
31166
|
+
if (schema2.patternProperties) {
|
|
31167
|
+
const patternProps = schema2.patternProperties;
|
|
31135
31168
|
const patternKeys = Object.keys(patternProps);
|
|
31136
31169
|
const looseRecords = [];
|
|
31137
31170
|
for (const pattern of patternKeys) {
|
|
@@ -31158,18 +31191,18 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31158
31191
|
break;
|
|
31159
31192
|
}
|
|
31160
31193
|
const objectSchema = z.object(shape);
|
|
31161
|
-
if (
|
|
31194
|
+
if (schema2.additionalProperties === false) {
|
|
31162
31195
|
zodSchema = objectSchema.strict();
|
|
31163
|
-
} else if (typeof
|
|
31164
|
-
zodSchema = objectSchema.catchall(convertSchema(
|
|
31196
|
+
} else if (typeof schema2.additionalProperties === "object") {
|
|
31197
|
+
zodSchema = objectSchema.catchall(convertSchema(schema2.additionalProperties, ctx));
|
|
31165
31198
|
} else {
|
|
31166
31199
|
zodSchema = objectSchema.passthrough();
|
|
31167
31200
|
}
|
|
31168
31201
|
break;
|
|
31169
31202
|
}
|
|
31170
31203
|
case "array": {
|
|
31171
|
-
const prefixItems =
|
|
31172
|
-
const items =
|
|
31204
|
+
const prefixItems = schema2.prefixItems;
|
|
31205
|
+
const items = schema2.items;
|
|
31173
31206
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
31174
31207
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
31175
31208
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
@@ -31178,34 +31211,34 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31178
31211
|
} else {
|
|
31179
31212
|
zodSchema = z.tuple(tupleItems);
|
|
31180
31213
|
}
|
|
31181
|
-
if (typeof
|
|
31182
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
31214
|
+
if (typeof schema2.minItems === "number") {
|
|
31215
|
+
zodSchema = zodSchema.check(z.minLength(schema2.minItems));
|
|
31183
31216
|
}
|
|
31184
|
-
if (typeof
|
|
31185
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
31217
|
+
if (typeof schema2.maxItems === "number") {
|
|
31218
|
+
zodSchema = zodSchema.check(z.maxLength(schema2.maxItems));
|
|
31186
31219
|
}
|
|
31187
31220
|
} else if (Array.isArray(items)) {
|
|
31188
31221
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
31189
|
-
const rest =
|
|
31222
|
+
const rest = schema2.additionalItems && typeof schema2.additionalItems === "object" ? convertSchema(schema2.additionalItems, ctx) : void 0;
|
|
31190
31223
|
if (rest) {
|
|
31191
31224
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
31192
31225
|
} else {
|
|
31193
31226
|
zodSchema = z.tuple(tupleItems);
|
|
31194
31227
|
}
|
|
31195
|
-
if (typeof
|
|
31196
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
31228
|
+
if (typeof schema2.minItems === "number") {
|
|
31229
|
+
zodSchema = zodSchema.check(z.minLength(schema2.minItems));
|
|
31197
31230
|
}
|
|
31198
|
-
if (typeof
|
|
31199
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
31231
|
+
if (typeof schema2.maxItems === "number") {
|
|
31232
|
+
zodSchema = zodSchema.check(z.maxLength(schema2.maxItems));
|
|
31200
31233
|
}
|
|
31201
31234
|
} else if (items !== void 0) {
|
|
31202
31235
|
const element = convertSchema(items, ctx);
|
|
31203
31236
|
let arraySchema = z.array(element);
|
|
31204
|
-
if (typeof
|
|
31205
|
-
arraySchema = arraySchema.min(
|
|
31237
|
+
if (typeof schema2.minItems === "number") {
|
|
31238
|
+
arraySchema = arraySchema.min(schema2.minItems);
|
|
31206
31239
|
}
|
|
31207
|
-
if (typeof
|
|
31208
|
-
arraySchema = arraySchema.max(
|
|
31240
|
+
if (typeof schema2.maxItems === "number") {
|
|
31241
|
+
arraySchema = arraySchema.max(schema2.maxItems);
|
|
31209
31242
|
}
|
|
31210
31243
|
zodSchema = arraySchema;
|
|
31211
31244
|
} else {
|
|
@@ -31216,64 +31249,64 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31216
31249
|
default:
|
|
31217
31250
|
throw new Error(`Unsupported type: ${type}`);
|
|
31218
31251
|
}
|
|
31219
|
-
if (
|
|
31220
|
-
zodSchema = zodSchema.describe(
|
|
31252
|
+
if (schema2.description) {
|
|
31253
|
+
zodSchema = zodSchema.describe(schema2.description);
|
|
31221
31254
|
}
|
|
31222
|
-
if (
|
|
31223
|
-
zodSchema = zodSchema.default(
|
|
31255
|
+
if (schema2.default !== void 0) {
|
|
31256
|
+
zodSchema = zodSchema.default(schema2.default);
|
|
31224
31257
|
}
|
|
31225
31258
|
return zodSchema;
|
|
31226
31259
|
}
|
|
31227
|
-
function convertSchema(
|
|
31228
|
-
if (typeof
|
|
31229
|
-
return
|
|
31260
|
+
function convertSchema(schema2, ctx) {
|
|
31261
|
+
if (typeof schema2 === "boolean") {
|
|
31262
|
+
return schema2 ? z.any() : z.never();
|
|
31230
31263
|
}
|
|
31231
|
-
let baseSchema = convertBaseSchema(
|
|
31232
|
-
const hasExplicitType =
|
|
31233
|
-
if (
|
|
31234
|
-
const options =
|
|
31264
|
+
let baseSchema = convertBaseSchema(schema2, ctx);
|
|
31265
|
+
const hasExplicitType = schema2.type || schema2.enum !== void 0 || schema2.const !== void 0;
|
|
31266
|
+
if (schema2.anyOf && Array.isArray(schema2.anyOf)) {
|
|
31267
|
+
const options = schema2.anyOf.map((s) => convertSchema(s, ctx));
|
|
31235
31268
|
const anyOfUnion = z.union(options);
|
|
31236
31269
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
31237
31270
|
}
|
|
31238
|
-
if (
|
|
31239
|
-
const options =
|
|
31271
|
+
if (schema2.oneOf && Array.isArray(schema2.oneOf)) {
|
|
31272
|
+
const options = schema2.oneOf.map((s) => convertSchema(s, ctx));
|
|
31240
31273
|
const oneOfUnion = z.xor(options);
|
|
31241
31274
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
31242
31275
|
}
|
|
31243
|
-
if (
|
|
31244
|
-
if (
|
|
31276
|
+
if (schema2.allOf && Array.isArray(schema2.allOf)) {
|
|
31277
|
+
if (schema2.allOf.length === 0) {
|
|
31245
31278
|
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
31246
31279
|
} else {
|
|
31247
|
-
let result = hasExplicitType ? baseSchema : convertSchema(
|
|
31280
|
+
let result = hasExplicitType ? baseSchema : convertSchema(schema2.allOf[0], ctx);
|
|
31248
31281
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
31249
|
-
for (let i = startIdx; i <
|
|
31250
|
-
result = z.intersection(result, convertSchema(
|
|
31282
|
+
for (let i = startIdx; i < schema2.allOf.length; i++) {
|
|
31283
|
+
result = z.intersection(result, convertSchema(schema2.allOf[i], ctx));
|
|
31251
31284
|
}
|
|
31252
31285
|
baseSchema = result;
|
|
31253
31286
|
}
|
|
31254
31287
|
}
|
|
31255
|
-
if (
|
|
31288
|
+
if (schema2.nullable === true && ctx.version === "openapi-3.0") {
|
|
31256
31289
|
baseSchema = z.nullable(baseSchema);
|
|
31257
31290
|
}
|
|
31258
|
-
if (
|
|
31291
|
+
if (schema2.readOnly === true) {
|
|
31259
31292
|
baseSchema = z.readonly(baseSchema);
|
|
31260
31293
|
}
|
|
31261
31294
|
const extraMeta = {};
|
|
31262
31295
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
31263
31296
|
for (const key of coreMetadataKeys) {
|
|
31264
|
-
if (key in
|
|
31265
|
-
extraMeta[key] =
|
|
31297
|
+
if (key in schema2) {
|
|
31298
|
+
extraMeta[key] = schema2[key];
|
|
31266
31299
|
}
|
|
31267
31300
|
}
|
|
31268
31301
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
31269
31302
|
for (const key of contentMetadataKeys) {
|
|
31270
|
-
if (key in
|
|
31271
|
-
extraMeta[key] =
|
|
31303
|
+
if (key in schema2) {
|
|
31304
|
+
extraMeta[key] = schema2[key];
|
|
31272
31305
|
}
|
|
31273
31306
|
}
|
|
31274
|
-
for (const key of Object.keys(
|
|
31307
|
+
for (const key of Object.keys(schema2)) {
|
|
31275
31308
|
if (!RECOGNIZED_KEYS.has(key)) {
|
|
31276
|
-
extraMeta[key] =
|
|
31309
|
+
extraMeta[key] = schema2[key];
|
|
31277
31310
|
}
|
|
31278
31311
|
}
|
|
31279
31312
|
if (Object.keys(extraMeta).length > 0) {
|
|
@@ -31281,21 +31314,21 @@ function convertSchema(schema, ctx) {
|
|
|
31281
31314
|
}
|
|
31282
31315
|
return baseSchema;
|
|
31283
31316
|
}
|
|
31284
|
-
function fromJSONSchema(
|
|
31285
|
-
if (typeof
|
|
31286
|
-
return
|
|
31317
|
+
function fromJSONSchema(schema2, params3) {
|
|
31318
|
+
if (typeof schema2 === "boolean") {
|
|
31319
|
+
return schema2 ? z.any() : z.never();
|
|
31287
31320
|
}
|
|
31288
|
-
const version2 = detectVersion(
|
|
31289
|
-
const defs =
|
|
31321
|
+
const version2 = detectVersion(schema2, params3?.defaultTarget);
|
|
31322
|
+
const defs = schema2.$defs || schema2.definitions || {};
|
|
31290
31323
|
const ctx = {
|
|
31291
31324
|
version: version2,
|
|
31292
31325
|
defs,
|
|
31293
31326
|
refs: /* @__PURE__ */ new Map(),
|
|
31294
31327
|
processing: /* @__PURE__ */ new Set(),
|
|
31295
|
-
rootSchema:
|
|
31328
|
+
rootSchema: schema2,
|
|
31296
31329
|
registry: params3?.registry ?? globalRegistry
|
|
31297
31330
|
};
|
|
31298
|
-
return convertSchema(
|
|
31331
|
+
return convertSchema(schema2, ctx);
|
|
31299
31332
|
}
|
|
31300
31333
|
|
|
31301
31334
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/classic/coerce.js
|
|
@@ -33132,16 +33165,16 @@ function parseIntersectionDef(def2, refs) {
|
|
|
33132
33165
|
].filter((x) => !!x);
|
|
33133
33166
|
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
33134
33167
|
const mergedAllOf = [];
|
|
33135
|
-
allOf.forEach((
|
|
33136
|
-
if (isJsonSchema7AllOfType(
|
|
33137
|
-
mergedAllOf.push(...
|
|
33138
|
-
if (
|
|
33168
|
+
allOf.forEach((schema2) => {
|
|
33169
|
+
if (isJsonSchema7AllOfType(schema2)) {
|
|
33170
|
+
mergedAllOf.push(...schema2.allOf);
|
|
33171
|
+
if (schema2.unevaluatedProperties === void 0) {
|
|
33139
33172
|
unevaluatedProperties = void 0;
|
|
33140
33173
|
}
|
|
33141
33174
|
} else {
|
|
33142
|
-
let nestedSchema =
|
|
33143
|
-
if ("additionalProperties" in
|
|
33144
|
-
const { additionalProperties, ...rest } =
|
|
33175
|
+
let nestedSchema = schema2;
|
|
33176
|
+
if ("additionalProperties" in schema2 && schema2.additionalProperties === false) {
|
|
33177
|
+
const { additionalProperties, ...rest } = schema2;
|
|
33145
33178
|
nestedSchema = rest;
|
|
33146
33179
|
} else {
|
|
33147
33180
|
unevaluatedProperties = void 0;
|
|
@@ -33368,60 +33401,60 @@ function escapeNonAlphaNumeric(source) {
|
|
|
33368
33401
|
}
|
|
33369
33402
|
return result;
|
|
33370
33403
|
}
|
|
33371
|
-
function addFormat(
|
|
33372
|
-
if (
|
|
33373
|
-
if (!
|
|
33374
|
-
|
|
33404
|
+
function addFormat(schema2, value, message, refs) {
|
|
33405
|
+
if (schema2.format || schema2.anyOf?.some((x) => x.format)) {
|
|
33406
|
+
if (!schema2.anyOf) {
|
|
33407
|
+
schema2.anyOf = [];
|
|
33375
33408
|
}
|
|
33376
|
-
if (
|
|
33377
|
-
|
|
33378
|
-
format:
|
|
33379
|
-
...
|
|
33380
|
-
errorMessage: { format:
|
|
33409
|
+
if (schema2.format) {
|
|
33410
|
+
schema2.anyOf.push({
|
|
33411
|
+
format: schema2.format,
|
|
33412
|
+
...schema2.errorMessage && refs.errorMessages && {
|
|
33413
|
+
errorMessage: { format: schema2.errorMessage.format }
|
|
33381
33414
|
}
|
|
33382
33415
|
});
|
|
33383
|
-
delete
|
|
33384
|
-
if (
|
|
33385
|
-
delete
|
|
33386
|
-
if (Object.keys(
|
|
33387
|
-
delete
|
|
33416
|
+
delete schema2.format;
|
|
33417
|
+
if (schema2.errorMessage) {
|
|
33418
|
+
delete schema2.errorMessage.format;
|
|
33419
|
+
if (Object.keys(schema2.errorMessage).length === 0) {
|
|
33420
|
+
delete schema2.errorMessage;
|
|
33388
33421
|
}
|
|
33389
33422
|
}
|
|
33390
33423
|
}
|
|
33391
|
-
|
|
33424
|
+
schema2.anyOf.push({
|
|
33392
33425
|
format: value,
|
|
33393
33426
|
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
33394
33427
|
});
|
|
33395
33428
|
} else {
|
|
33396
|
-
setResponseValueAndErrors(
|
|
33429
|
+
setResponseValueAndErrors(schema2, "format", value, message, refs);
|
|
33397
33430
|
}
|
|
33398
33431
|
}
|
|
33399
|
-
function addPattern(
|
|
33400
|
-
if (
|
|
33401
|
-
if (!
|
|
33402
|
-
|
|
33432
|
+
function addPattern(schema2, regex, message, refs) {
|
|
33433
|
+
if (schema2.pattern || schema2.allOf?.some((x) => x.pattern)) {
|
|
33434
|
+
if (!schema2.allOf) {
|
|
33435
|
+
schema2.allOf = [];
|
|
33403
33436
|
}
|
|
33404
|
-
if (
|
|
33405
|
-
|
|
33406
|
-
pattern:
|
|
33407
|
-
...
|
|
33408
|
-
errorMessage: { pattern:
|
|
33437
|
+
if (schema2.pattern) {
|
|
33438
|
+
schema2.allOf.push({
|
|
33439
|
+
pattern: schema2.pattern,
|
|
33440
|
+
...schema2.errorMessage && refs.errorMessages && {
|
|
33441
|
+
errorMessage: { pattern: schema2.errorMessage.pattern }
|
|
33409
33442
|
}
|
|
33410
33443
|
});
|
|
33411
|
-
delete
|
|
33412
|
-
if (
|
|
33413
|
-
delete
|
|
33414
|
-
if (Object.keys(
|
|
33415
|
-
delete
|
|
33444
|
+
delete schema2.pattern;
|
|
33445
|
+
if (schema2.errorMessage) {
|
|
33446
|
+
delete schema2.errorMessage.pattern;
|
|
33447
|
+
if (Object.keys(schema2.errorMessage).length === 0) {
|
|
33448
|
+
delete schema2.errorMessage;
|
|
33416
33449
|
}
|
|
33417
33450
|
}
|
|
33418
33451
|
}
|
|
33419
|
-
|
|
33452
|
+
schema2.allOf.push({
|
|
33420
33453
|
pattern: stringifyRegExpWithFlags(regex, refs),
|
|
33421
33454
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
33422
33455
|
});
|
|
33423
33456
|
} else {
|
|
33424
|
-
setResponseValueAndErrors(
|
|
33457
|
+
setResponseValueAndErrors(schema2, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
|
|
33425
33458
|
}
|
|
33426
33459
|
}
|
|
33427
33460
|
function stringifyRegExpWithFlags(regex, refs) {
|
|
@@ -33519,7 +33552,7 @@ function parseRecordDef(def2, refs) {
|
|
|
33519
33552
|
additionalProperties: refs.rejectedAdditionalProperties
|
|
33520
33553
|
};
|
|
33521
33554
|
}
|
|
33522
|
-
const
|
|
33555
|
+
const schema2 = {
|
|
33523
33556
|
type: "object",
|
|
33524
33557
|
additionalProperties: parseDef(def2.valueType._def, {
|
|
33525
33558
|
...refs,
|
|
@@ -33527,17 +33560,17 @@ function parseRecordDef(def2, refs) {
|
|
|
33527
33560
|
}) ?? refs.allowedAdditionalProperties
|
|
33528
33561
|
};
|
|
33529
33562
|
if (refs.target === "openApi3") {
|
|
33530
|
-
return
|
|
33563
|
+
return schema2;
|
|
33531
33564
|
}
|
|
33532
33565
|
if (def2.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def2.keyType._def.checks?.length) {
|
|
33533
33566
|
const { type, ...keyType } = parseStringDef(def2.keyType._def, refs);
|
|
33534
33567
|
return {
|
|
33535
|
-
...
|
|
33568
|
+
...schema2,
|
|
33536
33569
|
propertyNames: keyType
|
|
33537
33570
|
};
|
|
33538
33571
|
} else if (def2.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
|
|
33539
33572
|
return {
|
|
33540
|
-
...
|
|
33573
|
+
...schema2,
|
|
33541
33574
|
propertyNames: {
|
|
33542
33575
|
enum: def2.keyType._def.values
|
|
33543
33576
|
}
|
|
@@ -33545,11 +33578,11 @@ function parseRecordDef(def2, refs) {
|
|
|
33545
33578
|
} else if (def2.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def2.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def2.keyType._def.type._def.checks?.length) {
|
|
33546
33579
|
const { type, ...keyType } = parseBrandedDef(def2.keyType._def, refs);
|
|
33547
33580
|
return {
|
|
33548
|
-
...
|
|
33581
|
+
...schema2,
|
|
33549
33582
|
propertyNames: keyType
|
|
33550
33583
|
};
|
|
33551
33584
|
}
|
|
33552
|
-
return
|
|
33585
|
+
return schema2;
|
|
33553
33586
|
}
|
|
33554
33587
|
|
|
33555
33588
|
// ../../.yarn/__virtual__/zod-to-json-schema-virtual-00ec010bf6/0/cache/zod-to-json-schema-npm-3.25.1-850d9216b4-711b30e34d.zip/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
@@ -33822,9 +33855,9 @@ function decideAdditionalProperties(def2, refs) {
|
|
|
33822
33855
|
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
33823
33856
|
}
|
|
33824
33857
|
}
|
|
33825
|
-
function safeIsOptional(
|
|
33858
|
+
function safeIsOptional(schema2) {
|
|
33826
33859
|
try {
|
|
33827
|
-
return
|
|
33860
|
+
return schema2.isOptional();
|
|
33828
33861
|
} catch {
|
|
33829
33862
|
return true;
|
|
33830
33863
|
}
|
|
@@ -33880,18 +33913,18 @@ function parseSetDef(def2, refs) {
|
|
|
33880
33913
|
...refs,
|
|
33881
33914
|
currentPath: [...refs.currentPath, "items"]
|
|
33882
33915
|
});
|
|
33883
|
-
const
|
|
33916
|
+
const schema2 = {
|
|
33884
33917
|
type: "array",
|
|
33885
33918
|
uniqueItems: true,
|
|
33886
33919
|
items
|
|
33887
33920
|
};
|
|
33888
33921
|
if (def2.minSize) {
|
|
33889
|
-
setResponseValueAndErrors(
|
|
33922
|
+
setResponseValueAndErrors(schema2, "minItems", def2.minSize.value, def2.minSize.message, refs);
|
|
33890
33923
|
}
|
|
33891
33924
|
if (def2.maxSize) {
|
|
33892
|
-
setResponseValueAndErrors(
|
|
33925
|
+
setResponseValueAndErrors(schema2, "maxItems", def2.maxSize.value, def2.maxSize.message, refs);
|
|
33893
33926
|
}
|
|
33894
|
-
return
|
|
33927
|
+
return schema2;
|
|
33895
33928
|
}
|
|
33896
33929
|
|
|
33897
33930
|
// ../../.yarn/__virtual__/zod-to-json-schema-virtual-00ec010bf6/0/cache/zod-to-json-schema-npm-3.25.1-850d9216b4-711b30e34d.zip/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
@@ -34072,17 +34105,17 @@ var addMeta = (def2, refs, jsonSchema) => {
|
|
|
34072
34105
|
};
|
|
34073
34106
|
|
|
34074
34107
|
// ../../.yarn/__virtual__/zod-to-json-schema-virtual-00ec010bf6/0/cache/zod-to-json-schema-npm-3.25.1-850d9216b4-711b30e34d.zip/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
34075
|
-
var zodToJsonSchema = (
|
|
34108
|
+
var zodToJsonSchema = (schema2, options) => {
|
|
34076
34109
|
const refs = getRefs(options);
|
|
34077
|
-
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2,
|
|
34110
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema3]) => ({
|
|
34078
34111
|
...acc,
|
|
34079
|
-
[name2]: parseDef(
|
|
34112
|
+
[name2]: parseDef(schema3._def, {
|
|
34080
34113
|
...refs,
|
|
34081
34114
|
currentPath: [...refs.basePath, refs.definitionPath, name2]
|
|
34082
34115
|
}, true) ?? parseAnyDef(refs)
|
|
34083
34116
|
}), {}) : void 0;
|
|
34084
34117
|
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
34085
|
-
const main = parseDef(
|
|
34118
|
+
const main = parseDef(schema2._def, name === void 0 ? refs : {
|
|
34086
34119
|
...refs,
|
|
34087
34120
|
currentPath: [...refs.basePath, refs.definitionPath, name]
|
|
34088
34121
|
}, false) ?? parseAnyDef(refs);
|
|
@@ -34143,20 +34176,20 @@ function mapMiniTarget(t) {
|
|
|
34143
34176
|
return "draft-2020-12";
|
|
34144
34177
|
return "draft-7";
|
|
34145
34178
|
}
|
|
34146
|
-
function toJsonSchemaCompat(
|
|
34147
|
-
if (isZ4Schema(
|
|
34148
|
-
return toJSONSchema(
|
|
34179
|
+
function toJsonSchemaCompat(schema2, opts) {
|
|
34180
|
+
if (isZ4Schema(schema2)) {
|
|
34181
|
+
return toJSONSchema(schema2, {
|
|
34149
34182
|
target: mapMiniTarget(opts?.target),
|
|
34150
34183
|
io: opts?.pipeStrategy ?? "input"
|
|
34151
34184
|
});
|
|
34152
34185
|
}
|
|
34153
|
-
return zodToJsonSchema(
|
|
34186
|
+
return zodToJsonSchema(schema2, {
|
|
34154
34187
|
strictUnions: opts?.strictUnions ?? true,
|
|
34155
34188
|
pipeStrategy: opts?.pipeStrategy ?? "input"
|
|
34156
34189
|
});
|
|
34157
34190
|
}
|
|
34158
|
-
function getMethodLiteral(
|
|
34159
|
-
const shape = getObjectShape(
|
|
34191
|
+
function getMethodLiteral(schema2) {
|
|
34192
|
+
const shape = getObjectShape(schema2);
|
|
34160
34193
|
const methodSchema = shape?.method;
|
|
34161
34194
|
if (!methodSchema) {
|
|
34162
34195
|
throw new Error("Schema is missing a method literal");
|
|
@@ -34167,8 +34200,8 @@ function getMethodLiteral(schema) {
|
|
|
34167
34200
|
}
|
|
34168
34201
|
return value;
|
|
34169
34202
|
}
|
|
34170
|
-
function parseWithCompat(
|
|
34171
|
-
const result = safeParse2(
|
|
34203
|
+
function parseWithCompat(schema2, data) {
|
|
34204
|
+
const result = safeParse2(schema2, data);
|
|
34172
34205
|
if (!result.success) {
|
|
34173
34206
|
throw result.error;
|
|
34174
34207
|
}
|
|
@@ -35170,8 +35203,8 @@ var AjvJsonSchemaValidator = class {
|
|
|
35170
35203
|
* @param schema - Standard JSON Schema object
|
|
35171
35204
|
* @returns A validator function that validates input data
|
|
35172
35205
|
*/
|
|
35173
|
-
getValidator(
|
|
35174
|
-
const ajvValidator = "$id" in
|
|
35206
|
+
getValidator(schema2) {
|
|
35207
|
+
const ajvValidator = "$id" in schema2 && typeof schema2.$id === "string" ? this._ajv.getSchema(schema2.$id) ?? this._ajv.compile(schema2) : this._ajv.compile(schema2);
|
|
35175
35208
|
return (input) => {
|
|
35176
35209
|
const valid = ajvValidator(input);
|
|
35177
35210
|
if (valid) {
|
|
@@ -35680,11 +35713,11 @@ var Server = class extends Protocol {
|
|
|
35680
35713
|
|
|
35681
35714
|
// ../../.yarn/__virtual__/@modelcontextprotocol-sdk-virtual-4beea6215a/0/cache/@modelcontextprotocol-sdk-npm-1.26.0-380479a6f8-b4098789d9.zip/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
35682
35715
|
var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
|
|
35683
|
-
function isCompletable(
|
|
35684
|
-
return !!
|
|
35716
|
+
function isCompletable(schema2) {
|
|
35717
|
+
return !!schema2 && typeof schema2 === "object" && COMPLETABLE_SYMBOL in schema2;
|
|
35685
35718
|
}
|
|
35686
|
-
function getCompleter(
|
|
35687
|
-
const meta3 =
|
|
35719
|
+
function getCompleter(schema2) {
|
|
35720
|
+
const meta3 = schema2[COMPLETABLE_SYMBOL];
|
|
35688
35721
|
return meta3?.complete;
|
|
35689
35722
|
}
|
|
35690
35723
|
var McpZodTypeKind;
|
|
@@ -36500,17 +36533,17 @@ function isZodRawShapeCompat(obj) {
|
|
|
36500
36533
|
}
|
|
36501
36534
|
return Object.values(obj).some(isZodTypeLike);
|
|
36502
36535
|
}
|
|
36503
|
-
function getZodSchemaObject(
|
|
36504
|
-
if (!
|
|
36536
|
+
function getZodSchemaObject(schema2) {
|
|
36537
|
+
if (!schema2) {
|
|
36505
36538
|
return void 0;
|
|
36506
36539
|
}
|
|
36507
|
-
if (isZodRawShapeCompat(
|
|
36508
|
-
return objectFromShape(
|
|
36540
|
+
if (isZodRawShapeCompat(schema2)) {
|
|
36541
|
+
return objectFromShape(schema2);
|
|
36509
36542
|
}
|
|
36510
|
-
return
|
|
36543
|
+
return schema2;
|
|
36511
36544
|
}
|
|
36512
|
-
function promptArgumentsFromSchema(
|
|
36513
|
-
const shape = getObjectShape(
|
|
36545
|
+
function promptArgumentsFromSchema(schema2) {
|
|
36546
|
+
const shape = getObjectShape(schema2);
|
|
36514
36547
|
if (!shape)
|
|
36515
36548
|
return [];
|
|
36516
36549
|
return Object.entries(shape).map(([name, field]) => {
|
|
@@ -36523,8 +36556,8 @@ function promptArgumentsFromSchema(schema) {
|
|
|
36523
36556
|
};
|
|
36524
36557
|
});
|
|
36525
36558
|
}
|
|
36526
|
-
function getMethodValue(
|
|
36527
|
-
const shape = getObjectShape(
|
|
36559
|
+
function getMethodValue(schema2) {
|
|
36560
|
+
const shape = getObjectShape(schema2);
|
|
36528
36561
|
const methodSchema = shape?.method;
|
|
36529
36562
|
if (!methodSchema) {
|
|
36530
36563
|
throw new Error("Schema is missing a method literal");
|
|
@@ -36678,7 +36711,7 @@ async function mcp() {
|
|
|
36678
36711
|
setMcpMode();
|
|
36679
36712
|
const server = new McpServer({
|
|
36680
36713
|
name: "reporting-bi",
|
|
36681
|
-
version: "0.1.
|
|
36714
|
+
version: "0.1.17"
|
|
36682
36715
|
});
|
|
36683
36716
|
server.tool(
|
|
36684
36717
|
"status",
|
|
@@ -37219,8 +37252,8 @@ async function checkForUpdate() {
|
|
|
37219
37252
|
saveUpdateCheck({ lastCheck: now });
|
|
37220
37253
|
const latest = await fetchLatestVersion();
|
|
37221
37254
|
if (!latest) return;
|
|
37222
|
-
if (!isNewer(latest, "0.1.
|
|
37223
|
-
console.error(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.1.
|
|
37255
|
+
if (!isNewer(latest, "0.1.17")) return;
|
|
37256
|
+
console.error(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.1.17"} \u2192 ${latest}...\x1B[0m`);
|
|
37224
37257
|
(0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: ["ignore", 2, 2] });
|
|
37225
37258
|
console.error(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
37226
37259
|
} catch {
|
|
@@ -37232,11 +37265,11 @@ async function forceUpdate() {
|
|
|
37232
37265
|
console.error("Could not fetch latest version from npm.");
|
|
37233
37266
|
process.exit(1);
|
|
37234
37267
|
}
|
|
37235
|
-
if (!isNewer(latest, "0.1.
|
|
37236
|
-
console.log(`Already up to date (${"0.1.
|
|
37268
|
+
if (!isNewer(latest, "0.1.17")) {
|
|
37269
|
+
console.log(`Already up to date (${"0.1.17"}).`);
|
|
37237
37270
|
return;
|
|
37238
37271
|
}
|
|
37239
|
-
console.log(`Updating ${PACKAGE_NAME} ${"0.1.
|
|
37272
|
+
console.log(`Updating ${PACKAGE_NAME} ${"0.1.17"} \u2192 ${latest}...`);
|
|
37240
37273
|
(0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
|
|
37241
37274
|
console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
37242
37275
|
saveUpdateCheck({ lastCheck: Date.now() });
|
|
@@ -37280,6 +37313,7 @@ ETL:
|
|
|
37280
37313
|
etl abort <spid> Abort a running exec (exec reports "rpbi: spid <n>" on stderr)
|
|
37281
37314
|
etl search <query> Search threads
|
|
37282
37315
|
etl params <id> [--save <json>|--delete <idz>] List, save or delete thread parameters (save creates, or updates when the JSON carries "idz"; a name already declared alongside is refused)
|
|
37316
|
+
etl schema [--version <v>] [--dir <path>] SQL completion catalogue of the company's data and ETL databases (tables, views, procedures, functions; --json prints it, --version <v> of the last answer gets "databases": null when nothing changed)
|
|
37283
37317
|
etl pull [--dir <path>] [--no-context] Pull all ETL threads, parameters, metadata & schema to local files
|
|
37284
37318
|
etl push [files...] [--dir <path>] [--force] Push modified/new .sql files back to server
|
|
37285
37319
|
etl status [--dir <path>] [--remote] [--json] Show local changes (--remote compares with server)
|
|
@@ -37430,7 +37464,7 @@ Examples:
|
|
|
37430
37464
|
(async () => {
|
|
37431
37465
|
const [command, ...args] = process.argv.slice(2);
|
|
37432
37466
|
if (command === "--version" || command === "-v") {
|
|
37433
|
-
console.log("0.1.
|
|
37467
|
+
console.log("0.1.17");
|
|
37434
37468
|
return;
|
|
37435
37469
|
}
|
|
37436
37470
|
await checkForUpdate();
|
|
@@ -37499,6 +37533,11 @@ Examples:
|
|
|
37499
37533
|
init(args);
|
|
37500
37534
|
break;
|
|
37501
37535
|
default:
|
|
37536
|
+
if (command) {
|
|
37537
|
+
console.error(`Unknown command: ${command}. Run rpbi without arguments for usage.`);
|
|
37538
|
+
process.exitCode = 1;
|
|
37539
|
+
break;
|
|
37540
|
+
}
|
|
37502
37541
|
printLogo();
|
|
37503
37542
|
console.log();
|
|
37504
37543
|
console.log(USAGE_default);
|