@finchtech/cli 0.3.5 → 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 +16 -8
- package/dist/finch.js +1209 -813
- package/package.json +2 -2
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")
|
|
@@ -4349,7 +4349,7 @@ var require_core = __commonJS({
|
|
|
4349
4349
|
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
4350
4350
|
if (!errors || errors.length === 0)
|
|
4351
4351
|
return "No errors";
|
|
4352
|
-
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((
|
|
4352
|
+
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text3, msg) => text3 + separator + msg);
|
|
4353
4353
|
}
|
|
4354
4354
|
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
4355
4355
|
const rules = this.RULES.all;
|
|
@@ -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 });
|
|
@@ -9579,7 +9612,7 @@ function baseX({ name, prefix, alphabet, caseInsensitive = false }) {
|
|
|
9579
9612
|
prefix,
|
|
9580
9613
|
name,
|
|
9581
9614
|
encode: encode10,
|
|
9582
|
-
decode: (
|
|
9615
|
+
decode: (text3) => coerce(decode10(text3))
|
|
9583
9616
|
});
|
|
9584
9617
|
}
|
|
9585
9618
|
function decode2(string5, alphabetIdx, bitsPerChar, name) {
|
|
@@ -9699,12 +9732,12 @@ var init_base = __esm({
|
|
|
9699
9732
|
this.prefixCodePoint = prefixCodePoint;
|
|
9700
9733
|
this.baseDecode = baseDecode;
|
|
9701
9734
|
}
|
|
9702
|
-
decode(
|
|
9703
|
-
if (typeof
|
|
9704
|
-
if (
|
|
9705
|
-
throw Error(`Unable to decode multibase string ${JSON.stringify(
|
|
9735
|
+
decode(text3) {
|
|
9736
|
+
if (typeof text3 === "string") {
|
|
9737
|
+
if (text3.codePointAt(0) !== this.prefixCodePoint) {
|
|
9738
|
+
throw Error(`Unable to decode multibase string ${JSON.stringify(text3)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);
|
|
9706
9739
|
}
|
|
9707
|
-
return this.baseDecode(
|
|
9740
|
+
return this.baseDecode(text3.slice(this.prefix.length));
|
|
9708
9741
|
} else {
|
|
9709
9742
|
throw Error("Can only multibase decode strings");
|
|
9710
9743
|
}
|
|
@@ -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,44 +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
|
-
});
|
|
14672
|
-
displayTextSchema = (minBytes, maxBytes) => 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({
|
|
14673
14724
|
type: "string",
|
|
14674
|
-
|
|
14675
|
-
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
"x-finch-
|
|
14679
|
-
|
|
14680
|
-
|
|
14681
|
-
|
|
14682
|
-
|
|
14683
|
-
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);
|
|
14684
14734
|
agentMarketRevisionDisplaySchema = strictObjectSchema({
|
|
14685
14735
|
displayName: agentMarketDisplayNameSchema,
|
|
14686
14736
|
description: agentMarketDescriptionSchema
|
|
@@ -15122,6 +15172,53 @@ var init_identity = __esm({
|
|
|
15122
15172
|
}
|
|
15123
15173
|
});
|
|
15124
15174
|
|
|
15175
|
+
// ../../packages/agent-market-contracts/src/v1/localization.ts
|
|
15176
|
+
var agentMarketMultilineCopySchema, text2, listingInputRequestSchema, saveListingRequestSchema, listingSaveResponseSchema;
|
|
15177
|
+
var init_localization = __esm({
|
|
15178
|
+
"../../packages/agent-market-contracts/src/v1/localization.ts"() {
|
|
15179
|
+
"use strict";
|
|
15180
|
+
init_common2();
|
|
15181
|
+
init_display();
|
|
15182
|
+
agentMarketMultilineCopySchema = (maxLength) => agentMarketUnicodeTextSchema(0, maxLength);
|
|
15183
|
+
text2 = strictObjectSchema({
|
|
15184
|
+
name: agentMarketUnicodeTextSchema(1, 120),
|
|
15185
|
+
description: agentMarketMultilineCopySchema(5e3),
|
|
15186
|
+
deliverable: agentMarketMultilineCopySchema(2e3),
|
|
15187
|
+
serviceBoundary: agentMarketMultilineCopySchema(2e3)
|
|
15188
|
+
}, ["name", "description"]);
|
|
15189
|
+
listingInputRequestSchema = strictObjectSchema({
|
|
15190
|
+
inputLocales: {
|
|
15191
|
+
type: "array",
|
|
15192
|
+
minItems: 1,
|
|
15193
|
+
maxItems: 3,
|
|
15194
|
+
uniqueItems: true,
|
|
15195
|
+
items: { enum: ["en", "zh", "zh-TW"] },
|
|
15196
|
+
description: "Explicit authored languages. One queues the other two; multiple languages disable automatic translation."
|
|
15197
|
+
},
|
|
15198
|
+
translations: strictObjectSchema({ en: text2, zh: text2, "zh-TW": text2 }, [])
|
|
15199
|
+
});
|
|
15200
|
+
saveListingRequestSchema = strictObjectSchema({
|
|
15201
|
+
versionRevision: positiveRevisionSchema,
|
|
15202
|
+
integrationFamily: { enum: ["agenton_v2", "direct_api_v1"] },
|
|
15203
|
+
displayName: agentMarketDisplayNameSchema,
|
|
15204
|
+
description: agentMarketDescriptionSchema,
|
|
15205
|
+
supportContact: agentMarketUnicodeTextSchema(3, 320),
|
|
15206
|
+
avatarUri: { type: "string", maxLength: 2048 },
|
|
15207
|
+
avatarMediaType: { enum: [null, "image/jpeg", "image/png", "image/webp", "video/mp4", "video/webm"] },
|
|
15208
|
+
category: { type: "string", maxLength: 80 },
|
|
15209
|
+
tags: { type: "array", maxItems: 16, items: agentMarketUnicodeTextSchema(1, 80) },
|
|
15210
|
+
deliverable: agentMarketMultilineCopySchema(1e3),
|
|
15211
|
+
serviceBoundary: agentMarketMultilineCopySchema(1e3),
|
|
15212
|
+
localization: listingInputRequestSchema
|
|
15213
|
+
}, ["versionRevision", "integrationFamily", "displayName", "description", "supportContact", "avatarUri", "avatarMediaType", "category", "tags", "deliverable", "serviceBoundary"]);
|
|
15214
|
+
listingSaveResponseSchema = strictObjectSchema({
|
|
15215
|
+
serviceVersionId: { type: "string", format: "uuid" },
|
|
15216
|
+
versionRevision: positiveRevisionSchema,
|
|
15217
|
+
presentationRevision: positiveRevisionSchema
|
|
15218
|
+
});
|
|
15219
|
+
}
|
|
15220
|
+
});
|
|
15221
|
+
|
|
15125
15222
|
// ../../packages/agent-market-contracts/src/v1/merchant.ts
|
|
15126
15223
|
function signedStatusVariants(kind, denialCode, executionFailureCode, successResult, extra = {}) {
|
|
15127
15224
|
const base3 = (status) => ({ ...signedBase(kind, status), ...extra });
|
|
@@ -15141,6 +15238,7 @@ var init_merchant = __esm({
|
|
|
15141
15238
|
"../../packages/agent-market-contracts/src/v1/merchant.ts"() {
|
|
15142
15239
|
"use strict";
|
|
15143
15240
|
init_common2();
|
|
15241
|
+
init_localization();
|
|
15144
15242
|
init_validation_input();
|
|
15145
15243
|
init_display();
|
|
15146
15244
|
init_actions();
|
|
@@ -15216,8 +15314,9 @@ var init_merchant = __esm({
|
|
|
15216
15314
|
displayName: agentMarketDisplayNameSchema,
|
|
15217
15315
|
description: agentMarketDescriptionSchema,
|
|
15218
15316
|
supportContact: agentMarketSupportContactSchema,
|
|
15219
|
-
avatarUri: nullableIpfsUriSchema
|
|
15220
|
-
|
|
15317
|
+
avatarUri: nullableIpfsUriSchema,
|
|
15318
|
+
localization: listingInputRequestSchema
|
|
15319
|
+
}, ["integrationFamily", "displayName", "description", "supportContact", "avatarUri"]);
|
|
15221
15320
|
agentResponseSchema = strictObjectSchema({
|
|
15222
15321
|
agentId: canonicalUuidSchema,
|
|
15223
15322
|
supportContact: agentMarketSupportContactSchema,
|
|
@@ -15305,8 +15404,9 @@ var init_merchant = __esm({
|
|
|
15305
15404
|
createAdditionalVersionRequestSchema = strictObjectSchema({
|
|
15306
15405
|
integrationFamily: { type: "string", enum: integrationFamilyValues },
|
|
15307
15406
|
displayName: agentMarketDisplayNameSchema,
|
|
15308
|
-
description: agentMarketDescriptionSchema
|
|
15309
|
-
|
|
15407
|
+
description: agentMarketDescriptionSchema,
|
|
15408
|
+
localization: listingInputRequestSchema
|
|
15409
|
+
}, ["integrationFamily", "displayName", "description"]);
|
|
15310
15410
|
beginVersionDraftRequestSchema = emptyStrictObjectSchema;
|
|
15311
15411
|
beginVersionDraftResponseSchema = strictObjectSchema({
|
|
15312
15412
|
serviceVersionId: canonicalUuidSchema,
|
|
@@ -15393,7 +15493,7 @@ var init_merchant = __esm({
|
|
|
15393
15493
|
artifactContract: artifactBatchContractSchema,
|
|
15394
15494
|
validationInput: validationInputSchema
|
|
15395
15495
|
};
|
|
15396
|
-
createOfferRequestSchema = strictObjectSchema(offerConfigurationProperties);
|
|
15496
|
+
createOfferRequestSchema = strictObjectSchema({ ...offerConfigurationProperties, localization: listingInputRequestSchema }, Object.keys(offerConfigurationProperties));
|
|
15397
15497
|
replaceOfferRequestSchema = createOfferRequestSchema;
|
|
15398
15498
|
offerResponseSchema = strictObjectSchema({
|
|
15399
15499
|
offerId: canonicalUuidSchema,
|
|
@@ -15861,6 +15961,7 @@ var init_public_catalog = __esm({
|
|
|
15861
15961
|
});
|
|
15862
15962
|
publicAgentOnDetailSchema = strictObjectSchema({
|
|
15863
15963
|
...publicSummaryProperties,
|
|
15964
|
+
supportContact: { anyOf: [agentMarketSupportContactSchema, { type: "null" }] },
|
|
15864
15965
|
integrationFamily: { const: "agenton_v2" },
|
|
15865
15966
|
runtimeRevision: positiveRevisionSchema,
|
|
15866
15967
|
runtimeConfigHash: hex32Schema,
|
|
@@ -15872,6 +15973,7 @@ var init_public_catalog = __esm({
|
|
|
15872
15973
|
});
|
|
15873
15974
|
publicDirectDetailSchema = strictObjectSchema({
|
|
15874
15975
|
...publicSummaryProperties,
|
|
15976
|
+
supportContact: { anyOf: [agentMarketSupportContactSchema, { type: "null" }] },
|
|
15875
15977
|
integrationFamily: { const: "direct_api_v1" },
|
|
15876
15978
|
runtimeRevision: positiveRevisionSchema,
|
|
15877
15979
|
runtimeConfigHash: hex32Schema,
|
|
@@ -16013,6 +16115,7 @@ var families, AGENT_MARKET_V1_OPERATIONS, CLI_IDEMPOTENCY_RETRY_CONTRACT, REQUES
|
|
|
16013
16115
|
var init_operations = __esm({
|
|
16014
16116
|
"../../packages/agent-market-contracts/src/v1/operations.ts"() {
|
|
16015
16117
|
"use strict";
|
|
16118
|
+
init_localization();
|
|
16016
16119
|
init_artifacts();
|
|
16017
16120
|
init_agent_cli();
|
|
16018
16121
|
init_buyer();
|
|
@@ -16128,6 +16231,19 @@ var init_operations = __esm({
|
|
|
16128
16231
|
sessionWrites: false,
|
|
16129
16232
|
writes: true
|
|
16130
16233
|
}),
|
|
16234
|
+
"merchant_listings.replace": operation({
|
|
16235
|
+
id: "merchant_listings.replace",
|
|
16236
|
+
requiredScope: "agent_market:merchant:write",
|
|
16237
|
+
http: http("put", "/api/v1/agent-market/merchant/versions/{versionId}/listing", 200, {
|
|
16238
|
+
requestSchema: saveListingRequestSchema,
|
|
16239
|
+
responseSchema: listingSaveResponseSchema,
|
|
16240
|
+
idempotencyRequired: true
|
|
16241
|
+
}),
|
|
16242
|
+
mcp: { name: "agent_market_merchant_listing_replace" },
|
|
16243
|
+
cli: null,
|
|
16244
|
+
integrationFamilies: families.active,
|
|
16245
|
+
writes: true
|
|
16246
|
+
}),
|
|
16131
16247
|
"merchant_versions.get": operation({
|
|
16132
16248
|
id: "merchant_versions.get",
|
|
16133
16249
|
requiredScope: "agent_market:merchant:read",
|
|
@@ -16840,9 +16956,9 @@ var init_operations = __esm({
|
|
|
16840
16956
|
expectedSha256: "0x483944fda693c326c11d8caa70df5c52e9854eb2ec58e50d5f7483b323fdfe7b"
|
|
16841
16957
|
}),
|
|
16842
16958
|
publication: Object.freeze({
|
|
16843
|
-
byteLength:
|
|
16844
|
-
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}}]',
|
|
16845
|
-
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"
|
|
16846
16962
|
}),
|
|
16847
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"])
|
|
16848
16964
|
});
|
|
@@ -16861,18 +16977,18 @@ var init_operations = __esm({
|
|
|
16861
16977
|
});
|
|
16862
16978
|
|
|
16863
16979
|
// ../../packages/agent-market-contracts/src/v1/mcp.ts
|
|
16864
|
-
function bodyVariants(
|
|
16865
|
-
if (
|
|
16866
|
-
const candidate =
|
|
16980
|
+
function bodyVariants(schema5) {
|
|
16981
|
+
if (schema5 === void 0) return [{}];
|
|
16982
|
+
const candidate = schema5;
|
|
16867
16983
|
if (candidate.oneOf !== void 0) return candidate.oneOf.flatMap((variant) => bodyVariants(variant));
|
|
16868
16984
|
return [candidate];
|
|
16869
16985
|
}
|
|
16870
16986
|
function unionProperties(variants) {
|
|
16871
16987
|
const candidates = /* @__PURE__ */ new Map();
|
|
16872
16988
|
for (const { properties } of variants) {
|
|
16873
|
-
for (const [field,
|
|
16989
|
+
for (const [field, schema5] of Object.entries(properties ?? {})) {
|
|
16874
16990
|
const alternatives = candidates.get(field) ?? /* @__PURE__ */ new Map();
|
|
16875
|
-
alternatives.set(JSON.stringify(
|
|
16991
|
+
alternatives.set(JSON.stringify(schema5), schema5);
|
|
16876
16992
|
candidates.set(field, alternatives);
|
|
16877
16993
|
}
|
|
16878
16994
|
}
|
|
@@ -16978,12 +17094,12 @@ var init_mcp = __esm({
|
|
|
16978
17094
|
});
|
|
16979
17095
|
|
|
16980
17096
|
// ../../packages/agent-market-contracts/src/v1/openapi.ts
|
|
16981
|
-
function mediaTypeContent(contentType,
|
|
16982
|
-
return { content: { [contentType]: { schema:
|
|
17097
|
+
function mediaTypeContent(contentType, schema5) {
|
|
17098
|
+
return { content: { [contentType]: { schema: schema5 } } };
|
|
16983
17099
|
}
|
|
16984
17100
|
function responseHeaderObjects(schemas) {
|
|
16985
17101
|
return Object.fromEntries(
|
|
16986
|
-
Object.entries(schemas).map(([name,
|
|
17102
|
+
Object.entries(schemas).map(([name, schema5]) => [name, { schema: schema5 }])
|
|
16987
17103
|
);
|
|
16988
17104
|
}
|
|
16989
17105
|
function operationParameters(http3) {
|
|
@@ -16993,16 +17109,16 @@ function operationParameters(http3) {
|
|
|
16993
17109
|
required: true,
|
|
16994
17110
|
schema: canonicalUuidSchema
|
|
16995
17111
|
}));
|
|
16996
|
-
for (const [name,
|
|
17112
|
+
for (const [name, schema5] of Object.entries(http3.querySchema?.properties ?? {})) {
|
|
16997
17113
|
parameters.push({
|
|
16998
17114
|
name,
|
|
16999
17115
|
in: "query",
|
|
17000
17116
|
required: http3.querySchema?.required?.includes(name) ?? false,
|
|
17001
|
-
schema:
|
|
17117
|
+
schema: schema5
|
|
17002
17118
|
});
|
|
17003
17119
|
}
|
|
17004
|
-
for (const [name,
|
|
17005
|
-
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 });
|
|
17006
17122
|
}
|
|
17007
17123
|
if (http3.idempotencyRequired) parameters.push({ $ref: "#/components/parameters/IdempotencyKey" });
|
|
17008
17124
|
if (http3.ifMatchRequired) parameters.push({ $ref: "#/components/parameters/IfMatch" });
|
|
@@ -17351,6 +17467,7 @@ var init_v1 = __esm({
|
|
|
17351
17467
|
init_snapshot();
|
|
17352
17468
|
init_testnet_purchase_v1();
|
|
17353
17469
|
init_validation_input();
|
|
17470
|
+
init_localization();
|
|
17354
17471
|
}
|
|
17355
17472
|
});
|
|
17356
17473
|
|
|
@@ -17440,7 +17557,7 @@ var init_schemas = __esm({
|
|
|
17440
17557
|
}, ["content"]);
|
|
17441
17558
|
taskReviewRequestSchema = strictObjectSchema2({
|
|
17442
17559
|
submissionIds: { type: "array", minItems: 1, maxItems: 100, uniqueItems: true, items: canonicalUuidSchema2 },
|
|
17443
|
-
action: { type: "string", enum: ["approve", "reject", "spam", "favorite", "unfavorite"] },
|
|
17560
|
+
action: { type: "string", enum: ["approve", "cancel_award", "reject", "spam", "favorite", "unfavorite"] },
|
|
17444
17561
|
spamReason: { type: "string", maxLength: 200 }
|
|
17445
17562
|
}, ["submissionIds", "action"]);
|
|
17446
17563
|
signedAwardSchema = strictObjectSchema2({
|
|
@@ -17537,24 +17654,24 @@ var init_schemas = __esm({
|
|
|
17537
17654
|
function operation2(value) {
|
|
17538
17655
|
return Object.freeze(value);
|
|
17539
17656
|
}
|
|
17540
|
-
function schemaFields(
|
|
17541
|
-
if (
|
|
17542
|
-
const shape =
|
|
17657
|
+
function schemaFields(schema5) {
|
|
17658
|
+
if (schema5 === void 0) return {};
|
|
17659
|
+
const shape = schema5;
|
|
17543
17660
|
return Object.freeze(Object.assign(
|
|
17544
17661
|
{},
|
|
17545
17662
|
shape.properties ?? {},
|
|
17546
17663
|
...(shape.oneOf ?? []).map((variant) => schemaFields(variant))
|
|
17547
17664
|
));
|
|
17548
17665
|
}
|
|
17549
|
-
function requiredFields(
|
|
17550
|
-
return
|
|
17666
|
+
function requiredFields(schema5) {
|
|
17667
|
+
return schema5?.required ?? [];
|
|
17551
17668
|
}
|
|
17552
17669
|
function inputSchema(fields, required4, body) {
|
|
17553
|
-
const
|
|
17670
|
+
const schema5 = strictObjectSchema2(fields, required4);
|
|
17554
17671
|
const variants = body?.oneOf ?? [];
|
|
17555
|
-
if (variants.length === 0) return
|
|
17672
|
+
if (variants.length === 0) return schema5;
|
|
17556
17673
|
return Object.freeze({
|
|
17557
|
-
...
|
|
17674
|
+
...schema5,
|
|
17558
17675
|
oneOf: variants.map((variant) => Object.freeze({ required: requiredFields(variant) }))
|
|
17559
17676
|
});
|
|
17560
17677
|
}
|
|
@@ -17857,8 +17974,8 @@ function mergeDefs(...defs) {
|
|
|
17857
17974
|
}
|
|
17858
17975
|
return Object.defineProperties({}, mergedDescriptors);
|
|
17859
17976
|
}
|
|
17860
|
-
function cloneDef(
|
|
17861
|
-
return mergeDefs(
|
|
17977
|
+
function cloneDef(schema5) {
|
|
17978
|
+
return mergeDefs(schema5._zod.def);
|
|
17862
17979
|
}
|
|
17863
17980
|
function getElementAtPath(obj, path2) {
|
|
17864
17981
|
if (!path2)
|
|
@@ -17999,14 +18116,14 @@ function optionalKeys(shape) {
|
|
|
17999
18116
|
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
18000
18117
|
});
|
|
18001
18118
|
}
|
|
18002
|
-
function pick(
|
|
18003
|
-
const currDef =
|
|
18119
|
+
function pick(schema5, mask) {
|
|
18120
|
+
const currDef = schema5._zod.def;
|
|
18004
18121
|
const checks = currDef.checks;
|
|
18005
18122
|
const hasChecks = checks && checks.length > 0;
|
|
18006
18123
|
if (hasChecks) {
|
|
18007
18124
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
18008
18125
|
}
|
|
18009
|
-
const def = mergeDefs(
|
|
18126
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18010
18127
|
get shape() {
|
|
18011
18128
|
const newShape = {};
|
|
18012
18129
|
for (const key in mask) {
|
|
@@ -18022,18 +18139,18 @@ function pick(schema4, mask) {
|
|
|
18022
18139
|
},
|
|
18023
18140
|
checks: []
|
|
18024
18141
|
});
|
|
18025
|
-
return clone(
|
|
18142
|
+
return clone(schema5, def);
|
|
18026
18143
|
}
|
|
18027
|
-
function omit(
|
|
18028
|
-
const currDef =
|
|
18144
|
+
function omit(schema5, mask) {
|
|
18145
|
+
const currDef = schema5._zod.def;
|
|
18029
18146
|
const checks = currDef.checks;
|
|
18030
18147
|
const hasChecks = checks && checks.length > 0;
|
|
18031
18148
|
if (hasChecks) {
|
|
18032
18149
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
18033
18150
|
}
|
|
18034
|
-
const def = mergeDefs(
|
|
18151
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18035
18152
|
get shape() {
|
|
18036
|
-
const newShape = { ...
|
|
18153
|
+
const newShape = { ...schema5._zod.def.shape };
|
|
18037
18154
|
for (const key in mask) {
|
|
18038
18155
|
if (!(key in currDef.shape)) {
|
|
18039
18156
|
throw new Error(`Unrecognized key: "${key}"`);
|
|
@@ -18047,43 +18164,43 @@ function omit(schema4, mask) {
|
|
|
18047
18164
|
},
|
|
18048
18165
|
checks: []
|
|
18049
18166
|
});
|
|
18050
|
-
return clone(
|
|
18167
|
+
return clone(schema5, def);
|
|
18051
18168
|
}
|
|
18052
|
-
function extend(
|
|
18169
|
+
function extend(schema5, shape) {
|
|
18053
18170
|
if (!isPlainObject(shape)) {
|
|
18054
18171
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
18055
18172
|
}
|
|
18056
|
-
const checks =
|
|
18173
|
+
const checks = schema5._zod.def.checks;
|
|
18057
18174
|
const hasChecks = checks && checks.length > 0;
|
|
18058
18175
|
if (hasChecks) {
|
|
18059
|
-
const existingShape =
|
|
18176
|
+
const existingShape = schema5._zod.def.shape;
|
|
18060
18177
|
for (const key in shape) {
|
|
18061
18178
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
18062
18179
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
18063
18180
|
}
|
|
18064
18181
|
}
|
|
18065
18182
|
}
|
|
18066
|
-
const def = mergeDefs(
|
|
18183
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18067
18184
|
get shape() {
|
|
18068
|
-
const _shape = { ...
|
|
18185
|
+
const _shape = { ...schema5._zod.def.shape, ...shape };
|
|
18069
18186
|
assignProp(this, "shape", _shape);
|
|
18070
18187
|
return _shape;
|
|
18071
18188
|
}
|
|
18072
18189
|
});
|
|
18073
|
-
return clone(
|
|
18190
|
+
return clone(schema5, def);
|
|
18074
18191
|
}
|
|
18075
|
-
function safeExtend(
|
|
18192
|
+
function safeExtend(schema5, shape) {
|
|
18076
18193
|
if (!isPlainObject(shape)) {
|
|
18077
18194
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
18078
18195
|
}
|
|
18079
|
-
const def = mergeDefs(
|
|
18196
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18080
18197
|
get shape() {
|
|
18081
|
-
const _shape = { ...
|
|
18198
|
+
const _shape = { ...schema5._zod.def.shape, ...shape };
|
|
18082
18199
|
assignProp(this, "shape", _shape);
|
|
18083
18200
|
return _shape;
|
|
18084
18201
|
}
|
|
18085
18202
|
});
|
|
18086
|
-
return clone(
|
|
18203
|
+
return clone(schema5, def);
|
|
18087
18204
|
}
|
|
18088
18205
|
function merge(a, b) {
|
|
18089
18206
|
if (a._zod.def.checks?.length) {
|
|
@@ -18102,16 +18219,16 @@ function merge(a, b) {
|
|
|
18102
18219
|
});
|
|
18103
18220
|
return clone(a, def);
|
|
18104
18221
|
}
|
|
18105
|
-
function partial(Class2,
|
|
18106
|
-
const currDef =
|
|
18222
|
+
function partial(Class2, schema5, mask) {
|
|
18223
|
+
const currDef = schema5._zod.def;
|
|
18107
18224
|
const checks = currDef.checks;
|
|
18108
18225
|
const hasChecks = checks && checks.length > 0;
|
|
18109
18226
|
if (hasChecks) {
|
|
18110
18227
|
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
18111
18228
|
}
|
|
18112
|
-
const def = mergeDefs(
|
|
18229
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18113
18230
|
get shape() {
|
|
18114
|
-
const oldShape =
|
|
18231
|
+
const oldShape = schema5._zod.def.shape;
|
|
18115
18232
|
const shape = { ...oldShape };
|
|
18116
18233
|
if (mask) {
|
|
18117
18234
|
for (const key in mask) {
|
|
@@ -18138,12 +18255,12 @@ function partial(Class2, schema4, mask) {
|
|
|
18138
18255
|
},
|
|
18139
18256
|
checks: []
|
|
18140
18257
|
});
|
|
18141
|
-
return clone(
|
|
18258
|
+
return clone(schema5, def);
|
|
18142
18259
|
}
|
|
18143
|
-
function required(Class2,
|
|
18144
|
-
const def = mergeDefs(
|
|
18260
|
+
function required(Class2, schema5, mask) {
|
|
18261
|
+
const def = mergeDefs(schema5._zod.def, {
|
|
18145
18262
|
get shape() {
|
|
18146
|
-
const oldShape =
|
|
18263
|
+
const oldShape = schema5._zod.def.shape;
|
|
18147
18264
|
const shape = { ...oldShape };
|
|
18148
18265
|
if (mask) {
|
|
18149
18266
|
for (const key in mask) {
|
|
@@ -18169,7 +18286,7 @@ function required(Class2, schema4, mask) {
|
|
|
18169
18286
|
return shape;
|
|
18170
18287
|
}
|
|
18171
18288
|
});
|
|
18172
|
-
return clone(
|
|
18289
|
+
return clone(schema5, def);
|
|
18173
18290
|
}
|
|
18174
18291
|
function aborted(x2, startIndex = 0) {
|
|
18175
18292
|
if (x2.aborted === true)
|
|
@@ -18549,9 +18666,9 @@ var init_parse = __esm({
|
|
|
18549
18666
|
init_core();
|
|
18550
18667
|
init_errors2();
|
|
18551
18668
|
init_util();
|
|
18552
|
-
_parse = (_Err) => (
|
|
18669
|
+
_parse = (_Err) => (schema5, value, _ctx, _params) => {
|
|
18553
18670
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
18554
|
-
const result2 =
|
|
18671
|
+
const result2 = schema5._zod.run({ value, issues: [] }, ctx);
|
|
18555
18672
|
if (result2 instanceof Promise) {
|
|
18556
18673
|
throw new $ZodAsyncError();
|
|
18557
18674
|
}
|
|
@@ -18563,9 +18680,9 @@ var init_parse = __esm({
|
|
|
18563
18680
|
return result2.value;
|
|
18564
18681
|
};
|
|
18565
18682
|
parse2 = /* @__PURE__ */ _parse($ZodRealError);
|
|
18566
|
-
_parseAsync = (_Err) => async (
|
|
18683
|
+
_parseAsync = (_Err) => async (schema5, value, _ctx, params) => {
|
|
18567
18684
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
18568
|
-
let result2 =
|
|
18685
|
+
let result2 = schema5._zod.run({ value, issues: [] }, ctx);
|
|
18569
18686
|
if (result2 instanceof Promise)
|
|
18570
18687
|
result2 = await result2;
|
|
18571
18688
|
if (result2.issues.length) {
|
|
@@ -18576,9 +18693,9 @@ var init_parse = __esm({
|
|
|
18576
18693
|
return result2.value;
|
|
18577
18694
|
};
|
|
18578
18695
|
parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
18579
|
-
_safeParse = (_Err) => (
|
|
18696
|
+
_safeParse = (_Err) => (schema5, value, _ctx) => {
|
|
18580
18697
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
18581
|
-
const result2 =
|
|
18698
|
+
const result2 = schema5._zod.run({ value, issues: [] }, ctx);
|
|
18582
18699
|
if (result2 instanceof Promise) {
|
|
18583
18700
|
throw new $ZodAsyncError();
|
|
18584
18701
|
}
|
|
@@ -18588,9 +18705,9 @@ var init_parse = __esm({
|
|
|
18588
18705
|
} : { success: true, data: result2.value };
|
|
18589
18706
|
};
|
|
18590
18707
|
safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
18591
|
-
_safeParseAsync = (_Err) => async (
|
|
18708
|
+
_safeParseAsync = (_Err) => async (schema5, value, _ctx) => {
|
|
18592
18709
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
18593
|
-
let result2 =
|
|
18710
|
+
let result2 = schema5._zod.run({ value, issues: [] }, ctx);
|
|
18594
18711
|
if (result2 instanceof Promise)
|
|
18595
18712
|
result2 = await result2;
|
|
18596
18713
|
return result2.issues.length ? {
|
|
@@ -18599,40 +18716,40 @@ var init_parse = __esm({
|
|
|
18599
18716
|
} : { success: true, data: result2.value };
|
|
18600
18717
|
};
|
|
18601
18718
|
safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
18602
|
-
_encode = (_Err) => (
|
|
18719
|
+
_encode = (_Err) => (schema5, value, _ctx) => {
|
|
18603
18720
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
18604
|
-
return _parse(_Err)(
|
|
18721
|
+
return _parse(_Err)(schema5, value, ctx);
|
|
18605
18722
|
};
|
|
18606
18723
|
encode5 = /* @__PURE__ */ _encode($ZodRealError);
|
|
18607
|
-
_decode = (_Err) => (
|
|
18608
|
-
return _parse(_Err)(
|
|
18724
|
+
_decode = (_Err) => (schema5, value, _ctx) => {
|
|
18725
|
+
return _parse(_Err)(schema5, value, _ctx);
|
|
18609
18726
|
};
|
|
18610
18727
|
decode7 = /* @__PURE__ */ _decode($ZodRealError);
|
|
18611
|
-
_encodeAsync = (_Err) => async (
|
|
18728
|
+
_encodeAsync = (_Err) => async (schema5, value, _ctx) => {
|
|
18612
18729
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
18613
|
-
return _parseAsync(_Err)(
|
|
18730
|
+
return _parseAsync(_Err)(schema5, value, ctx);
|
|
18614
18731
|
};
|
|
18615
18732
|
encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
18616
|
-
_decodeAsync = (_Err) => async (
|
|
18617
|
-
return _parseAsync(_Err)(
|
|
18733
|
+
_decodeAsync = (_Err) => async (schema5, value, _ctx) => {
|
|
18734
|
+
return _parseAsync(_Err)(schema5, value, _ctx);
|
|
18618
18735
|
};
|
|
18619
18736
|
decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
18620
|
-
_safeEncode = (_Err) => (
|
|
18737
|
+
_safeEncode = (_Err) => (schema5, value, _ctx) => {
|
|
18621
18738
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
18622
|
-
return _safeParse(_Err)(
|
|
18739
|
+
return _safeParse(_Err)(schema5, value, ctx);
|
|
18623
18740
|
};
|
|
18624
18741
|
safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
18625
|
-
_safeDecode = (_Err) => (
|
|
18626
|
-
return _safeParse(_Err)(
|
|
18742
|
+
_safeDecode = (_Err) => (schema5, value, _ctx) => {
|
|
18743
|
+
return _safeParse(_Err)(schema5, value, _ctx);
|
|
18627
18744
|
};
|
|
18628
18745
|
safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
18629
|
-
_safeEncodeAsync = (_Err) => async (
|
|
18746
|
+
_safeEncodeAsync = (_Err) => async (schema5, value, _ctx) => {
|
|
18630
18747
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
18631
|
-
return _safeParseAsync(_Err)(
|
|
18748
|
+
return _safeParseAsync(_Err)(schema5, value, ctx);
|
|
18632
18749
|
};
|
|
18633
18750
|
safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
18634
|
-
_safeDecodeAsync = (_Err) => async (
|
|
18635
|
-
return _safeParseAsync(_Err)(
|
|
18751
|
+
_safeDecodeAsync = (_Err) => async (schema5, value, _ctx) => {
|
|
18752
|
+
return _safeParseAsync(_Err)(schema5, value, _ctx);
|
|
18636
18753
|
};
|
|
18637
18754
|
safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
18638
18755
|
}
|
|
@@ -20521,9 +20638,9 @@ var init_schemas2 = __esm({
|
|
|
20521
20638
|
for (const key of normalized.keys) {
|
|
20522
20639
|
const id = ids[key];
|
|
20523
20640
|
const k = esc(key);
|
|
20524
|
-
const
|
|
20525
|
-
const isOptionalIn =
|
|
20526
|
-
const isOptionalOut =
|
|
20641
|
+
const schema5 = shape[key];
|
|
20642
|
+
const isOptionalIn = schema5?._zod?.optin === "optional";
|
|
20643
|
+
const isOptionalOut = schema5?._zod?.optout === "optional";
|
|
20527
20644
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
20528
20645
|
if (isOptionalIn && isOptionalOut) {
|
|
20529
20646
|
doc.write(`
|
|
@@ -24920,8 +25037,8 @@ var capitalizeFirstCharacter, error28;
|
|
|
24920
25037
|
var init_lt = __esm({
|
|
24921
25038
|
"../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/lt.js"() {
|
|
24922
25039
|
init_util();
|
|
24923
|
-
capitalizeFirstCharacter = (
|
|
24924
|
-
return
|
|
25040
|
+
capitalizeFirstCharacter = (text3) => {
|
|
25041
|
+
return text3.charAt(0).toUpperCase() + text3.slice(1);
|
|
24925
25042
|
};
|
|
24926
25043
|
error28 = () => {
|
|
24927
25044
|
const Sizable = {
|
|
@@ -27853,11 +27970,11 @@ var init_registries = __esm({
|
|
|
27853
27970
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
27854
27971
|
this._idmap = /* @__PURE__ */ new Map();
|
|
27855
27972
|
}
|
|
27856
|
-
add(
|
|
27973
|
+
add(schema5, ..._meta) {
|
|
27857
27974
|
const meta3 = _meta[0];
|
|
27858
|
-
this._map.set(
|
|
27975
|
+
this._map.set(schema5, meta3);
|
|
27859
27976
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
27860
|
-
this._idmap.set(meta3.id,
|
|
27977
|
+
this._idmap.set(meta3.id, schema5);
|
|
27861
27978
|
}
|
|
27862
27979
|
return this;
|
|
27863
27980
|
}
|
|
@@ -27866,26 +27983,26 @@ var init_registries = __esm({
|
|
|
27866
27983
|
this._idmap = /* @__PURE__ */ new Map();
|
|
27867
27984
|
return this;
|
|
27868
27985
|
}
|
|
27869
|
-
remove(
|
|
27870
|
-
const meta3 = this._map.get(
|
|
27986
|
+
remove(schema5) {
|
|
27987
|
+
const meta3 = this._map.get(schema5);
|
|
27871
27988
|
if (meta3 && typeof meta3 === "object" && "id" in meta3) {
|
|
27872
27989
|
this._idmap.delete(meta3.id);
|
|
27873
27990
|
}
|
|
27874
|
-
this._map.delete(
|
|
27991
|
+
this._map.delete(schema5);
|
|
27875
27992
|
return this;
|
|
27876
27993
|
}
|
|
27877
|
-
get(
|
|
27878
|
-
const p =
|
|
27994
|
+
get(schema5) {
|
|
27995
|
+
const p = schema5._zod.parent;
|
|
27879
27996
|
if (p) {
|
|
27880
27997
|
const pm = { ...this.get(p) ?? {} };
|
|
27881
27998
|
delete pm.id;
|
|
27882
|
-
const f = { ...pm, ...this._map.get(
|
|
27999
|
+
const f = { ...pm, ...this._map.get(schema5) };
|
|
27883
28000
|
return Object.keys(f).length ? f : void 0;
|
|
27884
28001
|
}
|
|
27885
|
-
return this._map.get(
|
|
28002
|
+
return this._map.get(schema5);
|
|
27886
28003
|
}
|
|
27887
|
-
has(
|
|
27888
|
-
return this._map.has(
|
|
28004
|
+
has(schema5) {
|
|
28005
|
+
return this._map.has(schema5);
|
|
27889
28006
|
}
|
|
27890
28007
|
};
|
|
27891
28008
|
(_a3 = globalThis).__zod_globalRegistry ?? (_a3.__zod_globalRegistry = registry());
|
|
@@ -28530,11 +28647,11 @@ function _endsWith(suffix, params) {
|
|
|
28530
28647
|
});
|
|
28531
28648
|
}
|
|
28532
28649
|
// @__NO_SIDE_EFFECTS__
|
|
28533
|
-
function _property(property,
|
|
28650
|
+
function _property(property, schema5, params) {
|
|
28534
28651
|
return new $ZodCheckProperty({
|
|
28535
28652
|
check: "property",
|
|
28536
28653
|
property,
|
|
28537
|
-
schema:
|
|
28654
|
+
schema: schema5,
|
|
28538
28655
|
...normalizeParams(params)
|
|
28539
28656
|
});
|
|
28540
28657
|
}
|
|
@@ -28782,23 +28899,23 @@ function _promise(Class2, innerType) {
|
|
|
28782
28899
|
function _custom(Class2, fn, _params) {
|
|
28783
28900
|
const norm = normalizeParams(_params);
|
|
28784
28901
|
norm.abort ?? (norm.abort = true);
|
|
28785
|
-
const
|
|
28902
|
+
const schema5 = new Class2({
|
|
28786
28903
|
type: "custom",
|
|
28787
28904
|
check: "custom",
|
|
28788
28905
|
fn,
|
|
28789
28906
|
...norm
|
|
28790
28907
|
});
|
|
28791
|
-
return
|
|
28908
|
+
return schema5;
|
|
28792
28909
|
}
|
|
28793
28910
|
// @__NO_SIDE_EFFECTS__
|
|
28794
28911
|
function _refine(Class2, fn, _params) {
|
|
28795
|
-
const
|
|
28912
|
+
const schema5 = new Class2({
|
|
28796
28913
|
type: "custom",
|
|
28797
28914
|
check: "custom",
|
|
28798
28915
|
fn,
|
|
28799
28916
|
...normalizeParams(_params)
|
|
28800
28917
|
});
|
|
28801
|
-
return
|
|
28918
|
+
return schema5;
|
|
28802
28919
|
}
|
|
28803
28920
|
// @__NO_SIDE_EFFECTS__
|
|
28804
28921
|
function _superRefine(fn, params) {
|
|
@@ -28963,40 +29080,40 @@ function initializeContext(params) {
|
|
|
28963
29080
|
external: params?.external ?? void 0
|
|
28964
29081
|
};
|
|
28965
29082
|
}
|
|
28966
|
-
function process2(
|
|
29083
|
+
function process2(schema5, ctx, _params = { path: [], schemaPath: [] }) {
|
|
28967
29084
|
var _a4;
|
|
28968
|
-
const def =
|
|
28969
|
-
const seen = ctx.seen.get(
|
|
29085
|
+
const def = schema5._zod.def;
|
|
29086
|
+
const seen = ctx.seen.get(schema5);
|
|
28970
29087
|
if (seen) {
|
|
28971
29088
|
seen.count++;
|
|
28972
|
-
const isCycle = _params.schemaPath.includes(
|
|
29089
|
+
const isCycle = _params.schemaPath.includes(schema5);
|
|
28973
29090
|
if (isCycle) {
|
|
28974
29091
|
seen.cycle = _params.path;
|
|
28975
29092
|
}
|
|
28976
29093
|
return seen.schema;
|
|
28977
29094
|
}
|
|
28978
29095
|
const result2 = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
28979
|
-
ctx.seen.set(
|
|
28980
|
-
const overrideSchema =
|
|
29096
|
+
ctx.seen.set(schema5, result2);
|
|
29097
|
+
const overrideSchema = schema5._zod.toJSONSchema?.();
|
|
28981
29098
|
if (overrideSchema) {
|
|
28982
29099
|
result2.schema = overrideSchema;
|
|
28983
29100
|
} else {
|
|
28984
29101
|
const params = {
|
|
28985
29102
|
..._params,
|
|
28986
|
-
schemaPath: [..._params.schemaPath,
|
|
29103
|
+
schemaPath: [..._params.schemaPath, schema5],
|
|
28987
29104
|
path: _params.path
|
|
28988
29105
|
};
|
|
28989
|
-
if (
|
|
28990
|
-
|
|
29106
|
+
if (schema5._zod.processJSONSchema) {
|
|
29107
|
+
schema5._zod.processJSONSchema(ctx, result2.schema, params);
|
|
28991
29108
|
} else {
|
|
28992
29109
|
const _json = result2.schema;
|
|
28993
29110
|
const processor = ctx.processors[def.type];
|
|
28994
29111
|
if (!processor) {
|
|
28995
29112
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
28996
29113
|
}
|
|
28997
|
-
processor(
|
|
29114
|
+
processor(schema5, ctx, _json, params);
|
|
28998
29115
|
}
|
|
28999
|
-
const parent =
|
|
29116
|
+
const parent = schema5._zod.parent;
|
|
29000
29117
|
if (parent) {
|
|
29001
29118
|
if (!result2.ref)
|
|
29002
29119
|
result2.ref = parent;
|
|
@@ -29004,21 +29121,21 @@ function process2(schema4, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
29004
29121
|
ctx.seen.get(parent).isParent = true;
|
|
29005
29122
|
}
|
|
29006
29123
|
}
|
|
29007
|
-
const meta3 = ctx.metadataRegistry.get(
|
|
29124
|
+
const meta3 = ctx.metadataRegistry.get(schema5);
|
|
29008
29125
|
if (meta3)
|
|
29009
29126
|
Object.assign(result2.schema, meta3);
|
|
29010
|
-
if (ctx.io === "input" && isTransforming(
|
|
29127
|
+
if (ctx.io === "input" && isTransforming(schema5)) {
|
|
29011
29128
|
delete result2.schema.examples;
|
|
29012
29129
|
delete result2.schema.default;
|
|
29013
29130
|
}
|
|
29014
29131
|
if (ctx.io === "input" && "_prefault" in result2.schema)
|
|
29015
29132
|
(_a4 = result2.schema).default ?? (_a4.default = result2.schema._prefault);
|
|
29016
29133
|
delete result2.schema._prefault;
|
|
29017
|
-
const _result = ctx.seen.get(
|
|
29134
|
+
const _result = ctx.seen.get(schema5);
|
|
29018
29135
|
return _result.schema;
|
|
29019
29136
|
}
|
|
29020
|
-
function extractDefs(ctx,
|
|
29021
|
-
const root = ctx.seen.get(
|
|
29137
|
+
function extractDefs(ctx, schema5) {
|
|
29138
|
+
const root = ctx.seen.get(schema5);
|
|
29022
29139
|
if (!root)
|
|
29023
29140
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
29024
29141
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
@@ -29061,11 +29178,11 @@ function extractDefs(ctx, schema4) {
|
|
|
29061
29178
|
seen.def = { ...seen.schema };
|
|
29062
29179
|
if (defId)
|
|
29063
29180
|
seen.defId = defId;
|
|
29064
|
-
const
|
|
29065
|
-
for (const key in
|
|
29066
|
-
delete
|
|
29181
|
+
const schema6 = seen.schema;
|
|
29182
|
+
for (const key in schema6) {
|
|
29183
|
+
delete schema6[key];
|
|
29067
29184
|
}
|
|
29068
|
-
|
|
29185
|
+
schema6.$ref = ref;
|
|
29069
29186
|
};
|
|
29070
29187
|
if (ctx.cycles === "throw") {
|
|
29071
29188
|
for (const entry2 of ctx.seen.entries()) {
|
|
@@ -29079,13 +29196,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29079
29196
|
}
|
|
29080
29197
|
for (const entry2 of ctx.seen.entries()) {
|
|
29081
29198
|
const seen = entry2[1];
|
|
29082
|
-
if (
|
|
29199
|
+
if (schema5 === entry2[0]) {
|
|
29083
29200
|
extractToDef(entry2);
|
|
29084
29201
|
continue;
|
|
29085
29202
|
}
|
|
29086
29203
|
if (ctx.external) {
|
|
29087
29204
|
const ext = ctx.external.registry.get(entry2[0])?.id;
|
|
29088
|
-
if (
|
|
29205
|
+
if (schema5 !== entry2[0] && ext) {
|
|
29089
29206
|
extractToDef(entry2);
|
|
29090
29207
|
continue;
|
|
29091
29208
|
}
|
|
@@ -29107,16 +29224,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29107
29224
|
}
|
|
29108
29225
|
}
|
|
29109
29226
|
}
|
|
29110
|
-
function finalize(ctx,
|
|
29111
|
-
const root = ctx.seen.get(
|
|
29227
|
+
function finalize(ctx, schema5) {
|
|
29228
|
+
const root = ctx.seen.get(schema5);
|
|
29112
29229
|
if (!root)
|
|
29113
29230
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
29114
29231
|
const flattenRef = (zodSchema) => {
|
|
29115
29232
|
const seen = ctx.seen.get(zodSchema);
|
|
29116
29233
|
if (seen.ref === null)
|
|
29117
29234
|
return;
|
|
29118
|
-
const
|
|
29119
|
-
const _cached = { ...
|
|
29235
|
+
const schema6 = seen.def ?? seen.schema;
|
|
29236
|
+
const _cached = { ...schema6 };
|
|
29120
29237
|
const ref = seen.ref;
|
|
29121
29238
|
seen.ref = null;
|
|
29122
29239
|
if (ref) {
|
|
@@ -29124,28 +29241,28 @@ function finalize(ctx, schema4) {
|
|
|
29124
29241
|
const refSeen = ctx.seen.get(ref);
|
|
29125
29242
|
const refSchema = refSeen.schema;
|
|
29126
29243
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
29127
|
-
|
|
29128
|
-
|
|
29244
|
+
schema6.allOf = schema6.allOf ?? [];
|
|
29245
|
+
schema6.allOf.push(refSchema);
|
|
29129
29246
|
} else {
|
|
29130
|
-
Object.assign(
|
|
29247
|
+
Object.assign(schema6, refSchema);
|
|
29131
29248
|
}
|
|
29132
|
-
Object.assign(
|
|
29249
|
+
Object.assign(schema6, _cached);
|
|
29133
29250
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
29134
29251
|
if (isParentRef) {
|
|
29135
|
-
for (const key in
|
|
29252
|
+
for (const key in schema6) {
|
|
29136
29253
|
if (key === "$ref" || key === "allOf")
|
|
29137
29254
|
continue;
|
|
29138
29255
|
if (!(key in _cached)) {
|
|
29139
|
-
delete
|
|
29256
|
+
delete schema6[key];
|
|
29140
29257
|
}
|
|
29141
29258
|
}
|
|
29142
29259
|
}
|
|
29143
29260
|
if (refSchema.$ref && refSeen.def) {
|
|
29144
|
-
for (const key in
|
|
29261
|
+
for (const key in schema6) {
|
|
29145
29262
|
if (key === "$ref" || key === "allOf")
|
|
29146
29263
|
continue;
|
|
29147
|
-
if (key in refSeen.def && JSON.stringify(
|
|
29148
|
-
delete
|
|
29264
|
+
if (key in refSeen.def && JSON.stringify(schema6[key]) === JSON.stringify(refSeen.def[key])) {
|
|
29265
|
+
delete schema6[key];
|
|
29149
29266
|
}
|
|
29150
29267
|
}
|
|
29151
29268
|
}
|
|
@@ -29155,13 +29272,13 @@ function finalize(ctx, schema4) {
|
|
|
29155
29272
|
flattenRef(parent);
|
|
29156
29273
|
const parentSeen = ctx.seen.get(parent);
|
|
29157
29274
|
if (parentSeen?.schema.$ref) {
|
|
29158
|
-
|
|
29275
|
+
schema6.$ref = parentSeen.schema.$ref;
|
|
29159
29276
|
if (parentSeen.def) {
|
|
29160
|
-
for (const key in
|
|
29277
|
+
for (const key in schema6) {
|
|
29161
29278
|
if (key === "$ref" || key === "allOf")
|
|
29162
29279
|
continue;
|
|
29163
|
-
if (key in parentSeen.def && JSON.stringify(
|
|
29164
|
-
delete
|
|
29280
|
+
if (key in parentSeen.def && JSON.stringify(schema6[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
29281
|
+
delete schema6[key];
|
|
29165
29282
|
}
|
|
29166
29283
|
}
|
|
29167
29284
|
}
|
|
@@ -29169,7 +29286,7 @@ function finalize(ctx, schema4) {
|
|
|
29169
29286
|
}
|
|
29170
29287
|
ctx.override({
|
|
29171
29288
|
zodSchema,
|
|
29172
|
-
jsonSchema:
|
|
29289
|
+
jsonSchema: schema6,
|
|
29173
29290
|
path: seen.path ?? []
|
|
29174
29291
|
});
|
|
29175
29292
|
};
|
|
@@ -29187,13 +29304,13 @@ function finalize(ctx, schema4) {
|
|
|
29187
29304
|
} else {
|
|
29188
29305
|
}
|
|
29189
29306
|
if (ctx.external?.uri) {
|
|
29190
|
-
const id = ctx.external.registry.get(
|
|
29307
|
+
const id = ctx.external.registry.get(schema5)?.id;
|
|
29191
29308
|
if (!id)
|
|
29192
29309
|
throw new Error("Schema is missing an `id` property");
|
|
29193
29310
|
result2.$id = ctx.external.uri(id);
|
|
29194
29311
|
}
|
|
29195
29312
|
Object.assign(result2, root.def ?? root.schema);
|
|
29196
|
-
const rootMetaId = ctx.metadataRegistry.get(
|
|
29313
|
+
const rootMetaId = ctx.metadataRegistry.get(schema5)?.id;
|
|
29197
29314
|
if (rootMetaId !== void 0 && result2.id === rootMetaId)
|
|
29198
29315
|
delete result2.id;
|
|
29199
29316
|
const defs = ctx.external?.defs ?? {};
|
|
@@ -29219,10 +29336,10 @@ function finalize(ctx, schema4) {
|
|
|
29219
29336
|
const finalized = JSON.parse(JSON.stringify(result2));
|
|
29220
29337
|
Object.defineProperty(finalized, "~standard", {
|
|
29221
29338
|
value: {
|
|
29222
|
-
...
|
|
29339
|
+
...schema5["~standard"],
|
|
29223
29340
|
jsonSchema: {
|
|
29224
|
-
input: createStandardJSONSchemaMethod(
|
|
29225
|
-
output: createStandardJSONSchemaMethod(
|
|
29341
|
+
input: createStandardJSONSchemaMethod(schema5, "input", ctx.processors),
|
|
29342
|
+
output: createStandardJSONSchemaMethod(schema5, "output", ctx.processors)
|
|
29226
29343
|
}
|
|
29227
29344
|
},
|
|
29228
29345
|
enumerable: false,
|
|
@@ -29290,18 +29407,18 @@ var createToJSONSchemaMethod, createStandardJSONSchemaMethod;
|
|
|
29290
29407
|
var init_to_json_schema = __esm({
|
|
29291
29408
|
"../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js"() {
|
|
29292
29409
|
init_registries();
|
|
29293
|
-
createToJSONSchemaMethod = (
|
|
29410
|
+
createToJSONSchemaMethod = (schema5, processors = {}) => (params) => {
|
|
29294
29411
|
const ctx = initializeContext({ ...params, processors });
|
|
29295
|
-
process2(
|
|
29296
|
-
extractDefs(ctx,
|
|
29297
|
-
return finalize(ctx,
|
|
29412
|
+
process2(schema5, ctx);
|
|
29413
|
+
extractDefs(ctx, schema5);
|
|
29414
|
+
return finalize(ctx, schema5);
|
|
29298
29415
|
};
|
|
29299
|
-
createStandardJSONSchemaMethod = (
|
|
29416
|
+
createStandardJSONSchemaMethod = (schema5, io, processors = {}) => (params) => {
|
|
29300
29417
|
const { libraryOptions, target } = params ?? {};
|
|
29301
29418
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
29302
|
-
process2(
|
|
29303
|
-
extractDefs(ctx,
|
|
29304
|
-
return finalize(ctx,
|
|
29419
|
+
process2(schema5, ctx);
|
|
29420
|
+
extractDefs(ctx, schema5);
|
|
29421
|
+
return finalize(ctx, schema5);
|
|
29305
29422
|
};
|
|
29306
29423
|
}
|
|
29307
29424
|
});
|
|
@@ -29313,8 +29430,8 @@ function toJSONSchema(input, params) {
|
|
|
29313
29430
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
29314
29431
|
const defs = {};
|
|
29315
29432
|
for (const entry2 of registry2._idmap.entries()) {
|
|
29316
|
-
const [_,
|
|
29317
|
-
process2(
|
|
29433
|
+
const [_, schema5] = entry2;
|
|
29434
|
+
process2(schema5, ctx2);
|
|
29318
29435
|
}
|
|
29319
29436
|
const schemas = {};
|
|
29320
29437
|
const external = {
|
|
@@ -29324,9 +29441,9 @@ function toJSONSchema(input, params) {
|
|
|
29324
29441
|
};
|
|
29325
29442
|
ctx2.external = external;
|
|
29326
29443
|
for (const entry2 of registry2._idmap.entries()) {
|
|
29327
|
-
const [key,
|
|
29328
|
-
extractDefs(ctx2,
|
|
29329
|
-
schemas[key] = finalize(ctx2,
|
|
29444
|
+
const [key, schema5] = entry2;
|
|
29445
|
+
extractDefs(ctx2, schema5);
|
|
29446
|
+
schemas[key] = finalize(ctx2, schema5);
|
|
29330
29447
|
}
|
|
29331
29448
|
if (Object.keys(defs).length > 0) {
|
|
29332
29449
|
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
@@ -29354,10 +29471,10 @@ var init_json_schema_processors = __esm({
|
|
|
29354
29471
|
regex: ""
|
|
29355
29472
|
// do not set
|
|
29356
29473
|
};
|
|
29357
|
-
stringProcessor = (
|
|
29474
|
+
stringProcessor = (schema5, ctx, _json, _params) => {
|
|
29358
29475
|
const json2 = _json;
|
|
29359
29476
|
json2.type = "string";
|
|
29360
|
-
const { minimum, maximum, format: format3, patterns, contentEncoding } =
|
|
29477
|
+
const { minimum, maximum, format: format3, patterns, contentEncoding } = schema5._zod.bag;
|
|
29361
29478
|
if (typeof minimum === "number")
|
|
29362
29479
|
json2.minLength = minimum;
|
|
29363
29480
|
if (typeof maximum === "number")
|
|
@@ -29386,9 +29503,9 @@ var init_json_schema_processors = __esm({
|
|
|
29386
29503
|
}
|
|
29387
29504
|
}
|
|
29388
29505
|
};
|
|
29389
|
-
numberProcessor = (
|
|
29506
|
+
numberProcessor = (schema5, ctx, _json, _params) => {
|
|
29390
29507
|
const json2 = _json;
|
|
29391
|
-
const { minimum, maximum, format: format3, multipleOf, exclusiveMaximum, exclusiveMinimum } =
|
|
29508
|
+
const { minimum, maximum, format: format3, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema5._zod.bag;
|
|
29392
29509
|
if (typeof format3 === "string" && format3.includes("int"))
|
|
29393
29510
|
json2.type = "integer";
|
|
29394
29511
|
else
|
|
@@ -29463,8 +29580,8 @@ var init_json_schema_processors = __esm({
|
|
|
29463
29580
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
29464
29581
|
}
|
|
29465
29582
|
};
|
|
29466
|
-
enumProcessor = (
|
|
29467
|
-
const def =
|
|
29583
|
+
enumProcessor = (schema5, _ctx, json2, _params) => {
|
|
29584
|
+
const def = schema5._zod.def;
|
|
29468
29585
|
const values = getEnumValues(def.entries);
|
|
29469
29586
|
if (values.every((v) => typeof v === "number"))
|
|
29470
29587
|
json2.type = "number";
|
|
@@ -29472,8 +29589,8 @@ var init_json_schema_processors = __esm({
|
|
|
29472
29589
|
json2.type = "string";
|
|
29473
29590
|
json2.enum = values;
|
|
29474
29591
|
};
|
|
29475
|
-
literalProcessor = (
|
|
29476
|
-
const def =
|
|
29592
|
+
literalProcessor = (schema5, ctx, json2, _params) => {
|
|
29593
|
+
const def = schema5._zod.def;
|
|
29477
29594
|
const vals = [];
|
|
29478
29595
|
for (const val of def.values) {
|
|
29479
29596
|
if (val === void 0) {
|
|
@@ -29517,22 +29634,22 @@ var init_json_schema_processors = __esm({
|
|
|
29517
29634
|
throw new Error("NaN cannot be represented in JSON Schema");
|
|
29518
29635
|
}
|
|
29519
29636
|
};
|
|
29520
|
-
templateLiteralProcessor = (
|
|
29637
|
+
templateLiteralProcessor = (schema5, _ctx, json2, _params) => {
|
|
29521
29638
|
const _json = json2;
|
|
29522
|
-
const pattern =
|
|
29639
|
+
const pattern = schema5._zod.pattern;
|
|
29523
29640
|
if (!pattern)
|
|
29524
29641
|
throw new Error("Pattern not found in template literal");
|
|
29525
29642
|
_json.type = "string";
|
|
29526
29643
|
_json.pattern = pattern.source;
|
|
29527
29644
|
};
|
|
29528
|
-
fileProcessor = (
|
|
29645
|
+
fileProcessor = (schema5, _ctx, json2, _params) => {
|
|
29529
29646
|
const _json = json2;
|
|
29530
29647
|
const file2 = {
|
|
29531
29648
|
type: "string",
|
|
29532
29649
|
format: "binary",
|
|
29533
29650
|
contentEncoding: "binary"
|
|
29534
29651
|
};
|
|
29535
|
-
const { minimum, maximum, mime } =
|
|
29652
|
+
const { minimum, maximum, mime } = schema5._zod.bag;
|
|
29536
29653
|
if (minimum !== void 0)
|
|
29537
29654
|
file2.minLength = minimum;
|
|
29538
29655
|
if (maximum !== void 0)
|
|
@@ -29577,10 +29694,10 @@ var init_json_schema_processors = __esm({
|
|
|
29577
29694
|
throw new Error("Set cannot be represented in JSON Schema");
|
|
29578
29695
|
}
|
|
29579
29696
|
};
|
|
29580
|
-
arrayProcessor = (
|
|
29697
|
+
arrayProcessor = (schema5, ctx, _json, params) => {
|
|
29581
29698
|
const json2 = _json;
|
|
29582
|
-
const def =
|
|
29583
|
-
const { minimum, maximum } =
|
|
29699
|
+
const def = schema5._zod.def;
|
|
29700
|
+
const { minimum, maximum } = schema5._zod.bag;
|
|
29584
29701
|
if (typeof minimum === "number")
|
|
29585
29702
|
json2.minItems = minimum;
|
|
29586
29703
|
if (typeof maximum === "number")
|
|
@@ -29591,9 +29708,9 @@ var init_json_schema_processors = __esm({
|
|
|
29591
29708
|
path: [...params.path, "items"]
|
|
29592
29709
|
});
|
|
29593
29710
|
};
|
|
29594
|
-
objectProcessor = (
|
|
29711
|
+
objectProcessor = (schema5, ctx, _json, params) => {
|
|
29595
29712
|
const json2 = _json;
|
|
29596
|
-
const def =
|
|
29713
|
+
const def = schema5._zod.def;
|
|
29597
29714
|
json2.type = "object";
|
|
29598
29715
|
json2.properties = {};
|
|
29599
29716
|
const shape = def.shape;
|
|
@@ -29627,8 +29744,8 @@ var init_json_schema_processors = __esm({
|
|
|
29627
29744
|
});
|
|
29628
29745
|
}
|
|
29629
29746
|
};
|
|
29630
|
-
unionProcessor = (
|
|
29631
|
-
const def =
|
|
29747
|
+
unionProcessor = (schema5, ctx, json2, params) => {
|
|
29748
|
+
const def = schema5._zod.def;
|
|
29632
29749
|
const isExclusive = def.inclusive === false;
|
|
29633
29750
|
const options = def.options.map((x2, i2) => process2(x2, ctx, {
|
|
29634
29751
|
...params,
|
|
@@ -29640,8 +29757,8 @@ var init_json_schema_processors = __esm({
|
|
|
29640
29757
|
json2.anyOf = options;
|
|
29641
29758
|
}
|
|
29642
29759
|
};
|
|
29643
|
-
intersectionProcessor = (
|
|
29644
|
-
const def =
|
|
29760
|
+
intersectionProcessor = (schema5, ctx, json2, params) => {
|
|
29761
|
+
const def = schema5._zod.def;
|
|
29645
29762
|
const a = process2(def.left, ctx, {
|
|
29646
29763
|
...params,
|
|
29647
29764
|
path: [...params.path, "allOf", 0]
|
|
@@ -29657,9 +29774,9 @@ var init_json_schema_processors = __esm({
|
|
|
29657
29774
|
];
|
|
29658
29775
|
json2.allOf = allOf;
|
|
29659
29776
|
};
|
|
29660
|
-
tupleProcessor = (
|
|
29777
|
+
tupleProcessor = (schema5, ctx, _json, params) => {
|
|
29661
29778
|
const json2 = _json;
|
|
29662
|
-
const def =
|
|
29779
|
+
const def = schema5._zod.def;
|
|
29663
29780
|
json2.type = "array";
|
|
29664
29781
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
29665
29782
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
@@ -29693,15 +29810,15 @@ var init_json_schema_processors = __esm({
|
|
|
29693
29810
|
json2.additionalItems = rest;
|
|
29694
29811
|
}
|
|
29695
29812
|
}
|
|
29696
|
-
const { minimum, maximum } =
|
|
29813
|
+
const { minimum, maximum } = schema5._zod.bag;
|
|
29697
29814
|
if (typeof minimum === "number")
|
|
29698
29815
|
json2.minItems = minimum;
|
|
29699
29816
|
if (typeof maximum === "number")
|
|
29700
29817
|
json2.maxItems = maximum;
|
|
29701
29818
|
};
|
|
29702
|
-
recordProcessor = (
|
|
29819
|
+
recordProcessor = (schema5, ctx, _json, params) => {
|
|
29703
29820
|
const json2 = _json;
|
|
29704
|
-
const def =
|
|
29821
|
+
const def = schema5._zod.def;
|
|
29705
29822
|
json2.type = "object";
|
|
29706
29823
|
const keyType = def.keyType;
|
|
29707
29824
|
const keyBag = keyType._zod.bag;
|
|
@@ -29735,10 +29852,10 @@ var init_json_schema_processors = __esm({
|
|
|
29735
29852
|
}
|
|
29736
29853
|
}
|
|
29737
29854
|
};
|
|
29738
|
-
nullableProcessor = (
|
|
29739
|
-
const def =
|
|
29855
|
+
nullableProcessor = (schema5, ctx, json2, params) => {
|
|
29856
|
+
const def = schema5._zod.def;
|
|
29740
29857
|
const inner = process2(def.innerType, ctx, params);
|
|
29741
|
-
const seen = ctx.seen.get(
|
|
29858
|
+
const seen = ctx.seen.get(schema5);
|
|
29742
29859
|
if (ctx.target === "openapi-3.0") {
|
|
29743
29860
|
seen.ref = def.innerType;
|
|
29744
29861
|
json2.nullable = true;
|
|
@@ -29746,31 +29863,31 @@ var init_json_schema_processors = __esm({
|
|
|
29746
29863
|
json2.anyOf = [inner, { type: "null" }];
|
|
29747
29864
|
}
|
|
29748
29865
|
};
|
|
29749
|
-
nonoptionalProcessor = (
|
|
29750
|
-
const def =
|
|
29866
|
+
nonoptionalProcessor = (schema5, ctx, _json, params) => {
|
|
29867
|
+
const def = schema5._zod.def;
|
|
29751
29868
|
process2(def.innerType, ctx, params);
|
|
29752
|
-
const seen = ctx.seen.get(
|
|
29869
|
+
const seen = ctx.seen.get(schema5);
|
|
29753
29870
|
seen.ref = def.innerType;
|
|
29754
29871
|
};
|
|
29755
|
-
defaultProcessor = (
|
|
29756
|
-
const def =
|
|
29872
|
+
defaultProcessor = (schema5, ctx, json2, params) => {
|
|
29873
|
+
const def = schema5._zod.def;
|
|
29757
29874
|
process2(def.innerType, ctx, params);
|
|
29758
|
-
const seen = ctx.seen.get(
|
|
29875
|
+
const seen = ctx.seen.get(schema5);
|
|
29759
29876
|
seen.ref = def.innerType;
|
|
29760
29877
|
json2.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
29761
29878
|
};
|
|
29762
|
-
prefaultProcessor = (
|
|
29763
|
-
const def =
|
|
29879
|
+
prefaultProcessor = (schema5, ctx, json2, params) => {
|
|
29880
|
+
const def = schema5._zod.def;
|
|
29764
29881
|
process2(def.innerType, ctx, params);
|
|
29765
|
-
const seen = ctx.seen.get(
|
|
29882
|
+
const seen = ctx.seen.get(schema5);
|
|
29766
29883
|
seen.ref = def.innerType;
|
|
29767
29884
|
if (ctx.io === "input")
|
|
29768
29885
|
json2._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
29769
29886
|
};
|
|
29770
|
-
catchProcessor = (
|
|
29771
|
-
const def =
|
|
29887
|
+
catchProcessor = (schema5, ctx, json2, params) => {
|
|
29888
|
+
const def = schema5._zod.def;
|
|
29772
29889
|
process2(def.innerType, ctx, params);
|
|
29773
|
-
const seen = ctx.seen.get(
|
|
29890
|
+
const seen = ctx.seen.get(schema5);
|
|
29774
29891
|
seen.ref = def.innerType;
|
|
29775
29892
|
let catchValue;
|
|
29776
29893
|
try {
|
|
@@ -29780,37 +29897,37 @@ var init_json_schema_processors = __esm({
|
|
|
29780
29897
|
}
|
|
29781
29898
|
json2.default = catchValue;
|
|
29782
29899
|
};
|
|
29783
|
-
pipeProcessor = (
|
|
29784
|
-
const def =
|
|
29900
|
+
pipeProcessor = (schema5, ctx, _json, params) => {
|
|
29901
|
+
const def = schema5._zod.def;
|
|
29785
29902
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
29786
29903
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
29787
29904
|
process2(innerType, ctx, params);
|
|
29788
|
-
const seen = ctx.seen.get(
|
|
29905
|
+
const seen = ctx.seen.get(schema5);
|
|
29789
29906
|
seen.ref = innerType;
|
|
29790
29907
|
};
|
|
29791
|
-
readonlyProcessor = (
|
|
29792
|
-
const def =
|
|
29908
|
+
readonlyProcessor = (schema5, ctx, json2, params) => {
|
|
29909
|
+
const def = schema5._zod.def;
|
|
29793
29910
|
process2(def.innerType, ctx, params);
|
|
29794
|
-
const seen = ctx.seen.get(
|
|
29911
|
+
const seen = ctx.seen.get(schema5);
|
|
29795
29912
|
seen.ref = def.innerType;
|
|
29796
29913
|
json2.readOnly = true;
|
|
29797
29914
|
};
|
|
29798
|
-
promiseProcessor = (
|
|
29799
|
-
const def =
|
|
29915
|
+
promiseProcessor = (schema5, ctx, _json, params) => {
|
|
29916
|
+
const def = schema5._zod.def;
|
|
29800
29917
|
process2(def.innerType, ctx, params);
|
|
29801
|
-
const seen = ctx.seen.get(
|
|
29918
|
+
const seen = ctx.seen.get(schema5);
|
|
29802
29919
|
seen.ref = def.innerType;
|
|
29803
29920
|
};
|
|
29804
|
-
optionalProcessor = (
|
|
29805
|
-
const def =
|
|
29921
|
+
optionalProcessor = (schema5, ctx, _json, params) => {
|
|
29922
|
+
const def = schema5._zod.def;
|
|
29806
29923
|
process2(def.innerType, ctx, params);
|
|
29807
|
-
const seen = ctx.seen.get(
|
|
29924
|
+
const seen = ctx.seen.get(schema5);
|
|
29808
29925
|
seen.ref = def.innerType;
|
|
29809
29926
|
};
|
|
29810
|
-
lazyProcessor = (
|
|
29811
|
-
const innerType =
|
|
29927
|
+
lazyProcessor = (schema5, ctx, _json, params) => {
|
|
29928
|
+
const innerType = schema5._zod.innerType;
|
|
29812
29929
|
process2(innerType, ctx, params);
|
|
29813
|
-
const seen = ctx.seen.get(
|
|
29930
|
+
const seen = ctx.seen.get(schema5);
|
|
29814
29931
|
seen.ref = innerType;
|
|
29815
29932
|
};
|
|
29816
29933
|
allProcessors = {
|
|
@@ -29914,14 +30031,14 @@ var init_json_schema_generator = __esm({
|
|
|
29914
30031
|
* Process a schema to prepare it for JSON Schema generation.
|
|
29915
30032
|
* This must be called before emit().
|
|
29916
30033
|
*/
|
|
29917
|
-
process(
|
|
29918
|
-
return process2(
|
|
30034
|
+
process(schema5, _params = { path: [], schemaPath: [] }) {
|
|
30035
|
+
return process2(schema5, this.ctx, _params);
|
|
29919
30036
|
}
|
|
29920
30037
|
/**
|
|
29921
30038
|
* Emit the final JSON Schema after processing.
|
|
29922
30039
|
* Must call process() first.
|
|
29923
30040
|
*/
|
|
29924
|
-
emit(
|
|
30041
|
+
emit(schema5, _params) {
|
|
29925
30042
|
if (_params) {
|
|
29926
30043
|
if (_params.cycles)
|
|
29927
30044
|
this.ctx.cycles = _params.cycles;
|
|
@@ -29930,8 +30047,8 @@ var init_json_schema_generator = __esm({
|
|
|
29930
30047
|
if (_params.external)
|
|
29931
30048
|
this.ctx.external = _params.external;
|
|
29932
30049
|
}
|
|
29933
|
-
extractDefs(this.ctx,
|
|
29934
|
-
const result2 = finalize(this.ctx,
|
|
30050
|
+
extractDefs(this.ctx, schema5);
|
|
30051
|
+
const result2 = finalize(this.ctx, schema5);
|
|
29935
30052
|
const { "~standard": _, ...plainResult } = result2;
|
|
29936
30053
|
return plainResult;
|
|
29937
30054
|
}
|
|
@@ -30760,8 +30877,8 @@ function date3(params) {
|
|
|
30760
30877
|
function array(element, params) {
|
|
30761
30878
|
return _array(ZodArray, element, params);
|
|
30762
30879
|
}
|
|
30763
|
-
function keyof(
|
|
30764
|
-
const shape =
|
|
30880
|
+
function keyof(schema5) {
|
|
30881
|
+
const shape = schema5._zod.def.shape;
|
|
30765
30882
|
return _enum2(Object.keys(shape));
|
|
30766
30883
|
}
|
|
30767
30884
|
function object(shape, params) {
|
|
@@ -31076,11 +31193,11 @@ function json(params) {
|
|
|
31076
31193
|
});
|
|
31077
31194
|
return jsonSchema;
|
|
31078
31195
|
}
|
|
31079
|
-
function preprocess(fn,
|
|
31196
|
+
function preprocess(fn, schema5) {
|
|
31080
31197
|
return new ZodPreprocess({
|
|
31081
31198
|
type: "pipe",
|
|
31082
31199
|
in: transform(fn),
|
|
31083
|
-
out:
|
|
31200
|
+
out: schema5
|
|
31084
31201
|
});
|
|
31085
31202
|
}
|
|
31086
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;
|
|
@@ -31904,8 +32021,8 @@ var init_compat = __esm({
|
|
|
31904
32021
|
});
|
|
31905
32022
|
|
|
31906
32023
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/from-json-schema.js
|
|
31907
|
-
function detectVersion(
|
|
31908
|
-
const $schema =
|
|
32024
|
+
function detectVersion(schema5, defaultTarget) {
|
|
32025
|
+
const $schema = schema5.$schema;
|
|
31909
32026
|
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
31910
32027
|
return "draft-2020-12";
|
|
31911
32028
|
}
|
|
@@ -31935,27 +32052,27 @@ function resolveRef(ref, ctx) {
|
|
|
31935
32052
|
}
|
|
31936
32053
|
throw new Error(`Reference not found: ${ref}`);
|
|
31937
32054
|
}
|
|
31938
|
-
function convertBaseSchema(
|
|
31939
|
-
if (
|
|
31940
|
-
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) {
|
|
31941
32058
|
return z.never();
|
|
31942
32059
|
}
|
|
31943
32060
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
31944
32061
|
}
|
|
31945
|
-
if (
|
|
32062
|
+
if (schema5.unevaluatedItems !== void 0) {
|
|
31946
32063
|
throw new Error("unevaluatedItems is not supported");
|
|
31947
32064
|
}
|
|
31948
|
-
if (
|
|
32065
|
+
if (schema5.unevaluatedProperties !== void 0) {
|
|
31949
32066
|
throw new Error("unevaluatedProperties is not supported");
|
|
31950
32067
|
}
|
|
31951
|
-
if (
|
|
32068
|
+
if (schema5.if !== void 0 || schema5.then !== void 0 || schema5.else !== void 0) {
|
|
31952
32069
|
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
31953
32070
|
}
|
|
31954
|
-
if (
|
|
32071
|
+
if (schema5.dependentSchemas !== void 0 || schema5.dependentRequired !== void 0) {
|
|
31955
32072
|
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
31956
32073
|
}
|
|
31957
|
-
if (
|
|
31958
|
-
const refPath =
|
|
32074
|
+
if (schema5.$ref) {
|
|
32075
|
+
const refPath = schema5.$ref;
|
|
31959
32076
|
if (ctx.refs.has(refPath)) {
|
|
31960
32077
|
return ctx.refs.get(refPath);
|
|
31961
32078
|
}
|
|
@@ -31974,9 +32091,9 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
31974
32091
|
ctx.processing.delete(refPath);
|
|
31975
32092
|
return zodSchema2;
|
|
31976
32093
|
}
|
|
31977
|
-
if (
|
|
31978
|
-
const enumValues =
|
|
31979
|
-
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) {
|
|
31980
32097
|
return z.null();
|
|
31981
32098
|
}
|
|
31982
32099
|
if (enumValues.length === 0) {
|
|
@@ -31994,13 +32111,13 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
31994
32111
|
}
|
|
31995
32112
|
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
31996
32113
|
}
|
|
31997
|
-
if (
|
|
31998
|
-
return z.literal(
|
|
32114
|
+
if (schema5.const !== void 0) {
|
|
32115
|
+
return z.literal(schema5.const);
|
|
31999
32116
|
}
|
|
32000
|
-
const type =
|
|
32117
|
+
const type = schema5.type;
|
|
32001
32118
|
if (Array.isArray(type)) {
|
|
32002
32119
|
const typeSchemas = type.map((t) => {
|
|
32003
|
-
const typeSchema = { ...
|
|
32120
|
+
const typeSchema = { ...schema5, type: t };
|
|
32004
32121
|
return convertBaseSchema(typeSchema, ctx);
|
|
32005
32122
|
});
|
|
32006
32123
|
if (typeSchemas.length === 0) {
|
|
@@ -32018,8 +32135,8 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32018
32135
|
switch (type) {
|
|
32019
32136
|
case "string": {
|
|
32020
32137
|
let stringSchema = z.string();
|
|
32021
|
-
if (
|
|
32022
|
-
const format3 =
|
|
32138
|
+
if (schema5.format) {
|
|
32139
|
+
const format3 = schema5.format;
|
|
32023
32140
|
if (format3 === "email") {
|
|
32024
32141
|
stringSchema = stringSchema.check(z.email());
|
|
32025
32142
|
} else if (format3 === "uri" || format3 === "uri-reference") {
|
|
@@ -32068,14 +32185,14 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32068
32185
|
stringSchema = stringSchema.check(z.ksuid());
|
|
32069
32186
|
}
|
|
32070
32187
|
}
|
|
32071
|
-
if (typeof
|
|
32072
|
-
stringSchema = stringSchema.min(
|
|
32188
|
+
if (typeof schema5.minLength === "number") {
|
|
32189
|
+
stringSchema = stringSchema.min(schema5.minLength);
|
|
32073
32190
|
}
|
|
32074
|
-
if (typeof
|
|
32075
|
-
stringSchema = stringSchema.max(
|
|
32191
|
+
if (typeof schema5.maxLength === "number") {
|
|
32192
|
+
stringSchema = stringSchema.max(schema5.maxLength);
|
|
32076
32193
|
}
|
|
32077
|
-
if (
|
|
32078
|
-
stringSchema = stringSchema.regex(new RegExp(
|
|
32194
|
+
if (schema5.pattern) {
|
|
32195
|
+
stringSchema = stringSchema.regex(new RegExp(schema5.pattern));
|
|
32079
32196
|
}
|
|
32080
32197
|
zodSchema = stringSchema;
|
|
32081
32198
|
break;
|
|
@@ -32083,24 +32200,24 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32083
32200
|
case "number":
|
|
32084
32201
|
case "integer": {
|
|
32085
32202
|
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
32086
|
-
if (typeof
|
|
32087
|
-
numberSchema = numberSchema.min(
|
|
32203
|
+
if (typeof schema5.minimum === "number") {
|
|
32204
|
+
numberSchema = numberSchema.min(schema5.minimum);
|
|
32088
32205
|
}
|
|
32089
|
-
if (typeof
|
|
32090
|
-
numberSchema = numberSchema.max(
|
|
32206
|
+
if (typeof schema5.maximum === "number") {
|
|
32207
|
+
numberSchema = numberSchema.max(schema5.maximum);
|
|
32091
32208
|
}
|
|
32092
|
-
if (typeof
|
|
32093
|
-
numberSchema = numberSchema.gt(
|
|
32094
|
-
} else if (
|
|
32095
|
-
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);
|
|
32096
32213
|
}
|
|
32097
|
-
if (typeof
|
|
32098
|
-
numberSchema = numberSchema.lt(
|
|
32099
|
-
} else if (
|
|
32100
|
-
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);
|
|
32101
32218
|
}
|
|
32102
|
-
if (typeof
|
|
32103
|
-
numberSchema = numberSchema.multipleOf(
|
|
32219
|
+
if (typeof schema5.multipleOf === "number") {
|
|
32220
|
+
numberSchema = numberSchema.multipleOf(schema5.multipleOf);
|
|
32104
32221
|
}
|
|
32105
32222
|
zodSchema = numberSchema;
|
|
32106
32223
|
break;
|
|
@@ -32115,15 +32232,15 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32115
32232
|
}
|
|
32116
32233
|
case "object": {
|
|
32117
32234
|
const shape = {};
|
|
32118
|
-
const properties =
|
|
32119
|
-
const requiredSet = new Set(
|
|
32235
|
+
const properties = schema5.properties || {};
|
|
32236
|
+
const requiredSet = new Set(schema5.required || []);
|
|
32120
32237
|
for (const [key, propSchema] of Object.entries(properties)) {
|
|
32121
32238
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
32122
32239
|
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
32123
32240
|
}
|
|
32124
|
-
if (
|
|
32125
|
-
const keySchema = convertSchema(
|
|
32126
|
-
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();
|
|
32127
32244
|
if (Object.keys(shape).length === 0) {
|
|
32128
32245
|
zodSchema = z.record(keySchema, valueSchema);
|
|
32129
32246
|
break;
|
|
@@ -32133,8 +32250,8 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32133
32250
|
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
32134
32251
|
break;
|
|
32135
32252
|
}
|
|
32136
|
-
if (
|
|
32137
|
-
const patternProps =
|
|
32253
|
+
if (schema5.patternProperties) {
|
|
32254
|
+
const patternProps = schema5.patternProperties;
|
|
32138
32255
|
const patternKeys = Object.keys(patternProps);
|
|
32139
32256
|
const looseRecords = [];
|
|
32140
32257
|
for (const pattern of patternKeys) {
|
|
@@ -32161,18 +32278,18 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32161
32278
|
break;
|
|
32162
32279
|
}
|
|
32163
32280
|
const objectSchema = z.object(shape);
|
|
32164
|
-
if (
|
|
32281
|
+
if (schema5.additionalProperties === false) {
|
|
32165
32282
|
zodSchema = objectSchema.strict();
|
|
32166
|
-
} else if (typeof
|
|
32167
|
-
zodSchema = objectSchema.catchall(convertSchema(
|
|
32283
|
+
} else if (typeof schema5.additionalProperties === "object") {
|
|
32284
|
+
zodSchema = objectSchema.catchall(convertSchema(schema5.additionalProperties, ctx));
|
|
32168
32285
|
} else {
|
|
32169
32286
|
zodSchema = objectSchema.passthrough();
|
|
32170
32287
|
}
|
|
32171
32288
|
break;
|
|
32172
32289
|
}
|
|
32173
32290
|
case "array": {
|
|
32174
|
-
const prefixItems =
|
|
32175
|
-
const items =
|
|
32291
|
+
const prefixItems = schema5.prefixItems;
|
|
32292
|
+
const items = schema5.items;
|
|
32176
32293
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
32177
32294
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
32178
32295
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
@@ -32181,34 +32298,34 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32181
32298
|
} else {
|
|
32182
32299
|
zodSchema = z.tuple(tupleItems);
|
|
32183
32300
|
}
|
|
32184
|
-
if (typeof
|
|
32185
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
32301
|
+
if (typeof schema5.minItems === "number") {
|
|
32302
|
+
zodSchema = zodSchema.check(z.minLength(schema5.minItems));
|
|
32186
32303
|
}
|
|
32187
|
-
if (typeof
|
|
32188
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
32304
|
+
if (typeof schema5.maxItems === "number") {
|
|
32305
|
+
zodSchema = zodSchema.check(z.maxLength(schema5.maxItems));
|
|
32189
32306
|
}
|
|
32190
32307
|
} else if (Array.isArray(items)) {
|
|
32191
32308
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
32192
|
-
const rest =
|
|
32309
|
+
const rest = schema5.additionalItems && typeof schema5.additionalItems === "object" ? convertSchema(schema5.additionalItems, ctx) : void 0;
|
|
32193
32310
|
if (rest) {
|
|
32194
32311
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
32195
32312
|
} else {
|
|
32196
32313
|
zodSchema = z.tuple(tupleItems);
|
|
32197
32314
|
}
|
|
32198
|
-
if (typeof
|
|
32199
|
-
zodSchema = zodSchema.check(z.minLength(
|
|
32315
|
+
if (typeof schema5.minItems === "number") {
|
|
32316
|
+
zodSchema = zodSchema.check(z.minLength(schema5.minItems));
|
|
32200
32317
|
}
|
|
32201
|
-
if (typeof
|
|
32202
|
-
zodSchema = zodSchema.check(z.maxLength(
|
|
32318
|
+
if (typeof schema5.maxItems === "number") {
|
|
32319
|
+
zodSchema = zodSchema.check(z.maxLength(schema5.maxItems));
|
|
32203
32320
|
}
|
|
32204
32321
|
} else if (items !== void 0) {
|
|
32205
32322
|
const element = convertSchema(items, ctx);
|
|
32206
32323
|
let arraySchema = z.array(element);
|
|
32207
|
-
if (typeof
|
|
32208
|
-
arraySchema = arraySchema.min(
|
|
32324
|
+
if (typeof schema5.minItems === "number") {
|
|
32325
|
+
arraySchema = arraySchema.min(schema5.minItems);
|
|
32209
32326
|
}
|
|
32210
|
-
if (typeof
|
|
32211
|
-
arraySchema = arraySchema.max(
|
|
32327
|
+
if (typeof schema5.maxItems === "number") {
|
|
32328
|
+
arraySchema = arraySchema.max(schema5.maxItems);
|
|
32212
32329
|
}
|
|
32213
32330
|
zodSchema = arraySchema;
|
|
32214
32331
|
} else {
|
|
@@ -32221,76 +32338,76 @@ function convertBaseSchema(schema4, ctx) {
|
|
|
32221
32338
|
}
|
|
32222
32339
|
return zodSchema;
|
|
32223
32340
|
}
|
|
32224
|
-
function convertSchema(
|
|
32225
|
-
if (typeof
|
|
32226
|
-
return
|
|
32341
|
+
function convertSchema(schema5, ctx) {
|
|
32342
|
+
if (typeof schema5 === "boolean") {
|
|
32343
|
+
return schema5 ? z.any() : z.never();
|
|
32227
32344
|
}
|
|
32228
|
-
let baseSchema = convertBaseSchema(
|
|
32229
|
-
const hasExplicitType =
|
|
32230
|
-
if (
|
|
32231
|
-
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));
|
|
32232
32349
|
const anyOfUnion = z.union(options);
|
|
32233
32350
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
32234
32351
|
}
|
|
32235
|
-
if (
|
|
32236
|
-
const options =
|
|
32352
|
+
if (schema5.oneOf && Array.isArray(schema5.oneOf)) {
|
|
32353
|
+
const options = schema5.oneOf.map((s) => convertSchema(s, ctx));
|
|
32237
32354
|
const oneOfUnion = z.xor(options);
|
|
32238
32355
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
32239
32356
|
}
|
|
32240
|
-
if (
|
|
32241
|
-
if (
|
|
32357
|
+
if (schema5.allOf && Array.isArray(schema5.allOf)) {
|
|
32358
|
+
if (schema5.allOf.length === 0) {
|
|
32242
32359
|
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
32243
32360
|
} else {
|
|
32244
|
-
let result2 = hasExplicitType ? baseSchema : convertSchema(
|
|
32361
|
+
let result2 = hasExplicitType ? baseSchema : convertSchema(schema5.allOf[0], ctx);
|
|
32245
32362
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
32246
|
-
for (let i2 = startIdx; i2 <
|
|
32247
|
-
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));
|
|
32248
32365
|
}
|
|
32249
32366
|
baseSchema = result2;
|
|
32250
32367
|
}
|
|
32251
32368
|
}
|
|
32252
|
-
if (
|
|
32369
|
+
if (schema5.nullable === true && ctx.version === "openapi-3.0") {
|
|
32253
32370
|
baseSchema = z.nullable(baseSchema);
|
|
32254
32371
|
}
|
|
32255
|
-
if (
|
|
32372
|
+
if (schema5.readOnly === true) {
|
|
32256
32373
|
baseSchema = z.readonly(baseSchema);
|
|
32257
32374
|
}
|
|
32258
|
-
if (
|
|
32259
|
-
baseSchema = baseSchema.default(
|
|
32375
|
+
if (schema5.default !== void 0) {
|
|
32376
|
+
baseSchema = baseSchema.default(schema5.default);
|
|
32260
32377
|
}
|
|
32261
32378
|
const extraMeta = {};
|
|
32262
32379
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
32263
32380
|
for (const key of coreMetadataKeys) {
|
|
32264
|
-
if (key in
|
|
32265
|
-
extraMeta[key] =
|
|
32381
|
+
if (key in schema5) {
|
|
32382
|
+
extraMeta[key] = schema5[key];
|
|
32266
32383
|
}
|
|
32267
32384
|
}
|
|
32268
32385
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
32269
32386
|
for (const key of contentMetadataKeys) {
|
|
32270
|
-
if (key in
|
|
32271
|
-
extraMeta[key] =
|
|
32387
|
+
if (key in schema5) {
|
|
32388
|
+
extraMeta[key] = schema5[key];
|
|
32272
32389
|
}
|
|
32273
32390
|
}
|
|
32274
|
-
for (const key of Object.keys(
|
|
32391
|
+
for (const key of Object.keys(schema5)) {
|
|
32275
32392
|
if (!RECOGNIZED_KEYS.has(key)) {
|
|
32276
|
-
extraMeta[key] =
|
|
32393
|
+
extraMeta[key] = schema5[key];
|
|
32277
32394
|
}
|
|
32278
32395
|
}
|
|
32279
32396
|
if (Object.keys(extraMeta).length > 0) {
|
|
32280
32397
|
ctx.registry.add(baseSchema, extraMeta);
|
|
32281
32398
|
}
|
|
32282
|
-
if (
|
|
32283
|
-
baseSchema = baseSchema.describe(
|
|
32399
|
+
if (schema5.description) {
|
|
32400
|
+
baseSchema = baseSchema.describe(schema5.description);
|
|
32284
32401
|
}
|
|
32285
32402
|
return baseSchema;
|
|
32286
32403
|
}
|
|
32287
|
-
function fromJSONSchema(
|
|
32288
|
-
if (typeof
|
|
32289
|
-
return
|
|
32404
|
+
function fromJSONSchema(schema5, params) {
|
|
32405
|
+
if (typeof schema5 === "boolean") {
|
|
32406
|
+
return schema5 ? z.any() : z.never();
|
|
32290
32407
|
}
|
|
32291
32408
|
let normalized;
|
|
32292
32409
|
try {
|
|
32293
|
-
normalized = JSON.parse(JSON.stringify(
|
|
32410
|
+
normalized = JSON.parse(JSON.stringify(schema5));
|
|
32294
32411
|
} catch {
|
|
32295
32412
|
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
32296
32413
|
}
|
|
@@ -32993,9 +33110,12 @@ var init_skill_protocol = __esm({
|
|
|
32993
33110
|
name: "Base",
|
|
32994
33111
|
explorerUrl: "https://basescan.org",
|
|
32995
33112
|
defaultRpcUrls: [
|
|
33113
|
+
"https://base.gateway.tenderly.co",
|
|
33114
|
+
"https://base-rpc.publicnode.com",
|
|
32996
33115
|
"https://mainnet.base.org"
|
|
32997
33116
|
],
|
|
32998
|
-
maxLogBlockRange:
|
|
33117
|
+
maxLogBlockRange: 1e3,
|
|
33118
|
+
maxConcurrentRequests: 3
|
|
32999
33119
|
},
|
|
33000
33120
|
sourceRepository: "FinchipAI/finchip-protocol",
|
|
33001
33121
|
sourceCommit: "89e54d6ff46dbfba61122e90c5e77f409f02fe5e",
|
|
@@ -33151,12 +33271,12 @@ function resolveSkillProtocolEnvironment(raw) {
|
|
|
33151
33271
|
`FINCH_ENVIRONMENT must explicitly be local, test, or production; received ${received}.`
|
|
33152
33272
|
);
|
|
33153
33273
|
}
|
|
33154
|
-
function parseTypedRegistry(
|
|
33155
|
-
const
|
|
33156
|
-
if (!
|
|
33157
|
-
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)}`);
|
|
33158
33278
|
}
|
|
33159
|
-
return
|
|
33279
|
+
return parsed2.data;
|
|
33160
33280
|
}
|
|
33161
33281
|
function activeDeployment(protocol, deployments, environment3) {
|
|
33162
33282
|
if (environment3 === "local") {
|
|
@@ -33282,7 +33402,8 @@ function getSkillProtocolDeployment(environment3, chainId) {
|
|
|
33282
33402
|
factoryDeploymentBlock: value.deployment.factoryFirstBlock,
|
|
33283
33403
|
confirmations: value.deployment.confirmations,
|
|
33284
33404
|
defaultRpcUrls: Object.freeze([...value.network.defaultRpcUrls]),
|
|
33285
|
-
maxLogBlockRange: value.network.maxLogBlockRange ?? DEFAULT_LOG_BLOCK_RANGE
|
|
33405
|
+
maxLogBlockRange: value.network.maxLogBlockRange ?? DEFAULT_LOG_BLOCK_RANGE,
|
|
33406
|
+
maxConcurrentRequests: value.network.maxConcurrentRequests ?? DEFAULT_CONCURRENT_REQUESTS
|
|
33286
33407
|
});
|
|
33287
33408
|
}
|
|
33288
33409
|
function getSkillProtocolDeploymentByChainId(chainId) {
|
|
@@ -33293,7 +33414,7 @@ function getSkillProtocolDeploymentByChainId(chainId) {
|
|
|
33293
33414
|
function getAllSkillProtocolChainIds() {
|
|
33294
33415
|
return Object.freeze(Object.keys(SKILL_CLIENT_DEPLOYMENT_BY_CHAIN).map(Number).sort((left, right) => left - right));
|
|
33295
33416
|
}
|
|
33296
|
-
var canonicalAddressSchema, hashSchema, commitSchema, positiveDecimalSchema, DEFAULT_LOG_BLOCK_RANGE, networkSchema, publicRpcUrlsSchema, legacySkillIndexerChainSchema, legacySkillIndexerRegistrySchema, sourceSchema, disabledDeploymentSchema, deploymentsShape, agentActiveSchema, taskActiveSchema, skillActiveSchema, agentRegistrySchema, taskRegistrySchema, skillEnvironmentSchema, skillRegistrySchema, registrySchema, agentRegistry, taskRegistry, skillRegistry, legacySkillIndexerRegistry, AGENT_CLIENT_DEPLOYMENT_BY_CHAIN, TASK_CLIENT_DEPLOYMENT_BY_CHAIN, SKILL_CLIENT_DEPLOYMENT_BY_CHAIN;
|
|
33417
|
+
var canonicalAddressSchema, hashSchema, commitSchema, positiveDecimalSchema, DEFAULT_LOG_BLOCK_RANGE, DEFAULT_CONCURRENT_REQUESTS, networkSchema, publicRpcUrlsSchema, legacySkillIndexerChainSchema, legacySkillIndexerRegistrySchema, sourceSchema, disabledDeploymentSchema, deploymentsShape, agentActiveSchema, taskActiveSchema, skillActiveSchema, agentRegistrySchema, taskRegistrySchema, skillEnvironmentSchema, skillRegistrySchema, registrySchema, agentRegistry, taskRegistry, skillRegistry, legacySkillIndexerRegistry, AGENT_CLIENT_DEPLOYMENT_BY_CHAIN, TASK_CLIENT_DEPLOYMENT_BY_CHAIN, SKILL_CLIENT_DEPLOYMENT_BY_CHAIN;
|
|
33297
33418
|
var init_chains = __esm({
|
|
33298
33419
|
"../../packages/deployment-manifest/src/chains/index.ts"() {
|
|
33299
33420
|
"use strict";
|
|
@@ -33309,13 +33430,24 @@ var init_chains = __esm({
|
|
|
33309
33430
|
commitSchema = external_exports.string().regex(/^[0-9a-f]{40}$/u);
|
|
33310
33431
|
positiveDecimalSchema = external_exports.string().regex(/^[1-9][0-9]*$/u);
|
|
33311
33432
|
DEFAULT_LOG_BLOCK_RANGE = 9999;
|
|
33433
|
+
DEFAULT_CONCURRENT_REQUESTS = 12;
|
|
33312
33434
|
networkSchema = external_exports.strictObject({
|
|
33313
33435
|
chainId: external_exports.number().int().positive(),
|
|
33314
33436
|
name: external_exports.string().min(1).max(100),
|
|
33315
33437
|
explorerUrl: external_exports.url().refine((value) => new URL(value).protocol === "https:"),
|
|
33316
33438
|
defaultRpcUrls: external_exports.array(external_exports.url().refine((value) => new URL(value).protocol === "https:")).min(1).max(4),
|
|
33317
33439
|
/** Omit where every listed endpoint serves the default window. */
|
|
33318
|
-
maxLogBlockRange: external_exports.number().int().min(1).max(DEFAULT_LOG_BLOCK_RANGE).optional()
|
|
33440
|
+
maxLogBlockRange: external_exports.number().int().min(1).max(DEFAULT_LOG_BLOCK_RANGE).optional(),
|
|
33441
|
+
/**
|
|
33442
|
+
* Shared by scheduled and receipt readers for this environment/chain within one process.
|
|
33443
|
+
* Omit where every listed endpoint serves the default number of concurrent requests.
|
|
33444
|
+
*
|
|
33445
|
+
* Narrow it for an endpoint that meters compute rather than requests: Base answers four
|
|
33446
|
+
* concurrent `eth_call`s and refuses most of eight with `-32016 over rate limit`, while serving
|
|
33447
|
+
* twelve concurrent balance reads without complaint. The number that matters is the one measured
|
|
33448
|
+
* with the call the indexer actually makes.
|
|
33449
|
+
*/
|
|
33450
|
+
maxConcurrentRequests: external_exports.number().int().min(1).max(DEFAULT_CONCURRENT_REQUESTS).optional()
|
|
33319
33451
|
});
|
|
33320
33452
|
publicRpcUrlsSchema = external_exports.array(
|
|
33321
33453
|
external_exports.url().refine((value) => new URL(value).protocol === "https:")
|
|
@@ -33561,6 +33693,45 @@ var init_chains = __esm({
|
|
|
33561
33693
|
}
|
|
33562
33694
|
});
|
|
33563
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
|
+
|
|
33564
33735
|
// ../../packages/deployment-manifest/src/platform/passkey-safe.json
|
|
33565
33736
|
var passkey_safe_default;
|
|
33566
33737
|
var init_passkey_safe = __esm({
|
|
@@ -33588,9 +33759,9 @@ var init_passkey_safe = __esm({
|
|
|
33588
33759
|
|
|
33589
33760
|
// ../../packages/deployment-manifest/src/platform/passkey-safe.ts
|
|
33590
33761
|
function parsePasskeySafeManifest(input) {
|
|
33591
|
-
return
|
|
33762
|
+
return schema2.parse(input);
|
|
33592
33763
|
}
|
|
33593
|
-
var disabled, enabled,
|
|
33764
|
+
var disabled, enabled, schema2, manifest;
|
|
33594
33765
|
var init_passkey_safe2 = __esm({
|
|
33595
33766
|
"../../packages/deployment-manifest/src/platform/passkey-safe.ts"() {
|
|
33596
33767
|
"use strict";
|
|
@@ -33607,7 +33778,7 @@ var init_passkey_safe2 = __esm({
|
|
|
33607
33778
|
minimumGasWei: external_exports.string().regex(/^[1-9][0-9]*$/),
|
|
33608
33779
|
maxGasPerTransaction: external_exports.string().regex(/^[1-9][0-9]*$/)
|
|
33609
33780
|
});
|
|
33610
|
-
|
|
33781
|
+
schema2 = external_exports.strictObject({
|
|
33611
33782
|
schemaVersion: external_exports.literal(1),
|
|
33612
33783
|
kind: external_exports.literal("passkey_safe"),
|
|
33613
33784
|
environments: external_exports.strictObject({
|
|
@@ -33841,9 +34012,9 @@ var init_agenton_payout = __esm({
|
|
|
33841
34012
|
|
|
33842
34013
|
// ../../packages/deployment-manifest/src/platform/agenton-payout.ts
|
|
33843
34014
|
function parseAgentonPayoutManifest(input) {
|
|
33844
|
-
return
|
|
34015
|
+
return schema3.parse(input);
|
|
33845
34016
|
}
|
|
33846
|
-
var origin, environment,
|
|
34017
|
+
var origin, environment, schema3, manifest2;
|
|
33847
34018
|
var init_agenton_payout2 = __esm({
|
|
33848
34019
|
"../../packages/deployment-manifest/src/platform/agenton-payout.ts"() {
|
|
33849
34020
|
"use strict";
|
|
@@ -33854,7 +34025,7 @@ var init_agenton_payout2 = __esm({
|
|
|
33854
34025
|
return url2.protocol === "https:" && url2.origin === value && !url2.username && !url2.password;
|
|
33855
34026
|
});
|
|
33856
34027
|
environment = external_exports.strictObject({ enabled: external_exports.boolean(), mandateId: external_exports.string().min(1).nullable() });
|
|
33857
|
-
|
|
34028
|
+
schema3 = external_exports.strictObject({
|
|
33858
34029
|
schemaVersion: external_exports.literal(1),
|
|
33859
34030
|
kind: external_exports.literal("agenton_payout"),
|
|
33860
34031
|
agentIdBaseUrl: origin,
|
|
@@ -33893,36 +34064,36 @@ var init_merchant_avatar_video = __esm({
|
|
|
33893
34064
|
|
|
33894
34065
|
// ../../packages/deployment-manifest/src/platform/merchant-avatar-video.ts
|
|
33895
34066
|
function parseMerchantAvatarVideoManifest(input) {
|
|
33896
|
-
return
|
|
34067
|
+
return schema4.parse(input);
|
|
33897
34068
|
}
|
|
33898
|
-
var
|
|
34069
|
+
var policy2, schema4, manifest3;
|
|
33899
34070
|
var init_merchant_avatar_video2 = __esm({
|
|
33900
34071
|
"../../packages/deployment-manifest/src/platform/merchant-avatar-video.ts"() {
|
|
33901
34072
|
"use strict";
|
|
33902
34073
|
init_zod();
|
|
33903
34074
|
init_merchant_avatar_video();
|
|
33904
|
-
|
|
34075
|
+
policy2 = external_exports.discriminatedUnion("enabled", [
|
|
33905
34076
|
external_exports.strictObject({ enabled: external_exports.literal(false) }),
|
|
33906
34077
|
external_exports.strictObject({ enabled: external_exports.literal(true), offerId: external_exports.uuid(), dailyLimit: external_exports.number().int().min(1).max(1e4) })
|
|
33907
34078
|
]);
|
|
33908
|
-
|
|
34079
|
+
schema4 = external_exports.strictObject({
|
|
33909
34080
|
schemaVersion: external_exports.literal(1),
|
|
33910
34081
|
kind: external_exports.literal("merchant_avatar_video"),
|
|
33911
|
-
environments: external_exports.strictObject({ local:
|
|
34082
|
+
environments: external_exports.strictObject({ local: policy2, test: policy2, production: policy2 })
|
|
33912
34083
|
});
|
|
33913
34084
|
manifest3 = parseMerchantAvatarVideoManifest(merchant_avatar_video_default);
|
|
33914
34085
|
}
|
|
33915
34086
|
});
|
|
33916
34087
|
|
|
33917
34088
|
// ../../packages/deployment-manifest/src/platform/index.ts
|
|
33918
|
-
function parseManifest2(label,
|
|
33919
|
-
const
|
|
33920
|
-
if (!
|
|
34089
|
+
function parseManifest2(label, schema5, value) {
|
|
34090
|
+
const parsed2 = schema5.safeParse(value);
|
|
34091
|
+
if (!parsed2.success) {
|
|
33921
34092
|
throw new DeploymentManifestError(
|
|
33922
|
-
`Invalid ${label} deployment manifest: ${external_exports.prettifyError(
|
|
34093
|
+
`Invalid ${label} deployment manifest: ${external_exports.prettifyError(parsed2.error)}`
|
|
33923
34094
|
);
|
|
33924
34095
|
}
|
|
33925
|
-
return
|
|
34096
|
+
return parsed2.data;
|
|
33926
34097
|
}
|
|
33927
34098
|
function parseInternalAppsManifest(value) {
|
|
33928
34099
|
return parseManifest2("internal-apps", internalAppsManifestSchema, value);
|
|
@@ -33960,6 +34131,7 @@ var init_platform = __esm({
|
|
|
33960
34131
|
"../../packages/deployment-manifest/src/platform/index.ts"() {
|
|
33961
34132
|
"use strict";
|
|
33962
34133
|
init_zod();
|
|
34134
|
+
init_get_help2();
|
|
33963
34135
|
init_passkey_safe2();
|
|
33964
34136
|
init_web_analytics();
|
|
33965
34137
|
init_web_localization();
|
|
@@ -34123,21 +34295,18 @@ var init_common4 = __esm({
|
|
|
34123
34295
|
}
|
|
34124
34296
|
});
|
|
34125
34297
|
|
|
34298
|
+
// ../../packages/market-categories/src/index.ts
|
|
34299
|
+
var init_src4 = __esm({
|
|
34300
|
+
"../../packages/market-categories/src/index.ts"() {
|
|
34301
|
+
}
|
|
34302
|
+
});
|
|
34303
|
+
|
|
34126
34304
|
// ../../packages/skill-market-contracts/src/public.ts
|
|
34127
|
-
var
|
|
34305
|
+
var SKILL_V3_ENVELOPE_SCHEME, SKILL_V3_LIT_ENVELOPE_SCHEME;
|
|
34128
34306
|
var init_public = __esm({
|
|
34129
34307
|
"../../packages/skill-market-contracts/src/public.ts"() {
|
|
34130
34308
|
"use strict";
|
|
34131
|
-
|
|
34132
|
-
"Dev Environment",
|
|
34133
|
-
"Documents & Legal",
|
|
34134
|
-
"Security Audit",
|
|
34135
|
-
"Finance & Tax",
|
|
34136
|
-
"Education & Research",
|
|
34137
|
-
"Media & Entertainment",
|
|
34138
|
-
"Health & Medicine",
|
|
34139
|
-
"Other"
|
|
34140
|
-
];
|
|
34309
|
+
init_src4();
|
|
34141
34310
|
SKILL_V3_ENVELOPE_SCHEME = "FINCHIP_V2";
|
|
34142
34311
|
SKILL_V3_LIT_ENVELOPE_SCHEME = "LIT_V1";
|
|
34143
34312
|
}
|
|
@@ -34171,7 +34340,6 @@ var init_client = __esm({
|
|
|
34171
34340
|
init_platform();
|
|
34172
34341
|
init_common4();
|
|
34173
34342
|
init_public();
|
|
34174
|
-
init_public();
|
|
34175
34343
|
SKILL_V3_CHAIN_IDS = getAllSkillProtocolChainIds();
|
|
34176
34344
|
SKILL_V3_DEPLOYMENTS = Object.freeze(SKILL_V3_CHAIN_IDS.map((chainId) => {
|
|
34177
34345
|
const deployment = getSkillProtocolDeploymentByChainId(chainId);
|
|
@@ -34179,7 +34347,7 @@ var init_client = __esm({
|
|
|
34179
34347
|
}));
|
|
34180
34348
|
versionSchema = { type: "integer", minimum: 1, maximum: 4294967295 };
|
|
34181
34349
|
chainIdSchema2 = { type: "integer", enum: SKILL_V3_CHAIN_IDS };
|
|
34182
|
-
nullableCategorySchema = { type: ["string", "null"],
|
|
34350
|
+
nullableCategorySchema = { type: ["string", "null"], minLength: 1, maxLength: 100 };
|
|
34183
34351
|
signingAuthoritySchema = strictObjectSchema3({
|
|
34184
34352
|
accountId: canonicalUuidSchema3,
|
|
34185
34353
|
walletAddress: addressSchema2,
|
|
@@ -38111,12 +38279,12 @@ var init_utils3 = __esm({
|
|
|
38111
38279
|
getContractAddress = (address2) => address2;
|
|
38112
38280
|
getUrl = (url2) => {
|
|
38113
38281
|
try {
|
|
38114
|
-
const
|
|
38115
|
-
if (!
|
|
38282
|
+
const parsed2 = new URL(url2);
|
|
38283
|
+
if (!parsed2.username && !parsed2.password)
|
|
38116
38284
|
return url2;
|
|
38117
|
-
|
|
38118
|
-
|
|
38119
|
-
return
|
|
38285
|
+
parsed2.username = "";
|
|
38286
|
+
parsed2.password = "";
|
|
38287
|
+
return parsed2.toString();
|
|
38120
38288
|
} catch {
|
|
38121
38289
|
return url2;
|
|
38122
38290
|
}
|
|
@@ -53318,13 +53486,13 @@ var init_validateSiweMessage = __esm({
|
|
|
53318
53486
|
// ../../node_modules/.pnpm/viem@2.55.15_bufferutil@4.1_ce20031be19c56210207d462110a7a29/node_modules/viem/_esm/actions/siwe/verifySiweMessage.js
|
|
53319
53487
|
async function verifySiweMessage(client, parameters) {
|
|
53320
53488
|
const { address: address2, domain: domain2, message, nonce, scheme, signature, time: time3 = /* @__PURE__ */ new Date(), ...callRequest } = parameters;
|
|
53321
|
-
const
|
|
53322
|
-
if (!
|
|
53489
|
+
const parsed2 = parseSiweMessage(message);
|
|
53490
|
+
if (!parsed2.address)
|
|
53323
53491
|
return false;
|
|
53324
53492
|
const isValid = validateSiweMessage({
|
|
53325
53493
|
address: address2,
|
|
53326
53494
|
domain: domain2,
|
|
53327
|
-
message:
|
|
53495
|
+
message: parsed2,
|
|
53328
53496
|
nonce,
|
|
53329
53497
|
scheme,
|
|
53330
53498
|
time: time3
|
|
@@ -53333,7 +53501,7 @@ async function verifySiweMessage(client, parameters) {
|
|
|
53333
53501
|
return false;
|
|
53334
53502
|
const hash5 = hashMessage(message);
|
|
53335
53503
|
return verifyHash(client, {
|
|
53336
|
-
address:
|
|
53504
|
+
address: parsed2.address,
|
|
53337
53505
|
hash: hash5,
|
|
53338
53506
|
signature,
|
|
53339
53507
|
...callRequest
|
|
@@ -54816,27 +54984,27 @@ function normalizeCliEvmAddress(value, field = "EVM address") {
|
|
|
54816
54984
|
function record3(value) {
|
|
54817
54985
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
54818
54986
|
}
|
|
54819
|
-
function variantMatches(
|
|
54820
|
-
if (!record3(
|
|
54821
|
-
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]) => {
|
|
54822
54990
|
if (!record3(property) || !Object.hasOwn(property, "const")) return true;
|
|
54823
54991
|
return value[key] === property.const;
|
|
54824
54992
|
});
|
|
54825
54993
|
}
|
|
54826
|
-
function normalizeCliRequestAddresses(
|
|
54827
|
-
if ((
|
|
54994
|
+
function normalizeCliRequestAddresses(schema5, value) {
|
|
54995
|
+
if ((schema5.pattern === CANONICAL_ADDRESS_PATTERN || schema5.pattern === INPUT_ADDRESS_PATTERN) && typeof value === "string") {
|
|
54828
54996
|
return normalizeCliEvmAddress(value);
|
|
54829
54997
|
}
|
|
54830
|
-
const variants = Array.isArray(
|
|
54998
|
+
const variants = Array.isArray(schema5.oneOf) ? schema5.oneOf : Array.isArray(schema5.anyOf) ? schema5.anyOf : null;
|
|
54831
54999
|
if (variants !== null) {
|
|
54832
55000
|
const selected = variants.find((variant) => record3(variant) && variantMatches(variant, value));
|
|
54833
55001
|
return selected === void 0 || !record3(selected) ? value : normalizeCliRequestAddresses(selected, value);
|
|
54834
55002
|
}
|
|
54835
|
-
if (Array.isArray(value) && record3(
|
|
54836
|
-
return value.map((item) => normalizeCliRequestAddresses(
|
|
55003
|
+
if (Array.isArray(value) && record3(schema5.items)) {
|
|
55004
|
+
return value.map((item) => normalizeCliRequestAddresses(schema5.items, item));
|
|
54837
55005
|
}
|
|
54838
|
-
if (record3(value) && record3(
|
|
54839
|
-
const properties =
|
|
55006
|
+
if (record3(value) && record3(schema5.properties)) {
|
|
55007
|
+
const properties = schema5.properties;
|
|
54840
55008
|
return Object.fromEntries(Object.entries(value).map(([key, entry2]) => {
|
|
54841
55009
|
const property = properties[key];
|
|
54842
55010
|
return [key, record3(property) ? normalizeCliRequestAddresses(property, entry2) : entry2];
|
|
@@ -54861,18 +55029,19 @@ function skillHttpDiagnostic(response, value) {
|
|
|
54861
55029
|
const code = value?.error?.code;
|
|
54862
55030
|
const platformCode = response.headers.get("x-vercel-error");
|
|
54863
55031
|
const requestId = response.headers.get("x-vercel-id");
|
|
54864
|
-
const
|
|
55032
|
+
const bodyTraceId = value?.error?.traceId;
|
|
55033
|
+
const traceId = response.headers.get("x-finch-trace-id") ?? (typeof bodyTraceId === "string" ? bodyTraceId : null);
|
|
54865
55034
|
return {
|
|
54866
55035
|
...typeof code === "string" && PUBLIC_SKILL_HTTP_CODES.has(code) ? { remoteCode: code } : platformCode !== null && PUBLIC_SKILL_HTTP_CODES.has(platformCode) ? { remoteCode: platformCode } : {},
|
|
54867
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 } : {},
|
|
54868
|
-
...traceId !== null &&
|
|
55037
|
+
...traceId !== null && TRACE_ID_PATTERN.test(traceId) ? { remoteTraceId: traceId } : {}
|
|
54869
55038
|
};
|
|
54870
55039
|
}
|
|
54871
|
-
function assertSchema(
|
|
54872
|
-
let validator = validatorCache.get(
|
|
55040
|
+
function assertSchema(schema5, value, diagnosticPaths) {
|
|
55041
|
+
let validator = validatorCache.get(schema5);
|
|
54873
55042
|
if (validator === void 0) {
|
|
54874
|
-
const compiled = ajv.compile(
|
|
54875
|
-
validatorCache.set(
|
|
55043
|
+
const compiled = ajv.compile(schema5);
|
|
55044
|
+
validatorCache.set(schema5, compiled);
|
|
54876
55045
|
validator = compiled;
|
|
54877
55046
|
}
|
|
54878
55047
|
if (!validator(value)) {
|
|
@@ -54884,20 +55053,20 @@ function assertSchema(schema4, value, diagnosticPaths) {
|
|
|
54884
55053
|
}
|
|
54885
55054
|
return value;
|
|
54886
55055
|
}
|
|
54887
|
-
function assertRequestSchema(
|
|
54888
|
-
let validator = validatorCache.get(
|
|
55056
|
+
function assertRequestSchema(schema5, value) {
|
|
55057
|
+
let validator = validatorCache.get(schema5);
|
|
54889
55058
|
if (validator === void 0) {
|
|
54890
|
-
validator = ajv.compile(
|
|
54891
|
-
validatorCache.set(
|
|
55059
|
+
validator = ajv.compile(schema5);
|
|
55060
|
+
validatorCache.set(schema5, validator);
|
|
54892
55061
|
}
|
|
54893
55062
|
if (!validator(value)) throw new TypeError("Creator request does not match the shared operation schema.");
|
|
54894
55063
|
}
|
|
54895
55064
|
function canonicalOrigin2(input) {
|
|
54896
|
-
const
|
|
54897
|
-
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)) {
|
|
54898
55067
|
throw new TypeError("AgentCLI origin must be canonical.");
|
|
54899
55068
|
}
|
|
54900
|
-
return
|
|
55069
|
+
return parsed2.origin;
|
|
54901
55070
|
}
|
|
54902
55071
|
function jsonObject(value) {
|
|
54903
55072
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -55017,10 +55186,10 @@ async function readBoundedBytes(response, minimumBytes, maximumBytes) {
|
|
|
55017
55186
|
}
|
|
55018
55187
|
}
|
|
55019
55188
|
function parseRemoteError(contract, response, value, diagnose = false) {
|
|
55020
|
-
const
|
|
55189
|
+
const schema5 = contract === "agent_market" ? agentCliErrorEnvelopeSchema : contract === "identity" ? identityErrorEnvelopeSchema : contract === "task_market" ? taskErrorEnvelopeSchema : contract === "skill_market" ? skillErrorEnvelopeSchema : oauthErrorResponseSchema;
|
|
55021
55190
|
let envelope;
|
|
55022
55191
|
try {
|
|
55023
|
-
envelope = assertSchema(
|
|
55192
|
+
envelope = assertSchema(schema5, value, diagnose ? skillErrorDiagnosticPaths : void 0);
|
|
55024
55193
|
} catch (cause) {
|
|
55025
55194
|
throw new CliHttpError("CLI_RESPONSE_INVALID", response.status, {
|
|
55026
55195
|
cause,
|
|
@@ -55037,7 +55206,7 @@ function parseRemoteError(contract, response, value, diagnose = false) {
|
|
|
55037
55206
|
}
|
|
55038
55207
|
return envelope;
|
|
55039
55208
|
}
|
|
55040
|
-
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;
|
|
55041
55210
|
var init_api2 = __esm({
|
|
55042
55211
|
"src/api.ts"() {
|
|
55043
55212
|
"use strict";
|
|
@@ -55070,6 +55239,7 @@ var init_api2 = __esm({
|
|
|
55070
55239
|
"merchant_connection_tests.create",
|
|
55071
55240
|
"merchant_publish_intents.create"
|
|
55072
55241
|
]);
|
|
55242
|
+
SKILL_UPLOAD_INLINE_LIMIT_BYTES = 4e6;
|
|
55073
55243
|
PUBLIC_SKILL_HTTP_CODES = /* @__PURE__ */ new Set([
|
|
55074
55244
|
"UPLOAD_INVALID",
|
|
55075
55245
|
"UPLOAD_TOO_LARGE",
|
|
@@ -55084,6 +55254,7 @@ var init_api2 = __esm({
|
|
|
55084
55254
|
"INTENT_UNAVAILABLE",
|
|
55085
55255
|
"PUBLICATION_INVALID"
|
|
55086
55256
|
]);
|
|
55257
|
+
TRACE_ID_PATTERN = /^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/u;
|
|
55087
55258
|
CliHttpError = class extends Error {
|
|
55088
55259
|
code;
|
|
55089
55260
|
status;
|
|
@@ -55141,16 +55312,12 @@ var init_api2 = __esm({
|
|
|
55141
55312
|
}
|
|
55142
55313
|
};
|
|
55143
55314
|
AgentCliHttpClient = class {
|
|
55144
|
-
|
|
55145
|
-
|
|
55146
|
-
|
|
55147
|
-
this.warn = warn;
|
|
55315
|
+
origin;
|
|
55316
|
+
fetchImplementation;
|
|
55317
|
+
constructor(origin2, fetchImplementation = fetch) {
|
|
55148
55318
|
this.origin = canonicalOrigin2(origin2);
|
|
55149
55319
|
this.fetchImplementation = fetchImplementation;
|
|
55150
55320
|
}
|
|
55151
|
-
warn;
|
|
55152
|
-
origin;
|
|
55153
|
-
fetchImplementation;
|
|
55154
55321
|
async request(options) {
|
|
55155
55322
|
const headers = new Headers(options.headers);
|
|
55156
55323
|
if (options.path.split("?")[0] === "/api/v1/skill-market/skills") headers.set("X-Finch-Search-Version", "2");
|
|
@@ -55176,13 +55343,41 @@ var init_api2 = __esm({
|
|
|
55176
55343
|
} catch (cause) {
|
|
55177
55344
|
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", null, { cause });
|
|
55178
55345
|
}
|
|
55346
|
+
const diagnose = options.errorContract === "skill_market";
|
|
55179
55347
|
if (response.status !== options.successStatus) {
|
|
55180
|
-
|
|
55181
|
-
|
|
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
|
+
});
|
|
55182
55365
|
}
|
|
55183
55366
|
if (options.successStatus === 204) return void 0;
|
|
55184
|
-
|
|
55185
|
-
|
|
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
|
+
}
|
|
55186
55381
|
}
|
|
55187
55382
|
async skillFetch(path2, init, expectedStatus = 200) {
|
|
55188
55383
|
let response;
|
|
@@ -55194,8 +55389,8 @@ var init_api2 = __esm({
|
|
|
55194
55389
|
if (response.status !== expectedStatus) {
|
|
55195
55390
|
let value;
|
|
55196
55391
|
try {
|
|
55197
|
-
value = await readBoundedJson(response, 65536,
|
|
55198
|
-
const envelope = parseRemoteError("skill_market", response, value,
|
|
55392
|
+
value = await readBoundedJson(response, 65536, true);
|
|
55393
|
+
const envelope = parseRemoteError("skill_market", response, value, true);
|
|
55199
55394
|
throw new CliHttpError("CLI_REMOTE_UNAVAILABLE", response.status, { envelope });
|
|
55200
55395
|
} catch (cause) {
|
|
55201
55396
|
throw new CliHttpError(cause instanceof CliHttpError ? cause.code : "CLI_RESPONSE_INVALID", response.status, {
|
|
@@ -55298,19 +55493,9 @@ var init_api2 = __esm({
|
|
|
55298
55493
|
const encoded = new Response(form);
|
|
55299
55494
|
const bodyBytes = await encoded.arrayBuffer();
|
|
55300
55495
|
const requestBytes = bodyBytes.byteLength;
|
|
55301
|
-
if (requestBytes >
|
|
55302
|
-
|
|
55303
|
-
"SKILL_UPLOAD_REQUEST_TOO_LARGE",
|
|
55304
|
-
{ actualBytes: requestBytes, maxBytes: 45e5 },
|
|
55305
|
-
"Skill upload request exceeds 4.5 MB. Reduce the package size before publishing."
|
|
55306
|
-
);
|
|
55496
|
+
if (requestBytes > SKILL_UPLOAD_INLINE_LIMIT_BYTES) {
|
|
55497
|
+
return await this.uploadStagedSkillObject(input);
|
|
55307
55498
|
}
|
|
55308
|
-
if (requestBytes > 4e6) this.warn({
|
|
55309
|
-
code: "SKILL_UPLOAD_NEAR_LIMIT",
|
|
55310
|
-
requestBytes,
|
|
55311
|
-
maxBytes: 45e5,
|
|
55312
|
-
message: "Skill upload request exceeds 4 MB and may fail near the platform limit. Continuing."
|
|
55313
|
-
});
|
|
55314
55499
|
let response;
|
|
55315
55500
|
let value;
|
|
55316
55501
|
try {
|
|
@@ -55337,6 +55522,121 @@ var init_api2 = __esm({
|
|
|
55337
55522
|
});
|
|
55338
55523
|
}
|
|
55339
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
|
+
}
|
|
55340
55640
|
async requestSkillIntent(body, bearer) {
|
|
55341
55641
|
let response;
|
|
55342
55642
|
try {
|
|
@@ -55438,7 +55738,7 @@ var init_api2 = __esm({
|
|
|
55438
55738
|
headers: bearer === void 0 ? void 0 : { authorization: `Bearer ${bearer}` },
|
|
55439
55739
|
cache: "no-store"
|
|
55440
55740
|
});
|
|
55441
|
-
return readBoundedBytes(response, 1,
|
|
55741
|
+
return readBoundedBytes(response, 1, MAX_SKILL_PACKAGE_BYTES);
|
|
55442
55742
|
}
|
|
55443
55743
|
async confirmSkillProjection(chainId, transactionHash3, bearer) {
|
|
55444
55744
|
let response;
|
|
@@ -55478,13 +55778,13 @@ var init_api2 = __esm({
|
|
|
55478
55778
|
});
|
|
55479
55779
|
}
|
|
55480
55780
|
authorizeMcp(requestPath, bearer) {
|
|
55481
|
-
let
|
|
55781
|
+
let parsed2;
|
|
55482
55782
|
try {
|
|
55483
|
-
|
|
55783
|
+
parsed2 = new URL(requestPath, this.origin);
|
|
55484
55784
|
} catch {
|
|
55485
55785
|
throw new TypeError("MCP authorization request path is invalid.");
|
|
55486
55786
|
}
|
|
55487
|
-
if (
|
|
55787
|
+
if (parsed2.origin !== this.origin || parsed2.pathname !== "/oauth/authorize" || parsed2.hash !== "" || requestPath !== `${parsed2.pathname}${parsed2.search}` || parsed2.search === "") {
|
|
55488
55788
|
throw new TypeError("MCP authorization request path is invalid.");
|
|
55489
55789
|
}
|
|
55490
55790
|
return this.request({
|
|
@@ -56135,16 +56435,16 @@ function assertLocalAction(value, command, skillId) {
|
|
|
56135
56435
|
}
|
|
56136
56436
|
}
|
|
56137
56437
|
function intent(value, walletAddress2) {
|
|
56138
|
-
const
|
|
56139
|
-
exact2(
|
|
56140
|
-
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");
|
|
56141
56441
|
return Object.freeze({
|
|
56142
56442
|
chainId,
|
|
56143
|
-
to: string4(
|
|
56144
|
-
data: string4(
|
|
56145
|
-
value: string4(
|
|
56146
|
-
summary: string4(
|
|
56147
|
-
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)
|
|
56148
56448
|
});
|
|
56149
56449
|
}
|
|
56150
56450
|
function legacyIntent(value, walletAddress2, authority) {
|
|
@@ -56464,6 +56764,14 @@ function recoveryJournal(value, fingerprint2, kind, context) {
|
|
|
56464
56764
|
journal.receipts = parsedReceipts;
|
|
56465
56765
|
return journal;
|
|
56466
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
|
+
}
|
|
56467
56775
|
var MAX_ENCRYPTED_BYTES, HASH2, IPFS, DECIMAL, UUID, SkillLocalFlow;
|
|
56468
56776
|
var init_skill_local_flow = __esm({
|
|
56469
56777
|
"src/skill-local-flow.ts"() {
|
|
@@ -56471,7 +56779,7 @@ var init_skill_local_flow = __esm({
|
|
|
56471
56779
|
init_src2();
|
|
56472
56780
|
init_client();
|
|
56473
56781
|
init_cli_error();
|
|
56474
|
-
MAX_ENCRYPTED_BYTES =
|
|
56782
|
+
MAX_ENCRYPTED_BYTES = MAX_SKILL_PACKAGE_BYTES;
|
|
56475
56783
|
HASH2 = /^0x[0-9a-fA-F]{64}$/u;
|
|
56476
56784
|
IPFS = /^ipfs:\/\/(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|b[a-z2-7]{20,})$/u;
|
|
56477
56785
|
DECIMAL = /^(?:0|[1-9][0-9]*)$/u;
|
|
@@ -56497,15 +56805,23 @@ var init_skill_local_flow = __esm({
|
|
|
56497
56805
|
return await work(progress);
|
|
56498
56806
|
} catch (cause) {
|
|
56499
56807
|
const journal = progress.journal;
|
|
56500
|
-
|
|
56501
|
-
|
|
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
|
+
]);
|
|
56502
56816
|
const fingerprint2 = progress.journal && progress.fingerprint ? progress.fingerprint : null;
|
|
56503
56817
|
throw new CliSkillPublicationError({
|
|
56504
56818
|
phase: progress.phase,
|
|
56505
56819
|
fingerprint: fingerprint2,
|
|
56506
56820
|
transactionHashes,
|
|
56821
|
+
unconfirmedActions: unconfirmed,
|
|
56507
56822
|
submissionStatus: progress.uncertain ? "uncertain" : Object.keys(transactionHashes).length ? "hash_known" : "not_attempted",
|
|
56508
|
-
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
|
|
56509
56825
|
}, cause);
|
|
56510
56826
|
}
|
|
56511
56827
|
}
|
|
@@ -56530,7 +56846,7 @@ var init_skill_local_flow = __esm({
|
|
|
56530
56846
|
}
|
|
56531
56847
|
async upload(input) {
|
|
56532
56848
|
const { bytes } = input;
|
|
56533
|
-
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.`);
|
|
56534
56850
|
const result2 = await required2(this.api.uploadSkillObject, "Skill upload").call(this.api, input);
|
|
56535
56851
|
return string4(result2.uri, "Pinned Skill URI", IPFS);
|
|
56536
56852
|
}
|
|
@@ -56604,8 +56920,8 @@ var init_skill_local_flow = __esm({
|
|
|
56604
56920
|
if (error51 instanceof SkillZipInvalidError) {
|
|
56605
56921
|
const messages = {
|
|
56606
56922
|
invalid_archive: "Skill ZIP is damaged or unsupported. Rebuild a regular ZIP and try again.",
|
|
56607
|
-
archive_too_large:
|
|
56608
|
-
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.`,
|
|
56609
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.",
|
|
56610
56926
|
filename_encoding_invalid: "Skill ZIP filename bytes are not valid UTF-8. Rebuild the ZIP with UTF-8 filenames and flags."
|
|
56611
56927
|
};
|
|
@@ -56686,15 +57002,24 @@ var init_skill_local_flow = __esm({
|
|
|
56686
57002
|
await this.project(journal.chainId, journal.receipts[stage].transactionHash, context.bearer);
|
|
56687
57003
|
return;
|
|
56688
57004
|
}
|
|
56689
|
-
if (
|
|
57005
|
+
if (stage !== "uri" && (journal.pendingStage != null || journal.version !== 6)) {
|
|
56690
57006
|
progress.uncertain = true;
|
|
56691
|
-
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
|
+
});
|
|
56692
57014
|
}
|
|
56693
57015
|
progress.phase = "intent";
|
|
56694
57016
|
const prepared = await prepare();
|
|
56695
57017
|
progress.phase = "transaction";
|
|
56696
|
-
journal.
|
|
56697
|
-
|
|
57018
|
+
const marks = journal.version === 6;
|
|
57019
|
+
if (marks) {
|
|
57020
|
+
journal.pendingStage = stage;
|
|
57021
|
+
await this.save(fingerprint2, journal);
|
|
57022
|
+
}
|
|
56698
57023
|
progress.uncertain = true;
|
|
56699
57024
|
journal.receipts[stage] = await this.send(
|
|
56700
57025
|
context,
|
|
@@ -56705,12 +57030,14 @@ var init_skill_local_flow = __esm({
|
|
|
56705
57030
|
async ({ transactionHash: transactionHash3 }) => {
|
|
56706
57031
|
journal.receipts[stage] = { transactionHash: transactionHash3, blockNumber: null };
|
|
56707
57032
|
await this.save(fingerprint2, journal);
|
|
56708
|
-
|
|
56709
|
-
|
|
57033
|
+
if (marks) {
|
|
57034
|
+
journal.pendingStage = null;
|
|
57035
|
+
await this.save(fingerprint2, journal);
|
|
57036
|
+
}
|
|
56710
57037
|
progress.uncertain = false;
|
|
56711
57038
|
}
|
|
56712
57039
|
);
|
|
56713
|
-
journal.pendingStage = null;
|
|
57040
|
+
if (marks) journal.pendingStage = null;
|
|
56714
57041
|
await this.save(fingerprint2, journal);
|
|
56715
57042
|
progress.uncertain = false;
|
|
56716
57043
|
progress.phase = "projection";
|
|
@@ -57167,15 +57494,30 @@ var init_skill_local_flow = __esm({
|
|
|
57167
57494
|
await this.project(plan.chainId, submission.transactionHash, context.bearer);
|
|
57168
57495
|
return { ...submission, chainId: plan.chainId, skillId: plan.request.skillId, kind };
|
|
57169
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
|
+
*/
|
|
57170
57505
|
async publishPresentation(planValue, context) {
|
|
57506
|
+
return this.publication((progress) => this.publishPresentationWithProgress(planValue, context, progress));
|
|
57507
|
+
}
|
|
57508
|
+
async publishPresentationWithProgress(planValue, context, progress) {
|
|
57171
57509
|
const plan = presentationPlan(planValue, context.walletAddress);
|
|
57510
|
+
progress.resubmitSafe = true;
|
|
57172
57511
|
const liveVersion = await required2(this.api.readSkillCurrentVersion, "Skill version API").call(this.api, plan.chainId, plan.skillId, context.bearer);
|
|
57173
57512
|
if (liveVersion !== plan.currentVersion) {
|
|
57174
|
-
throw new
|
|
57513
|
+
throw new CliSkillPresentationStaleError("version_moved", plan.currentVersion, liveVersion);
|
|
57175
57514
|
}
|
|
57176
57515
|
const currentBytes = await required2(this.api.fetchSkillStoredContent, "Skill content relay").call(this.api, plan.currentManifestURI, context.bearer);
|
|
57177
57516
|
const currentManifest = parseManifest(currentBytes);
|
|
57178
|
-
if (currentManifest === null)
|
|
57517
|
+
if (currentManifest === null) {
|
|
57518
|
+
throw new CliSkillPresentationStaleError("manifest_unreadable", plan.currentVersion, liveVersion);
|
|
57519
|
+
}
|
|
57520
|
+
progress.phase = "upload";
|
|
57179
57521
|
const manifestURI = await this.upload({
|
|
57180
57522
|
bytes: serializeManifest(withPresentation(currentManifest, plan.presentation)),
|
|
57181
57523
|
filename: `skill-${plan.skillId}.versions.json`,
|
|
@@ -57183,14 +57525,24 @@ var init_skill_local_flow = __esm({
|
|
|
57183
57525
|
objectKind: "manifest"
|
|
57184
57526
|
});
|
|
57185
57527
|
const request = { action: "setSkillURI", chainId: plan.chainId, skillId: plan.skillId, packageURI: manifestURI };
|
|
57528
|
+
progress.phase = "intent";
|
|
57186
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;
|
|
57187
57532
|
const submission = await this.send(
|
|
57188
57533
|
context,
|
|
57189
57534
|
"setSkillURI",
|
|
57190
57535
|
request,
|
|
57191
57536
|
prepared,
|
|
57192
|
-
plan.signingAuthority
|
|
57537
|
+
plan.signingAuthority,
|
|
57538
|
+
async ({ transactionHash: transactionHash3 }) => {
|
|
57539
|
+
progress.broadcast = { setSkillURI: transactionHash3 };
|
|
57540
|
+
progress.uncertain = false;
|
|
57541
|
+
}
|
|
57193
57542
|
);
|
|
57543
|
+
progress.broadcast = { setSkillURI: submission.transactionHash };
|
|
57544
|
+
progress.uncertain = false;
|
|
57545
|
+
progress.phase = "projection";
|
|
57194
57546
|
await this.project(plan.chainId, submission.transactionHash, context.bearer);
|
|
57195
57547
|
return { ...submission, chainId: plan.chainId, skillId: plan.skillId, currentVersion: plan.currentVersion, manifestURI };
|
|
57196
57548
|
}
|
|
@@ -57443,8 +57795,8 @@ async function readBoundedJsonFile(path2) {
|
|
|
57443
57795
|
if (after.size !== before.size || bytes.byteLength !== before.size) {
|
|
57444
57796
|
throw new TypeError("Request file changed while it was read.");
|
|
57445
57797
|
}
|
|
57446
|
-
const
|
|
57447
|
-
return asObject(JSON.parse(
|
|
57798
|
+
const text3 = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
57799
|
+
return asObject(JSON.parse(text3), "Request file");
|
|
57448
57800
|
} catch (cause) {
|
|
57449
57801
|
if (cause instanceof TypeError) throw cause;
|
|
57450
57802
|
throw new TypeError("Request file is invalid.", { cause });
|
|
@@ -57932,14 +58284,14 @@ var init_application = __esm({
|
|
|
57932
58284
|
}
|
|
57933
58285
|
async loginSite(requestUrl) {
|
|
57934
58286
|
const profile = await this.authorizedProfile();
|
|
57935
|
-
let
|
|
58287
|
+
let parsed2;
|
|
57936
58288
|
try {
|
|
57937
|
-
|
|
58289
|
+
parsed2 = new URL(requestUrl);
|
|
57938
58290
|
} catch {
|
|
57939
58291
|
throw new TypeError("Browser login request URL is invalid.");
|
|
57940
58292
|
}
|
|
57941
|
-
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(
|
|
57942
|
-
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) {
|
|
57943
58295
|
throw new TypeError("Browser login request origin or path does not match the active profile origin.");
|
|
57944
58296
|
}
|
|
57945
58297
|
const authority = await this.verifiedAgentCliAuthority();
|
|
@@ -58777,7 +59129,7 @@ var init_application = __esm({
|
|
|
58777
59129
|
const plan = await readBoundedJsonFile(planFile);
|
|
58778
59130
|
const context = isPlaintextSkillDelivery(plan) ? null : await this.skillLocalContext();
|
|
58779
59131
|
const delivered = await required3(this.skillLocalFlow, "skill local flow").download(plan, context);
|
|
58780
|
-
await writeExclusiveProtectedFile(outputFile, delivered.bytes);
|
|
59132
|
+
await writeExclusiveProtectedFile(outputFile, delivered.bytes, "output_destination");
|
|
58781
59133
|
return { path: outputFile, skillId: delivered.skillId, version: delivered.version, packageHash: delivered.packageHash };
|
|
58782
59134
|
}
|
|
58783
59135
|
async showIntent(intentId) {
|
|
@@ -58899,7 +59251,7 @@ var init_application = __esm({
|
|
|
58899
59251
|
if (decoded.keyId !== material.keyId || claim.expectedKeyId !== null && claim.expectedKeyId !== decoded.keyId) {
|
|
58900
59252
|
throw new TypeError("Credential material keyId does not match the live claim.");
|
|
58901
59253
|
}
|
|
58902
|
-
await writeExclusiveProtectedFile(outputFile, material.body);
|
|
59254
|
+
await writeExclusiveProtectedFile(outputFile, material.body, "output_destination");
|
|
58903
59255
|
return Object.freeze({ keyId: decoded.keyId, path: outputFile });
|
|
58904
59256
|
}
|
|
58905
59257
|
async showOperation(operationId) {
|
|
@@ -59057,7 +59409,7 @@ var init_package = __esm({
|
|
|
59057
59409
|
"package.json"() {
|
|
59058
59410
|
package_default = {
|
|
59059
59411
|
name: "@finchtech/cli",
|
|
59060
|
-
version: "0.3.
|
|
59412
|
+
version: "0.3.7",
|
|
59061
59413
|
description: "Finch Agent CLI for wallet-owned marketplace and MCP workflows.",
|
|
59062
59414
|
type: "module",
|
|
59063
59415
|
bin: {
|
|
@@ -60059,12 +60411,12 @@ function environment2(value) {
|
|
|
60059
60411
|
}
|
|
60060
60412
|
function endpointOrigin(value) {
|
|
60061
60413
|
if (typeof value !== "string" || !URL.canParse(value)) throw new CliStateError("CLI_STATE_CORRUPT");
|
|
60062
|
-
const
|
|
60063
|
-
const loopbackHttp =
|
|
60064
|
-
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) {
|
|
60065
60417
|
throw new CliStateError("CLI_STATE_CORRUPT");
|
|
60066
60418
|
}
|
|
60067
|
-
return
|
|
60419
|
+
return parsed2.origin;
|
|
60068
60420
|
}
|
|
60069
60421
|
function pendingGrantFingerprint(scopes, expiresAt) {
|
|
60070
60422
|
return createHash4("sha256").update(JSON.stringify({ scopes, expiresAt }), "utf8").digest("hex");
|
|
@@ -61122,11 +61474,11 @@ var init_chains2 = __esm({
|
|
|
61122
61474
|
|
|
61123
61475
|
// src/purchase-sender.ts
|
|
61124
61476
|
function parseRpcUrl(value) {
|
|
61125
|
-
const
|
|
61126
|
-
if (
|
|
61477
|
+
const parsed2 = new URL(value);
|
|
61478
|
+
if (parsed2.protocol !== "https:" || parsed2.username !== "" || parsed2.password !== "" || parsed2.hash !== "") {
|
|
61127
61479
|
throw new TypeError("The reviewed Agent RPC must be HTTPS without userinfo or fragment.");
|
|
61128
61480
|
}
|
|
61129
|
-
return
|
|
61481
|
+
return parsed2.href;
|
|
61130
61482
|
}
|
|
61131
61483
|
function privateKey2(value) {
|
|
61132
61484
|
if (!/^0x[0-9a-f]{64}$/u.test(value)) {
|
|
@@ -61423,11 +61775,11 @@ var init_purchase_sender = __esm({
|
|
|
61423
61775
|
|
|
61424
61776
|
// src/task-protocol-sender.ts
|
|
61425
61777
|
function parseRpcUrl2(value) {
|
|
61426
|
-
const
|
|
61427
|
-
if (
|
|
61778
|
+
const parsed2 = new URL(value);
|
|
61779
|
+
if (parsed2.protocol !== "https:" || parsed2.username !== "" || parsed2.password !== "" || parsed2.hash !== "") {
|
|
61428
61780
|
throw new TypeError("The reviewed Task RPC must be HTTPS without userinfo or fragment.");
|
|
61429
61781
|
}
|
|
61430
|
-
return
|
|
61782
|
+
return parsed2.href;
|
|
61431
61783
|
}
|
|
61432
61784
|
function installedPrivateKey(value) {
|
|
61433
61785
|
if (!/^0x[0-9a-f]{64}$/u.test(value)) throw new TypeError("The installed wallet private key is invalid.");
|
|
@@ -61453,9 +61805,9 @@ function unsigned(value, name) {
|
|
|
61453
61805
|
}
|
|
61454
61806
|
function uint642(value, name) {
|
|
61455
61807
|
if (!Number.isSafeInteger(value) || Number(value) < 0) throw new TypeError(`${name} is invalid.`);
|
|
61456
|
-
const
|
|
61457
|
-
if (
|
|
61458
|
-
return
|
|
61808
|
+
const parsed2 = BigInt(Number(value));
|
|
61809
|
+
if (parsed2 > 18446744073709551615n) throw new TypeError(`${name} is invalid.`);
|
|
61810
|
+
return parsed2;
|
|
61459
61811
|
}
|
|
61460
61812
|
function uint16(value, name) {
|
|
61461
61813
|
if (!Number.isSafeInteger(value) || Number(value) < 0 || Number(value) > 65535) {
|
|
@@ -61805,11 +62157,11 @@ var init_task_protocol_sender = __esm({
|
|
|
61805
62157
|
|
|
61806
62158
|
// src/skill-intent-sender.ts
|
|
61807
62159
|
function parseRpcUrl3(value) {
|
|
61808
|
-
const
|
|
61809
|
-
if (
|
|
62160
|
+
const parsed2 = new URL(value);
|
|
62161
|
+
if (parsed2.protocol !== "https:" || parsed2.username !== "" || parsed2.password !== "" || parsed2.hash !== "") {
|
|
61810
62162
|
throw new TypeError("The reviewed Skill RPC must be HTTPS without userinfo or fragment.");
|
|
61811
62163
|
}
|
|
61812
|
-
return
|
|
62164
|
+
return parsed2.href;
|
|
61813
62165
|
}
|
|
61814
62166
|
function installedPrivateKey2(value) {
|
|
61815
62167
|
if (!/^0x[0-9a-f]{64}$/u.test(value)) throw new TypeError("The installed wallet private key is invalid.");
|
|
@@ -62192,6 +62544,18 @@ var output_exports = {};
|
|
|
62192
62544
|
__export(output_exports, {
|
|
62193
62545
|
emitCliOutcome: () => emitCliOutcome
|
|
62194
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
|
+
}
|
|
62195
62559
|
function remoteExitCode(status) {
|
|
62196
62560
|
if (status === 400 || status === 422) return AGENT_CLI_OUTPUT_CONTRACT.exitCodes.usageOrLocalSchema;
|
|
62197
62561
|
if (status === 401 || status === 403) return AGENT_CLI_OUTPUT_CONTRACT.exitCodes.authenticationOrAuthority;
|
|
@@ -62224,6 +62588,23 @@ function failure(error51) {
|
|
|
62224
62588
|
message: "This protocol is not available in production."
|
|
62225
62589
|
};
|
|
62226
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
|
+
}
|
|
62227
62608
|
if (error51 instanceof CliRecoveryBlockedError) {
|
|
62228
62609
|
return {
|
|
62229
62610
|
code: "AGENT_MARKET_STATE_CONFLICT",
|
|
@@ -62264,17 +62645,32 @@ function emitCliOutcome(outcome, sinks) {
|
|
|
62264
62645
|
const envelope2 = JSON.parse(serialized);
|
|
62265
62646
|
const source = cause instanceof CliSkillSourceError ? cause : null;
|
|
62266
62647
|
const remote = cause instanceof CliHttpError && cause.envelope !== null;
|
|
62648
|
+
const uncertainRecovery = cause instanceof CliSkillRecoveryUncertainError;
|
|
62267
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;
|
|
62268
62653
|
envelope2.error.state = JSON.stringify({
|
|
62269
62654
|
diagnosticCode: source?.diagnosticCode ?? "SKILL_PUBLICATION_FAILED",
|
|
62270
62655
|
...source?.details,
|
|
62271
62656
|
...diagnostic,
|
|
62272
62657
|
...cause instanceof CliHttpError ? { remoteStatus: cause.status, ...cause.diagnostic } : {},
|
|
62273
|
-
|
|
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 } : {}
|
|
62274
62661
|
});
|
|
62275
62662
|
envelope2.error.retryable = false;
|
|
62276
|
-
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."}`;
|
|
62277
|
-
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
|
+
}
|
|
62278
62674
|
sinks.stdout(`${JSON.stringify(envelope2)}
|
|
62279
62675
|
`);
|
|
62280
62676
|
return exitCode;
|