@codemation/core-nodes 0.0.21 → 0.0.24
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/CHANGELOG.md +25 -0
- package/dist/index.cjs +1606 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +189 -27
- package/dist/index.d.ts +189 -27
- package/dist/index.js +1580 -60
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +3 -0
- package/src/nodes/AIAgentConfig.ts +14 -4
- package/src/nodes/AIAgentNode.ts +40 -12
- package/src/nodes/AggregateNode.ts +19 -0
- package/src/nodes/FilterNode.ts +22 -0
- package/src/nodes/MapDataNode.ts +12 -9
- package/src/nodes/SplitNode.ts +26 -0
- package/src/nodes/aggregate.ts +21 -0
- package/src/nodes/filter.ts +23 -0
- package/src/nodes/split.ts +23 -0
- package/src/register.types.ts +6 -0
- package/src/workflowAuthoring/WorkflowBranchBuilder.types.ts +1 -1
- package/src/workflowAuthoring/WorkflowChain.types.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -179,12 +179,77 @@ var AgentToolCallPortMap = class {
|
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
184
|
+
/** A special constant with type `never` */
|
|
185
|
+
const NEVER = Object.freeze({ status: "aborted" });
|
|
186
|
+
function $constructor(name, initializer$2, params) {
|
|
187
|
+
function init(inst, def) {
|
|
188
|
+
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
189
|
+
value: {
|
|
190
|
+
def,
|
|
191
|
+
constr: _,
|
|
192
|
+
traits: /* @__PURE__ */ new Set()
|
|
193
|
+
},
|
|
194
|
+
enumerable: false
|
|
195
|
+
});
|
|
196
|
+
if (inst._zod.traits.has(name)) return;
|
|
197
|
+
inst._zod.traits.add(name);
|
|
198
|
+
initializer$2(inst, def);
|
|
199
|
+
const proto = _.prototype;
|
|
200
|
+
const keys = Object.keys(proto);
|
|
201
|
+
for (let i = 0; i < keys.length; i++) {
|
|
202
|
+
const k = keys[i];
|
|
203
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const Parent = params?.Parent ?? Object;
|
|
207
|
+
class Definition extends Parent {}
|
|
208
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
209
|
+
function _(def) {
|
|
210
|
+
var _a$1;
|
|
211
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
212
|
+
init(inst, def);
|
|
213
|
+
(_a$1 = inst._zod).deferred ?? (_a$1.deferred = []);
|
|
214
|
+
for (const fn of inst._zod.deferred) fn();
|
|
215
|
+
return inst;
|
|
216
|
+
}
|
|
217
|
+
Object.defineProperty(_, "init", { value: init });
|
|
218
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
219
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
220
|
+
return inst?._zod?.traits?.has(name);
|
|
221
|
+
} });
|
|
222
|
+
Object.defineProperty(_, "name", { value: name });
|
|
223
|
+
return _;
|
|
224
|
+
}
|
|
225
|
+
const $brand = Symbol("zod_brand");
|
|
226
|
+
var $ZodAsyncError = class extends Error {
|
|
227
|
+
constructor() {
|
|
228
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
var $ZodEncodeError = class extends Error {
|
|
232
|
+
constructor(name) {
|
|
233
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
234
|
+
this.name = "ZodEncodeError";
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
const globalConfig = {};
|
|
238
|
+
function config(newConfig) {
|
|
239
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
240
|
+
return globalConfig;
|
|
241
|
+
}
|
|
242
|
+
|
|
182
243
|
//#endregion
|
|
183
244
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js
|
|
184
245
|
function getEnumValues(entries) {
|
|
185
246
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
186
247
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
187
248
|
}
|
|
249
|
+
function jsonStringifyReplacer(_, value) {
|
|
250
|
+
if (typeof value === "bigint") return value.toString();
|
|
251
|
+
return value;
|
|
252
|
+
}
|
|
188
253
|
function cached(getter) {
|
|
189
254
|
return { get value() {
|
|
190
255
|
{
|
|
@@ -195,8 +260,44 @@ function cached(getter) {
|
|
|
195
260
|
throw new Error("cached value already set");
|
|
196
261
|
} };
|
|
197
262
|
}
|
|
263
|
+
function nullish(input) {
|
|
264
|
+
return input === null || input === void 0;
|
|
265
|
+
}
|
|
266
|
+
function cleanRegex(source) {
|
|
267
|
+
const start = source.startsWith("^") ? 1 : 0;
|
|
268
|
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
269
|
+
return source.slice(start, end);
|
|
270
|
+
}
|
|
198
271
|
const EVALUATING = Symbol("evaluating");
|
|
272
|
+
function defineLazy(object, key, getter) {
|
|
273
|
+
let value = void 0;
|
|
274
|
+
Object.defineProperty(object, key, {
|
|
275
|
+
get() {
|
|
276
|
+
if (value === EVALUATING) return;
|
|
277
|
+
if (value === void 0) {
|
|
278
|
+
value = EVALUATING;
|
|
279
|
+
value = getter();
|
|
280
|
+
}
|
|
281
|
+
return value;
|
|
282
|
+
},
|
|
283
|
+
set(v) {
|
|
284
|
+
Object.defineProperty(object, key, { value: v });
|
|
285
|
+
},
|
|
286
|
+
configurable: true
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function mergeDefs(...defs) {
|
|
290
|
+
const mergedDescriptors = {};
|
|
291
|
+
for (const def of defs) {
|
|
292
|
+
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
293
|
+
Object.assign(mergedDescriptors, descriptors);
|
|
294
|
+
}
|
|
295
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
296
|
+
}
|
|
199
297
|
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
298
|
+
function isObject(data) {
|
|
299
|
+
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
300
|
+
}
|
|
200
301
|
const allowsEval = cached(() => {
|
|
201
302
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
|
|
202
303
|
try {
|
|
@@ -206,6 +307,41 @@ const allowsEval = cached(() => {
|
|
|
206
307
|
return false;
|
|
207
308
|
}
|
|
208
309
|
});
|
|
310
|
+
function isPlainObject(o) {
|
|
311
|
+
if (isObject(o) === false) return false;
|
|
312
|
+
const ctor = o.constructor;
|
|
313
|
+
if (ctor === void 0) return true;
|
|
314
|
+
if (typeof ctor !== "function") return true;
|
|
315
|
+
const prot = ctor.prototype;
|
|
316
|
+
if (isObject(prot) === false) return false;
|
|
317
|
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
320
|
+
function shallowClone(o) {
|
|
321
|
+
if (isPlainObject(o)) return { ...o };
|
|
322
|
+
if (Array.isArray(o)) return [...o];
|
|
323
|
+
return o;
|
|
324
|
+
}
|
|
325
|
+
function clone(inst, def, params) {
|
|
326
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
327
|
+
if (!def || params?.parent) cl._zod.parent = inst;
|
|
328
|
+
return cl;
|
|
329
|
+
}
|
|
330
|
+
function normalizeParams(_params) {
|
|
331
|
+
const params = _params;
|
|
332
|
+
if (!params) return {};
|
|
333
|
+
if (typeof params === "string") return { error: () => params };
|
|
334
|
+
if (params?.message !== void 0) {
|
|
335
|
+
if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
|
|
336
|
+
params.error = params.message;
|
|
337
|
+
}
|
|
338
|
+
delete params.message;
|
|
339
|
+
if (typeof params.error === "string") return {
|
|
340
|
+
...params,
|
|
341
|
+
error: () => params.error
|
|
342
|
+
};
|
|
343
|
+
return params;
|
|
344
|
+
}
|
|
209
345
|
const NUMBER_FORMAT_RANGES = {
|
|
210
346
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
211
347
|
int32: [-2147483648, 2147483647],
|
|
@@ -213,6 +349,824 @@ const NUMBER_FORMAT_RANGES = {
|
|
|
213
349
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
214
350
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
215
351
|
};
|
|
352
|
+
function aborted(x, startIndex = 0) {
|
|
353
|
+
if (x.aborted === true) return true;
|
|
354
|
+
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
function prefixIssues(path, issues) {
|
|
358
|
+
return issues.map((iss) => {
|
|
359
|
+
var _a$1;
|
|
360
|
+
(_a$1 = iss).path ?? (_a$1.path = []);
|
|
361
|
+
iss.path.unshift(path);
|
|
362
|
+
return iss;
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
function unwrapMessage(message) {
|
|
366
|
+
return typeof message === "string" ? message : message?.message;
|
|
367
|
+
}
|
|
368
|
+
function finalizeIssue(iss, ctx, config$1) {
|
|
369
|
+
const full = {
|
|
370
|
+
...iss,
|
|
371
|
+
path: iss.path ?? []
|
|
372
|
+
};
|
|
373
|
+
if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config$1.customError?.(iss)) ?? unwrapMessage(config$1.localeError?.(iss)) ?? "Invalid input";
|
|
374
|
+
delete full.inst;
|
|
375
|
+
delete full.continue;
|
|
376
|
+
if (!ctx?.reportInput) delete full.input;
|
|
377
|
+
return full;
|
|
378
|
+
}
|
|
379
|
+
function getLengthableOrigin(input) {
|
|
380
|
+
if (Array.isArray(input)) return "array";
|
|
381
|
+
if (typeof input === "string") return "string";
|
|
382
|
+
return "unknown";
|
|
383
|
+
}
|
|
384
|
+
function issue(...args) {
|
|
385
|
+
const [iss, input, inst] = args;
|
|
386
|
+
if (typeof iss === "string") return {
|
|
387
|
+
message: iss,
|
|
388
|
+
code: "custom",
|
|
389
|
+
input,
|
|
390
|
+
inst
|
|
391
|
+
};
|
|
392
|
+
return { ...iss };
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
|
|
397
|
+
const initializer$1 = (inst, def) => {
|
|
398
|
+
inst.name = "$ZodError";
|
|
399
|
+
Object.defineProperty(inst, "_zod", {
|
|
400
|
+
value: inst._zod,
|
|
401
|
+
enumerable: false
|
|
402
|
+
});
|
|
403
|
+
Object.defineProperty(inst, "issues", {
|
|
404
|
+
value: def,
|
|
405
|
+
enumerable: false
|
|
406
|
+
});
|
|
407
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
408
|
+
Object.defineProperty(inst, "toString", {
|
|
409
|
+
value: () => inst.message,
|
|
410
|
+
enumerable: false
|
|
411
|
+
});
|
|
412
|
+
};
|
|
413
|
+
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
414
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
415
|
+
function flattenError(error, mapper = (issue$1) => issue$1.message) {
|
|
416
|
+
const fieldErrors = {};
|
|
417
|
+
const formErrors = [];
|
|
418
|
+
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
419
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
420
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
421
|
+
} else formErrors.push(mapper(sub));
|
|
422
|
+
return {
|
|
423
|
+
formErrors,
|
|
424
|
+
fieldErrors
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
function formatError(error, mapper = (issue$1) => issue$1.message) {
|
|
428
|
+
const fieldErrors = { _errors: [] };
|
|
429
|
+
const processError = (error$1) => {
|
|
430
|
+
for (const issue$1 of error$1.issues) if (issue$1.code === "invalid_union" && issue$1.errors.length) issue$1.errors.map((issues) => processError({ issues }));
|
|
431
|
+
else if (issue$1.code === "invalid_key") processError({ issues: issue$1.issues });
|
|
432
|
+
else if (issue$1.code === "invalid_element") processError({ issues: issue$1.issues });
|
|
433
|
+
else if (issue$1.path.length === 0) fieldErrors._errors.push(mapper(issue$1));
|
|
434
|
+
else {
|
|
435
|
+
let curr = fieldErrors;
|
|
436
|
+
let i = 0;
|
|
437
|
+
while (i < issue$1.path.length) {
|
|
438
|
+
const el = issue$1.path[i];
|
|
439
|
+
if (!(i === issue$1.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
440
|
+
else {
|
|
441
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
442
|
+
curr[el]._errors.push(mapper(issue$1));
|
|
443
|
+
}
|
|
444
|
+
curr = curr[el];
|
|
445
|
+
i++;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
processError(error);
|
|
450
|
+
return fieldErrors;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
|
|
455
|
+
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
456
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
457
|
+
const result = schema._zod.run({
|
|
458
|
+
value,
|
|
459
|
+
issues: []
|
|
460
|
+
}, ctx);
|
|
461
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
462
|
+
if (result.issues.length) {
|
|
463
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
464
|
+
captureStackTrace(e, _params?.callee);
|
|
465
|
+
throw e;
|
|
466
|
+
}
|
|
467
|
+
return result.value;
|
|
468
|
+
};
|
|
469
|
+
const parse$1 = /* @__PURE__ */ _parse($ZodRealError);
|
|
470
|
+
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
471
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
472
|
+
let result = schema._zod.run({
|
|
473
|
+
value,
|
|
474
|
+
issues: []
|
|
475
|
+
}, ctx);
|
|
476
|
+
if (result instanceof Promise) result = await result;
|
|
477
|
+
if (result.issues.length) {
|
|
478
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
479
|
+
captureStackTrace(e, params?.callee);
|
|
480
|
+
throw e;
|
|
481
|
+
}
|
|
482
|
+
return result.value;
|
|
483
|
+
};
|
|
484
|
+
const parseAsync$1 = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
485
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
486
|
+
const ctx = _ctx ? {
|
|
487
|
+
..._ctx,
|
|
488
|
+
async: false
|
|
489
|
+
} : { async: false };
|
|
490
|
+
const result = schema._zod.run({
|
|
491
|
+
value,
|
|
492
|
+
issues: []
|
|
493
|
+
}, ctx);
|
|
494
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
495
|
+
return result.issues.length ? {
|
|
496
|
+
success: false,
|
|
497
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
498
|
+
} : {
|
|
499
|
+
success: true,
|
|
500
|
+
data: result.value
|
|
501
|
+
};
|
|
502
|
+
};
|
|
503
|
+
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
504
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
505
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
506
|
+
let result = schema._zod.run({
|
|
507
|
+
value,
|
|
508
|
+
issues: []
|
|
509
|
+
}, ctx);
|
|
510
|
+
if (result instanceof Promise) result = await result;
|
|
511
|
+
return result.issues.length ? {
|
|
512
|
+
success: false,
|
|
513
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
514
|
+
} : {
|
|
515
|
+
success: true,
|
|
516
|
+
data: result.value
|
|
517
|
+
};
|
|
518
|
+
};
|
|
519
|
+
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
520
|
+
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
521
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
522
|
+
return _parse(_Err)(schema, value, ctx);
|
|
523
|
+
};
|
|
524
|
+
const encode$1 = /* @__PURE__ */ _encode($ZodRealError);
|
|
525
|
+
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
526
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
527
|
+
};
|
|
528
|
+
const decode$1 = /* @__PURE__ */ _decode($ZodRealError);
|
|
529
|
+
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
530
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
531
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
532
|
+
};
|
|
533
|
+
const encodeAsync$1 = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
534
|
+
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
535
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
536
|
+
};
|
|
537
|
+
const decodeAsync$1 = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
538
|
+
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
539
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
540
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
541
|
+
};
|
|
542
|
+
const safeEncode$1 = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
543
|
+
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
544
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
545
|
+
};
|
|
546
|
+
const safeDecode$1 = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
547
|
+
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
548
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
549
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
550
|
+
};
|
|
551
|
+
const safeEncodeAsync$1 = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
552
|
+
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
553
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
554
|
+
};
|
|
555
|
+
const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
556
|
+
|
|
557
|
+
//#endregion
|
|
558
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
559
|
+
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
560
|
+
var _a$1;
|
|
561
|
+
inst._zod ?? (inst._zod = {});
|
|
562
|
+
inst._zod.def = def;
|
|
563
|
+
(_a$1 = inst._zod).onattach ?? (_a$1.onattach = []);
|
|
564
|
+
});
|
|
565
|
+
const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
566
|
+
var _a$1;
|
|
567
|
+
$ZodCheck.init(inst, def);
|
|
568
|
+
(_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
|
|
569
|
+
const val = payload.value;
|
|
570
|
+
return !nullish(val) && val.length !== void 0;
|
|
571
|
+
});
|
|
572
|
+
inst._zod.onattach.push((inst$1) => {
|
|
573
|
+
const curr = inst$1._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
574
|
+
if (def.maximum < curr) inst$1._zod.bag.maximum = def.maximum;
|
|
575
|
+
});
|
|
576
|
+
inst._zod.check = (payload) => {
|
|
577
|
+
const input = payload.value;
|
|
578
|
+
if (input.length <= def.maximum) return;
|
|
579
|
+
const origin = getLengthableOrigin(input);
|
|
580
|
+
payload.issues.push({
|
|
581
|
+
origin,
|
|
582
|
+
code: "too_big",
|
|
583
|
+
maximum: def.maximum,
|
|
584
|
+
inclusive: true,
|
|
585
|
+
input,
|
|
586
|
+
inst,
|
|
587
|
+
continue: !def.abort
|
|
588
|
+
});
|
|
589
|
+
};
|
|
590
|
+
});
|
|
591
|
+
const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
592
|
+
var _a$1;
|
|
593
|
+
$ZodCheck.init(inst, def);
|
|
594
|
+
(_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
|
|
595
|
+
const val = payload.value;
|
|
596
|
+
return !nullish(val) && val.length !== void 0;
|
|
597
|
+
});
|
|
598
|
+
inst._zod.onattach.push((inst$1) => {
|
|
599
|
+
const curr = inst$1._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
600
|
+
if (def.minimum > curr) inst$1._zod.bag.minimum = def.minimum;
|
|
601
|
+
});
|
|
602
|
+
inst._zod.check = (payload) => {
|
|
603
|
+
const input = payload.value;
|
|
604
|
+
if (input.length >= def.minimum) return;
|
|
605
|
+
const origin = getLengthableOrigin(input);
|
|
606
|
+
payload.issues.push({
|
|
607
|
+
origin,
|
|
608
|
+
code: "too_small",
|
|
609
|
+
minimum: def.minimum,
|
|
610
|
+
inclusive: true,
|
|
611
|
+
input,
|
|
612
|
+
inst,
|
|
613
|
+
continue: !def.abort
|
|
614
|
+
});
|
|
615
|
+
};
|
|
616
|
+
});
|
|
617
|
+
const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
618
|
+
var _a$1;
|
|
619
|
+
$ZodCheck.init(inst, def);
|
|
620
|
+
(_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
|
|
621
|
+
const val = payload.value;
|
|
622
|
+
return !nullish(val) && val.length !== void 0;
|
|
623
|
+
});
|
|
624
|
+
inst._zod.onattach.push((inst$1) => {
|
|
625
|
+
const bag = inst$1._zod.bag;
|
|
626
|
+
bag.minimum = def.length;
|
|
627
|
+
bag.maximum = def.length;
|
|
628
|
+
bag.length = def.length;
|
|
629
|
+
});
|
|
630
|
+
inst._zod.check = (payload) => {
|
|
631
|
+
const input = payload.value;
|
|
632
|
+
const length = input.length;
|
|
633
|
+
if (length === def.length) return;
|
|
634
|
+
const origin = getLengthableOrigin(input);
|
|
635
|
+
const tooBig = length > def.length;
|
|
636
|
+
payload.issues.push({
|
|
637
|
+
origin,
|
|
638
|
+
...tooBig ? {
|
|
639
|
+
code: "too_big",
|
|
640
|
+
maximum: def.length
|
|
641
|
+
} : {
|
|
642
|
+
code: "too_small",
|
|
643
|
+
minimum: def.length
|
|
644
|
+
},
|
|
645
|
+
inclusive: true,
|
|
646
|
+
exact: true,
|
|
647
|
+
input: payload.value,
|
|
648
|
+
inst,
|
|
649
|
+
continue: !def.abort
|
|
650
|
+
});
|
|
651
|
+
};
|
|
652
|
+
});
|
|
653
|
+
const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
654
|
+
$ZodCheck.init(inst, def);
|
|
655
|
+
inst._zod.check = (payload) => {
|
|
656
|
+
payload.value = def.tx(payload.value);
|
|
657
|
+
};
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
|
|
662
|
+
const version = {
|
|
663
|
+
major: 4,
|
|
664
|
+
minor: 3,
|
|
665
|
+
patch: 6
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
//#endregion
|
|
669
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
|
|
670
|
+
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
671
|
+
var _a$1;
|
|
672
|
+
inst ?? (inst = {});
|
|
673
|
+
inst._zod.def = def;
|
|
674
|
+
inst._zod.bag = inst._zod.bag || {};
|
|
675
|
+
inst._zod.version = version;
|
|
676
|
+
const checks = [...inst._zod.def.checks ?? []];
|
|
677
|
+
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
678
|
+
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
679
|
+
if (checks.length === 0) {
|
|
680
|
+
(_a$1 = inst._zod).deferred ?? (_a$1.deferred = []);
|
|
681
|
+
inst._zod.deferred?.push(() => {
|
|
682
|
+
inst._zod.run = inst._zod.parse;
|
|
683
|
+
});
|
|
684
|
+
} else {
|
|
685
|
+
const runChecks = (payload, checks$1, ctx) => {
|
|
686
|
+
let isAborted = aborted(payload);
|
|
687
|
+
let asyncResult;
|
|
688
|
+
for (const ch of checks$1) {
|
|
689
|
+
if (ch._zod.def.when) {
|
|
690
|
+
if (!ch._zod.def.when(payload)) continue;
|
|
691
|
+
} else if (isAborted) continue;
|
|
692
|
+
const currLen = payload.issues.length;
|
|
693
|
+
const _ = ch._zod.check(payload);
|
|
694
|
+
if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
|
|
695
|
+
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
696
|
+
await _;
|
|
697
|
+
if (payload.issues.length === currLen) return;
|
|
698
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
699
|
+
});
|
|
700
|
+
else {
|
|
701
|
+
if (payload.issues.length === currLen) continue;
|
|
702
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
if (asyncResult) return asyncResult.then(() => {
|
|
706
|
+
return payload;
|
|
707
|
+
});
|
|
708
|
+
return payload;
|
|
709
|
+
};
|
|
710
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
711
|
+
if (aborted(canary)) {
|
|
712
|
+
canary.aborted = true;
|
|
713
|
+
return canary;
|
|
714
|
+
}
|
|
715
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
716
|
+
if (checkResult instanceof Promise) {
|
|
717
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
718
|
+
return checkResult.then((checkResult$1) => inst._zod.parse(checkResult$1, ctx));
|
|
719
|
+
}
|
|
720
|
+
return inst._zod.parse(checkResult, ctx);
|
|
721
|
+
};
|
|
722
|
+
inst._zod.run = (payload, ctx) => {
|
|
723
|
+
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
724
|
+
if (ctx.direction === "backward") {
|
|
725
|
+
const canary = inst._zod.parse({
|
|
726
|
+
value: payload.value,
|
|
727
|
+
issues: []
|
|
728
|
+
}, {
|
|
729
|
+
...ctx,
|
|
730
|
+
skipChecks: true
|
|
731
|
+
});
|
|
732
|
+
if (canary instanceof Promise) return canary.then((canary$1) => {
|
|
733
|
+
return handleCanaryResult(canary$1, payload, ctx);
|
|
734
|
+
});
|
|
735
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
736
|
+
}
|
|
737
|
+
const result = inst._zod.parse(payload, ctx);
|
|
738
|
+
if (result instanceof Promise) {
|
|
739
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
740
|
+
return result.then((result$1) => runChecks(result$1, checks, ctx));
|
|
741
|
+
}
|
|
742
|
+
return runChecks(result, checks, ctx);
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
defineLazy(inst, "~standard", () => ({
|
|
746
|
+
validate: (value) => {
|
|
747
|
+
try {
|
|
748
|
+
const r = safeParse$1(inst, value);
|
|
749
|
+
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
750
|
+
} catch (_) {
|
|
751
|
+
return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
vendor: "zod",
|
|
755
|
+
version: 1
|
|
756
|
+
}));
|
|
757
|
+
});
|
|
758
|
+
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
759
|
+
$ZodType.init(inst, def);
|
|
760
|
+
inst._zod.parse = (payload) => payload;
|
|
761
|
+
});
|
|
762
|
+
function handleArrayResult(result, final, index) {
|
|
763
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
764
|
+
final.value[index] = result.value;
|
|
765
|
+
}
|
|
766
|
+
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
767
|
+
$ZodType.init(inst, def);
|
|
768
|
+
inst._zod.parse = (payload, ctx) => {
|
|
769
|
+
const input = payload.value;
|
|
770
|
+
if (!Array.isArray(input)) {
|
|
771
|
+
payload.issues.push({
|
|
772
|
+
expected: "array",
|
|
773
|
+
code: "invalid_type",
|
|
774
|
+
input,
|
|
775
|
+
inst
|
|
776
|
+
});
|
|
777
|
+
return payload;
|
|
778
|
+
}
|
|
779
|
+
payload.value = Array(input.length);
|
|
780
|
+
const proms = [];
|
|
781
|
+
for (let i = 0; i < input.length; i++) {
|
|
782
|
+
const item = input[i];
|
|
783
|
+
const result = def.element._zod.run({
|
|
784
|
+
value: item,
|
|
785
|
+
issues: []
|
|
786
|
+
}, ctx);
|
|
787
|
+
if (result instanceof Promise) proms.push(result.then((result$1) => handleArrayResult(result$1, payload, i)));
|
|
788
|
+
else handleArrayResult(result, payload, i);
|
|
789
|
+
}
|
|
790
|
+
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
791
|
+
return payload;
|
|
792
|
+
};
|
|
793
|
+
});
|
|
794
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
795
|
+
for (const result of results) if (result.issues.length === 0) {
|
|
796
|
+
final.value = result.value;
|
|
797
|
+
return final;
|
|
798
|
+
}
|
|
799
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
800
|
+
if (nonaborted.length === 1) {
|
|
801
|
+
final.value = nonaborted[0].value;
|
|
802
|
+
return nonaborted[0];
|
|
803
|
+
}
|
|
804
|
+
final.issues.push({
|
|
805
|
+
code: "invalid_union",
|
|
806
|
+
input: final.value,
|
|
807
|
+
inst,
|
|
808
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
809
|
+
});
|
|
810
|
+
return final;
|
|
811
|
+
}
|
|
812
|
+
const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
813
|
+
$ZodType.init(inst, def);
|
|
814
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
815
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
816
|
+
defineLazy(inst._zod, "values", () => {
|
|
817
|
+
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
818
|
+
});
|
|
819
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
820
|
+
if (def.options.every((o) => o._zod.pattern)) {
|
|
821
|
+
const patterns = def.options.map((o) => o._zod.pattern);
|
|
822
|
+
return /* @__PURE__ */ new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
const single = def.options.length === 1;
|
|
826
|
+
const first = def.options[0]._zod.run;
|
|
827
|
+
inst._zod.parse = (payload, ctx) => {
|
|
828
|
+
if (single) return first(payload, ctx);
|
|
829
|
+
let async = false;
|
|
830
|
+
const results = [];
|
|
831
|
+
for (const option of def.options) {
|
|
832
|
+
const result = option._zod.run({
|
|
833
|
+
value: payload.value,
|
|
834
|
+
issues: []
|
|
835
|
+
}, ctx);
|
|
836
|
+
if (result instanceof Promise) {
|
|
837
|
+
results.push(result);
|
|
838
|
+
async = true;
|
|
839
|
+
} else {
|
|
840
|
+
if (result.issues.length === 0) return result;
|
|
841
|
+
results.push(result);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
845
|
+
return Promise.all(results).then((results$1) => {
|
|
846
|
+
return handleUnionResults(results$1, payload, inst, ctx);
|
|
847
|
+
});
|
|
848
|
+
};
|
|
849
|
+
});
|
|
850
|
+
const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
851
|
+
$ZodType.init(inst, def);
|
|
852
|
+
inst._zod.parse = (payload, ctx) => {
|
|
853
|
+
const input = payload.value;
|
|
854
|
+
const left = def.left._zod.run({
|
|
855
|
+
value: input,
|
|
856
|
+
issues: []
|
|
857
|
+
}, ctx);
|
|
858
|
+
const right = def.right._zod.run({
|
|
859
|
+
value: input,
|
|
860
|
+
issues: []
|
|
861
|
+
}, ctx);
|
|
862
|
+
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left$1, right$1]) => {
|
|
863
|
+
return handleIntersectionResults(payload, left$1, right$1);
|
|
864
|
+
});
|
|
865
|
+
return handleIntersectionResults(payload, left, right);
|
|
866
|
+
};
|
|
867
|
+
});
|
|
868
|
+
function mergeValues(a, b) {
|
|
869
|
+
if (a === b) return {
|
|
870
|
+
valid: true,
|
|
871
|
+
data: a
|
|
872
|
+
};
|
|
873
|
+
if (a instanceof Date && b instanceof Date && +a === +b) return {
|
|
874
|
+
valid: true,
|
|
875
|
+
data: a
|
|
876
|
+
};
|
|
877
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
878
|
+
const bKeys = Object.keys(b);
|
|
879
|
+
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
880
|
+
const newObj = {
|
|
881
|
+
...a,
|
|
882
|
+
...b
|
|
883
|
+
};
|
|
884
|
+
for (const key of sharedKeys) {
|
|
885
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
|
886
|
+
if (!sharedValue.valid) return {
|
|
887
|
+
valid: false,
|
|
888
|
+
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
889
|
+
};
|
|
890
|
+
newObj[key] = sharedValue.data;
|
|
891
|
+
}
|
|
892
|
+
return {
|
|
893
|
+
valid: true,
|
|
894
|
+
data: newObj
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
898
|
+
if (a.length !== b.length) return {
|
|
899
|
+
valid: false,
|
|
900
|
+
mergeErrorPath: []
|
|
901
|
+
};
|
|
902
|
+
const newArray = [];
|
|
903
|
+
for (let index = 0; index < a.length; index++) {
|
|
904
|
+
const itemA = a[index];
|
|
905
|
+
const itemB = b[index];
|
|
906
|
+
const sharedValue = mergeValues(itemA, itemB);
|
|
907
|
+
if (!sharedValue.valid) return {
|
|
908
|
+
valid: false,
|
|
909
|
+
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
910
|
+
};
|
|
911
|
+
newArray.push(sharedValue.data);
|
|
912
|
+
}
|
|
913
|
+
return {
|
|
914
|
+
valid: true,
|
|
915
|
+
data: newArray
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
return {
|
|
919
|
+
valid: false,
|
|
920
|
+
mergeErrorPath: []
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
function handleIntersectionResults(result, left, right) {
|
|
924
|
+
const unrecKeys = /* @__PURE__ */ new Map();
|
|
925
|
+
let unrecIssue;
|
|
926
|
+
for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
|
|
927
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
928
|
+
for (const k of iss.keys) {
|
|
929
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
930
|
+
unrecKeys.get(k).l = true;
|
|
931
|
+
}
|
|
932
|
+
} else result.issues.push(iss);
|
|
933
|
+
for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
|
|
934
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
935
|
+
unrecKeys.get(k).r = true;
|
|
936
|
+
}
|
|
937
|
+
else result.issues.push(iss);
|
|
938
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
939
|
+
if (bothKeys.length && unrecIssue) result.issues.push({
|
|
940
|
+
...unrecIssue,
|
|
941
|
+
keys: bothKeys
|
|
942
|
+
});
|
|
943
|
+
if (aborted(result)) return result;
|
|
944
|
+
const merged = mergeValues(left.value, right.value);
|
|
945
|
+
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
946
|
+
result.value = merged.data;
|
|
947
|
+
return result;
|
|
948
|
+
}
|
|
949
|
+
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
950
|
+
$ZodType.init(inst, def);
|
|
951
|
+
inst._zod.parse = (payload, ctx) => {
|
|
952
|
+
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
953
|
+
const _out = def.transform(payload.value, payload);
|
|
954
|
+
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
955
|
+
payload.value = output;
|
|
956
|
+
return payload;
|
|
957
|
+
});
|
|
958
|
+
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
959
|
+
payload.value = _out;
|
|
960
|
+
return payload;
|
|
961
|
+
};
|
|
962
|
+
});
|
|
963
|
+
function handleOptionalResult(result, input) {
|
|
964
|
+
if (result.issues.length && input === void 0) return {
|
|
965
|
+
issues: [],
|
|
966
|
+
value: void 0
|
|
967
|
+
};
|
|
968
|
+
return result;
|
|
969
|
+
}
|
|
970
|
+
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
971
|
+
$ZodType.init(inst, def);
|
|
972
|
+
inst._zod.optin = "optional";
|
|
973
|
+
inst._zod.optout = "optional";
|
|
974
|
+
defineLazy(inst._zod, "values", () => {
|
|
975
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
976
|
+
});
|
|
977
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
978
|
+
const pattern = def.innerType._zod.pattern;
|
|
979
|
+
return pattern ? /* @__PURE__ */ new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
980
|
+
});
|
|
981
|
+
inst._zod.parse = (payload, ctx) => {
|
|
982
|
+
if (def.innerType._zod.optin === "optional") {
|
|
983
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
984
|
+
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
|
|
985
|
+
return handleOptionalResult(result, payload.value);
|
|
986
|
+
}
|
|
987
|
+
if (payload.value === void 0) return payload;
|
|
988
|
+
return def.innerType._zod.run(payload, ctx);
|
|
989
|
+
};
|
|
990
|
+
});
|
|
991
|
+
const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
992
|
+
$ZodOptional.init(inst, def);
|
|
993
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
994
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
995
|
+
inst._zod.parse = (payload, ctx) => {
|
|
996
|
+
return def.innerType._zod.run(payload, ctx);
|
|
997
|
+
};
|
|
998
|
+
});
|
|
999
|
+
const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
1000
|
+
$ZodType.init(inst, def);
|
|
1001
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1002
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1003
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1004
|
+
const pattern = def.innerType._zod.pattern;
|
|
1005
|
+
return pattern ? /* @__PURE__ */ new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
1006
|
+
});
|
|
1007
|
+
defineLazy(inst._zod, "values", () => {
|
|
1008
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
1009
|
+
});
|
|
1010
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1011
|
+
if (payload.value === null) return payload;
|
|
1012
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1013
|
+
};
|
|
1014
|
+
});
|
|
1015
|
+
const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
1016
|
+
$ZodType.init(inst, def);
|
|
1017
|
+
inst._zod.optin = "optional";
|
|
1018
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1019
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1020
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
1021
|
+
if (payload.value === void 0) {
|
|
1022
|
+
payload.value = def.defaultValue;
|
|
1023
|
+
/**
|
|
1024
|
+
* $ZodDefault returns the default value immediately in forward direction.
|
|
1025
|
+
* It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
|
|
1026
|
+
return payload;
|
|
1027
|
+
}
|
|
1028
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1029
|
+
if (result instanceof Promise) return result.then((result$1) => handleDefaultResult(result$1, def));
|
|
1030
|
+
return handleDefaultResult(result, def);
|
|
1031
|
+
};
|
|
1032
|
+
});
|
|
1033
|
+
function handleDefaultResult(payload, def) {
|
|
1034
|
+
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
1035
|
+
return payload;
|
|
1036
|
+
}
|
|
1037
|
+
const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
1038
|
+
$ZodType.init(inst, def);
|
|
1039
|
+
inst._zod.optin = "optional";
|
|
1040
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1041
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1042
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
1043
|
+
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
1044
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1045
|
+
};
|
|
1046
|
+
});
|
|
1047
|
+
const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
1048
|
+
$ZodType.init(inst, def);
|
|
1049
|
+
defineLazy(inst._zod, "values", () => {
|
|
1050
|
+
const v = def.innerType._zod.values;
|
|
1051
|
+
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
1052
|
+
});
|
|
1053
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1054
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1055
|
+
if (result instanceof Promise) return result.then((result$1) => handleNonOptionalResult(result$1, inst));
|
|
1056
|
+
return handleNonOptionalResult(result, inst);
|
|
1057
|
+
};
|
|
1058
|
+
});
|
|
1059
|
+
function handleNonOptionalResult(payload, inst) {
|
|
1060
|
+
if (!payload.issues.length && payload.value === void 0) payload.issues.push({
|
|
1061
|
+
code: "invalid_type",
|
|
1062
|
+
expected: "nonoptional",
|
|
1063
|
+
input: payload.value,
|
|
1064
|
+
inst
|
|
1065
|
+
});
|
|
1066
|
+
return payload;
|
|
1067
|
+
}
|
|
1068
|
+
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
1069
|
+
$ZodType.init(inst, def);
|
|
1070
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1071
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1072
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1073
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1074
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
1075
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1076
|
+
if (result instanceof Promise) return result.then((result$1) => {
|
|
1077
|
+
payload.value = result$1.value;
|
|
1078
|
+
if (result$1.issues.length) {
|
|
1079
|
+
payload.value = def.catchValue({
|
|
1080
|
+
...payload,
|
|
1081
|
+
error: { issues: result$1.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
1082
|
+
input: payload.value
|
|
1083
|
+
});
|
|
1084
|
+
payload.issues = [];
|
|
1085
|
+
}
|
|
1086
|
+
return payload;
|
|
1087
|
+
});
|
|
1088
|
+
payload.value = result.value;
|
|
1089
|
+
if (result.issues.length) {
|
|
1090
|
+
payload.value = def.catchValue({
|
|
1091
|
+
...payload,
|
|
1092
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
1093
|
+
input: payload.value
|
|
1094
|
+
});
|
|
1095
|
+
payload.issues = [];
|
|
1096
|
+
}
|
|
1097
|
+
return payload;
|
|
1098
|
+
};
|
|
1099
|
+
});
|
|
1100
|
+
const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
1101
|
+
$ZodType.init(inst, def);
|
|
1102
|
+
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
1103
|
+
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
1104
|
+
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
1105
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
1106
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1107
|
+
if (ctx.direction === "backward") {
|
|
1108
|
+
const right = def.out._zod.run(payload, ctx);
|
|
1109
|
+
if (right instanceof Promise) return right.then((right$1) => handlePipeResult(right$1, def.in, ctx));
|
|
1110
|
+
return handlePipeResult(right, def.in, ctx);
|
|
1111
|
+
}
|
|
1112
|
+
const left = def.in._zod.run(payload, ctx);
|
|
1113
|
+
if (left instanceof Promise) return left.then((left$1) => handlePipeResult(left$1, def.out, ctx));
|
|
1114
|
+
return handlePipeResult(left, def.out, ctx);
|
|
1115
|
+
};
|
|
1116
|
+
});
|
|
1117
|
+
function handlePipeResult(left, next, ctx) {
|
|
1118
|
+
if (left.issues.length) {
|
|
1119
|
+
left.aborted = true;
|
|
1120
|
+
return left;
|
|
1121
|
+
}
|
|
1122
|
+
return next._zod.run({
|
|
1123
|
+
value: left.value,
|
|
1124
|
+
issues: left.issues
|
|
1125
|
+
}, ctx);
|
|
1126
|
+
}
|
|
1127
|
+
const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
1128
|
+
$ZodType.init(inst, def);
|
|
1129
|
+
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
1130
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1131
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
1132
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
1133
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1134
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
1135
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1136
|
+
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
1137
|
+
return handleReadonlyResult(result);
|
|
1138
|
+
};
|
|
1139
|
+
});
|
|
1140
|
+
function handleReadonlyResult(payload) {
|
|
1141
|
+
payload.value = Object.freeze(payload.value);
|
|
1142
|
+
return payload;
|
|
1143
|
+
}
|
|
1144
|
+
const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
1145
|
+
$ZodCheck.init(inst, def);
|
|
1146
|
+
$ZodType.init(inst, def);
|
|
1147
|
+
inst._zod.parse = (payload, _) => {
|
|
1148
|
+
return payload;
|
|
1149
|
+
};
|
|
1150
|
+
inst._zod.check = (payload) => {
|
|
1151
|
+
const input = payload.value;
|
|
1152
|
+
const r = def.fn(input);
|
|
1153
|
+
if (r instanceof Promise) return r.then((r$1) => handleRefineResult(r$1, payload, input, inst));
|
|
1154
|
+
handleRefineResult(r, payload, input, inst);
|
|
1155
|
+
};
|
|
1156
|
+
});
|
|
1157
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
1158
|
+
if (!result) {
|
|
1159
|
+
const _iss = {
|
|
1160
|
+
code: "custom",
|
|
1161
|
+
input,
|
|
1162
|
+
inst,
|
|
1163
|
+
path: [...inst._zod.def.path ?? []],
|
|
1164
|
+
continue: !inst._zod.def.abort
|
|
1165
|
+
};
|
|
1166
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
1167
|
+
payload.issues.push(issue(_iss));
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
216
1170
|
|
|
217
1171
|
//#endregion
|
|
218
1172
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js
|
|
@@ -225,9 +1179,9 @@ var $ZodRegistry = class {
|
|
|
225
1179
|
this._idmap = /* @__PURE__ */ new Map();
|
|
226
1180
|
}
|
|
227
1181
|
add(schema, ..._meta) {
|
|
228
|
-
const meta = _meta[0];
|
|
229
|
-
this._map.set(schema, meta);
|
|
230
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
1182
|
+
const meta$2 = _meta[0];
|
|
1183
|
+
this._map.set(schema, meta$2);
|
|
1184
|
+
if (meta$2 && typeof meta$2 === "object" && "id" in meta$2) this._idmap.set(meta$2.id, schema);
|
|
231
1185
|
return this;
|
|
232
1186
|
}
|
|
233
1187
|
clear() {
|
|
@@ -236,8 +1190,8 @@ var $ZodRegistry = class {
|
|
|
236
1190
|
return this;
|
|
237
1191
|
}
|
|
238
1192
|
remove(schema) {
|
|
239
|
-
const meta = this._map.get(schema);
|
|
240
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
1193
|
+
const meta$2 = this._map.get(schema);
|
|
1194
|
+
if (meta$2 && typeof meta$2 === "object" && "id" in meta$2) this._idmap.delete(meta$2.id);
|
|
241
1195
|
this._map.delete(schema);
|
|
242
1196
|
return this;
|
|
243
1197
|
}
|
|
@@ -264,6 +1218,115 @@ function registry() {
|
|
|
264
1218
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
265
1219
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
266
1220
|
|
|
1221
|
+
//#endregion
|
|
1222
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
1223
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1224
|
+
function _unknown(Class) {
|
|
1225
|
+
return new Class({ type: "unknown" });
|
|
1226
|
+
}
|
|
1227
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1228
|
+
function _maxLength(maximum, params) {
|
|
1229
|
+
return new $ZodCheckMaxLength({
|
|
1230
|
+
check: "max_length",
|
|
1231
|
+
...normalizeParams(params),
|
|
1232
|
+
maximum
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1236
|
+
function _minLength(minimum, params) {
|
|
1237
|
+
return new $ZodCheckMinLength({
|
|
1238
|
+
check: "min_length",
|
|
1239
|
+
...normalizeParams(params),
|
|
1240
|
+
minimum
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1244
|
+
function _length(length, params) {
|
|
1245
|
+
return new $ZodCheckLengthEquals({
|
|
1246
|
+
check: "length_equals",
|
|
1247
|
+
...normalizeParams(params),
|
|
1248
|
+
length
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1252
|
+
function _overwrite(tx) {
|
|
1253
|
+
return new $ZodCheckOverwrite({
|
|
1254
|
+
check: "overwrite",
|
|
1255
|
+
tx
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1259
|
+
function _array(Class, element, params) {
|
|
1260
|
+
return new Class({
|
|
1261
|
+
type: "array",
|
|
1262
|
+
element,
|
|
1263
|
+
...normalizeParams(params)
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1267
|
+
function _refine(Class, fn, _params) {
|
|
1268
|
+
return new Class({
|
|
1269
|
+
type: "custom",
|
|
1270
|
+
check: "custom",
|
|
1271
|
+
fn,
|
|
1272
|
+
...normalizeParams(_params)
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1276
|
+
function _superRefine(fn) {
|
|
1277
|
+
const ch = /* @__PURE__ */ _check((payload) => {
|
|
1278
|
+
payload.addIssue = (issue$1) => {
|
|
1279
|
+
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
|
|
1280
|
+
else {
|
|
1281
|
+
const _issue = issue$1;
|
|
1282
|
+
if (_issue.fatal) _issue.continue = false;
|
|
1283
|
+
_issue.code ?? (_issue.code = "custom");
|
|
1284
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
1285
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
1286
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
1287
|
+
payload.issues.push(issue(_issue));
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1290
|
+
return fn(payload.value, payload);
|
|
1291
|
+
});
|
|
1292
|
+
return ch;
|
|
1293
|
+
}
|
|
1294
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1295
|
+
function _check(fn, params) {
|
|
1296
|
+
const ch = new $ZodCheck({
|
|
1297
|
+
check: "custom",
|
|
1298
|
+
...normalizeParams(params)
|
|
1299
|
+
});
|
|
1300
|
+
ch._zod.check = fn;
|
|
1301
|
+
return ch;
|
|
1302
|
+
}
|
|
1303
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1304
|
+
function describe$1(description) {
|
|
1305
|
+
const ch = new $ZodCheck({ check: "describe" });
|
|
1306
|
+
ch._zod.onattach = [(inst) => {
|
|
1307
|
+
const existing = globalRegistry.get(inst) ?? {};
|
|
1308
|
+
globalRegistry.add(inst, {
|
|
1309
|
+
...existing,
|
|
1310
|
+
description
|
|
1311
|
+
});
|
|
1312
|
+
}];
|
|
1313
|
+
ch._zod.check = () => {};
|
|
1314
|
+
return ch;
|
|
1315
|
+
}
|
|
1316
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1317
|
+
function meta$1(metadata) {
|
|
1318
|
+
const ch = new $ZodCheck({ check: "meta" });
|
|
1319
|
+
ch._zod.onattach = [(inst) => {
|
|
1320
|
+
const existing = globalRegistry.get(inst) ?? {};
|
|
1321
|
+
globalRegistry.add(inst, {
|
|
1322
|
+
...existing,
|
|
1323
|
+
...metadata
|
|
1324
|
+
});
|
|
1325
|
+
}];
|
|
1326
|
+
ch._zod.check = () => {};
|
|
1327
|
+
return ch;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
267
1330
|
//#endregion
|
|
268
1331
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
|
|
269
1332
|
function initializeContext(params) {
|
|
@@ -325,8 +1388,8 @@ function process(schema, ctx, _params = {
|
|
|
325
1388
|
ctx.seen.get(parent).isParent = true;
|
|
326
1389
|
}
|
|
327
1390
|
}
|
|
328
|
-
const meta = ctx.metadataRegistry.get(schema);
|
|
329
|
-
if (meta) Object.assign(result.schema, meta);
|
|
1391
|
+
const meta$2 = ctx.metadataRegistry.get(schema);
|
|
1392
|
+
if (meta$2) Object.assign(result.schema, meta$2);
|
|
330
1393
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
331
1394
|
delete result.schema.examples;
|
|
332
1395
|
delete result.schema.default;
|
|
@@ -524,6 +1587,19 @@ function isTransforming(_schema, _ctx) {
|
|
|
524
1587
|
}
|
|
525
1588
|
return false;
|
|
526
1589
|
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Creates a toJSONSchema method for a schema instance.
|
|
1592
|
+
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
1593
|
+
*/
|
|
1594
|
+
const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
1595
|
+
const ctx = initializeContext({
|
|
1596
|
+
...params,
|
|
1597
|
+
processors
|
|
1598
|
+
});
|
|
1599
|
+
process(schema, ctx);
|
|
1600
|
+
extractDefs(ctx, schema);
|
|
1601
|
+
return finalize(ctx, schema);
|
|
1602
|
+
};
|
|
527
1603
|
const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
528
1604
|
const { libraryOptions, target } = params ?? {};
|
|
529
1605
|
const ctx = initializeContext({
|
|
@@ -994,6 +2070,336 @@ function toJSONSchema(input, params) {
|
|
|
994
2070
|
return finalize(ctx, input);
|
|
995
2071
|
}
|
|
996
2072
|
|
|
2073
|
+
//#endregion
|
|
2074
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
2075
|
+
const initializer = (inst, issues) => {
|
|
2076
|
+
$ZodError.init(inst, issues);
|
|
2077
|
+
inst.name = "ZodError";
|
|
2078
|
+
Object.defineProperties(inst, {
|
|
2079
|
+
format: { value: (mapper) => formatError(inst, mapper) },
|
|
2080
|
+
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
2081
|
+
addIssue: { value: (issue$1) => {
|
|
2082
|
+
inst.issues.push(issue$1);
|
|
2083
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
2084
|
+
} },
|
|
2085
|
+
addIssues: { value: (issues$1) => {
|
|
2086
|
+
inst.issues.push(...issues$1);
|
|
2087
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
2088
|
+
} },
|
|
2089
|
+
isEmpty: { get() {
|
|
2090
|
+
return inst.issues.length === 0;
|
|
2091
|
+
} }
|
|
2092
|
+
});
|
|
2093
|
+
};
|
|
2094
|
+
const ZodError = $constructor("ZodError", initializer);
|
|
2095
|
+
const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
|
|
2096
|
+
|
|
2097
|
+
//#endregion
|
|
2098
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js
|
|
2099
|
+
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
2100
|
+
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
2101
|
+
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
2102
|
+
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
2103
|
+
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
2104
|
+
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
2105
|
+
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
2106
|
+
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
2107
|
+
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
2108
|
+
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
2109
|
+
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
2110
|
+
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
2111
|
+
|
|
2112
|
+
//#endregion
|
|
2113
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
|
|
2114
|
+
const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
2115
|
+
$ZodType.init(inst, def);
|
|
2116
|
+
Object.assign(inst["~standard"], { jsonSchema: {
|
|
2117
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
2118
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
2119
|
+
} });
|
|
2120
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
2121
|
+
inst.def = def;
|
|
2122
|
+
inst.type = def.type;
|
|
2123
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
2124
|
+
inst.check = (...checks) => {
|
|
2125
|
+
return inst.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
2126
|
+
check: ch,
|
|
2127
|
+
def: { check: "custom" },
|
|
2128
|
+
onattach: []
|
|
2129
|
+
} } : ch)] }), { parent: true });
|
|
2130
|
+
};
|
|
2131
|
+
inst.with = inst.check;
|
|
2132
|
+
inst.clone = (def$1, params) => clone(inst, def$1, params);
|
|
2133
|
+
inst.brand = () => inst;
|
|
2134
|
+
inst.register = ((reg, meta$2) => {
|
|
2135
|
+
reg.add(inst, meta$2);
|
|
2136
|
+
return inst;
|
|
2137
|
+
});
|
|
2138
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
2139
|
+
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
2140
|
+
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
2141
|
+
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
2142
|
+
inst.spa = inst.safeParseAsync;
|
|
2143
|
+
inst.encode = (data, params) => encode(inst, data, params);
|
|
2144
|
+
inst.decode = (data, params) => decode(inst, data, params);
|
|
2145
|
+
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
2146
|
+
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
2147
|
+
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
2148
|
+
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
2149
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
2150
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
2151
|
+
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
2152
|
+
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
2153
|
+
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
2154
|
+
inst.optional = () => optional(inst);
|
|
2155
|
+
inst.exactOptional = () => exactOptional(inst);
|
|
2156
|
+
inst.nullable = () => nullable(inst);
|
|
2157
|
+
inst.nullish = () => optional(nullable(inst));
|
|
2158
|
+
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
2159
|
+
inst.array = () => array(inst);
|
|
2160
|
+
inst.or = (arg) => union([inst, arg]);
|
|
2161
|
+
inst.and = (arg) => intersection(inst, arg);
|
|
2162
|
+
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
2163
|
+
inst.default = (def$1) => _default(inst, def$1);
|
|
2164
|
+
inst.prefault = (def$1) => prefault(inst, def$1);
|
|
2165
|
+
inst.catch = (params) => _catch(inst, params);
|
|
2166
|
+
inst.pipe = (target) => pipe(inst, target);
|
|
2167
|
+
inst.readonly = () => readonly(inst);
|
|
2168
|
+
inst.describe = (description) => {
|
|
2169
|
+
const cl = inst.clone();
|
|
2170
|
+
globalRegistry.add(cl, { description });
|
|
2171
|
+
return cl;
|
|
2172
|
+
};
|
|
2173
|
+
Object.defineProperty(inst, "description", {
|
|
2174
|
+
get() {
|
|
2175
|
+
return globalRegistry.get(inst)?.description;
|
|
2176
|
+
},
|
|
2177
|
+
configurable: true
|
|
2178
|
+
});
|
|
2179
|
+
inst.meta = (...args) => {
|
|
2180
|
+
if (args.length === 0) return globalRegistry.get(inst);
|
|
2181
|
+
const cl = inst.clone();
|
|
2182
|
+
globalRegistry.add(cl, args[0]);
|
|
2183
|
+
return cl;
|
|
2184
|
+
};
|
|
2185
|
+
inst.isOptional = () => inst.safeParse(void 0).success;
|
|
2186
|
+
inst.isNullable = () => inst.safeParse(null).success;
|
|
2187
|
+
inst.apply = (fn) => fn(inst);
|
|
2188
|
+
return inst;
|
|
2189
|
+
});
|
|
2190
|
+
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
2191
|
+
$ZodUnknown.init(inst, def);
|
|
2192
|
+
ZodType.init(inst, def);
|
|
2193
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
2194
|
+
});
|
|
2195
|
+
function unknown() {
|
|
2196
|
+
return _unknown(ZodUnknown);
|
|
2197
|
+
}
|
|
2198
|
+
const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
2199
|
+
$ZodArray.init(inst, def);
|
|
2200
|
+
ZodType.init(inst, def);
|
|
2201
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
2202
|
+
inst.element = def.element;
|
|
2203
|
+
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
2204
|
+
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
2205
|
+
inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
|
|
2206
|
+
inst.length = (len, params) => inst.check(_length(len, params));
|
|
2207
|
+
inst.unwrap = () => inst.element;
|
|
2208
|
+
});
|
|
2209
|
+
function array(element, params) {
|
|
2210
|
+
return _array(ZodArray, element, params);
|
|
2211
|
+
}
|
|
2212
|
+
const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
2213
|
+
$ZodUnion.init(inst, def);
|
|
2214
|
+
ZodType.init(inst, def);
|
|
2215
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
2216
|
+
inst.options = def.options;
|
|
2217
|
+
});
|
|
2218
|
+
function union(options, params) {
|
|
2219
|
+
return new ZodUnion({
|
|
2220
|
+
type: "union",
|
|
2221
|
+
options,
|
|
2222
|
+
...normalizeParams(params)
|
|
2223
|
+
});
|
|
2224
|
+
}
|
|
2225
|
+
const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
2226
|
+
$ZodIntersection.init(inst, def);
|
|
2227
|
+
ZodType.init(inst, def);
|
|
2228
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
2229
|
+
});
|
|
2230
|
+
function intersection(left, right) {
|
|
2231
|
+
return new ZodIntersection({
|
|
2232
|
+
type: "intersection",
|
|
2233
|
+
left,
|
|
2234
|
+
right
|
|
2235
|
+
});
|
|
2236
|
+
}
|
|
2237
|
+
const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
2238
|
+
$ZodTransform.init(inst, def);
|
|
2239
|
+
ZodType.init(inst, def);
|
|
2240
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
2241
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2242
|
+
if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
2243
|
+
payload.addIssue = (issue$1) => {
|
|
2244
|
+
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
|
|
2245
|
+
else {
|
|
2246
|
+
const _issue = issue$1;
|
|
2247
|
+
if (_issue.fatal) _issue.continue = false;
|
|
2248
|
+
_issue.code ?? (_issue.code = "custom");
|
|
2249
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
2250
|
+
_issue.inst ?? (_issue.inst = inst);
|
|
2251
|
+
payload.issues.push(issue(_issue));
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
const output = def.transform(payload.value, payload);
|
|
2255
|
+
if (output instanceof Promise) return output.then((output$1) => {
|
|
2256
|
+
payload.value = output$1;
|
|
2257
|
+
return payload;
|
|
2258
|
+
});
|
|
2259
|
+
payload.value = output;
|
|
2260
|
+
return payload;
|
|
2261
|
+
};
|
|
2262
|
+
});
|
|
2263
|
+
function transform(fn) {
|
|
2264
|
+
return new ZodTransform({
|
|
2265
|
+
type: "transform",
|
|
2266
|
+
transform: fn
|
|
2267
|
+
});
|
|
2268
|
+
}
|
|
2269
|
+
const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
2270
|
+
$ZodOptional.init(inst, def);
|
|
2271
|
+
ZodType.init(inst, def);
|
|
2272
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
2273
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2274
|
+
});
|
|
2275
|
+
function optional(innerType) {
|
|
2276
|
+
return new ZodOptional({
|
|
2277
|
+
type: "optional",
|
|
2278
|
+
innerType
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
const ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
2282
|
+
$ZodExactOptional.init(inst, def);
|
|
2283
|
+
ZodType.init(inst, def);
|
|
2284
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
2285
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2286
|
+
});
|
|
2287
|
+
function exactOptional(innerType) {
|
|
2288
|
+
return new ZodExactOptional({
|
|
2289
|
+
type: "optional",
|
|
2290
|
+
innerType
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
2294
|
+
$ZodNullable.init(inst, def);
|
|
2295
|
+
ZodType.init(inst, def);
|
|
2296
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
2297
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2298
|
+
});
|
|
2299
|
+
function nullable(innerType) {
|
|
2300
|
+
return new ZodNullable({
|
|
2301
|
+
type: "nullable",
|
|
2302
|
+
innerType
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
2306
|
+
$ZodDefault.init(inst, def);
|
|
2307
|
+
ZodType.init(inst, def);
|
|
2308
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
2309
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2310
|
+
inst.removeDefault = inst.unwrap;
|
|
2311
|
+
});
|
|
2312
|
+
function _default(innerType, defaultValue) {
|
|
2313
|
+
return new ZodDefault({
|
|
2314
|
+
type: "default",
|
|
2315
|
+
innerType,
|
|
2316
|
+
get defaultValue() {
|
|
2317
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
2318
|
+
}
|
|
2319
|
+
});
|
|
2320
|
+
}
|
|
2321
|
+
const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
2322
|
+
$ZodPrefault.init(inst, def);
|
|
2323
|
+
ZodType.init(inst, def);
|
|
2324
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
2325
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2326
|
+
});
|
|
2327
|
+
function prefault(innerType, defaultValue) {
|
|
2328
|
+
return new ZodPrefault({
|
|
2329
|
+
type: "prefault",
|
|
2330
|
+
innerType,
|
|
2331
|
+
get defaultValue() {
|
|
2332
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
2333
|
+
}
|
|
2334
|
+
});
|
|
2335
|
+
}
|
|
2336
|
+
const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
2337
|
+
$ZodNonOptional.init(inst, def);
|
|
2338
|
+
ZodType.init(inst, def);
|
|
2339
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
2340
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2341
|
+
});
|
|
2342
|
+
function nonoptional(innerType, params) {
|
|
2343
|
+
return new ZodNonOptional({
|
|
2344
|
+
type: "nonoptional",
|
|
2345
|
+
innerType,
|
|
2346
|
+
...normalizeParams(params)
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
2350
|
+
$ZodCatch.init(inst, def);
|
|
2351
|
+
ZodType.init(inst, def);
|
|
2352
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
2353
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2354
|
+
inst.removeCatch = inst.unwrap;
|
|
2355
|
+
});
|
|
2356
|
+
function _catch(innerType, catchValue) {
|
|
2357
|
+
return new ZodCatch({
|
|
2358
|
+
type: "catch",
|
|
2359
|
+
innerType,
|
|
2360
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
2364
|
+
$ZodPipe.init(inst, def);
|
|
2365
|
+
ZodType.init(inst, def);
|
|
2366
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
2367
|
+
inst.in = def.in;
|
|
2368
|
+
inst.out = def.out;
|
|
2369
|
+
});
|
|
2370
|
+
function pipe(in_, out) {
|
|
2371
|
+
return new ZodPipe({
|
|
2372
|
+
type: "pipe",
|
|
2373
|
+
in: in_,
|
|
2374
|
+
out
|
|
2375
|
+
});
|
|
2376
|
+
}
|
|
2377
|
+
const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
2378
|
+
$ZodReadonly.init(inst, def);
|
|
2379
|
+
ZodType.init(inst, def);
|
|
2380
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
2381
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2382
|
+
});
|
|
2383
|
+
function readonly(innerType) {
|
|
2384
|
+
return new ZodReadonly({
|
|
2385
|
+
type: "readonly",
|
|
2386
|
+
innerType
|
|
2387
|
+
});
|
|
2388
|
+
}
|
|
2389
|
+
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
2390
|
+
$ZodCustom.init(inst, def);
|
|
2391
|
+
ZodType.init(inst, def);
|
|
2392
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
2393
|
+
});
|
|
2394
|
+
function refine(fn, _params = {}) {
|
|
2395
|
+
return _refine(ZodCustom, fn, _params);
|
|
2396
|
+
}
|
|
2397
|
+
function superRefine(fn) {
|
|
2398
|
+
return _superRefine(fn);
|
|
2399
|
+
}
|
|
2400
|
+
const describe = describe$1;
|
|
2401
|
+
const meta = meta$1;
|
|
2402
|
+
|
|
997
2403
|
//#endregion
|
|
998
2404
|
//#region src/nodes/ConnectionCredentialExecutionContextFactory.ts
|
|
999
2405
|
/**
|
|
@@ -1069,9 +2475,9 @@ let AIAgentExecutionHelpersFactory = class AIAgentExecutionHelpersFactory$1 {
|
|
|
1069
2475
|
/**
|
|
1070
2476
|
* `@cfworker/json-schema` iterates `schema.required` with `for...of`; it must be a string array or absent.
|
|
1071
2477
|
*/
|
|
1072
|
-
sanitizeJsonSchemaRequiredKeywordsForCfworker(node$
|
|
1073
|
-
if (!node$
|
|
1074
|
-
const o = node$
|
|
2478
|
+
sanitizeJsonSchemaRequiredKeywordsForCfworker(node$15) {
|
|
2479
|
+
if (!node$15 || typeof node$15 !== "object" || Array.isArray(node$15)) return;
|
|
2480
|
+
const o = node$15;
|
|
1075
2481
|
const req = o.required;
|
|
1076
2482
|
if (req !== void 0 && !Array.isArray(req)) delete o.required;
|
|
1077
2483
|
else if (Array.isArray(req)) {
|
|
@@ -1119,28 +2525,28 @@ let NodeBackedToolRuntime = class NodeBackedToolRuntime$1 {
|
|
|
1119
2525
|
constructor(nodeResolver) {
|
|
1120
2526
|
this.nodeResolver = nodeResolver;
|
|
1121
2527
|
}
|
|
1122
|
-
async execute(config, args) {
|
|
1123
|
-
const nodeInput = config.toNodeItem({
|
|
2528
|
+
async execute(config$1, args) {
|
|
2529
|
+
const nodeInput = config$1.toNodeItem({
|
|
1124
2530
|
input: args.input,
|
|
1125
2531
|
item: args.item,
|
|
1126
2532
|
itemIndex: args.itemIndex,
|
|
1127
2533
|
items: args.items,
|
|
1128
2534
|
ctx: args.ctx,
|
|
1129
|
-
node: config.node
|
|
2535
|
+
node: config$1.node
|
|
1130
2536
|
});
|
|
1131
2537
|
const nodeCtx = {
|
|
1132
2538
|
...args.ctx,
|
|
1133
|
-
config: config.node
|
|
2539
|
+
config: config$1.node
|
|
1134
2540
|
};
|
|
1135
|
-
const resolvedNode = this.nodeResolver.resolve(config.node.type);
|
|
2541
|
+
const resolvedNode = this.nodeResolver.resolve(config$1.node.type);
|
|
1136
2542
|
const outputs = await this.executeResolvedNode(resolvedNode, nodeInput, nodeCtx);
|
|
1137
|
-
return config.toToolOutput({
|
|
2543
|
+
return config$1.toToolOutput({
|
|
1138
2544
|
input: args.input,
|
|
1139
2545
|
item: args.item,
|
|
1140
2546
|
itemIndex: args.itemIndex,
|
|
1141
2547
|
items: args.items,
|
|
1142
2548
|
ctx: args.ctx,
|
|
1143
|
-
node: config.node,
|
|
2549
|
+
node: config$1.node,
|
|
1144
2550
|
outputs
|
|
1145
2551
|
});
|
|
1146
2552
|
}
|
|
@@ -1176,21 +2582,43 @@ var _ref, _ref2;
|
|
|
1176
2582
|
let AIAgentNode = class AIAgentNode$1 {
|
|
1177
2583
|
kind = "node";
|
|
1178
2584
|
outputPorts = ["main"];
|
|
2585
|
+
/**
|
|
2586
|
+
* Engine applies {@link RunnableNodeConfig.mapInput} + parse before {@link #executeOne}. Prefer modeling
|
|
2587
|
+
* prompts as {@code { messages: [{ role, content }, ...] }} so persisted inputs are visible in the UI.
|
|
2588
|
+
*/
|
|
2589
|
+
inputSchema = unknown();
|
|
1179
2590
|
connectionCredentialExecutionContextFactory;
|
|
2591
|
+
/** One resolved model/tools bundle per activation context (same ctx across items in a batch). */
|
|
2592
|
+
preparedByExecutionContext = /* @__PURE__ */ new WeakMap();
|
|
1180
2593
|
constructor(nodeResolver, credentialSessions, nodeBackedToolRuntime, executionHelpers) {
|
|
1181
2594
|
this.nodeResolver = nodeResolver;
|
|
1182
2595
|
this.nodeBackedToolRuntime = nodeBackedToolRuntime;
|
|
1183
2596
|
this.executionHelpers = executionHelpers;
|
|
1184
2597
|
this.connectionCredentialExecutionContextFactory = this.executionHelpers.createConnectionCredentialExecutionContextFactory(credentialSessions);
|
|
1185
2598
|
}
|
|
1186
|
-
async
|
|
1187
|
-
const prepared = await this.
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1190
|
-
|
|
2599
|
+
async executeOne(args) {
|
|
2600
|
+
const prepared = await this.getOrPrepareExecution(args.ctx);
|
|
2601
|
+
const itemWithMappedJson = {
|
|
2602
|
+
...args.item,
|
|
2603
|
+
json: args.input
|
|
2604
|
+
};
|
|
2605
|
+
return (await this.runAgentForItem(prepared, itemWithMappedJson, args.itemIndex, args.items)).json;
|
|
2606
|
+
}
|
|
2607
|
+
async getOrPrepareExecution(ctx) {
|
|
2608
|
+
let pending = this.preparedByExecutionContext.get(ctx);
|
|
2609
|
+
if (!pending) {
|
|
2610
|
+
pending = this.prepareExecution(ctx);
|
|
2611
|
+
this.preparedByExecutionContext.set(ctx, pending);
|
|
2612
|
+
}
|
|
2613
|
+
try {
|
|
2614
|
+
return await pending;
|
|
2615
|
+
} catch (error) {
|
|
2616
|
+
this.preparedByExecutionContext.delete(ctx);
|
|
2617
|
+
throw error;
|
|
2618
|
+
}
|
|
1191
2619
|
}
|
|
1192
2620
|
/**
|
|
1193
|
-
* Resolves the chat model and tools once, then
|
|
2621
|
+
* Resolves the chat model and tools once per activation, then reuses for every item in the batch.
|
|
1194
2622
|
*/
|
|
1195
2623
|
async prepareExecution(ctx) {
|
|
1196
2624
|
const chatModelFactory = this.nodeResolver.resolve(ctx.config.chatModel.type);
|
|
@@ -1269,9 +2697,9 @@ let AIAgentNode = class AIAgentNode$1 {
|
|
|
1269
2697
|
return model.bindTools(itemScopedTools.map((entry) => entry.langChainTool));
|
|
1270
2698
|
}
|
|
1271
2699
|
resolveTools(toolConfigs) {
|
|
1272
|
-
const resolvedTools = toolConfigs.map((config) => ({
|
|
1273
|
-
config,
|
|
1274
|
-
runtime: this.resolveToolRuntime(config)
|
|
2700
|
+
const resolvedTools = toolConfigs.map((config$1) => ({
|
|
2701
|
+
config: config$1,
|
|
2702
|
+
runtime: this.resolveToolRuntime(config$1)
|
|
1275
2703
|
}));
|
|
1276
2704
|
const names = /* @__PURE__ */ new Set();
|
|
1277
2705
|
for (const entry of resolvedTools) {
|
|
@@ -1440,25 +2868,25 @@ let AIAgentNode = class AIAgentNode$1 {
|
|
|
1440
2868
|
return JSON.parse(json);
|
|
1441
2869
|
}
|
|
1442
2870
|
createPromptMessages(item, itemIndex, items, ctx) {
|
|
1443
|
-
return AgentMessageFactory.createPromptMessages(__codemation_core.AgentMessageConfigNormalizer.
|
|
2871
|
+
return AgentMessageFactory.createPromptMessages(__codemation_core.AgentMessageConfigNormalizer.resolveFromInputOrConfig(item.json, ctx.config, {
|
|
1444
2872
|
item,
|
|
1445
2873
|
itemIndex,
|
|
1446
2874
|
items,
|
|
1447
2875
|
ctx
|
|
1448
2876
|
}));
|
|
1449
2877
|
}
|
|
1450
|
-
resolveToolRuntime(config) {
|
|
1451
|
-
if (this.isNodeBackedToolConfig(config)) {
|
|
1452
|
-
const inputSchema = config.getInputSchema();
|
|
1453
|
-
if (inputSchema == null) throw new Error(`AIAgent tool "${config.name}": node-backed tool is missing inputSchema (cannot build LangChain tool).`);
|
|
2878
|
+
resolveToolRuntime(config$1) {
|
|
2879
|
+
if (this.isNodeBackedToolConfig(config$1)) {
|
|
2880
|
+
const inputSchema = config$1.getInputSchema();
|
|
2881
|
+
if (inputSchema == null) throw new Error(`AIAgent tool "${config$1.name}": node-backed tool is missing inputSchema (cannot build LangChain tool).`);
|
|
1454
2882
|
return {
|
|
1455
|
-
defaultDescription: `Run workflow node "${config.node.name ?? config.name}" as an AI tool.`,
|
|
2883
|
+
defaultDescription: `Run workflow node "${config$1.node.name ?? config$1.name}" as an AI tool.`,
|
|
1456
2884
|
inputSchema,
|
|
1457
|
-
execute: async (args) => await this.nodeBackedToolRuntime.execute(config, args)
|
|
2885
|
+
execute: async (args) => await this.nodeBackedToolRuntime.execute(config$1, args)
|
|
1458
2886
|
};
|
|
1459
2887
|
}
|
|
1460
|
-
const tool = this.nodeResolver.resolve(config.type);
|
|
1461
|
-
if (tool.inputSchema == null) throw new Error(`AIAgent tool "${config.name}": plugin tool "${String(config.type)}" is missing inputSchema.`);
|
|
2888
|
+
const tool = this.nodeResolver.resolve(config$1.type);
|
|
2889
|
+
if (tool.inputSchema == null) throw new Error(`AIAgent tool "${config$1.name}": plugin tool "${String(config$1.type)}" is missing inputSchema.`);
|
|
1462
2890
|
return {
|
|
1463
2891
|
defaultDescription: tool.defaultDescription,
|
|
1464
2892
|
inputSchema: tool.inputSchema,
|
|
@@ -1470,8 +2898,8 @@ let AIAgentNode = class AIAgentNode$1 {
|
|
|
1470
2898
|
* sending node-backed tools down the plugin-tool branch with `inputSchema: undefined` (LangChain then crashes in
|
|
1471
2899
|
* json-schema validation). {@link NodeBackedToolConfig#toolKind} is stable across copies.
|
|
1472
2900
|
*/
|
|
1473
|
-
isNodeBackedToolConfig(config) {
|
|
1474
|
-
return config instanceof __codemation_core.NodeBackedToolConfig || typeof config === "object" && config !== null && config.toolKind === "nodeBacked";
|
|
2901
|
+
isNodeBackedToolConfig(config$1) {
|
|
2902
|
+
return config$1 instanceof __codemation_core.NodeBackedToolConfig || typeof config$1 === "object" && config$1 !== null && config$1.toolKind === "nodeBacked";
|
|
1475
2903
|
}
|
|
1476
2904
|
resolveGuardrails(guardrails) {
|
|
1477
2905
|
const maxTurns = guardrails?.maxTurns ?? __codemation_core.AgentGuardrailDefaults.maxTurns;
|
|
@@ -1515,6 +2943,8 @@ var AIAgent = class {
|
|
|
1515
2943
|
id;
|
|
1516
2944
|
retryPolicy;
|
|
1517
2945
|
guardrails;
|
|
2946
|
+
inputSchema;
|
|
2947
|
+
mapInput;
|
|
1518
2948
|
constructor(options) {
|
|
1519
2949
|
this.name = options.name;
|
|
1520
2950
|
this.messages = options.messages;
|
|
@@ -1523,6 +2953,8 @@ var AIAgent = class {
|
|
|
1523
2953
|
this.id = options.id;
|
|
1524
2954
|
this.retryPolicy = options.retryPolicy ?? __codemation_core.RetryPolicy.defaultForAiAgent;
|
|
1525
2955
|
this.guardrails = options.guardrails;
|
|
2956
|
+
this.inputSchema = options.inputSchema;
|
|
2957
|
+
this.mapInput = options.mapInput;
|
|
1526
2958
|
}
|
|
1527
2959
|
};
|
|
1528
2960
|
|
|
@@ -1673,6 +3105,62 @@ var HttpRequest = class {
|
|
|
1673
3105
|
}
|
|
1674
3106
|
};
|
|
1675
3107
|
|
|
3108
|
+
//#endregion
|
|
3109
|
+
//#region src/nodes/AggregateNode.ts
|
|
3110
|
+
let AggregateNode = class AggregateNode$1 {
|
|
3111
|
+
kind = "node";
|
|
3112
|
+
outputPorts = ["main"];
|
|
3113
|
+
async execute(items, ctx) {
|
|
3114
|
+
if (items.length === 0) return { main: [] };
|
|
3115
|
+
return { main: [{ json: await Promise.resolve(ctx.config.aggregate(items, ctx)) }] };
|
|
3116
|
+
}
|
|
3117
|
+
};
|
|
3118
|
+
AggregateNode = __decorate([(0, __codemation_core.node)({ packageName: "@codemation/core-nodes" })], AggregateNode);
|
|
3119
|
+
|
|
3120
|
+
//#endregion
|
|
3121
|
+
//#region src/nodes/aggregate.ts
|
|
3122
|
+
var Aggregate = class {
|
|
3123
|
+
kind = "node";
|
|
3124
|
+
type = AggregateNode;
|
|
3125
|
+
execution = { hint: "local" };
|
|
3126
|
+
icon = "lucide:layers";
|
|
3127
|
+
constructor(name, aggregate, id) {
|
|
3128
|
+
this.name = name;
|
|
3129
|
+
this.aggregate = aggregate;
|
|
3130
|
+
this.id = id;
|
|
3131
|
+
}
|
|
3132
|
+
};
|
|
3133
|
+
|
|
3134
|
+
//#endregion
|
|
3135
|
+
//#region src/nodes/FilterNode.ts
|
|
3136
|
+
let FilterNode = class FilterNode$1 {
|
|
3137
|
+
kind = "node";
|
|
3138
|
+
outputPorts = ["main"];
|
|
3139
|
+
async execute(items, ctx) {
|
|
3140
|
+
const out = [];
|
|
3141
|
+
for (let i = 0; i < items.length; i++) {
|
|
3142
|
+
const item = items[i];
|
|
3143
|
+
if (ctx.config.predicate(item, i, items, ctx)) out.push(item);
|
|
3144
|
+
}
|
|
3145
|
+
return { main: out };
|
|
3146
|
+
}
|
|
3147
|
+
};
|
|
3148
|
+
FilterNode = __decorate([(0, __codemation_core.node)({ packageName: "@codemation/core-nodes" })], FilterNode);
|
|
3149
|
+
|
|
3150
|
+
//#endregion
|
|
3151
|
+
//#region src/nodes/filter.ts
|
|
3152
|
+
var Filter = class {
|
|
3153
|
+
kind = "node";
|
|
3154
|
+
type = FilterNode;
|
|
3155
|
+
execution = { hint: "local" };
|
|
3156
|
+
icon = "lucide:filter";
|
|
3157
|
+
constructor(name, predicate, id) {
|
|
3158
|
+
this.name = name;
|
|
3159
|
+
this.predicate = predicate;
|
|
3160
|
+
this.id = id;
|
|
3161
|
+
}
|
|
3162
|
+
};
|
|
3163
|
+
|
|
1676
3164
|
//#endregion
|
|
1677
3165
|
//#region src/nodes/IfNode.ts
|
|
1678
3166
|
let IfNode = class IfNode$1 {
|
|
@@ -1725,6 +3213,45 @@ var If = class {
|
|
|
1725
3213
|
}
|
|
1726
3214
|
};
|
|
1727
3215
|
|
|
3216
|
+
//#endregion
|
|
3217
|
+
//#region src/nodes/SplitNode.ts
|
|
3218
|
+
let SplitNode = class SplitNode$1 {
|
|
3219
|
+
kind = "node";
|
|
3220
|
+
outputPorts = ["main"];
|
|
3221
|
+
async execute(items, ctx) {
|
|
3222
|
+
const out = [];
|
|
3223
|
+
for (let i = 0; i < items.length; i++) {
|
|
3224
|
+
const item = items[i];
|
|
3225
|
+
const elements = ctx.config.getElements(item, ctx);
|
|
3226
|
+
for (let j = 0; j < elements.length; j++) out.push({
|
|
3227
|
+
...item,
|
|
3228
|
+
json: elements[j]
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3231
|
+
return { main: out };
|
|
3232
|
+
}
|
|
3233
|
+
};
|
|
3234
|
+
SplitNode = __decorate([(0, __codemation_core.node)({ packageName: "@codemation/core-nodes" })], SplitNode);
|
|
3235
|
+
|
|
3236
|
+
//#endregion
|
|
3237
|
+
//#region src/nodes/split.ts
|
|
3238
|
+
var Split = class {
|
|
3239
|
+
kind = "node";
|
|
3240
|
+
type = SplitNode;
|
|
3241
|
+
execution = { hint: "local" };
|
|
3242
|
+
/**
|
|
3243
|
+
* When splitting yields zero items for a batch, downstream single-input nodes still run once with an empty batch.
|
|
3244
|
+
* Mirrors {@link MapData}'s empty-output behavior.
|
|
3245
|
+
*/
|
|
3246
|
+
continueWhenEmptyOutput = true;
|
|
3247
|
+
icon = "lucide:ungroup";
|
|
3248
|
+
constructor(name, getElements, id) {
|
|
3249
|
+
this.name = name;
|
|
3250
|
+
this.getElements = getElements;
|
|
3251
|
+
this.id = id;
|
|
3252
|
+
}
|
|
3253
|
+
};
|
|
3254
|
+
|
|
1728
3255
|
//#endregion
|
|
1729
3256
|
//#region src/nodes/ManualTriggerNode.ts
|
|
1730
3257
|
let ManualTriggerNode = class ManualTriggerNode$1 {
|
|
@@ -1737,8 +3264,8 @@ let ManualTriggerNode = class ManualTriggerNode$1 {
|
|
|
1737
3264
|
async execute(items, ctx) {
|
|
1738
3265
|
return { main: this.resolveManualItems(items, ctx.config) };
|
|
1739
3266
|
}
|
|
1740
|
-
resolveManualItems(items, config) {
|
|
1741
|
-
return items.length > 0 ? items : config.defaultItems ?? [];
|
|
3267
|
+
resolveManualItems(items, config$1) {
|
|
3268
|
+
return items.length > 0 ? items : config$1.defaultItems ?? [];
|
|
1742
3269
|
}
|
|
1743
3270
|
};
|
|
1744
3271
|
ManualTriggerNode = __decorate([(0, __codemation_core.node)({ packageName: "@codemation/core-nodes" })], ManualTriggerNode);
|
|
@@ -1773,16 +3300,9 @@ var ManualTrigger = class ManualTrigger {
|
|
|
1773
3300
|
let MapDataNode = class MapDataNode$1 {
|
|
1774
3301
|
kind = "node";
|
|
1775
3302
|
outputPorts = ["main"];
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
const item = items[i];
|
|
1780
|
-
out.push({
|
|
1781
|
-
...item,
|
|
1782
|
-
json: ctx.config.map(item, ctx)
|
|
1783
|
-
});
|
|
1784
|
-
}
|
|
1785
|
-
return { main: out };
|
|
3303
|
+
inputSchema = unknown();
|
|
3304
|
+
async executeOne(args) {
|
|
3305
|
+
return args.ctx.config.map(args.item, args.ctx);
|
|
1786
3306
|
}
|
|
1787
3307
|
};
|
|
1788
3308
|
MapDataNode = __decorate([(0, __codemation_core.node)({ packageName: "@codemation/core-nodes" })], MapDataNode);
|
|
@@ -1834,16 +3354,16 @@ let MergeNode = class MergeNode$1 {
|
|
|
1834
3354
|
for (let i = 0; i < maxLen; i++) {
|
|
1835
3355
|
const json = {};
|
|
1836
3356
|
const paired = [];
|
|
1837
|
-
let meta;
|
|
3357
|
+
let meta$2;
|
|
1838
3358
|
for (const k of order) {
|
|
1839
3359
|
const item = (inputsByPort[k] ?? [])[i];
|
|
1840
3360
|
json[k] = item?.json;
|
|
1841
3361
|
if (item?.paired) paired.push(...item.paired);
|
|
1842
|
-
if (!meta && item?.meta) meta = { ...item.meta };
|
|
3362
|
+
if (!meta$2 && item?.meta) meta$2 = { ...item.meta };
|
|
1843
3363
|
}
|
|
1844
3364
|
const merged = { json };
|
|
1845
3365
|
if (paired.length > 0) merged.paired = paired;
|
|
1846
|
-
if (meta) merged.meta = meta;
|
|
3366
|
+
if (meta$2) merged.meta = meta$2;
|
|
1847
3367
|
out$1.push(merged);
|
|
1848
3368
|
}
|
|
1849
3369
|
return { main: out$1 };
|
|
@@ -2099,8 +3619,8 @@ function registerCoreNodes(container) {}
|
|
|
2099
3619
|
|
|
2100
3620
|
//#endregion
|
|
2101
3621
|
//#region src/workflowBuilder.types.ts
|
|
2102
|
-
function createWorkflowBuilder(meta) {
|
|
2103
|
-
return new __codemation_core.WorkflowBuilder(meta, { makeMergeNode: (name) => new Merge(name, {
|
|
3622
|
+
function createWorkflowBuilder(meta$2) {
|
|
3623
|
+
return new __codemation_core.WorkflowBuilder(meta$2, { makeMergeNode: (name) => new Merge(name, {
|
|
2104
3624
|
mode: "passThrough",
|
|
2105
3625
|
prefer: ["true", "false"]
|
|
2106
3626
|
}) });
|
|
@@ -2172,8 +3692,8 @@ var WorkflowBranchBuilder = class WorkflowBranchBuilder {
|
|
|
2172
3692
|
constructor(steps = []) {
|
|
2173
3693
|
this.steps = steps;
|
|
2174
3694
|
}
|
|
2175
|
-
then(config) {
|
|
2176
|
-
return new WorkflowBranchBuilder([...this.steps, config]);
|
|
3695
|
+
then(config$1) {
|
|
3696
|
+
return new WorkflowBranchBuilder([...this.steps, config$1]);
|
|
2177
3697
|
}
|
|
2178
3698
|
map(nameOrMapper, mapperOrUndefined, id) {
|
|
2179
3699
|
const name = typeof nameOrMapper === "string" ? nameOrMapper : "Map data";
|
|
@@ -2188,9 +3708,9 @@ var WorkflowBranchBuilder = class WorkflowBranchBuilder {
|
|
|
2188
3708
|
agent(nameOrOptions, optionsOrUndefined) {
|
|
2189
3709
|
return this.then(WorkflowAgentNodeFactory.create(nameOrOptions, optionsOrUndefined));
|
|
2190
3710
|
}
|
|
2191
|
-
node(definitionOrKey, config, name, id) {
|
|
3711
|
+
node(definitionOrKey, config$1, name, id) {
|
|
2192
3712
|
const definition = WorkflowDefinedNodeResolver.resolve(definitionOrKey);
|
|
2193
|
-
return this.then(definition.create(config, name, id));
|
|
3713
|
+
return this.then(definition.create(config$1, name, id));
|
|
2194
3714
|
}
|
|
2195
3715
|
getSteps() {
|
|
2196
3716
|
return this.steps;
|
|
@@ -2203,8 +3723,8 @@ var WorkflowChain = class WorkflowChain {
|
|
|
2203
3723
|
constructor(chain) {
|
|
2204
3724
|
this.chain = chain;
|
|
2205
3725
|
}
|
|
2206
|
-
then(config) {
|
|
2207
|
-
return new WorkflowChain(this.chain.then(config));
|
|
3726
|
+
then(config$1) {
|
|
3727
|
+
return new WorkflowChain(this.chain.then(config$1));
|
|
2208
3728
|
}
|
|
2209
3729
|
map(nameOrMapper, mapperOrUndefined, id) {
|
|
2210
3730
|
const name = typeof nameOrMapper === "string" ? nameOrMapper : "Map data";
|
|
@@ -2231,9 +3751,9 @@ var WorkflowChain = class WorkflowChain {
|
|
|
2231
3751
|
agent(nameOrOptions, optionsOrUndefined) {
|
|
2232
3752
|
return this.then(WorkflowAgentNodeFactory.create(nameOrOptions, optionsOrUndefined));
|
|
2233
3753
|
}
|
|
2234
|
-
node(definitionOrKey, config, name, id) {
|
|
3754
|
+
node(definitionOrKey, config$1, name, id) {
|
|
2235
3755
|
const definition = WorkflowDefinedNodeResolver.resolve(definitionOrKey);
|
|
2236
|
-
return this.then(definition.create(config, name, id));
|
|
3756
|
+
return this.then(definition.create(config$1, name, id));
|
|
2237
3757
|
}
|
|
2238
3758
|
build() {
|
|
2239
3759
|
return this.chain.build();
|
|
@@ -2280,9 +3800,9 @@ var AIAgentConnectionWorkflowExpander = class {
|
|
|
2280
3800
|
const connectionsByParentAndName = this.createConnectionsByParentAndName(workflow$1);
|
|
2281
3801
|
const extraNodes = [];
|
|
2282
3802
|
let connectionsChanged = false;
|
|
2283
|
-
for (const node$
|
|
2284
|
-
if (node$
|
|
2285
|
-
for (const connectionNode of __codemation_core.AgentConnectionNodeCollector.collect(node$
|
|
3803
|
+
for (const node$15 of workflow$1.nodes) {
|
|
3804
|
+
if (node$15.type !== AIAgentNode || !__codemation_core.AgentConfigInspector.isAgentNodeConfig(node$15.config)) continue;
|
|
3805
|
+
for (const connectionNode of __codemation_core.AgentConnectionNodeCollector.collect(node$15.id, node$15.config)) {
|
|
2286
3806
|
if (!existingChildIds.has(connectionNode.nodeId)) {
|
|
2287
3807
|
this.assertNoIdCollision(workflow$1, extraNodes, existingChildIds, connectionNode.nodeId);
|
|
2288
3808
|
extraNodes.push({
|
|
@@ -2380,6 +3900,13 @@ exports.AgentItemPortMap = AgentItemPortMap;
|
|
|
2380
3900
|
exports.AgentMessageFactory = AgentMessageFactory;
|
|
2381
3901
|
exports.AgentOutputFactory = AgentOutputFactory;
|
|
2382
3902
|
exports.AgentToolCallPortMap = AgentToolCallPortMap;
|
|
3903
|
+
exports.Aggregate = Aggregate;
|
|
3904
|
+
Object.defineProperty(exports, 'AggregateNode', {
|
|
3905
|
+
enumerable: true,
|
|
3906
|
+
get: function () {
|
|
3907
|
+
return AggregateNode;
|
|
3908
|
+
}
|
|
3909
|
+
});
|
|
2383
3910
|
exports.Callback = Callback;
|
|
2384
3911
|
Object.defineProperty(exports, 'CallbackNode', {
|
|
2385
3912
|
enumerable: true,
|
|
@@ -2397,6 +3924,13 @@ Object.defineProperty(exports, 'ConnectionCredentialNode', {
|
|
|
2397
3924
|
});
|
|
2398
3925
|
exports.ConnectionCredentialNodeConfig = ConnectionCredentialNodeConfig;
|
|
2399
3926
|
exports.ConnectionCredentialNodeConfigFactory = ConnectionCredentialNodeConfigFactory;
|
|
3927
|
+
exports.Filter = Filter;
|
|
3928
|
+
Object.defineProperty(exports, 'FilterNode', {
|
|
3929
|
+
enumerable: true,
|
|
3930
|
+
get: function () {
|
|
3931
|
+
return FilterNode;
|
|
3932
|
+
}
|
|
3933
|
+
});
|
|
2400
3934
|
exports.HttpRequest = HttpRequest;
|
|
2401
3935
|
Object.defineProperty(exports, 'HttpRequestNode', {
|
|
2402
3936
|
enumerable: true,
|
|
@@ -2447,6 +3981,13 @@ Object.defineProperty(exports, 'OpenAIChatModelFactory', {
|
|
|
2447
3981
|
}
|
|
2448
3982
|
});
|
|
2449
3983
|
exports.OpenAiChatModelPresets = OpenAiChatModelPresets;
|
|
3984
|
+
exports.Split = Split;
|
|
3985
|
+
Object.defineProperty(exports, 'SplitNode', {
|
|
3986
|
+
enumerable: true,
|
|
3987
|
+
get: function () {
|
|
3988
|
+
return SplitNode;
|
|
3989
|
+
}
|
|
3990
|
+
});
|
|
2450
3991
|
exports.SubWorkflow = SubWorkflow;
|
|
2451
3992
|
Object.defineProperty(exports, 'SubWorkflowNode', {
|
|
2452
3993
|
enumerable: true,
|