@chosengeneration/light-code 0.99.0 → 0.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +998 -654
- package/dist/server.cjs +995 -651
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -17821,52 +17821,52 @@ var require_util8 = __commonJS({
|
|
|
17821
17821
|
return hash2;
|
|
17822
17822
|
}
|
|
17823
17823
|
exports2.toHash = toHash;
|
|
17824
|
-
function alwaysValidSchema(it,
|
|
17825
|
-
if (typeof
|
|
17826
|
-
return
|
|
17827
|
-
if (Object.keys(
|
|
17824
|
+
function alwaysValidSchema(it, schema3) {
|
|
17825
|
+
if (typeof schema3 == "boolean")
|
|
17826
|
+
return schema3;
|
|
17827
|
+
if (Object.keys(schema3).length === 0)
|
|
17828
17828
|
return true;
|
|
17829
|
-
checkUnknownRules(it,
|
|
17830
|
-
return !schemaHasRules(
|
|
17829
|
+
checkUnknownRules(it, schema3);
|
|
17830
|
+
return !schemaHasRules(schema3, it.self.RULES.all);
|
|
17831
17831
|
}
|
|
17832
17832
|
exports2.alwaysValidSchema = alwaysValidSchema;
|
|
17833
|
-
function checkUnknownRules(it,
|
|
17833
|
+
function checkUnknownRules(it, schema3 = it.schema) {
|
|
17834
17834
|
const { opts, self } = it;
|
|
17835
17835
|
if (!opts.strictSchema)
|
|
17836
17836
|
return;
|
|
17837
|
-
if (typeof
|
|
17837
|
+
if (typeof schema3 === "boolean")
|
|
17838
17838
|
return;
|
|
17839
17839
|
const rules = self.RULES.keywords;
|
|
17840
|
-
for (const key in
|
|
17840
|
+
for (const key in schema3) {
|
|
17841
17841
|
if (!rules[key])
|
|
17842
17842
|
checkStrictMode(it, `unknown keyword: "${key}"`);
|
|
17843
17843
|
}
|
|
17844
17844
|
}
|
|
17845
17845
|
exports2.checkUnknownRules = checkUnknownRules;
|
|
17846
|
-
function schemaHasRules(
|
|
17847
|
-
if (typeof
|
|
17848
|
-
return !
|
|
17849
|
-
for (const key in
|
|
17846
|
+
function schemaHasRules(schema3, rules) {
|
|
17847
|
+
if (typeof schema3 == "boolean")
|
|
17848
|
+
return !schema3;
|
|
17849
|
+
for (const key in schema3)
|
|
17850
17850
|
if (rules[key])
|
|
17851
17851
|
return true;
|
|
17852
17852
|
return false;
|
|
17853
17853
|
}
|
|
17854
17854
|
exports2.schemaHasRules = schemaHasRules;
|
|
17855
|
-
function schemaHasRulesButRef(
|
|
17856
|
-
if (typeof
|
|
17857
|
-
return !
|
|
17858
|
-
for (const key in
|
|
17855
|
+
function schemaHasRulesButRef(schema3, RULES) {
|
|
17856
|
+
if (typeof schema3 == "boolean")
|
|
17857
|
+
return !schema3;
|
|
17858
|
+
for (const key in schema3)
|
|
17859
17859
|
if (key !== "$ref" && RULES.all[key])
|
|
17860
17860
|
return true;
|
|
17861
17861
|
return false;
|
|
17862
17862
|
}
|
|
17863
17863
|
exports2.schemaHasRulesButRef = schemaHasRulesButRef;
|
|
17864
|
-
function schemaRefOrVal({ topSchemaRef, schemaPath },
|
|
17864
|
+
function schemaRefOrVal({ topSchemaRef, schemaPath }, schema3, keyword, $data) {
|
|
17865
17865
|
if (!$data) {
|
|
17866
|
-
if (typeof
|
|
17867
|
-
return
|
|
17868
|
-
if (typeof
|
|
17869
|
-
return (0, codegen_1._)`${
|
|
17866
|
+
if (typeof schema3 == "number" || typeof schema3 == "boolean")
|
|
17867
|
+
return schema3;
|
|
17868
|
+
if (typeof schema3 == "string")
|
|
17869
|
+
return (0, codegen_1._)`${schema3}`;
|
|
17870
17870
|
}
|
|
17871
17871
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
17872
17872
|
}
|
|
@@ -18147,10 +18147,10 @@ var require_boolSchema = __commonJS({
|
|
|
18147
18147
|
message: "boolean schema is false"
|
|
18148
18148
|
};
|
|
18149
18149
|
function topBoolOrEmptySchema(it) {
|
|
18150
|
-
const { gen, schema:
|
|
18151
|
-
if (
|
|
18150
|
+
const { gen, schema: schema3, validateName } = it;
|
|
18151
|
+
if (schema3 === false) {
|
|
18152
18152
|
falseSchemaError(it, false);
|
|
18153
|
-
} else if (typeof
|
|
18153
|
+
} else if (typeof schema3 == "object" && schema3.$async === true) {
|
|
18154
18154
|
gen.return(names_1.default.data);
|
|
18155
18155
|
} else {
|
|
18156
18156
|
gen.assign((0, codegen_1._)`${validateName}.errors`, null);
|
|
@@ -18159,8 +18159,8 @@ var require_boolSchema = __commonJS({
|
|
|
18159
18159
|
}
|
|
18160
18160
|
exports2.topBoolOrEmptySchema = topBoolOrEmptySchema;
|
|
18161
18161
|
function boolOrEmptySchema(it, valid) {
|
|
18162
|
-
const { gen, schema:
|
|
18163
|
-
if (
|
|
18162
|
+
const { gen, schema: schema3 } = it;
|
|
18163
|
+
if (schema3 === false) {
|
|
18164
18164
|
gen.var(valid, false);
|
|
18165
18165
|
falseSchemaError(it);
|
|
18166
18166
|
} else {
|
|
@@ -18222,18 +18222,18 @@ var require_applicability = __commonJS({
|
|
|
18222
18222
|
"use strict";
|
|
18223
18223
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18224
18224
|
exports2.shouldUseRule = exports2.shouldUseGroup = exports2.schemaHasRulesForType = void 0;
|
|
18225
|
-
function schemaHasRulesForType({ schema:
|
|
18225
|
+
function schemaHasRulesForType({ schema: schema3, self }, type) {
|
|
18226
18226
|
const group = self.RULES.types[type];
|
|
18227
|
-
return group && group !== true && shouldUseGroup(
|
|
18227
|
+
return group && group !== true && shouldUseGroup(schema3, group);
|
|
18228
18228
|
}
|
|
18229
18229
|
exports2.schemaHasRulesForType = schemaHasRulesForType;
|
|
18230
|
-
function shouldUseGroup(
|
|
18231
|
-
return group.rules.some((rule) => shouldUseRule(
|
|
18230
|
+
function shouldUseGroup(schema3, group) {
|
|
18231
|
+
return group.rules.some((rule) => shouldUseRule(schema3, rule));
|
|
18232
18232
|
}
|
|
18233
18233
|
exports2.shouldUseGroup = shouldUseGroup;
|
|
18234
|
-
function shouldUseRule(
|
|
18234
|
+
function shouldUseRule(schema3, rule) {
|
|
18235
18235
|
var _a3;
|
|
18236
|
-
return
|
|
18236
|
+
return schema3[rule.keyword] !== void 0 || ((_a3 = rule.definition.implements) === null || _a3 === void 0 ? void 0 : _a3.some((kwd) => schema3[kwd] !== void 0));
|
|
18237
18237
|
}
|
|
18238
18238
|
exports2.shouldUseRule = shouldUseRule;
|
|
18239
18239
|
}
|
|
@@ -18255,17 +18255,17 @@ var require_dataType = __commonJS({
|
|
|
18255
18255
|
DataType2[DataType2["Correct"] = 0] = "Correct";
|
|
18256
18256
|
DataType2[DataType2["Wrong"] = 1] = "Wrong";
|
|
18257
18257
|
})(DataType || (exports2.DataType = DataType = {}));
|
|
18258
|
-
function getSchemaTypes(
|
|
18259
|
-
const types = getJSONTypes(
|
|
18258
|
+
function getSchemaTypes(schema3) {
|
|
18259
|
+
const types = getJSONTypes(schema3.type);
|
|
18260
18260
|
const hasNull = types.includes("null");
|
|
18261
18261
|
if (hasNull) {
|
|
18262
|
-
if (
|
|
18262
|
+
if (schema3.nullable === false)
|
|
18263
18263
|
throw new Error("type: null contradicts nullable: false");
|
|
18264
18264
|
} else {
|
|
18265
|
-
if (!types.length &&
|
|
18265
|
+
if (!types.length && schema3.nullable !== void 0) {
|
|
18266
18266
|
throw new Error('"nullable" cannot be used without "type"');
|
|
18267
18267
|
}
|
|
18268
|
-
if (
|
|
18268
|
+
if (schema3.nullable === true)
|
|
18269
18269
|
types.push("null");
|
|
18270
18270
|
}
|
|
18271
18271
|
return types;
|
|
@@ -18397,8 +18397,8 @@ var require_dataType = __commonJS({
|
|
|
18397
18397
|
}
|
|
18398
18398
|
exports2.checkDataTypes = checkDataTypes;
|
|
18399
18399
|
var typeError = {
|
|
18400
|
-
message: ({ schema:
|
|
18401
|
-
params: ({ schema:
|
|
18400
|
+
message: ({ schema: schema3 }) => `must be ${schema3}`,
|
|
18401
|
+
params: ({ schema: schema3, schemaValue }) => typeof schema3 == "string" ? (0, codegen_1._)`{type: ${schema3}}` : (0, codegen_1._)`{type: ${schemaValue}}`
|
|
18402
18402
|
};
|
|
18403
18403
|
function reportTypeError(it) {
|
|
18404
18404
|
const cxt = getTypeErrorContext(it);
|
|
@@ -18406,16 +18406,16 @@ var require_dataType = __commonJS({
|
|
|
18406
18406
|
}
|
|
18407
18407
|
exports2.reportTypeError = reportTypeError;
|
|
18408
18408
|
function getTypeErrorContext(it) {
|
|
18409
|
-
const { gen, data, schema:
|
|
18410
|
-
const schemaCode = (0, util_1.schemaRefOrVal)(it,
|
|
18409
|
+
const { gen, data, schema: schema3 } = it;
|
|
18410
|
+
const schemaCode = (0, util_1.schemaRefOrVal)(it, schema3, "type");
|
|
18411
18411
|
return {
|
|
18412
18412
|
gen,
|
|
18413
18413
|
keyword: "type",
|
|
18414
18414
|
data,
|
|
18415
|
-
schema:
|
|
18415
|
+
schema: schema3.type,
|
|
18416
18416
|
schemaCode,
|
|
18417
18417
|
schemaValue: schemaCode,
|
|
18418
|
-
parentSchema:
|
|
18418
|
+
parentSchema: schema3,
|
|
18419
18419
|
params: {},
|
|
18420
18420
|
it
|
|
18421
18421
|
};
|
|
@@ -18568,15 +18568,15 @@ var require_code2 = __commonJS({
|
|
|
18568
18568
|
}
|
|
18569
18569
|
exports2.validateArray = validateArray;
|
|
18570
18570
|
function validateUnion(cxt) {
|
|
18571
|
-
const { gen, schema:
|
|
18572
|
-
if (!Array.isArray(
|
|
18571
|
+
const { gen, schema: schema3, keyword, it } = cxt;
|
|
18572
|
+
if (!Array.isArray(schema3))
|
|
18573
18573
|
throw new Error("ajv implementation error");
|
|
18574
|
-
const alwaysValid =
|
|
18574
|
+
const alwaysValid = schema3.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));
|
|
18575
18575
|
if (alwaysValid && !it.opts.unevaluated)
|
|
18576
18576
|
return;
|
|
18577
18577
|
const valid = gen.let("valid", false);
|
|
18578
18578
|
const schValid = gen.name("_valid");
|
|
18579
|
-
gen.block(() =>
|
|
18579
|
+
gen.block(() => schema3.forEach((_sch, i) => {
|
|
18580
18580
|
const schCxt = cxt.subschema({
|
|
18581
18581
|
keyword,
|
|
18582
18582
|
schemaProp: i,
|
|
@@ -18604,8 +18604,8 @@ var require_keyword = __commonJS({
|
|
|
18604
18604
|
var code_1 = require_code2();
|
|
18605
18605
|
var errors_1 = require_errors2();
|
|
18606
18606
|
function macroKeywordCode(cxt, def) {
|
|
18607
|
-
const { gen, keyword, schema:
|
|
18608
|
-
const macroSchema2 = def.macro.call(it.self,
|
|
18607
|
+
const { gen, keyword, schema: schema3, parentSchema, it } = cxt;
|
|
18608
|
+
const macroSchema2 = def.macro.call(it.self, schema3, parentSchema, it);
|
|
18609
18609
|
const schemaRef = useKeyword(gen, keyword, macroSchema2);
|
|
18610
18610
|
if (it.opts.validateSchema !== false)
|
|
18611
18611
|
it.self.validateSchema(macroSchema2, true);
|
|
@@ -18622,9 +18622,9 @@ var require_keyword = __commonJS({
|
|
|
18622
18622
|
exports2.macroKeywordCode = macroKeywordCode;
|
|
18623
18623
|
function funcKeywordCode(cxt, def) {
|
|
18624
18624
|
var _a3;
|
|
18625
|
-
const { gen, keyword, schema:
|
|
18625
|
+
const { gen, keyword, schema: schema3, parentSchema, $data, it } = cxt;
|
|
18626
18626
|
checkAsyncKeyword(it, def);
|
|
18627
|
-
const validate = !$data && def.compile ? def.compile.call(it.self,
|
|
18627
|
+
const validate = !$data && def.compile ? def.compile.call(it.self, schema3, parentSchema, it) : def.validate;
|
|
18628
18628
|
const validateRef = useKeyword(gen, keyword, validate);
|
|
18629
18629
|
const valid = gen.let("valid");
|
|
18630
18630
|
cxt.block$data(valid, validateKeyword);
|
|
@@ -18684,20 +18684,20 @@ var require_keyword = __commonJS({
|
|
|
18684
18684
|
throw new Error(`keyword "${keyword}" failed to compile`);
|
|
18685
18685
|
return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) });
|
|
18686
18686
|
}
|
|
18687
|
-
function validSchemaType(
|
|
18688
|
-
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(
|
|
18687
|
+
function validSchemaType(schema3, schemaType, allowUndefined = false) {
|
|
18688
|
+
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema3) : st === "object" ? schema3 && typeof schema3 == "object" && !Array.isArray(schema3) : typeof schema3 == st || allowUndefined && typeof schema3 == "undefined");
|
|
18689
18689
|
}
|
|
18690
18690
|
exports2.validSchemaType = validSchemaType;
|
|
18691
|
-
function validateKeywordUsage({ schema:
|
|
18691
|
+
function validateKeywordUsage({ schema: schema3, opts, self, errSchemaPath }, def, keyword) {
|
|
18692
18692
|
if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {
|
|
18693
18693
|
throw new Error("ajv implementation error");
|
|
18694
18694
|
}
|
|
18695
18695
|
const deps = def.dependencies;
|
|
18696
|
-
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(
|
|
18696
|
+
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema3, kwd))) {
|
|
18697
18697
|
throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`);
|
|
18698
18698
|
}
|
|
18699
18699
|
if (def.validateSchema) {
|
|
18700
|
-
const valid = def.validateSchema(
|
|
18700
|
+
const valid = def.validateSchema(schema3[keyword]);
|
|
18701
18701
|
if (!valid) {
|
|
18702
18702
|
const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def.validateSchema.errors);
|
|
18703
18703
|
if (opts.validateSchema === "log")
|
|
@@ -18719,8 +18719,8 @@ var require_subschema = __commonJS({
|
|
|
18719
18719
|
exports2.extendSubschemaMode = exports2.extendSubschemaData = exports2.getSubschema = void 0;
|
|
18720
18720
|
var codegen_1 = require_codegen();
|
|
18721
18721
|
var util_1 = require_util8();
|
|
18722
|
-
function getSubschema(it, { keyword, schemaProp, schema:
|
|
18723
|
-
if (keyword !== void 0 &&
|
|
18722
|
+
function getSubschema(it, { keyword, schemaProp, schema: schema3, schemaPath, errSchemaPath, topSchemaRef }) {
|
|
18723
|
+
if (keyword !== void 0 && schema3 !== void 0) {
|
|
18724
18724
|
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
18725
18725
|
}
|
|
18726
18726
|
if (keyword !== void 0) {
|
|
@@ -18735,12 +18735,12 @@ var require_subschema = __commonJS({
|
|
|
18735
18735
|
errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`
|
|
18736
18736
|
};
|
|
18737
18737
|
}
|
|
18738
|
-
if (
|
|
18738
|
+
if (schema3 !== void 0) {
|
|
18739
18739
|
if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
|
|
18740
18740
|
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
|
18741
18741
|
}
|
|
18742
18742
|
return {
|
|
18743
|
-
schema:
|
|
18743
|
+
schema: schema3,
|
|
18744
18744
|
schemaPath,
|
|
18745
18745
|
topSchemaRef,
|
|
18746
18746
|
errSchemaPath
|
|
@@ -18833,7 +18833,7 @@ var require_fast_deep_equal = __commonJS({
|
|
|
18833
18833
|
var require_json_schema_traverse = __commonJS({
|
|
18834
18834
|
"../../node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js"(exports2, module2) {
|
|
18835
18835
|
"use strict";
|
|
18836
|
-
var traverse = module2.exports = function(
|
|
18836
|
+
var traverse = module2.exports = function(schema3, opts, cb) {
|
|
18837
18837
|
if (typeof opts == "function") {
|
|
18838
18838
|
cb = opts;
|
|
18839
18839
|
opts = {};
|
|
@@ -18843,7 +18843,7 @@ var require_json_schema_traverse = __commonJS({
|
|
|
18843
18843
|
};
|
|
18844
18844
|
var post = cb.post || function() {
|
|
18845
18845
|
};
|
|
18846
|
-
_traverse(opts, pre, post,
|
|
18846
|
+
_traverse(opts, pre, post, schema3, "", schema3);
|
|
18847
18847
|
};
|
|
18848
18848
|
traverse.keywords = {
|
|
18849
18849
|
additionalItems: true,
|
|
@@ -18889,26 +18889,26 @@ var require_json_schema_traverse = __commonJS({
|
|
|
18889
18889
|
maxProperties: true,
|
|
18890
18890
|
minProperties: true
|
|
18891
18891
|
};
|
|
18892
|
-
function _traverse(opts, pre, post,
|
|
18893
|
-
if (
|
|
18894
|
-
pre(
|
|
18895
|
-
for (var key in
|
|
18896
|
-
var sch =
|
|
18892
|
+
function _traverse(opts, pre, post, schema3, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
18893
|
+
if (schema3 && typeof schema3 == "object" && !Array.isArray(schema3)) {
|
|
18894
|
+
pre(schema3, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
18895
|
+
for (var key in schema3) {
|
|
18896
|
+
var sch = schema3[key];
|
|
18897
18897
|
if (Array.isArray(sch)) {
|
|
18898
18898
|
if (key in traverse.arrayKeywords) {
|
|
18899
18899
|
for (var i = 0; i < sch.length; i++)
|
|
18900
|
-
_traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key,
|
|
18900
|
+
_traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key, schema3, i);
|
|
18901
18901
|
}
|
|
18902
18902
|
} else if (key in traverse.propsKeywords) {
|
|
18903
18903
|
if (sch && typeof sch == "object") {
|
|
18904
18904
|
for (var prop in sch)
|
|
18905
|
-
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key,
|
|
18905
|
+
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema3, prop);
|
|
18906
18906
|
}
|
|
18907
18907
|
} else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) {
|
|
18908
|
-
_traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key,
|
|
18908
|
+
_traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema3);
|
|
18909
18909
|
}
|
|
18910
18910
|
}
|
|
18911
|
-
post(
|
|
18911
|
+
post(schema3, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
18912
18912
|
}
|
|
18913
18913
|
}
|
|
18914
18914
|
function escapeJsonPtr(str) {
|
|
@@ -18944,14 +18944,14 @@ var require_resolve = __commonJS({
|
|
|
18944
18944
|
"enum",
|
|
18945
18945
|
"const"
|
|
18946
18946
|
]);
|
|
18947
|
-
function inlineRef(
|
|
18948
|
-
if (typeof
|
|
18947
|
+
function inlineRef(schema3, limit = true) {
|
|
18948
|
+
if (typeof schema3 == "boolean")
|
|
18949
18949
|
return true;
|
|
18950
18950
|
if (limit === true)
|
|
18951
|
-
return !hasRef(
|
|
18951
|
+
return !hasRef(schema3);
|
|
18952
18952
|
if (!limit)
|
|
18953
18953
|
return false;
|
|
18954
|
-
return countKeys(
|
|
18954
|
+
return countKeys(schema3) <= limit;
|
|
18955
18955
|
}
|
|
18956
18956
|
exports2.inlineRef = inlineRef;
|
|
18957
18957
|
var REF_KEYWORDS = /* @__PURE__ */ new Set([
|
|
@@ -18961,11 +18961,11 @@ var require_resolve = __commonJS({
|
|
|
18961
18961
|
"$dynamicRef",
|
|
18962
18962
|
"$dynamicAnchor"
|
|
18963
18963
|
]);
|
|
18964
|
-
function hasRef(
|
|
18965
|
-
for (const key in
|
|
18964
|
+
function hasRef(schema3) {
|
|
18965
|
+
for (const key in schema3) {
|
|
18966
18966
|
if (REF_KEYWORDS.has(key))
|
|
18967
18967
|
return true;
|
|
18968
|
-
const sch =
|
|
18968
|
+
const sch = schema3[key];
|
|
18969
18969
|
if (Array.isArray(sch) && sch.some(hasRef))
|
|
18970
18970
|
return true;
|
|
18971
18971
|
if (typeof sch == "object" && hasRef(sch))
|
|
@@ -18973,16 +18973,16 @@ var require_resolve = __commonJS({
|
|
|
18973
18973
|
}
|
|
18974
18974
|
return false;
|
|
18975
18975
|
}
|
|
18976
|
-
function countKeys(
|
|
18976
|
+
function countKeys(schema3) {
|
|
18977
18977
|
let count2 = 0;
|
|
18978
|
-
for (const key in
|
|
18978
|
+
for (const key in schema3) {
|
|
18979
18979
|
if (key === "$ref")
|
|
18980
18980
|
return Infinity;
|
|
18981
18981
|
count2++;
|
|
18982
18982
|
if (SIMPLE_INLINED.has(key))
|
|
18983
18983
|
continue;
|
|
18984
|
-
if (typeof
|
|
18985
|
-
(0, util_1.eachItem)(
|
|
18984
|
+
if (typeof schema3[key] == "object") {
|
|
18985
|
+
(0, util_1.eachItem)(schema3[key], (sch) => count2 += countKeys(sch));
|
|
18986
18986
|
}
|
|
18987
18987
|
if (count2 === Infinity)
|
|
18988
18988
|
return Infinity;
|
|
@@ -19012,16 +19012,16 @@ var require_resolve = __commonJS({
|
|
|
19012
19012
|
}
|
|
19013
19013
|
exports2.resolveUrl = resolveUrl;
|
|
19014
19014
|
var ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
19015
|
-
function getSchemaRefs(
|
|
19016
|
-
if (typeof
|
|
19015
|
+
function getSchemaRefs(schema3, baseId) {
|
|
19016
|
+
if (typeof schema3 == "boolean")
|
|
19017
19017
|
return {};
|
|
19018
19018
|
const { schemaId, uriResolver } = this.opts;
|
|
19019
|
-
const schId = normalizeId(
|
|
19019
|
+
const schId = normalizeId(schema3[schemaId] || baseId);
|
|
19020
19020
|
const baseIds = { "": schId };
|
|
19021
19021
|
const pathPrefix = getFullPath(uriResolver, schId, false);
|
|
19022
19022
|
const localRefs = {};
|
|
19023
19023
|
const schemaRefs = /* @__PURE__ */ new Set();
|
|
19024
|
-
traverse(
|
|
19024
|
+
traverse(schema3, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
|
|
19025
19025
|
if (parentJsonPtr === void 0)
|
|
19026
19026
|
return;
|
|
19027
19027
|
const fullPath = pathPrefix + jsonPtr;
|
|
@@ -19102,15 +19102,15 @@ var require_validate = __commonJS({
|
|
|
19102
19102
|
validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
|
|
19103
19103
|
}
|
|
19104
19104
|
exports2.validateFunctionCode = validateFunctionCode;
|
|
19105
|
-
function validateFunction({ gen, validateName, schema:
|
|
19105
|
+
function validateFunction({ gen, validateName, schema: schema3, schemaEnv, opts }, body) {
|
|
19106
19106
|
if (opts.code.es5) {
|
|
19107
19107
|
gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
|
|
19108
|
-
gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(
|
|
19108
|
+
gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema3, opts)}`);
|
|
19109
19109
|
destructureValCxtES5(gen, opts);
|
|
19110
19110
|
gen.code(body);
|
|
19111
19111
|
});
|
|
19112
19112
|
} else {
|
|
19113
|
-
gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(
|
|
19113
|
+
gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema3, opts)).code(body));
|
|
19114
19114
|
}
|
|
19115
19115
|
}
|
|
19116
19116
|
function destructureValCxt(opts) {
|
|
@@ -19134,9 +19134,9 @@ var require_validate = __commonJS({
|
|
|
19134
19134
|
});
|
|
19135
19135
|
}
|
|
19136
19136
|
function topSchemaObjCode(it) {
|
|
19137
|
-
const { schema:
|
|
19137
|
+
const { schema: schema3, opts, gen } = it;
|
|
19138
19138
|
validateFunction(it, () => {
|
|
19139
|
-
if (opts.$comment &&
|
|
19139
|
+
if (opts.$comment && schema3.$comment)
|
|
19140
19140
|
commentKeyword(it);
|
|
19141
19141
|
checkNoDefault(it);
|
|
19142
19142
|
gen.let(names_1.default.vErrors, null);
|
|
@@ -19154,8 +19154,8 @@ var require_validate = __commonJS({
|
|
|
19154
19154
|
gen.if((0, codegen_1._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._)`${it.evaluated}.props`, (0, codegen_1._)`undefined`));
|
|
19155
19155
|
gen.if((0, codegen_1._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._)`${it.evaluated}.items`, (0, codegen_1._)`undefined`));
|
|
19156
19156
|
}
|
|
19157
|
-
function funcSourceUrl(
|
|
19158
|
-
const schId = typeof
|
|
19157
|
+
function funcSourceUrl(schema3, opts) {
|
|
19158
|
+
const schId = typeof schema3 == "object" && schema3[opts.schemaId];
|
|
19159
19159
|
return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._)`/*# sourceURL=${schId} */` : codegen_1.nil;
|
|
19160
19160
|
}
|
|
19161
19161
|
function subschemaCode(it, valid) {
|
|
@@ -19168,10 +19168,10 @@ var require_validate = __commonJS({
|
|
|
19168
19168
|
}
|
|
19169
19169
|
(0, boolSchema_1.boolOrEmptySchema)(it, valid);
|
|
19170
19170
|
}
|
|
19171
|
-
function schemaCxtHasRules({ schema:
|
|
19172
|
-
if (typeof
|
|
19173
|
-
return !
|
|
19174
|
-
for (const key in
|
|
19171
|
+
function schemaCxtHasRules({ schema: schema3, self }) {
|
|
19172
|
+
if (typeof schema3 == "boolean")
|
|
19173
|
+
return !schema3;
|
|
19174
|
+
for (const key in schema3)
|
|
19175
19175
|
if (self.RULES.all[key])
|
|
19176
19176
|
return true;
|
|
19177
19177
|
return false;
|
|
@@ -19180,8 +19180,8 @@ var require_validate = __commonJS({
|
|
|
19180
19180
|
return typeof it.schema != "boolean";
|
|
19181
19181
|
}
|
|
19182
19182
|
function subSchemaObjCode(it, valid) {
|
|
19183
|
-
const { schema:
|
|
19184
|
-
if (opts.$comment &&
|
|
19183
|
+
const { schema: schema3, gen, opts } = it;
|
|
19184
|
+
if (opts.$comment && schema3.$comment)
|
|
19185
19185
|
commentKeyword(it);
|
|
19186
19186
|
updateContext(it);
|
|
19187
19187
|
checkAsyncSchema(it);
|
|
@@ -19201,14 +19201,14 @@ var require_validate = __commonJS({
|
|
|
19201
19201
|
schemaKeywords(it, types, !checkedTypes, errsCount);
|
|
19202
19202
|
}
|
|
19203
19203
|
function checkRefsAndKeywords(it) {
|
|
19204
|
-
const { schema:
|
|
19205
|
-
if (
|
|
19204
|
+
const { schema: schema3, errSchemaPath, opts, self } = it;
|
|
19205
|
+
if (schema3.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema3, self.RULES)) {
|
|
19206
19206
|
self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
|
|
19207
19207
|
}
|
|
19208
19208
|
}
|
|
19209
19209
|
function checkNoDefault(it) {
|
|
19210
|
-
const { schema:
|
|
19211
|
-
if (
|
|
19210
|
+
const { schema: schema3, opts } = it;
|
|
19211
|
+
if (schema3.default !== void 0 && opts.useDefaults && opts.strictSchema) {
|
|
19212
19212
|
(0, util_1.checkStrictMode)(it, "default is ignored in the schema root");
|
|
19213
19213
|
}
|
|
19214
19214
|
}
|
|
@@ -19221,8 +19221,8 @@ var require_validate = __commonJS({
|
|
|
19221
19221
|
if (it.schema.$async && !it.schemaEnv.$async)
|
|
19222
19222
|
throw new Error("async schema in sync schema");
|
|
19223
19223
|
}
|
|
19224
|
-
function commentKeyword({ gen, schemaEnv, schema:
|
|
19225
|
-
const msg =
|
|
19224
|
+
function commentKeyword({ gen, schemaEnv, schema: schema3, errSchemaPath, opts }) {
|
|
19225
|
+
const msg = schema3.$comment;
|
|
19226
19226
|
if (opts.$comment === true) {
|
|
19227
19227
|
gen.code((0, codegen_1._)`${names_1.default.self}.logger.log(${msg})`);
|
|
19228
19228
|
} else if (typeof opts.$comment == "function") {
|
|
@@ -19249,9 +19249,9 @@ var require_validate = __commonJS({
|
|
|
19249
19249
|
gen.assign((0, codegen_1._)`${evaluated}.items`, items);
|
|
19250
19250
|
}
|
|
19251
19251
|
function schemaKeywords(it, types, typeErrors, errsCount) {
|
|
19252
|
-
const { gen, schema:
|
|
19252
|
+
const { gen, schema: schema3, data, allErrors, opts, self } = it;
|
|
19253
19253
|
const { RULES } = self;
|
|
19254
|
-
if (
|
|
19254
|
+
if (schema3.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema3, RULES))) {
|
|
19255
19255
|
gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
|
|
19256
19256
|
return;
|
|
19257
19257
|
}
|
|
@@ -19263,7 +19263,7 @@ var require_validate = __commonJS({
|
|
|
19263
19263
|
groupKeywords(RULES.post);
|
|
19264
19264
|
});
|
|
19265
19265
|
function groupKeywords(group) {
|
|
19266
|
-
if (!(0, applicability_1.shouldUseGroup)(
|
|
19266
|
+
if (!(0, applicability_1.shouldUseGroup)(schema3, group))
|
|
19267
19267
|
return;
|
|
19268
19268
|
if (group.type) {
|
|
19269
19269
|
gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
|
|
@@ -19281,12 +19281,12 @@ var require_validate = __commonJS({
|
|
|
19281
19281
|
}
|
|
19282
19282
|
}
|
|
19283
19283
|
function iterateKeywords(it, group) {
|
|
19284
|
-
const { gen, schema:
|
|
19284
|
+
const { gen, schema: schema3, opts: { useDefaults } } = it;
|
|
19285
19285
|
if (useDefaults)
|
|
19286
19286
|
(0, defaults_1.assignDefaults)(it, group.type);
|
|
19287
19287
|
gen.block(() => {
|
|
19288
19288
|
for (const rule of group.rules) {
|
|
19289
|
-
if ((0, applicability_1.shouldUseRule)(
|
|
19289
|
+
if ((0, applicability_1.shouldUseRule)(schema3, rule)) {
|
|
19290
19290
|
keywordCode(it, rule.keyword, rule.definition, group.type);
|
|
19291
19291
|
}
|
|
19292
19292
|
}
|
|
@@ -19631,17 +19631,17 @@ var require_compile = __commonJS({
|
|
|
19631
19631
|
var _a3;
|
|
19632
19632
|
this.refs = {};
|
|
19633
19633
|
this.dynamicAnchors = {};
|
|
19634
|
-
let
|
|
19634
|
+
let schema3;
|
|
19635
19635
|
if (typeof env2.schema == "object")
|
|
19636
|
-
|
|
19636
|
+
schema3 = env2.schema;
|
|
19637
19637
|
this.schema = env2.schema;
|
|
19638
19638
|
this.schemaId = env2.schemaId;
|
|
19639
19639
|
this.root = env2.root || this;
|
|
19640
|
-
this.baseId = (_a3 = env2.baseId) !== null && _a3 !== void 0 ? _a3 : (0, resolve_1.normalizeId)(
|
|
19640
|
+
this.baseId = (_a3 = env2.baseId) !== null && _a3 !== void 0 ? _a3 : (0, resolve_1.normalizeId)(schema3 === null || schema3 === void 0 ? void 0 : schema3[env2.schemaId || "$id"]);
|
|
19641
19641
|
this.schemaPath = env2.schemaPath;
|
|
19642
19642
|
this.localRefs = env2.localRefs;
|
|
19643
19643
|
this.meta = env2.meta;
|
|
19644
|
-
this.$async =
|
|
19644
|
+
this.$async = schema3 === null || schema3 === void 0 ? void 0 : schema3.$async;
|
|
19645
19645
|
this.refs = {};
|
|
19646
19646
|
}
|
|
19647
19647
|
};
|
|
@@ -19740,10 +19740,10 @@ var require_compile = __commonJS({
|
|
|
19740
19740
|
return schOrFunc;
|
|
19741
19741
|
let _sch = resolve.call(this, root, ref);
|
|
19742
19742
|
if (_sch === void 0) {
|
|
19743
|
-
const
|
|
19743
|
+
const schema3 = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
|
|
19744
19744
|
const { schemaId } = this.opts;
|
|
19745
|
-
if (
|
|
19746
|
-
_sch = new SchemaEnv({ schema:
|
|
19745
|
+
if (schema3)
|
|
19746
|
+
_sch = new SchemaEnv({ schema: schema3, schemaId, root, baseId });
|
|
19747
19747
|
}
|
|
19748
19748
|
if (_sch === void 0)
|
|
19749
19749
|
return;
|
|
@@ -19791,12 +19791,12 @@ var require_compile = __commonJS({
|
|
|
19791
19791
|
if (!schOrRef.validate)
|
|
19792
19792
|
compileSchema.call(this, schOrRef);
|
|
19793
19793
|
if (id === (0, resolve_1.normalizeId)(ref)) {
|
|
19794
|
-
const { schema:
|
|
19794
|
+
const { schema: schema3 } = schOrRef;
|
|
19795
19795
|
const { schemaId } = this.opts;
|
|
19796
|
-
const schId =
|
|
19796
|
+
const schId = schema3[schemaId];
|
|
19797
19797
|
if (schId)
|
|
19798
19798
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
19799
|
-
return new SchemaEnv({ schema:
|
|
19799
|
+
return new SchemaEnv({ schema: schema3, schemaId, root, baseId });
|
|
19800
19800
|
}
|
|
19801
19801
|
return getJsonPointer.call(this, p, schOrRef);
|
|
19802
19802
|
}
|
|
@@ -19808,29 +19808,29 @@ var require_compile = __commonJS({
|
|
|
19808
19808
|
"dependencies",
|
|
19809
19809
|
"definitions"
|
|
19810
19810
|
]);
|
|
19811
|
-
function getJsonPointer(parsedRef, { baseId, schema:
|
|
19811
|
+
function getJsonPointer(parsedRef, { baseId, schema: schema3, root }) {
|
|
19812
19812
|
var _a3;
|
|
19813
19813
|
if (((_a3 = parsedRef.fragment) === null || _a3 === void 0 ? void 0 : _a3[0]) !== "/")
|
|
19814
19814
|
return;
|
|
19815
19815
|
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
19816
|
-
if (typeof
|
|
19816
|
+
if (typeof schema3 === "boolean")
|
|
19817
19817
|
return;
|
|
19818
|
-
const partSchema =
|
|
19818
|
+
const partSchema = schema3[(0, util_1.unescapeFragment)(part)];
|
|
19819
19819
|
if (partSchema === void 0)
|
|
19820
19820
|
return;
|
|
19821
|
-
|
|
19822
|
-
const schId = typeof
|
|
19821
|
+
schema3 = partSchema;
|
|
19822
|
+
const schId = typeof schema3 === "object" && schema3[this.opts.schemaId];
|
|
19823
19823
|
if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
|
|
19824
19824
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
19825
19825
|
}
|
|
19826
19826
|
}
|
|
19827
19827
|
let env2;
|
|
19828
|
-
if (typeof
|
|
19829
|
-
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId,
|
|
19828
|
+
if (typeof schema3 != "boolean" && schema3.$ref && !(0, util_1.schemaHasRulesButRef)(schema3, this.RULES)) {
|
|
19829
|
+
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema3.$ref);
|
|
19830
19830
|
env2 = resolveSchema.call(this, root, $ref);
|
|
19831
19831
|
}
|
|
19832
19832
|
const { schemaId } = this.opts;
|
|
19833
|
-
env2 = env2 || new SchemaEnv({ schema:
|
|
19833
|
+
env2 = env2 || new SchemaEnv({ schema: schema3, schemaId, root, baseId });
|
|
19834
19834
|
if (env2.schema !== env2.root.schema)
|
|
19835
19835
|
return env2;
|
|
19836
19836
|
return void 0;
|
|
@@ -20852,16 +20852,16 @@ var require_core = __commonJS({
|
|
|
20852
20852
|
this.errors = v.errors;
|
|
20853
20853
|
return valid;
|
|
20854
20854
|
}
|
|
20855
|
-
compile(
|
|
20856
|
-
const sch = this._addSchema(
|
|
20855
|
+
compile(schema3, _meta) {
|
|
20856
|
+
const sch = this._addSchema(schema3, _meta);
|
|
20857
20857
|
return sch.validate || this._compileSchemaEnv(sch);
|
|
20858
20858
|
}
|
|
20859
|
-
compileAsync(
|
|
20859
|
+
compileAsync(schema3, meta3) {
|
|
20860
20860
|
if (typeof this.opts.loadSchema != "function") {
|
|
20861
20861
|
throw new Error("options.loadSchema should be a function");
|
|
20862
20862
|
}
|
|
20863
20863
|
const { loadSchema } = this.opts;
|
|
20864
|
-
return runCompileAsync.call(this,
|
|
20864
|
+
return runCompileAsync.call(this, schema3, meta3);
|
|
20865
20865
|
async function runCompileAsync(_schema, _meta) {
|
|
20866
20866
|
await loadMetaSchema.call(this, _schema.$schema);
|
|
20867
20867
|
const sch = this._addSchema(_schema, _meta);
|
|
@@ -20907,37 +20907,37 @@ var require_core = __commonJS({
|
|
|
20907
20907
|
}
|
|
20908
20908
|
}
|
|
20909
20909
|
// Adds schema to the instance
|
|
20910
|
-
addSchema(
|
|
20911
|
-
if (Array.isArray(
|
|
20912
|
-
for (const sch of
|
|
20910
|
+
addSchema(schema3, key, _meta, _validateSchema = this.opts.validateSchema) {
|
|
20911
|
+
if (Array.isArray(schema3)) {
|
|
20912
|
+
for (const sch of schema3)
|
|
20913
20913
|
this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
20914
20914
|
return this;
|
|
20915
20915
|
}
|
|
20916
20916
|
let id;
|
|
20917
|
-
if (typeof
|
|
20917
|
+
if (typeof schema3 === "object") {
|
|
20918
20918
|
const { schemaId } = this.opts;
|
|
20919
|
-
id =
|
|
20919
|
+
id = schema3[schemaId];
|
|
20920
20920
|
if (id !== void 0 && typeof id != "string") {
|
|
20921
20921
|
throw new Error(`schema ${schemaId} must be string`);
|
|
20922
20922
|
}
|
|
20923
20923
|
}
|
|
20924
20924
|
key = (0, resolve_1.normalizeId)(key || id);
|
|
20925
20925
|
this._checkUnique(key);
|
|
20926
|
-
this.schemas[key] = this._addSchema(
|
|
20926
|
+
this.schemas[key] = this._addSchema(schema3, _meta, key, _validateSchema, true);
|
|
20927
20927
|
return this;
|
|
20928
20928
|
}
|
|
20929
20929
|
// Add schema that will be used to validate other schemas
|
|
20930
20930
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
20931
|
-
addMetaSchema(
|
|
20932
|
-
this.addSchema(
|
|
20931
|
+
addMetaSchema(schema3, key, _validateSchema = this.opts.validateSchema) {
|
|
20932
|
+
this.addSchema(schema3, key, true, _validateSchema);
|
|
20933
20933
|
return this;
|
|
20934
20934
|
}
|
|
20935
20935
|
// Validate schema against its meta-schema
|
|
20936
|
-
validateSchema(
|
|
20937
|
-
if (typeof
|
|
20936
|
+
validateSchema(schema3, throwOrLogError) {
|
|
20937
|
+
if (typeof schema3 == "boolean")
|
|
20938
20938
|
return true;
|
|
20939
20939
|
let $schema;
|
|
20940
|
-
$schema =
|
|
20940
|
+
$schema = schema3.$schema;
|
|
20941
20941
|
if ($schema !== void 0 && typeof $schema != "string") {
|
|
20942
20942
|
throw new Error("$schema must be a string");
|
|
20943
20943
|
}
|
|
@@ -20947,7 +20947,7 @@ var require_core = __commonJS({
|
|
|
20947
20947
|
this.errors = null;
|
|
20948
20948
|
return true;
|
|
20949
20949
|
}
|
|
20950
|
-
const valid = this.validate($schema,
|
|
20950
|
+
const valid = this.validate($schema, schema3);
|
|
20951
20951
|
if (!valid && throwOrLogError) {
|
|
20952
20952
|
const message4 = "schema is invalid: " + this.errorsText();
|
|
20953
20953
|
if (this.opts.validateSchema === "log")
|
|
@@ -21090,9 +21090,9 @@ var require_core = __commonJS({
|
|
|
21090
21090
|
if (typeof rule != "object")
|
|
21091
21091
|
continue;
|
|
21092
21092
|
const { $data } = rule.definition;
|
|
21093
|
-
const
|
|
21094
|
-
if ($data &&
|
|
21095
|
-
keywords[key] = schemaOrData(
|
|
21093
|
+
const schema3 = keywords[key];
|
|
21094
|
+
if ($data && schema3)
|
|
21095
|
+
keywords[key] = schemaOrData(schema3);
|
|
21096
21096
|
}
|
|
21097
21097
|
}
|
|
21098
21098
|
return metaSchema;
|
|
@@ -21110,23 +21110,23 @@ var require_core = __commonJS({
|
|
|
21110
21110
|
}
|
|
21111
21111
|
}
|
|
21112
21112
|
}
|
|
21113
|
-
_addSchema(
|
|
21113
|
+
_addSchema(schema3, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
21114
21114
|
let id;
|
|
21115
21115
|
const { schemaId } = this.opts;
|
|
21116
|
-
if (typeof
|
|
21117
|
-
id =
|
|
21116
|
+
if (typeof schema3 == "object") {
|
|
21117
|
+
id = schema3[schemaId];
|
|
21118
21118
|
} else {
|
|
21119
21119
|
if (this.opts.jtd)
|
|
21120
21120
|
throw new Error("schema must be object");
|
|
21121
|
-
else if (typeof
|
|
21121
|
+
else if (typeof schema3 != "boolean")
|
|
21122
21122
|
throw new Error("schema must be object or boolean");
|
|
21123
21123
|
}
|
|
21124
|
-
let sch = this._cache.get(
|
|
21124
|
+
let sch = this._cache.get(schema3);
|
|
21125
21125
|
if (sch !== void 0)
|
|
21126
21126
|
return sch;
|
|
21127
21127
|
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
21128
|
-
const localRefs = resolve_1.getSchemaRefs.call(this,
|
|
21129
|
-
sch = new compile_1.SchemaEnv({ schema:
|
|
21128
|
+
const localRefs = resolve_1.getSchemaRefs.call(this, schema3, baseId);
|
|
21129
|
+
sch = new compile_1.SchemaEnv({ schema: schema3, schemaId, meta: meta3, baseId, localRefs });
|
|
21130
21130
|
this._cache.set(sch.schema, sch);
|
|
21131
21131
|
if (addSchema && !baseId.startsWith("#")) {
|
|
21132
21132
|
if (baseId)
|
|
@@ -21134,7 +21134,7 @@ var require_core = __commonJS({
|
|
|
21134
21134
|
this.refs[baseId] = sch;
|
|
21135
21135
|
}
|
|
21136
21136
|
if (validateSchema)
|
|
21137
|
-
this.validateSchema(
|
|
21137
|
+
this.validateSchema(schema3, true);
|
|
21138
21138
|
return sch;
|
|
21139
21139
|
}
|
|
21140
21140
|
_checkUnique(id) {
|
|
@@ -21288,8 +21288,8 @@ var require_core = __commonJS({
|
|
|
21288
21288
|
var $dataRef = {
|
|
21289
21289
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
21290
21290
|
};
|
|
21291
|
-
function schemaOrData(
|
|
21292
|
-
return { anyOf: [
|
|
21291
|
+
function schemaOrData(schema3) {
|
|
21292
|
+
return { anyOf: [schema3, $dataRef] };
|
|
21293
21293
|
}
|
|
21294
21294
|
}
|
|
21295
21295
|
});
|
|
@@ -21589,7 +21589,7 @@ var require_pattern = __commonJS({
|
|
|
21589
21589
|
$data: true,
|
|
21590
21590
|
error: error51,
|
|
21591
21591
|
code(cxt) {
|
|
21592
|
-
const { gen, data, $data, schema:
|
|
21592
|
+
const { gen, data, $data, schema: schema3, schemaCode, it } = cxt;
|
|
21593
21593
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
21594
21594
|
if ($data) {
|
|
21595
21595
|
const { regExp } = it.opts.code;
|
|
@@ -21598,7 +21598,7 @@ var require_pattern = __commonJS({
|
|
|
21598
21598
|
gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
|
|
21599
21599
|
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
21600
21600
|
} else {
|
|
21601
|
-
const regExp = (0, code_1.usePattern)(cxt,
|
|
21601
|
+
const regExp = (0, code_1.usePattern)(cxt, schema3);
|
|
21602
21602
|
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
21603
21603
|
}
|
|
21604
21604
|
}
|
|
@@ -21655,11 +21655,11 @@ var require_required = __commonJS({
|
|
|
21655
21655
|
$data: true,
|
|
21656
21656
|
error: error51,
|
|
21657
21657
|
code(cxt) {
|
|
21658
|
-
const { gen, schema:
|
|
21658
|
+
const { gen, schema: schema3, schemaCode, data, $data, it } = cxt;
|
|
21659
21659
|
const { opts } = it;
|
|
21660
|
-
if (!$data &&
|
|
21660
|
+
if (!$data && schema3.length === 0)
|
|
21661
21661
|
return;
|
|
21662
|
-
const useLoop =
|
|
21662
|
+
const useLoop = schema3.length >= opts.loopRequired;
|
|
21663
21663
|
if (it.allErrors)
|
|
21664
21664
|
allErrorsMode();
|
|
21665
21665
|
else
|
|
@@ -21667,7 +21667,7 @@ var require_required = __commonJS({
|
|
|
21667
21667
|
if (opts.strictRequired) {
|
|
21668
21668
|
const props = cxt.parentSchema.properties;
|
|
21669
21669
|
const { definedProperties } = cxt.it;
|
|
21670
|
-
for (const requiredKey of
|
|
21670
|
+
for (const requiredKey of schema3) {
|
|
21671
21671
|
if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === void 0 && !definedProperties.has(requiredKey)) {
|
|
21672
21672
|
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
|
21673
21673
|
const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`;
|
|
@@ -21679,7 +21679,7 @@ var require_required = __commonJS({
|
|
|
21679
21679
|
if (useLoop || $data) {
|
|
21680
21680
|
cxt.block$data(codegen_1.nil, loopAllRequired);
|
|
21681
21681
|
} else {
|
|
21682
|
-
for (const prop of
|
|
21682
|
+
for (const prop of schema3) {
|
|
21683
21683
|
(0, code_1.checkReportMissingProp)(cxt, prop);
|
|
21684
21684
|
}
|
|
21685
21685
|
}
|
|
@@ -21691,7 +21691,7 @@ var require_required = __commonJS({
|
|
|
21691
21691
|
cxt.block$data(valid, () => loopUntilMissing(missing, valid));
|
|
21692
21692
|
cxt.ok(valid);
|
|
21693
21693
|
} else {
|
|
21694
|
-
gen.if((0, code_1.checkMissingProp)(cxt,
|
|
21694
|
+
gen.if((0, code_1.checkMissingProp)(cxt, schema3, missing));
|
|
21695
21695
|
(0, code_1.reportMissingProp)(cxt, missing);
|
|
21696
21696
|
gen.else();
|
|
21697
21697
|
}
|
|
@@ -21778,8 +21778,8 @@ var require_uniqueItems = __commonJS({
|
|
|
21778
21778
|
$data: true,
|
|
21779
21779
|
error: error51,
|
|
21780
21780
|
code(cxt) {
|
|
21781
|
-
const { gen, data, $data, schema:
|
|
21782
|
-
if (!$data && !
|
|
21781
|
+
const { gen, data, $data, schema: schema3, parentSchema, schemaCode, it } = cxt;
|
|
21782
|
+
if (!$data && !schema3)
|
|
21783
21783
|
return;
|
|
21784
21784
|
const valid = gen.let("valid");
|
|
21785
21785
|
const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : [];
|
|
@@ -21842,11 +21842,11 @@ var require_const = __commonJS({
|
|
|
21842
21842
|
$data: true,
|
|
21843
21843
|
error: error51,
|
|
21844
21844
|
code(cxt) {
|
|
21845
|
-
const { gen, data, $data, schemaCode, schema:
|
|
21846
|
-
if ($data ||
|
|
21845
|
+
const { gen, data, $data, schemaCode, schema: schema3 } = cxt;
|
|
21846
|
+
if ($data || schema3 && typeof schema3 == "object") {
|
|
21847
21847
|
cxt.fail$data((0, codegen_1._)`!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`);
|
|
21848
21848
|
} else {
|
|
21849
|
-
cxt.fail((0, codegen_1._)`${
|
|
21849
|
+
cxt.fail((0, codegen_1._)`${schema3} !== ${data}`);
|
|
21850
21850
|
}
|
|
21851
21851
|
}
|
|
21852
21852
|
};
|
|
@@ -21872,10 +21872,10 @@ var require_enum = __commonJS({
|
|
|
21872
21872
|
$data: true,
|
|
21873
21873
|
error: error51,
|
|
21874
21874
|
code(cxt) {
|
|
21875
|
-
const { gen, data, $data, schema:
|
|
21876
|
-
if (!$data &&
|
|
21875
|
+
const { gen, data, $data, schema: schema3, schemaCode, it } = cxt;
|
|
21876
|
+
if (!$data && schema3.length === 0)
|
|
21877
21877
|
throw new Error("enum must have non-empty array");
|
|
21878
|
-
const useLoop =
|
|
21878
|
+
const useLoop = schema3.length >= it.opts.loopEnum;
|
|
21879
21879
|
let eql;
|
|
21880
21880
|
const getEql = () => eql !== null && eql !== void 0 ? eql : eql = (0, util_1.useFunc)(gen, equal_1.default);
|
|
21881
21881
|
let valid;
|
|
@@ -21883,10 +21883,10 @@ var require_enum = __commonJS({
|
|
|
21883
21883
|
valid = gen.let("valid");
|
|
21884
21884
|
cxt.block$data(valid, loopEnum);
|
|
21885
21885
|
} else {
|
|
21886
|
-
if (!Array.isArray(
|
|
21886
|
+
if (!Array.isArray(schema3))
|
|
21887
21887
|
throw new Error("ajv implementation error");
|
|
21888
21888
|
const vSchema = gen.const("vSchema", schemaCode);
|
|
21889
|
-
valid = (0, codegen_1.or)(...
|
|
21889
|
+
valid = (0, codegen_1.or)(...schema3.map((_x, i) => equalCode(vSchema, i)));
|
|
21890
21890
|
}
|
|
21891
21891
|
cxt.pass(valid);
|
|
21892
21892
|
function loopEnum() {
|
|
@@ -21894,7 +21894,7 @@ var require_enum = __commonJS({
|
|
|
21894
21894
|
gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._)`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()));
|
|
21895
21895
|
}
|
|
21896
21896
|
function equalCode(vSchema, i) {
|
|
21897
|
-
const sch =
|
|
21897
|
+
const sch = schema3[i];
|
|
21898
21898
|
return typeof sch === "object" && sch !== null ? (0, codegen_1._)`${getEql()}(${data}, ${vSchema}[${i}])` : (0, codegen_1._)`${data} === ${sch}`;
|
|
21899
21899
|
}
|
|
21900
21900
|
}
|
|
@@ -21970,13 +21970,13 @@ var require_additionalItems = __commonJS({
|
|
|
21970
21970
|
}
|
|
21971
21971
|
};
|
|
21972
21972
|
function validateAdditionalItems(cxt, items) {
|
|
21973
|
-
const { gen, schema:
|
|
21973
|
+
const { gen, schema: schema3, data, keyword, it } = cxt;
|
|
21974
21974
|
it.items = true;
|
|
21975
21975
|
const len = gen.const("len", (0, codegen_1._)`${data}.length`);
|
|
21976
|
-
if (
|
|
21976
|
+
if (schema3 === false) {
|
|
21977
21977
|
cxt.setParams({ len: items.length });
|
|
21978
21978
|
cxt.pass((0, codegen_1._)`${len} <= ${items.length}`);
|
|
21979
|
-
} else if (typeof
|
|
21979
|
+
} else if (typeof schema3 == "object" && !(0, util_1.alwaysValidSchema)(it, schema3)) {
|
|
21980
21980
|
const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items.length}`);
|
|
21981
21981
|
gen.if((0, codegen_1.not)(valid), () => validateItems(valid));
|
|
21982
21982
|
cxt.ok(valid);
|
|
@@ -22009,11 +22009,11 @@ var require_items = __commonJS({
|
|
|
22009
22009
|
schemaType: ["object", "array", "boolean"],
|
|
22010
22010
|
before: "uniqueItems",
|
|
22011
22011
|
code(cxt) {
|
|
22012
|
-
const { schema:
|
|
22013
|
-
if (Array.isArray(
|
|
22014
|
-
return validateTuple(cxt, "additionalItems",
|
|
22012
|
+
const { schema: schema3, it } = cxt;
|
|
22013
|
+
if (Array.isArray(schema3))
|
|
22014
|
+
return validateTuple(cxt, "additionalItems", schema3);
|
|
22015
22015
|
it.items = true;
|
|
22016
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
22016
|
+
if ((0, util_1.alwaysValidSchema)(it, schema3))
|
|
22017
22017
|
return;
|
|
22018
22018
|
cxt.ok((0, code_1.validateArray)(cxt));
|
|
22019
22019
|
}
|
|
@@ -22088,10 +22088,10 @@ var require_items2020 = __commonJS({
|
|
|
22088
22088
|
before: "uniqueItems",
|
|
22089
22089
|
error: error51,
|
|
22090
22090
|
code(cxt) {
|
|
22091
|
-
const { schema:
|
|
22091
|
+
const { schema: schema3, parentSchema, it } = cxt;
|
|
22092
22092
|
const { prefixItems } = parentSchema;
|
|
22093
22093
|
it.items = true;
|
|
22094
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
22094
|
+
if ((0, util_1.alwaysValidSchema)(it, schema3))
|
|
22095
22095
|
return;
|
|
22096
22096
|
if (prefixItems)
|
|
22097
22097
|
(0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);
|
|
@@ -22122,7 +22122,7 @@ var require_contains = __commonJS({
|
|
|
22122
22122
|
trackErrors: true,
|
|
22123
22123
|
error: error51,
|
|
22124
22124
|
code(cxt) {
|
|
22125
|
-
const { gen, schema:
|
|
22125
|
+
const { gen, schema: schema3, parentSchema, data, it } = cxt;
|
|
22126
22126
|
let min;
|
|
22127
22127
|
let max;
|
|
22128
22128
|
const { minContains, maxContains } = parentSchema;
|
|
@@ -22143,7 +22143,7 @@ var require_contains = __commonJS({
|
|
|
22143
22143
|
cxt.fail();
|
|
22144
22144
|
return;
|
|
22145
22145
|
}
|
|
22146
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
22146
|
+
if ((0, util_1.alwaysValidSchema)(it, schema3)) {
|
|
22147
22147
|
let cond = (0, codegen_1._)`${len} >= ${min}`;
|
|
22148
22148
|
if (max !== void 0)
|
|
22149
22149
|
cond = (0, codegen_1._)`${cond} && ${len} <= ${max}`;
|
|
@@ -22228,14 +22228,14 @@ var require_dependencies = __commonJS({
|
|
|
22228
22228
|
validateSchemaDeps(cxt, schDeps);
|
|
22229
22229
|
}
|
|
22230
22230
|
};
|
|
22231
|
-
function splitDependencies({ schema:
|
|
22231
|
+
function splitDependencies({ schema: schema3 }) {
|
|
22232
22232
|
const propertyDeps = {};
|
|
22233
22233
|
const schemaDeps = {};
|
|
22234
|
-
for (const key in
|
|
22234
|
+
for (const key in schema3) {
|
|
22235
22235
|
if (key === "__proto__")
|
|
22236
22236
|
continue;
|
|
22237
|
-
const deps = Array.isArray(
|
|
22238
|
-
deps[key] =
|
|
22237
|
+
const deps = Array.isArray(schema3[key]) ? propertyDeps : schemaDeps;
|
|
22238
|
+
deps[key] = schema3[key];
|
|
22239
22239
|
}
|
|
22240
22240
|
return [propertyDeps, schemaDeps];
|
|
22241
22241
|
}
|
|
@@ -22308,8 +22308,8 @@ var require_propertyNames = __commonJS({
|
|
|
22308
22308
|
schemaType: ["object", "boolean"],
|
|
22309
22309
|
error: error51,
|
|
22310
22310
|
code(cxt) {
|
|
22311
|
-
const { gen, schema:
|
|
22312
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
22311
|
+
const { gen, schema: schema3, data, it } = cxt;
|
|
22312
|
+
if ((0, util_1.alwaysValidSchema)(it, schema3))
|
|
22313
22313
|
return;
|
|
22314
22314
|
const valid = gen.name("valid");
|
|
22315
22315
|
gen.forIn("key", data, (key) => {
|
|
@@ -22355,12 +22355,12 @@ var require_additionalProperties = __commonJS({
|
|
|
22355
22355
|
trackErrors: true,
|
|
22356
22356
|
error: error51,
|
|
22357
22357
|
code(cxt) {
|
|
22358
|
-
const { gen, schema:
|
|
22358
|
+
const { gen, schema: schema3, parentSchema, data, errsCount, it } = cxt;
|
|
22359
22359
|
if (!errsCount)
|
|
22360
22360
|
throw new Error("ajv implementation error");
|
|
22361
22361
|
const { allErrors, opts } = it;
|
|
22362
22362
|
it.props = true;
|
|
22363
|
-
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it,
|
|
22363
|
+
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema3))
|
|
22364
22364
|
return;
|
|
22365
22365
|
const props = (0, code_1.allSchemaProperties)(parentSchema.properties);
|
|
22366
22366
|
const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);
|
|
@@ -22393,18 +22393,18 @@ var require_additionalProperties = __commonJS({
|
|
|
22393
22393
|
gen.code((0, codegen_1._)`delete ${data}[${key}]`);
|
|
22394
22394
|
}
|
|
22395
22395
|
function additionalPropertyCode(key) {
|
|
22396
|
-
if (opts.removeAdditional === "all" || opts.removeAdditional &&
|
|
22396
|
+
if (opts.removeAdditional === "all" || opts.removeAdditional && schema3 === false) {
|
|
22397
22397
|
deleteAdditional(key);
|
|
22398
22398
|
return;
|
|
22399
22399
|
}
|
|
22400
|
-
if (
|
|
22400
|
+
if (schema3 === false) {
|
|
22401
22401
|
cxt.setParams({ additionalProperty: key });
|
|
22402
22402
|
cxt.error();
|
|
22403
22403
|
if (!allErrors)
|
|
22404
22404
|
gen.break();
|
|
22405
22405
|
return;
|
|
22406
22406
|
}
|
|
22407
|
-
if (typeof
|
|
22407
|
+
if (typeof schema3 == "object" && !(0, util_1.alwaysValidSchema)(it, schema3)) {
|
|
22408
22408
|
const valid = gen.name("valid");
|
|
22409
22409
|
if (opts.removeAdditional === "failing") {
|
|
22410
22410
|
applyAdditionalSchema(key, valid, false);
|
|
@@ -22454,18 +22454,18 @@ var require_properties = __commonJS({
|
|
|
22454
22454
|
type: "object",
|
|
22455
22455
|
schemaType: "object",
|
|
22456
22456
|
code(cxt) {
|
|
22457
|
-
const { gen, schema:
|
|
22457
|
+
const { gen, schema: schema3, parentSchema, data, it } = cxt;
|
|
22458
22458
|
if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === void 0) {
|
|
22459
22459
|
additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties"));
|
|
22460
22460
|
}
|
|
22461
|
-
const allProps = (0, code_1.allSchemaProperties)(
|
|
22461
|
+
const allProps = (0, code_1.allSchemaProperties)(schema3);
|
|
22462
22462
|
for (const prop of allProps) {
|
|
22463
22463
|
it.definedProperties.add(prop);
|
|
22464
22464
|
}
|
|
22465
22465
|
if (it.opts.unevaluated && allProps.length && it.props !== true) {
|
|
22466
22466
|
it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
|
|
22467
22467
|
}
|
|
22468
|
-
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it,
|
|
22468
|
+
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema3[p]));
|
|
22469
22469
|
if (properties.length === 0)
|
|
22470
22470
|
return;
|
|
22471
22471
|
const valid = gen.name("valid");
|
|
@@ -22483,7 +22483,7 @@ var require_properties = __commonJS({
|
|
|
22483
22483
|
cxt.ok(valid);
|
|
22484
22484
|
}
|
|
22485
22485
|
function hasDefault(prop) {
|
|
22486
|
-
return it.opts.useDefaults && !it.compositeRule &&
|
|
22486
|
+
return it.opts.useDefaults && !it.compositeRule && schema3[prop].default !== void 0;
|
|
22487
22487
|
}
|
|
22488
22488
|
function applyPropertySchema(prop) {
|
|
22489
22489
|
cxt.subschema({
|
|
@@ -22512,10 +22512,10 @@ var require_patternProperties = __commonJS({
|
|
|
22512
22512
|
type: "object",
|
|
22513
22513
|
schemaType: "object",
|
|
22514
22514
|
code(cxt) {
|
|
22515
|
-
const { gen, schema:
|
|
22515
|
+
const { gen, schema: schema3, data, parentSchema, it } = cxt;
|
|
22516
22516
|
const { opts } = it;
|
|
22517
|
-
const patterns = (0, code_1.allSchemaProperties)(
|
|
22518
|
-
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it,
|
|
22517
|
+
const patterns = (0, code_1.allSchemaProperties)(schema3);
|
|
22518
|
+
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema3[p]));
|
|
22519
22519
|
if (patterns.length === 0 || alwaysValidPatterns.length === patterns.length && (!it.opts.unevaluated || it.props === true)) {
|
|
22520
22520
|
return;
|
|
22521
22521
|
}
|
|
@@ -22583,8 +22583,8 @@ var require_not = __commonJS({
|
|
|
22583
22583
|
schemaType: ["object", "boolean"],
|
|
22584
22584
|
trackErrors: true,
|
|
22585
22585
|
code(cxt) {
|
|
22586
|
-
const { gen, schema:
|
|
22587
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
22586
|
+
const { gen, schema: schema3, it } = cxt;
|
|
22587
|
+
if ((0, util_1.alwaysValidSchema)(it, schema3)) {
|
|
22588
22588
|
cxt.fail();
|
|
22589
22589
|
return;
|
|
22590
22590
|
}
|
|
@@ -22637,12 +22637,12 @@ var require_oneOf = __commonJS({
|
|
|
22637
22637
|
trackErrors: true,
|
|
22638
22638
|
error: error51,
|
|
22639
22639
|
code(cxt) {
|
|
22640
|
-
const { gen, schema:
|
|
22641
|
-
if (!Array.isArray(
|
|
22640
|
+
const { gen, schema: schema3, parentSchema, it } = cxt;
|
|
22641
|
+
if (!Array.isArray(schema3))
|
|
22642
22642
|
throw new Error("ajv implementation error");
|
|
22643
22643
|
if (it.opts.discriminator && parentSchema.discriminator)
|
|
22644
22644
|
return;
|
|
22645
|
-
const schArr =
|
|
22645
|
+
const schArr = schema3;
|
|
22646
22646
|
const valid = gen.let("valid", false);
|
|
22647
22647
|
const passing = gen.let("passing", null);
|
|
22648
22648
|
const schValid = gen.name("_valid");
|
|
@@ -22688,11 +22688,11 @@ var require_allOf = __commonJS({
|
|
|
22688
22688
|
keyword: "allOf",
|
|
22689
22689
|
schemaType: "array",
|
|
22690
22690
|
code(cxt) {
|
|
22691
|
-
const { gen, schema:
|
|
22692
|
-
if (!Array.isArray(
|
|
22691
|
+
const { gen, schema: schema3, it } = cxt;
|
|
22692
|
+
if (!Array.isArray(schema3))
|
|
22693
22693
|
throw new Error("ajv implementation error");
|
|
22694
22694
|
const valid = gen.name("valid");
|
|
22695
|
-
|
|
22695
|
+
schema3.forEach((sch, i) => {
|
|
22696
22696
|
if ((0, util_1.alwaysValidSchema)(it, sch))
|
|
22697
22697
|
return;
|
|
22698
22698
|
const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid);
|
|
@@ -22767,8 +22767,8 @@ var require_if = __commonJS({
|
|
|
22767
22767
|
}
|
|
22768
22768
|
};
|
|
22769
22769
|
function hasSchema(it, keyword) {
|
|
22770
|
-
const
|
|
22771
|
-
return
|
|
22770
|
+
const schema3 = it.schema[keyword];
|
|
22771
|
+
return schema3 !== void 0 && !(0, util_1.alwaysValidSchema)(it, schema3);
|
|
22772
22772
|
}
|
|
22773
22773
|
exports2.default = def;
|
|
22774
22774
|
}
|
|
@@ -22857,7 +22857,7 @@ var require_format = __commonJS({
|
|
|
22857
22857
|
$data: true,
|
|
22858
22858
|
error: error51,
|
|
22859
22859
|
code(cxt, ruleType) {
|
|
22860
|
-
const { gen, data, $data, schema:
|
|
22860
|
+
const { gen, data, $data, schema: schema3, schemaCode, it } = cxt;
|
|
22861
22861
|
const { opts, errSchemaPath, schemaEnv, self } = it;
|
|
22862
22862
|
if (!opts.validateFormats)
|
|
22863
22863
|
return;
|
|
@@ -22887,7 +22887,7 @@ var require_format = __commonJS({
|
|
|
22887
22887
|
}
|
|
22888
22888
|
}
|
|
22889
22889
|
function validateFormat() {
|
|
22890
|
-
const formatDef = self.formats[
|
|
22890
|
+
const formatDef = self.formats[schema3];
|
|
22891
22891
|
if (!formatDef) {
|
|
22892
22892
|
unknownFormat();
|
|
22893
22893
|
return;
|
|
@@ -22904,12 +22904,12 @@ var require_format = __commonJS({
|
|
|
22904
22904
|
}
|
|
22905
22905
|
throw new Error(unknownMsg());
|
|
22906
22906
|
function unknownMsg() {
|
|
22907
|
-
return `unknown format "${
|
|
22907
|
+
return `unknown format "${schema3}" ignored in schema at path "${errSchemaPath}"`;
|
|
22908
22908
|
}
|
|
22909
22909
|
}
|
|
22910
22910
|
function getFormat(fmtDef) {
|
|
22911
|
-
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(
|
|
22912
|
-
const fmt = gen.scopeValue("formats", { key:
|
|
22911
|
+
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema3)}` : void 0;
|
|
22912
|
+
const fmt = gen.scopeValue("formats", { key: schema3, ref: fmtDef, code });
|
|
22913
22913
|
if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
|
|
22914
22914
|
return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`];
|
|
22915
22915
|
}
|
|
@@ -23020,15 +23020,15 @@ var require_discriminator = __commonJS({
|
|
|
23020
23020
|
schemaType: "object",
|
|
23021
23021
|
error: error51,
|
|
23022
23022
|
code(cxt) {
|
|
23023
|
-
const { gen, data, schema:
|
|
23023
|
+
const { gen, data, schema: schema3, parentSchema, it } = cxt;
|
|
23024
23024
|
const { oneOf } = parentSchema;
|
|
23025
23025
|
if (!it.opts.discriminator) {
|
|
23026
23026
|
throw new Error("discriminator: requires discriminator option");
|
|
23027
23027
|
}
|
|
23028
|
-
const tagName =
|
|
23028
|
+
const tagName = schema3.propertyName;
|
|
23029
23029
|
if (typeof tagName != "string")
|
|
23030
23030
|
throw new Error("discriminator: requires propertyName");
|
|
23031
|
-
if (
|
|
23031
|
+
if (schema3.mapping)
|
|
23032
23032
|
throw new Error("discriminator: mapping is not supported");
|
|
23033
23033
|
if (!oneOf)
|
|
23034
23034
|
throw new Error("discriminator: requires oneOf keyword");
|
|
@@ -25337,8 +25337,8 @@ function mergeDefs(...defs) {
|
|
|
25337
25337
|
}
|
|
25338
25338
|
return Object.defineProperties({}, mergedDescriptors);
|
|
25339
25339
|
}
|
|
25340
|
-
function cloneDef(
|
|
25341
|
-
return mergeDefs(
|
|
25340
|
+
function cloneDef(schema3) {
|
|
25341
|
+
return mergeDefs(schema3._zod.def);
|
|
25342
25342
|
}
|
|
25343
25343
|
function getElementAtPath(obj, path44) {
|
|
25344
25344
|
if (!path44)
|
|
@@ -25560,14 +25560,14 @@ var BIGINT_FORMAT_RANGES = {
|
|
|
25560
25560
|
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
25561
25561
|
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
25562
25562
|
};
|
|
25563
|
-
function pick(
|
|
25564
|
-
const currDef =
|
|
25563
|
+
function pick(schema3, mask) {
|
|
25564
|
+
const currDef = schema3._zod.def;
|
|
25565
25565
|
const checks = currDef.checks;
|
|
25566
25566
|
const hasChecks = checks && checks.length > 0;
|
|
25567
25567
|
if (hasChecks) {
|
|
25568
25568
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
25569
25569
|
}
|
|
25570
|
-
const def = mergeDefs(
|
|
25570
|
+
const def = mergeDefs(schema3._zod.def, {
|
|
25571
25571
|
get shape() {
|
|
25572
25572
|
const newShape = {};
|
|
25573
25573
|
for (const key in mask) {
|
|
@@ -25583,18 +25583,18 @@ function pick(schema2, mask) {
|
|
|
25583
25583
|
},
|
|
25584
25584
|
checks: []
|
|
25585
25585
|
});
|
|
25586
|
-
return clone(
|
|
25586
|
+
return clone(schema3, def);
|
|
25587
25587
|
}
|
|
25588
|
-
function omit(
|
|
25589
|
-
const currDef =
|
|
25588
|
+
function omit(schema3, mask) {
|
|
25589
|
+
const currDef = schema3._zod.def;
|
|
25590
25590
|
const checks = currDef.checks;
|
|
25591
25591
|
const hasChecks = checks && checks.length > 0;
|
|
25592
25592
|
if (hasChecks) {
|
|
25593
25593
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
25594
25594
|
}
|
|
25595
|
-
const def = mergeDefs(
|
|
25595
|
+
const def = mergeDefs(schema3._zod.def, {
|
|
25596
25596
|
get shape() {
|
|
25597
|
-
const newShape = { ...
|
|
25597
|
+
const newShape = { ...schema3._zod.def.shape };
|
|
25598
25598
|
for (const key in mask) {
|
|
25599
25599
|
if (!(key in currDef.shape)) {
|
|
25600
25600
|
throw new Error(`Unrecognized key: "${key}"`);
|
|
@@ -25608,43 +25608,43 @@ function omit(schema2, mask) {
|
|
|
25608
25608
|
},
|
|
25609
25609
|
checks: []
|
|
25610
25610
|
});
|
|
25611
|
-
return clone(
|
|
25611
|
+
return clone(schema3, def);
|
|
25612
25612
|
}
|
|
25613
|
-
function extend(
|
|
25613
|
+
function extend(schema3, shape) {
|
|
25614
25614
|
if (!isPlainObject(shape)) {
|
|
25615
25615
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
25616
25616
|
}
|
|
25617
|
-
const checks =
|
|
25617
|
+
const checks = schema3._zod.def.checks;
|
|
25618
25618
|
const hasChecks = checks && checks.length > 0;
|
|
25619
25619
|
if (hasChecks) {
|
|
25620
|
-
const existingShape =
|
|
25620
|
+
const existingShape = schema3._zod.def.shape;
|
|
25621
25621
|
for (const key in shape) {
|
|
25622
25622
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
25623
25623
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
25624
25624
|
}
|
|
25625
25625
|
}
|
|
25626
25626
|
}
|
|
25627
|
-
const def = mergeDefs(
|
|
25627
|
+
const def = mergeDefs(schema3._zod.def, {
|
|
25628
25628
|
get shape() {
|
|
25629
|
-
const _shape = { ...
|
|
25629
|
+
const _shape = { ...schema3._zod.def.shape, ...shape };
|
|
25630
25630
|
assignProp(this, "shape", _shape);
|
|
25631
25631
|
return _shape;
|
|
25632
25632
|
}
|
|
25633
25633
|
});
|
|
25634
|
-
return clone(
|
|
25634
|
+
return clone(schema3, def);
|
|
25635
25635
|
}
|
|
25636
|
-
function safeExtend(
|
|
25636
|
+
function safeExtend(schema3, shape) {
|
|
25637
25637
|
if (!isPlainObject(shape)) {
|
|
25638
25638
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
25639
25639
|
}
|
|
25640
|
-
const def = mergeDefs(
|
|
25640
|
+
const def = mergeDefs(schema3._zod.def, {
|
|
25641
25641
|
get shape() {
|
|
25642
|
-
const _shape = { ...
|
|
25642
|
+
const _shape = { ...schema3._zod.def.shape, ...shape };
|
|
25643
25643
|
assignProp(this, "shape", _shape);
|
|
25644
25644
|
return _shape;
|
|
25645
25645
|
}
|
|
25646
25646
|
});
|
|
25647
|
-
return clone(
|
|
25647
|
+
return clone(schema3, def);
|
|
25648
25648
|
}
|
|
25649
25649
|
function merge(a, b) {
|
|
25650
25650
|
if (a._zod.def.checks?.length) {
|
|
@@ -25663,16 +25663,16 @@ function merge(a, b) {
|
|
|
25663
25663
|
});
|
|
25664
25664
|
return clone(a, def);
|
|
25665
25665
|
}
|
|
25666
|
-
function partial(Class2,
|
|
25667
|
-
const currDef =
|
|
25666
|
+
function partial(Class2, schema3, mask) {
|
|
25667
|
+
const currDef = schema3._zod.def;
|
|
25668
25668
|
const checks = currDef.checks;
|
|
25669
25669
|
const hasChecks = checks && checks.length > 0;
|
|
25670
25670
|
if (hasChecks) {
|
|
25671
25671
|
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
25672
25672
|
}
|
|
25673
|
-
const def = mergeDefs(
|
|
25673
|
+
const def = mergeDefs(schema3._zod.def, {
|
|
25674
25674
|
get shape() {
|
|
25675
|
-
const oldShape =
|
|
25675
|
+
const oldShape = schema3._zod.def.shape;
|
|
25676
25676
|
const shape = { ...oldShape };
|
|
25677
25677
|
if (mask) {
|
|
25678
25678
|
for (const key in mask) {
|
|
@@ -25699,12 +25699,12 @@ function partial(Class2, schema2, mask) {
|
|
|
25699
25699
|
},
|
|
25700
25700
|
checks: []
|
|
25701
25701
|
});
|
|
25702
|
-
return clone(
|
|
25702
|
+
return clone(schema3, def);
|
|
25703
25703
|
}
|
|
25704
|
-
function required(Class2,
|
|
25705
|
-
const def = mergeDefs(
|
|
25704
|
+
function required(Class2, schema3, mask) {
|
|
25705
|
+
const def = mergeDefs(schema3._zod.def, {
|
|
25706
25706
|
get shape() {
|
|
25707
|
-
const oldShape =
|
|
25707
|
+
const oldShape = schema3._zod.def.shape;
|
|
25708
25708
|
const shape = { ...oldShape };
|
|
25709
25709
|
if (mask) {
|
|
25710
25710
|
for (const key in mask) {
|
|
@@ -25730,7 +25730,7 @@ function required(Class2, schema2, mask) {
|
|
|
25730
25730
|
return shape;
|
|
25731
25731
|
}
|
|
25732
25732
|
});
|
|
25733
|
-
return clone(
|
|
25733
|
+
return clone(schema3, def);
|
|
25734
25734
|
}
|
|
25735
25735
|
function aborted(x, startIndex = 0) {
|
|
25736
25736
|
if (x.aborted === true)
|
|
@@ -26009,9 +26009,9 @@ function prettifyError(error51) {
|
|
|
26009
26009
|
}
|
|
26010
26010
|
|
|
26011
26011
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
|
|
26012
|
-
var _parse = (_Err) => (
|
|
26012
|
+
var _parse = (_Err) => (schema3, value, _ctx, _params) => {
|
|
26013
26013
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
26014
|
-
const result =
|
|
26014
|
+
const result = schema3._zod.run({ value, issues: [] }, ctx);
|
|
26015
26015
|
if (result instanceof Promise) {
|
|
26016
26016
|
throw new $ZodAsyncError();
|
|
26017
26017
|
}
|
|
@@ -26023,9 +26023,9 @@ var _parse = (_Err) => (schema2, value, _ctx, _params) => {
|
|
|
26023
26023
|
return result.value;
|
|
26024
26024
|
};
|
|
26025
26025
|
var parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
26026
|
-
var _parseAsync = (_Err) => async (
|
|
26026
|
+
var _parseAsync = (_Err) => async (schema3, value, _ctx, params) => {
|
|
26027
26027
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
26028
|
-
let result =
|
|
26028
|
+
let result = schema3._zod.run({ value, issues: [] }, ctx);
|
|
26029
26029
|
if (result instanceof Promise)
|
|
26030
26030
|
result = await result;
|
|
26031
26031
|
if (result.issues.length) {
|
|
@@ -26036,9 +26036,9 @@ var _parseAsync = (_Err) => async (schema2, value, _ctx, params) => {
|
|
|
26036
26036
|
return result.value;
|
|
26037
26037
|
};
|
|
26038
26038
|
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
26039
|
-
var _safeParse = (_Err) => (
|
|
26039
|
+
var _safeParse = (_Err) => (schema3, value, _ctx) => {
|
|
26040
26040
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
26041
|
-
const result =
|
|
26041
|
+
const result = schema3._zod.run({ value, issues: [] }, ctx);
|
|
26042
26042
|
if (result instanceof Promise) {
|
|
26043
26043
|
throw new $ZodAsyncError();
|
|
26044
26044
|
}
|
|
@@ -26048,9 +26048,9 @@ var _safeParse = (_Err) => (schema2, value, _ctx) => {
|
|
|
26048
26048
|
} : { success: true, data: result.value };
|
|
26049
26049
|
};
|
|
26050
26050
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
26051
|
-
var _safeParseAsync = (_Err) => async (
|
|
26051
|
+
var _safeParseAsync = (_Err) => async (schema3, value, _ctx) => {
|
|
26052
26052
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
26053
|
-
let result =
|
|
26053
|
+
let result = schema3._zod.run({ value, issues: [] }, ctx);
|
|
26054
26054
|
if (result instanceof Promise)
|
|
26055
26055
|
result = await result;
|
|
26056
26056
|
return result.issues.length ? {
|
|
@@ -26059,40 +26059,40 @@ var _safeParseAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
|
26059
26059
|
} : { success: true, data: result.value };
|
|
26060
26060
|
};
|
|
26061
26061
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
26062
|
-
var _encode = (_Err) => (
|
|
26062
|
+
var _encode = (_Err) => (schema3, value, _ctx) => {
|
|
26063
26063
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
26064
|
-
return _parse(_Err)(
|
|
26064
|
+
return _parse(_Err)(schema3, value, ctx);
|
|
26065
26065
|
};
|
|
26066
26066
|
var encode = /* @__PURE__ */ _encode($ZodRealError);
|
|
26067
|
-
var _decode = (_Err) => (
|
|
26068
|
-
return _parse(_Err)(
|
|
26067
|
+
var _decode = (_Err) => (schema3, value, _ctx) => {
|
|
26068
|
+
return _parse(_Err)(schema3, value, _ctx);
|
|
26069
26069
|
};
|
|
26070
26070
|
var decode = /* @__PURE__ */ _decode($ZodRealError);
|
|
26071
|
-
var _encodeAsync = (_Err) => async (
|
|
26071
|
+
var _encodeAsync = (_Err) => async (schema3, value, _ctx) => {
|
|
26072
26072
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
26073
|
-
return _parseAsync(_Err)(
|
|
26073
|
+
return _parseAsync(_Err)(schema3, value, ctx);
|
|
26074
26074
|
};
|
|
26075
26075
|
var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
26076
|
-
var _decodeAsync = (_Err) => async (
|
|
26077
|
-
return _parseAsync(_Err)(
|
|
26076
|
+
var _decodeAsync = (_Err) => async (schema3, value, _ctx) => {
|
|
26077
|
+
return _parseAsync(_Err)(schema3, value, _ctx);
|
|
26078
26078
|
};
|
|
26079
26079
|
var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
26080
|
-
var _safeEncode = (_Err) => (
|
|
26080
|
+
var _safeEncode = (_Err) => (schema3, value, _ctx) => {
|
|
26081
26081
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
26082
|
-
return _safeParse(_Err)(
|
|
26082
|
+
return _safeParse(_Err)(schema3, value, ctx);
|
|
26083
26083
|
};
|
|
26084
26084
|
var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
26085
|
-
var _safeDecode = (_Err) => (
|
|
26086
|
-
return _safeParse(_Err)(
|
|
26085
|
+
var _safeDecode = (_Err) => (schema3, value, _ctx) => {
|
|
26086
|
+
return _safeParse(_Err)(schema3, value, _ctx);
|
|
26087
26087
|
};
|
|
26088
26088
|
var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
26089
|
-
var _safeEncodeAsync = (_Err) => async (
|
|
26089
|
+
var _safeEncodeAsync = (_Err) => async (schema3, value, _ctx) => {
|
|
26090
26090
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
26091
|
-
return _safeParseAsync(_Err)(
|
|
26091
|
+
return _safeParseAsync(_Err)(schema3, value, ctx);
|
|
26092
26092
|
};
|
|
26093
26093
|
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
26094
|
-
var _safeDecodeAsync = (_Err) => async (
|
|
26095
|
-
return _safeParseAsync(_Err)(
|
|
26094
|
+
var _safeDecodeAsync = (_Err) => async (schema3, value, _ctx) => {
|
|
26095
|
+
return _safeParseAsync(_Err)(schema3, value, _ctx);
|
|
26096
26096
|
};
|
|
26097
26097
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
26098
26098
|
|
|
@@ -27668,9 +27668,9 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
27668
27668
|
for (const key of normalized.keys) {
|
|
27669
27669
|
const id = ids[key];
|
|
27670
27670
|
const k = esc(key);
|
|
27671
|
-
const
|
|
27672
|
-
const isOptionalIn =
|
|
27673
|
-
const isOptionalOut =
|
|
27671
|
+
const schema3 = shape[key];
|
|
27672
|
+
const isOptionalIn = schema3?._zod?.optin === "optional";
|
|
27673
|
+
const isOptionalOut = schema3?._zod?.optout === "optional";
|
|
27674
27674
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
27675
27675
|
if (isOptionalIn && isOptionalOut) {
|
|
27676
27676
|
doc.write(`
|
|
@@ -34903,11 +34903,11 @@ var $ZodRegistry = class {
|
|
|
34903
34903
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
34904
34904
|
this._idmap = /* @__PURE__ */ new Map();
|
|
34905
34905
|
}
|
|
34906
|
-
add(
|
|
34906
|
+
add(schema3, ..._meta) {
|
|
34907
34907
|
const meta3 = _meta[0];
|
|
34908
|
-
this._map.set(
|
|
34908
|
+
this._map.set(schema3, meta3);
|
|
34909
34909
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
34910
|
-
this._idmap.set(meta3.id,
|
|
34910
|
+
this._idmap.set(meta3.id, schema3);
|
|
34911
34911
|
}
|
|
34912
34912
|
return this;
|
|
34913
34913
|
}
|
|
@@ -34916,26 +34916,26 @@ var $ZodRegistry = class {
|
|
|
34916
34916
|
this._idmap = /* @__PURE__ */ new Map();
|
|
34917
34917
|
return this;
|
|
34918
34918
|
}
|
|
34919
|
-
remove(
|
|
34920
|
-
const meta3 = this._map.get(
|
|
34919
|
+
remove(schema3) {
|
|
34920
|
+
const meta3 = this._map.get(schema3);
|
|
34921
34921
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
34922
34922
|
this._idmap.delete(meta3.id);
|
|
34923
34923
|
}
|
|
34924
|
-
this._map.delete(
|
|
34924
|
+
this._map.delete(schema3);
|
|
34925
34925
|
return this;
|
|
34926
34926
|
}
|
|
34927
|
-
get(
|
|
34928
|
-
const p =
|
|
34927
|
+
get(schema3) {
|
|
34928
|
+
const p = schema3._zod.parent;
|
|
34929
34929
|
if (p) {
|
|
34930
34930
|
const pm = { ...this.get(p) ?? {} };
|
|
34931
34931
|
delete pm.id;
|
|
34932
|
-
const f = { ...pm, ...this._map.get(
|
|
34932
|
+
const f = { ...pm, ...this._map.get(schema3) };
|
|
34933
34933
|
return Object.keys(f).length ? f : void 0;
|
|
34934
34934
|
}
|
|
34935
|
-
return this._map.get(
|
|
34935
|
+
return this._map.get(schema3);
|
|
34936
34936
|
}
|
|
34937
|
-
has(
|
|
34938
|
-
return this._map.has(
|
|
34937
|
+
has(schema3) {
|
|
34938
|
+
return this._map.has(schema3);
|
|
34939
34939
|
}
|
|
34940
34940
|
};
|
|
34941
34941
|
function registry() {
|
|
@@ -35588,11 +35588,11 @@ function _endsWith(suffix, params) {
|
|
|
35588
35588
|
});
|
|
35589
35589
|
}
|
|
35590
35590
|
// @__NO_SIDE_EFFECTS__
|
|
35591
|
-
function _property(property,
|
|
35591
|
+
function _property(property, schema3, params) {
|
|
35592
35592
|
return new $ZodCheckProperty({
|
|
35593
35593
|
check: "property",
|
|
35594
35594
|
property,
|
|
35595
|
-
schema:
|
|
35595
|
+
schema: schema3,
|
|
35596
35596
|
...normalizeParams(params)
|
|
35597
35597
|
});
|
|
35598
35598
|
}
|
|
@@ -35840,23 +35840,23 @@ function _promise(Class2, innerType) {
|
|
|
35840
35840
|
function _custom(Class2, fn, _params) {
|
|
35841
35841
|
const norm = normalizeParams(_params);
|
|
35842
35842
|
norm.abort ?? (norm.abort = true);
|
|
35843
|
-
const
|
|
35843
|
+
const schema3 = new Class2({
|
|
35844
35844
|
type: "custom",
|
|
35845
35845
|
check: "custom",
|
|
35846
35846
|
fn,
|
|
35847
35847
|
...norm
|
|
35848
35848
|
});
|
|
35849
|
-
return
|
|
35849
|
+
return schema3;
|
|
35850
35850
|
}
|
|
35851
35851
|
// @__NO_SIDE_EFFECTS__
|
|
35852
35852
|
function _refine(Class2, fn, _params) {
|
|
35853
|
-
const
|
|
35853
|
+
const schema3 = new Class2({
|
|
35854
35854
|
type: "custom",
|
|
35855
35855
|
check: "custom",
|
|
35856
35856
|
fn,
|
|
35857
35857
|
...normalizeParams(_params)
|
|
35858
35858
|
});
|
|
35859
|
-
return
|
|
35859
|
+
return schema3;
|
|
35860
35860
|
}
|
|
35861
35861
|
// @__NO_SIDE_EFFECTS__
|
|
35862
35862
|
function _superRefine(fn, params) {
|
|
@@ -36005,40 +36005,40 @@ function initializeContext(params) {
|
|
|
36005
36005
|
external: params?.external ?? void 0
|
|
36006
36006
|
};
|
|
36007
36007
|
}
|
|
36008
|
-
function process2(
|
|
36008
|
+
function process2(schema3, ctx, _params = { path: [], schemaPath: [] }) {
|
|
36009
36009
|
var _a3;
|
|
36010
|
-
const def =
|
|
36011
|
-
const seen = ctx.seen.get(
|
|
36010
|
+
const def = schema3._zod.def;
|
|
36011
|
+
const seen = ctx.seen.get(schema3);
|
|
36012
36012
|
if (seen) {
|
|
36013
36013
|
seen.count++;
|
|
36014
|
-
const isCycle = _params.schemaPath.includes(
|
|
36014
|
+
const isCycle = _params.schemaPath.includes(schema3);
|
|
36015
36015
|
if (isCycle) {
|
|
36016
36016
|
seen.cycle = _params.path;
|
|
36017
36017
|
}
|
|
36018
36018
|
return seen.schema;
|
|
36019
36019
|
}
|
|
36020
36020
|
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
36021
|
-
ctx.seen.set(
|
|
36022
|
-
const overrideSchema =
|
|
36021
|
+
ctx.seen.set(schema3, result);
|
|
36022
|
+
const overrideSchema = schema3._zod.toJSONSchema?.();
|
|
36023
36023
|
if (overrideSchema) {
|
|
36024
36024
|
result.schema = overrideSchema;
|
|
36025
36025
|
} else {
|
|
36026
36026
|
const params = {
|
|
36027
36027
|
..._params,
|
|
36028
|
-
schemaPath: [..._params.schemaPath,
|
|
36028
|
+
schemaPath: [..._params.schemaPath, schema3],
|
|
36029
36029
|
path: _params.path
|
|
36030
36030
|
};
|
|
36031
|
-
if (
|
|
36032
|
-
|
|
36031
|
+
if (schema3._zod.processJSONSchema) {
|
|
36032
|
+
schema3._zod.processJSONSchema(ctx, result.schema, params);
|
|
36033
36033
|
} else {
|
|
36034
36034
|
const _json = result.schema;
|
|
36035
36035
|
const processor = ctx.processors[def.type];
|
|
36036
36036
|
if (!processor) {
|
|
36037
36037
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
36038
36038
|
}
|
|
36039
|
-
processor(
|
|
36039
|
+
processor(schema3, ctx, _json, params);
|
|
36040
36040
|
}
|
|
36041
|
-
const parent =
|
|
36041
|
+
const parent = schema3._zod.parent;
|
|
36042
36042
|
if (parent) {
|
|
36043
36043
|
if (!result.ref)
|
|
36044
36044
|
result.ref = parent;
|
|
@@ -36046,21 +36046,21 @@ function process2(schema2, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
36046
36046
|
ctx.seen.get(parent).isParent = true;
|
|
36047
36047
|
}
|
|
36048
36048
|
}
|
|
36049
|
-
const meta3 = ctx.metadataRegistry.get(
|
|
36049
|
+
const meta3 = ctx.metadataRegistry.get(schema3);
|
|
36050
36050
|
if (meta3)
|
|
36051
36051
|
Object.assign(result.schema, meta3);
|
|
36052
|
-
if (ctx.io === "input" && isTransforming(
|
|
36052
|
+
if (ctx.io === "input" && isTransforming(schema3)) {
|
|
36053
36053
|
delete result.schema.examples;
|
|
36054
36054
|
delete result.schema.default;
|
|
36055
36055
|
}
|
|
36056
36056
|
if (ctx.io === "input" && "_prefault" in result.schema)
|
|
36057
36057
|
(_a3 = result.schema).default ?? (_a3.default = result.schema._prefault);
|
|
36058
36058
|
delete result.schema._prefault;
|
|
36059
|
-
const _result = ctx.seen.get(
|
|
36059
|
+
const _result = ctx.seen.get(schema3);
|
|
36060
36060
|
return _result.schema;
|
|
36061
36061
|
}
|
|
36062
|
-
function extractDefs(ctx,
|
|
36063
|
-
const root = ctx.seen.get(
|
|
36062
|
+
function extractDefs(ctx, schema3) {
|
|
36063
|
+
const root = ctx.seen.get(schema3);
|
|
36064
36064
|
if (!root)
|
|
36065
36065
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
36066
36066
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
@@ -36103,11 +36103,11 @@ function extractDefs(ctx, schema2) {
|
|
|
36103
36103
|
seen.def = { ...seen.schema };
|
|
36104
36104
|
if (defId)
|
|
36105
36105
|
seen.defId = defId;
|
|
36106
|
-
const
|
|
36107
|
-
for (const key in
|
|
36108
|
-
delete
|
|
36106
|
+
const schema4 = seen.schema;
|
|
36107
|
+
for (const key in schema4) {
|
|
36108
|
+
delete schema4[key];
|
|
36109
36109
|
}
|
|
36110
|
-
|
|
36110
|
+
schema4.$ref = ref;
|
|
36111
36111
|
};
|
|
36112
36112
|
if (ctx.cycles === "throw") {
|
|
36113
36113
|
for (const entry of ctx.seen.entries()) {
|
|
@@ -36121,13 +36121,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
36121
36121
|
}
|
|
36122
36122
|
for (const entry of ctx.seen.entries()) {
|
|
36123
36123
|
const seen = entry[1];
|
|
36124
|
-
if (
|
|
36124
|
+
if (schema3 === entry[0]) {
|
|
36125
36125
|
extractToDef(entry);
|
|
36126
36126
|
continue;
|
|
36127
36127
|
}
|
|
36128
36128
|
if (ctx.external) {
|
|
36129
36129
|
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
36130
|
-
if (
|
|
36130
|
+
if (schema3 !== entry[0] && ext) {
|
|
36131
36131
|
extractToDef(entry);
|
|
36132
36132
|
continue;
|
|
36133
36133
|
}
|
|
@@ -36149,16 +36149,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
36149
36149
|
}
|
|
36150
36150
|
}
|
|
36151
36151
|
}
|
|
36152
|
-
function finalize(ctx,
|
|
36153
|
-
const root = ctx.seen.get(
|
|
36152
|
+
function finalize(ctx, schema3) {
|
|
36153
|
+
const root = ctx.seen.get(schema3);
|
|
36154
36154
|
if (!root)
|
|
36155
36155
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
36156
36156
|
const flattenRef = (zodSchema) => {
|
|
36157
36157
|
const seen = ctx.seen.get(zodSchema);
|
|
36158
36158
|
if (seen.ref === null)
|
|
36159
36159
|
return;
|
|
36160
|
-
const
|
|
36161
|
-
const _cached = { ...
|
|
36160
|
+
const schema4 = seen.def ?? seen.schema;
|
|
36161
|
+
const _cached = { ...schema4 };
|
|
36162
36162
|
const ref = seen.ref;
|
|
36163
36163
|
seen.ref = null;
|
|
36164
36164
|
if (ref) {
|
|
@@ -36166,28 +36166,28 @@ function finalize(ctx, schema2) {
|
|
|
36166
36166
|
const refSeen = ctx.seen.get(ref);
|
|
36167
36167
|
const refSchema = refSeen.schema;
|
|
36168
36168
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
36169
|
-
|
|
36170
|
-
|
|
36169
|
+
schema4.allOf = schema4.allOf ?? [];
|
|
36170
|
+
schema4.allOf.push(refSchema);
|
|
36171
36171
|
} else {
|
|
36172
|
-
Object.assign(
|
|
36172
|
+
Object.assign(schema4, refSchema);
|
|
36173
36173
|
}
|
|
36174
|
-
Object.assign(
|
|
36174
|
+
Object.assign(schema4, _cached);
|
|
36175
36175
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
36176
36176
|
if (isParentRef) {
|
|
36177
|
-
for (const key in
|
|
36177
|
+
for (const key in schema4) {
|
|
36178
36178
|
if (key === "$ref" || key === "allOf")
|
|
36179
36179
|
continue;
|
|
36180
36180
|
if (!(key in _cached)) {
|
|
36181
|
-
delete
|
|
36181
|
+
delete schema4[key];
|
|
36182
36182
|
}
|
|
36183
36183
|
}
|
|
36184
36184
|
}
|
|
36185
36185
|
if (refSchema.$ref && refSeen.def) {
|
|
36186
|
-
for (const key in
|
|
36186
|
+
for (const key in schema4) {
|
|
36187
36187
|
if (key === "$ref" || key === "allOf")
|
|
36188
36188
|
continue;
|
|
36189
|
-
if (key in refSeen.def && JSON.stringify(
|
|
36190
|
-
delete
|
|
36189
|
+
if (key in refSeen.def && JSON.stringify(schema4[key]) === JSON.stringify(refSeen.def[key])) {
|
|
36190
|
+
delete schema4[key];
|
|
36191
36191
|
}
|
|
36192
36192
|
}
|
|
36193
36193
|
}
|
|
@@ -36197,13 +36197,13 @@ function finalize(ctx, schema2) {
|
|
|
36197
36197
|
flattenRef(parent);
|
|
36198
36198
|
const parentSeen = ctx.seen.get(parent);
|
|
36199
36199
|
if (parentSeen?.schema.$ref) {
|
|
36200
|
-
|
|
36200
|
+
schema4.$ref = parentSeen.schema.$ref;
|
|
36201
36201
|
if (parentSeen.def) {
|
|
36202
|
-
for (const key in
|
|
36202
|
+
for (const key in schema4) {
|
|
36203
36203
|
if (key === "$ref" || key === "allOf")
|
|
36204
36204
|
continue;
|
|
36205
|
-
if (key in parentSeen.def && JSON.stringify(
|
|
36206
|
-
delete
|
|
36205
|
+
if (key in parentSeen.def && JSON.stringify(schema4[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
36206
|
+
delete schema4[key];
|
|
36207
36207
|
}
|
|
36208
36208
|
}
|
|
36209
36209
|
}
|
|
@@ -36211,7 +36211,7 @@ function finalize(ctx, schema2) {
|
|
|
36211
36211
|
}
|
|
36212
36212
|
ctx.override({
|
|
36213
36213
|
zodSchema,
|
|
36214
|
-
jsonSchema:
|
|
36214
|
+
jsonSchema: schema4,
|
|
36215
36215
|
path: seen.path ?? []
|
|
36216
36216
|
});
|
|
36217
36217
|
};
|
|
@@ -36229,13 +36229,13 @@ function finalize(ctx, schema2) {
|
|
|
36229
36229
|
} else {
|
|
36230
36230
|
}
|
|
36231
36231
|
if (ctx.external?.uri) {
|
|
36232
|
-
const id = ctx.external.registry.get(
|
|
36232
|
+
const id = ctx.external.registry.get(schema3)?.id;
|
|
36233
36233
|
if (!id)
|
|
36234
36234
|
throw new Error("Schema is missing an `id` property");
|
|
36235
36235
|
result.$id = ctx.external.uri(id);
|
|
36236
36236
|
}
|
|
36237
36237
|
Object.assign(result, root.def ?? root.schema);
|
|
36238
|
-
const rootMetaId = ctx.metadataRegistry.get(
|
|
36238
|
+
const rootMetaId = ctx.metadataRegistry.get(schema3)?.id;
|
|
36239
36239
|
if (rootMetaId !== void 0 && result.id === rootMetaId)
|
|
36240
36240
|
delete result.id;
|
|
36241
36241
|
const defs = ctx.external?.defs ?? {};
|
|
@@ -36261,10 +36261,10 @@ function finalize(ctx, schema2) {
|
|
|
36261
36261
|
const finalized = JSON.parse(JSON.stringify(result));
|
|
36262
36262
|
Object.defineProperty(finalized, "~standard", {
|
|
36263
36263
|
value: {
|
|
36264
|
-
...
|
|
36264
|
+
...schema3["~standard"],
|
|
36265
36265
|
jsonSchema: {
|
|
36266
|
-
input: createStandardJSONSchemaMethod(
|
|
36267
|
-
output: createStandardJSONSchemaMethod(
|
|
36266
|
+
input: createStandardJSONSchemaMethod(schema3, "input", ctx.processors),
|
|
36267
|
+
output: createStandardJSONSchemaMethod(schema3, "output", ctx.processors)
|
|
36268
36268
|
}
|
|
36269
36269
|
},
|
|
36270
36270
|
enumerable: false,
|
|
@@ -36328,18 +36328,18 @@ function isTransforming(_schema, _ctx) {
|
|
|
36328
36328
|
}
|
|
36329
36329
|
return false;
|
|
36330
36330
|
}
|
|
36331
|
-
var createToJSONSchemaMethod = (
|
|
36331
|
+
var createToJSONSchemaMethod = (schema3, processors = {}) => (params) => {
|
|
36332
36332
|
const ctx = initializeContext({ ...params, processors });
|
|
36333
|
-
process2(
|
|
36334
|
-
extractDefs(ctx,
|
|
36335
|
-
return finalize(ctx,
|
|
36333
|
+
process2(schema3, ctx);
|
|
36334
|
+
extractDefs(ctx, schema3);
|
|
36335
|
+
return finalize(ctx, schema3);
|
|
36336
36336
|
};
|
|
36337
|
-
var createStandardJSONSchemaMethod = (
|
|
36337
|
+
var createStandardJSONSchemaMethod = (schema3, io, processors = {}) => (params) => {
|
|
36338
36338
|
const { libraryOptions, target } = params ?? {};
|
|
36339
36339
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
36340
|
-
process2(
|
|
36341
|
-
extractDefs(ctx,
|
|
36342
|
-
return finalize(ctx,
|
|
36340
|
+
process2(schema3, ctx);
|
|
36341
|
+
extractDefs(ctx, schema3);
|
|
36342
|
+
return finalize(ctx, schema3);
|
|
36343
36343
|
};
|
|
36344
36344
|
|
|
36345
36345
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
|
|
@@ -36351,10 +36351,10 @@ var formatMap = {
|
|
|
36351
36351
|
regex: ""
|
|
36352
36352
|
// do not set
|
|
36353
36353
|
};
|
|
36354
|
-
var stringProcessor = (
|
|
36354
|
+
var stringProcessor = (schema3, ctx, _json, _params) => {
|
|
36355
36355
|
const json2 = _json;
|
|
36356
36356
|
json2.type = "string";
|
|
36357
|
-
const { minimum, maximum, format, patterns, contentEncoding } =
|
|
36357
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema3._zod.bag;
|
|
36358
36358
|
if (typeof minimum === "number")
|
|
36359
36359
|
json2.minLength = minimum;
|
|
36360
36360
|
if (typeof maximum === "number")
|
|
@@ -36383,9 +36383,9 @@ var stringProcessor = (schema2, ctx, _json, _params) => {
|
|
|
36383
36383
|
}
|
|
36384
36384
|
}
|
|
36385
36385
|
};
|
|
36386
|
-
var numberProcessor = (
|
|
36386
|
+
var numberProcessor = (schema3, ctx, _json, _params) => {
|
|
36387
36387
|
const json2 = _json;
|
|
36388
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } =
|
|
36388
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema3._zod.bag;
|
|
36389
36389
|
if (typeof format === "string" && format.includes("int"))
|
|
36390
36390
|
json2.type = "integer";
|
|
36391
36391
|
else
|
|
@@ -36460,8 +36460,8 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
36460
36460
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
36461
36461
|
}
|
|
36462
36462
|
};
|
|
36463
|
-
var enumProcessor = (
|
|
36464
|
-
const def =
|
|
36463
|
+
var enumProcessor = (schema3, _ctx, json2, _params) => {
|
|
36464
|
+
const def = schema3._zod.def;
|
|
36465
36465
|
const values = getEnumValues(def.entries);
|
|
36466
36466
|
if (values.every((v) => typeof v === "number"))
|
|
36467
36467
|
json2.type = "number";
|
|
@@ -36469,8 +36469,8 @@ var enumProcessor = (schema2, _ctx, json2, _params) => {
|
|
|
36469
36469
|
json2.type = "string";
|
|
36470
36470
|
json2.enum = values;
|
|
36471
36471
|
};
|
|
36472
|
-
var literalProcessor = (
|
|
36473
|
-
const def =
|
|
36472
|
+
var literalProcessor = (schema3, ctx, json2, _params) => {
|
|
36473
|
+
const def = schema3._zod.def;
|
|
36474
36474
|
const vals = [];
|
|
36475
36475
|
for (const val of def.values) {
|
|
36476
36476
|
if (val === void 0) {
|
|
@@ -36514,22 +36514,22 @@ var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
|
36514
36514
|
throw new Error("NaN cannot be represented in JSON Schema");
|
|
36515
36515
|
}
|
|
36516
36516
|
};
|
|
36517
|
-
var templateLiteralProcessor = (
|
|
36517
|
+
var templateLiteralProcessor = (schema3, _ctx, json2, _params) => {
|
|
36518
36518
|
const _json = json2;
|
|
36519
|
-
const pattern =
|
|
36519
|
+
const pattern = schema3._zod.pattern;
|
|
36520
36520
|
if (!pattern)
|
|
36521
36521
|
throw new Error("Pattern not found in template literal");
|
|
36522
36522
|
_json.type = "string";
|
|
36523
36523
|
_json.pattern = pattern.source;
|
|
36524
36524
|
};
|
|
36525
|
-
var fileProcessor = (
|
|
36525
|
+
var fileProcessor = (schema3, _ctx, json2, _params) => {
|
|
36526
36526
|
const _json = json2;
|
|
36527
36527
|
const file2 = {
|
|
36528
36528
|
type: "string",
|
|
36529
36529
|
format: "binary",
|
|
36530
36530
|
contentEncoding: "binary"
|
|
36531
36531
|
};
|
|
36532
|
-
const { minimum, maximum, mime } =
|
|
36532
|
+
const { minimum, maximum, mime } = schema3._zod.bag;
|
|
36533
36533
|
if (minimum !== void 0)
|
|
36534
36534
|
file2.minLength = minimum;
|
|
36535
36535
|
if (maximum !== void 0)
|
|
@@ -36574,10 +36574,10 @@ var setProcessor = (_schema, ctx, _json, _params) => {
|
|
|
36574
36574
|
throw new Error("Set cannot be represented in JSON Schema");
|
|
36575
36575
|
}
|
|
36576
36576
|
};
|
|
36577
|
-
var arrayProcessor = (
|
|
36577
|
+
var arrayProcessor = (schema3, ctx, _json, params) => {
|
|
36578
36578
|
const json2 = _json;
|
|
36579
|
-
const def =
|
|
36580
|
-
const { minimum, maximum } =
|
|
36579
|
+
const def = schema3._zod.def;
|
|
36580
|
+
const { minimum, maximum } = schema3._zod.bag;
|
|
36581
36581
|
if (typeof minimum === "number")
|
|
36582
36582
|
json2.minItems = minimum;
|
|
36583
36583
|
if (typeof maximum === "number")
|
|
@@ -36588,9 +36588,9 @@ var arrayProcessor = (schema2, ctx, _json, params) => {
|
|
|
36588
36588
|
path: [...params.path, "items"]
|
|
36589
36589
|
});
|
|
36590
36590
|
};
|
|
36591
|
-
var objectProcessor = (
|
|
36591
|
+
var objectProcessor = (schema3, ctx, _json, params) => {
|
|
36592
36592
|
const json2 = _json;
|
|
36593
|
-
const def =
|
|
36593
|
+
const def = schema3._zod.def;
|
|
36594
36594
|
json2.type = "object";
|
|
36595
36595
|
json2.properties = {};
|
|
36596
36596
|
const shape = def.shape;
|
|
@@ -36624,8 +36624,8 @@ var objectProcessor = (schema2, ctx, _json, params) => {
|
|
|
36624
36624
|
});
|
|
36625
36625
|
}
|
|
36626
36626
|
};
|
|
36627
|
-
var unionProcessor = (
|
|
36628
|
-
const def =
|
|
36627
|
+
var unionProcessor = (schema3, ctx, json2, params) => {
|
|
36628
|
+
const def = schema3._zod.def;
|
|
36629
36629
|
const isExclusive = def.inclusive === false;
|
|
36630
36630
|
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
36631
36631
|
...params,
|
|
@@ -36637,8 +36637,8 @@ var unionProcessor = (schema2, ctx, json2, params) => {
|
|
|
36637
36637
|
json2.anyOf = options;
|
|
36638
36638
|
}
|
|
36639
36639
|
};
|
|
36640
|
-
var intersectionProcessor = (
|
|
36641
|
-
const def =
|
|
36640
|
+
var intersectionProcessor = (schema3, ctx, json2, params) => {
|
|
36641
|
+
const def = schema3._zod.def;
|
|
36642
36642
|
const a = process2(def.left, ctx, {
|
|
36643
36643
|
...params,
|
|
36644
36644
|
path: [...params.path, "allOf", 0]
|
|
@@ -36654,9 +36654,9 @@ var intersectionProcessor = (schema2, ctx, json2, params) => {
|
|
|
36654
36654
|
];
|
|
36655
36655
|
json2.allOf = allOf;
|
|
36656
36656
|
};
|
|
36657
|
-
var tupleProcessor = (
|
|
36657
|
+
var tupleProcessor = (schema3, ctx, _json, params) => {
|
|
36658
36658
|
const json2 = _json;
|
|
36659
|
-
const def =
|
|
36659
|
+
const def = schema3._zod.def;
|
|
36660
36660
|
json2.type = "array";
|
|
36661
36661
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
36662
36662
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
@@ -36690,15 +36690,15 @@ var tupleProcessor = (schema2, ctx, _json, params) => {
|
|
|
36690
36690
|
json2.additionalItems = rest;
|
|
36691
36691
|
}
|
|
36692
36692
|
}
|
|
36693
|
-
const { minimum, maximum } =
|
|
36693
|
+
const { minimum, maximum } = schema3._zod.bag;
|
|
36694
36694
|
if (typeof minimum === "number")
|
|
36695
36695
|
json2.minItems = minimum;
|
|
36696
36696
|
if (typeof maximum === "number")
|
|
36697
36697
|
json2.maxItems = maximum;
|
|
36698
36698
|
};
|
|
36699
|
-
var recordProcessor = (
|
|
36699
|
+
var recordProcessor = (schema3, ctx, _json, params) => {
|
|
36700
36700
|
const json2 = _json;
|
|
36701
|
-
const def =
|
|
36701
|
+
const def = schema3._zod.def;
|
|
36702
36702
|
json2.type = "object";
|
|
36703
36703
|
const keyType = def.keyType;
|
|
36704
36704
|
const keyBag = keyType._zod.bag;
|
|
@@ -36732,10 +36732,10 @@ var recordProcessor = (schema2, ctx, _json, params) => {
|
|
|
36732
36732
|
}
|
|
36733
36733
|
}
|
|
36734
36734
|
};
|
|
36735
|
-
var nullableProcessor = (
|
|
36736
|
-
const def =
|
|
36735
|
+
var nullableProcessor = (schema3, ctx, json2, params) => {
|
|
36736
|
+
const def = schema3._zod.def;
|
|
36737
36737
|
const inner = process2(def.innerType, ctx, params);
|
|
36738
|
-
const seen = ctx.seen.get(
|
|
36738
|
+
const seen = ctx.seen.get(schema3);
|
|
36739
36739
|
if (ctx.target === "openapi-3.0") {
|
|
36740
36740
|
seen.ref = def.innerType;
|
|
36741
36741
|
json2.nullable = true;
|
|
@@ -36743,31 +36743,31 @@ var nullableProcessor = (schema2, ctx, json2, params) => {
|
|
|
36743
36743
|
json2.anyOf = [inner, { type: "null" }];
|
|
36744
36744
|
}
|
|
36745
36745
|
};
|
|
36746
|
-
var nonoptionalProcessor = (
|
|
36747
|
-
const def =
|
|
36746
|
+
var nonoptionalProcessor = (schema3, ctx, _json, params) => {
|
|
36747
|
+
const def = schema3._zod.def;
|
|
36748
36748
|
process2(def.innerType, ctx, params);
|
|
36749
|
-
const seen = ctx.seen.get(
|
|
36749
|
+
const seen = ctx.seen.get(schema3);
|
|
36750
36750
|
seen.ref = def.innerType;
|
|
36751
36751
|
};
|
|
36752
|
-
var defaultProcessor = (
|
|
36753
|
-
const def =
|
|
36752
|
+
var defaultProcessor = (schema3, ctx, json2, params) => {
|
|
36753
|
+
const def = schema3._zod.def;
|
|
36754
36754
|
process2(def.innerType, ctx, params);
|
|
36755
|
-
const seen = ctx.seen.get(
|
|
36755
|
+
const seen = ctx.seen.get(schema3);
|
|
36756
36756
|
seen.ref = def.innerType;
|
|
36757
36757
|
json2.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
36758
36758
|
};
|
|
36759
|
-
var prefaultProcessor = (
|
|
36760
|
-
const def =
|
|
36759
|
+
var prefaultProcessor = (schema3, ctx, json2, params) => {
|
|
36760
|
+
const def = schema3._zod.def;
|
|
36761
36761
|
process2(def.innerType, ctx, params);
|
|
36762
|
-
const seen = ctx.seen.get(
|
|
36762
|
+
const seen = ctx.seen.get(schema3);
|
|
36763
36763
|
seen.ref = def.innerType;
|
|
36764
36764
|
if (ctx.io === "input")
|
|
36765
36765
|
json2._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
36766
36766
|
};
|
|
36767
|
-
var catchProcessor = (
|
|
36768
|
-
const def =
|
|
36767
|
+
var catchProcessor = (schema3, ctx, json2, params) => {
|
|
36768
|
+
const def = schema3._zod.def;
|
|
36769
36769
|
process2(def.innerType, ctx, params);
|
|
36770
|
-
const seen = ctx.seen.get(
|
|
36770
|
+
const seen = ctx.seen.get(schema3);
|
|
36771
36771
|
seen.ref = def.innerType;
|
|
36772
36772
|
let catchValue;
|
|
36773
36773
|
try {
|
|
@@ -36777,37 +36777,37 @@ var catchProcessor = (schema2, ctx, json2, params) => {
|
|
|
36777
36777
|
}
|
|
36778
36778
|
json2.default = catchValue;
|
|
36779
36779
|
};
|
|
36780
|
-
var pipeProcessor = (
|
|
36781
|
-
const def =
|
|
36780
|
+
var pipeProcessor = (schema3, ctx, _json, params) => {
|
|
36781
|
+
const def = schema3._zod.def;
|
|
36782
36782
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
36783
36783
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
36784
36784
|
process2(innerType, ctx, params);
|
|
36785
|
-
const seen = ctx.seen.get(
|
|
36785
|
+
const seen = ctx.seen.get(schema3);
|
|
36786
36786
|
seen.ref = innerType;
|
|
36787
36787
|
};
|
|
36788
|
-
var readonlyProcessor = (
|
|
36789
|
-
const def =
|
|
36788
|
+
var readonlyProcessor = (schema3, ctx, json2, params) => {
|
|
36789
|
+
const def = schema3._zod.def;
|
|
36790
36790
|
process2(def.innerType, ctx, params);
|
|
36791
|
-
const seen = ctx.seen.get(
|
|
36791
|
+
const seen = ctx.seen.get(schema3);
|
|
36792
36792
|
seen.ref = def.innerType;
|
|
36793
36793
|
json2.readOnly = true;
|
|
36794
36794
|
};
|
|
36795
|
-
var promiseProcessor = (
|
|
36796
|
-
const def =
|
|
36795
|
+
var promiseProcessor = (schema3, ctx, _json, params) => {
|
|
36796
|
+
const def = schema3._zod.def;
|
|
36797
36797
|
process2(def.innerType, ctx, params);
|
|
36798
|
-
const seen = ctx.seen.get(
|
|
36798
|
+
const seen = ctx.seen.get(schema3);
|
|
36799
36799
|
seen.ref = def.innerType;
|
|
36800
36800
|
};
|
|
36801
|
-
var optionalProcessor = (
|
|
36802
|
-
const def =
|
|
36801
|
+
var optionalProcessor = (schema3, ctx, _json, params) => {
|
|
36802
|
+
const def = schema3._zod.def;
|
|
36803
36803
|
process2(def.innerType, ctx, params);
|
|
36804
|
-
const seen = ctx.seen.get(
|
|
36804
|
+
const seen = ctx.seen.get(schema3);
|
|
36805
36805
|
seen.ref = def.innerType;
|
|
36806
36806
|
};
|
|
36807
|
-
var lazyProcessor = (
|
|
36808
|
-
const innerType =
|
|
36807
|
+
var lazyProcessor = (schema3, ctx, _json, params) => {
|
|
36808
|
+
const innerType = schema3._zod.innerType;
|
|
36809
36809
|
process2(innerType, ctx, params);
|
|
36810
|
-
const seen = ctx.seen.get(
|
|
36810
|
+
const seen = ctx.seen.get(schema3);
|
|
36811
36811
|
seen.ref = innerType;
|
|
36812
36812
|
};
|
|
36813
36813
|
var allProcessors = {
|
|
@@ -36857,8 +36857,8 @@ function toJSONSchema(input, params) {
|
|
|
36857
36857
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
36858
36858
|
const defs = {};
|
|
36859
36859
|
for (const entry of registry2._idmap.entries()) {
|
|
36860
|
-
const [_,
|
|
36861
|
-
process2(
|
|
36860
|
+
const [_, schema3] = entry;
|
|
36861
|
+
process2(schema3, ctx2);
|
|
36862
36862
|
}
|
|
36863
36863
|
const schemas = {};
|
|
36864
36864
|
const external = {
|
|
@@ -36868,9 +36868,9 @@ function toJSONSchema(input, params) {
|
|
|
36868
36868
|
};
|
|
36869
36869
|
ctx2.external = external;
|
|
36870
36870
|
for (const entry of registry2._idmap.entries()) {
|
|
36871
|
-
const [key,
|
|
36872
|
-
extractDefs(ctx2,
|
|
36873
|
-
schemas[key] = finalize(ctx2,
|
|
36871
|
+
const [key, schema3] = entry;
|
|
36872
|
+
extractDefs(ctx2, schema3);
|
|
36873
|
+
schemas[key] = finalize(ctx2, schema3);
|
|
36874
36874
|
}
|
|
36875
36875
|
if (Object.keys(defs).length > 0) {
|
|
36876
36876
|
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
@@ -36938,14 +36938,14 @@ var JSONSchemaGenerator = class {
|
|
|
36938
36938
|
* Process a schema to prepare it for JSON Schema generation.
|
|
36939
36939
|
* This must be called before emit().
|
|
36940
36940
|
*/
|
|
36941
|
-
process(
|
|
36942
|
-
return process2(
|
|
36941
|
+
process(schema3, _params = { path: [], schemaPath: [] }) {
|
|
36942
|
+
return process2(schema3, this.ctx, _params);
|
|
36943
36943
|
}
|
|
36944
36944
|
/**
|
|
36945
36945
|
* Emit the final JSON Schema after processing.
|
|
36946
36946
|
* Must call process() first.
|
|
36947
36947
|
*/
|
|
36948
|
-
emit(
|
|
36948
|
+
emit(schema3, _params) {
|
|
36949
36949
|
if (_params) {
|
|
36950
36950
|
if (_params.cycles)
|
|
36951
36951
|
this.ctx.cycles = _params.cycles;
|
|
@@ -36954,8 +36954,8 @@ var JSONSchemaGenerator = class {
|
|
|
36954
36954
|
if (_params.external)
|
|
36955
36955
|
this.ctx.external = _params.external;
|
|
36956
36956
|
}
|
|
36957
|
-
extractDefs(this.ctx,
|
|
36958
|
-
const result = finalize(this.ctx,
|
|
36957
|
+
extractDefs(this.ctx, schema3);
|
|
36958
|
+
const result = finalize(this.ctx, schema3);
|
|
36959
36959
|
const { "~standard": _, ...plainResult } = result;
|
|
36960
36960
|
return plainResult;
|
|
36961
36961
|
}
|
|
@@ -37920,8 +37920,8 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
|
37920
37920
|
function array(element, params) {
|
|
37921
37921
|
return _array(ZodArray, element, params);
|
|
37922
37922
|
}
|
|
37923
|
-
function keyof(
|
|
37924
|
-
const shape =
|
|
37923
|
+
function keyof(schema3) {
|
|
37924
|
+
const shape = schema3._zod.def.shape;
|
|
37925
37925
|
return _enum2(Object.keys(shape));
|
|
37926
37926
|
}
|
|
37927
37927
|
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
@@ -38546,11 +38546,11 @@ function json(params) {
|
|
|
38546
38546
|
});
|
|
38547
38547
|
return jsonSchema;
|
|
38548
38548
|
}
|
|
38549
|
-
function preprocess(fn,
|
|
38549
|
+
function preprocess(fn, schema3) {
|
|
38550
38550
|
return new ZodPreprocess({
|
|
38551
38551
|
type: "pipe",
|
|
38552
38552
|
in: transform(fn),
|
|
38553
|
-
out:
|
|
38553
|
+
out: schema3
|
|
38554
38554
|
});
|
|
38555
38555
|
}
|
|
38556
38556
|
|
|
@@ -38657,8 +38657,8 @@ var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
|
|
|
38657
38657
|
"nullable",
|
|
38658
38658
|
"readOnly"
|
|
38659
38659
|
]);
|
|
38660
|
-
function detectVersion(
|
|
38661
|
-
const $schema =
|
|
38660
|
+
function detectVersion(schema3, defaultTarget) {
|
|
38661
|
+
const $schema = schema3.$schema;
|
|
38662
38662
|
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
38663
38663
|
return "draft-2020-12";
|
|
38664
38664
|
}
|
|
@@ -38688,27 +38688,27 @@ function resolveRef(ref, ctx) {
|
|
|
38688
38688
|
}
|
|
38689
38689
|
throw new Error(`Reference not found: ${ref}`);
|
|
38690
38690
|
}
|
|
38691
|
-
function convertBaseSchema(
|
|
38692
|
-
if (
|
|
38693
|
-
if (typeof
|
|
38691
|
+
function convertBaseSchema(schema3, ctx) {
|
|
38692
|
+
if (schema3.not !== void 0) {
|
|
38693
|
+
if (typeof schema3.not === "object" && Object.keys(schema3.not).length === 0) {
|
|
38694
38694
|
return z.never();
|
|
38695
38695
|
}
|
|
38696
38696
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
38697
38697
|
}
|
|
38698
|
-
if (
|
|
38698
|
+
if (schema3.unevaluatedItems !== void 0) {
|
|
38699
38699
|
throw new Error("unevaluatedItems is not supported");
|
|
38700
38700
|
}
|
|
38701
|
-
if (
|
|
38701
|
+
if (schema3.unevaluatedProperties !== void 0) {
|
|
38702
38702
|
throw new Error("unevaluatedProperties is not supported");
|
|
38703
38703
|
}
|
|
38704
|
-
if (
|
|
38704
|
+
if (schema3.if !== void 0 || schema3.then !== void 0 || schema3.else !== void 0) {
|
|
38705
38705
|
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
38706
38706
|
}
|
|
38707
|
-
if (
|
|
38707
|
+
if (schema3.dependentSchemas !== void 0 || schema3.dependentRequired !== void 0) {
|
|
38708
38708
|
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
38709
38709
|
}
|
|
38710
|
-
if (
|
|
38711
|
-
const refPath =
|
|
38710
|
+
if (schema3.$ref) {
|
|
38711
|
+
const refPath = schema3.$ref;
|
|
38712
38712
|
if (ctx.refs.has(refPath)) {
|
|
38713
38713
|
return ctx.refs.get(refPath);
|
|
38714
38714
|
}
|
|
@@ -38727,9 +38727,9 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
38727
38727
|
ctx.processing.delete(refPath);
|
|
38728
38728
|
return zodSchema2;
|
|
38729
38729
|
}
|
|
38730
|
-
if (
|
|
38731
|
-
const enumValues =
|
|
38732
|
-
if (ctx.version === "openapi-3.0" &&
|
|
38730
|
+
if (schema3.enum !== void 0) {
|
|
38731
|
+
const enumValues = schema3.enum;
|
|
38732
|
+
if (ctx.version === "openapi-3.0" && schema3.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
38733
38733
|
return z.null();
|
|
38734
38734
|
}
|
|
38735
38735
|
if (enumValues.length === 0) {
|
|
@@ -38747,13 +38747,13 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
38747
38747
|
}
|
|
38748
38748
|
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
38749
38749
|
}
|
|
38750
|
-
if (
|
|
38751
|
-
return z.literal(
|
|
38750
|
+
if (schema3.const !== void 0) {
|
|
38751
|
+
return z.literal(schema3.const);
|
|
38752
38752
|
}
|
|
38753
|
-
const type =
|
|
38753
|
+
const type = schema3.type;
|
|
38754
38754
|
if (Array.isArray(type)) {
|
|
38755
38755
|
const typeSchemas = type.map((t) => {
|
|
38756
|
-
const typeSchema = { ...
|
|
38756
|
+
const typeSchema = { ...schema3, type: t };
|
|
38757
38757
|
return convertBaseSchema(typeSchema, ctx);
|
|
38758
38758
|
});
|
|
38759
38759
|
if (typeSchemas.length === 0) {
|
|
@@ -38771,8 +38771,8 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
38771
38771
|
switch (type) {
|
|
38772
38772
|
case "string": {
|
|
38773
38773
|
let stringSchema = z.string();
|
|
38774
|
-
if (
|
|
38775
|
-
const format =
|
|
38774
|
+
if (schema3.format) {
|
|
38775
|
+
const format = schema3.format;
|
|
38776
38776
|
if (format === "email") {
|
|
38777
38777
|
stringSchema = stringSchema.check(z.email());
|
|
38778
38778
|
} else if (format === "uri" || format === "uri-reference") {
|
|
@@ -38821,14 +38821,14 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
38821
38821
|
stringSchema = stringSchema.check(z.ksuid());
|
|
38822
38822
|
}
|
|
38823
38823
|
}
|
|
38824
|
-
if (typeof
|
|
38825
|
-
stringSchema = stringSchema.min(
|
|
38824
|
+
if (typeof schema3.minLength === "number") {
|
|
38825
|
+
stringSchema = stringSchema.min(schema3.minLength);
|
|
38826
38826
|
}
|
|
38827
|
-
if (typeof
|
|
38828
|
-
stringSchema = stringSchema.max(
|
|
38827
|
+
if (typeof schema3.maxLength === "number") {
|
|
38828
|
+
stringSchema = stringSchema.max(schema3.maxLength);
|
|
38829
38829
|
}
|
|
38830
|
-
if (
|
|
38831
|
-
stringSchema = stringSchema.regex(new RegExp(
|
|
38830
|
+
if (schema3.pattern) {
|
|
38831
|
+
stringSchema = stringSchema.regex(new RegExp(schema3.pattern));
|
|
38832
38832
|
}
|
|
38833
38833
|
zodSchema = stringSchema;
|
|
38834
38834
|
break;
|
|
@@ -38836,24 +38836,24 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
38836
38836
|
case "number":
|
|
38837
38837
|
case "integer": {
|
|
38838
38838
|
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
38839
|
-
if (typeof
|
|
38840
|
-
numberSchema = numberSchema.min(
|
|
38839
|
+
if (typeof schema3.minimum === "number") {
|
|
38840
|
+
numberSchema = numberSchema.min(schema3.minimum);
|
|
38841
38841
|
}
|
|
38842
|
-
if (typeof
|
|
38843
|
-
numberSchema = numberSchema.max(
|
|
38842
|
+
if (typeof schema3.maximum === "number") {
|
|
38843
|
+
numberSchema = numberSchema.max(schema3.maximum);
|
|
38844
38844
|
}
|
|
38845
|
-
if (typeof
|
|
38846
|
-
numberSchema = numberSchema.gt(
|
|
38847
|
-
} else if (
|
|
38848
|
-
numberSchema = numberSchema.gt(
|
|
38845
|
+
if (typeof schema3.exclusiveMinimum === "number") {
|
|
38846
|
+
numberSchema = numberSchema.gt(schema3.exclusiveMinimum);
|
|
38847
|
+
} else if (schema3.exclusiveMinimum === true && typeof schema3.minimum === "number") {
|
|
38848
|
+
numberSchema = numberSchema.gt(schema3.minimum);
|
|
38849
38849
|
}
|
|
38850
|
-
if (typeof
|
|
38851
|
-
numberSchema = numberSchema.lt(
|
|
38852
|
-
} else if (
|
|
38853
|
-
numberSchema = numberSchema.lt(
|
|
38850
|
+
if (typeof schema3.exclusiveMaximum === "number") {
|
|
38851
|
+
numberSchema = numberSchema.lt(schema3.exclusiveMaximum);
|
|
38852
|
+
} else if (schema3.exclusiveMaximum === true && typeof schema3.maximum === "number") {
|
|
38853
|
+
numberSchema = numberSchema.lt(schema3.maximum);
|
|
38854
38854
|
}
|
|
38855
|
-
if (typeof
|
|
38856
|
-
numberSchema = numberSchema.multipleOf(
|
|
38855
|
+
if (typeof schema3.multipleOf === "number") {
|
|
38856
|
+
numberSchema = numberSchema.multipleOf(schema3.multipleOf);
|
|
38857
38857
|
}
|
|
38858
38858
|
zodSchema = numberSchema;
|
|
38859
38859
|
break;
|
|
@@ -38868,15 +38868,15 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
38868
38868
|
}
|
|
38869
38869
|
case "object": {
|
|
38870
38870
|
const shape = {};
|
|
38871
|
-
const properties =
|
|
38872
|
-
const requiredSet = new Set(
|
|
38871
|
+
const properties = schema3.properties || {};
|
|
38872
|
+
const requiredSet = new Set(schema3.required || []);
|
|
38873
38873
|
for (const [key, propSchema] of Object.entries(properties)) {
|
|
38874
38874
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
38875
38875
|
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
38876
38876
|
}
|
|
38877
|
-
if (
|
|
38878
|
-
const keySchema = convertSchema(
|
|
38879
|
-
const valueSchema =
|
|
38877
|
+
if (schema3.propertyNames) {
|
|
38878
|
+
const keySchema = convertSchema(schema3.propertyNames, ctx);
|
|
38879
|
+
const valueSchema = schema3.additionalProperties && typeof schema3.additionalProperties === "object" ? convertSchema(schema3.additionalProperties, ctx) : z.any();
|
|
38880
38880
|
if (Object.keys(shape).length === 0) {
|
|
38881
38881
|
zodSchema = z.record(keySchema, valueSchema);
|
|
38882
38882
|
break;
|
|
@@ -38886,8 +38886,8 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
38886
38886
|
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
38887
38887
|
break;
|
|
38888
38888
|
}
|
|
38889
|
-
if (
|
|
38890
|
-
const patternProps =
|
|
38889
|
+
if (schema3.patternProperties) {
|
|
38890
|
+
const patternProps = schema3.patternProperties;
|
|
38891
38891
|
const patternKeys = Object.keys(patternProps);
|
|
38892
38892
|
const looseRecords = [];
|
|
38893
38893
|
for (const pattern of patternKeys) {
|
|
@@ -38914,18 +38914,18 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
38914
38914
|
break;
|
|
38915
38915
|
}
|
|
38916
38916
|
const objectSchema = z.object(shape);
|
|
38917
|
-
if (
|
|
38917
|
+
if (schema3.additionalProperties === false) {
|
|
38918
38918
|
zodSchema = objectSchema.strict();
|
|
38919
|
-
} else if (typeof
|
|
38920
|
-
zodSchema = objectSchema.catchall(convertSchema(
|
|
38919
|
+
} else if (typeof schema3.additionalProperties === "object") {
|
|
38920
|
+
zodSchema = objectSchema.catchall(convertSchema(schema3.additionalProperties, ctx));
|
|
38921
38921
|
} else {
|
|
38922
38922
|
zodSchema = objectSchema.passthrough();
|
|
38923
38923
|
}
|
|
38924
38924
|
break;
|
|
38925
38925
|
}
|
|
38926
38926
|
case "array": {
|
|
38927
|
-
const prefixItems =
|
|
38928
|
-
const items =
|
|
38927
|
+
const prefixItems = schema3.prefixItems;
|
|
38928
|
+
const items = schema3.items;
|
|
38929
38929
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
38930
38930
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
38931
38931
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
@@ -38934,34 +38934,34 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
38934
38934
|
} else {
|
|
38935
38935
|
zodSchema = z.tuple(tupleItems);
|
|
38936
38936
|
}
|
|
38937
|
-
if (typeof
|
|
38938
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
38937
|
+
if (typeof schema3.minItems === "number") {
|
|
38938
|
+
zodSchema = zodSchema.check(z.minLength(schema3.minItems));
|
|
38939
38939
|
}
|
|
38940
|
-
if (typeof
|
|
38941
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
38940
|
+
if (typeof schema3.maxItems === "number") {
|
|
38941
|
+
zodSchema = zodSchema.check(z.maxLength(schema3.maxItems));
|
|
38942
38942
|
}
|
|
38943
38943
|
} else if (Array.isArray(items)) {
|
|
38944
38944
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
38945
|
-
const rest =
|
|
38945
|
+
const rest = schema3.additionalItems && typeof schema3.additionalItems === "object" ? convertSchema(schema3.additionalItems, ctx) : void 0;
|
|
38946
38946
|
if (rest) {
|
|
38947
38947
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
38948
38948
|
} else {
|
|
38949
38949
|
zodSchema = z.tuple(tupleItems);
|
|
38950
38950
|
}
|
|
38951
|
-
if (typeof
|
|
38952
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
38951
|
+
if (typeof schema3.minItems === "number") {
|
|
38952
|
+
zodSchema = zodSchema.check(z.minLength(schema3.minItems));
|
|
38953
38953
|
}
|
|
38954
|
-
if (typeof
|
|
38955
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
38954
|
+
if (typeof schema3.maxItems === "number") {
|
|
38955
|
+
zodSchema = zodSchema.check(z.maxLength(schema3.maxItems));
|
|
38956
38956
|
}
|
|
38957
38957
|
} else if (items !== void 0) {
|
|
38958
38958
|
const element = convertSchema(items, ctx);
|
|
38959
38959
|
let arraySchema = z.array(element);
|
|
38960
|
-
if (typeof
|
|
38961
|
-
arraySchema = arraySchema.min(
|
|
38960
|
+
if (typeof schema3.minItems === "number") {
|
|
38961
|
+
arraySchema = arraySchema.min(schema3.minItems);
|
|
38962
38962
|
}
|
|
38963
|
-
if (typeof
|
|
38964
|
-
arraySchema = arraySchema.max(
|
|
38963
|
+
if (typeof schema3.maxItems === "number") {
|
|
38964
|
+
arraySchema = arraySchema.max(schema3.maxItems);
|
|
38965
38965
|
}
|
|
38966
38966
|
zodSchema = arraySchema;
|
|
38967
38967
|
} else {
|
|
@@ -38974,76 +38974,76 @@ function convertBaseSchema(schema2, ctx) {
|
|
|
38974
38974
|
}
|
|
38975
38975
|
return zodSchema;
|
|
38976
38976
|
}
|
|
38977
|
-
function convertSchema(
|
|
38978
|
-
if (typeof
|
|
38979
|
-
return
|
|
38977
|
+
function convertSchema(schema3, ctx) {
|
|
38978
|
+
if (typeof schema3 === "boolean") {
|
|
38979
|
+
return schema3 ? z.any() : z.never();
|
|
38980
38980
|
}
|
|
38981
|
-
let baseSchema = convertBaseSchema(
|
|
38982
|
-
const hasExplicitType =
|
|
38983
|
-
if (
|
|
38984
|
-
const options =
|
|
38981
|
+
let baseSchema = convertBaseSchema(schema3, ctx);
|
|
38982
|
+
const hasExplicitType = schema3.type || schema3.enum !== void 0 || schema3.const !== void 0;
|
|
38983
|
+
if (schema3.anyOf && Array.isArray(schema3.anyOf)) {
|
|
38984
|
+
const options = schema3.anyOf.map((s) => convertSchema(s, ctx));
|
|
38985
38985
|
const anyOfUnion = z.union(options);
|
|
38986
38986
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
38987
38987
|
}
|
|
38988
|
-
if (
|
|
38989
|
-
const options =
|
|
38988
|
+
if (schema3.oneOf && Array.isArray(schema3.oneOf)) {
|
|
38989
|
+
const options = schema3.oneOf.map((s) => convertSchema(s, ctx));
|
|
38990
38990
|
const oneOfUnion = z.xor(options);
|
|
38991
38991
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
38992
38992
|
}
|
|
38993
|
-
if (
|
|
38994
|
-
if (
|
|
38993
|
+
if (schema3.allOf && Array.isArray(schema3.allOf)) {
|
|
38994
|
+
if (schema3.allOf.length === 0) {
|
|
38995
38995
|
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
38996
38996
|
} else {
|
|
38997
|
-
let result = hasExplicitType ? baseSchema : convertSchema(
|
|
38997
|
+
let result = hasExplicitType ? baseSchema : convertSchema(schema3.allOf[0], ctx);
|
|
38998
38998
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
38999
|
-
for (let i = startIdx; i <
|
|
39000
|
-
result = z.intersection(result, convertSchema(
|
|
38999
|
+
for (let i = startIdx; i < schema3.allOf.length; i++) {
|
|
39000
|
+
result = z.intersection(result, convertSchema(schema3.allOf[i], ctx));
|
|
39001
39001
|
}
|
|
39002
39002
|
baseSchema = result;
|
|
39003
39003
|
}
|
|
39004
39004
|
}
|
|
39005
|
-
if (
|
|
39005
|
+
if (schema3.nullable === true && ctx.version === "openapi-3.0") {
|
|
39006
39006
|
baseSchema = z.nullable(baseSchema);
|
|
39007
39007
|
}
|
|
39008
|
-
if (
|
|
39008
|
+
if (schema3.readOnly === true) {
|
|
39009
39009
|
baseSchema = z.readonly(baseSchema);
|
|
39010
39010
|
}
|
|
39011
|
-
if (
|
|
39012
|
-
baseSchema = baseSchema.default(
|
|
39011
|
+
if (schema3.default !== void 0) {
|
|
39012
|
+
baseSchema = baseSchema.default(schema3.default);
|
|
39013
39013
|
}
|
|
39014
39014
|
const extraMeta = {};
|
|
39015
39015
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
39016
39016
|
for (const key of coreMetadataKeys) {
|
|
39017
|
-
if (key in
|
|
39018
|
-
extraMeta[key] =
|
|
39017
|
+
if (key in schema3) {
|
|
39018
|
+
extraMeta[key] = schema3[key];
|
|
39019
39019
|
}
|
|
39020
39020
|
}
|
|
39021
39021
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
39022
39022
|
for (const key of contentMetadataKeys) {
|
|
39023
|
-
if (key in
|
|
39024
|
-
extraMeta[key] =
|
|
39023
|
+
if (key in schema3) {
|
|
39024
|
+
extraMeta[key] = schema3[key];
|
|
39025
39025
|
}
|
|
39026
39026
|
}
|
|
39027
|
-
for (const key of Object.keys(
|
|
39027
|
+
for (const key of Object.keys(schema3)) {
|
|
39028
39028
|
if (!RECOGNIZED_KEYS.has(key)) {
|
|
39029
|
-
extraMeta[key] =
|
|
39029
|
+
extraMeta[key] = schema3[key];
|
|
39030
39030
|
}
|
|
39031
39031
|
}
|
|
39032
39032
|
if (Object.keys(extraMeta).length > 0) {
|
|
39033
39033
|
ctx.registry.add(baseSchema, extraMeta);
|
|
39034
39034
|
}
|
|
39035
|
-
if (
|
|
39036
|
-
baseSchema = baseSchema.describe(
|
|
39035
|
+
if (schema3.description) {
|
|
39036
|
+
baseSchema = baseSchema.describe(schema3.description);
|
|
39037
39037
|
}
|
|
39038
39038
|
return baseSchema;
|
|
39039
39039
|
}
|
|
39040
|
-
function fromJSONSchema(
|
|
39041
|
-
if (typeof
|
|
39042
|
-
return
|
|
39040
|
+
function fromJSONSchema(schema3, params) {
|
|
39041
|
+
if (typeof schema3 === "boolean") {
|
|
39042
|
+
return schema3 ? z.any() : z.never();
|
|
39043
39043
|
}
|
|
39044
39044
|
let normalized;
|
|
39045
39045
|
try {
|
|
39046
|
-
normalized = JSON.parse(JSON.stringify(
|
|
39046
|
+
normalized = JSON.parse(JSON.stringify(schema3));
|
|
39047
39047
|
} catch {
|
|
39048
39048
|
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
39049
39049
|
}
|
|
@@ -39475,7 +39475,9 @@ var ALWAYS_AVAILABLE_TO_SCHEDULES = [
|
|
|
39475
39475
|
"notify",
|
|
39476
39476
|
"read_tool_result",
|
|
39477
39477
|
"search_docs",
|
|
39478
|
-
"call_tool"
|
|
39478
|
+
"call_tool",
|
|
39479
|
+
// Reaches nothing; lets a run check, wait and check again — much of what a schedule is for.
|
|
39480
|
+
"wait"
|
|
39479
39481
|
];
|
|
39480
39482
|
function skillsForSchedule(skills, allowed) {
|
|
39481
39483
|
if (allowed === void 0)
|
|
@@ -40328,6 +40330,13 @@ var autosysAuthSchema = external_exports.object({
|
|
|
40328
40330
|
tokenHeaderPrefix: external_exports.string(),
|
|
40329
40331
|
/** Sent with every API call, e.g. an API key the gateway also wants. Plain values only. */
|
|
40330
40332
|
extraHeaders: external_exports.record(external_exports.string(), external_exports.string()),
|
|
40333
|
+
/**
|
|
40334
|
+
* Also send the AutoSys username and password as HTTP Basic, for a gateway that checks its own
|
|
40335
|
+
* token and passes AutoSys's sign-in through. In `basicHeaderName` (default `Authorization`),
|
|
40336
|
+
* which must differ from the token's header — one header cannot carry both.
|
|
40337
|
+
*/
|
|
40338
|
+
sendBasic: external_exports.boolean(),
|
|
40339
|
+
basicHeaderName: external_exports.string().min(1),
|
|
40331
40340
|
/** Client certificate for the gateway. Absent uses Settings → Network's, as every connection does. */
|
|
40332
40341
|
certFile: external_exports.string().min(1),
|
|
40333
40342
|
keyFile: external_exports.string().min(1),
|
|
@@ -42626,13 +42635,13 @@ var GEMINI_UNSUPPORTED = /* @__PURE__ */ new Set([
|
|
|
42626
42635
|
function isRecord(value) {
|
|
42627
42636
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
42628
42637
|
}
|
|
42629
|
-
function pruneSchema(
|
|
42630
|
-
if (Array.isArray(
|
|
42631
|
-
return
|
|
42632
|
-
if (!isRecord(
|
|
42633
|
-
return
|
|
42638
|
+
function pruneSchema(schema3, keep) {
|
|
42639
|
+
if (Array.isArray(schema3))
|
|
42640
|
+
return schema3.map((entry) => pruneSchema(entry, keep));
|
|
42641
|
+
if (!isRecord(schema3))
|
|
42642
|
+
return schema3;
|
|
42634
42643
|
const result = {};
|
|
42635
|
-
for (const [key, value] of Object.entries(
|
|
42644
|
+
for (const [key, value] of Object.entries(schema3)) {
|
|
42636
42645
|
if (!keep(key))
|
|
42637
42646
|
continue;
|
|
42638
42647
|
if (key === "properties" && isRecord(value)) {
|
|
@@ -47800,9 +47809,9 @@ function createSearchCodebaseTool(options) {
|
|
|
47800
47809
|
const startedAt = Date.now();
|
|
47801
47810
|
try {
|
|
47802
47811
|
const size = params.size ?? DEFAULT_SIZE;
|
|
47803
|
-
const
|
|
47804
|
-
const wantsTeam =
|
|
47805
|
-
const alias = aliasForScope(
|
|
47812
|
+
const requested2 = params.scope?.trim() ?? "mine";
|
|
47813
|
+
const wantsTeam = requested2.length > 0 && requested2.toLowerCase() !== "mine";
|
|
47814
|
+
const alias = aliasForScope(requested2, options.teamAliases ?? []);
|
|
47806
47815
|
const teamUnavailable = wantsTeam && alias === void 0;
|
|
47807
47816
|
const searchingTeam = wantsTeam && alias !== void 0;
|
|
47808
47817
|
const collection = searchingTeam ? alias : options.index;
|
|
@@ -47856,7 +47865,7 @@ ${hit.text}`;
|
|
|
47856
47865
|
* scope that was misspelled, and naming the ones that exist turns a dead end
|
|
47857
47866
|
* into a retry the model can get right.
|
|
47858
47867
|
*/
|
|
47859
|
-
(options.teamAliases ?? []).length === 0 ? "A shared scope was asked for but none is configured, so only this workspace was searched. Do not conclude from this that no colleague has solved it \u2014 their work was not looked at." : `There is no shared scope called "${
|
|
47868
|
+
(options.teamAliases ?? []).length === 0 ? "A shared scope was asked for but none is configured, so only this workspace was searched. Do not conclude from this that no colleague has solved it \u2014 their work was not looked at." : `There is no shared scope called "${requested2}". The ones configured here are: ${(options.teamAliases ?? []).join(", ")}. Only this workspace was searched, so do not conclude that no colleague has solved it.`
|
|
47860
47869
|
] : [],
|
|
47861
47870
|
...anyRemote ? ["", ...REMOTE_GUIDANCE] : [],
|
|
47862
47871
|
"",
|
|
@@ -47882,10 +47891,10 @@ ${hit.text}`;
|
|
|
47882
47891
|
|
|
47883
47892
|
// ../../packages/core/dist/sharing/scope.js
|
|
47884
47893
|
var EVERY_PROJECT = /* @__PURE__ */ new Set(["all", "*", "any", "every"]);
|
|
47885
|
-
function resolveSearchScope(
|
|
47886
|
-
const author =
|
|
47894
|
+
function resolveSearchScope(requested2, currentProject, fallback) {
|
|
47895
|
+
const author = requested2.author?.trim();
|
|
47887
47896
|
const withAuthor = author !== void 0 && author.length > 0 ? { author } : {};
|
|
47888
|
-
const project =
|
|
47897
|
+
const project = requested2.project?.trim();
|
|
47889
47898
|
const saidNothing = (project === void 0 || project.length === 0) && author === void 0;
|
|
47890
47899
|
if (saidNothing && fallback !== void 0) {
|
|
47891
47900
|
if (fallback.mode === "all")
|
|
@@ -48306,8 +48315,8 @@ function tidy(text) {
|
|
|
48306
48315
|
// ../../packages/core/dist/tools/paths.js
|
|
48307
48316
|
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
48308
48317
|
async function resolveToolPath(context, requestedPath, options = {}) {
|
|
48309
|
-
const
|
|
48310
|
-
const absolute = import_node_path10.default.resolve(context.workspaceRoot,
|
|
48318
|
+
const requested2 = normalizeWindowsPath(requestedPath);
|
|
48319
|
+
const absolute = import_node_path10.default.resolve(context.workspaceRoot, requested2);
|
|
48311
48320
|
const roots = options.write === true ? [context.workspaceRoot] : [context.workspaceRoot, ...context.readRoots ?? []];
|
|
48312
48321
|
let realPath;
|
|
48313
48322
|
try {
|
|
@@ -50454,17 +50463,17 @@ var WHY_SCHEMA = {
|
|
|
50454
50463
|
type: "string",
|
|
50455
50464
|
description: "One short sentence, for the person watching: why you are making this call and what you expect to learn or change. Not a restatement of the tool name."
|
|
50456
50465
|
};
|
|
50457
|
-
function withWhy(
|
|
50458
|
-
if (typeof
|
|
50459
|
-
return
|
|
50460
|
-
const record2 =
|
|
50466
|
+
function withWhy(schema3) {
|
|
50467
|
+
if (typeof schema3 !== "object" || schema3 === null || Array.isArray(schema3))
|
|
50468
|
+
return schema3;
|
|
50469
|
+
const record2 = schema3;
|
|
50461
50470
|
if (record2.type !== "object")
|
|
50462
|
-
return
|
|
50471
|
+
return schema3;
|
|
50463
50472
|
const properties = record2.properties;
|
|
50464
50473
|
if (properties !== void 0 && (typeof properties !== "object" || properties === null))
|
|
50465
|
-
return
|
|
50474
|
+
return schema3;
|
|
50466
50475
|
if (properties !== void 0 && WHY_PARAMETER in properties)
|
|
50467
|
-
return
|
|
50476
|
+
return schema3;
|
|
50468
50477
|
return {
|
|
50469
50478
|
...record2,
|
|
50470
50479
|
properties: { ...properties ?? {}, [WHY_PARAMETER]: WHY_SCHEMA }
|
|
@@ -52230,27 +52239,27 @@ function createPlanProgressTool(access) {
|
|
|
52230
52239
|
|
|
52231
52240
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1_ed45788dfbfe808cc09dd7daea6bd385/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
52232
52241
|
function isZ4Schema(s) {
|
|
52233
|
-
const
|
|
52234
|
-
return !!
|
|
52242
|
+
const schema3 = s;
|
|
52243
|
+
return !!schema3._zod;
|
|
52235
52244
|
}
|
|
52236
|
-
function safeParse3(
|
|
52237
|
-
if (isZ4Schema(
|
|
52238
|
-
const result2 = safeParse(
|
|
52245
|
+
function safeParse3(schema3, data) {
|
|
52246
|
+
if (isZ4Schema(schema3)) {
|
|
52247
|
+
const result2 = safeParse(schema3, data);
|
|
52239
52248
|
return result2;
|
|
52240
52249
|
}
|
|
52241
|
-
const v3Schema =
|
|
52250
|
+
const v3Schema = schema3;
|
|
52242
52251
|
const result = v3Schema.safeParse(data);
|
|
52243
52252
|
return result;
|
|
52244
52253
|
}
|
|
52245
|
-
function getObjectShape(
|
|
52246
|
-
if (!
|
|
52254
|
+
function getObjectShape(schema3) {
|
|
52255
|
+
if (!schema3)
|
|
52247
52256
|
return void 0;
|
|
52248
52257
|
let rawShape;
|
|
52249
|
-
if (isZ4Schema(
|
|
52250
|
-
const v4Schema =
|
|
52258
|
+
if (isZ4Schema(schema3)) {
|
|
52259
|
+
const v4Schema = schema3;
|
|
52251
52260
|
rawShape = v4Schema._zod?.def?.shape;
|
|
52252
52261
|
} else {
|
|
52253
|
-
const v3Schema =
|
|
52262
|
+
const v3Schema = schema3;
|
|
52254
52263
|
rawShape = v3Schema.shape;
|
|
52255
52264
|
}
|
|
52256
52265
|
if (!rawShape)
|
|
@@ -52264,9 +52273,9 @@ function getObjectShape(schema2) {
|
|
|
52264
52273
|
}
|
|
52265
52274
|
return rawShape;
|
|
52266
52275
|
}
|
|
52267
|
-
function getLiteralValue(
|
|
52268
|
-
if (isZ4Schema(
|
|
52269
|
-
const v4Schema =
|
|
52276
|
+
function getLiteralValue(schema3) {
|
|
52277
|
+
if (isZ4Schema(schema3)) {
|
|
52278
|
+
const v4Schema = schema3;
|
|
52270
52279
|
const def2 = v4Schema._zod?.def;
|
|
52271
52280
|
if (def2) {
|
|
52272
52281
|
if (def2.value !== void 0)
|
|
@@ -52276,7 +52285,7 @@ function getLiteralValue(schema2) {
|
|
|
52276
52285
|
}
|
|
52277
52286
|
}
|
|
52278
52287
|
}
|
|
52279
|
-
const v3Schema =
|
|
52288
|
+
const v3Schema = schema3;
|
|
52280
52289
|
const def = v3Schema._def;
|
|
52281
52290
|
if (def) {
|
|
52282
52291
|
if (def.value !== void 0)
|
|
@@ -52285,7 +52294,7 @@ function getLiteralValue(schema2) {
|
|
|
52285
52294
|
return def.values[0];
|
|
52286
52295
|
}
|
|
52287
52296
|
}
|
|
52288
|
-
const directValue =
|
|
52297
|
+
const directValue = schema3.value;
|
|
52289
52298
|
if (directValue !== void 0)
|
|
52290
52299
|
return directValue;
|
|
52291
52300
|
return void 0;
|
|
@@ -53820,8 +53829,8 @@ function isTerminal(status2) {
|
|
|
53820
53829
|
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
53821
53830
|
|
|
53822
53831
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1_ed45788dfbfe808cc09dd7daea6bd385/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
53823
|
-
function getMethodLiteral(
|
|
53824
|
-
const shape = getObjectShape(
|
|
53832
|
+
function getMethodLiteral(schema3) {
|
|
53833
|
+
const shape = getObjectShape(schema3);
|
|
53825
53834
|
const methodSchema = shape?.method;
|
|
53826
53835
|
if (!methodSchema) {
|
|
53827
53836
|
throw new Error("Schema is missing a method literal");
|
|
@@ -53832,8 +53841,8 @@ function getMethodLiteral(schema2) {
|
|
|
53832
53841
|
}
|
|
53833
53842
|
return value;
|
|
53834
53843
|
}
|
|
53835
|
-
function parseWithCompat(
|
|
53836
|
-
const result = safeParse3(
|
|
53844
|
+
function parseWithCompat(schema3, data) {
|
|
53845
|
+
const result = safeParse3(schema3, data);
|
|
53837
53846
|
if (!result.success) {
|
|
53838
53847
|
throw result.error;
|
|
53839
53848
|
}
|
|
@@ -54841,8 +54850,8 @@ var AjvJsonSchemaValidator = class {
|
|
|
54841
54850
|
* @param schema - Standard JSON Schema object
|
|
54842
54851
|
* @returns A validator function that validates input data
|
|
54843
54852
|
*/
|
|
54844
|
-
getValidator(
|
|
54845
|
-
const ajvValidator = "$id" in
|
|
54853
|
+
getValidator(schema3) {
|
|
54854
|
+
const ajvValidator = "$id" in schema3 && typeof schema3.$id === "string" ? this._ajv.getSchema(schema3.$id) ?? this._ajv.compile(schema3) : this._ajv.compile(schema3);
|
|
54846
54855
|
return (input) => {
|
|
54847
54856
|
const valid = ajvValidator(input);
|
|
54848
54857
|
if (valid) {
|
|
@@ -55052,12 +55061,12 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
55052
55061
|
}
|
|
55053
55062
|
|
|
55054
55063
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1_ed45788dfbfe808cc09dd7daea6bd385/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
|
|
55055
|
-
function applyElicitationDefaults(
|
|
55056
|
-
if (!
|
|
55064
|
+
function applyElicitationDefaults(schema3, data) {
|
|
55065
|
+
if (!schema3 || data === null || typeof data !== "object")
|
|
55057
55066
|
return;
|
|
55058
|
-
if (
|
|
55067
|
+
if (schema3.type === "object" && schema3.properties && typeof schema3.properties === "object") {
|
|
55059
55068
|
const obj = data;
|
|
55060
|
-
const props =
|
|
55069
|
+
const props = schema3.properties;
|
|
55061
55070
|
for (const key of Object.keys(props)) {
|
|
55062
55071
|
const propSchema = props[key];
|
|
55063
55072
|
if (obj[key] === void 0 && Object.prototype.hasOwnProperty.call(propSchema, "default")) {
|
|
@@ -55068,15 +55077,15 @@ function applyElicitationDefaults(schema2, data) {
|
|
|
55068
55077
|
}
|
|
55069
55078
|
}
|
|
55070
55079
|
}
|
|
55071
|
-
if (Array.isArray(
|
|
55072
|
-
for (const sub of
|
|
55080
|
+
if (Array.isArray(schema3.anyOf)) {
|
|
55081
|
+
for (const sub of schema3.anyOf) {
|
|
55073
55082
|
if (typeof sub !== "boolean") {
|
|
55074
55083
|
applyElicitationDefaults(sub, data);
|
|
55075
55084
|
}
|
|
55076
55085
|
}
|
|
55077
55086
|
}
|
|
55078
|
-
if (Array.isArray(
|
|
55079
|
-
for (const sub of
|
|
55087
|
+
if (Array.isArray(schema3.oneOf)) {
|
|
55088
|
+
for (const sub of schema3.oneOf) {
|
|
55080
55089
|
if (typeof sub !== "boolean") {
|
|
55081
55090
|
applyElicitationDefaults(sub, data);
|
|
55082
55091
|
}
|
|
@@ -56469,15 +56478,15 @@ function resourceUrlFromServerUrl(url2) {
|
|
|
56469
56478
|
return resourceURL;
|
|
56470
56479
|
}
|
|
56471
56480
|
function checkResourceAllowed({ requestedResource, configuredResource }) {
|
|
56472
|
-
const
|
|
56481
|
+
const requested2 = typeof requestedResource === "string" ? new URL(requestedResource) : new URL(requestedResource.href);
|
|
56473
56482
|
const configured = typeof configuredResource === "string" ? new URL(configuredResource) : new URL(configuredResource.href);
|
|
56474
|
-
if (
|
|
56483
|
+
if (requested2.origin !== configured.origin) {
|
|
56475
56484
|
return false;
|
|
56476
56485
|
}
|
|
56477
|
-
if (
|
|
56486
|
+
if (requested2.pathname.length < configured.pathname.length) {
|
|
56478
56487
|
return false;
|
|
56479
56488
|
}
|
|
56480
|
-
const requestedPath =
|
|
56489
|
+
const requestedPath = requested2.pathname.endsWith("/") ? requested2.pathname : requested2.pathname + "/";
|
|
56481
56490
|
const configuredPath = configured.pathname.endsWith("/") ? configured.pathname : configured.pathname + "/";
|
|
56482
56491
|
return requestedPath.startsWith(configuredPath);
|
|
56483
56492
|
}
|
|
@@ -61704,6 +61713,13 @@ async function runAgentTurn(provider, conversation, userMessage, toolRegistry, t
|
|
|
61704
61713
|
var import_node_crypto9 = require("node:crypto");
|
|
61705
61714
|
|
|
61706
61715
|
// ../../packages/core/dist/atlassian/autosysGateway.js
|
|
61716
|
+
function withBasicCredentials(auth2, headerName, username, password) {
|
|
61717
|
+
const basic = `Basic ${Buffer.from(`${username}:${password}`, "utf8").toString("base64")}`;
|
|
61718
|
+
return {
|
|
61719
|
+
resolveHeaders: async () => ({ ...await auth2.resolveHeaders(), [headerName]: basic }),
|
|
61720
|
+
onUnauthorized: () => auth2.onUnauthorized()
|
|
61721
|
+
};
|
|
61722
|
+
}
|
|
61707
61723
|
var AUTOSYS_CLIENT_SECRET_REF = "autosys:clientSecret";
|
|
61708
61724
|
var AUTOSYS_PASSPHRASE_REF = "autosys:certPassphrase";
|
|
61709
61725
|
function linesFrom(map2, separator) {
|
|
@@ -61723,6 +61739,8 @@ function gatewayView(auth2, hasClientSecret, hasPassphrase) {
|
|
|
61723
61739
|
tokenHeaderPrefix: auth2?.tokenHeaderPrefix ?? "",
|
|
61724
61740
|
extraHeaders: linesFrom(auth2?.extraHeaders, ": "),
|
|
61725
61741
|
extraTokenParams: linesFrom(auth2?.extraTokenParams, "="),
|
|
61742
|
+
sendBasic: auth2?.sendBasic === true,
|
|
61743
|
+
basicHeaderName: auth2?.basicHeaderName ?? "",
|
|
61726
61744
|
certFile: auth2?.certFile ?? "",
|
|
61727
61745
|
keyFile: auth2?.keyFile ?? "",
|
|
61728
61746
|
pfxFile: auth2?.pfxFile ?? "",
|
|
@@ -61764,6 +61782,13 @@ function gatewayFromSettings(input, stored) {
|
|
|
61764
61782
|
const params = parseLines(input.extraTokenParams, "=", "Extra token parameters");
|
|
61765
61783
|
if (typeof params === "string")
|
|
61766
61784
|
return { error: params };
|
|
61785
|
+
const tokenHeader = (text(input.tokenHeaderName) ?? "Authorization").toLowerCase();
|
|
61786
|
+
const basicHeader = (text(input.basicHeaderName) ?? "Authorization").toLowerCase();
|
|
61787
|
+
if (input.sendBasic && tokenHeader === basicHeader) {
|
|
61788
|
+
return {
|
|
61789
|
+
error: `The gateway token and the AutoSys username and password would both go in the ${text(input.basicHeaderName) ?? "Authorization"} header, and one header holds one value. Set the header the gateway reads its token from (Advanced \u2192 "Header the token is sent in", for example x-apigee-token), or the header AutoSys reads the username and password from \u2014 your gateway team knows which.`
|
|
61790
|
+
};
|
|
61791
|
+
}
|
|
61767
61792
|
if (text(input.pfxFile) !== void 0 && text(input.certFile) !== void 0) {
|
|
61768
61793
|
return { error: "Use either a PFX bundle or a certificate and key, not both." };
|
|
61769
61794
|
}
|
|
@@ -61791,6 +61816,8 @@ function gatewayFromSettings(input, stored) {
|
|
|
61791
61816
|
...input.tokenHeaderPrefix.trim().length > 0 ? { tokenHeaderPrefix: /[A-Za-z0-9]$/.test(input.tokenHeaderPrefix) ? `${input.tokenHeaderPrefix} ` : input.tokenHeaderPrefix } : {},
|
|
61792
61817
|
...Object.keys(headers).length > 0 ? { extraHeaders: headers } : {},
|
|
61793
61818
|
...Object.keys(params).length > 0 ? { extraTokenParams: params } : {},
|
|
61819
|
+
...input.sendBasic ? { sendBasic: true } : {},
|
|
61820
|
+
...optional2("basicHeaderName", text(input.basicHeaderName)),
|
|
61794
61821
|
...optional2("certFile", text(input.certFile)),
|
|
61795
61822
|
...optional2("keyFile", text(input.keyFile)),
|
|
61796
61823
|
...optional2("pfxFile", text(input.pfxFile)),
|
|
@@ -66596,12 +66623,12 @@ function createJenkinsFindJobsTool(options) {
|
|
|
66596
66623
|
};
|
|
66597
66624
|
}
|
|
66598
66625
|
function createJenkinsJobTool(options) {
|
|
66599
|
-
const
|
|
66626
|
+
const schema3 = external_exports.object({ job: jobParam(options) });
|
|
66600
66627
|
const tool = {
|
|
66601
66628
|
name: "jenkins_job",
|
|
66602
66629
|
group: "read",
|
|
66603
66630
|
description: "Read a Jenkins job: health, whether it is building or queued, its last ten builds with results and durations, the last good and last failed build, and the parameters it takes with their defaults and choices.",
|
|
66604
|
-
parametersSchema:
|
|
66631
|
+
parametersSchema: schema3,
|
|
66605
66632
|
async execute(params) {
|
|
66606
66633
|
try {
|
|
66607
66634
|
const client = await options.client();
|
|
@@ -66634,12 +66661,12 @@ function createJenkinsJobTool(options) {
|
|
|
66634
66661
|
return tool;
|
|
66635
66662
|
}
|
|
66636
66663
|
function createJenkinsBuildTool(options) {
|
|
66637
|
-
const
|
|
66664
|
+
const schema3 = external_exports.object({ job: jobParam(options), build: buildParam });
|
|
66638
66665
|
const tool = {
|
|
66639
66666
|
name: "jenkins_build",
|
|
66640
66667
|
group: "read",
|
|
66641
66668
|
description: "Read one Jenkins build: result, what started it, its parameters, the commits in it, pipeline stages with their status, failed tests with their errors, and artifacts. Start here to find out why a build failed, then read the failing stage\u2019s log with jenkins_build_log.",
|
|
66642
|
-
parametersSchema:
|
|
66669
|
+
parametersSchema: schema3,
|
|
66643
66670
|
async execute(params) {
|
|
66644
66671
|
try {
|
|
66645
66672
|
const client = await options.client();
|
|
@@ -66677,7 +66704,7 @@ function createJenkinsBuildTool(options) {
|
|
|
66677
66704
|
return tool;
|
|
66678
66705
|
}
|
|
66679
66706
|
function createJenkinsBuildLogTool(options) {
|
|
66680
|
-
const
|
|
66707
|
+
const schema3 = external_exports.object({
|
|
66681
66708
|
job: jobParam(options),
|
|
66682
66709
|
build: buildParam,
|
|
66683
66710
|
stage: external_exports.string().optional().describe("A pipeline stage name: returns the log of that stage\u2019s failed steps (or all its steps if none failed)."),
|
|
@@ -66688,7 +66715,7 @@ function createJenkinsBuildLogTool(options) {
|
|
|
66688
66715
|
name: "jenkins_build_log",
|
|
66689
66716
|
group: "read",
|
|
66690
66717
|
description: "Read a Jenkins build\u2019s console log without loading all of it: the end of it, only lines matching a pattern, or one pipeline stage\u2019s steps. Use jenkins_build first to see which stage failed.",
|
|
66691
|
-
parametersSchema:
|
|
66718
|
+
parametersSchema: schema3,
|
|
66692
66719
|
async execute(params) {
|
|
66693
66720
|
try {
|
|
66694
66721
|
const client = await options.client();
|
|
@@ -66759,7 +66786,7 @@ function createJenkinsQueueTool(options) {
|
|
|
66759
66786
|
};
|
|
66760
66787
|
}
|
|
66761
66788
|
function createJenkinsStartBuildTool(options) {
|
|
66762
|
-
const
|
|
66789
|
+
const schema3 = external_exports.object({
|
|
66763
66790
|
job: jobParam(options),
|
|
66764
66791
|
parameters: external_exports.record(external_exports.string(), external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])).optional().describe("Build parameters by name. Unset ones take the job\u2019s defaults. See jenkins_job for what it takes.")
|
|
66765
66792
|
});
|
|
@@ -66768,7 +66795,7 @@ function createJenkinsStartBuildTool(options) {
|
|
|
66768
66795
|
name: "jenkins_start_build",
|
|
66769
66796
|
group: "command",
|
|
66770
66797
|
description: "Start a Jenkins build now, with parameters if the job takes them. It runs on shared CI under the user\u2019s name, so it is always shown to the user first. Returns the build number when Jenkins starts it within a few seconds.",
|
|
66771
|
-
parametersSchema:
|
|
66798
|
+
parametersSchema: schema3,
|
|
66772
66799
|
async preview(params) {
|
|
66773
66800
|
const client = await options.client();
|
|
66774
66801
|
const job = jobOf(options, params.job);
|
|
@@ -66806,12 +66833,12 @@ Link: ${client.base}${jobPath(job, client.base)}/${String(started.number)}/` };
|
|
|
66806
66833
|
return tool;
|
|
66807
66834
|
}
|
|
66808
66835
|
function createJenkinsStopBuildTool(options) {
|
|
66809
|
-
const
|
|
66836
|
+
const schema3 = external_exports.object({ job: jobParam(options), build: external_exports.union([external_exports.number().int().positive(), external_exports.string()]).describe("The build number to stop.") });
|
|
66810
66837
|
const tool = {
|
|
66811
66838
|
name: "jenkins_stop_build",
|
|
66812
66839
|
group: "command",
|
|
66813
66840
|
description: "Abort a running Jenkins build. Always shown to the user first.",
|
|
66814
|
-
parametersSchema:
|
|
66841
|
+
parametersSchema: schema3,
|
|
66815
66842
|
async preview(params) {
|
|
66816
66843
|
const client = await options.client();
|
|
66817
66844
|
const job = jobOf(options, params.job);
|
|
@@ -66872,7 +66899,7 @@ function createJenkinsCheckJenkinsfileTool(options) {
|
|
|
66872
66899
|
};
|
|
66873
66900
|
}
|
|
66874
66901
|
function createJenkinsTryJenkinsfileTool(options) {
|
|
66875
|
-
const
|
|
66902
|
+
const schema3 = external_exports.object({
|
|
66876
66903
|
job: jobParam(options),
|
|
66877
66904
|
path: external_exports.string().optional().describe("The local Jenkinsfile to run. Default Jenkinsfile."),
|
|
66878
66905
|
build: external_exports.union([external_exports.number().int().positive(), external_exports.string()]).optional().describe("The build to replay \u2014 its parameters and revision are reused. Default last."),
|
|
@@ -66882,7 +66909,7 @@ function createJenkinsTryJenkinsfileTool(options) {
|
|
|
66882
66909
|
name: "jenkins_try_jenkinsfile",
|
|
66883
66910
|
group: "command",
|
|
66884
66911
|
description: "Find out whether a locally edited Jenkinsfile actually runs on Jenkins, without committing it: Jenkins Replay re-runs a recent build of a pipeline job with the local file as its script, on the job\u2019s own agents, parameters and credentials, and this waits for the result \u2014 success, or the failing stage and the end of its log. Check the file with jenkins_check_jenkinsfile first; this one really runs, so it is always shown to the user first, with the whole file. Needs an existing pipeline job that has run at least once, and the Replay permission.",
|
|
66885
|
-
parametersSchema:
|
|
66912
|
+
parametersSchema: schema3,
|
|
66886
66913
|
async preview(params, context) {
|
|
66887
66914
|
const client = await options.client();
|
|
66888
66915
|
const job = jobOf(options, params.job);
|
|
@@ -67191,29 +67218,138 @@ function createAutosysFindJobsTool(options) {
|
|
|
67191
67218
|
}
|
|
67192
67219
|
};
|
|
67193
67220
|
}
|
|
67194
|
-
var
|
|
67221
|
+
var LOOKUPS_IN_FLIGHT = 4;
|
|
67222
|
+
var MAX_JOBS = 200;
|
|
67223
|
+
var MAX_FULL_DEFINITIONS = 10;
|
|
67224
|
+
async function inBatches(items, work) {
|
|
67225
|
+
const results = new Array(items.length);
|
|
67226
|
+
let next = 0;
|
|
67227
|
+
const lane = async () => {
|
|
67228
|
+
while (next < items.length) {
|
|
67229
|
+
const at = next++;
|
|
67230
|
+
results[at] = await work(items[at]);
|
|
67231
|
+
}
|
|
67232
|
+
};
|
|
67233
|
+
await Promise.all(Array.from({ length: Math.min(LOOKUPS_IN_FLIGHT, items.length) }, () => lane()));
|
|
67234
|
+
return results;
|
|
67235
|
+
}
|
|
67236
|
+
function requested(jobs, pattern, fallback) {
|
|
67237
|
+
const all = [...jobs ?? [], ...pattern !== void 0 ? [pattern] : []].map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
67238
|
+
const unique = [...new Set(all)];
|
|
67239
|
+
return unique.length > 0 ? unique : fallback !== void 0 ? [fallback] : [];
|
|
67240
|
+
}
|
|
67241
|
+
var STATUSES = [
|
|
67242
|
+
"FAILURE",
|
|
67243
|
+
"TERMINATED",
|
|
67244
|
+
"RUNNING",
|
|
67245
|
+
"ON_HOLD",
|
|
67246
|
+
"ON_ICE",
|
|
67247
|
+
"SUCCESS",
|
|
67248
|
+
"INACTIVE",
|
|
67249
|
+
"STARTING",
|
|
67250
|
+
"ACTIVATED",
|
|
67251
|
+
"RESTART",
|
|
67252
|
+
"QUE_WAIT",
|
|
67253
|
+
"ON_NOEXEC"
|
|
67254
|
+
];
|
|
67255
|
+
function statusSummary(runs) {
|
|
67256
|
+
const counts = /* @__PURE__ */ new Map();
|
|
67257
|
+
for (const run3 of runs)
|
|
67258
|
+
counts.set(run3.status, (counts.get(run3.status) ?? 0) + 1);
|
|
67259
|
+
return [...counts.entries()].sort((a, b) => b[1] - a[1]).map(([status2, count2]) => `${String(count2)} ${status2}`).join(" \xB7 ");
|
|
67260
|
+
}
|
|
67261
|
+
function attributeMatches(key, wanted) {
|
|
67262
|
+
const snake = key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`).toLowerCase();
|
|
67263
|
+
const flat = key.toLowerCase().replace(/_/g, "");
|
|
67264
|
+
return wanted.some((name) => name === key.toLowerCase() || name === snake || name.replace(/_/g, "") === flat);
|
|
67265
|
+
}
|
|
67266
|
+
var jobSchema = external_exports.object({
|
|
67267
|
+
job: external_exports.string().min(1).optional().describe("One exact job name."),
|
|
67268
|
+
jobs: external_exports.array(external_exports.string().min(1)).max(MAX_JOBS).optional().describe("Several job names or patterns (* wildcards) at once."),
|
|
67269
|
+
pattern: external_exports.string().min(1).optional().describe("A name pattern, e.g. PAY_* \u2014 every matching job."),
|
|
67270
|
+
fields: external_exports.array(external_exports.string().min(1)).max(30).optional().describe('Only these attributes of each job, e.g. ["command", "machine", "start_times", "condition"]. Best for many jobs.')
|
|
67271
|
+
});
|
|
67195
67272
|
function createAutosysJobTool(options) {
|
|
67196
67273
|
return {
|
|
67197
67274
|
name: "autosys_job",
|
|
67198
67275
|
group: "read",
|
|
67199
|
-
description: "Read
|
|
67276
|
+
description: "Read AutoSys job definitions \u2014 command, machine, owner, conditions, start times, calendars, output files and every other attribute \u2014 with each job\u2019s current status, and the jobs inside a box. Takes one job, a list (`jobs`), or a pattern (`pattern`, * wildcards) for every matching job; with many jobs, name the attributes wanted in `fields`.",
|
|
67200
67277
|
parametersSchema: jobSchema,
|
|
67201
67278
|
async execute(params) {
|
|
67202
67279
|
try {
|
|
67203
67280
|
const client = await options.client();
|
|
67204
|
-
const
|
|
67205
|
-
|
|
67206
|
-
|
|
67207
|
-
const
|
|
67208
|
-
|
|
67209
|
-
|
|
67210
|
-
|
|
67211
|
-
|
|
67212
|
-
|
|
67213
|
-
|
|
67214
|
-
|
|
67215
|
-
|
|
67216
|
-
|
|
67281
|
+
const wanted = requested([...params.job !== void 0 ? [params.job] : [], ...params.jobs ?? []], params.pattern, void 0);
|
|
67282
|
+
if (wanted.length === 0)
|
|
67283
|
+
return { content: "Name a job, a list of jobs, or a pattern.", isError: true };
|
|
67284
|
+
const definitions = /* @__PURE__ */ new Map();
|
|
67285
|
+
const problems = [];
|
|
67286
|
+
const found = await inBatches(wanted, async (entry) => {
|
|
67287
|
+
try {
|
|
67288
|
+
if (entry.includes("*")) {
|
|
67289
|
+
const matches = await client.findJobs(entry);
|
|
67290
|
+
if (matches.length === 0)
|
|
67291
|
+
problems.push(`No jobs match ${entry}.`);
|
|
67292
|
+
return matches.map((job) => [field(job, "name", "jobName", "job_name") ?? "?", job]);
|
|
67293
|
+
}
|
|
67294
|
+
return [[entry, await client.job(entry)]];
|
|
67295
|
+
} catch (error51) {
|
|
67296
|
+
problems.push(error51 instanceof Error ? error51.message : String(error51));
|
|
67297
|
+
return [];
|
|
67298
|
+
}
|
|
67299
|
+
});
|
|
67300
|
+
for (const [name, definition] of found.flat())
|
|
67301
|
+
if (!definitions.has(name))
|
|
67302
|
+
definitions.set(name, definition);
|
|
67303
|
+
const names = [...definitions.keys()];
|
|
67304
|
+
if (names.length === 0)
|
|
67305
|
+
return { content: problems.join("\n"), isError: true };
|
|
67306
|
+
const shownNames = names.slice(0, MAX_JOBS);
|
|
67307
|
+
const statuses = /* @__PURE__ */ new Map();
|
|
67308
|
+
await inBatches(shownNames, async (name) => {
|
|
67309
|
+
const runs = await client.runInfo(name).catch(() => []);
|
|
67310
|
+
if (runs[0] !== void 0)
|
|
67311
|
+
statuses.set(name, runs[0]);
|
|
67312
|
+
});
|
|
67313
|
+
const fields = params.fields?.map((name) => name.trim().toLowerCase());
|
|
67314
|
+
const pick3 = (definition) => fields === void 0 ? definition : Object.fromEntries(Object.entries(definition).filter(([key]) => attributeMatches(key, fields)));
|
|
67315
|
+
const full = fields === void 0 && shownNames.length <= MAX_FULL_DEFINITIONS;
|
|
67316
|
+
const sections = [];
|
|
67317
|
+
if (shownNames.length > 1) {
|
|
67318
|
+
sections.push(`${String(names.length)} job(s)${names.length > shownNames.length ? `, showing ${String(shownNames.length)}` : ""}. Status: ${statusSummary([...statuses.values()]) || "not available"}.`);
|
|
67319
|
+
}
|
|
67320
|
+
for (const name of shownNames) {
|
|
67321
|
+
const definition = definitions.get(name) ?? {};
|
|
67322
|
+
const run3 = statuses.get(name);
|
|
67323
|
+
const status2 = run3 !== void 0 ? describeRun(run3) : `${name}: status not available`;
|
|
67324
|
+
if (full || fields !== void 0) {
|
|
67325
|
+
const lines = renderDefinition(pick3(definition)).map((line) => ` ${line}`);
|
|
67326
|
+
sections.push([
|
|
67327
|
+
shownNames.length === 1 ? `Definition of ${name}:` : `${name}:`,
|
|
67328
|
+
...lines.length > 0 ? lines : [" (none of the requested attributes are set)"],
|
|
67329
|
+
` Status: ${run3 !== void 0 ? status2.slice(name.length + 2) : "not available"}`
|
|
67330
|
+
].join("\n"));
|
|
67331
|
+
} else {
|
|
67332
|
+
const type = field(definition, "jobType", "job_type", "type");
|
|
67333
|
+
const box = field(definition, "boxName", "box_name");
|
|
67334
|
+
sections.push(`- ${status2}${type !== void 0 ? ` \xB7 ${type}` : ""}${box !== void 0 ? ` \xB7 in ${box}` : ""}`);
|
|
67335
|
+
}
|
|
67336
|
+
}
|
|
67337
|
+
if (shownNames.length === 1) {
|
|
67338
|
+
const only = shownNames[0];
|
|
67339
|
+
const type = (field(definitions.get(only) ?? {}, "jobType", "job_type", "type") ?? "").toUpperCase();
|
|
67340
|
+
if (type === "BOX" || type === "B") {
|
|
67341
|
+
const members = await client.boxMembers(only).catch(() => []);
|
|
67342
|
+
if (members.length > 0) {
|
|
67343
|
+
sections.push([`Jobs in this box (${String(members.length)}):`, ...members.map((member) => `- ${field(member, "name", "jobName") ?? "?"}`)].join("\n"));
|
|
67344
|
+
}
|
|
67345
|
+
}
|
|
67346
|
+
}
|
|
67347
|
+
if (!full && fields === void 0) {
|
|
67348
|
+
sections.push("One line per job. Ask again with `fields` (e.g. command, machine, start_times, condition) for the attributes needed.");
|
|
67349
|
+
}
|
|
67350
|
+
if (problems.length > 0)
|
|
67351
|
+
sections.push(`Not found: ${problems.join(" ")}`);
|
|
67352
|
+
return { content: sections.join("\n\n") };
|
|
67217
67353
|
} catch (error51) {
|
|
67218
67354
|
return errorResult3(error51);
|
|
67219
67355
|
}
|
|
@@ -67222,23 +67358,63 @@ function createAutosysJobTool(options) {
|
|
|
67222
67358
|
}
|
|
67223
67359
|
var statusSchema = external_exports.object({
|
|
67224
67360
|
pattern: external_exports.string().optional().describe("Job name or pattern (* wildcards). Defaults to the configured pattern."),
|
|
67225
|
-
|
|
67361
|
+
jobs: external_exports.array(external_exports.string().min(1)).max(MAX_JOBS).optional().describe('Several job names or patterns at once, e.g. ["PAY_LOAD", "GL_*"].'),
|
|
67362
|
+
only: external_exports.union([external_exports.enum(STATUSES), external_exports.array(external_exports.enum(STATUSES)).min(1)]).optional().describe('Only jobs in this status (or any of these), e.g. FAILURE, or ["FAILURE", "TERMINATED"].')
|
|
67226
67363
|
});
|
|
67364
|
+
var STATUS_ORDER = ["FAILURE", "TERMINATED", "RUNNING", "STARTING", "RESTART", "ON_HOLD", "ON_ICE"];
|
|
67365
|
+
var statusRank = (status2) => {
|
|
67366
|
+
const at = STATUS_ORDER.indexOf(status2.toUpperCase());
|
|
67367
|
+
return at === -1 ? STATUS_ORDER.length : at;
|
|
67368
|
+
};
|
|
67227
67369
|
function createAutosysStatusTool(options) {
|
|
67228
67370
|
return {
|
|
67229
67371
|
name: "autosys_status",
|
|
67230
67372
|
group: "read",
|
|
67231
|
-
description: "Current status of AutoSys jobs \u2014 like autorep -J: status, last start and end, exit code, run number and machine. Use only: FAILURE to see what failed.",
|
|
67373
|
+
description: "Current status of AutoSys jobs \u2014 like autorep -J: status, last start and end, exit code, run number and machine \u2014 for one job, a pattern, or many at once (`jobs`), with a count by status first. Use only: FAILURE to see what failed. To follow a job until it finishes, check, `wait`, and check again.",
|
|
67232
67374
|
parametersSchema: statusSchema,
|
|
67233
67375
|
async execute(params) {
|
|
67234
67376
|
try {
|
|
67235
|
-
const
|
|
67236
|
-
if (
|
|
67237
|
-
return { content: "Give a job name or pattern \u2014 no default pattern is configured.", isError: true };
|
|
67238
|
-
const
|
|
67239
|
-
|
|
67240
|
-
|
|
67241
|
-
|
|
67377
|
+
const wanted = requested(params.jobs, params.pattern, options.defaultPattern);
|
|
67378
|
+
if (wanted.length === 0)
|
|
67379
|
+
return { content: "Give a job name, a list of jobs or a pattern \u2014 no default pattern is configured.", isError: true };
|
|
67380
|
+
const client = await options.client();
|
|
67381
|
+
const problems = [];
|
|
67382
|
+
const lists = await inBatches(wanted, async (entry) => {
|
|
67383
|
+
try {
|
|
67384
|
+
return await client.runInfo(entry);
|
|
67385
|
+
} catch (error51) {
|
|
67386
|
+
problems.push(`${entry}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
67387
|
+
return [];
|
|
67388
|
+
}
|
|
67389
|
+
});
|
|
67390
|
+
const byName = /* @__PURE__ */ new Map();
|
|
67391
|
+
for (const run3 of lists.flat())
|
|
67392
|
+
if (!byName.has(run3.name))
|
|
67393
|
+
byName.set(run3.name, run3);
|
|
67394
|
+
const only = params.only === void 0 ? void 0 : (Array.isArray(params.only) ? params.only : [params.only]).map((status2) => status2.toUpperCase());
|
|
67395
|
+
const all = [...byName.values()];
|
|
67396
|
+
const runs = all.filter((run3) => only === void 0 || only.includes(run3.status.toUpperCase()));
|
|
67397
|
+
const asked = wanted.join(", ");
|
|
67398
|
+
const unreadable = problems.length > 0 ? ["", "Could not read:", ...problems.map((problem) => `- ${problem}`)] : [];
|
|
67399
|
+
if (runs.length === 0) {
|
|
67400
|
+
return {
|
|
67401
|
+
content: [
|
|
67402
|
+
all.length === 0 ? `No jobs match ${asked}.` : `None of the ${String(all.length)} job(s) matching ${asked} are ${(only ?? []).join(" or ")} (${statusSummary(all)}).`,
|
|
67403
|
+
...unreadable
|
|
67404
|
+
].join("\n"),
|
|
67405
|
+
...problems.length > 0 && all.length === 0 ? { isError: true } : {}
|
|
67406
|
+
};
|
|
67407
|
+
}
|
|
67408
|
+
const sorted = [...runs].sort((a, b) => statusRank(a.status) - statusRank(b.status) || a.name.localeCompare(b.name));
|
|
67409
|
+
const heading = only === void 0 ? `${String(runs.length)} job(s) \u2014 ${statusSummary(runs)}:` : `${String(runs.length)} of the ${String(all.length)} matching job(s) are ${only.join(" or ")} (all: ${statusSummary(all)}):`;
|
|
67410
|
+
return {
|
|
67411
|
+
content: [
|
|
67412
|
+
heading,
|
|
67413
|
+
...sorted.slice(0, MAX_JOBS).map((run3) => `- ${describeRun(run3)}`),
|
|
67414
|
+
...sorted.length > MAX_JOBS ? [`\u2026 and ${String(sorted.length - MAX_JOBS)} more; narrow the pattern or use only.`] : [],
|
|
67415
|
+
...unreadable
|
|
67416
|
+
].join("\n")
|
|
67417
|
+
};
|
|
67242
67418
|
} catch (error51) {
|
|
67243
67419
|
return errorResult3(error51);
|
|
67244
67420
|
}
|
|
@@ -67799,8 +67975,8 @@ var JiraClient = class {
|
|
|
67799
67975
|
}
|
|
67800
67976
|
};
|
|
67801
67977
|
function fieldInfo(id, field2) {
|
|
67802
|
-
const
|
|
67803
|
-
const type =
|
|
67978
|
+
const schema3 = field2.schema ?? {};
|
|
67979
|
+
const type = schema3.type === "array" ? `array of ${schema3.items ?? "?"}` : schema3.type ?? "?";
|
|
67804
67980
|
return {
|
|
67805
67981
|
id,
|
|
67806
67982
|
name: field2.name ?? id,
|
|
@@ -71366,6 +71542,7 @@ ${preview.text}` } : {}
|
|
|
71366
71542
|
function hostCapabilities() {
|
|
71367
71543
|
return {
|
|
71368
71544
|
nativeGuide: ui.openWalkthrough !== void 0,
|
|
71545
|
+
exportsSource: services.sourceArchive !== void 0,
|
|
71369
71546
|
/*
|
|
71370
71547
|
* Whether this host has a theme of its own to follow.
|
|
71371
71548
|
*
|
|
@@ -72055,6 +72232,8 @@ ${preview.text}` } : {}
|
|
|
72055
72232
|
// Also withheld from a scheduled run: nobody is there to fill a form in, and a job
|
|
72056
72233
|
// that stops to wait for one would never finish.
|
|
72057
72234
|
...schedule === void 0 ? { requestForm } : {},
|
|
72235
|
+
// So `wait` ends the moment the user types or reacts, rather than after its full time.
|
|
72236
|
+
hasNewUserInput: () => queuedMessages.length > 0 || pendingReactions.size > 0,
|
|
72058
72237
|
signal: activeAbortController.signal,
|
|
72059
72238
|
/*
|
|
72060
72239
|
* Supplied by the host, not imported by core: the binary is platform-specific and
|
|
@@ -73591,12 +73770,12 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
73591
73770
|
}
|
|
73592
73771
|
}
|
|
73593
73772
|
}
|
|
73594
|
-
async function handleValidateMailFolder(
|
|
73773
|
+
async function handleValidateMailFolder(requested2) {
|
|
73595
73774
|
try {
|
|
73596
|
-
const result = await office().request({ op: "outlook.validateFolder", path:
|
|
73775
|
+
const result = await office().request({ op: "outlook.validateFolder", path: requested2 });
|
|
73597
73776
|
post({
|
|
73598
73777
|
type: "mailFolderValidated",
|
|
73599
|
-
requested,
|
|
73778
|
+
requested: requested2,
|
|
73600
73779
|
ok: result.ok,
|
|
73601
73780
|
...result.canonical !== void 0 ? { canonical: result.canonical } : {},
|
|
73602
73781
|
...result.how !== void 0 ? { how: result.how } : {},
|
|
@@ -73607,7 +73786,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
73607
73786
|
} catch (error51) {
|
|
73608
73787
|
post({
|
|
73609
73788
|
type: "mailFolderValidated",
|
|
73610
|
-
requested,
|
|
73789
|
+
requested: requested2,
|
|
73611
73790
|
ok: false,
|
|
73612
73791
|
error: error51 instanceof Error ? error51.message : String(error51)
|
|
73613
73792
|
});
|
|
@@ -73884,7 +74063,17 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
73884
74063
|
return {
|
|
73885
74064
|
baseUrl: settings.baseUrl,
|
|
73886
74065
|
token: "",
|
|
73887
|
-
auth: await
|
|
74066
|
+
auth: await (async () => {
|
|
74067
|
+
const gatewayAuth = await autosysGatewayAuth(config2, tls3);
|
|
74068
|
+
if (auth2.sendBasic !== true)
|
|
74069
|
+
return gatewayAuth;
|
|
74070
|
+
const username2 = config2.autosys?.username?.trim() ?? "";
|
|
74071
|
+
const password = config2.autosys?.tokenRef !== void 0 ? await secrets.get(config2.autosys.tokenRef) : void 0;
|
|
74072
|
+
if (username2.length === 0 || password === void 0 || password.length === 0) {
|
|
74073
|
+
throw new AtlassianError("AutoSys is set to send its username and password through the gateway, but one of them is not saved. Settings \u2192 DevOps \u2192 AutoSys: enter both and save.");
|
|
74074
|
+
}
|
|
74075
|
+
return withBasicCredentials(gatewayAuth, auth2.basicHeaderName ?? "Authorization", username2, password);
|
|
74076
|
+
})(),
|
|
73888
74077
|
...tls3 !== void 0 ? { tls: tls3 } : {}
|
|
73889
74078
|
};
|
|
73890
74079
|
}
|
|
@@ -73962,16 +74151,19 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
73962
74151
|
}
|
|
73963
74152
|
post({ type: "atlassian", products });
|
|
73964
74153
|
}
|
|
73965
|
-
async function handleSaveAtlassian(product, input, token) {
|
|
74154
|
+
async function handleSaveAtlassian(product, input, token, gateway) {
|
|
74155
|
+
const refuse = (message4) => {
|
|
74156
|
+
post({ type: "atlassianTest", product, ok: false, detail: `Not saved: ${message4}` });
|
|
74157
|
+
};
|
|
73966
74158
|
try {
|
|
73967
74159
|
const info = atlassianProduct(product);
|
|
73968
74160
|
const baseUrl = input.baseUrl.trim().replace(/\/+$/, "");
|
|
73969
74161
|
if (baseUrl.length > 0 && !/^https?:\/\/[^\s]+$/i.test(baseUrl)) {
|
|
73970
|
-
|
|
74162
|
+
refuse(`"${baseUrl}" is not a web address \u2014 it should begin with https followed by the site name.`);
|
|
73971
74163
|
return;
|
|
73972
74164
|
}
|
|
73973
74165
|
if (input.enabled && baseUrl.length === 0) {
|
|
73974
|
-
|
|
74166
|
+
refuse(`Enter the ${info.label} site address before switching it on.`);
|
|
73975
74167
|
return;
|
|
73976
74168
|
}
|
|
73977
74169
|
if (token !== void 0 && token.trim().length > 0) {
|
|
@@ -74003,35 +74195,49 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
74003
74195
|
...input.rejectUnauthorized ? {} : { rejectUnauthorized: false }
|
|
74004
74196
|
}
|
|
74005
74197
|
});
|
|
74198
|
+
if (product === "autosys" && gateway !== void 0) {
|
|
74199
|
+
const problem = await saveAutosysGateway(gateway.settings, gateway.clientSecret, gateway.passphrase);
|
|
74200
|
+
if (problem !== void 0) {
|
|
74201
|
+
await loadSettings();
|
|
74202
|
+
await postAtlassian();
|
|
74203
|
+
refuse(`the API gateway settings \u2014 ${problem} The site settings were saved.`);
|
|
74204
|
+
return;
|
|
74205
|
+
}
|
|
74206
|
+
}
|
|
74006
74207
|
await loadSettings();
|
|
74007
74208
|
await postAtlassian();
|
|
74008
74209
|
post({ type: "atlassianSaved", product });
|
|
74009
74210
|
} catch (error51) {
|
|
74010
|
-
|
|
74211
|
+
refuse(error51 instanceof Error ? error51.message : String(error51));
|
|
74011
74212
|
}
|
|
74012
74213
|
}
|
|
74214
|
+
async function saveAutosysGateway(input, clientSecret, passphrase) {
|
|
74215
|
+
if (clientSecret !== void 0 && clientSecret.trim().length > 0)
|
|
74216
|
+
await secrets.set(AUTOSYS_CLIENT_SECRET_REF, clientSecret.trim());
|
|
74217
|
+
if (passphrase !== void 0 && passphrase.length > 0)
|
|
74218
|
+
await secrets.set(AUTOSYS_PASSPHRASE_REF, passphrase);
|
|
74219
|
+
const result = gatewayFromSettings(input, {
|
|
74220
|
+
clientSecret: (await secrets.get(AUTOSYS_CLIENT_SECRET_REF) ?? "").length > 0,
|
|
74221
|
+
passphrase: (await secrets.get(AUTOSYS_PASSPHRASE_REF) ?? "").length > 0
|
|
74222
|
+
});
|
|
74223
|
+
if ("error" in result)
|
|
74224
|
+
return result.error;
|
|
74225
|
+
const { config: config2 } = await configManager.load();
|
|
74226
|
+
await configManager.save("user", { autosys: { ...config2.autosys ?? {}, auth: result.auth } });
|
|
74227
|
+
autosysGateway = void 0;
|
|
74228
|
+
return void 0;
|
|
74229
|
+
}
|
|
74013
74230
|
async function handleSaveAutosysGateway(input, clientSecret, passphrase) {
|
|
74014
74231
|
try {
|
|
74015
|
-
|
|
74016
|
-
await secrets.set(AUTOSYS_CLIENT_SECRET_REF, clientSecret.trim());
|
|
74017
|
-
if (passphrase !== void 0 && passphrase.length > 0)
|
|
74018
|
-
await secrets.set(AUTOSYS_PASSPHRASE_REF, passphrase);
|
|
74019
|
-
const result = gatewayFromSettings(input, {
|
|
74020
|
-
clientSecret: (await secrets.get(AUTOSYS_CLIENT_SECRET_REF) ?? "").length > 0,
|
|
74021
|
-
passphrase: (await secrets.get(AUTOSYS_PASSPHRASE_REF) ?? "").length > 0
|
|
74022
|
-
});
|
|
74023
|
-
if ("error" in result) {
|
|
74024
|
-
post({ type: "error", message: `AutoSys gateway: ${result.error}` });
|
|
74025
|
-
return;
|
|
74026
|
-
}
|
|
74027
|
-
const { config: config2 } = await configManager.load();
|
|
74028
|
-
await configManager.save("user", { autosys: { ...config2.autosys ?? {}, auth: result.auth } });
|
|
74029
|
-
autosysGateway = void 0;
|
|
74232
|
+
const problem = await saveAutosysGateway(input, clientSecret, passphrase);
|
|
74030
74233
|
await loadSettings();
|
|
74031
74234
|
await postAtlassian();
|
|
74032
|
-
|
|
74235
|
+
if (problem !== void 0)
|
|
74236
|
+
post({ type: "atlassianTest", product: "autosys", ok: false, detail: `Not saved: ${problem}` });
|
|
74237
|
+
else
|
|
74238
|
+
post({ type: "atlassianSaved", product: "autosys" });
|
|
74033
74239
|
} catch (error51) {
|
|
74034
|
-
post({ type: "
|
|
74240
|
+
post({ type: "atlassianTest", product: "autosys", ok: false, detail: `Not saved: ${error51 instanceof Error ? error51.message : String(error51)}` });
|
|
74035
74241
|
}
|
|
74036
74242
|
}
|
|
74037
74243
|
async function handleClearAutosysGatewaySecret(which) {
|
|
@@ -75975,6 +76181,29 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
75975
76181
|
fail(error51 instanceof Error ? error51.message : String(error51));
|
|
75976
76182
|
}
|
|
75977
76183
|
}
|
|
76184
|
+
async function handleExportSource() {
|
|
76185
|
+
const archive = services.sourceArchive;
|
|
76186
|
+
if (archive === void 0)
|
|
76187
|
+
return;
|
|
76188
|
+
try {
|
|
76189
|
+
await import_promises19.default.access(archive.path);
|
|
76190
|
+
} catch {
|
|
76191
|
+
post({
|
|
76192
|
+
type: "error",
|
|
76193
|
+
message: `This build does not carry its source archive (${archive.path} is missing). Packages built with "pnpm package" include it.`
|
|
76194
|
+
});
|
|
76195
|
+
return;
|
|
76196
|
+
}
|
|
76197
|
+
try {
|
|
76198
|
+
const target = await ui.showSaveDialog({ defaultName: archive.defaultName, extensions: ["zip"] });
|
|
76199
|
+
if (target === void 0)
|
|
76200
|
+
return;
|
|
76201
|
+
await import_promises19.default.copyFile(archive.path, target);
|
|
76202
|
+
ui.showInfo(`Saved the Light Code source to ${target}. Extract it, open the folder in VS Code, and follow START_HERE.md \u2014 it builds as it stands.`);
|
|
76203
|
+
} catch (error51) {
|
|
76204
|
+
post({ type: "error", message: `Could not save the source: ${error51 instanceof Error ? error51.message : String(error51)}` });
|
|
76205
|
+
}
|
|
76206
|
+
}
|
|
75978
76207
|
async function handleExportConfig(sections) {
|
|
75979
76208
|
try {
|
|
75980
76209
|
const { config: config2 } = await configManager.load();
|
|
@@ -76772,7 +77001,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
76772
77001
|
} else if (message4.type === "requestAtlassian") {
|
|
76773
77002
|
reportFailure("postAtlassian", postAtlassian());
|
|
76774
77003
|
} else if (message4.type === "saveAtlassian") {
|
|
76775
|
-
reportFailure("handleSaveAtlassian", handleSaveAtlassian(message4.product, message4.settings, message4.token));
|
|
77004
|
+
reportFailure("handleSaveAtlassian", handleSaveAtlassian(message4.product, message4.settings, message4.token, message4.gateway));
|
|
76776
77005
|
} else if (message4.type === "saveAutosysGateway") {
|
|
76777
77006
|
reportFailure("handleSaveAutosysGateway", handleSaveAutosysGateway(message4.gateway, message4.clientSecret, message4.passphrase));
|
|
76778
77007
|
} else if (message4.type === "clearAutosysGatewaySecret") {
|
|
@@ -77150,6 +77379,8 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
77150
77379
|
reportFailure("handleRequestShareSections", handleRequestShareSections());
|
|
77151
77380
|
} else if (message4.type === "previewImport") {
|
|
77152
77381
|
reportFailure("handlePreviewImport", handlePreviewImport());
|
|
77382
|
+
} else if (message4.type === "exportSource") {
|
|
77383
|
+
reportFailure("handleExportSource", handleExportSource());
|
|
77153
77384
|
} else if (message4.type === "exportConfig") {
|
|
77154
77385
|
reportFailure("handleExportConfig", handleExportConfig(message4.sections));
|
|
77155
77386
|
} else if (message4.type === "importConfig") {
|
|
@@ -79094,8 +79325,10 @@ job pattern such as \`PAY_*\`, a CA file and the skip-verify escape hatch. Off u
|
|
|
79094
79325
|
**user-scope only** (config:autosys). The password is kept in secure storage. **Test connection**
|
|
79095
79326
|
signs in without listing any jobs.
|
|
79096
79327
|
|
|
79097
|
-
**Behind an API gateway (Apigee)?**
|
|
79098
|
-
"Sign in through the gateway"
|
|
79328
|
+
**Behind an API gateway (Apigee)?** Fill in **API gateway (Apigee)** in the same panel \u2014 typing a
|
|
79329
|
+
token URL ticks "Sign in through the gateway" \u2014 and press the panel's one **Save**, which stores the
|
|
79330
|
+
site address and the gateway together. Test connection runs against what is saved and says on the
|
|
79331
|
+
page what it is still waiting for; a refused save is explained there too. Enter the **token URL** (where the token is issued \u2014 usually a
|
|
79099
79332
|
different address from the AutoSys API), the **client id** and **client secret** (kept in secure
|
|
79100
79333
|
storage), and a scope if the gateway asks for one. A token is fetched with those, kept in memory
|
|
79101
79334
|
only, renewed before it expires, and sent with every call to the site address \u2014 the username and
|
|
@@ -79103,7 +79336,12 @@ password are then not used. The **client certificate** comes from Settings \u219
|
|
|
79103
79336
|
name one under *Client certificate* (certificate and key, or a PFX, plus a passphrase); the same
|
|
79104
79337
|
certificate is presented to the token URL and to the API. If the token request is refused with 401
|
|
79105
79338
|
and the secret is right, switch *How the client id and secret are sent* between the request body
|
|
79106
|
-
and a Basic header \u2014 gateways differ.
|
|
79339
|
+
and a Basic header \u2014 gateways differ. **Gateway token and AutoSys username and password together:** tick *Also send the AutoSys
|
|
79340
|
+
username and password (HTTP Basic)* \u2014 it sends the username and password entered above as Basic,
|
|
79341
|
+
alongside the gateway's token. One header holds one value, so the two must go in different headers:
|
|
79342
|
+
usually the token in a gateway header (Advanced \u2192 *Header the token is sent in*, such as
|
|
79343
|
+
x-apigee-token) and the Basic sign-in in Authorization, or the other way round with *Header for the
|
|
79344
|
+
username and password*. The panel warns before saving if both would land in the same one. *Advanced* covers the grant type, where the token and its
|
|
79107
79345
|
expiry sit in the response, the header and prefix it is sent with, extra headers (an API key, say)
|
|
79108
79346
|
and extra token parameters (config:autosys).
|
|
79109
79347
|
|
|
@@ -79114,9 +79352,13 @@ runInfo, jobRunInfo, boxMembers, event, jil and log.
|
|
|
79114
79352
|
|
|
79115
79353
|
**Reading** \u2014 ordinary read tools, which you may set to always allow:
|
|
79116
79354
|
- \`autosys_find_jobs\` \u2014 jobs matching a name pattern, with type, box and machine.
|
|
79117
|
-
- \`autosys_job\` \u2014
|
|
79118
|
-
|
|
79119
|
-
|
|
79355
|
+
- \`autosys_job\` \u2014 job definitions in JIL terms with each job's status, and a box's members. One
|
|
79356
|
+
job, a list, or a **pattern** for every matching job; for many jobs ask for just the attributes
|
|
79357
|
+
you need ("the command and start times of every PAY_* job").
|
|
79358
|
+
- \`autosys_status\` \u2014 like autorep: status, last start and end, exit code, run number. One job, a
|
|
79359
|
+
pattern, or **several at once** ("PAY_LOAD and every GL_* job"), with a count by status first and
|
|
79360
|
+
failures at the top; \`only\` narrows to FAILURE, or to several statuses at once.
|
|
79361
|
+
- Ask it to **follow a job until it finishes**: it checks the status, waits, and checks again.
|
|
79120
79362
|
- \`autosys_job_log\` \u2014 a job's stderr or stdout, the end of it or matching lines. If the server
|
|
79121
79363
|
offers no log endpoint, it says which file on which machine the job writes to instead.
|
|
79122
79364
|
- \`autosys_dependencies\` \u2014 **why has it not started?** Upstream: each job its condition names
|
|
@@ -79552,6 +79794,73 @@ process)"). The saved conversation shows exactly that text, so reopening it late
|
|
|
79552
79794
|
done.** Most models do not see their earlier reasoning on the next turn at all, so the quote is how
|
|
79553
79795
|
it learns which line of thought you meant. \u{1F44E} on an approach while it is still working is the most
|
|
79554
79796
|
useful use of it: the next step reads it before deciding what to do.
|
|
79797
|
+
`
|
|
79798
|
+
},
|
|
79799
|
+
{
|
|
79800
|
+
id: "source-export",
|
|
79801
|
+
title: "Taking the Light Code source with you",
|
|
79802
|
+
keywords: [
|
|
79803
|
+
"export source",
|
|
79804
|
+
"source code",
|
|
79805
|
+
"export the source",
|
|
79806
|
+
"build it myself",
|
|
79807
|
+
"no github",
|
|
79808
|
+
"offline development",
|
|
79809
|
+
"zip of the project",
|
|
79810
|
+
"work on light code",
|
|
79811
|
+
"continue development"
|
|
79812
|
+
],
|
|
79813
|
+
body: `
|
|
79814
|
+
The **export button beside Help** in the chat header (an arrow out of a box) saves the complete
|
|
79815
|
+
Light Code source as a zip \u2014 every app, CLAUDE.md, the build scripts and the lockfile \u2014 for working on
|
|
79816
|
+
Light Code where GitHub cannot be reached. It is the source of exactly the version you are running,
|
|
79817
|
+
packed when that version was built, so it needs no network to export.
|
|
79818
|
+
|
|
79819
|
+
Extract it **to a short path** (C:\\src\\light-code, not deep inside Downloads): Windows will not
|
|
79820
|
+
start a program whose full path passes 260 characters, and the build tools sit deep in
|
|
79821
|
+
node_modules. Then open the folder in VS Code and follow **START_HERE.md**: Node 18 or newer, pnpm,
|
|
79822
|
+
\`pnpm install --ignore-scripts\` (from the npm registry or your organisation's mirror), then
|
|
79823
|
+
\`pnpm build\`, \`pnpm test\`, \`pnpm package\`. Start Claude Code in the folder; CLAUDE.md is the
|
|
79824
|
+
project's context and is read automatically.
|
|
79825
|
+
|
|
79826
|
+
The export has no git history \u2014 START_HERE.md shows the three commands to begin a repository \u2014 and
|
|
79827
|
+
leaves out the demo animations. The Node host has its own \`--export-code\` for the Node half.
|
|
79828
|
+
`
|
|
79829
|
+
},
|
|
79830
|
+
{
|
|
79831
|
+
id: "waiting",
|
|
79832
|
+
title: "Waiting for something to finish",
|
|
79833
|
+
keywords: [
|
|
79834
|
+
"wait",
|
|
79835
|
+
"waiting",
|
|
79836
|
+
"wait for",
|
|
79837
|
+
"until it finishes",
|
|
79838
|
+
"keep checking",
|
|
79839
|
+
"poll",
|
|
79840
|
+
"check again",
|
|
79841
|
+
"monitor",
|
|
79842
|
+
"watch the job",
|
|
79843
|
+
"when it is done",
|
|
79844
|
+
"sleep",
|
|
79845
|
+
"wait until",
|
|
79846
|
+
"until the job finishes",
|
|
79847
|
+
"job finishes",
|
|
79848
|
+
"tell me when"
|
|
79849
|
+
],
|
|
79850
|
+
body: `
|
|
79851
|
+
The assistant has a **wait** tool. Ask it to follow something \u2014 "watch PAY_EOD until it finishes",
|
|
79852
|
+
"tell me when the build is green", "check again in ten minutes" \u2014 and it checks with the ordinary
|
|
79853
|
+
tool, waits, and checks again, saying each time what it is waiting for.
|
|
79854
|
+
|
|
79855
|
+
- **Each wait is up to 15 minutes**; for longer it checks and waits again.
|
|
79856
|
+
- **It stops waiting the moment you type a message or react**, so it never holds up your reply.
|
|
79857
|
+
- **Every check is an ordinary tool call**, shown and approved like any other. The wait itself does
|
|
79858
|
+
nothing and never asks. To let it check without asking each time, allow that read tool always
|
|
79859
|
+
(Settings \u2192 Approvals, or "Always allow" on the prompt).
|
|
79860
|
+
- Each check and each wait counts toward the step limit (config:maxIterations); a very long watch
|
|
79861
|
+
may stop and ask you to continue \u2014 sending any message carries on.
|
|
79862
|
+
|
|
79863
|
+
A scheduled run can wait too, which is how a nightly job can watch something finish and report.
|
|
79555
79864
|
`
|
|
79556
79865
|
},
|
|
79557
79866
|
{
|
|
@@ -80295,6 +80604,40 @@ var writeToFileTool = {
|
|
|
80295
80604
|
}
|
|
80296
80605
|
};
|
|
80297
80606
|
|
|
80607
|
+
// ../../packages/core/dist/tools/wait.js
|
|
80608
|
+
var MAX_WAIT_SECONDS = 900;
|
|
80609
|
+
var schema = external_exports.object({
|
|
80610
|
+
seconds: external_exports.number().int().min(1).max(MAX_WAIT_SECONDS).describe(`How long to wait, 1\u2013${String(MAX_WAIT_SECONDS)} seconds. Prefer fewer, longer waits: every check and every wait is a step.`),
|
|
80611
|
+
reason: external_exports.string().max(200).optional().describe('What you are waiting for, shown to the user \u2014 e.g. "PAY_EOD to finish".')
|
|
80612
|
+
});
|
|
80613
|
+
function createWaitTool(options = {}) {
|
|
80614
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
80615
|
+
const now = options.now ?? (() => Date.now());
|
|
80616
|
+
return {
|
|
80617
|
+
name: "wait",
|
|
80618
|
+
group: "always",
|
|
80619
|
+
description: `Wait before looking again \u2014 for a job, build, deployment or file that is not ready yet. Check with the ordinary tool, wait, then check again; say what you are waiting for in \`reason\`. Ends early if the user sends a message. Up to ${String(MAX_WAIT_SECONDS)} seconds per call; for longer, wait again after checking.`,
|
|
80620
|
+
parametersSchema: schema,
|
|
80621
|
+
async execute(params, context) {
|
|
80622
|
+
const started = now();
|
|
80623
|
+
const until = started + params.seconds * 1e3;
|
|
80624
|
+
const what = params.reason !== void 0 && params.reason.trim().length > 0 ? ` for ${params.reason.trim()}` : "";
|
|
80625
|
+
while (now() < until) {
|
|
80626
|
+
if (context.signal?.aborted === true) {
|
|
80627
|
+
return { content: `Wait${what} cancelled after ${String(Math.round((now() - started) / 1e3))}s.`, isError: true };
|
|
80628
|
+
}
|
|
80629
|
+
if (context.hasNewUserInput?.() === true) {
|
|
80630
|
+
return {
|
|
80631
|
+
content: `Stopped waiting${what} after ${String(Math.round((now() - started) / 1e3))}s: the user has sent something. Read it before carrying on.`
|
|
80632
|
+
};
|
|
80633
|
+
}
|
|
80634
|
+
await sleep(Math.min(1e3, until - now()));
|
|
80635
|
+
}
|
|
80636
|
+
return { content: `Waited ${String(params.seconds)}s${what}. Check again now.` };
|
|
80637
|
+
}
|
|
80638
|
+
};
|
|
80639
|
+
}
|
|
80640
|
+
|
|
80298
80641
|
// ../../packages/core/dist/tools/readToolResult.js
|
|
80299
80642
|
var paramsSchema24 = external_exports.object({
|
|
80300
80643
|
handle: external_exports.string().min(1).describe("The handle from a truncated tool result."),
|
|
@@ -80332,6 +80675,7 @@ function createDefaultToolRegistry() {
|
|
|
80332
80675
|
registry2.register(createShowChartTool());
|
|
80333
80676
|
registry2.register(createShowDiagramTool());
|
|
80334
80677
|
registry2.register(createLightCodeHelpTool());
|
|
80678
|
+
registry2.register(createWaitTool());
|
|
80335
80679
|
registry2.register(attemptCompletionTool);
|
|
80336
80680
|
return registry2;
|
|
80337
80681
|
}
|
|
@@ -80676,7 +81020,7 @@ function describeNestedCall(caller, callee) {
|
|
|
80676
81020
|
}
|
|
80677
81021
|
|
|
80678
81022
|
// ../../packages/core/dist/tools/checkCollectorTool.js
|
|
80679
|
-
var
|
|
81023
|
+
var schema2 = external_exports.object({
|
|
80680
81024
|
name: external_exports.string().min(1).describe("The Python tool to examine, with or without the `py__` prefix."),
|
|
80681
81025
|
arguments: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Arguments to call it with, if it needs any. `since` is supplied automatically by a sync.")
|
|
80682
81026
|
});
|
|
@@ -80703,7 +81047,7 @@ function createCheckCollectorTool(options) {
|
|
|
80703
81047
|
name: "check_collector",
|
|
80704
81048
|
group: "read",
|
|
80705
81049
|
description: "Runs a Python tool and says whether its output can be indexed as a custom dataset, and if not, exactly what to change. Use it when a dataset sync reports that records are not usable, when adapting an existing tool into a collector, or after writing one to confirm it before the user configures a dataset around it. Changes nothing \u2014 it reports; fixing is an ordinary update_python_tool edit.",
|
|
80706
|
-
parametersSchema:
|
|
81050
|
+
parametersSchema: schema2,
|
|
80707
81051
|
execute: async (params) => {
|
|
80708
81052
|
const bare = params.name.replace(/^py__/, "");
|
|
80709
81053
|
const full = `py__${bare}`;
|
|
@@ -81019,14 +81363,14 @@ function normalisePrefix(prefix) {
|
|
|
81019
81363
|
return "";
|
|
81020
81364
|
return trimmed.endsWith("/") ? trimmed : `${trimmed}/`;
|
|
81021
81365
|
}
|
|
81022
|
-
function confineKey(
|
|
81023
|
-
const clean =
|
|
81366
|
+
function confineKey(requested2, prefix) {
|
|
81367
|
+
const clean = requested2.trim().replace(/^\/+/, "");
|
|
81024
81368
|
if (clean === "")
|
|
81025
81369
|
return { ok: false, message: "No key was given." };
|
|
81026
81370
|
if (clean.split("/").includes("..")) {
|
|
81027
81371
|
return {
|
|
81028
81372
|
ok: false,
|
|
81029
|
-
message: `"${
|
|
81373
|
+
message: `"${requested2}" contains "..", which S3 does not interpret as a parent folder \u2014 it would be part of the key. Give the key as it appears in the bucket.`
|
|
81030
81374
|
};
|
|
81031
81375
|
}
|
|
81032
81376
|
const base = normalisePrefix(prefix);
|
|
@@ -81034,7 +81378,7 @@ function confineKey(requested, prefix) {
|
|
|
81034
81378
|
return { ok: true, key: clean };
|
|
81035
81379
|
const key = clean.startsWith(base) ? clean : `${base}${clean}`;
|
|
81036
81380
|
if (!key.startsWith(base)) {
|
|
81037
|
-
return { ok: false, message: `"${
|
|
81381
|
+
return { ok: false, message: `"${requested2}" is outside "${base}", which this connection is limited to.` };
|
|
81038
81382
|
}
|
|
81039
81383
|
return { ok: true, key };
|
|
81040
81384
|
}
|