@reporting-bi/cli 0.1.16 → 0.1.18
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 +759 -689
- 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");
|
|
@@ -9458,6 +9458,28 @@ var ReportingAuthClient = class {
|
|
|
9458
9458
|
throw new ReportingAuthClientException(err);
|
|
9459
9459
|
}
|
|
9460
9460
|
}
|
|
9461
|
+
/** SSO links of SA users to other instances (RP_SSO_LINKS of the server) */
|
|
9462
|
+
async ssoLinks(accounting2) {
|
|
9463
|
+
const serviceUrl = accountingServiceUrl(this.options.serviceUrl, accounting2);
|
|
9464
|
+
const response = await this.fetchWithAuth(`${serviceUrl}/ssoLinks`);
|
|
9465
|
+
if (!response.ok) {
|
|
9466
|
+
const err = await response.json();
|
|
9467
|
+
throw new ReportingAuthClientException(err);
|
|
9468
|
+
}
|
|
9469
|
+
return await response.json();
|
|
9470
|
+
}
|
|
9471
|
+
/** URL that signs the current SA user in to the instance of an SSO link; valid for a few minutes */
|
|
9472
|
+
async ssoLinkUrl(id, accounting2) {
|
|
9473
|
+
const serviceUrl = accountingServiceUrl(this.options.serviceUrl, accounting2);
|
|
9474
|
+
const response = await this.fetchWithAuth(`${serviceUrl}/ssoLinks/${id}`, {
|
|
9475
|
+
method: "POST"
|
|
9476
|
+
});
|
|
9477
|
+
if (!response.ok) {
|
|
9478
|
+
const err = await response.json();
|
|
9479
|
+
throw new ReportingAuthClientException(err);
|
|
9480
|
+
}
|
|
9481
|
+
return (await response.json()).url;
|
|
9482
|
+
}
|
|
9461
9483
|
async log(action, data = {}, accounting2) {
|
|
9462
9484
|
await this.fetchWithAuth(`${this.options.serviceUrl}/log`, {
|
|
9463
9485
|
method: "POST",
|
|
@@ -10325,7 +10347,8 @@ async function accounting(args) {
|
|
|
10325
10347
|
case "list":
|
|
10326
10348
|
return list(flags);
|
|
10327
10349
|
default:
|
|
10328
|
-
console.
|
|
10350
|
+
console.error("Usage: rpbi accounting <list>");
|
|
10351
|
+
process.exitCode = 1;
|
|
10329
10352
|
break;
|
|
10330
10353
|
}
|
|
10331
10354
|
}
|
|
@@ -11477,7 +11500,8 @@ async function wiki(args) {
|
|
|
11477
11500
|
case "watch":
|
|
11478
11501
|
return watch3(flags);
|
|
11479
11502
|
default:
|
|
11480
|
-
console.
|
|
11503
|
+
console.error("Usage: rpbi wiki <list|get|read|search|save|delete|pull|push|status|watch> [options]");
|
|
11504
|
+
process.exitCode = 1;
|
|
11481
11505
|
break;
|
|
11482
11506
|
}
|
|
11483
11507
|
}
|
|
@@ -12016,6 +12040,26 @@ async function params(id, flags) {
|
|
|
12016
12040
|
output(result || [], flags);
|
|
12017
12041
|
}
|
|
12018
12042
|
}
|
|
12043
|
+
async function schema(flags) {
|
|
12044
|
+
const service = await createService("etl", { cwd: flags.dir || "." });
|
|
12045
|
+
const result = await service.get("schema/catalog", flags.version ? { version: flags.version } : void 0).catch((err) => fail(err, "Database objects not loaded"));
|
|
12046
|
+
if (flags.json) {
|
|
12047
|
+
output(result, flags);
|
|
12048
|
+
return;
|
|
12049
|
+
}
|
|
12050
|
+
if (!result?.databases) {
|
|
12051
|
+
console.log(`No change since version ${result?.version ?? "?"}.`);
|
|
12052
|
+
return;
|
|
12053
|
+
}
|
|
12054
|
+
console.log(`Version ${result.version}`);
|
|
12055
|
+
output(Object.entries(result.databases).map(([database, objects]) => ({
|
|
12056
|
+
database,
|
|
12057
|
+
tables: objects.tables.length,
|
|
12058
|
+
views: objects.views.length,
|
|
12059
|
+
procedures: objects.procedures.length,
|
|
12060
|
+
functions: objects.functions.length
|
|
12061
|
+
})), flags);
|
|
12062
|
+
}
|
|
12019
12063
|
async function etl(args) {
|
|
12020
12064
|
const { positional, flags } = parseArgs(args);
|
|
12021
12065
|
const [subcommand, ...rest] = positional;
|
|
@@ -12064,6 +12108,8 @@ async function etl(args) {
|
|
|
12064
12108
|
process.exit(1);
|
|
12065
12109
|
}
|
|
12066
12110
|
return params(rest[0], flags);
|
|
12111
|
+
case "schema":
|
|
12112
|
+
return schema(flags);
|
|
12067
12113
|
case "pull":
|
|
12068
12114
|
return pull2(flags);
|
|
12069
12115
|
case "push":
|
|
@@ -12075,7 +12121,8 @@ async function etl(args) {
|
|
|
12075
12121
|
case "watch":
|
|
12076
12122
|
return watch4(flags);
|
|
12077
12123
|
default:
|
|
12078
|
-
console.
|
|
12124
|
+
console.error("Usage: rpbi etl <list|get|content|exec|parse|abort|search|params|schema|pull|push|context|status|watch> [options]");
|
|
12125
|
+
process.exitCode = 1;
|
|
12079
12126
|
break;
|
|
12080
12127
|
}
|
|
12081
12128
|
}
|
|
@@ -12240,6 +12287,16 @@ async function push3(flags, files) {
|
|
|
12240
12287
|
return;
|
|
12241
12288
|
}
|
|
12242
12289
|
console.log(`Pushing ${filesToPush.length} file(s)...`);
|
|
12290
|
+
const refreshServerDate = async (idThread, accounting2) => {
|
|
12291
|
+
try {
|
|
12292
|
+
const meta3 = await service.get(`threads/${idThread}`, { fields: ["date_created"], accounting: accounting2 });
|
|
12293
|
+
if (!meta3?.date_created) return;
|
|
12294
|
+
for (const e of index) {
|
|
12295
|
+
if (e.id_thread === idThread) e.serverDate = meta3.date_created;
|
|
12296
|
+
}
|
|
12297
|
+
} catch {
|
|
12298
|
+
}
|
|
12299
|
+
};
|
|
12243
12300
|
for (const relPath of filesToPush) {
|
|
12244
12301
|
const absPath = path6.join(root, relPath);
|
|
12245
12302
|
const entry = indexMap.get(relPath);
|
|
@@ -12285,11 +12342,7 @@ async function push3(flags, files) {
|
|
|
12285
12342
|
}
|
|
12286
12343
|
await service.patch(endpoint, localContent, { accounting: entryAccounting(entry) });
|
|
12287
12344
|
entry.hash = computeHash(localContent);
|
|
12288
|
-
|
|
12289
|
-
const meta3 = await service.get(`threads/${entry.id_thread}`, { fields: ["date_created"] });
|
|
12290
|
-
if (meta3?.date_created) entry.serverDate = meta3.date_created;
|
|
12291
|
-
} catch {
|
|
12292
|
-
}
|
|
12345
|
+
await refreshServerDate(entry.id_thread, entryAccounting(entry));
|
|
12293
12346
|
console.log(` Updated: ${relPath}`);
|
|
12294
12347
|
} else if (isDoc) {
|
|
12295
12348
|
const sqlPath = relPath.replace(/\.md$/i, ".sql");
|
|
@@ -12299,7 +12352,7 @@ async function push3(flags, files) {
|
|
|
12299
12352
|
continue;
|
|
12300
12353
|
}
|
|
12301
12354
|
await service.patch(`threads/${sqlEntry.id_thread}/doc`, localContent, { accounting: entryAccounting(sqlEntry) });
|
|
12302
|
-
|
|
12355
|
+
const docEntry = {
|
|
12303
12356
|
path: relPath,
|
|
12304
12357
|
id_thread: sqlEntry.id_thread,
|
|
12305
12358
|
kind: "doc",
|
|
@@ -12307,7 +12360,10 @@ async function push3(flags, files) {
|
|
|
12307
12360
|
type: sqlEntry.type,
|
|
12308
12361
|
accounting: sqlEntry.accounting,
|
|
12309
12362
|
serverDate: sqlEntry.serverDate
|
|
12310
|
-
}
|
|
12363
|
+
};
|
|
12364
|
+
index.push(docEntry);
|
|
12365
|
+
indexMap.set(relPath, docEntry);
|
|
12366
|
+
await refreshServerDate(sqlEntry.id_thread, entryAccounting(sqlEntry));
|
|
12311
12367
|
console.log(` Created doc: ${relPath} (thread #${sqlEntry.id_thread})`);
|
|
12312
12368
|
} else {
|
|
12313
12369
|
const parts = relPath.split("/");
|
|
@@ -12535,7 +12591,8 @@ async function deployment(args) {
|
|
|
12535
12591
|
case "watch":
|
|
12536
12592
|
return watch5(flags);
|
|
12537
12593
|
default:
|
|
12538
|
-
console.
|
|
12594
|
+
console.error("Usage: rpbi deployment <list|get|content|doc|exec|parse|pull|push|status|watch> [options]");
|
|
12595
|
+
process.exitCode = 1;
|
|
12539
12596
|
break;
|
|
12540
12597
|
}
|
|
12541
12598
|
}
|
|
@@ -13148,7 +13205,8 @@ async function ext(args) {
|
|
|
13148
13205
|
case "watch":
|
|
13149
13206
|
return watch6(flags);
|
|
13150
13207
|
default:
|
|
13151
|
-
console.
|
|
13208
|
+
console.error("Usage: rpbi ext <projects|resources|queries|content|exec|parse|abort|params|deps|pull|push|status|watch> [options]");
|
|
13209
|
+
process.exitCode = 1;
|
|
13152
13210
|
break;
|
|
13153
13211
|
}
|
|
13154
13212
|
}
|
|
@@ -13197,7 +13255,8 @@ async function jobs(args) {
|
|
|
13197
13255
|
case "status":
|
|
13198
13256
|
return statusCmd(flags);
|
|
13199
13257
|
default:
|
|
13200
|
-
console.
|
|
13258
|
+
console.error("Usage: rpbi jobs <list|start|stop|status> [options]");
|
|
13259
|
+
process.exitCode = 1;
|
|
13201
13260
|
break;
|
|
13202
13261
|
}
|
|
13203
13262
|
}
|
|
@@ -13226,7 +13285,8 @@ async function context2(args) {
|
|
|
13226
13285
|
output(ctx, flags);
|
|
13227
13286
|
break;
|
|
13228
13287
|
default:
|
|
13229
|
-
console.
|
|
13288
|
+
console.error("Usage: rpbi context <list|get> [options]");
|
|
13289
|
+
process.exitCode = 1;
|
|
13230
13290
|
break;
|
|
13231
13291
|
}
|
|
13232
13292
|
}
|
|
@@ -13299,7 +13359,8 @@ async function users(args) {
|
|
|
13299
13359
|
case "roles":
|
|
13300
13360
|
return roles(flags);
|
|
13301
13361
|
default:
|
|
13302
|
-
console.
|
|
13362
|
+
console.error("Usage: rpbi users <list|get|me|rights|roles> [options]");
|
|
13363
|
+
process.exitCode = 1;
|
|
13303
13364
|
break;
|
|
13304
13365
|
}
|
|
13305
13366
|
}
|
|
@@ -13364,7 +13425,8 @@ async function def(args) {
|
|
|
13364
13425
|
case "fiscal-years":
|
|
13365
13426
|
return fiscalYears(flags);
|
|
13366
13427
|
default:
|
|
13367
|
-
console.
|
|
13428
|
+
console.error("Usage: rpbi def <statements|statement|dimensions|modules|scenarios|fiscal-years> [options]");
|
|
13429
|
+
process.exitCode = 1;
|
|
13368
13430
|
break;
|
|
13369
13431
|
}
|
|
13370
13432
|
}
|
|
@@ -13428,7 +13490,8 @@ async function mdm(args) {
|
|
|
13428
13490
|
}
|
|
13429
13491
|
return exportCsv(rest[0], flags);
|
|
13430
13492
|
default:
|
|
13431
|
-
console.
|
|
13493
|
+
console.error("Usage: rpbi mdm <tables|table|columns|values|export> [options]");
|
|
13494
|
+
process.exitCode = 1;
|
|
13432
13495
|
break;
|
|
13433
13496
|
}
|
|
13434
13497
|
}
|
|
@@ -13488,7 +13551,8 @@ async function helpdesk(args) {
|
|
|
13488
13551
|
case "create":
|
|
13489
13552
|
return create(flags);
|
|
13490
13553
|
default:
|
|
13491
|
-
console.
|
|
13554
|
+
console.error("Usage: rpbi helpdesk <list|get|messages|create> [options]");
|
|
13555
|
+
process.exitCode = 1;
|
|
13492
13556
|
break;
|
|
13493
13557
|
}
|
|
13494
13558
|
}
|
|
@@ -15705,9 +15769,9 @@ var ZodArray = class _ZodArray extends ZodType {
|
|
|
15705
15769
|
return this.min(1, message);
|
|
15706
15770
|
}
|
|
15707
15771
|
};
|
|
15708
|
-
ZodArray.create = (
|
|
15772
|
+
ZodArray.create = (schema2, params3) => {
|
|
15709
15773
|
return new ZodArray({
|
|
15710
|
-
type:
|
|
15774
|
+
type: schema2,
|
|
15711
15775
|
minLength: null,
|
|
15712
15776
|
maxLength: null,
|
|
15713
15777
|
exactLength: null,
|
|
@@ -15715,30 +15779,30 @@ ZodArray.create = (schema, params3) => {
|
|
|
15715
15779
|
...processCreateParams(params3)
|
|
15716
15780
|
});
|
|
15717
15781
|
};
|
|
15718
|
-
function deepPartialify(
|
|
15719
|
-
if (
|
|
15782
|
+
function deepPartialify(schema2) {
|
|
15783
|
+
if (schema2 instanceof ZodObject) {
|
|
15720
15784
|
const newShape = {};
|
|
15721
|
-
for (const key in
|
|
15722
|
-
const fieldSchema =
|
|
15785
|
+
for (const key in schema2.shape) {
|
|
15786
|
+
const fieldSchema = schema2.shape[key];
|
|
15723
15787
|
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
|
15724
15788
|
}
|
|
15725
15789
|
return new ZodObject({
|
|
15726
|
-
...
|
|
15790
|
+
...schema2._def,
|
|
15727
15791
|
shape: () => newShape
|
|
15728
15792
|
});
|
|
15729
|
-
} else if (
|
|
15793
|
+
} else if (schema2 instanceof ZodArray) {
|
|
15730
15794
|
return new ZodArray({
|
|
15731
|
-
...
|
|
15732
|
-
type: deepPartialify(
|
|
15795
|
+
...schema2._def,
|
|
15796
|
+
type: deepPartialify(schema2.element)
|
|
15733
15797
|
});
|
|
15734
|
-
} else if (
|
|
15735
|
-
return ZodOptional.create(deepPartialify(
|
|
15736
|
-
} else if (
|
|
15737
|
-
return ZodNullable.create(deepPartialify(
|
|
15738
|
-
} else if (
|
|
15739
|
-
return ZodTuple.create(
|
|
15798
|
+
} else if (schema2 instanceof ZodOptional) {
|
|
15799
|
+
return ZodOptional.create(deepPartialify(schema2.unwrap()));
|
|
15800
|
+
} else if (schema2 instanceof ZodNullable) {
|
|
15801
|
+
return ZodNullable.create(deepPartialify(schema2.unwrap()));
|
|
15802
|
+
} else if (schema2 instanceof ZodTuple) {
|
|
15803
|
+
return ZodTuple.create(schema2.items.map((item) => deepPartialify(item)));
|
|
15740
15804
|
} else {
|
|
15741
|
-
return
|
|
15805
|
+
return schema2;
|
|
15742
15806
|
}
|
|
15743
15807
|
}
|
|
15744
15808
|
var ZodObject = class _ZodObject extends ZodType {
|
|
@@ -15954,8 +16018,8 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
15954
16018
|
// }) as any;
|
|
15955
16019
|
// return merged;
|
|
15956
16020
|
// }
|
|
15957
|
-
setKey(key,
|
|
15958
|
-
return this.augment({ [key]:
|
|
16021
|
+
setKey(key, schema2) {
|
|
16022
|
+
return this.augment({ [key]: schema2 });
|
|
15959
16023
|
}
|
|
15960
16024
|
// merge<Incoming extends AnyZodObject>(
|
|
15961
16025
|
// merging: Incoming
|
|
@@ -16401,10 +16465,10 @@ var ZodTuple = class _ZodTuple extends ZodType {
|
|
|
16401
16465
|
status6.dirty();
|
|
16402
16466
|
}
|
|
16403
16467
|
const items = [...ctx.data].map((item, itemIndex) => {
|
|
16404
|
-
const
|
|
16405
|
-
if (!
|
|
16468
|
+
const schema2 = this._def.items[itemIndex] || this._def.rest;
|
|
16469
|
+
if (!schema2)
|
|
16406
16470
|
return null;
|
|
16407
|
-
return
|
|
16471
|
+
return schema2._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
|
16408
16472
|
}).filter((x) => !!x);
|
|
16409
16473
|
if (ctx.common.async) {
|
|
16410
16474
|
return Promise.all(items).then((results) => {
|
|
@@ -16918,9 +16982,9 @@ var ZodPromise = class extends ZodType {
|
|
|
16918
16982
|
}));
|
|
16919
16983
|
}
|
|
16920
16984
|
};
|
|
16921
|
-
ZodPromise.create = (
|
|
16985
|
+
ZodPromise.create = (schema2, params3) => {
|
|
16922
16986
|
return new ZodPromise({
|
|
16923
|
-
type:
|
|
16987
|
+
type: schema2,
|
|
16924
16988
|
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
16925
16989
|
...processCreateParams(params3)
|
|
16926
16990
|
});
|
|
@@ -17048,17 +17112,17 @@ var ZodEffects = class extends ZodType {
|
|
|
17048
17112
|
util.assertNever(effect);
|
|
17049
17113
|
}
|
|
17050
17114
|
};
|
|
17051
|
-
ZodEffects.create = (
|
|
17115
|
+
ZodEffects.create = (schema2, effect, params3) => {
|
|
17052
17116
|
return new ZodEffects({
|
|
17053
|
-
schema,
|
|
17117
|
+
schema: schema2,
|
|
17054
17118
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
17055
17119
|
effect,
|
|
17056
17120
|
...processCreateParams(params3)
|
|
17057
17121
|
});
|
|
17058
17122
|
};
|
|
17059
|
-
ZodEffects.createWithPreprocess = (preprocess2,
|
|
17123
|
+
ZodEffects.createWithPreprocess = (preprocess2, schema2, params3) => {
|
|
17060
17124
|
return new ZodEffects({
|
|
17061
|
-
schema,
|
|
17125
|
+
schema: schema2,
|
|
17062
17126
|
effect: { type: "preprocess", transform: preprocess2 },
|
|
17063
17127
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
17064
17128
|
...processCreateParams(params3)
|
|
@@ -17893,8 +17957,8 @@ function mergeDefs(...defs) {
|
|
|
17893
17957
|
}
|
|
17894
17958
|
return Object.defineProperties({}, mergedDescriptors);
|
|
17895
17959
|
}
|
|
17896
|
-
function cloneDef(
|
|
17897
|
-
return mergeDefs(
|
|
17960
|
+
function cloneDef(schema2) {
|
|
17961
|
+
return mergeDefs(schema2._zod.def);
|
|
17898
17962
|
}
|
|
17899
17963
|
function getElementAtPath(obj, path9) {
|
|
17900
17964
|
if (!path9)
|
|
@@ -18102,14 +18166,14 @@ var BIGINT_FORMAT_RANGES = {
|
|
|
18102
18166
|
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
18103
18167
|
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
18104
18168
|
};
|
|
18105
|
-
function pick(
|
|
18106
|
-
const currDef =
|
|
18169
|
+
function pick(schema2, mask) {
|
|
18170
|
+
const currDef = schema2._zod.def;
|
|
18107
18171
|
const checks = currDef.checks;
|
|
18108
18172
|
const hasChecks = checks && checks.length > 0;
|
|
18109
18173
|
if (hasChecks) {
|
|
18110
18174
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
18111
18175
|
}
|
|
18112
|
-
const def2 = mergeDefs(
|
|
18176
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18113
18177
|
get shape() {
|
|
18114
18178
|
const newShape = {};
|
|
18115
18179
|
for (const key in mask) {
|
|
@@ -18125,18 +18189,18 @@ function pick(schema, mask) {
|
|
|
18125
18189
|
},
|
|
18126
18190
|
checks: []
|
|
18127
18191
|
});
|
|
18128
|
-
return clone(
|
|
18192
|
+
return clone(schema2, def2);
|
|
18129
18193
|
}
|
|
18130
|
-
function omit(
|
|
18131
|
-
const currDef =
|
|
18194
|
+
function omit(schema2, mask) {
|
|
18195
|
+
const currDef = schema2._zod.def;
|
|
18132
18196
|
const checks = currDef.checks;
|
|
18133
18197
|
const hasChecks = checks && checks.length > 0;
|
|
18134
18198
|
if (hasChecks) {
|
|
18135
18199
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
18136
18200
|
}
|
|
18137
|
-
const def2 = mergeDefs(
|
|
18201
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18138
18202
|
get shape() {
|
|
18139
|
-
const newShape = { ...
|
|
18203
|
+
const newShape = { ...schema2._zod.def.shape };
|
|
18140
18204
|
for (const key in mask) {
|
|
18141
18205
|
if (!(key in currDef.shape)) {
|
|
18142
18206
|
throw new Error(`Unrecognized key: "${key}"`);
|
|
@@ -18150,43 +18214,43 @@ function omit(schema, mask) {
|
|
|
18150
18214
|
},
|
|
18151
18215
|
checks: []
|
|
18152
18216
|
});
|
|
18153
|
-
return clone(
|
|
18217
|
+
return clone(schema2, def2);
|
|
18154
18218
|
}
|
|
18155
|
-
function extend(
|
|
18219
|
+
function extend(schema2, shape) {
|
|
18156
18220
|
if (!isPlainObject(shape)) {
|
|
18157
18221
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
18158
18222
|
}
|
|
18159
|
-
const checks =
|
|
18223
|
+
const checks = schema2._zod.def.checks;
|
|
18160
18224
|
const hasChecks = checks && checks.length > 0;
|
|
18161
18225
|
if (hasChecks) {
|
|
18162
|
-
const existingShape =
|
|
18226
|
+
const existingShape = schema2._zod.def.shape;
|
|
18163
18227
|
for (const key in shape) {
|
|
18164
18228
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
18165
18229
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
18166
18230
|
}
|
|
18167
18231
|
}
|
|
18168
18232
|
}
|
|
18169
|
-
const def2 = mergeDefs(
|
|
18233
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18170
18234
|
get shape() {
|
|
18171
|
-
const _shape = { ...
|
|
18235
|
+
const _shape = { ...schema2._zod.def.shape, ...shape };
|
|
18172
18236
|
assignProp(this, "shape", _shape);
|
|
18173
18237
|
return _shape;
|
|
18174
18238
|
}
|
|
18175
18239
|
});
|
|
18176
|
-
return clone(
|
|
18240
|
+
return clone(schema2, def2);
|
|
18177
18241
|
}
|
|
18178
|
-
function safeExtend(
|
|
18242
|
+
function safeExtend(schema2, shape) {
|
|
18179
18243
|
if (!isPlainObject(shape)) {
|
|
18180
18244
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
18181
18245
|
}
|
|
18182
|
-
const def2 = mergeDefs(
|
|
18246
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18183
18247
|
get shape() {
|
|
18184
|
-
const _shape = { ...
|
|
18248
|
+
const _shape = { ...schema2._zod.def.shape, ...shape };
|
|
18185
18249
|
assignProp(this, "shape", _shape);
|
|
18186
18250
|
return _shape;
|
|
18187
18251
|
}
|
|
18188
18252
|
});
|
|
18189
|
-
return clone(
|
|
18253
|
+
return clone(schema2, def2);
|
|
18190
18254
|
}
|
|
18191
18255
|
function merge(a, b) {
|
|
18192
18256
|
const def2 = mergeDefs(a._zod.def, {
|
|
@@ -18203,16 +18267,16 @@ function merge(a, b) {
|
|
|
18203
18267
|
});
|
|
18204
18268
|
return clone(a, def2);
|
|
18205
18269
|
}
|
|
18206
|
-
function partial(Class2,
|
|
18207
|
-
const currDef =
|
|
18270
|
+
function partial(Class2, schema2, mask) {
|
|
18271
|
+
const currDef = schema2._zod.def;
|
|
18208
18272
|
const checks = currDef.checks;
|
|
18209
18273
|
const hasChecks = checks && checks.length > 0;
|
|
18210
18274
|
if (hasChecks) {
|
|
18211
18275
|
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
18212
18276
|
}
|
|
18213
|
-
const def2 = mergeDefs(
|
|
18277
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18214
18278
|
get shape() {
|
|
18215
|
-
const oldShape =
|
|
18279
|
+
const oldShape = schema2._zod.def.shape;
|
|
18216
18280
|
const shape = { ...oldShape };
|
|
18217
18281
|
if (mask) {
|
|
18218
18282
|
for (const key in mask) {
|
|
@@ -18239,12 +18303,12 @@ function partial(Class2, schema, mask) {
|
|
|
18239
18303
|
},
|
|
18240
18304
|
checks: []
|
|
18241
18305
|
});
|
|
18242
|
-
return clone(
|
|
18306
|
+
return clone(schema2, def2);
|
|
18243
18307
|
}
|
|
18244
|
-
function required(Class2,
|
|
18245
|
-
const def2 = mergeDefs(
|
|
18308
|
+
function required(Class2, schema2, mask) {
|
|
18309
|
+
const def2 = mergeDefs(schema2._zod.def, {
|
|
18246
18310
|
get shape() {
|
|
18247
|
-
const oldShape =
|
|
18311
|
+
const oldShape = schema2._zod.def.shape;
|
|
18248
18312
|
const shape = { ...oldShape };
|
|
18249
18313
|
if (mask) {
|
|
18250
18314
|
for (const key in mask) {
|
|
@@ -18270,7 +18334,7 @@ function required(Class2, schema, mask) {
|
|
|
18270
18334
|
return shape;
|
|
18271
18335
|
}
|
|
18272
18336
|
});
|
|
18273
|
-
return clone(
|
|
18337
|
+
return clone(schema2, def2);
|
|
18274
18338
|
}
|
|
18275
18339
|
function aborted(x, startIndex = 0) {
|
|
18276
18340
|
if (x.aborted === true)
|
|
@@ -18539,9 +18603,9 @@ function prettifyError(error48) {
|
|
|
18539
18603
|
}
|
|
18540
18604
|
|
|
18541
18605
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/core/parse.js
|
|
18542
|
-
var _parse = (_Err) => (
|
|
18606
|
+
var _parse = (_Err) => (schema2, value, _ctx, _params) => {
|
|
18543
18607
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
18544
|
-
const result =
|
|
18608
|
+
const result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18545
18609
|
if (result instanceof Promise) {
|
|
18546
18610
|
throw new $ZodAsyncError();
|
|
18547
18611
|
}
|
|
@@ -18553,9 +18617,9 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
18553
18617
|
return result.value;
|
|
18554
18618
|
};
|
|
18555
18619
|
var parse4 = /* @__PURE__ */ _parse($ZodRealError);
|
|
18556
|
-
var _parseAsync = (_Err) => async (
|
|
18620
|
+
var _parseAsync = (_Err) => async (schema2, value, _ctx, params3) => {
|
|
18557
18621
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
18558
|
-
let result =
|
|
18622
|
+
let result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18559
18623
|
if (result instanceof Promise)
|
|
18560
18624
|
result = await result;
|
|
18561
18625
|
if (result.issues.length) {
|
|
@@ -18566,9 +18630,9 @@ var _parseAsync = (_Err) => async (schema, value, _ctx, params3) => {
|
|
|
18566
18630
|
return result.value;
|
|
18567
18631
|
};
|
|
18568
18632
|
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
18569
|
-
var _safeParse = (_Err) => (
|
|
18633
|
+
var _safeParse = (_Err) => (schema2, value, _ctx) => {
|
|
18570
18634
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
18571
|
-
const result =
|
|
18635
|
+
const result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18572
18636
|
if (result instanceof Promise) {
|
|
18573
18637
|
throw new $ZodAsyncError();
|
|
18574
18638
|
}
|
|
@@ -18578,9 +18642,9 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
18578
18642
|
} : { success: true, data: result.value };
|
|
18579
18643
|
};
|
|
18580
18644
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
18581
|
-
var _safeParseAsync = (_Err) => async (
|
|
18645
|
+
var _safeParseAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18582
18646
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
18583
|
-
let result =
|
|
18647
|
+
let result = schema2._zod.run({ value, issues: [] }, ctx);
|
|
18584
18648
|
if (result instanceof Promise)
|
|
18585
18649
|
result = await result;
|
|
18586
18650
|
return result.issues.length ? {
|
|
@@ -18589,40 +18653,40 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
18589
18653
|
} : { success: true, data: result.value };
|
|
18590
18654
|
};
|
|
18591
18655
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
18592
|
-
var _encode = (_Err) => (
|
|
18656
|
+
var _encode = (_Err) => (schema2, value, _ctx) => {
|
|
18593
18657
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18594
|
-
return _parse(_Err)(
|
|
18658
|
+
return _parse(_Err)(schema2, value, ctx);
|
|
18595
18659
|
};
|
|
18596
18660
|
var encode = /* @__PURE__ */ _encode($ZodRealError);
|
|
18597
|
-
var _decode = (_Err) => (
|
|
18598
|
-
return _parse(_Err)(
|
|
18661
|
+
var _decode = (_Err) => (schema2, value, _ctx) => {
|
|
18662
|
+
return _parse(_Err)(schema2, value, _ctx);
|
|
18599
18663
|
};
|
|
18600
18664
|
var decode = /* @__PURE__ */ _decode($ZodRealError);
|
|
18601
|
-
var _encodeAsync = (_Err) => async (
|
|
18665
|
+
var _encodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18602
18666
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18603
|
-
return _parseAsync(_Err)(
|
|
18667
|
+
return _parseAsync(_Err)(schema2, value, ctx);
|
|
18604
18668
|
};
|
|
18605
18669
|
var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
18606
|
-
var _decodeAsync = (_Err) => async (
|
|
18607
|
-
return _parseAsync(_Err)(
|
|
18670
|
+
var _decodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18671
|
+
return _parseAsync(_Err)(schema2, value, _ctx);
|
|
18608
18672
|
};
|
|
18609
18673
|
var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
18610
|
-
var _safeEncode = (_Err) => (
|
|
18674
|
+
var _safeEncode = (_Err) => (schema2, value, _ctx) => {
|
|
18611
18675
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18612
|
-
return _safeParse(_Err)(
|
|
18676
|
+
return _safeParse(_Err)(schema2, value, ctx);
|
|
18613
18677
|
};
|
|
18614
18678
|
var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
18615
|
-
var _safeDecode = (_Err) => (
|
|
18616
|
-
return _safeParse(_Err)(
|
|
18679
|
+
var _safeDecode = (_Err) => (schema2, value, _ctx) => {
|
|
18680
|
+
return _safeParse(_Err)(schema2, value, _ctx);
|
|
18617
18681
|
};
|
|
18618
18682
|
var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
18619
|
-
var _safeEncodeAsync = (_Err) => async (
|
|
18683
|
+
var _safeEncodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18620
18684
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
18621
|
-
return _safeParseAsync(_Err)(
|
|
18685
|
+
return _safeParseAsync(_Err)(schema2, value, ctx);
|
|
18622
18686
|
};
|
|
18623
18687
|
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
18624
|
-
var _safeDecodeAsync = (_Err) => async (
|
|
18625
|
-
return _safeParseAsync(_Err)(
|
|
18688
|
+
var _safeDecodeAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
18689
|
+
return _safeParseAsync(_Err)(schema2, value, _ctx);
|
|
18626
18690
|
};
|
|
18627
18691
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
18628
18692
|
|
|
@@ -20165,8 +20229,8 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def2) =
|
|
|
20165
20229
|
for (const key of normalized.keys) {
|
|
20166
20230
|
const id = ids[key];
|
|
20167
20231
|
const k = esc(key);
|
|
20168
|
-
const
|
|
20169
|
-
const isOptionalOut =
|
|
20232
|
+
const schema2 = shape[key];
|
|
20233
|
+
const isOptionalOut = schema2?._zod?.optout === "optional";
|
|
20170
20234
|
doc2.write(`const ${id} = ${parseStr(key)};`);
|
|
20171
20235
|
if (isOptionalOut) {
|
|
20172
20236
|
doc2.write(`
|
|
@@ -26931,11 +26995,11 @@ var $ZodRegistry = class {
|
|
|
26931
26995
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
26932
26996
|
this._idmap = /* @__PURE__ */ new Map();
|
|
26933
26997
|
}
|
|
26934
|
-
add(
|
|
26998
|
+
add(schema2, ..._meta) {
|
|
26935
26999
|
const meta3 = _meta[0];
|
|
26936
|
-
this._map.set(
|
|
27000
|
+
this._map.set(schema2, meta3);
|
|
26937
27001
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
26938
|
-
this._idmap.set(meta3.id,
|
|
27002
|
+
this._idmap.set(meta3.id, schema2);
|
|
26939
27003
|
}
|
|
26940
27004
|
return this;
|
|
26941
27005
|
}
|
|
@@ -26944,26 +27008,26 @@ var $ZodRegistry = class {
|
|
|
26944
27008
|
this._idmap = /* @__PURE__ */ new Map();
|
|
26945
27009
|
return this;
|
|
26946
27010
|
}
|
|
26947
|
-
remove(
|
|
26948
|
-
const meta3 = this._map.get(
|
|
27011
|
+
remove(schema2) {
|
|
27012
|
+
const meta3 = this._map.get(schema2);
|
|
26949
27013
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
26950
27014
|
this._idmap.delete(meta3.id);
|
|
26951
27015
|
}
|
|
26952
|
-
this._map.delete(
|
|
27016
|
+
this._map.delete(schema2);
|
|
26953
27017
|
return this;
|
|
26954
27018
|
}
|
|
26955
|
-
get(
|
|
26956
|
-
const p =
|
|
27019
|
+
get(schema2) {
|
|
27020
|
+
const p = schema2._zod.parent;
|
|
26957
27021
|
if (p) {
|
|
26958
27022
|
const pm = { ...this.get(p) ?? {} };
|
|
26959
27023
|
delete pm.id;
|
|
26960
|
-
const f = { ...pm, ...this._map.get(
|
|
27024
|
+
const f = { ...pm, ...this._map.get(schema2) };
|
|
26961
27025
|
return Object.keys(f).length ? f : void 0;
|
|
26962
27026
|
}
|
|
26963
|
-
return this._map.get(
|
|
27027
|
+
return this._map.get(schema2);
|
|
26964
27028
|
}
|
|
26965
|
-
has(
|
|
26966
|
-
return this._map.has(
|
|
27029
|
+
has(schema2) {
|
|
27030
|
+
return this._map.has(schema2);
|
|
26967
27031
|
}
|
|
26968
27032
|
};
|
|
26969
27033
|
function registry() {
|
|
@@ -27616,11 +27680,11 @@ function _endsWith(suffix, params3) {
|
|
|
27616
27680
|
});
|
|
27617
27681
|
}
|
|
27618
27682
|
// @__NO_SIDE_EFFECTS__
|
|
27619
|
-
function _property(property,
|
|
27683
|
+
function _property(property, schema2, params3) {
|
|
27620
27684
|
return new $ZodCheckProperty({
|
|
27621
27685
|
check: "property",
|
|
27622
27686
|
property,
|
|
27623
|
-
schema,
|
|
27687
|
+
schema: schema2,
|
|
27624
27688
|
...normalizeParams(params3)
|
|
27625
27689
|
});
|
|
27626
27690
|
}
|
|
@@ -27868,23 +27932,23 @@ function _promise(Class2, innerType) {
|
|
|
27868
27932
|
function _custom(Class2, fn, _params) {
|
|
27869
27933
|
const norm = normalizeParams(_params);
|
|
27870
27934
|
norm.abort ?? (norm.abort = true);
|
|
27871
|
-
const
|
|
27935
|
+
const schema2 = new Class2({
|
|
27872
27936
|
type: "custom",
|
|
27873
27937
|
check: "custom",
|
|
27874
27938
|
fn,
|
|
27875
27939
|
...norm
|
|
27876
27940
|
});
|
|
27877
|
-
return
|
|
27941
|
+
return schema2;
|
|
27878
27942
|
}
|
|
27879
27943
|
// @__NO_SIDE_EFFECTS__
|
|
27880
27944
|
function _refine(Class2, fn, _params) {
|
|
27881
|
-
const
|
|
27945
|
+
const schema2 = new Class2({
|
|
27882
27946
|
type: "custom",
|
|
27883
27947
|
check: "custom",
|
|
27884
27948
|
fn,
|
|
27885
27949
|
...normalizeParams(_params)
|
|
27886
27950
|
});
|
|
27887
|
-
return
|
|
27951
|
+
return schema2;
|
|
27888
27952
|
}
|
|
27889
27953
|
// @__NO_SIDE_EFFECTS__
|
|
27890
27954
|
function _superRefine(fn) {
|
|
@@ -28033,40 +28097,40 @@ function initializeContext(params3) {
|
|
|
28033
28097
|
external: params3?.external ?? void 0
|
|
28034
28098
|
};
|
|
28035
28099
|
}
|
|
28036
|
-
function process2(
|
|
28100
|
+
function process2(schema2, ctx, _params = { path: [], schemaPath: [] }) {
|
|
28037
28101
|
var _a2;
|
|
28038
|
-
const def2 =
|
|
28039
|
-
const seen = ctx.seen.get(
|
|
28102
|
+
const def2 = schema2._zod.def;
|
|
28103
|
+
const seen = ctx.seen.get(schema2);
|
|
28040
28104
|
if (seen) {
|
|
28041
28105
|
seen.count++;
|
|
28042
|
-
const isCycle = _params.schemaPath.includes(
|
|
28106
|
+
const isCycle = _params.schemaPath.includes(schema2);
|
|
28043
28107
|
if (isCycle) {
|
|
28044
28108
|
seen.cycle = _params.path;
|
|
28045
28109
|
}
|
|
28046
28110
|
return seen.schema;
|
|
28047
28111
|
}
|
|
28048
28112
|
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
28049
|
-
ctx.seen.set(
|
|
28050
|
-
const overrideSchema =
|
|
28113
|
+
ctx.seen.set(schema2, result);
|
|
28114
|
+
const overrideSchema = schema2._zod.toJSONSchema?.();
|
|
28051
28115
|
if (overrideSchema) {
|
|
28052
28116
|
result.schema = overrideSchema;
|
|
28053
28117
|
} else {
|
|
28054
28118
|
const params3 = {
|
|
28055
28119
|
..._params,
|
|
28056
|
-
schemaPath: [..._params.schemaPath,
|
|
28120
|
+
schemaPath: [..._params.schemaPath, schema2],
|
|
28057
28121
|
path: _params.path
|
|
28058
28122
|
};
|
|
28059
|
-
if (
|
|
28060
|
-
|
|
28123
|
+
if (schema2._zod.processJSONSchema) {
|
|
28124
|
+
schema2._zod.processJSONSchema(ctx, result.schema, params3);
|
|
28061
28125
|
} else {
|
|
28062
28126
|
const _json = result.schema;
|
|
28063
28127
|
const processor = ctx.processors[def2.type];
|
|
28064
28128
|
if (!processor) {
|
|
28065
28129
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def2.type}`);
|
|
28066
28130
|
}
|
|
28067
|
-
processor(
|
|
28131
|
+
processor(schema2, ctx, _json, params3);
|
|
28068
28132
|
}
|
|
28069
|
-
const parent =
|
|
28133
|
+
const parent = schema2._zod.parent;
|
|
28070
28134
|
if (parent) {
|
|
28071
28135
|
if (!result.ref)
|
|
28072
28136
|
result.ref = parent;
|
|
@@ -28074,21 +28138,21 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
28074
28138
|
ctx.seen.get(parent).isParent = true;
|
|
28075
28139
|
}
|
|
28076
28140
|
}
|
|
28077
|
-
const meta3 = ctx.metadataRegistry.get(
|
|
28141
|
+
const meta3 = ctx.metadataRegistry.get(schema2);
|
|
28078
28142
|
if (meta3)
|
|
28079
28143
|
Object.assign(result.schema, meta3);
|
|
28080
|
-
if (ctx.io === "input" && isTransforming(
|
|
28144
|
+
if (ctx.io === "input" && isTransforming(schema2)) {
|
|
28081
28145
|
delete result.schema.examples;
|
|
28082
28146
|
delete result.schema.default;
|
|
28083
28147
|
}
|
|
28084
28148
|
if (ctx.io === "input" && result.schema._prefault)
|
|
28085
28149
|
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
|
|
28086
28150
|
delete result.schema._prefault;
|
|
28087
|
-
const _result = ctx.seen.get(
|
|
28151
|
+
const _result = ctx.seen.get(schema2);
|
|
28088
28152
|
return _result.schema;
|
|
28089
28153
|
}
|
|
28090
|
-
function extractDefs(ctx,
|
|
28091
|
-
const root = ctx.seen.get(
|
|
28154
|
+
function extractDefs(ctx, schema2) {
|
|
28155
|
+
const root = ctx.seen.get(schema2);
|
|
28092
28156
|
if (!root)
|
|
28093
28157
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
28094
28158
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
@@ -28131,11 +28195,11 @@ function extractDefs(ctx, schema) {
|
|
|
28131
28195
|
seen.def = { ...seen.schema };
|
|
28132
28196
|
if (defId)
|
|
28133
28197
|
seen.defId = defId;
|
|
28134
|
-
const
|
|
28135
|
-
for (const key in
|
|
28136
|
-
delete
|
|
28198
|
+
const schema3 = seen.schema;
|
|
28199
|
+
for (const key in schema3) {
|
|
28200
|
+
delete schema3[key];
|
|
28137
28201
|
}
|
|
28138
|
-
|
|
28202
|
+
schema3.$ref = ref;
|
|
28139
28203
|
};
|
|
28140
28204
|
if (ctx.cycles === "throw") {
|
|
28141
28205
|
for (const entry of ctx.seen.entries()) {
|
|
@@ -28149,13 +28213,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
28149
28213
|
}
|
|
28150
28214
|
for (const entry of ctx.seen.entries()) {
|
|
28151
28215
|
const seen = entry[1];
|
|
28152
|
-
if (
|
|
28216
|
+
if (schema2 === entry[0]) {
|
|
28153
28217
|
extractToDef(entry);
|
|
28154
28218
|
continue;
|
|
28155
28219
|
}
|
|
28156
28220
|
if (ctx.external) {
|
|
28157
28221
|
const ext2 = ctx.external.registry.get(entry[0])?.id;
|
|
28158
|
-
if (
|
|
28222
|
+
if (schema2 !== entry[0] && ext2) {
|
|
28159
28223
|
extractToDef(entry);
|
|
28160
28224
|
continue;
|
|
28161
28225
|
}
|
|
@@ -28177,16 +28241,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
28177
28241
|
}
|
|
28178
28242
|
}
|
|
28179
28243
|
}
|
|
28180
|
-
function finalize(ctx,
|
|
28181
|
-
const root = ctx.seen.get(
|
|
28244
|
+
function finalize(ctx, schema2) {
|
|
28245
|
+
const root = ctx.seen.get(schema2);
|
|
28182
28246
|
if (!root)
|
|
28183
28247
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
28184
28248
|
const flattenRef = (zodSchema) => {
|
|
28185
28249
|
const seen = ctx.seen.get(zodSchema);
|
|
28186
28250
|
if (seen.ref === null)
|
|
28187
28251
|
return;
|
|
28188
|
-
const
|
|
28189
|
-
const _cached = { ...
|
|
28252
|
+
const schema3 = seen.def ?? seen.schema;
|
|
28253
|
+
const _cached = { ...schema3 };
|
|
28190
28254
|
const ref = seen.ref;
|
|
28191
28255
|
seen.ref = null;
|
|
28192
28256
|
if (ref) {
|
|
@@ -28194,28 +28258,28 @@ function finalize(ctx, schema) {
|
|
|
28194
28258
|
const refSeen = ctx.seen.get(ref);
|
|
28195
28259
|
const refSchema = refSeen.schema;
|
|
28196
28260
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
28197
|
-
|
|
28198
|
-
|
|
28261
|
+
schema3.allOf = schema3.allOf ?? [];
|
|
28262
|
+
schema3.allOf.push(refSchema);
|
|
28199
28263
|
} else {
|
|
28200
|
-
Object.assign(
|
|
28264
|
+
Object.assign(schema3, refSchema);
|
|
28201
28265
|
}
|
|
28202
|
-
Object.assign(
|
|
28266
|
+
Object.assign(schema3, _cached);
|
|
28203
28267
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
28204
28268
|
if (isParentRef) {
|
|
28205
|
-
for (const key in
|
|
28269
|
+
for (const key in schema3) {
|
|
28206
28270
|
if (key === "$ref" || key === "allOf")
|
|
28207
28271
|
continue;
|
|
28208
28272
|
if (!(key in _cached)) {
|
|
28209
|
-
delete
|
|
28273
|
+
delete schema3[key];
|
|
28210
28274
|
}
|
|
28211
28275
|
}
|
|
28212
28276
|
}
|
|
28213
28277
|
if (refSchema.$ref && refSeen.def) {
|
|
28214
|
-
for (const key in
|
|
28278
|
+
for (const key in schema3) {
|
|
28215
28279
|
if (key === "$ref" || key === "allOf")
|
|
28216
28280
|
continue;
|
|
28217
|
-
if (key in refSeen.def && JSON.stringify(
|
|
28218
|
-
delete
|
|
28281
|
+
if (key in refSeen.def && JSON.stringify(schema3[key]) === JSON.stringify(refSeen.def[key])) {
|
|
28282
|
+
delete schema3[key];
|
|
28219
28283
|
}
|
|
28220
28284
|
}
|
|
28221
28285
|
}
|
|
@@ -28225,13 +28289,13 @@ function finalize(ctx, schema) {
|
|
|
28225
28289
|
flattenRef(parent);
|
|
28226
28290
|
const parentSeen = ctx.seen.get(parent);
|
|
28227
28291
|
if (parentSeen?.schema.$ref) {
|
|
28228
|
-
|
|
28292
|
+
schema3.$ref = parentSeen.schema.$ref;
|
|
28229
28293
|
if (parentSeen.def) {
|
|
28230
|
-
for (const key in
|
|
28294
|
+
for (const key in schema3) {
|
|
28231
28295
|
if (key === "$ref" || key === "allOf")
|
|
28232
28296
|
continue;
|
|
28233
|
-
if (key in parentSeen.def && JSON.stringify(
|
|
28234
|
-
delete
|
|
28297
|
+
if (key in parentSeen.def && JSON.stringify(schema3[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
28298
|
+
delete schema3[key];
|
|
28235
28299
|
}
|
|
28236
28300
|
}
|
|
28237
28301
|
}
|
|
@@ -28239,7 +28303,7 @@ function finalize(ctx, schema) {
|
|
|
28239
28303
|
}
|
|
28240
28304
|
ctx.override({
|
|
28241
28305
|
zodSchema,
|
|
28242
|
-
jsonSchema:
|
|
28306
|
+
jsonSchema: schema3,
|
|
28243
28307
|
path: seen.path ?? []
|
|
28244
28308
|
});
|
|
28245
28309
|
};
|
|
@@ -28257,7 +28321,7 @@ function finalize(ctx, schema) {
|
|
|
28257
28321
|
} else {
|
|
28258
28322
|
}
|
|
28259
28323
|
if (ctx.external?.uri) {
|
|
28260
|
-
const id = ctx.external.registry.get(
|
|
28324
|
+
const id = ctx.external.registry.get(schema2)?.id;
|
|
28261
28325
|
if (!id)
|
|
28262
28326
|
throw new Error("Schema is missing an `id` property");
|
|
28263
28327
|
result.$id = ctx.external.uri(id);
|
|
@@ -28284,10 +28348,10 @@ function finalize(ctx, schema) {
|
|
|
28284
28348
|
const finalized = JSON.parse(JSON.stringify(result));
|
|
28285
28349
|
Object.defineProperty(finalized, "~standard", {
|
|
28286
28350
|
value: {
|
|
28287
|
-
...
|
|
28351
|
+
...schema2["~standard"],
|
|
28288
28352
|
jsonSchema: {
|
|
28289
|
-
input: createStandardJSONSchemaMethod(
|
|
28290
|
-
output: createStandardJSONSchemaMethod(
|
|
28353
|
+
input: createStandardJSONSchemaMethod(schema2, "input", ctx.processors),
|
|
28354
|
+
output: createStandardJSONSchemaMethod(schema2, "output", ctx.processors)
|
|
28291
28355
|
}
|
|
28292
28356
|
},
|
|
28293
28357
|
enumerable: false,
|
|
@@ -28349,18 +28413,18 @@ function isTransforming(_schema, _ctx) {
|
|
|
28349
28413
|
}
|
|
28350
28414
|
return false;
|
|
28351
28415
|
}
|
|
28352
|
-
var createToJSONSchemaMethod = (
|
|
28416
|
+
var createToJSONSchemaMethod = (schema2, processors = {}) => (params3) => {
|
|
28353
28417
|
const ctx = initializeContext({ ...params3, processors });
|
|
28354
|
-
process2(
|
|
28355
|
-
extractDefs(ctx,
|
|
28356
|
-
return finalize(ctx,
|
|
28418
|
+
process2(schema2, ctx);
|
|
28419
|
+
extractDefs(ctx, schema2);
|
|
28420
|
+
return finalize(ctx, schema2);
|
|
28357
28421
|
};
|
|
28358
|
-
var createStandardJSONSchemaMethod = (
|
|
28422
|
+
var createStandardJSONSchemaMethod = (schema2, io, processors = {}) => (params3) => {
|
|
28359
28423
|
const { libraryOptions, target } = params3 ?? {};
|
|
28360
28424
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
28361
|
-
process2(
|
|
28362
|
-
extractDefs(ctx,
|
|
28363
|
-
return finalize(ctx,
|
|
28425
|
+
process2(schema2, ctx);
|
|
28426
|
+
extractDefs(ctx, schema2);
|
|
28427
|
+
return finalize(ctx, schema2);
|
|
28364
28428
|
};
|
|
28365
28429
|
|
|
28366
28430
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/core/json-schema-processors.js
|
|
@@ -28372,10 +28436,10 @@ var formatMap = {
|
|
|
28372
28436
|
regex: ""
|
|
28373
28437
|
// do not set
|
|
28374
28438
|
};
|
|
28375
|
-
var stringProcessor = (
|
|
28439
|
+
var stringProcessor = (schema2, ctx, _json, _params) => {
|
|
28376
28440
|
const json3 = _json;
|
|
28377
28441
|
json3.type = "string";
|
|
28378
|
-
const { minimum, maximum, format, patterns, contentEncoding } =
|
|
28442
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema2._zod.bag;
|
|
28379
28443
|
if (typeof minimum === "number")
|
|
28380
28444
|
json3.minLength = minimum;
|
|
28381
28445
|
if (typeof maximum === "number")
|
|
@@ -28404,9 +28468,9 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
28404
28468
|
}
|
|
28405
28469
|
}
|
|
28406
28470
|
};
|
|
28407
|
-
var numberProcessor = (
|
|
28471
|
+
var numberProcessor = (schema2, ctx, _json, _params) => {
|
|
28408
28472
|
const json3 = _json;
|
|
28409
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } =
|
|
28473
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema2._zod.bag;
|
|
28410
28474
|
if (typeof format === "string" && format.includes("int"))
|
|
28411
28475
|
json3.type = "integer";
|
|
28412
28476
|
else
|
|
@@ -28492,8 +28556,8 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
28492
28556
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
28493
28557
|
}
|
|
28494
28558
|
};
|
|
28495
|
-
var enumProcessor = (
|
|
28496
|
-
const def2 =
|
|
28559
|
+
var enumProcessor = (schema2, _ctx, json3, _params) => {
|
|
28560
|
+
const def2 = schema2._zod.def;
|
|
28497
28561
|
const values2 = getEnumValues(def2.entries);
|
|
28498
28562
|
if (values2.every((v) => typeof v === "number"))
|
|
28499
28563
|
json3.type = "number";
|
|
@@ -28501,8 +28565,8 @@ var enumProcessor = (schema, _ctx, json3, _params) => {
|
|
|
28501
28565
|
json3.type = "string";
|
|
28502
28566
|
json3.enum = values2;
|
|
28503
28567
|
};
|
|
28504
|
-
var literalProcessor = (
|
|
28505
|
-
const def2 =
|
|
28568
|
+
var literalProcessor = (schema2, ctx, json3, _params) => {
|
|
28569
|
+
const def2 = schema2._zod.def;
|
|
28506
28570
|
const vals = [];
|
|
28507
28571
|
for (const val of def2.values) {
|
|
28508
28572
|
if (val === void 0) {
|
|
@@ -28546,22 +28610,22 @@ var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
|
28546
28610
|
throw new Error("NaN cannot be represented in JSON Schema");
|
|
28547
28611
|
}
|
|
28548
28612
|
};
|
|
28549
|
-
var templateLiteralProcessor = (
|
|
28613
|
+
var templateLiteralProcessor = (schema2, _ctx, json3, _params) => {
|
|
28550
28614
|
const _json = json3;
|
|
28551
|
-
const pattern =
|
|
28615
|
+
const pattern = schema2._zod.pattern;
|
|
28552
28616
|
if (!pattern)
|
|
28553
28617
|
throw new Error("Pattern not found in template literal");
|
|
28554
28618
|
_json.type = "string";
|
|
28555
28619
|
_json.pattern = pattern.source;
|
|
28556
28620
|
};
|
|
28557
|
-
var fileProcessor = (
|
|
28621
|
+
var fileProcessor = (schema2, _ctx, json3, _params) => {
|
|
28558
28622
|
const _json = json3;
|
|
28559
28623
|
const file2 = {
|
|
28560
28624
|
type: "string",
|
|
28561
28625
|
format: "binary",
|
|
28562
28626
|
contentEncoding: "binary"
|
|
28563
28627
|
};
|
|
28564
|
-
const { minimum, maximum, mime } =
|
|
28628
|
+
const { minimum, maximum, mime } = schema2._zod.bag;
|
|
28565
28629
|
if (minimum !== void 0)
|
|
28566
28630
|
file2.minLength = minimum;
|
|
28567
28631
|
if (maximum !== void 0)
|
|
@@ -28606,10 +28670,10 @@ var setProcessor = (_schema, ctx, _json, _params) => {
|
|
|
28606
28670
|
throw new Error("Set cannot be represented in JSON Schema");
|
|
28607
28671
|
}
|
|
28608
28672
|
};
|
|
28609
|
-
var arrayProcessor = (
|
|
28673
|
+
var arrayProcessor = (schema2, ctx, _json, params3) => {
|
|
28610
28674
|
const json3 = _json;
|
|
28611
|
-
const def2 =
|
|
28612
|
-
const { minimum, maximum } =
|
|
28675
|
+
const def2 = schema2._zod.def;
|
|
28676
|
+
const { minimum, maximum } = schema2._zod.bag;
|
|
28613
28677
|
if (typeof minimum === "number")
|
|
28614
28678
|
json3.minItems = minimum;
|
|
28615
28679
|
if (typeof maximum === "number")
|
|
@@ -28617,9 +28681,9 @@ var arrayProcessor = (schema, ctx, _json, params3) => {
|
|
|
28617
28681
|
json3.type = "array";
|
|
28618
28682
|
json3.items = process2(def2.element, ctx, { ...params3, path: [...params3.path, "items"] });
|
|
28619
28683
|
};
|
|
28620
|
-
var objectProcessor = (
|
|
28684
|
+
var objectProcessor = (schema2, ctx, _json, params3) => {
|
|
28621
28685
|
const json3 = _json;
|
|
28622
|
-
const def2 =
|
|
28686
|
+
const def2 = schema2._zod.def;
|
|
28623
28687
|
json3.type = "object";
|
|
28624
28688
|
json3.properties = {};
|
|
28625
28689
|
const shape = def2.shape;
|
|
@@ -28653,8 +28717,8 @@ var objectProcessor = (schema, ctx, _json, params3) => {
|
|
|
28653
28717
|
});
|
|
28654
28718
|
}
|
|
28655
28719
|
};
|
|
28656
|
-
var unionProcessor = (
|
|
28657
|
-
const def2 =
|
|
28720
|
+
var unionProcessor = (schema2, ctx, json3, params3) => {
|
|
28721
|
+
const def2 = schema2._zod.def;
|
|
28658
28722
|
const isExclusive = def2.inclusive === false;
|
|
28659
28723
|
const options = def2.options.map((x, i) => process2(x, ctx, {
|
|
28660
28724
|
...params3,
|
|
@@ -28666,8 +28730,8 @@ var unionProcessor = (schema, ctx, json3, params3) => {
|
|
|
28666
28730
|
json3.anyOf = options;
|
|
28667
28731
|
}
|
|
28668
28732
|
};
|
|
28669
|
-
var intersectionProcessor = (
|
|
28670
|
-
const def2 =
|
|
28733
|
+
var intersectionProcessor = (schema2, ctx, json3, params3) => {
|
|
28734
|
+
const def2 = schema2._zod.def;
|
|
28671
28735
|
const a = process2(def2.left, ctx, {
|
|
28672
28736
|
...params3,
|
|
28673
28737
|
path: [...params3.path, "allOf", 0]
|
|
@@ -28683,9 +28747,9 @@ var intersectionProcessor = (schema, ctx, json3, params3) => {
|
|
|
28683
28747
|
];
|
|
28684
28748
|
json3.allOf = allOf;
|
|
28685
28749
|
};
|
|
28686
|
-
var tupleProcessor = (
|
|
28750
|
+
var tupleProcessor = (schema2, ctx, _json, params3) => {
|
|
28687
28751
|
const json3 = _json;
|
|
28688
|
-
const def2 =
|
|
28752
|
+
const def2 = schema2._zod.def;
|
|
28689
28753
|
json3.type = "array";
|
|
28690
28754
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
28691
28755
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
@@ -28719,15 +28783,15 @@ var tupleProcessor = (schema, ctx, _json, params3) => {
|
|
|
28719
28783
|
json3.additionalItems = rest;
|
|
28720
28784
|
}
|
|
28721
28785
|
}
|
|
28722
|
-
const { minimum, maximum } =
|
|
28786
|
+
const { minimum, maximum } = schema2._zod.bag;
|
|
28723
28787
|
if (typeof minimum === "number")
|
|
28724
28788
|
json3.minItems = minimum;
|
|
28725
28789
|
if (typeof maximum === "number")
|
|
28726
28790
|
json3.maxItems = maximum;
|
|
28727
28791
|
};
|
|
28728
|
-
var recordProcessor = (
|
|
28792
|
+
var recordProcessor = (schema2, ctx, _json, params3) => {
|
|
28729
28793
|
const json3 = _json;
|
|
28730
|
-
const def2 =
|
|
28794
|
+
const def2 = schema2._zod.def;
|
|
28731
28795
|
json3.type = "object";
|
|
28732
28796
|
const keyType = def2.keyType;
|
|
28733
28797
|
const keyBag = keyType._zod.bag;
|
|
@@ -28761,10 +28825,10 @@ var recordProcessor = (schema, ctx, _json, params3) => {
|
|
|
28761
28825
|
}
|
|
28762
28826
|
}
|
|
28763
28827
|
};
|
|
28764
|
-
var nullableProcessor = (
|
|
28765
|
-
const def2 =
|
|
28828
|
+
var nullableProcessor = (schema2, ctx, json3, params3) => {
|
|
28829
|
+
const def2 = schema2._zod.def;
|
|
28766
28830
|
const inner = process2(def2.innerType, ctx, params3);
|
|
28767
|
-
const seen = ctx.seen.get(
|
|
28831
|
+
const seen = ctx.seen.get(schema2);
|
|
28768
28832
|
if (ctx.target === "openapi-3.0") {
|
|
28769
28833
|
seen.ref = def2.innerType;
|
|
28770
28834
|
json3.nullable = true;
|
|
@@ -28772,31 +28836,31 @@ var nullableProcessor = (schema, ctx, json3, params3) => {
|
|
|
28772
28836
|
json3.anyOf = [inner, { type: "null" }];
|
|
28773
28837
|
}
|
|
28774
28838
|
};
|
|
28775
|
-
var nonoptionalProcessor = (
|
|
28776
|
-
const def2 =
|
|
28839
|
+
var nonoptionalProcessor = (schema2, ctx, _json, params3) => {
|
|
28840
|
+
const def2 = schema2._zod.def;
|
|
28777
28841
|
process2(def2.innerType, ctx, params3);
|
|
28778
|
-
const seen = ctx.seen.get(
|
|
28842
|
+
const seen = ctx.seen.get(schema2);
|
|
28779
28843
|
seen.ref = def2.innerType;
|
|
28780
28844
|
};
|
|
28781
|
-
var defaultProcessor = (
|
|
28782
|
-
const def2 =
|
|
28845
|
+
var defaultProcessor = (schema2, ctx, json3, params3) => {
|
|
28846
|
+
const def2 = schema2._zod.def;
|
|
28783
28847
|
process2(def2.innerType, ctx, params3);
|
|
28784
|
-
const seen = ctx.seen.get(
|
|
28848
|
+
const seen = ctx.seen.get(schema2);
|
|
28785
28849
|
seen.ref = def2.innerType;
|
|
28786
28850
|
json3.default = JSON.parse(JSON.stringify(def2.defaultValue));
|
|
28787
28851
|
};
|
|
28788
|
-
var prefaultProcessor = (
|
|
28789
|
-
const def2 =
|
|
28852
|
+
var prefaultProcessor = (schema2, ctx, json3, params3) => {
|
|
28853
|
+
const def2 = schema2._zod.def;
|
|
28790
28854
|
process2(def2.innerType, ctx, params3);
|
|
28791
|
-
const seen = ctx.seen.get(
|
|
28855
|
+
const seen = ctx.seen.get(schema2);
|
|
28792
28856
|
seen.ref = def2.innerType;
|
|
28793
28857
|
if (ctx.io === "input")
|
|
28794
28858
|
json3._prefault = JSON.parse(JSON.stringify(def2.defaultValue));
|
|
28795
28859
|
};
|
|
28796
|
-
var catchProcessor = (
|
|
28797
|
-
const def2 =
|
|
28860
|
+
var catchProcessor = (schema2, ctx, json3, params3) => {
|
|
28861
|
+
const def2 = schema2._zod.def;
|
|
28798
28862
|
process2(def2.innerType, ctx, params3);
|
|
28799
|
-
const seen = ctx.seen.get(
|
|
28863
|
+
const seen = ctx.seen.get(schema2);
|
|
28800
28864
|
seen.ref = def2.innerType;
|
|
28801
28865
|
let catchValue;
|
|
28802
28866
|
try {
|
|
@@ -28806,36 +28870,36 @@ var catchProcessor = (schema, ctx, json3, params3) => {
|
|
|
28806
28870
|
}
|
|
28807
28871
|
json3.default = catchValue;
|
|
28808
28872
|
};
|
|
28809
|
-
var pipeProcessor = (
|
|
28810
|
-
const def2 =
|
|
28873
|
+
var pipeProcessor = (schema2, ctx, _json, params3) => {
|
|
28874
|
+
const def2 = schema2._zod.def;
|
|
28811
28875
|
const innerType = ctx.io === "input" ? def2.in._zod.def.type === "transform" ? def2.out : def2.in : def2.out;
|
|
28812
28876
|
process2(innerType, ctx, params3);
|
|
28813
|
-
const seen = ctx.seen.get(
|
|
28877
|
+
const seen = ctx.seen.get(schema2);
|
|
28814
28878
|
seen.ref = innerType;
|
|
28815
28879
|
};
|
|
28816
|
-
var readonlyProcessor = (
|
|
28817
|
-
const def2 =
|
|
28880
|
+
var readonlyProcessor = (schema2, ctx, json3, params3) => {
|
|
28881
|
+
const def2 = schema2._zod.def;
|
|
28818
28882
|
process2(def2.innerType, ctx, params3);
|
|
28819
|
-
const seen = ctx.seen.get(
|
|
28883
|
+
const seen = ctx.seen.get(schema2);
|
|
28820
28884
|
seen.ref = def2.innerType;
|
|
28821
28885
|
json3.readOnly = true;
|
|
28822
28886
|
};
|
|
28823
|
-
var promiseProcessor = (
|
|
28824
|
-
const def2 =
|
|
28887
|
+
var promiseProcessor = (schema2, ctx, _json, params3) => {
|
|
28888
|
+
const def2 = schema2._zod.def;
|
|
28825
28889
|
process2(def2.innerType, ctx, params3);
|
|
28826
|
-
const seen = ctx.seen.get(
|
|
28890
|
+
const seen = ctx.seen.get(schema2);
|
|
28827
28891
|
seen.ref = def2.innerType;
|
|
28828
28892
|
};
|
|
28829
|
-
var optionalProcessor = (
|
|
28830
|
-
const def2 =
|
|
28893
|
+
var optionalProcessor = (schema2, ctx, _json, params3) => {
|
|
28894
|
+
const def2 = schema2._zod.def;
|
|
28831
28895
|
process2(def2.innerType, ctx, params3);
|
|
28832
|
-
const seen = ctx.seen.get(
|
|
28896
|
+
const seen = ctx.seen.get(schema2);
|
|
28833
28897
|
seen.ref = def2.innerType;
|
|
28834
28898
|
};
|
|
28835
|
-
var lazyProcessor = (
|
|
28836
|
-
const innerType =
|
|
28899
|
+
var lazyProcessor = (schema2, ctx, _json, params3) => {
|
|
28900
|
+
const innerType = schema2._zod.innerType;
|
|
28837
28901
|
process2(innerType, ctx, params3);
|
|
28838
|
-
const seen = ctx.seen.get(
|
|
28902
|
+
const seen = ctx.seen.get(schema2);
|
|
28839
28903
|
seen.ref = innerType;
|
|
28840
28904
|
};
|
|
28841
28905
|
var allProcessors = {
|
|
@@ -28885,8 +28949,8 @@ function toJSONSchema(input, params3) {
|
|
|
28885
28949
|
const ctx2 = initializeContext({ ...params3, processors: allProcessors });
|
|
28886
28950
|
const defs = {};
|
|
28887
28951
|
for (const entry of registry2._idmap.entries()) {
|
|
28888
|
-
const [_,
|
|
28889
|
-
process2(
|
|
28952
|
+
const [_, schema2] = entry;
|
|
28953
|
+
process2(schema2, ctx2);
|
|
28890
28954
|
}
|
|
28891
28955
|
const schemas = {};
|
|
28892
28956
|
const external = {
|
|
@@ -28896,9 +28960,9 @@ function toJSONSchema(input, params3) {
|
|
|
28896
28960
|
};
|
|
28897
28961
|
ctx2.external = external;
|
|
28898
28962
|
for (const entry of registry2._idmap.entries()) {
|
|
28899
|
-
const [key,
|
|
28900
|
-
extractDefs(ctx2,
|
|
28901
|
-
schemas[key] = finalize(ctx2,
|
|
28963
|
+
const [key, schema2] = entry;
|
|
28964
|
+
extractDefs(ctx2, schema2);
|
|
28965
|
+
schemas[key] = finalize(ctx2, schema2);
|
|
28902
28966
|
}
|
|
28903
28967
|
if (Object.keys(defs).length > 0) {
|
|
28904
28968
|
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
@@ -28966,14 +29030,14 @@ var JSONSchemaGenerator = class {
|
|
|
28966
29030
|
* Process a schema to prepare it for JSON Schema generation.
|
|
28967
29031
|
* This must be called before emit().
|
|
28968
29032
|
*/
|
|
28969
|
-
process(
|
|
28970
|
-
return process2(
|
|
29033
|
+
process(schema2, _params = { path: [], schemaPath: [] }) {
|
|
29034
|
+
return process2(schema2, this.ctx, _params);
|
|
28971
29035
|
}
|
|
28972
29036
|
/**
|
|
28973
29037
|
* Emit the final JSON Schema after processing.
|
|
28974
29038
|
* Must call process() first.
|
|
28975
29039
|
*/
|
|
28976
|
-
emit(
|
|
29040
|
+
emit(schema2, _params) {
|
|
28977
29041
|
if (_params) {
|
|
28978
29042
|
if (_params.cycles)
|
|
28979
29043
|
this.ctx.cycles = _params.cycles;
|
|
@@ -28982,8 +29046,8 @@ var JSONSchemaGenerator = class {
|
|
|
28982
29046
|
if (_params.external)
|
|
28983
29047
|
this.ctx.external = _params.external;
|
|
28984
29048
|
}
|
|
28985
|
-
extractDefs(this.ctx,
|
|
28986
|
-
const result = finalize(this.ctx,
|
|
29049
|
+
extractDefs(this.ctx, schema2);
|
|
29050
|
+
const result = finalize(this.ctx, schema2);
|
|
28987
29051
|
const { "~standard": _, ...plainResult } = result;
|
|
28988
29052
|
return plainResult;
|
|
28989
29053
|
}
|
|
@@ -29038,8 +29102,8 @@ function object(shape, params3) {
|
|
|
29038
29102
|
|
|
29039
29103
|
// ../../.yarn/__virtual__/@modelcontextprotocol-sdk-virtual-4beea6215a/0/cache/@modelcontextprotocol-sdk-npm-1.26.0-380479a6f8-b4098789d9.zip/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
29040
29104
|
function isZ4Schema(s) {
|
|
29041
|
-
const
|
|
29042
|
-
return !!
|
|
29105
|
+
const schema2 = s;
|
|
29106
|
+
return !!schema2._zod;
|
|
29043
29107
|
}
|
|
29044
29108
|
function objectFromShape(shape) {
|
|
29045
29109
|
const values2 = Object.values(shape);
|
|
@@ -29053,33 +29117,33 @@ function objectFromShape(shape) {
|
|
|
29053
29117
|
return objectType(shape);
|
|
29054
29118
|
throw new Error("Mixed Zod versions detected in object shape.");
|
|
29055
29119
|
}
|
|
29056
|
-
function safeParse2(
|
|
29057
|
-
if (isZ4Schema(
|
|
29058
|
-
const result2 = safeParse(
|
|
29120
|
+
function safeParse2(schema2, data) {
|
|
29121
|
+
if (isZ4Schema(schema2)) {
|
|
29122
|
+
const result2 = safeParse(schema2, data);
|
|
29059
29123
|
return result2;
|
|
29060
29124
|
}
|
|
29061
|
-
const v3Schema =
|
|
29125
|
+
const v3Schema = schema2;
|
|
29062
29126
|
const result = v3Schema.safeParse(data);
|
|
29063
29127
|
return result;
|
|
29064
29128
|
}
|
|
29065
|
-
async function safeParseAsync2(
|
|
29066
|
-
if (isZ4Schema(
|
|
29067
|
-
const result2 = await safeParseAsync(
|
|
29129
|
+
async function safeParseAsync2(schema2, data) {
|
|
29130
|
+
if (isZ4Schema(schema2)) {
|
|
29131
|
+
const result2 = await safeParseAsync(schema2, data);
|
|
29068
29132
|
return result2;
|
|
29069
29133
|
}
|
|
29070
|
-
const v3Schema =
|
|
29134
|
+
const v3Schema = schema2;
|
|
29071
29135
|
const result = await v3Schema.safeParseAsync(data);
|
|
29072
29136
|
return result;
|
|
29073
29137
|
}
|
|
29074
|
-
function getObjectShape(
|
|
29075
|
-
if (!
|
|
29138
|
+
function getObjectShape(schema2) {
|
|
29139
|
+
if (!schema2)
|
|
29076
29140
|
return void 0;
|
|
29077
29141
|
let rawShape;
|
|
29078
|
-
if (isZ4Schema(
|
|
29079
|
-
const v4Schema =
|
|
29142
|
+
if (isZ4Schema(schema2)) {
|
|
29143
|
+
const v4Schema = schema2;
|
|
29080
29144
|
rawShape = v4Schema._zod?.def?.shape;
|
|
29081
29145
|
} else {
|
|
29082
|
-
const v3Schema =
|
|
29146
|
+
const v3Schema = schema2;
|
|
29083
29147
|
rawShape = v3Schema.shape;
|
|
29084
29148
|
}
|
|
29085
29149
|
if (!rawShape)
|
|
@@ -29093,29 +29157,29 @@ function getObjectShape(schema) {
|
|
|
29093
29157
|
}
|
|
29094
29158
|
return rawShape;
|
|
29095
29159
|
}
|
|
29096
|
-
function normalizeObjectSchema(
|
|
29097
|
-
if (!
|
|
29160
|
+
function normalizeObjectSchema(schema2) {
|
|
29161
|
+
if (!schema2)
|
|
29098
29162
|
return void 0;
|
|
29099
|
-
if (typeof
|
|
29100
|
-
const asV3 =
|
|
29101
|
-
const asV4 =
|
|
29163
|
+
if (typeof schema2 === "object") {
|
|
29164
|
+
const asV3 = schema2;
|
|
29165
|
+
const asV4 = schema2;
|
|
29102
29166
|
if (!asV3._def && !asV4._zod) {
|
|
29103
|
-
const values2 = Object.values(
|
|
29167
|
+
const values2 = Object.values(schema2);
|
|
29104
29168
|
if (values2.length > 0 && values2.every((v) => typeof v === "object" && v !== null && (v._def !== void 0 || v._zod !== void 0 || typeof v.parse === "function"))) {
|
|
29105
|
-
return objectFromShape(
|
|
29169
|
+
return objectFromShape(schema2);
|
|
29106
29170
|
}
|
|
29107
29171
|
}
|
|
29108
29172
|
}
|
|
29109
|
-
if (isZ4Schema(
|
|
29110
|
-
const v4Schema =
|
|
29173
|
+
if (isZ4Schema(schema2)) {
|
|
29174
|
+
const v4Schema = schema2;
|
|
29111
29175
|
const def2 = v4Schema._zod?.def;
|
|
29112
29176
|
if (def2 && (def2.type === "object" || def2.shape !== void 0)) {
|
|
29113
|
-
return
|
|
29177
|
+
return schema2;
|
|
29114
29178
|
}
|
|
29115
29179
|
} else {
|
|
29116
|
-
const v3Schema =
|
|
29180
|
+
const v3Schema = schema2;
|
|
29117
29181
|
if (v3Schema.shape !== void 0) {
|
|
29118
|
-
return
|
|
29182
|
+
return schema2;
|
|
29119
29183
|
}
|
|
29120
29184
|
}
|
|
29121
29185
|
return void 0;
|
|
@@ -29139,23 +29203,23 @@ function getParseErrorMessage(error48) {
|
|
|
29139
29203
|
}
|
|
29140
29204
|
return String(error48);
|
|
29141
29205
|
}
|
|
29142
|
-
function getSchemaDescription(
|
|
29143
|
-
return
|
|
29206
|
+
function getSchemaDescription(schema2) {
|
|
29207
|
+
return schema2.description;
|
|
29144
29208
|
}
|
|
29145
|
-
function isSchemaOptional(
|
|
29146
|
-
if (isZ4Schema(
|
|
29147
|
-
const v4Schema =
|
|
29209
|
+
function isSchemaOptional(schema2) {
|
|
29210
|
+
if (isZ4Schema(schema2)) {
|
|
29211
|
+
const v4Schema = schema2;
|
|
29148
29212
|
return v4Schema._zod?.def?.type === "optional";
|
|
29149
29213
|
}
|
|
29150
|
-
const v3Schema =
|
|
29151
|
-
if (typeof
|
|
29152
|
-
return
|
|
29214
|
+
const v3Schema = schema2;
|
|
29215
|
+
if (typeof schema2.isOptional === "function") {
|
|
29216
|
+
return schema2.isOptional();
|
|
29153
29217
|
}
|
|
29154
29218
|
return v3Schema._def?.typeName === "ZodOptional";
|
|
29155
29219
|
}
|
|
29156
|
-
function getLiteralValue(
|
|
29157
|
-
if (isZ4Schema(
|
|
29158
|
-
const v4Schema =
|
|
29220
|
+
function getLiteralValue(schema2) {
|
|
29221
|
+
if (isZ4Schema(schema2)) {
|
|
29222
|
+
const v4Schema = schema2;
|
|
29159
29223
|
const def3 = v4Schema._zod?.def;
|
|
29160
29224
|
if (def3) {
|
|
29161
29225
|
if (def3.value !== void 0)
|
|
@@ -29165,7 +29229,7 @@ function getLiteralValue(schema) {
|
|
|
29165
29229
|
}
|
|
29166
29230
|
}
|
|
29167
29231
|
}
|
|
29168
|
-
const v3Schema =
|
|
29232
|
+
const v3Schema = schema2;
|
|
29169
29233
|
const def2 = v3Schema._def;
|
|
29170
29234
|
if (def2) {
|
|
29171
29235
|
if (def2.value !== void 0)
|
|
@@ -29174,7 +29238,7 @@ function getLiteralValue(schema) {
|
|
|
29174
29238
|
return def2.values[0];
|
|
29175
29239
|
}
|
|
29176
29240
|
}
|
|
29177
|
-
const directValue =
|
|
29241
|
+
const directValue = schema2.value;
|
|
29178
29242
|
if (directValue !== void 0)
|
|
29179
29243
|
return directValue;
|
|
29180
29244
|
return void 0;
|
|
@@ -30216,8 +30280,8 @@ var ZodArray2 = /* @__PURE__ */ $constructor("ZodArray", (inst, def2) => {
|
|
|
30216
30280
|
function array(element, params3) {
|
|
30217
30281
|
return _array(ZodArray2, element, params3);
|
|
30218
30282
|
}
|
|
30219
|
-
function keyof(
|
|
30220
|
-
const shape =
|
|
30283
|
+
function keyof(schema2) {
|
|
30284
|
+
const shape = schema2._zod.def.shape;
|
|
30221
30285
|
return _enum2(Object.keys(shape));
|
|
30222
30286
|
}
|
|
30223
30287
|
var ZodObject2 = /* @__PURE__ */ $constructor("ZodObject", (inst, def2) => {
|
|
@@ -30794,8 +30858,8 @@ function json(params3) {
|
|
|
30794
30858
|
});
|
|
30795
30859
|
return jsonSchema;
|
|
30796
30860
|
}
|
|
30797
|
-
function preprocess(fn,
|
|
30798
|
-
return pipe(transform(fn),
|
|
30861
|
+
function preprocess(fn, schema2) {
|
|
30862
|
+
return pipe(transform(fn), schema2);
|
|
30799
30863
|
}
|
|
30800
30864
|
|
|
30801
30865
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/classic/compat.js
|
|
@@ -30901,8 +30965,8 @@ var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
|
|
|
30901
30965
|
"nullable",
|
|
30902
30966
|
"readOnly"
|
|
30903
30967
|
]);
|
|
30904
|
-
function detectVersion(
|
|
30905
|
-
const $schema =
|
|
30968
|
+
function detectVersion(schema2, defaultTarget) {
|
|
30969
|
+
const $schema = schema2.$schema;
|
|
30906
30970
|
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
30907
30971
|
return "draft-2020-12";
|
|
30908
30972
|
}
|
|
@@ -30932,27 +30996,27 @@ function resolveRef(ref, ctx) {
|
|
|
30932
30996
|
}
|
|
30933
30997
|
throw new Error(`Reference not found: ${ref}`);
|
|
30934
30998
|
}
|
|
30935
|
-
function convertBaseSchema(
|
|
30936
|
-
if (
|
|
30937
|
-
if (typeof
|
|
30999
|
+
function convertBaseSchema(schema2, ctx) {
|
|
31000
|
+
if (schema2.not !== void 0) {
|
|
31001
|
+
if (typeof schema2.not === "object" && Object.keys(schema2.not).length === 0) {
|
|
30938
31002
|
return z.never();
|
|
30939
31003
|
}
|
|
30940
31004
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
30941
31005
|
}
|
|
30942
|
-
if (
|
|
31006
|
+
if (schema2.unevaluatedItems !== void 0) {
|
|
30943
31007
|
throw new Error("unevaluatedItems is not supported");
|
|
30944
31008
|
}
|
|
30945
|
-
if (
|
|
31009
|
+
if (schema2.unevaluatedProperties !== void 0) {
|
|
30946
31010
|
throw new Error("unevaluatedProperties is not supported");
|
|
30947
31011
|
}
|
|
30948
|
-
if (
|
|
31012
|
+
if (schema2.if !== void 0 || schema2.then !== void 0 || schema2.else !== void 0) {
|
|
30949
31013
|
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
30950
31014
|
}
|
|
30951
|
-
if (
|
|
31015
|
+
if (schema2.dependentSchemas !== void 0 || schema2.dependentRequired !== void 0) {
|
|
30952
31016
|
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
30953
31017
|
}
|
|
30954
|
-
if (
|
|
30955
|
-
const refPath =
|
|
31018
|
+
if (schema2.$ref) {
|
|
31019
|
+
const refPath = schema2.$ref;
|
|
30956
31020
|
if (ctx.refs.has(refPath)) {
|
|
30957
31021
|
return ctx.refs.get(refPath);
|
|
30958
31022
|
}
|
|
@@ -30971,9 +31035,9 @@ function convertBaseSchema(schema, ctx) {
|
|
|
30971
31035
|
ctx.processing.delete(refPath);
|
|
30972
31036
|
return zodSchema2;
|
|
30973
31037
|
}
|
|
30974
|
-
if (
|
|
30975
|
-
const enumValues =
|
|
30976
|
-
if (ctx.version === "openapi-3.0" &&
|
|
31038
|
+
if (schema2.enum !== void 0) {
|
|
31039
|
+
const enumValues = schema2.enum;
|
|
31040
|
+
if (ctx.version === "openapi-3.0" && schema2.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
30977
31041
|
return z.null();
|
|
30978
31042
|
}
|
|
30979
31043
|
if (enumValues.length === 0) {
|
|
@@ -30991,13 +31055,13 @@ function convertBaseSchema(schema, ctx) {
|
|
|
30991
31055
|
}
|
|
30992
31056
|
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
30993
31057
|
}
|
|
30994
|
-
if (
|
|
30995
|
-
return z.literal(
|
|
31058
|
+
if (schema2.const !== void 0) {
|
|
31059
|
+
return z.literal(schema2.const);
|
|
30996
31060
|
}
|
|
30997
|
-
const type =
|
|
31061
|
+
const type = schema2.type;
|
|
30998
31062
|
if (Array.isArray(type)) {
|
|
30999
31063
|
const typeSchemas = type.map((t) => {
|
|
31000
|
-
const typeSchema = { ...
|
|
31064
|
+
const typeSchema = { ...schema2, type: t };
|
|
31001
31065
|
return convertBaseSchema(typeSchema, ctx);
|
|
31002
31066
|
});
|
|
31003
31067
|
if (typeSchemas.length === 0) {
|
|
@@ -31015,8 +31079,8 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31015
31079
|
switch (type) {
|
|
31016
31080
|
case "string": {
|
|
31017
31081
|
let stringSchema = z.string();
|
|
31018
|
-
if (
|
|
31019
|
-
const format =
|
|
31082
|
+
if (schema2.format) {
|
|
31083
|
+
const format = schema2.format;
|
|
31020
31084
|
if (format === "email") {
|
|
31021
31085
|
stringSchema = stringSchema.check(z.email());
|
|
31022
31086
|
} else if (format === "uri" || format === "uri-reference") {
|
|
@@ -31065,14 +31129,14 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31065
31129
|
stringSchema = stringSchema.check(z.ksuid());
|
|
31066
31130
|
}
|
|
31067
31131
|
}
|
|
31068
|
-
if (typeof
|
|
31069
|
-
stringSchema = stringSchema.min(
|
|
31132
|
+
if (typeof schema2.minLength === "number") {
|
|
31133
|
+
stringSchema = stringSchema.min(schema2.minLength);
|
|
31070
31134
|
}
|
|
31071
|
-
if (typeof
|
|
31072
|
-
stringSchema = stringSchema.max(
|
|
31135
|
+
if (typeof schema2.maxLength === "number") {
|
|
31136
|
+
stringSchema = stringSchema.max(schema2.maxLength);
|
|
31073
31137
|
}
|
|
31074
|
-
if (
|
|
31075
|
-
stringSchema = stringSchema.regex(new RegExp(
|
|
31138
|
+
if (schema2.pattern) {
|
|
31139
|
+
stringSchema = stringSchema.regex(new RegExp(schema2.pattern));
|
|
31076
31140
|
}
|
|
31077
31141
|
zodSchema = stringSchema;
|
|
31078
31142
|
break;
|
|
@@ -31080,24 +31144,24 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31080
31144
|
case "number":
|
|
31081
31145
|
case "integer": {
|
|
31082
31146
|
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
31083
|
-
if (typeof
|
|
31084
|
-
numberSchema = numberSchema.min(
|
|
31147
|
+
if (typeof schema2.minimum === "number") {
|
|
31148
|
+
numberSchema = numberSchema.min(schema2.minimum);
|
|
31085
31149
|
}
|
|
31086
|
-
if (typeof
|
|
31087
|
-
numberSchema = numberSchema.max(
|
|
31150
|
+
if (typeof schema2.maximum === "number") {
|
|
31151
|
+
numberSchema = numberSchema.max(schema2.maximum);
|
|
31088
31152
|
}
|
|
31089
|
-
if (typeof
|
|
31090
|
-
numberSchema = numberSchema.gt(
|
|
31091
|
-
} else if (
|
|
31092
|
-
numberSchema = numberSchema.gt(
|
|
31153
|
+
if (typeof schema2.exclusiveMinimum === "number") {
|
|
31154
|
+
numberSchema = numberSchema.gt(schema2.exclusiveMinimum);
|
|
31155
|
+
} else if (schema2.exclusiveMinimum === true && typeof schema2.minimum === "number") {
|
|
31156
|
+
numberSchema = numberSchema.gt(schema2.minimum);
|
|
31093
31157
|
}
|
|
31094
|
-
if (typeof
|
|
31095
|
-
numberSchema = numberSchema.lt(
|
|
31096
|
-
} else if (
|
|
31097
|
-
numberSchema = numberSchema.lt(
|
|
31158
|
+
if (typeof schema2.exclusiveMaximum === "number") {
|
|
31159
|
+
numberSchema = numberSchema.lt(schema2.exclusiveMaximum);
|
|
31160
|
+
} else if (schema2.exclusiveMaximum === true && typeof schema2.maximum === "number") {
|
|
31161
|
+
numberSchema = numberSchema.lt(schema2.maximum);
|
|
31098
31162
|
}
|
|
31099
|
-
if (typeof
|
|
31100
|
-
numberSchema = numberSchema.multipleOf(
|
|
31163
|
+
if (typeof schema2.multipleOf === "number") {
|
|
31164
|
+
numberSchema = numberSchema.multipleOf(schema2.multipleOf);
|
|
31101
31165
|
}
|
|
31102
31166
|
zodSchema = numberSchema;
|
|
31103
31167
|
break;
|
|
@@ -31112,15 +31176,15 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31112
31176
|
}
|
|
31113
31177
|
case "object": {
|
|
31114
31178
|
const shape = {};
|
|
31115
|
-
const properties =
|
|
31116
|
-
const requiredSet = new Set(
|
|
31179
|
+
const properties = schema2.properties || {};
|
|
31180
|
+
const requiredSet = new Set(schema2.required || []);
|
|
31117
31181
|
for (const [key, propSchema] of Object.entries(properties)) {
|
|
31118
31182
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
31119
31183
|
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
31120
31184
|
}
|
|
31121
|
-
if (
|
|
31122
|
-
const keySchema = convertSchema(
|
|
31123
|
-
const valueSchema =
|
|
31185
|
+
if (schema2.propertyNames) {
|
|
31186
|
+
const keySchema = convertSchema(schema2.propertyNames, ctx);
|
|
31187
|
+
const valueSchema = schema2.additionalProperties && typeof schema2.additionalProperties === "object" ? convertSchema(schema2.additionalProperties, ctx) : z.any();
|
|
31124
31188
|
if (Object.keys(shape).length === 0) {
|
|
31125
31189
|
zodSchema = z.record(keySchema, valueSchema);
|
|
31126
31190
|
break;
|
|
@@ -31130,8 +31194,8 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31130
31194
|
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
31131
31195
|
break;
|
|
31132
31196
|
}
|
|
31133
|
-
if (
|
|
31134
|
-
const patternProps =
|
|
31197
|
+
if (schema2.patternProperties) {
|
|
31198
|
+
const patternProps = schema2.patternProperties;
|
|
31135
31199
|
const patternKeys = Object.keys(patternProps);
|
|
31136
31200
|
const looseRecords = [];
|
|
31137
31201
|
for (const pattern of patternKeys) {
|
|
@@ -31158,18 +31222,18 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31158
31222
|
break;
|
|
31159
31223
|
}
|
|
31160
31224
|
const objectSchema = z.object(shape);
|
|
31161
|
-
if (
|
|
31225
|
+
if (schema2.additionalProperties === false) {
|
|
31162
31226
|
zodSchema = objectSchema.strict();
|
|
31163
|
-
} else if (typeof
|
|
31164
|
-
zodSchema = objectSchema.catchall(convertSchema(
|
|
31227
|
+
} else if (typeof schema2.additionalProperties === "object") {
|
|
31228
|
+
zodSchema = objectSchema.catchall(convertSchema(schema2.additionalProperties, ctx));
|
|
31165
31229
|
} else {
|
|
31166
31230
|
zodSchema = objectSchema.passthrough();
|
|
31167
31231
|
}
|
|
31168
31232
|
break;
|
|
31169
31233
|
}
|
|
31170
31234
|
case "array": {
|
|
31171
|
-
const prefixItems =
|
|
31172
|
-
const items =
|
|
31235
|
+
const prefixItems = schema2.prefixItems;
|
|
31236
|
+
const items = schema2.items;
|
|
31173
31237
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
31174
31238
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
31175
31239
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
@@ -31178,34 +31242,34 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31178
31242
|
} else {
|
|
31179
31243
|
zodSchema = z.tuple(tupleItems);
|
|
31180
31244
|
}
|
|
31181
|
-
if (typeof
|
|
31182
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
31245
|
+
if (typeof schema2.minItems === "number") {
|
|
31246
|
+
zodSchema = zodSchema.check(z.minLength(schema2.minItems));
|
|
31183
31247
|
}
|
|
31184
|
-
if (typeof
|
|
31185
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
31248
|
+
if (typeof schema2.maxItems === "number") {
|
|
31249
|
+
zodSchema = zodSchema.check(z.maxLength(schema2.maxItems));
|
|
31186
31250
|
}
|
|
31187
31251
|
} else if (Array.isArray(items)) {
|
|
31188
31252
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
31189
|
-
const rest =
|
|
31253
|
+
const rest = schema2.additionalItems && typeof schema2.additionalItems === "object" ? convertSchema(schema2.additionalItems, ctx) : void 0;
|
|
31190
31254
|
if (rest) {
|
|
31191
31255
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
31192
31256
|
} else {
|
|
31193
31257
|
zodSchema = z.tuple(tupleItems);
|
|
31194
31258
|
}
|
|
31195
|
-
if (typeof
|
|
31196
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
31259
|
+
if (typeof schema2.minItems === "number") {
|
|
31260
|
+
zodSchema = zodSchema.check(z.minLength(schema2.minItems));
|
|
31197
31261
|
}
|
|
31198
|
-
if (typeof
|
|
31199
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
31262
|
+
if (typeof schema2.maxItems === "number") {
|
|
31263
|
+
zodSchema = zodSchema.check(z.maxLength(schema2.maxItems));
|
|
31200
31264
|
}
|
|
31201
31265
|
} else if (items !== void 0) {
|
|
31202
31266
|
const element = convertSchema(items, ctx);
|
|
31203
31267
|
let arraySchema = z.array(element);
|
|
31204
|
-
if (typeof
|
|
31205
|
-
arraySchema = arraySchema.min(
|
|
31268
|
+
if (typeof schema2.minItems === "number") {
|
|
31269
|
+
arraySchema = arraySchema.min(schema2.minItems);
|
|
31206
31270
|
}
|
|
31207
|
-
if (typeof
|
|
31208
|
-
arraySchema = arraySchema.max(
|
|
31271
|
+
if (typeof schema2.maxItems === "number") {
|
|
31272
|
+
arraySchema = arraySchema.max(schema2.maxItems);
|
|
31209
31273
|
}
|
|
31210
31274
|
zodSchema = arraySchema;
|
|
31211
31275
|
} else {
|
|
@@ -31216,64 +31280,64 @@ function convertBaseSchema(schema, ctx) {
|
|
|
31216
31280
|
default:
|
|
31217
31281
|
throw new Error(`Unsupported type: ${type}`);
|
|
31218
31282
|
}
|
|
31219
|
-
if (
|
|
31220
|
-
zodSchema = zodSchema.describe(
|
|
31283
|
+
if (schema2.description) {
|
|
31284
|
+
zodSchema = zodSchema.describe(schema2.description);
|
|
31221
31285
|
}
|
|
31222
|
-
if (
|
|
31223
|
-
zodSchema = zodSchema.default(
|
|
31286
|
+
if (schema2.default !== void 0) {
|
|
31287
|
+
zodSchema = zodSchema.default(schema2.default);
|
|
31224
31288
|
}
|
|
31225
31289
|
return zodSchema;
|
|
31226
31290
|
}
|
|
31227
|
-
function convertSchema(
|
|
31228
|
-
if (typeof
|
|
31229
|
-
return
|
|
31291
|
+
function convertSchema(schema2, ctx) {
|
|
31292
|
+
if (typeof schema2 === "boolean") {
|
|
31293
|
+
return schema2 ? z.any() : z.never();
|
|
31230
31294
|
}
|
|
31231
|
-
let baseSchema = convertBaseSchema(
|
|
31232
|
-
const hasExplicitType =
|
|
31233
|
-
if (
|
|
31234
|
-
const options =
|
|
31295
|
+
let baseSchema = convertBaseSchema(schema2, ctx);
|
|
31296
|
+
const hasExplicitType = schema2.type || schema2.enum !== void 0 || schema2.const !== void 0;
|
|
31297
|
+
if (schema2.anyOf && Array.isArray(schema2.anyOf)) {
|
|
31298
|
+
const options = schema2.anyOf.map((s) => convertSchema(s, ctx));
|
|
31235
31299
|
const anyOfUnion = z.union(options);
|
|
31236
31300
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
31237
31301
|
}
|
|
31238
|
-
if (
|
|
31239
|
-
const options =
|
|
31302
|
+
if (schema2.oneOf && Array.isArray(schema2.oneOf)) {
|
|
31303
|
+
const options = schema2.oneOf.map((s) => convertSchema(s, ctx));
|
|
31240
31304
|
const oneOfUnion = z.xor(options);
|
|
31241
31305
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
31242
31306
|
}
|
|
31243
|
-
if (
|
|
31244
|
-
if (
|
|
31307
|
+
if (schema2.allOf && Array.isArray(schema2.allOf)) {
|
|
31308
|
+
if (schema2.allOf.length === 0) {
|
|
31245
31309
|
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
31246
31310
|
} else {
|
|
31247
|
-
let result = hasExplicitType ? baseSchema : convertSchema(
|
|
31311
|
+
let result = hasExplicitType ? baseSchema : convertSchema(schema2.allOf[0], ctx);
|
|
31248
31312
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
31249
|
-
for (let i = startIdx; i <
|
|
31250
|
-
result = z.intersection(result, convertSchema(
|
|
31313
|
+
for (let i = startIdx; i < schema2.allOf.length; i++) {
|
|
31314
|
+
result = z.intersection(result, convertSchema(schema2.allOf[i], ctx));
|
|
31251
31315
|
}
|
|
31252
31316
|
baseSchema = result;
|
|
31253
31317
|
}
|
|
31254
31318
|
}
|
|
31255
|
-
if (
|
|
31319
|
+
if (schema2.nullable === true && ctx.version === "openapi-3.0") {
|
|
31256
31320
|
baseSchema = z.nullable(baseSchema);
|
|
31257
31321
|
}
|
|
31258
|
-
if (
|
|
31322
|
+
if (schema2.readOnly === true) {
|
|
31259
31323
|
baseSchema = z.readonly(baseSchema);
|
|
31260
31324
|
}
|
|
31261
31325
|
const extraMeta = {};
|
|
31262
31326
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
31263
31327
|
for (const key of coreMetadataKeys) {
|
|
31264
|
-
if (key in
|
|
31265
|
-
extraMeta[key] =
|
|
31328
|
+
if (key in schema2) {
|
|
31329
|
+
extraMeta[key] = schema2[key];
|
|
31266
31330
|
}
|
|
31267
31331
|
}
|
|
31268
31332
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
31269
31333
|
for (const key of contentMetadataKeys) {
|
|
31270
|
-
if (key in
|
|
31271
|
-
extraMeta[key] =
|
|
31334
|
+
if (key in schema2) {
|
|
31335
|
+
extraMeta[key] = schema2[key];
|
|
31272
31336
|
}
|
|
31273
31337
|
}
|
|
31274
|
-
for (const key of Object.keys(
|
|
31338
|
+
for (const key of Object.keys(schema2)) {
|
|
31275
31339
|
if (!RECOGNIZED_KEYS.has(key)) {
|
|
31276
|
-
extraMeta[key] =
|
|
31340
|
+
extraMeta[key] = schema2[key];
|
|
31277
31341
|
}
|
|
31278
31342
|
}
|
|
31279
31343
|
if (Object.keys(extraMeta).length > 0) {
|
|
@@ -31281,21 +31345,21 @@ function convertSchema(schema, ctx) {
|
|
|
31281
31345
|
}
|
|
31282
31346
|
return baseSchema;
|
|
31283
31347
|
}
|
|
31284
|
-
function fromJSONSchema(
|
|
31285
|
-
if (typeof
|
|
31286
|
-
return
|
|
31348
|
+
function fromJSONSchema(schema2, params3) {
|
|
31349
|
+
if (typeof schema2 === "boolean") {
|
|
31350
|
+
return schema2 ? z.any() : z.never();
|
|
31287
31351
|
}
|
|
31288
|
-
const version2 = detectVersion(
|
|
31289
|
-
const defs =
|
|
31352
|
+
const version2 = detectVersion(schema2, params3?.defaultTarget);
|
|
31353
|
+
const defs = schema2.$defs || schema2.definitions || {};
|
|
31290
31354
|
const ctx = {
|
|
31291
31355
|
version: version2,
|
|
31292
31356
|
defs,
|
|
31293
31357
|
refs: /* @__PURE__ */ new Map(),
|
|
31294
31358
|
processing: /* @__PURE__ */ new Set(),
|
|
31295
|
-
rootSchema:
|
|
31359
|
+
rootSchema: schema2,
|
|
31296
31360
|
registry: params3?.registry ?? globalRegistry
|
|
31297
31361
|
};
|
|
31298
|
-
return convertSchema(
|
|
31362
|
+
return convertSchema(schema2, ctx);
|
|
31299
31363
|
}
|
|
31300
31364
|
|
|
31301
31365
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/classic/coerce.js
|
|
@@ -33132,16 +33196,16 @@ function parseIntersectionDef(def2, refs) {
|
|
|
33132
33196
|
].filter((x) => !!x);
|
|
33133
33197
|
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
33134
33198
|
const mergedAllOf = [];
|
|
33135
|
-
allOf.forEach((
|
|
33136
|
-
if (isJsonSchema7AllOfType(
|
|
33137
|
-
mergedAllOf.push(...
|
|
33138
|
-
if (
|
|
33199
|
+
allOf.forEach((schema2) => {
|
|
33200
|
+
if (isJsonSchema7AllOfType(schema2)) {
|
|
33201
|
+
mergedAllOf.push(...schema2.allOf);
|
|
33202
|
+
if (schema2.unevaluatedProperties === void 0) {
|
|
33139
33203
|
unevaluatedProperties = void 0;
|
|
33140
33204
|
}
|
|
33141
33205
|
} else {
|
|
33142
|
-
let nestedSchema =
|
|
33143
|
-
if ("additionalProperties" in
|
|
33144
|
-
const { additionalProperties, ...rest } =
|
|
33206
|
+
let nestedSchema = schema2;
|
|
33207
|
+
if ("additionalProperties" in schema2 && schema2.additionalProperties === false) {
|
|
33208
|
+
const { additionalProperties, ...rest } = schema2;
|
|
33145
33209
|
nestedSchema = rest;
|
|
33146
33210
|
} else {
|
|
33147
33211
|
unevaluatedProperties = void 0;
|
|
@@ -33368,60 +33432,60 @@ function escapeNonAlphaNumeric(source) {
|
|
|
33368
33432
|
}
|
|
33369
33433
|
return result;
|
|
33370
33434
|
}
|
|
33371
|
-
function addFormat(
|
|
33372
|
-
if (
|
|
33373
|
-
if (!
|
|
33374
|
-
|
|
33435
|
+
function addFormat(schema2, value, message, refs) {
|
|
33436
|
+
if (schema2.format || schema2.anyOf?.some((x) => x.format)) {
|
|
33437
|
+
if (!schema2.anyOf) {
|
|
33438
|
+
schema2.anyOf = [];
|
|
33375
33439
|
}
|
|
33376
|
-
if (
|
|
33377
|
-
|
|
33378
|
-
format:
|
|
33379
|
-
...
|
|
33380
|
-
errorMessage: { format:
|
|
33440
|
+
if (schema2.format) {
|
|
33441
|
+
schema2.anyOf.push({
|
|
33442
|
+
format: schema2.format,
|
|
33443
|
+
...schema2.errorMessage && refs.errorMessages && {
|
|
33444
|
+
errorMessage: { format: schema2.errorMessage.format }
|
|
33381
33445
|
}
|
|
33382
33446
|
});
|
|
33383
|
-
delete
|
|
33384
|
-
if (
|
|
33385
|
-
delete
|
|
33386
|
-
if (Object.keys(
|
|
33387
|
-
delete
|
|
33447
|
+
delete schema2.format;
|
|
33448
|
+
if (schema2.errorMessage) {
|
|
33449
|
+
delete schema2.errorMessage.format;
|
|
33450
|
+
if (Object.keys(schema2.errorMessage).length === 0) {
|
|
33451
|
+
delete schema2.errorMessage;
|
|
33388
33452
|
}
|
|
33389
33453
|
}
|
|
33390
33454
|
}
|
|
33391
|
-
|
|
33455
|
+
schema2.anyOf.push({
|
|
33392
33456
|
format: value,
|
|
33393
33457
|
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
33394
33458
|
});
|
|
33395
33459
|
} else {
|
|
33396
|
-
setResponseValueAndErrors(
|
|
33460
|
+
setResponseValueAndErrors(schema2, "format", value, message, refs);
|
|
33397
33461
|
}
|
|
33398
33462
|
}
|
|
33399
|
-
function addPattern(
|
|
33400
|
-
if (
|
|
33401
|
-
if (!
|
|
33402
|
-
|
|
33463
|
+
function addPattern(schema2, regex, message, refs) {
|
|
33464
|
+
if (schema2.pattern || schema2.allOf?.some((x) => x.pattern)) {
|
|
33465
|
+
if (!schema2.allOf) {
|
|
33466
|
+
schema2.allOf = [];
|
|
33403
33467
|
}
|
|
33404
|
-
if (
|
|
33405
|
-
|
|
33406
|
-
pattern:
|
|
33407
|
-
...
|
|
33408
|
-
errorMessage: { pattern:
|
|
33468
|
+
if (schema2.pattern) {
|
|
33469
|
+
schema2.allOf.push({
|
|
33470
|
+
pattern: schema2.pattern,
|
|
33471
|
+
...schema2.errorMessage && refs.errorMessages && {
|
|
33472
|
+
errorMessage: { pattern: schema2.errorMessage.pattern }
|
|
33409
33473
|
}
|
|
33410
33474
|
});
|
|
33411
|
-
delete
|
|
33412
|
-
if (
|
|
33413
|
-
delete
|
|
33414
|
-
if (Object.keys(
|
|
33415
|
-
delete
|
|
33475
|
+
delete schema2.pattern;
|
|
33476
|
+
if (schema2.errorMessage) {
|
|
33477
|
+
delete schema2.errorMessage.pattern;
|
|
33478
|
+
if (Object.keys(schema2.errorMessage).length === 0) {
|
|
33479
|
+
delete schema2.errorMessage;
|
|
33416
33480
|
}
|
|
33417
33481
|
}
|
|
33418
33482
|
}
|
|
33419
|
-
|
|
33483
|
+
schema2.allOf.push({
|
|
33420
33484
|
pattern: stringifyRegExpWithFlags(regex, refs),
|
|
33421
33485
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
33422
33486
|
});
|
|
33423
33487
|
} else {
|
|
33424
|
-
setResponseValueAndErrors(
|
|
33488
|
+
setResponseValueAndErrors(schema2, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
|
|
33425
33489
|
}
|
|
33426
33490
|
}
|
|
33427
33491
|
function stringifyRegExpWithFlags(regex, refs) {
|
|
@@ -33519,7 +33583,7 @@ function parseRecordDef(def2, refs) {
|
|
|
33519
33583
|
additionalProperties: refs.rejectedAdditionalProperties
|
|
33520
33584
|
};
|
|
33521
33585
|
}
|
|
33522
|
-
const
|
|
33586
|
+
const schema2 = {
|
|
33523
33587
|
type: "object",
|
|
33524
33588
|
additionalProperties: parseDef(def2.valueType._def, {
|
|
33525
33589
|
...refs,
|
|
@@ -33527,17 +33591,17 @@ function parseRecordDef(def2, refs) {
|
|
|
33527
33591
|
}) ?? refs.allowedAdditionalProperties
|
|
33528
33592
|
};
|
|
33529
33593
|
if (refs.target === "openApi3") {
|
|
33530
|
-
return
|
|
33594
|
+
return schema2;
|
|
33531
33595
|
}
|
|
33532
33596
|
if (def2.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def2.keyType._def.checks?.length) {
|
|
33533
33597
|
const { type, ...keyType } = parseStringDef(def2.keyType._def, refs);
|
|
33534
33598
|
return {
|
|
33535
|
-
...
|
|
33599
|
+
...schema2,
|
|
33536
33600
|
propertyNames: keyType
|
|
33537
33601
|
};
|
|
33538
33602
|
} else if (def2.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
|
|
33539
33603
|
return {
|
|
33540
|
-
...
|
|
33604
|
+
...schema2,
|
|
33541
33605
|
propertyNames: {
|
|
33542
33606
|
enum: def2.keyType._def.values
|
|
33543
33607
|
}
|
|
@@ -33545,11 +33609,11 @@ function parseRecordDef(def2, refs) {
|
|
|
33545
33609
|
} else if (def2.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def2.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def2.keyType._def.type._def.checks?.length) {
|
|
33546
33610
|
const { type, ...keyType } = parseBrandedDef(def2.keyType._def, refs);
|
|
33547
33611
|
return {
|
|
33548
|
-
...
|
|
33612
|
+
...schema2,
|
|
33549
33613
|
propertyNames: keyType
|
|
33550
33614
|
};
|
|
33551
33615
|
}
|
|
33552
|
-
return
|
|
33616
|
+
return schema2;
|
|
33553
33617
|
}
|
|
33554
33618
|
|
|
33555
33619
|
// ../../.yarn/__virtual__/zod-to-json-schema-virtual-00ec010bf6/0/cache/zod-to-json-schema-npm-3.25.1-850d9216b4-711b30e34d.zip/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
@@ -33822,9 +33886,9 @@ function decideAdditionalProperties(def2, refs) {
|
|
|
33822
33886
|
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
33823
33887
|
}
|
|
33824
33888
|
}
|
|
33825
|
-
function safeIsOptional(
|
|
33889
|
+
function safeIsOptional(schema2) {
|
|
33826
33890
|
try {
|
|
33827
|
-
return
|
|
33891
|
+
return schema2.isOptional();
|
|
33828
33892
|
} catch {
|
|
33829
33893
|
return true;
|
|
33830
33894
|
}
|
|
@@ -33880,18 +33944,18 @@ function parseSetDef(def2, refs) {
|
|
|
33880
33944
|
...refs,
|
|
33881
33945
|
currentPath: [...refs.currentPath, "items"]
|
|
33882
33946
|
});
|
|
33883
|
-
const
|
|
33947
|
+
const schema2 = {
|
|
33884
33948
|
type: "array",
|
|
33885
33949
|
uniqueItems: true,
|
|
33886
33950
|
items
|
|
33887
33951
|
};
|
|
33888
33952
|
if (def2.minSize) {
|
|
33889
|
-
setResponseValueAndErrors(
|
|
33953
|
+
setResponseValueAndErrors(schema2, "minItems", def2.minSize.value, def2.minSize.message, refs);
|
|
33890
33954
|
}
|
|
33891
33955
|
if (def2.maxSize) {
|
|
33892
|
-
setResponseValueAndErrors(
|
|
33956
|
+
setResponseValueAndErrors(schema2, "maxItems", def2.maxSize.value, def2.maxSize.message, refs);
|
|
33893
33957
|
}
|
|
33894
|
-
return
|
|
33958
|
+
return schema2;
|
|
33895
33959
|
}
|
|
33896
33960
|
|
|
33897
33961
|
// ../../.yarn/__virtual__/zod-to-json-schema-virtual-00ec010bf6/0/cache/zod-to-json-schema-npm-3.25.1-850d9216b4-711b30e34d.zip/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
@@ -34072,17 +34136,17 @@ var addMeta = (def2, refs, jsonSchema) => {
|
|
|
34072
34136
|
};
|
|
34073
34137
|
|
|
34074
34138
|
// ../../.yarn/__virtual__/zod-to-json-schema-virtual-00ec010bf6/0/cache/zod-to-json-schema-npm-3.25.1-850d9216b4-711b30e34d.zip/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
34075
|
-
var zodToJsonSchema = (
|
|
34139
|
+
var zodToJsonSchema = (schema2, options) => {
|
|
34076
34140
|
const refs = getRefs(options);
|
|
34077
|
-
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2,
|
|
34141
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema3]) => ({
|
|
34078
34142
|
...acc,
|
|
34079
|
-
[name2]: parseDef(
|
|
34143
|
+
[name2]: parseDef(schema3._def, {
|
|
34080
34144
|
...refs,
|
|
34081
34145
|
currentPath: [...refs.basePath, refs.definitionPath, name2]
|
|
34082
34146
|
}, true) ?? parseAnyDef(refs)
|
|
34083
34147
|
}), {}) : void 0;
|
|
34084
34148
|
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
34085
|
-
const main = parseDef(
|
|
34149
|
+
const main = parseDef(schema2._def, name === void 0 ? refs : {
|
|
34086
34150
|
...refs,
|
|
34087
34151
|
currentPath: [...refs.basePath, refs.definitionPath, name]
|
|
34088
34152
|
}, false) ?? parseAnyDef(refs);
|
|
@@ -34143,20 +34207,20 @@ function mapMiniTarget(t) {
|
|
|
34143
34207
|
return "draft-2020-12";
|
|
34144
34208
|
return "draft-7";
|
|
34145
34209
|
}
|
|
34146
|
-
function toJsonSchemaCompat(
|
|
34147
|
-
if (isZ4Schema(
|
|
34148
|
-
return toJSONSchema(
|
|
34210
|
+
function toJsonSchemaCompat(schema2, opts) {
|
|
34211
|
+
if (isZ4Schema(schema2)) {
|
|
34212
|
+
return toJSONSchema(schema2, {
|
|
34149
34213
|
target: mapMiniTarget(opts?.target),
|
|
34150
34214
|
io: opts?.pipeStrategy ?? "input"
|
|
34151
34215
|
});
|
|
34152
34216
|
}
|
|
34153
|
-
return zodToJsonSchema(
|
|
34217
|
+
return zodToJsonSchema(schema2, {
|
|
34154
34218
|
strictUnions: opts?.strictUnions ?? true,
|
|
34155
34219
|
pipeStrategy: opts?.pipeStrategy ?? "input"
|
|
34156
34220
|
});
|
|
34157
34221
|
}
|
|
34158
|
-
function getMethodLiteral(
|
|
34159
|
-
const shape = getObjectShape(
|
|
34222
|
+
function getMethodLiteral(schema2) {
|
|
34223
|
+
const shape = getObjectShape(schema2);
|
|
34160
34224
|
const methodSchema = shape?.method;
|
|
34161
34225
|
if (!methodSchema) {
|
|
34162
34226
|
throw new Error("Schema is missing a method literal");
|
|
@@ -34167,8 +34231,8 @@ function getMethodLiteral(schema) {
|
|
|
34167
34231
|
}
|
|
34168
34232
|
return value;
|
|
34169
34233
|
}
|
|
34170
|
-
function parseWithCompat(
|
|
34171
|
-
const result = safeParse2(
|
|
34234
|
+
function parseWithCompat(schema2, data) {
|
|
34235
|
+
const result = safeParse2(schema2, data);
|
|
34172
34236
|
if (!result.success) {
|
|
34173
34237
|
throw result.error;
|
|
34174
34238
|
}
|
|
@@ -35170,8 +35234,8 @@ var AjvJsonSchemaValidator = class {
|
|
|
35170
35234
|
* @param schema - Standard JSON Schema object
|
|
35171
35235
|
* @returns A validator function that validates input data
|
|
35172
35236
|
*/
|
|
35173
|
-
getValidator(
|
|
35174
|
-
const ajvValidator = "$id" in
|
|
35237
|
+
getValidator(schema2) {
|
|
35238
|
+
const ajvValidator = "$id" in schema2 && typeof schema2.$id === "string" ? this._ajv.getSchema(schema2.$id) ?? this._ajv.compile(schema2) : this._ajv.compile(schema2);
|
|
35175
35239
|
return (input) => {
|
|
35176
35240
|
const valid = ajvValidator(input);
|
|
35177
35241
|
if (valid) {
|
|
@@ -35680,11 +35744,11 @@ var Server = class extends Protocol {
|
|
|
35680
35744
|
|
|
35681
35745
|
// ../../.yarn/__virtual__/@modelcontextprotocol-sdk-virtual-4beea6215a/0/cache/@modelcontextprotocol-sdk-npm-1.26.0-380479a6f8-b4098789d9.zip/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
35682
35746
|
var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
|
|
35683
|
-
function isCompletable(
|
|
35684
|
-
return !!
|
|
35747
|
+
function isCompletable(schema2) {
|
|
35748
|
+
return !!schema2 && typeof schema2 === "object" && COMPLETABLE_SYMBOL in schema2;
|
|
35685
35749
|
}
|
|
35686
|
-
function getCompleter(
|
|
35687
|
-
const meta3 =
|
|
35750
|
+
function getCompleter(schema2) {
|
|
35751
|
+
const meta3 = schema2[COMPLETABLE_SYMBOL];
|
|
35688
35752
|
return meta3?.complete;
|
|
35689
35753
|
}
|
|
35690
35754
|
var McpZodTypeKind;
|
|
@@ -36500,17 +36564,17 @@ function isZodRawShapeCompat(obj) {
|
|
|
36500
36564
|
}
|
|
36501
36565
|
return Object.values(obj).some(isZodTypeLike);
|
|
36502
36566
|
}
|
|
36503
|
-
function getZodSchemaObject(
|
|
36504
|
-
if (!
|
|
36567
|
+
function getZodSchemaObject(schema2) {
|
|
36568
|
+
if (!schema2) {
|
|
36505
36569
|
return void 0;
|
|
36506
36570
|
}
|
|
36507
|
-
if (isZodRawShapeCompat(
|
|
36508
|
-
return objectFromShape(
|
|
36571
|
+
if (isZodRawShapeCompat(schema2)) {
|
|
36572
|
+
return objectFromShape(schema2);
|
|
36509
36573
|
}
|
|
36510
|
-
return
|
|
36574
|
+
return schema2;
|
|
36511
36575
|
}
|
|
36512
|
-
function promptArgumentsFromSchema(
|
|
36513
|
-
const shape = getObjectShape(
|
|
36576
|
+
function promptArgumentsFromSchema(schema2) {
|
|
36577
|
+
const shape = getObjectShape(schema2);
|
|
36514
36578
|
if (!shape)
|
|
36515
36579
|
return [];
|
|
36516
36580
|
return Object.entries(shape).map(([name, field]) => {
|
|
@@ -36523,8 +36587,8 @@ function promptArgumentsFromSchema(schema) {
|
|
|
36523
36587
|
};
|
|
36524
36588
|
});
|
|
36525
36589
|
}
|
|
36526
|
-
function getMethodValue(
|
|
36527
|
-
const shape = getObjectShape(
|
|
36590
|
+
function getMethodValue(schema2) {
|
|
36591
|
+
const shape = getObjectShape(schema2);
|
|
36528
36592
|
const methodSchema = shape?.method;
|
|
36529
36593
|
if (!methodSchema) {
|
|
36530
36594
|
throw new Error("Schema is missing a method literal");
|
|
@@ -36678,7 +36742,7 @@ async function mcp() {
|
|
|
36678
36742
|
setMcpMode();
|
|
36679
36743
|
const server = new McpServer({
|
|
36680
36744
|
name: "reporting-bi",
|
|
36681
|
-
version: "0.1.
|
|
36745
|
+
version: "0.1.18"
|
|
36682
36746
|
});
|
|
36683
36747
|
server.tool(
|
|
36684
36748
|
"status",
|
|
@@ -37219,8 +37283,8 @@ async function checkForUpdate() {
|
|
|
37219
37283
|
saveUpdateCheck({ lastCheck: now });
|
|
37220
37284
|
const latest = await fetchLatestVersion();
|
|
37221
37285
|
if (!latest) return;
|
|
37222
|
-
if (!isNewer(latest, "0.1.
|
|
37223
|
-
console.error(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.1.
|
|
37286
|
+
if (!isNewer(latest, "0.1.18")) return;
|
|
37287
|
+
console.error(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.1.18"} \u2192 ${latest}...\x1B[0m`);
|
|
37224
37288
|
(0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: ["ignore", 2, 2] });
|
|
37225
37289
|
console.error(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
37226
37290
|
} catch {
|
|
@@ -37232,11 +37296,11 @@ async function forceUpdate() {
|
|
|
37232
37296
|
console.error("Could not fetch latest version from npm.");
|
|
37233
37297
|
process.exit(1);
|
|
37234
37298
|
}
|
|
37235
|
-
if (!isNewer(latest, "0.1.
|
|
37236
|
-
console.log(`Already up to date (${"0.1.
|
|
37299
|
+
if (!isNewer(latest, "0.1.18")) {
|
|
37300
|
+
console.log(`Already up to date (${"0.1.18"}).`);
|
|
37237
37301
|
return;
|
|
37238
37302
|
}
|
|
37239
|
-
console.log(`Updating ${PACKAGE_NAME} ${"0.1.
|
|
37303
|
+
console.log(`Updating ${PACKAGE_NAME} ${"0.1.18"} \u2192 ${latest}...`);
|
|
37240
37304
|
(0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
|
|
37241
37305
|
console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
37242
37306
|
saveUpdateCheck({ lastCheck: Date.now() });
|
|
@@ -37280,6 +37344,7 @@ ETL:
|
|
|
37280
37344
|
etl abort <spid> Abort a running exec (exec reports "rpbi: spid <n>" on stderr)
|
|
37281
37345
|
etl search <query> Search threads
|
|
37282
37346
|
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)
|
|
37347
|
+
etl schema [--version <v>] [--dir <path>] SQL completion catalogue of the company's data and ETL databases (tables, views, procedures, functions; --json prints it, --version <v> of the last answer gets "databases": null when nothing changed)
|
|
37283
37348
|
etl pull [--dir <path>] [--no-context] Pull all ETL threads, parameters, metadata & schema to local files
|
|
37284
37349
|
etl push [files...] [--dir <path>] [--force] Push modified/new .sql files back to server
|
|
37285
37350
|
etl status [--dir <path>] [--remote] [--json] Show local changes (--remote compares with server)
|
|
@@ -37430,7 +37495,7 @@ Examples:
|
|
|
37430
37495
|
(async () => {
|
|
37431
37496
|
const [command, ...args] = process.argv.slice(2);
|
|
37432
37497
|
if (command === "--version" || command === "-v") {
|
|
37433
|
-
console.log("0.1.
|
|
37498
|
+
console.log("0.1.18");
|
|
37434
37499
|
return;
|
|
37435
37500
|
}
|
|
37436
37501
|
await checkForUpdate();
|
|
@@ -37499,6 +37564,11 @@ Examples:
|
|
|
37499
37564
|
init(args);
|
|
37500
37565
|
break;
|
|
37501
37566
|
default:
|
|
37567
|
+
if (command) {
|
|
37568
|
+
console.error(`Unknown command: ${command}. Run rpbi without arguments for usage.`);
|
|
37569
|
+
process.exitCode = 1;
|
|
37570
|
+
break;
|
|
37571
|
+
}
|
|
37502
37572
|
printLogo();
|
|
37503
37573
|
console.log();
|
|
37504
37574
|
console.log(USAGE_default);
|