@reporting-bi/cli 0.1.15 → 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 +751 -688
- 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
|
}
|
|
@@ -10421,20 +10422,44 @@ function parsePastedCode(input) {
|
|
|
10421
10422
|
}
|
|
10422
10423
|
return { code: text2 };
|
|
10423
10424
|
}
|
|
10425
|
+
async function resolveDomain(domain2) {
|
|
10426
|
+
let origin = new URL(domain2).origin;
|
|
10427
|
+
for (let i = 0; i < 5; i++) {
|
|
10428
|
+
let res;
|
|
10429
|
+
try {
|
|
10430
|
+
res = await fetch(`${origin}/auth/info`, { method: "HEAD", redirect: "manual" });
|
|
10431
|
+
} catch {
|
|
10432
|
+
return origin;
|
|
10433
|
+
}
|
|
10434
|
+
const location = res.headers.get("location");
|
|
10435
|
+
if (res.status < 300 || res.status >= 400 || !location) return origin;
|
|
10436
|
+
const next = new URL(location, origin).origin;
|
|
10437
|
+
if (next === origin) return origin;
|
|
10438
|
+
origin = next;
|
|
10439
|
+
}
|
|
10440
|
+
return origin;
|
|
10441
|
+
}
|
|
10424
10442
|
async function login(args) {
|
|
10425
10443
|
const { positional, flags } = parseArgs(args);
|
|
10426
|
-
const
|
|
10444
|
+
const requested = positional[0] || "https://bi.reporting.eu";
|
|
10445
|
+
const domain2 = await resolveDomain(requested);
|
|
10427
10446
|
const accounting2 = flags.accounting ? parseInt(flags.accounting) : void 0;
|
|
10428
10447
|
const port = flags.port ? parseInt(flags.port) : 0;
|
|
10429
10448
|
const browser = flags["no-browser"] !== "true" && canOpenBrowser();
|
|
10430
|
-
console.log(`Logging in to ${domain2}...`);
|
|
10449
|
+
console.log(`Logging in to ${domain2}${domain2 !== requested.replace(/\/+$/, "") ? ` (redirected from ${requested})` : ""}...`);
|
|
10431
10450
|
const code = await getAuthorizationCode(domain2, port, browser);
|
|
10432
10451
|
if (!code) {
|
|
10433
10452
|
console.error("Login cancelled or timed out.");
|
|
10434
10453
|
process.exit(1);
|
|
10435
10454
|
}
|
|
10436
10455
|
const client = createAuthClient(domain2);
|
|
10437
|
-
|
|
10456
|
+
try {
|
|
10457
|
+
await client.authorize(code);
|
|
10458
|
+
} catch (e) {
|
|
10459
|
+
const data = e.data;
|
|
10460
|
+
console.error(`Login failed: ${data?.error_description || data?.error || e.message}${data?.status ? ` (HTTP ${data.status})` : ""}`);
|
|
10461
|
+
process.exit(1);
|
|
10462
|
+
}
|
|
10438
10463
|
const credentials = await client.readCredentials();
|
|
10439
10464
|
if (!credentials?.access_token) {
|
|
10440
10465
|
console.error("Failed to obtain tokens.");
|
|
@@ -11453,7 +11478,8 @@ async function wiki(args) {
|
|
|
11453
11478
|
case "watch":
|
|
11454
11479
|
return watch3(flags);
|
|
11455
11480
|
default:
|
|
11456
|
-
console.
|
|
11481
|
+
console.error("Usage: rpbi wiki <list|get|read|search|save|delete|pull|push|status|watch> [options]");
|
|
11482
|
+
process.exitCode = 1;
|
|
11457
11483
|
break;
|
|
11458
11484
|
}
|
|
11459
11485
|
}
|
|
@@ -11992,6 +12018,26 @@ async function params(id, flags) {
|
|
|
11992
12018
|
output(result || [], flags);
|
|
11993
12019
|
}
|
|
11994
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
|
+
}
|
|
11995
12041
|
async function etl(args) {
|
|
11996
12042
|
const { positional, flags } = parseArgs(args);
|
|
11997
12043
|
const [subcommand, ...rest] = positional;
|
|
@@ -12040,6 +12086,8 @@ async function etl(args) {
|
|
|
12040
12086
|
process.exit(1);
|
|
12041
12087
|
}
|
|
12042
12088
|
return params(rest[0], flags);
|
|
12089
|
+
case "schema":
|
|
12090
|
+
return schema(flags);
|
|
12043
12091
|
case "pull":
|
|
12044
12092
|
return pull2(flags);
|
|
12045
12093
|
case "push":
|
|
@@ -12051,7 +12099,8 @@ async function etl(args) {
|
|
|
12051
12099
|
case "watch":
|
|
12052
12100
|
return watch4(flags);
|
|
12053
12101
|
default:
|
|
12054
|
-
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;
|
|
12055
12104
|
break;
|
|
12056
12105
|
}
|
|
12057
12106
|
}
|
|
@@ -12511,7 +12560,8 @@ async function deployment(args) {
|
|
|
12511
12560
|
case "watch":
|
|
12512
12561
|
return watch5(flags);
|
|
12513
12562
|
default:
|
|
12514
|
-
console.
|
|
12563
|
+
console.error("Usage: rpbi deployment <list|get|content|doc|exec|parse|pull|push|status|watch> [options]");
|
|
12564
|
+
process.exitCode = 1;
|
|
12515
12565
|
break;
|
|
12516
12566
|
}
|
|
12517
12567
|
}
|
|
@@ -13124,7 +13174,8 @@ async function ext(args) {
|
|
|
13124
13174
|
case "watch":
|
|
13125
13175
|
return watch6(flags);
|
|
13126
13176
|
default:
|
|
13127
|
-
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;
|
|
13128
13179
|
break;
|
|
13129
13180
|
}
|
|
13130
13181
|
}
|
|
@@ -13173,7 +13224,8 @@ async function jobs(args) {
|
|
|
13173
13224
|
case "status":
|
|
13174
13225
|
return statusCmd(flags);
|
|
13175
13226
|
default:
|
|
13176
|
-
console.
|
|
13227
|
+
console.error("Usage: rpbi jobs <list|start|stop|status> [options]");
|
|
13228
|
+
process.exitCode = 1;
|
|
13177
13229
|
break;
|
|
13178
13230
|
}
|
|
13179
13231
|
}
|
|
@@ -13202,7 +13254,8 @@ async function context2(args) {
|
|
|
13202
13254
|
output(ctx, flags);
|
|
13203
13255
|
break;
|
|
13204
13256
|
default:
|
|
13205
|
-
console.
|
|
13257
|
+
console.error("Usage: rpbi context <list|get> [options]");
|
|
13258
|
+
process.exitCode = 1;
|
|
13206
13259
|
break;
|
|
13207
13260
|
}
|
|
13208
13261
|
}
|
|
@@ -13275,7 +13328,8 @@ async function users(args) {
|
|
|
13275
13328
|
case "roles":
|
|
13276
13329
|
return roles(flags);
|
|
13277
13330
|
default:
|
|
13278
|
-
console.
|
|
13331
|
+
console.error("Usage: rpbi users <list|get|me|rights|roles> [options]");
|
|
13332
|
+
process.exitCode = 1;
|
|
13279
13333
|
break;
|
|
13280
13334
|
}
|
|
13281
13335
|
}
|
|
@@ -13340,7 +13394,8 @@ async function def(args) {
|
|
|
13340
13394
|
case "fiscal-years":
|
|
13341
13395
|
return fiscalYears(flags);
|
|
13342
13396
|
default:
|
|
13343
|
-
console.
|
|
13397
|
+
console.error("Usage: rpbi def <statements|statement|dimensions|modules|scenarios|fiscal-years> [options]");
|
|
13398
|
+
process.exitCode = 1;
|
|
13344
13399
|
break;
|
|
13345
13400
|
}
|
|
13346
13401
|
}
|
|
@@ -13404,7 +13459,8 @@ async function mdm(args) {
|
|
|
13404
13459
|
}
|
|
13405
13460
|
return exportCsv(rest[0], flags);
|
|
13406
13461
|
default:
|
|
13407
|
-
console.
|
|
13462
|
+
console.error("Usage: rpbi mdm <tables|table|columns|values|export> [options]");
|
|
13463
|
+
process.exitCode = 1;
|
|
13408
13464
|
break;
|
|
13409
13465
|
}
|
|
13410
13466
|
}
|
|
@@ -13464,7 +13520,8 @@ async function helpdesk(args) {
|
|
|
13464
13520
|
case "create":
|
|
13465
13521
|
return create(flags);
|
|
13466
13522
|
default:
|
|
13467
|
-
console.
|
|
13523
|
+
console.error("Usage: rpbi helpdesk <list|get|messages|create> [options]");
|
|
13524
|
+
process.exitCode = 1;
|
|
13468
13525
|
break;
|
|
13469
13526
|
}
|
|
13470
13527
|
}
|
|
@@ -15681,9 +15738,9 @@ var ZodArray = class _ZodArray extends ZodType {
|
|
|
15681
15738
|
return this.min(1, message);
|
|
15682
15739
|
}
|
|
15683
15740
|
};
|
|
15684
|
-
ZodArray.create = (
|
|
15741
|
+
ZodArray.create = (schema2, params3) => {
|
|
15685
15742
|
return new ZodArray({
|
|
15686
|
-
type:
|
|
15743
|
+
type: schema2,
|
|
15687
15744
|
minLength: null,
|
|
15688
15745
|
maxLength: null,
|
|
15689
15746
|
exactLength: null,
|
|
@@ -15691,30 +15748,30 @@ ZodArray.create = (schema, params3) => {
|
|
|
15691
15748
|
...processCreateParams(params3)
|
|
15692
15749
|
});
|
|
15693
15750
|
};
|
|
15694
|
-
function deepPartialify(
|
|
15695
|
-
if (
|
|
15751
|
+
function deepPartialify(schema2) {
|
|
15752
|
+
if (schema2 instanceof ZodObject) {
|
|
15696
15753
|
const newShape = {};
|
|
15697
|
-
for (const key in
|
|
15698
|
-
const fieldSchema =
|
|
15754
|
+
for (const key in schema2.shape) {
|
|
15755
|
+
const fieldSchema = schema2.shape[key];
|
|
15699
15756
|
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
|
15700
15757
|
}
|
|
15701
15758
|
return new ZodObject({
|
|
15702
|
-
...
|
|
15759
|
+
...schema2._def,
|
|
15703
15760
|
shape: () => newShape
|
|
15704
15761
|
});
|
|
15705
|
-
} else if (
|
|
15762
|
+
} else if (schema2 instanceof ZodArray) {
|
|
15706
15763
|
return new ZodArray({
|
|
15707
|
-
...
|
|
15708
|
-
type: deepPartialify(
|
|
15764
|
+
...schema2._def,
|
|
15765
|
+
type: deepPartialify(schema2.element)
|
|
15709
15766
|
});
|
|
15710
|
-
} else if (
|
|
15711
|
-
return ZodOptional.create(deepPartialify(
|
|
15712
|
-
} else if (
|
|
15713
|
-
return ZodNullable.create(deepPartialify(
|
|
15714
|
-
} else if (
|
|
15715
|
-
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)));
|
|
15716
15773
|
} else {
|
|
15717
|
-
return
|
|
15774
|
+
return schema2;
|
|
15718
15775
|
}
|
|
15719
15776
|
}
|
|
15720
15777
|
var ZodObject = class _ZodObject extends ZodType {
|
|
@@ -15930,8 +15987,8 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
15930
15987
|
// }) as any;
|
|
15931
15988
|
// return merged;
|
|
15932
15989
|
// }
|
|
15933
|
-
setKey(key,
|
|
15934
|
-
return this.augment({ [key]:
|
|
15990
|
+
setKey(key, schema2) {
|
|
15991
|
+
return this.augment({ [key]: schema2 });
|
|
15935
15992
|
}
|
|
15936
15993
|
// merge<Incoming extends AnyZodObject>(
|
|
15937
15994
|
// merging: Incoming
|
|
@@ -16377,10 +16434,10 @@ var ZodTuple = class _ZodTuple extends ZodType {
|
|
|
16377
16434
|
status6.dirty();
|
|
16378
16435
|
}
|
|
16379
16436
|
const items = [...ctx.data].map((item, itemIndex) => {
|
|
16380
|
-
const
|
|
16381
|
-
if (!
|
|
16437
|
+
const schema2 = this._def.items[itemIndex] || this._def.rest;
|
|
16438
|
+
if (!schema2)
|
|
16382
16439
|
return null;
|
|
16383
|
-
return
|
|
16440
|
+
return schema2._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
|
16384
16441
|
}).filter((x) => !!x);
|
|
16385
16442
|
if (ctx.common.async) {
|
|
16386
16443
|
return Promise.all(items).then((results) => {
|
|
@@ -16894,9 +16951,9 @@ var ZodPromise = class extends ZodType {
|
|
|
16894
16951
|
}));
|
|
16895
16952
|
}
|
|
16896
16953
|
};
|
|
16897
|
-
ZodPromise.create = (
|
|
16954
|
+
ZodPromise.create = (schema2, params3) => {
|
|
16898
16955
|
return new ZodPromise({
|
|
16899
|
-
type:
|
|
16956
|
+
type: schema2,
|
|
16900
16957
|
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
16901
16958
|
...processCreateParams(params3)
|
|
16902
16959
|
});
|
|
@@ -17024,17 +17081,17 @@ var ZodEffects = class extends ZodType {
|
|
|
17024
17081
|
util.assertNever(effect);
|
|
17025
17082
|
}
|
|
17026
17083
|
};
|
|
17027
|
-
ZodEffects.create = (
|
|
17084
|
+
ZodEffects.create = (schema2, effect, params3) => {
|
|
17028
17085
|
return new ZodEffects({
|
|
17029
|
-
schema,
|
|
17086
|
+
schema: schema2,
|
|
17030
17087
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
17031
17088
|
effect,
|
|
17032
17089
|
...processCreateParams(params3)
|
|
17033
17090
|
});
|
|
17034
17091
|
};
|
|
17035
|
-
ZodEffects.createWithPreprocess = (preprocess2,
|
|
17092
|
+
ZodEffects.createWithPreprocess = (preprocess2, schema2, params3) => {
|
|
17036
17093
|
return new ZodEffects({
|
|
17037
|
-
schema,
|
|
17094
|
+
schema: schema2,
|
|
17038
17095
|
effect: { type: "preprocess", transform: preprocess2 },
|
|
17039
17096
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
17040
17097
|
...processCreateParams(params3)
|
|
@@ -17869,8 +17926,8 @@ function mergeDefs(...defs) {
|
|
|
17869
17926
|
}
|
|
17870
17927
|
return Object.defineProperties({}, mergedDescriptors);
|
|
17871
17928
|
}
|
|
17872
|
-
function cloneDef(
|
|
17873
|
-
return mergeDefs(
|
|
17929
|
+
function cloneDef(schema2) {
|
|
17930
|
+
return mergeDefs(schema2._zod.def);
|
|
17874
17931
|
}
|
|
17875
17932
|
function getElementAtPath(obj, path9) {
|
|
17876
17933
|
if (!path9)
|
|
@@ -18078,14 +18135,14 @@ var BIGINT_FORMAT_RANGES = {
|
|
|
18078
18135
|
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
18079
18136
|
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
18080
18137
|
};
|
|
18081
|
-
function pick(
|
|
18082
|
-
const currDef =
|
|
18138
|
+
function pick(schema2, mask) {
|
|
18139
|
+
const currDef = schema2._zod.def;
|
|
18083
18140
|
const checks = currDef.checks;
|
|
18084
18141
|
const hasChecks = checks && checks.length > 0;
|
|
18085
18142
|
if (hasChecks) {
|
|
18086
18143
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
18087
18144
|
}
|
|
18088
|
-
const def2 = mergeDefs(
|
|
18145
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18089
18146
|
get shape() {
|
|
18090
18147
|
const newShape = {};
|
|
18091
18148
|
for (const key in mask) {
|
|
@@ -18101,18 +18158,18 @@ function pick(schema, mask) {
|
|
|
18101
18158
|
},
|
|
18102
18159
|
checks: []
|
|
18103
18160
|
});
|
|
18104
|
-
return clone(
|
|
18161
|
+
return clone(schema2, def2);
|
|
18105
18162
|
}
|
|
18106
|
-
function omit(
|
|
18107
|
-
const currDef =
|
|
18163
|
+
function omit(schema2, mask) {
|
|
18164
|
+
const currDef = schema2._zod.def;
|
|
18108
18165
|
const checks = currDef.checks;
|
|
18109
18166
|
const hasChecks = checks && checks.length > 0;
|
|
18110
18167
|
if (hasChecks) {
|
|
18111
18168
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
18112
18169
|
}
|
|
18113
|
-
const def2 = mergeDefs(
|
|
18170
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18114
18171
|
get shape() {
|
|
18115
|
-
const newShape = { ...
|
|
18172
|
+
const newShape = { ...schema2._zod.def.shape };
|
|
18116
18173
|
for (const key in mask) {
|
|
18117
18174
|
if (!(key in currDef.shape)) {
|
|
18118
18175
|
throw new Error(`Unrecognized key: "${key}"`);
|
|
@@ -18126,43 +18183,43 @@ function omit(schema, mask) {
|
|
|
18126
18183
|
},
|
|
18127
18184
|
checks: []
|
|
18128
18185
|
});
|
|
18129
|
-
return clone(
|
|
18186
|
+
return clone(schema2, def2);
|
|
18130
18187
|
}
|
|
18131
|
-
function extend(
|
|
18188
|
+
function extend(schema2, shape) {
|
|
18132
18189
|
if (!isPlainObject(shape)) {
|
|
18133
18190
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
18134
18191
|
}
|
|
18135
|
-
const checks =
|
|
18192
|
+
const checks = schema2._zod.def.checks;
|
|
18136
18193
|
const hasChecks = checks && checks.length > 0;
|
|
18137
18194
|
if (hasChecks) {
|
|
18138
|
-
const existingShape =
|
|
18195
|
+
const existingShape = schema2._zod.def.shape;
|
|
18139
18196
|
for (const key in shape) {
|
|
18140
18197
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
18141
18198
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
18142
18199
|
}
|
|
18143
18200
|
}
|
|
18144
18201
|
}
|
|
18145
|
-
const def2 = mergeDefs(
|
|
18202
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18146
18203
|
get shape() {
|
|
18147
|
-
const _shape = { ...
|
|
18204
|
+
const _shape = { ...schema2._zod.def.shape, ...shape };
|
|
18148
18205
|
assignProp(this, "shape", _shape);
|
|
18149
18206
|
return _shape;
|
|
18150
18207
|
}
|
|
18151
18208
|
});
|
|
18152
|
-
return clone(
|
|
18209
|
+
return clone(schema2, def2);
|
|
18153
18210
|
}
|
|
18154
|
-
function safeExtend(
|
|
18211
|
+
function safeExtend(schema2, shape) {
|
|
18155
18212
|
if (!isPlainObject(shape)) {
|
|
18156
18213
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
18157
18214
|
}
|
|
18158
|
-
const def2 = mergeDefs(
|
|
18215
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18159
18216
|
get shape() {
|
|
18160
|
-
const _shape = { ...
|
|
18217
|
+
const _shape = { ...schema2._zod.def.shape, ...shape };
|
|
18161
18218
|
assignProp(this, "shape", _shape);
|
|
18162
18219
|
return _shape;
|
|
18163
18220
|
}
|
|
18164
18221
|
});
|
|
18165
|
-
return clone(
|
|
18222
|
+
return clone(schema2, def2);
|
|
18166
18223
|
}
|
|
18167
18224
|
function merge(a, b) {
|
|
18168
18225
|
const def2 = mergeDefs(a._zod.def, {
|
|
@@ -18179,16 +18236,16 @@ function merge(a, b) {
|
|
|
18179
18236
|
});
|
|
18180
18237
|
return clone(a, def2);
|
|
18181
18238
|
}
|
|
18182
|
-
function partial(Class2,
|
|
18183
|
-
const currDef =
|
|
18239
|
+
function partial(Class2, schema2, mask) {
|
|
18240
|
+
const currDef = schema2._zod.def;
|
|
18184
18241
|
const checks = currDef.checks;
|
|
18185
18242
|
const hasChecks = checks && checks.length > 0;
|
|
18186
18243
|
if (hasChecks) {
|
|
18187
18244
|
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
18188
18245
|
}
|
|
18189
|
-
const def2 = mergeDefs(
|
|
18246
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18190
18247
|
get shape() {
|
|
18191
|
-
const oldShape =
|
|
18248
|
+
const oldShape = schema2._zod.def.shape;
|
|
18192
18249
|
const shape = { ...oldShape };
|
|
18193
18250
|
if (mask) {
|
|
18194
18251
|
for (const key in mask) {
|
|
@@ -18215,12 +18272,12 @@ function partial(Class2, schema, mask) {
|
|
|
18215
18272
|
},
|
|
18216
18273
|
checks: []
|
|
18217
18274
|
});
|
|
18218
|
-
return clone(
|
|
18275
|
+
return clone(schema2, def2);
|
|
18219
18276
|
}
|
|
18220
|
-
function required(Class2,
|
|
18221
|
-
const def2 = mergeDefs(
|
|
18277
|
+
function required(Class2, schema2, mask) {
|
|
18278
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18222
18279
|
get shape() {
|
|
18223
|
-
const oldShape =
|
|
18280
|
+
const oldShape = schema2._zod.def.shape;
|
|
18224
18281
|
const shape = { ...oldShape };
|
|
18225
18282
|
if (mask) {
|
|
18226
18283
|
for (const key in mask) {
|
|
@@ -18246,7 +18303,7 @@ function required(Class2, schema, mask) {
|
|
|
18246
18303
|
return shape;
|
|
18247
18304
|
}
|
|
18248
18305
|
});
|
|
18249
|
-
return clone(
|
|
18306
|
+
return clone(schema2, def2);
|
|
18250
18307
|
}
|
|
18251
18308
|
function aborted(x, startIndex = 0) {
|
|
18252
18309
|
if (x.aborted === true)
|
|
@@ -18515,9 +18572,9 @@ function prettifyError(error48) {
|
|
|
18515
18572
|
}
|
|
18516
18573
|
|
|
18517
18574
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/core/parse.js
|
|
18518
|
-
var _parse = (_Err) => (
|
|
18575
|
+
var _parse = (_Err) => (schema2, value, _ctx, _params) => {
|
|
18519
18576
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
18520
|
-
const result =
|
|
18577
|
+
const result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18521
18578
|
if (result instanceof Promise) {
|
|
18522
18579
|
throw new $ZodAsyncError();
|
|
18523
18580
|
}
|
|
@@ -18529,9 +18586,9 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
18529
18586
|
return result.value;
|
|
18530
18587
|
};
|
|
18531
18588
|
var parse4 = /* @__PURE__ */ _parse($ZodRealError);
|
|
18532
|
-
var _parseAsync = (_Err) => async (
|
|
18589
|
+
var _parseAsync = (_Err) => async (schema2, value, _ctx, params3) => {
|
|
18533
18590
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
18534
|
-
let result =
|
|
18591
|
+
let result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18535
18592
|
if (result instanceof Promise)
|
|
18536
18593
|
result = await result;
|
|
18537
18594
|
if (result.issues.length) {
|
|
@@ -18542,9 +18599,9 @@ var _parseAsync = (_Err) => async (schema, value, _ctx, params3) => {
|
|
|
18542
18599
|
return result.value;
|
|
18543
18600
|
};
|
|
18544
18601
|
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
18545
|
-
var _safeParse = (_Err) => (
|
|
18602
|
+
var _safeParse = (_Err) => (schema2, value, _ctx) => {
|
|
18546
18603
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
18547
|
-
const result =
|
|
18604
|
+
const result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18548
18605
|
if (result instanceof Promise) {
|
|
18549
18606
|
throw new $ZodAsyncError();
|
|
18550
18607
|
}
|
|
@@ -18554,9 +18611,9 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
18554
18611
|
} : { success: true, data: result.value };
|
|
18555
18612
|
};
|
|
18556
18613
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
18557
|
-
var _safeParseAsync = (_Err) => async (
|
|
18614
|
+
var _safeParseAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18558
18615
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
18559
|
-
let result =
|
|
18616
|
+
let result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18560
18617
|
if (result instanceof Promise)
|
|
18561
18618
|
result = await result;
|
|
18562
18619
|
return result.issues.length ? {
|
|
@@ -18565,40 +18622,40 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
18565
18622
|
} : { success: true, data: result.value };
|
|
18566
18623
|
};
|
|
18567
18624
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
18568
|
-
var _encode = (_Err) => (
|
|
18625
|
+
var _encode = (_Err) => (schema2, value, _ctx) => {
|
|
18569
18626
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18570
|
-
return _parse(_Err)(
|
|
18627
|
+
return _parse(_Err)(schema2, value, ctx);
|
|
18571
18628
|
};
|
|
18572
18629
|
var encode = /* @__PURE__ */ _encode($ZodRealError);
|
|
18573
|
-
var _decode = (_Err) => (
|
|
18574
|
-
return _parse(_Err)(
|
|
18630
|
+
var _decode = (_Err) => (schema2, value, _ctx) => {
|
|
18631
|
+
return _parse(_Err)(schema2, value, _ctx);
|
|
18575
18632
|
};
|
|
18576
18633
|
var decode = /* @__PURE__ */ _decode($ZodRealError);
|
|
18577
|
-
var _encodeAsync = (_Err) => async (
|
|
18634
|
+
var _encodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18578
18635
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18579
|
-
return _parseAsync(_Err)(
|
|
18636
|
+
return _parseAsync(_Err)(schema2, value, ctx);
|
|
18580
18637
|
};
|
|
18581
18638
|
var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
18582
|
-
var _decodeAsync = (_Err) => async (
|
|
18583
|
-
return _parseAsync(_Err)(
|
|
18639
|
+
var _decodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18640
|
+
return _parseAsync(_Err)(schema2, value, _ctx);
|
|
18584
18641
|
};
|
|
18585
18642
|
var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
18586
|
-
var _safeEncode = (_Err) => (
|
|
18643
|
+
var _safeEncode = (_Err) => (schema2, value, _ctx) => {
|
|
18587
18644
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18588
|
-
return _safeParse(_Err)(
|
|
18645
|
+
return _safeParse(_Err)(schema2, value, ctx);
|
|
18589
18646
|
};
|
|
18590
18647
|
var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
18591
|
-
var _safeDecode = (_Err) => (
|
|
18592
|
-
return _safeParse(_Err)(
|
|
18648
|
+
var _safeDecode = (_Err) => (schema2, value, _ctx) => {
|
|
18649
|
+
return _safeParse(_Err)(schema2, value, _ctx);
|
|
18593
18650
|
};
|
|
18594
18651
|
var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
18595
|
-
var _safeEncodeAsync = (_Err) => async (
|
|
18652
|
+
var _safeEncodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18596
18653
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18597
|
-
return _safeParseAsync(_Err)(
|
|
18654
|
+
return _safeParseAsync(_Err)(schema2, value, ctx);
|
|
18598
18655
|
};
|
|
18599
18656
|
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
18600
|
-
var _safeDecodeAsync = (_Err) => async (
|
|
18601
|
-
return _safeParseAsync(_Err)(
|
|
18657
|
+
var _safeDecodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18658
|
+
return _safeParseAsync(_Err)(schema2, value, _ctx);
|
|
18602
18659
|
};
|
|
18603
18660
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
18604
18661
|
|
|
@@ -20141,8 +20198,8 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def2) =
|
|
|
20141
20198
|
for (const key of normalized.keys) {
|
|
20142
20199
|
const id = ids[key];
|
|
20143
20200
|
const k = esc(key);
|
|
20144
|
-
const
|
|
20145
|
-
const isOptionalOut =
|
|
20201
|
+
const schema2 = shape[key];
|
|
20202
|
+
const isOptionalOut = schema2?._zod?.optout === "optional";
|
|
20146
20203
|
doc2.write(`const ${id} = ${parseStr(key)};`);
|
|
20147
20204
|
if (isOptionalOut) {
|
|
20148
20205
|
doc2.write(`
|
|
@@ -26907,11 +26964,11 @@ var $ZodRegistry = class {
|
|
|
26907
26964
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
26908
26965
|
this._idmap = /* @__PURE__ */ new Map();
|
|
26909
26966
|
}
|
|
26910
|
-
add(
|
|
26967
|
+
add(schema2, ..._meta) {
|
|
26911
26968
|
const meta3 = _meta[0];
|
|
26912
|
-
this._map.set(
|
|
26969
|
+
this._map.set(schema2, meta3);
|
|
26913
26970
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
26914
|
-
this._idmap.set(meta3.id,
|
|
26971
|
+
this._idmap.set(meta3.id, schema2);
|
|
26915
26972
|
}
|
|
26916
26973
|
return this;
|
|
26917
26974
|
}
|
|
@@ -26920,26 +26977,26 @@ var $ZodRegistry = class {
|
|
|
26920
26977
|
this._idmap = /* @__PURE__ */ new Map();
|
|
26921
26978
|
return this;
|
|
26922
26979
|
}
|
|
26923
|
-
remove(
|
|
26924
|
-
const meta3 = this._map.get(
|
|
26980
|
+
remove(schema2) {
|
|
26981
|
+
const meta3 = this._map.get(schema2);
|
|
26925
26982
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
26926
26983
|
this._idmap.delete(meta3.id);
|
|
26927
26984
|
}
|
|
26928
|
-
this._map.delete(
|
|
26985
|
+
this._map.delete(schema2);
|
|
26929
26986
|
return this;
|
|
26930
26987
|
}
|
|
26931
|
-
get(
|
|
26932
|
-
const p =
|
|
26988
|
+
get(schema2) {
|
|
26989
|
+
const p = schema2._zod.parent;
|
|
26933
26990
|
if (p) {
|
|
26934
26991
|
const pm = { ...this.get(p) ?? {} };
|
|
26935
26992
|
delete pm.id;
|
|
26936
|
-
const f = { ...pm, ...this._map.get(
|
|
26993
|
+
const f = { ...pm, ...this._map.get(schema2) };
|
|
26937
26994
|
return Object.keys(f).length ? f : void 0;
|
|
26938
26995
|
}
|
|
26939
|
-
return this._map.get(
|
|
26996
|
+
return this._map.get(schema2);
|
|
26940
26997
|
}
|
|
26941
|
-
has(
|
|
26942
|
-
return this._map.has(
|
|
26998
|
+
has(schema2) {
|
|
26999
|
+
return this._map.has(schema2);
|
|
26943
27000
|
}
|
|
26944
27001
|
};
|
|
26945
27002
|
function registry() {
|
|
@@ -27592,11 +27649,11 @@ function _endsWith(suffix, params3) {
|
|
|
27592
27649
|
});
|
|
27593
27650
|
}
|
|
27594
27651
|
// @__NO_SIDE_EFFECTS__
|
|
27595
|
-
function _property(property,
|
|
27652
|
+
function _property(property, schema2, params3) {
|
|
27596
27653
|
return new $ZodCheckProperty({
|
|
27597
27654
|
check: "property",
|
|
27598
27655
|
property,
|
|
27599
|
-
schema,
|
|
27656
|
+
schema: schema2,
|
|
27600
27657
|
...normalizeParams(params3)
|
|
27601
27658
|
});
|
|
27602
27659
|
}
|
|
@@ -27844,23 +27901,23 @@ function _promise(Class2, innerType) {
|
|
|
27844
27901
|
function _custom(Class2, fn, _params) {
|
|
27845
27902
|
const norm = normalizeParams(_params);
|
|
27846
27903
|
norm.abort ?? (norm.abort = true);
|
|
27847
|
-
const
|
|
27904
|
+
const schema2 = new Class2({
|
|
27848
27905
|
type: "custom",
|
|
27849
27906
|
check: "custom",
|
|
27850
27907
|
fn,
|
|
27851
27908
|
...norm
|
|
27852
27909
|
});
|
|
27853
|
-
return
|
|
27910
|
+
return schema2;
|
|
27854
27911
|
}
|
|
27855
27912
|
// @__NO_SIDE_EFFECTS__
|
|
27856
27913
|
function _refine(Class2, fn, _params) {
|
|
27857
|
-
const
|
|
27914
|
+
const schema2 = new Class2({
|
|
27858
27915
|
type: "custom",
|
|
27859
27916
|
check: "custom",
|
|
27860
27917
|
fn,
|
|
27861
27918
|
...normalizeParams(_params)
|
|
27862
27919
|
});
|
|
27863
|
-
return
|
|
27920
|
+
return schema2;
|
|
27864
27921
|
}
|
|
27865
27922
|
// @__NO_SIDE_EFFECTS__
|
|
27866
27923
|
function _superRefine(fn) {
|
|
@@ -28009,40 +28066,40 @@ function initializeContext(params3) {
|
|
|
28009
28066
|
external: params3?.external ?? void 0
|
|
28010
28067
|
};
|
|
28011
28068
|
}
|
|
28012
|
-
function process2(
|
|
28069
|
+
function process2(schema2, ctx, _params = { path: [], schemaPath: [] }) {
|
|
28013
28070
|
var _a2;
|
|
28014
|
-
const def2 =
|
|
28015
|
-
const seen = ctx.seen.get(
|
|
28071
|
+
const def2 = schema2._zod.def;
|
|
28072
|
+
const seen = ctx.seen.get(schema2);
|
|
28016
28073
|
if (seen) {
|
|
28017
28074
|
seen.count++;
|
|
28018
|
-
const isCycle = _params.schemaPath.includes(
|
|
28075
|
+
const isCycle = _params.schemaPath.includes(schema2);
|
|
28019
28076
|
if (isCycle) {
|
|
28020
28077
|
seen.cycle = _params.path;
|
|
28021
28078
|
}
|
|
28022
28079
|
return seen.schema;
|
|
28023
28080
|
}
|
|
28024
28081
|
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
28025
|
-
ctx.seen.set(
|
|
28026
|
-
const overrideSchema =
|
|
28082
|
+
ctx.seen.set(schema2, result);
|
|
28083
|
+
const overrideSchema = schema2._zod.toJSONSchema?.();
|
|
28027
28084
|
if (overrideSchema) {
|
|
28028
28085
|
result.schema = overrideSchema;
|
|
28029
28086
|
} else {
|
|
28030
28087
|
const params3 = {
|
|
28031
28088
|
..._params,
|
|
28032
|
-
schemaPath: [..._params.schemaPath,
|
|
28089
|
+
schemaPath: [..._params.schemaPath, schema2],
|
|
28033
28090
|
path: _params.path
|
|
28034
28091
|
};
|
|
28035
|
-
if (
|
|
28036
|
-
|
|
28092
|
+
if (schema2._zod.processJSONSchema) {
|
|
28093
|
+
schema2._zod.processJSONSchema(ctx, result.schema, params3);
|
|
28037
28094
|
} else {
|
|
28038
28095
|
const _json = result.schema;
|
|
28039
28096
|
const processor = ctx.processors[def2.type];
|
|
28040
28097
|
if (!processor) {
|
|
28041
28098
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def2.type}`);
|
|
28042
28099
|
}
|
|
28043
|
-
processor(
|
|
28100
|
+
processor(schema2, ctx, _json, params3);
|
|
28044
28101
|
}
|
|
28045
|
-
const parent =
|
|
28102
|
+
const parent = schema2._zod.parent;
|
|
28046
28103
|
if (parent) {
|
|
28047
28104
|
if (!result.ref)
|
|
28048
28105
|
result.ref = parent;
|
|
@@ -28050,21 +28107,21 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
28050
28107
|
ctx.seen.get(parent).isParent = true;
|
|
28051
28108
|
}
|
|
28052
28109
|
}
|
|
28053
|
-
const meta3 = ctx.metadataRegistry.get(
|
|
28110
|
+
const meta3 = ctx.metadataRegistry.get(schema2);
|
|
28054
28111
|
if (meta3)
|
|
28055
28112
|
Object.assign(result.schema, meta3);
|
|
28056
|
-
if (ctx.io === "input" && isTransforming(
|
|
28113
|
+
if (ctx.io === "input" && isTransforming(schema2)) {
|
|
28057
28114
|
delete result.schema.examples;
|
|
28058
28115
|
delete result.schema.default;
|
|
28059
28116
|
}
|
|
28060
28117
|
if (ctx.io === "input" && result.schema._prefault)
|
|
28061
28118
|
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
|
|
28062
28119
|
delete result.schema._prefault;
|
|
28063
|
-
const _result = ctx.seen.get(
|
|
28120
|
+
const _result = ctx.seen.get(schema2);
|
|
28064
28121
|
return _result.schema;
|
|
28065
28122
|
}
|
|
28066
|
-
function extractDefs(ctx,
|
|
28067
|
-
const root = ctx.seen.get(
|
|
28123
|
+
function extractDefs(ctx, schema2) {
|
|
28124
|
+
const root = ctx.seen.get(schema2);
|
|
28068
28125
|
if (!root)
|
|
28069
28126
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
28070
28127
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
@@ -28107,11 +28164,11 @@ function extractDefs(ctx, schema) {
|
|
|
28107
28164
|
seen.def = { ...seen.schema };
|
|
28108
28165
|
if (defId)
|
|
28109
28166
|
seen.defId = defId;
|
|
28110
|
-
const
|
|
28111
|
-
for (const key in
|
|
28112
|
-
delete
|
|
28167
|
+
const schema3 = seen.schema;
|
|
28168
|
+
for (const key in schema3) {
|
|
28169
|
+
delete schema3[key];
|
|
28113
28170
|
}
|
|
28114
|
-
|
|
28171
|
+
schema3.$ref = ref;
|
|
28115
28172
|
};
|
|
28116
28173
|
if (ctx.cycles === "throw") {
|
|
28117
28174
|
for (const entry of ctx.seen.entries()) {
|
|
@@ -28125,13 +28182,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
28125
28182
|
}
|
|
28126
28183
|
for (const entry of ctx.seen.entries()) {
|
|
28127
28184
|
const seen = entry[1];
|
|
28128
|
-
if (
|
|
28185
|
+
if (schema2 === entry[0]) {
|
|
28129
28186
|
extractToDef(entry);
|
|
28130
28187
|
continue;
|
|
28131
28188
|
}
|
|
28132
28189
|
if (ctx.external) {
|
|
28133
28190
|
const ext2 = ctx.external.registry.get(entry[0])?.id;
|
|
28134
|
-
if (
|
|
28191
|
+
if (schema2 !== entry[0] && ext2) {
|
|
28135
28192
|
extractToDef(entry);
|
|
28136
28193
|
continue;
|
|
28137
28194
|
}
|
|
@@ -28153,16 +28210,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
28153
28210
|
}
|
|
28154
28211
|
}
|
|
28155
28212
|
}
|
|
28156
|
-
function finalize(ctx,
|
|
28157
|
-
const root = ctx.seen.get(
|
|
28213
|
+
function finalize(ctx, schema2) {
|
|
28214
|
+
const root = ctx.seen.get(schema2);
|
|
28158
28215
|
if (!root)
|
|
28159
28216
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
28160
28217
|
const flattenRef = (zodSchema) => {
|
|
28161
28218
|
const seen = ctx.seen.get(zodSchema);
|
|
28162
28219
|
if (seen.ref === null)
|
|
28163
28220
|
return;
|
|
28164
|
-
const
|
|
28165
|
-
const _cached = { ...
|
|
28221
|
+
const schema3 = seen.def ?? seen.schema;
|
|
28222
|
+
const _cached = { ...schema3 };
|
|
28166
28223
|
const ref = seen.ref;
|
|
28167
28224
|
seen.ref = null;
|
|
28168
28225
|
if (ref) {
|
|
@@ -28170,28 +28227,28 @@ function finalize(ctx, schema) {
|
|
|
28170
28227
|
const refSeen = ctx.seen.get(ref);
|
|
28171
28228
|
const refSchema = refSeen.schema;
|
|
28172
28229
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
28173
|
-
|
|
28174
|
-
|
|
28230
|
+
schema3.allOf = schema3.allOf ?? [];
|
|
28231
|
+
schema3.allOf.push(refSchema);
|
|
28175
28232
|
} else {
|
|
28176
|
-
Object.assign(
|
|
28233
|
+
Object.assign(schema3, refSchema);
|
|
28177
28234
|
}
|
|
28178
|
-
Object.assign(
|
|
28235
|
+
Object.assign(schema3, _cached);
|
|
28179
28236
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
28180
28237
|
if (isParentRef) {
|
|
28181
|
-
for (const key in
|
|
28238
|
+
for (const key in schema3) {
|
|
28182
28239
|
if (key === "$ref" || key === "allOf")
|
|
28183
28240
|
continue;
|
|
28184
28241
|
if (!(key in _cached)) {
|
|
28185
|
-
delete
|
|
28242
|
+
delete schema3[key];
|
|
28186
28243
|
}
|
|
28187
28244
|
}
|
|
28188
28245
|
}
|
|
28189
28246
|
if (refSchema.$ref && refSeen.def) {
|
|
28190
|
-
for (const key in
|
|
28247
|
+
for (const key in schema3) {
|
|
28191
28248
|
if (key === "$ref" || key === "allOf")
|
|
28192
28249
|
continue;
|
|
28193
|
-
if (key in refSeen.def && JSON.stringify(
|
|
28194
|
-
delete
|
|
28250
|
+
if (key in refSeen.def && JSON.stringify(schema3[key]) === JSON.stringify(refSeen.def[key])) {
|
|
28251
|
+
delete schema3[key];
|
|
28195
28252
|
}
|
|
28196
28253
|
}
|
|
28197
28254
|
}
|
|
@@ -28201,13 +28258,13 @@ function finalize(ctx, schema) {
|
|
|
28201
28258
|
flattenRef(parent);
|
|
28202
28259
|
const parentSeen = ctx.seen.get(parent);
|
|
28203
28260
|
if (parentSeen?.schema.$ref) {
|
|
28204
|
-
|
|
28261
|
+
schema3.$ref = parentSeen.schema.$ref;
|
|
28205
28262
|
if (parentSeen.def) {
|
|
28206
|
-
for (const key in
|
|
28263
|
+
for (const key in schema3) {
|
|
28207
28264
|
if (key === "$ref" || key === "allOf")
|
|
28208
28265
|
continue;
|
|
28209
|
-
if (key in parentSeen.def && JSON.stringify(
|
|
28210
|
-
delete
|
|
28266
|
+
if (key in parentSeen.def && JSON.stringify(schema3[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
28267
|
+
delete schema3[key];
|
|
28211
28268
|
}
|
|
28212
28269
|
}
|
|
28213
28270
|
}
|
|
@@ -28215,7 +28272,7 @@ function finalize(ctx, schema) {
|
|
|
28215
28272
|
}
|
|
28216
28273
|
ctx.override({
|
|
28217
28274
|
zodSchema,
|
|
28218
|
-
jsonSchema:
|
|
28275
|
+
jsonSchema: schema3,
|
|
28219
28276
|
path: seen.path ?? []
|
|
28220
28277
|
});
|
|
28221
28278
|
};
|
|
@@ -28233,7 +28290,7 @@ function finalize(ctx, schema) {
|
|
|
28233
28290
|
} else {
|
|
28234
28291
|
}
|
|
28235
28292
|
if (ctx.external?.uri) {
|
|
28236
|
-
const id = ctx.external.registry.get(
|
|
28293
|
+
const id = ctx.external.registry.get(schema2)?.id;
|
|
28237
28294
|
if (!id)
|
|
28238
28295
|
throw new Error("Schema is missing an `id` property");
|
|
28239
28296
|
result.$id = ctx.external.uri(id);
|
|
@@ -28260,10 +28317,10 @@ function finalize(ctx, schema) {
|
|
|
28260
28317
|
const finalized = JSON.parse(JSON.stringify(result));
|
|
28261
28318
|
Object.defineProperty(finalized, "~standard", {
|
|
28262
28319
|
value: {
|
|
28263
|
-
...
|
|
28320
|
+
...schema2["~standard"],
|
|
28264
28321
|
jsonSchema: {
|
|
28265
|
-
input: createStandardJSONSchemaMethod(
|
|
28266
|
-
output: createStandardJSONSchemaMethod(
|
|
28322
|
+
input: createStandardJSONSchemaMethod(schema2, "input", ctx.processors),
|
|
28323
|
+
output: createStandardJSONSchemaMethod(schema2, "output", ctx.processors)
|
|
28267
28324
|
}
|
|
28268
28325
|
},
|
|
28269
28326
|
enumerable: false,
|
|
@@ -28325,18 +28382,18 @@ function isTransforming(_schema, _ctx) {
|
|
|
28325
28382
|
}
|
|
28326
28383
|
return false;
|
|
28327
28384
|
}
|
|
28328
|
-
var createToJSONSchemaMethod = (
|
|
28385
|
+
var createToJSONSchemaMethod = (schema2, processors = {}) => (params3) => {
|
|
28329
28386
|
const ctx = initializeContext({ ...params3, processors });
|
|
28330
|
-
process2(
|
|
28331
|
-
extractDefs(ctx,
|
|
28332
|
-
return finalize(ctx,
|
|
28387
|
+
process2(schema2, ctx);
|
|
28388
|
+
extractDefs(ctx, schema2);
|
|
28389
|
+
return finalize(ctx, schema2);
|
|
28333
28390
|
};
|
|
28334
|
-
var createStandardJSONSchemaMethod = (
|
|
28391
|
+
var createStandardJSONSchemaMethod = (schema2, io, processors = {}) => (params3) => {
|
|
28335
28392
|
const { libraryOptions, target } = params3 ?? {};
|
|
28336
28393
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
28337
|
-
process2(
|
|
28338
|
-
extractDefs(ctx,
|
|
28339
|
-
return finalize(ctx,
|
|
28394
|
+
process2(schema2, ctx);
|
|
28395
|
+
extractDefs(ctx, schema2);
|
|
28396
|
+
return finalize(ctx, schema2);
|
|
28340
28397
|
};
|
|
28341
28398
|
|
|
28342
28399
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/core/json-schema-processors.js
|
|
@@ -28348,10 +28405,10 @@ var formatMap = {
|
|
|
28348
28405
|
regex: ""
|
|
28349
28406
|
// do not set
|
|
28350
28407
|
};
|
|
28351
|
-
var stringProcessor = (
|
|
28408
|
+
var stringProcessor = (schema2, ctx, _json, _params) => {
|
|
28352
28409
|
const json3 = _json;
|
|
28353
28410
|
json3.type = "string";
|
|
28354
|
-
const { minimum, maximum, format, patterns, contentEncoding } =
|
|
28411
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema2._zod.bag;
|
|
28355
28412
|
if (typeof minimum === "number")
|
|
28356
28413
|
json3.minLength = minimum;
|
|
28357
28414
|
if (typeof maximum === "number")
|
|
@@ -28380,9 +28437,9 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
28380
28437
|
}
|
|
28381
28438
|
}
|
|
28382
28439
|
};
|
|
28383
|
-
var numberProcessor = (
|
|
28440
|
+
var numberProcessor = (schema2, ctx, _json, _params) => {
|
|
28384
28441
|
const json3 = _json;
|
|
28385
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } =
|
|
28442
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema2._zod.bag;
|
|
28386
28443
|
if (typeof format === "string" && format.includes("int"))
|
|
28387
28444
|
json3.type = "integer";
|
|
28388
28445
|
else
|
|
@@ -28468,8 +28525,8 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
28468
28525
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
28469
28526
|
}
|
|
28470
28527
|
};
|
|
28471
|
-
var enumProcessor = (
|
|
28472
|
-
const def2 =
|
|
28528
|
+
var enumProcessor = (schema2, _ctx, json3, _params) => {
|
|
28529
|
+
const def2 = schema2._zod.def;
|
|
28473
28530
|
const values2 = getEnumValues(def2.entries);
|
|
28474
28531
|
if (values2.every((v) => typeof v === "number"))
|
|
28475
28532
|
json3.type = "number";
|
|
@@ -28477,8 +28534,8 @@ var enumProcessor = (schema, _ctx, json3, _params) => {
|
|
|
28477
28534
|
json3.type = "string";
|
|
28478
28535
|
json3.enum = values2;
|
|
28479
28536
|
};
|
|
28480
|
-
var literalProcessor = (
|
|
28481
|
-
const def2 =
|
|
28537
|
+
var literalProcessor = (schema2, ctx, json3, _params) => {
|
|
28538
|
+
const def2 = schema2._zod.def;
|
|
28482
28539
|
const vals = [];
|
|
28483
28540
|
for (const val of def2.values) {
|
|
28484
28541
|
if (val === void 0) {
|
|
@@ -28522,22 +28579,22 @@ var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
|
28522
28579
|
throw new Error("NaN cannot be represented in JSON Schema");
|
|
28523
28580
|
}
|
|
28524
28581
|
};
|
|
28525
|
-
var templateLiteralProcessor = (
|
|
28582
|
+
var templateLiteralProcessor = (schema2, _ctx, json3, _params) => {
|
|
28526
28583
|
const _json = json3;
|
|
28527
|
-
const pattern =
|
|
28584
|
+
const pattern = schema2._zod.pattern;
|
|
28528
28585
|
if (!pattern)
|
|
28529
28586
|
throw new Error("Pattern not found in template literal");
|
|
28530
28587
|
_json.type = "string";
|
|
28531
28588
|
_json.pattern = pattern.source;
|
|
28532
28589
|
};
|
|
28533
|
-
var fileProcessor = (
|
|
28590
|
+
var fileProcessor = (schema2, _ctx, json3, _params) => {
|
|
28534
28591
|
const _json = json3;
|
|
28535
28592
|
const file2 = {
|
|
28536
28593
|
type: "string",
|
|
28537
28594
|
format: "binary",
|
|
28538
28595
|
contentEncoding: "binary"
|
|
28539
28596
|
};
|
|
28540
|
-
const { minimum, maximum, mime } =
|
|
28597
|
+
const { minimum, maximum, mime } = schema2._zod.bag;
|
|
28541
28598
|
if (minimum !== void 0)
|
|
28542
28599
|
file2.minLength = minimum;
|
|
28543
28600
|
if (maximum !== void 0)
|
|
@@ -28582,10 +28639,10 @@ var setProcessor = (_schema, ctx, _json, _params) => {
|
|
|
28582
28639
|
throw new Error("Set cannot be represented in JSON Schema");
|
|
28583
28640
|
}
|
|
28584
28641
|
};
|
|
28585
|
-
var arrayProcessor = (
|
|
28642
|
+
var arrayProcessor = (schema2, ctx, _json, params3) => {
|
|
28586
28643
|
const json3 = _json;
|
|
28587
|
-
const def2 =
|
|
28588
|
-
const { minimum, maximum } =
|
|
28644
|
+
const def2 = schema2._zod.def;
|
|
28645
|
+
const { minimum, maximum } = schema2._zod.bag;
|
|
28589
28646
|
if (typeof minimum === "number")
|
|
28590
28647
|
json3.minItems = minimum;
|
|
28591
28648
|
if (typeof maximum === "number")
|
|
@@ -28593,9 +28650,9 @@ var arrayProcessor = (schema, ctx, _json, params3) => {
|
|
|
28593
28650
|
json3.type = "array";
|
|
28594
28651
|
json3.items = process2(def2.element, ctx, { ...params3, path: [...params3.path, "items"] });
|
|
28595
28652
|
};
|
|
28596
|
-
var objectProcessor = (
|
|
28653
|
+
var objectProcessor = (schema2, ctx, _json, params3) => {
|
|
28597
28654
|
const json3 = _json;
|
|
28598
|
-
const def2 =
|
|
28655
|
+
const def2 = schema2._zod.def;
|
|
28599
28656
|
json3.type = "object";
|
|
28600
28657
|
json3.properties = {};
|
|
28601
28658
|
const shape = def2.shape;
|
|
@@ -28629,8 +28686,8 @@ var objectProcessor = (schema, ctx, _json, params3) => {
|
|
|
28629
28686
|
});
|
|
28630
28687
|
}
|
|
28631
28688
|
};
|
|
28632
|
-
var unionProcessor = (
|
|
28633
|
-
const def2 =
|
|
28689
|
+
var unionProcessor = (schema2, ctx, json3, params3) => {
|
|
28690
|
+
const def2 = schema2._zod.def;
|
|
28634
28691
|
const isExclusive = def2.inclusive === false;
|
|
28635
28692
|
const options = def2.options.map((x, i) => process2(x, ctx, {
|
|
28636
28693
|
...params3,
|
|
@@ -28642,8 +28699,8 @@ var unionProcessor = (schema, ctx, json3, params3) => {
|
|
|
28642
28699
|
json3.anyOf = options;
|
|
28643
28700
|
}
|
|
28644
28701
|
};
|
|
28645
|
-
var intersectionProcessor = (
|
|
28646
|
-
const def2 =
|
|
28702
|
+
var intersectionProcessor = (schema2, ctx, json3, params3) => {
|
|
28703
|
+
const def2 = schema2._zod.def;
|
|
28647
28704
|
const a = process2(def2.left, ctx, {
|
|
28648
28705
|
...params3,
|
|
28649
28706
|
path: [...params3.path, "allOf", 0]
|
|
@@ -28659,9 +28716,9 @@ var intersectionProcessor = (schema, ctx, json3, params3) => {
|
|
|
28659
28716
|
];
|
|
28660
28717
|
json3.allOf = allOf;
|
|
28661
28718
|
};
|
|
28662
|
-
var tupleProcessor = (
|
|
28719
|
+
var tupleProcessor = (schema2, ctx, _json, params3) => {
|
|
28663
28720
|
const json3 = _json;
|
|
28664
|
-
const def2 =
|
|
28721
|
+
const def2 = schema2._zod.def;
|
|
28665
28722
|
json3.type = "array";
|
|
28666
28723
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
28667
28724
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
@@ -28695,15 +28752,15 @@ var tupleProcessor = (schema, ctx, _json, params3) => {
|
|
|
28695
28752
|
json3.additionalItems = rest;
|
|
28696
28753
|
}
|
|
28697
28754
|
}
|
|
28698
|
-
const { minimum, maximum } =
|
|
28755
|
+
const { minimum, maximum } = schema2._zod.bag;
|
|
28699
28756
|
if (typeof minimum === "number")
|
|
28700
28757
|
json3.minItems = minimum;
|
|
28701
28758
|
if (typeof maximum === "number")
|
|
28702
28759
|
json3.maxItems = maximum;
|
|
28703
28760
|
};
|
|
28704
|
-
var recordProcessor = (
|
|
28761
|
+
var recordProcessor = (schema2, ctx, _json, params3) => {
|
|
28705
28762
|
const json3 = _json;
|
|
28706
|
-
const def2 =
|
|
28763
|
+
const def2 = schema2._zod.def;
|
|
28707
28764
|
json3.type = "object";
|
|
28708
28765
|
const keyType = def2.keyType;
|
|
28709
28766
|
const keyBag = keyType._zod.bag;
|
|
@@ -28737,10 +28794,10 @@ var recordProcessor = (schema, ctx, _json, params3) => {
|
|
|
28737
28794
|
}
|
|
28738
28795
|
}
|
|
28739
28796
|
};
|
|
28740
|
-
var nullableProcessor = (
|
|
28741
|
-
const def2 =
|
|
28797
|
+
var nullableProcessor = (schema2, ctx, json3, params3) => {
|
|
28798
|
+
const def2 = schema2._zod.def;
|
|
28742
28799
|
const inner = process2(def2.innerType, ctx, params3);
|
|
28743
|
-
const seen = ctx.seen.get(
|
|
28800
|
+
const seen = ctx.seen.get(schema2);
|
|
28744
28801
|
if (ctx.target === "openapi-3.0") {
|
|
28745
28802
|
seen.ref = def2.innerType;
|
|
28746
28803
|
json3.nullable = true;
|
|
@@ -28748,31 +28805,31 @@ var nullableProcessor = (schema, ctx, json3, params3) => {
|
|
|
28748
28805
|
json3.anyOf = [inner, { type: "null" }];
|
|
28749
28806
|
}
|
|
28750
28807
|
};
|
|
28751
|
-
var nonoptionalProcessor = (
|
|
28752
|
-
const def2 =
|
|
28808
|
+
var nonoptionalProcessor = (schema2, ctx, _json, params3) => {
|
|
28809
|
+
const def2 = schema2._zod.def;
|
|
28753
28810
|
process2(def2.innerType, ctx, params3);
|
|
28754
|
-
const seen = ctx.seen.get(
|
|
28811
|
+
const seen = ctx.seen.get(schema2);
|
|
28755
28812
|
seen.ref = def2.innerType;
|
|
28756
28813
|
};
|
|
28757
|
-
var defaultProcessor = (
|
|
28758
|
-
const def2 =
|
|
28814
|
+
var defaultProcessor = (schema2, ctx, json3, params3) => {
|
|
28815
|
+
const def2 = schema2._zod.def;
|
|
28759
28816
|
process2(def2.innerType, ctx, params3);
|
|
28760
|
-
const seen = ctx.seen.get(
|
|
28817
|
+
const seen = ctx.seen.get(schema2);
|
|
28761
28818
|
seen.ref = def2.innerType;
|
|
28762
28819
|
json3.default = JSON.parse(JSON.stringify(def2.defaultValue));
|
|
28763
28820
|
};
|
|
28764
|
-
var prefaultProcessor = (
|
|
28765
|
-
const def2 =
|
|
28821
|
+
var prefaultProcessor = (schema2, ctx, json3, params3) => {
|
|
28822
|
+
const def2 = schema2._zod.def;
|
|
28766
28823
|
process2(def2.innerType, ctx, params3);
|
|
28767
|
-
const seen = ctx.seen.get(
|
|
28824
|
+
const seen = ctx.seen.get(schema2);
|
|
28768
28825
|
seen.ref = def2.innerType;
|
|
28769
28826
|
if (ctx.io === "input")
|
|
28770
28827
|
json3._prefault = JSON.parse(JSON.stringify(def2.defaultValue));
|
|
28771
28828
|
};
|
|
28772
|
-
var catchProcessor = (
|
|
28773
|
-
const def2 =
|
|
28829
|
+
var catchProcessor = (schema2, ctx, json3, params3) => {
|
|
28830
|
+
const def2 = schema2._zod.def;
|
|
28774
28831
|
process2(def2.innerType, ctx, params3);
|
|
28775
|
-
const seen = ctx.seen.get(
|
|
28832
|
+
const seen = ctx.seen.get(schema2);
|
|
28776
28833
|
seen.ref = def2.innerType;
|
|
28777
28834
|
let catchValue;
|
|
28778
28835
|
try {
|
|
@@ -28782,36 +28839,36 @@ var catchProcessor = (schema, ctx, json3, params3) => {
|
|
|
28782
28839
|
}
|
|
28783
28840
|
json3.default = catchValue;
|
|
28784
28841
|
};
|
|
28785
|
-
var pipeProcessor = (
|
|
28786
|
-
const def2 =
|
|
28842
|
+
var pipeProcessor = (schema2, ctx, _json, params3) => {
|
|
28843
|
+
const def2 = schema2._zod.def;
|
|
28787
28844
|
const innerType = ctx.io === "input" ? def2.in._zod.def.type === "transform" ? def2.out : def2.in : def2.out;
|
|
28788
28845
|
process2(innerType, ctx, params3);
|
|
28789
|
-
const seen = ctx.seen.get(
|
|
28846
|
+
const seen = ctx.seen.get(schema2);
|
|
28790
28847
|
seen.ref = innerType;
|
|
28791
28848
|
};
|
|
28792
|
-
var readonlyProcessor = (
|
|
28793
|
-
const def2 =
|
|
28849
|
+
var readonlyProcessor = (schema2, ctx, json3, params3) => {
|
|
28850
|
+
const def2 = schema2._zod.def;
|
|
28794
28851
|
process2(def2.innerType, ctx, params3);
|
|
28795
|
-
const seen = ctx.seen.get(
|
|
28852
|
+
const seen = ctx.seen.get(schema2);
|
|
28796
28853
|
seen.ref = def2.innerType;
|
|
28797
28854
|
json3.readOnly = true;
|
|
28798
28855
|
};
|
|
28799
|
-
var promiseProcessor = (
|
|
28800
|
-
const def2 =
|
|
28856
|
+
var promiseProcessor = (schema2, ctx, _json, params3) => {
|
|
28857
|
+
const def2 = schema2._zod.def;
|
|
28801
28858
|
process2(def2.innerType, ctx, params3);
|
|
28802
|
-
const seen = ctx.seen.get(
|
|
28859
|
+
const seen = ctx.seen.get(schema2);
|
|
28803
28860
|
seen.ref = def2.innerType;
|
|
28804
28861
|
};
|
|
28805
|
-
var optionalProcessor = (
|
|
28806
|
-
const def2 =
|
|
28862
|
+
var optionalProcessor = (schema2, ctx, _json, params3) => {
|
|
28863
|
+
const def2 = schema2._zod.def;
|
|
28807
28864
|
process2(def2.innerType, ctx, params3);
|
|
28808
|
-
const seen = ctx.seen.get(
|
|
28865
|
+
const seen = ctx.seen.get(schema2);
|
|
28809
28866
|
seen.ref = def2.innerType;
|
|
28810
28867
|
};
|
|
28811
|
-
var lazyProcessor = (
|
|
28812
|
-
const innerType =
|
|
28868
|
+
var lazyProcessor = (schema2, ctx, _json, params3) => {
|
|
28869
|
+
const innerType = schema2._zod.innerType;
|
|
28813
28870
|
process2(innerType, ctx, params3);
|
|
28814
|
-
const seen = ctx.seen.get(
|
|
28871
|
+
const seen = ctx.seen.get(schema2);
|
|
28815
28872
|
seen.ref = innerType;
|
|
28816
28873
|
};
|
|
28817
28874
|
var allProcessors = {
|
|
@@ -28861,8 +28918,8 @@ function toJSONSchema(input, params3) {
|
|
|
28861
28918
|
const ctx2 = initializeContext({ ...params3, processors: allProcessors });
|
|
28862
28919
|
const defs = {};
|
|
28863
28920
|
for (const entry of registry2._idmap.entries()) {
|
|
28864
|
-
const [_,
|
|
28865
|
-
process2(
|
|
28921
|
+
const [_, schema2] = entry;
|
|
28922
|
+
process2(schema2, ctx2);
|
|
28866
28923
|
}
|
|
28867
28924
|
const schemas = {};
|
|
28868
28925
|
const external = {
|
|
@@ -28872,9 +28929,9 @@ function toJSONSchema(input, params3) {
|
|
|
28872
28929
|
};
|
|
28873
28930
|
ctx2.external = external;
|
|
28874
28931
|
for (const entry of registry2._idmap.entries()) {
|
|
28875
|
-
const [key,
|
|
28876
|
-
extractDefs(ctx2,
|
|
28877
|
-
schemas[key] = finalize(ctx2,
|
|
28932
|
+
const [key, schema2] = entry;
|
|
28933
|
+
extractDefs(ctx2, schema2);
|
|
28934
|
+
schemas[key] = finalize(ctx2, schema2);
|
|
28878
28935
|
}
|
|
28879
28936
|
if (Object.keys(defs).length > 0) {
|
|
28880
28937
|
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
@@ -28942,14 +28999,14 @@ var JSONSchemaGenerator = class {
|
|
|
28942
28999
|
* Process a schema to prepare it for JSON Schema generation.
|
|
28943
29000
|
* This must be called before emit().
|
|
28944
29001
|
*/
|
|
28945
|
-
process(
|
|
28946
|
-
return process2(
|
|
29002
|
+
process(schema2, _params = { path: [], schemaPath: [] }) {
|
|
29003
|
+
return process2(schema2, this.ctx, _params);
|
|
28947
29004
|
}
|
|
28948
29005
|
/**
|
|
28949
29006
|
* Emit the final JSON Schema after processing.
|
|
28950
29007
|
* Must call process() first.
|
|
28951
29008
|
*/
|
|
28952
|
-
emit(
|
|
29009
|
+
emit(schema2, _params) {
|
|
28953
29010
|
if (_params) {
|
|
28954
29011
|
if (_params.cycles)
|
|
28955
29012
|
this.ctx.cycles = _params.cycles;
|
|
@@ -28958,8 +29015,8 @@ var JSONSchemaGenerator = class {
|
|
|
28958
29015
|
if (_params.external)
|
|
28959
29016
|
this.ctx.external = _params.external;
|
|
28960
29017
|
}
|
|
28961
|
-
extractDefs(this.ctx,
|
|
28962
|
-
const result = finalize(this.ctx,
|
|
29018
|
+
extractDefs(this.ctx, schema2);
|
|
29019
|
+
const result = finalize(this.ctx, schema2);
|
|
28963
29020
|
const { "~standard": _, ...plainResult } = result;
|
|
28964
29021
|
return plainResult;
|
|
28965
29022
|
}
|
|
@@ -29014,8 +29071,8 @@ function object(shape, params3) {
|
|
|
29014
29071
|
|
|
29015
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
|
|
29016
29073
|
function isZ4Schema(s) {
|
|
29017
|
-
const
|
|
29018
|
-
return !!
|
|
29074
|
+
const schema2 = s;
|
|
29075
|
+
return !!schema2._zod;
|
|
29019
29076
|
}
|
|
29020
29077
|
function objectFromShape(shape) {
|
|
29021
29078
|
const values2 = Object.values(shape);
|
|
@@ -29029,33 +29086,33 @@ function objectFromShape(shape) {
|
|
|
29029
29086
|
return objectType(shape);
|
|
29030
29087
|
throw new Error("Mixed Zod versions detected in object shape.");
|
|
29031
29088
|
}
|
|
29032
|
-
function safeParse2(
|
|
29033
|
-
if (isZ4Schema(
|
|
29034
|
-
const result2 = safeParse(
|
|
29089
|
+
function safeParse2(schema2, data) {
|
|
29090
|
+
if (isZ4Schema(schema2)) {
|
|
29091
|
+
const result2 = safeParse(schema2, data);
|
|
29035
29092
|
return result2;
|
|
29036
29093
|
}
|
|
29037
|
-
const v3Schema =
|
|
29094
|
+
const v3Schema = schema2;
|
|
29038
29095
|
const result = v3Schema.safeParse(data);
|
|
29039
29096
|
return result;
|
|
29040
29097
|
}
|
|
29041
|
-
async function safeParseAsync2(
|
|
29042
|
-
if (isZ4Schema(
|
|
29043
|
-
const result2 = await safeParseAsync(
|
|
29098
|
+
async function safeParseAsync2(schema2, data) {
|
|
29099
|
+
if (isZ4Schema(schema2)) {
|
|
29100
|
+
const result2 = await safeParseAsync(schema2, data);
|
|
29044
29101
|
return result2;
|
|
29045
29102
|
}
|
|
29046
|
-
const v3Schema =
|
|
29103
|
+
const v3Schema = schema2;
|
|
29047
29104
|
const result = await v3Schema.safeParseAsync(data);
|
|
29048
29105
|
return result;
|
|
29049
29106
|
}
|
|
29050
|
-
function getObjectShape(
|
|
29051
|
-
if (!
|
|
29107
|
+
function getObjectShape(schema2) {
|
|
29108
|
+
if (!schema2)
|
|
29052
29109
|
return void 0;
|
|
29053
29110
|
let rawShape;
|
|
29054
|
-
if (isZ4Schema(
|
|
29055
|
-
const v4Schema =
|
|
29111
|
+
if (isZ4Schema(schema2)) {
|
|
29112
|
+
const v4Schema = schema2;
|
|
29056
29113
|
rawShape = v4Schema._zod?.def?.shape;
|
|
29057
29114
|
} else {
|
|
29058
|
-
const v3Schema =
|
|
29115
|
+
const v3Schema = schema2;
|
|
29059
29116
|
rawShape = v3Schema.shape;
|
|
29060
29117
|
}
|
|
29061
29118
|
if (!rawShape)
|
|
@@ -29069,29 +29126,29 @@ function getObjectShape(schema) {
|
|
|
29069
29126
|
}
|
|
29070
29127
|
return rawShape;
|
|
29071
29128
|
}
|
|
29072
|
-
function normalizeObjectSchema(
|
|
29073
|
-
if (!
|
|
29129
|
+
function normalizeObjectSchema(schema2) {
|
|
29130
|
+
if (!schema2)
|
|
29074
29131
|
return void 0;
|
|
29075
|
-
if (typeof
|
|
29076
|
-
const asV3 =
|
|
29077
|
-
const asV4 =
|
|
29132
|
+
if (typeof schema2 === "object") {
|
|
29133
|
+
const asV3 = schema2;
|
|
29134
|
+
const asV4 = schema2;
|
|
29078
29135
|
if (!asV3._def && !asV4._zod) {
|
|
29079
|
-
const values2 = Object.values(
|
|
29136
|
+
const values2 = Object.values(schema2);
|
|
29080
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"))) {
|
|
29081
|
-
return objectFromShape(
|
|
29138
|
+
return objectFromShape(schema2);
|
|
29082
29139
|
}
|
|
29083
29140
|
}
|
|
29084
29141
|
}
|
|
29085
|
-
if (isZ4Schema(
|
|
29086
|
-
const v4Schema =
|
|
29142
|
+
if (isZ4Schema(schema2)) {
|
|
29143
|
+
const v4Schema = schema2;
|
|
29087
29144
|
const def2 = v4Schema._zod?.def;
|
|
29088
29145
|
if (def2 && (def2.type === "object" || def2.shape !== void 0)) {
|
|
29089
|
-
return
|
|
29146
|
+
return schema2;
|
|
29090
29147
|
}
|
|
29091
29148
|
} else {
|
|
29092
|
-
const v3Schema =
|
|
29149
|
+
const v3Schema = schema2;
|
|
29093
29150
|
if (v3Schema.shape !== void 0) {
|
|
29094
|
-
return
|
|
29151
|
+
return schema2;
|
|
29095
29152
|
}
|
|
29096
29153
|
}
|
|
29097
29154
|
return void 0;
|
|
@@ -29115,23 +29172,23 @@ function getParseErrorMessage(error48) {
|
|
|
29115
29172
|
}
|
|
29116
29173
|
return String(error48);
|
|
29117
29174
|
}
|
|
29118
|
-
function getSchemaDescription(
|
|
29119
|
-
return
|
|
29175
|
+
function getSchemaDescription(schema2) {
|
|
29176
|
+
return schema2.description;
|
|
29120
29177
|
}
|
|
29121
|
-
function isSchemaOptional(
|
|
29122
|
-
if (isZ4Schema(
|
|
29123
|
-
const v4Schema =
|
|
29178
|
+
function isSchemaOptional(schema2) {
|
|
29179
|
+
if (isZ4Schema(schema2)) {
|
|
29180
|
+
const v4Schema = schema2;
|
|
29124
29181
|
return v4Schema._zod?.def?.type === "optional";
|
|
29125
29182
|
}
|
|
29126
|
-
const v3Schema =
|
|
29127
|
-
if (typeof
|
|
29128
|
-
return
|
|
29183
|
+
const v3Schema = schema2;
|
|
29184
|
+
if (typeof schema2.isOptional === "function") {
|
|
29185
|
+
return schema2.isOptional();
|
|
29129
29186
|
}
|
|
29130
29187
|
return v3Schema._def?.typeName === "ZodOptional";
|
|
29131
29188
|
}
|
|
29132
|
-
function getLiteralValue(
|
|
29133
|
-
if (isZ4Schema(
|
|
29134
|
-
const v4Schema =
|
|
29189
|
+
function getLiteralValue(schema2) {
|
|
29190
|
+
if (isZ4Schema(schema2)) {
|
|
29191
|
+
const v4Schema = schema2;
|
|
29135
29192
|
const def3 = v4Schema._zod?.def;
|
|
29136
29193
|
if (def3) {
|
|
29137
29194
|
if (def3.value !== void 0)
|
|
@@ -29141,7 +29198,7 @@ function getLiteralValue(schema) {
|
|
|
29141
29198
|
}
|
|
29142
29199
|
}
|
|
29143
29200
|
}
|
|
29144
|
-
const v3Schema =
|
|
29201
|
+
const v3Schema = schema2;
|
|
29145
29202
|
const def2 = v3Schema._def;
|
|
29146
29203
|
if (def2) {
|
|
29147
29204
|
if (def2.value !== void 0)
|
|
@@ -29150,7 +29207,7 @@ function getLiteralValue(schema) {
|
|
|
29150
29207
|
return def2.values[0];
|
|
29151
29208
|
}
|
|
29152
29209
|
}
|
|
29153
|
-
const directValue =
|
|
29210
|
+
const directValue = schema2.value;
|
|
29154
29211
|
if (directValue !== void 0)
|
|
29155
29212
|
return directValue;
|
|
29156
29213
|
return void 0;
|
|
@@ -30192,8 +30249,8 @@ var ZodArray2 = /* @__PURE__ */ $constructor("ZodArray", (inst, def2) => {
|
|
|
30192
30249
|
function array(element, params3) {
|
|
30193
30250
|
return _array(ZodArray2, element, params3);
|
|
30194
30251
|
}
|
|
30195
|
-
function keyof(
|
|
30196
|
-
const shape =
|
|
30252
|
+
function keyof(schema2) {
|
|
30253
|
+
const shape = schema2._zod.def.shape;
|
|
30197
30254
|
return _enum2(Object.keys(shape));
|
|
30198
30255
|
}
|
|
30199
30256
|
var ZodObject2 = /* @__PURE__ */ $constructor("ZodObject", (inst, def2) => {
|
|
@@ -30770,8 +30827,8 @@ function json(params3) {
|
|
|
30770
30827
|
});
|
|
30771
30828
|
return jsonSchema;
|
|
30772
30829
|
}
|
|
30773
|
-
function preprocess(fn,
|
|
30774
|
-
return pipe(transform(fn),
|
|
30830
|
+
function preprocess(fn, schema2) {
|
|
30831
|
+
return pipe(transform(fn), schema2);
|
|
30775
30832
|
}
|
|
30776
30833
|
|
|
30777
30834
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/classic/compat.js
|
|
@@ -30877,8 +30934,8 @@ var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
|
|
|
30877
30934
|
"nullable",
|
|
30878
30935
|
"readOnly"
|
|
30879
30936
|
]);
|
|
30880
|
-
function detectVersion(
|
|
30881
|
-
const $schema =
|
|
30937
|
+
function detectVersion(schema2, defaultTarget) {
|
|
30938
|
+
const $schema = schema2.$schema;
|
|
30882
30939
|
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
30883
30940
|
return "draft-2020-12";
|
|
30884
30941
|
}
|
|
@@ -30908,27 +30965,27 @@ function resolveRef(ref, ctx) {
|
|
|
30908
30965
|
}
|
|
30909
30966
|
throw new Error(`Reference not found: ${ref}`);
|
|
30910
30967
|
}
|
|
30911
|
-
function convertBaseSchema(
|
|
30912
|
-
if (
|
|
30913
|
-
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) {
|
|
30914
30971
|
return z.never();
|
|
30915
30972
|
}
|
|
30916
30973
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
30917
30974
|
}
|
|
30918
|
-
if (
|
|
30975
|
+
if (schema2.unevaluatedItems !== void 0) {
|
|
30919
30976
|
throw new Error("unevaluatedItems is not supported");
|
|
30920
30977
|
}
|
|
30921
|
-
if (
|
|
30978
|
+
if (schema2.unevaluatedProperties !== void 0) {
|
|
30922
30979
|
throw new Error("unevaluatedProperties is not supported");
|
|
30923
30980
|
}
|
|
30924
|
-
if (
|
|
30981
|
+
if (schema2.if !== void 0 || schema2.then !== void 0 || schema2.else !== void 0) {
|
|
30925
30982
|
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
30926
30983
|
}
|
|
30927
|
-
if (
|
|
30984
|
+
if (schema2.dependentSchemas !== void 0 || schema2.dependentRequired !== void 0) {
|
|
30928
30985
|
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
30929
30986
|
}
|
|
30930
|
-
if (
|
|
30931
|
-
const refPath =
|
|
30987
|
+
if (schema2.$ref) {
|
|
30988
|
+
const refPath = schema2.$ref;
|
|
30932
30989
|
if (ctx.refs.has(refPath)) {
|
|
30933
30990
|
return ctx.refs.get(refPath);
|
|
30934
30991
|
}
|
|
@@ -30947,9 +31004,9 @@ function convertBaseSchema(schema, ctx) {
|
|
|
30947
31004
|
ctx.processing.delete(refPath);
|
|
30948
31005
|
return zodSchema2;
|
|
30949
31006
|
}
|
|
30950
|
-
if (
|
|
30951
|
-
const enumValues =
|
|
30952
|
-
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) {
|
|
30953
31010
|
return z.null();
|
|
30954
31011
|
}
|
|
30955
31012
|
if (enumValues.length === 0) {
|
|
@@ -30967,13 +31024,13 @@ function convertBaseSchema(schema, ctx) {
|
|
|
30967
31024
|
}
|
|
30968
31025
|
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
30969
31026
|
}
|
|
30970
|
-
if (
|
|
30971
|
-
return z.literal(
|
|
31027
|
+
if (schema2.const !== void 0) {
|
|
31028
|
+
return z.literal(schema2.const);
|
|
30972
31029
|
}
|
|
30973
|
-
const type =
|
|
31030
|
+
const type = schema2.type;
|
|
30974
31031
|
if (Array.isArray(type)) {
|
|
30975
31032
|
const typeSchemas = type.map((t) => {
|
|
30976
|
-
const typeSchema = { ...
|
|
31033
|
+
const typeSchema = { ...schema2, type: t };
|
|
30977
31034
|
return convertBaseSchema(typeSchema, ctx);
|
|
30978
31035
|
});
|
|
30979
31036
|
if (typeSchemas.length === 0) {
|
|
@@ -30991,8 +31048,8 @@ function convertBaseSchema(schema, ctx) {
|
|
|
30991
31048
|
switch (type) {
|
|
30992
31049
|
case "string": {
|
|
30993
31050
|
let stringSchema = z.string();
|
|
30994
|
-
if (
|
|
30995
|
-
const format =
|
|
31051
|
+
if (schema2.format) {
|
|
31052
|
+
const format = schema2.format;
|
|
30996
31053
|
if (format === "email") {
|
|
30997
31054
|
stringSchema = stringSchema.check(z.email());
|
|
30998
31055
|
} else if (format === "uri" || format === "uri-reference") {
|
|
@@ -31041,14 +31098,14 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31041
31098
|
stringSchema = stringSchema.check(z.ksuid());
|
|
31042
31099
|
}
|
|
31043
31100
|
}
|
|
31044
|
-
if (typeof
|
|
31045
|
-
stringSchema = stringSchema.min(
|
|
31101
|
+
if (typeof schema2.minLength === "number") {
|
|
31102
|
+
stringSchema = stringSchema.min(schema2.minLength);
|
|
31046
31103
|
}
|
|
31047
|
-
if (typeof
|
|
31048
|
-
stringSchema = stringSchema.max(
|
|
31104
|
+
if (typeof schema2.maxLength === "number") {
|
|
31105
|
+
stringSchema = stringSchema.max(schema2.maxLength);
|
|
31049
31106
|
}
|
|
31050
|
-
if (
|
|
31051
|
-
stringSchema = stringSchema.regex(new RegExp(
|
|
31107
|
+
if (schema2.pattern) {
|
|
31108
|
+
stringSchema = stringSchema.regex(new RegExp(schema2.pattern));
|
|
31052
31109
|
}
|
|
31053
31110
|
zodSchema = stringSchema;
|
|
31054
31111
|
break;
|
|
@@ -31056,24 +31113,24 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31056
31113
|
case "number":
|
|
31057
31114
|
case "integer": {
|
|
31058
31115
|
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
31059
|
-
if (typeof
|
|
31060
|
-
numberSchema = numberSchema.min(
|
|
31116
|
+
if (typeof schema2.minimum === "number") {
|
|
31117
|
+
numberSchema = numberSchema.min(schema2.minimum);
|
|
31061
31118
|
}
|
|
31062
|
-
if (typeof
|
|
31063
|
-
numberSchema = numberSchema.max(
|
|
31119
|
+
if (typeof schema2.maximum === "number") {
|
|
31120
|
+
numberSchema = numberSchema.max(schema2.maximum);
|
|
31064
31121
|
}
|
|
31065
|
-
if (typeof
|
|
31066
|
-
numberSchema = numberSchema.gt(
|
|
31067
|
-
} else if (
|
|
31068
|
-
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);
|
|
31069
31126
|
}
|
|
31070
|
-
if (typeof
|
|
31071
|
-
numberSchema = numberSchema.lt(
|
|
31072
|
-
} else if (
|
|
31073
|
-
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);
|
|
31074
31131
|
}
|
|
31075
|
-
if (typeof
|
|
31076
|
-
numberSchema = numberSchema.multipleOf(
|
|
31132
|
+
if (typeof schema2.multipleOf === "number") {
|
|
31133
|
+
numberSchema = numberSchema.multipleOf(schema2.multipleOf);
|
|
31077
31134
|
}
|
|
31078
31135
|
zodSchema = numberSchema;
|
|
31079
31136
|
break;
|
|
@@ -31088,15 +31145,15 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31088
31145
|
}
|
|
31089
31146
|
case "object": {
|
|
31090
31147
|
const shape = {};
|
|
31091
|
-
const properties =
|
|
31092
|
-
const requiredSet = new Set(
|
|
31148
|
+
const properties = schema2.properties || {};
|
|
31149
|
+
const requiredSet = new Set(schema2.required || []);
|
|
31093
31150
|
for (const [key, propSchema] of Object.entries(properties)) {
|
|
31094
31151
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
31095
31152
|
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
31096
31153
|
}
|
|
31097
|
-
if (
|
|
31098
|
-
const keySchema = convertSchema(
|
|
31099
|
-
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();
|
|
31100
31157
|
if (Object.keys(shape).length === 0) {
|
|
31101
31158
|
zodSchema = z.record(keySchema, valueSchema);
|
|
31102
31159
|
break;
|
|
@@ -31106,8 +31163,8 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31106
31163
|
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
31107
31164
|
break;
|
|
31108
31165
|
}
|
|
31109
|
-
if (
|
|
31110
|
-
const patternProps =
|
|
31166
|
+
if (schema2.patternProperties) {
|
|
31167
|
+
const patternProps = schema2.patternProperties;
|
|
31111
31168
|
const patternKeys = Object.keys(patternProps);
|
|
31112
31169
|
const looseRecords = [];
|
|
31113
31170
|
for (const pattern of patternKeys) {
|
|
@@ -31134,18 +31191,18 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31134
31191
|
break;
|
|
31135
31192
|
}
|
|
31136
31193
|
const objectSchema = z.object(shape);
|
|
31137
|
-
if (
|
|
31194
|
+
if (schema2.additionalProperties === false) {
|
|
31138
31195
|
zodSchema = objectSchema.strict();
|
|
31139
|
-
} else if (typeof
|
|
31140
|
-
zodSchema = objectSchema.catchall(convertSchema(
|
|
31196
|
+
} else if (typeof schema2.additionalProperties === "object") {
|
|
31197
|
+
zodSchema = objectSchema.catchall(convertSchema(schema2.additionalProperties, ctx));
|
|
31141
31198
|
} else {
|
|
31142
31199
|
zodSchema = objectSchema.passthrough();
|
|
31143
31200
|
}
|
|
31144
31201
|
break;
|
|
31145
31202
|
}
|
|
31146
31203
|
case "array": {
|
|
31147
|
-
const prefixItems =
|
|
31148
|
-
const items =
|
|
31204
|
+
const prefixItems = schema2.prefixItems;
|
|
31205
|
+
const items = schema2.items;
|
|
31149
31206
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
31150
31207
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
31151
31208
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
@@ -31154,34 +31211,34 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31154
31211
|
} else {
|
|
31155
31212
|
zodSchema = z.tuple(tupleItems);
|
|
31156
31213
|
}
|
|
31157
|
-
if (typeof
|
|
31158
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
31214
|
+
if (typeof schema2.minItems === "number") {
|
|
31215
|
+
zodSchema = zodSchema.check(z.minLength(schema2.minItems));
|
|
31159
31216
|
}
|
|
31160
|
-
if (typeof
|
|
31161
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
31217
|
+
if (typeof schema2.maxItems === "number") {
|
|
31218
|
+
zodSchema = zodSchema.check(z.maxLength(schema2.maxItems));
|
|
31162
31219
|
}
|
|
31163
31220
|
} else if (Array.isArray(items)) {
|
|
31164
31221
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
31165
|
-
const rest =
|
|
31222
|
+
const rest = schema2.additionalItems && typeof schema2.additionalItems === "object" ? convertSchema(schema2.additionalItems, ctx) : void 0;
|
|
31166
31223
|
if (rest) {
|
|
31167
31224
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
31168
31225
|
} else {
|
|
31169
31226
|
zodSchema = z.tuple(tupleItems);
|
|
31170
31227
|
}
|
|
31171
|
-
if (typeof
|
|
31172
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
31228
|
+
if (typeof schema2.minItems === "number") {
|
|
31229
|
+
zodSchema = zodSchema.check(z.minLength(schema2.minItems));
|
|
31173
31230
|
}
|
|
31174
|
-
if (typeof
|
|
31175
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
31231
|
+
if (typeof schema2.maxItems === "number") {
|
|
31232
|
+
zodSchema = zodSchema.check(z.maxLength(schema2.maxItems));
|
|
31176
31233
|
}
|
|
31177
31234
|
} else if (items !== void 0) {
|
|
31178
31235
|
const element = convertSchema(items, ctx);
|
|
31179
31236
|
let arraySchema = z.array(element);
|
|
31180
|
-
if (typeof
|
|
31181
|
-
arraySchema = arraySchema.min(
|
|
31237
|
+
if (typeof schema2.minItems === "number") {
|
|
31238
|
+
arraySchema = arraySchema.min(schema2.minItems);
|
|
31182
31239
|
}
|
|
31183
|
-
if (typeof
|
|
31184
|
-
arraySchema = arraySchema.max(
|
|
31240
|
+
if (typeof schema2.maxItems === "number") {
|
|
31241
|
+
arraySchema = arraySchema.max(schema2.maxItems);
|
|
31185
31242
|
}
|
|
31186
31243
|
zodSchema = arraySchema;
|
|
31187
31244
|
} else {
|
|
@@ -31192,64 +31249,64 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31192
31249
|
default:
|
|
31193
31250
|
throw new Error(`Unsupported type: ${type}`);
|
|
31194
31251
|
}
|
|
31195
|
-
if (
|
|
31196
|
-
zodSchema = zodSchema.describe(
|
|
31252
|
+
if (schema2.description) {
|
|
31253
|
+
zodSchema = zodSchema.describe(schema2.description);
|
|
31197
31254
|
}
|
|
31198
|
-
if (
|
|
31199
|
-
zodSchema = zodSchema.default(
|
|
31255
|
+
if (schema2.default !== void 0) {
|
|
31256
|
+
zodSchema = zodSchema.default(schema2.default);
|
|
31200
31257
|
}
|
|
31201
31258
|
return zodSchema;
|
|
31202
31259
|
}
|
|
31203
|
-
function convertSchema(
|
|
31204
|
-
if (typeof
|
|
31205
|
-
return
|
|
31260
|
+
function convertSchema(schema2, ctx) {
|
|
31261
|
+
if (typeof schema2 === "boolean") {
|
|
31262
|
+
return schema2 ? z.any() : z.never();
|
|
31206
31263
|
}
|
|
31207
|
-
let baseSchema = convertBaseSchema(
|
|
31208
|
-
const hasExplicitType =
|
|
31209
|
-
if (
|
|
31210
|
-
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));
|
|
31211
31268
|
const anyOfUnion = z.union(options);
|
|
31212
31269
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
31213
31270
|
}
|
|
31214
|
-
if (
|
|
31215
|
-
const options =
|
|
31271
|
+
if (schema2.oneOf && Array.isArray(schema2.oneOf)) {
|
|
31272
|
+
const options = schema2.oneOf.map((s) => convertSchema(s, ctx));
|
|
31216
31273
|
const oneOfUnion = z.xor(options);
|
|
31217
31274
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
31218
31275
|
}
|
|
31219
|
-
if (
|
|
31220
|
-
if (
|
|
31276
|
+
if (schema2.allOf && Array.isArray(schema2.allOf)) {
|
|
31277
|
+
if (schema2.allOf.length === 0) {
|
|
31221
31278
|
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
31222
31279
|
} else {
|
|
31223
|
-
let result = hasExplicitType ? baseSchema : convertSchema(
|
|
31280
|
+
let result = hasExplicitType ? baseSchema : convertSchema(schema2.allOf[0], ctx);
|
|
31224
31281
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
31225
|
-
for (let i = startIdx; i <
|
|
31226
|
-
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));
|
|
31227
31284
|
}
|
|
31228
31285
|
baseSchema = result;
|
|
31229
31286
|
}
|
|
31230
31287
|
}
|
|
31231
|
-
if (
|
|
31288
|
+
if (schema2.nullable === true && ctx.version === "openapi-3.0") {
|
|
31232
31289
|
baseSchema = z.nullable(baseSchema);
|
|
31233
31290
|
}
|
|
31234
|
-
if (
|
|
31291
|
+
if (schema2.readOnly === true) {
|
|
31235
31292
|
baseSchema = z.readonly(baseSchema);
|
|
31236
31293
|
}
|
|
31237
31294
|
const extraMeta = {};
|
|
31238
31295
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
31239
31296
|
for (const key of coreMetadataKeys) {
|
|
31240
|
-
if (key in
|
|
31241
|
-
extraMeta[key] =
|
|
31297
|
+
if (key in schema2) {
|
|
31298
|
+
extraMeta[key] = schema2[key];
|
|
31242
31299
|
}
|
|
31243
31300
|
}
|
|
31244
31301
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
31245
31302
|
for (const key of contentMetadataKeys) {
|
|
31246
|
-
if (key in
|
|
31247
|
-
extraMeta[key] =
|
|
31303
|
+
if (key in schema2) {
|
|
31304
|
+
extraMeta[key] = schema2[key];
|
|
31248
31305
|
}
|
|
31249
31306
|
}
|
|
31250
|
-
for (const key of Object.keys(
|
|
31307
|
+
for (const key of Object.keys(schema2)) {
|
|
31251
31308
|
if (!RECOGNIZED_KEYS.has(key)) {
|
|
31252
|
-
extraMeta[key] =
|
|
31309
|
+
extraMeta[key] = schema2[key];
|
|
31253
31310
|
}
|
|
31254
31311
|
}
|
|
31255
31312
|
if (Object.keys(extraMeta).length > 0) {
|
|
@@ -31257,21 +31314,21 @@ function convertSchema(schema, ctx) {
|
|
|
31257
31314
|
}
|
|
31258
31315
|
return baseSchema;
|
|
31259
31316
|
}
|
|
31260
|
-
function fromJSONSchema(
|
|
31261
|
-
if (typeof
|
|
31262
|
-
return
|
|
31317
|
+
function fromJSONSchema(schema2, params3) {
|
|
31318
|
+
if (typeof schema2 === "boolean") {
|
|
31319
|
+
return schema2 ? z.any() : z.never();
|
|
31263
31320
|
}
|
|
31264
|
-
const version2 = detectVersion(
|
|
31265
|
-
const defs =
|
|
31321
|
+
const version2 = detectVersion(schema2, params3?.defaultTarget);
|
|
31322
|
+
const defs = schema2.$defs || schema2.definitions || {};
|
|
31266
31323
|
const ctx = {
|
|
31267
31324
|
version: version2,
|
|
31268
31325
|
defs,
|
|
31269
31326
|
refs: /* @__PURE__ */ new Map(),
|
|
31270
31327
|
processing: /* @__PURE__ */ new Set(),
|
|
31271
|
-
rootSchema:
|
|
31328
|
+
rootSchema: schema2,
|
|
31272
31329
|
registry: params3?.registry ?? globalRegistry
|
|
31273
31330
|
};
|
|
31274
|
-
return convertSchema(
|
|
31331
|
+
return convertSchema(schema2, ctx);
|
|
31275
31332
|
}
|
|
31276
31333
|
|
|
31277
31334
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/classic/coerce.js
|
|
@@ -33108,16 +33165,16 @@ function parseIntersectionDef(def2, refs) {
|
|
|
33108
33165
|
].filter((x) => !!x);
|
|
33109
33166
|
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
33110
33167
|
const mergedAllOf = [];
|
|
33111
|
-
allOf.forEach((
|
|
33112
|
-
if (isJsonSchema7AllOfType(
|
|
33113
|
-
mergedAllOf.push(...
|
|
33114
|
-
if (
|
|
33168
|
+
allOf.forEach((schema2) => {
|
|
33169
|
+
if (isJsonSchema7AllOfType(schema2)) {
|
|
33170
|
+
mergedAllOf.push(...schema2.allOf);
|
|
33171
|
+
if (schema2.unevaluatedProperties === void 0) {
|
|
33115
33172
|
unevaluatedProperties = void 0;
|
|
33116
33173
|
}
|
|
33117
33174
|
} else {
|
|
33118
|
-
let nestedSchema =
|
|
33119
|
-
if ("additionalProperties" in
|
|
33120
|
-
const { additionalProperties, ...rest } =
|
|
33175
|
+
let nestedSchema = schema2;
|
|
33176
|
+
if ("additionalProperties" in schema2 && schema2.additionalProperties === false) {
|
|
33177
|
+
const { additionalProperties, ...rest } = schema2;
|
|
33121
33178
|
nestedSchema = rest;
|
|
33122
33179
|
} else {
|
|
33123
33180
|
unevaluatedProperties = void 0;
|
|
@@ -33344,60 +33401,60 @@ function escapeNonAlphaNumeric(source) {
|
|
|
33344
33401
|
}
|
|
33345
33402
|
return result;
|
|
33346
33403
|
}
|
|
33347
|
-
function addFormat(
|
|
33348
|
-
if (
|
|
33349
|
-
if (!
|
|
33350
|
-
|
|
33404
|
+
function addFormat(schema2, value, message, refs) {
|
|
33405
|
+
if (schema2.format || schema2.anyOf?.some((x) => x.format)) {
|
|
33406
|
+
if (!schema2.anyOf) {
|
|
33407
|
+
schema2.anyOf = [];
|
|
33351
33408
|
}
|
|
33352
|
-
if (
|
|
33353
|
-
|
|
33354
|
-
format:
|
|
33355
|
-
...
|
|
33356
|
-
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 }
|
|
33357
33414
|
}
|
|
33358
33415
|
});
|
|
33359
|
-
delete
|
|
33360
|
-
if (
|
|
33361
|
-
delete
|
|
33362
|
-
if (Object.keys(
|
|
33363
|
-
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;
|
|
33364
33421
|
}
|
|
33365
33422
|
}
|
|
33366
33423
|
}
|
|
33367
|
-
|
|
33424
|
+
schema2.anyOf.push({
|
|
33368
33425
|
format: value,
|
|
33369
33426
|
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
33370
33427
|
});
|
|
33371
33428
|
} else {
|
|
33372
|
-
setResponseValueAndErrors(
|
|
33429
|
+
setResponseValueAndErrors(schema2, "format", value, message, refs);
|
|
33373
33430
|
}
|
|
33374
33431
|
}
|
|
33375
|
-
function addPattern(
|
|
33376
|
-
if (
|
|
33377
|
-
if (!
|
|
33378
|
-
|
|
33432
|
+
function addPattern(schema2, regex, message, refs) {
|
|
33433
|
+
if (schema2.pattern || schema2.allOf?.some((x) => x.pattern)) {
|
|
33434
|
+
if (!schema2.allOf) {
|
|
33435
|
+
schema2.allOf = [];
|
|
33379
33436
|
}
|
|
33380
|
-
if (
|
|
33381
|
-
|
|
33382
|
-
pattern:
|
|
33383
|
-
...
|
|
33384
|
-
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 }
|
|
33385
33442
|
}
|
|
33386
33443
|
});
|
|
33387
|
-
delete
|
|
33388
|
-
if (
|
|
33389
|
-
delete
|
|
33390
|
-
if (Object.keys(
|
|
33391
|
-
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;
|
|
33392
33449
|
}
|
|
33393
33450
|
}
|
|
33394
33451
|
}
|
|
33395
|
-
|
|
33452
|
+
schema2.allOf.push({
|
|
33396
33453
|
pattern: stringifyRegExpWithFlags(regex, refs),
|
|
33397
33454
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
33398
33455
|
});
|
|
33399
33456
|
} else {
|
|
33400
|
-
setResponseValueAndErrors(
|
|
33457
|
+
setResponseValueAndErrors(schema2, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
|
|
33401
33458
|
}
|
|
33402
33459
|
}
|
|
33403
33460
|
function stringifyRegExpWithFlags(regex, refs) {
|
|
@@ -33495,7 +33552,7 @@ function parseRecordDef(def2, refs) {
|
|
|
33495
33552
|
additionalProperties: refs.rejectedAdditionalProperties
|
|
33496
33553
|
};
|
|
33497
33554
|
}
|
|
33498
|
-
const
|
|
33555
|
+
const schema2 = {
|
|
33499
33556
|
type: "object",
|
|
33500
33557
|
additionalProperties: parseDef(def2.valueType._def, {
|
|
33501
33558
|
...refs,
|
|
@@ -33503,17 +33560,17 @@ function parseRecordDef(def2, refs) {
|
|
|
33503
33560
|
}) ?? refs.allowedAdditionalProperties
|
|
33504
33561
|
};
|
|
33505
33562
|
if (refs.target === "openApi3") {
|
|
33506
|
-
return
|
|
33563
|
+
return schema2;
|
|
33507
33564
|
}
|
|
33508
33565
|
if (def2.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def2.keyType._def.checks?.length) {
|
|
33509
33566
|
const { type, ...keyType } = parseStringDef(def2.keyType._def, refs);
|
|
33510
33567
|
return {
|
|
33511
|
-
...
|
|
33568
|
+
...schema2,
|
|
33512
33569
|
propertyNames: keyType
|
|
33513
33570
|
};
|
|
33514
33571
|
} else if (def2.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
|
|
33515
33572
|
return {
|
|
33516
|
-
...
|
|
33573
|
+
...schema2,
|
|
33517
33574
|
propertyNames: {
|
|
33518
33575
|
enum: def2.keyType._def.values
|
|
33519
33576
|
}
|
|
@@ -33521,11 +33578,11 @@ function parseRecordDef(def2, refs) {
|
|
|
33521
33578
|
} else if (def2.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def2.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def2.keyType._def.type._def.checks?.length) {
|
|
33522
33579
|
const { type, ...keyType } = parseBrandedDef(def2.keyType._def, refs);
|
|
33523
33580
|
return {
|
|
33524
|
-
...
|
|
33581
|
+
...schema2,
|
|
33525
33582
|
propertyNames: keyType
|
|
33526
33583
|
};
|
|
33527
33584
|
}
|
|
33528
|
-
return
|
|
33585
|
+
return schema2;
|
|
33529
33586
|
}
|
|
33530
33587
|
|
|
33531
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
|
|
@@ -33798,9 +33855,9 @@ function decideAdditionalProperties(def2, refs) {
|
|
|
33798
33855
|
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
33799
33856
|
}
|
|
33800
33857
|
}
|
|
33801
|
-
function safeIsOptional(
|
|
33858
|
+
function safeIsOptional(schema2) {
|
|
33802
33859
|
try {
|
|
33803
|
-
return
|
|
33860
|
+
return schema2.isOptional();
|
|
33804
33861
|
} catch {
|
|
33805
33862
|
return true;
|
|
33806
33863
|
}
|
|
@@ -33856,18 +33913,18 @@ function parseSetDef(def2, refs) {
|
|
|
33856
33913
|
...refs,
|
|
33857
33914
|
currentPath: [...refs.currentPath, "items"]
|
|
33858
33915
|
});
|
|
33859
|
-
const
|
|
33916
|
+
const schema2 = {
|
|
33860
33917
|
type: "array",
|
|
33861
33918
|
uniqueItems: true,
|
|
33862
33919
|
items
|
|
33863
33920
|
};
|
|
33864
33921
|
if (def2.minSize) {
|
|
33865
|
-
setResponseValueAndErrors(
|
|
33922
|
+
setResponseValueAndErrors(schema2, "minItems", def2.minSize.value, def2.minSize.message, refs);
|
|
33866
33923
|
}
|
|
33867
33924
|
if (def2.maxSize) {
|
|
33868
|
-
setResponseValueAndErrors(
|
|
33925
|
+
setResponseValueAndErrors(schema2, "maxItems", def2.maxSize.value, def2.maxSize.message, refs);
|
|
33869
33926
|
}
|
|
33870
|
-
return
|
|
33927
|
+
return schema2;
|
|
33871
33928
|
}
|
|
33872
33929
|
|
|
33873
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
|
|
@@ -34048,17 +34105,17 @@ var addMeta = (def2, refs, jsonSchema) => {
|
|
|
34048
34105
|
};
|
|
34049
34106
|
|
|
34050
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
|
|
34051
|
-
var zodToJsonSchema = (
|
|
34108
|
+
var zodToJsonSchema = (schema2, options) => {
|
|
34052
34109
|
const refs = getRefs(options);
|
|
34053
|
-
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]) => ({
|
|
34054
34111
|
...acc,
|
|
34055
|
-
[name2]: parseDef(
|
|
34112
|
+
[name2]: parseDef(schema3._def, {
|
|
34056
34113
|
...refs,
|
|
34057
34114
|
currentPath: [...refs.basePath, refs.definitionPath, name2]
|
|
34058
34115
|
}, true) ?? parseAnyDef(refs)
|
|
34059
34116
|
}), {}) : void 0;
|
|
34060
34117
|
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
34061
|
-
const main = parseDef(
|
|
34118
|
+
const main = parseDef(schema2._def, name === void 0 ? refs : {
|
|
34062
34119
|
...refs,
|
|
34063
34120
|
currentPath: [...refs.basePath, refs.definitionPath, name]
|
|
34064
34121
|
}, false) ?? parseAnyDef(refs);
|
|
@@ -34119,20 +34176,20 @@ function mapMiniTarget(t) {
|
|
|
34119
34176
|
return "draft-2020-12";
|
|
34120
34177
|
return "draft-7";
|
|
34121
34178
|
}
|
|
34122
|
-
function toJsonSchemaCompat(
|
|
34123
|
-
if (isZ4Schema(
|
|
34124
|
-
return toJSONSchema(
|
|
34179
|
+
function toJsonSchemaCompat(schema2, opts) {
|
|
34180
|
+
if (isZ4Schema(schema2)) {
|
|
34181
|
+
return toJSONSchema(schema2, {
|
|
34125
34182
|
target: mapMiniTarget(opts?.target),
|
|
34126
34183
|
io: opts?.pipeStrategy ?? "input"
|
|
34127
34184
|
});
|
|
34128
34185
|
}
|
|
34129
|
-
return zodToJsonSchema(
|
|
34186
|
+
return zodToJsonSchema(schema2, {
|
|
34130
34187
|
strictUnions: opts?.strictUnions ?? true,
|
|
34131
34188
|
pipeStrategy: opts?.pipeStrategy ?? "input"
|
|
34132
34189
|
});
|
|
34133
34190
|
}
|
|
34134
|
-
function getMethodLiteral(
|
|
34135
|
-
const shape = getObjectShape(
|
|
34191
|
+
function getMethodLiteral(schema2) {
|
|
34192
|
+
const shape = getObjectShape(schema2);
|
|
34136
34193
|
const methodSchema = shape?.method;
|
|
34137
34194
|
if (!methodSchema) {
|
|
34138
34195
|
throw new Error("Schema is missing a method literal");
|
|
@@ -34143,8 +34200,8 @@ function getMethodLiteral(schema) {
|
|
|
34143
34200
|
}
|
|
34144
34201
|
return value;
|
|
34145
34202
|
}
|
|
34146
|
-
function parseWithCompat(
|
|
34147
|
-
const result = safeParse2(
|
|
34203
|
+
function parseWithCompat(schema2, data) {
|
|
34204
|
+
const result = safeParse2(schema2, data);
|
|
34148
34205
|
if (!result.success) {
|
|
34149
34206
|
throw result.error;
|
|
34150
34207
|
}
|
|
@@ -35146,8 +35203,8 @@ var AjvJsonSchemaValidator = class {
|
|
|
35146
35203
|
* @param schema - Standard JSON Schema object
|
|
35147
35204
|
* @returns A validator function that validates input data
|
|
35148
35205
|
*/
|
|
35149
|
-
getValidator(
|
|
35150
|
-
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);
|
|
35151
35208
|
return (input) => {
|
|
35152
35209
|
const valid = ajvValidator(input);
|
|
35153
35210
|
if (valid) {
|
|
@@ -35656,11 +35713,11 @@ var Server = class extends Protocol {
|
|
|
35656
35713
|
|
|
35657
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
|
|
35658
35715
|
var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
|
|
35659
|
-
function isCompletable(
|
|
35660
|
-
return !!
|
|
35716
|
+
function isCompletable(schema2) {
|
|
35717
|
+
return !!schema2 && typeof schema2 === "object" && COMPLETABLE_SYMBOL in schema2;
|
|
35661
35718
|
}
|
|
35662
|
-
function getCompleter(
|
|
35663
|
-
const meta3 =
|
|
35719
|
+
function getCompleter(schema2) {
|
|
35720
|
+
const meta3 = schema2[COMPLETABLE_SYMBOL];
|
|
35664
35721
|
return meta3?.complete;
|
|
35665
35722
|
}
|
|
35666
35723
|
var McpZodTypeKind;
|
|
@@ -36476,17 +36533,17 @@ function isZodRawShapeCompat(obj) {
|
|
|
36476
36533
|
}
|
|
36477
36534
|
return Object.values(obj).some(isZodTypeLike);
|
|
36478
36535
|
}
|
|
36479
|
-
function getZodSchemaObject(
|
|
36480
|
-
if (!
|
|
36536
|
+
function getZodSchemaObject(schema2) {
|
|
36537
|
+
if (!schema2) {
|
|
36481
36538
|
return void 0;
|
|
36482
36539
|
}
|
|
36483
|
-
if (isZodRawShapeCompat(
|
|
36484
|
-
return objectFromShape(
|
|
36540
|
+
if (isZodRawShapeCompat(schema2)) {
|
|
36541
|
+
return objectFromShape(schema2);
|
|
36485
36542
|
}
|
|
36486
|
-
return
|
|
36543
|
+
return schema2;
|
|
36487
36544
|
}
|
|
36488
|
-
function promptArgumentsFromSchema(
|
|
36489
|
-
const shape = getObjectShape(
|
|
36545
|
+
function promptArgumentsFromSchema(schema2) {
|
|
36546
|
+
const shape = getObjectShape(schema2);
|
|
36490
36547
|
if (!shape)
|
|
36491
36548
|
return [];
|
|
36492
36549
|
return Object.entries(shape).map(([name, field]) => {
|
|
@@ -36499,8 +36556,8 @@ function promptArgumentsFromSchema(schema) {
|
|
|
36499
36556
|
};
|
|
36500
36557
|
});
|
|
36501
36558
|
}
|
|
36502
|
-
function getMethodValue(
|
|
36503
|
-
const shape = getObjectShape(
|
|
36559
|
+
function getMethodValue(schema2) {
|
|
36560
|
+
const shape = getObjectShape(schema2);
|
|
36504
36561
|
const methodSchema = shape?.method;
|
|
36505
36562
|
if (!methodSchema) {
|
|
36506
36563
|
throw new Error("Schema is missing a method literal");
|
|
@@ -36654,7 +36711,7 @@ async function mcp() {
|
|
|
36654
36711
|
setMcpMode();
|
|
36655
36712
|
const server = new McpServer({
|
|
36656
36713
|
name: "reporting-bi",
|
|
36657
|
-
version: "0.1.
|
|
36714
|
+
version: "0.1.17"
|
|
36658
36715
|
});
|
|
36659
36716
|
server.tool(
|
|
36660
36717
|
"status",
|
|
@@ -37195,8 +37252,8 @@ async function checkForUpdate() {
|
|
|
37195
37252
|
saveUpdateCheck({ lastCheck: now });
|
|
37196
37253
|
const latest = await fetchLatestVersion();
|
|
37197
37254
|
if (!latest) return;
|
|
37198
|
-
if (!isNewer(latest, "0.1.
|
|
37199
|
-
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`);
|
|
37200
37257
|
(0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: ["ignore", 2, 2] });
|
|
37201
37258
|
console.error(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
37202
37259
|
} catch {
|
|
@@ -37208,11 +37265,11 @@ async function forceUpdate() {
|
|
|
37208
37265
|
console.error("Could not fetch latest version from npm.");
|
|
37209
37266
|
process.exit(1);
|
|
37210
37267
|
}
|
|
37211
|
-
if (!isNewer(latest, "0.1.
|
|
37212
|
-
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"}).`);
|
|
37213
37270
|
return;
|
|
37214
37271
|
}
|
|
37215
|
-
console.log(`Updating ${PACKAGE_NAME} ${"0.1.
|
|
37272
|
+
console.log(`Updating ${PACKAGE_NAME} ${"0.1.17"} \u2192 ${latest}...`);
|
|
37216
37273
|
(0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
|
|
37217
37274
|
console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
37218
37275
|
saveUpdateCheck({ lastCheck: Date.now() });
|
|
@@ -37256,6 +37313,7 @@ ETL:
|
|
|
37256
37313
|
etl abort <spid> Abort a running exec (exec reports "rpbi: spid <n>" on stderr)
|
|
37257
37314
|
etl search <query> Search threads
|
|
37258
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)
|
|
37259
37317
|
etl pull [--dir <path>] [--no-context] Pull all ETL threads, parameters, metadata & schema to local files
|
|
37260
37318
|
etl push [files...] [--dir <path>] [--force] Push modified/new .sql files back to server
|
|
37261
37319
|
etl status [--dir <path>] [--remote] [--json] Show local changes (--remote compares with server)
|
|
@@ -37353,12 +37411,12 @@ Global options:
|
|
|
37353
37411
|
--filter <expression> Filter results (server-side where clause)
|
|
37354
37412
|
--verbose Show API request URLs for debugging
|
|
37355
37413
|
|
|
37356
|
-
Default domain: https://reporting.
|
|
37414
|
+
Default domain: https://bi.reporting.eu
|
|
37357
37415
|
Default language: cs
|
|
37358
37416
|
|
|
37359
37417
|
Examples:
|
|
37360
|
-
rpbi login https://reporting.
|
|
37361
|
-
rpbi use https://reporting.
|
|
37418
|
+
rpbi login https://bi.reporting.eu --accounting 100000
|
|
37419
|
+
rpbi use https://bi.reporting.eu --accounting 100000
|
|
37362
37420
|
rpbi status
|
|
37363
37421
|
|
|
37364
37422
|
rpbi etl list
|
|
@@ -37406,7 +37464,7 @@ Examples:
|
|
|
37406
37464
|
(async () => {
|
|
37407
37465
|
const [command, ...args] = process.argv.slice(2);
|
|
37408
37466
|
if (command === "--version" || command === "-v") {
|
|
37409
|
-
console.log("0.1.
|
|
37467
|
+
console.log("0.1.17");
|
|
37410
37468
|
return;
|
|
37411
37469
|
}
|
|
37412
37470
|
await checkForUpdate();
|
|
@@ -37475,6 +37533,11 @@ Examples:
|
|
|
37475
37533
|
init(args);
|
|
37476
37534
|
break;
|
|
37477
37535
|
default:
|
|
37536
|
+
if (command) {
|
|
37537
|
+
console.error(`Unknown command: ${command}. Run rpbi without arguments for usage.`);
|
|
37538
|
+
process.exitCode = 1;
|
|
37539
|
+
break;
|
|
37540
|
+
}
|
|
37478
37541
|
printLogo();
|
|
37479
37542
|
console.log();
|
|
37480
37543
|
console.log(USAGE_default);
|