yap2app 1.1.4 → 1.1.5
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/bin/cli.bundle.js +428 -476
- package/bin/cli.js +428 -476
- package/bridge.js +103 -7
- package/package.json +1 -1
package/bin/cli.bundle.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
if(typeof process!=='undefined'&&process.emitWarning){var _ow=process.emitWarning;process.emitWarning=function(w){if(typeof w==='string'&&(w.includes('punycode')||w.includes('ExperimentalWarning')||w.includes('DEP0040')))return;if(w&&typeof w==='object'&&(w.code==='DEP0040'||w.name==='ExperimentalWarning'||String(w.message||'').includes('punycode')))return;return _ow.apply(process,arguments);};}if(typeof globalThis==='undefined'){if(typeof global!=='undefined'){global.globalThis=global;}else if(typeof window!=='undefined'){window.globalThis=window;}else if(typeof self!=='undefined'){self.globalThis=self;}}if(!Object.fromEntries){Object.fromEntries=function(e){if(!e)return{};var o={};var a=Array.isArray(e)?e:Array.from(e);for(var i=0;i<a.length;i++){var p=a[i];if(p&&p.length>=2)o[p[0]]=p[1];}return o;};}if(!Object.hasOwn){Object.hasOwn=function(o,p){return o!=null&&Object.prototype.hasOwnProperty.call(o,p);};}if(!Array.prototype.flat){Array.prototype.flat=function(d){var f=[];var dp=typeof d==='number'?d:1;(function fl(a,cd){for(var i=0;i<a.length;i++){if(Array.isArray(a[i])&&cd>0){fl(a[i],cd-1);}else{f.push(a[i]);}}})(this,dp);return f;};}if(!String.prototype.replaceAll){String.prototype.replaceAll=function(s,r){if(s instanceof RegExp)return this.replace(s,r);return this.split(s).join(r);};}if(!String.prototype.matchAll){String.prototype.matchAll=function(r){var f=r.flags;if(!f.includes('g'))f+='g';var rx=new RegExp(r.source,f);var s=String(this);var m=[];var mt;while((mt=rx.exec(s))!==null){m.push(mt);if(mt.index===rx.lastIndex)rx.lastIndex++;}return m[Symbol.iterator]?m[Symbol.iterator]():m;};}
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -77,12 +76,12 @@ var require_code = __commonJS({
|
|
|
77
76
|
return item === "" || item === '""';
|
|
78
77
|
}
|
|
79
78
|
get str() {
|
|
80
|
-
var
|
|
81
|
-
return (
|
|
79
|
+
var _a3;
|
|
80
|
+
return (_a3 = this._str) !== null && _a3 !== void 0 ? _a3 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
|
|
82
81
|
}
|
|
83
82
|
get names() {
|
|
84
|
-
var
|
|
85
|
-
return (
|
|
83
|
+
var _a3;
|
|
84
|
+
return (_a3 = this._names) !== null && _a3 !== void 0 ? _a3 : this._names = this._items.reduce((names, c) => {
|
|
86
85
|
if (c instanceof Name)
|
|
87
86
|
names[c.str] = (names[c.str] || 0) + 1;
|
|
88
87
|
return names;
|
|
@@ -228,8 +227,8 @@ var require_scope = __commonJS({
|
|
|
228
227
|
return `${prefix}${ng.index++}`;
|
|
229
228
|
}
|
|
230
229
|
_nameGroup(prefix) {
|
|
231
|
-
var
|
|
232
|
-
if (((_b = (
|
|
230
|
+
var _a3, _b;
|
|
231
|
+
if (((_b = (_a3 = this._parent) === null || _a3 === void 0 ? void 0 : _a3._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
|
|
233
232
|
throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
|
|
234
233
|
}
|
|
235
234
|
return this._names[prefix] = { prefix, index: 0 };
|
|
@@ -262,12 +261,12 @@ var require_scope = __commonJS({
|
|
|
262
261
|
return new ValueScopeName(prefix, this._newName(prefix));
|
|
263
262
|
}
|
|
264
263
|
value(nameOrPrefix, value) {
|
|
265
|
-
var
|
|
264
|
+
var _a3;
|
|
266
265
|
if (value.ref === void 0)
|
|
267
266
|
throw new Error("CodeGen: ref must be passed in value");
|
|
268
267
|
const name = this.toName(nameOrPrefix);
|
|
269
268
|
const { prefix } = name;
|
|
270
|
-
const valueKey = (
|
|
269
|
+
const valueKey = (_a3 = value.key) !== null && _a3 !== void 0 ? _a3 : value.ref;
|
|
271
270
|
let vs = this._values[prefix];
|
|
272
271
|
if (vs) {
|
|
273
272
|
const _name = vs.get(valueKey);
|
|
@@ -585,8 +584,8 @@ var require_codegen = __commonJS({
|
|
|
585
584
|
return this;
|
|
586
585
|
}
|
|
587
586
|
optimizeNames(names, constants) {
|
|
588
|
-
var
|
|
589
|
-
this.else = (
|
|
587
|
+
var _a3;
|
|
588
|
+
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants);
|
|
590
589
|
if (!(super.optimizeNames(names, constants) || this.else))
|
|
591
590
|
return;
|
|
592
591
|
this.condition = optimizeExpr(this.condition, names, constants);
|
|
@@ -690,16 +689,16 @@ var require_codegen = __commonJS({
|
|
|
690
689
|
return code;
|
|
691
690
|
}
|
|
692
691
|
optimizeNodes() {
|
|
693
|
-
var
|
|
692
|
+
var _a3, _b;
|
|
694
693
|
super.optimizeNodes();
|
|
695
|
-
(
|
|
694
|
+
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNodes();
|
|
696
695
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
697
696
|
return this;
|
|
698
697
|
}
|
|
699
698
|
optimizeNames(names, constants) {
|
|
700
|
-
var
|
|
699
|
+
var _a3, _b;
|
|
701
700
|
super.optimizeNames(names, constants);
|
|
702
|
-
(
|
|
701
|
+
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants);
|
|
703
702
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
|
|
704
703
|
return this;
|
|
705
704
|
}
|
|
@@ -1479,8 +1478,8 @@ var require_applicability = __commonJS({
|
|
|
1479
1478
|
}
|
|
1480
1479
|
exports2.shouldUseGroup = shouldUseGroup;
|
|
1481
1480
|
function shouldUseRule(schema, rule) {
|
|
1482
|
-
var
|
|
1483
|
-
return schema[rule.keyword] !== void 0 || ((
|
|
1481
|
+
var _a3;
|
|
1482
|
+
return schema[rule.keyword] !== void 0 || ((_a3 = rule.definition.implements) === null || _a3 === void 0 ? void 0 : _a3.some((kwd) => schema[kwd] !== void 0));
|
|
1484
1483
|
}
|
|
1485
1484
|
exports2.shouldUseRule = shouldUseRule;
|
|
1486
1485
|
}
|
|
@@ -1868,14 +1867,14 @@ var require_keyword = __commonJS({
|
|
|
1868
1867
|
}
|
|
1869
1868
|
exports2.macroKeywordCode = macroKeywordCode;
|
|
1870
1869
|
function funcKeywordCode(cxt, def) {
|
|
1871
|
-
var
|
|
1870
|
+
var _a3;
|
|
1872
1871
|
const { gen, keyword, schema, parentSchema, $data, it } = cxt;
|
|
1873
1872
|
checkAsyncKeyword(it, def);
|
|
1874
1873
|
const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
|
|
1875
1874
|
const validateRef = useKeyword(gen, keyword, validate);
|
|
1876
1875
|
const valid = gen.let("valid");
|
|
1877
1876
|
cxt.block$data(valid, validateKeyword);
|
|
1878
|
-
cxt.ok((
|
|
1877
|
+
cxt.ok((_a3 = def.valid) !== null && _a3 !== void 0 ? _a3 : valid);
|
|
1879
1878
|
function validateKeyword() {
|
|
1880
1879
|
if (def.errors === false) {
|
|
1881
1880
|
assignValid();
|
|
@@ -1906,8 +1905,8 @@ var require_keyword = __commonJS({
|
|
|
1906
1905
|
gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
|
|
1907
1906
|
}
|
|
1908
1907
|
function reportErrs(errors) {
|
|
1909
|
-
var
|
|
1910
|
-
gen.if((0, codegen_1.not)((
|
|
1908
|
+
var _a4;
|
|
1909
|
+
gen.if((0, codegen_1.not)((_a4 = def.valid) !== null && _a4 !== void 0 ? _a4 : valid), errors);
|
|
1911
1910
|
}
|
|
1912
1911
|
}
|
|
1913
1912
|
exports2.funcKeywordCode = funcKeywordCode;
|
|
@@ -2875,7 +2874,7 @@ var require_compile = __commonJS({
|
|
|
2875
2874
|
var validate_1 = require_validate();
|
|
2876
2875
|
var SchemaEnv = class {
|
|
2877
2876
|
constructor(env) {
|
|
2878
|
-
var
|
|
2877
|
+
var _a3;
|
|
2879
2878
|
this.refs = {};
|
|
2880
2879
|
this.dynamicAnchors = {};
|
|
2881
2880
|
let schema;
|
|
@@ -2884,7 +2883,7 @@ var require_compile = __commonJS({
|
|
|
2884
2883
|
this.schema = env.schema;
|
|
2885
2884
|
this.schemaId = env.schemaId;
|
|
2886
2885
|
this.root = env.root || this;
|
|
2887
|
-
this.baseId = (
|
|
2886
|
+
this.baseId = (_a3 = env.baseId) !== null && _a3 !== void 0 ? _a3 : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
|
|
2888
2887
|
this.schemaPath = env.schemaPath;
|
|
2889
2888
|
this.localRefs = env.localRefs;
|
|
2890
2889
|
this.meta = env.meta;
|
|
@@ -2980,14 +2979,14 @@ var require_compile = __commonJS({
|
|
|
2980
2979
|
}
|
|
2981
2980
|
exports2.compileSchema = compileSchema;
|
|
2982
2981
|
function resolveRef(root, baseId, ref) {
|
|
2983
|
-
var
|
|
2982
|
+
var _a3;
|
|
2984
2983
|
ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
|
|
2985
2984
|
const schOrFunc = root.refs[ref];
|
|
2986
2985
|
if (schOrFunc)
|
|
2987
2986
|
return schOrFunc;
|
|
2988
2987
|
let _sch = resolve.call(this, root, ref);
|
|
2989
2988
|
if (_sch === void 0) {
|
|
2990
|
-
const schema = (
|
|
2989
|
+
const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
|
|
2991
2990
|
const { schemaId } = this.opts;
|
|
2992
2991
|
if (schema)
|
|
2993
2992
|
_sch = new SchemaEnv({ schema, schemaId, root, baseId });
|
|
@@ -3056,8 +3055,8 @@ var require_compile = __commonJS({
|
|
|
3056
3055
|
"definitions"
|
|
3057
3056
|
]);
|
|
3058
3057
|
function getJsonPointer(parsedRef, { baseId, schema, root }) {
|
|
3059
|
-
var
|
|
3060
|
-
if (((
|
|
3058
|
+
var _a3;
|
|
3059
|
+
if (((_a3 = parsedRef.fragment) === null || _a3 === void 0 ? void 0 : _a3[0]) !== "/")
|
|
3061
3060
|
return;
|
|
3062
3061
|
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
3063
3062
|
if (typeof schema === "boolean")
|
|
@@ -3552,7 +3551,7 @@ var require_schemes = __commonJS({
|
|
|
3552
3551
|
serialize: httpSerialize
|
|
3553
3552
|
}
|
|
3554
3553
|
);
|
|
3555
|
-
var
|
|
3554
|
+
var https2 = (
|
|
3556
3555
|
/** @type {SchemeHandler} */
|
|
3557
3556
|
{
|
|
3558
3557
|
scheme: "https",
|
|
@@ -3601,7 +3600,7 @@ var require_schemes = __commonJS({
|
|
|
3601
3600
|
/** @type {Record<SchemeName, SchemeHandler>} */
|
|
3602
3601
|
{
|
|
3603
3602
|
http: http2,
|
|
3604
|
-
https,
|
|
3603
|
+
https: https2,
|
|
3605
3604
|
ws,
|
|
3606
3605
|
wss,
|
|
3607
3606
|
urn,
|
|
@@ -4031,9 +4030,9 @@ var require_core = __commonJS({
|
|
|
4031
4030
|
};
|
|
4032
4031
|
var MAX_EXPRESSION = 200;
|
|
4033
4032
|
function requiredOptions(o) {
|
|
4034
|
-
var
|
|
4033
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
4035
4034
|
const s = o.strict;
|
|
4036
|
-
const _optz = (
|
|
4035
|
+
const _optz = (_a3 = o.code) === null || _a3 === void 0 ? void 0 : _a3.optimize;
|
|
4037
4036
|
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
4038
4037
|
const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
|
|
4039
4038
|
const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
|
|
@@ -4507,7 +4506,7 @@ var require_core = __commonJS({
|
|
|
4507
4506
|
}
|
|
4508
4507
|
}
|
|
4509
4508
|
function addRule(keyword, definition, dataType) {
|
|
4510
|
-
var
|
|
4509
|
+
var _a3;
|
|
4511
4510
|
const post = definition === null || definition === void 0 ? void 0 : definition.post;
|
|
4512
4511
|
if (dataType && post)
|
|
4513
4512
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
@@ -4533,7 +4532,7 @@ var require_core = __commonJS({
|
|
|
4533
4532
|
else
|
|
4534
4533
|
ruleGroup.rules.push(rule);
|
|
4535
4534
|
RULES.all[keyword] = rule;
|
|
4536
|
-
(
|
|
4535
|
+
(_a3 = definition.implements) === null || _a3 === void 0 ? void 0 : _a3.forEach((kwd) => this.addKeyword(kwd));
|
|
4537
4536
|
}
|
|
4538
4537
|
function addBeforeRule(ruleGroup, rule, before) {
|
|
4539
4538
|
const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
|
|
@@ -4667,10 +4666,10 @@ var require_ref = __commonJS({
|
|
|
4667
4666
|
gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
|
|
4668
4667
|
}
|
|
4669
4668
|
function addEvaluatedFrom(source) {
|
|
4670
|
-
var
|
|
4669
|
+
var _a3;
|
|
4671
4670
|
if (!it.opts.unevaluated)
|
|
4672
4671
|
return;
|
|
4673
|
-
const schEvaluated = (
|
|
4672
|
+
const schEvaluated = (_a3 = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a3 === void 0 ? void 0 : _a3.evaluated;
|
|
4674
4673
|
if (it.props !== true) {
|
|
4675
4674
|
if (schEvaluated && !schEvaluated.dynamicProps) {
|
|
4676
4675
|
if (schEvaluated.props !== void 0) {
|
|
@@ -6321,7 +6320,7 @@ var require_discriminator = __commonJS({
|
|
|
6321
6320
|
return _valid;
|
|
6322
6321
|
}
|
|
6323
6322
|
function getMapping() {
|
|
6324
|
-
var
|
|
6323
|
+
var _a3;
|
|
6325
6324
|
const oneOfMapping = {};
|
|
6326
6325
|
const topRequired = hasRequired(parentSchema);
|
|
6327
6326
|
let tagRequired = true;
|
|
@@ -6335,7 +6334,7 @@ var require_discriminator = __commonJS({
|
|
|
6335
6334
|
if (sch === void 0)
|
|
6336
6335
|
throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
|
|
6337
6336
|
}
|
|
6338
|
-
const propSch = (
|
|
6337
|
+
const propSch = (_a3 = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a3 === void 0 ? void 0 : _a3[tagName];
|
|
6339
6338
|
if (typeof propSch != "object") {
|
|
6340
6339
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
|
|
6341
6340
|
}
|
|
@@ -6904,9 +6903,9 @@ var require_dist = __commonJS({
|
|
|
6904
6903
|
return f;
|
|
6905
6904
|
};
|
|
6906
6905
|
function addFormats(ajv, list, fs4, exportName) {
|
|
6907
|
-
var
|
|
6906
|
+
var _a3;
|
|
6908
6907
|
var _b;
|
|
6909
|
-
(
|
|
6908
|
+
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
6910
6909
|
for (const f of list)
|
|
6911
6910
|
ajv.addFormat(f, fs4[f]);
|
|
6912
6911
|
}
|
|
@@ -7026,6 +7025,7 @@ if (!Promise.allSettled) {
|
|
|
7026
7025
|
|
|
7027
7026
|
// bridge.js
|
|
7028
7027
|
var import_http = __toESM(require("http"));
|
|
7028
|
+
var import_https = __toESM(require("https"));
|
|
7029
7029
|
var import_fs2 = __toESM(require("fs"));
|
|
7030
7030
|
var import_path2 = __toESM(require("path"));
|
|
7031
7031
|
var import_util2 = __toESM(require("util"));
|
|
@@ -7409,12 +7409,11 @@ async function extractComponentSignatures(projectRoot, allFiles) {
|
|
|
7409
7409
|
return catalog;
|
|
7410
7410
|
}
|
|
7411
7411
|
function extractPathAliases(manifests) {
|
|
7412
|
-
var _a5;
|
|
7413
7412
|
if (manifests["tsconfig.json"]) {
|
|
7414
7413
|
try {
|
|
7415
7414
|
const cleaned = manifests["tsconfig.json"].replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
7416
7415
|
const parsed = JSON.parse(cleaned);
|
|
7417
|
-
const paths =
|
|
7416
|
+
const paths = parsed.compilerOptions?.paths || {};
|
|
7418
7417
|
const firstKey = Object.keys(paths)[0];
|
|
7419
7418
|
if (firstKey) {
|
|
7420
7419
|
return firstKey.replace("*", "");
|
|
@@ -7574,10 +7573,50 @@ var fs2 = import_fs2.default.promises || {
|
|
|
7574
7573
|
};
|
|
7575
7574
|
var PORT = Number(process.env.YAP2APP_PORT) || 10420;
|
|
7576
7575
|
var PROJECT_ROOT = process.cwd();
|
|
7576
|
+
var CLOUD_RELAY_URL = process.env.YAP2APP_CLOUD_URL || "https://yap2app-dot-cybage-hackathon.uc.r.appspot.com";
|
|
7577
|
+
var PAIR_CODE = (process.env.YAP2APP_PAIR_CODE || "CYB-" + Math.floor(100 + Math.random() * 900)).toUpperCase();
|
|
7578
|
+
function sendCloudRelayRequest(method, endpoint, payload) {
|
|
7579
|
+
return new Promise((resolve) => {
|
|
7580
|
+
try {
|
|
7581
|
+
const url = new URL(`${CLOUD_RELAY_URL}${endpoint}`);
|
|
7582
|
+
const body = payload ? JSON.stringify(payload) : "";
|
|
7583
|
+
const req = import_https.default.request({
|
|
7584
|
+
hostname: url.hostname,
|
|
7585
|
+
port: 443,
|
|
7586
|
+
path: url.pathname + url.search,
|
|
7587
|
+
method,
|
|
7588
|
+
headers: {
|
|
7589
|
+
"Content-Type": "application/json",
|
|
7590
|
+
"Content-Length": Buffer.byteLength(body),
|
|
7591
|
+
"User-Agent": "yap2app-cli/1.1.5"
|
|
7592
|
+
},
|
|
7593
|
+
timeout: 6e3
|
|
7594
|
+
}, (res) => {
|
|
7595
|
+
let respData = "";
|
|
7596
|
+
res.on("data", (chunk) => respData += chunk);
|
|
7597
|
+
res.on("end", () => {
|
|
7598
|
+
try {
|
|
7599
|
+
resolve({ ok: res.statusCode >= 200 && res.statusCode < 300, status: res.statusCode, data: JSON.parse(respData || "{}") });
|
|
7600
|
+
} catch {
|
|
7601
|
+
resolve({ ok: false, status: res.statusCode, data: null });
|
|
7602
|
+
}
|
|
7603
|
+
});
|
|
7604
|
+
});
|
|
7605
|
+
req.on("error", () => resolve({ ok: false, status: 0, data: null }));
|
|
7606
|
+
req.on("timeout", () => {
|
|
7607
|
+
req.destroy();
|
|
7608
|
+
resolve({ ok: false, status: 0, data: null });
|
|
7609
|
+
});
|
|
7610
|
+
if (body) req.write(body);
|
|
7611
|
+
req.end();
|
|
7612
|
+
} catch {
|
|
7613
|
+
resolve({ ok: false, status: 0, data: null });
|
|
7614
|
+
}
|
|
7615
|
+
});
|
|
7616
|
+
}
|
|
7577
7617
|
function getCorsHeaders(req) {
|
|
7578
|
-
|
|
7579
|
-
const
|
|
7580
|
-
const requestedHeaders = ((_b = req == null ? void 0 : req.headers) == null ? void 0 : _b["access-control-request-headers"]) || "*";
|
|
7618
|
+
const origin = req?.headers?.origin || "*";
|
|
7619
|
+
const requestedHeaders = req?.headers?.["access-control-request-headers"] || "*";
|
|
7581
7620
|
return {
|
|
7582
7621
|
"Access-Control-Allow-Origin": origin,
|
|
7583
7622
|
"Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, DELETE, HEAD, PATCH",
|
|
@@ -7644,8 +7683,9 @@ var server = import_http.default.createServer(async (req, res) => {
|
|
|
7644
7683
|
res.end(JSON.stringify({
|
|
7645
7684
|
status: "healthy",
|
|
7646
7685
|
service: "Yap2App-Localhost-Bridge",
|
|
7647
|
-
version: "1.1.
|
|
7686
|
+
version: "1.1.5",
|
|
7648
7687
|
port: PORT,
|
|
7688
|
+
pair_code: PAIR_CODE,
|
|
7649
7689
|
project_root: PROJECT_ROOT,
|
|
7650
7690
|
project_name: import_path2.default.basename(PROJECT_ROOT),
|
|
7651
7691
|
ready: true
|
|
@@ -7744,28 +7784,77 @@ server.on("error", (err) => {
|
|
|
7744
7784
|
if (err && err.code === "EADDRINUSE") {
|
|
7745
7785
|
console.log(`
|
|
7746
7786
|
===============================================================`);
|
|
7747
|
-
console.log(`\u{1F4E1}
|
|
7787
|
+
console.log(`\u{1F4E1} Localhost port ${PORT} is active. Cloud Relay continues seamlessly!`);
|
|
7748
7788
|
console.log(`\u{1F4C1} Active Workspace: ${PROJECT_ROOT}`);
|
|
7749
|
-
console.log(`\u{
|
|
7789
|
+
console.log(`\u{1F511} Pairing Code: ${PAIR_CODE}`);
|
|
7790
|
+
console.log(`\u{1F310} Web Studio: ${CLOUD_RELAY_URL}`);
|
|
7750
7791
|
console.log(`===============================================================
|
|
7751
7792
|
`);
|
|
7752
7793
|
return;
|
|
7753
7794
|
}
|
|
7754
7795
|
console.error("[Yap2App Bridge Error]:", err);
|
|
7755
7796
|
});
|
|
7756
|
-
function startBridge(port = PORT) {
|
|
7797
|
+
async function startBridge(port = PORT) {
|
|
7757
7798
|
server.listen(port, "0.0.0.0", () => {
|
|
7758
7799
|
console.log(`
|
|
7759
7800
|
===============================================================`);
|
|
7760
|
-
console.log(`\u{1F680} Yap2App Localhost Bridge &
|
|
7761
|
-
console.log(`\u{1F4E1}
|
|
7801
|
+
console.log(`\u{1F680} Yap2App Localhost Bridge & Telemetry is ACTIVE!`);
|
|
7802
|
+
console.log(`\u{1F4E1} Local Endpoint: http://127.0.0.1:${port}`);
|
|
7762
7803
|
console.log(`\u{1F4C1} Active Workspace: ${PROJECT_ROOT}`);
|
|
7763
|
-
console.log(`\u{
|
|
7804
|
+
console.log(`\u{1F511} Pairing Code: ${PAIR_CODE}`);
|
|
7805
|
+
console.log(`\u{1F310} Connected to Web Studio: ${CLOUD_RELAY_URL}`);
|
|
7806
|
+
console.log(`\u{1F6E1}\uFE0F Enterprise Diff, W3C PNA & Cloud Relay Enabled`);
|
|
7764
7807
|
console.log(`===============================================================
|
|
7765
7808
|
`);
|
|
7766
7809
|
console.log(`Ready for 1-click sync from Yap2App Web Studio UI...
|
|
7767
7810
|
`);
|
|
7768
7811
|
});
|
|
7812
|
+
try {
|
|
7813
|
+
const initialContext = await scanCodebase(PROJECT_ROOT);
|
|
7814
|
+
await sendCloudRelayRequest("POST", "/api/v1/bridge/heartbeat", {
|
|
7815
|
+
pair_code: PAIR_CODE,
|
|
7816
|
+
project_name: import_path2.default.basename(PROJECT_ROOT),
|
|
7817
|
+
project_root: PROJECT_ROOT,
|
|
7818
|
+
framework: initialContext.framework,
|
|
7819
|
+
context: initialContext,
|
|
7820
|
+
version: "1.1.5"
|
|
7821
|
+
});
|
|
7822
|
+
} catch (e) {
|
|
7823
|
+
}
|
|
7824
|
+
setInterval(async () => {
|
|
7825
|
+
try {
|
|
7826
|
+
const context = await scanCodebase(PROJECT_ROOT);
|
|
7827
|
+
const hbResult = await sendCloudRelayRequest("POST", "/api/v1/bridge/heartbeat", {
|
|
7828
|
+
pair_code: PAIR_CODE,
|
|
7829
|
+
project_name: import_path2.default.basename(PROJECT_ROOT),
|
|
7830
|
+
project_root: PROJECT_ROOT,
|
|
7831
|
+
framework: context.framework,
|
|
7832
|
+
context,
|
|
7833
|
+
version: "1.1.5"
|
|
7834
|
+
});
|
|
7835
|
+
if (hbResult && hbResult.data && hbResult.data.pending_writes_count > 0) {
|
|
7836
|
+
const pollResult = await sendCloudRelayRequest("GET", `/api/v1/bridge/poll-writes?pair_code=${PAIR_CODE}`);
|
|
7837
|
+
const tasks = pollResult.data && pollResult.data.pending_tasks || [];
|
|
7838
|
+
for (const task of tasks) {
|
|
7839
|
+
const written = [];
|
|
7840
|
+
for (const file of task.files || []) {
|
|
7841
|
+
const fullPath = import_path2.default.join(PROJECT_ROOT, file.path);
|
|
7842
|
+
await fs2.mkdir(import_path2.default.dirname(fullPath), { recursive: true });
|
|
7843
|
+
await fs2.writeFile(fullPath, file.content, "utf8");
|
|
7844
|
+
console.log(`[Yap2App Bridge] \u270D\uFE0F Wrote approved file: ${file.path}`);
|
|
7845
|
+
written.push(file.path);
|
|
7846
|
+
}
|
|
7847
|
+
await sendCloudRelayRequest("POST", "/api/v1/bridge/complete-write", {
|
|
7848
|
+
task_id: task.task_id,
|
|
7849
|
+
success: true,
|
|
7850
|
+
written,
|
|
7851
|
+
message: `Wrote ${written.length} file(s) directly to ${import_path2.default.basename(PROJECT_ROOT)}`
|
|
7852
|
+
});
|
|
7853
|
+
}
|
|
7854
|
+
}
|
|
7855
|
+
} catch {
|
|
7856
|
+
}
|
|
7857
|
+
}, 3500);
|
|
7769
7858
|
}
|
|
7770
7859
|
var isDirectRun = Boolean(typeof process !== "undefined" && process.argv && process.argv[1] && (process.argv[1].endsWith("bridge.js") || process.argv[1].endsWith("bridge")));
|
|
7771
7860
|
if (isDirectRun) {
|
|
@@ -7776,7 +7865,6 @@ if (isDirectRun) {
|
|
|
7776
7865
|
var _a;
|
|
7777
7866
|
// @__NO_SIDE_EFFECTS__
|
|
7778
7867
|
function $constructor(name, initializer3, params) {
|
|
7779
|
-
var _a5;
|
|
7780
7868
|
function init(inst, def) {
|
|
7781
7869
|
if (!inst._zod) {
|
|
7782
7870
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -7802,16 +7890,15 @@ function $constructor(name, initializer3, params) {
|
|
|
7802
7890
|
}
|
|
7803
7891
|
}
|
|
7804
7892
|
}
|
|
7805
|
-
const Parent =
|
|
7893
|
+
const Parent = params?.Parent ?? Object;
|
|
7806
7894
|
class Definition extends Parent {
|
|
7807
7895
|
}
|
|
7808
7896
|
Object.defineProperty(Definition, "name", { value: name });
|
|
7809
7897
|
function _(def) {
|
|
7810
|
-
var
|
|
7811
|
-
|
|
7812
|
-
const inst = (params == null ? void 0 : params.Parent) ? new Definition() : this;
|
|
7898
|
+
var _a3;
|
|
7899
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
7813
7900
|
init(inst, def);
|
|
7814
|
-
(
|
|
7901
|
+
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
7815
7902
|
for (const fn of inst._zod.deferred) {
|
|
7816
7903
|
fn();
|
|
7817
7904
|
}
|
|
@@ -7820,10 +7907,9 @@ function $constructor(name, initializer3, params) {
|
|
|
7820
7907
|
Object.defineProperty(_, "init", { value: init });
|
|
7821
7908
|
Object.defineProperty(_, Symbol.hasInstance, {
|
|
7822
7909
|
value: (inst) => {
|
|
7823
|
-
|
|
7824
|
-
if ((params == null ? void 0 : params.Parent) && inst instanceof params.Parent)
|
|
7910
|
+
if (params?.Parent && inst instanceof params.Parent)
|
|
7825
7911
|
return true;
|
|
7826
|
-
return
|
|
7912
|
+
return inst?._zod?.traits?.has(name);
|
|
7827
7913
|
}
|
|
7828
7914
|
});
|
|
7829
7915
|
Object.defineProperty(_, "name", { value: name });
|
|
@@ -7840,8 +7926,7 @@ var $ZodEncodeError = class extends Error {
|
|
|
7840
7926
|
this.name = "ZodEncodeError";
|
|
7841
7927
|
}
|
|
7842
7928
|
};
|
|
7843
|
-
|
|
7844
|
-
(_a2 = (_a = globalThis).__zod_globalConfig) != null ? _a2 : _a.__zod_globalConfig = {};
|
|
7929
|
+
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
|
|
7845
7930
|
var globalConfig = globalThis.__zod_globalConfig;
|
|
7846
7931
|
function config(newConfig) {
|
|
7847
7932
|
if (newConfig)
|
|
@@ -8019,7 +8104,7 @@ function cloneDef(schema) {
|
|
|
8019
8104
|
function getElementAtPath(obj, path4) {
|
|
8020
8105
|
if (!path4)
|
|
8021
8106
|
return obj;
|
|
8022
|
-
return path4.reduce((acc, key) => acc
|
|
8107
|
+
return path4.reduce((acc, key) => acc?.[key], obj);
|
|
8023
8108
|
}
|
|
8024
8109
|
function promiseAllObject(promisesObj) {
|
|
8025
8110
|
const keys = Object.keys(promisesObj);
|
|
@@ -8052,11 +8137,10 @@ function isObject(data) {
|
|
|
8052
8137
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
8053
8138
|
}
|
|
8054
8139
|
var allowsEval = /* @__PURE__ */ cached(() => {
|
|
8055
|
-
var _a5;
|
|
8056
8140
|
if (globalConfig.jitless) {
|
|
8057
8141
|
return false;
|
|
8058
8142
|
}
|
|
8059
|
-
if (typeof navigator !== "undefined" &&
|
|
8143
|
+
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
8060
8144
|
return false;
|
|
8061
8145
|
}
|
|
8062
8146
|
try {
|
|
@@ -8160,8 +8244,8 @@ function escapeRegex(str) {
|
|
|
8160
8244
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8161
8245
|
}
|
|
8162
8246
|
function clone(inst, def, params) {
|
|
8163
|
-
const cl = new inst._zod.constr(def
|
|
8164
|
-
if (!def ||
|
|
8247
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
8248
|
+
if (!def || params?.parent)
|
|
8165
8249
|
cl._zod.parent = inst;
|
|
8166
8250
|
return cl;
|
|
8167
8251
|
}
|
|
@@ -8171,8 +8255,8 @@ function normalizeParams(_params) {
|
|
|
8171
8255
|
return {};
|
|
8172
8256
|
if (typeof params === "string")
|
|
8173
8257
|
return { error: () => params };
|
|
8174
|
-
if (
|
|
8175
|
-
if (
|
|
8258
|
+
if (params?.message !== void 0) {
|
|
8259
|
+
if (params?.error !== void 0)
|
|
8176
8260
|
throw new Error("Cannot specify both `message` and `error` params");
|
|
8177
8261
|
params.error = params.message;
|
|
8178
8262
|
}
|
|
@@ -8185,31 +8269,31 @@ function createTransparentProxy(getter) {
|
|
|
8185
8269
|
let target;
|
|
8186
8270
|
return new Proxy({}, {
|
|
8187
8271
|
get(_, prop, receiver) {
|
|
8188
|
-
target
|
|
8272
|
+
target ?? (target = getter());
|
|
8189
8273
|
return Reflect.get(target, prop, receiver);
|
|
8190
8274
|
},
|
|
8191
8275
|
set(_, prop, value, receiver) {
|
|
8192
|
-
target
|
|
8276
|
+
target ?? (target = getter());
|
|
8193
8277
|
return Reflect.set(target, prop, value, receiver);
|
|
8194
8278
|
},
|
|
8195
8279
|
has(_, prop) {
|
|
8196
|
-
target
|
|
8280
|
+
target ?? (target = getter());
|
|
8197
8281
|
return Reflect.has(target, prop);
|
|
8198
8282
|
},
|
|
8199
8283
|
deleteProperty(_, prop) {
|
|
8200
|
-
target
|
|
8284
|
+
target ?? (target = getter());
|
|
8201
8285
|
return Reflect.deleteProperty(target, prop);
|
|
8202
8286
|
},
|
|
8203
8287
|
ownKeys(_) {
|
|
8204
|
-
target
|
|
8288
|
+
target ?? (target = getter());
|
|
8205
8289
|
return Reflect.ownKeys(target);
|
|
8206
8290
|
},
|
|
8207
8291
|
getOwnPropertyDescriptor(_, prop) {
|
|
8208
|
-
target
|
|
8292
|
+
target ?? (target = getter());
|
|
8209
8293
|
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
8210
8294
|
},
|
|
8211
8295
|
defineProperty(_, prop, descriptor) {
|
|
8212
|
-
target
|
|
8296
|
+
target ?? (target = getter());
|
|
8213
8297
|
return Reflect.defineProperty(target, prop, descriptor);
|
|
8214
8298
|
}
|
|
8215
8299
|
});
|
|
@@ -8324,8 +8408,7 @@ function safeExtend(schema, shape) {
|
|
|
8324
8408
|
return clone(schema, def);
|
|
8325
8409
|
}
|
|
8326
8410
|
function merge(a, b) {
|
|
8327
|
-
|
|
8328
|
-
if ((_a5 = a._zod.def.checks) == null ? void 0 : _a5.length) {
|
|
8411
|
+
if (a._zod.def.checks?.length) {
|
|
8329
8412
|
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
8330
8413
|
}
|
|
8331
8414
|
const def = mergeDefs(a._zod.def, {
|
|
@@ -8337,7 +8420,7 @@ function merge(a, b) {
|
|
|
8337
8420
|
get catchall() {
|
|
8338
8421
|
return b._zod.def.catchall;
|
|
8339
8422
|
},
|
|
8340
|
-
checks:
|
|
8423
|
+
checks: b._zod.def.checks ?? []
|
|
8341
8424
|
});
|
|
8342
8425
|
return clone(a, def);
|
|
8343
8426
|
}
|
|
@@ -8411,22 +8494,20 @@ function required(Class2, schema, mask) {
|
|
|
8411
8494
|
return clone(schema, def);
|
|
8412
8495
|
}
|
|
8413
8496
|
function aborted(x, startIndex = 0) {
|
|
8414
|
-
var _a5;
|
|
8415
8497
|
if (x.aborted === true)
|
|
8416
8498
|
return true;
|
|
8417
8499
|
for (let i = startIndex; i < x.issues.length; i++) {
|
|
8418
|
-
if (
|
|
8500
|
+
if (x.issues[i]?.continue !== true) {
|
|
8419
8501
|
return true;
|
|
8420
8502
|
}
|
|
8421
8503
|
}
|
|
8422
8504
|
return false;
|
|
8423
8505
|
}
|
|
8424
8506
|
function explicitlyAborted(x, startIndex = 0) {
|
|
8425
|
-
var _a5;
|
|
8426
8507
|
if (x.aborted === true)
|
|
8427
8508
|
return true;
|
|
8428
8509
|
for (let i = startIndex; i < x.issues.length; i++) {
|
|
8429
|
-
if (
|
|
8510
|
+
if (x.issues[i]?.continue === false) {
|
|
8430
8511
|
return true;
|
|
8431
8512
|
}
|
|
8432
8513
|
}
|
|
@@ -8434,23 +8515,21 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
8434
8515
|
}
|
|
8435
8516
|
function prefixIssues(path4, issues) {
|
|
8436
8517
|
return issues.map((iss) => {
|
|
8437
|
-
var
|
|
8438
|
-
|
|
8439
|
-
(_a6 = (_a5 = iss).path) != null ? _a6 : _a5.path = [];
|
|
8518
|
+
var _a3;
|
|
8519
|
+
(_a3 = iss).path ?? (_a3.path = []);
|
|
8440
8520
|
iss.path.unshift(path4);
|
|
8441
8521
|
return iss;
|
|
8442
8522
|
});
|
|
8443
8523
|
}
|
|
8444
8524
|
function unwrapMessage(message) {
|
|
8445
|
-
return typeof message === "string" ? message : message
|
|
8525
|
+
return typeof message === "string" ? message : message?.message;
|
|
8446
8526
|
}
|
|
8447
8527
|
function finalizeIssue(iss, ctx, config2) {
|
|
8448
|
-
|
|
8449
|
-
const message = iss.message ? iss.message : (_j = (_i = (_g = (_e = unwrapMessage((_c = (_b = (_a5 = iss.inst) == null ? void 0 : _a5._zod.def) == null ? void 0 : _b.error) == null ? void 0 : _c.call(_b, iss))) != null ? _e : unwrapMessage((_d = ctx == null ? void 0 : ctx.error) == null ? void 0 : _d.call(ctx, iss))) != null ? _g : unwrapMessage((_f = config2.customError) == null ? void 0 : _f.call(config2, iss))) != null ? _i : unwrapMessage((_h = config2.localeError) == null ? void 0 : _h.call(config2, iss))) != null ? _j : "Invalid input";
|
|
8528
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
8450
8529
|
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
|
|
8451
|
-
|
|
8530
|
+
rest.path ?? (rest.path = []);
|
|
8452
8531
|
rest.message = message;
|
|
8453
|
-
if (ctx
|
|
8532
|
+
if (ctx?.reportInput) {
|
|
8454
8533
|
rest.input = _input;
|
|
8455
8534
|
}
|
|
8456
8535
|
return rest;
|
|
@@ -8622,28 +8701,26 @@ function formatError(error2, mapper = (issue2) => issue2.message) {
|
|
|
8622
8701
|
|
|
8623
8702
|
// node_modules/zod/v4/core/parse.js
|
|
8624
8703
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
8625
|
-
var _a5;
|
|
8626
8704
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
8627
8705
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
8628
8706
|
if (result instanceof Promise) {
|
|
8629
8707
|
throw new $ZodAsyncError();
|
|
8630
8708
|
}
|
|
8631
8709
|
if (result.issues.length) {
|
|
8632
|
-
const e = new (
|
|
8633
|
-
captureStackTrace(e, _params
|
|
8710
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
8711
|
+
captureStackTrace(e, _params?.callee);
|
|
8634
8712
|
throw e;
|
|
8635
8713
|
}
|
|
8636
8714
|
return result.value;
|
|
8637
8715
|
};
|
|
8638
8716
|
var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
8639
|
-
var _a5;
|
|
8640
8717
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
8641
8718
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
8642
8719
|
if (result instanceof Promise)
|
|
8643
8720
|
result = await result;
|
|
8644
8721
|
if (result.issues.length) {
|
|
8645
|
-
const e = new (
|
|
8646
|
-
captureStackTrace(e, params
|
|
8722
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
8723
|
+
captureStackTrace(e, params?.callee);
|
|
8647
8724
|
throw e;
|
|
8648
8725
|
}
|
|
8649
8726
|
return result.value;
|
|
@@ -8656,7 +8733,7 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
8656
8733
|
}
|
|
8657
8734
|
return result.issues.length ? {
|
|
8658
8735
|
success: false,
|
|
8659
|
-
error: new (_Err
|
|
8736
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
8660
8737
|
} : { success: true, data: result.value };
|
|
8661
8738
|
};
|
|
8662
8739
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
@@ -8748,8 +8825,7 @@ function datetime(args) {
|
|
|
8748
8825
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
8749
8826
|
}
|
|
8750
8827
|
var string = (params) => {
|
|
8751
|
-
|
|
8752
|
-
const regex = params ? `[\\s\\S]{${(_a5 = params == null ? void 0 : params.minimum) != null ? _a5 : 0},${(_b = params == null ? void 0 : params.maximum) != null ? _b : ""}}` : `[\\s\\S]*`;
|
|
8828
|
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
8753
8829
|
return new RegExp(`^${regex}$`);
|
|
8754
8830
|
};
|
|
8755
8831
|
var integer = /^-?\d+$/;
|
|
@@ -8761,11 +8837,10 @@ var uppercase = /^[^a-z]*$/;
|
|
|
8761
8837
|
|
|
8762
8838
|
// node_modules/zod/v4/core/checks.js
|
|
8763
8839
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
8764
|
-
var
|
|
8765
|
-
|
|
8766
|
-
(_a6 = inst._zod) != null ? _a6 : inst._zod = {};
|
|
8840
|
+
var _a3;
|
|
8841
|
+
inst._zod ?? (inst._zod = {});
|
|
8767
8842
|
inst._zod.def = def;
|
|
8768
|
-
(
|
|
8843
|
+
(_a3 = inst._zod).onattach ?? (_a3.onattach = []);
|
|
8769
8844
|
});
|
|
8770
8845
|
var numericOriginMap = {
|
|
8771
8846
|
number: "number",
|
|
@@ -8776,9 +8851,8 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
|
|
|
8776
8851
|
$ZodCheck.init(inst, def);
|
|
8777
8852
|
const origin = numericOriginMap[typeof def.value];
|
|
8778
8853
|
inst._zod.onattach.push((inst2) => {
|
|
8779
|
-
var _a5;
|
|
8780
8854
|
const bag = inst2._zod.bag;
|
|
8781
|
-
const curr = (
|
|
8855
|
+
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
8782
8856
|
if (def.value < curr) {
|
|
8783
8857
|
if (def.inclusive)
|
|
8784
8858
|
bag.maximum = def.value;
|
|
@@ -8805,9 +8879,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
8805
8879
|
$ZodCheck.init(inst, def);
|
|
8806
8880
|
const origin = numericOriginMap[typeof def.value];
|
|
8807
8881
|
inst._zod.onattach.push((inst2) => {
|
|
8808
|
-
var _a5;
|
|
8809
8882
|
const bag = inst2._zod.bag;
|
|
8810
|
-
const curr = (
|
|
8883
|
+
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
8811
8884
|
if (def.value > curr) {
|
|
8812
8885
|
if (def.inclusive)
|
|
8813
8886
|
bag.minimum = def.value;
|
|
@@ -8833,9 +8906,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
8833
8906
|
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
8834
8907
|
$ZodCheck.init(inst, def);
|
|
8835
8908
|
inst._zod.onattach.push((inst2) => {
|
|
8836
|
-
var
|
|
8837
|
-
|
|
8838
|
-
(_a6 = (_a5 = inst2._zod.bag).multipleOf) != null ? _a6 : _a5.multipleOf = def.value;
|
|
8909
|
+
var _a3;
|
|
8910
|
+
(_a3 = inst2._zod.bag).multipleOf ?? (_a3.multipleOf = def.value);
|
|
8839
8911
|
});
|
|
8840
8912
|
inst._zod.check = (payload) => {
|
|
8841
8913
|
if (typeof payload.value !== typeof def.value)
|
|
@@ -8854,10 +8926,9 @@ var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (i
|
|
|
8854
8926
|
};
|
|
8855
8927
|
});
|
|
8856
8928
|
var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
|
|
8857
|
-
var _a5;
|
|
8858
8929
|
$ZodCheck.init(inst, def);
|
|
8859
8930
|
def.format = def.format || "float64";
|
|
8860
|
-
const isInt =
|
|
8931
|
+
const isInt = def.format?.includes("int");
|
|
8861
8932
|
const origin = isInt ? "int" : "number";
|
|
8862
8933
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
8863
8934
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -8934,16 +9005,14 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
8934
9005
|
};
|
|
8935
9006
|
});
|
|
8936
9007
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
8937
|
-
var
|
|
8938
|
-
var _a5;
|
|
9008
|
+
var _a3;
|
|
8939
9009
|
$ZodCheck.init(inst, def);
|
|
8940
|
-
(
|
|
9010
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
8941
9011
|
const val = payload.value;
|
|
8942
9012
|
return !nullish(val) && val.length !== void 0;
|
|
8943
|
-
};
|
|
9013
|
+
});
|
|
8944
9014
|
inst._zod.onattach.push((inst2) => {
|
|
8945
|
-
|
|
8946
|
-
const curr = (_a7 = inst2._zod.bag.maximum) != null ? _a7 : Number.POSITIVE_INFINITY;
|
|
9015
|
+
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
8947
9016
|
if (def.maximum < curr)
|
|
8948
9017
|
inst2._zod.bag.maximum = def.maximum;
|
|
8949
9018
|
});
|
|
@@ -8965,16 +9034,14 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
8965
9034
|
};
|
|
8966
9035
|
});
|
|
8967
9036
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
8968
|
-
var
|
|
8969
|
-
var _a5;
|
|
9037
|
+
var _a3;
|
|
8970
9038
|
$ZodCheck.init(inst, def);
|
|
8971
|
-
(
|
|
9039
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
8972
9040
|
const val = payload.value;
|
|
8973
9041
|
return !nullish(val) && val.length !== void 0;
|
|
8974
|
-
};
|
|
9042
|
+
});
|
|
8975
9043
|
inst._zod.onattach.push((inst2) => {
|
|
8976
|
-
|
|
8977
|
-
const curr = (_a7 = inst2._zod.bag.minimum) != null ? _a7 : Number.NEGATIVE_INFINITY;
|
|
9044
|
+
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
8978
9045
|
if (def.minimum > curr)
|
|
8979
9046
|
inst2._zod.bag.minimum = def.minimum;
|
|
8980
9047
|
});
|
|
@@ -8996,13 +9063,12 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
8996
9063
|
};
|
|
8997
9064
|
});
|
|
8998
9065
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
8999
|
-
var
|
|
9000
|
-
var _a5;
|
|
9066
|
+
var _a3;
|
|
9001
9067
|
$ZodCheck.init(inst, def);
|
|
9002
|
-
(
|
|
9068
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
9003
9069
|
const val = payload.value;
|
|
9004
9070
|
return !nullish(val) && val.length !== void 0;
|
|
9005
|
-
};
|
|
9071
|
+
});
|
|
9006
9072
|
inst._zod.onattach.push((inst2) => {
|
|
9007
9073
|
const bag = inst2._zod.bag;
|
|
9008
9074
|
bag.minimum = def.length;
|
|
@@ -9028,20 +9094,18 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
9028
9094
|
};
|
|
9029
9095
|
});
|
|
9030
9096
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
9031
|
-
var
|
|
9032
|
-
var _a5, _b;
|
|
9097
|
+
var _a3, _b;
|
|
9033
9098
|
$ZodCheck.init(inst, def);
|
|
9034
9099
|
inst._zod.onattach.push((inst2) => {
|
|
9035
|
-
var _a7;
|
|
9036
9100
|
const bag = inst2._zod.bag;
|
|
9037
9101
|
bag.format = def.format;
|
|
9038
9102
|
if (def.pattern) {
|
|
9039
|
-
|
|
9103
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
9040
9104
|
bag.patterns.add(def.pattern);
|
|
9041
9105
|
}
|
|
9042
9106
|
});
|
|
9043
9107
|
if (def.pattern)
|
|
9044
|
-
(
|
|
9108
|
+
(_a3 = inst._zod).check ?? (_a3.check = (payload) => {
|
|
9045
9109
|
def.pattern.lastIndex = 0;
|
|
9046
9110
|
if (def.pattern.test(payload.value))
|
|
9047
9111
|
return;
|
|
@@ -9054,10 +9118,10 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
|
|
|
9054
9118
|
inst,
|
|
9055
9119
|
continue: !def.abort
|
|
9056
9120
|
});
|
|
9057
|
-
};
|
|
9121
|
+
});
|
|
9058
9122
|
else
|
|
9059
|
-
(
|
|
9060
|
-
};
|
|
9123
|
+
(_b = inst._zod).check ?? (_b.check = () => {
|
|
9124
|
+
});
|
|
9061
9125
|
});
|
|
9062
9126
|
var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
9063
9127
|
$ZodCheckStringFormat.init(inst, def);
|
|
@@ -9077,13 +9141,11 @@ var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def)
|
|
|
9077
9141
|
};
|
|
9078
9142
|
});
|
|
9079
9143
|
var $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
9080
|
-
|
|
9081
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = lowercase;
|
|
9144
|
+
def.pattern ?? (def.pattern = lowercase);
|
|
9082
9145
|
$ZodCheckStringFormat.init(inst, def);
|
|
9083
9146
|
});
|
|
9084
9147
|
var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
9085
|
-
|
|
9086
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = uppercase;
|
|
9148
|
+
def.pattern ?? (def.pattern = uppercase);
|
|
9087
9149
|
$ZodCheckStringFormat.init(inst, def);
|
|
9088
9150
|
});
|
|
9089
9151
|
var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
@@ -9092,9 +9154,8 @@ var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst,
|
|
|
9092
9154
|
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
9093
9155
|
def.pattern = pattern;
|
|
9094
9156
|
inst._zod.onattach.push((inst2) => {
|
|
9095
|
-
var _a5;
|
|
9096
9157
|
const bag = inst2._zod.bag;
|
|
9097
|
-
|
|
9158
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
9098
9159
|
bag.patterns.add(pattern);
|
|
9099
9160
|
});
|
|
9100
9161
|
inst._zod.check = (payload) => {
|
|
@@ -9112,14 +9173,12 @@ var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst,
|
|
|
9112
9173
|
};
|
|
9113
9174
|
});
|
|
9114
9175
|
var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
9115
|
-
var _a5;
|
|
9116
9176
|
$ZodCheck.init(inst, def);
|
|
9117
9177
|
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
9118
|
-
|
|
9178
|
+
def.pattern ?? (def.pattern = pattern);
|
|
9119
9179
|
inst._zod.onattach.push((inst2) => {
|
|
9120
|
-
var _a6;
|
|
9121
9180
|
const bag = inst2._zod.bag;
|
|
9122
|
-
|
|
9181
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
9123
9182
|
bag.patterns.add(pattern);
|
|
9124
9183
|
});
|
|
9125
9184
|
inst._zod.check = (payload) => {
|
|
@@ -9137,14 +9196,12 @@ var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (i
|
|
|
9137
9196
|
};
|
|
9138
9197
|
});
|
|
9139
9198
|
var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
9140
|
-
var _a5;
|
|
9141
9199
|
$ZodCheck.init(inst, def);
|
|
9142
9200
|
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
9143
|
-
|
|
9201
|
+
def.pattern ?? (def.pattern = pattern);
|
|
9144
9202
|
inst._zod.onattach.push((inst2) => {
|
|
9145
|
-
var _a6;
|
|
9146
9203
|
const bag = inst2._zod.bag;
|
|
9147
|
-
|
|
9204
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
9148
9205
|
bag.patterns.add(pattern);
|
|
9149
9206
|
});
|
|
9150
9207
|
inst._zod.check = (payload) => {
|
|
@@ -9196,10 +9253,9 @@ var Doc = class {
|
|
|
9196
9253
|
}
|
|
9197
9254
|
}
|
|
9198
9255
|
compile() {
|
|
9199
|
-
var _a5;
|
|
9200
9256
|
const F = Function;
|
|
9201
|
-
const args = this
|
|
9202
|
-
const content =
|
|
9257
|
+
const args = this?.args;
|
|
9258
|
+
const content = this?.content ?? [``];
|
|
9203
9259
|
const lines = [...content.map((x) => ` ${x}`)];
|
|
9204
9260
|
return new F(...args, lines.join("\n"));
|
|
9205
9261
|
}
|
|
@@ -9214,13 +9270,12 @@ var version = {
|
|
|
9214
9270
|
|
|
9215
9271
|
// node_modules/zod/v4/core/schemas.js
|
|
9216
9272
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
9217
|
-
var
|
|
9218
|
-
|
|
9219
|
-
inst != null ? inst : inst = {};
|
|
9273
|
+
var _a3;
|
|
9274
|
+
inst ?? (inst = {});
|
|
9220
9275
|
inst._zod.def = def;
|
|
9221
9276
|
inst._zod.bag = inst._zod.bag || {};
|
|
9222
9277
|
inst._zod.version = version;
|
|
9223
|
-
const checks = [...
|
|
9278
|
+
const checks = [...inst._zod.def.checks ?? []];
|
|
9224
9279
|
if (inst._zod.traits.has("$ZodCheck")) {
|
|
9225
9280
|
checks.unshift(inst);
|
|
9226
9281
|
}
|
|
@@ -9230,8 +9285,8 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
9230
9285
|
}
|
|
9231
9286
|
}
|
|
9232
9287
|
if (checks.length === 0) {
|
|
9233
|
-
(
|
|
9234
|
-
|
|
9288
|
+
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
9289
|
+
inst._zod.deferred?.push(() => {
|
|
9235
9290
|
inst._zod.run = inst._zod.parse;
|
|
9236
9291
|
});
|
|
9237
9292
|
} else {
|
|
@@ -9250,11 +9305,11 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
9250
9305
|
}
|
|
9251
9306
|
const currLen = payload.issues.length;
|
|
9252
9307
|
const _ = ch._zod.check(payload);
|
|
9253
|
-
if (_ instanceof Promise &&
|
|
9308
|
+
if (_ instanceof Promise && ctx?.async === false) {
|
|
9254
9309
|
throw new $ZodAsyncError();
|
|
9255
9310
|
}
|
|
9256
9311
|
if (asyncResult || _ instanceof Promise) {
|
|
9257
|
-
asyncResult = (asyncResult
|
|
9312
|
+
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
9258
9313
|
await _;
|
|
9259
9314
|
const nextLen = payload.issues.length;
|
|
9260
9315
|
if (nextLen === currLen)
|
|
@@ -9314,15 +9369,11 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
9314
9369
|
}
|
|
9315
9370
|
defineLazy(inst, "~standard", () => ({
|
|
9316
9371
|
validate: (value) => {
|
|
9317
|
-
var _a7;
|
|
9318
9372
|
try {
|
|
9319
9373
|
const r = safeParse(inst, value);
|
|
9320
|
-
return r.success ? { value: r.data } : { issues:
|
|
9374
|
+
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
9321
9375
|
} catch (_) {
|
|
9322
|
-
return safeParseAsync(inst, value).then((r) => {
|
|
9323
|
-
var _a8;
|
|
9324
|
-
return r.success ? { value: r.data } : { issues: (_a8 = r.error) == null ? void 0 : _a8.issues };
|
|
9325
|
-
});
|
|
9376
|
+
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
9326
9377
|
}
|
|
9327
9378
|
},
|
|
9328
9379
|
vendor: "zod",
|
|
@@ -9330,9 +9381,8 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
9330
9381
|
}));
|
|
9331
9382
|
});
|
|
9332
9383
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
9333
|
-
var _a5, _b, _c;
|
|
9334
9384
|
$ZodType.init(inst, def);
|
|
9335
|
-
inst._zod.pattern =
|
|
9385
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
9336
9386
|
inst._zod.parse = (payload, _) => {
|
|
9337
9387
|
if (def.coerce)
|
|
9338
9388
|
try {
|
|
@@ -9355,12 +9405,10 @@ var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, d
|
|
|
9355
9405
|
$ZodString.init(inst, def);
|
|
9356
9406
|
});
|
|
9357
9407
|
var $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
|
|
9358
|
-
|
|
9359
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = guid;
|
|
9408
|
+
def.pattern ?? (def.pattern = guid);
|
|
9360
9409
|
$ZodStringFormat.init(inst, def);
|
|
9361
9410
|
});
|
|
9362
9411
|
var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
9363
|
-
var _a5, _b;
|
|
9364
9412
|
if (def.version) {
|
|
9365
9413
|
const versionMap = {
|
|
9366
9414
|
v1: 1,
|
|
@@ -9375,23 +9423,21 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
|
9375
9423
|
const v = versionMap[def.version];
|
|
9376
9424
|
if (v === void 0)
|
|
9377
9425
|
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
9378
|
-
|
|
9426
|
+
def.pattern ?? (def.pattern = uuid(v));
|
|
9379
9427
|
} else
|
|
9380
|
-
|
|
9428
|
+
def.pattern ?? (def.pattern = uuid());
|
|
9381
9429
|
$ZodStringFormat.init(inst, def);
|
|
9382
9430
|
});
|
|
9383
9431
|
var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
9384
|
-
|
|
9385
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = email;
|
|
9432
|
+
def.pattern ?? (def.pattern = email);
|
|
9386
9433
|
$ZodStringFormat.init(inst, def);
|
|
9387
9434
|
});
|
|
9388
9435
|
var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
9389
9436
|
$ZodStringFormat.init(inst, def);
|
|
9390
9437
|
inst._zod.check = (payload) => {
|
|
9391
|
-
var _a5;
|
|
9392
9438
|
try {
|
|
9393
9439
|
const trimmed = payload.value.trim();
|
|
9394
|
-
if (!def.normalize &&
|
|
9440
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source) {
|
|
9395
9441
|
if (!/^https?:\/\//i.test(trimmed)) {
|
|
9396
9442
|
payload.issues.push({
|
|
9397
9443
|
code: "invalid_format",
|
|
@@ -9451,69 +9497,56 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
9451
9497
|
};
|
|
9452
9498
|
});
|
|
9453
9499
|
var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
9454
|
-
|
|
9455
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = emoji();
|
|
9500
|
+
def.pattern ?? (def.pattern = emoji());
|
|
9456
9501
|
$ZodStringFormat.init(inst, def);
|
|
9457
9502
|
});
|
|
9458
9503
|
var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
9459
|
-
|
|
9460
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = nanoid;
|
|
9504
|
+
def.pattern ?? (def.pattern = nanoid);
|
|
9461
9505
|
$ZodStringFormat.init(inst, def);
|
|
9462
9506
|
});
|
|
9463
9507
|
var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
9464
|
-
|
|
9465
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = cuid;
|
|
9508
|
+
def.pattern ?? (def.pattern = cuid);
|
|
9466
9509
|
$ZodStringFormat.init(inst, def);
|
|
9467
9510
|
});
|
|
9468
9511
|
var $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
|
|
9469
|
-
|
|
9470
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = cuid2;
|
|
9512
|
+
def.pattern ?? (def.pattern = cuid2);
|
|
9471
9513
|
$ZodStringFormat.init(inst, def);
|
|
9472
9514
|
});
|
|
9473
9515
|
var $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
|
|
9474
|
-
|
|
9475
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = ulid;
|
|
9516
|
+
def.pattern ?? (def.pattern = ulid);
|
|
9476
9517
|
$ZodStringFormat.init(inst, def);
|
|
9477
9518
|
});
|
|
9478
9519
|
var $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
|
|
9479
|
-
|
|
9480
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = xid;
|
|
9520
|
+
def.pattern ?? (def.pattern = xid);
|
|
9481
9521
|
$ZodStringFormat.init(inst, def);
|
|
9482
9522
|
});
|
|
9483
9523
|
var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
9484
|
-
|
|
9485
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = ksuid;
|
|
9524
|
+
def.pattern ?? (def.pattern = ksuid);
|
|
9486
9525
|
$ZodStringFormat.init(inst, def);
|
|
9487
9526
|
});
|
|
9488
9527
|
var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
9489
|
-
|
|
9490
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = datetime(def);
|
|
9528
|
+
def.pattern ?? (def.pattern = datetime(def));
|
|
9491
9529
|
$ZodStringFormat.init(inst, def);
|
|
9492
9530
|
});
|
|
9493
9531
|
var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
9494
|
-
|
|
9495
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = date;
|
|
9532
|
+
def.pattern ?? (def.pattern = date);
|
|
9496
9533
|
$ZodStringFormat.init(inst, def);
|
|
9497
9534
|
});
|
|
9498
9535
|
var $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
9499
|
-
|
|
9500
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = time(def);
|
|
9536
|
+
def.pattern ?? (def.pattern = time(def));
|
|
9501
9537
|
$ZodStringFormat.init(inst, def);
|
|
9502
9538
|
});
|
|
9503
9539
|
var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
9504
|
-
|
|
9505
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = duration;
|
|
9540
|
+
def.pattern ?? (def.pattern = duration);
|
|
9506
9541
|
$ZodStringFormat.init(inst, def);
|
|
9507
9542
|
});
|
|
9508
9543
|
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
9509
|
-
|
|
9510
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = ipv4;
|
|
9544
|
+
def.pattern ?? (def.pattern = ipv4);
|
|
9511
9545
|
$ZodStringFormat.init(inst, def);
|
|
9512
9546
|
inst._zod.bag.format = `ipv4`;
|
|
9513
9547
|
});
|
|
9514
9548
|
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
9515
|
-
|
|
9516
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = ipv6;
|
|
9549
|
+
def.pattern ?? (def.pattern = ipv6);
|
|
9517
9550
|
$ZodStringFormat.init(inst, def);
|
|
9518
9551
|
inst._zod.bag.format = `ipv6`;
|
|
9519
9552
|
inst._zod.check = (payload) => {
|
|
@@ -9531,13 +9564,11 @@ var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
|
9531
9564
|
};
|
|
9532
9565
|
});
|
|
9533
9566
|
var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
9534
|
-
|
|
9535
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = cidrv4;
|
|
9567
|
+
def.pattern ?? (def.pattern = cidrv4);
|
|
9536
9568
|
$ZodStringFormat.init(inst, def);
|
|
9537
9569
|
});
|
|
9538
9570
|
var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
9539
|
-
|
|
9540
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = cidrv6;
|
|
9571
|
+
def.pattern ?? (def.pattern = cidrv6);
|
|
9541
9572
|
$ZodStringFormat.init(inst, def);
|
|
9542
9573
|
inst._zod.check = (payload) => {
|
|
9543
9574
|
const parts = payload.value.split("/");
|
|
@@ -9579,8 +9610,7 @@ function isValidBase64(data) {
|
|
|
9579
9610
|
}
|
|
9580
9611
|
}
|
|
9581
9612
|
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
9582
|
-
|
|
9583
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = base64;
|
|
9613
|
+
def.pattern ?? (def.pattern = base64);
|
|
9584
9614
|
$ZodStringFormat.init(inst, def);
|
|
9585
9615
|
inst._zod.bag.contentEncoding = "base64";
|
|
9586
9616
|
inst._zod.check = (payload) => {
|
|
@@ -9603,8 +9633,7 @@ function isValidBase64URL(data) {
|
|
|
9603
9633
|
return isValidBase64(padded);
|
|
9604
9634
|
}
|
|
9605
9635
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
9606
|
-
|
|
9607
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = base64url;
|
|
9636
|
+
def.pattern ?? (def.pattern = base64url);
|
|
9608
9637
|
$ZodStringFormat.init(inst, def);
|
|
9609
9638
|
inst._zod.bag.contentEncoding = "base64url";
|
|
9610
9639
|
inst._zod.check = (payload) => {
|
|
@@ -9620,8 +9649,7 @@ var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) =>
|
|
|
9620
9649
|
};
|
|
9621
9650
|
});
|
|
9622
9651
|
var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
|
|
9623
|
-
|
|
9624
|
-
(_a5 = def.pattern) != null ? _a5 : def.pattern = e164;
|
|
9652
|
+
def.pattern ?? (def.pattern = e164);
|
|
9625
9653
|
$ZodStringFormat.init(inst, def);
|
|
9626
9654
|
});
|
|
9627
9655
|
function isValidJWT(token, algorithm = null) {
|
|
@@ -9633,7 +9661,7 @@ function isValidJWT(token, algorithm = null) {
|
|
|
9633
9661
|
if (!header)
|
|
9634
9662
|
return false;
|
|
9635
9663
|
const parsedHeader = JSON.parse(atob(header));
|
|
9636
|
-
if ("typ" in parsedHeader &&
|
|
9664
|
+
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
|
|
9637
9665
|
return false;
|
|
9638
9666
|
if (!parsedHeader.alg)
|
|
9639
9667
|
return false;
|
|
@@ -9659,9 +9687,8 @@ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
|
9659
9687
|
};
|
|
9660
9688
|
});
|
|
9661
9689
|
var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
9662
|
-
var _a5;
|
|
9663
9690
|
$ZodType.init(inst, def);
|
|
9664
|
-
inst._zod.pattern =
|
|
9691
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? number;
|
|
9665
9692
|
inst._zod.parse = (payload, _ctx) => {
|
|
9666
9693
|
if (def.coerce)
|
|
9667
9694
|
try {
|
|
@@ -9808,10 +9835,9 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
9808
9835
|
}
|
|
9809
9836
|
}
|
|
9810
9837
|
function normalizeDef(def) {
|
|
9811
|
-
var _a5, _b, _c, _d;
|
|
9812
9838
|
const keys = Object.keys(def.shape);
|
|
9813
9839
|
for (const k of keys) {
|
|
9814
|
-
if (!
|
|
9840
|
+
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
9815
9841
|
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
9816
9842
|
}
|
|
9817
9843
|
}
|
|
@@ -9864,7 +9890,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
9864
9890
|
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
9865
9891
|
$ZodType.init(inst, def);
|
|
9866
9892
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
9867
|
-
if (!
|
|
9893
|
+
if (!desc?.get) {
|
|
9868
9894
|
const sh = def.shape;
|
|
9869
9895
|
Object.defineProperty(def, "shape", {
|
|
9870
9896
|
get: () => {
|
|
@@ -9878,13 +9904,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
9878
9904
|
}
|
|
9879
9905
|
const _normalized = cached(() => normalizeDef(def));
|
|
9880
9906
|
defineLazy(inst._zod, "propValues", () => {
|
|
9881
|
-
var _a5;
|
|
9882
9907
|
const shape = def.shape;
|
|
9883
9908
|
const propValues = {};
|
|
9884
9909
|
for (const key in shape) {
|
|
9885
9910
|
const field = shape[key]._zod;
|
|
9886
9911
|
if (field.values) {
|
|
9887
|
-
|
|
9912
|
+
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
9888
9913
|
for (const v of field.values)
|
|
9889
9914
|
propValues[key].add(v);
|
|
9890
9915
|
}
|
|
@@ -9895,7 +9920,7 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
9895
9920
|
const catchall = def.catchall;
|
|
9896
9921
|
let value;
|
|
9897
9922
|
inst._zod.parse = (payload, ctx) => {
|
|
9898
|
-
value
|
|
9923
|
+
value ?? (value = _normalized.value);
|
|
9899
9924
|
const input = payload.value;
|
|
9900
9925
|
if (!isObject2(input)) {
|
|
9901
9926
|
payload.issues.push({
|
|
@@ -9931,7 +9956,6 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
9931
9956
|
const superParse = inst._zod.parse;
|
|
9932
9957
|
const _normalized = cached(() => normalizeDef(def));
|
|
9933
9958
|
const generateFastpass = (shape) => {
|
|
9934
|
-
var _a5, _b;
|
|
9935
9959
|
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
9936
9960
|
const normalized = _normalized.value;
|
|
9937
9961
|
const parseStr = (key) => {
|
|
@@ -9949,8 +9973,8 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
9949
9973
|
const id = ids[key];
|
|
9950
9974
|
const k = esc(key);
|
|
9951
9975
|
const schema = shape[key];
|
|
9952
|
-
const isOptionalIn =
|
|
9953
|
-
const isOptionalOut =
|
|
9976
|
+
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
9977
|
+
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
9954
9978
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
9955
9979
|
if (isOptionalIn && isOptionalOut) {
|
|
9956
9980
|
doc.write(`
|
|
@@ -10032,7 +10056,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
10032
10056
|
const catchall = def.catchall;
|
|
10033
10057
|
let value;
|
|
10034
10058
|
inst._zod.parse = (payload, ctx) => {
|
|
10035
|
-
value
|
|
10059
|
+
value ?? (value = _normalized.value);
|
|
10036
10060
|
const input = payload.value;
|
|
10037
10061
|
if (!isObject2(input)) {
|
|
10038
10062
|
payload.issues.push({
|
|
@@ -10043,7 +10067,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
10043
10067
|
});
|
|
10044
10068
|
return payload;
|
|
10045
10069
|
}
|
|
10046
|
-
if (jit && fastEnabled &&
|
|
10070
|
+
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
10047
10071
|
if (!fastpass)
|
|
10048
10072
|
fastpass = generateFastpass(def.shape);
|
|
10049
10073
|
payload = fastpass(payload, ctx);
|
|
@@ -10140,11 +10164,10 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
10140
10164
|
return propValues;
|
|
10141
10165
|
});
|
|
10142
10166
|
const disc = cached(() => {
|
|
10143
|
-
var _a5;
|
|
10144
10167
|
const opts = def.options;
|
|
10145
10168
|
const map = /* @__PURE__ */ new Map();
|
|
10146
10169
|
for (const o of opts) {
|
|
10147
|
-
const values =
|
|
10170
|
+
const values = o._zod.propValues?.[def.discriminator];
|
|
10148
10171
|
if (!values || values.size === 0)
|
|
10149
10172
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
10150
10173
|
for (const v of values) {
|
|
@@ -10167,7 +10190,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
10167
10190
|
});
|
|
10168
10191
|
return payload;
|
|
10169
10192
|
}
|
|
10170
|
-
const opt = disc.value.get(input
|
|
10193
|
+
const opt = disc.value.get(input?.[def.discriminator]);
|
|
10171
10194
|
if (opt) {
|
|
10172
10195
|
return opt._zod.run(payload, ctx);
|
|
10173
10196
|
}
|
|
@@ -10251,7 +10274,7 @@ function handleIntersectionResults(result, left, right) {
|
|
|
10251
10274
|
let unrecIssue;
|
|
10252
10275
|
for (const iss of left.issues) {
|
|
10253
10276
|
if (iss.code === "unrecognized_keys") {
|
|
10254
|
-
unrecIssue
|
|
10277
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
10255
10278
|
for (const k of iss.keys) {
|
|
10256
10279
|
if (!unrecKeys.has(k))
|
|
10257
10280
|
unrecKeys.set(k, {});
|
|
@@ -10341,7 +10364,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
10341
10364
|
let unrecognized;
|
|
10342
10365
|
for (const key in input) {
|
|
10343
10366
|
if (!recordKeys.has(key)) {
|
|
10344
|
-
unrecognized = unrecognized
|
|
10367
|
+
unrecognized = unrecognized ?? [];
|
|
10345
10368
|
unrecognized.push(key);
|
|
10346
10369
|
}
|
|
10347
10370
|
}
|
|
@@ -10674,14 +10697,8 @@ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
10674
10697
|
$ZodType.init(inst, def);
|
|
10675
10698
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
10676
10699
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
10677
|
-
defineLazy(inst._zod, "optin", () =>
|
|
10678
|
-
|
|
10679
|
-
return (_b = (_a5 = def.innerType) == null ? void 0 : _a5._zod) == null ? void 0 : _b.optin;
|
|
10680
|
-
});
|
|
10681
|
-
defineLazy(inst._zod, "optout", () => {
|
|
10682
|
-
var _a5, _b;
|
|
10683
|
-
return (_b = (_a5 = def.innerType) == null ? void 0 : _a5._zod) == null ? void 0 : _b.optout;
|
|
10684
|
-
});
|
|
10700
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
10701
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
10685
10702
|
inst._zod.parse = (payload, ctx) => {
|
|
10686
10703
|
if (ctx.direction === "backward") {
|
|
10687
10704
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -10714,14 +10731,13 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
10714
10731
|
};
|
|
10715
10732
|
});
|
|
10716
10733
|
function handleRefineResult(result, payload, input, inst) {
|
|
10717
|
-
var _a5;
|
|
10718
10734
|
if (!result) {
|
|
10719
10735
|
const _iss = {
|
|
10720
10736
|
code: "custom",
|
|
10721
10737
|
input,
|
|
10722
10738
|
inst,
|
|
10723
10739
|
// incorporates params.error into issue reporting
|
|
10724
|
-
path: [...
|
|
10740
|
+
path: [...inst._zod.def.path ?? []],
|
|
10725
10741
|
// incorporates params.error into issue reporting
|
|
10726
10742
|
continue: !inst._zod.def.abort
|
|
10727
10743
|
// params: inst._zod.def.params,
|
|
@@ -10742,8 +10758,7 @@ var error = () => {
|
|
|
10742
10758
|
map: { unit: "entries", verb: "to have" }
|
|
10743
10759
|
};
|
|
10744
10760
|
function getSizing(origin) {
|
|
10745
|
-
|
|
10746
|
-
return (_a5 = Sizable[origin]) != null ? _a5 : null;
|
|
10761
|
+
return Sizable[origin] ?? null;
|
|
10747
10762
|
}
|
|
10748
10763
|
const FormatDictionary = {
|
|
10749
10764
|
regex: "input",
|
|
@@ -10782,12 +10797,11 @@ var error = () => {
|
|
|
10782
10797
|
// All other type names omitted - they fall back to raw values via ?? operator
|
|
10783
10798
|
};
|
|
10784
10799
|
return (issue2) => {
|
|
10785
|
-
var _a5, _b, _c, _d, _e, _f;
|
|
10786
10800
|
switch (issue2.code) {
|
|
10787
10801
|
case "invalid_type": {
|
|
10788
|
-
const expected =
|
|
10802
|
+
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
|
|
10789
10803
|
const receivedType = parsedType(issue2.input);
|
|
10790
|
-
const received =
|
|
10804
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
10791
10805
|
return `Invalid input: expected ${expected}, received ${received}`;
|
|
10792
10806
|
}
|
|
10793
10807
|
case "invalid_value":
|
|
@@ -10798,8 +10812,8 @@ var error = () => {
|
|
|
10798
10812
|
const adj = issue2.inclusive ? "<=" : "<";
|
|
10799
10813
|
const sizing = getSizing(issue2.origin);
|
|
10800
10814
|
if (sizing)
|
|
10801
|
-
return `Too big: expected ${
|
|
10802
|
-
return `Too big: expected ${
|
|
10815
|
+
return `Too big: expected ${issue2.origin ?? "value"} to have ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
10816
|
+
return `Too big: expected ${issue2.origin ?? "value"} to be ${adj}${issue2.maximum.toString()}`;
|
|
10803
10817
|
}
|
|
10804
10818
|
case "too_small": {
|
|
10805
10819
|
const adj = issue2.inclusive ? ">=" : ">";
|
|
@@ -10820,7 +10834,7 @@ var error = () => {
|
|
|
10820
10834
|
return `Invalid string: must include "${_issue.includes}"`;
|
|
10821
10835
|
if (_issue.format === "regex")
|
|
10822
10836
|
return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
10823
|
-
return `Invalid ${
|
|
10837
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
|
|
10824
10838
|
}
|
|
10825
10839
|
case "not_multiple_of":
|
|
10826
10840
|
return `Invalid number: must be a multiple of ${issue2.divisor}`;
|
|
@@ -10848,7 +10862,7 @@ function en_default() {
|
|
|
10848
10862
|
}
|
|
10849
10863
|
|
|
10850
10864
|
// node_modules/zod/v4/core/registries.js
|
|
10851
|
-
var
|
|
10865
|
+
var _a2;
|
|
10852
10866
|
var $ZodRegistry = class {
|
|
10853
10867
|
constructor() {
|
|
10854
10868
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
@@ -10876,10 +10890,9 @@ var $ZodRegistry = class {
|
|
|
10876
10890
|
return this;
|
|
10877
10891
|
}
|
|
10878
10892
|
get(schema) {
|
|
10879
|
-
var _a5;
|
|
10880
10893
|
const p = schema._zod.parent;
|
|
10881
10894
|
if (p) {
|
|
10882
|
-
const pm = { ...
|
|
10895
|
+
const pm = { ...this.get(p) ?? {} };
|
|
10883
10896
|
delete pm.id;
|
|
10884
10897
|
const f = { ...pm, ...this._map.get(schema) };
|
|
10885
10898
|
return Object.keys(f).length ? f : void 0;
|
|
@@ -10893,8 +10906,7 @@ var $ZodRegistry = class {
|
|
|
10893
10906
|
function registry() {
|
|
10894
10907
|
return new $ZodRegistry();
|
|
10895
10908
|
}
|
|
10896
|
-
|
|
10897
|
-
(_a4 = (_a3 = globalThis).__zod_globalRegistry) != null ? _a4 : _a3.__zod_globalRegistry = registry();
|
|
10909
|
+
(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
|
|
10898
10910
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
10899
10911
|
|
|
10900
10912
|
// node_modules/zod/v4/core/api.js
|
|
@@ -11374,9 +11386,8 @@ function _array(Class2, element, params) {
|
|
|
11374
11386
|
}
|
|
11375
11387
|
// @__NO_SIDE_EFFECTS__
|
|
11376
11388
|
function _custom(Class2, fn, _params) {
|
|
11377
|
-
var _a5;
|
|
11378
11389
|
const norm = normalizeParams(_params);
|
|
11379
|
-
|
|
11390
|
+
norm.abort ?? (norm.abort = true);
|
|
11380
11391
|
const schema = new Class2({
|
|
11381
11392
|
type: "custom",
|
|
11382
11393
|
check: "custom",
|
|
@@ -11399,17 +11410,16 @@ function _refine(Class2, fn, _params) {
|
|
|
11399
11410
|
function _superRefine(fn, params) {
|
|
11400
11411
|
const ch = /* @__PURE__ */ _check((payload) => {
|
|
11401
11412
|
payload.addIssue = (issue2) => {
|
|
11402
|
-
var _a5, _b, _c, _d;
|
|
11403
11413
|
if (typeof issue2 === "string") {
|
|
11404
11414
|
payload.issues.push(issue(issue2, payload.value, ch._zod.def));
|
|
11405
11415
|
} else {
|
|
11406
11416
|
const _issue = issue2;
|
|
11407
11417
|
if (_issue.fatal)
|
|
11408
11418
|
_issue.continue = false;
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11419
|
+
_issue.code ?? (_issue.code = "custom");
|
|
11420
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
11421
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
11422
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
11413
11423
|
payload.issues.push(issue(_issue));
|
|
11414
11424
|
}
|
|
11415
11425
|
};
|
|
@@ -11429,30 +11439,28 @@ function _check(fn, params) {
|
|
|
11429
11439
|
|
|
11430
11440
|
// node_modules/zod/v4/core/to-json-schema.js
|
|
11431
11441
|
function initializeContext(params) {
|
|
11432
|
-
|
|
11433
|
-
let target = (_a5 = params == null ? void 0 : params.target) != null ? _a5 : "draft-2020-12";
|
|
11442
|
+
let target = params?.target ?? "draft-2020-12";
|
|
11434
11443
|
if (target === "draft-4")
|
|
11435
11444
|
target = "draft-04";
|
|
11436
11445
|
if (target === "draft-7")
|
|
11437
11446
|
target = "draft-07";
|
|
11438
11447
|
return {
|
|
11439
|
-
processors:
|
|
11440
|
-
metadataRegistry:
|
|
11448
|
+
processors: params.processors ?? {},
|
|
11449
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
11441
11450
|
target,
|
|
11442
|
-
unrepresentable:
|
|
11443
|
-
override:
|
|
11451
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
11452
|
+
override: params?.override ?? (() => {
|
|
11444
11453
|
}),
|
|
11445
|
-
io:
|
|
11454
|
+
io: params?.io ?? "output",
|
|
11446
11455
|
counter: 0,
|
|
11447
11456
|
seen: /* @__PURE__ */ new Map(),
|
|
11448
|
-
cycles:
|
|
11449
|
-
reused:
|
|
11450
|
-
external:
|
|
11457
|
+
cycles: params?.cycles ?? "ref",
|
|
11458
|
+
reused: params?.reused ?? "inline",
|
|
11459
|
+
external: params?.external ?? void 0
|
|
11451
11460
|
};
|
|
11452
11461
|
}
|
|
11453
11462
|
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
11454
|
-
var
|
|
11455
|
-
var _a5;
|
|
11463
|
+
var _a3;
|
|
11456
11464
|
const def = schema._zod.def;
|
|
11457
11465
|
const seen = ctx.seen.get(schema);
|
|
11458
11466
|
if (seen) {
|
|
@@ -11465,7 +11473,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
11465
11473
|
}
|
|
11466
11474
|
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
11467
11475
|
ctx.seen.set(schema, result);
|
|
11468
|
-
const overrideSchema =
|
|
11476
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
11469
11477
|
if (overrideSchema) {
|
|
11470
11478
|
result.schema = overrideSchema;
|
|
11471
11479
|
} else {
|
|
@@ -11500,19 +11508,18 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
11500
11508
|
delete result.schema.default;
|
|
11501
11509
|
}
|
|
11502
11510
|
if (ctx.io === "input" && "_prefault" in result.schema)
|
|
11503
|
-
(
|
|
11511
|
+
(_a3 = result.schema).default ?? (_a3.default = result.schema._prefault);
|
|
11504
11512
|
delete result.schema._prefault;
|
|
11505
11513
|
const _result = ctx.seen.get(schema);
|
|
11506
11514
|
return _result.schema;
|
|
11507
11515
|
}
|
|
11508
11516
|
function extractDefs(ctx, schema) {
|
|
11509
|
-
var _a5, _b, _c, _d;
|
|
11510
11517
|
const root = ctx.seen.get(schema);
|
|
11511
11518
|
if (!root)
|
|
11512
11519
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11513
11520
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
11514
11521
|
for (const entry of ctx.seen.entries()) {
|
|
11515
|
-
const id =
|
|
11522
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11516
11523
|
if (id) {
|
|
11517
11524
|
const existing = idToSchema.get(id);
|
|
11518
11525
|
if (existing && existing !== entry[0]) {
|
|
@@ -11522,15 +11529,14 @@ function extractDefs(ctx, schema) {
|
|
|
11522
11529
|
}
|
|
11523
11530
|
}
|
|
11524
11531
|
const makeURI = (entry) => {
|
|
11525
|
-
var _a6, _b2, _c2, _d2, _e;
|
|
11526
11532
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
11527
11533
|
if (ctx.external) {
|
|
11528
|
-
const externalId =
|
|
11529
|
-
const uriGenerator =
|
|
11534
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
11535
|
+
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
11530
11536
|
if (externalId) {
|
|
11531
11537
|
return { ref: uriGenerator(externalId) };
|
|
11532
11538
|
}
|
|
11533
|
-
const id =
|
|
11539
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
11534
11540
|
entry[1].defId = id;
|
|
11535
11541
|
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
11536
11542
|
}
|
|
@@ -11539,7 +11545,7 @@ function extractDefs(ctx, schema) {
|
|
|
11539
11545
|
}
|
|
11540
11546
|
const uriPrefix = `#`;
|
|
11541
11547
|
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
11542
|
-
const defId =
|
|
11548
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
11543
11549
|
return { defId, ref: defUriPrefix + defId };
|
|
11544
11550
|
};
|
|
11545
11551
|
const extractToDef = (entry) => {
|
|
@@ -11561,7 +11567,7 @@ function extractDefs(ctx, schema) {
|
|
|
11561
11567
|
for (const entry of ctx.seen.entries()) {
|
|
11562
11568
|
const seen = entry[1];
|
|
11563
11569
|
if (seen.cycle) {
|
|
11564
|
-
throw new Error(`Cycle detected: #/${
|
|
11570
|
+
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
11565
11571
|
|
|
11566
11572
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
11567
11573
|
}
|
|
@@ -11574,13 +11580,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11574
11580
|
continue;
|
|
11575
11581
|
}
|
|
11576
11582
|
if (ctx.external) {
|
|
11577
|
-
const ext =
|
|
11583
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
11578
11584
|
if (schema !== entry[0] && ext) {
|
|
11579
11585
|
extractToDef(entry);
|
|
11580
11586
|
continue;
|
|
11581
11587
|
}
|
|
11582
11588
|
}
|
|
11583
|
-
const id =
|
|
11589
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11584
11590
|
if (id) {
|
|
11585
11591
|
extractToDef(entry);
|
|
11586
11592
|
continue;
|
|
@@ -11598,16 +11604,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11598
11604
|
}
|
|
11599
11605
|
}
|
|
11600
11606
|
function finalize(ctx, schema) {
|
|
11601
|
-
var _a5, _b, _c, _d, _e, _f;
|
|
11602
11607
|
const root = ctx.seen.get(schema);
|
|
11603
11608
|
if (!root)
|
|
11604
11609
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11605
11610
|
const flattenRef = (zodSchema) => {
|
|
11606
|
-
var _a6, _b2, _c2;
|
|
11607
11611
|
const seen = ctx.seen.get(zodSchema);
|
|
11608
11612
|
if (seen.ref === null)
|
|
11609
11613
|
return;
|
|
11610
|
-
const schema2 =
|
|
11614
|
+
const schema2 = seen.def ?? seen.schema;
|
|
11611
11615
|
const _cached = { ...schema2 };
|
|
11612
11616
|
const ref = seen.ref;
|
|
11613
11617
|
seen.ref = null;
|
|
@@ -11616,7 +11620,7 @@ function finalize(ctx, schema) {
|
|
|
11616
11620
|
const refSeen = ctx.seen.get(ref);
|
|
11617
11621
|
const refSchema = refSeen.schema;
|
|
11618
11622
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
11619
|
-
schema2.allOf =
|
|
11623
|
+
schema2.allOf = schema2.allOf ?? [];
|
|
11620
11624
|
schema2.allOf.push(refSchema);
|
|
11621
11625
|
} else {
|
|
11622
11626
|
Object.assign(schema2, refSchema);
|
|
@@ -11646,7 +11650,7 @@ function finalize(ctx, schema) {
|
|
|
11646
11650
|
if (parent && parent !== ref) {
|
|
11647
11651
|
flattenRef(parent);
|
|
11648
11652
|
const parentSeen = ctx.seen.get(parent);
|
|
11649
|
-
if (parentSeen
|
|
11653
|
+
if (parentSeen?.schema.$ref) {
|
|
11650
11654
|
schema2.$ref = parentSeen.schema.$ref;
|
|
11651
11655
|
if (parentSeen.def) {
|
|
11652
11656
|
for (const key in schema2) {
|
|
@@ -11662,7 +11666,7 @@ function finalize(ctx, schema) {
|
|
|
11662
11666
|
ctx.override({
|
|
11663
11667
|
zodSchema,
|
|
11664
11668
|
jsonSchema: schema2,
|
|
11665
|
-
path:
|
|
11669
|
+
path: seen.path ?? []
|
|
11666
11670
|
});
|
|
11667
11671
|
};
|
|
11668
11672
|
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
@@ -11678,17 +11682,17 @@ function finalize(ctx, schema) {
|
|
|
11678
11682
|
} else if (ctx.target === "openapi-3.0") {
|
|
11679
11683
|
} else {
|
|
11680
11684
|
}
|
|
11681
|
-
if (
|
|
11682
|
-
const id =
|
|
11685
|
+
if (ctx.external?.uri) {
|
|
11686
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
11683
11687
|
if (!id)
|
|
11684
11688
|
throw new Error("Schema is missing an `id` property");
|
|
11685
11689
|
result.$id = ctx.external.uri(id);
|
|
11686
11690
|
}
|
|
11687
|
-
Object.assign(result,
|
|
11688
|
-
const rootMetaId =
|
|
11691
|
+
Object.assign(result, root.def ?? root.schema);
|
|
11692
|
+
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
11689
11693
|
if (rootMetaId !== void 0 && result.id === rootMetaId)
|
|
11690
11694
|
delete result.id;
|
|
11691
|
-
const defs =
|
|
11695
|
+
const defs = ctx.external?.defs ?? {};
|
|
11692
11696
|
for (const entry of ctx.seen.entries()) {
|
|
11693
11697
|
const seen = entry[1];
|
|
11694
11698
|
if (seen.def && seen.defId) {
|
|
@@ -11726,7 +11730,7 @@ function finalize(ctx, schema) {
|
|
|
11726
11730
|
}
|
|
11727
11731
|
}
|
|
11728
11732
|
function isTransforming(_schema, _ctx) {
|
|
11729
|
-
const ctx = _ctx
|
|
11733
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
11730
11734
|
if (ctx.seen.has(_schema))
|
|
11731
11735
|
return false;
|
|
11732
11736
|
ctx.seen.add(_schema);
|
|
@@ -11785,8 +11789,8 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
11785
11789
|
return finalize(ctx, schema);
|
|
11786
11790
|
};
|
|
11787
11791
|
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
11788
|
-
const { libraryOptions, target } = params
|
|
11789
|
-
const ctx = initializeContext({ ...libraryOptions
|
|
11792
|
+
const { libraryOptions, target } = params ?? {};
|
|
11793
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
11790
11794
|
process2(schema, ctx);
|
|
11791
11795
|
extractDefs(ctx, schema);
|
|
11792
11796
|
return finalize(ctx, schema);
|
|
@@ -11802,7 +11806,6 @@ var formatMap = {
|
|
|
11802
11806
|
// do not set
|
|
11803
11807
|
};
|
|
11804
11808
|
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
11805
|
-
var _a5;
|
|
11806
11809
|
const json = _json;
|
|
11807
11810
|
json.type = "string";
|
|
11808
11811
|
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
@@ -11811,7 +11814,7 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
11811
11814
|
if (typeof maximum === "number")
|
|
11812
11815
|
json.maxLength = maximum;
|
|
11813
11816
|
if (format) {
|
|
11814
|
-
json.format =
|
|
11817
|
+
json.format = formatMap[format] ?? format;
|
|
11815
11818
|
if (json.format === "")
|
|
11816
11819
|
delete json.format;
|
|
11817
11820
|
if (format === "time") {
|
|
@@ -11841,8 +11844,8 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
11841
11844
|
json.type = "integer";
|
|
11842
11845
|
else
|
|
11843
11846
|
json.type = "number";
|
|
11844
|
-
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum
|
|
11845
|
-
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum
|
|
11847
|
+
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
11848
|
+
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
11846
11849
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
11847
11850
|
if (exMin) {
|
|
11848
11851
|
if (legacy) {
|
|
@@ -11958,7 +11961,6 @@ var arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
11958
11961
|
});
|
|
11959
11962
|
};
|
|
11960
11963
|
var objectProcessor = (schema, ctx, _json, params) => {
|
|
11961
|
-
var _a5;
|
|
11962
11964
|
const json = _json;
|
|
11963
11965
|
const def = schema._zod.def;
|
|
11964
11966
|
json.type = "object";
|
|
@@ -11982,7 +11984,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
11982
11984
|
if (requiredKeys.size > 0) {
|
|
11983
11985
|
json.required = Array.from(requiredKeys);
|
|
11984
11986
|
}
|
|
11985
|
-
if (
|
|
11987
|
+
if (def.catchall?._zod.def.type === "never") {
|
|
11986
11988
|
json.additionalProperties = false;
|
|
11987
11989
|
} else if (!def.catchall) {
|
|
11988
11990
|
if (ctx.io === "output")
|
|
@@ -12030,7 +12032,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
12030
12032
|
json.type = "object";
|
|
12031
12033
|
const keyType = def.keyType;
|
|
12032
12034
|
const keyBag = keyType._zod.bag;
|
|
12033
|
-
const patterns = keyBag
|
|
12035
|
+
const patterns = keyBag?.patterns;
|
|
12034
12036
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
12035
12037
|
const valueSchema = process2(def.valueType, ctx, {
|
|
12036
12038
|
...params,
|
|
@@ -12142,13 +12144,12 @@ function safeParse2(schema, data) {
|
|
|
12142
12144
|
return result;
|
|
12143
12145
|
}
|
|
12144
12146
|
function getObjectShape(schema) {
|
|
12145
|
-
var _a5, _b;
|
|
12146
12147
|
if (!schema)
|
|
12147
12148
|
return void 0;
|
|
12148
12149
|
let rawShape;
|
|
12149
12150
|
if (isZ4Schema(schema)) {
|
|
12150
12151
|
const v4Schema = schema;
|
|
12151
|
-
rawShape =
|
|
12152
|
+
rawShape = v4Schema._zod?.def?.shape;
|
|
12152
12153
|
} else {
|
|
12153
12154
|
const v3Schema = schema;
|
|
12154
12155
|
rawShape = v3Schema.shape;
|
|
@@ -12165,10 +12166,9 @@ function getObjectShape(schema) {
|
|
|
12165
12166
|
return rawShape;
|
|
12166
12167
|
}
|
|
12167
12168
|
function getLiteralValue(schema) {
|
|
12168
|
-
var _a5;
|
|
12169
12169
|
if (isZ4Schema(schema)) {
|
|
12170
12170
|
const v4Schema = schema;
|
|
12171
|
-
const def2 =
|
|
12171
|
+
const def2 = v4Schema._zod?.def;
|
|
12172
12172
|
if (def2) {
|
|
12173
12173
|
if (def2.value !== void 0)
|
|
12174
12174
|
return def2.value;
|
|
@@ -12351,11 +12351,10 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
12351
12351
|
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params);
|
|
12352
12352
|
_installLazyMethods(inst, "ZodType", {
|
|
12353
12353
|
check(...chks) {
|
|
12354
|
-
var _a5;
|
|
12355
12354
|
const def2 = this.def;
|
|
12356
12355
|
return this.clone(util_exports.mergeDefs(def2, {
|
|
12357
12356
|
checks: [
|
|
12358
|
-
...
|
|
12357
|
+
...def2.checks ?? [],
|
|
12359
12358
|
...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
12360
12359
|
]
|
|
12361
12360
|
}), { parent: true });
|
|
@@ -12448,22 +12447,20 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
12448
12447
|
});
|
|
12449
12448
|
Object.defineProperty(inst, "description", {
|
|
12450
12449
|
get() {
|
|
12451
|
-
|
|
12452
|
-
return (_a5 = globalRegistry.get(inst)) == null ? void 0 : _a5.description;
|
|
12450
|
+
return globalRegistry.get(inst)?.description;
|
|
12453
12451
|
},
|
|
12454
12452
|
configurable: true
|
|
12455
12453
|
});
|
|
12456
12454
|
return inst;
|
|
12457
12455
|
});
|
|
12458
12456
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
12459
|
-
var _a5, _b, _c;
|
|
12460
12457
|
$ZodString.init(inst, def);
|
|
12461
12458
|
ZodType.init(inst, def);
|
|
12462
12459
|
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
12463
12460
|
const bag = inst._zod.bag;
|
|
12464
|
-
inst.format =
|
|
12465
|
-
inst.minLength =
|
|
12466
|
-
inst.maxLength =
|
|
12461
|
+
inst.format = bag.format ?? null;
|
|
12462
|
+
inst.minLength = bag.minimum ?? null;
|
|
12463
|
+
inst.maxLength = bag.maximum ?? null;
|
|
12467
12464
|
_installLazyMethods(inst, "_ZodString", {
|
|
12468
12465
|
regex(...args) {
|
|
12469
12466
|
return this.check(_regex(...args));
|
|
@@ -12627,7 +12624,6 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
12627
12624
|
ZodStringFormat.init(inst, def);
|
|
12628
12625
|
});
|
|
12629
12626
|
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
12630
|
-
var _a5, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
12631
12627
|
$ZodNumber.init(inst, def);
|
|
12632
12628
|
ZodType.init(inst, def);
|
|
12633
12629
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
@@ -12679,11 +12675,11 @@ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
|
12679
12675
|
}
|
|
12680
12676
|
});
|
|
12681
12677
|
const bag = inst._zod.bag;
|
|
12682
|
-
inst.minValue =
|
|
12683
|
-
inst.maxValue =
|
|
12684
|
-
inst.isInt = (
|
|
12678
|
+
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
12679
|
+
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
12680
|
+
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
|
|
12685
12681
|
inst.isFinite = true;
|
|
12686
|
-
inst.format =
|
|
12682
|
+
inst.format = bag.format ?? null;
|
|
12687
12683
|
});
|
|
12688
12684
|
function number2(params) {
|
|
12689
12685
|
return _number(ZodNumber, params);
|
|
@@ -12805,7 +12801,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
12805
12801
|
function object2(shape, params) {
|
|
12806
12802
|
const def = {
|
|
12807
12803
|
type: "object",
|
|
12808
|
-
shape: shape
|
|
12804
|
+
shape: shape ?? {},
|
|
12809
12805
|
...util_exports.normalizeParams(params)
|
|
12810
12806
|
};
|
|
12811
12807
|
return new ZodObject(def);
|
|
@@ -12954,16 +12950,15 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
12954
12950
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
12955
12951
|
}
|
|
12956
12952
|
payload.addIssue = (issue2) => {
|
|
12957
|
-
var _a5, _b, _c;
|
|
12958
12953
|
if (typeof issue2 === "string") {
|
|
12959
12954
|
payload.issues.push(util_exports.issue(issue2, payload.value, def));
|
|
12960
12955
|
} else {
|
|
12961
12956
|
const _issue = issue2;
|
|
12962
12957
|
if (_issue.fatal)
|
|
12963
12958
|
_issue.continue = false;
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
12959
|
+
_issue.code ?? (_issue.code = "custom");
|
|
12960
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
12961
|
+
_issue.inst ?? (_issue.inst = inst);
|
|
12967
12962
|
payload.issues.push(util_exports.issue(_issue));
|
|
12968
12963
|
}
|
|
12969
12964
|
};
|
|
@@ -13117,7 +13112,7 @@ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
|
13117
13112
|
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
13118
13113
|
});
|
|
13119
13114
|
function custom(fn, _params) {
|
|
13120
|
-
return _custom(ZodCustom, fn
|
|
13115
|
+
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
13121
13116
|
}
|
|
13122
13117
|
function refine(fn, _params = {}) {
|
|
13123
13118
|
return _refine(ZodCustom, fn, _params);
|
|
@@ -14651,8 +14646,7 @@ var UrlElicitationRequiredError = class extends McpError {
|
|
|
14651
14646
|
});
|
|
14652
14647
|
}
|
|
14653
14648
|
get elicitations() {
|
|
14654
|
-
|
|
14655
|
-
return (_b = (_a5 = this.data) == null ? void 0 : _a5.elicitations) != null ? _b : [];
|
|
14649
|
+
return this.data?.elicitations ?? [];
|
|
14656
14650
|
}
|
|
14657
14651
|
};
|
|
14658
14652
|
|
|
@@ -14667,7 +14661,7 @@ var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0
|
|
|
14667
14661
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
14668
14662
|
function getMethodLiteral(schema) {
|
|
14669
14663
|
const shape = getObjectShape(schema);
|
|
14670
|
-
const methodSchema = shape
|
|
14664
|
+
const methodSchema = shape?.method;
|
|
14671
14665
|
if (!methodSchema) {
|
|
14672
14666
|
throw new Error("Schema is missing a method literal");
|
|
14673
14667
|
}
|
|
@@ -14711,8 +14705,8 @@ var Protocol = class {
|
|
|
14711
14705
|
// Automatic pong by default.
|
|
14712
14706
|
(_request) => ({})
|
|
14713
14707
|
);
|
|
14714
|
-
this._taskStore = _options
|
|
14715
|
-
this._taskMessageQueue = _options
|
|
14708
|
+
this._taskStore = _options?.taskStore;
|
|
14709
|
+
this._taskMessageQueue = _options?.taskMessageQueue;
|
|
14716
14710
|
if (this._taskStore) {
|
|
14717
14711
|
this.setRequestHandler(GetTaskRequestSchema, async (request, extra) => {
|
|
14718
14712
|
const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
|
@@ -14725,7 +14719,6 @@ var Protocol = class {
|
|
|
14725
14719
|
});
|
|
14726
14720
|
this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
|
|
14727
14721
|
const handleTaskResult = async () => {
|
|
14728
|
-
var _a5;
|
|
14729
14722
|
const taskId = request.params.taskId;
|
|
14730
14723
|
if (this._taskMessageQueue) {
|
|
14731
14724
|
let queuedMessage;
|
|
@@ -14749,7 +14742,7 @@ var Protocol = class {
|
|
|
14749
14742
|
}
|
|
14750
14743
|
continue;
|
|
14751
14744
|
}
|
|
14752
|
-
await
|
|
14745
|
+
await this._transport?.send(queuedMessage.message, { relatedRequestId: extra.requestId });
|
|
14753
14746
|
}
|
|
14754
14747
|
}
|
|
14755
14748
|
const task = await this._taskStore.getTask(taskId, extra.sessionId);
|
|
@@ -14778,9 +14771,8 @@ var Protocol = class {
|
|
|
14778
14771
|
return await handleTaskResult();
|
|
14779
14772
|
});
|
|
14780
14773
|
this.setRequestHandler(ListTasksRequestSchema, async (request, extra) => {
|
|
14781
|
-
var _a5;
|
|
14782
14774
|
try {
|
|
14783
|
-
const { tasks, nextCursor } = await this._taskStore.listTasks(
|
|
14775
|
+
const { tasks, nextCursor } = await this._taskStore.listTasks(request.params?.cursor, extra.sessionId);
|
|
14784
14776
|
return {
|
|
14785
14777
|
tasks,
|
|
14786
14778
|
nextCursor,
|
|
@@ -14823,7 +14815,7 @@ var Protocol = class {
|
|
|
14823
14815
|
return;
|
|
14824
14816
|
}
|
|
14825
14817
|
const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);
|
|
14826
|
-
controller
|
|
14818
|
+
controller?.abort(notification.params.reason);
|
|
14827
14819
|
}
|
|
14828
14820
|
_setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
|
|
14829
14821
|
this._timeoutInfo.set(messageId, {
|
|
@@ -14864,24 +14856,23 @@ var Protocol = class {
|
|
|
14864
14856
|
* The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
|
|
14865
14857
|
*/
|
|
14866
14858
|
async connect(transport) {
|
|
14867
|
-
var _a5, _b, _c;
|
|
14868
14859
|
if (this._transport) {
|
|
14869
14860
|
throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");
|
|
14870
14861
|
}
|
|
14871
14862
|
this._transport = transport;
|
|
14872
|
-
const _onclose =
|
|
14863
|
+
const _onclose = this.transport?.onclose;
|
|
14873
14864
|
this._transport.onclose = () => {
|
|
14874
|
-
_onclose
|
|
14865
|
+
_onclose?.();
|
|
14875
14866
|
this._onclose();
|
|
14876
14867
|
};
|
|
14877
|
-
const _onerror =
|
|
14868
|
+
const _onerror = this.transport?.onerror;
|
|
14878
14869
|
this._transport.onerror = (error2) => {
|
|
14879
|
-
_onerror
|
|
14870
|
+
_onerror?.(error2);
|
|
14880
14871
|
this._onerror(error2);
|
|
14881
14872
|
};
|
|
14882
|
-
const _onmessage =
|
|
14873
|
+
const _onmessage = this._transport?.onmessage;
|
|
14883
14874
|
this._transport.onmessage = (message, extra) => {
|
|
14884
|
-
_onmessage
|
|
14875
|
+
_onmessage?.(message, extra);
|
|
14885
14876
|
if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {
|
|
14886
14877
|
this._onresponse(message);
|
|
14887
14878
|
} else if (isJSONRPCRequest(message)) {
|
|
@@ -14895,7 +14886,6 @@ var Protocol = class {
|
|
|
14895
14886
|
await this._transport.start();
|
|
14896
14887
|
}
|
|
14897
14888
|
_onclose() {
|
|
14898
|
-
var _a5;
|
|
14899
14889
|
const responseHandlers = this._responseHandlers;
|
|
14900
14890
|
this._responseHandlers = /* @__PURE__ */ new Map();
|
|
14901
14891
|
this._progressHandlers.clear();
|
|
@@ -14911,28 +14901,25 @@ var Protocol = class {
|
|
|
14911
14901
|
this._requestHandlerAbortControllers.clear();
|
|
14912
14902
|
const error2 = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
|
|
14913
14903
|
this._transport = void 0;
|
|
14914
|
-
|
|
14904
|
+
this.onclose?.();
|
|
14915
14905
|
for (const handler of responseHandlers.values()) {
|
|
14916
14906
|
handler(error2);
|
|
14917
14907
|
}
|
|
14918
14908
|
}
|
|
14919
14909
|
_onerror(error2) {
|
|
14920
|
-
|
|
14921
|
-
(_a5 = this.onerror) == null ? void 0 : _a5.call(this, error2);
|
|
14910
|
+
this.onerror?.(error2);
|
|
14922
14911
|
}
|
|
14923
14912
|
_onnotification(notification) {
|
|
14924
|
-
|
|
14925
|
-
const handler = (_a5 = this._notificationHandlers.get(notification.method)) != null ? _a5 : this.fallbackNotificationHandler;
|
|
14913
|
+
const handler = this._notificationHandlers.get(notification.method) ?? this.fallbackNotificationHandler;
|
|
14926
14914
|
if (handler === void 0) {
|
|
14927
14915
|
return;
|
|
14928
14916
|
}
|
|
14929
14917
|
Promise.resolve().then(() => handler(notification)).catch((error2) => this._onerror(new Error(`Uncaught error in notification handler: ${error2}`)));
|
|
14930
14918
|
}
|
|
14931
14919
|
_onrequest(request, extra) {
|
|
14932
|
-
|
|
14933
|
-
const handler = (_a5 = this._requestHandlers.get(request.method)) != null ? _a5 : this.fallbackRequestHandler;
|
|
14920
|
+
const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
|
|
14934
14921
|
const capturedTransport = this._transport;
|
|
14935
|
-
const relatedTaskId =
|
|
14922
|
+
const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
|
|
14936
14923
|
if (handler === void 0) {
|
|
14937
14924
|
const errorResponse = {
|
|
14938
14925
|
jsonrpc: "2.0",
|
|
@@ -14947,20 +14934,20 @@ var Protocol = class {
|
|
|
14947
14934
|
type: "error",
|
|
14948
14935
|
message: errorResponse,
|
|
14949
14936
|
timestamp: Date.now()
|
|
14950
|
-
}, capturedTransport
|
|
14937
|
+
}, capturedTransport?.sessionId).catch((error2) => this._onerror(new Error(`Failed to enqueue error response: ${error2}`)));
|
|
14951
14938
|
} else {
|
|
14952
|
-
capturedTransport
|
|
14939
|
+
capturedTransport?.send(errorResponse).catch((error2) => this._onerror(new Error(`Failed to send an error response: ${error2}`)));
|
|
14953
14940
|
}
|
|
14954
14941
|
return;
|
|
14955
14942
|
}
|
|
14956
14943
|
const abortController = new AbortController();
|
|
14957
14944
|
this._requestHandlerAbortControllers.set(request.id, abortController);
|
|
14958
14945
|
const taskCreationParams = isTaskAugmentedRequestParams(request.params) ? request.params.task : void 0;
|
|
14959
|
-
const taskStore = this._taskStore ? this.requestTaskStore(request, capturedTransport
|
|
14946
|
+
const taskStore = this._taskStore ? this.requestTaskStore(request, capturedTransport?.sessionId) : void 0;
|
|
14960
14947
|
const fullExtra = {
|
|
14961
14948
|
signal: abortController.signal,
|
|
14962
|
-
sessionId: capturedTransport
|
|
14963
|
-
_meta:
|
|
14949
|
+
sessionId: capturedTransport?.sessionId,
|
|
14950
|
+
_meta: request.params?._meta,
|
|
14964
14951
|
sendNotification: async (notification) => {
|
|
14965
14952
|
if (abortController.signal.aborted)
|
|
14966
14953
|
return;
|
|
@@ -14971,7 +14958,6 @@ var Protocol = class {
|
|
|
14971
14958
|
await this.notification(notification, notificationOptions);
|
|
14972
14959
|
},
|
|
14973
14960
|
sendRequest: async (r, resultSchema, options) => {
|
|
14974
|
-
var _a6, _b2;
|
|
14975
14961
|
if (abortController.signal.aborted) {
|
|
14976
14962
|
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
14977
14963
|
}
|
|
@@ -14979,20 +14965,20 @@ var Protocol = class {
|
|
|
14979
14965
|
if (relatedTaskId && !requestOptions.relatedTask) {
|
|
14980
14966
|
requestOptions.relatedTask = { taskId: relatedTaskId };
|
|
14981
14967
|
}
|
|
14982
|
-
const effectiveTaskId =
|
|
14968
|
+
const effectiveTaskId = requestOptions.relatedTask?.taskId ?? relatedTaskId;
|
|
14983
14969
|
if (effectiveTaskId && taskStore) {
|
|
14984
14970
|
await taskStore.updateTaskStatus(effectiveTaskId, "input_required");
|
|
14985
14971
|
}
|
|
14986
14972
|
return await this.request(r, resultSchema, requestOptions);
|
|
14987
14973
|
},
|
|
14988
|
-
authInfo: extra
|
|
14974
|
+
authInfo: extra?.authInfo,
|
|
14989
14975
|
requestId: request.id,
|
|
14990
|
-
requestInfo: extra
|
|
14976
|
+
requestInfo: extra?.requestInfo,
|
|
14991
14977
|
taskId: relatedTaskId,
|
|
14992
14978
|
taskStore,
|
|
14993
|
-
taskRequestedTtl: taskCreationParams
|
|
14994
|
-
closeSSEStream: extra
|
|
14995
|
-
closeStandaloneSSEStream: extra
|
|
14979
|
+
taskRequestedTtl: taskCreationParams?.ttl,
|
|
14980
|
+
closeSSEStream: extra?.closeSSEStream,
|
|
14981
|
+
closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
|
|
14996
14982
|
};
|
|
14997
14983
|
Promise.resolve().then(() => {
|
|
14998
14984
|
if (taskCreationParams) {
|
|
@@ -15012,12 +14998,11 @@ var Protocol = class {
|
|
|
15012
14998
|
type: "response",
|
|
15013
14999
|
message: response,
|
|
15014
15000
|
timestamp: Date.now()
|
|
15015
|
-
}, capturedTransport
|
|
15001
|
+
}, capturedTransport?.sessionId);
|
|
15016
15002
|
} else {
|
|
15017
|
-
await
|
|
15003
|
+
await capturedTransport?.send(response);
|
|
15018
15004
|
}
|
|
15019
15005
|
}, async (error2) => {
|
|
15020
|
-
var _a6;
|
|
15021
15006
|
if (abortController.signal.aborted) {
|
|
15022
15007
|
return;
|
|
15023
15008
|
}
|
|
@@ -15026,7 +15011,7 @@ var Protocol = class {
|
|
|
15026
15011
|
id: request.id,
|
|
15027
15012
|
error: {
|
|
15028
15013
|
code: Number.isSafeInteger(error2["code"]) ? error2["code"] : ErrorCode.InternalError,
|
|
15029
|
-
message:
|
|
15014
|
+
message: error2.message ?? "Internal error",
|
|
15030
15015
|
...error2["data"] !== void 0 && { data: error2["data"] }
|
|
15031
15016
|
}
|
|
15032
15017
|
};
|
|
@@ -15035,9 +15020,9 @@ var Protocol = class {
|
|
|
15035
15020
|
type: "error",
|
|
15036
15021
|
message: errorResponse,
|
|
15037
15022
|
timestamp: Date.now()
|
|
15038
|
-
}, capturedTransport
|
|
15023
|
+
}, capturedTransport?.sessionId);
|
|
15039
15024
|
} else {
|
|
15040
|
-
await
|
|
15025
|
+
await capturedTransport?.send(errorResponse);
|
|
15041
15026
|
}
|
|
15042
15027
|
}).catch((error2) => this._onerror(new Error(`Failed to send response: ${error2}`))).finally(() => {
|
|
15043
15028
|
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
@@ -15116,8 +15101,7 @@ var Protocol = class {
|
|
|
15116
15101
|
* Closes the connection.
|
|
15117
15102
|
*/
|
|
15118
15103
|
async close() {
|
|
15119
|
-
|
|
15120
|
-
await ((_a5 = this._transport) == null ? void 0 : _a5.close());
|
|
15104
|
+
await this._transport?.close();
|
|
15121
15105
|
}
|
|
15122
15106
|
/**
|
|
15123
15107
|
* Sends a request and returns an AsyncGenerator that yields response messages.
|
|
@@ -15147,8 +15131,7 @@ var Protocol = class {
|
|
|
15147
15131
|
* @experimental Use `client.experimental.tasks.requestStream()` to access this method.
|
|
15148
15132
|
*/
|
|
15149
15133
|
async *requestStream(request, resultSchema, options) {
|
|
15150
|
-
|
|
15151
|
-
const { task } = options != null ? options : {};
|
|
15134
|
+
const { task } = options ?? {};
|
|
15152
15135
|
if (!task) {
|
|
15153
15136
|
try {
|
|
15154
15137
|
const result = await this.request(request, resultSchema, options);
|
|
@@ -15195,9 +15178,9 @@ var Protocol = class {
|
|
|
15195
15178
|
yield { type: "result", result };
|
|
15196
15179
|
return;
|
|
15197
15180
|
}
|
|
15198
|
-
const pollInterval =
|
|
15181
|
+
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
15199
15182
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
15200
|
-
|
|
15183
|
+
options?.signal?.throwIfAborted();
|
|
15201
15184
|
}
|
|
15202
15185
|
} catch (error2) {
|
|
15203
15186
|
yield {
|
|
@@ -15212,9 +15195,8 @@ var Protocol = class {
|
|
|
15212
15195
|
* Do not use this method to emit notifications! Use notification() instead.
|
|
15213
15196
|
*/
|
|
15214
15197
|
request(request, resultSchema, options) {
|
|
15215
|
-
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options
|
|
15198
|
+
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
15216
15199
|
return new Promise((resolve, reject) => {
|
|
15217
|
-
var _a5, _b, _c, _d, _e, _f, _g;
|
|
15218
15200
|
const earlyReject = (error2) => {
|
|
15219
15201
|
reject(error2);
|
|
15220
15202
|
};
|
|
@@ -15222,7 +15204,7 @@ var Protocol = class {
|
|
|
15222
15204
|
earlyReject(new Error("Not connected"));
|
|
15223
15205
|
return;
|
|
15224
15206
|
}
|
|
15225
|
-
if (
|
|
15207
|
+
if (this._options?.enforceStrictCapabilities === true) {
|
|
15226
15208
|
try {
|
|
15227
15209
|
this.assertCapabilityForMethod(request.method);
|
|
15228
15210
|
if (task) {
|
|
@@ -15233,19 +15215,19 @@ var Protocol = class {
|
|
|
15233
15215
|
return;
|
|
15234
15216
|
}
|
|
15235
15217
|
}
|
|
15236
|
-
|
|
15218
|
+
options?.signal?.throwIfAborted();
|
|
15237
15219
|
const messageId = this._requestMessageId++;
|
|
15238
15220
|
const jsonrpcRequest = {
|
|
15239
15221
|
...request,
|
|
15240
15222
|
jsonrpc: "2.0",
|
|
15241
15223
|
id: messageId
|
|
15242
15224
|
};
|
|
15243
|
-
if (options
|
|
15225
|
+
if (options?.onprogress) {
|
|
15244
15226
|
this._progressHandlers.set(messageId, options.onprogress);
|
|
15245
15227
|
jsonrpcRequest.params = {
|
|
15246
15228
|
...request.params,
|
|
15247
15229
|
_meta: {
|
|
15248
|
-
...
|
|
15230
|
+
...request.params?._meta || {},
|
|
15249
15231
|
progressToken: messageId
|
|
15250
15232
|
}
|
|
15251
15233
|
};
|
|
@@ -15260,17 +15242,16 @@ var Protocol = class {
|
|
|
15260
15242
|
jsonrpcRequest.params = {
|
|
15261
15243
|
...jsonrpcRequest.params,
|
|
15262
15244
|
_meta: {
|
|
15263
|
-
...
|
|
15245
|
+
...jsonrpcRequest.params?._meta || {},
|
|
15264
15246
|
[RELATED_TASK_META_KEY]: relatedTask
|
|
15265
15247
|
}
|
|
15266
15248
|
};
|
|
15267
15249
|
}
|
|
15268
15250
|
const cancel = (reason) => {
|
|
15269
|
-
var _a6;
|
|
15270
15251
|
this._responseHandlers.delete(messageId);
|
|
15271
15252
|
this._progressHandlers.delete(messageId);
|
|
15272
15253
|
this._cleanupTimeout(messageId);
|
|
15273
|
-
|
|
15254
|
+
this._transport?.send({
|
|
15274
15255
|
jsonrpc: "2.0",
|
|
15275
15256
|
method: "notifications/cancelled",
|
|
15276
15257
|
params: {
|
|
@@ -15282,8 +15263,7 @@ var Protocol = class {
|
|
|
15282
15263
|
reject(error2);
|
|
15283
15264
|
};
|
|
15284
15265
|
this._responseHandlers.set(messageId, (response) => {
|
|
15285
|
-
|
|
15286
|
-
if ((_a6 = options == null ? void 0 : options.signal) == null ? void 0 : _a6.aborted) {
|
|
15266
|
+
if (options?.signal?.aborted) {
|
|
15287
15267
|
return;
|
|
15288
15268
|
}
|
|
15289
15269
|
if (response instanceof Error) {
|
|
@@ -15300,14 +15280,13 @@ var Protocol = class {
|
|
|
15300
15280
|
reject(error2);
|
|
15301
15281
|
}
|
|
15302
15282
|
});
|
|
15303
|
-
|
|
15304
|
-
|
|
15305
|
-
cancel((_a6 = options == null ? void 0 : options.signal) == null ? void 0 : _a6.reason);
|
|
15283
|
+
options?.signal?.addEventListener("abort", () => {
|
|
15284
|
+
cancel(options?.signal?.reason);
|
|
15306
15285
|
});
|
|
15307
|
-
const timeout =
|
|
15286
|
+
const timeout = options?.timeout ?? DEFAULT_REQUEST_TIMEOUT_MSEC;
|
|
15308
15287
|
const timeoutHandler = () => cancel(McpError.fromError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
|
|
15309
|
-
this._setupTimeout(messageId, timeout, options
|
|
15310
|
-
const relatedTaskId = relatedTask
|
|
15288
|
+
this._setupTimeout(messageId, timeout, options?.maxTotalTimeout, timeoutHandler, options?.resetTimeoutOnProgress ?? false);
|
|
15289
|
+
const relatedTaskId = relatedTask?.taskId;
|
|
15311
15290
|
if (relatedTaskId) {
|
|
15312
15291
|
const responseResolver = (response) => {
|
|
15313
15292
|
const handler = this._responseHandlers.get(messageId);
|
|
@@ -15370,12 +15349,11 @@ var Protocol = class {
|
|
|
15370
15349
|
* Emits a notification, which is a one-way message that does not expect a response.
|
|
15371
15350
|
*/
|
|
15372
15351
|
async notification(notification, options) {
|
|
15373
|
-
var _a5, _b, _c, _d, _e;
|
|
15374
15352
|
if (!this._transport) {
|
|
15375
15353
|
throw new Error("Not connected");
|
|
15376
15354
|
}
|
|
15377
15355
|
this.assertNotificationCapability(notification.method);
|
|
15378
|
-
const relatedTaskId =
|
|
15356
|
+
const relatedTaskId = options?.relatedTask?.taskId;
|
|
15379
15357
|
if (relatedTaskId) {
|
|
15380
15358
|
const jsonrpcNotification2 = {
|
|
15381
15359
|
...notification,
|
|
@@ -15383,7 +15361,7 @@ var Protocol = class {
|
|
|
15383
15361
|
params: {
|
|
15384
15362
|
...notification.params,
|
|
15385
15363
|
_meta: {
|
|
15386
|
-
...
|
|
15364
|
+
...notification.params?._meta || {},
|
|
15387
15365
|
[RELATED_TASK_META_KEY]: options.relatedTask
|
|
15388
15366
|
}
|
|
15389
15367
|
}
|
|
@@ -15395,15 +15373,14 @@ var Protocol = class {
|
|
|
15395
15373
|
});
|
|
15396
15374
|
return;
|
|
15397
15375
|
}
|
|
15398
|
-
const debouncedMethods =
|
|
15399
|
-
const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !
|
|
15376
|
+
const debouncedMethods = this._options?.debouncedNotificationMethods ?? [];
|
|
15377
|
+
const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !options?.relatedRequestId && !options?.relatedTask;
|
|
15400
15378
|
if (canDebounce) {
|
|
15401
15379
|
if (this._pendingDebouncedNotifications.has(notification.method)) {
|
|
15402
15380
|
return;
|
|
15403
15381
|
}
|
|
15404
15382
|
this._pendingDebouncedNotifications.add(notification.method);
|
|
15405
15383
|
Promise.resolve().then(() => {
|
|
15406
|
-
var _a6, _b2;
|
|
15407
15384
|
this._pendingDebouncedNotifications.delete(notification.method);
|
|
15408
15385
|
if (!this._transport) {
|
|
15409
15386
|
return;
|
|
@@ -15412,19 +15389,19 @@ var Protocol = class {
|
|
|
15412
15389
|
...notification,
|
|
15413
15390
|
jsonrpc: "2.0"
|
|
15414
15391
|
};
|
|
15415
|
-
if (options
|
|
15392
|
+
if (options?.relatedTask) {
|
|
15416
15393
|
jsonrpcNotification2 = {
|
|
15417
15394
|
...jsonrpcNotification2,
|
|
15418
15395
|
params: {
|
|
15419
15396
|
...jsonrpcNotification2.params,
|
|
15420
15397
|
_meta: {
|
|
15421
|
-
...
|
|
15398
|
+
...jsonrpcNotification2.params?._meta || {},
|
|
15422
15399
|
[RELATED_TASK_META_KEY]: options.relatedTask
|
|
15423
15400
|
}
|
|
15424
15401
|
}
|
|
15425
15402
|
};
|
|
15426
15403
|
}
|
|
15427
|
-
|
|
15404
|
+
this._transport?.send(jsonrpcNotification2, options).catch((error2) => this._onerror(error2));
|
|
15428
15405
|
});
|
|
15429
15406
|
return;
|
|
15430
15407
|
}
|
|
@@ -15432,13 +15409,13 @@ var Protocol = class {
|
|
|
15432
15409
|
...notification,
|
|
15433
15410
|
jsonrpc: "2.0"
|
|
15434
15411
|
};
|
|
15435
|
-
if (options
|
|
15412
|
+
if (options?.relatedTask) {
|
|
15436
15413
|
jsonrpcNotification = {
|
|
15437
15414
|
...jsonrpcNotification,
|
|
15438
15415
|
params: {
|
|
15439
15416
|
...jsonrpcNotification.params,
|
|
15440
15417
|
_meta: {
|
|
15441
|
-
...
|
|
15418
|
+
...jsonrpcNotification.params?._meta || {},
|
|
15442
15419
|
[RELATED_TASK_META_KEY]: options.relatedTask
|
|
15443
15420
|
}
|
|
15444
15421
|
}
|
|
@@ -15514,11 +15491,10 @@ var Protocol = class {
|
|
|
15514
15491
|
* simply propagates the error.
|
|
15515
15492
|
*/
|
|
15516
15493
|
async _enqueueTaskMessage(taskId, message, sessionId) {
|
|
15517
|
-
var _a5;
|
|
15518
15494
|
if (!this._taskStore || !this._taskMessageQueue) {
|
|
15519
15495
|
throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
15520
15496
|
}
|
|
15521
|
-
const maxQueueSize =
|
|
15497
|
+
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
15522
15498
|
await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
|
|
15523
15499
|
}
|
|
15524
15500
|
/**
|
|
@@ -15551,11 +15527,10 @@ var Protocol = class {
|
|
|
15551
15527
|
* @returns Promise that resolves when an update occurs or rejects if aborted
|
|
15552
15528
|
*/
|
|
15553
15529
|
async _waitForTaskUpdate(taskId, signal) {
|
|
15554
|
-
|
|
15555
|
-
let interval = (_b = (_a5 = this._options) == null ? void 0 : _a5.defaultTaskPollInterval) != null ? _b : 1e3;
|
|
15530
|
+
let interval = this._options?.defaultTaskPollInterval ?? 1e3;
|
|
15556
15531
|
try {
|
|
15557
|
-
const task = await
|
|
15558
|
-
if (task
|
|
15532
|
+
const task = await this._taskStore?.getTask(taskId);
|
|
15533
|
+
if (task?.pollInterval) {
|
|
15559
15534
|
interval = task.pollInterval;
|
|
15560
15535
|
}
|
|
15561
15536
|
} catch {
|
|
@@ -15694,7 +15669,7 @@ var AjvJsonSchemaValidator = class {
|
|
|
15694
15669
|
* ```
|
|
15695
15670
|
*/
|
|
15696
15671
|
constructor(ajv) {
|
|
15697
|
-
this._ajv = ajv
|
|
15672
|
+
this._ajv = ajv ?? createDefaultAjvInstance();
|
|
15698
15673
|
}
|
|
15699
15674
|
/**
|
|
15700
15675
|
* Create a validator for the given JSON Schema
|
|
@@ -15706,8 +15681,7 @@ var AjvJsonSchemaValidator = class {
|
|
|
15706
15681
|
* @returns A validator function that validates input data
|
|
15707
15682
|
*/
|
|
15708
15683
|
getValidator(schema) {
|
|
15709
|
-
|
|
15710
|
-
const ajvValidator = "$id" in schema && typeof schema.$id === "string" ? (_a5 = this._ajv.getSchema(schema.$id)) != null ? _a5 : this._ajv.compile(schema) : this._ajv.compile(schema);
|
|
15684
|
+
const ajvValidator = "$id" in schema && typeof schema.$id === "string" ? this._ajv.getSchema(schema.$id) ?? this._ajv.compile(schema) : this._ajv.compile(schema);
|
|
15711
15685
|
return (input) => {
|
|
15712
15686
|
const valid = ajvValidator(input);
|
|
15713
15687
|
if (valid) {
|
|
@@ -15793,9 +15767,8 @@ var ExperimentalServerTasks = class {
|
|
|
15793
15767
|
* @experimental
|
|
15794
15768
|
*/
|
|
15795
15769
|
createMessageStream(params, options) {
|
|
15796
|
-
var _a5;
|
|
15797
15770
|
const clientCapabilities = this._server.getClientCapabilities();
|
|
15798
|
-
if ((params.tools || params.toolChoice) && !
|
|
15771
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
15799
15772
|
throw new Error("Client does not support sampling tools capability.");
|
|
15800
15773
|
}
|
|
15801
15774
|
if (params.messages.length > 0) {
|
|
@@ -15869,18 +15842,17 @@ var ExperimentalServerTasks = class {
|
|
|
15869
15842
|
* @experimental
|
|
15870
15843
|
*/
|
|
15871
15844
|
elicitInputStream(params, options) {
|
|
15872
|
-
var _a5, _b, _c;
|
|
15873
15845
|
const clientCapabilities = this._server.getClientCapabilities();
|
|
15874
|
-
const mode =
|
|
15846
|
+
const mode = params.mode ?? "form";
|
|
15875
15847
|
switch (mode) {
|
|
15876
15848
|
case "url": {
|
|
15877
|
-
if (!
|
|
15849
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
15878
15850
|
throw new Error("Client does not support url elicitation.");
|
|
15879
15851
|
}
|
|
15880
15852
|
break;
|
|
15881
15853
|
}
|
|
15882
15854
|
case "form": {
|
|
15883
|
-
if (!
|
|
15855
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
15884
15856
|
throw new Error("Client does not support form elicitation.");
|
|
15885
15857
|
}
|
|
15886
15858
|
break;
|
|
@@ -15944,13 +15916,12 @@ var ExperimentalServerTasks = class {
|
|
|
15944
15916
|
|
|
15945
15917
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
15946
15918
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
15947
|
-
var _a5;
|
|
15948
15919
|
if (!requests) {
|
|
15949
15920
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
15950
15921
|
}
|
|
15951
15922
|
switch (method) {
|
|
15952
15923
|
case "tools/call":
|
|
15953
|
-
if (!
|
|
15924
|
+
if (!requests.tools?.call) {
|
|
15954
15925
|
throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);
|
|
15955
15926
|
}
|
|
15956
15927
|
break;
|
|
@@ -15959,18 +15930,17 @@ function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
|
15959
15930
|
}
|
|
15960
15931
|
}
|
|
15961
15932
|
function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
15962
|
-
var _a5, _b;
|
|
15963
15933
|
if (!requests) {
|
|
15964
15934
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
15965
15935
|
}
|
|
15966
15936
|
switch (method) {
|
|
15967
15937
|
case "sampling/createMessage":
|
|
15968
|
-
if (!
|
|
15938
|
+
if (!requests.sampling?.createMessage) {
|
|
15969
15939
|
throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`);
|
|
15970
15940
|
}
|
|
15971
15941
|
break;
|
|
15972
15942
|
case "elicitation/create":
|
|
15973
|
-
if (!
|
|
15943
|
+
if (!requests.elicitation?.create) {
|
|
15974
15944
|
throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);
|
|
15975
15945
|
}
|
|
15976
15946
|
break;
|
|
@@ -15985,7 +15955,6 @@ var Server = class extends Protocol {
|
|
|
15985
15955
|
* Initializes this server with the given name and version information.
|
|
15986
15956
|
*/
|
|
15987
15957
|
constructor(_serverInfo, options) {
|
|
15988
|
-
var _a5, _b;
|
|
15989
15958
|
super(options);
|
|
15990
15959
|
this._serverInfo = _serverInfo;
|
|
15991
15960
|
this._loggingLevels = /* @__PURE__ */ new Map();
|
|
@@ -15994,18 +15963,14 @@ var Server = class extends Protocol {
|
|
|
15994
15963
|
const currentLevel = this._loggingLevels.get(sessionId);
|
|
15995
15964
|
return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;
|
|
15996
15965
|
};
|
|
15997
|
-
this._capabilities =
|
|
15998
|
-
this._instructions = options
|
|
15999
|
-
this._jsonSchemaValidator =
|
|
15966
|
+
this._capabilities = options?.capabilities ?? {};
|
|
15967
|
+
this._instructions = options?.instructions;
|
|
15968
|
+
this._jsonSchemaValidator = options?.jsonSchemaValidator ?? new AjvJsonSchemaValidator();
|
|
16000
15969
|
this.setRequestHandler(InitializeRequestSchema, (request) => this._oninitialize(request));
|
|
16001
|
-
this.setNotificationHandler(InitializedNotificationSchema, () =>
|
|
16002
|
-
var _a6;
|
|
16003
|
-
return (_a6 = this.oninitialized) == null ? void 0 : _a6.call(this);
|
|
16004
|
-
});
|
|
15970
|
+
this.setNotificationHandler(InitializedNotificationSchema, () => this.oninitialized?.());
|
|
16005
15971
|
if (this._capabilities.logging) {
|
|
16006
15972
|
this.setRequestHandler(SetLevelRequestSchema, async (request, extra) => {
|
|
16007
|
-
|
|
16008
|
-
const transportSessionId = extra.sessionId || ((_a6 = extra.requestInfo) == null ? void 0 : _a6.headers["mcp-session-id"]) || void 0;
|
|
15973
|
+
const transportSessionId = extra.sessionId || extra.requestInfo?.headers["mcp-session-id"] || void 0;
|
|
16009
15974
|
const { level } = request.params;
|
|
16010
15975
|
const parseResult = LoggingLevelSchema.safeParse(level);
|
|
16011
15976
|
if (parseResult.success) {
|
|
@@ -16046,7 +16011,7 @@ var Server = class extends Protocol {
|
|
|
16046
16011
|
*/
|
|
16047
16012
|
setRequestHandler(requestSchema, handler) {
|
|
16048
16013
|
const shape = getObjectShape(requestSchema);
|
|
16049
|
-
const methodSchema = shape
|
|
16014
|
+
const methodSchema = shape?.method;
|
|
16050
16015
|
if (!methodSchema) {
|
|
16051
16016
|
throw new Error("Schema is missing a method literal");
|
|
16052
16017
|
}
|
|
@@ -16084,20 +16049,19 @@ var Server = class extends Protocol {
|
|
|
16084
16049
|
return super.setRequestHandler(requestSchema, handler);
|
|
16085
16050
|
}
|
|
16086
16051
|
assertCapabilityForMethod(method) {
|
|
16087
|
-
var _a5, _b, _c;
|
|
16088
16052
|
switch (method) {
|
|
16089
16053
|
case "sampling/createMessage":
|
|
16090
|
-
if (!
|
|
16054
|
+
if (!this._clientCapabilities?.sampling) {
|
|
16091
16055
|
throw new Error(`Client does not support sampling (required for ${method})`);
|
|
16092
16056
|
}
|
|
16093
16057
|
break;
|
|
16094
16058
|
case "elicitation/create":
|
|
16095
|
-
if (!
|
|
16059
|
+
if (!this._clientCapabilities?.elicitation) {
|
|
16096
16060
|
throw new Error(`Client does not support elicitation (required for ${method})`);
|
|
16097
16061
|
}
|
|
16098
16062
|
break;
|
|
16099
16063
|
case "roots/list":
|
|
16100
|
-
if (!
|
|
16064
|
+
if (!this._clientCapabilities?.roots) {
|
|
16101
16065
|
throw new Error(`Client does not support listing roots (required for ${method})`);
|
|
16102
16066
|
}
|
|
16103
16067
|
break;
|
|
@@ -16106,7 +16070,6 @@ var Server = class extends Protocol {
|
|
|
16106
16070
|
}
|
|
16107
16071
|
}
|
|
16108
16072
|
assertNotificationCapability(method) {
|
|
16109
|
-
var _a5, _b;
|
|
16110
16073
|
switch (method) {
|
|
16111
16074
|
case "notifications/message":
|
|
16112
16075
|
if (!this._capabilities.logging) {
|
|
@@ -16130,7 +16093,7 @@ var Server = class extends Protocol {
|
|
|
16130
16093
|
}
|
|
16131
16094
|
break;
|
|
16132
16095
|
case "notifications/elicitation/complete":
|
|
16133
|
-
if (!
|
|
16096
|
+
if (!this._clientCapabilities?.elicitation?.url) {
|
|
16134
16097
|
throw new Error(`Client does not support URL elicitation (required for ${method})`);
|
|
16135
16098
|
}
|
|
16136
16099
|
break;
|
|
@@ -16188,15 +16151,13 @@ var Server = class extends Protocol {
|
|
|
16188
16151
|
}
|
|
16189
16152
|
}
|
|
16190
16153
|
assertTaskCapability(method) {
|
|
16191
|
-
|
|
16192
|
-
assertClientRequestTaskCapability((_b = (_a5 = this._clientCapabilities) == null ? void 0 : _a5.tasks) == null ? void 0 : _b.requests, method, "Client");
|
|
16154
|
+
assertClientRequestTaskCapability(this._clientCapabilities?.tasks?.requests, method, "Client");
|
|
16193
16155
|
}
|
|
16194
16156
|
assertTaskHandlerCapability(method) {
|
|
16195
|
-
var _a5;
|
|
16196
16157
|
if (!this._capabilities) {
|
|
16197
16158
|
return;
|
|
16198
16159
|
}
|
|
16199
|
-
assertToolsCallTaskCapability(
|
|
16160
|
+
assertToolsCallTaskCapability(this._capabilities.tasks?.requests, method, "Server");
|
|
16200
16161
|
}
|
|
16201
16162
|
async _oninitialize(request) {
|
|
16202
16163
|
const requestedVersion = request.params.protocolVersion;
|
|
@@ -16230,9 +16191,8 @@ var Server = class extends Protocol {
|
|
|
16230
16191
|
}
|
|
16231
16192
|
// Implementation
|
|
16232
16193
|
async createMessage(params, options) {
|
|
16233
|
-
var _a5, _b;
|
|
16234
16194
|
if (params.tools || params.toolChoice) {
|
|
16235
|
-
if (!
|
|
16195
|
+
if (!this._clientCapabilities?.sampling?.tools) {
|
|
16236
16196
|
throw new Error("Client does not support sampling tools capability.");
|
|
16237
16197
|
}
|
|
16238
16198
|
}
|
|
@@ -16272,18 +16232,17 @@ var Server = class extends Protocol {
|
|
|
16272
16232
|
* @returns The result of the elicitation request.
|
|
16273
16233
|
*/
|
|
16274
16234
|
async elicitInput(params, options) {
|
|
16275
|
-
|
|
16276
|
-
const mode = (_a5 = params.mode) != null ? _a5 : "form";
|
|
16235
|
+
const mode = params.mode ?? "form";
|
|
16277
16236
|
switch (mode) {
|
|
16278
16237
|
case "url": {
|
|
16279
|
-
if (!
|
|
16238
|
+
if (!this._clientCapabilities?.elicitation?.url) {
|
|
16280
16239
|
throw new Error("Client does not support url elicitation.");
|
|
16281
16240
|
}
|
|
16282
16241
|
const urlParams = params;
|
|
16283
16242
|
return this.request({ method: "elicitation/create", params: urlParams }, ElicitResultSchema, options);
|
|
16284
16243
|
}
|
|
16285
16244
|
case "form": {
|
|
16286
|
-
if (!
|
|
16245
|
+
if (!this._clientCapabilities?.elicitation?.form) {
|
|
16287
16246
|
throw new Error("Client does not support form elicitation.");
|
|
16288
16247
|
}
|
|
16289
16248
|
const formParams = params.mode === "form" ? params : { ...params, mode: "form" };
|
|
@@ -16315,8 +16274,7 @@ var Server = class extends Protocol {
|
|
|
16315
16274
|
* @returns A function that emits the completion notification when awaited.
|
|
16316
16275
|
*/
|
|
16317
16276
|
createElicitationCompletionNotifier(elicitationId, options) {
|
|
16318
|
-
|
|
16319
|
-
if (!((_b = (_a5 = this._clientCapabilities) == null ? void 0 : _a5.elicitation) == null ? void 0 : _b.url)) {
|
|
16277
|
+
if (!this._clientCapabilities?.elicitation?.url) {
|
|
16320
16278
|
throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");
|
|
16321
16279
|
}
|
|
16322
16280
|
return () => this.notification({
|
|
@@ -16363,18 +16321,16 @@ var Server = class extends Protocol {
|
|
|
16363
16321
|
};
|
|
16364
16322
|
|
|
16365
16323
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
16366
|
-
var import_node_process = __toESM(require("process"), 1);
|
|
16324
|
+
var import_node_process = __toESM(require("node:process"), 1);
|
|
16367
16325
|
|
|
16368
16326
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
16369
16327
|
var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
16370
16328
|
var ReadBuffer = class {
|
|
16371
16329
|
constructor(options) {
|
|
16372
|
-
|
|
16373
|
-
this._maxBufferSize = (_a5 = options == null ? void 0 : options.maxBufferSize) != null ? _a5 : STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
16330
|
+
this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
16374
16331
|
}
|
|
16375
16332
|
append(chunk) {
|
|
16376
|
-
|
|
16377
|
-
const newSize = ((_b = (_a5 = this._buffer) == null ? void 0 : _a5.length) != null ? _b : 0) + chunk.length;
|
|
16333
|
+
const newSize = (this._buffer?.length ?? 0) + chunk.length;
|
|
16378
16334
|
if (newSize > this._maxBufferSize) {
|
|
16379
16335
|
this.clear();
|
|
16380
16336
|
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
@@ -16411,21 +16367,19 @@ var StdioServerTransport = class {
|
|
|
16411
16367
|
this._stdout = _stdout;
|
|
16412
16368
|
this._started = false;
|
|
16413
16369
|
this._ondata = (chunk) => {
|
|
16414
|
-
var _a5;
|
|
16415
16370
|
try {
|
|
16416
16371
|
this._readBuffer.append(chunk);
|
|
16417
16372
|
this.processReadBuffer();
|
|
16418
16373
|
} catch (error2) {
|
|
16419
|
-
|
|
16374
|
+
this.onerror?.(error2);
|
|
16420
16375
|
this.close().catch(() => {
|
|
16421
16376
|
});
|
|
16422
16377
|
}
|
|
16423
16378
|
};
|
|
16424
16379
|
this._onerror = (error2) => {
|
|
16425
|
-
|
|
16426
|
-
(_a5 = this.onerror) == null ? void 0 : _a5.call(this, error2);
|
|
16380
|
+
this.onerror?.(error2);
|
|
16427
16381
|
};
|
|
16428
|
-
this._readBuffer = new ReadBuffer({ maxBufferSize: options
|
|
16382
|
+
this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
|
|
16429
16383
|
}
|
|
16430
16384
|
/**
|
|
16431
16385
|
* Starts listening for messages on stdin.
|
|
@@ -16439,21 +16393,19 @@ var StdioServerTransport = class {
|
|
|
16439
16393
|
this._stdin.on("error", this._onerror);
|
|
16440
16394
|
}
|
|
16441
16395
|
processReadBuffer() {
|
|
16442
|
-
var _a5, _b;
|
|
16443
16396
|
while (true) {
|
|
16444
16397
|
try {
|
|
16445
16398
|
const message = this._readBuffer.readMessage();
|
|
16446
16399
|
if (message === null) {
|
|
16447
16400
|
break;
|
|
16448
16401
|
}
|
|
16449
|
-
|
|
16402
|
+
this.onmessage?.(message);
|
|
16450
16403
|
} catch (error2) {
|
|
16451
|
-
|
|
16404
|
+
this.onerror?.(error2);
|
|
16452
16405
|
}
|
|
16453
16406
|
}
|
|
16454
16407
|
}
|
|
16455
16408
|
async close() {
|
|
16456
|
-
var _a5;
|
|
16457
16409
|
this._stdin.off("data", this._ondata);
|
|
16458
16410
|
this._stdin.off("error", this._onerror);
|
|
16459
16411
|
const remainingDataListeners = this._stdin.listenerCount("data");
|
|
@@ -16461,7 +16413,7 @@ var StdioServerTransport = class {
|
|
|
16461
16413
|
this._stdin.pause();
|
|
16462
16414
|
}
|
|
16463
16415
|
this._readBuffer.clear();
|
|
16464
|
-
|
|
16416
|
+
this.onclose?.();
|
|
16465
16417
|
}
|
|
16466
16418
|
send(message) {
|
|
16467
16419
|
return new Promise((resolve) => {
|
|
@@ -16555,8 +16507,8 @@ server2.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
16555
16507
|
}
|
|
16556
16508
|
}
|
|
16557
16509
|
if (name === "yap2app_suggest_placement") {
|
|
16558
|
-
const componentName =
|
|
16559
|
-
const granularity =
|
|
16510
|
+
const componentName = args?.componentName || "CustomComponent";
|
|
16511
|
+
const granularity = args?.granularity || "organism";
|
|
16560
16512
|
let subfolder = "components/organisms";
|
|
16561
16513
|
if (granularity === "atom") subfolder = "components/ui";
|
|
16562
16514
|
else if (granularity === "molecule") subfolder = "components/molecules";
|