@mastra/mcp 2.9.0-alpha.3 → 2.9.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +38 -38
- package/dist/docs/references/docs-connections-mcp.md +2 -0
- package/dist/index.cjs +302 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +302 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -1330,7 +1330,7 @@ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin$1(((exports, mo
|
|
|
1330
1330
|
return str.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
1331
1331
|
}
|
|
1332
1332
|
}));
|
|
1333
|
-
// ../schema-compat/dist/json-schema-
|
|
1333
|
+
// ../schema-compat/dist/json-schema-Ln9bxqtn.js
|
|
1334
1334
|
var require_code$1 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
1335
1335
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1336
1336
|
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
|
@@ -8170,8 +8170,303 @@ var require__2020 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
8170
8170
|
}
|
|
8171
8171
|
});
|
|
8172
8172
|
}));
|
|
8173
|
+
var require_formats = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
8174
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8175
|
+
exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
|
|
8176
|
+
function fmtDef(validate, compare) {
|
|
8177
|
+
return {
|
|
8178
|
+
validate,
|
|
8179
|
+
compare
|
|
8180
|
+
};
|
|
8181
|
+
}
|
|
8182
|
+
exports.fullFormats = {
|
|
8183
|
+
date: fmtDef(date, compareDate),
|
|
8184
|
+
time: fmtDef(getTime(true), compareTime),
|
|
8185
|
+
"date-time": fmtDef(getDateTime(true), compareDateTime),
|
|
8186
|
+
"iso-time": fmtDef(getTime(), compareIsoTime),
|
|
8187
|
+
"iso-date-time": fmtDef(getDateTime(), compareIsoDateTime),
|
|
8188
|
+
duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
|
|
8189
|
+
uri,
|
|
8190
|
+
"uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,
|
|
8191
|
+
"uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,
|
|
8192
|
+
url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,
|
|
8193
|
+
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
|
8194
|
+
hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,
|
|
8195
|
+
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,
|
|
8196
|
+
ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
|
|
8197
|
+
regex,
|
|
8198
|
+
uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
|
|
8199
|
+
"json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/,
|
|
8200
|
+
"json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,
|
|
8201
|
+
"relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,
|
|
8202
|
+
byte,
|
|
8203
|
+
int32: {
|
|
8204
|
+
type: "number",
|
|
8205
|
+
validate: validateInt32
|
|
8206
|
+
},
|
|
8207
|
+
int64: {
|
|
8208
|
+
type: "number",
|
|
8209
|
+
validate: validateInt64
|
|
8210
|
+
},
|
|
8211
|
+
float: {
|
|
8212
|
+
type: "number",
|
|
8213
|
+
validate: validateNumber
|
|
8214
|
+
},
|
|
8215
|
+
double: {
|
|
8216
|
+
type: "number",
|
|
8217
|
+
validate: validateNumber
|
|
8218
|
+
},
|
|
8219
|
+
password: true,
|
|
8220
|
+
binary: true
|
|
8221
|
+
};
|
|
8222
|
+
exports.fastFormats = {
|
|
8223
|
+
...exports.fullFormats,
|
|
8224
|
+
date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate),
|
|
8225
|
+
time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime),
|
|
8226
|
+
"date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime),
|
|
8227
|
+
"iso-time": fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoTime),
|
|
8228
|
+
"iso-date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoDateTime),
|
|
8229
|
+
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
|
8230
|
+
"uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
|
8231
|
+
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
|
|
8232
|
+
};
|
|
8233
|
+
exports.formatNames = Object.keys(exports.fullFormats);
|
|
8234
|
+
function isLeapYear(year) {
|
|
8235
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
8236
|
+
}
|
|
8237
|
+
const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
8238
|
+
const DAYS = [
|
|
8239
|
+
0,
|
|
8240
|
+
31,
|
|
8241
|
+
28,
|
|
8242
|
+
31,
|
|
8243
|
+
30,
|
|
8244
|
+
31,
|
|
8245
|
+
30,
|
|
8246
|
+
31,
|
|
8247
|
+
31,
|
|
8248
|
+
30,
|
|
8249
|
+
31,
|
|
8250
|
+
30,
|
|
8251
|
+
31
|
|
8252
|
+
];
|
|
8253
|
+
function date(str) {
|
|
8254
|
+
const matches = DATE.exec(str);
|
|
8255
|
+
if (!matches) return false;
|
|
8256
|
+
const year = +matches[1];
|
|
8257
|
+
const month = +matches[2];
|
|
8258
|
+
const day = +matches[3];
|
|
8259
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
|
8260
|
+
}
|
|
8261
|
+
function compareDate(d1, d2) {
|
|
8262
|
+
if (!(d1 && d2)) return void 0;
|
|
8263
|
+
if (d1 > d2) return 1;
|
|
8264
|
+
if (d1 < d2) return -1;
|
|
8265
|
+
return 0;
|
|
8266
|
+
}
|
|
8267
|
+
const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
8268
|
+
function getTime(strictTimeZone) {
|
|
8269
|
+
return function time(str) {
|
|
8270
|
+
const matches = TIME.exec(str);
|
|
8271
|
+
if (!matches) return false;
|
|
8272
|
+
const hr = +matches[1];
|
|
8273
|
+
const min = +matches[2];
|
|
8274
|
+
const sec = +matches[3];
|
|
8275
|
+
const tz = matches[4];
|
|
8276
|
+
const tzSign = matches[5] === "-" ? -1 : 1;
|
|
8277
|
+
const tzH = +(matches[6] || 0);
|
|
8278
|
+
const tzM = +(matches[7] || 0);
|
|
8279
|
+
if (tzH > 23 || tzM > 59 || strictTimeZone && !tz) return false;
|
|
8280
|
+
if (hr <= 23 && min <= 59 && sec < 60) return true;
|
|
8281
|
+
const utcMin = min - tzM * tzSign;
|
|
8282
|
+
const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
|
|
8283
|
+
return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
|
|
8284
|
+
};
|
|
8285
|
+
}
|
|
8286
|
+
function compareTime(s1, s2) {
|
|
8287
|
+
if (!(s1 && s2)) return void 0;
|
|
8288
|
+
const t1 = (/* @__PURE__ */ new Date("2020-01-01T" + s1)).valueOf();
|
|
8289
|
+
const t2 = (/* @__PURE__ */ new Date("2020-01-01T" + s2)).valueOf();
|
|
8290
|
+
if (!(t1 && t2)) return void 0;
|
|
8291
|
+
return t1 - t2;
|
|
8292
|
+
}
|
|
8293
|
+
function compareIsoTime(t1, t2) {
|
|
8294
|
+
if (!(t1 && t2)) return void 0;
|
|
8295
|
+
const a1 = TIME.exec(t1);
|
|
8296
|
+
const a2 = TIME.exec(t2);
|
|
8297
|
+
if (!(a1 && a2)) return void 0;
|
|
8298
|
+
t1 = a1[1] + a1[2] + a1[3];
|
|
8299
|
+
t2 = a2[1] + a2[2] + a2[3];
|
|
8300
|
+
if (t1 > t2) return 1;
|
|
8301
|
+
if (t1 < t2) return -1;
|
|
8302
|
+
return 0;
|
|
8303
|
+
}
|
|
8304
|
+
const DATE_TIME_SEPARATOR = /t|\s/i;
|
|
8305
|
+
function getDateTime(strictTimeZone) {
|
|
8306
|
+
const time = getTime(strictTimeZone);
|
|
8307
|
+
return function date_time(str) {
|
|
8308
|
+
const dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
8309
|
+
return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]);
|
|
8310
|
+
};
|
|
8311
|
+
}
|
|
8312
|
+
function compareDateTime(dt1, dt2) {
|
|
8313
|
+
if (!(dt1 && dt2)) return void 0;
|
|
8314
|
+
const d1 = new Date(dt1).valueOf();
|
|
8315
|
+
const d2 = new Date(dt2).valueOf();
|
|
8316
|
+
if (!(d1 && d2)) return void 0;
|
|
8317
|
+
return d1 - d2;
|
|
8318
|
+
}
|
|
8319
|
+
function compareIsoDateTime(dt1, dt2) {
|
|
8320
|
+
if (!(dt1 && dt2)) return void 0;
|
|
8321
|
+
const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);
|
|
8322
|
+
const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);
|
|
8323
|
+
const res = compareDate(d1, d2);
|
|
8324
|
+
if (res === void 0) return void 0;
|
|
8325
|
+
return res || compareTime(t1, t2);
|
|
8326
|
+
}
|
|
8327
|
+
const NOT_URI_FRAGMENT = /\/|:/;
|
|
8328
|
+
const URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
8329
|
+
function uri(str) {
|
|
8330
|
+
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
|
8331
|
+
}
|
|
8332
|
+
const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
8333
|
+
function byte(str) {
|
|
8334
|
+
BYTE.lastIndex = 0;
|
|
8335
|
+
return BYTE.test(str);
|
|
8336
|
+
}
|
|
8337
|
+
const MIN_INT32 = -(2 ** 31);
|
|
8338
|
+
const MAX_INT32 = 2 ** 31 - 1;
|
|
8339
|
+
function validateInt32(value) {
|
|
8340
|
+
return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32;
|
|
8341
|
+
}
|
|
8342
|
+
function validateInt64(value) {
|
|
8343
|
+
return Number.isInteger(value);
|
|
8344
|
+
}
|
|
8345
|
+
function validateNumber() {
|
|
8346
|
+
return true;
|
|
8347
|
+
}
|
|
8348
|
+
const Z_ANCHOR = /[^\\]\\Z/;
|
|
8349
|
+
function regex(str) {
|
|
8350
|
+
if (Z_ANCHOR.test(str)) return false;
|
|
8351
|
+
try {
|
|
8352
|
+
new RegExp(str);
|
|
8353
|
+
return true;
|
|
8354
|
+
} catch (e) {
|
|
8355
|
+
return false;
|
|
8356
|
+
}
|
|
8357
|
+
}
|
|
8358
|
+
}));
|
|
8359
|
+
var require_limit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
8360
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8361
|
+
exports.formatLimitDefinition = void 0;
|
|
8362
|
+
const ajv_1 = require_ajv();
|
|
8363
|
+
const codegen_1 = require_codegen();
|
|
8364
|
+
const ops = codegen_1.operators;
|
|
8365
|
+
const KWDs = {
|
|
8366
|
+
formatMaximum: {
|
|
8367
|
+
okStr: "<=",
|
|
8368
|
+
ok: ops.LTE,
|
|
8369
|
+
fail: ops.GT
|
|
8370
|
+
},
|
|
8371
|
+
formatMinimum: {
|
|
8372
|
+
okStr: ">=",
|
|
8373
|
+
ok: ops.GTE,
|
|
8374
|
+
fail: ops.LT
|
|
8375
|
+
},
|
|
8376
|
+
formatExclusiveMaximum: {
|
|
8377
|
+
okStr: "<",
|
|
8378
|
+
ok: ops.LT,
|
|
8379
|
+
fail: ops.GTE
|
|
8380
|
+
},
|
|
8381
|
+
formatExclusiveMinimum: {
|
|
8382
|
+
okStr: ">",
|
|
8383
|
+
ok: ops.GT,
|
|
8384
|
+
fail: ops.LTE
|
|
8385
|
+
}
|
|
8386
|
+
};
|
|
8387
|
+
exports.formatLimitDefinition = {
|
|
8388
|
+
keyword: Object.keys(KWDs),
|
|
8389
|
+
type: "string",
|
|
8390
|
+
schemaType: "string",
|
|
8391
|
+
$data: true,
|
|
8392
|
+
error: {
|
|
8393
|
+
message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`,
|
|
8394
|
+
params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
|
|
8395
|
+
},
|
|
8396
|
+
code(cxt) {
|
|
8397
|
+
const { gen, data, schemaCode, keyword, it } = cxt;
|
|
8398
|
+
const { opts, self } = it;
|
|
8399
|
+
if (!opts.validateFormats) return;
|
|
8400
|
+
const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format");
|
|
8401
|
+
if (fCxt.$data) validate$DataFormat();
|
|
8402
|
+
else validateFormat();
|
|
8403
|
+
function validate$DataFormat() {
|
|
8404
|
+
const fmts = gen.scopeValue("formats", {
|
|
8405
|
+
ref: self.formats,
|
|
8406
|
+
code: opts.code.formats
|
|
8407
|
+
});
|
|
8408
|
+
const fmt = gen.const("fmt", (0, codegen_1._)`${fmts}[${fCxt.schemaCode}]`);
|
|
8409
|
+
cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt} != "object"`, (0, codegen_1._)`${fmt} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt}.compare != "function"`, compareCode(fmt)));
|
|
8410
|
+
}
|
|
8411
|
+
function validateFormat() {
|
|
8412
|
+
const format = fCxt.schema;
|
|
8413
|
+
const fmtDef = self.formats[format];
|
|
8414
|
+
if (!fmtDef || fmtDef === true) return;
|
|
8415
|
+
if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
|
|
8416
|
+
const fmt = gen.scopeValue("formats", {
|
|
8417
|
+
key: format,
|
|
8418
|
+
ref: fmtDef,
|
|
8419
|
+
code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : void 0
|
|
8420
|
+
});
|
|
8421
|
+
cxt.fail$data(compareCode(fmt));
|
|
8422
|
+
}
|
|
8423
|
+
function compareCode(fmt) {
|
|
8424
|
+
return (0, codegen_1._)`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;
|
|
8425
|
+
}
|
|
8426
|
+
},
|
|
8427
|
+
dependencies: ["format"]
|
|
8428
|
+
};
|
|
8429
|
+
const formatLimitPlugin = (ajv) => {
|
|
8430
|
+
ajv.addKeyword(exports.formatLimitDefinition);
|
|
8431
|
+
return ajv;
|
|
8432
|
+
};
|
|
8433
|
+
exports.default = formatLimitPlugin;
|
|
8434
|
+
}));
|
|
8435
|
+
var require_dist = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
8436
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8437
|
+
const formats_1 = require_formats();
|
|
8438
|
+
const limit_1 = require_limit();
|
|
8439
|
+
const codegen_1 = require_codegen();
|
|
8440
|
+
const fullName = new codegen_1.Name("fullFormats");
|
|
8441
|
+
const fastName = new codegen_1.Name("fastFormats");
|
|
8442
|
+
const formatsPlugin = (ajv, opts = { keywords: true }) => {
|
|
8443
|
+
if (Array.isArray(opts)) {
|
|
8444
|
+
addFormats(ajv, opts, formats_1.fullFormats, fullName);
|
|
8445
|
+
return ajv;
|
|
8446
|
+
}
|
|
8447
|
+
const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName];
|
|
8448
|
+
addFormats(ajv, opts.formats || formats_1.formatNames, formats, exportName);
|
|
8449
|
+
if (opts.keywords) (0, limit_1.default)(ajv);
|
|
8450
|
+
return ajv;
|
|
8451
|
+
};
|
|
8452
|
+
formatsPlugin.get = (name, mode = "full") => {
|
|
8453
|
+
const f = (mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats)[name];
|
|
8454
|
+
if (!f) throw new Error(`Unknown format "${name}"`);
|
|
8455
|
+
return f;
|
|
8456
|
+
};
|
|
8457
|
+
function addFormats(ajv, list, fs, exportName) {
|
|
8458
|
+
var _a;
|
|
8459
|
+
var _b;
|
|
8460
|
+
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
|
|
8461
|
+
for (const f of list) ajv.addFormat(f, fs[f]);
|
|
8462
|
+
}
|
|
8463
|
+
module.exports = exports = formatsPlugin;
|
|
8464
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8465
|
+
exports.default = formatsPlugin;
|
|
8466
|
+
}));
|
|
8173
8467
|
var import_ajv = require_ajv();
|
|
8174
8468
|
var import__2020 = /* @__PURE__ */ __toESM$1(require__2020(), 1);
|
|
8469
|
+
var import_dist = /* @__PURE__ */ __toESM$1(require_dist(), 1);
|
|
8175
8470
|
var import_json_schema_traverse$2 = /* @__PURE__ */ __toESM$1(require_json_schema_traverse(), 1);
|
|
8176
8471
|
/**
|
|
8177
8472
|
* Vendor name for JSON Schema wrapped schemas.
|
|
@@ -8298,13 +8593,15 @@ var JsonSchemaWrapper = class {
|
|
|
8298
8593
|
*/
|
|
8299
8594
|
#getAjvValidator() {
|
|
8300
8595
|
if (!this.#ajvValidateCache) {
|
|
8301
|
-
const
|
|
8302
|
-
this.#ajvInstance = new AjvClass({
|
|
8596
|
+
const ajv = new (typeof this.#schema.$schema === "string" && this.#schema.$schema.includes("2020-12") ? import__2020.default : import_ajv.Ajv)({
|
|
8303
8597
|
allErrors: true,
|
|
8304
8598
|
strict: false,
|
|
8305
8599
|
...this.#options.ajvOptions
|
|
8306
8600
|
});
|
|
8307
|
-
|
|
8601
|
+
(0, import_dist.default)(ajv);
|
|
8602
|
+
for (const [name, format] of Object.entries(this.#options.ajvOptions?.formats ?? {})) if (format !== void 0) ajv.addFormat(name, format);
|
|
8603
|
+
this.#ajvInstance = ajv;
|
|
8604
|
+
this.#ajvValidateCache = ajv.compile(this.#schema);
|
|
8308
8605
|
}
|
|
8309
8606
|
return this.#ajvValidateCache;
|
|
8310
8607
|
}
|
|
@@ -8456,7 +8753,7 @@ function toStandardSchema$2(zodSchema) {
|
|
|
8456
8753
|
});
|
|
8457
8754
|
return wrapper;
|
|
8458
8755
|
}
|
|
8459
|
-
// ../schema-compat/dist/schema-
|
|
8756
|
+
// ../schema-compat/dist/schema-xsUy1mlm.js
|
|
8460
8757
|
/**
|
|
8461
8758
|
* Supported JSON Schema targets for z.toJSONSchema().
|
|
8462
8759
|
* Works with both real Zod v4 and Zod 3.25's v4 compat layer.
|