@finchtech/cli 0.3.6 → 0.3.7
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/README.md +12 -8
- package/dist/finch.js +1113 -806
- package/package.json +3 -3
package/dist/finch.js
CHANGED
|
@@ -1075,52 +1075,52 @@ var require_util = __commonJS({
|
|
|
1075
1075
|
return hash5;
|
|
1076
1076
|
}
|
|
1077
1077
|
exports.toHash = toHash;
|
|
1078
|
-
function alwaysValidSchema(it,
|
|
1079
|
-
if (typeof
|
|
1080
|
-
return
|
|
1081
|
-
if (Object.keys(
|
|
1078
|
+
function alwaysValidSchema(it, schema5) {
|
|
1079
|
+
if (typeof schema5 == "boolean")
|
|
1080
|
+
return schema5;
|
|
1081
|
+
if (Object.keys(schema5).length === 0)
|
|
1082
1082
|
return true;
|
|
1083
|
-
checkUnknownRules(it,
|
|
1084
|
-
return !schemaHasRules(
|
|
1083
|
+
checkUnknownRules(it, schema5);
|
|
1084
|
+
return !schemaHasRules(schema5, it.self.RULES.all);
|
|
1085
1085
|
}
|
|
1086
1086
|
exports.alwaysValidSchema = alwaysValidSchema;
|
|
1087
|
-
function checkUnknownRules(it,
|
|
1087
|
+
function checkUnknownRules(it, schema5 = it.schema) {
|
|
1088
1088
|
const { opts, self } = it;
|
|
1089
1089
|
if (!opts.strictSchema)
|
|
1090
1090
|
return;
|
|
1091
|
-
if (typeof
|
|
1091
|
+
if (typeof schema5 === "boolean")
|
|
1092
1092
|
return;
|
|
1093
1093
|
const rules = self.RULES.keywords;
|
|
1094
|
-
for (const key in
|
|
1094
|
+
for (const key in schema5) {
|
|
1095
1095
|
if (!rules[key])
|
|
1096
1096
|
checkStrictMode(it, `unknown keyword: "${key}"`);
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
1099
|
exports.checkUnknownRules = checkUnknownRules;
|
|
1100
|
-
function schemaHasRules(
|
|
1101
|
-
if (typeof
|
|
1102
|
-
return !
|
|
1103
|
-
for (const key in
|
|
1100
|
+
function schemaHasRules(schema5, rules) {
|
|
1101
|
+
if (typeof schema5 == "boolean")
|
|
1102
|
+
return !schema5;
|
|
1103
|
+
for (const key in schema5)
|
|
1104
1104
|
if (rules[key])
|
|
1105
1105
|
return true;
|
|
1106
1106
|
return false;
|
|
1107
1107
|
}
|
|
1108
1108
|
exports.schemaHasRules = schemaHasRules;
|
|
1109
|
-
function schemaHasRulesButRef(
|
|
1110
|
-
if (typeof
|
|
1111
|
-
return !
|
|
1112
|
-
for (const key in
|
|
1109
|
+
function schemaHasRulesButRef(schema5, RULES) {
|
|
1110
|
+
if (typeof schema5 == "boolean")
|
|
1111
|
+
return !schema5;
|
|
1112
|
+
for (const key in schema5)
|
|
1113
1113
|
if (key !== "$ref" && RULES.all[key])
|
|
1114
1114
|
return true;
|
|
1115
1115
|
return false;
|
|
1116
1116
|
}
|
|
1117
1117
|
exports.schemaHasRulesButRef = schemaHasRulesButRef;
|
|
1118
|
-
function schemaRefOrVal({ topSchemaRef, schemaPath },
|
|
1118
|
+
function schemaRefOrVal({ topSchemaRef, schemaPath }, schema5, keyword, $data) {
|
|
1119
1119
|
if (!$data) {
|
|
1120
|
-
if (typeof
|
|
1121
|
-
return
|
|
1122
|
-
if (typeof
|
|
1123
|
-
return (0, codegen_1._)`${
|
|
1120
|
+
if (typeof schema5 == "number" || typeof schema5 == "boolean")
|
|
1121
|
+
return schema5;
|
|
1122
|
+
if (typeof schema5 == "string")
|
|
1123
|
+
return (0, codegen_1._)`${schema5}`;
|
|
1124
1124
|
}
|
|
1125
1125
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
1126
1126
|
}
|
|
@@ -1401,10 +1401,10 @@ var require_boolSchema = __commonJS({
|
|
|
1401
1401
|
message: "boolean schema is false"
|
|
1402
1402
|
};
|
|
1403
1403
|
function topBoolOrEmptySchema(it) {
|
|
1404
|
-
const { gen: gen2, schema:
|
|
1405
|
-
if (
|
|
1404
|
+
const { gen: gen2, schema: schema5, validateName } = it;
|
|
1405
|
+
if (schema5 === false) {
|
|
1406
1406
|
falseSchemaError(it, false);
|
|
1407
|
-
} else if (typeof
|
|
1407
|
+
} else if (typeof schema5 == "object" && schema5.$async === true) {
|
|
1408
1408
|
gen2.return(names_1.default.data);
|
|
1409
1409
|
} else {
|
|
1410
1410
|
gen2.assign((0, codegen_1._)`${validateName}.errors`, null);
|
|
@@ -1413,8 +1413,8 @@ var require_boolSchema = __commonJS({
|
|
|
1413
1413
|
}
|
|
1414
1414
|
exports.topBoolOrEmptySchema = topBoolOrEmptySchema;
|
|
1415
1415
|
function boolOrEmptySchema(it, valid) {
|
|
1416
|
-
const { gen: gen2, schema:
|
|
1417
|
-
if (
|
|
1416
|
+
const { gen: gen2, schema: schema5 } = it;
|
|
1417
|
+
if (schema5 === false) {
|
|
1418
1418
|
gen2.var(valid, false);
|
|
1419
1419
|
falseSchemaError(it);
|
|
1420
1420
|
} else {
|
|
@@ -1476,18 +1476,18 @@ var require_applicability = __commonJS({
|
|
|
1476
1476
|
"use strict";
|
|
1477
1477
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1478
1478
|
exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
|
|
1479
|
-
function schemaHasRulesForType({ schema:
|
|
1479
|
+
function schemaHasRulesForType({ schema: schema5, self }, type) {
|
|
1480
1480
|
const group = self.RULES.types[type];
|
|
1481
|
-
return group && group !== true && shouldUseGroup(
|
|
1481
|
+
return group && group !== true && shouldUseGroup(schema5, group);
|
|
1482
1482
|
}
|
|
1483
1483
|
exports.schemaHasRulesForType = schemaHasRulesForType;
|
|
1484
|
-
function shouldUseGroup(
|
|
1485
|
-
return group.rules.some((rule) => shouldUseRule(
|
|
1484
|
+
function shouldUseGroup(schema5, group) {
|
|
1485
|
+
return group.rules.some((rule) => shouldUseRule(schema5, rule));
|
|
1486
1486
|
}
|
|
1487
1487
|
exports.shouldUseGroup = shouldUseGroup;
|
|
1488
|
-
function shouldUseRule(
|
|
1488
|
+
function shouldUseRule(schema5, rule) {
|
|
1489
1489
|
var _a4;
|
|
1490
|
-
return
|
|
1490
|
+
return schema5[rule.keyword] !== void 0 || ((_a4 = rule.definition.implements) === null || _a4 === void 0 ? void 0 : _a4.some((kwd) => schema5[kwd] !== void 0));
|
|
1491
1491
|
}
|
|
1492
1492
|
exports.shouldUseRule = shouldUseRule;
|
|
1493
1493
|
}
|
|
@@ -1509,17 +1509,17 @@ var require_dataType = __commonJS({
|
|
|
1509
1509
|
DataType2[DataType2["Correct"] = 0] = "Correct";
|
|
1510
1510
|
DataType2[DataType2["Wrong"] = 1] = "Wrong";
|
|
1511
1511
|
})(DataType || (exports.DataType = DataType = {}));
|
|
1512
|
-
function getSchemaTypes(
|
|
1513
|
-
const types = getJSONTypes(
|
|
1512
|
+
function getSchemaTypes(schema5) {
|
|
1513
|
+
const types = getJSONTypes(schema5.type);
|
|
1514
1514
|
const hasNull = types.includes("null");
|
|
1515
1515
|
if (hasNull) {
|
|
1516
|
-
if (
|
|
1516
|
+
if (schema5.nullable === false)
|
|
1517
1517
|
throw new Error("type: null contradicts nullable: false");
|
|
1518
1518
|
} else {
|
|
1519
|
-
if (!types.length &&
|
|
1519
|
+
if (!types.length && schema5.nullable !== void 0) {
|
|
1520
1520
|
throw new Error('"nullable" cannot be used without "type"');
|
|
1521
1521
|
}
|
|
1522
|
-
if (
|
|
1522
|
+
if (schema5.nullable === true)
|
|
1523
1523
|
types.push("null");
|
|
1524
1524
|
}
|
|
1525
1525
|
return types;
|
|
@@ -1651,8 +1651,8 @@ var require_dataType = __commonJS({
|
|
|
1651
1651
|
}
|
|
1652
1652
|
exports.checkDataTypes = checkDataTypes;
|
|
1653
1653
|
var typeError = {
|
|
1654
|
-
message: ({ schema:
|
|
1655
|
-
params: ({ schema:
|
|
1654
|
+
message: ({ schema: schema5 }) => `must be ${schema5}`,
|
|
1655
|
+
params: ({ schema: schema5, schemaValue }) => typeof schema5 == "string" ? (0, codegen_1._)`{type: ${schema5}}` : (0, codegen_1._)`{type: ${schemaValue}}`
|
|
1656
1656
|
};
|
|
1657
1657
|
function reportTypeError(it) {
|
|
1658
1658
|
const cxt = getTypeErrorContext(it);
|
|
@@ -1660,16 +1660,16 @@ var require_dataType = __commonJS({
|
|
|
1660
1660
|
}
|
|
1661
1661
|
exports.reportTypeError = reportTypeError;
|
|
1662
1662
|
function getTypeErrorContext(it) {
|
|
1663
|
-
const { gen: gen2, data, schema:
|
|
1664
|
-
const schemaCode = (0, util_1.schemaRefOrVal)(it,
|
|
1663
|
+
const { gen: gen2, data, schema: schema5 } = it;
|
|
1664
|
+
const schemaCode = (0, util_1.schemaRefOrVal)(it, schema5, "type");
|
|
1665
1665
|
return {
|
|
1666
1666
|
gen: gen2,
|
|
1667
1667
|
keyword: "type",
|
|
1668
1668
|
data,
|
|
1669
|
-
schema:
|
|
1669
|
+
schema: schema5.type,
|
|
1670
1670
|
schemaCode,
|
|
1671
1671
|
schemaValue: schemaCode,
|
|
1672
|
-
parentSchema:
|
|
1672
|
+
parentSchema: schema5,
|
|
1673
1673
|
params: {},
|
|
1674
1674
|
it
|
|
1675
1675
|
};
|
|
@@ -1822,15 +1822,15 @@ var require_code2 = __commonJS({
|
|
|
1822
1822
|
}
|
|
1823
1823
|
exports.validateArray = validateArray;
|
|
1824
1824
|
function validateUnion(cxt) {
|
|
1825
|
-
const { gen: gen2, schema:
|
|
1826
|
-
if (!Array.isArray(
|
|
1825
|
+
const { gen: gen2, schema: schema5, keyword, it } = cxt;
|
|
1826
|
+
if (!Array.isArray(schema5))
|
|
1827
1827
|
throw new Error("ajv implementation error");
|
|
1828
|
-
const alwaysValid =
|
|
1828
|
+
const alwaysValid = schema5.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));
|
|
1829
1829
|
if (alwaysValid && !it.opts.unevaluated)
|
|
1830
1830
|
return;
|
|
1831
1831
|
const valid = gen2.let("valid", false);
|
|
1832
1832
|
const schValid = gen2.name("_valid");
|
|
1833
|
-
gen2.block(() =>
|
|
1833
|
+
gen2.block(() => schema5.forEach((_sch, i2) => {
|
|
1834
1834
|
const schCxt = cxt.subschema({
|
|
1835
1835
|
keyword,
|
|
1836
1836
|
schemaProp: i2,
|
|
@@ -1858,8 +1858,8 @@ var require_keyword = __commonJS({
|
|
|
1858
1858
|
var code_1 = require_code2();
|
|
1859
1859
|
var errors_1 = require_errors();
|
|
1860
1860
|
function macroKeywordCode(cxt, def) {
|
|
1861
|
-
const { gen: gen2, keyword, schema:
|
|
1862
|
-
const macroSchema = def.macro.call(it.self,
|
|
1861
|
+
const { gen: gen2, keyword, schema: schema5, parentSchema, it } = cxt;
|
|
1862
|
+
const macroSchema = def.macro.call(it.self, schema5, parentSchema, it);
|
|
1863
1863
|
const schemaRef = useKeyword(gen2, keyword, macroSchema);
|
|
1864
1864
|
if (it.opts.validateSchema !== false)
|
|
1865
1865
|
it.self.validateSchema(macroSchema, true);
|
|
@@ -1876,9 +1876,9 @@ var require_keyword = __commonJS({
|
|
|
1876
1876
|
exports.macroKeywordCode = macroKeywordCode;
|
|
1877
1877
|
function funcKeywordCode(cxt, def) {
|
|
1878
1878
|
var _a4;
|
|
1879
|
-
const { gen: gen2, keyword, schema:
|
|
1879
|
+
const { gen: gen2, keyword, schema: schema5, parentSchema, $data, it } = cxt;
|
|
1880
1880
|
checkAsyncKeyword(it, def);
|
|
1881
|
-
const validate6 = !$data && def.compile ? def.compile.call(it.self,
|
|
1881
|
+
const validate6 = !$data && def.compile ? def.compile.call(it.self, schema5, parentSchema, it) : def.validate;
|
|
1882
1882
|
const validateRef = useKeyword(gen2, keyword, validate6);
|
|
1883
1883
|
const valid = gen2.let("valid");
|
|
1884
1884
|
cxt.block$data(valid, validateKeyword);
|
|
@@ -1938,20 +1938,20 @@ var require_keyword = __commonJS({
|
|
|
1938
1938
|
throw new Error(`keyword "${keyword}" failed to compile`);
|
|
1939
1939
|
return gen2.scopeValue("keyword", typeof result2 == "function" ? { ref: result2 } : { ref: result2, code: (0, codegen_1.stringify)(result2) });
|
|
1940
1940
|
}
|
|
1941
|
-
function validSchemaType(
|
|
1942
|
-
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(
|
|
1941
|
+
function validSchemaType(schema5, schemaType, allowUndefined = false) {
|
|
1942
|
+
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema5) : st === "object" ? schema5 && typeof schema5 == "object" && !Array.isArray(schema5) : typeof schema5 == st || allowUndefined && typeof schema5 == "undefined");
|
|
1943
1943
|
}
|
|
1944
1944
|
exports.validSchemaType = validSchemaType;
|
|
1945
|
-
function validateKeywordUsage({ schema:
|
|
1945
|
+
function validateKeywordUsage({ schema: schema5, opts, self, errSchemaPath }, def, keyword) {
|
|
1946
1946
|
if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {
|
|
1947
1947
|
throw new Error("ajv implementation error");
|
|
1948
1948
|
}
|
|
1949
1949
|
const deps = def.dependencies;
|
|
1950
|
-
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(
|
|
1950
|
+
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema5, kwd))) {
|
|
1951
1951
|
throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`);
|
|
1952
1952
|
}
|
|
1953
1953
|
if (def.validateSchema) {
|
|
1954
|
-
const valid = def.validateSchema(
|
|
1954
|
+
const valid = def.validateSchema(schema5[keyword]);
|
|
1955
1955
|
if (!valid) {
|
|
1956
1956
|
const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def.validateSchema.errors);
|
|
1957
1957
|
if (opts.validateSchema === "log")
|
|
@@ -1973,8 +1973,8 @@ var require_subschema = __commonJS({
|
|
|
1973
1973
|
exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0;
|
|
1974
1974
|
var codegen_1 = require_codegen();
|
|
1975
1975
|
var util_1 = require_util();
|
|
1976
|
-
function getSubschema(it, { keyword, schemaProp, schema:
|
|
1977
|
-
if (keyword !== void 0 &&
|
|
1976
|
+
function getSubschema(it, { keyword, schemaProp, schema: schema5, schemaPath, errSchemaPath, topSchemaRef }) {
|
|
1977
|
+
if (keyword !== void 0 && schema5 !== void 0) {
|
|
1978
1978
|
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
1979
1979
|
}
|
|
1980
1980
|
if (keyword !== void 0) {
|
|
@@ -1989,12 +1989,12 @@ var require_subschema = __commonJS({
|
|
|
1989
1989
|
errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`
|
|
1990
1990
|
};
|
|
1991
1991
|
}
|
|
1992
|
-
if (
|
|
1992
|
+
if (schema5 !== void 0) {
|
|
1993
1993
|
if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
|
|
1994
1994
|
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
|
1995
1995
|
}
|
|
1996
1996
|
return {
|
|
1997
|
-
schema:
|
|
1997
|
+
schema: schema5,
|
|
1998
1998
|
schemaPath,
|
|
1999
1999
|
topSchemaRef,
|
|
2000
2000
|
errSchemaPath
|
|
@@ -2087,7 +2087,7 @@ var require_fast_deep_equal = __commonJS({
|
|
|
2087
2087
|
var require_json_schema_traverse = __commonJS({
|
|
2088
2088
|
"../../node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js"(exports, module) {
|
|
2089
2089
|
"use strict";
|
|
2090
|
-
var traverse = module.exports = function(
|
|
2090
|
+
var traverse = module.exports = function(schema5, opts, cb) {
|
|
2091
2091
|
if (typeof opts == "function") {
|
|
2092
2092
|
cb = opts;
|
|
2093
2093
|
opts = {};
|
|
@@ -2097,7 +2097,7 @@ var require_json_schema_traverse = __commonJS({
|
|
|
2097
2097
|
};
|
|
2098
2098
|
var post = cb.post || function() {
|
|
2099
2099
|
};
|
|
2100
|
-
_traverse(opts, pre, post,
|
|
2100
|
+
_traverse(opts, pre, post, schema5, "", schema5);
|
|
2101
2101
|
};
|
|
2102
2102
|
traverse.keywords = {
|
|
2103
2103
|
additionalItems: true,
|
|
@@ -2143,26 +2143,26 @@ var require_json_schema_traverse = __commonJS({
|
|
|
2143
2143
|
maxProperties: true,
|
|
2144
2144
|
minProperties: true
|
|
2145
2145
|
};
|
|
2146
|
-
function _traverse(opts, pre, post,
|
|
2147
|
-
if (
|
|
2148
|
-
pre(
|
|
2149
|
-
for (var key in
|
|
2150
|
-
var sch =
|
|
2146
|
+
function _traverse(opts, pre, post, schema5, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
2147
|
+
if (schema5 && typeof schema5 == "object" && !Array.isArray(schema5)) {
|
|
2148
|
+
pre(schema5, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
2149
|
+
for (var key in schema5) {
|
|
2150
|
+
var sch = schema5[key];
|
|
2151
2151
|
if (Array.isArray(sch)) {
|
|
2152
2152
|
if (key in traverse.arrayKeywords) {
|
|
2153
2153
|
for (var i2 = 0; i2 < sch.length; i2++)
|
|
2154
|
-
_traverse(opts, pre, post, sch[i2], jsonPtr + "/" + key + "/" + i2, rootSchema, jsonPtr, key,
|
|
2154
|
+
_traverse(opts, pre, post, sch[i2], jsonPtr + "/" + key + "/" + i2, rootSchema, jsonPtr, key, schema5, i2);
|
|
2155
2155
|
}
|
|
2156
2156
|
} else if (key in traverse.propsKeywords) {
|
|
2157
2157
|
if (sch && typeof sch == "object") {
|
|
2158
2158
|
for (var prop in sch)
|
|
2159
|
-
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key,
|
|
2159
|
+
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema5, prop);
|
|
2160
2160
|
}
|
|
2161
2161
|
} else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) {
|
|
2162
|
-
_traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key,
|
|
2162
|
+
_traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema5);
|
|
2163
2163
|
}
|
|
2164
2164
|
}
|
|
2165
|
-
post(
|
|
2165
|
+
post(schema5, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
2166
2166
|
}
|
|
2167
2167
|
}
|
|
2168
2168
|
function escapeJsonPtr(str) {
|
|
@@ -2198,14 +2198,14 @@ var require_resolve = __commonJS({
|
|
|
2198
2198
|
"enum",
|
|
2199
2199
|
"const"
|
|
2200
2200
|
]);
|
|
2201
|
-
function inlineRef(
|
|
2202
|
-
if (typeof
|
|
2201
|
+
function inlineRef(schema5, limit = true) {
|
|
2202
|
+
if (typeof schema5 == "boolean")
|
|
2203
2203
|
return true;
|
|
2204
2204
|
if (limit === true)
|
|
2205
|
-
return !hasRef(
|
|
2205
|
+
return !hasRef(schema5);
|
|
2206
2206
|
if (!limit)
|
|
2207
2207
|
return false;
|
|
2208
|
-
return countKeys(
|
|
2208
|
+
return countKeys(schema5) <= limit;
|
|
2209
2209
|
}
|
|
2210
2210
|
exports.inlineRef = inlineRef;
|
|
2211
2211
|
var REF_KEYWORDS = /* @__PURE__ */ new Set([
|
|
@@ -2215,11 +2215,11 @@ var require_resolve = __commonJS({
|
|
|
2215
2215
|
"$dynamicRef",
|
|
2216
2216
|
"$dynamicAnchor"
|
|
2217
2217
|
]);
|
|
2218
|
-
function hasRef(
|
|
2219
|
-
for (const key in
|
|
2218
|
+
function hasRef(schema5) {
|
|
2219
|
+
for (const key in schema5) {
|
|
2220
2220
|
if (REF_KEYWORDS.has(key))
|
|
2221
2221
|
return true;
|
|
2222
|
-
const sch =
|
|
2222
|
+
const sch = schema5[key];
|
|
2223
2223
|
if (Array.isArray(sch) && sch.some(hasRef))
|
|
2224
2224
|
return true;
|
|
2225
2225
|
if (typeof sch == "object" && hasRef(sch))
|
|
@@ -2227,16 +2227,16 @@ var require_resolve = __commonJS({
|
|
|
2227
2227
|
}
|
|
2228
2228
|
return false;
|
|
2229
2229
|
}
|
|
2230
|
-
function countKeys(
|
|
2230
|
+
function countKeys(schema5) {
|
|
2231
2231
|
let count = 0;
|
|
2232
|
-
for (const key in
|
|
2232
|
+
for (const key in schema5) {
|
|
2233
2233
|
if (key === "$ref")
|
|
2234
2234
|
return Infinity;
|
|
2235
2235
|
count++;
|
|
2236
2236
|
if (SIMPLE_INLINED.has(key))
|
|
2237
2237
|
continue;
|
|
2238
|
-
if (typeof
|
|
2239
|
-
(0, util_1.eachItem)(
|
|
2238
|
+
if (typeof schema5[key] == "object") {
|
|
2239
|
+
(0, util_1.eachItem)(schema5[key], (sch) => count += countKeys(sch));
|
|
2240
2240
|
}
|
|
2241
2241
|
if (count === Infinity)
|
|
2242
2242
|
return Infinity;
|
|
@@ -2266,16 +2266,16 @@ var require_resolve = __commonJS({
|
|
|
2266
2266
|
}
|
|
2267
2267
|
exports.resolveUrl = resolveUrl;
|
|
2268
2268
|
var ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
2269
|
-
function getSchemaRefs(
|
|
2270
|
-
if (typeof
|
|
2269
|
+
function getSchemaRefs(schema5, baseId) {
|
|
2270
|
+
if (typeof schema5 == "boolean")
|
|
2271
2271
|
return {};
|
|
2272
2272
|
const { schemaId, uriResolver } = this.opts;
|
|
2273
|
-
const schId = normalizeId(
|
|
2273
|
+
const schId = normalizeId(schema5[schemaId] || baseId);
|
|
2274
2274
|
const baseIds = { "": schId };
|
|
2275
2275
|
const pathPrefix = getFullPath(uriResolver, schId, false);
|
|
2276
2276
|
const localRefs = {};
|
|
2277
2277
|
const schemaRefs = /* @__PURE__ */ new Set();
|
|
2278
|
-
traverse(
|
|
2278
|
+
traverse(schema5, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
|
|
2279
2279
|
if (parentJsonPtr === void 0)
|
|
2280
2280
|
return;
|
|
2281
2281
|
const fullPath = pathPrefix + jsonPtr;
|
|
@@ -2356,15 +2356,15 @@ var require_validate = __commonJS({
|
|
|
2356
2356
|
validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
|
|
2357
2357
|
}
|
|
2358
2358
|
exports.validateFunctionCode = validateFunctionCode;
|
|
2359
|
-
function validateFunction({ gen: gen2, validateName, schema:
|
|
2359
|
+
function validateFunction({ gen: gen2, validateName, schema: schema5, schemaEnv, opts }, body) {
|
|
2360
2360
|
if (opts.code.es5) {
|
|
2361
2361
|
gen2.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
|
|
2362
|
-
gen2.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(
|
|
2362
|
+
gen2.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema5, opts)}`);
|
|
2363
2363
|
destructureValCxtES5(gen2, opts);
|
|
2364
2364
|
gen2.code(body);
|
|
2365
2365
|
});
|
|
2366
2366
|
} else {
|
|
2367
|
-
gen2.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen2.code(funcSourceUrl(
|
|
2367
|
+
gen2.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen2.code(funcSourceUrl(schema5, opts)).code(body));
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
2370
|
function destructureValCxt(opts) {
|
|
@@ -2388,9 +2388,9 @@ var require_validate = __commonJS({
|
|
|
2388
2388
|
});
|
|
2389
2389
|
}
|
|
2390
2390
|
function topSchemaObjCode(it) {
|
|
2391
|
-
const { schema:
|
|
2391
|
+
const { schema: schema5, opts, gen: gen2 } = it;
|
|
2392
2392
|
validateFunction(it, () => {
|
|
2393
|
-
if (opts.$comment &&
|
|
2393
|
+
if (opts.$comment && schema5.$comment)
|
|
2394
2394
|
commentKeyword(it);
|
|
2395
2395
|
checkNoDefault(it);
|
|
2396
2396
|
gen2.let(names_1.default.vErrors, null);
|
|
@@ -2408,8 +2408,8 @@ var require_validate = __commonJS({
|
|
|
2408
2408
|
gen2.if((0, codegen_1._)`${it.evaluated}.dynamicProps`, () => gen2.assign((0, codegen_1._)`${it.evaluated}.props`, (0, codegen_1._)`undefined`));
|
|
2409
2409
|
gen2.if((0, codegen_1._)`${it.evaluated}.dynamicItems`, () => gen2.assign((0, codegen_1._)`${it.evaluated}.items`, (0, codegen_1._)`undefined`));
|
|
2410
2410
|
}
|
|
2411
|
-
function funcSourceUrl(
|
|
2412
|
-
const schId = typeof
|
|
2411
|
+
function funcSourceUrl(schema5, opts) {
|
|
2412
|
+
const schId = typeof schema5 == "object" && schema5[opts.schemaId];
|
|
2413
2413
|
return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._)`/*# sourceURL=${schId} */` : codegen_1.nil;
|
|
2414
2414
|
}
|
|
2415
2415
|
function subschemaCode(it, valid) {
|
|
@@ -2422,10 +2422,10 @@ var require_validate = __commonJS({
|
|
|
2422
2422
|
}
|
|
2423
2423
|
(0, boolSchema_1.boolOrEmptySchema)(it, valid);
|
|
2424
2424
|
}
|
|
2425
|
-
function schemaCxtHasRules({ schema:
|
|
2426
|
-
if (typeof
|
|
2427
|
-
return !
|
|
2428
|
-
for (const key in
|
|
2425
|
+
function schemaCxtHasRules({ schema: schema5, self }) {
|
|
2426
|
+
if (typeof schema5 == "boolean")
|
|
2427
|
+
return !schema5;
|
|
2428
|
+
for (const key in schema5)
|
|
2429
2429
|
if (self.RULES.all[key])
|
|
2430
2430
|
return true;
|
|
2431
2431
|
return false;
|
|
@@ -2434,8 +2434,8 @@ var require_validate = __commonJS({
|
|
|
2434
2434
|
return typeof it.schema != "boolean";
|
|
2435
2435
|
}
|
|
2436
2436
|
function subSchemaObjCode(it, valid) {
|
|
2437
|
-
const { schema:
|
|
2438
|
-
if (opts.$comment &&
|
|
2437
|
+
const { schema: schema5, gen: gen2, opts } = it;
|
|
2438
|
+
if (opts.$comment && schema5.$comment)
|
|
2439
2439
|
commentKeyword(it);
|
|
2440
2440
|
updateContext(it);
|
|
2441
2441
|
checkAsyncSchema(it);
|
|
@@ -2455,14 +2455,14 @@ var require_validate = __commonJS({
|
|
|
2455
2455
|
schemaKeywords(it, types, !checkedTypes, errsCount);
|
|
2456
2456
|
}
|
|
2457
2457
|
function checkRefsAndKeywords(it) {
|
|
2458
|
-
const { schema:
|
|
2459
|
-
if (
|
|
2458
|
+
const { schema: schema5, errSchemaPath, opts, self } = it;
|
|
2459
|
+
if (schema5.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema5, self.RULES)) {
|
|
2460
2460
|
self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
|
|
2461
2461
|
}
|
|
2462
2462
|
}
|
|
2463
2463
|
function checkNoDefault(it) {
|
|
2464
|
-
const { schema:
|
|
2465
|
-
if (
|
|
2464
|
+
const { schema: schema5, opts } = it;
|
|
2465
|
+
if (schema5.default !== void 0 && opts.useDefaults && opts.strictSchema) {
|
|
2466
2466
|
(0, util_1.checkStrictMode)(it, "default is ignored in the schema root");
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
@@ -2475,8 +2475,8 @@ var require_validate = __commonJS({
|
|
|
2475
2475
|
if (it.schema.$async && !it.schemaEnv.$async)
|
|
2476
2476
|
throw new Error("async schema in sync schema");
|
|
2477
2477
|
}
|
|
2478
|
-
function commentKeyword({ gen: gen2, schemaEnv, schema:
|
|
2479
|
-
const msg =
|
|
2478
|
+
function commentKeyword({ gen: gen2, schemaEnv, schema: schema5, errSchemaPath, opts }) {
|
|
2479
|
+
const msg = schema5.$comment;
|
|
2480
2480
|
if (opts.$comment === true) {
|
|
2481
2481
|
gen2.code((0, codegen_1._)`${names_1.default.self}.logger.log(${msg})`);
|
|
2482
2482
|
} else if (typeof opts.$comment == "function") {
|
|
@@ -2503,9 +2503,9 @@ var require_validate = __commonJS({
|
|
|
2503
2503
|
gen2.assign((0, codegen_1._)`${evaluated}.items`, items);
|
|
2504
2504
|
}
|
|
2505
2505
|
function schemaKeywords(it, types, typeErrors, errsCount) {
|
|
2506
|
-
const { gen: gen2, schema:
|
|
2506
|
+
const { gen: gen2, schema: schema5, data, allErrors, opts, self } = it;
|
|
2507
2507
|
const { RULES } = self;
|
|
2508
|
-
if (
|
|
2508
|
+
if (schema5.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema5, RULES))) {
|
|
2509
2509
|
gen2.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
|
|
2510
2510
|
return;
|
|
2511
2511
|
}
|
|
@@ -2517,7 +2517,7 @@ var require_validate = __commonJS({
|
|
|
2517
2517
|
groupKeywords(RULES.post);
|
|
2518
2518
|
});
|
|
2519
2519
|
function groupKeywords(group) {
|
|
2520
|
-
if (!(0, applicability_1.shouldUseGroup)(
|
|
2520
|
+
if (!(0, applicability_1.shouldUseGroup)(schema5, group))
|
|
2521
2521
|
return;
|
|
2522
2522
|
if (group.type) {
|
|
2523
2523
|
gen2.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
|
|
@@ -2535,12 +2535,12 @@ var require_validate = __commonJS({
|
|
|
2535
2535
|
}
|
|
2536
2536
|
}
|
|
2537
2537
|
function iterateKeywords(it, group) {
|
|
2538
|
-
const { gen: gen2, schema:
|
|
2538
|
+
const { gen: gen2, schema: schema5, opts: { useDefaults } } = it;
|
|
2539
2539
|
if (useDefaults)
|
|
2540
2540
|
(0, defaults_1.assignDefaults)(it, group.type);
|
|
2541
2541
|
gen2.block(() => {
|
|
2542
2542
|
for (const rule of group.rules) {
|
|
2543
|
-
if ((0, applicability_1.shouldUseRule)(
|
|
2543
|
+
if ((0, applicability_1.shouldUseRule)(schema5, rule)) {
|
|
2544
2544
|
keywordCode(it, rule.keyword, rule.definition, group.type);
|
|
2545
2545
|
}
|
|
2546
2546
|
}
|
|
@@ -2885,17 +2885,17 @@ var require_compile = __commonJS({
|
|
|
2885
2885
|
var _a4;
|
|
2886
2886
|
this.refs = {};
|
|
2887
2887
|
this.dynamicAnchors = {};
|
|
2888
|
-
let
|
|
2888
|
+
let schema5;
|
|
2889
2889
|
if (typeof env.schema == "object")
|
|
2890
|
-
|
|
2890
|
+
schema5 = env.schema;
|
|
2891
2891
|
this.schema = env.schema;
|
|
2892
2892
|
this.schemaId = env.schemaId;
|
|
2893
2893
|
this.root = env.root || this;
|
|
2894
|
-
this.baseId = (_a4 = env.baseId) !== null && _a4 !== void 0 ? _a4 : (0, resolve_1.normalizeId)(
|
|
2894
|
+
this.baseId = (_a4 = env.baseId) !== null && _a4 !== void 0 ? _a4 : (0, resolve_1.normalizeId)(schema5 === null || schema5 === void 0 ? void 0 : schema5[env.schemaId || "$id"]);
|
|
2895
2895
|
this.schemaPath = env.schemaPath;
|
|
2896
2896
|
this.localRefs = env.localRefs;
|
|
2897
2897
|
this.meta = env.meta;
|
|
2898
|
-
this.$async =
|
|
2898
|
+
this.$async = schema5 === null || schema5 === void 0 ? void 0 : schema5.$async;
|
|
2899
2899
|
this.refs = {};
|
|
2900
2900
|
}
|
|
2901
2901
|
};
|
|
@@ -2994,10 +2994,10 @@ var require_compile = __commonJS({
|
|
|
2994
2994
|
return schOrFunc;
|
|
2995
2995
|
let _sch = resolve4.call(this, root, ref);
|
|
2996
2996
|
if (_sch === void 0) {
|
|
2997
|
-
const
|
|
2997
|
+
const schema5 = (_a4 = root.localRefs) === null || _a4 === void 0 ? void 0 : _a4[ref];
|
|
2998
2998
|
const { schemaId } = this.opts;
|
|
2999
|
-
if (
|
|
3000
|
-
_sch = new SchemaEnv({ schema:
|
|
2999
|
+
if (schema5)
|
|
3000
|
+
_sch = new SchemaEnv({ schema: schema5, schemaId, root, baseId });
|
|
3001
3001
|
}
|
|
3002
3002
|
if (_sch === void 0)
|
|
3003
3003
|
return;
|
|
@@ -3045,12 +3045,12 @@ var require_compile = __commonJS({
|
|
|
3045
3045
|
if (!schOrRef.validate)
|
|
3046
3046
|
compileSchema.call(this, schOrRef);
|
|
3047
3047
|
if (id === (0, resolve_1.normalizeId)(ref)) {
|
|
3048
|
-
const { schema:
|
|
3048
|
+
const { schema: schema5 } = schOrRef;
|
|
3049
3049
|
const { schemaId } = this.opts;
|
|
3050
|
-
const schId =
|
|
3050
|
+
const schId = schema5[schemaId];
|
|
3051
3051
|
if (schId)
|
|
3052
3052
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
3053
|
-
return new SchemaEnv({ schema:
|
|
3053
|
+
return new SchemaEnv({ schema: schema5, schemaId, root, baseId });
|
|
3054
3054
|
}
|
|
3055
3055
|
return getJsonPointer.call(this, p, schOrRef);
|
|
3056
3056
|
}
|
|
@@ -3062,29 +3062,29 @@ var require_compile = __commonJS({
|
|
|
3062
3062
|
"dependencies",
|
|
3063
3063
|
"definitions"
|
|
3064
3064
|
]);
|
|
3065
|
-
function getJsonPointer(parsedRef, { baseId, schema:
|
|
3065
|
+
function getJsonPointer(parsedRef, { baseId, schema: schema5, root }) {
|
|
3066
3066
|
var _a4;
|
|
3067
3067
|
if (((_a4 = parsedRef.fragment) === null || _a4 === void 0 ? void 0 : _a4[0]) !== "/")
|
|
3068
3068
|
return;
|
|
3069
3069
|
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
3070
|
-
if (typeof
|
|
3070
|
+
if (typeof schema5 === "boolean")
|
|
3071
3071
|
return;
|
|
3072
|
-
const partSchema =
|
|
3072
|
+
const partSchema = schema5[(0, util_1.unescapeFragment)(part)];
|
|
3073
3073
|
if (partSchema === void 0)
|
|
3074
3074
|
return;
|
|
3075
|
-
|
|
3076
|
-
const schId = typeof
|
|
3075
|
+
schema5 = partSchema;
|
|
3076
|
+
const schId = typeof schema5 === "object" && schema5[this.opts.schemaId];
|
|
3077
3077
|
if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
|
|
3078
3078
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
3079
3079
|
}
|
|
3080
3080
|
}
|
|
3081
3081
|
let env;
|
|
3082
|
-
if (typeof
|
|
3083
|
-
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId,
|
|
3082
|
+
if (typeof schema5 != "boolean" && schema5.$ref && !(0, util_1.schemaHasRulesButRef)(schema5, this.RULES)) {
|
|
3083
|
+
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema5.$ref);
|
|
3084
3084
|
env = resolveSchema.call(this, root, $ref);
|
|
3085
3085
|
}
|
|
3086
3086
|
const { schemaId } = this.opts;
|
|
3087
|
-
env = env || new SchemaEnv({ schema:
|
|
3087
|
+
env = env || new SchemaEnv({ schema: schema5, schemaId, root, baseId });
|
|
3088
3088
|
if (env.schema !== env.root.schema)
|
|
3089
3089
|
return env;
|
|
3090
3090
|
return void 0;
|
|
@@ -3784,18 +3784,18 @@ var require_fast_uri = __commonJS({
|
|
|
3784
3784
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
3785
3785
|
var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
|
|
3786
3786
|
var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
|
|
3787
|
-
function getParseError(
|
|
3788
|
-
if (matches[2] !== void 0 &&
|
|
3787
|
+
function getParseError(parsed2, matches) {
|
|
3788
|
+
if (matches[2] !== void 0 && parsed2.path && parsed2.path[0] !== "/") {
|
|
3789
3789
|
return 'URI path must start with "/" when authority is present.';
|
|
3790
3790
|
}
|
|
3791
|
-
if (typeof
|
|
3791
|
+
if (typeof parsed2.port === "number" && (parsed2.port < 0 || parsed2.port > 65535)) {
|
|
3792
3792
|
return "URI port is malformed.";
|
|
3793
3793
|
}
|
|
3794
3794
|
return void 0;
|
|
3795
3795
|
}
|
|
3796
3796
|
function parseWithStatus(uri, opts) {
|
|
3797
3797
|
const options = Object.assign({}, opts);
|
|
3798
|
-
const
|
|
3798
|
+
const parsed2 = {
|
|
3799
3799
|
scheme: void 0,
|
|
3800
3800
|
userinfo: void 0,
|
|
3801
3801
|
host: "",
|
|
@@ -3815,7 +3815,7 @@ var require_fast_uri = __commonJS({
|
|
|
3815
3815
|
}
|
|
3816
3816
|
const authorityMatch = uri.match(AUTHORITY_PREFIX);
|
|
3817
3817
|
if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
|
|
3818
|
-
|
|
3818
|
+
parsed2.error = "URI authority must not contain a literal backslash.";
|
|
3819
3819
|
malformedAuthorityOrPort = true;
|
|
3820
3820
|
}
|
|
3821
3821
|
const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
|
|
@@ -3824,90 +3824,90 @@ var require_fast_uri = __commonJS({
|
|
|
3824
3824
|
const normalizedRegion = region.replace(/[\t\n\r]/g, "");
|
|
3825
3825
|
if (normalizedRegion.length >= 2) {
|
|
3826
3826
|
if (normalizedRegion.slice(0, 2) !== "//") {
|
|
3827
|
-
|
|
3827
|
+
parsed2.error = parsed2.error || "URI authority must not contain a literal backslash.";
|
|
3828
3828
|
malformedAuthorityOrPort = true;
|
|
3829
3829
|
} else if (region.length !== normalizedRegion.length) {
|
|
3830
|
-
|
|
3830
|
+
parsed2.error = parsed2.error || "URI authority introducer must not contain whitespace.";
|
|
3831
3831
|
malformedAuthorityOrPort = true;
|
|
3832
3832
|
}
|
|
3833
3833
|
}
|
|
3834
3834
|
}
|
|
3835
3835
|
const matches = uri.match(URI_PARSE);
|
|
3836
3836
|
if (matches) {
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
if (isNaN(
|
|
3845
|
-
|
|
3846
|
-
}
|
|
3847
|
-
const parseError = getParseError(
|
|
3837
|
+
parsed2.scheme = matches[1];
|
|
3838
|
+
parsed2.userinfo = matches[3];
|
|
3839
|
+
parsed2.host = matches[4];
|
|
3840
|
+
parsed2.port = parseInt(matches[5], 10);
|
|
3841
|
+
parsed2.path = matches[6] || "";
|
|
3842
|
+
parsed2.query = matches[7];
|
|
3843
|
+
parsed2.fragment = matches[8];
|
|
3844
|
+
if (isNaN(parsed2.port)) {
|
|
3845
|
+
parsed2.port = matches[5];
|
|
3846
|
+
}
|
|
3847
|
+
const parseError = getParseError(parsed2, matches);
|
|
3848
3848
|
if (parseError !== void 0) {
|
|
3849
|
-
|
|
3849
|
+
parsed2.error = parsed2.error || parseError;
|
|
3850
3850
|
malformedAuthorityOrPort = true;
|
|
3851
3851
|
}
|
|
3852
|
-
if (
|
|
3853
|
-
const ipv4result = isIPv4(
|
|
3852
|
+
if (parsed2.host) {
|
|
3853
|
+
const ipv4result = isIPv4(parsed2.host);
|
|
3854
3854
|
if (ipv4result === false) {
|
|
3855
|
-
const ipv6result = normalizeIPv6(
|
|
3856
|
-
|
|
3855
|
+
const ipv6result = normalizeIPv6(parsed2.host);
|
|
3856
|
+
parsed2.host = ipv6result.host.toLowerCase();
|
|
3857
3857
|
isIP = ipv6result.isIPV6;
|
|
3858
3858
|
} else {
|
|
3859
3859
|
isIP = true;
|
|
3860
3860
|
}
|
|
3861
3861
|
}
|
|
3862
|
-
if (
|
|
3863
|
-
|
|
3864
|
-
} else if (
|
|
3865
|
-
|
|
3866
|
-
} else if (
|
|
3867
|
-
|
|
3862
|
+
if (parsed2.scheme === void 0 && parsed2.userinfo === void 0 && parsed2.host === void 0 && parsed2.port === void 0 && parsed2.query === void 0 && !parsed2.path) {
|
|
3863
|
+
parsed2.reference = "same-document";
|
|
3864
|
+
} else if (parsed2.scheme === void 0) {
|
|
3865
|
+
parsed2.reference = "relative";
|
|
3866
|
+
} else if (parsed2.fragment === void 0) {
|
|
3867
|
+
parsed2.reference = "absolute";
|
|
3868
3868
|
} else {
|
|
3869
|
-
|
|
3869
|
+
parsed2.reference = "uri";
|
|
3870
3870
|
}
|
|
3871
|
-
if (options.reference && options.reference !== "suffix" && options.reference !==
|
|
3872
|
-
|
|
3871
|
+
if (options.reference && options.reference !== "suffix" && options.reference !== parsed2.reference) {
|
|
3872
|
+
parsed2.error = parsed2.error || "URI is not a " + options.reference + " reference.";
|
|
3873
3873
|
}
|
|
3874
|
-
const schemeHandler = getSchemeHandler(options.scheme ||
|
|
3874
|
+
const schemeHandler = getSchemeHandler(options.scheme || parsed2.scheme);
|
|
3875
3875
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
3876
|
-
if (
|
|
3876
|
+
if (parsed2.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed2.host)) {
|
|
3877
3877
|
try {
|
|
3878
|
-
|
|
3878
|
+
parsed2.host = new URL("http://" + parsed2.host).hostname;
|
|
3879
3879
|
} catch (e) {
|
|
3880
|
-
|
|
3880
|
+
parsed2.error = parsed2.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
3881
3881
|
}
|
|
3882
3882
|
}
|
|
3883
3883
|
}
|
|
3884
3884
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
3885
3885
|
if (uri.indexOf("%") !== -1) {
|
|
3886
|
-
if (
|
|
3887
|
-
|
|
3886
|
+
if (parsed2.scheme !== void 0) {
|
|
3887
|
+
parsed2.scheme = unescape(parsed2.scheme);
|
|
3888
3888
|
}
|
|
3889
|
-
if (
|
|
3890
|
-
|
|
3889
|
+
if (parsed2.host !== void 0) {
|
|
3890
|
+
parsed2.host = reescapeHostDelimiters(unescape(parsed2.host), isIP);
|
|
3891
3891
|
}
|
|
3892
3892
|
}
|
|
3893
|
-
if (
|
|
3894
|
-
|
|
3893
|
+
if (parsed2.path) {
|
|
3894
|
+
parsed2.path = normalizePathEncoding(parsed2.path);
|
|
3895
3895
|
}
|
|
3896
|
-
if (
|
|
3896
|
+
if (parsed2.fragment) {
|
|
3897
3897
|
try {
|
|
3898
|
-
|
|
3898
|
+
parsed2.fragment = encodeURI(decodeURIComponent(parsed2.fragment));
|
|
3899
3899
|
} catch {
|
|
3900
|
-
|
|
3900
|
+
parsed2.error = parsed2.error || "URI malformed";
|
|
3901
3901
|
}
|
|
3902
3902
|
}
|
|
3903
3903
|
}
|
|
3904
3904
|
if (schemeHandler && schemeHandler.parse) {
|
|
3905
|
-
schemeHandler.parse(
|
|
3905
|
+
schemeHandler.parse(parsed2, options);
|
|
3906
3906
|
}
|
|
3907
3907
|
} else {
|
|
3908
|
-
|
|
3908
|
+
parsed2.error = parsed2.error || "URI can not be parsed.";
|
|
3909
3909
|
}
|
|
3910
|
-
return { parsed, malformedAuthorityOrPort };
|
|
3910
|
+
return { parsed: parsed2, malformedAuthorityOrPort };
|
|
3911
3911
|
}
|
|
3912
3912
|
function parse4(uri, opts) {
|
|
3913
3913
|
return parseWithStatus(uri, opts).parsed;
|
|
@@ -3916,9 +3916,9 @@ var require_fast_uri = __commonJS({
|
|
|
3916
3916
|
return normalizeStringWithStatus(uri, opts).normalized;
|
|
3917
3917
|
}
|
|
3918
3918
|
function normalizeStringWithStatus(uri, opts) {
|
|
3919
|
-
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
3919
|
+
const { parsed: parsed2, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
3920
3920
|
return {
|
|
3921
|
-
normalized: malformedAuthorityOrPort ? uri : serialize(
|
|
3921
|
+
normalized: malformedAuthorityOrPort ? uri : serialize(parsed2, opts),
|
|
3922
3922
|
malformedAuthorityOrPort
|
|
3923
3923
|
};
|
|
3924
3924
|
}
|
|
@@ -4126,16 +4126,16 @@ var require_core = __commonJS({
|
|
|
4126
4126
|
this.errors = v.errors;
|
|
4127
4127
|
return valid;
|
|
4128
4128
|
}
|
|
4129
|
-
compile(
|
|
4130
|
-
const sch = this._addSchema(
|
|
4129
|
+
compile(schema5, _meta) {
|
|
4130
|
+
const sch = this._addSchema(schema5, _meta);
|
|
4131
4131
|
return sch.validate || this._compileSchemaEnv(sch);
|
|
4132
4132
|
}
|
|
4133
|
-
compileAsync(
|
|
4133
|
+
compileAsync(schema5, meta3) {
|
|
4134
4134
|
if (typeof this.opts.loadSchema != "function") {
|
|
4135
4135
|
throw new Error("options.loadSchema should be a function");
|
|
4136
4136
|
}
|
|
4137
4137
|
const { loadSchema } = this.opts;
|
|
4138
|
-
return runCompileAsync.call(this,
|
|
4138
|
+
return runCompileAsync.call(this, schema5, meta3);
|
|
4139
4139
|
async function runCompileAsync(_schema, _meta) {
|
|
4140
4140
|
await loadMetaSchema.call(this, _schema.$schema);
|
|
4141
4141
|
const sch = this._addSchema(_schema, _meta);
|
|
@@ -4181,37 +4181,37 @@ var require_core = __commonJS({
|
|
|
4181
4181
|
}
|
|
4182
4182
|
}
|
|
4183
4183
|
// Adds schema to the instance
|
|
4184
|
-
addSchema(
|
|
4185
|
-
if (Array.isArray(
|
|
4186
|
-
for (const sch of
|
|
4184
|
+
addSchema(schema5, key, _meta, _validateSchema = this.opts.validateSchema) {
|
|
4185
|
+
if (Array.isArray(schema5)) {
|
|
4186
|
+
for (const sch of schema5)
|
|
4187
4187
|
this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
4188
4188
|
return this;
|
|
4189
4189
|
}
|
|
4190
4190
|
let id;
|
|
4191
|
-
if (typeof
|
|
4191
|
+
if (typeof schema5 === "object") {
|
|
4192
4192
|
const { schemaId } = this.opts;
|
|
4193
|
-
id =
|
|
4193
|
+
id = schema5[schemaId];
|
|
4194
4194
|
if (id !== void 0 && typeof id != "string") {
|
|
4195
4195
|
throw new Error(`schema ${schemaId} must be string`);
|
|
4196
4196
|
}
|
|
4197
4197
|
}
|
|
4198
4198
|
key = (0, resolve_1.normalizeId)(key || id);
|
|
4199
4199
|
this._checkUnique(key);
|
|
4200
|
-
this.schemas[key] = this._addSchema(
|
|
4200
|
+
this.schemas[key] = this._addSchema(schema5, _meta, key, _validateSchema, true);
|
|
4201
4201
|
return this;
|
|
4202
4202
|
}
|
|
4203
4203
|
// Add schema that will be used to validate other schemas
|
|
4204
4204
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
4205
|
-
addMetaSchema(
|
|
4206
|
-
this.addSchema(
|
|
4205
|
+
addMetaSchema(schema5, key, _validateSchema = this.opts.validateSchema) {
|
|
4206
|
+
this.addSchema(schema5, key, true, _validateSchema);
|
|
4207
4207
|
return this;
|
|
4208
4208
|
}
|
|
4209
4209
|
// Validate schema against its meta-schema
|
|
4210
|
-
validateSchema(
|
|
4211
|
-
if (typeof
|
|
4210
|
+
validateSchema(schema5, throwOrLogError) {
|
|
4211
|
+
if (typeof schema5 == "boolean")
|
|
4212
4212
|
return true;
|
|
4213
4213
|
let $schema;
|
|
4214
|
-
$schema =
|
|
4214
|
+
$schema = schema5.$schema;
|
|
4215
4215
|
if ($schema !== void 0 && typeof $schema != "string") {
|
|
4216
4216
|
throw new Error("$schema must be a string");
|
|
4217
4217
|
}
|
|
@@ -4221,7 +4221,7 @@ var require_core = __commonJS({
|
|
|
4221
4221
|
this.errors = null;
|
|
4222
4222
|
return true;
|
|
4223
4223
|
}
|
|
4224
|
-
const valid = this.validate($schema,
|
|
4224
|
+
const valid = this.validate($schema, schema5);
|
|
4225
4225
|
if (!valid && throwOrLogError) {
|
|
4226
4226
|
const message = "schema is invalid: " + this.errorsText();
|
|
4227
4227
|
if (this.opts.validateSchema === "log")
|
|
@@ -4364,9 +4364,9 @@ var require_core = __commonJS({
|
|
|
4364
4364
|
if (typeof rule != "object")
|
|
4365
4365
|
continue;
|
|
4366
4366
|
const { $data } = rule.definition;
|
|
4367
|
-
const
|
|
4368
|
-
if ($data &&
|
|
4369
|
-
keywords[key] = schemaOrData(
|
|
4367
|
+
const schema5 = keywords[key];
|
|
4368
|
+
if ($data && schema5)
|
|
4369
|
+
keywords[key] = schemaOrData(schema5);
|
|
4370
4370
|
}
|
|
4371
4371
|
}
|
|
4372
4372
|
return metaSchema;
|
|
@@ -4384,23 +4384,23 @@ var require_core = __commonJS({
|
|
|
4384
4384
|
}
|
|
4385
4385
|
}
|
|
4386
4386
|
}
|
|
4387
|
-
_addSchema(
|
|
4387
|
+
_addSchema(schema5, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
4388
4388
|
let id;
|
|
4389
4389
|
const { schemaId } = this.opts;
|
|
4390
|
-
if (typeof
|
|
4391
|
-
id =
|
|
4390
|
+
if (typeof schema5 == "object") {
|
|
4391
|
+
id = schema5[schemaId];
|
|
4392
4392
|
} else {
|
|
4393
4393
|
if (this.opts.jtd)
|
|
4394
4394
|
throw new Error("schema must be object");
|
|
4395
|
-
else if (typeof
|
|
4395
|
+
else if (typeof schema5 != "boolean")
|
|
4396
4396
|
throw new Error("schema must be object or boolean");
|
|
4397
4397
|
}
|
|
4398
|
-
let sch = this._cache.get(
|
|
4398
|
+
let sch = this._cache.get(schema5);
|
|
4399
4399
|
if (sch !== void 0)
|
|
4400
4400
|
return sch;
|
|
4401
4401
|
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
4402
|
-
const localRefs = resolve_1.getSchemaRefs.call(this,
|
|
4403
|
-
sch = new compile_1.SchemaEnv({ schema:
|
|
4402
|
+
const localRefs = resolve_1.getSchemaRefs.call(this, schema5, baseId);
|
|
4403
|
+
sch = new compile_1.SchemaEnv({ schema: schema5, schemaId, meta: meta3, baseId, localRefs });
|
|
4404
4404
|
this._cache.set(sch.schema, sch);
|
|
4405
4405
|
if (addSchema && !baseId.startsWith("#")) {
|
|
4406
4406
|
if (baseId)
|
|
@@ -4408,7 +4408,7 @@ var require_core = __commonJS({
|
|
|
4408
4408
|
this.refs[baseId] = sch;
|
|
4409
4409
|
}
|
|
4410
4410
|
if (validateSchema)
|
|
4411
|
-
this.validateSchema(
|
|
4411
|
+
this.validateSchema(schema5, true);
|
|
4412
4412
|
return sch;
|
|
4413
4413
|
}
|
|
4414
4414
|
_checkUnique(id) {
|
|
@@ -4562,8 +4562,8 @@ var require_core = __commonJS({
|
|
|
4562
4562
|
var $dataRef = {
|
|
4563
4563
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
4564
4564
|
};
|
|
4565
|
-
function schemaOrData(
|
|
4566
|
-
return { anyOf: [
|
|
4565
|
+
function schemaOrData(schema5) {
|
|
4566
|
+
return { anyOf: [schema5, $dataRef] };
|
|
4567
4567
|
}
|
|
4568
4568
|
}
|
|
4569
4569
|
});
|
|
@@ -4863,7 +4863,7 @@ var require_pattern = __commonJS({
|
|
|
4863
4863
|
$data: true,
|
|
4864
4864
|
error: error51,
|
|
4865
4865
|
code(cxt) {
|
|
4866
|
-
const { gen: gen2, data, $data, schema:
|
|
4866
|
+
const { gen: gen2, data, $data, schema: schema5, schemaCode, it } = cxt;
|
|
4867
4867
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
4868
4868
|
if ($data) {
|
|
4869
4869
|
const { regExp } = it.opts.code;
|
|
@@ -4872,7 +4872,7 @@ var require_pattern = __commonJS({
|
|
|
4872
4872
|
gen2.try(() => gen2.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen2.assign(valid, false));
|
|
4873
4873
|
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
4874
4874
|
} else {
|
|
4875
|
-
const regExp = (0, code_1.usePattern)(cxt,
|
|
4875
|
+
const regExp = (0, code_1.usePattern)(cxt, schema5);
|
|
4876
4876
|
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
4877
4877
|
}
|
|
4878
4878
|
}
|
|
@@ -4929,11 +4929,11 @@ var require_required = __commonJS({
|
|
|
4929
4929
|
$data: true,
|
|
4930
4930
|
error: error51,
|
|
4931
4931
|
code(cxt) {
|
|
4932
|
-
const { gen: gen2, schema:
|
|
4932
|
+
const { gen: gen2, schema: schema5, schemaCode, data, $data, it } = cxt;
|
|
4933
4933
|
const { opts } = it;
|
|
4934
|
-
if (!$data &&
|
|
4934
|
+
if (!$data && schema5.length === 0)
|
|
4935
4935
|
return;
|
|
4936
|
-
const useLoop =
|
|
4936
|
+
const useLoop = schema5.length >= opts.loopRequired;
|
|
4937
4937
|
if (it.allErrors)
|
|
4938
4938
|
allErrorsMode();
|
|
4939
4939
|
else
|
|
@@ -4941,7 +4941,7 @@ var require_required = __commonJS({
|
|
|
4941
4941
|
if (opts.strictRequired) {
|
|
4942
4942
|
const props = cxt.parentSchema.properties;
|
|
4943
4943
|
const { definedProperties } = cxt.it;
|
|
4944
|
-
for (const requiredKey of
|
|
4944
|
+
for (const requiredKey of schema5) {
|
|
4945
4945
|
if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === void 0 && !definedProperties.has(requiredKey)) {
|
|
4946
4946
|
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
|
4947
4947
|
const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`;
|
|
@@ -4953,7 +4953,7 @@ var require_required = __commonJS({
|
|
|
4953
4953
|
if (useLoop || $data) {
|
|
4954
4954
|
cxt.block$data(codegen_1.nil, loopAllRequired);
|
|
4955
4955
|
} else {
|
|
4956
|
-
for (const prop of
|
|
4956
|
+
for (const prop of schema5) {
|
|
4957
4957
|
(0, code_1.checkReportMissingProp)(cxt, prop);
|
|
4958
4958
|
}
|
|
4959
4959
|
}
|
|
@@ -4965,7 +4965,7 @@ var require_required = __commonJS({
|
|
|
4965
4965
|
cxt.block$data(valid, () => loopUntilMissing(missing, valid));
|
|
4966
4966
|
cxt.ok(valid);
|
|
4967
4967
|
} else {
|
|
4968
|
-
gen2.if((0, code_1.checkMissingProp)(cxt,
|
|
4968
|
+
gen2.if((0, code_1.checkMissingProp)(cxt, schema5, missing));
|
|
4969
4969
|
(0, code_1.reportMissingProp)(cxt, missing);
|
|
4970
4970
|
gen2.else();
|
|
4971
4971
|
}
|
|
@@ -5052,8 +5052,8 @@ var require_uniqueItems = __commonJS({
|
|
|
5052
5052
|
$data: true,
|
|
5053
5053
|
error: error51,
|
|
5054
5054
|
code(cxt) {
|
|
5055
|
-
const { gen: gen2, data, $data, schema:
|
|
5056
|
-
if (!$data && !
|
|
5055
|
+
const { gen: gen2, data, $data, schema: schema5, parentSchema, schemaCode, it } = cxt;
|
|
5056
|
+
if (!$data && !schema5)
|
|
5057
5057
|
return;
|
|
5058
5058
|
const valid = gen2.let("valid");
|
|
5059
5059
|
const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : [];
|
|
@@ -5116,11 +5116,11 @@ var require_const = __commonJS({
|
|
|
5116
5116
|
$data: true,
|
|
5117
5117
|
error: error51,
|
|
5118
5118
|
code(cxt) {
|
|
5119
|
-
const { gen: gen2, data, $data, schemaCode, schema:
|
|
5120
|
-
if ($data ||
|
|
5119
|
+
const { gen: gen2, data, $data, schemaCode, schema: schema5 } = cxt;
|
|
5120
|
+
if ($data || schema5 && typeof schema5 == "object") {
|
|
5121
5121
|
cxt.fail$data((0, codegen_1._)`!${(0, util_1.useFunc)(gen2, equal_1.default)}(${data}, ${schemaCode})`);
|
|
5122
5122
|
} else {
|
|
5123
|
-
cxt.fail((0, codegen_1._)`${
|
|
5123
|
+
cxt.fail((0, codegen_1._)`${schema5} !== ${data}`);
|
|
5124
5124
|
}
|
|
5125
5125
|
}
|
|
5126
5126
|
};
|
|
@@ -5146,10 +5146,10 @@ var require_enum = __commonJS({
|
|
|
5146
5146
|
$data: true,
|
|
5147
5147
|
error: error51,
|
|
5148
5148
|
code(cxt) {
|
|
5149
|
-
const { gen: gen2, data, $data, schema:
|
|
5150
|
-
if (!$data &&
|
|
5149
|
+
const { gen: gen2, data, $data, schema: schema5, schemaCode, it } = cxt;
|
|
5150
|
+
if (!$data && schema5.length === 0)
|
|
5151
5151
|
throw new Error("enum must have non-empty array");
|
|
5152
|
-
const useLoop =
|
|
5152
|
+
const useLoop = schema5.length >= it.opts.loopEnum;
|
|
5153
5153
|
let eql;
|
|
5154
5154
|
const getEql = () => eql !== null && eql !== void 0 ? eql : eql = (0, util_1.useFunc)(gen2, equal_1.default);
|
|
5155
5155
|
let valid;
|
|
@@ -5157,10 +5157,10 @@ var require_enum = __commonJS({
|
|
|
5157
5157
|
valid = gen2.let("valid");
|
|
5158
5158
|
cxt.block$data(valid, loopEnum);
|
|
5159
5159
|
} else {
|
|
5160
|
-
if (!Array.isArray(
|
|
5160
|
+
if (!Array.isArray(schema5))
|
|
5161
5161
|
throw new Error("ajv implementation error");
|
|
5162
5162
|
const vSchema = gen2.const("vSchema", schemaCode);
|
|
5163
|
-
valid = (0, codegen_1.or)(...
|
|
5163
|
+
valid = (0, codegen_1.or)(...schema5.map((_x, i2) => equalCode(vSchema, i2)));
|
|
5164
5164
|
}
|
|
5165
5165
|
cxt.pass(valid);
|
|
5166
5166
|
function loopEnum() {
|
|
@@ -5168,7 +5168,7 @@ var require_enum = __commonJS({
|
|
|
5168
5168
|
gen2.forOf("v", schemaCode, (v) => gen2.if((0, codegen_1._)`${getEql()}(${data}, ${v})`, () => gen2.assign(valid, true).break()));
|
|
5169
5169
|
}
|
|
5170
5170
|
function equalCode(vSchema, i2) {
|
|
5171
|
-
const sch =
|
|
5171
|
+
const sch = schema5[i2];
|
|
5172
5172
|
return typeof sch === "object" && sch !== null ? (0, codegen_1._)`${getEql()}(${data}, ${vSchema}[${i2}])` : (0, codegen_1._)`${data} === ${sch}`;
|
|
5173
5173
|
}
|
|
5174
5174
|
}
|
|
@@ -5244,13 +5244,13 @@ var require_additionalItems = __commonJS({
|
|
|
5244
5244
|
}
|
|
5245
5245
|
};
|
|
5246
5246
|
function validateAdditionalItems(cxt, items) {
|
|
5247
|
-
const { gen: gen2, schema:
|
|
5247
|
+
const { gen: gen2, schema: schema5, data, keyword, it } = cxt;
|
|
5248
5248
|
it.items = true;
|
|
5249
5249
|
const len = gen2.const("len", (0, codegen_1._)`${data}.length`);
|
|
5250
|
-
if (
|
|
5250
|
+
if (schema5 === false) {
|
|
5251
5251
|
cxt.setParams({ len: items.length });
|
|
5252
5252
|
cxt.pass((0, codegen_1._)`${len} <= ${items.length}`);
|
|
5253
|
-
} else if (typeof
|
|
5253
|
+
} else if (typeof schema5 == "object" && !(0, util_1.alwaysValidSchema)(it, schema5)) {
|
|
5254
5254
|
const valid = gen2.var("valid", (0, codegen_1._)`${len} <= ${items.length}`);
|
|
5255
5255
|
gen2.if((0, codegen_1.not)(valid), () => validateItems(valid));
|
|
5256
5256
|
cxt.ok(valid);
|
|
@@ -5283,11 +5283,11 @@ var require_items = __commonJS({
|
|
|
5283
5283
|
schemaType: ["object", "array", "boolean"],
|
|
5284
5284
|
before: "uniqueItems",
|
|
5285
5285
|
code(cxt) {
|
|
5286
|
-
const { schema:
|
|
5287
|
-
if (Array.isArray(
|
|
5288
|
-
return validateTuple(cxt, "additionalItems",
|
|
5286
|
+
const { schema: schema5, it } = cxt;
|
|
5287
|
+
if (Array.isArray(schema5))
|
|
5288
|
+
return validateTuple(cxt, "additionalItems", schema5);
|
|
5289
5289
|
it.items = true;
|
|
5290
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
5290
|
+
if ((0, util_1.alwaysValidSchema)(it, schema5))
|
|
5291
5291
|
return;
|
|
5292
5292
|
cxt.ok((0, code_1.validateArray)(cxt));
|
|
5293
5293
|
}
|
|
@@ -5362,10 +5362,10 @@ var require_items2020 = __commonJS({
|
|
|
5362
5362
|
before: "uniqueItems",
|
|
5363
5363
|
error: error51,
|
|
5364
5364
|
code(cxt) {
|
|
5365
|
-
const { schema:
|
|
5365
|
+
const { schema: schema5, parentSchema, it } = cxt;
|
|
5366
5366
|
const { prefixItems } = parentSchema;
|
|
5367
5367
|
it.items = true;
|
|
5368
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
5368
|
+
if ((0, util_1.alwaysValidSchema)(it, schema5))
|
|
5369
5369
|
return;
|
|
5370
5370
|
if (prefixItems)
|
|
5371
5371
|
(0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);
|
|
@@ -5396,7 +5396,7 @@ var require_contains = __commonJS({
|
|
|
5396
5396
|
trackErrors: true,
|
|
5397
5397
|
error: error51,
|
|
5398
5398
|
code(cxt) {
|
|
5399
|
-
const { gen: gen2, schema:
|
|
5399
|
+
const { gen: gen2, schema: schema5, parentSchema, data, it } = cxt;
|
|
5400
5400
|
let min;
|
|
5401
5401
|
let max2;
|
|
5402
5402
|
const { minContains, maxContains } = parentSchema;
|
|
@@ -5417,7 +5417,7 @@ var require_contains = __commonJS({
|
|
|
5417
5417
|
cxt.fail();
|
|
5418
5418
|
return;
|
|
5419
5419
|
}
|
|
5420
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
5420
|
+
if ((0, util_1.alwaysValidSchema)(it, schema5)) {
|
|
5421
5421
|
let cond = (0, codegen_1._)`${len} >= ${min}`;
|
|
5422
5422
|
if (max2 !== void 0)
|
|
5423
5423
|
cond = (0, codegen_1._)`${cond} && ${len} <= ${max2}`;
|
|
@@ -5502,14 +5502,14 @@ var require_dependencies = __commonJS({
|
|
|
5502
5502
|
validateSchemaDeps(cxt, schDeps);
|
|
5503
5503
|
}
|
|
5504
5504
|
};
|
|
5505
|
-
function splitDependencies({ schema:
|
|
5505
|
+
function splitDependencies({ schema: schema5 }) {
|
|
5506
5506
|
const propertyDeps = {};
|
|
5507
5507
|
const schemaDeps = {};
|
|
5508
|
-
for (const key in
|
|
5508
|
+
for (const key in schema5) {
|
|
5509
5509
|
if (key === "__proto__")
|
|
5510
5510
|
continue;
|
|
5511
|
-
const deps = Array.isArray(
|
|
5512
|
-
deps[key] =
|
|
5511
|
+
const deps = Array.isArray(schema5[key]) ? propertyDeps : schemaDeps;
|
|
5512
|
+
deps[key] = schema5[key];
|
|
5513
5513
|
}
|
|
5514
5514
|
return [propertyDeps, schemaDeps];
|
|
5515
5515
|
}
|
|
@@ -5582,8 +5582,8 @@ var require_propertyNames = __commonJS({
|
|
|
5582
5582
|
schemaType: ["object", "boolean"],
|
|
5583
5583
|
error: error51,
|
|
5584
5584
|
code(cxt) {
|
|
5585
|
-
const { gen: gen2, schema:
|
|
5586
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
5585
|
+
const { gen: gen2, schema: schema5, data, it } = cxt;
|
|
5586
|
+
if ((0, util_1.alwaysValidSchema)(it, schema5))
|
|
5587
5587
|
return;
|
|
5588
5588
|
const valid = gen2.name("valid");
|
|
5589
5589
|
gen2.forIn("key", data, (key) => {
|
|
@@ -5629,12 +5629,12 @@ var require_additionalProperties = __commonJS({
|
|
|
5629
5629
|
trackErrors: true,
|
|
5630
5630
|
error: error51,
|
|
5631
5631
|
code(cxt) {
|
|
5632
|
-
const { gen: gen2, schema:
|
|
5632
|
+
const { gen: gen2, schema: schema5, parentSchema, data, errsCount, it } = cxt;
|
|
5633
5633
|
if (!errsCount)
|
|
5634
5634
|
throw new Error("ajv implementation error");
|
|
5635
5635
|
const { allErrors, opts } = it;
|
|
5636
5636
|
it.props = true;
|
|
5637
|
-
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it,
|
|
5637
|
+
if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema5))
|
|
5638
5638
|
return;
|
|
5639
5639
|
const props = (0, code_1.allSchemaProperties)(parentSchema.properties);
|
|
5640
5640
|
const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);
|
|
@@ -5667,18 +5667,18 @@ var require_additionalProperties = __commonJS({
|
|
|
5667
5667
|
gen2.code((0, codegen_1._)`delete ${data}[${key}]`);
|
|
5668
5668
|
}
|
|
5669
5669
|
function additionalPropertyCode(key) {
|
|
5670
|
-
if (opts.removeAdditional === "all" || opts.removeAdditional &&
|
|
5670
|
+
if (opts.removeAdditional === "all" || opts.removeAdditional && schema5 === false) {
|
|
5671
5671
|
deleteAdditional(key);
|
|
5672
5672
|
return;
|
|
5673
5673
|
}
|
|
5674
|
-
if (
|
|
5674
|
+
if (schema5 === false) {
|
|
5675
5675
|
cxt.setParams({ additionalProperty: key });
|
|
5676
5676
|
cxt.error();
|
|
5677
5677
|
if (!allErrors)
|
|
5678
5678
|
gen2.break();
|
|
5679
5679
|
return;
|
|
5680
5680
|
}
|
|
5681
|
-
if (typeof
|
|
5681
|
+
if (typeof schema5 == "object" && !(0, util_1.alwaysValidSchema)(it, schema5)) {
|
|
5682
5682
|
const valid = gen2.name("valid");
|
|
5683
5683
|
if (opts.removeAdditional === "failing") {
|
|
5684
5684
|
applyAdditionalSchema(key, valid, false);
|
|
@@ -5728,18 +5728,18 @@ var require_properties = __commonJS({
|
|
|
5728
5728
|
type: "object",
|
|
5729
5729
|
schemaType: "object",
|
|
5730
5730
|
code(cxt) {
|
|
5731
|
-
const { gen: gen2, schema:
|
|
5731
|
+
const { gen: gen2, schema: schema5, parentSchema, data, it } = cxt;
|
|
5732
5732
|
if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === void 0) {
|
|
5733
5733
|
additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties"));
|
|
5734
5734
|
}
|
|
5735
|
-
const allProps = (0, code_1.allSchemaProperties)(
|
|
5735
|
+
const allProps = (0, code_1.allSchemaProperties)(schema5);
|
|
5736
5736
|
for (const prop of allProps) {
|
|
5737
5737
|
it.definedProperties.add(prop);
|
|
5738
5738
|
}
|
|
5739
5739
|
if (it.opts.unevaluated && allProps.length && it.props !== true) {
|
|
5740
5740
|
it.props = util_1.mergeEvaluated.props(gen2, (0, util_1.toHash)(allProps), it.props);
|
|
5741
5741
|
}
|
|
5742
|
-
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it,
|
|
5742
|
+
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema5[p]));
|
|
5743
5743
|
if (properties.length === 0)
|
|
5744
5744
|
return;
|
|
5745
5745
|
const valid = gen2.name("valid");
|
|
@@ -5757,7 +5757,7 @@ var require_properties = __commonJS({
|
|
|
5757
5757
|
cxt.ok(valid);
|
|
5758
5758
|
}
|
|
5759
5759
|
function hasDefault(prop) {
|
|
5760
|
-
return it.opts.useDefaults && !it.compositeRule &&
|
|
5760
|
+
return it.opts.useDefaults && !it.compositeRule && schema5[prop].default !== void 0;
|
|
5761
5761
|
}
|
|
5762
5762
|
function applyPropertySchema(prop) {
|
|
5763
5763
|
cxt.subschema({
|
|
@@ -5786,10 +5786,10 @@ var require_patternProperties = __commonJS({
|
|
|
5786
5786
|
type: "object",
|
|
5787
5787
|
schemaType: "object",
|
|
5788
5788
|
code(cxt) {
|
|
5789
|
-
const { gen: gen2, schema:
|
|
5789
|
+
const { gen: gen2, schema: schema5, data, parentSchema, it } = cxt;
|
|
5790
5790
|
const { opts } = it;
|
|
5791
|
-
const patterns = (0, code_1.allSchemaProperties)(
|
|
5792
|
-
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it,
|
|
5791
|
+
const patterns = (0, code_1.allSchemaProperties)(schema5);
|
|
5792
|
+
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema5[p]));
|
|
5793
5793
|
if (patterns.length === 0 || alwaysValidPatterns.length === patterns.length && (!it.opts.unevaluated || it.props === true)) {
|
|
5794
5794
|
return;
|
|
5795
5795
|
}
|
|
@@ -5857,8 +5857,8 @@ var require_not = __commonJS({
|
|
|
5857
5857
|
schemaType: ["object", "boolean"],
|
|
5858
5858
|
trackErrors: true,
|
|
5859
5859
|
code(cxt) {
|
|
5860
|
-
const { gen: gen2, schema:
|
|
5861
|
-
if ((0, util_1.alwaysValidSchema)(it,
|
|
5860
|
+
const { gen: gen2, schema: schema5, it } = cxt;
|
|
5861
|
+
if ((0, util_1.alwaysValidSchema)(it, schema5)) {
|
|
5862
5862
|
cxt.fail();
|
|
5863
5863
|
return;
|
|
5864
5864
|
}
|
|
@@ -5911,12 +5911,12 @@ var require_oneOf = __commonJS({
|
|
|
5911
5911
|
trackErrors: true,
|
|
5912
5912
|
error: error51,
|
|
5913
5913
|
code(cxt) {
|
|
5914
|
-
const { gen: gen2, schema:
|
|
5915
|
-
if (!Array.isArray(
|
|
5914
|
+
const { gen: gen2, schema: schema5, parentSchema, it } = cxt;
|
|
5915
|
+
if (!Array.isArray(schema5))
|
|
5916
5916
|
throw new Error("ajv implementation error");
|
|
5917
5917
|
if (it.opts.discriminator && parentSchema.discriminator)
|
|
5918
5918
|
return;
|
|
5919
|
-
const schArr =
|
|
5919
|
+
const schArr = schema5;
|
|
5920
5920
|
const valid = gen2.let("valid", false);
|
|
5921
5921
|
const passing = gen2.let("passing", null);
|
|
5922
5922
|
const schValid = gen2.name("_valid");
|
|
@@ -5962,11 +5962,11 @@ var require_allOf = __commonJS({
|
|
|
5962
5962
|
keyword: "allOf",
|
|
5963
5963
|
schemaType: "array",
|
|
5964
5964
|
code(cxt) {
|
|
5965
|
-
const { gen: gen2, schema:
|
|
5966
|
-
if (!Array.isArray(
|
|
5965
|
+
const { gen: gen2, schema: schema5, it } = cxt;
|
|
5966
|
+
if (!Array.isArray(schema5))
|
|
5967
5967
|
throw new Error("ajv implementation error");
|
|
5968
5968
|
const valid = gen2.name("valid");
|
|
5969
|
-
|
|
5969
|
+
schema5.forEach((sch, i2) => {
|
|
5970
5970
|
if ((0, util_1.alwaysValidSchema)(it, sch))
|
|
5971
5971
|
return;
|
|
5972
5972
|
const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i2 }, valid);
|
|
@@ -6041,8 +6041,8 @@ var require_if = __commonJS({
|
|
|
6041
6041
|
}
|
|
6042
6042
|
};
|
|
6043
6043
|
function hasSchema(it, keyword) {
|
|
6044
|
-
const
|
|
6045
|
-
return
|
|
6044
|
+
const schema5 = it.schema[keyword];
|
|
6045
|
+
return schema5 !== void 0 && !(0, util_1.alwaysValidSchema)(it, schema5);
|
|
6046
6046
|
}
|
|
6047
6047
|
exports.default = def;
|
|
6048
6048
|
}
|
|
@@ -6131,7 +6131,7 @@ var require_format = __commonJS({
|
|
|
6131
6131
|
$data: true,
|
|
6132
6132
|
error: error51,
|
|
6133
6133
|
code(cxt, ruleType) {
|
|
6134
|
-
const { gen: gen2, data, $data, schema:
|
|
6134
|
+
const { gen: gen2, data, $data, schema: schema5, schemaCode, it } = cxt;
|
|
6135
6135
|
const { opts, errSchemaPath, schemaEnv, self } = it;
|
|
6136
6136
|
if (!opts.validateFormats)
|
|
6137
6137
|
return;
|
|
@@ -6161,7 +6161,7 @@ var require_format = __commonJS({
|
|
|
6161
6161
|
}
|
|
6162
6162
|
}
|
|
6163
6163
|
function validateFormat() {
|
|
6164
|
-
const formatDef = self.formats[
|
|
6164
|
+
const formatDef = self.formats[schema5];
|
|
6165
6165
|
if (!formatDef) {
|
|
6166
6166
|
unknownFormat();
|
|
6167
6167
|
return;
|
|
@@ -6178,12 +6178,12 @@ var require_format = __commonJS({
|
|
|
6178
6178
|
}
|
|
6179
6179
|
throw new Error(unknownMsg());
|
|
6180
6180
|
function unknownMsg() {
|
|
6181
|
-
return `unknown format "${
|
|
6181
|
+
return `unknown format "${schema5}" ignored in schema at path "${errSchemaPath}"`;
|
|
6182
6182
|
}
|
|
6183
6183
|
}
|
|
6184
6184
|
function getFormat(fmtDef) {
|
|
6185
|
-
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(
|
|
6186
|
-
const fmt = gen2.scopeValue("formats", { key:
|
|
6185
|
+
const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema5)}` : void 0;
|
|
6186
|
+
const fmt = gen2.scopeValue("formats", { key: schema5, ref: fmtDef, code });
|
|
6187
6187
|
if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
|
|
6188
6188
|
return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`];
|
|
6189
6189
|
}
|
|
@@ -6294,15 +6294,15 @@ var require_discriminator = __commonJS({
|
|
|
6294
6294
|
schemaType: "object",
|
|
6295
6295
|
error: error51,
|
|
6296
6296
|
code(cxt) {
|
|
6297
|
-
const { gen: gen2, data, schema:
|
|
6297
|
+
const { gen: gen2, data, schema: schema5, parentSchema, it } = cxt;
|
|
6298
6298
|
const { oneOf } = parentSchema;
|
|
6299
6299
|
if (!it.opts.discriminator) {
|
|
6300
6300
|
throw new Error("discriminator: requires discriminator option");
|
|
6301
6301
|
}
|
|
6302
|
-
const tagName =
|
|
6302
|
+
const tagName = schema5.propertyName;
|
|
6303
6303
|
if (typeof tagName != "string")
|
|
6304
6304
|
throw new Error("discriminator: requires propertyName");
|
|
6305
|
-
if (
|
|
6305
|
+
if (schema5.mapping)
|
|
6306
6306
|
throw new Error("discriminator: mapping is not supported");
|
|
6307
6307
|
if (!oneOf)
|
|
6308
6308
|
throw new Error("discriminator: requires oneOf keyword");
|
|
@@ -6712,11 +6712,15 @@ async function harden(path2, directory) {
|
|
|
6712
6712
|
await chmod(path2, directory ? 448 : 384);
|
|
6713
6713
|
}
|
|
6714
6714
|
}
|
|
6715
|
-
async function writeExclusiveProtectedFile(path2, value) {
|
|
6715
|
+
async function writeExclusiveProtectedFile(path2, value, diagnostic) {
|
|
6716
6716
|
const target = resolve(path2);
|
|
6717
6717
|
const parent = dirname(target);
|
|
6718
|
+
const refuse = (code, cause) => new CliStateError(code, {
|
|
6719
|
+
...cause === void 0 ? {} : { cause },
|
|
6720
|
+
...diagnostic === void 0 ? {} : { diagnostic }
|
|
6721
|
+
});
|
|
6718
6722
|
if (!isAbsolute(path2) || parse(target).root === target) {
|
|
6719
|
-
throw
|
|
6723
|
+
throw refuse("CLI_STATE_PERMISSIONS_INVALID");
|
|
6720
6724
|
}
|
|
6721
6725
|
let handle;
|
|
6722
6726
|
let created = false;
|
|
@@ -6728,14 +6732,14 @@ async function writeExclusiveProtectedFile(path2, value) {
|
|
|
6728
6732
|
const opened = await handle.stat();
|
|
6729
6733
|
const pathAfterOpen = await lstat(target);
|
|
6730
6734
|
if (!opened.isFile() || opened.nlink !== 1 || !sameIdentity(opened, pathAfterOpen)) {
|
|
6731
|
-
throw
|
|
6735
|
+
throw refuse("CLI_STATE_PERMISSIONS_INVALID");
|
|
6732
6736
|
}
|
|
6733
6737
|
await defaultPermissionPolicy.hardenNew(target, false);
|
|
6734
6738
|
await defaultPermissionPolicy.verify(target, false);
|
|
6735
6739
|
const openedAfterAcl = await handle.stat();
|
|
6736
6740
|
const pathAfterAcl = await lstat(target);
|
|
6737
6741
|
if (!sameIdentity(opened, openedAfterAcl) || !sameIdentity(opened, pathAfterAcl) || openedAfterAcl.nlink !== 1) {
|
|
6738
|
-
throw
|
|
6742
|
+
throw refuse("CLI_STATE_PERMISSIONS_INVALID");
|
|
6739
6743
|
}
|
|
6740
6744
|
await handle.writeFile(value);
|
|
6741
6745
|
await handle.sync();
|
|
@@ -6745,13 +6749,13 @@ async function writeExclusiveProtectedFile(path2, value) {
|
|
|
6745
6749
|
} catch (cause) {
|
|
6746
6750
|
await handle?.close().catch(() => void 0);
|
|
6747
6751
|
if (cause.code === "EEXIST") {
|
|
6748
|
-
throw
|
|
6752
|
+
throw refuse("CLI_STATE_CONFLICT", cause);
|
|
6749
6753
|
}
|
|
6750
6754
|
if (created) {
|
|
6751
6755
|
await rm(target, { force: true }).catch(() => void 0);
|
|
6752
6756
|
await defaultSyncDirectory(parent).catch(() => void 0);
|
|
6753
6757
|
}
|
|
6754
|
-
throw permissionFailure(cause);
|
|
6758
|
+
throw permissionFailure(cause, diagnostic);
|
|
6755
6759
|
}
|
|
6756
6760
|
}
|
|
6757
6761
|
async function assertSafeNode(path2, directory) {
|
|
@@ -6799,8 +6803,14 @@ async function assertSafePathComponents(path2) {
|
|
|
6799
6803
|
}
|
|
6800
6804
|
}
|
|
6801
6805
|
}
|
|
6802
|
-
function permissionFailure(cause) {
|
|
6803
|
-
|
|
6806
|
+
function permissionFailure(cause, diagnostic) {
|
|
6807
|
+
if (cause instanceof CliStateError) {
|
|
6808
|
+
return diagnostic === void 0 || cause.diagnostic !== null ? cause : new CliStateError(cause.code, { cause, diagnostic });
|
|
6809
|
+
}
|
|
6810
|
+
return new CliStateError("CLI_STATE_PERMISSIONS_INVALID", {
|
|
6811
|
+
cause,
|
|
6812
|
+
...diagnostic === void 0 ? {} : { diagnostic }
|
|
6813
|
+
});
|
|
6804
6814
|
}
|
|
6805
6815
|
function sameIdentity(left, right) {
|
|
6806
6816
|
return left.dev === right.dev && left.ino === right.ino;
|
|
@@ -7038,6 +7048,9 @@ $rules = @($acl.Access | ForEach-Object {
|
|
|
7038
7048
|
// src/cli-error.ts
|
|
7039
7049
|
function localFailureMessage(error51) {
|
|
7040
7050
|
if (error51 instanceof CliStateError) {
|
|
7051
|
+
if (error51.diagnostic === "output_destination") {
|
|
7052
|
+
return error51.code === "CLI_STATE_CONFLICT" ? "The requested output file already exists. Choose a path that does not exist yet; Finch never overwrites one." : "The requested output path is not usable. Pass an absolute file path inside a directory you own with mode 0700 and no symbolic links, for example mkdir -m 700 ~/finch-out. Wallet and login state are not involved in this failure.";
|
|
7053
|
+
}
|
|
7041
7054
|
if (error51.code === "CLI_STATE_PERMISSIONS_INVALID") {
|
|
7042
7055
|
return process.platform === "win32" ? "Protected local state has unsafe ownership or ACLs. Restrict it to the current Windows user and retry." : "Protected local state has unsafe permissions. Directories must be mode 0700 and files mode 0600.";
|
|
7043
7056
|
}
|
|
@@ -7073,7 +7086,7 @@ function localFailureMessage(error51) {
|
|
|
7073
7086
|
}
|
|
7074
7087
|
return "Command input does not match the expected schema. Check finch help for this command.";
|
|
7075
7088
|
}
|
|
7076
|
-
var CliAuthorityError, CliProductionUnavailableError, BrowserOpenError, PUBLIC_RECOVERY_COMMAND, CliRecoveryBlockedError, CliSkillSourceError, CliSkillPublicationError;
|
|
7089
|
+
var CliAuthorityError, CliProductionUnavailableError, BrowserOpenError, PUBLIC_RECOVERY_COMMAND, CliRecoveryBlockedError, CliSkillSourceError, CliSkillPresentationStaleError, CliSkillRecoveryUncertainError, CliSkillPublicationError;
|
|
7077
7090
|
var init_cli_error = __esm({
|
|
7078
7091
|
"src/cli-error.ts"() {
|
|
7079
7092
|
"use strict";
|
|
@@ -7122,6 +7135,26 @@ var init_cli_error = __esm({
|
|
|
7122
7135
|
diagnosticCode;
|
|
7123
7136
|
details;
|
|
7124
7137
|
};
|
|
7138
|
+
CliSkillPresentationStaleError = class extends Error {
|
|
7139
|
+
constructor(reason, planVersion, liveVersion) {
|
|
7140
|
+
super(`Skill presentation plan for version ${planVersion} no longer matches the Skill on chain.`);
|
|
7141
|
+
this.reason = reason;
|
|
7142
|
+
this.planVersion = planVersion;
|
|
7143
|
+
this.liveVersion = liveVersion;
|
|
7144
|
+
this.name = "CliSkillPresentationStaleError";
|
|
7145
|
+
}
|
|
7146
|
+
reason;
|
|
7147
|
+
planVersion;
|
|
7148
|
+
liveVersion;
|
|
7149
|
+
};
|
|
7150
|
+
CliSkillRecoveryUncertainError = class extends Error {
|
|
7151
|
+
constructor(detail) {
|
|
7152
|
+
super(`Skill recovery stage ${detail.stage} has no receipt and a ${detail.marker} pre-send marker in a version ${detail.journalVersion} journal.`);
|
|
7153
|
+
this.detail = detail;
|
|
7154
|
+
this.name = "CliSkillRecoveryUncertainError";
|
|
7155
|
+
}
|
|
7156
|
+
detail;
|
|
7157
|
+
};
|
|
7125
7158
|
CliSkillPublicationError = class extends Error {
|
|
7126
7159
|
constructor(diagnostic, cause) {
|
|
7127
7160
|
super(cause instanceof Error ? cause.message : "Skill publication failed.", { cause });
|
|
@@ -10859,6 +10892,15 @@ var init_esm = __esm({
|
|
|
10859
10892
|
}
|
|
10860
10893
|
});
|
|
10861
10894
|
|
|
10895
|
+
// ../../packages/skill-content/src/limits.ts
|
|
10896
|
+
var MAX_SKILL_PACKAGE_BYTES;
|
|
10897
|
+
var init_limits = __esm({
|
|
10898
|
+
"../../packages/skill-content/src/limits.ts"() {
|
|
10899
|
+
"use strict";
|
|
10900
|
+
MAX_SKILL_PACKAGE_BYTES = 30 * 1024 * 1024;
|
|
10901
|
+
}
|
|
10902
|
+
});
|
|
10903
|
+
|
|
10862
10904
|
// ../../packages/skill-content/src/zip.ts
|
|
10863
10905
|
function crc32(bytes) {
|
|
10864
10906
|
let crc = 4294967295;
|
|
@@ -10992,7 +11034,7 @@ function importZip(bytes, maxEntries = MAX_SKILL_IMPORT_FILES) {
|
|
|
10992
11034
|
}
|
|
10993
11035
|
function readZip(bytes, maxEntries) {
|
|
10994
11036
|
if (bytes.length > MAX_SKILL_IMPORT_BYTES) throw new SkillZipInvalidError(
|
|
10995
|
-
|
|
11037
|
+
`ZIP import size exceeds the ${MAX_SKILL_IMPORT_BYTES} byte limit.`,
|
|
10996
11038
|
"archive_too_large",
|
|
10997
11039
|
{ actualBytes: bytes.length, maxBytes: MAX_SKILL_IMPORT_BYTES, sizeBasis: "archive" }
|
|
10998
11040
|
);
|
|
@@ -11053,7 +11095,7 @@ function readZip(bytes, maxEntries) {
|
|
|
11053
11095
|
}
|
|
11054
11096
|
total += expanded;
|
|
11055
11097
|
if (total > MAX_SKILL_IMPORT_BYTES) throw new SkillZipInvalidError(
|
|
11056
|
-
|
|
11098
|
+
`ZIP expanded content exceeds the ${MAX_SKILL_IMPORT_BYTES} byte limit.`,
|
|
11057
11099
|
"expanded_content_too_large",
|
|
11058
11100
|
{ actualBytes: total, maxBytes: MAX_SKILL_IMPORT_BYTES, sizeBasis: "declared_expanded", path: path2 }
|
|
11059
11101
|
);
|
|
@@ -11117,8 +11159,9 @@ var init_zip_import = __esm({
|
|
|
11117
11159
|
"../../packages/skill-content/src/zip-import.ts"() {
|
|
11118
11160
|
"use strict";
|
|
11119
11161
|
init_esm();
|
|
11162
|
+
init_limits();
|
|
11120
11163
|
init_zip();
|
|
11121
|
-
MAX_SKILL_IMPORT_BYTES =
|
|
11164
|
+
MAX_SKILL_IMPORT_BYTES = MAX_SKILL_PACKAGE_BYTES;
|
|
11122
11165
|
MAX_SKILL_IMPORT_FILES = 1024;
|
|
11123
11166
|
SkillZipSymlinkError = class extends RangeError {
|
|
11124
11167
|
constructor(path2) {
|
|
@@ -11558,6 +11601,13 @@ function detailObject(input, name, expectedMediaType, kind) {
|
|
|
11558
11601
|
}
|
|
11559
11602
|
return { uri: value.uri, hash: value.hash, mediaType: value.mediaType, size: Number(value.size) };
|
|
11560
11603
|
}
|
|
11604
|
+
function detailExternalMediaHosts(input, kind) {
|
|
11605
|
+
if (input === void 0) return void 0;
|
|
11606
|
+
if (!Array.isArray(input) || input.length === 0 || input.length > 20 || input.some((host) => typeof host !== "string" || host !== host.toLowerCase() || !DETAIL_MEDIA_HOST.test(host)) || new Set(input).size !== input.length) {
|
|
11607
|
+
throw new RangeError(`Skill ${kind} external media hosts are invalid.`);
|
|
11608
|
+
}
|
|
11609
|
+
return [...input].sort();
|
|
11610
|
+
}
|
|
11561
11611
|
function buildDetailDocuments(input) {
|
|
11562
11612
|
if (input === null || typeof input !== "object" || Array.isArray(input)) {
|
|
11563
11613
|
throw new RangeError("Skill detail documents are invalid.");
|
|
@@ -11575,9 +11625,11 @@ function buildDetailDocuments(input) {
|
|
|
11575
11625
|
throw new RangeError(`Skill ${kind} document is invalid.`);
|
|
11576
11626
|
}
|
|
11577
11627
|
const document2 = raw;
|
|
11578
|
-
|
|
11628
|
+
const shape = Object.keys(document2).sort().join(",");
|
|
11629
|
+
if (shape !== "assets,entry,mode" && shape !== "assets,entry,externalMediaHosts,mode" || document2.mode !== "html" || !Array.isArray(document2.assets) || document2.assets.length > 50) {
|
|
11579
11630
|
throw new RangeError(`Skill ${kind} document is invalid.`);
|
|
11580
11631
|
}
|
|
11632
|
+
const externalMediaHosts = detailExternalMediaHosts(document2.externalMediaHosts, kind);
|
|
11581
11633
|
const entry2 = detailObject(document2.entry, `Skill ${kind} HTML`, "text/html", kind);
|
|
11582
11634
|
const names = /* @__PURE__ */ new Set();
|
|
11583
11635
|
const assets = document2.assets.map((rawAsset) => {
|
|
@@ -11607,7 +11659,7 @@ function buildDetailDocuments(input) {
|
|
|
11607
11659
|
if (entry2.size + assets.reduce((sum, asset) => sum + asset.size, 0) > MAX_SKILL_DETAIL_DOCUMENT_BYTES) {
|
|
11608
11660
|
throw new RangeError(`Skill ${kind} document exceeds 4 MB.`);
|
|
11609
11661
|
}
|
|
11610
|
-
documents[kind] = { mode: "html", entry: entry2, assets };
|
|
11662
|
+
documents[kind] = externalMediaHosts === void 0 ? { mode: "html", entry: entry2, assets } : { mode: "html", entry: entry2, assets, externalMediaHosts };
|
|
11611
11663
|
}
|
|
11612
11664
|
return documents;
|
|
11613
11665
|
}
|
|
@@ -11670,7 +11722,7 @@ function withVersion(manifest4, entry2) {
|
|
|
11670
11722
|
function withPresentation(manifest4, presentation) {
|
|
11671
11723
|
return buildManifest(manifest4.versions, presentation, manifest4.documents);
|
|
11672
11724
|
}
|
|
11673
|
-
var MAX_SKILL_MANIFEST_BYTES, SKILL_MANIFEST_SCHEME, SKILL_DETAIL_KINDS, DETAIL_MEDIA_TYPES, DETAIL_HASH, DETAIL_ASSET_PATH, DETAIL_IPFS_URI, DETAIL_STORAGE_URI, DETAIL_BUCKET_BY_KIND;
|
|
11725
|
+
var MAX_SKILL_MANIFEST_BYTES, SKILL_MANIFEST_SCHEME, SKILL_DETAIL_KINDS, DETAIL_MEDIA_TYPES, DETAIL_HASH, DETAIL_ASSET_PATH, DETAIL_IPFS_URI, DETAIL_STORAGE_URI, DETAIL_BUCKET_BY_KIND, DETAIL_MEDIA_HOST;
|
|
11674
11726
|
var init_manifest = __esm({
|
|
11675
11727
|
"../../packages/skill-content/src/manifest.ts"() {
|
|
11676
11728
|
"use strict";
|
|
@@ -11699,6 +11751,7 @@ var init_manifest = __esm({
|
|
|
11699
11751
|
benchmark: "skill-benchmarks",
|
|
11700
11752
|
showcase: "skill-showcases"
|
|
11701
11753
|
});
|
|
11754
|
+
DETAIL_MEDIA_HOST = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?))+$/u;
|
|
11702
11755
|
}
|
|
11703
11756
|
});
|
|
11704
11757
|
|
|
@@ -11759,6 +11812,7 @@ var init_src2 = __esm({
|
|
|
11759
11812
|
init_delivery_message();
|
|
11760
11813
|
init_detail_documents();
|
|
11761
11814
|
init_image_signature();
|
|
11815
|
+
init_limits();
|
|
11762
11816
|
init_manifest();
|
|
11763
11817
|
init_packaging();
|
|
11764
11818
|
init_static_detail();
|
|
@@ -11962,8 +12016,9 @@ var init_actions = __esm({
|
|
|
11962
12016
|
});
|
|
11963
12017
|
publishIntentRequestSchema = strictObjectSchema({
|
|
11964
12018
|
expectedPublicationGeneration: nonNegativeGenerationSchema,
|
|
11965
|
-
retiredOffers: exactOfferRevisionListSchema
|
|
11966
|
-
|
|
12019
|
+
retiredOffers: exactOfferRevisionListSchema,
|
|
12020
|
+
reviewRequired: { type: "boolean" }
|
|
12021
|
+
}, ["expectedPublicationGeneration", "retiredOffers"]);
|
|
11967
12022
|
offerRetirementIntentRequestSchema = strictObjectSchema({
|
|
11968
12023
|
expectedPublicationGeneration: nonNegativeGenerationSchema
|
|
11969
12024
|
});
|
|
@@ -12345,12 +12400,19 @@ var init_validation_input = __esm({
|
|
|
12345
12400
|
});
|
|
12346
12401
|
|
|
12347
12402
|
// ../../packages/agent-market-contracts/src/v1/errors.ts
|
|
12348
|
-
var agentMarketErrorCodes, nextActionValues, AGENT_MARKET_ERROR_DEFINITIONS, nullableStringSchema, nullableUuidSchema, nullableRevisionSchema2, agentMarketErrorEnvelopeSchema;
|
|
12403
|
+
var creatorRequestReasonCodes, agentMarketErrorCodes, nextActionValues, AGENT_MARKET_ERROR_DEFINITIONS, nullableStringSchema, nullableUuidSchema, nullableRevisionSchema2, agentMarketErrorEnvelopeSchema;
|
|
12349
12404
|
var init_errors = __esm({
|
|
12350
12405
|
"../../packages/agent-market-contracts/src/v1/errors.ts"() {
|
|
12351
12406
|
"use strict";
|
|
12352
12407
|
init_common2();
|
|
12353
12408
|
init_validation_input();
|
|
12409
|
+
creatorRequestReasonCodes = [
|
|
12410
|
+
"creator_request_invalid",
|
|
12411
|
+
"creator_field_invalid",
|
|
12412
|
+
"creator_text_too_long",
|
|
12413
|
+
"creator_text_invalid_unicode",
|
|
12414
|
+
"creator_database_constraint"
|
|
12415
|
+
];
|
|
12354
12416
|
agentMarketErrorCodes = [
|
|
12355
12417
|
"AGENT_MARKET_AUTH_REQUIRED",
|
|
12356
12418
|
"AGENT_MARKET_SCOPE_DENIED",
|
|
@@ -12429,15 +12491,16 @@ var init_errors = __esm({
|
|
|
12429
12491
|
error: strictObjectSchema({
|
|
12430
12492
|
code: { type: "string", enum: agentMarketErrorCodes },
|
|
12431
12493
|
message: { type: "string", minLength: 1, maxLength: 500 },
|
|
12432
|
-
reasonCode: { anyOf: [{ type: "string", enum: validationInputReasonCodes }, { type: "null" }] },
|
|
12494
|
+
reasonCode: { anyOf: [{ type: "string", enum: [...validationInputReasonCodes, ...creatorRequestReasonCodes] }, { type: "null" }] },
|
|
12433
12495
|
retryable: { type: "boolean" },
|
|
12434
12496
|
nextAction: { type: "string", enum: nextActionValues },
|
|
12435
12497
|
state: nullableStringSchema,
|
|
12436
12498
|
operationId: nullableUuidSchema,
|
|
12437
12499
|
currentRevision: nullableRevisionSchema2,
|
|
12438
12500
|
currentEtag: nullableStringSchema,
|
|
12439
|
-
traceId: { type: "string", minLength: 1, maxLength: 128 }
|
|
12440
|
-
|
|
12501
|
+
traceId: { type: "string", minLength: 1, maxLength: 128 },
|
|
12502
|
+
field: nullableStringSchema
|
|
12503
|
+
}, ["code", "message", "reasonCode", "retryable", "nextAction", "state", "operationId", "currentRevision", "currentEtag", "traceId"])
|
|
12441
12504
|
});
|
|
12442
12505
|
}
|
|
12443
12506
|
});
|
|
@@ -14643,60 +14706,31 @@ var init_direct_connection_test = __esm({
|
|
|
14643
14706
|
});
|
|
14644
14707
|
|
|
14645
14708
|
// ../../packages/agent-market-contracts/src/v1/display.ts
|
|
14646
|
-
var DISPLAY_TEXT_CODEC_CONTRACT,
|
|
14709
|
+
var DISPLAY_TEXT_VALID_UNICODE_PATTERN, DISPLAY_TEXT_CODEC_CONTRACT, agentMarketUnicodeTextSchema, agentMarketDisplayNameSchema, agentMarketDescriptionSchema, agentMarketSupportContactSchema, agentMarketRevisionDisplaySchema;
|
|
14647
14710
|
var init_display = __esm({
|
|
14648
14711
|
"../../packages/agent-market-contracts/src/v1/display.ts"() {
|
|
14649
14712
|
"use strict";
|
|
14650
14713
|
init_common2();
|
|
14714
|
+
DISPLAY_TEXT_VALID_UNICODE_PATTERN = "^[^\\u0000\\ud800-\\udfff]*$";
|
|
14651
14715
|
DISPLAY_TEXT_CODEC_CONTRACT = Object.freeze({
|
|
14652
|
-
normalization: "
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
"U+00A0",
|
|
14661
|
-
"U+1680",
|
|
14662
|
-
"U+2000..U+200A",
|
|
14663
|
-
"U+2028",
|
|
14664
|
-
"U+2029",
|
|
14665
|
-
"U+202F",
|
|
14666
|
-
"U+205F",
|
|
14667
|
-
"U+3000",
|
|
14668
|
-
"U+FEFF",
|
|
14669
|
-
"U+D800..U+DFFF"
|
|
14670
|
-
]),
|
|
14671
|
-
descriptionForbiddenCodePoints: Object.freeze([
|
|
14672
|
-
"U+0000..U+0009",
|
|
14673
|
-
"U+000B..U+000C",
|
|
14674
|
-
"U+000E..U+001F",
|
|
14675
|
-
"U+007F..U+009F",
|
|
14676
|
-
"U+00A0",
|
|
14677
|
-
"U+1680",
|
|
14678
|
-
"U+2000..U+200A",
|
|
14679
|
-
"U+2028",
|
|
14680
|
-
"U+2029",
|
|
14681
|
-
"U+202F",
|
|
14682
|
-
"U+205F",
|
|
14683
|
-
"U+3000",
|
|
14684
|
-
"U+FEFF",
|
|
14685
|
-
"U+D800..U+DFFF"
|
|
14686
|
-
])
|
|
14687
|
-
});
|
|
14688
|
-
displayTextSchema = (minBytes, maxBytes, allowStandardLineBreaks = false) => Object.freeze({
|
|
14716
|
+
normalization: "verbatim",
|
|
14717
|
+
displayNameCharacters: Object.freeze({ min: 1, max: 120 }),
|
|
14718
|
+
descriptionCharacters: Object.freeze({ min: 0, max: 2e3 }),
|
|
14719
|
+
preservesWhitespace: true,
|
|
14720
|
+
supportsEmoji: true,
|
|
14721
|
+
unsupportedCodePoints: Object.freeze(["U+0000", "unpaired UTF-16 surrogate"])
|
|
14722
|
+
});
|
|
14723
|
+
agentMarketUnicodeTextSchema = (minCharacters, maxCharacters) => Object.freeze({
|
|
14689
14724
|
type: "string",
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
"x-finch-
|
|
14695
|
-
|
|
14696
|
-
|
|
14697
|
-
|
|
14698
|
-
|
|
14699
|
-
agentMarketSupportContactSchema = displayTextSchema(1, 500);
|
|
14725
|
+
minLength: minCharacters,
|
|
14726
|
+
maxLength: maxCharacters,
|
|
14727
|
+
pattern: DISPLAY_TEXT_VALID_UNICODE_PATTERN,
|
|
14728
|
+
description: `Verbatim Unicode text containing ${minCharacters}..${maxCharacters} characters. Emoji, whitespace and control characters are preserved; U+0000 and malformed UTF-16 are not storable.`,
|
|
14729
|
+
"x-finch-preserve-verbatim": true
|
|
14730
|
+
});
|
|
14731
|
+
agentMarketDisplayNameSchema = agentMarketUnicodeTextSchema(1, 120);
|
|
14732
|
+
agentMarketDescriptionSchema = agentMarketUnicodeTextSchema(0, 2e3);
|
|
14733
|
+
agentMarketSupportContactSchema = agentMarketUnicodeTextSchema(1, 500);
|
|
14700
14734
|
agentMarketRevisionDisplaySchema = strictObjectSchema({
|
|
14701
14735
|
displayName: agentMarketDisplayNameSchema,
|
|
14702
14736
|
description: agentMarketDescriptionSchema
|
|
@@ -15139,17 +15173,18 @@ var init_identity = __esm({
|
|
|
15139
15173
|
});
|
|
15140
15174
|
|
|
15141
15175
|
// ../../packages/agent-market-contracts/src/v1/localization.ts
|
|
15142
|
-
var text2, listingInputRequestSchema, saveListingRequestSchema, listingSaveResponseSchema;
|
|
15176
|
+
var agentMarketMultilineCopySchema, text2, listingInputRequestSchema, saveListingRequestSchema, listingSaveResponseSchema;
|
|
15143
15177
|
var init_localization = __esm({
|
|
15144
15178
|
"../../packages/agent-market-contracts/src/v1/localization.ts"() {
|
|
15145
15179
|
"use strict";
|
|
15146
15180
|
init_common2();
|
|
15147
15181
|
init_display();
|
|
15182
|
+
agentMarketMultilineCopySchema = (maxLength) => agentMarketUnicodeTextSchema(0, maxLength);
|
|
15148
15183
|
text2 = strictObjectSchema({
|
|
15149
|
-
name:
|
|
15150
|
-
description:
|
|
15151
|
-
deliverable:
|
|
15152
|
-
serviceBoundary:
|
|
15184
|
+
name: agentMarketUnicodeTextSchema(1, 120),
|
|
15185
|
+
description: agentMarketMultilineCopySchema(5e3),
|
|
15186
|
+
deliverable: agentMarketMultilineCopySchema(2e3),
|
|
15187
|
+
serviceBoundary: agentMarketMultilineCopySchema(2e3)
|
|
15153
15188
|
}, ["name", "description"]);
|
|
15154
15189
|
listingInputRequestSchema = strictObjectSchema({
|
|
15155
15190
|
inputLocales: {
|
|
@@ -15167,13 +15202,13 @@ var init_localization = __esm({
|
|
|
15167
15202
|
integrationFamily: { enum: ["agenton_v2", "direct_api_v1"] },
|
|
15168
15203
|
displayName: agentMarketDisplayNameSchema,
|
|
15169
15204
|
description: agentMarketDescriptionSchema,
|
|
15170
|
-
supportContact:
|
|
15205
|
+
supportContact: agentMarketUnicodeTextSchema(3, 320),
|
|
15171
15206
|
avatarUri: { type: "string", maxLength: 2048 },
|
|
15172
15207
|
avatarMediaType: { enum: [null, "image/jpeg", "image/png", "image/webp", "video/mp4", "video/webm"] },
|
|
15173
15208
|
category: { type: "string", maxLength: 80 },
|
|
15174
|
-
tags: { type: "array", maxItems: 16, items:
|
|
15175
|
-
deliverable:
|
|
15176
|
-
serviceBoundary:
|
|
15209
|
+
tags: { type: "array", maxItems: 16, items: agentMarketUnicodeTextSchema(1, 80) },
|
|
15210
|
+
deliverable: agentMarketMultilineCopySchema(1e3),
|
|
15211
|
+
serviceBoundary: agentMarketMultilineCopySchema(1e3),
|
|
15177
15212
|
localization: listingInputRequestSchema
|
|
15178
15213
|
}, ["versionRevision", "integrationFamily", "displayName", "description", "supportContact", "avatarUri", "avatarMediaType", "category", "tags", "deliverable", "serviceBoundary"]);
|
|
15179
15214
|
listingSaveResponseSchema = strictObjectSchema({
|
|
@@ -15926,6 +15961,7 @@ var init_public_catalog = __esm({
|
|
|
15926
15961
|
});
|
|
15927
15962
|
publicAgentOnDetailSchema = strictObjectSchema({
|
|
15928
15963
|
...publicSummaryProperties,
|
|
15964
|
+
supportContact: { anyOf: [agentMarketSupportContactSchema, { type: "null" }] },
|
|
15929
15965
|
integrationFamily: { const: "agenton_v2" },
|
|
15930
15966
|
runtimeRevision: positiveRevisionSchema,
|
|
15931
15967
|
runtimeConfigHash: hex32Schema,
|
|
@@ -15937,6 +15973,7 @@ var init_public_catalog = __esm({
|
|
|
15937
15973
|
});
|
|
15938
15974
|
publicDirectDetailSchema = strictObjectSchema({
|
|
15939
15975
|
...publicSummaryProperties,
|
|
15976
|
+
supportContact: { anyOf: [agentMarketSupportContactSchema, { type: "null" }] },
|
|
15940
15977
|
integrationFamily: { const: "direct_api_v1" },
|
|
15941
15978
|
runtimeRevision: positiveRevisionSchema,
|
|
15942
15979
|
runtimeConfigHash: hex32Schema,
|
|
@@ -16919,9 +16956,9 @@ var init_operations = __esm({
|
|
|
16919
16956
|
expectedSha256: "0x483944fda693c326c11d8caa70df5c52e9854eb2ec58e50d5f7483b323fdfe7b"
|
|
16920
16957
|
}),
|
|
16921
16958
|
publication: Object.freeze({
|
|
16922
|
-
byteLength:
|
|
16923
|
-
preimage: '["finch.agent_market.online_request.v1","publish","22222222-2222-4222-8222-222222222222","production",["/api/v1/agent-market/merchant/versions/{versionId}/publish-intents",[["versionId","11111111-1111-4111-8111-111111111111"]]],{"expectedPublicationGeneration":"7","retiredOffers":[],"revisionPrecondition":{"resourceId":"11111111-1111-4111-8111-111111111111","resourceKind":"version","revision":3}}]',
|
|
16924
|
-
expectedSha256: "
|
|
16959
|
+
byteLength: 422,
|
|
16960
|
+
preimage: '["finch.agent_market.online_request.v1","publish","22222222-2222-4222-8222-222222222222","production",["/api/v1/agent-market/merchant/versions/{versionId}/publish-intents",[["versionId","11111111-1111-4111-8111-111111111111"]]],{"expectedPublicationGeneration":"7","retiredOffers":[],"reviewRequired":true,"revisionPrecondition":{"resourceId":"11111111-1111-4111-8111-111111111111","resourceKind":"version","revision":3}}]',
|
|
16961
|
+
expectedSha256: "0xb2bbcd0f6699a5b7c34f1f362eda7a980ba37fb0332786fcc33fcdf31d7e8921"
|
|
16925
16962
|
}),
|
|
16926
16963
|
tamperCases: Object.freeze(["operation_kind", "account", "environment", "route_template", "path_binding_name", "path_binding_value", "path_binding_order", "semantic_body", "revision_r1_r2", "publication_generation", "uuid_case"])
|
|
16927
16964
|
});
|
|
@@ -16940,18 +16977,18 @@ var init_operations = __esm({
|
|
|
16940
16977
|
});
|
|
16941
16978
|
|
|
16942
16979
|
// ../../packages/agent-market-contracts/src/v1/mcp.ts
|
|
16943
|
-
function bodyVariants(
|
|
16944
|
-
if (
|
|
16945
|
-
const candidate =
|
|
16980
|
+
function bodyVariants(schema5) {
|
|
16981
|
+
if (schema5 === void 0) return [{}];
|
|
16982
|
+
const candidate = schema5;
|
|
16946
16983
|
if (candidate.oneOf !== void 0) return candidate.oneOf.flatMap((variant) => bodyVariants(variant));
|
|
16947
16984
|
return [candidate];
|
|
16948
16985
|
}
|
|
16949
16986
|
function unionProperties(variants) {
|
|
16950
16987
|
const candidates = /* @__PURE__ */ new Map();
|
|
16951
16988
|
for (const { properties } of variants) {
|
|
16952
|
-
for (const [field,
|
|
16989
|
+
for (const [field, schema5] of Object.entries(properties ?? {})) {
|
|
16953
16990
|
const alternatives = candidates.get(field) ?? /* @__PURE__ */ new Map();
|
|
16954
|
-
alternatives.set(JSON.stringify(
|
|
16991
|
+
alternatives.set(JSON.stringify(schema5), schema5);
|
|
16955
16992
|
candidates.set(field, alternatives);
|
|
16956
16993
|
}
|
|
16957
16994
|
}
|
|
@@ -17057,12 +17094,12 @@ var init_mcp = __esm({
|
|
|
17057
17094
|
});
|
|
17058
17095
|
|
|
17059
17096
|
// ../../packages/agent-market-contracts/src/v1/openapi.ts
|
|
17060
|
-
function mediaTypeContent(contentType,
|
|
17061
|
-
return { content: { [contentType]: { schema:
|
|
17097
|
+
function mediaTypeContent(contentType, schema5) {
|
|
17098
|
+
return { content: { [contentType]: { schema: schema5 } } };
|
|
17062
17099
|
}
|
|
17063
17100
|
function responseHeaderObjects(schemas) {
|
|
17064
17101
|
return Object.fromEntries(
|
|
17065
|
-
Object.entries(schemas).map(([name,
|
|
17102
|
+
Object.entries(schemas).map(([name, schema5]) => [name, { schema: schema5 }])
|
|
17066
17103
|
);
|
|
17067
17104
|
}
|
|
17068
17105
|
function operationParameters(http3) {
|
|
@@ -17072,16 +17109,16 @@ function operationParameters(http3) {
|
|
|
17072
17109
|
required: true,
|
|
17073
17110
|
schema: canonicalUuidSchema
|
|
17074
17111
|
}));
|
|
17075
|
-
for (const [name,
|
|
17112
|
+
for (const [name, schema5] of Object.entries(http3.querySchema?.properties ?? {})) {
|
|
17076
17113
|
parameters.push({
|
|
17077
17114
|
name,
|
|
17078
17115
|
in: "query",
|
|
17079
17116
|
required: http3.querySchema?.required?.includes(name) ?? false,
|
|
17080
|
-
schema:
|
|
17117
|
+
schema: schema5
|
|
17081
17118
|
});
|
|
17082
17119
|
}
|
|
17083
|
-
for (const [name,
|
|
17084
|
-
parameters.push({ name, in: "header", required: true, schema:
|
|
17120
|
+
for (const [name, schema5] of Object.entries(http3.requestHeaders ?? {})) {
|
|
17121
|
+
parameters.push({ name, in: "header", required: true, schema: schema5 });
|
|
17085
17122
|
}
|
|
17086
17123
|
if (http3.idempotencyRequired) parameters.push({ $ref: "#/components/parameters/IdempotencyKey" });
|
|
17087
17124
|
if (http3.ifMatchRequired) parameters.push({ $ref: "#/components/parameters/IfMatch" });
|
|
@@ -17520,7 +17557,7 @@ var init_schemas = __esm({
|
|
|
17520
17557
|
}, ["content"]);
|
|
17521
17558
|
taskReviewRequestSchema = strictObjectSchema2({
|
|
17522
17559
|
submissionIds: { type: "array", minItems: 1, maxItems: 100, uniqueItems: true, items: canonicalUuidSchema2 },
|
|
17523
|
-
action: { type: "string", enum: ["approve", "reject", "spam", "favorite", "unfavorite"] },
|
|
17560
|
+
action: { type: "string", enum: ["approve", "cancel_award", "reject", "spam", "favorite", "unfavorite"] },
|
|
17524
17561
|
spamReason: { type: "string", maxLength: 200 }
|
|
17525
17562
|
}, ["submissionIds", "action"]);
|
|
17526
17563
|
signedAwardSchema = strictObjectSchema2({
|
|
@@ -17617,24 +17654,24 @@ var init_schemas = __esm({
|
|
|
17617
17654
|
function operation2(value) {
|
|
17618
17655
|
return Object.freeze(value);
|
|
17619
17656
|
}
|
|
17620
|
-
function schemaFields(
|
|
17621
|
-
if (
|
|
17622
|
-
const shape =
|
|
17657
|
+
function schemaFields(schema5) {
|
|
17658
|
+
if (schema5 === void 0) return {};
|
|
17659
|
+
const shape = schema5;
|
|
17623
17660
|
return Object.freeze(Object.assign(
|
|
17624
17661
|
{},
|
|
17625
17662
|
shape.properties ?? {},
|
|
17626
17663
|
...(shape.oneOf ?? []).map((variant) => schemaFields(variant))
|
|
17627
17664
|
));
|
|
17628
17665
|
}
|
|
17629
|
-
function requiredFields(
|
|
17630
|
-
return
|
|
17666
|
+
function requiredFields(schema5) {
|
|
17667
|
+
return schema5?.required ?? [];
|
|
17631
17668
|
}
|
|
17632
17669
|
function inputSchema(fields, required4, body) {
|
|
17633
|
-
const
|
|
17670
|
+
const schema5 = strictObjectSchema2(fields, required4);
|
|
17634
17671
|
const variants = body?.oneOf ?? [];
|
|
17635
|
-
if (variants.length === 0) return
|
|
17672
|
+
if (variants.length === 0) return schema5;
|
|
17636
17673
|
return Object.freeze({
|
|
17637
|
-
...
|
|
17674
|
+
...schema5,
|
|
17638
17675
|
oneOf: variants.map((variant) => Object.freeze({ required: requiredFields(variant) }))
|
|
17639
17676
|
});
|
|
17640
17677
|
}
|
|
@@ -17937,8 +17974,8 @@ function mergeDefs(...defs) {
|
|
|
17937
17974
|
}
|
|
17938
17975
|
return Object.defineProperties({}, mergedDescriptors);
|
|
17939
17976
|
}
|
|
17940
|
-
function cloneDef(
|
|
17941
|
-
return mergeDefs(
|
|
17977
|
+
function cloneDef(schema5) {
|
|
17978
|
+
return mergeDefs(schema5._zod.def);
|
|
17942
17979
|
}
|
|
17943
17980
|
function getElementAtPath(obj, path2) {
|
|
17944
17981
|
if (!path2)
|
|
@@ -18079,14 +18116,14 @@ function optionalKeys(shape) {
|
|
|
18079
18116
|
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
18080
18117
|
});
|
|
18081
18118
|
}
|
|
18082
|
-
function pick(
|
|
18083
|
-
const currDef =
|
|
18119
|
+
function pick(schema5, mask) {
|
|
18120
|
+
const currDef = schema5._zod.def;
|
|
18084
18121
|
const checks = currDef.checks;
|
|
18085
18122
|
const hasChecks = checks && checks.length > 0;
|
|
18086
18123
|
if (hasChecks) {
|
|
18087
18124
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
18088
18125
|
}
|
|
18089
|
-
const def = mergeDefs(
|
|
18126
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18090
18127
|
get shape() {
|
|
18091
18128
|
const newShape = {};
|
|
18092
18129
|
for (const key in mask) {
|
|
@@ -18102,18 +18139,18 @@ function pick(schema4, mask) {
|
|
|
18102
18139
|
},
|
|
18103
18140
|
checks: []
|
|
18104
18141
|
});
|
|
18105
|
-
return clone(
|
|
18142
|
+
return clone(schema5, def);
|
|
18106
18143
|
}
|
|
18107
|
-
function omit(
|
|
18108
|
-
const currDef =
|
|
18144
|
+
function omit(schema5, mask) {
|
|
18145
|
+
const currDef = schema5._zod.def;
|
|
18109
18146
|
const checks = currDef.checks;
|
|
18110
18147
|
const hasChecks = checks && checks.length > 0;
|
|
18111
18148
|
if (hasChecks) {
|
|
18112
18149
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
18113
18150
|
}
|
|
18114
|
-
const def = mergeDefs(
|
|
18151
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18115
18152
|
get shape() {
|
|
18116
|
-
const newShape = { ...
|
|
18153
|
+
const newShape = { ...schema5._zod.def.shape };
|
|
18117
18154
|
for (const key in mask) {
|
|
18118
18155
|
if (!(key in currDef.shape)) {
|
|
18119
18156
|
throw new Error(`Unrecognized key: "${key}"`);
|
|
@@ -18127,43 +18164,43 @@ function omit(schema4, mask) {
|
|
|
18127
18164
|
},
|
|
18128
18165
|
checks: []
|
|
18129
18166
|
});
|
|
18130
|
-
return clone(
|
|
18167
|
+
return clone(schema5, def);
|
|
18131
18168
|
}
|
|
18132
|
-
function extend(
|
|
18169
|
+
function extend(schema5, shape) {
|
|
18133
18170
|
if (!isPlainObject(shape)) {
|
|
18134
18171
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
18135
18172
|
}
|
|
18136
|
-
const checks =
|
|
18173
|
+
const checks = schema5._zod.def.checks;
|
|
18137
18174
|
const hasChecks = checks && checks.length > 0;
|
|
18138
18175
|
if (hasChecks) {
|
|
18139
|
-
const existingShape =
|
|
18176
|
+
const existingShape = schema5._zod.def.shape;
|
|
18140
18177
|
for (const key in shape) {
|
|
18141
18178
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
18142
18179
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
18143
18180
|
}
|
|
18144
18181
|
}
|
|
18145
18182
|
}
|
|
18146
|
-
const def = mergeDefs(
|
|
18183
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18147
18184
|
get shape() {
|
|
18148
|
-
const _shape = { ...
|
|
18185
|
+
const _shape = { ...schema5._zod.def.shape, ...shape };
|
|
18149
18186
|
assignProp(this, "shape", _shape);
|
|
18150
18187
|
return _shape;
|
|
18151
18188
|
}
|
|
18152
18189
|
});
|
|
18153
|
-
return clone(
|
|
18190
|
+
return clone(schema5, def);
|
|
18154
18191
|
}
|
|
18155
|
-
function safeExtend(
|
|
18192
|
+
function safeExtend(schema5, shape) {
|
|
18156
18193
|
if (!isPlainObject(shape)) {
|
|
18157
18194
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
18158
18195
|
}
|
|
18159
|
-
const def = mergeDefs(
|
|
18196
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18160
18197
|
get shape() {
|
|
18161
|
-
const _shape = { ...
|
|
18198
|
+
const _shape = { ...schema5._zod.def.shape, ...shape };
|
|
18162
18199
|
assignProp(this, "shape", _shape);
|
|
18163
18200
|
return _shape;
|
|
18164
18201
|
}
|
|
18165
18202
|
});
|
|
18166
|
-
return clone(
|
|
18203
|
+
return clone(schema5, def);
|
|
18167
18204
|
}
|
|
18168
18205
|
function merge(a, b) {
|
|
18169
18206
|
if (a._zod.def.checks?.length) {
|
|
@@ -18182,16 +18219,16 @@ function merge(a, b) {
|
|
|
18182
18219
|
});
|
|
18183
18220
|
return clone(a, def);
|
|
18184
18221
|
}
|
|
18185
|
-
function partial(Class2,
|
|
18186
|
-
const currDef =
|
|
18222
|
+
function partial(Class2, schema5, mask) {
|
|
18223
|
+
const currDef = schema5._zod.def;
|
|
18187
18224
|
const checks = currDef.checks;
|
|
18188
18225
|
const hasChecks = checks && checks.length > 0;
|
|
18189
18226
|
if (hasChecks) {
|
|
18190
18227
|
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
18191
18228
|
}
|
|
18192
|
-
const def = mergeDefs(
|
|
18229
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18193
18230
|
get shape() {
|
|
18194
|
-
const oldShape =
|
|
18231
|
+
const oldShape = schema5._zod.def.shape;
|
|
18195
18232
|
const shape = { ...oldShape };
|
|
18196
18233
|
if (mask) {
|
|
18197
18234
|
for (const key in mask) {
|
|
@@ -18218,12 +18255,12 @@ function partial(Class2, schema4, mask) {
|
|
|
18218
18255
|
},
|
|
18219
18256
|
checks: []
|
|
18220
18257
|
});
|
|
18221
|
-
return clone(
|
|
18258
|
+
return clone(schema5, def);
|
|
18222
18259
|
}
|
|
18223
|
-
function required(Class2,
|
|
18224
|
-
const def = mergeDefs(
|
|
18260
|
+
function required(Class2, schema5, mask) {
|
|
18261
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18225
18262
|
get shape() {
|
|
18226
|
-
const oldShape =
|
|
18263
|
+
const oldShape = schema5._zod.def.shape;
|
|
18227
18264
|
const shape = { ...oldShape };
|
|
18228
18265
|
if (mask) {
|
|
18229
18266
|
for (const key in mask) {
|
|
@@ -18249,7 +18286,7 @@ function required(Class2, schema4, mask) {
|
|
|
18249
18286
|
return shape;
|
|
18250
18287
|
}
|
|
18251
18288
|
});
|
|
18252
|
-
return clone(
|
|
18289
|
+
return clone(schema5, def);
|
|
18253
18290
|
}
|
|
18254
18291
|
function aborted(x2, startIndex = 0) {
|
|
18255
18292
|
if (x2.aborted === true)
|
|
@@ -18629,9 +18666,9 @@ var init_parse = __esm({
|
|
|
18629
18666
|
init_core();
|
|
18630
18667
|
init_errors2();
|
|
18631
18668
|
init_util();
|
|
18632
|
-
_parse = (_Err) => (
|
|
18669
|
+
_parse = (_Err) => (schema5, value, _ctx, _params) => {
|
|
18633
18670
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
18634
|
-
const result2 =
|
|
18671
|
+
const result2 = schema5._zod.run({ value, issues: [] }, ctx);
|
|
18635
18672
|
if (result2 instanceof Promise) {
|
|
18636
18673
|
throw new $ZodAsyncError();
|
|
18637
18674
|
}
|
|
@@ -18643,9 +18680,9 @@ var init_parse = __esm({
|
|
|
18643
18680
|
return result2.value;
|
|
18644
18681
|
};
|
|
18645
18682
|
parse2 = /* @__PURE__ */ _parse($ZodRealError);
|
|
18646
|
-
_parseAsync = (_Err) => async (
|
|
18683
|
+
_parseAsync = (_Err) => async (schema5, value, _ctx, params) => {
|
|
18647
18684
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
18648
|
-
let result2 =
|
|
18685
|
+
let result2 = schema5._zod.run({ value, issues: [] }, ctx);
|
|
18649
18686
|
if (result2 instanceof Promise)
|
|
18650
18687
|
result2 = await result2;
|
|
18651
18688
|
if (result2.issues.length) {
|
|
@@ -18656,9 +18693,9 @@ var init_parse = __esm({
|
|
|
18656
18693
|
return result2.value;
|
|
18657
18694
|
};
|
|
18658
18695
|
parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
18659
|
-
_safeParse = (_Err) => (
|
|
18696
|
+
_safeParse = (_Err) => (schema5, value, _ctx) => {
|
|
18660
18697
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
18661
|
-
const result2 =
|
|
18698
|
+
const result2 = schema5._zod.run({ value, issues: [] }, ctx);
|
|
18662
18699
|
if (result2 instanceof Promise) {
|
|
18663
18700
|
throw new $ZodAsyncError();
|
|
18664
18701
|
}
|
|
@@ -18668,9 +18705,9 @@ var init_parse = __esm({
|
|
|
18668
18705
|
} : { success: true, data: result2.value };
|
|
18669
18706
|
};
|
|
18670
18707
|
safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
18671
|
-
_safeParseAsync = (_Err) => async (
|
|
18708
|
+
_safeParseAsync = (_Err) => async (schema5, value, _ctx) => {
|
|
18672
18709
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
18673
|
-
let result2 =
|
|
18710
|
+
let result2 = schema5._zod.run({ value, issues: [] }, ctx);
|
|
18674
18711
|
if (result2 instanceof Promise)
|
|
18675
18712
|
result2 = await result2;
|
|
18676
18713
|
return result2.issues.length ? {
|
|
@@ -18679,40 +18716,40 @@ var init_parse = __esm({
|
|
|
18679
18716
|
} : { success: true, data: result2.value };
|
|
18680
18717
|
};
|
|
18681
18718
|
safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
18682
|
-
_encode = (_Err) => (
|
|
18719
|
+
_encode = (_Err) => (schema5, value, _ctx) => {
|
|
18683
18720
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
18684
|
-
return _parse(_Err)(
|
|
18721
|
+
return _parse(_Err)(schema5, value, ctx);
|
|
18685
18722
|
};
|
|
18686
18723
|
encode5 = /* @__PURE__ */ _encode($ZodRealError);
|
|
18687
|
-
_decode = (_Err) => (
|
|
18688
|
-
return _parse(_Err)(
|
|
18724
|
+
_decode = (_Err) => (schema5, value, _ctx) => {
|
|
18725
|
+
return _parse(_Err)(schema5, value, _ctx);
|
|
18689
18726
|
};
|
|
18690
18727
|
decode7 = /* @__PURE__ */ _decode($ZodRealError);
|
|
18691
|
-
_encodeAsync = (_Err) => async (
|
|
18728
|
+
_encodeAsync = (_Err) => async (schema5, value, _ctx) => {
|
|
18692
18729
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
18693
|
-
return _parseAsync(_Err)(
|
|
18730
|
+
return _parseAsync(_Err)(schema5, value, ctx);
|
|
18694
18731
|
};
|
|
18695
18732
|
encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
18696
|
-
_decodeAsync = (_Err) => async (
|
|
18697
|
-
return _parseAsync(_Err)(
|
|
18733
|
+
_decodeAsync = (_Err) => async (schema5, value, _ctx) => {
|
|
18734
|
+
return _parseAsync(_Err)(schema5, value, _ctx);
|
|
18698
18735
|
};
|
|
18699
18736
|
decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
18700
|
-
_safeEncode = (_Err) => (
|
|
18737
|
+
_safeEncode = (_Err) => (schema5, value, _ctx) => {
|
|
18701
18738
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
18702
|
-
return _safeParse(_Err)(
|
|
18739
|
+
return _safeParse(_Err)(schema5, value, ctx);
|
|
18703
18740
|
};
|
|
18704
18741
|
safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
18705
|
-
_safeDecode = (_Err) => (
|
|
18706
|
-
return _safeParse(_Err)(
|
|
18742
|
+
_safeDecode = (_Err) => (schema5, value, _ctx) => {
|
|
18743
|
+
return _safeParse(_Err)(schema5, value, _ctx);
|
|
18707
18744
|
};
|
|
18708
18745
|
safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
18709
|
-
_safeEncodeAsync = (_Err) => async (
|
|
18746
|
+
_safeEncodeAsync = (_Err) => async (schema5, value, _ctx) => {
|
|
18710
18747
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
18711
|
-
return _safeParseAsync(_Err)(
|
|
18748
|
+
return _safeParseAsync(_Err)(schema5, value, ctx);
|
|
18712
18749
|
};
|
|
18713
18750
|
safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
18714
|
-
_safeDecodeAsync = (_Err) => async (
|
|
18715
|
-
return _safeParseAsync(_Err)(
|
|
18751
|
+
_safeDecodeAsync = (_Err) => async (schema5, value, _ctx) => {
|
|
18752
|
+
return _safeParseAsync(_Err)(schema5, value, _ctx);
|
|
18716
18753
|
};
|
|
18717
18754
|
safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
18718
18755
|
}
|
|
@@ -20601,9 +20638,9 @@ var init_schemas2 = __esm({
|
|
|
20601
20638
|
for (const key of normalized.keys) {
|
|
20602
20639
|
const id = ids[key];
|
|
20603
20640
|
const k = esc(key);
|
|
20604
|
-
const
|
|
20605
|
-
const isOptionalIn =
|
|
20606
|
-
const isOptionalOut =
|
|
20641
|
+
const schema5 = shape[key];
|
|
20642
|
+
const isOptionalIn = schema5?._zod?.optin === "optional";
|
|
20643
|
+
const isOptionalOut = schema5?._zod?.optout === "optional";
|
|
20607
20644
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
20608
20645
|
if (isOptionalIn && isOptionalOut) {
|
|
20609
20646
|
doc.write(`
|
|
@@ -27933,11 +27970,11 @@ var init_registries = __esm({
|
|
|
27933
27970
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
27934
27971
|
this._idmap = /* @__PURE__ */ new Map();
|
|
27935
27972
|
}
|
|
27936
|
-
add(
|
|
27973
|
+
add(schema5, ..._meta) {
|
|
27937
27974
|
const meta3 = _meta[0];
|
|
27938
|
-
this._map.set(
|
|
27975
|
+
this._map.set(schema5, meta3);
|
|
27939
27976
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
27940
|
-
this._idmap.set(meta3.id,
|
|
27977
|
+
this._idmap.set(meta3.id, schema5);
|
|
27941
27978
|
}
|
|
27942
27979
|
return this;
|
|
27943
27980
|
}
|
|
@@ -27946,26 +27983,26 @@ var init_registries = __esm({
|
|
|
27946
27983
|
this._idmap = /* @__PURE__ */ new Map();
|
|
27947
27984
|
return this;
|
|
27948
27985
|
}
|
|
27949
|
-
remove(
|
|
27950
|
-
const meta3 = this._map.get(
|
|
27986
|
+
remove(schema5) {
|
|
27987
|
+
const meta3 = this._map.get(schema5);
|
|
27951
27988
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
27952
27989
|
this._idmap.delete(meta3.id);
|
|
27953
27990
|
}
|
|
27954
|
-
this._map.delete(
|
|
27991
|
+
this._map.delete(schema5);
|
|
27955
27992
|
return this;
|
|
27956
27993
|
}
|
|
27957
|
-
get(
|
|
27958
|
-
const p =
|
|
27994
|
+
get(schema5) {
|
|
27995
|
+
const p = schema5._zod.parent;
|
|
27959
27996
|
if (p) {
|
|
27960
27997
|
const pm = { ...this.get(p) ?? {} };
|
|
27961
27998
|
delete pm.id;
|
|
27962
|
-
const f = { ...pm, ...this._map.get(
|
|
27999
|
+
const f = { ...pm, ...this._map.get(schema5) };
|
|
27963
28000
|
return Object.keys(f).length ? f : void 0;
|
|
27964
28001
|
}
|
|
27965
|
-
return this._map.get(
|
|
28002
|
+
return this._map.get(schema5);
|
|
27966
28003
|
}
|
|
27967
|
-
has(
|
|
27968
|
-
return this._map.has(
|
|
28004
|
+
has(schema5) {
|
|
28005
|
+
return this._map.has(schema5);
|
|
27969
28006
|
}
|
|
27970
28007
|
};
|
|
27971
28008
|
(_a3 = globalThis).__zod_globalRegistry ?? (_a3.__zod_globalRegistry = registry());
|
|
@@ -28610,11 +28647,11 @@ function _endsWith(suffix, params) {
|
|
|
28610
28647
|
});
|
|
28611
28648
|
}
|
|
28612
28649
|
// @__NO_SIDE_EFFECTS__
|
|
28613
|
-
function _property(property,
|
|
28650
|
+
function _property(property, schema5, params) {
|
|
28614
28651
|
return new $ZodCheckProperty({
|
|
28615
28652
|
check: "property",
|
|
28616
28653
|
property,
|
|
28617
|
-
schema:
|
|
28654
|
+
schema: schema5,
|
|
28618
28655
|
...normalizeParams(params)
|
|
28619
28656
|
});
|
|
28620
28657
|
}
|
|
@@ -28862,23 +28899,23 @@ function _promise(Class2, innerType) {
|
|
|
28862
28899
|
function _custom(Class2, fn, _params) {
|
|
28863
28900
|
const norm = normalizeParams(_params);
|
|
28864
28901
|
norm.abort ?? (norm.abort = true);
|
|
28865
|
-
const
|
|
28902
|
+
const schema5 = new Class2({
|
|
28866
28903
|
type: "custom",
|
|
28867
28904
|
check: "custom",
|
|
28868
28905
|
fn,
|
|
28869
28906
|
...norm
|
|
28870
28907
|
});
|
|
28871
|
-
return
|
|
28908
|
+
return schema5;
|
|
28872
28909
|
}
|
|
28873
28910
|
// @__NO_SIDE_EFFECTS__
|
|
28874
28911
|
function _refine(Class2, fn, _params) {
|
|
28875
|
-
const
|
|
28912
|
+
const schema5 = new Class2({
|
|
28876
28913
|
type: "custom",
|
|
28877
28914
|
check: "custom",
|
|
28878
28915
|
fn,
|
|
28879
28916
|
...normalizeParams(_params)
|
|
28880
28917
|
});
|
|
28881
|
-
return
|
|
28918
|
+
return schema5;
|
|
28882
28919
|
}
|
|
28883
28920
|
// @__NO_SIDE_EFFECTS__
|
|
28884
28921
|
function _superRefine(fn, params) {
|
|
@@ -29043,40 +29080,40 @@ function initializeContext(params) {
|
|
|
29043
29080
|
external: params?.external ?? void 0
|
|
29044
29081
|
};
|
|
29045
29082
|
}
|
|
29046
|
-
function process2(
|
|
29083
|
+
function process2(schema5, ctx, _params = { path: [], schemaPath: [] }) {
|
|
29047
29084
|
var _a4;
|
|
29048
|
-
const def =
|
|
29049
|
-
const seen = ctx.seen.get(
|
|
29085
|
+
const def = schema5._zod.def;
|
|
29086
|
+
const seen = ctx.seen.get(schema5);
|
|
29050
29087
|
if (seen) {
|
|
29051
29088
|
seen.count++;
|
|
29052
|
-
const isCycle = _params.schemaPath.includes(
|
|
29089
|
+
const isCycle = _params.schemaPath.includes(schema5);
|
|
29053
29090
|
if (isCycle) {
|
|
29054
29091
|
seen.cycle = _params.path;
|
|
29055
29092
|
}
|
|
29056
29093
|
return seen.schema;
|
|
29057
29094
|
}
|
|
29058
29095
|
const result2 = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
29059
|
-
ctx.seen.set(
|
|
29060
|
-
const overrideSchema =
|
|
29096
|
+
ctx.seen.set(schema5, result2);
|
|
29097
|
+
const overrideSchema = schema5._zod.toJSONSchema?.();
|
|
29061
29098
|
if (overrideSchema) {
|
|
29062
29099
|
result2.schema = overrideSchema;
|
|
29063
29100
|
} else {
|
|
29064
29101
|
const params = {
|
|
29065
29102
|
..._params,
|
|
29066
|
-
schemaPath: [..._params.schemaPath,
|
|
29103
|
+
schemaPath: [..._params.schemaPath, schema5],
|
|
29067
29104
|
path: _params.path
|
|
29068
29105
|
};
|
|
29069
|
-
if (
|
|
29070
|
-
|
|
29106
|
+
if (schema5._zod.processJSONSchema) {
|
|
29107
|
+
schema5._zod.processJSONSchema(ctx, result2.schema, params);
|
|
29071
29108
|
} else {
|
|
29072
29109
|
const _json = result2.schema;
|
|
29073
29110
|
const processor = ctx.processors[def.type];
|
|
29074
29111
|
if (!processor) {
|
|
29075
29112
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
29076
29113
|
}
|
|
29077
|
-
processor(
|
|
29114
|
+
processor(schema5, ctx, _json, params);
|
|
29078
29115
|
}
|
|
29079
|
-
const parent =
|
|
29116
|
+
const parent = schema5._zod.parent;
|
|
29080
29117
|
if (parent) {
|
|
29081
29118
|
if (!result2.ref)
|
|
29082
29119
|
result2.ref = parent;
|
|
@@ -29084,21 +29121,21 @@ function process2(schema4, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
29084
29121
|
ctx.seen.get(parent).isParent = true;
|
|
29085
29122
|
}
|
|
29086
29123
|
}
|
|
29087
|
-
const meta3 = ctx.metadataRegistry.get(
|
|
29124
|
+
const meta3 = ctx.metadataRegistry.get(schema5);
|
|
29088
29125
|
if (meta3)
|
|
29089
29126
|
Object.assign(result2.schema, meta3);
|
|
29090
|
-
if (ctx.io === "input" && isTransforming(
|
|
29127
|
+
if (ctx.io === "input" && isTransforming(schema5)) {
|
|
29091
29128
|
delete result2.schema.examples;
|
|
29092
29129
|
delete result2.schema.default;
|
|
29093
29130
|
}
|
|
29094
29131
|
if (ctx.io === "input" && "_prefault" in result2.schema)
|
|
29095
29132
|
(_a4 = result2.schema).default ?? (_a4.default = result2.schema._prefault);
|
|
29096
29133
|
delete result2.schema._prefault;
|
|
29097
|
-
const _result = ctx.seen.get(
|
|
29134
|
+
const _result = ctx.seen.get(schema5);
|
|
29098
29135
|
return _result.schema;
|
|
29099
29136
|
}
|
|
29100
|
-
function extractDefs(ctx,
|
|
29101
|
-
const root = ctx.seen.get(
|
|
29137
|
+
function extractDefs(ctx, schema5) {
|
|
29138
|
+
const root = ctx.seen.get(schema5);
|
|
29102
29139
|
if (!root)
|
|
29103
29140
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
29104
29141
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
@@ -29141,11 +29178,11 @@ function extractDefs(ctx, schema4) {
|
|
|
29141
29178
|
seen.def = { ...seen.schema };
|
|
29142
29179
|
if (defId)
|
|
29143
29180
|
seen.defId = defId;
|
|
29144
|
-
const
|
|
29145
|
-
for (const key in
|
|
29146
|
-
delete
|
|
29181
|
+
const schema6 = seen.schema;
|
|
29182
|
+
for (const key in schema6) {
|
|
29183
|
+
delete schema6[key];
|
|
29147
29184
|
}
|
|
29148
|
-
|
|
29185
|
+
schema6.$ref = ref;
|
|
29149
29186
|
};
|
|
29150
29187
|
if (ctx.cycles === "throw") {
|
|
29151
29188
|
for (const entry2 of ctx.seen.entries()) {
|
|
@@ -29159,13 +29196,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29159
29196
|
}
|
|
29160
29197
|
for (const entry2 of ctx.seen.entries()) {
|
|
29161
29198
|
const seen = entry2[1];
|
|
29162
|
-
if (
|
|
29199
|
+
if (schema5 === entry2[0]) {
|
|
29163
29200
|
extractToDef(entry2);
|
|
29164
29201
|
continue;
|
|
29165
29202
|
}
|
|
29166
29203
|
if (ctx.external) {
|
|
29167
29204
|
const ext = ctx.external.registry.get(entry2[0])?.id;
|
|
29168
|
-
if (
|
|
29205
|
+
if (schema5 !== entry2[0] && ext) {
|
|
29169
29206
|
extractToDef(entry2);
|
|
29170
29207
|
continue;
|
|
29171
29208
|
}
|
|
@@ -29187,16 +29224,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29187
29224
|
}
|
|
29188
29225
|
}
|
|
29189
29226
|
}
|
|
29190
|
-
function finalize(ctx,
|
|
29191
|
-
const root = ctx.seen.get(
|
|
29227
|
+
function finalize(ctx, schema5) {
|
|
29228
|
+
const root = ctx.seen.get(schema5);
|
|
29192
29229
|
if (!root)
|
|
29193
29230
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
29194
29231
|
const flattenRef = (zodSchema) => {
|
|
29195
29232
|
const seen = ctx.seen.get(zodSchema);
|
|
29196
29233
|
if (seen.ref === null)
|
|
29197
29234
|
return;
|
|
29198
|
-
const
|
|
29199
|
-
const _cached = { ...
|
|
29235
|
+
const schema6 = seen.def ?? seen.schema;
|
|
29236
|
+
const _cached = { ...schema6 };
|
|
29200
29237
|
const ref = seen.ref;
|
|
29201
29238
|
seen.ref = null;
|
|
29202
29239
|
if (ref) {
|
|
@@ -29204,28 +29241,28 @@ function finalize(ctx, schema4) {
|
|
|
29204
29241
|
const refSeen = ctx.seen.get(ref);
|
|
29205
29242
|
const refSchema = refSeen.schema;
|
|
29206
29243
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
29207
|
-
|
|
29208
|
-
|
|
29244
|
+
schema6.allOf = schema6.allOf ?? [];
|
|
29245
|
+
schema6.allOf.push(refSchema);
|
|
29209
29246
|
} else {
|
|
29210
|
-
Object.assign(
|
|
29247
|
+
Object.assign(schema6, refSchema);
|
|
29211
29248
|
}
|
|
29212
|
-
Object.assign(
|
|
29249
|
+
Object.assign(schema6, _cached);
|
|
29213
29250
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
29214
29251
|
if (isParentRef) {
|
|
29215
|
-
for (const key in
|
|
29252
|
+
for (const key in schema6) {
|
|
29216
29253
|
if (key === "$ref" || key === "allOf")
|
|
29217
29254
|
continue;
|
|
29218
29255
|
if (!(key in _cached)) {
|
|
29219
|
-
delete
|
|
29256
|
+
delete schema6[key];
|
|
29220
29257
|
}
|
|
29221
29258
|
}
|
|
29222
29259
|
}
|
|
29223
29260
|
if (refSchema.$ref && refSeen.def) {
|
|
29224
|
-
for (const key in
|
|
29261
|
+
for (const key in schema6) {
|
|
29225
29262
|
if (key === "$ref" || key === "allOf")
|
|
29226
29263
|
continue;
|
|
29227
|
-
if (key in refSeen.def && JSON.stringify(
|
|
29228
|
-
delete
|
|
29264
|
+
if (key in refSeen.def && JSON.stringify(schema6[key]) === JSON.stringify(refSeen.def[key])) {
|
|
29265
|
+
delete schema6[key];
|
|
29229
29266
|
}
|
|
29230
29267
|
}
|
|
29231
29268
|
}
|
|
@@ -29235,13 +29272,13 @@ function finalize(ctx, schema4) {
|
|
|
29235
29272
|
flattenRef(parent);
|
|
29236
29273
|
const parentSeen = ctx.seen.get(parent);
|
|
29237
29274
|
if (parentSeen?.schema.$ref) {
|
|
29238
|
-
|
|
29275
|
+
schema6.$ref = parentSeen.schema.$ref;
|
|
29239
29276
|
if (parentSeen.def) {
|
|
29240
|
-
for (const key in
|
|
29277
|
+
for (const key in schema6) {
|
|
29241
29278
|
if (key === "$ref" || key === "allOf")
|
|
29242
29279
|
continue;
|
|
29243
|
-
if (key in parentSeen.def && JSON.stringify(
|
|
29244
|
-
delete
|
|
29280
|
+
if (key in parentSeen.def && JSON.stringify(schema6[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
29281
|
+
delete schema6[key];
|
|
29245
29282
|
}
|
|
29246
29283
|
}
|
|
29247
29284
|
}
|
|
@@ -29249,7 +29286,7 @@ function finalize(ctx, schema4) {
|
|
|
29249
29286
|
}
|
|
29250
29287
|
ctx.override({
|
|
29251
29288
|
zodSchema,
|
|
29252
|
-
jsonSchema:
|
|
29289
|
+
jsonSchema: schema6,
|
|
29253
29290
|
path: seen.path ?? []
|
|
29254
29291
|
});
|
|
29255
29292
|
};
|
|
@@ -29267,13 +29304,13 @@ function finalize(ctx, schema4) {
|
|
|
29267
29304
|
} else {
|
|
29268
29305
|
}
|
|
29269
29306
|
if (ctx.external?.uri) {
|
|
29270
|
-
const id = ctx.external.registry.get(
|
|
29307
|
+
const id = ctx.external.registry.get(schema5)?.id;
|
|
29271
29308
|
if (!id)
|
|
29272
29309
|
throw new Error("Schema is missing an `id` property");
|
|
29273
29310
|
result2.$id = ctx.external.uri(id);
|
|
29274
29311
|
}
|
|
29275
29312
|
Object.assign(result2, root.def ?? root.schema);
|
|
29276
|
-
const rootMetaId = ctx.metadataRegistry.get(
|
|
29313
|
+
const rootMetaId = ctx.metadataRegistry.get(schema5)?.id;
|
|
29277
29314
|
if (rootMetaId !== void 0 && result2.id === rootMetaId)
|
|
29278
29315
|
delete result2.id;
|
|
29279
29316
|
const defs = ctx.external?.defs ?? {};
|
|
@@ -29299,10 +29336,10 @@ function finalize(ctx, schema4) {
|
|
|
29299
29336
|
const finalized = JSON.parse(JSON.stringify(result2));
|
|
29300
29337
|
Object.defineProperty(finalized, "~standard", {
|
|
29301
29338
|
value: {
|
|
29302
|
-
...
|
|
29339
|
+
...schema5["~standard"],
|
|
29303
29340
|
jsonSchema: {
|
|
29304
|
-
input: createStandardJSONSchemaMethod(
|
|
29305
|
-
output: createStandardJSONSchemaMethod(
|
|
29341
|
+
input: createStandardJSONSchemaMethod(schema5, "input", ctx.processors),
|
|
29342
|
+
output: createStandardJSONSchemaMethod(schema5, "output", ctx.processors)
|
|
29306
29343
|
}
|
|
29307
29344
|
},
|
|
29308
29345
|
enumerable: false,
|
|
@@ -29370,18 +29407,18 @@ var createToJSONSchemaMethod, createStandardJSONSchemaMethod;
|
|
|
29370
29407
|
var init_to_json_schema = __esm({
|
|
29371
29408
|
"../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js"() {
|
|
29372
29409
|
init_registries();
|
|
29373
|
-
createToJSONSchemaMethod = (
|
|
29410
|
+
createToJSONSchemaMethod = (schema5, processors = {}) => (params) => {
|
|
29374
29411
|
const ctx = initializeContext({ ...params, processors });
|
|
29375
|
-
process2(
|
|
29376
|
-
extractDefs(ctx,
|
|
29377
|
-
return finalize(ctx,
|
|
29412
|
+
process2(schema5, ctx);
|
|
29413
|
+
extractDefs(ctx, schema5);
|
|
29414
|
+
return finalize(ctx, schema5);
|
|
29378
29415
|
};
|
|
29379
|
-
createStandardJSONSchemaMethod = (
|
|
29416
|
+
createStandardJSONSchemaMethod = (schema5, io, processors = {}) => (params) => {
|
|
29380
29417
|
const { libraryOptions, target } = params ?? {};
|
|
29381
29418
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
29382
|
-
process2(
|
|
29383
|
-
extractDefs(ctx,
|
|
29384
|
-
return finalize(ctx,
|
|
29419
|
+
process2(schema5, ctx);
|
|
29420
|
+
extractDefs(ctx, schema5);
|
|
29421
|
+
return finalize(ctx, schema5);
|
|
29385
29422
|
};
|
|
29386
29423
|
}
|
|
29387
29424
|
});
|
|
@@ -29393,8 +29430,8 @@ function toJSONSchema(input, params) {
|
|
|
29393
29430
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
29394
29431
|
const defs = {};
|
|
29395
29432
|
for (const entry2 of registry2._idmap.entries()) {
|
|
29396
|
-
const [_,
|
|
29397
|
-
process2(
|
|
29433
|
+
const [_, schema5] = entry2;
|
|
29434
|
+
process2(schema5, ctx2);
|
|
29398
29435
|
}
|
|
29399
29436
|
const schemas = {};
|
|
29400
29437
|
const external = {
|
|
@@ -29404,9 +29441,9 @@ function toJSONSchema(input, params) {
|
|
|
29404
29441
|
};
|
|
29405
29442
|
ctx2.external = external;
|
|
29406
29443
|
for (const entry2 of registry2._idmap.entries()) {
|
|
29407
|
-
const [key,
|
|
29408
|
-
extractDefs(ctx2,
|
|
29409
|
-
schemas[key] = finalize(ctx2,
|
|
29444
|
+
const [key, schema5] = entry2;
|
|
29445
|
+
extractDefs(ctx2, schema5);
|
|
29446
|
+
schemas[key] = finalize(ctx2, schema5);
|
|
29410
29447
|
}
|
|
29411
29448
|
if (Object.keys(defs).length > 0) {
|
|
29412
29449
|
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
@@ -29434,10 +29471,10 @@ var init_json_schema_processors = __esm({
|
|
|
29434
29471
|
regex: ""
|
|
29435
29472
|
// do not set
|
|
29436
29473
|
};
|
|
29437
|
-
stringProcessor = (
|
|
29474
|
+
stringProcessor = (schema5, ctx, _json, _params) => {
|
|
29438
29475
|
const json2 = _json;
|
|
29439
29476
|
json2.type = "string";
|
|
29440
|
-
const { minimum, maximum, format: format3, patterns, contentEncoding } =
|
|
29477
|
+
const { minimum, maximum, format: format3, patterns, contentEncoding } = schema5._zod.bag;
|
|
29441
29478
|
if (typeof minimum === "number")
|
|
29442
29479
|
json2.minLength = minimum;
|
|
29443
29480
|
if (typeof maximum === "number")
|
|
@@ -29466,9 +29503,9 @@ var init_json_schema_processors = __esm({
|
|
|
29466
29503
|
}
|
|
29467
29504
|
}
|
|
29468
29505
|
};
|
|
29469
|
-
numberProcessor = (
|
|
29506
|
+
numberProcessor = (schema5, ctx, _json, _params) => {
|
|
29470
29507
|
const json2 = _json;
|
|
29471
|
-
const { minimum, maximum, format: format3, multipleOf, exclusiveMaximum, exclusiveMinimum } =
|
|
29508
|
+
const { minimum, maximum, format: format3, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema5._zod.bag;
|
|
29472
29509
|
if (typeof format3 === "string" && format3.includes("int"))
|
|
29473
29510
|
json2.type = "integer";
|
|
29474
29511
|
else
|
|
@@ -29543,8 +29580,8 @@ var init_json_schema_processors = __esm({
|
|
|
29543
29580
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
29544
29581
|
}
|
|
29545
29582
|
};
|
|
29546
|
-
enumProcessor = (
|
|
29547
|
-
const def =
|
|
29583
|
+
enumProcessor = (schema5, _ctx, json2, _params) => {
|
|
29584
|
+
const def = schema5._zod.def;
|
|
29548
29585
|
const values = getEnumValues(def.entries);
|
|
29549
29586
|
if (values.every((v) => typeof v === "number"))
|
|
29550
29587
|
json2.type = "number";
|
|
@@ -29552,8 +29589,8 @@ var init_json_schema_processors = __esm({
|
|
|
29552
29589
|
json2.type = "string";
|
|
29553
29590
|
json2.enum = values;
|
|
29554
29591
|
};
|
|
29555
|
-
literalProcessor = (
|
|
29556
|
-
const def =
|
|
29592
|
+
literalProcessor = (schema5, ctx, json2, _params) => {
|
|
29593
|
+
const def = schema5._zod.def;
|
|
29557
29594
|
const vals = [];
|
|
29558
29595
|
for (const val of def.values) {
|
|
29559
29596
|
if (val === void 0) {
|
|
@@ -29597,22 +29634,22 @@ var init_json_schema_processors = __esm({
|
|
|
29597
29634
|
throw new Error("NaN cannot be represented in JSON Schema");
|
|
29598
29635
|
}
|
|
29599
29636
|
};
|
|
29600
|
-
templateLiteralProcessor = (
|
|
29637
|
+
templateLiteralProcessor = (schema5, _ctx, json2, _params) => {
|
|
29601
29638
|
const _json = json2;
|
|
29602
|
-
const pattern =
|
|
29639
|
+
const pattern = schema5._zod.pattern;
|
|
29603
29640
|
if (!pattern)
|
|
29604
29641
|
throw new Error("Pattern not found in template literal");
|
|
29605
29642
|
_json.type = "string";
|
|
29606
29643
|
_json.pattern = pattern.source;
|
|
29607
29644
|
};
|
|
29608
|
-
fileProcessor = (
|
|
29645
|
+
fileProcessor = (schema5, _ctx, json2, _params) => {
|
|
29609
29646
|
const _json = json2;
|
|
29610
29647
|
const file2 = {
|
|
29611
29648
|
type: "string",
|
|
29612
29649
|
format: "binary",
|
|
29613
29650
|
contentEncoding: "binary"
|
|
29614
29651
|
};
|
|
29615
|
-
const { minimum, maximum, mime } =
|
|
29652
|
+
const { minimum, maximum, mime } = schema5._zod.bag;
|
|
29616
29653
|
if (minimum !== void 0)
|
|
29617
29654
|
file2.minLength = minimum;
|
|
29618
29655
|
if (maximum !== void 0)
|
|
@@ -29657,10 +29694,10 @@ var init_json_schema_processors = __esm({
|
|
|
29657
29694
|
throw new Error("Set cannot be represented in JSON Schema");
|
|
29658
29695
|
}
|
|
29659
29696
|
};
|
|
29660
|
-
arrayProcessor = (
|
|
29697
|
+
arrayProcessor = (schema5, ctx, _json, params) => {
|
|
29661
29698
|
const json2 = _json;
|
|
29662
|
-
const def =
|
|
29663
|
-
const { minimum, maximum } =
|
|
29699
|
+
const def = schema5._zod.def;
|
|
29700
|
+
const { minimum, maximum } = schema5._zod.bag;
|
|
29664
29701
|
if (typeof minimum === "number")
|
|
29665
29702
|
json2.minItems = minimum;
|
|
29666
29703
|
if (typeof maximum === "number")
|
|
@@ -29671,9 +29708,9 @@ var init_json_schema_processors = __esm({
|
|
|
29671
29708
|
path: [...params.path, "items"]
|
|
29672
29709
|
});
|
|
29673
29710
|
};
|
|
29674
|
-
objectProcessor = (
|
|
29711
|
+
objectProcessor = (schema5, ctx, _json, params) => {
|
|
29675
29712
|
const json2 = _json;
|
|
29676
|
-
const def =
|
|
29713
|
+
const def = schema5._zod.def;
|
|
29677
29714
|
json2.type = "object";
|
|
29678
29715
|
json2.properties = {};
|
|
29679
29716
|
const shape = def.shape;
|
|
@@ -29707,8 +29744,8 @@ var init_json_schema_processors = __esm({
|
|
|
29707
29744
|
});
|
|
29708
29745
|
}
|
|
29709
29746
|
};
|
|
29710
|
-
unionProcessor = (
|
|
29711
|
-
const def =
|
|
29747
|
+
unionProcessor = (schema5, ctx, json2, params) => {
|
|
29748
|
+
const def = schema5._zod.def;
|
|
29712
29749
|
const isExclusive = def.inclusive === false;
|
|
29713
29750
|
const options = def.options.map((x2, i2) => process2(x2, ctx, {
|
|
29714
29751
|
...params,
|
|
@@ -29720,8 +29757,8 @@ var init_json_schema_processors = __esm({
|
|
|
29720
29757
|
json2.anyOf = options;
|
|
29721
29758
|
}
|
|
29722
29759
|
};
|
|
29723
|
-
intersectionProcessor = (
|
|
29724
|
-
const def =
|
|
29760
|
+
intersectionProcessor = (schema5, ctx, json2, params) => {
|
|
29761
|
+
const def = schema5._zod.def;
|
|
29725
29762
|
const a = process2(def.left, ctx, {
|
|
29726
29763
|
...params,
|
|
29727
29764
|
path: [...params.path, "allOf", 0]
|
|
@@ -29737,9 +29774,9 @@ var init_json_schema_processors = __esm({
|
|
|
29737
29774
|
];
|
|
29738
29775
|
json2.allOf = allOf;
|
|
29739
29776
|
};
|
|
29740
|
-
tupleProcessor = (
|
|
29777
|
+
tupleProcessor = (schema5, ctx, _json, params) => {
|
|
29741
29778
|
const json2 = _json;
|
|
29742
|
-
const def =
|
|
29779
|
+
const def = schema5._zod.def;
|
|
29743
29780
|
json2.type = "array";
|
|
29744
29781
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
29745
29782
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
@@ -29773,15 +29810,15 @@ var init_json_schema_processors = __esm({
|
|
|
29773
29810
|
json2.additionalItems = rest;
|
|
29774
29811
|
}
|
|
29775
29812
|
}
|
|
29776
|
-
const { minimum, maximum } =
|
|
29813
|
+
const { minimum, maximum } = schema5._zod.bag;
|
|
29777
29814
|
if (typeof minimum === "number")
|
|
29778
29815
|
json2.minItems = minimum;
|
|
29779
29816
|
if (typeof maximum === "number")
|
|
29780
29817
|
json2.maxItems = maximum;
|
|
29781
29818
|
};
|
|
29782
|
-
recordProcessor = (
|
|
29819
|
+
recordProcessor = (schema5, ctx, _json, params) => {
|
|
29783
29820
|
const json2 = _json;
|
|
29784
|
-
const def =
|
|
29821
|
+
const def = schema5._zod.def;
|
|
29785
29822
|
json2.type = "object";
|
|
29786
29823
|
const keyType = def.keyType;
|
|
29787
29824
|
const keyBag = keyType._zod.bag;
|
|
@@ -29815,10 +29852,10 @@ var init_json_schema_processors = __esm({
|
|
|
29815
29852
|
}
|
|
29816
29853
|
}
|
|
29817
29854
|
};
|
|
29818
|
-
nullableProcessor = (
|
|
29819
|
-
const def =
|
|
29855
|
+
nullableProcessor = (schema5, ctx, json2, params) => {
|
|
29856
|
+
const def = schema5._zod.def;
|
|
29820
29857
|
const inner = process2(def.innerType, ctx, params);
|
|
29821
|
-
const seen = ctx.seen.get(
|
|
29858
|
+
const seen = ctx.seen.get(schema5);
|
|
29822
29859
|
if (ctx.target === "openapi-3.0") {
|
|
29823
29860
|
seen.ref = def.innerType;
|
|
29824
29861
|
json2.nullable = true;
|
|
@@ -29826,31 +29863,31 @@ var init_json_schema_processors = __esm({
|
|
|
29826
29863
|
json2.anyOf = [inner, { type: "null" }];
|
|
29827
29864
|
}
|
|
29828
29865
|
};
|
|
29829
|
-
nonoptionalProcessor = (
|
|
29830
|
-
const def =
|
|
29866
|
+
nonoptionalProcessor = (schema5, ctx, _json, params) => {
|
|
29867
|
+
const def = schema5._zod.def;
|
|
29831
29868
|
process2(def.innerType, ctx, params);
|
|
29832
|
-
const seen = ctx.seen.get(
|
|
29869
|
+
const seen = ctx.seen.get(schema5);
|
|
29833
29870
|
seen.ref = def.innerType;
|
|
29834
29871
|
};
|
|
29835
|
-
defaultProcessor = (
|
|
29836
|
-
const def =
|
|
29872
|
+
defaultProcessor = (schema5, ctx, json2, params) => {
|
|
29873
|
+
const def = schema5._zod.def;
|
|
29837
29874
|
process2(def.innerType, ctx, params);
|
|
29838
|
-
const seen = ctx.seen.get(
|
|
29875
|
+
const seen = ctx.seen.get(schema5);
|
|
29839
29876
|
seen.ref = def.innerType;
|
|
29840
29877
|
json2.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
29841
29878
|
};
|
|
29842
|
-
prefaultProcessor = (
|
|
29843
|
-
const def =
|
|
29879
|
+
prefaultProcessor = (schema5, ctx, json2, params) => {
|
|
29880
|
+
const def = schema5._zod.def;
|
|
29844
29881
|
process2(def.innerType, ctx, params);
|
|
29845
|
-
const seen = ctx.seen.get(
|
|
29882
|
+
const seen = ctx.seen.get(schema5);
|
|
29846
29883
|
seen.ref = def.innerType;
|
|
29847
29884
|
if (ctx.io === "input")
|
|
29848
29885
|
json2._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
29849
29886
|
};
|
|
29850
|
-
catchProcessor = (
|
|
29851
|
-
const def =
|
|
29887
|
+
catchProcessor = (schema5, ctx, json2, params) => {
|
|
29888
|
+
const def = schema5._zod.def;
|
|
29852
29889
|
process2(def.innerType, ctx, params);
|
|
29853
|
-
const seen = ctx.seen.get(
|
|
29890
|
+
const seen = ctx.seen.get(schema5);
|
|
29854
29891
|
seen.ref = def.innerType;
|
|
29855
29892
|
let catchValue;
|
|
29856
29893
|
try {
|
|
@@ -29860,37 +29897,37 @@ var init_json_schema_processors = __esm({
|
|
|
29860
29897
|
}
|
|
29861
29898
|
json2.default = catchValue;
|
|
29862
29899
|
};
|
|
29863
|
-
pipeProcessor = (
|
|
29864
|
-
const def =
|
|
29900
|
+
pipeProcessor = (schema5, ctx, _json, params) => {
|
|
29901
|
+
const def = schema5._zod.def;
|
|
29865
29902
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
29866
29903
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
29867
29904
|
process2(innerType, ctx, params);
|
|
29868
|
-
const seen = ctx.seen.get(
|
|
29905
|
+
const seen = ctx.seen.get(schema5);
|
|
29869
29906
|
seen.ref = innerType;
|
|
29870
29907
|
};
|
|
29871
|
-
readonlyProcessor = (
|
|
29872
|
-
const def =
|
|
29908
|
+
readonlyProcessor = (schema5, ctx, json2, params) => {
|
|
29909
|
+
const def = schema5._zod.def;
|
|
29873
29910
|
process2(def.innerType, ctx, params);
|
|
29874
|
-
const seen = ctx.seen.get(
|
|
29911
|
+
const seen = ctx.seen.get(schema5);
|
|
29875
29912
|
seen.ref = def.innerType;
|
|
29876
29913
|
json2.readOnly = true;
|
|
29877
29914
|
};
|
|
29878
|
-
promiseProcessor = (
|
|
29879
|
-
const def =
|
|
29915
|
+
promiseProcessor = (schema5, ctx, _json, params) => {
|
|
29916
|
+
const def = schema5._zod.def;
|
|
29880
29917
|
process2(def.innerType, ctx, params);
|
|
29881
|
-
const seen = ctx.seen.get(
|
|
29918
|
+
const seen = ctx.seen.get(schema5);
|
|
29882
29919
|
seen.ref = def.innerType;
|
|
29883
29920
|
};
|
|
29884
|
-
optionalProcessor = (
|
|
29885
|
-
const def =
|
|
29921
|
+
optionalProcessor = (schema5, ctx, _json, params) => {
|
|
29922
|
+
const def = schema5._zod.def;
|
|
29886
29923
|
process2(def.innerType, ctx, params);
|
|
29887
|
-
const seen = ctx.seen.get(
|
|
29924
|
+
const seen = ctx.seen.get(schema5);
|
|
29888
29925
|
seen.ref = def.innerType;
|
|
29889
29926
|
};
|
|
29890
|
-
lazyProcessor = (
|
|
29891
|
-
const innerType =
|
|
29927
|
+
lazyProcessor = (schema5, ctx, _json, params) => {
|
|
29928
|
+
const innerType = schema5._zod.innerType;
|
|
29892
29929
|
process2(innerType, ctx, params);
|
|
29893
|
-
const seen = ctx.seen.get(
|
|
29930
|
+
const seen = ctx.seen.get(schema5);
|
|
29894
29931
|
seen.ref = innerType;
|
|
29895
29932
|
};
|
|
29896
29933
|
allProcessors = {
|
|
@@ -29994,14 +30031,14 @@ var init_json_schema_generator = __esm({
|
|
|
29994
30031
|
* Process a schema to prepare it for JSON Schema generation.
|
|
29995
30032
|
* This must be called before emit().
|
|
29996
30033
|
*/
|
|
29997
|
-
process(
|
|
29998
|
-
return process2(
|
|
30034
|
+
process(schema5, _params = { path: [], schemaPath: [] }) {
|
|
30035
|
+
return process2(schema5, this.ctx, _params);
|
|
29999
30036
|
}
|
|
30000
30037
|
/**
|
|
30001
30038
|
* Emit the final JSON Schema after processing.
|
|
30002
30039
|
* Must call process() first.
|
|
30003
30040
|
*/
|
|
30004
|
-
emit(
|
|
30041
|
+
emit(schema5, _params) {
|
|
30005
30042
|
if (_params) {
|
|
30006
30043
|
if (_params.cycles)
|
|
30007
30044
|
this.ctx.cycles = _params.cycles;
|
|
@@ -30010,8 +30047,8 @@ var init_json_schema_generator = __esm({
|
|
|
30010
30047
|
if (_params.external)
|
|
30011
30048
|
this.ctx.external = _params.external;
|
|
30012
30049
|
}
|
|
30013
|
-
extractDefs(this.ctx,
|
|
30014
|
-
const result2 = finalize(this.ctx,
|
|
30050
|
+
extractDefs(this.ctx, schema5);
|
|
30051
|
+
const result2 = finalize(this.ctx, schema5);
|
|
30015
30052
|
const { "~standard": _, ...plainResult } = result2;
|
|
30016
30053
|
return plainResult;
|
|
30017
30054
|
}
|
|
@@ -30840,8 +30877,8 @@ function date3(params) {
|
|
|
30840
30877
|
function array(element, params) {
|
|
30841
30878
|
return _array(ZodArray, element, params);
|
|
30842
30879
|
}
|
|
30843
|
-
function keyof(
|
|
30844
|
-
const shape =
|
|
30880
|
+
function keyof(schema5) {
|
|
30881
|
+
const shape = schema5._zod.def.shape;
|
|
30845
30882
|
return _enum2(Object.keys(shape));
|
|
30846
30883
|
}
|
|
30847
30884
|
function object(shape, params) {
|
|
@@ -31156,11 +31193,11 @@ function json(params) {
|
|
|
31156
31193
|
});
|
|
31157
31194
|
return jsonSchema;
|
|
31158
31195
|
}
|
|
31159
|
-
function preprocess(fn,
|
|
31196
|
+
function preprocess(fn, schema5) {
|
|
31160
31197
|
return new ZodPreprocess({
|
|
31161
31198
|
type: "pipe",
|
|
31162
31199
|
in: transform(fn),
|
|
31163
|
-
out:
|
|
31200
|
+
out: schema5
|
|
31164
31201
|
});
|
|
31165
31202
|
}
|
|
31166
31203
|
var _installedGroups, ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodMAC, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodCustomStringFormat, ZodNumber, ZodNumberFormat, ZodBoolean, ZodBigInt, ZodBigIntFormat, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodDate, ZodArray, ZodObject, ZodUnion, ZodXor, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodEnum, ZodLiteral, ZodFile, ZodTransform, ZodOptional, ZodExactOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodSuccess, ZodCatch, ZodNaN, ZodPipe, ZodCodec, ZodPreprocess, ZodReadonly, ZodTemplateLiteral, ZodLazy, ZodPromise, ZodFunction, ZodCustom, describe2, meta2, stringbool;
|
|
@@ -31984,8 +32021,8 @@ var init_compat = __esm({
|
|
|
31984
32021
|
});
|
|
31985
32022
|
|
|
31986
32023
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/from-json-schema.js
|
|
31987
|
-
function detectVersion(
|
|
31988
|
-
const $schema =
|
|
32024
|
+
function detectVersion(schema5, defaultTarget) {
|
|
32025
|
+
const $schema = schema5.$schema;
|
|
31989
32026
|
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
31990
32027
|
return "draft-2020-12";
|
|
31991
32028
|
}
|
|
@@ -32015,27 +32052,27 @@ function resolveRef(ref, ctx) {
|
|
|
32015
32052
|
}
|
|
32016
32053
|
throw new Error(`Reference not found: ${ref}`);
|
|
32017
32054
|
}
|
|
32018
|
-
function convertBaseSchema(
|
|
32019
|
-
if (
|
|
32020
|
-
if (typeof
|
|
32055
|
+
function convertBaseSchema(schema5, ctx) {
|
|
32056
|
+
if (schema5.not !== void 0) {
|
|
32057
|
+
if (typeof schema5.not === "object" && Object.keys(schema5.not).length === 0) {
|
|
32021
32058
|
return z.never();
|
|
32022
32059
|
}
|
|
32023
32060
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
32024
32061
|
}
|
|
32025
|
-
if (
|
|
32062
|
+
if (schema5.unevaluatedItems !== void 0) {
|
|
32026
32063
|
throw new Error("unevaluatedItems is not supported");
|
|
32027
32064
|
}
|
|
32028
|
-
if (
|
|
32065
|
+
if (schema5.unevaluatedProperties !== void 0) {
|
|
32029
32066
|
throw new Error("unevaluatedProperties is not supported");
|
|
32030
32067
|
}
|
|
32031
|
-
if (
|
|
32068
|
+
if (schema5.if !== void 0 || schema5.then !== void 0 || schema5.else !== void 0) {
|
|
32032
32069
|
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
32033
32070
|
}
|
|
32034
|
-
if (
|
|
32071
|
+
if (schema5.dependentSchemas !== void 0 || schema5.dependentRequired !== void 0) {
|
|
32035
32072
|
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
32036
32073
|
}
|
|
32037
|
-
if (
|
|
32038
|
-
const refPath =
|
|
32074
|
+
if (schema5.$ref) {
|
|
32075
|
+
const refPath = schema5.$ref;
|
|
32039
32076
|
if (ctx.refs.has(refPath)) {
|
|
32040
32077
|
return ctx.refs.get(refPath);
|
|
32041
32078
|
}
|
|
@@ -32054,9 +32091,9 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32054
32091
|
ctx.processing.delete(refPath);
|
|
32055
32092
|
return zodSchema2;
|
|
32056
32093
|
}
|
|
32057
|
-
if (
|
|
32058
|
-
const enumValues =
|
|
32059
|
-
if (ctx.version === "openapi-3.0" &&
|
|
32094
|
+
if (schema5.enum !== void 0) {
|
|
32095
|
+
const enumValues = schema5.enum;
|
|
32096
|
+
if (ctx.version === "openapi-3.0" && schema5.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
32060
32097
|
return z.null();
|
|
32061
32098
|
}
|
|
32062
32099
|
if (enumValues.length === 0) {
|
|
@@ -32074,13 +32111,13 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32074
32111
|
}
|
|
32075
32112
|
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
32076
32113
|
}
|
|
32077
|
-
if (
|
|
32078
|
-
return z.literal(
|
|
32114
|
+
if (schema5.const !== void 0) {
|
|
32115
|
+
return z.literal(schema5.const);
|
|
32079
32116
|
}
|
|
32080
|
-
const type =
|
|
32117
|
+
const type = schema5.type;
|
|
32081
32118
|
if (Array.isArray(type)) {
|
|
32082
32119
|
const typeSchemas = type.map((t) => {
|
|
32083
|
-
const typeSchema = { ...
|
|
32120
|
+
const typeSchema = { ...schema5, type: t };
|
|
32084
32121
|
return convertBaseSchema(typeSchema, ctx);
|
|
32085
32122
|
});
|
|
32086
32123
|
if (typeSchemas.length === 0) {
|
|
@@ -32098,8 +32135,8 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32098
32135
|
switch (type) {
|
|
32099
32136
|
case "string": {
|
|
32100
32137
|
let stringSchema = z.string();
|
|
32101
|
-
if (
|
|
32102
|
-
const format3 =
|
|
32138
|
+
if (schema5.format) {
|
|
32139
|
+
const format3 = schema5.format;
|
|
32103
32140
|
if (format3 === "email") {
|
|
32104
32141
|
stringSchema = stringSchema.check(z.email());
|
|
32105
32142
|
} else if (format3 === "uri" || format3 === "uri-reference") {
|
|
@@ -32148,14 +32185,14 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32148
32185
|
stringSchema = stringSchema.check(z.ksuid());
|
|
32149
32186
|
}
|
|
32150
32187
|
}
|
|
32151
|
-
if (typeof
|
|
32152
|
-
stringSchema = stringSchema.min(
|
|
32188
|
+
if (typeof schema5.minLength === "number") {
|
|
32189
|
+
stringSchema = stringSchema.min(schema5.minLength);
|
|
32153
32190
|
}
|
|
32154
|
-
if (typeof
|
|
32155
|
-
stringSchema = stringSchema.max(
|
|
32191
|
+
if (typeof schema5.maxLength === "number") {
|
|
32192
|
+
stringSchema = stringSchema.max(schema5.maxLength);
|
|
32156
32193
|
}
|
|
32157
|
-
if (
|
|
32158
|
-
stringSchema = stringSchema.regex(new RegExp(
|
|
32194
|
+
if (schema5.pattern) {
|
|
32195
|
+
stringSchema = stringSchema.regex(new RegExp(schema5.pattern));
|
|
32159
32196
|
}
|
|
32160
32197
|
zodSchema = stringSchema;
|
|
32161
32198
|
break;
|
|
@@ -32163,24 +32200,24 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32163
32200
|
case "number":
|
|
32164
32201
|
case "integer": {
|
|
32165
32202
|
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
32166
|
-
if (typeof
|
|
32167
|
-
numberSchema = numberSchema.min(
|
|
32203
|
+
if (typeof schema5.minimum === "number") {
|
|
32204
|
+
numberSchema = numberSchema.min(schema5.minimum);
|
|
32168
32205
|
}
|
|
32169
|
-
if (typeof
|
|
32170
|
-
numberSchema = numberSchema.max(
|
|
32206
|
+
if (typeof schema5.maximum === "number") {
|
|
32207
|
+
numberSchema = numberSchema.max(schema5.maximum);
|
|
32171
32208
|
}
|
|
32172
|
-
if (typeof
|
|
32173
|
-
numberSchema = numberSchema.gt(
|
|
32174
|
-
} else if (
|
|
32175
|
-
numberSchema = numberSchema.gt(
|
|
32209
|
+
if (typeof schema5.exclusiveMinimum === "number") {
|
|
32210
|
+
numberSchema = numberSchema.gt(schema5.exclusiveMinimum);
|
|
32211
|
+
} else if (schema5.exclusiveMinimum === true && typeof schema5.minimum === "number") {
|
|
32212
|
+
numberSchema = numberSchema.gt(schema5.minimum);
|
|
32176
32213
|
}
|
|
32177
|
-
if (typeof
|
|
32178
|
-
numberSchema = numberSchema.lt(
|
|
32179
|
-
} else if (
|
|
32180
|
-
numberSchema = numberSchema.lt(
|
|
32214
|
+
if (typeof schema5.exclusiveMaximum === "number") {
|
|
32215
|
+
numberSchema = numberSchema.lt(schema5.exclusiveMaximum);
|
|
32216
|
+
} else if (schema5.exclusiveMaximum === true && typeof schema5.maximum === "number") {
|
|
32217
|
+
numberSchema = numberSchema.lt(schema5.maximum);
|
|
32181
32218
|
}
|
|
32182
|
-
if (typeof
|
|
32183
|
-
numberSchema = numberSchema.multipleOf(
|
|
32219
|
+
if (typeof schema5.multipleOf === "number") {
|
|
32220
|
+
numberSchema = numberSchema.multipleOf(schema5.multipleOf);
|
|
32184
32221
|
}
|
|
32185
32222
|
zodSchema = numberSchema;
|
|
32186
32223
|
break;
|
|
@@ -32195,15 +32232,15 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32195
32232
|
}
|
|
32196
32233
|
case "object": {
|
|
32197
32234
|
const shape = {};
|
|
32198
|
-
const properties =
|
|
32199
|
-
const requiredSet = new Set(
|
|
32235
|
+
const properties = schema5.properties || {};
|
|
32236
|
+
const requiredSet = new Set(schema5.required || []);
|
|
32200
32237
|
for (const [key, propSchema] of Object.entries(properties)) {
|
|
32201
32238
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
32202
32239
|
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
32203
32240
|
}
|
|
32204
|
-
if (
|
|
32205
|
-
const keySchema = convertSchema(
|
|
32206
|
-
const valueSchema =
|
|
32241
|
+
if (schema5.propertyNames) {
|
|
32242
|
+
const keySchema = convertSchema(schema5.propertyNames, ctx);
|
|
32243
|
+
const valueSchema = schema5.additionalProperties && typeof schema5.additionalProperties === "object" ? convertSchema(schema5.additionalProperties, ctx) : z.any();
|
|
32207
32244
|
if (Object.keys(shape).length === 0) {
|
|
32208
32245
|
zodSchema = z.record(keySchema, valueSchema);
|
|
32209
32246
|
break;
|
|
@@ -32213,8 +32250,8 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32213
32250
|
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
32214
32251
|
break;
|
|
32215
32252
|
}
|
|
32216
|
-
if (
|
|
32217
|
-
const patternProps =
|
|
32253
|
+
if (schema5.patternProperties) {
|
|
32254
|
+
const patternProps = schema5.patternProperties;
|
|
32218
32255
|
const patternKeys = Object.keys(patternProps);
|
|
32219
32256
|
const looseRecords = [];
|
|
32220
32257
|
for (const pattern of patternKeys) {
|
|
@@ -32241,18 +32278,18 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32241
32278
|
break;
|
|
32242
32279
|
}
|
|
32243
32280
|
const objectSchema = z.object(shape);
|
|
32244
|
-
if (
|
|
32281
|
+
if (schema5.additionalProperties === false) {
|
|
32245
32282
|
zodSchema = objectSchema.strict();
|
|
32246
|
-
} else if (typeof
|
|
32247
|
-
zodSchema = objectSchema.catchall(convertSchema(
|
|
32283
|
+
} else if (typeof schema5.additionalProperties === "object") {
|
|
32284
|
+
zodSchema = objectSchema.catchall(convertSchema(schema5.additionalProperties, ctx));
|
|
32248
32285
|
} else {
|
|
32249
32286
|
zodSchema = objectSchema.passthrough();
|
|
32250
32287
|
}
|
|
32251
32288
|
break;
|
|
32252
32289
|
}
|
|
32253
32290
|
case "array": {
|
|
32254
|
-
const prefixItems =
|
|
32255
|
-
const items =
|
|
32291
|
+
const prefixItems = schema5.prefixItems;
|
|
32292
|
+
const items = schema5.items;
|
|
32256
32293
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
32257
32294
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
32258
32295
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
@@ -32261,34 +32298,34 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32261
32298
|
} else {
|
|
32262
32299
|
zodSchema = z.tuple(tupleItems);
|
|
32263
32300
|
}
|
|
32264
|
-
if (typeof
|
|
32265
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
32301
|
+
if (typeof schema5.minItems === "number") {
|
|
32302
|
+
zodSchema = zodSchema.check(z.minLength(schema5.minItems));
|
|
32266
32303
|
}
|
|
32267
|
-
if (typeof
|
|
32268
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
32304
|
+
if (typeof schema5.maxItems === "number") {
|
|
32305
|
+
zodSchema = zodSchema.check(z.maxLength(schema5.maxItems));
|
|
32269
32306
|
}
|
|
32270
32307
|
} else if (Array.isArray(items)) {
|
|
32271
32308
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
32272
|
-
const rest =
|
|
32309
|
+
const rest = schema5.additionalItems && typeof schema5.additionalItems === "object" ? convertSchema(schema5.additionalItems, ctx) : void 0;
|
|
32273
32310
|
if (rest) {
|
|
32274
32311
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
32275
32312
|
} else {
|
|
32276
32313
|
zodSchema = z.tuple(tupleItems);
|
|
32277
32314
|
}
|
|
32278
|
-
if (typeof
|
|
32279
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
32315
|
+
if (typeof schema5.minItems === "number") {
|
|
32316
|
+
zodSchema = zodSchema.check(z.minLength(schema5.minItems));
|
|
32280
32317
|
}
|
|
32281
|
-
if (typeof
|
|
32282
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
32318
|
+
if (typeof schema5.maxItems === "number") {
|
|
32319
|
+
zodSchema = zodSchema.check(z.maxLength(schema5.maxItems));
|
|
32283
32320
|
}
|
|
32284
32321
|
} else if (items !== void 0) {
|
|
32285
32322
|
const element = convertSchema(items, ctx);
|
|
32286
32323
|
let arraySchema = z.array(element);
|
|
32287
|
-
if (typeof
|
|
32288
|
-
arraySchema = arraySchema.min(
|
|
32324
|
+
if (typeof schema5.minItems === "number") {
|
|
32325
|
+
arraySchema = arraySchema.min(schema5.minItems);
|
|
32289
32326
|
}
|
|
32290
|
-
if (typeof
|
|
32291
|
-
arraySchema = arraySchema.max(
|
|
32327
|
+
if (typeof schema5.maxItems === "number") {
|
|
32328
|
+
arraySchema = arraySchema.max(schema5.maxItems);
|
|
32292
32329
|
}
|
|
32293
32330
|
zodSchema = arraySchema;
|
|
32294
32331
|
} else {
|
|
@@ -32301,76 +32338,76 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32301
32338
|
}
|
|
32302
32339
|
return zodSchema;
|
|
32303
32340
|
}
|
|
32304
|
-
function convertSchema(
|
|
32305
|
-
if (typeof
|
|
32306
|
-
return
|
|
32341
|
+
function convertSchema(schema5, ctx) {
|
|
32342
|
+
if (typeof schema5 === "boolean") {
|
|
32343
|
+
return schema5 ? z.any() : z.never();
|
|
32307
32344
|
}
|
|
32308
|
-
let baseSchema = convertBaseSchema(
|
|
32309
|
-
const hasExplicitType =
|
|
32310
|
-
if (
|
|
32311
|
-
const options =
|
|
32345
|
+
let baseSchema = convertBaseSchema(schema5, ctx);
|
|
32346
|
+
const hasExplicitType = schema5.type || schema5.enum !== void 0 || schema5.const !== void 0;
|
|
32347
|
+
if (schema5.anyOf && Array.isArray(schema5.anyOf)) {
|
|
32348
|
+
const options = schema5.anyOf.map((s) => convertSchema(s, ctx));
|
|
32312
32349
|
const anyOfUnion = z.union(options);
|
|
32313
32350
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
32314
32351
|
}
|
|
32315
|
-
if (
|
|
32316
|
-
const options =
|
|
32352
|
+
if (schema5.oneOf && Array.isArray(schema5.oneOf)) {
|
|
32353
|
+
const options = schema5.oneOf.map((s) => convertSchema(s, ctx));
|
|
32317
32354
|
const oneOfUnion = z.xor(options);
|
|
32318
32355
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
32319
32356
|
}
|
|
32320
|
-
if (
|
|
32321
|
-
if (
|
|
32357
|
+
if (schema5.allOf && Array.isArray(schema5.allOf)) {
|
|
32358
|
+
if (schema5.allOf.length === 0) {
|
|
32322
32359
|
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
32323
32360
|
} else {
|
|
32324
|
-
let result2 = hasExplicitType ? baseSchema : convertSchema(
|
|
32361
|
+
let result2 = hasExplicitType ? baseSchema : convertSchema(schema5.allOf[0], ctx);
|
|
32325
32362
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
32326
|
-
for (let i2 = startIdx; i2 <
|
|
32327
|
-
result2 = z.intersection(result2, convertSchema(
|
|
32363
|
+
for (let i2 = startIdx; i2 < schema5.allOf.length; i2++) {
|
|
32364
|
+
result2 = z.intersection(result2, convertSchema(schema5.allOf[i2], ctx));
|
|
32328
32365
|
}
|
|
32329
32366
|
baseSchema = result2;
|
|
32330
32367
|
}
|
|
32331
32368
|
}
|
|
32332
|
-
if (
|
|
32369
|
+
if (schema5.nullable === true && ctx.version === "openapi-3.0") {
|
|
32333
32370
|
baseSchema = z.nullable(baseSchema);
|
|
32334
32371
|
}
|
|
32335
|
-
if (
|
|
32372
|
+
if (schema5.readOnly === true) {
|
|
32336
32373
|
baseSchema = z.readonly(baseSchema);
|
|
32337
32374
|
}
|
|
32338
|
-
if (
|
|
32339
|
-
baseSchema = baseSchema.default(
|
|
32375
|
+
if (schema5.default !== void 0) {
|
|
32376
|
+
baseSchema = baseSchema.default(schema5.default);
|
|
32340
32377
|
}
|
|
32341
32378
|
const extraMeta = {};
|
|
32342
32379
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
32343
32380
|
for (const key of coreMetadataKeys) {
|
|
32344
|
-
if (key in
|
|
32345
|
-
extraMeta[key] =
|
|
32381
|
+
if (key in schema5) {
|
|
32382
|
+
extraMeta[key] = schema5[key];
|
|
32346
32383
|
}
|
|
32347
32384
|
}
|
|
32348
32385
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
32349
32386
|
for (const key of contentMetadataKeys) {
|
|
32350
|
-
if (key in
|
|
32351
|
-
extraMeta[key] =
|
|
32387
|
+
if (key in schema5) {
|
|
32388
|
+
extraMeta[key] = schema5[key];
|
|
32352
32389
|
}
|
|
32353
32390
|
}
|
|
32354
|
-
for (const key of Object.keys(
|
|
32391
|
+
for (const key of Object.keys(schema5)) {
|
|
32355
32392
|
if (!RECOGNIZED_KEYS.has(key)) {
|
|
32356
|
-
extraMeta[key] =
|
|
32393
|
+
extraMeta[key] = schema5[key];
|
|
32357
32394
|
}
|
|
32358
32395
|
}
|
|
32359
32396
|
if (Object.keys(extraMeta).length > 0) {
|
|
32360
32397
|
ctx.registry.add(baseSchema, extraMeta);
|
|
32361
32398
|
}
|
|
32362
|
-
if (
|
|
32363
|
-
baseSchema = baseSchema.describe(
|
|
32399
|
+
if (schema5.description) {
|
|
32400
|
+
baseSchema = baseSchema.describe(schema5.description);
|
|
32364
32401
|
}
|
|
32365
32402
|
return baseSchema;
|
|
32366
32403
|
}
|
|
32367
|
-
function fromJSONSchema(
|
|
32368
|
-
if (typeof
|
|
32369
|
-
return
|
|
32404
|
+
function fromJSONSchema(schema5, params) {
|
|
32405
|
+
if (typeof schema5 === "boolean") {
|
|
32406
|
+
return schema5 ? z.any() : z.never();
|
|
32370
32407
|
}
|
|
32371
32408
|
let normalized;
|
|
32372
32409
|
try {
|
|
32373
|
-
normalized = JSON.parse(JSON.stringify(
|
|
32410
|
+
normalized = JSON.parse(JSON.stringify(schema5));
|
|
32374
32411
|
} catch {
|
|
32375
32412
|
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
32376
32413
|
}
|
|
@@ -33073,9 +33110,11 @@ var init_skill_protocol = __esm({
|
|
|
33073
33110
|
name: "Base",
|
|
33074
33111
|
explorerUrl: "https://basescan.org",
|
|
33075
33112
|
defaultRpcUrls: [
|
|
33113
|
+
"https://base.gateway.tenderly.co",
|
|
33114
|
+
"https://base-rpc.publicnode.com",
|
|
33076
33115
|
"https://mainnet.base.org"
|
|
33077
33116
|
],
|
|
33078
|
-
maxLogBlockRange:
|
|
33117
|
+
maxLogBlockRange: 1e3,
|
|
33079
33118
|
maxConcurrentRequests: 3
|
|
33080
33119
|
},
|
|
33081
33120
|
sourceRepository: "FinchipAI/finchip-protocol",
|
|
@@ -33232,12 +33271,12 @@ function resolveSkillProtocolEnvironment(raw) {
|
|
|
33232
33271
|
`FINCH_ENVIRONMENT must explicitly be local, test, or production; received ${received}.`
|
|
33233
33272
|
);
|
|
33234
33273
|
}
|
|
33235
|
-
function parseTypedRegistry(
|
|
33236
|
-
const
|
|
33237
|
-
if (!
|
|
33238
|
-
throw new DeploymentManifestError(`Invalid chain deployment manifest: ${external_exports.prettifyError(
|
|
33274
|
+
function parseTypedRegistry(schema5, value) {
|
|
33275
|
+
const parsed2 = schema5.safeParse(value);
|
|
33276
|
+
if (!parsed2.success) {
|
|
33277
|
+
throw new DeploymentManifestError(`Invalid chain deployment manifest: ${external_exports.prettifyError(parsed2.error)}`);
|
|
33239
33278
|
}
|
|
33240
|
-
return
|
|
33279
|
+
return parsed2.data;
|
|
33241
33280
|
}
|
|
33242
33281
|
function activeDeployment(protocol, deployments, environment3) {
|
|
33243
33282
|
if (environment3 === "local") {
|
|
@@ -33654,6 +33693,45 @@ var init_chains = __esm({
|
|
|
33654
33693
|
}
|
|
33655
33694
|
});
|
|
33656
33695
|
|
|
33696
|
+
// ../../packages/deployment-manifest/src/platform/get-help.json
|
|
33697
|
+
var get_help_default;
|
|
33698
|
+
var init_get_help = __esm({
|
|
33699
|
+
"../../packages/deployment-manifest/src/platform/get-help.json"() {
|
|
33700
|
+
get_help_default = {
|
|
33701
|
+
schemaVersion: 1,
|
|
33702
|
+
kind: "get_help",
|
|
33703
|
+
environments: {
|
|
33704
|
+
local: { enabled: true, ipHourlyLimit: 5, emailDailyLimit: 10, dailyUploadBytes: 104857600 },
|
|
33705
|
+
test: { enabled: true, ipHourlyLimit: 5, emailDailyLimit: 10, dailyUploadBytes: 104857600 },
|
|
33706
|
+
production: { enabled: false, ipHourlyLimit: 5, emailDailyLimit: 10, dailyUploadBytes: 104857600 }
|
|
33707
|
+
}
|
|
33708
|
+
};
|
|
33709
|
+
}
|
|
33710
|
+
});
|
|
33711
|
+
|
|
33712
|
+
// ../../packages/deployment-manifest/src/platform/get-help.ts
|
|
33713
|
+
var policy, schema, parseGetHelpManifest, parsed;
|
|
33714
|
+
var init_get_help2 = __esm({
|
|
33715
|
+
"../../packages/deployment-manifest/src/platform/get-help.ts"() {
|
|
33716
|
+
"use strict";
|
|
33717
|
+
init_zod();
|
|
33718
|
+
init_get_help();
|
|
33719
|
+
policy = external_exports.strictObject({
|
|
33720
|
+
enabled: external_exports.boolean(),
|
|
33721
|
+
ipHourlyLimit: external_exports.number().int().min(1).max(100),
|
|
33722
|
+
emailDailyLimit: external_exports.number().int().min(1).max(100),
|
|
33723
|
+
dailyUploadBytes: external_exports.number().int().min(2097152).max(1073741824)
|
|
33724
|
+
});
|
|
33725
|
+
schema = external_exports.strictObject({
|
|
33726
|
+
schemaVersion: external_exports.literal(1),
|
|
33727
|
+
kind: external_exports.literal("get_help"),
|
|
33728
|
+
environments: external_exports.strictObject({ local: policy, test: policy, production: policy })
|
|
33729
|
+
});
|
|
33730
|
+
parseGetHelpManifest = (value) => schema.parse(value);
|
|
33731
|
+
parsed = parseGetHelpManifest(get_help_default);
|
|
33732
|
+
}
|
|
33733
|
+
});
|
|
33734
|
+
|
|
33657
33735
|
// ../../packages/deployment-manifest/src/platform/passkey-safe.json
|
|
33658
33736
|
var passkey_safe_default;
|
|
33659
33737
|
var init_passkey_safe = __esm({
|
|
@@ -33681,9 +33759,9 @@ var init_passkey_safe = __esm({
|
|
|
33681
33759
|
|
|
33682
33760
|
// ../../packages/deployment-manifest/src/platform/passkey-safe.ts
|
|
33683
33761
|
function parsePasskeySafeManifest(input) {
|
|
33684
|
-
return
|
|
33762
|
+
return schema2.parse(input);
|
|
33685
33763
|
}
|
|
33686
|
-
var disabled, enabled,
|
|
33764
|
+
var disabled, enabled, schema2, manifest;
|
|
33687
33765
|
var init_passkey_safe2 = __esm({
|
|
33688
33766
|
"../../packages/deployment-manifest/src/platform/passkey-safe.ts"() {
|
|
33689
33767
|
"use strict";
|
|
@@ -33700,7 +33778,7 @@ var init_passkey_safe2 = __esm({
|
|
|
33700
33778
|
minimumGasWei: external_exports.string().regex(/^[1-9][0-9]*$/),
|
|
33701
33779
|
maxGasPerTransaction: external_exports.string().regex(/^[1-9][0-9]*$/)
|
|
33702
33780
|
});
|
|
33703
|
-
|
|
33781
|
+
schema2 = external_exports.strictObject({
|
|
33704
33782
|
schemaVersion: external_exports.literal(1),
|
|
33705
33783
|
kind: external_exports.literal("passkey_safe"),
|
|
33706
33784
|
environments: external_exports.strictObject({
|
|
@@ -33934,9 +34012,9 @@ var init_agenton_payout = __esm({
|
|
|
33934
34012
|
|
|
33935
34013
|
// ../../packages/deployment-manifest/src/platform/agenton-payout.ts
|
|
33936
34014
|
function parseAgentonPayoutManifest(input) {
|
|
33937
|
-
return
|
|
34015
|
+
return schema3.parse(input);
|
|
33938
34016
|
}
|
|
33939
|
-
var origin, environment,
|
|
34017
|
+
var origin, environment, schema3, manifest2;
|
|
33940
34018
|
var init_agenton_payout2 = __esm({
|
|
33941
34019
|
"../../packages/deployment-manifest/src/platform/agenton-payout.ts"() {
|
|
33942
34020
|
"use strict";
|
|
@@ -33947,7 +34025,7 @@ var init_agenton_payout2 = __esm({
|
|
|
33947
34025
|
return url2.protocol === "https:" && url2.origin === value && !url2.username && !url2.password;
|
|
33948
34026
|
});
|
|
33949
34027
|
environment = external_exports.strictObject({ enabled: external_exports.boolean(), mandateId: external_exports.string().min(1).nullable() });
|
|
33950
|
-
|
|
34028
|
+
schema3 = external_exports.strictObject({
|
|
33951
34029
|
schemaVersion: external_exports.literal(1),
|
|
33952
34030
|
kind: external_exports.literal("agenton_payout"),
|
|
33953
34031
|
agentIdBaseUrl: origin,
|
|
@@ -33986,36 +34064,36 @@ var init_merchant_avatar_video = __esm({
|
|
|
33986
34064
|
|
|
33987
34065
|
// ../../packages/deployment-manifest/src/platform/merchant-avatar-video.ts
|
|
33988
34066
|
function parseMerchantAvatarVideoManifest(input) {
|
|
33989
|
-
return
|
|
34067
|
+
return schema4.parse(input);
|
|
33990
34068
|
}
|
|
33991
|
-
var
|
|
34069
|
+
var policy2, schema4, manifest3;
|
|
33992
34070
|
var init_merchant_avatar_video2 = __esm({
|
|
33993
34071
|
"../../packages/deployment-manifest/src/platform/merchant-avatar-video.ts"() {
|
|
33994
34072
|
"use strict";
|
|
33995
34073
|
init_zod();
|
|
33996
34074
|
init_merchant_avatar_video();
|
|
33997
|
-
|
|
34075
|
+
policy2 = external_exports.discriminatedUnion("enabled", [
|
|
33998
34076
|
external_exports.strictObject({ enabled: external_exports.literal(false) }),
|
|
33999
34077
|
external_exports.strictObject({ enabled: external_exports.literal(true), offerId: external_exports.uuid(), dailyLimit: external_exports.number().int().min(1).max(1e4) })
|
|
34000
34078
|
]);
|
|
34001
|
-
|
|
34079
|
+
schema4 = external_exports.strictObject({
|
|
34002
34080
|
schemaVersion: external_exports.literal(1),
|
|
34003
34081
|
kind: external_exports.literal("merchant_avatar_video"),
|
|
34004
|
-
environments: external_exports.strictObject({ local:
|
|
34082
|
+
environments: external_exports.strictObject({ local: policy2, test: policy2, production: policy2 })
|
|
34005
34083
|
});
|
|
34006
34084
|
manifest3 = parseMerchantAvatarVideoManifest(merchant_avatar_video_default);
|
|
34007
34085
|
}
|
|
34008
34086
|
});
|
|
34009
34087
|
|
|
34010
34088
|
// ../../packages/deployment-manifest/src/platform/index.ts
|
|
34011
|
-
function parseManifest2(label,
|
|
34012
|
-
const
|
|
34013
|
-
if (!
|
|
34089
|
+
function parseManifest2(label, schema5, value) {
|
|
34090
|
+
const parsed2 = schema5.safeParse(value);
|
|
34091
|
+
if (!parsed2.success) {
|
|
34014
34092
|
throw new DeploymentManifestError(
|
|
34015
|
-
`Invalid ${label} deployment manifest: ${external_exports.prettifyError(
|
|
34093
|
+
`Invalid ${label} deployment manifest: ${external_exports.prettifyError(parsed2.error)}`
|
|
34016
34094
|
);
|
|
34017
34095
|
}
|
|
34018
|
-
return
|
|
34096
|
+
return parsed2.data;
|
|
34019
34097
|
}
|
|
34020
34098
|
function parseInternalAppsManifest(value) {
|
|
34021
34099
|
return parseManifest2("internal-apps", internalAppsManifestSchema, value);
|
|
@@ -34053,6 +34131,7 @@ var init_platform = __esm({
|
|
|
34053
34131
|
"../../packages/deployment-manifest/src/platform/index.ts"() {
|
|
34054
34132
|
"use strict";
|
|
34055
34133
|
init_zod();
|
|
34134
|
+
init_get_help2();
|
|
34056
34135
|
init_passkey_safe2();
|
|
34057
34136
|
init_web_analytics();
|
|
34058
34137
|
init_web_localization();
|
|
@@ -38200,12 +38279,12 @@ var init_utils3 = __esm({
|
|
|
38200
38279
|
getContractAddress = (address2) => address2;
|
|
38201
38280
|
getUrl = (url2) => {
|
|
38202
38281
|
try {
|
|
38203
|
-
const
|
|
38204
|
-
if (!
|
|
38282
|
+
const parsed2 = new URL(url2);
|
|
38283
|
+
if (!parsed2.username && !parsed2.password)
|
|
38205
38284
|
return url2;
|
|
38206
|
-
|
|
38207
|
-
|
|
38208
|
-
return
|
|
38285
|
+
parsed2.username = "";
|
|
38286
|
+
parsed2.password = "";
|
|
38287
|
+
return parsed2.toString();
|
|
38209
38288
|
} catch {
|
|
38210
38289
|
return url2;
|
|
38211
38290
|
}
|
|
@@ -53407,13 +53486,13 @@ var init_validateSiweMessage = __esm({
|
|
|
53407
53486
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/actions/siwe/verifySiweMessage.js
|
|
53408
53487
|
async function verifySiweMessage(client, parameters) {
|
|
53409
53488
|
const { address: address2, domain: domain2, message, nonce, scheme, signature, time: time3 = /* @__PURE__ */ new Date(), ...callRequest } = parameters;
|
|
53410
|
-
const
|
|
53411
|
-
if (!
|
|
53489
|
+
const parsed2 = parseSiweMessage(message);
|
|
53490
|
+
if (!parsed2.address)
|
|
53412
53491
|
return false;
|
|
53413
53492
|
const isValid = validateSiweMessage({
|
|
53414
53493
|
address: address2,
|
|
53415
53494
|
domain: domain2,
|
|
53416
|
-
message:
|
|
53495
|
+
message: parsed2,
|
|
53417
53496
|
nonce,
|
|
53418
53497
|
scheme,
|
|
53419
53498
|
time: time3
|
|
@@ -53422,7 +53501,7 @@ async function verifySiweMessage(client, parameters) {
|
|
|
53422
53501
|
return false;
|
|
53423
53502
|
const hash5 = hashMessage(message);
|
|
53424
53503
|
return verifyHash(client, {
|
|
53425
|
-
address:
|
|
53504
|
+
address: parsed2.address,
|
|
53426
53505
|
hash: hash5,
|
|
53427
53506
|
signature,
|
|
53428
53507
|
...callRequest
|
|
@@ -54905,27 +54984,27 @@ function normalizeCliEvmAddress(value, field = "EVM address") {
|
|
|
54905
54984
|
function record3(value) {
|
|
54906
54985
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
54907
54986
|
}
|
|
54908
|
-
function variantMatches(
|
|
54909
|
-
if (!record3(
|
|
54910
|
-
return Object.entries(
|
|
54987
|
+
function variantMatches(schema5, value) {
|
|
54988
|
+
if (!record3(schema5.properties) || !record3(value)) return true;
|
|
54989
|
+
return Object.entries(schema5.properties).every(([key, property]) => {
|
|
54911
54990
|
if (!record3(property) || !Object.hasOwn(property, "const")) return true;
|
|
54912
54991
|
return value[key] === property.const;
|
|
54913
54992
|
});
|
|
54914
54993
|
}
|
|
54915
|
-
function normalizeCliRequestAddresses(
|
|
54916
|
-
if ((
|
|
54994
|
+
function normalizeCliRequestAddresses(schema5, value) {
|
|
54995
|
+
if ((schema5.pattern === CANONICAL_ADDRESS_PATTERN || schema5.pattern === INPUT_ADDRESS_PATTERN) && typeof value === "string") {
|
|
54917
54996
|
return normalizeCliEvmAddress(value);
|
|
54918
54997
|
}
|
|
54919
|
-
const variants = Array.isArray(
|
|
54998
|
+
const variants = Array.isArray(schema5.oneOf) ? schema5.oneOf : Array.isArray(schema5.anyOf) ? schema5.anyOf : null;
|
|
54920
54999
|
if (variants !== null) {
|
|
54921
55000
|
const selected = variants.find((variant) => record3(variant) && variantMatches(variant, value));
|
|
54922
55001
|
return selected === void 0 || !record3(selected) ? value : normalizeCliRequestAddresses(selected, value);
|
|
54923
55002
|
}
|
|
54924
|
-
if (Array.isArray(value) && record3(
|
|
54925
|
-
return value.map((item) => normalizeCliRequestAddresses(
|
|
55003
|
+
if (Array.isArray(value) && record3(schema5.items)) {
|
|
55004
|
+
return value.map((item) => normalizeCliRequestAddresses(schema5.items, item));
|
|
54926
55005
|
}
|
|
54927
|
-
if (record3(value) && record3(
|
|
54928
|
-
const properties =
|
|
55006
|
+
if (record3(value) && record3(schema5.properties)) {
|
|
55007
|
+
const properties = schema5.properties;
|
|
54929
55008
|
return Object.fromEntries(Object.entries(value).map(([key, entry2]) => {
|
|
54930
55009
|
const property = properties[key];
|
|
54931
55010
|
return [key, record3(property) ? normalizeCliRequestAddresses(property, entry2) : entry2];
|
|
@@ -54950,18 +55029,19 @@ function skillHttpDiagnostic(response, value) {
|
|
|
54950
55029
|
const code = value?.error?.code;
|
|
54951
55030
|
const platformCode = response.headers.get("x-vercel-error");
|
|
54952
55031
|
const requestId = response.headers.get("x-vercel-id");
|
|
54953
|
-
const
|
|
55032
|
+
const bodyTraceId = value?.error?.traceId;
|
|
55033
|
+
const traceId = response.headers.get("x-finch-trace-id") ?? (typeof bodyTraceId === "string" ? bodyTraceId : null);
|
|
54954
55034
|
return {
|
|
54955
55035
|
...typeof code === "string" && PUBLIC_SKILL_HTTP_CODES.has(code) ? { remoteCode: code } : platformCode !== null && PUBLIC_SKILL_HTTP_CODES.has(platformCode) ? { remoteCode: platformCode } : {},
|
|
54956
55036
|
...requestId !== null && /^[a-z0-9]{3,8}(?:::[a-z0-9]{3,8})?::[a-z0-9]{5}-[0-9]{13}-[a-f0-9]{12}$/u.test(requestId) ? { remoteRequestId: requestId } : {},
|
|
54957
|
-
...traceId !== null &&
|
|
55037
|
+
...traceId !== null && TRACE_ID_PATTERN.test(traceId) ? { remoteTraceId: traceId } : {}
|
|
54958
55038
|
};
|
|
54959
55039
|
}
|
|
54960
|
-
function assertSchema(
|
|
54961
|
-
let validator = validatorCache.get(
|
|
55040
|
+
function assertSchema(schema5, value, diagnosticPaths) {
|
|
55041
|
+
let validator = validatorCache.get(schema5);
|
|
54962
55042
|
if (validator === void 0) {
|
|
54963
|
-
const compiled = ajv.compile(
|
|
54964
|
-
validatorCache.set(
|
|
55043
|
+
const compiled = ajv.compile(schema5);
|
|
55044
|
+
validatorCache.set(schema5, compiled);
|
|
54965
55045
|
validator = compiled;
|
|
54966
55046
|
}
|
|
54967
55047
|
if (!validator(value)) {
|
|
@@ -54973,20 +55053,20 @@ function assertSchema(schema4, value, diagnosticPaths) {
|
|
|
54973
55053
|
}
|
|
54974
55054
|
return value;
|
|
54975
55055
|
}
|
|
54976
|
-
function assertRequestSchema(
|
|
54977
|
-
let validator = validatorCache.get(
|
|
55056
|
+
function assertRequestSchema(schema5, value) {
|
|
55057
|
+
let validator = validatorCache.get(schema5);
|
|
54978
55058
|
if (validator === void 0) {
|
|
54979
|
-
validator = ajv.compile(
|
|
54980
|
-
validatorCache.set(
|
|
55059
|
+
validator = ajv.compile(schema5);
|
|
55060
|
+
validatorCache.set(schema5, validator);
|
|
54981
55061
|
}
|
|
54982
55062
|
if (!validator(value)) throw new TypeError("Creator request does not match the shared operation schema.");
|
|
54983
55063
|
}
|
|
54984
55064
|
function canonicalOrigin2(input) {
|
|
54985
|
-
const
|
|
54986
|
-
if (
|
|
55065
|
+
const parsed2 = new URL(input);
|
|
55066
|
+
if (parsed2.origin !== input || parsed2.username !== "" || parsed2.password !== "" || parsed2.pathname !== "/" || parsed2.search !== "" || parsed2.hash !== "" || !["http:", "https:"].includes(parsed2.protocol)) {
|
|
54987
55067
|
throw new TypeError("AgentCLI origin must be canonical.");
|
|
54988
55068
|
}
|
|
54989
|
-
return
|
|
55069
|
+
return parsed2.origin;
|
|
54990
55070
|
}
|
|
54991
55071
|
function jsonObject(value) {
|
|
54992
55072
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -55106,10 +55186,10 @@ async function readBoundedBytes(response, minimumBytes, maximumBytes) {
|
|
|
55106
55186
|
}
|
|
55107
55187
|
}
|
|
55108
55188
|
function parseRemoteError(contract, response, value, diagnose = false) {
|
|
55109
|
-
const
|
|
55189
|
+
const schema5 = contract === "agent_market" ? agentCliErrorEnvelopeSchema : contract === "identity" ? identityErrorEnvelopeSchema : contract === "task_market" ? taskErrorEnvelopeSchema : contract === "skill_market" ? skillErrorEnvelopeSchema : oauthErrorResponseSchema;
|
|
55110
55190
|
let envelope;
|
|
55111
55191
|
try {
|
|
55112
|
-
envelope = assertSchema(
|
|
55192
|
+
envelope = assertSchema(schema5, value, diagnose ? skillErrorDiagnosticPaths : void 0);
|
|
55113
55193
|
} catch (cause) {
|
|
55114
55194
|
throw new CliHttpError("CLI_RESPONSE_INVALID", response.status, {
|
|
55115
55195
|
cause,
|
|
@@ -55126,7 +55206,7 @@ function parseRemoteError(contract, response, value, diagnose = false) {
|
|
|
55126
55206
|
}
|
|
55127
55207
|
return envelope;
|
|
55128
55208
|
}
|
|
55129
|
-
var import_ajv, CLI_MERCHANT_OPERATION_IDS, PUBLIC_SKILL_HTTP_CODES, CliHttpError, ajv, validatorCache, skillUnsignedIntentResponseSchema, intentDiagnosticPaths, skillErrorDiagnosticPaths, oauthAuthorizationResponseSchema, oauthErrorResponseSchema, AgentCliHttpClient;
|
|
55209
|
+
var import_ajv, CLI_MERCHANT_OPERATION_IDS, SKILL_UPLOAD_INLINE_LIMIT_BYTES, PUBLIC_SKILL_HTTP_CODES, TRACE_ID_PATTERN, CliHttpError, ajv, validatorCache, skillUnsignedIntentResponseSchema, intentDiagnosticPaths, skillErrorDiagnosticPaths, oauthAuthorizationResponseSchema, oauthErrorResponseSchema, AgentCliHttpClient;
|
|
55130
55210
|
var init_api2 = __esm({
|
|
55131
55211
|
"src/api.ts"() {
|
|
55132
55212
|
"use strict";
|
|
@@ -55159,6 +55239,7 @@ var init_api2 = __esm({
|
|
|
55159
55239
|
"merchant_connection_tests.create",
|
|
55160
55240
|
"merchant_publish_intents.create"
|
|
55161
55241
|
]);
|
|
55242
|
+
SKILL_UPLOAD_INLINE_LIMIT_BYTES = 4e6;
|
|
55162
55243
|
PUBLIC_SKILL_HTTP_CODES = /* @__PURE__ */ new Set([
|
|
55163
55244
|
"UPLOAD_INVALID",
|
|
55164
55245
|
"UPLOAD_TOO_LARGE",
|
|
@@ -55173,6 +55254,7 @@ var init_api2 = __esm({
|
|
|
55173
55254
|
"INTENT_UNAVAILABLE",
|
|
55174
55255
|
"PUBLICATION_INVALID"
|
|
55175
55256
|
]);
|
|
55257
|
+
TRACE_ID_PATTERN = /^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/u;
|
|
55176
55258
|
CliHttpError = class extends Error {
|
|
55177
55259
|
code;
|
|
55178
55260
|
status;
|
|
@@ -55230,16 +55312,12 @@ var init_api2 = __esm({
|
|
|
55230
55312
|
}
|
|
55231
55313
|
};
|
|
55232
55314
|
AgentCliHttpClient = class {
|
|
55233
|
-
|
|
55234
|
-
|
|
55235
|
-
|
|
55236
|
-
this.warn = warn;
|
|
55315
|
+
origin;
|
|
55316
|
+
fetchImplementation;
|
|
55317
|
+
constructor(origin2, fetchImplementation = fetch) {
|
|
55237
55318
|
this.origin = canonicalOrigin2(origin2);
|
|
55238
55319
|
this.fetchImplementation = fetchImplementation;
|
|
55239
55320
|
}
|
|
55240
|
-
warn;
|
|
55241
|
-
origin;
|
|
55242
|
-
fetchImplementation;
|
|
55243
55321
|
async request(options) {
|
|
55244
55322
|
const headers = new Headers(options.headers);
|
|
55245
55323
|
if (options.path.split("?")[0] === "/api/v1/skill-market/skills") headers.set("X-Finch-Search-Version", "2");
|
|
@@ -55265,13 +55343,41 @@ var init_api2 = __esm({
|
|
|
55265
55343
|
} catch (cause) {
|
|
55266
55344
|
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", null, { cause });
|
|
55267
55345
|
}
|
|
55346
|
+
const diagnose = options.errorContract === "skill_market";
|
|
55268
55347
|
if (response.status !== options.successStatus) {
|
|
55269
|
-
|
|
55270
|
-
|
|
55348
|
+
let value2;
|
|
55349
|
+
let envelope;
|
|
55350
|
+
try {
|
|
55351
|
+
value2 = await readBoundedJson(response, 65536, diagnose);
|
|
55352
|
+
envelope = parseRemoteError(options.errorContract, response, value2, diagnose);
|
|
55353
|
+
} catch (cause) {
|
|
55354
|
+
if (!diagnose) throw cause;
|
|
55355
|
+
throw new CliHttpError(cause instanceof CliHttpError ? cause.code : "CLI_RESPONSE_INVALID", response.status, {
|
|
55356
|
+
cause,
|
|
55357
|
+
...cause instanceof CliHttpError && cause.envelope !== null ? { envelope: cause.envelope } : {},
|
|
55358
|
+
diagnostic: { ...skillHttpDiagnostic(response, value2), ...cause instanceof CliHttpError ? cause.diagnostic : {} }
|
|
55359
|
+
});
|
|
55360
|
+
}
|
|
55361
|
+
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", response.status, {
|
|
55362
|
+
envelope,
|
|
55363
|
+
...diagnose ? { diagnostic: skillHttpDiagnostic(response, value2) } : {}
|
|
55364
|
+
});
|
|
55271
55365
|
}
|
|
55272
55366
|
if (options.successStatus === 204) return void 0;
|
|
55273
|
-
|
|
55274
|
-
|
|
55367
|
+
if (!diagnose) {
|
|
55368
|
+
const value2 = await readBoundedJson(response);
|
|
55369
|
+
return options.responseSchema === void 0 ? value2 : assertSchema(options.responseSchema, value2);
|
|
55370
|
+
}
|
|
55371
|
+
let value;
|
|
55372
|
+
try {
|
|
55373
|
+
value = await readBoundedJson(response, 65536, true);
|
|
55374
|
+
return options.responseSchema === void 0 ? value : assertSchema(options.responseSchema, value);
|
|
55375
|
+
} catch (cause) {
|
|
55376
|
+
throw new CliHttpError(cause instanceof CliHttpError ? cause.code : "CLI_RESPONSE_INVALID", response.status, {
|
|
55377
|
+
cause,
|
|
55378
|
+
diagnostic: { ...skillHttpDiagnostic(response, value), ...cause instanceof CliHttpError ? cause.diagnostic : {} }
|
|
55379
|
+
});
|
|
55380
|
+
}
|
|
55275
55381
|
}
|
|
55276
55382
|
async skillFetch(path2, init, expectedStatus = 200) {
|
|
55277
55383
|
let response;
|
|
@@ -55283,8 +55389,8 @@ var init_api2 = __esm({
|
|
|
55283
55389
|
if (response.status !== expectedStatus) {
|
|
55284
55390
|
let value;
|
|
55285
55391
|
try {
|
|
55286
|
-
value = await readBoundedJson(response, 65536,
|
|
55287
|
-
const envelope = parseRemoteError("skill_market", response, value,
|
|
55392
|
+
value = await readBoundedJson(response, 65536, true);
|
|
55393
|
+
const envelope = parseRemoteError("skill_market", response, value, true);
|
|
55288
55394
|
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", response.status, { envelope });
|
|
55289
55395
|
} catch (cause) {
|
|
55290
55396
|
throw new CliHttpError(cause instanceof CliHttpError ? cause.code : "CLI_RESPONSE_INVALID", response.status, {
|
|
@@ -55387,19 +55493,9 @@ var init_api2 = __esm({
|
|
|
55387
55493
|
const encoded = new Response(form);
|
|
55388
55494
|
const bodyBytes = await encoded.arrayBuffer();
|
|
55389
55495
|
const requestBytes = bodyBytes.byteLength;
|
|
55390
|
-
if (requestBytes >
|
|
55391
|
-
|
|
55392
|
-
"SKILL_UPLOAD_REQUEST_TOO_LARGE",
|
|
55393
|
-
{ actualBytes: requestBytes, maxBytes: 45e5 },
|
|
55394
|
-
"Skill upload request exceeds 4.5 MB. Reduce the package size before publishing."
|
|
55395
|
-
);
|
|
55496
|
+
if (requestBytes > SKILL_UPLOAD_INLINE_LIMIT_BYTES) {
|
|
55497
|
+
return await this.uploadStagedSkillObject(input);
|
|
55396
55498
|
}
|
|
55397
|
-
if (requestBytes > 4e6) this.warn({
|
|
55398
|
-
code: "SKILL_UPLOAD_NEAR_LIMIT",
|
|
55399
|
-
requestBytes,
|
|
55400
|
-
maxBytes: 45e5,
|
|
55401
|
-
message: "Skill upload request exceeds 4 MB and may fail near the platform limit. Continuing."
|
|
55402
|
-
});
|
|
55403
55499
|
let response;
|
|
55404
55500
|
let value;
|
|
55405
55501
|
try {
|
|
@@ -55426,6 +55522,121 @@ var init_api2 = __esm({
|
|
|
55426
55522
|
});
|
|
55427
55523
|
}
|
|
55428
55524
|
}
|
|
55525
|
+
/**
|
|
55526
|
+
* Returns a ticket to the wallet's budget when the upload it authorized will not be finished.
|
|
55527
|
+
*
|
|
55528
|
+
* A ticket is charged when it is issued, not when bytes arrive, so a write that fails leaves one
|
|
55529
|
+
* indistinguishable from a ticket still in use. Four of those and the wallet is held until the
|
|
55530
|
+
* oldest expires, a day later, for a dropped connection.
|
|
55531
|
+
*
|
|
55532
|
+
* Reports rather than throws, because it only ever runs while another failure is being raised
|
|
55533
|
+
* and that failure is the one the publisher has to see. The outcome travels on that error's
|
|
55534
|
+
* diagnostic instead, so a release that did not happen is still visible.
|
|
55535
|
+
*/
|
|
55536
|
+
async releaseStagedTicket(path2, bearer) {
|
|
55537
|
+
try {
|
|
55538
|
+
await this.skillFetch("/api/skills/upload-tickets/abandon", {
|
|
55539
|
+
method: "POST",
|
|
55540
|
+
headers: { authorization: `Bearer ${bearer}`, "content-type": "application/json" },
|
|
55541
|
+
body: JSON.stringify({ path: path2 })
|
|
55542
|
+
});
|
|
55543
|
+
return true;
|
|
55544
|
+
} catch {
|
|
55545
|
+
return false;
|
|
55546
|
+
}
|
|
55547
|
+
}
|
|
55548
|
+
/**
|
|
55549
|
+
* Uploads one object through the staged transport: ask for a signed URL, write the bytes to it
|
|
55550
|
+
* directly, then ask the server to verify and pin what it finds there.
|
|
55551
|
+
*
|
|
55552
|
+
* The signed URL names a storage origin rather than Finch's, so it is checked before any bytes
|
|
55553
|
+
* are written to it: a redirected or credential-bearing URL is refused rather than followed.
|
|
55554
|
+
*/
|
|
55555
|
+
async uploadStagedSkillObject(input) {
|
|
55556
|
+
const opened = await this.skillFetch("/api/skills/upload-tickets", {
|
|
55557
|
+
method: "POST",
|
|
55558
|
+
headers: { authorization: `Bearer ${input.bearer}` }
|
|
55559
|
+
});
|
|
55560
|
+
const ticket = await readBoundedJson(opened);
|
|
55561
|
+
if (typeof ticket?.path !== "string" || typeof ticket.signedUrl !== "string") {
|
|
55562
|
+
throw new CliHttpError("CLI_RESPONSE_INVALID", 200);
|
|
55563
|
+
}
|
|
55564
|
+
let signed;
|
|
55565
|
+
try {
|
|
55566
|
+
signed = new URL(ticket.signedUrl);
|
|
55567
|
+
} catch {
|
|
55568
|
+
throw new CliHttpError("CLI_RESPONSE_INVALID", 200);
|
|
55569
|
+
}
|
|
55570
|
+
if (signed.protocol !== "https:" && signed.hostname !== "127.0.0.1" && signed.hostname !== "localhost" || signed.username || signed.password) {
|
|
55571
|
+
throw new CliHttpError("CLI_RESPONSE_INVALID", 200);
|
|
55572
|
+
}
|
|
55573
|
+
let written;
|
|
55574
|
+
try {
|
|
55575
|
+
written = await this.fetchImplementation(signed.toString(), {
|
|
55576
|
+
method: "PUT",
|
|
55577
|
+
redirect: "error",
|
|
55578
|
+
headers: { "content-type": input.mediaType ?? "application/octet-stream" },
|
|
55579
|
+
body: input.bytes
|
|
55580
|
+
});
|
|
55581
|
+
} catch (cause) {
|
|
55582
|
+
const ticketReleased = await this.releaseStagedTicket(ticket.path, input.bearer);
|
|
55583
|
+
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", null, {
|
|
55584
|
+
cause,
|
|
55585
|
+
diagnostic: {
|
|
55586
|
+
uploadBytes: input.bytes.byteLength,
|
|
55587
|
+
uploadObjectKind: input.objectKind,
|
|
55588
|
+
uploadTransport: "staged",
|
|
55589
|
+
ticketReleased
|
|
55590
|
+
}
|
|
55591
|
+
});
|
|
55592
|
+
}
|
|
55593
|
+
if (!written.ok) {
|
|
55594
|
+
const ticketReleased = await this.releaseStagedTicket(ticket.path, input.bearer);
|
|
55595
|
+
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", written.status, {
|
|
55596
|
+
diagnostic: {
|
|
55597
|
+
uploadBytes: input.bytes.byteLength,
|
|
55598
|
+
uploadObjectKind: input.objectKind,
|
|
55599
|
+
uploadTransport: "staged",
|
|
55600
|
+
ticketReleased
|
|
55601
|
+
}
|
|
55602
|
+
});
|
|
55603
|
+
}
|
|
55604
|
+
let response;
|
|
55605
|
+
let value;
|
|
55606
|
+
try {
|
|
55607
|
+
response = await this.skillFetch("/api/skills/upload-tickets/complete", {
|
|
55608
|
+
method: "POST",
|
|
55609
|
+
headers: { authorization: `Bearer ${input.bearer}`, "content-type": "application/json" },
|
|
55610
|
+
body: JSON.stringify({
|
|
55611
|
+
path: ticket.path,
|
|
55612
|
+
objectKind: input.objectKind,
|
|
55613
|
+
filename: input.filename,
|
|
55614
|
+
...input.mediaType === void 0 ? {} : { mediaType: input.mediaType },
|
|
55615
|
+
...input.sourceKind === void 0 ? {} : { sourceKind: input.sourceKind },
|
|
55616
|
+
...input.contentMode === void 0 ? {} : { contentMode: input.contentMode }
|
|
55617
|
+
})
|
|
55618
|
+
});
|
|
55619
|
+
value = await readBoundedJson(response);
|
|
55620
|
+
const body = value;
|
|
55621
|
+
if (typeof body?.uri !== "string") throw new CliHttpError("CLI_RESPONSE_INVALID", 200);
|
|
55622
|
+
return Object.freeze({ uri: body.uri });
|
|
55623
|
+
} catch (cause) {
|
|
55624
|
+
if (!(cause instanceof CliHttpError)) throw cause;
|
|
55625
|
+
const ticketReleased = await this.releaseStagedTicket(ticket.path, input.bearer);
|
|
55626
|
+
throw new CliHttpError(cause.code, cause.status, {
|
|
55627
|
+
cause,
|
|
55628
|
+
...cause.envelope !== null ? { envelope: cause.envelope } : {},
|
|
55629
|
+
diagnostic: {
|
|
55630
|
+
...response === void 0 ? {} : skillHttpDiagnostic(response, value),
|
|
55631
|
+
...cause.diagnostic,
|
|
55632
|
+
uploadBytes: input.bytes.byteLength,
|
|
55633
|
+
uploadObjectKind: input.objectKind,
|
|
55634
|
+
uploadTransport: "staged",
|
|
55635
|
+
ticketReleased
|
|
55636
|
+
}
|
|
55637
|
+
});
|
|
55638
|
+
}
|
|
55639
|
+
}
|
|
55429
55640
|
async requestSkillIntent(body, bearer) {
|
|
55430
55641
|
let response;
|
|
55431
55642
|
try {
|
|
@@ -55527,7 +55738,7 @@ var init_api2 = __esm({
|
|
|
55527
55738
|
headers: bearer === void 0 ? void 0 : { authorization: `Bearer ${bearer}` },
|
|
55528
55739
|
cache: "no-store"
|
|
55529
55740
|
});
|
|
55530
|
-
return readBoundedBytes(response, 1,
|
|
55741
|
+
return readBoundedBytes(response, 1, MAX_SKILL_PACKAGE_BYTES);
|
|
55531
55742
|
}
|
|
55532
55743
|
async confirmSkillProjection(chainId, transactionHash3, bearer) {
|
|
55533
55744
|
let response;
|
|
@@ -55567,13 +55778,13 @@ var init_api2 = __esm({
|
|
|
55567
55778
|
});
|
|
55568
55779
|
}
|
|
55569
55780
|
authorizeMcp(requestPath, bearer) {
|
|
55570
|
-
let
|
|
55781
|
+
let parsed2;
|
|
55571
55782
|
try {
|
|
55572
|
-
|
|
55783
|
+
parsed2 = new URL(requestPath, this.origin);
|
|
55573
55784
|
} catch {
|
|
55574
55785
|
throw new TypeError("MCP authorization request path is invalid.");
|
|
55575
55786
|
}
|
|
55576
|
-
if (
|
|
55787
|
+
if (parsed2.origin !== this.origin || parsed2.pathname !== "/oauth/authorize" || parsed2.hash !== "" || requestPath !== `${parsed2.pathname}${parsed2.search}` || parsed2.search === "") {
|
|
55577
55788
|
throw new TypeError("MCP authorization request path is invalid.");
|
|
55578
55789
|
}
|
|
55579
55790
|
return this.request({
|
|
@@ -56224,16 +56435,16 @@ function assertLocalAction(value, command, skillId) {
|
|
|
56224
56435
|
}
|
|
56225
56436
|
}
|
|
56226
56437
|
function intent(value, walletAddress2) {
|
|
56227
|
-
const
|
|
56228
|
-
exact2(
|
|
56229
|
-
const chainId = skillChain(
|
|
56438
|
+
const parsed2 = object2(value, "Skill intent");
|
|
56439
|
+
exact2(parsed2, ["chainId", "to", "data", "value", "summary", "signingAuthority"], "Skill intent");
|
|
56440
|
+
const chainId = skillChain(parsed2.chainId, "Skill intent chain");
|
|
56230
56441
|
return Object.freeze({
|
|
56231
56442
|
chainId,
|
|
56232
|
-
to: string4(
|
|
56233
|
-
data: string4(
|
|
56234
|
-
value: string4(
|
|
56235
|
-
summary: string4(
|
|
56236
|
-
signingAuthority: signingAuthority(
|
|
56443
|
+
to: string4(parsed2.to, "Skill intent target", /^0x[0-9a-fA-F]{40}$/u),
|
|
56444
|
+
data: string4(parsed2.data, "Skill intent calldata", /^0x(?:[0-9a-fA-F]{2})+$/u),
|
|
56445
|
+
value: string4(parsed2.value, "Skill intent value", DECIMAL),
|
|
56446
|
+
summary: string4(parsed2.summary, "Skill intent summary"),
|
|
56447
|
+
signingAuthority: signingAuthority(parsed2.signingAuthority, walletAddress2)
|
|
56237
56448
|
});
|
|
56238
56449
|
}
|
|
56239
56450
|
function legacyIntent(value, walletAddress2, authority) {
|
|
@@ -56553,6 +56764,14 @@ function recoveryJournal(value, fingerprint2, kind, context) {
|
|
|
56553
56764
|
journal.receipts = parsedReceipts;
|
|
56554
56765
|
return journal;
|
|
56555
56766
|
}
|
|
56767
|
+
function unconfirmedActions(journal) {
|
|
56768
|
+
const actions = /* @__PURE__ */ new Map([
|
|
56769
|
+
["primary", journal.kind === "version" ? "updateSkill" : "createSkill"]
|
|
56770
|
+
]);
|
|
56771
|
+
if (journal.kind === "version") actions.set("uri", "setSkillURI");
|
|
56772
|
+
if (journal.contentMode !== "plaintext") actions.set("lit", "setLitData");
|
|
56773
|
+
return [...actions].filter(([stage]) => journal.receipts[stage] === null).map(([, action]) => action);
|
|
56774
|
+
}
|
|
56556
56775
|
var MAX_ENCRYPTED_BYTES, HASH2, IPFS, DECIMAL, UUID, SkillLocalFlow;
|
|
56557
56776
|
var init_skill_local_flow = __esm({
|
|
56558
56777
|
"src/skill-local-flow.ts"() {
|
|
@@ -56560,7 +56779,7 @@ var init_skill_local_flow = __esm({
|
|
|
56560
56779
|
init_src2();
|
|
56561
56780
|
init_client();
|
|
56562
56781
|
init_cli_error();
|
|
56563
|
-
MAX_ENCRYPTED_BYTES =
|
|
56782
|
+
MAX_ENCRYPTED_BYTES = MAX_SKILL_PACKAGE_BYTES;
|
|
56564
56783
|
HASH2 = /^0x[0-9a-fA-F]{64}$/u;
|
|
56565
56784
|
IPFS = /^ipfs:\/\/(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|b[a-z2-7]{20,})$/u;
|
|
56566
56785
|
DECIMAL = /^(?:0|[1-9][0-9]*)$/u;
|
|
@@ -56586,15 +56805,23 @@ var init_skill_local_flow = __esm({
|
|
|
56586
56805
|
return await work(progress);
|
|
56587
56806
|
} catch (cause) {
|
|
56588
56807
|
const journal = progress.journal;
|
|
56589
|
-
|
|
56590
|
-
|
|
56808
|
+
const unconfirmed = journal ? unconfirmedActions(journal) : [];
|
|
56809
|
+
if (journal && (journal.pendingStage != null || journal.version !== 6 && unconfirmed.length > 0)) {
|
|
56810
|
+
progress.uncertain = true;
|
|
56811
|
+
}
|
|
56812
|
+
const transactionHashes = Object.fromEntries([
|
|
56813
|
+
...Object.entries(progress.journal?.receipts ?? {}).flatMap(([stage, receipt]) => receipt && HASH2.test(receipt.transactionHash) ? [[stage, receipt.transactionHash]] : []),
|
|
56814
|
+
...Object.entries(progress.broadcast ?? {}).filter(([, hash5]) => HASH2.test(hash5))
|
|
56815
|
+
]);
|
|
56591
56816
|
const fingerprint2 = progress.journal && progress.fingerprint ? progress.fingerprint : null;
|
|
56592
56817
|
throw new CliSkillPublicationError({
|
|
56593
56818
|
phase: progress.phase,
|
|
56594
56819
|
fingerprint: fingerprint2,
|
|
56595
56820
|
transactionHashes,
|
|
56821
|
+
unconfirmedActions: unconfirmed,
|
|
56596
56822
|
submissionStatus: progress.uncertain ? "uncertain" : Object.keys(transactionHashes).length ? "hash_known" : "not_attempted",
|
|
56597
|
-
recoveryCommand: progress.journalSaved && !progress.uncertain && progress.phase !== "cleanup" && fingerprint2 ? `finch skill recover publication ${fingerprint2}` : null
|
|
56823
|
+
recoveryCommand: progress.journalSaved && !progress.uncertain && progress.phase !== "cleanup" && fingerprint2 ? `finch skill recover publication ${fingerprint2}` : null,
|
|
56824
|
+
resubmitSafe: progress.resubmitSafe === true
|
|
56598
56825
|
}, cause);
|
|
56599
56826
|
}
|
|
56600
56827
|
}
|
|
@@ -56619,7 +56846,7 @@ var init_skill_local_flow = __esm({
|
|
|
56619
56846
|
}
|
|
56620
56847
|
async upload(input) {
|
|
56621
56848
|
const { bytes } = input;
|
|
56622
|
-
if (bytes.byteLength === 0 || bytes.byteLength > MAX_ENCRYPTED_BYTES) throw new CliSkillSourceError("SKILL_UPLOAD_SIZE_INVALID", { actualBytes: bytes.byteLength, maxBytes: MAX_ENCRYPTED_BYTES },
|
|
56849
|
+
if (bytes.byteLength === 0 || bytes.byteLength > MAX_ENCRYPTED_BYTES) throw new CliSkillSourceError("SKILL_UPLOAD_SIZE_INVALID", { actualBytes: bytes.byteLength, maxBytes: MAX_ENCRYPTED_BYTES }, `Skill upload must be between 1 byte and ${MAX_ENCRYPTED_BYTES} bytes, including package metadata and encryption overhead.`);
|
|
56623
56850
|
const result2 = await required2(this.api.uploadSkillObject, "Skill upload").call(this.api, input);
|
|
56624
56851
|
return string4(result2.uri, "Pinned Skill URI", IPFS);
|
|
56625
56852
|
}
|
|
@@ -56693,8 +56920,8 @@ var init_skill_local_flow = __esm({
|
|
|
56693
56920
|
if (error51 instanceof SkillZipInvalidError) {
|
|
56694
56921
|
const messages = {
|
|
56695
56922
|
invalid_archive: "Skill ZIP is damaged or unsupported. Rebuild a regular ZIP and try again.",
|
|
56696
|
-
archive_too_large:
|
|
56697
|
-
expanded_content_too_large:
|
|
56923
|
+
archive_too_large: `Skill ZIP exceeds the ${MAX_SKILL_IMPORT_BYTES} byte compressed import limit. Reduce the archive size and try again.`,
|
|
56924
|
+
expanded_content_too_large: `Skill ZIP declares expanded content above the ${MAX_SKILL_IMPORT_BYTES} byte import limit. Reduce the uncompressed content and rebuild the ZIP.`,
|
|
56698
56925
|
utf8_flag_missing: "Skill ZIP filenames with non-ASCII characters must declare UTF-8 (bit 11). Rebuild the ZIP with UTF-8 filenames and flags.",
|
|
56699
56926
|
filename_encoding_invalid: "Skill ZIP filename bytes are not valid UTF-8. Rebuild the ZIP with UTF-8 filenames and flags."
|
|
56700
56927
|
};
|
|
@@ -56775,15 +57002,24 @@ var init_skill_local_flow = __esm({
|
|
|
56775
57002
|
await this.project(journal.chainId, journal.receipts[stage].transactionHash, context.bearer);
|
|
56776
57003
|
return;
|
|
56777
57004
|
}
|
|
56778
|
-
if (
|
|
57005
|
+
if (stage !== "uri" && (journal.pendingStage != null || journal.version !== 6)) {
|
|
56779
57006
|
progress.uncertain = true;
|
|
56780
|
-
throw new
|
|
57007
|
+
throw new CliSkillRecoveryUncertainError({
|
|
57008
|
+
stage,
|
|
57009
|
+
journalVersion: journal.version,
|
|
57010
|
+
kind: journal.kind,
|
|
57011
|
+
targetVersion: journal.targetVersion,
|
|
57012
|
+
marker: journal.pendingStage != null ? "pending" : "absent"
|
|
57013
|
+
});
|
|
56781
57014
|
}
|
|
56782
57015
|
progress.phase = "intent";
|
|
56783
57016
|
const prepared = await prepare();
|
|
56784
57017
|
progress.phase = "transaction";
|
|
56785
|
-
journal.
|
|
56786
|
-
|
|
57018
|
+
const marks = journal.version === 6;
|
|
57019
|
+
if (marks) {
|
|
57020
|
+
journal.pendingStage = stage;
|
|
57021
|
+
await this.save(fingerprint2, journal);
|
|
57022
|
+
}
|
|
56787
57023
|
progress.uncertain = true;
|
|
56788
57024
|
journal.receipts[stage] = await this.send(
|
|
56789
57025
|
context,
|
|
@@ -56794,12 +57030,14 @@ var init_skill_local_flow = __esm({
|
|
|
56794
57030
|
async ({ transactionHash: transactionHash3 }) => {
|
|
56795
57031
|
journal.receipts[stage] = { transactionHash: transactionHash3, blockNumber: null };
|
|
56796
57032
|
await this.save(fingerprint2, journal);
|
|
56797
|
-
|
|
56798
|
-
|
|
57033
|
+
if (marks) {
|
|
57034
|
+
journal.pendingStage = null;
|
|
57035
|
+
await this.save(fingerprint2, journal);
|
|
57036
|
+
}
|
|
56799
57037
|
progress.uncertain = false;
|
|
56800
57038
|
}
|
|
56801
57039
|
);
|
|
56802
|
-
journal.pendingStage = null;
|
|
57040
|
+
if (marks) journal.pendingStage = null;
|
|
56803
57041
|
await this.save(fingerprint2, journal);
|
|
56804
57042
|
progress.uncertain = false;
|
|
56805
57043
|
progress.phase = "projection";
|
|
@@ -57256,15 +57494,30 @@ var init_skill_local_flow = __esm({
|
|
|
57256
57494
|
await this.project(plan.chainId, submission.transactionHash, context.bearer);
|
|
57257
57495
|
return { ...submission, chainId: plan.chainId, skillId: plan.request.skillId, kind };
|
|
57258
57496
|
}
|
|
57497
|
+
/**
|
|
57498
|
+
* Binds a cover and an introduction to a Skill by replacing its manifest URI.
|
|
57499
|
+
*
|
|
57500
|
+
* Reported through the same publication progress as a publish, so a failure states the phase it
|
|
57501
|
+
* reached and whether a transaction was broadcast. It keeps no recovery journal, because the one
|
|
57502
|
+
* transaction it sends is `setSkillURI`: submitting the same plan again sets the same URI rather
|
|
57503
|
+
* than creating anything, which is why `resubmitSafe` is true here and never true for a publish.
|
|
57504
|
+
*/
|
|
57259
57505
|
async publishPresentation(planValue, context) {
|
|
57506
|
+
return this.publication((progress) => this.publishPresentationWithProgress(planValue, context, progress));
|
|
57507
|
+
}
|
|
57508
|
+
async publishPresentationWithProgress(planValue, context, progress) {
|
|
57260
57509
|
const plan = presentationPlan(planValue, context.walletAddress);
|
|
57510
|
+
progress.resubmitSafe = true;
|
|
57261
57511
|
const liveVersion = await required2(this.api.readSkillCurrentVersion, "Skill version API").call(this.api, plan.chainId, plan.skillId, context.bearer);
|
|
57262
57512
|
if (liveVersion !== plan.currentVersion) {
|
|
57263
|
-
throw new
|
|
57513
|
+
throw new CliSkillPresentationStaleError("version_moved", plan.currentVersion, liveVersion);
|
|
57264
57514
|
}
|
|
57265
57515
|
const currentBytes = await required2(this.api.fetchSkillStoredContent, "Skill content relay").call(this.api, plan.currentManifestURI, context.bearer);
|
|
57266
57516
|
const currentManifest = parseManifest(currentBytes);
|
|
57267
|
-
if (currentManifest === null)
|
|
57517
|
+
if (currentManifest === null) {
|
|
57518
|
+
throw new CliSkillPresentationStaleError("manifest_unreadable", plan.currentVersion, liveVersion);
|
|
57519
|
+
}
|
|
57520
|
+
progress.phase = "upload";
|
|
57268
57521
|
const manifestURI = await this.upload({
|
|
57269
57522
|
bytes: serializeManifest(withPresentation(currentManifest, plan.presentation)),
|
|
57270
57523
|
filename: `skill-${plan.skillId}.versions.json`,
|
|
@@ -57272,14 +57525,24 @@ var init_skill_local_flow = __esm({
|
|
|
57272
57525
|
objectKind: "manifest"
|
|
57273
57526
|
});
|
|
57274
57527
|
const request = { action: "setSkillURI", chainId: plan.chainId, skillId: plan.skillId, packageURI: manifestURI };
|
|
57528
|
+
progress.phase = "intent";
|
|
57275
57529
|
const prepared = await required2(this.api.requestSkillIntent, "Skill intent API").call(this.api, request, context.bearer);
|
|
57530
|
+
progress.phase = "transaction";
|
|
57531
|
+
progress.uncertain = true;
|
|
57276
57532
|
const submission = await this.send(
|
|
57277
57533
|
context,
|
|
57278
57534
|
"setSkillURI",
|
|
57279
57535
|
request,
|
|
57280
57536
|
prepared,
|
|
57281
|
-
plan.signingAuthority
|
|
57537
|
+
plan.signingAuthority,
|
|
57538
|
+
async ({ transactionHash: transactionHash3 }) => {
|
|
57539
|
+
progress.broadcast = { setSkillURI: transactionHash3 };
|
|
57540
|
+
progress.uncertain = false;
|
|
57541
|
+
}
|
|
57282
57542
|
);
|
|
57543
|
+
progress.broadcast = { setSkillURI: submission.transactionHash };
|
|
57544
|
+
progress.uncertain = false;
|
|
57545
|
+
progress.phase = "projection";
|
|
57283
57546
|
await this.project(plan.chainId, submission.transactionHash, context.bearer);
|
|
57284
57547
|
return { ...submission, chainId: plan.chainId, skillId: plan.skillId, currentVersion: plan.currentVersion, manifestURI };
|
|
57285
57548
|
}
|
|
@@ -58021,14 +58284,14 @@ var init_application = __esm({
|
|
|
58021
58284
|
}
|
|
58022
58285
|
async loginSite(requestUrl) {
|
|
58023
58286
|
const profile = await this.authorizedProfile();
|
|
58024
|
-
let
|
|
58287
|
+
let parsed2;
|
|
58025
58288
|
try {
|
|
58026
|
-
|
|
58289
|
+
parsed2 = new URL(requestUrl);
|
|
58027
58290
|
} catch {
|
|
58028
58291
|
throw new TypeError("Browser login request URL is invalid.");
|
|
58029
58292
|
}
|
|
58030
|
-
const match = /^\/auth\/agent\/request\/([0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/u.exec(
|
|
58031
|
-
if (
|
|
58293
|
+
const match = /^\/auth\/agent\/request\/([0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/u.exec(parsed2.pathname);
|
|
58294
|
+
if (parsed2.origin !== profile.origin || requestUrl !== `${profile.origin}${parsed2.pathname}` || parsed2.search !== "" || parsed2.hash !== "" || match === null) {
|
|
58032
58295
|
throw new TypeError("Browser login request origin or path does not match the active profile origin.");
|
|
58033
58296
|
}
|
|
58034
58297
|
const authority = await this.verifiedAgentCliAuthority();
|
|
@@ -58866,7 +59129,7 @@ var init_application = __esm({
|
|
|
58866
59129
|
const plan = await readBoundedJsonFile(planFile);
|
|
58867
59130
|
const context = isPlaintextSkillDelivery(plan) ? null : await this.skillLocalContext();
|
|
58868
59131
|
const delivered = await required3(this.skillLocalFlow, "skill local flow").download(plan, context);
|
|
58869
|
-
await writeExclusiveProtectedFile(outputFile, delivered.bytes);
|
|
59132
|
+
await writeExclusiveProtectedFile(outputFile, delivered.bytes, "output_destination");
|
|
58870
59133
|
return { path: outputFile, skillId: delivered.skillId, version: delivered.version, packageHash: delivered.packageHash };
|
|
58871
59134
|
}
|
|
58872
59135
|
async showIntent(intentId) {
|
|
@@ -58988,7 +59251,7 @@ var init_application = __esm({
|
|
|
58988
59251
|
if (decoded.keyId !== material.keyId || claim.expectedKeyId !== null && claim.expectedKeyId !== decoded.keyId) {
|
|
58989
59252
|
throw new TypeError("Credential material keyId does not match the live claim.");
|
|
58990
59253
|
}
|
|
58991
|
-
await writeExclusiveProtectedFile(outputFile, material.body);
|
|
59254
|
+
await writeExclusiveProtectedFile(outputFile, material.body, "output_destination");
|
|
58992
59255
|
return Object.freeze({ keyId: decoded.keyId, path: outputFile });
|
|
58993
59256
|
}
|
|
58994
59257
|
async showOperation(operationId) {
|
|
@@ -59146,7 +59409,7 @@ var init_package = __esm({
|
|
|
59146
59409
|
"package.json"() {
|
|
59147
59410
|
package_default = {
|
|
59148
59411
|
name: "@finchtech/cli",
|
|
59149
|
-
version: "0.3.
|
|
59412
|
+
version: "0.3.7",
|
|
59150
59413
|
description: "Finch Agent CLI for wallet-owned marketplace and MCP workflows.",
|
|
59151
59414
|
type: "module",
|
|
59152
59415
|
bin: {
|
|
@@ -60148,12 +60411,12 @@ function environment2(value) {
|
|
|
60148
60411
|
}
|
|
60149
60412
|
function endpointOrigin(value) {
|
|
60150
60413
|
if (typeof value !== "string" || !URL.canParse(value)) throw new CliStateError("CLI_STATE_CORRUPT");
|
|
60151
|
-
const
|
|
60152
|
-
const loopbackHttp =
|
|
60153
|
-
if (
|
|
60414
|
+
const parsed2 = new URL(value);
|
|
60415
|
+
const loopbackHttp = parsed2.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(parsed2.hostname);
|
|
60416
|
+
if (parsed2.origin !== value || parsed2.username !== "" || parsed2.password !== "" || parsed2.pathname !== "/" || parsed2.search !== "" || parsed2.hash !== "" || parsed2.protocol !== "https:" && !loopbackHttp) {
|
|
60154
60417
|
throw new CliStateError("CLI_STATE_CORRUPT");
|
|
60155
60418
|
}
|
|
60156
|
-
return
|
|
60419
|
+
return parsed2.origin;
|
|
60157
60420
|
}
|
|
60158
60421
|
function pendingGrantFingerprint(scopes, expiresAt) {
|
|
60159
60422
|
return createHash4("sha256").update(JSON.stringify({ scopes, expiresAt }), "utf8").digest("hex");
|
|
@@ -61211,11 +61474,11 @@ var init_chains2 = __esm({
|
|
|
61211
61474
|
|
|
61212
61475
|
// src/purchase-sender.ts
|
|
61213
61476
|
function parseRpcUrl(value) {
|
|
61214
|
-
const
|
|
61215
|
-
if (
|
|
61477
|
+
const parsed2 = new URL(value);
|
|
61478
|
+
if (parsed2.protocol !== "https:" || parsed2.username !== "" || parsed2.password !== "" || parsed2.hash !== "") {
|
|
61216
61479
|
throw new TypeError("The reviewed Agent RPC must be HTTPS without userinfo or fragment.");
|
|
61217
61480
|
}
|
|
61218
|
-
return
|
|
61481
|
+
return parsed2.href;
|
|
61219
61482
|
}
|
|
61220
61483
|
function privateKey2(value) {
|
|
61221
61484
|
if (!/^0x[0-9a-f]{64}$/u.test(value)) {
|
|
@@ -61512,11 +61775,11 @@ var init_purchase_sender = __esm({
|
|
|
61512
61775
|
|
|
61513
61776
|
// src/task-protocol-sender.ts
|
|
61514
61777
|
function parseRpcUrl2(value) {
|
|
61515
|
-
const
|
|
61516
|
-
if (
|
|
61778
|
+
const parsed2 = new URL(value);
|
|
61779
|
+
if (parsed2.protocol !== "https:" || parsed2.username !== "" || parsed2.password !== "" || parsed2.hash !== "") {
|
|
61517
61780
|
throw new TypeError("The reviewed Task RPC must be HTTPS without userinfo or fragment.");
|
|
61518
61781
|
}
|
|
61519
|
-
return
|
|
61782
|
+
return parsed2.href;
|
|
61520
61783
|
}
|
|
61521
61784
|
function installedPrivateKey(value) {
|
|
61522
61785
|
if (!/^0x[0-9a-f]{64}$/u.test(value)) throw new TypeError("The installed wallet private key is invalid.");
|
|
@@ -61542,9 +61805,9 @@ function unsigned(value, name) {
|
|
|
61542
61805
|
}
|
|
61543
61806
|
function uint642(value, name) {
|
|
61544
61807
|
if (!Number.isSafeInteger(value) || Number(value) < 0) throw new TypeError(`${name} is invalid.`);
|
|
61545
|
-
const
|
|
61546
|
-
if (
|
|
61547
|
-
return
|
|
61808
|
+
const parsed2 = BigInt(Number(value));
|
|
61809
|
+
if (parsed2 > 18446744073709551615n) throw new TypeError(`${name} is invalid.`);
|
|
61810
|
+
return parsed2;
|
|
61548
61811
|
}
|
|
61549
61812
|
function uint16(value, name) {
|
|
61550
61813
|
if (!Number.isSafeInteger(value) || Number(value) < 0 || Number(value) > 65535) {
|
|
@@ -61894,11 +62157,11 @@ var init_task_protocol_sender = __esm({
|
|
|
61894
62157
|
|
|
61895
62158
|
// src/skill-intent-sender.ts
|
|
61896
62159
|
function parseRpcUrl3(value) {
|
|
61897
|
-
const
|
|
61898
|
-
if (
|
|
62160
|
+
const parsed2 = new URL(value);
|
|
62161
|
+
if (parsed2.protocol !== "https:" || parsed2.username !== "" || parsed2.password !== "" || parsed2.hash !== "") {
|
|
61899
62162
|
throw new TypeError("The reviewed Skill RPC must be HTTPS without userinfo or fragment.");
|
|
61900
62163
|
}
|
|
61901
|
-
return
|
|
62164
|
+
return parsed2.href;
|
|
61902
62165
|
}
|
|
61903
62166
|
function installedPrivateKey2(value) {
|
|
61904
62167
|
if (!/^0x[0-9a-f]{64}$/u.test(value)) throw new TypeError("The installed wallet private key is invalid.");
|
|
@@ -62281,6 +62544,18 @@ var output_exports = {};
|
|
|
62281
62544
|
__export(output_exports, {
|
|
62282
62545
|
emitCliOutcome: () => emitCliOutcome
|
|
62283
62546
|
});
|
|
62547
|
+
function resubmitSafeGuidance(diagnostic) {
|
|
62548
|
+
if (diagnostic.submissionStatus === "not_attempted") {
|
|
62549
|
+
return "No transaction was sent. Submitting the same plan again is safe.";
|
|
62550
|
+
}
|
|
62551
|
+
return `${diagnostic.submissionStatus === "uncertain" ? "A transaction may have been broadcast without a returned hash." : "The transaction was broadcast and may still have reverted."} Read the Skill on chain first; resubmitting the same plan cannot apply twice, because it sets the same URI rather than creating anything.`;
|
|
62552
|
+
}
|
|
62553
|
+
function remoteCallerAction(status) {
|
|
62554
|
+
if (status === 401 || status === 403) return "authenticate";
|
|
62555
|
+
if (status === 400 || status === 422) return "fix_request";
|
|
62556
|
+
if (status === 409 || status === 412 || status === 428) return "refresh_resource";
|
|
62557
|
+
return null;
|
|
62558
|
+
}
|
|
62284
62559
|
function remoteExitCode(status) {
|
|
62285
62560
|
if (status === 400 || status === 422) return AGENT_CLI_OUTPUT_CONTRACT.exitCodes.usageOrLocalSchema;
|
|
62286
62561
|
if (status === 401 || status === 403) return AGENT_CLI_OUTPUT_CONTRACT.exitCodes.authenticationOrAuthority;
|
|
@@ -62313,6 +62588,23 @@ function failure(error51) {
|
|
|
62313
62588
|
message: "This protocol is not available in production."
|
|
62314
62589
|
};
|
|
62315
62590
|
}
|
|
62591
|
+
if (error51 instanceof CliSkillPresentationStaleError) {
|
|
62592
|
+
return {
|
|
62593
|
+
code: "AGENT_MARKET_STATE_CONFLICT",
|
|
62594
|
+
exitCode: AGENT_CLI_OUTPUT_CONTRACT.exitCodes.conflictOrPrecondition,
|
|
62595
|
+
message: error51.reason === "version_moved" ? `The Skill is now at version ${error51.liveVersion}; this presentation plan was prepared for version ${error51.planVersion}. Prepare the presentation again against the current version.` : "The Skill URI on chain does not hold a version manifest this CLI can extend. Re-read the Skill, then prepare the presentation again."
|
|
62596
|
+
};
|
|
62597
|
+
}
|
|
62598
|
+
if (error51 instanceof CliSkillRecoveryUncertainError) {
|
|
62599
|
+
const { stage, marker, kind, targetVersion } = error51.detail;
|
|
62600
|
+
const unknown2 = stage === "lit" ? `the delivery key for version ${targetVersion} was set` : kind === "version" ? `version ${targetVersion} was added` : "the Skill was created";
|
|
62601
|
+
const settled = stage === "lit" ? `version ${targetVersion} is already deliverable` : kind === "version" ? `the Skill is already at version ${targetVersion}` : "a Skill is already registered under this slug";
|
|
62602
|
+
return {
|
|
62603
|
+
code: "AGENT_MARKET_STATE_CONFLICT",
|
|
62604
|
+
exitCode: AGENT_CLI_OUTPUT_CONTRACT.exitCodes.conflictOrPrecondition,
|
|
62605
|
+
message: `${marker === "pending" ? "This recovery stopped after the transaction was prepared for sending" : "This recovery journal predates the pre-send marker"}, so whether ${unknown2} cannot be established locally. Read the Skill on chain first: if ${settled}, the transaction landed and only the local journal is behind. Contact support with this state rather than re-running the command.`
|
|
62606
|
+
};
|
|
62607
|
+
}
|
|
62316
62608
|
if (error51 instanceof CliRecoveryBlockedError) {
|
|
62317
62609
|
return {
|
|
62318
62610
|
code: "AGENT_MARKET_STATE_CONFLICT",
|
|
@@ -62353,17 +62645,32 @@ function emitCliOutcome(outcome, sinks) {
|
|
|
62353
62645
|
const envelope2 = JSON.parse(serialized);
|
|
62354
62646
|
const source = cause instanceof CliSkillSourceError ? cause : null;
|
|
62355
62647
|
const remote = cause instanceof CliHttpError && cause.envelope !== null;
|
|
62648
|
+
const uncertainRecovery = cause instanceof CliSkillRecoveryUncertainError;
|
|
62356
62649
|
const diagnostic = outcome.diagnostic;
|
|
62650
|
+
const inputBound = source !== null || !(cause instanceof CliHttpError) && diagnostic.phase === "validation";
|
|
62651
|
+
const remoteAction = remoteCallerAction(cause instanceof CliHttpError ? cause.status : null);
|
|
62652
|
+
const safeRepeat = diagnostic.resubmitSafe && !inputBound && remoteAction === null;
|
|
62357
62653
|
envelope2.error.state = JSON.stringify({
|
|
62358
62654
|
diagnosticCode: source?.diagnosticCode ?? "SKILL_PUBLICATION_FAILED",
|
|
62359
62655
|
...source?.details,
|
|
62360
62656
|
...diagnostic,
|
|
62361
62657
|
...cause instanceof CliHttpError ? { remoteStatus: cause.status, ...cause.diagnostic } : {},
|
|
62362
|
-
|
|
62658
|
+
// The message is kept beside the state because the branches below rewrite the top-level one:
|
|
62659
|
+
// whatever the Online API said about this failure has to survive somewhere it can be read.
|
|
62660
|
+
...remote ? { remoteStatus: cause.status, remoteState: envelope2.error.state, remoteMessage: envelope2.error.message } : {}
|
|
62363
62661
|
});
|
|
62364
62662
|
envelope2.error.retryable = false;
|
|
62365
|
-
if (!source && !remote && diagnostic.phase !== "validation") envelope2.error.message = `Skill publication failed during ${diagnostic.phase}. ${diagnostic.recoveryCommand ? "Use the recovery command in state; do not resubmit." : diagnostic.submissionStatus === "uncertain" ? "Broadcast outcome or checkpoint is uncertain. Contact support before retrying or recovering." : "Contact support with the public diagnostic state before retrying."}`;
|
|
62366
|
-
envelope2.error.nextAction = diagnostic.
|
|
62663
|
+
if (!source && !remote && !uncertainRecovery && diagnostic.phase !== "validation") envelope2.error.message = `Skill publication failed during ${diagnostic.phase}. ${diagnostic.recoveryCommand ? "Use the recovery command in state; do not resubmit." : safeRepeat ? resubmitSafeGuidance(diagnostic) : diagnostic.submissionStatus === "uncertain" ? "Broadcast outcome or checkpoint is uncertain. Contact support before retrying or recovering." : "Contact support with the public diagnostic state before retrying."}`;
|
|
62664
|
+
envelope2.error.nextAction = diagnostic.recoveryCommand ? "refresh_resource" : inputBound ? envelope2.error.nextAction : remoteAction !== null ? remoteAction : safeRepeat ? "refresh_resource" : diagnostic.submissionStatus === "uncertain" ? "contact_support" : (remote || diagnostic.phase === "validation") && ["authenticate", "request_scope", "fix_request"].includes(String(envelope2.error.nextAction)) ? envelope2.error.nextAction : "contact_support";
|
|
62665
|
+
if (safeRepeat) envelope2.error.retryable = true;
|
|
62666
|
+
if (diagnostic.phase === "projection" && diagnostic.submissionStatus === "hash_known") {
|
|
62667
|
+
const status = cause instanceof CliHttpError ? cause.status : null;
|
|
62668
|
+
const remaining = diagnostic.unconfirmedActions;
|
|
62669
|
+
const repeatNote = diagnostic.resubmitSafe ? "Submitting the same plan again is safe, though unnecessary once the projection lands." : "Do not resubmit the publication.";
|
|
62670
|
+
envelope2.error.message = remaining.length === 0 ? `Skill transactions succeeded; only the marketplace projection did not confirm. ${diagnostic.recoveryCommand ? "Re-read the Skill, then use the recovery command in state to finish the projection." : "Re-read the Skill and retry the projection."} ${repeatNote}` : `The transactions sent so far succeeded, but the publication is not finished: ${remaining.join(", ")} ${remaining.length === 1 ? "has" : "have"} not been sent. ${diagnostic.recoveryCommand ? "Use the recovery command in state to send the remaining transactions." : "Contact support with the public diagnostic state."} ${repeatNote}`;
|
|
62671
|
+
envelope2.error.retryable = true;
|
|
62672
|
+
envelope2.error.nextAction = status === 401 || status === 403 ? "authenticate" : remaining.length === 0 ? "retry_later" : diagnostic.recoveryCommand ? "refresh_resource" : "contact_support";
|
|
62673
|
+
}
|
|
62367
62674
|
sinks.stdout(`${JSON.stringify(envelope2)}
|
|
62368
62675
|
`);
|
|
62369
62676
|
return exitCode;
|