@casys/mcp-erpnext 3.0.0 → 3.0.1
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/mcp-erpnext.mjs +1480 -649
- package/package.json +1 -1
package/mcp-erpnext.mjs
CHANGED
|
@@ -1769,7 +1769,7 @@ var require_code2 = __commonJS({
|
|
|
1769
1769
|
return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p]));
|
|
1770
1770
|
}
|
|
1771
1771
|
exports.schemaProperties = schemaProperties;
|
|
1772
|
-
function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func,
|
|
1772
|
+
function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context2, passSchema) {
|
|
1773
1773
|
const dataAndSchema = passSchema ? (0, codegen_1._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
|
|
1774
1774
|
const valCxt = [
|
|
1775
1775
|
[names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)],
|
|
@@ -1780,7 +1780,7 @@ var require_code2 = __commonJS({
|
|
|
1780
1780
|
if (it.opts.dynamicRef)
|
|
1781
1781
|
valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]);
|
|
1782
1782
|
const args = (0, codegen_1._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
|
|
1783
|
-
return
|
|
1783
|
+
return context2 !== codegen_1.nil ? (0, codegen_1._)`${func}.call(${context2}, ${args})` : (0, codegen_1._)`${func}(${args})`;
|
|
1784
1784
|
}
|
|
1785
1785
|
exports.callValidateCode = callValidateCode;
|
|
1786
1786
|
var newRegExp = (0, codegen_1._)`new RegExp`;
|
|
@@ -4776,8 +4776,8 @@ var require_multipleOf = __commonJS({
|
|
|
4776
4776
|
const { gen, data, schemaCode, it } = cxt;
|
|
4777
4777
|
const prec = it.opts.multipleOfPrecision;
|
|
4778
4778
|
const res = gen.let("res");
|
|
4779
|
-
const
|
|
4780
|
-
cxt.fail$data((0, codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${
|
|
4779
|
+
const invalid2 = prec ? (0, codegen_1._)`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` : (0, codegen_1._)`${res} !== parseInt(${res})`;
|
|
4780
|
+
cxt.fail$data((0, codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid2}))`);
|
|
4781
4781
|
}
|
|
4782
4782
|
};
|
|
4783
4783
|
exports.default = def;
|
|
@@ -6676,8 +6676,8 @@ var require_formats = __commonJS({
|
|
|
6676
6676
|
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
|
|
6677
6677
|
};
|
|
6678
6678
|
exports.formatNames = Object.keys(exports.fullFormats);
|
|
6679
|
-
function isLeapYear(
|
|
6680
|
-
return
|
|
6679
|
+
function isLeapYear(year) {
|
|
6680
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
6681
6681
|
}
|
|
6682
6682
|
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
6683
6683
|
var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
@@ -6685,10 +6685,10 @@ var require_formats = __commonJS({
|
|
|
6685
6685
|
const matches = DATE.exec(str);
|
|
6686
6686
|
if (!matches)
|
|
6687
6687
|
return false;
|
|
6688
|
-
const
|
|
6688
|
+
const year = +matches[1];
|
|
6689
6689
|
const month = +matches[2];
|
|
6690
|
-
const
|
|
6691
|
-
return month >= 1 && month <= 12 &&
|
|
6690
|
+
const day = +matches[3];
|
|
6691
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
|
6692
6692
|
}
|
|
6693
6693
|
function compareDate(d1, d2) {
|
|
6694
6694
|
if (!(d1 && d2))
|
|
@@ -6921,6 +6921,830 @@ var require_dist = __commonJS({
|
|
|
6921
6921
|
}
|
|
6922
6922
|
});
|
|
6923
6923
|
|
|
6924
|
+
// node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js
|
|
6925
|
+
var require_dynamicAnchor = __commonJS({
|
|
6926
|
+
"node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js"(exports) {
|
|
6927
|
+
"use strict";
|
|
6928
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6929
|
+
exports.dynamicAnchor = void 0;
|
|
6930
|
+
var codegen_1 = require_codegen();
|
|
6931
|
+
var names_1 = require_names();
|
|
6932
|
+
var compile_1 = require_compile();
|
|
6933
|
+
var ref_1 = require_ref();
|
|
6934
|
+
var def = {
|
|
6935
|
+
keyword: "$dynamicAnchor",
|
|
6936
|
+
schemaType: "string",
|
|
6937
|
+
code: (cxt) => dynamicAnchor(cxt, cxt.schema)
|
|
6938
|
+
};
|
|
6939
|
+
function dynamicAnchor(cxt, anchor) {
|
|
6940
|
+
const { gen, it } = cxt;
|
|
6941
|
+
it.schemaEnv.root.dynamicAnchors[anchor] = true;
|
|
6942
|
+
const v = (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`;
|
|
6943
|
+
const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt);
|
|
6944
|
+
gen.if((0, codegen_1._)`!${v}`, () => gen.assign(v, validate));
|
|
6945
|
+
}
|
|
6946
|
+
exports.dynamicAnchor = dynamicAnchor;
|
|
6947
|
+
function _getValidate(cxt) {
|
|
6948
|
+
const { schemaEnv, schema, self: self2 } = cxt.it;
|
|
6949
|
+
const { root, baseId, localRefs, meta: meta2 } = schemaEnv.root;
|
|
6950
|
+
const { schemaId } = self2.opts;
|
|
6951
|
+
const sch = new compile_1.SchemaEnv({ schema, schemaId, root, baseId, localRefs, meta: meta2 });
|
|
6952
|
+
compile_1.compileSchema.call(self2, sch);
|
|
6953
|
+
return (0, ref_1.getValidate)(cxt, sch);
|
|
6954
|
+
}
|
|
6955
|
+
exports.default = def;
|
|
6956
|
+
}
|
|
6957
|
+
});
|
|
6958
|
+
|
|
6959
|
+
// node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js
|
|
6960
|
+
var require_dynamicRef = __commonJS({
|
|
6961
|
+
"node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js"(exports) {
|
|
6962
|
+
"use strict";
|
|
6963
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6964
|
+
exports.dynamicRef = void 0;
|
|
6965
|
+
var codegen_1 = require_codegen();
|
|
6966
|
+
var names_1 = require_names();
|
|
6967
|
+
var ref_1 = require_ref();
|
|
6968
|
+
var def = {
|
|
6969
|
+
keyword: "$dynamicRef",
|
|
6970
|
+
schemaType: "string",
|
|
6971
|
+
code: (cxt) => dynamicRef(cxt, cxt.schema)
|
|
6972
|
+
};
|
|
6973
|
+
function dynamicRef(cxt, ref) {
|
|
6974
|
+
const { gen, keyword, it } = cxt;
|
|
6975
|
+
if (ref[0] !== "#")
|
|
6976
|
+
throw new Error(`"${keyword}" only supports hash fragment reference`);
|
|
6977
|
+
const anchor = ref.slice(1);
|
|
6978
|
+
if (it.allErrors) {
|
|
6979
|
+
_dynamicRef();
|
|
6980
|
+
} else {
|
|
6981
|
+
const valid = gen.let("valid", false);
|
|
6982
|
+
_dynamicRef(valid);
|
|
6983
|
+
cxt.ok(valid);
|
|
6984
|
+
}
|
|
6985
|
+
function _dynamicRef(valid) {
|
|
6986
|
+
if (it.schemaEnv.root.dynamicAnchors[anchor]) {
|
|
6987
|
+
const v = gen.let("_v", (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`);
|
|
6988
|
+
gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid));
|
|
6989
|
+
} else {
|
|
6990
|
+
_callRef(it.validateName, valid)();
|
|
6991
|
+
}
|
|
6992
|
+
}
|
|
6993
|
+
function _callRef(validate, valid) {
|
|
6994
|
+
return valid ? () => gen.block(() => {
|
|
6995
|
+
(0, ref_1.callRef)(cxt, validate);
|
|
6996
|
+
gen.let(valid, true);
|
|
6997
|
+
}) : () => (0, ref_1.callRef)(cxt, validate);
|
|
6998
|
+
}
|
|
6999
|
+
}
|
|
7000
|
+
exports.dynamicRef = dynamicRef;
|
|
7001
|
+
exports.default = def;
|
|
7002
|
+
}
|
|
7003
|
+
});
|
|
7004
|
+
|
|
7005
|
+
// node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js
|
|
7006
|
+
var require_recursiveAnchor = __commonJS({
|
|
7007
|
+
"node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js"(exports) {
|
|
7008
|
+
"use strict";
|
|
7009
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7010
|
+
var dynamicAnchor_1 = require_dynamicAnchor();
|
|
7011
|
+
var util_1 = require_util();
|
|
7012
|
+
var def = {
|
|
7013
|
+
keyword: "$recursiveAnchor",
|
|
7014
|
+
schemaType: "boolean",
|
|
7015
|
+
code(cxt) {
|
|
7016
|
+
if (cxt.schema)
|
|
7017
|
+
(0, dynamicAnchor_1.dynamicAnchor)(cxt, "");
|
|
7018
|
+
else
|
|
7019
|
+
(0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored");
|
|
7020
|
+
}
|
|
7021
|
+
};
|
|
7022
|
+
exports.default = def;
|
|
7023
|
+
}
|
|
7024
|
+
});
|
|
7025
|
+
|
|
7026
|
+
// node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js
|
|
7027
|
+
var require_recursiveRef = __commonJS({
|
|
7028
|
+
"node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js"(exports) {
|
|
7029
|
+
"use strict";
|
|
7030
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7031
|
+
var dynamicRef_1 = require_dynamicRef();
|
|
7032
|
+
var def = {
|
|
7033
|
+
keyword: "$recursiveRef",
|
|
7034
|
+
schemaType: "string",
|
|
7035
|
+
code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema)
|
|
7036
|
+
};
|
|
7037
|
+
exports.default = def;
|
|
7038
|
+
}
|
|
7039
|
+
});
|
|
7040
|
+
|
|
7041
|
+
// node_modules/ajv/dist/vocabularies/dynamic/index.js
|
|
7042
|
+
var require_dynamic = __commonJS({
|
|
7043
|
+
"node_modules/ajv/dist/vocabularies/dynamic/index.js"(exports) {
|
|
7044
|
+
"use strict";
|
|
7045
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7046
|
+
var dynamicAnchor_1 = require_dynamicAnchor();
|
|
7047
|
+
var dynamicRef_1 = require_dynamicRef();
|
|
7048
|
+
var recursiveAnchor_1 = require_recursiveAnchor();
|
|
7049
|
+
var recursiveRef_1 = require_recursiveRef();
|
|
7050
|
+
var dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default];
|
|
7051
|
+
exports.default = dynamic;
|
|
7052
|
+
}
|
|
7053
|
+
});
|
|
7054
|
+
|
|
7055
|
+
// node_modules/ajv/dist/vocabularies/validation/dependentRequired.js
|
|
7056
|
+
var require_dependentRequired = __commonJS({
|
|
7057
|
+
"node_modules/ajv/dist/vocabularies/validation/dependentRequired.js"(exports) {
|
|
7058
|
+
"use strict";
|
|
7059
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7060
|
+
var dependencies_1 = require_dependencies();
|
|
7061
|
+
var def = {
|
|
7062
|
+
keyword: "dependentRequired",
|
|
7063
|
+
type: "object",
|
|
7064
|
+
schemaType: "object",
|
|
7065
|
+
error: dependencies_1.error,
|
|
7066
|
+
code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt)
|
|
7067
|
+
};
|
|
7068
|
+
exports.default = def;
|
|
7069
|
+
}
|
|
7070
|
+
});
|
|
7071
|
+
|
|
7072
|
+
// node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js
|
|
7073
|
+
var require_dependentSchemas = __commonJS({
|
|
7074
|
+
"node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js"(exports) {
|
|
7075
|
+
"use strict";
|
|
7076
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7077
|
+
var dependencies_1 = require_dependencies();
|
|
7078
|
+
var def = {
|
|
7079
|
+
keyword: "dependentSchemas",
|
|
7080
|
+
type: "object",
|
|
7081
|
+
schemaType: "object",
|
|
7082
|
+
code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt)
|
|
7083
|
+
};
|
|
7084
|
+
exports.default = def;
|
|
7085
|
+
}
|
|
7086
|
+
});
|
|
7087
|
+
|
|
7088
|
+
// node_modules/ajv/dist/vocabularies/validation/limitContains.js
|
|
7089
|
+
var require_limitContains = __commonJS({
|
|
7090
|
+
"node_modules/ajv/dist/vocabularies/validation/limitContains.js"(exports) {
|
|
7091
|
+
"use strict";
|
|
7092
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7093
|
+
var util_1 = require_util();
|
|
7094
|
+
var def = {
|
|
7095
|
+
keyword: ["maxContains", "minContains"],
|
|
7096
|
+
type: "array",
|
|
7097
|
+
schemaType: "number",
|
|
7098
|
+
code({ keyword, parentSchema, it }) {
|
|
7099
|
+
if (parentSchema.contains === void 0) {
|
|
7100
|
+
(0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`);
|
|
7101
|
+
}
|
|
7102
|
+
}
|
|
7103
|
+
};
|
|
7104
|
+
exports.default = def;
|
|
7105
|
+
}
|
|
7106
|
+
});
|
|
7107
|
+
|
|
7108
|
+
// node_modules/ajv/dist/vocabularies/next.js
|
|
7109
|
+
var require_next = __commonJS({
|
|
7110
|
+
"node_modules/ajv/dist/vocabularies/next.js"(exports) {
|
|
7111
|
+
"use strict";
|
|
7112
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7113
|
+
var dependentRequired_1 = require_dependentRequired();
|
|
7114
|
+
var dependentSchemas_1 = require_dependentSchemas();
|
|
7115
|
+
var limitContains_1 = require_limitContains();
|
|
7116
|
+
var next = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default];
|
|
7117
|
+
exports.default = next;
|
|
7118
|
+
}
|
|
7119
|
+
});
|
|
7120
|
+
|
|
7121
|
+
// node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js
|
|
7122
|
+
var require_unevaluatedProperties = __commonJS({
|
|
7123
|
+
"node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js"(exports) {
|
|
7124
|
+
"use strict";
|
|
7125
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7126
|
+
var codegen_1 = require_codegen();
|
|
7127
|
+
var util_1 = require_util();
|
|
7128
|
+
var names_1 = require_names();
|
|
7129
|
+
var error2 = {
|
|
7130
|
+
message: "must NOT have unevaluated properties",
|
|
7131
|
+
params: ({ params }) => (0, codegen_1._)`{unevaluatedProperty: ${params.unevaluatedProperty}}`
|
|
7132
|
+
};
|
|
7133
|
+
var def = {
|
|
7134
|
+
keyword: "unevaluatedProperties",
|
|
7135
|
+
type: "object",
|
|
7136
|
+
schemaType: ["boolean", "object"],
|
|
7137
|
+
trackErrors: true,
|
|
7138
|
+
error: error2,
|
|
7139
|
+
code(cxt) {
|
|
7140
|
+
const { gen, schema, data, errsCount, it } = cxt;
|
|
7141
|
+
if (!errsCount)
|
|
7142
|
+
throw new Error("ajv implementation error");
|
|
7143
|
+
const { allErrors, props } = it;
|
|
7144
|
+
if (props instanceof codegen_1.Name) {
|
|
7145
|
+
gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key))));
|
|
7146
|
+
} else if (props !== true) {
|
|
7147
|
+
gen.forIn("key", data, (key) => props === void 0 ? unevaluatedPropCode(key) : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)));
|
|
7148
|
+
}
|
|
7149
|
+
it.props = true;
|
|
7150
|
+
cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
|
|
7151
|
+
function unevaluatedPropCode(key) {
|
|
7152
|
+
if (schema === false) {
|
|
7153
|
+
cxt.setParams({ unevaluatedProperty: key });
|
|
7154
|
+
cxt.error();
|
|
7155
|
+
if (!allErrors)
|
|
7156
|
+
gen.break();
|
|
7157
|
+
return;
|
|
7158
|
+
}
|
|
7159
|
+
if (!(0, util_1.alwaysValidSchema)(it, schema)) {
|
|
7160
|
+
const valid = gen.name("valid");
|
|
7161
|
+
cxt.subschema({
|
|
7162
|
+
keyword: "unevaluatedProperties",
|
|
7163
|
+
dataProp: key,
|
|
7164
|
+
dataPropType: util_1.Type.Str
|
|
7165
|
+
}, valid);
|
|
7166
|
+
if (!allErrors)
|
|
7167
|
+
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
7168
|
+
}
|
|
7169
|
+
}
|
|
7170
|
+
function unevaluatedDynamic(evaluatedProps, key) {
|
|
7171
|
+
return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key}]`;
|
|
7172
|
+
}
|
|
7173
|
+
function unevaluatedStatic(evaluatedProps, key) {
|
|
7174
|
+
const ps = [];
|
|
7175
|
+
for (const p in evaluatedProps) {
|
|
7176
|
+
if (evaluatedProps[p] === true)
|
|
7177
|
+
ps.push((0, codegen_1._)`${key} !== ${p}`);
|
|
7178
|
+
}
|
|
7179
|
+
return (0, codegen_1.and)(...ps);
|
|
7180
|
+
}
|
|
7181
|
+
}
|
|
7182
|
+
};
|
|
7183
|
+
exports.default = def;
|
|
7184
|
+
}
|
|
7185
|
+
});
|
|
7186
|
+
|
|
7187
|
+
// node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js
|
|
7188
|
+
var require_unevaluatedItems = __commonJS({
|
|
7189
|
+
"node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js"(exports) {
|
|
7190
|
+
"use strict";
|
|
7191
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7192
|
+
var codegen_1 = require_codegen();
|
|
7193
|
+
var util_1 = require_util();
|
|
7194
|
+
var error2 = {
|
|
7195
|
+
message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
|
|
7196
|
+
params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
|
|
7197
|
+
};
|
|
7198
|
+
var def = {
|
|
7199
|
+
keyword: "unevaluatedItems",
|
|
7200
|
+
type: "array",
|
|
7201
|
+
schemaType: ["boolean", "object"],
|
|
7202
|
+
error: error2,
|
|
7203
|
+
code(cxt) {
|
|
7204
|
+
const { gen, schema, data, it } = cxt;
|
|
7205
|
+
const items = it.items || 0;
|
|
7206
|
+
if (items === true)
|
|
7207
|
+
return;
|
|
7208
|
+
const len = gen.const("len", (0, codegen_1._)`${data}.length`);
|
|
7209
|
+
if (schema === false) {
|
|
7210
|
+
cxt.setParams({ len: items });
|
|
7211
|
+
cxt.fail((0, codegen_1._)`${len} > ${items}`);
|
|
7212
|
+
} else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
|
|
7213
|
+
const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items}`);
|
|
7214
|
+
gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items));
|
|
7215
|
+
cxt.ok(valid);
|
|
7216
|
+
}
|
|
7217
|
+
it.items = true;
|
|
7218
|
+
function validateItems(valid, from) {
|
|
7219
|
+
gen.forRange("i", from, len, (i) => {
|
|
7220
|
+
cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid);
|
|
7221
|
+
if (!it.allErrors)
|
|
7222
|
+
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
7223
|
+
});
|
|
7224
|
+
}
|
|
7225
|
+
}
|
|
7226
|
+
};
|
|
7227
|
+
exports.default = def;
|
|
7228
|
+
}
|
|
7229
|
+
});
|
|
7230
|
+
|
|
7231
|
+
// node_modules/ajv/dist/vocabularies/unevaluated/index.js
|
|
7232
|
+
var require_unevaluated = __commonJS({
|
|
7233
|
+
"node_modules/ajv/dist/vocabularies/unevaluated/index.js"(exports) {
|
|
7234
|
+
"use strict";
|
|
7235
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7236
|
+
var unevaluatedProperties_1 = require_unevaluatedProperties();
|
|
7237
|
+
var unevaluatedItems_1 = require_unevaluatedItems();
|
|
7238
|
+
var unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default];
|
|
7239
|
+
exports.default = unevaluated;
|
|
7240
|
+
}
|
|
7241
|
+
});
|
|
7242
|
+
|
|
7243
|
+
// node_modules/ajv/dist/vocabularies/draft2020.js
|
|
7244
|
+
var require_draft2020 = __commonJS({
|
|
7245
|
+
"node_modules/ajv/dist/vocabularies/draft2020.js"(exports) {
|
|
7246
|
+
"use strict";
|
|
7247
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7248
|
+
var core_1 = require_core2();
|
|
7249
|
+
var validation_1 = require_validation();
|
|
7250
|
+
var applicator_1 = require_applicator();
|
|
7251
|
+
var dynamic_1 = require_dynamic();
|
|
7252
|
+
var next_1 = require_next();
|
|
7253
|
+
var unevaluated_1 = require_unevaluated();
|
|
7254
|
+
var format_1 = require_format2();
|
|
7255
|
+
var metadata_1 = require_metadata();
|
|
7256
|
+
var draft2020Vocabularies = [
|
|
7257
|
+
dynamic_1.default,
|
|
7258
|
+
core_1.default,
|
|
7259
|
+
validation_1.default,
|
|
7260
|
+
(0, applicator_1.default)(true),
|
|
7261
|
+
format_1.default,
|
|
7262
|
+
metadata_1.metadataVocabulary,
|
|
7263
|
+
metadata_1.contentVocabulary,
|
|
7264
|
+
next_1.default,
|
|
7265
|
+
unevaluated_1.default
|
|
7266
|
+
];
|
|
7267
|
+
exports.default = draft2020Vocabularies;
|
|
7268
|
+
}
|
|
7269
|
+
});
|
|
7270
|
+
|
|
7271
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/schema.json
|
|
7272
|
+
var require_schema = __commonJS({
|
|
7273
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/schema.json"(exports, module) {
|
|
7274
|
+
module.exports = {
|
|
7275
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
7276
|
+
$id: "https://json-schema.org/draft/2020-12/schema",
|
|
7277
|
+
$vocabulary: {
|
|
7278
|
+
"https://json-schema.org/draft/2020-12/vocab/core": true,
|
|
7279
|
+
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
|
|
7280
|
+
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
|
|
7281
|
+
"https://json-schema.org/draft/2020-12/vocab/validation": true,
|
|
7282
|
+
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
|
|
7283
|
+
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
|
|
7284
|
+
"https://json-schema.org/draft/2020-12/vocab/content": true
|
|
7285
|
+
},
|
|
7286
|
+
$dynamicAnchor: "meta",
|
|
7287
|
+
title: "Core and Validation specifications meta-schema",
|
|
7288
|
+
allOf: [
|
|
7289
|
+
{ $ref: "meta/core" },
|
|
7290
|
+
{ $ref: "meta/applicator" },
|
|
7291
|
+
{ $ref: "meta/unevaluated" },
|
|
7292
|
+
{ $ref: "meta/validation" },
|
|
7293
|
+
{ $ref: "meta/meta-data" },
|
|
7294
|
+
{ $ref: "meta/format-annotation" },
|
|
7295
|
+
{ $ref: "meta/content" }
|
|
7296
|
+
],
|
|
7297
|
+
type: ["object", "boolean"],
|
|
7298
|
+
$comment: "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
|
|
7299
|
+
properties: {
|
|
7300
|
+
definitions: {
|
|
7301
|
+
$comment: '"definitions" has been replaced by "$defs".',
|
|
7302
|
+
type: "object",
|
|
7303
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
7304
|
+
deprecated: true,
|
|
7305
|
+
default: {}
|
|
7306
|
+
},
|
|
7307
|
+
dependencies: {
|
|
7308
|
+
$comment: '"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',
|
|
7309
|
+
type: "object",
|
|
7310
|
+
additionalProperties: {
|
|
7311
|
+
anyOf: [{ $dynamicRef: "#meta" }, { $ref: "meta/validation#/$defs/stringArray" }]
|
|
7312
|
+
},
|
|
7313
|
+
deprecated: true,
|
|
7314
|
+
default: {}
|
|
7315
|
+
},
|
|
7316
|
+
$recursiveAnchor: {
|
|
7317
|
+
$comment: '"$recursiveAnchor" has been replaced by "$dynamicAnchor".',
|
|
7318
|
+
$ref: "meta/core#/$defs/anchorString",
|
|
7319
|
+
deprecated: true
|
|
7320
|
+
},
|
|
7321
|
+
$recursiveRef: {
|
|
7322
|
+
$comment: '"$recursiveRef" has been replaced by "$dynamicRef".',
|
|
7323
|
+
$ref: "meta/core#/$defs/uriReferenceString",
|
|
7324
|
+
deprecated: true
|
|
7325
|
+
}
|
|
7326
|
+
}
|
|
7327
|
+
};
|
|
7328
|
+
}
|
|
7329
|
+
});
|
|
7330
|
+
|
|
7331
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json
|
|
7332
|
+
var require_applicator2 = __commonJS({
|
|
7333
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json"(exports, module) {
|
|
7334
|
+
module.exports = {
|
|
7335
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
7336
|
+
$id: "https://json-schema.org/draft/2020-12/meta/applicator",
|
|
7337
|
+
$vocabulary: {
|
|
7338
|
+
"https://json-schema.org/draft/2020-12/vocab/applicator": true
|
|
7339
|
+
},
|
|
7340
|
+
$dynamicAnchor: "meta",
|
|
7341
|
+
title: "Applicator vocabulary meta-schema",
|
|
7342
|
+
type: ["object", "boolean"],
|
|
7343
|
+
properties: {
|
|
7344
|
+
prefixItems: { $ref: "#/$defs/schemaArray" },
|
|
7345
|
+
items: { $dynamicRef: "#meta" },
|
|
7346
|
+
contains: { $dynamicRef: "#meta" },
|
|
7347
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
7348
|
+
properties: {
|
|
7349
|
+
type: "object",
|
|
7350
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
7351
|
+
default: {}
|
|
7352
|
+
},
|
|
7353
|
+
patternProperties: {
|
|
7354
|
+
type: "object",
|
|
7355
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
7356
|
+
propertyNames: { format: "regex" },
|
|
7357
|
+
default: {}
|
|
7358
|
+
},
|
|
7359
|
+
dependentSchemas: {
|
|
7360
|
+
type: "object",
|
|
7361
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
7362
|
+
default: {}
|
|
7363
|
+
},
|
|
7364
|
+
propertyNames: { $dynamicRef: "#meta" },
|
|
7365
|
+
if: { $dynamicRef: "#meta" },
|
|
7366
|
+
then: { $dynamicRef: "#meta" },
|
|
7367
|
+
else: { $dynamicRef: "#meta" },
|
|
7368
|
+
allOf: { $ref: "#/$defs/schemaArray" },
|
|
7369
|
+
anyOf: { $ref: "#/$defs/schemaArray" },
|
|
7370
|
+
oneOf: { $ref: "#/$defs/schemaArray" },
|
|
7371
|
+
not: { $dynamicRef: "#meta" }
|
|
7372
|
+
},
|
|
7373
|
+
$defs: {
|
|
7374
|
+
schemaArray: {
|
|
7375
|
+
type: "array",
|
|
7376
|
+
minItems: 1,
|
|
7377
|
+
items: { $dynamicRef: "#meta" }
|
|
7378
|
+
}
|
|
7379
|
+
}
|
|
7380
|
+
};
|
|
7381
|
+
}
|
|
7382
|
+
});
|
|
7383
|
+
|
|
7384
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json
|
|
7385
|
+
var require_unevaluated2 = __commonJS({
|
|
7386
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json"(exports, module) {
|
|
7387
|
+
module.exports = {
|
|
7388
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
7389
|
+
$id: "https://json-schema.org/draft/2020-12/meta/unevaluated",
|
|
7390
|
+
$vocabulary: {
|
|
7391
|
+
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true
|
|
7392
|
+
},
|
|
7393
|
+
$dynamicAnchor: "meta",
|
|
7394
|
+
title: "Unevaluated applicator vocabulary meta-schema",
|
|
7395
|
+
type: ["object", "boolean"],
|
|
7396
|
+
properties: {
|
|
7397
|
+
unevaluatedItems: { $dynamicRef: "#meta" },
|
|
7398
|
+
unevaluatedProperties: { $dynamicRef: "#meta" }
|
|
7399
|
+
}
|
|
7400
|
+
};
|
|
7401
|
+
}
|
|
7402
|
+
});
|
|
7403
|
+
|
|
7404
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json
|
|
7405
|
+
var require_content = __commonJS({
|
|
7406
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json"(exports, module) {
|
|
7407
|
+
module.exports = {
|
|
7408
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
7409
|
+
$id: "https://json-schema.org/draft/2020-12/meta/content",
|
|
7410
|
+
$vocabulary: {
|
|
7411
|
+
"https://json-schema.org/draft/2020-12/vocab/content": true
|
|
7412
|
+
},
|
|
7413
|
+
$dynamicAnchor: "meta",
|
|
7414
|
+
title: "Content vocabulary meta-schema",
|
|
7415
|
+
type: ["object", "boolean"],
|
|
7416
|
+
properties: {
|
|
7417
|
+
contentEncoding: { type: "string" },
|
|
7418
|
+
contentMediaType: { type: "string" },
|
|
7419
|
+
contentSchema: { $dynamicRef: "#meta" }
|
|
7420
|
+
}
|
|
7421
|
+
};
|
|
7422
|
+
}
|
|
7423
|
+
});
|
|
7424
|
+
|
|
7425
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json
|
|
7426
|
+
var require_core3 = __commonJS({
|
|
7427
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json"(exports, module) {
|
|
7428
|
+
module.exports = {
|
|
7429
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
7430
|
+
$id: "https://json-schema.org/draft/2020-12/meta/core",
|
|
7431
|
+
$vocabulary: {
|
|
7432
|
+
"https://json-schema.org/draft/2020-12/vocab/core": true
|
|
7433
|
+
},
|
|
7434
|
+
$dynamicAnchor: "meta",
|
|
7435
|
+
title: "Core vocabulary meta-schema",
|
|
7436
|
+
type: ["object", "boolean"],
|
|
7437
|
+
properties: {
|
|
7438
|
+
$id: {
|
|
7439
|
+
$ref: "#/$defs/uriReferenceString",
|
|
7440
|
+
$comment: "Non-empty fragments not allowed.",
|
|
7441
|
+
pattern: "^[^#]*#?$"
|
|
7442
|
+
},
|
|
7443
|
+
$schema: { $ref: "#/$defs/uriString" },
|
|
7444
|
+
$ref: { $ref: "#/$defs/uriReferenceString" },
|
|
7445
|
+
$anchor: { $ref: "#/$defs/anchorString" },
|
|
7446
|
+
$dynamicRef: { $ref: "#/$defs/uriReferenceString" },
|
|
7447
|
+
$dynamicAnchor: { $ref: "#/$defs/anchorString" },
|
|
7448
|
+
$vocabulary: {
|
|
7449
|
+
type: "object",
|
|
7450
|
+
propertyNames: { $ref: "#/$defs/uriString" },
|
|
7451
|
+
additionalProperties: {
|
|
7452
|
+
type: "boolean"
|
|
7453
|
+
}
|
|
7454
|
+
},
|
|
7455
|
+
$comment: {
|
|
7456
|
+
type: "string"
|
|
7457
|
+
},
|
|
7458
|
+
$defs: {
|
|
7459
|
+
type: "object",
|
|
7460
|
+
additionalProperties: { $dynamicRef: "#meta" }
|
|
7461
|
+
}
|
|
7462
|
+
},
|
|
7463
|
+
$defs: {
|
|
7464
|
+
anchorString: {
|
|
7465
|
+
type: "string",
|
|
7466
|
+
pattern: "^[A-Za-z_][-A-Za-z0-9._]*$"
|
|
7467
|
+
},
|
|
7468
|
+
uriString: {
|
|
7469
|
+
type: "string",
|
|
7470
|
+
format: "uri"
|
|
7471
|
+
},
|
|
7472
|
+
uriReferenceString: {
|
|
7473
|
+
type: "string",
|
|
7474
|
+
format: "uri-reference"
|
|
7475
|
+
}
|
|
7476
|
+
}
|
|
7477
|
+
};
|
|
7478
|
+
}
|
|
7479
|
+
});
|
|
7480
|
+
|
|
7481
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json
|
|
7482
|
+
var require_format_annotation = __commonJS({
|
|
7483
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json"(exports, module) {
|
|
7484
|
+
module.exports = {
|
|
7485
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
7486
|
+
$id: "https://json-schema.org/draft/2020-12/meta/format-annotation",
|
|
7487
|
+
$vocabulary: {
|
|
7488
|
+
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true
|
|
7489
|
+
},
|
|
7490
|
+
$dynamicAnchor: "meta",
|
|
7491
|
+
title: "Format vocabulary meta-schema for annotation results",
|
|
7492
|
+
type: ["object", "boolean"],
|
|
7493
|
+
properties: {
|
|
7494
|
+
format: { type: "string" }
|
|
7495
|
+
}
|
|
7496
|
+
};
|
|
7497
|
+
}
|
|
7498
|
+
});
|
|
7499
|
+
|
|
7500
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json
|
|
7501
|
+
var require_meta_data = __commonJS({
|
|
7502
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json"(exports, module) {
|
|
7503
|
+
module.exports = {
|
|
7504
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
7505
|
+
$id: "https://json-schema.org/draft/2020-12/meta/meta-data",
|
|
7506
|
+
$vocabulary: {
|
|
7507
|
+
"https://json-schema.org/draft/2020-12/vocab/meta-data": true
|
|
7508
|
+
},
|
|
7509
|
+
$dynamicAnchor: "meta",
|
|
7510
|
+
title: "Meta-data vocabulary meta-schema",
|
|
7511
|
+
type: ["object", "boolean"],
|
|
7512
|
+
properties: {
|
|
7513
|
+
title: {
|
|
7514
|
+
type: "string"
|
|
7515
|
+
},
|
|
7516
|
+
description: {
|
|
7517
|
+
type: "string"
|
|
7518
|
+
},
|
|
7519
|
+
default: true,
|
|
7520
|
+
deprecated: {
|
|
7521
|
+
type: "boolean",
|
|
7522
|
+
default: false
|
|
7523
|
+
},
|
|
7524
|
+
readOnly: {
|
|
7525
|
+
type: "boolean",
|
|
7526
|
+
default: false
|
|
7527
|
+
},
|
|
7528
|
+
writeOnly: {
|
|
7529
|
+
type: "boolean",
|
|
7530
|
+
default: false
|
|
7531
|
+
},
|
|
7532
|
+
examples: {
|
|
7533
|
+
type: "array",
|
|
7534
|
+
items: true
|
|
7535
|
+
}
|
|
7536
|
+
}
|
|
7537
|
+
};
|
|
7538
|
+
}
|
|
7539
|
+
});
|
|
7540
|
+
|
|
7541
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json
|
|
7542
|
+
var require_validation2 = __commonJS({
|
|
7543
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json"(exports, module) {
|
|
7544
|
+
module.exports = {
|
|
7545
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
7546
|
+
$id: "https://json-schema.org/draft/2020-12/meta/validation",
|
|
7547
|
+
$vocabulary: {
|
|
7548
|
+
"https://json-schema.org/draft/2020-12/vocab/validation": true
|
|
7549
|
+
},
|
|
7550
|
+
$dynamicAnchor: "meta",
|
|
7551
|
+
title: "Validation vocabulary meta-schema",
|
|
7552
|
+
type: ["object", "boolean"],
|
|
7553
|
+
properties: {
|
|
7554
|
+
type: {
|
|
7555
|
+
anyOf: [
|
|
7556
|
+
{ $ref: "#/$defs/simpleTypes" },
|
|
7557
|
+
{
|
|
7558
|
+
type: "array",
|
|
7559
|
+
items: { $ref: "#/$defs/simpleTypes" },
|
|
7560
|
+
minItems: 1,
|
|
7561
|
+
uniqueItems: true
|
|
7562
|
+
}
|
|
7563
|
+
]
|
|
7564
|
+
},
|
|
7565
|
+
const: true,
|
|
7566
|
+
enum: {
|
|
7567
|
+
type: "array",
|
|
7568
|
+
items: true
|
|
7569
|
+
},
|
|
7570
|
+
multipleOf: {
|
|
7571
|
+
type: "number",
|
|
7572
|
+
exclusiveMinimum: 0
|
|
7573
|
+
},
|
|
7574
|
+
maximum: {
|
|
7575
|
+
type: "number"
|
|
7576
|
+
},
|
|
7577
|
+
exclusiveMaximum: {
|
|
7578
|
+
type: "number"
|
|
7579
|
+
},
|
|
7580
|
+
minimum: {
|
|
7581
|
+
type: "number"
|
|
7582
|
+
},
|
|
7583
|
+
exclusiveMinimum: {
|
|
7584
|
+
type: "number"
|
|
7585
|
+
},
|
|
7586
|
+
maxLength: { $ref: "#/$defs/nonNegativeInteger" },
|
|
7587
|
+
minLength: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
|
|
7588
|
+
pattern: {
|
|
7589
|
+
type: "string",
|
|
7590
|
+
format: "regex"
|
|
7591
|
+
},
|
|
7592
|
+
maxItems: { $ref: "#/$defs/nonNegativeInteger" },
|
|
7593
|
+
minItems: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
|
|
7594
|
+
uniqueItems: {
|
|
7595
|
+
type: "boolean",
|
|
7596
|
+
default: false
|
|
7597
|
+
},
|
|
7598
|
+
maxContains: { $ref: "#/$defs/nonNegativeInteger" },
|
|
7599
|
+
minContains: {
|
|
7600
|
+
$ref: "#/$defs/nonNegativeInteger",
|
|
7601
|
+
default: 1
|
|
7602
|
+
},
|
|
7603
|
+
maxProperties: { $ref: "#/$defs/nonNegativeInteger" },
|
|
7604
|
+
minProperties: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
|
|
7605
|
+
required: { $ref: "#/$defs/stringArray" },
|
|
7606
|
+
dependentRequired: {
|
|
7607
|
+
type: "object",
|
|
7608
|
+
additionalProperties: {
|
|
7609
|
+
$ref: "#/$defs/stringArray"
|
|
7610
|
+
}
|
|
7611
|
+
}
|
|
7612
|
+
},
|
|
7613
|
+
$defs: {
|
|
7614
|
+
nonNegativeInteger: {
|
|
7615
|
+
type: "integer",
|
|
7616
|
+
minimum: 0
|
|
7617
|
+
},
|
|
7618
|
+
nonNegativeIntegerDefault0: {
|
|
7619
|
+
$ref: "#/$defs/nonNegativeInteger",
|
|
7620
|
+
default: 0
|
|
7621
|
+
},
|
|
7622
|
+
simpleTypes: {
|
|
7623
|
+
enum: ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
7624
|
+
},
|
|
7625
|
+
stringArray: {
|
|
7626
|
+
type: "array",
|
|
7627
|
+
items: { type: "string" },
|
|
7628
|
+
uniqueItems: true,
|
|
7629
|
+
default: []
|
|
7630
|
+
}
|
|
7631
|
+
}
|
|
7632
|
+
};
|
|
7633
|
+
}
|
|
7634
|
+
});
|
|
7635
|
+
|
|
7636
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/index.js
|
|
7637
|
+
var require_json_schema_2020_12 = __commonJS({
|
|
7638
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/index.js"(exports) {
|
|
7639
|
+
"use strict";
|
|
7640
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7641
|
+
var metaSchema = require_schema();
|
|
7642
|
+
var applicator = require_applicator2();
|
|
7643
|
+
var unevaluated = require_unevaluated2();
|
|
7644
|
+
var content = require_content();
|
|
7645
|
+
var core = require_core3();
|
|
7646
|
+
var format = require_format_annotation();
|
|
7647
|
+
var metadata = require_meta_data();
|
|
7648
|
+
var validation = require_validation2();
|
|
7649
|
+
var META_SUPPORT_DATA = ["/properties"];
|
|
7650
|
+
function addMetaSchema2020($data) {
|
|
7651
|
+
;
|
|
7652
|
+
[
|
|
7653
|
+
metaSchema,
|
|
7654
|
+
applicator,
|
|
7655
|
+
unevaluated,
|
|
7656
|
+
content,
|
|
7657
|
+
core,
|
|
7658
|
+
with$data(this, format),
|
|
7659
|
+
metadata,
|
|
7660
|
+
with$data(this, validation)
|
|
7661
|
+
].forEach((sch) => this.addMetaSchema(sch, void 0, false));
|
|
7662
|
+
return this;
|
|
7663
|
+
function with$data(ajv, sch) {
|
|
7664
|
+
return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch;
|
|
7665
|
+
}
|
|
7666
|
+
}
|
|
7667
|
+
exports.default = addMetaSchema2020;
|
|
7668
|
+
}
|
|
7669
|
+
});
|
|
7670
|
+
|
|
7671
|
+
// node_modules/ajv/dist/2020.js
|
|
7672
|
+
var require__ = __commonJS({
|
|
7673
|
+
"node_modules/ajv/dist/2020.js"(exports, module) {
|
|
7674
|
+
"use strict";
|
|
7675
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7676
|
+
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2020 = void 0;
|
|
7677
|
+
var core_1 = require_core();
|
|
7678
|
+
var draft2020_1 = require_draft2020();
|
|
7679
|
+
var discriminator_1 = require_discriminator();
|
|
7680
|
+
var json_schema_2020_12_1 = require_json_schema_2020_12();
|
|
7681
|
+
var META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema";
|
|
7682
|
+
var Ajv2020 = class extends core_1.default {
|
|
7683
|
+
constructor(opts = {}) {
|
|
7684
|
+
super({
|
|
7685
|
+
...opts,
|
|
7686
|
+
dynamicRef: true,
|
|
7687
|
+
next: true,
|
|
7688
|
+
unevaluated: true
|
|
7689
|
+
});
|
|
7690
|
+
}
|
|
7691
|
+
_addVocabularies() {
|
|
7692
|
+
super._addVocabularies();
|
|
7693
|
+
draft2020_1.default.forEach((v) => this.addVocabulary(v));
|
|
7694
|
+
if (this.opts.discriminator)
|
|
7695
|
+
this.addKeyword(discriminator_1.default);
|
|
7696
|
+
}
|
|
7697
|
+
_addDefaultMetaSchema() {
|
|
7698
|
+
super._addDefaultMetaSchema();
|
|
7699
|
+
const { $data, meta: meta2 } = this.opts;
|
|
7700
|
+
if (!meta2)
|
|
7701
|
+
return;
|
|
7702
|
+
json_schema_2020_12_1.default.call(this, $data);
|
|
7703
|
+
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
|
7704
|
+
}
|
|
7705
|
+
defaultMeta() {
|
|
7706
|
+
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0);
|
|
7707
|
+
}
|
|
7708
|
+
};
|
|
7709
|
+
exports.Ajv2020 = Ajv2020;
|
|
7710
|
+
module.exports = exports = Ajv2020;
|
|
7711
|
+
module.exports.Ajv2020 = Ajv2020;
|
|
7712
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7713
|
+
exports.default = Ajv2020;
|
|
7714
|
+
var validate_1 = require_validate();
|
|
7715
|
+
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
|
|
7716
|
+
return validate_1.KeywordCxt;
|
|
7717
|
+
} });
|
|
7718
|
+
var codegen_1 = require_codegen();
|
|
7719
|
+
Object.defineProperty(exports, "_", { enumerable: true, get: function() {
|
|
7720
|
+
return codegen_1._;
|
|
7721
|
+
} });
|
|
7722
|
+
Object.defineProperty(exports, "str", { enumerable: true, get: function() {
|
|
7723
|
+
return codegen_1.str;
|
|
7724
|
+
} });
|
|
7725
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function() {
|
|
7726
|
+
return codegen_1.stringify;
|
|
7727
|
+
} });
|
|
7728
|
+
Object.defineProperty(exports, "nil", { enumerable: true, get: function() {
|
|
7729
|
+
return codegen_1.nil;
|
|
7730
|
+
} });
|
|
7731
|
+
Object.defineProperty(exports, "Name", { enumerable: true, get: function() {
|
|
7732
|
+
return codegen_1.Name;
|
|
7733
|
+
} });
|
|
7734
|
+
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
|
|
7735
|
+
return codegen_1.CodeGen;
|
|
7736
|
+
} });
|
|
7737
|
+
var validation_error_1 = require_validation_error();
|
|
7738
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() {
|
|
7739
|
+
return validation_error_1.default;
|
|
7740
|
+
} });
|
|
7741
|
+
var ref_error_1 = require_ref_error();
|
|
7742
|
+
Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function() {
|
|
7743
|
+
return ref_error_1.default;
|
|
7744
|
+
} });
|
|
7745
|
+
}
|
|
7746
|
+
});
|
|
7747
|
+
|
|
6924
7748
|
// node_modules/@casys/mcp-server/src/runtime/runtime.deno.ts
|
|
6925
7749
|
var runtime_deno_exports = {};
|
|
6926
7750
|
__export(runtime_deno_exports, {
|
|
@@ -9692,7 +10516,7 @@ var require_int = __commonJS({
|
|
|
9692
10516
|
});
|
|
9693
10517
|
|
|
9694
10518
|
// node_modules/yaml/dist/schema/core/schema.js
|
|
9695
|
-
var
|
|
10519
|
+
var require_schema2 = __commonJS({
|
|
9696
10520
|
"node_modules/yaml/dist/schema/core/schema.js"(exports) {
|
|
9697
10521
|
"use strict";
|
|
9698
10522
|
var map = require_map();
|
|
@@ -9720,7 +10544,7 @@ var require_schema = __commonJS({
|
|
|
9720
10544
|
});
|
|
9721
10545
|
|
|
9722
10546
|
// node_modules/yaml/dist/schema/json/schema.js
|
|
9723
|
-
var
|
|
10547
|
+
var require_schema3 = __commonJS({
|
|
9724
10548
|
"node_modules/yaml/dist/schema/json/schema.js"(exports) {
|
|
9725
10549
|
"use strict";
|
|
9726
10550
|
var Scalar = require_Scalar();
|
|
@@ -10325,9 +11149,9 @@ var require_timestamp = __commonJS({
|
|
|
10325
11149
|
const match2 = str.match(timestamp.test);
|
|
10326
11150
|
if (!match2)
|
|
10327
11151
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
10328
|
-
const [,
|
|
11152
|
+
const [, year, month, day, hour, minute, second] = match2.map(Number);
|
|
10329
11153
|
const millisec = match2[7] ? Number((match2[7] + "00").substr(1, 3)) : 0;
|
|
10330
|
-
let date3 = Date.UTC(
|
|
11154
|
+
let date3 = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
|
|
10331
11155
|
const tz = match2[8];
|
|
10332
11156
|
if (tz && tz !== "Z") {
|
|
10333
11157
|
let d = parseSexagesimal(tz, false);
|
|
@@ -10346,7 +11170,7 @@ var require_timestamp = __commonJS({
|
|
|
10346
11170
|
});
|
|
10347
11171
|
|
|
10348
11172
|
// node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
10349
|
-
var
|
|
11173
|
+
var require_schema4 = __commonJS({
|
|
10350
11174
|
"node_modules/yaml/dist/schema/yaml-1.1/schema.js"(exports) {
|
|
10351
11175
|
"use strict";
|
|
10352
11176
|
var map = require_map();
|
|
@@ -10400,13 +11224,13 @@ var require_tags = __commonJS({
|
|
|
10400
11224
|
var bool = require_bool();
|
|
10401
11225
|
var float = require_float();
|
|
10402
11226
|
var int2 = require_int();
|
|
10403
|
-
var schema =
|
|
10404
|
-
var schema$1 =
|
|
11227
|
+
var schema = require_schema2();
|
|
11228
|
+
var schema$1 = require_schema3();
|
|
10405
11229
|
var binary = require_binary();
|
|
10406
11230
|
var merge2 = require_merge();
|
|
10407
11231
|
var omap = require_omap();
|
|
10408
11232
|
var pairs = require_pairs();
|
|
10409
|
-
var schema$2 =
|
|
11233
|
+
var schema$2 = require_schema4();
|
|
10410
11234
|
var set = require_set();
|
|
10411
11235
|
var timestamp = require_timestamp();
|
|
10412
11236
|
var schemas = /* @__PURE__ */ new Map([
|
|
@@ -12539,15 +13363,15 @@ var require_cst_scalar = __commonJS({
|
|
|
12539
13363
|
}
|
|
12540
13364
|
return null;
|
|
12541
13365
|
}
|
|
12542
|
-
function createScalarToken(value,
|
|
12543
|
-
const { implicitKey = false, indent, inFlow = false, offset = -1, type = "PLAIN" } =
|
|
13366
|
+
function createScalarToken(value, context2) {
|
|
13367
|
+
const { implicitKey = false, indent, inFlow = false, offset = -1, type = "PLAIN" } = context2;
|
|
12544
13368
|
const source = stringifyString.stringifyString({ type, value }, {
|
|
12545
13369
|
implicitKey,
|
|
12546
13370
|
indent: indent > 0 ? " ".repeat(indent) : "",
|
|
12547
13371
|
inFlow,
|
|
12548
13372
|
options: { blockQuote: true, lineWidth: -1 }
|
|
12549
13373
|
});
|
|
12550
|
-
const end =
|
|
13374
|
+
const end = context2.end ?? [
|
|
12551
13375
|
{ type: "newline", offset: -1, indent, source: "\n" }
|
|
12552
13376
|
];
|
|
12553
13377
|
switch (source[0]) {
|
|
@@ -12571,8 +13395,8 @@ var require_cst_scalar = __commonJS({
|
|
|
12571
13395
|
return { type: "scalar", offset, indent, source, end };
|
|
12572
13396
|
}
|
|
12573
13397
|
}
|
|
12574
|
-
function setScalarValue(token, value,
|
|
12575
|
-
let { afterKey = false, implicitKey = false, inFlow = false, type } =
|
|
13398
|
+
function setScalarValue(token, value, context2 = {}) {
|
|
13399
|
+
let { afterKey = false, implicitKey = false, inFlow = false, type } = context2;
|
|
12576
13400
|
let indent = "indent" in token ? token.indent : null;
|
|
12577
13401
|
if (afterKey && typeof indent === "number")
|
|
12578
13402
|
indent += 2;
|
|
@@ -29659,7 +30483,7 @@ var StdioServerTransport = class {
|
|
|
29659
30483
|
|
|
29660
30484
|
// node_modules/hono/dist/compose.js
|
|
29661
30485
|
var compose = (middleware, onError, onNotFound) => {
|
|
29662
|
-
return (
|
|
30486
|
+
return (context2, next) => {
|
|
29663
30487
|
let index = -1;
|
|
29664
30488
|
return dispatch(0);
|
|
29665
30489
|
async function dispatch(i) {
|
|
@@ -29672,31 +30496,31 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
29672
30496
|
let handler;
|
|
29673
30497
|
if (middleware[i]) {
|
|
29674
30498
|
handler = middleware[i][0][0];
|
|
29675
|
-
|
|
30499
|
+
context2.req.routeIndex = i;
|
|
29676
30500
|
} else {
|
|
29677
30501
|
handler = i === middleware.length && next || void 0;
|
|
29678
30502
|
}
|
|
29679
30503
|
if (handler) {
|
|
29680
30504
|
try {
|
|
29681
|
-
res = await handler(
|
|
30505
|
+
res = await handler(context2, () => dispatch(i + 1));
|
|
29682
30506
|
} catch (err) {
|
|
29683
30507
|
if (err instanceof Error && onError) {
|
|
29684
|
-
|
|
29685
|
-
res = await onError(err,
|
|
30508
|
+
context2.error = err;
|
|
30509
|
+
res = await onError(err, context2);
|
|
29686
30510
|
isError = true;
|
|
29687
30511
|
} else {
|
|
29688
30512
|
throw err;
|
|
29689
30513
|
}
|
|
29690
30514
|
}
|
|
29691
30515
|
} else {
|
|
29692
|
-
if (
|
|
29693
|
-
res = await onNotFound(
|
|
30516
|
+
if (context2.finalized === false && onNotFound) {
|
|
30517
|
+
res = await onNotFound(context2);
|
|
29694
30518
|
}
|
|
29695
30519
|
}
|
|
29696
|
-
if (res && (
|
|
29697
|
-
|
|
30520
|
+
if (res && (context2.finalized === false || isError)) {
|
|
30521
|
+
context2.res = res;
|
|
29698
30522
|
}
|
|
29699
|
-
return
|
|
30523
|
+
return context2;
|
|
29700
30524
|
}
|
|
29701
30525
|
};
|
|
29702
30526
|
};
|
|
@@ -29923,18 +30747,16 @@ var checkOptionalParameter = (path) => {
|
|
|
29923
30747
|
});
|
|
29924
30748
|
return results.filter((v, i, a) => a.indexOf(v) === i);
|
|
29925
30749
|
};
|
|
30750
|
+
var tryDecodeURIComponent = (str) => str.indexOf("%") !== -1 ? tryDecode(str, decodeURIComponent_) : str;
|
|
29926
30751
|
var _decodeURI = (value) => {
|
|
29927
|
-
if (!/[%+]/.test(value)) {
|
|
29928
|
-
return value;
|
|
29929
|
-
}
|
|
29930
30752
|
if (value.indexOf("+") !== -1) {
|
|
29931
30753
|
value = value.replace(/\+/g, " ");
|
|
29932
30754
|
}
|
|
29933
|
-
return
|
|
30755
|
+
return tryDecodeURIComponent(value);
|
|
29934
30756
|
};
|
|
29935
30757
|
var _getQueryParam = (url, key, multiple) => {
|
|
29936
30758
|
let encoded;
|
|
29937
|
-
if (!multiple && key &&
|
|
30759
|
+
if (!multiple && key && key.indexOf("%") === -1 && key.indexOf("+") === -1) {
|
|
29938
30760
|
let keyIndex2 = url.indexOf("?", 8);
|
|
29939
30761
|
if (keyIndex2 === -1) {
|
|
29940
30762
|
return void 0;
|
|
@@ -30006,7 +30828,6 @@ var getQueryParams = (url, key) => {
|
|
|
30006
30828
|
var decodeURIComponent_ = decodeURIComponent;
|
|
30007
30829
|
|
|
30008
30830
|
// node_modules/hono/dist/request.js
|
|
30009
|
-
var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
|
|
30010
30831
|
var HonoRequest = class {
|
|
30011
30832
|
/**
|
|
30012
30833
|
* `.raw` can get the raw Request object.
|
|
@@ -30045,7 +30866,6 @@ var HonoRequest = class {
|
|
|
30045
30866
|
this.raw = request;
|
|
30046
30867
|
this.path = path;
|
|
30047
30868
|
this.#matchResult = matchResult;
|
|
30048
|
-
this.#validatedData = {};
|
|
30049
30869
|
}
|
|
30050
30870
|
param(key) {
|
|
30051
30871
|
return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();
|
|
@@ -30053,7 +30873,7 @@ var HonoRequest = class {
|
|
|
30053
30873
|
#getDecodedParam(key) {
|
|
30054
30874
|
const paramKey = this.#matchResult[0][this.routeIndex][1][key];
|
|
30055
30875
|
const param = this.#getParamValue(paramKey);
|
|
30056
|
-
return param &&
|
|
30876
|
+
return param && tryDecodeURIComponent(param);
|
|
30057
30877
|
}
|
|
30058
30878
|
#getAllDecodedParams() {
|
|
30059
30879
|
const decoded = {};
|
|
@@ -30061,7 +30881,7 @@ var HonoRequest = class {
|
|
|
30061
30881
|
for (const key of keys) {
|
|
30062
30882
|
const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
|
|
30063
30883
|
if (value !== void 0) {
|
|
30064
|
-
decoded[key] =
|
|
30884
|
+
decoded[key] = tryDecodeURIComponent(value);
|
|
30065
30885
|
}
|
|
30066
30886
|
}
|
|
30067
30887
|
return decoded;
|
|
@@ -30094,8 +30914,7 @@ var HonoRequest = class {
|
|
|
30094
30914
|
if (cachedBody) {
|
|
30095
30915
|
return cachedBody;
|
|
30096
30916
|
}
|
|
30097
|
-
const anyCachedKey
|
|
30098
|
-
if (anyCachedKey) {
|
|
30917
|
+
for (const anyCachedKey in bodyCache) {
|
|
30099
30918
|
return bodyCache[anyCachedKey].then((body) => {
|
|
30100
30919
|
if (anyCachedKey === "json") {
|
|
30101
30920
|
body = JSON.stringify(body);
|
|
@@ -30198,10 +31017,11 @@ var HonoRequest = class {
|
|
|
30198
31017
|
* @param data - The validated data to add.
|
|
30199
31018
|
*/
|
|
30200
31019
|
addValidatedData(target, data) {
|
|
30201
|
-
|
|
31020
|
+
;
|
|
31021
|
+
(this.#validatedData ??= {})[target] = data;
|
|
30202
31022
|
}
|
|
30203
31023
|
valid(target) {
|
|
30204
|
-
return this.#validatedData[target];
|
|
31024
|
+
return this.#validatedData?.[target];
|
|
30205
31025
|
}
|
|
30206
31026
|
/**
|
|
30207
31027
|
* `.url()` can get the request url strings.
|
|
@@ -30300,7 +31120,7 @@ var raw = (value, callbacks) => {
|
|
|
30300
31120
|
escapedString.callbacks = callbacks;
|
|
30301
31121
|
return escapedString;
|
|
30302
31122
|
};
|
|
30303
|
-
var resolveCallback = async (str, phase, preserveCallbacks,
|
|
31123
|
+
var resolveCallback = async (str, phase, preserveCallbacks, context2, buffer) => {
|
|
30304
31124
|
if (typeof str === "object" && !(str instanceof String)) {
|
|
30305
31125
|
if (!(str instanceof Promise)) {
|
|
30306
31126
|
str = str.toString();
|
|
@@ -30318,9 +31138,9 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
30318
31138
|
} else {
|
|
30319
31139
|
buffer = [str];
|
|
30320
31140
|
}
|
|
30321
|
-
const resStr = Promise.all(callbacks.map((c) => c({ phase, buffer, context }))).then(
|
|
31141
|
+
const resStr = Promise.all(callbacks.map((c) => c({ phase, buffer, context: context2 }))).then(
|
|
30322
31142
|
(res) => Promise.all(
|
|
30323
|
-
res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false,
|
|
31143
|
+
res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context2, buffer))
|
|
30324
31144
|
).then(() => buffer[0])
|
|
30325
31145
|
);
|
|
30326
31146
|
if (preserveCallbacks) {
|
|
@@ -30603,11 +31423,11 @@ var Context = class {
|
|
|
30603
31423
|
return Object.fromEntries(this.#var);
|
|
30604
31424
|
}
|
|
30605
31425
|
#newResponse(data, arg, headers) {
|
|
30606
|
-
|
|
30607
|
-
if (typeof arg === "object" &&
|
|
30608
|
-
|
|
30609
|
-
for (const [key, value] of
|
|
30610
|
-
if (key
|
|
31426
|
+
let responseHeaders = this.#res ? new Headers(this.#res.headers) : this.#preparedHeaders;
|
|
31427
|
+
if (typeof arg === "object" && arg.headers) {
|
|
31428
|
+
responseHeaders ??= new Headers();
|
|
31429
|
+
for (const [key, value] of new Headers(arg.headers)) {
|
|
31430
|
+
if (key === "set-cookie") {
|
|
30611
31431
|
responseHeaders.append(key, value);
|
|
30612
31432
|
} else {
|
|
30613
31433
|
responseHeaders.set(key, value);
|
|
@@ -30615,19 +31435,34 @@ var Context = class {
|
|
|
30615
31435
|
}
|
|
30616
31436
|
}
|
|
30617
31437
|
if (headers) {
|
|
30618
|
-
|
|
30619
|
-
|
|
30620
|
-
|
|
30621
|
-
|
|
30622
|
-
|
|
30623
|
-
|
|
30624
|
-
|
|
31438
|
+
if (!responseHeaders) {
|
|
31439
|
+
let count = 0;
|
|
31440
|
+
for (const k in headers) {
|
|
31441
|
+
if (++count > 1 || typeof headers[k] !== "string") {
|
|
31442
|
+
responseHeaders = new Headers();
|
|
31443
|
+
break;
|
|
31444
|
+
}
|
|
31445
|
+
}
|
|
31446
|
+
}
|
|
31447
|
+
if (responseHeaders) {
|
|
31448
|
+
for (const k in headers) {
|
|
31449
|
+
const v = headers[k];
|
|
31450
|
+
if (typeof v === "string") {
|
|
31451
|
+
responseHeaders.set(k, v);
|
|
31452
|
+
} else {
|
|
31453
|
+
responseHeaders.delete(k);
|
|
31454
|
+
for (const v2 of v) {
|
|
31455
|
+
responseHeaders.append(k, v2);
|
|
31456
|
+
}
|
|
30625
31457
|
}
|
|
30626
31458
|
}
|
|
30627
31459
|
}
|
|
30628
31460
|
}
|
|
30629
31461
|
const status = typeof arg === "number" ? arg : arg?.status ?? this.#status;
|
|
30630
|
-
return createResponseInstance(data, {
|
|
31462
|
+
return createResponseInstance(data, {
|
|
31463
|
+
status,
|
|
31464
|
+
headers: responseHeaders ?? headers
|
|
31465
|
+
});
|
|
30631
31466
|
}
|
|
30632
31467
|
newResponse = (...args) => this.#newResponse(...args);
|
|
30633
31468
|
/**
|
|
@@ -30740,7 +31575,7 @@ var Context = class {
|
|
|
30740
31575
|
// node_modules/hono/dist/router.js
|
|
30741
31576
|
var METHOD_NAME_ALL = "ALL";
|
|
30742
31577
|
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
30743
|
-
var METHODS = ["get", "post", "put", "delete", "options", "patch"];
|
|
31578
|
+
var METHODS = ["get", "post", "put", "delete", "options", "patch", "query"];
|
|
30744
31579
|
var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
|
|
30745
31580
|
var UnsupportedPathError = class extends Error {
|
|
30746
31581
|
};
|
|
@@ -30767,6 +31602,7 @@ var Hono = class _Hono {
|
|
|
30767
31602
|
delete;
|
|
30768
31603
|
options;
|
|
30769
31604
|
patch;
|
|
31605
|
+
query;
|
|
30770
31606
|
all;
|
|
30771
31607
|
on;
|
|
30772
31608
|
use;
|
|
@@ -31048,13 +31884,13 @@ var Hono = class _Hono {
|
|
|
31048
31884
|
const composed = compose(matchResult[0], this.errorHandler, this.#notFoundHandler);
|
|
31049
31885
|
return (async () => {
|
|
31050
31886
|
try {
|
|
31051
|
-
const
|
|
31052
|
-
if (!
|
|
31887
|
+
const context2 = await composed(c);
|
|
31888
|
+
if (!context2.finalized) {
|
|
31053
31889
|
throw new Error(
|
|
31054
31890
|
"Context is not finalized. Did you forget to return a Response object or `await next()`?"
|
|
31055
31891
|
);
|
|
31056
31892
|
}
|
|
31057
|
-
return
|
|
31893
|
+
return context2.res;
|
|
31058
31894
|
} catch (err) {
|
|
31059
31895
|
return this.#handleError(err, c);
|
|
31060
31896
|
}
|
|
@@ -31066,8 +31902,8 @@ var Hono = class _Hono {
|
|
|
31066
31902
|
* @see {@link https://hono.dev/docs/api/hono#fetch}
|
|
31067
31903
|
*
|
|
31068
31904
|
* @param {Request} request - request Object of request
|
|
31069
|
-
* @param {Env}
|
|
31070
|
-
* @param {ExecutionContext} - context of execution
|
|
31905
|
+
* @param {Env} env - env Object
|
|
31906
|
+
* @param {ExecutionContext} executionCtx - context of execution
|
|
31071
31907
|
* @returns {Response | Promise<Response>} response of request
|
|
31072
31908
|
*
|
|
31073
31909
|
*/
|
|
@@ -31159,7 +31995,7 @@ function compareKey(a, b) {
|
|
|
31159
31995
|
return 1;
|
|
31160
31996
|
}
|
|
31161
31997
|
if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) {
|
|
31162
|
-
return 1;
|
|
31998
|
+
return b === TAIL_WILDCARD_REG_EXP_STR ? -1 : 1;
|
|
31163
31999
|
} else if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) {
|
|
31164
32000
|
return -1;
|
|
31165
32001
|
}
|
|
@@ -31171,76 +32007,75 @@ function compareKey(a, b) {
|
|
|
31171
32007
|
return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;
|
|
31172
32008
|
}
|
|
31173
32009
|
var Node = class _Node {
|
|
32010
|
+
// handler index of a dynamic path, or -1 for a static path terminal
|
|
31174
32011
|
#index;
|
|
31175
32012
|
#varIndex;
|
|
31176
32013
|
#children = /* @__PURE__ */ Object.create(null);
|
|
31177
|
-
insert(tokens, index, paramMap,
|
|
31178
|
-
|
|
31179
|
-
|
|
31180
|
-
|
|
31181
|
-
}
|
|
31182
|
-
|
|
31183
|
-
|
|
31184
|
-
|
|
31185
|
-
|
|
31186
|
-
|
|
31187
|
-
|
|
31188
|
-
|
|
31189
|
-
|
|
31190
|
-
|
|
31191
|
-
|
|
31192
|
-
|
|
31193
|
-
|
|
31194
|
-
|
|
31195
|
-
|
|
31196
|
-
|
|
31197
|
-
}
|
|
31198
|
-
|
|
31199
|
-
if (
|
|
31200
|
-
|
|
31201
|
-
|
|
31202
|
-
|
|
31203
|
-
|
|
31204
|
-
|
|
31205
|
-
|
|
31206
|
-
|
|
31207
|
-
|
|
31208
|
-
|
|
31209
|
-
|
|
31210
|
-
|
|
31211
|
-
return;
|
|
32014
|
+
insert(tokens, index, paramMap, context2, isStatic) {
|
|
32015
|
+
let node = this;
|
|
32016
|
+
for (let i = 0, len = tokens.length; i < len; i++) {
|
|
32017
|
+
const token = tokens[i];
|
|
32018
|
+
const pattern = token.length === 1 ? token === "*" ? i === len - 1 ? ["", "", ONLY_WILDCARD_REG_EXP_STR] : ["", "", LABEL_REG_EXP_STR] : null : token === "/*" ? ["", "", TAIL_WILDCARD_REG_EXP_STR] : token.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
|
|
32019
|
+
let nextNode;
|
|
32020
|
+
if (pattern) {
|
|
32021
|
+
const name = pattern[1];
|
|
32022
|
+
let regexpStr = pattern[2] || LABEL_REG_EXP_STR;
|
|
32023
|
+
if (name && pattern[2]) {
|
|
32024
|
+
if (regexpStr === ".*") {
|
|
32025
|
+
throw PATH_ERROR;
|
|
32026
|
+
}
|
|
32027
|
+
regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:");
|
|
32028
|
+
if (/\((?!\?:)/.test(regexpStr)) {
|
|
32029
|
+
throw PATH_ERROR;
|
|
32030
|
+
}
|
|
32031
|
+
if (regexpStr.length === 1 && regExpMetaChars.has(regexpStr)) {
|
|
32032
|
+
throw PATH_ERROR;
|
|
32033
|
+
}
|
|
32034
|
+
}
|
|
32035
|
+
nextNode = node.#children[regexpStr];
|
|
32036
|
+
if (!nextNode) {
|
|
32037
|
+
if (regexpStr !== ONLY_WILDCARD_REG_EXP_STR && regexpStr !== TAIL_WILDCARD_REG_EXP_STR) {
|
|
32038
|
+
for (const k in node.#children) {
|
|
32039
|
+
if (
|
|
32040
|
+
// a single-char pattern coexists with single-char literals as a literal does
|
|
32041
|
+
(regexpStr.length > 1 || k.length > 1) && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR
|
|
32042
|
+
) {
|
|
32043
|
+
throw PATH_ERROR;
|
|
32044
|
+
}
|
|
32045
|
+
}
|
|
32046
|
+
}
|
|
32047
|
+
nextNode = node.#children[regexpStr] = new _Node();
|
|
31212
32048
|
}
|
|
31213
|
-
node = this.#children[regexpStr] = new _Node();
|
|
31214
32049
|
if (name !== "") {
|
|
31215
|
-
|
|
32050
|
+
nextNode.#varIndex ??= context2.varIndex++;
|
|
32051
|
+
paramMap.push([name, nextNode.#varIndex]);
|
|
31216
32052
|
}
|
|
31217
|
-
}
|
|
31218
|
-
|
|
31219
|
-
|
|
31220
|
-
|
|
31221
|
-
|
|
31222
|
-
|
|
31223
|
-
|
|
31224
|
-
|
|
31225
|
-
|
|
31226
|
-
)) {
|
|
31227
|
-
throw PATH_ERROR;
|
|
31228
|
-
}
|
|
31229
|
-
if (pathErrorCheckOnly) {
|
|
31230
|
-
return;
|
|
32053
|
+
} else {
|
|
32054
|
+
nextNode = node.#children[token];
|
|
32055
|
+
if (!nextNode) {
|
|
32056
|
+
for (const k in node.#children) {
|
|
32057
|
+
if (k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR) {
|
|
32058
|
+
throw PATH_ERROR;
|
|
32059
|
+
}
|
|
32060
|
+
}
|
|
32061
|
+
nextNode = node.#children[token] = new _Node();
|
|
31231
32062
|
}
|
|
31232
|
-
node = this.#children[token] = new _Node();
|
|
31233
32063
|
}
|
|
32064
|
+
node = nextNode;
|
|
32065
|
+
}
|
|
32066
|
+
if (node.#index !== void 0) {
|
|
32067
|
+
throw PATH_ERROR;
|
|
31234
32068
|
}
|
|
31235
|
-
node
|
|
32069
|
+
node.#index = isStatic ? -1 : index;
|
|
31236
32070
|
}
|
|
31237
32071
|
buildRegExpStr() {
|
|
31238
32072
|
const childKeys = Object.keys(this.#children).sort(compareKey);
|
|
31239
32073
|
const strList = childKeys.map((k) => {
|
|
31240
32074
|
const c = this.#children[k];
|
|
31241
|
-
|
|
31242
|
-
|
|
31243
|
-
|
|
32075
|
+
const childStr = c.buildRegExpStr();
|
|
32076
|
+
return childStr === "" ? "" : (typeof c.#varIndex === "number" ? `(${k})@${c.#varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + childStr;
|
|
32077
|
+
}).filter(Boolean);
|
|
32078
|
+
if (typeof this.#index === "number" && this.#index !== -1) {
|
|
31244
32079
|
strList.unshift(`#${this.#index}`);
|
|
31245
32080
|
}
|
|
31246
32081
|
if (strList.length === 0) {
|
|
@@ -31257,12 +32092,20 @@ var Node = class _Node {
|
|
|
31257
32092
|
var Trie = class {
|
|
31258
32093
|
#context = { varIndex: 0 };
|
|
31259
32094
|
#root = new Node();
|
|
31260
|
-
|
|
32095
|
+
#index = 0;
|
|
32096
|
+
// dynamic path -> [handler index, param assoc]; static paths are not registered
|
|
32097
|
+
paths = /* @__PURE__ */ Object.create(null);
|
|
32098
|
+
insert(path, isStatic) {
|
|
32099
|
+
if (isStatic) {
|
|
32100
|
+
this.#root.insert(path.split(""), 0, [], this.#context, true);
|
|
32101
|
+
return;
|
|
32102
|
+
}
|
|
31261
32103
|
const paramAssoc = [];
|
|
31262
32104
|
const groups = [];
|
|
32105
|
+
let markedPath = path;
|
|
31263
32106
|
for (let i = 0; ; ) {
|
|
31264
32107
|
let replaced = false;
|
|
31265
|
-
|
|
32108
|
+
markedPath = markedPath.replace(/\{[^}]+\}/g, (m) => {
|
|
31266
32109
|
const mark = `@\\${i}`;
|
|
31267
32110
|
groups[i] = [mark, m];
|
|
31268
32111
|
i++;
|
|
@@ -31273,7 +32116,7 @@ var Trie = class {
|
|
|
31273
32116
|
break;
|
|
31274
32117
|
}
|
|
31275
32118
|
}
|
|
31276
|
-
const tokens =
|
|
32119
|
+
const tokens = markedPath.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
|
|
31277
32120
|
for (let i = groups.length - 1; i >= 0; i--) {
|
|
31278
32121
|
const [mark] = groups[i];
|
|
31279
32122
|
for (let j = tokens.length - 1; j >= 0; j--) {
|
|
@@ -31283,8 +32126,8 @@ var Trie = class {
|
|
|
31283
32126
|
}
|
|
31284
32127
|
}
|
|
31285
32128
|
}
|
|
31286
|
-
this.#root.insert(tokens, index, paramAssoc, this.#context,
|
|
31287
|
-
|
|
32129
|
+
this.#root.insert(tokens, this.#index, paramAssoc, this.#context, false);
|
|
32130
|
+
this.paths[path] = [this.#index++, paramAssoc];
|
|
31288
32131
|
}
|
|
31289
32132
|
buildRegExp() {
|
|
31290
32133
|
let regexp = this.#root.buildRegExpStr();
|
|
@@ -31310,7 +32153,6 @@ var Trie = class {
|
|
|
31310
32153
|
};
|
|
31311
32154
|
|
|
31312
32155
|
// node_modules/hono/dist/router/reg-exp-router/router.js
|
|
31313
|
-
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
31314
32156
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
31315
32157
|
function buildWildcardRegExp(path) {
|
|
31316
32158
|
return wildcardRegExpCache[path] ??= new RegExp(
|
|
@@ -31323,63 +32165,6 @@ function buildWildcardRegExp(path) {
|
|
|
31323
32165
|
function clearWildcardRegExpCache() {
|
|
31324
32166
|
wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
31325
32167
|
}
|
|
31326
|
-
function buildMatcherFromPreprocessedRoutes(routes) {
|
|
31327
|
-
const trie = new Trie();
|
|
31328
|
-
const handlerData = [];
|
|
31329
|
-
if (routes.length === 0) {
|
|
31330
|
-
return nullMatcher;
|
|
31331
|
-
}
|
|
31332
|
-
const routesWithStaticPathFlag = routes.map(
|
|
31333
|
-
(route) => [!/\*|\/:/.test(route[0]), ...route]
|
|
31334
|
-
).sort(
|
|
31335
|
-
([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length
|
|
31336
|
-
);
|
|
31337
|
-
const staticMap = /* @__PURE__ */ Object.create(null);
|
|
31338
|
-
for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
|
|
31339
|
-
const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i];
|
|
31340
|
-
if (pathErrorCheckOnly) {
|
|
31341
|
-
staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
|
|
31342
|
-
} else {
|
|
31343
|
-
j++;
|
|
31344
|
-
}
|
|
31345
|
-
let paramAssoc;
|
|
31346
|
-
try {
|
|
31347
|
-
paramAssoc = trie.insert(path, j, pathErrorCheckOnly);
|
|
31348
|
-
} catch (e) {
|
|
31349
|
-
throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;
|
|
31350
|
-
}
|
|
31351
|
-
if (pathErrorCheckOnly) {
|
|
31352
|
-
continue;
|
|
31353
|
-
}
|
|
31354
|
-
handlerData[j] = handlers.map(([h, paramCount]) => {
|
|
31355
|
-
const paramIndexMap = /* @__PURE__ */ Object.create(null);
|
|
31356
|
-
paramCount -= 1;
|
|
31357
|
-
for (; paramCount >= 0; paramCount--) {
|
|
31358
|
-
const [key, value] = paramAssoc[paramCount];
|
|
31359
|
-
paramIndexMap[key] = value;
|
|
31360
|
-
}
|
|
31361
|
-
return [h, paramIndexMap];
|
|
31362
|
-
});
|
|
31363
|
-
}
|
|
31364
|
-
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
31365
|
-
for (let i = 0, len = handlerData.length; i < len; i++) {
|
|
31366
|
-
for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
|
|
31367
|
-
const map = handlerData[i][j]?.[1];
|
|
31368
|
-
if (!map) {
|
|
31369
|
-
continue;
|
|
31370
|
-
}
|
|
31371
|
-
const keys = Object.keys(map);
|
|
31372
|
-
for (let k = 0, len3 = keys.length; k < len3; k++) {
|
|
31373
|
-
map[keys[k]] = paramReplacementMap[map[keys[k]]];
|
|
31374
|
-
}
|
|
31375
|
-
}
|
|
31376
|
-
}
|
|
31377
|
-
const handlerMap = [];
|
|
31378
|
-
for (const i in indexReplacementMap) {
|
|
31379
|
-
handlerMap[i] = handlerData[indexReplacementMap[i]];
|
|
31380
|
-
}
|
|
31381
|
-
return [regexp, handlerMap, staticMap];
|
|
31382
|
-
}
|
|
31383
32168
|
function findMiddleware(middleware, path) {
|
|
31384
32169
|
if (!middleware) {
|
|
31385
32170
|
return void 0;
|
|
@@ -31395,9 +32180,18 @@ var RegExpRouter = class {
|
|
|
31395
32180
|
name = "RegExpRouter";
|
|
31396
32181
|
#middleware;
|
|
31397
32182
|
#routes;
|
|
32183
|
+
#tries;
|
|
31398
32184
|
constructor() {
|
|
31399
32185
|
this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
31400
32186
|
this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
32187
|
+
this.#tries = { [METHOD_NAME_ALL]: new Trie() };
|
|
32188
|
+
}
|
|
32189
|
+
#insertPath(method, path) {
|
|
32190
|
+
try {
|
|
32191
|
+
this.#tries[method].insert(path, !/\*|\/:/.test(path));
|
|
32192
|
+
} catch (e) {
|
|
32193
|
+
throw e === PATH_ERROR ? new UnsupportedPathError(path) : e;
|
|
32194
|
+
}
|
|
31401
32195
|
}
|
|
31402
32196
|
add(method, path, handler) {
|
|
31403
32197
|
const middleware = this.#middleware;
|
|
@@ -31406,11 +32200,12 @@ var RegExpRouter = class {
|
|
|
31406
32200
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
31407
32201
|
}
|
|
31408
32202
|
if (!middleware[method]) {
|
|
31409
|
-
;
|
|
32203
|
+
this.#tries[method] = new Trie();
|
|
31410
32204
|
[middleware, routes].forEach((handlerMap) => {
|
|
31411
32205
|
handlerMap[method] = /* @__PURE__ */ Object.create(null);
|
|
31412
32206
|
Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p) => {
|
|
31413
32207
|
handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];
|
|
32208
|
+
this.#insertPath(method, p);
|
|
31414
32209
|
});
|
|
31415
32210
|
});
|
|
31416
32211
|
}
|
|
@@ -31420,13 +32215,12 @@ var RegExpRouter = class {
|
|
|
31420
32215
|
const paramCount = (path.match(/\/:/g) || []).length;
|
|
31421
32216
|
if (/\*$/.test(path)) {
|
|
31422
32217
|
const re2 = buildWildcardRegExp(path);
|
|
31423
|
-
|
|
31424
|
-
|
|
31425
|
-
|
|
31426
|
-
|
|
31427
|
-
|
|
31428
|
-
|
|
31429
|
-
}
|
|
32218
|
+
Object.keys(middleware).forEach((m) => {
|
|
32219
|
+
if ((method === METHOD_NAME_ALL || method === m) && !middleware[m][path]) {
|
|
32220
|
+
this.#insertPath(m, path);
|
|
32221
|
+
middleware[m][path] = findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
|
|
32222
|
+
}
|
|
32223
|
+
});
|
|
31430
32224
|
Object.keys(middleware).forEach((m) => {
|
|
31431
32225
|
if (method === METHOD_NAME_ALL || method === m) {
|
|
31432
32226
|
Object.keys(middleware[m]).forEach((p) => {
|
|
@@ -31448,9 +32242,12 @@ var RegExpRouter = class {
|
|
|
31448
32242
|
const path2 = paths[i];
|
|
31449
32243
|
Object.keys(routes).forEach((m) => {
|
|
31450
32244
|
if (method === METHOD_NAME_ALL || method === m) {
|
|
31451
|
-
routes[m][path2]
|
|
31452
|
-
|
|
31453
|
-
|
|
32245
|
+
if (!routes[m][path2]) {
|
|
32246
|
+
this.#insertPath(m, path2);
|
|
32247
|
+
routes[m][path2] = [
|
|
32248
|
+
...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []
|
|
32249
|
+
];
|
|
32250
|
+
}
|
|
31454
32251
|
routes[m][path2].push([handler, paramCount - len + i + 1]);
|
|
31455
32252
|
}
|
|
31456
32253
|
});
|
|
@@ -31462,29 +32259,54 @@ var RegExpRouter = class {
|
|
|
31462
32259
|
Object.keys(this.#routes).concat(Object.keys(this.#middleware)).forEach((method) => {
|
|
31463
32260
|
matchers[method] ||= this.#buildMatcher(method);
|
|
31464
32261
|
});
|
|
31465
|
-
this.#middleware = this.#routes = void 0;
|
|
32262
|
+
this.#middleware = this.#routes = this.#tries = void 0;
|
|
31466
32263
|
clearWildcardRegExpCache();
|
|
31467
32264
|
return matchers;
|
|
31468
32265
|
}
|
|
31469
32266
|
#buildMatcher(method) {
|
|
31470
|
-
const
|
|
31471
|
-
|
|
31472
|
-
|
|
31473
|
-
|
|
31474
|
-
|
|
31475
|
-
|
|
31476
|
-
|
|
31477
|
-
|
|
31478
|
-
|
|
31479
|
-
|
|
31480
|
-
|
|
32267
|
+
const middleware = this.#middleware[method];
|
|
32268
|
+
const routes = this.#routes[method];
|
|
32269
|
+
const trie = this.#tries[method];
|
|
32270
|
+
const staticMap = /* @__PURE__ */ Object.create(null);
|
|
32271
|
+
const handlerData = [];
|
|
32272
|
+
[middleware, routes].forEach((r) => {
|
|
32273
|
+
for (const path in r) {
|
|
32274
|
+
const handlers = r[path];
|
|
32275
|
+
const pathData = trie.paths[path];
|
|
32276
|
+
if (!pathData) {
|
|
32277
|
+
staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
|
|
32278
|
+
continue;
|
|
32279
|
+
}
|
|
32280
|
+
const paramAssoc = pathData[1];
|
|
32281
|
+
handlerData[pathData[0]] = handlers.map(([h, paramCount]) => {
|
|
32282
|
+
const paramIndexMap = /* @__PURE__ */ Object.create(null);
|
|
32283
|
+
paramCount -= 1;
|
|
32284
|
+
for (; paramCount >= 0; paramCount--) {
|
|
32285
|
+
const [key, value] = paramAssoc[paramCount];
|
|
32286
|
+
paramIndexMap[key] = value;
|
|
32287
|
+
}
|
|
32288
|
+
return [h, paramIndexMap];
|
|
32289
|
+
});
|
|
31481
32290
|
}
|
|
31482
32291
|
});
|
|
31483
|
-
|
|
31484
|
-
|
|
31485
|
-
|
|
31486
|
-
|
|
32292
|
+
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
32293
|
+
for (let i = 0, len = handlerData.length; i < len; i++) {
|
|
32294
|
+
for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
|
|
32295
|
+
const map = handlerData[i][j]?.[1];
|
|
32296
|
+
if (!map) {
|
|
32297
|
+
continue;
|
|
32298
|
+
}
|
|
32299
|
+
const keys = Object.keys(map);
|
|
32300
|
+
for (let k = 0, len3 = keys.length; k < len3; k++) {
|
|
32301
|
+
map[keys[k]] = paramReplacementMap[map[keys[k]]];
|
|
32302
|
+
}
|
|
32303
|
+
}
|
|
32304
|
+
}
|
|
32305
|
+
const handlerMap = [];
|
|
32306
|
+
for (const i in indexReplacementMap) {
|
|
32307
|
+
handlerMap[i] = handlerData[indexReplacementMap[i]];
|
|
31487
32308
|
}
|
|
32309
|
+
return [regexp, handlerMap, staticMap];
|
|
31488
32310
|
}
|
|
31489
32311
|
};
|
|
31490
32312
|
|
|
@@ -31688,7 +32510,7 @@ var Node2 = class _Node2 {
|
|
|
31688
32510
|
}
|
|
31689
32511
|
if (hasChildren(child.#children)) {
|
|
31690
32512
|
child.#params = params;
|
|
31691
|
-
const componentCount = m[0].match(/\//)?.length ?? 0;
|
|
32513
|
+
const componentCount = m[0].match(/\//g)?.length ?? 0;
|
|
31692
32514
|
const targetCurNodes = curNodesQueue[componentCount] ||= [];
|
|
31693
32515
|
targetCurNodes.push(child);
|
|
31694
32516
|
}
|
|
@@ -31768,7 +32590,7 @@ var Hono2 = class extends Hono {
|
|
|
31768
32590
|
var cors = (options) => {
|
|
31769
32591
|
const opts = {
|
|
31770
32592
|
origin: "*",
|
|
31771
|
-
allowMethods: ["GET", "HEAD", "PUT", "POST", "DELETE", "PATCH"],
|
|
32593
|
+
allowMethods: ["GET", "HEAD", "PUT", "POST", "DELETE", "PATCH", "QUERY"],
|
|
31772
32594
|
allowHeaders: [],
|
|
31773
32595
|
exposeHeaders: [],
|
|
31774
32596
|
...options
|
|
@@ -31824,7 +32646,7 @@ var cors = (options) => {
|
|
|
31824
32646
|
if (!headers?.length) {
|
|
31825
32647
|
const requestHeaders = c.req.header("Access-Control-Request-Headers");
|
|
31826
32648
|
if (requestHeaders) {
|
|
31827
|
-
headers = requestHeaders.split(
|
|
32649
|
+
headers = requestHeaders.split(",").map((h) => h.trim());
|
|
31828
32650
|
}
|
|
31829
32651
|
}
|
|
31830
32652
|
if (headers?.length) {
|
|
@@ -32066,8 +32888,8 @@ var RateLimiter = class _RateLimiter {
|
|
|
32066
32888
|
};
|
|
32067
32889
|
|
|
32068
32890
|
// node_modules/@casys/mcp-server/src/validation/schema-validator.ts
|
|
32069
|
-
var
|
|
32070
|
-
var Ajv2 =
|
|
32891
|
+
var import__ = __toESM(require__(), 1);
|
|
32892
|
+
var Ajv2 = import__.default.default ?? import__.default;
|
|
32071
32893
|
function plural(n, singular, plural2 = `${singular}s`) {
|
|
32072
32894
|
return `${n} ${n === 1 ? singular : plural2}`;
|
|
32073
32895
|
}
|
|
@@ -32552,19 +33374,19 @@ var BaseContext = class _BaseContext {
|
|
|
32552
33374
|
*
|
|
32553
33375
|
* @param parentContext a context from which to inherit values
|
|
32554
33376
|
*/
|
|
32555
|
-
constructor(
|
|
33377
|
+
constructor(parentContext2) {
|
|
32556
33378
|
const self2 = this;
|
|
32557
|
-
self2._currentContext =
|
|
33379
|
+
self2._currentContext = parentContext2 ? new Map(parentContext2) : /* @__PURE__ */ new Map();
|
|
32558
33380
|
self2.getValue = (key) => self2._currentContext.get(key);
|
|
32559
33381
|
self2.setValue = (key, value) => {
|
|
32560
|
-
const
|
|
32561
|
-
|
|
32562
|
-
return
|
|
33382
|
+
const context2 = new _BaseContext(self2._currentContext);
|
|
33383
|
+
context2._currentContext.set(key, value);
|
|
33384
|
+
return context2;
|
|
32563
33385
|
};
|
|
32564
33386
|
self2.deleteValue = (key) => {
|
|
32565
|
-
const
|
|
32566
|
-
|
|
32567
|
-
return
|
|
33387
|
+
const context2 = new _BaseContext(self2._currentContext);
|
|
33388
|
+
context2._currentContext.delete(key);
|
|
33389
|
+
return context2;
|
|
32568
33390
|
};
|
|
32569
33391
|
}
|
|
32570
33392
|
};
|
|
@@ -32625,8 +33447,8 @@ var ContextAPI = class _ContextAPI {
|
|
|
32625
33447
|
* @param thisArg optional receiver to be used for calling fn
|
|
32626
33448
|
* @param args optional arguments forwarded to fn
|
|
32627
33449
|
*/
|
|
32628
|
-
with(
|
|
32629
|
-
return this._getContextManager().with(
|
|
33450
|
+
with(context2, fn, thisArg, ...args) {
|
|
33451
|
+
return this._getContextManager().with(context2, fn, thisArg, ...args);
|
|
32630
33452
|
}
|
|
32631
33453
|
/**
|
|
32632
33454
|
* Bind a context to a target function or event emitter
|
|
@@ -32634,8 +33456,8 @@ var ContextAPI = class _ContextAPI {
|
|
|
32634
33456
|
* @param context context to bind to the event emitter or function. Defaults to the currently active context
|
|
32635
33457
|
* @param target function or event emitter to bind
|
|
32636
33458
|
*/
|
|
32637
|
-
bind(
|
|
32638
|
-
return this._getContextManager().bind(
|
|
33459
|
+
bind(context2, target) {
|
|
33460
|
+
return this._getContextManager().bind(context2, target);
|
|
32639
33461
|
}
|
|
32640
33462
|
_getContextManager() {
|
|
32641
33463
|
return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
|
|
@@ -32712,24 +33534,24 @@ var NonRecordingSpan = class {
|
|
|
32712
33534
|
|
|
32713
33535
|
// node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
|
|
32714
33536
|
var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
|
|
32715
|
-
function getSpan(
|
|
32716
|
-
return
|
|
33537
|
+
function getSpan(context2) {
|
|
33538
|
+
return context2.getValue(SPAN_KEY) || void 0;
|
|
32717
33539
|
}
|
|
32718
33540
|
function getActiveSpan() {
|
|
32719
33541
|
return getSpan(ContextAPI.getInstance().active());
|
|
32720
33542
|
}
|
|
32721
|
-
function setSpan(
|
|
32722
|
-
return
|
|
33543
|
+
function setSpan(context2, span) {
|
|
33544
|
+
return context2.setValue(SPAN_KEY, span);
|
|
32723
33545
|
}
|
|
32724
|
-
function deleteSpan(
|
|
32725
|
-
return
|
|
33546
|
+
function deleteSpan(context2) {
|
|
33547
|
+
return context2.deleteValue(SPAN_KEY);
|
|
32726
33548
|
}
|
|
32727
|
-
function setSpanContext(
|
|
32728
|
-
return setSpan(
|
|
33549
|
+
function setSpanContext(context2, spanContext) {
|
|
33550
|
+
return setSpan(context2, new NonRecordingSpan(spanContext));
|
|
32729
33551
|
}
|
|
32730
|
-
function getSpanContext(
|
|
33552
|
+
function getSpanContext(context2) {
|
|
32731
33553
|
var _a3;
|
|
32732
|
-
return (_a3 = getSpan(
|
|
33554
|
+
return (_a3 = getSpan(context2)) === null || _a3 === void 0 ? void 0 : _a3.spanContext();
|
|
32733
33555
|
}
|
|
32734
33556
|
|
|
32735
33557
|
// node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
@@ -32864,12 +33686,12 @@ function wrapSpanContext(spanContext) {
|
|
|
32864
33686
|
var contextApi = ContextAPI.getInstance();
|
|
32865
33687
|
var NoopTracer = class {
|
|
32866
33688
|
// startSpan starts a noop span.
|
|
32867
|
-
startSpan(name, options,
|
|
33689
|
+
startSpan(name, options, context2 = contextApi.active()) {
|
|
32868
33690
|
const root = Boolean(options === null || options === void 0 ? void 0 : options.root);
|
|
32869
33691
|
if (root) {
|
|
32870
33692
|
return new NonRecordingSpan();
|
|
32871
33693
|
}
|
|
32872
|
-
const parentFromContext =
|
|
33694
|
+
const parentFromContext = context2 && getSpanContext(context2);
|
|
32873
33695
|
if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
|
|
32874
33696
|
return new NonRecordingSpan(parentFromContext);
|
|
32875
33697
|
} else {
|
|
@@ -32892,9 +33714,9 @@ var NoopTracer = class {
|
|
|
32892
33714
|
ctx = arg3;
|
|
32893
33715
|
fn = arg4;
|
|
32894
33716
|
}
|
|
32895
|
-
const
|
|
32896
|
-
const span = this.startSpan(name, opts,
|
|
32897
|
-
const contextWithSpanSet = setSpan(
|
|
33717
|
+
const parentContext2 = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
33718
|
+
const span = this.startSpan(name, opts, parentContext2);
|
|
33719
|
+
const contextWithSpanSet = setSpan(parentContext2, span);
|
|
32898
33720
|
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
32899
33721
|
}
|
|
32900
33722
|
};
|
|
@@ -32911,8 +33733,8 @@ var ProxyTracer = class {
|
|
|
32911
33733
|
this.version = version2;
|
|
32912
33734
|
this.options = options;
|
|
32913
33735
|
}
|
|
32914
|
-
startSpan(name, options,
|
|
32915
|
-
return this._getTracer().startSpan(name, options,
|
|
33736
|
+
startSpan(name, options, context2) {
|
|
33737
|
+
return this._getTracer().startSpan(name, options, context2);
|
|
32916
33738
|
}
|
|
32917
33739
|
startActiveSpan(_name, _options, _context, _fn) {
|
|
32918
33740
|
const tracer = this._getTracer();
|
|
@@ -32976,6 +33798,9 @@ var SpanStatusCode;
|
|
|
32976
33798
|
SpanStatusCode2[SpanStatusCode2["ERROR"] = 2] = "ERROR";
|
|
32977
33799
|
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
32978
33800
|
|
|
33801
|
+
// node_modules/@opentelemetry/api/build/esm/context-api.js
|
|
33802
|
+
var context = ContextAPI.getInstance();
|
|
33803
|
+
|
|
32979
33804
|
// node_modules/@opentelemetry/api/build/esm/api/trace.js
|
|
32980
33805
|
var API_NAME3 = "trace";
|
|
32981
33806
|
var TraceAPI = class _TraceAPI {
|
|
@@ -33034,15 +33859,101 @@ var trace = TraceAPI.getInstance();
|
|
|
33034
33859
|
|
|
33035
33860
|
// node_modules/@casys/mcp-server/src/observability/otel.ts
|
|
33036
33861
|
var serverTracer = null;
|
|
33862
|
+
var TRACEPARENT = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})/;
|
|
33863
|
+
var TRACEPARENT_PREFIX_LENGTH = 55;
|
|
33864
|
+
var INVALID_TRACE_ID = "0".repeat(32);
|
|
33865
|
+
var INVALID_SPAN_ID = "0".repeat(16);
|
|
33866
|
+
var TRACESTATE_MAX_MEMBERS = 32;
|
|
33867
|
+
var TRACESTATE_KEY = /^(?:[a-z][a-z0-9_\-*/]{0,255}|[a-z0-9][a-z0-9_\-*/]{0,240}@[a-z][a-z0-9_\-*/]{0,13})$/;
|
|
33868
|
+
var TRACESTATE_VALUE = /^[\x20-\x2B\x2D-\x3C\x3E-\x7E]{0,255}[\x21-\x2B\x2D-\x3C\x3E-\x7E]$/;
|
|
33869
|
+
function trimOws(member) {
|
|
33870
|
+
return member.replace(/^[ \t]+/, "").replace(/[ \t]+$/, "");
|
|
33871
|
+
}
|
|
33872
|
+
var ListTraceState = class _ListTraceState {
|
|
33873
|
+
#entries;
|
|
33874
|
+
constructor(entries) {
|
|
33875
|
+
this.#entries = entries;
|
|
33876
|
+
}
|
|
33877
|
+
static #isValid(key, value) {
|
|
33878
|
+
return TRACESTATE_KEY.test(key) && TRACESTATE_VALUE.test(value);
|
|
33879
|
+
}
|
|
33880
|
+
static parse(raw2) {
|
|
33881
|
+
const seen = /* @__PURE__ */ new Set();
|
|
33882
|
+
const entries = [];
|
|
33883
|
+
for (const member of raw2.split(",")) {
|
|
33884
|
+
const trimmed = trimOws(member);
|
|
33885
|
+
if (trimmed.length === 0) continue;
|
|
33886
|
+
const at = trimmed.indexOf("=");
|
|
33887
|
+
if (at <= 0) continue;
|
|
33888
|
+
const key = trimmed.slice(0, at);
|
|
33889
|
+
const value = trimmed.slice(at + 1);
|
|
33890
|
+
if (seen.has(key)) continue;
|
|
33891
|
+
if (!_ListTraceState.#isValid(key, value)) continue;
|
|
33892
|
+
seen.add(key);
|
|
33893
|
+
entries.push([key, value]);
|
|
33894
|
+
if (entries.length === TRACESTATE_MAX_MEMBERS) break;
|
|
33895
|
+
}
|
|
33896
|
+
return entries.length > 0 ? new _ListTraceState(entries) : void 0;
|
|
33897
|
+
}
|
|
33898
|
+
get(key) {
|
|
33899
|
+
return this.#entries.find(([k]) => k === key)?.[1];
|
|
33900
|
+
}
|
|
33901
|
+
set(key, value) {
|
|
33902
|
+
if (!_ListTraceState.#isValid(key, value)) return this;
|
|
33903
|
+
return new _ListTraceState([
|
|
33904
|
+
[key, value],
|
|
33905
|
+
...this.#entries.filter(([k]) => k !== key)
|
|
33906
|
+
].slice(0, TRACESTATE_MAX_MEMBERS));
|
|
33907
|
+
}
|
|
33908
|
+
unset(key) {
|
|
33909
|
+
return new _ListTraceState(this.#entries.filter(([k]) => k !== key));
|
|
33910
|
+
}
|
|
33911
|
+
serialize() {
|
|
33912
|
+
return this.#entries.map(([k, v]) => `${k}=${v}`).join(",");
|
|
33913
|
+
}
|
|
33914
|
+
};
|
|
33915
|
+
function parseTraceParent(traceparent, tracestate) {
|
|
33916
|
+
if (typeof traceparent !== "string") return void 0;
|
|
33917
|
+
if (traceparent.length < TRACEPARENT_PREFIX_LENGTH) return void 0;
|
|
33918
|
+
const match2 = TRACEPARENT.exec(traceparent);
|
|
33919
|
+
if (!match2) return void 0;
|
|
33920
|
+
const [, version2, traceId, spanId, flags] = match2;
|
|
33921
|
+
if (version2 === "ff") return void 0;
|
|
33922
|
+
if (version2 === "00") {
|
|
33923
|
+
if (traceparent.length !== TRACEPARENT_PREFIX_LENGTH) return void 0;
|
|
33924
|
+
} else if (traceparent.length > TRACEPARENT_PREFIX_LENGTH && traceparent[TRACEPARENT_PREFIX_LENGTH] !== "-") {
|
|
33925
|
+
return void 0;
|
|
33926
|
+
}
|
|
33927
|
+
if (traceId === INVALID_TRACE_ID || spanId === INVALID_SPAN_ID) {
|
|
33928
|
+
return void 0;
|
|
33929
|
+
}
|
|
33930
|
+
const traceState = typeof tracestate === "string" ? ListTraceState.parse(tracestate) : void 0;
|
|
33931
|
+
return {
|
|
33932
|
+
traceId,
|
|
33933
|
+
spanId,
|
|
33934
|
+
// Only the sampled bit is defined; the rest of the byte is reserved.
|
|
33935
|
+
traceFlags: parseInt(flags, 16) & TraceFlags.SAMPLED,
|
|
33936
|
+
isRemote: true,
|
|
33937
|
+
...traceState ? { traceState } : {}
|
|
33938
|
+
};
|
|
33939
|
+
}
|
|
33940
|
+
function parentContext(remote) {
|
|
33941
|
+
const active = context.active();
|
|
33942
|
+
return remote ? trace.setSpanContext(active, remote) : active;
|
|
33943
|
+
}
|
|
33037
33944
|
function getServerTracer() {
|
|
33038
33945
|
if (!serverTracer) {
|
|
33039
33946
|
serverTracer = trace.getTracer("mcp.server", "0.8.0");
|
|
33040
33947
|
}
|
|
33041
33948
|
return serverTracer;
|
|
33042
33949
|
}
|
|
33043
|
-
function startToolCallSpan(toolName, attributes) {
|
|
33950
|
+
function startToolCallSpan(toolName, attributes, remoteParent) {
|
|
33044
33951
|
const tracer = getServerTracer();
|
|
33045
|
-
return tracer.startSpan(
|
|
33952
|
+
return tracer.startSpan(
|
|
33953
|
+
`mcp.tool.call ${toolName}`,
|
|
33954
|
+
{ attributes },
|
|
33955
|
+
parentContext(remoteParent)
|
|
33956
|
+
);
|
|
33046
33957
|
}
|
|
33047
33958
|
function endToolCallSpan(span, success, durationMs, error2) {
|
|
33048
33959
|
span.setAttribute("mcp.tool.duration_ms", durationMs);
|
|
@@ -33271,6 +34182,12 @@ function checkUsage(key, usage) {
|
|
|
33271
34182
|
throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);
|
|
33272
34183
|
}
|
|
33273
34184
|
}
|
|
34185
|
+
function checkModulusLength(alg, key) {
|
|
34186
|
+
const { modulusLength } = key.algorithm;
|
|
34187
|
+
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
34188
|
+
throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);
|
|
34189
|
+
}
|
|
34190
|
+
}
|
|
33274
34191
|
function checkCryptoKey(key, expected, usage) {
|
|
33275
34192
|
const algorithm = key.algorithm;
|
|
33276
34193
|
if (algorithm.name !== expected.name) {
|
|
@@ -33290,7 +34207,6 @@ function checkCryptoKey(key, expected, usage) {
|
|
|
33290
34207
|
|
|
33291
34208
|
// node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
33292
34209
|
function message(msg, actual, ...types) {
|
|
33293
|
-
types = types.filter(Boolean);
|
|
33294
34210
|
if (types.length > 2) {
|
|
33295
34211
|
const last = types.pop();
|
|
33296
34212
|
msg += `one of type ${types.join(", ")}, or ${last}.`;
|
|
@@ -33426,6 +34342,7 @@ function decodeBase64(encoded) {
|
|
|
33426
34342
|
}
|
|
33427
34343
|
|
|
33428
34344
|
// node_modules/jose/dist/webapi/util/base64url.js
|
|
34345
|
+
var invalid = "The input to be decoded is not correctly encoded.";
|
|
33429
34346
|
function decode3(input) {
|
|
33430
34347
|
if (Uint8Array.fromBase64) {
|
|
33431
34348
|
try {
|
|
@@ -33433,7 +34350,7 @@ function decode3(input) {
|
|
|
33433
34350
|
alphabet: "base64url"
|
|
33434
34351
|
});
|
|
33435
34352
|
} catch (cause) {
|
|
33436
|
-
throw new TypeError(
|
|
34353
|
+
throw new TypeError(invalid, { cause });
|
|
33437
34354
|
}
|
|
33438
34355
|
}
|
|
33439
34356
|
let encoded = input;
|
|
@@ -33441,48 +34358,41 @@ function decode3(input) {
|
|
|
33441
34358
|
encoded = decoder.decode(encoded);
|
|
33442
34359
|
}
|
|
33443
34360
|
if (encoded.includes("+") || encoded.includes("/")) {
|
|
33444
|
-
throw new TypeError(
|
|
34361
|
+
throw new TypeError(invalid);
|
|
33445
34362
|
}
|
|
33446
34363
|
encoded = encoded.replace(/-/g, "+").replace(/_/g, "/");
|
|
33447
34364
|
try {
|
|
33448
34365
|
return decodeBase64(encoded);
|
|
33449
34366
|
} catch {
|
|
33450
|
-
throw new TypeError(
|
|
34367
|
+
throw new TypeError(invalid);
|
|
33451
34368
|
}
|
|
33452
34369
|
}
|
|
33453
34370
|
|
|
33454
34371
|
// node_modules/jose/dist/webapi/lib/type_checks.js
|
|
33455
|
-
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
33456
34372
|
function isObject2(input) {
|
|
33457
|
-
if (
|
|
34373
|
+
if (typeof input !== "object" || input === null || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
33458
34374
|
return false;
|
|
33459
34375
|
}
|
|
33460
|
-
|
|
34376
|
+
const prototype = Object.getPrototypeOf(input);
|
|
34377
|
+
if (prototype === null) {
|
|
33461
34378
|
return true;
|
|
33462
34379
|
}
|
|
33463
|
-
let proto =
|
|
34380
|
+
let proto = prototype;
|
|
33464
34381
|
while (Object.getPrototypeOf(proto) !== null) {
|
|
33465
34382
|
proto = Object.getPrototypeOf(proto);
|
|
33466
34383
|
}
|
|
33467
|
-
return
|
|
34384
|
+
return prototype === proto;
|
|
33468
34385
|
}
|
|
33469
34386
|
function isDisjoint(...headers) {
|
|
33470
|
-
const
|
|
33471
|
-
|
|
33472
|
-
|
|
33473
|
-
}
|
|
33474
|
-
let acc;
|
|
33475
|
-
for (const header of sources) {
|
|
33476
|
-
const parameters = Object.keys(header);
|
|
33477
|
-
if (!acc || acc.size === 0) {
|
|
33478
|
-
acc = new Set(parameters);
|
|
34387
|
+
const parameters = /* @__PURE__ */ new Set();
|
|
34388
|
+
for (const header of headers) {
|
|
34389
|
+
if (!header)
|
|
33479
34390
|
continue;
|
|
33480
|
-
|
|
33481
|
-
|
|
33482
|
-
if (acc.has(parameter)) {
|
|
34391
|
+
for (const parameter of Object.keys(header)) {
|
|
34392
|
+
if (parameters.has(parameter)) {
|
|
33483
34393
|
return false;
|
|
33484
34394
|
}
|
|
33485
|
-
|
|
34395
|
+
parameters.add(parameter);
|
|
33486
34396
|
}
|
|
33487
34397
|
}
|
|
33488
34398
|
return true;
|
|
@@ -33522,26 +34432,21 @@ function parseJoseHeader(b64, ErrorClass, message2) {
|
|
|
33522
34432
|
}
|
|
33523
34433
|
|
|
33524
34434
|
// node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
33525
|
-
var unsupportedAlg = 'Invalid or unsupported JWK "alg" (Algorithm) Parameter value';
|
|
33526
|
-
function subtleParams(entry, jwk) {
|
|
33527
|
-
if (!entry.kty.includes(jwk.kty)) {
|
|
33528
|
-
throw new JOSENotSupported(unsupportedAlg);
|
|
33529
|
-
}
|
|
33530
|
-
return entry.subtleFor?.({ kty: jwk.kty, crv: jwk.crv }) ?? entry.subtle;
|
|
33531
|
-
}
|
|
33532
34435
|
async function jwkToKey(entry, jwk) {
|
|
33533
34436
|
if (jwk.kty === "RSA" && "oth" in jwk && jwk.oth !== void 0) {
|
|
33534
34437
|
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
33535
34438
|
}
|
|
33536
|
-
|
|
34439
|
+
if (!entry.kty.includes(jwk.kty)) {
|
|
34440
|
+
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
34441
|
+
}
|
|
34442
|
+
const algorithm = entry.resolve?.({ kty: jwk.kty, crv: jwk.crv }) ?? entry.subtle;
|
|
33537
34443
|
const isPrivate = !!(jwk.d || jwk.priv);
|
|
33538
|
-
const keyUsages = isPrivate ? entry.usages.private : entry.usages.public;
|
|
33539
34444
|
const keyData = { ...jwk };
|
|
33540
34445
|
if (keyData.kty !== "AKP") {
|
|
33541
34446
|
delete keyData.alg;
|
|
33542
34447
|
}
|
|
33543
34448
|
delete keyData.use;
|
|
33544
|
-
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ??
|
|
34449
|
+
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? !isPrivate, jwk.key_ops ?? entry.usages[isPrivate ? 1 : 0]);
|
|
33545
34450
|
}
|
|
33546
34451
|
|
|
33547
34452
|
// node_modules/jose/dist/webapi/lib/key.js
|
|
@@ -33549,17 +34454,7 @@ var tag = (key) => key[Symbol.toStringTag];
|
|
|
33549
34454
|
var jwkMatchesOp = (entry, key, usage) => {
|
|
33550
34455
|
const { alg } = entry;
|
|
33551
34456
|
if (key.use !== void 0) {
|
|
33552
|
-
|
|
33553
|
-
switch (usage) {
|
|
33554
|
-
case "sign":
|
|
33555
|
-
case "verify":
|
|
33556
|
-
expected = "sig";
|
|
33557
|
-
break;
|
|
33558
|
-
case "encrypt":
|
|
33559
|
-
case "decrypt":
|
|
33560
|
-
expected = "enc";
|
|
33561
|
-
break;
|
|
33562
|
-
}
|
|
34457
|
+
const expected = usage === "sign" || usage === "verify" ? "sig" : "enc";
|
|
33563
34458
|
if (key.use !== expected) {
|
|
33564
34459
|
throw new TypeError(`Invalid key for this operation, its "use" must be "${expected}" when present`);
|
|
33565
34460
|
}
|
|
@@ -33568,77 +34463,47 @@ var jwkMatchesOp = (entry, key, usage) => {
|
|
|
33568
34463
|
throw new TypeError(`Invalid key for this operation, its "alg" must be "${alg}" when present`);
|
|
33569
34464
|
}
|
|
33570
34465
|
if (Array.isArray(key.key_ops)) {
|
|
33571
|
-
const expectedKeyOp = usage === "encrypt" || usage === "decrypt" ? entry.
|
|
33572
|
-
if (expectedKeyOp && key.key_ops
|
|
34466
|
+
const expectedKeyOp = usage === "encrypt" || usage === "decrypt" ? entry.ops?.[usage === "encrypt" ? 0 : 1] : usage;
|
|
34467
|
+
if (expectedKeyOp && !key.key_ops.includes(expectedKeyOp)) {
|
|
33573
34468
|
throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${expectedKeyOp}" when present`);
|
|
33574
34469
|
}
|
|
33575
34470
|
}
|
|
33576
|
-
return true;
|
|
33577
|
-
};
|
|
33578
|
-
var symmetricTypeCheck = (entry, key, usage) => {
|
|
33579
|
-
const { alg } = entry;
|
|
33580
|
-
if (key instanceof Uint8Array)
|
|
33581
|
-
return { kind: BYTES, key };
|
|
33582
|
-
if (isJWK(key)) {
|
|
33583
|
-
if (isSecretJWK(key) && jwkMatchesOp(entry, key, usage))
|
|
33584
|
-
return { kind: JWK, key };
|
|
33585
|
-
throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`);
|
|
33586
|
-
}
|
|
33587
|
-
if (!isKeyLike(key)) {
|
|
33588
|
-
throw new TypeError(withAlg(alg, key, "CryptoKey", "KeyObject", "JSON Web Key", "Uint8Array"));
|
|
33589
|
-
}
|
|
33590
|
-
if (key.type !== "secret") {
|
|
33591
|
-
throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`);
|
|
33592
|
-
}
|
|
33593
|
-
return isCryptoKey(key) ? { kind: CRYPTO, key } : { kind: KEYOBJECT, key };
|
|
33594
34471
|
};
|
|
33595
|
-
|
|
33596
|
-
const { alg } = entry;
|
|
34472
|
+
function checkKeyType(entry, key, usage) {
|
|
34473
|
+
const { alg, secret } = entry;
|
|
34474
|
+
const privateKey = usage === "decrypt" || usage === "sign";
|
|
34475
|
+
if (secret && key instanceof Uint8Array)
|
|
34476
|
+
return [BYTES, key];
|
|
33597
34477
|
if (isJWK(key)) {
|
|
33598
|
-
|
|
33599
|
-
|
|
33600
|
-
case "sign":
|
|
33601
|
-
if (isPrivateJWK(key) && jwkMatchesOp(entry, key, usage))
|
|
33602
|
-
return { kind: JWK, key };
|
|
33603
|
-
throw new TypeError(`JSON Web Key for this operation must be a private JWK`);
|
|
33604
|
-
case "encrypt":
|
|
33605
|
-
case "verify":
|
|
33606
|
-
if (isPublicJWK(key) && jwkMatchesOp(entry, key, usage))
|
|
33607
|
-
return { kind: JWK, key };
|
|
33608
|
-
throw new TypeError(`JSON Web Key for this operation must be a public JWK`);
|
|
34478
|
+
if (secret ? !isSecretJWK(key) : !(privateKey ? isPrivateJWK(key) : isPublicJWK(key))) {
|
|
34479
|
+
throw new TypeError(secret ? `JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present` : `JSON Web Key for this operation must be a ${privateKey ? "private" : "public"} JWK`);
|
|
33609
34480
|
}
|
|
34481
|
+
jwkMatchesOp(entry, key, usage);
|
|
34482
|
+
return [JWK, key];
|
|
33610
34483
|
}
|
|
33611
34484
|
if (!isKeyLike(key)) {
|
|
33612
|
-
throw new TypeError(withAlg(alg, key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
33613
|
-
}
|
|
33614
|
-
if (key.type === "secret") {
|
|
33615
|
-
throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
34485
|
+
throw new TypeError(secret ? withAlg(alg, key, "CryptoKey", "KeyObject", "JSON Web Key", "Uint8Array") : withAlg(alg, key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
33616
34486
|
}
|
|
33617
|
-
if (
|
|
33618
|
-
|
|
33619
|
-
|
|
33620
|
-
throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type "private"`);
|
|
33621
|
-
case "decrypt":
|
|
33622
|
-
throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type "private"`);
|
|
34487
|
+
if (secret) {
|
|
34488
|
+
if (key.type !== "secret") {
|
|
34489
|
+
throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`);
|
|
33623
34490
|
}
|
|
33624
|
-
}
|
|
33625
|
-
|
|
33626
|
-
|
|
33627
|
-
|
|
33628
|
-
|
|
33629
|
-
|
|
33630
|
-
|
|
34491
|
+
} else {
|
|
34492
|
+
if (key.type === "secret") {
|
|
34493
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
34494
|
+
}
|
|
34495
|
+
const expectedType = privateKey ? "private" : "public";
|
|
34496
|
+
if ((key.type === "public" || key.type === "private") && key.type !== expectedType) {
|
|
34497
|
+
const operation = usage === "sign" ? "signing" : usage === "verify" ? "verifying" : `${usage.slice(0, -1)}tion`;
|
|
34498
|
+
throw new TypeError(`${tag(key)} instances for asymmetric algorithm ${operation} must be of type "${expectedType}"`);
|
|
33631
34499
|
}
|
|
33632
34500
|
}
|
|
33633
|
-
return isCryptoKey(key) ?
|
|
33634
|
-
};
|
|
33635
|
-
var BYTES = Symbol();
|
|
33636
|
-
var CRYPTO = Symbol();
|
|
33637
|
-
var KEYOBJECT = Symbol();
|
|
33638
|
-
var JWK = Symbol();
|
|
33639
|
-
function checkKeyType(entry, key, usage) {
|
|
33640
|
-
return entry.symmetric ? symmetricTypeCheck(entry, key, usage) : asymmetricTypeCheck(entry, key, usage);
|
|
34501
|
+
return isCryptoKey(key) ? [CRYPTO, key] : [KEYOBJECT, key];
|
|
33641
34502
|
}
|
|
34503
|
+
var BYTES = 0;
|
|
34504
|
+
var CRYPTO = 1;
|
|
34505
|
+
var KEYOBJECT = 2;
|
|
34506
|
+
var JWK = 3;
|
|
33642
34507
|
var cache;
|
|
33643
34508
|
var nist = {
|
|
33644
34509
|
__proto__: null,
|
|
@@ -33646,57 +34511,51 @@ var nist = {
|
|
|
33646
34511
|
secp384r1: "P-384",
|
|
33647
34512
|
secp521r1: "P-521"
|
|
33648
34513
|
};
|
|
33649
|
-
function cached2(key, alg) {
|
|
34514
|
+
function cached2(key, alg, value) {
|
|
33650
34515
|
cache ||= /* @__PURE__ */ new WeakMap();
|
|
33651
|
-
return cache.get(key)?.[alg];
|
|
33652
|
-
}
|
|
33653
|
-
function store(key, alg, cryptoKey) {
|
|
33654
34516
|
const entry = cache.get(key);
|
|
33655
|
-
if (
|
|
33656
|
-
entry
|
|
33657
|
-
|
|
33658
|
-
|
|
34517
|
+
if (value) {
|
|
34518
|
+
if (entry) {
|
|
34519
|
+
entry[alg] = value;
|
|
34520
|
+
} else {
|
|
34521
|
+
cache.set(key, { __proto__: null, [alg]: value });
|
|
34522
|
+
}
|
|
33659
34523
|
}
|
|
33660
|
-
return
|
|
34524
|
+
return value ?? entry?.[alg];
|
|
33661
34525
|
}
|
|
33662
|
-
var handleJWK = async (key, jwk, entry) => {
|
|
33663
|
-
const hit = cached2(key, entry.alg);
|
|
33664
|
-
if (hit)
|
|
33665
|
-
return hit;
|
|
33666
|
-
const cryptoKey = await jwkToKey(entry, { ...jwk, alg: entry.alg });
|
|
33667
|
-
return store(key, entry.alg, cryptoKey);
|
|
33668
|
-
};
|
|
34526
|
+
var handleJWK = async (key, jwk, entry) => cached2(key, entry.alg) ?? cached2(key, entry.alg, await jwkToKey(entry, { ...jwk, alg: entry.alg }));
|
|
33669
34527
|
var handleKeyObject = (keyObject, entry) => {
|
|
33670
34528
|
const hit = cached2(keyObject, entry.alg);
|
|
33671
34529
|
if (hit)
|
|
33672
34530
|
return hit;
|
|
33673
34531
|
const isPublic = keyObject.type === "public";
|
|
33674
|
-
const usages = isPublic ?
|
|
34532
|
+
const usages = entry.usages[isPublic ? 0 : 1];
|
|
33675
34533
|
const { asymmetricKeyType } = keyObject;
|
|
33676
34534
|
const crv = nist[keyObject.asymmetricKeyDetails?.namedCurve];
|
|
33677
|
-
const params = entry.
|
|
33678
|
-
return
|
|
34535
|
+
const params = entry.resolve?.({ crv, asymmetricKeyType }) ?? entry.subtle;
|
|
34536
|
+
return cached2(keyObject, entry.alg, keyObject.toCryptoKey(params, isPublic, usages));
|
|
33679
34537
|
};
|
|
33680
34538
|
async function prepareKey(entry, key, usage) {
|
|
33681
34539
|
const tagged = checkKeyType(entry, key, usage);
|
|
33682
|
-
switch (tagged
|
|
34540
|
+
switch (tagged[0]) {
|
|
33683
34541
|
case BYTES:
|
|
33684
34542
|
case CRYPTO:
|
|
33685
|
-
return tagged
|
|
34543
|
+
return tagged[1];
|
|
33686
34544
|
case JWK: {
|
|
33687
|
-
|
|
33688
|
-
|
|
34545
|
+
const key2 = tagged[1];
|
|
34546
|
+
if (key2.k) {
|
|
34547
|
+
return decode3(key2.k);
|
|
33689
34548
|
}
|
|
33690
|
-
if (!Object.isFrozen(
|
|
33691
|
-
const { key_ops } =
|
|
34549
|
+
if (!Object.isFrozen(key2)) {
|
|
34550
|
+
const { key_ops } = key2;
|
|
33692
34551
|
if (Array.isArray(key_ops))
|
|
33693
34552
|
Object.freeze(key_ops);
|
|
33694
|
-
Object.freeze(
|
|
34553
|
+
Object.freeze(key2);
|
|
33695
34554
|
}
|
|
33696
|
-
return handleJWK(
|
|
34555
|
+
return handleJWK(key2, key2, entry);
|
|
33697
34556
|
}
|
|
33698
34557
|
case KEYOBJECT: {
|
|
33699
|
-
const keyObject = tagged
|
|
34558
|
+
const keyObject = tagged[1];
|
|
33700
34559
|
if (keyObject.type === "secret") {
|
|
33701
34560
|
return keyObject.export();
|
|
33702
34561
|
}
|
|
@@ -33711,45 +34570,14 @@ async function prepareKey(entry, key, usage) {
|
|
|
33711
34570
|
// node_modules/jose/dist/webapi/lib/key_descriptor.js
|
|
33712
34571
|
function table(entries) {
|
|
33713
34572
|
const out = { __proto__: null };
|
|
33714
|
-
for (const alg
|
|
34573
|
+
for (const alg in entries) {
|
|
33715
34574
|
out[alg] = { ...entries[alg], alg };
|
|
33716
34575
|
}
|
|
33717
34576
|
return out;
|
|
33718
34577
|
}
|
|
33719
34578
|
|
|
33720
|
-
// node_modules/jose/dist/webapi/lib/signing.js
|
|
33721
|
-
function checkModulusLength(alg, key) {
|
|
33722
|
-
const { modulusLength } = key.algorithm;
|
|
33723
|
-
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
33724
|
-
throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);
|
|
33725
|
-
}
|
|
33726
|
-
}
|
|
33727
|
-
function checkSigCryptoKey(entry, key, usage) {
|
|
33728
|
-
checkCryptoKey(key, entry.subtle, usage);
|
|
33729
|
-
if (entry.minModulusLength) {
|
|
33730
|
-
checkModulusLength(entry.alg, key);
|
|
33731
|
-
}
|
|
33732
|
-
}
|
|
33733
|
-
async function getSigKey(entry, key, usage) {
|
|
33734
|
-
if (key instanceof Uint8Array) {
|
|
33735
|
-
return crypto.subtle.importKey("raw", key, entry.subtle, false, [
|
|
33736
|
-
usage
|
|
33737
|
-
]);
|
|
33738
|
-
}
|
|
33739
|
-
checkSigCryptoKey(entry, key, usage);
|
|
33740
|
-
return key;
|
|
33741
|
-
}
|
|
33742
|
-
async function verify(entry, key, signature, data) {
|
|
33743
|
-
const cryptoKey = await getSigKey(entry, key, "verify");
|
|
33744
|
-
try {
|
|
33745
|
-
return await crypto.subtle.verify(entry.operation, cryptoKey, signature, data);
|
|
33746
|
-
} catch {
|
|
33747
|
-
return false;
|
|
33748
|
-
}
|
|
33749
|
-
}
|
|
33750
|
-
|
|
33751
34579
|
// node_modules/jose/dist/webapi/lib/options.js
|
|
33752
|
-
var JWS_RECOGNIZED =
|
|
34580
|
+
var JWS_RECOGNIZED = { __proto__: null, b64: true };
|
|
33753
34581
|
function validateAlgorithms(option, algorithms) {
|
|
33754
34582
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
33755
34583
|
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
@@ -33764,45 +34592,62 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
33764
34592
|
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
33765
34593
|
}
|
|
33766
34594
|
if (!protectedHeader || protectedHeader.crit === void 0) {
|
|
33767
|
-
return
|
|
34595
|
+
return [];
|
|
33768
34596
|
}
|
|
33769
34597
|
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
33770
34598
|
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
33771
34599
|
}
|
|
33772
|
-
|
|
33773
|
-
if (recognizedOption !== void 0) {
|
|
33774
|
-
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
33775
|
-
} else {
|
|
33776
|
-
recognized = recognizedDefault;
|
|
33777
|
-
}
|
|
34600
|
+
const recognized = recognizedOption === void 0 ? recognizedDefault : { __proto__: null, ...recognizedOption, ...recognizedDefault };
|
|
33778
34601
|
for (const parameter of protectedHeader.crit) {
|
|
33779
|
-
if (!
|
|
34602
|
+
if (!(parameter in recognized)) {
|
|
33780
34603
|
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
33781
34604
|
}
|
|
33782
|
-
if (joseHeader[parameter] === void 0) {
|
|
34605
|
+
if (!Object.hasOwn(joseHeader, parameter) || joseHeader[parameter] === void 0) {
|
|
33783
34606
|
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
33784
34607
|
}
|
|
33785
|
-
if (recognized.
|
|
34608
|
+
if (recognized[parameter] && (!Object.hasOwn(protectedHeader, parameter) || protectedHeader[parameter] === void 0)) {
|
|
33786
34609
|
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
33787
34610
|
}
|
|
33788
34611
|
}
|
|
33789
|
-
return
|
|
34612
|
+
return protectedHeader.crit;
|
|
34613
|
+
}
|
|
34614
|
+
|
|
34615
|
+
// node_modules/jose/dist/webapi/lib/signing.js
|
|
34616
|
+
async function getSigKey(entry, key, usage) {
|
|
34617
|
+
if (key instanceof Uint8Array) {
|
|
34618
|
+
return crypto.subtle.importKey("raw", key, entry.subtle, false, [
|
|
34619
|
+
usage
|
|
34620
|
+
]);
|
|
34621
|
+
}
|
|
34622
|
+
checkCryptoKey(key, entry.subtle, usage);
|
|
34623
|
+
if (entry.minRsaBits)
|
|
34624
|
+
checkModulusLength(entry.alg, key);
|
|
34625
|
+
return key;
|
|
34626
|
+
}
|
|
34627
|
+
async function verify(entry, key, signature, data) {
|
|
34628
|
+
const cryptoKey = await getSigKey(entry, key, "verify");
|
|
34629
|
+
try {
|
|
34630
|
+
return await crypto.subtle.verify(entry.signing, cryptoKey, signature, data);
|
|
34631
|
+
} catch {
|
|
34632
|
+
return false;
|
|
34633
|
+
}
|
|
33790
34634
|
}
|
|
33791
34635
|
|
|
33792
34636
|
// node_modules/jose/dist/webapi/lib/jws_algorithms.js
|
|
33793
|
-
var sig =
|
|
34637
|
+
var sig = [["verify"], ["sign"]];
|
|
33794
34638
|
function hmac(bits) {
|
|
33795
34639
|
const subtle = { name: "HMAC", hash: `SHA-${bits}` };
|
|
33796
|
-
return { kty: ["oct"],
|
|
34640
|
+
return { kty: ["oct"], secret: true, subtle, signing: subtle, usages: sig };
|
|
33797
34641
|
}
|
|
33798
|
-
function rsa(
|
|
34642
|
+
function rsa(bits, saltLength) {
|
|
34643
|
+
const name = saltLength ? "RSA-PSS" : "RSASSA-PKCS1-v1_5";
|
|
33799
34644
|
const subtle = { name, hash: `SHA-${bits}` };
|
|
33800
34645
|
return {
|
|
33801
34646
|
kty: ["RSA"],
|
|
33802
34647
|
subtle,
|
|
33803
|
-
|
|
34648
|
+
signing: saltLength ? { ...subtle, saltLength } : subtle,
|
|
33804
34649
|
usages: sig,
|
|
33805
|
-
|
|
34650
|
+
minRsaBits: 2048
|
|
33806
34651
|
};
|
|
33807
34652
|
}
|
|
33808
34653
|
function ecdsa(crv, bits) {
|
|
@@ -33810,7 +34655,7 @@ function ecdsa(crv, bits) {
|
|
|
33810
34655
|
kty: ["EC"],
|
|
33811
34656
|
crv,
|
|
33812
34657
|
subtle: { name: "ECDSA", namedCurve: crv },
|
|
33813
|
-
|
|
34658
|
+
signing: { name: "ECDSA", hash: `SHA-${bits}` },
|
|
33814
34659
|
usages: sig
|
|
33815
34660
|
};
|
|
33816
34661
|
}
|
|
@@ -33820,16 +34665,17 @@ function eddsa() {
|
|
|
33820
34665
|
kty: ["OKP"],
|
|
33821
34666
|
crv: "Ed25519",
|
|
33822
34667
|
subtle,
|
|
33823
|
-
|
|
34668
|
+
signing: subtle,
|
|
33824
34669
|
usages: sig
|
|
33825
34670
|
};
|
|
33826
34671
|
}
|
|
33827
|
-
function mldsa(
|
|
34672
|
+
function mldsa(bits) {
|
|
34673
|
+
const name = `ML-DSA-${bits}`;
|
|
33828
34674
|
const subtle = { name };
|
|
33829
34675
|
return {
|
|
33830
34676
|
kty: ["AKP"],
|
|
33831
34677
|
subtle,
|
|
33832
|
-
|
|
34678
|
+
signing: subtle,
|
|
33833
34679
|
usages: sig
|
|
33834
34680
|
};
|
|
33835
34681
|
}
|
|
@@ -33837,56 +34683,51 @@ var JWS = table({
|
|
|
33837
34683
|
HS256: hmac(256),
|
|
33838
34684
|
HS384: hmac(384),
|
|
33839
34685
|
HS512: hmac(512),
|
|
33840
|
-
RS256: rsa(
|
|
33841
|
-
RS384: rsa(
|
|
33842
|
-
RS512: rsa(
|
|
33843
|
-
PS256: rsa(
|
|
33844
|
-
PS384: rsa(
|
|
33845
|
-
PS512: rsa(
|
|
34686
|
+
RS256: rsa(256),
|
|
34687
|
+
RS384: rsa(384),
|
|
34688
|
+
RS512: rsa(512),
|
|
34689
|
+
PS256: rsa(256, 32),
|
|
34690
|
+
PS384: rsa(384, 48),
|
|
34691
|
+
PS512: rsa(512, 64),
|
|
33846
34692
|
ES256: ecdsa("P-256", 256),
|
|
33847
34693
|
ES384: ecdsa("P-384", 384),
|
|
33848
34694
|
ES512: ecdsa("P-521", 512),
|
|
33849
34695
|
EdDSA: eddsa(),
|
|
33850
34696
|
Ed25519: eddsa(),
|
|
33851
|
-
"ML-DSA-44": mldsa(
|
|
33852
|
-
"ML-DSA-65": mldsa(
|
|
33853
|
-
"ML-DSA-87": mldsa(
|
|
34697
|
+
"ML-DSA-44": mldsa(44),
|
|
34698
|
+
"ML-DSA-65": mldsa(65),
|
|
34699
|
+
"ML-DSA-87": mldsa(87)
|
|
33854
34700
|
});
|
|
33855
34701
|
function jwsAlgorithm(alg) {
|
|
33856
|
-
const entry = JWS[alg];
|
|
34702
|
+
const entry = typeof alg === "string" ? JWS[alg] : void 0;
|
|
33857
34703
|
if (!entry) {
|
|
33858
34704
|
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
33859
34705
|
}
|
|
33860
34706
|
return entry;
|
|
33861
34707
|
}
|
|
33862
|
-
function maybeJWSAlgorithm(alg) {
|
|
33863
|
-
return JWS[alg];
|
|
33864
|
-
}
|
|
33865
34708
|
|
|
33866
34709
|
// node_modules/jose/dist/webapi/lib/jws_verify.js
|
|
33867
34710
|
function prepareVerify(options) {
|
|
33868
|
-
return
|
|
33869
|
-
algorithms: options && validateAlgorithms("algorithms", options.algorithms),
|
|
33870
|
-
crit: options?.crit
|
|
33871
|
-
};
|
|
34711
|
+
return [options && validateAlgorithms("algorithms", options.algorithms), options?.crit];
|
|
33872
34712
|
}
|
|
33873
34713
|
async function verifySignature(jws, shared, key) {
|
|
34714
|
+
const { protected: encodedProtected, header, payload: inputPayload } = jws;
|
|
33874
34715
|
let parsedProt = {};
|
|
33875
|
-
if (
|
|
33876
|
-
parsedProt = parseJoseHeader(
|
|
34716
|
+
if (encodedProtected) {
|
|
34717
|
+
parsedProt = parseJoseHeader(encodedProtected, JWSInvalid, "JWS Protected Header is invalid");
|
|
33877
34718
|
}
|
|
33878
34719
|
let joseHeader;
|
|
33879
|
-
if (
|
|
33880
|
-
if (!isDisjoint(parsedProt,
|
|
34720
|
+
if (header !== void 0) {
|
|
34721
|
+
if (!isDisjoint(parsedProt, header)) {
|
|
33881
34722
|
throw new JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
33882
34723
|
}
|
|
33883
|
-
joseHeader = { ...parsedProt, ...
|
|
34724
|
+
joseHeader = { ...parsedProt, ...header };
|
|
33884
34725
|
} else {
|
|
33885
34726
|
joseHeader = parsedProt;
|
|
33886
34727
|
}
|
|
33887
|
-
const extensions = validateCrit(JWSInvalid, JWS_RECOGNIZED, shared
|
|
34728
|
+
const extensions = validateCrit(JWSInvalid, JWS_RECOGNIZED, shared[1], parsedProt, joseHeader);
|
|
33888
34729
|
let b64 = true;
|
|
33889
|
-
if (extensions.
|
|
34730
|
+
if (extensions.includes("b64")) {
|
|
33890
34731
|
b64 = parsedProt.b64;
|
|
33891
34732
|
if (typeof b64 !== "boolean") {
|
|
33892
34733
|
throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
@@ -33896,14 +34737,14 @@ async function verifySignature(jws, shared, key) {
|
|
|
33896
34737
|
if (typeof alg !== "string" || !alg) {
|
|
33897
34738
|
throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
33898
34739
|
}
|
|
33899
|
-
if (shared
|
|
34740
|
+
if (shared[0] && !shared[0].has(alg)) {
|
|
33900
34741
|
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
|
|
33901
34742
|
}
|
|
33902
34743
|
if (b64) {
|
|
33903
|
-
if (typeof
|
|
34744
|
+
if (typeof inputPayload !== "string") {
|
|
33904
34745
|
throw new JWSInvalid("JWS Payload must be a string");
|
|
33905
34746
|
}
|
|
33906
|
-
} else if (typeof
|
|
34747
|
+
} else if (typeof inputPayload !== "string" && !(inputPayload instanceof Uint8Array)) {
|
|
33907
34748
|
throw new JWSInvalid("JWS Payload must be a string or an Uint8Array instance");
|
|
33908
34749
|
}
|
|
33909
34750
|
let resolvedKey = false;
|
|
@@ -33912,7 +34753,7 @@ async function verifySignature(jws, shared, key) {
|
|
|
33912
34753
|
resolvedKey = true;
|
|
33913
34754
|
}
|
|
33914
34755
|
const entry = jwsAlgorithm(alg);
|
|
33915
|
-
const data = concat(
|
|
34756
|
+
const data = concat(encodedProtected !== void 0 ? encode3(encodedProtected) : new Uint8Array(), encode3("."), typeof inputPayload === "string" ? b64 ? shared[2] ??= encodeBase64url(inputPayload, "payload", JWSInvalid) : encoder.encode(inputPayload) : inputPayload);
|
|
33916
34757
|
const signature = decodeBase64url(jws.signature, "signature", JWSInvalid);
|
|
33917
34758
|
const k = await prepareKey(entry, key, "verify");
|
|
33918
34759
|
const verified = await verify(entry, k, signature, data);
|
|
@@ -33921,13 +34762,13 @@ async function verifySignature(jws, shared, key) {
|
|
|
33921
34762
|
}
|
|
33922
34763
|
let payload;
|
|
33923
34764
|
if (b64) {
|
|
33924
|
-
payload = decodeBase64url(
|
|
33925
|
-
} else if (typeof
|
|
33926
|
-
payload = encoder.encode(
|
|
34765
|
+
payload = decodeBase64url(inputPayload, "payload", JWSInvalid);
|
|
34766
|
+
} else if (typeof inputPayload === "string") {
|
|
34767
|
+
payload = encoder.encode(inputPayload);
|
|
33927
34768
|
} else {
|
|
33928
|
-
payload =
|
|
34769
|
+
payload = inputPayload;
|
|
33929
34770
|
}
|
|
33930
|
-
return
|
|
34771
|
+
return [payload, parsedProt, b64, k, resolvedKey];
|
|
33931
34772
|
}
|
|
33932
34773
|
async function verifyCompact(jws, shared, key) {
|
|
33933
34774
|
if (jws instanceof Uint8Array) {
|
|
@@ -33945,56 +34786,23 @@ async function verifyCompact(jws, shared, key) {
|
|
|
33945
34786
|
|
|
33946
34787
|
// node_modules/jose/dist/webapi/lib/jwt_claims_set.js
|
|
33947
34788
|
var epoch = (date3) => Math.floor(date3.getTime() / 1e3);
|
|
33948
|
-
var
|
|
33949
|
-
|
|
33950
|
-
|
|
33951
|
-
|
|
33952
|
-
|
|
34789
|
+
var multipliers = {
|
|
34790
|
+
s: 1,
|
|
34791
|
+
m: 60,
|
|
34792
|
+
h: 3600,
|
|
34793
|
+
d: 86400,
|
|
34794
|
+
w: 604800,
|
|
34795
|
+
y: 31557600
|
|
34796
|
+
};
|
|
33953
34797
|
var REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
34798
|
+
var checkFailed = "check_failed";
|
|
33954
34799
|
function secs(str) {
|
|
33955
34800
|
const matched = REGEX.exec(str);
|
|
33956
34801
|
if (!matched || matched[4] && matched[1]) {
|
|
33957
34802
|
throw new TypeError("Invalid time period format");
|
|
33958
34803
|
}
|
|
33959
34804
|
const value = parseFloat(matched[2]);
|
|
33960
|
-
const
|
|
33961
|
-
let numericDate;
|
|
33962
|
-
switch (unit) {
|
|
33963
|
-
case "sec":
|
|
33964
|
-
case "secs":
|
|
33965
|
-
case "second":
|
|
33966
|
-
case "seconds":
|
|
33967
|
-
case "s":
|
|
33968
|
-
numericDate = Math.round(value);
|
|
33969
|
-
break;
|
|
33970
|
-
case "minute":
|
|
33971
|
-
case "minutes":
|
|
33972
|
-
case "min":
|
|
33973
|
-
case "mins":
|
|
33974
|
-
case "m":
|
|
33975
|
-
numericDate = Math.round(value * minute);
|
|
33976
|
-
break;
|
|
33977
|
-
case "hour":
|
|
33978
|
-
case "hours":
|
|
33979
|
-
case "hr":
|
|
33980
|
-
case "hrs":
|
|
33981
|
-
case "h":
|
|
33982
|
-
numericDate = Math.round(value * hour);
|
|
33983
|
-
break;
|
|
33984
|
-
case "day":
|
|
33985
|
-
case "days":
|
|
33986
|
-
case "d":
|
|
33987
|
-
numericDate = Math.round(value * day);
|
|
33988
|
-
break;
|
|
33989
|
-
case "week":
|
|
33990
|
-
case "weeks":
|
|
33991
|
-
case "w":
|
|
33992
|
-
numericDate = Math.round(value * week);
|
|
33993
|
-
break;
|
|
33994
|
-
default:
|
|
33995
|
-
numericDate = Math.round(value * year);
|
|
33996
|
-
break;
|
|
33997
|
-
}
|
|
34805
|
+
const numericDate = Math.round(value * multipliers[matched[3][0].toLowerCase()]);
|
|
33998
34806
|
if (matched[1] === "-" || matched[4] === "ago") {
|
|
33999
34807
|
return -numericDate;
|
|
34000
34808
|
}
|
|
@@ -34017,10 +34825,22 @@ var checkAudiencePresence = (audPayload, audOption) => {
|
|
|
34017
34825
|
return audOption.includes(audPayload);
|
|
34018
34826
|
}
|
|
34019
34827
|
if (Array.isArray(audPayload)) {
|
|
34020
|
-
return audOption.some(
|
|
34828
|
+
return audOption.some((aud) => audPayload.includes(aud));
|
|
34021
34829
|
}
|
|
34022
34830
|
return false;
|
|
34023
34831
|
};
|
|
34832
|
+
function validateNumericDate(payload, claim, required2 = false) {
|
|
34833
|
+
const value = payload[claim];
|
|
34834
|
+
if (value === void 0 && !required2)
|
|
34835
|
+
return void 0;
|
|
34836
|
+
if (typeof value !== "number") {
|
|
34837
|
+
throw new JWTClaimValidationFailed(`"${claim}" claim must be a number`, payload, claim, "invalid");
|
|
34838
|
+
}
|
|
34839
|
+
return value;
|
|
34840
|
+
}
|
|
34841
|
+
function unexpectedClaim(payload, claim) {
|
|
34842
|
+
throw new JWTClaimValidationFailed(`unexpected "${claim}" claim value`, payload, claim, checkFailed);
|
|
34843
|
+
}
|
|
34024
34844
|
function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
34025
34845
|
let payload;
|
|
34026
34846
|
try {
|
|
@@ -34032,7 +34852,7 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
|
34032
34852
|
}
|
|
34033
34853
|
const { typ } = options;
|
|
34034
34854
|
if (typ && (typeof protectedHeader.typ !== "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
|
|
34035
|
-
throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, "typ",
|
|
34855
|
+
throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, "typ", checkFailed);
|
|
34036
34856
|
}
|
|
34037
34857
|
const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
|
|
34038
34858
|
const presenceCheck = [...requiredClaims];
|
|
@@ -34045,63 +34865,53 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
|
34045
34865
|
if (issuer !== void 0)
|
|
34046
34866
|
presenceCheck.push("iss");
|
|
34047
34867
|
for (const claim of new Set(presenceCheck.reverse())) {
|
|
34048
|
-
if (!(claim
|
|
34868
|
+
if (!Object.hasOwn(payload, claim)) {
|
|
34049
34869
|
throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, "missing");
|
|
34050
34870
|
}
|
|
34051
34871
|
}
|
|
34052
34872
|
if (issuer !== void 0 && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
|
|
34053
|
-
|
|
34873
|
+
unexpectedClaim(payload, "iss");
|
|
34054
34874
|
}
|
|
34055
34875
|
if (subject !== void 0 && payload.sub !== subject) {
|
|
34056
|
-
|
|
34876
|
+
unexpectedClaim(payload, "sub");
|
|
34057
34877
|
}
|
|
34058
34878
|
if (audience !== void 0 && !checkAudiencePresence(payload.aud, typeof audience === "string" ? [audience] : audience)) {
|
|
34059
|
-
|
|
34060
|
-
}
|
|
34061
|
-
|
|
34062
|
-
|
|
34063
|
-
|
|
34064
|
-
|
|
34065
|
-
|
|
34066
|
-
|
|
34067
|
-
tolerance = options.clockTolerance;
|
|
34068
|
-
break;
|
|
34069
|
-
case "undefined":
|
|
34070
|
-
tolerance = 0;
|
|
34071
|
-
break;
|
|
34072
|
-
default:
|
|
34879
|
+
unexpectedClaim(payload, "aud");
|
|
34880
|
+
}
|
|
34881
|
+
const { clockTolerance } = options;
|
|
34882
|
+
let tolerance = 0;
|
|
34883
|
+
if (typeof clockTolerance === "string") {
|
|
34884
|
+
tolerance = secs(clockTolerance);
|
|
34885
|
+
} else if (clockTolerance !== void 0) {
|
|
34886
|
+
if (typeof clockTolerance !== "number") {
|
|
34073
34887
|
throw new TypeError("Invalid clockTolerance option type");
|
|
34888
|
+
}
|
|
34889
|
+
tolerance = clockTolerance;
|
|
34074
34890
|
}
|
|
34075
34891
|
validateInput("clockTolerance option", tolerance);
|
|
34076
34892
|
const { currentDate } = options;
|
|
34077
34893
|
const now = validateInput("currentDate option", epoch(currentDate || /* @__PURE__ */ new Date()));
|
|
34078
|
-
|
|
34079
|
-
|
|
34080
|
-
|
|
34081
|
-
|
|
34082
|
-
|
|
34083
|
-
throw new JWTClaimValidationFailed('"nbf" claim must be a number', payload, "nbf", "invalid");
|
|
34084
|
-
}
|
|
34085
|
-
if (payload.nbf > now + tolerance) {
|
|
34086
|
-
throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, "nbf", "check_failed");
|
|
34894
|
+
const iat = validateNumericDate(payload, "iat", maxTokenAge !== void 0);
|
|
34895
|
+
const nbf = validateNumericDate(payload, "nbf");
|
|
34896
|
+
if (nbf !== void 0) {
|
|
34897
|
+
if (nbf > now + tolerance) {
|
|
34898
|
+
throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, "nbf", checkFailed);
|
|
34087
34899
|
}
|
|
34088
34900
|
}
|
|
34089
|
-
|
|
34090
|
-
|
|
34091
|
-
|
|
34092
|
-
|
|
34093
|
-
if (payload.exp <= now - tolerance) {
|
|
34094
|
-
throw new JWTExpired('"exp" claim timestamp check failed', payload, "exp", "check_failed");
|
|
34901
|
+
const exp = validateNumericDate(payload, "exp");
|
|
34902
|
+
if (exp !== void 0) {
|
|
34903
|
+
if (exp <= now - tolerance) {
|
|
34904
|
+
throw new JWTExpired('"exp" claim timestamp check failed', payload, "exp", checkFailed);
|
|
34095
34905
|
}
|
|
34096
34906
|
}
|
|
34097
34907
|
if (maxTokenAge !== void 0) {
|
|
34098
|
-
const age = now -
|
|
34908
|
+
const age = now - iat;
|
|
34099
34909
|
const max = typeof maxTokenAge === "number" ? maxTokenAge : secs(maxTokenAge);
|
|
34100
34910
|
if (age - tolerance > max) {
|
|
34101
|
-
throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, "iat",
|
|
34911
|
+
throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, "iat", checkFailed);
|
|
34102
34912
|
}
|
|
34103
34913
|
if (age < 0 - tolerance) {
|
|
34104
|
-
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, "iat",
|
|
34914
|
+
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, "iat", checkFailed);
|
|
34105
34915
|
}
|
|
34106
34916
|
}
|
|
34107
34917
|
return payload;
|
|
@@ -34110,21 +34920,21 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
|
34110
34920
|
// node_modules/jose/dist/webapi/jwt/verify.js
|
|
34111
34921
|
async function jwtVerify(jwt, key, options) {
|
|
34112
34922
|
const verified = await verifyCompact(jwt, prepareVerify(options), key);
|
|
34113
|
-
if (!verified
|
|
34923
|
+
if (!verified[2]) {
|
|
34114
34924
|
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
34115
34925
|
}
|
|
34116
|
-
const payload = validateClaimsSet(verified
|
|
34117
|
-
const result = { payload, protectedHeader: verified
|
|
34926
|
+
const payload = validateClaimsSet(verified[1], verified[0], options);
|
|
34927
|
+
const result = { payload, protectedHeader: verified[1] };
|
|
34118
34928
|
if (typeof key === "function") {
|
|
34119
|
-
return { ...result, key: verified
|
|
34929
|
+
return { ...result, key: verified[3] };
|
|
34120
34930
|
}
|
|
34121
34931
|
return result;
|
|
34122
34932
|
}
|
|
34123
34933
|
|
|
34124
34934
|
// node_modules/jose/dist/webapi/jwks/local.js
|
|
34125
34935
|
function signatureAlgorithm(alg) {
|
|
34126
|
-
const entry = typeof alg === "string" ?
|
|
34127
|
-
if (!entry || entry.
|
|
34936
|
+
const entry = typeof alg === "string" ? JWS[alg] : void 0;
|
|
34937
|
+
if (!entry || entry.secret) {
|
|
34128
34938
|
throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set');
|
|
34129
34939
|
}
|
|
34130
34940
|
return entry;
|
|
@@ -34134,10 +34944,7 @@ function isJWKSLike(jwks) {
|
|
|
34134
34944
|
return false;
|
|
34135
34945
|
}
|
|
34136
34946
|
const { keys } = jwks;
|
|
34137
|
-
return Array.isArray(keys) && keys.every(
|
|
34138
|
-
}
|
|
34139
|
-
function isJWKLike(key) {
|
|
34140
|
-
return isObject2(key);
|
|
34947
|
+
return Array.isArray(keys) && keys.every(isObject2);
|
|
34141
34948
|
}
|
|
34142
34949
|
var LocalJWKSetImpl = class {
|
|
34143
34950
|
#jwks;
|
|
@@ -34154,25 +34961,7 @@ var LocalJWKSetImpl = class {
|
|
|
34154
34961
|
async getKey(protectedHeader, token) {
|
|
34155
34962
|
const { alg, kid } = { ...protectedHeader, ...token?.header };
|
|
34156
34963
|
const entry = signatureAlgorithm(alg);
|
|
34157
|
-
const candidates = this.#jwks.keys.filter((jwk2) =>
|
|
34158
|
-
let candidate = entry.kty.includes(jwk2.kty);
|
|
34159
|
-
if (candidate && typeof kid === "string") {
|
|
34160
|
-
candidate = kid === jwk2.kid;
|
|
34161
|
-
}
|
|
34162
|
-
if (candidate && (typeof jwk2.alg === "string" || jwk2.kty === "AKP")) {
|
|
34163
|
-
candidate = alg === jwk2.alg;
|
|
34164
|
-
}
|
|
34165
|
-
if (candidate && typeof jwk2.use === "string") {
|
|
34166
|
-
candidate = jwk2.use === "sig";
|
|
34167
|
-
}
|
|
34168
|
-
if (candidate && Array.isArray(jwk2.key_ops)) {
|
|
34169
|
-
candidate = jwk2.key_ops.includes("verify");
|
|
34170
|
-
}
|
|
34171
|
-
if (candidate && entry.crv) {
|
|
34172
|
-
candidate = jwk2.crv === entry.crv;
|
|
34173
|
-
}
|
|
34174
|
-
return candidate;
|
|
34175
|
-
});
|
|
34964
|
+
const candidates = this.#jwks.keys.filter((jwk2) => entry.kty.includes(jwk2.kty) && (typeof kid !== "string" || kid === jwk2.kid) && (!(typeof jwk2.alg === "string" || jwk2.kty === "AKP") || alg === jwk2.alg) && (typeof jwk2.use !== "string" || jwk2.use === "sig") && (!Array.isArray(jwk2.key_ops) || jwk2.key_ops.includes("verify")) && (!entry.crv || jwk2.crv === entry.crv));
|
|
34176
34965
|
const { 0: jwk, length } = candidates;
|
|
34177
34966
|
if (length === 0) {
|
|
34178
34967
|
throw new JWKSNoMatchingKey();
|
|
@@ -34194,7 +34983,7 @@ var LocalJWKSetImpl = class {
|
|
|
34194
34983
|
}
|
|
34195
34984
|
};
|
|
34196
34985
|
async function importWithAlgCache(cache2, jwk, entry) {
|
|
34197
|
-
const cached3 = cache2.get(jwk) || cache2.set(jwk, {}).get(jwk);
|
|
34986
|
+
const cached3 = cache2.get(jwk) || cache2.set(jwk, { __proto__: null }).get(jwk);
|
|
34198
34987
|
if (cached3[entry.alg] === void 0) {
|
|
34199
34988
|
const key = await jwkToKey(entry, { ...jwk, alg: entry.alg, ext: true });
|
|
34200
34989
|
if (key.type !== "public") {
|
|
@@ -34207,13 +34996,8 @@ async function importWithAlgCache(cache2, jwk, entry) {
|
|
|
34207
34996
|
function createLocalJWKSet(jwks) {
|
|
34208
34997
|
const set = new LocalJWKSetImpl(jwks);
|
|
34209
34998
|
const localJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
|
|
34210
|
-
Object.
|
|
34211
|
-
|
|
34212
|
-
value: () => structuredClone(set.jwks()),
|
|
34213
|
-
enumerable: false,
|
|
34214
|
-
configurable: false,
|
|
34215
|
-
writable: false
|
|
34216
|
-
}
|
|
34999
|
+
Object.defineProperty(localJWKSet, "jwks", {
|
|
35000
|
+
value: () => structuredClone(set.jwks())
|
|
34217
35001
|
});
|
|
34218
35002
|
return localJWKSet;
|
|
34219
35003
|
}
|
|
@@ -34225,7 +35009,7 @@ function isCloudflareWorkers() {
|
|
|
34225
35009
|
var USER_AGENT;
|
|
34226
35010
|
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
34227
35011
|
const NAME = "jose";
|
|
34228
|
-
const VERSION2 = "v6.2.
|
|
35012
|
+
const VERSION2 = "v6.2.8";
|
|
34229
35013
|
USER_AGENT = `${NAME}/${VERSION2}`;
|
|
34230
35014
|
}
|
|
34231
35015
|
var customFetch = Symbol();
|
|
@@ -34279,10 +35063,11 @@ var RemoteJWKSetImpl = class {
|
|
|
34279
35063
|
throw new TypeError("url must be an instance of URL");
|
|
34280
35064
|
}
|
|
34281
35065
|
this.#url = new URL(url.href);
|
|
34282
|
-
|
|
34283
|
-
this.#
|
|
34284
|
-
this.#
|
|
34285
|
-
this.#
|
|
35066
|
+
const opts = options ?? {};
|
|
35067
|
+
this.#timeoutDuration = typeof opts.timeoutDuration === "number" ? opts.timeoutDuration : 5e3;
|
|
35068
|
+
this.#cooldownDuration = typeof opts.cooldownDuration === "number" ? opts.cooldownDuration : 3e4;
|
|
35069
|
+
this.#cacheMaxAge = typeof opts.cacheMaxAge === "number" ? opts.cacheMaxAge : 6e5;
|
|
35070
|
+
this.#headers = new Headers(opts.headers);
|
|
34286
35071
|
if (USER_AGENT && !this.#headers.has("User-Agent")) {
|
|
34287
35072
|
this.#headers.set("User-Agent", USER_AGENT);
|
|
34288
35073
|
}
|
|
@@ -34290,10 +35075,11 @@ var RemoteJWKSetImpl = class {
|
|
|
34290
35075
|
this.#headers.set("accept", "application/json");
|
|
34291
35076
|
this.#headers.append("accept", "application/jwk-set+json");
|
|
34292
35077
|
}
|
|
34293
|
-
this.#customFetch =
|
|
34294
|
-
|
|
34295
|
-
|
|
34296
|
-
|
|
35078
|
+
this.#customFetch = opts[customFetch];
|
|
35079
|
+
const cache2 = opts[jwksCache];
|
|
35080
|
+
if (cache2 !== void 0) {
|
|
35081
|
+
this.#cache = cache2;
|
|
35082
|
+
if (isFreshJwksCache(cache2, this.#cacheMaxAge)) {
|
|
34297
35083
|
this.#jwksTimestamp = this.#cache.uat;
|
|
34298
35084
|
this.#local = createLocalJWKSet(this.#cache.jwks);
|
|
34299
35085
|
}
|
|
@@ -34302,11 +35088,14 @@ var RemoteJWKSetImpl = class {
|
|
|
34302
35088
|
pendingFetch() {
|
|
34303
35089
|
return !!this.#pendingFetch;
|
|
34304
35090
|
}
|
|
35091
|
+
#validFor(duration3) {
|
|
35092
|
+
return typeof this.#jwksTimestamp === "number" && Date.now() < this.#jwksTimestamp + duration3;
|
|
35093
|
+
}
|
|
34305
35094
|
coolingDown() {
|
|
34306
|
-
return
|
|
35095
|
+
return this.#validFor(this.#cooldownDuration);
|
|
34307
35096
|
}
|
|
34308
35097
|
fresh() {
|
|
34309
|
-
return
|
|
35098
|
+
return this.#validFor(this.#cacheMaxAge);
|
|
34310
35099
|
}
|
|
34311
35100
|
jwks() {
|
|
34312
35101
|
return this.#local?.jwks();
|
|
@@ -34338,10 +35127,8 @@ var RemoteJWKSetImpl = class {
|
|
|
34338
35127
|
this.#cache.jwks = json;
|
|
34339
35128
|
}
|
|
34340
35129
|
this.#jwksTimestamp = Date.now();
|
|
35130
|
+
}).finally(() => {
|
|
34341
35131
|
this.#pendingFetch = void 0;
|
|
34342
|
-
}).catch((err) => {
|
|
34343
|
-
this.#pendingFetch = void 0;
|
|
34344
|
-
throw err;
|
|
34345
35132
|
});
|
|
34346
35133
|
await this.#pendingFetch;
|
|
34347
35134
|
}
|
|
@@ -34352,30 +35139,23 @@ function createRemoteJWKSet(url, options) {
|
|
|
34352
35139
|
Object.defineProperties(remoteJWKSet, {
|
|
34353
35140
|
coolingDown: {
|
|
34354
35141
|
get: () => set.coolingDown(),
|
|
34355
|
-
enumerable: true
|
|
34356
|
-
configurable: false
|
|
35142
|
+
enumerable: true
|
|
34357
35143
|
},
|
|
34358
35144
|
fresh: {
|
|
34359
35145
|
get: () => set.fresh(),
|
|
34360
|
-
enumerable: true
|
|
34361
|
-
configurable: false
|
|
35146
|
+
enumerable: true
|
|
34362
35147
|
},
|
|
34363
35148
|
reload: {
|
|
34364
35149
|
value: () => set.reload(),
|
|
34365
|
-
enumerable: true
|
|
34366
|
-
configurable: false,
|
|
34367
|
-
writable: false
|
|
35150
|
+
enumerable: true
|
|
34368
35151
|
},
|
|
34369
35152
|
reloading: {
|
|
34370
35153
|
get: () => set.pendingFetch(),
|
|
34371
|
-
enumerable: true
|
|
34372
|
-
configurable: false
|
|
35154
|
+
enumerable: true
|
|
34373
35155
|
},
|
|
34374
35156
|
jwks: {
|
|
34375
35157
|
value: () => set.jwks(),
|
|
34376
|
-
enumerable: true
|
|
34377
|
-
configurable: false,
|
|
34378
|
-
writable: false
|
|
35158
|
+
enumerable: true
|
|
34379
35159
|
}
|
|
34380
35160
|
});
|
|
34381
35161
|
return remoteJWKSet;
|
|
@@ -36697,6 +37477,8 @@ var STATELESS_SUPPORTED_VERSIONS = [
|
|
|
36697
37477
|
];
|
|
36698
37478
|
var STATELESS_SERVER_INFO_KEY = "io.modelcontextprotocol/serverInfo";
|
|
36699
37479
|
var STATELESS_LOG_LEVEL_KEY = "io.modelcontextprotocol/logLevel";
|
|
37480
|
+
var TRACEPARENT_KEY = "traceparent";
|
|
37481
|
+
var TRACESTATE_KEY2 = "tracestate";
|
|
36700
37482
|
var SPEC_2026_07_28 = "2026-07-28";
|
|
36701
37483
|
var TASKS_EXTENSION_ID = "io.modelcontextprotocol/tasks";
|
|
36702
37484
|
var STATELESS_FALLBACK_VERSION = "2026-07-28";
|
|
@@ -36704,6 +37486,13 @@ var JSONRPC_INVALID_PARAMS = ErrorCode.InvalidParams;
|
|
|
36704
37486
|
var MCP_HEADER_MISMATCH = -32020;
|
|
36705
37487
|
var MCP_MISSING_REQUIRED_CLIENT_CAPABILITY = -32021;
|
|
36706
37488
|
var MCP_UNSUPPORTED_PROTOCOL_VERSION = -32022;
|
|
37489
|
+
function readTraceContext(meta2) {
|
|
37490
|
+
const traceContext = parseTraceParent(
|
|
37491
|
+
meta2[TRACEPARENT_KEY],
|
|
37492
|
+
meta2[TRACESTATE_KEY2]
|
|
37493
|
+
);
|
|
37494
|
+
return traceContext ? { traceContext } : {};
|
|
37495
|
+
}
|
|
36707
37496
|
var MCP_LOG_LEVELS = [
|
|
36708
37497
|
"debug",
|
|
36709
37498
|
"info",
|
|
@@ -36998,15 +37787,63 @@ var McpApp = class {
|
|
|
36998
37787
|
async (request) => {
|
|
36999
37788
|
const toolName = request.params.name;
|
|
37000
37789
|
const args = request.params.arguments || {};
|
|
37790
|
+
const meta2 = request.params._meta;
|
|
37791
|
+
const clientMeta = isRecord5(meta2) ? {
|
|
37792
|
+
...readTraceContext(meta2),
|
|
37793
|
+
...readLogLevel(meta2) !== void 0 ? { logLevel: readLogLevel(meta2) } : {}
|
|
37794
|
+
} : void 0;
|
|
37001
37795
|
let result;
|
|
37002
37796
|
try {
|
|
37003
|
-
result = await this.executeToolCall(
|
|
37797
|
+
result = await this.executeToolCall(
|
|
37798
|
+
toolName,
|
|
37799
|
+
args,
|
|
37800
|
+
void 0,
|
|
37801
|
+
void 0,
|
|
37802
|
+
void 0,
|
|
37803
|
+
clientMeta
|
|
37804
|
+
);
|
|
37004
37805
|
} catch (error2) {
|
|
37005
37806
|
return this.handleToolError(error2, toolName);
|
|
37006
37807
|
}
|
|
37007
37808
|
return this.buildToolCallResult(toolName, result);
|
|
37008
37809
|
}
|
|
37009
37810
|
);
|
|
37811
|
+
server.fallbackRequestHandler = (request) => {
|
|
37812
|
+
if (request.method !== "server/discover") {
|
|
37813
|
+
throw new McpError(ErrorCode.MethodNotFound, "Method not found");
|
|
37814
|
+
}
|
|
37815
|
+
return Promise.resolve(this.buildDiscoverResult());
|
|
37816
|
+
};
|
|
37817
|
+
}
|
|
37818
|
+
/**
|
|
37819
|
+
* The `server/discover` result (spec 2026-07-28, SEP-2575).
|
|
37820
|
+
*
|
|
37821
|
+
* Single source of truth for both transports. They used to be one inline
|
|
37822
|
+
* object on the HTTP path; a stdio copy would have been the second place to
|
|
37823
|
+
* forget `instructions` or a new capability.
|
|
37824
|
+
*
|
|
37825
|
+
* Always stamped as 2026-07-28 regardless of what the transport negotiated.
|
|
37826
|
+
* That is deliberate but not free: nothing gates the method, so a peer that
|
|
37827
|
+
* negotiated `2025-11-25` over stdio can call it and receive an envelope it
|
|
37828
|
+
* never agreed to. The alternative is worse — stamping the negotiated version
|
|
37829
|
+
* would make the probe answer "2025" to the client asking whether this server
|
|
37830
|
+
* speaks 2026, which is the one question it exists to answer. Treat
|
|
37831
|
+
* `server/discover` as a cross-version exception: its result describes what
|
|
37832
|
+
* the server supports, not what the current transport negotiated.
|
|
37833
|
+
*/
|
|
37834
|
+
buildDiscoverResult() {
|
|
37835
|
+
return this.stampResult(
|
|
37836
|
+
this.withCacheHints({
|
|
37837
|
+
supportedVersions: [...STATELESS_SUPPORTED_VERSIONS],
|
|
37838
|
+
capabilities: this.buildServerCapabilities(),
|
|
37839
|
+
serverInfo: {
|
|
37840
|
+
name: this.options.name,
|
|
37841
|
+
version: this.options.version
|
|
37842
|
+
},
|
|
37843
|
+
...this.options.instructions ? { instructions: this.options.instructions } : {}
|
|
37844
|
+
}, SPEC_2026_07_28),
|
|
37845
|
+
SPEC_2026_07_28
|
|
37846
|
+
);
|
|
37010
37847
|
}
|
|
37011
37848
|
/**
|
|
37012
37849
|
* Register tools with their handlers
|
|
@@ -37054,15 +37891,15 @@ var McpApp = class {
|
|
|
37054
37891
|
* leave a half-registered tool behind.
|
|
37055
37892
|
*/
|
|
37056
37893
|
indexMirroredParams(tool) {
|
|
37057
|
-
const
|
|
37894
|
+
const invalid2 = [];
|
|
37058
37895
|
const mirrored = collectMirroredParams(
|
|
37059
37896
|
tool.inputSchema,
|
|
37060
|
-
(reason) =>
|
|
37897
|
+
(reason) => invalid2.push(reason)
|
|
37061
37898
|
);
|
|
37062
|
-
if (
|
|
37899
|
+
if (invalid2.length > 0) {
|
|
37063
37900
|
throw new Error(
|
|
37064
37901
|
`[McpApp] Tool "${tool.name}" has invalid x-mcp-header annotations:
|
|
37065
|
-
` +
|
|
37902
|
+
` + invalid2.map((r) => ` - ${r}`).join("\n")
|
|
37066
37903
|
);
|
|
37067
37904
|
}
|
|
37068
37905
|
if (mirrored.length > 0) this.mirroredParams.set(tool.name, mirrored);
|
|
@@ -37262,12 +38099,16 @@ var McpApp = class {
|
|
|
37262
38099
|
...mrtr?.inputResponses !== void 0 ? { inputResponses: mrtr.inputResponses } : {},
|
|
37263
38100
|
...mrtr?.retryVerified !== void 0 ? { retryVerified: mrtr.retryVerified } : {}
|
|
37264
38101
|
};
|
|
37265
|
-
const span = startToolCallSpan(
|
|
37266
|
-
|
|
37267
|
-
|
|
37268
|
-
|
|
37269
|
-
|
|
37270
|
-
|
|
38102
|
+
const span = startToolCallSpan(
|
|
38103
|
+
toolName,
|
|
38104
|
+
{
|
|
38105
|
+
"mcp.tool.name": toolName,
|
|
38106
|
+
"mcp.server.name": this.options.name,
|
|
38107
|
+
"mcp.transport": request ? "http" : "stdio",
|
|
38108
|
+
"mcp.session.id": sessionId
|
|
38109
|
+
},
|
|
38110
|
+
clientMeta?.traceContext
|
|
38111
|
+
);
|
|
37271
38112
|
const queueMetrics = this.requestQueue.getMetrics();
|
|
37272
38113
|
this.serverMetrics.setGauges({
|
|
37273
38114
|
activeRequests: queueMetrics.inFlight,
|
|
@@ -37715,14 +38556,14 @@ var McpApp = class {
|
|
|
37715
38556
|
return { allowed: true, retryAfterMs: 0 };
|
|
37716
38557
|
}
|
|
37717
38558
|
const ip = getClientIpFromHeaders(request.headers);
|
|
37718
|
-
const
|
|
38559
|
+
const context2 = {
|
|
37719
38560
|
ip,
|
|
37720
38561
|
method: request.method,
|
|
37721
38562
|
path: new URL(request.url).pathname,
|
|
37722
38563
|
headers: overrideHeaders ?? request.headers,
|
|
37723
38564
|
sessionId
|
|
37724
38565
|
};
|
|
37725
|
-
const key = httpRateLimit.keyExtractor?.(
|
|
38566
|
+
const key = httpRateLimit.keyExtractor?.(context2) ?? ip;
|
|
37726
38567
|
const behavior = httpRateLimit.onLimitExceeded ?? "reject";
|
|
37727
38568
|
if (behavior === "wait") {
|
|
37728
38569
|
try {
|
|
@@ -37920,18 +38761,7 @@ var McpApp = class {
|
|
|
37920
38761
|
return c.json({
|
|
37921
38762
|
jsonrpc: "2.0",
|
|
37922
38763
|
id,
|
|
37923
|
-
result: this.
|
|
37924
|
-
this.withCacheHints({
|
|
37925
|
-
supportedVersions: [...STATELESS_SUPPORTED_VERSIONS],
|
|
37926
|
-
capabilities: this.buildServerCapabilities(),
|
|
37927
|
-
serverInfo: {
|
|
37928
|
-
name: this.options.name,
|
|
37929
|
-
version: this.options.version
|
|
37930
|
-
},
|
|
37931
|
-
...this.options.instructions ? { instructions: this.options.instructions } : {}
|
|
37932
|
-
}, statelessVersion),
|
|
37933
|
-
statelessVersion
|
|
37934
|
-
)
|
|
38764
|
+
result: this.buildDiscoverResult()
|
|
37935
38765
|
});
|
|
37936
38766
|
}
|
|
37937
38767
|
if (method === "initialize") {
|
|
@@ -37969,7 +38799,8 @@ var McpApp = class {
|
|
|
37969
38799
|
const statelessClientMeta = isRecord5(params) && isRecord5(params["_meta"]) ? {
|
|
37970
38800
|
clientInfo: params["_meta"][STATELESS_CLIENT_INFO_KEY],
|
|
37971
38801
|
clientCapabilities: params["_meta"][STATELESS_CLIENT_CAPABILITIES_KEY],
|
|
37972
|
-
logLevel: readLogLevel(params["_meta"])
|
|
38802
|
+
logLevel: readLogLevel(params["_meta"]),
|
|
38803
|
+
...readTraceContext(params["_meta"])
|
|
37973
38804
|
} : void 0;
|
|
37974
38805
|
const mrtrEnabled = true;
|
|
37975
38806
|
const ingressDigest = mrtrEnabled ? await paramsDigest({ arguments: args, name: toolName }) : "";
|
|
@@ -38545,7 +39376,7 @@ var McpApp = class {
|
|
|
38545
39376
|
400
|
|
38546
39377
|
);
|
|
38547
39378
|
}
|
|
38548
|
-
const
|
|
39379
|
+
const store = this.taskStore;
|
|
38549
39380
|
const guard = this.requireTasksCapability(
|
|
38550
39381
|
isRecord5(params) && isRecord5(params["_meta"]) ? params["_meta"][STATELESS_CLIENT_CAPABILITIES_KEY] : void 0,
|
|
38551
39382
|
id
|
|
@@ -38585,7 +39416,7 @@ var McpApp = class {
|
|
|
38585
39416
|
);
|
|
38586
39417
|
}
|
|
38587
39418
|
if (method === "tasks/get") {
|
|
38588
|
-
const task =
|
|
39419
|
+
const task = store.get(taskId, caller);
|
|
38589
39420
|
if (task === null) {
|
|
38590
39421
|
return c.json({
|
|
38591
39422
|
jsonrpc: "2.0",
|
|
@@ -38617,7 +39448,7 @@ var McpApp = class {
|
|
|
38617
39448
|
400
|
|
38618
39449
|
);
|
|
38619
39450
|
}
|
|
38620
|
-
if (!
|
|
39451
|
+
if (!store.update(taskId, responses, caller)) {
|
|
38621
39452
|
return c.json({
|
|
38622
39453
|
jsonrpc: "2.0",
|
|
38623
39454
|
id,
|
|
@@ -38633,7 +39464,7 @@ var McpApp = class {
|
|
|
38633
39464
|
result: this.stampResult({}, statelessVersion)
|
|
38634
39465
|
});
|
|
38635
39466
|
}
|
|
38636
|
-
if (!
|
|
39467
|
+
if (!store.cancel(taskId, caller)) {
|
|
38637
39468
|
return c.json({
|
|
38638
39469
|
jsonrpc: "2.0",
|
|
38639
39470
|
id,
|
|
@@ -39110,7 +39941,7 @@ var McpApp = class {
|
|
|
39110
39941
|
* A violation is the server author's bug, so it surfaces as `-32603` rather
|
|
39111
39942
|
* than being emitted as an invalid MRTR result for the client to puzzle over.
|
|
39112
39943
|
*/
|
|
39113
|
-
async buildInputRequiredResult(signal,
|
|
39944
|
+
async buildInputRequiredResult(signal, context2) {
|
|
39114
39945
|
const requests = signal.inputRequests;
|
|
39115
39946
|
if (requests !== void 0 && !isRecord5(requests)) {
|
|
39116
39947
|
return {
|
|
@@ -39131,7 +39962,7 @@ var McpApp = class {
|
|
|
39131
39962
|
if (hasRequests) {
|
|
39132
39963
|
const check = checkInputRequestCapabilities(
|
|
39133
39964
|
requests,
|
|
39134
|
-
|
|
39965
|
+
context2.clientCapabilities
|
|
39135
39966
|
);
|
|
39136
39967
|
if (!check.ok) {
|
|
39137
39968
|
if (check.kind === "malformed") {
|
|
@@ -39177,9 +40008,9 @@ var McpApp = class {
|
|
|
39177
40008
|
if (key !== null) {
|
|
39178
40009
|
const ttl = this.options.mrtr?.defaultTtlSecs ?? 300;
|
|
39179
40010
|
requestState = await sealRequestState({
|
|
39180
|
-
sub:
|
|
39181
|
-
method:
|
|
39182
|
-
paramsDigest:
|
|
40011
|
+
sub: context2.principal,
|
|
40012
|
+
method: context2.method,
|
|
40013
|
+
paramsDigest: context2.paramsDigest,
|
|
39183
40014
|
exp: Math.floor(Date.now() / 1e3) + ttl,
|
|
39184
40015
|
nonce: bytesToHexLocal(crypto.getRandomValues(new Uint8Array(16)))
|
|
39185
40016
|
}, key);
|
|
@@ -48064,8 +48895,8 @@ function getToolByName(name) {
|
|
|
48064
48895
|
function linkDisambiguationRequestKey(inputPath) {
|
|
48065
48896
|
return `link-disambiguation:${inputPath}`;
|
|
48066
48897
|
}
|
|
48067
|
-
function supportsElicitation(
|
|
48068
|
-
return
|
|
48898
|
+
function supportsElicitation(context2) {
|
|
48899
|
+
return context2?.clientCapabilities?.elicitation !== void 0;
|
|
48069
48900
|
}
|
|
48070
48901
|
function isRecord6(value) {
|
|
48071
48902
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -48099,16 +48930,16 @@ function buildInputRequiredSignal(ambiguity, inputPath) {
|
|
|
48099
48930
|
}
|
|
48100
48931
|
};
|
|
48101
48932
|
}
|
|
48102
|
-
function selectedRecordId(ambiguity, inputPath,
|
|
48103
|
-
const hasRetryContext =
|
|
48933
|
+
function selectedRecordId(ambiguity, inputPath, context2) {
|
|
48934
|
+
const hasRetryContext = context2?.inputResponses !== void 0 || context2?.retryVerified !== void 0;
|
|
48104
48935
|
if (!hasRetryContext) return void 0;
|
|
48105
|
-
if (
|
|
48936
|
+
if (context2?.retryVerified !== true) {
|
|
48106
48937
|
throw new Error(
|
|
48107
48938
|
"[link-disambiguation] Refusing to use an unverified MRTR response."
|
|
48108
48939
|
);
|
|
48109
48940
|
}
|
|
48110
48941
|
const key = linkDisambiguationRequestKey(inputPath);
|
|
48111
|
-
const response =
|
|
48942
|
+
const response = context2.inputResponses?.[key];
|
|
48112
48943
|
if (!isRecord6(response)) {
|
|
48113
48944
|
throw new Error(
|
|
48114
48945
|
`[link-disambiguation] Missing or invalid response for "${key}".`
|