@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.js
CHANGED
|
@@ -149,12 +149,77 @@ var AgentToolCallPortMap = class {
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
154
|
+
/** A special constant with type `never` */
|
|
155
|
+
const NEVER = Object.freeze({ status: "aborted" });
|
|
156
|
+
function $constructor(name, initializer$2, params) {
|
|
157
|
+
function init(inst, def) {
|
|
158
|
+
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
159
|
+
value: {
|
|
160
|
+
def,
|
|
161
|
+
constr: _,
|
|
162
|
+
traits: /* @__PURE__ */ new Set()
|
|
163
|
+
},
|
|
164
|
+
enumerable: false
|
|
165
|
+
});
|
|
166
|
+
if (inst._zod.traits.has(name)) return;
|
|
167
|
+
inst._zod.traits.add(name);
|
|
168
|
+
initializer$2(inst, def);
|
|
169
|
+
const proto = _.prototype;
|
|
170
|
+
const keys = Object.keys(proto);
|
|
171
|
+
for (let i = 0; i < keys.length; i++) {
|
|
172
|
+
const k = keys[i];
|
|
173
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const Parent = params?.Parent ?? Object;
|
|
177
|
+
class Definition extends Parent {}
|
|
178
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
179
|
+
function _(def) {
|
|
180
|
+
var _a$1;
|
|
181
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
182
|
+
init(inst, def);
|
|
183
|
+
(_a$1 = inst._zod).deferred ?? (_a$1.deferred = []);
|
|
184
|
+
for (const fn of inst._zod.deferred) fn();
|
|
185
|
+
return inst;
|
|
186
|
+
}
|
|
187
|
+
Object.defineProperty(_, "init", { value: init });
|
|
188
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
189
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
190
|
+
return inst?._zod?.traits?.has(name);
|
|
191
|
+
} });
|
|
192
|
+
Object.defineProperty(_, "name", { value: name });
|
|
193
|
+
return _;
|
|
194
|
+
}
|
|
195
|
+
const $brand = Symbol("zod_brand");
|
|
196
|
+
var $ZodAsyncError = class extends Error {
|
|
197
|
+
constructor() {
|
|
198
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
var $ZodEncodeError = class extends Error {
|
|
202
|
+
constructor(name) {
|
|
203
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
204
|
+
this.name = "ZodEncodeError";
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const globalConfig = {};
|
|
208
|
+
function config(newConfig) {
|
|
209
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
210
|
+
return globalConfig;
|
|
211
|
+
}
|
|
212
|
+
|
|
152
213
|
//#endregion
|
|
153
214
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js
|
|
154
215
|
function getEnumValues(entries) {
|
|
155
216
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
156
217
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
157
218
|
}
|
|
219
|
+
function jsonStringifyReplacer(_, value) {
|
|
220
|
+
if (typeof value === "bigint") return value.toString();
|
|
221
|
+
return value;
|
|
222
|
+
}
|
|
158
223
|
function cached(getter) {
|
|
159
224
|
return { get value() {
|
|
160
225
|
{
|
|
@@ -165,8 +230,44 @@ function cached(getter) {
|
|
|
165
230
|
throw new Error("cached value already set");
|
|
166
231
|
} };
|
|
167
232
|
}
|
|
233
|
+
function nullish(input) {
|
|
234
|
+
return input === null || input === void 0;
|
|
235
|
+
}
|
|
236
|
+
function cleanRegex(source) {
|
|
237
|
+
const start = source.startsWith("^") ? 1 : 0;
|
|
238
|
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
239
|
+
return source.slice(start, end);
|
|
240
|
+
}
|
|
168
241
|
const EVALUATING = Symbol("evaluating");
|
|
242
|
+
function defineLazy(object, key, getter) {
|
|
243
|
+
let value = void 0;
|
|
244
|
+
Object.defineProperty(object, key, {
|
|
245
|
+
get() {
|
|
246
|
+
if (value === EVALUATING) return;
|
|
247
|
+
if (value === void 0) {
|
|
248
|
+
value = EVALUATING;
|
|
249
|
+
value = getter();
|
|
250
|
+
}
|
|
251
|
+
return value;
|
|
252
|
+
},
|
|
253
|
+
set(v) {
|
|
254
|
+
Object.defineProperty(object, key, { value: v });
|
|
255
|
+
},
|
|
256
|
+
configurable: true
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function mergeDefs(...defs) {
|
|
260
|
+
const mergedDescriptors = {};
|
|
261
|
+
for (const def of defs) {
|
|
262
|
+
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
263
|
+
Object.assign(mergedDescriptors, descriptors);
|
|
264
|
+
}
|
|
265
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
266
|
+
}
|
|
169
267
|
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
268
|
+
function isObject(data) {
|
|
269
|
+
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
270
|
+
}
|
|
170
271
|
const allowsEval = cached(() => {
|
|
171
272
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
|
|
172
273
|
try {
|
|
@@ -176,6 +277,41 @@ const allowsEval = cached(() => {
|
|
|
176
277
|
return false;
|
|
177
278
|
}
|
|
178
279
|
});
|
|
280
|
+
function isPlainObject(o) {
|
|
281
|
+
if (isObject(o) === false) return false;
|
|
282
|
+
const ctor = o.constructor;
|
|
283
|
+
if (ctor === void 0) return true;
|
|
284
|
+
if (typeof ctor !== "function") return true;
|
|
285
|
+
const prot = ctor.prototype;
|
|
286
|
+
if (isObject(prot) === false) return false;
|
|
287
|
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
function shallowClone(o) {
|
|
291
|
+
if (isPlainObject(o)) return { ...o };
|
|
292
|
+
if (Array.isArray(o)) return [...o];
|
|
293
|
+
return o;
|
|
294
|
+
}
|
|
295
|
+
function clone(inst, def, params) {
|
|
296
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
297
|
+
if (!def || params?.parent) cl._zod.parent = inst;
|
|
298
|
+
return cl;
|
|
299
|
+
}
|
|
300
|
+
function normalizeParams(_params) {
|
|
301
|
+
const params = _params;
|
|
302
|
+
if (!params) return {};
|
|
303
|
+
if (typeof params === "string") return { error: () => params };
|
|
304
|
+
if (params?.message !== void 0) {
|
|
305
|
+
if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
|
|
306
|
+
params.error = params.message;
|
|
307
|
+
}
|
|
308
|
+
delete params.message;
|
|
309
|
+
if (typeof params.error === "string") return {
|
|
310
|
+
...params,
|
|
311
|
+
error: () => params.error
|
|
312
|
+
};
|
|
313
|
+
return params;
|
|
314
|
+
}
|
|
179
315
|
const NUMBER_FORMAT_RANGES = {
|
|
180
316
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
181
317
|
int32: [-2147483648, 2147483647],
|
|
@@ -183,6 +319,824 @@ const NUMBER_FORMAT_RANGES = {
|
|
|
183
319
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
184
320
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
185
321
|
};
|
|
322
|
+
function aborted(x, startIndex = 0) {
|
|
323
|
+
if (x.aborted === true) return true;
|
|
324
|
+
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
function prefixIssues(path, issues) {
|
|
328
|
+
return issues.map((iss) => {
|
|
329
|
+
var _a$1;
|
|
330
|
+
(_a$1 = iss).path ?? (_a$1.path = []);
|
|
331
|
+
iss.path.unshift(path);
|
|
332
|
+
return iss;
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
function unwrapMessage(message) {
|
|
336
|
+
return typeof message === "string" ? message : message?.message;
|
|
337
|
+
}
|
|
338
|
+
function finalizeIssue(iss, ctx, config$1) {
|
|
339
|
+
const full = {
|
|
340
|
+
...iss,
|
|
341
|
+
path: iss.path ?? []
|
|
342
|
+
};
|
|
343
|
+
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";
|
|
344
|
+
delete full.inst;
|
|
345
|
+
delete full.continue;
|
|
346
|
+
if (!ctx?.reportInput) delete full.input;
|
|
347
|
+
return full;
|
|
348
|
+
}
|
|
349
|
+
function getLengthableOrigin(input) {
|
|
350
|
+
if (Array.isArray(input)) return "array";
|
|
351
|
+
if (typeof input === "string") return "string";
|
|
352
|
+
return "unknown";
|
|
353
|
+
}
|
|
354
|
+
function issue(...args) {
|
|
355
|
+
const [iss, input, inst] = args;
|
|
356
|
+
if (typeof iss === "string") return {
|
|
357
|
+
message: iss,
|
|
358
|
+
code: "custom",
|
|
359
|
+
input,
|
|
360
|
+
inst
|
|
361
|
+
};
|
|
362
|
+
return { ...iss };
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
|
|
367
|
+
const initializer$1 = (inst, def) => {
|
|
368
|
+
inst.name = "$ZodError";
|
|
369
|
+
Object.defineProperty(inst, "_zod", {
|
|
370
|
+
value: inst._zod,
|
|
371
|
+
enumerable: false
|
|
372
|
+
});
|
|
373
|
+
Object.defineProperty(inst, "issues", {
|
|
374
|
+
value: def,
|
|
375
|
+
enumerable: false
|
|
376
|
+
});
|
|
377
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
378
|
+
Object.defineProperty(inst, "toString", {
|
|
379
|
+
value: () => inst.message,
|
|
380
|
+
enumerable: false
|
|
381
|
+
});
|
|
382
|
+
};
|
|
383
|
+
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
384
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
385
|
+
function flattenError(error, mapper = (issue$1) => issue$1.message) {
|
|
386
|
+
const fieldErrors = {};
|
|
387
|
+
const formErrors = [];
|
|
388
|
+
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
389
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
390
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
391
|
+
} else formErrors.push(mapper(sub));
|
|
392
|
+
return {
|
|
393
|
+
formErrors,
|
|
394
|
+
fieldErrors
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
function formatError(error, mapper = (issue$1) => issue$1.message) {
|
|
398
|
+
const fieldErrors = { _errors: [] };
|
|
399
|
+
const processError = (error$1) => {
|
|
400
|
+
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 }));
|
|
401
|
+
else if (issue$1.code === "invalid_key") processError({ issues: issue$1.issues });
|
|
402
|
+
else if (issue$1.code === "invalid_element") processError({ issues: issue$1.issues });
|
|
403
|
+
else if (issue$1.path.length === 0) fieldErrors._errors.push(mapper(issue$1));
|
|
404
|
+
else {
|
|
405
|
+
let curr = fieldErrors;
|
|
406
|
+
let i = 0;
|
|
407
|
+
while (i < issue$1.path.length) {
|
|
408
|
+
const el = issue$1.path[i];
|
|
409
|
+
if (!(i === issue$1.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
410
|
+
else {
|
|
411
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
412
|
+
curr[el]._errors.push(mapper(issue$1));
|
|
413
|
+
}
|
|
414
|
+
curr = curr[el];
|
|
415
|
+
i++;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
processError(error);
|
|
420
|
+
return fieldErrors;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
|
|
425
|
+
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
426
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
427
|
+
const result = schema._zod.run({
|
|
428
|
+
value,
|
|
429
|
+
issues: []
|
|
430
|
+
}, ctx);
|
|
431
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
432
|
+
if (result.issues.length) {
|
|
433
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
434
|
+
captureStackTrace(e, _params?.callee);
|
|
435
|
+
throw e;
|
|
436
|
+
}
|
|
437
|
+
return result.value;
|
|
438
|
+
};
|
|
439
|
+
const parse$1 = /* @__PURE__ */ _parse($ZodRealError);
|
|
440
|
+
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
441
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
442
|
+
let result = schema._zod.run({
|
|
443
|
+
value,
|
|
444
|
+
issues: []
|
|
445
|
+
}, ctx);
|
|
446
|
+
if (result instanceof Promise) result = await result;
|
|
447
|
+
if (result.issues.length) {
|
|
448
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
449
|
+
captureStackTrace(e, params?.callee);
|
|
450
|
+
throw e;
|
|
451
|
+
}
|
|
452
|
+
return result.value;
|
|
453
|
+
};
|
|
454
|
+
const parseAsync$1 = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
455
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
456
|
+
const ctx = _ctx ? {
|
|
457
|
+
..._ctx,
|
|
458
|
+
async: false
|
|
459
|
+
} : { async: false };
|
|
460
|
+
const result = schema._zod.run({
|
|
461
|
+
value,
|
|
462
|
+
issues: []
|
|
463
|
+
}, ctx);
|
|
464
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
465
|
+
return result.issues.length ? {
|
|
466
|
+
success: false,
|
|
467
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
468
|
+
} : {
|
|
469
|
+
success: true,
|
|
470
|
+
data: result.value
|
|
471
|
+
};
|
|
472
|
+
};
|
|
473
|
+
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
474
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
475
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
476
|
+
let result = schema._zod.run({
|
|
477
|
+
value,
|
|
478
|
+
issues: []
|
|
479
|
+
}, ctx);
|
|
480
|
+
if (result instanceof Promise) result = await result;
|
|
481
|
+
return result.issues.length ? {
|
|
482
|
+
success: false,
|
|
483
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
484
|
+
} : {
|
|
485
|
+
success: true,
|
|
486
|
+
data: result.value
|
|
487
|
+
};
|
|
488
|
+
};
|
|
489
|
+
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
490
|
+
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
491
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
492
|
+
return _parse(_Err)(schema, value, ctx);
|
|
493
|
+
};
|
|
494
|
+
const encode$1 = /* @__PURE__ */ _encode($ZodRealError);
|
|
495
|
+
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
496
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
497
|
+
};
|
|
498
|
+
const decode$1 = /* @__PURE__ */ _decode($ZodRealError);
|
|
499
|
+
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
500
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
501
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
502
|
+
};
|
|
503
|
+
const encodeAsync$1 = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
504
|
+
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
505
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
506
|
+
};
|
|
507
|
+
const decodeAsync$1 = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
508
|
+
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
509
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
510
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
511
|
+
};
|
|
512
|
+
const safeEncode$1 = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
513
|
+
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
514
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
515
|
+
};
|
|
516
|
+
const safeDecode$1 = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
517
|
+
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
518
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
519
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
520
|
+
};
|
|
521
|
+
const safeEncodeAsync$1 = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
522
|
+
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
523
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
524
|
+
};
|
|
525
|
+
const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
526
|
+
|
|
527
|
+
//#endregion
|
|
528
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
529
|
+
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
530
|
+
var _a$1;
|
|
531
|
+
inst._zod ?? (inst._zod = {});
|
|
532
|
+
inst._zod.def = def;
|
|
533
|
+
(_a$1 = inst._zod).onattach ?? (_a$1.onattach = []);
|
|
534
|
+
});
|
|
535
|
+
const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
536
|
+
var _a$1;
|
|
537
|
+
$ZodCheck.init(inst, def);
|
|
538
|
+
(_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
|
|
539
|
+
const val = payload.value;
|
|
540
|
+
return !nullish(val) && val.length !== void 0;
|
|
541
|
+
});
|
|
542
|
+
inst._zod.onattach.push((inst$1) => {
|
|
543
|
+
const curr = inst$1._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
544
|
+
if (def.maximum < curr) inst$1._zod.bag.maximum = def.maximum;
|
|
545
|
+
});
|
|
546
|
+
inst._zod.check = (payload) => {
|
|
547
|
+
const input = payload.value;
|
|
548
|
+
if (input.length <= def.maximum) return;
|
|
549
|
+
const origin = getLengthableOrigin(input);
|
|
550
|
+
payload.issues.push({
|
|
551
|
+
origin,
|
|
552
|
+
code: "too_big",
|
|
553
|
+
maximum: def.maximum,
|
|
554
|
+
inclusive: true,
|
|
555
|
+
input,
|
|
556
|
+
inst,
|
|
557
|
+
continue: !def.abort
|
|
558
|
+
});
|
|
559
|
+
};
|
|
560
|
+
});
|
|
561
|
+
const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
562
|
+
var _a$1;
|
|
563
|
+
$ZodCheck.init(inst, def);
|
|
564
|
+
(_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
|
|
565
|
+
const val = payload.value;
|
|
566
|
+
return !nullish(val) && val.length !== void 0;
|
|
567
|
+
});
|
|
568
|
+
inst._zod.onattach.push((inst$1) => {
|
|
569
|
+
const curr = inst$1._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
570
|
+
if (def.minimum > curr) inst$1._zod.bag.minimum = def.minimum;
|
|
571
|
+
});
|
|
572
|
+
inst._zod.check = (payload) => {
|
|
573
|
+
const input = payload.value;
|
|
574
|
+
if (input.length >= def.minimum) return;
|
|
575
|
+
const origin = getLengthableOrigin(input);
|
|
576
|
+
payload.issues.push({
|
|
577
|
+
origin,
|
|
578
|
+
code: "too_small",
|
|
579
|
+
minimum: def.minimum,
|
|
580
|
+
inclusive: true,
|
|
581
|
+
input,
|
|
582
|
+
inst,
|
|
583
|
+
continue: !def.abort
|
|
584
|
+
});
|
|
585
|
+
};
|
|
586
|
+
});
|
|
587
|
+
const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
588
|
+
var _a$1;
|
|
589
|
+
$ZodCheck.init(inst, def);
|
|
590
|
+
(_a$1 = inst._zod.def).when ?? (_a$1.when = (payload) => {
|
|
591
|
+
const val = payload.value;
|
|
592
|
+
return !nullish(val) && val.length !== void 0;
|
|
593
|
+
});
|
|
594
|
+
inst._zod.onattach.push((inst$1) => {
|
|
595
|
+
const bag = inst$1._zod.bag;
|
|
596
|
+
bag.minimum = def.length;
|
|
597
|
+
bag.maximum = def.length;
|
|
598
|
+
bag.length = def.length;
|
|
599
|
+
});
|
|
600
|
+
inst._zod.check = (payload) => {
|
|
601
|
+
const input = payload.value;
|
|
602
|
+
const length = input.length;
|
|
603
|
+
if (length === def.length) return;
|
|
604
|
+
const origin = getLengthableOrigin(input);
|
|
605
|
+
const tooBig = length > def.length;
|
|
606
|
+
payload.issues.push({
|
|
607
|
+
origin,
|
|
608
|
+
...tooBig ? {
|
|
609
|
+
code: "too_big",
|
|
610
|
+
maximum: def.length
|
|
611
|
+
} : {
|
|
612
|
+
code: "too_small",
|
|
613
|
+
minimum: def.length
|
|
614
|
+
},
|
|
615
|
+
inclusive: true,
|
|
616
|
+
exact: true,
|
|
617
|
+
input: payload.value,
|
|
618
|
+
inst,
|
|
619
|
+
continue: !def.abort
|
|
620
|
+
});
|
|
621
|
+
};
|
|
622
|
+
});
|
|
623
|
+
const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
624
|
+
$ZodCheck.init(inst, def);
|
|
625
|
+
inst._zod.check = (payload) => {
|
|
626
|
+
payload.value = def.tx(payload.value);
|
|
627
|
+
};
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
|
|
632
|
+
const version = {
|
|
633
|
+
major: 4,
|
|
634
|
+
minor: 3,
|
|
635
|
+
patch: 6
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
//#endregion
|
|
639
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
|
|
640
|
+
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
641
|
+
var _a$1;
|
|
642
|
+
inst ?? (inst = {});
|
|
643
|
+
inst._zod.def = def;
|
|
644
|
+
inst._zod.bag = inst._zod.bag || {};
|
|
645
|
+
inst._zod.version = version;
|
|
646
|
+
const checks = [...inst._zod.def.checks ?? []];
|
|
647
|
+
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
648
|
+
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
649
|
+
if (checks.length === 0) {
|
|
650
|
+
(_a$1 = inst._zod).deferred ?? (_a$1.deferred = []);
|
|
651
|
+
inst._zod.deferred?.push(() => {
|
|
652
|
+
inst._zod.run = inst._zod.parse;
|
|
653
|
+
});
|
|
654
|
+
} else {
|
|
655
|
+
const runChecks = (payload, checks$1, ctx) => {
|
|
656
|
+
let isAborted = aborted(payload);
|
|
657
|
+
let asyncResult;
|
|
658
|
+
for (const ch of checks$1) {
|
|
659
|
+
if (ch._zod.def.when) {
|
|
660
|
+
if (!ch._zod.def.when(payload)) continue;
|
|
661
|
+
} else if (isAborted) continue;
|
|
662
|
+
const currLen = payload.issues.length;
|
|
663
|
+
const _ = ch._zod.check(payload);
|
|
664
|
+
if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
|
|
665
|
+
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
666
|
+
await _;
|
|
667
|
+
if (payload.issues.length === currLen) return;
|
|
668
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
669
|
+
});
|
|
670
|
+
else {
|
|
671
|
+
if (payload.issues.length === currLen) continue;
|
|
672
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
if (asyncResult) return asyncResult.then(() => {
|
|
676
|
+
return payload;
|
|
677
|
+
});
|
|
678
|
+
return payload;
|
|
679
|
+
};
|
|
680
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
681
|
+
if (aborted(canary)) {
|
|
682
|
+
canary.aborted = true;
|
|
683
|
+
return canary;
|
|
684
|
+
}
|
|
685
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
686
|
+
if (checkResult instanceof Promise) {
|
|
687
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
688
|
+
return checkResult.then((checkResult$1) => inst._zod.parse(checkResult$1, ctx));
|
|
689
|
+
}
|
|
690
|
+
return inst._zod.parse(checkResult, ctx);
|
|
691
|
+
};
|
|
692
|
+
inst._zod.run = (payload, ctx) => {
|
|
693
|
+
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
694
|
+
if (ctx.direction === "backward") {
|
|
695
|
+
const canary = inst._zod.parse({
|
|
696
|
+
value: payload.value,
|
|
697
|
+
issues: []
|
|
698
|
+
}, {
|
|
699
|
+
...ctx,
|
|
700
|
+
skipChecks: true
|
|
701
|
+
});
|
|
702
|
+
if (canary instanceof Promise) return canary.then((canary$1) => {
|
|
703
|
+
return handleCanaryResult(canary$1, payload, ctx);
|
|
704
|
+
});
|
|
705
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
706
|
+
}
|
|
707
|
+
const result = inst._zod.parse(payload, ctx);
|
|
708
|
+
if (result instanceof Promise) {
|
|
709
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
710
|
+
return result.then((result$1) => runChecks(result$1, checks, ctx));
|
|
711
|
+
}
|
|
712
|
+
return runChecks(result, checks, ctx);
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
defineLazy(inst, "~standard", () => ({
|
|
716
|
+
validate: (value) => {
|
|
717
|
+
try {
|
|
718
|
+
const r = safeParse$1(inst, value);
|
|
719
|
+
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
720
|
+
} catch (_) {
|
|
721
|
+
return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
vendor: "zod",
|
|
725
|
+
version: 1
|
|
726
|
+
}));
|
|
727
|
+
});
|
|
728
|
+
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
729
|
+
$ZodType.init(inst, def);
|
|
730
|
+
inst._zod.parse = (payload) => payload;
|
|
731
|
+
});
|
|
732
|
+
function handleArrayResult(result, final, index) {
|
|
733
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
734
|
+
final.value[index] = result.value;
|
|
735
|
+
}
|
|
736
|
+
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
737
|
+
$ZodType.init(inst, def);
|
|
738
|
+
inst._zod.parse = (payload, ctx) => {
|
|
739
|
+
const input = payload.value;
|
|
740
|
+
if (!Array.isArray(input)) {
|
|
741
|
+
payload.issues.push({
|
|
742
|
+
expected: "array",
|
|
743
|
+
code: "invalid_type",
|
|
744
|
+
input,
|
|
745
|
+
inst
|
|
746
|
+
});
|
|
747
|
+
return payload;
|
|
748
|
+
}
|
|
749
|
+
payload.value = Array(input.length);
|
|
750
|
+
const proms = [];
|
|
751
|
+
for (let i = 0; i < input.length; i++) {
|
|
752
|
+
const item = input[i];
|
|
753
|
+
const result = def.element._zod.run({
|
|
754
|
+
value: item,
|
|
755
|
+
issues: []
|
|
756
|
+
}, ctx);
|
|
757
|
+
if (result instanceof Promise) proms.push(result.then((result$1) => handleArrayResult(result$1, payload, i)));
|
|
758
|
+
else handleArrayResult(result, payload, i);
|
|
759
|
+
}
|
|
760
|
+
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
761
|
+
return payload;
|
|
762
|
+
};
|
|
763
|
+
});
|
|
764
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
765
|
+
for (const result of results) if (result.issues.length === 0) {
|
|
766
|
+
final.value = result.value;
|
|
767
|
+
return final;
|
|
768
|
+
}
|
|
769
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
770
|
+
if (nonaborted.length === 1) {
|
|
771
|
+
final.value = nonaborted[0].value;
|
|
772
|
+
return nonaborted[0];
|
|
773
|
+
}
|
|
774
|
+
final.issues.push({
|
|
775
|
+
code: "invalid_union",
|
|
776
|
+
input: final.value,
|
|
777
|
+
inst,
|
|
778
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
779
|
+
});
|
|
780
|
+
return final;
|
|
781
|
+
}
|
|
782
|
+
const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
783
|
+
$ZodType.init(inst, def);
|
|
784
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
785
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
786
|
+
defineLazy(inst._zod, "values", () => {
|
|
787
|
+
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
788
|
+
});
|
|
789
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
790
|
+
if (def.options.every((o) => o._zod.pattern)) {
|
|
791
|
+
const patterns = def.options.map((o) => o._zod.pattern);
|
|
792
|
+
return /* @__PURE__ */ new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
const single = def.options.length === 1;
|
|
796
|
+
const first = def.options[0]._zod.run;
|
|
797
|
+
inst._zod.parse = (payload, ctx) => {
|
|
798
|
+
if (single) return first(payload, ctx);
|
|
799
|
+
let async = false;
|
|
800
|
+
const results = [];
|
|
801
|
+
for (const option of def.options) {
|
|
802
|
+
const result = option._zod.run({
|
|
803
|
+
value: payload.value,
|
|
804
|
+
issues: []
|
|
805
|
+
}, ctx);
|
|
806
|
+
if (result instanceof Promise) {
|
|
807
|
+
results.push(result);
|
|
808
|
+
async = true;
|
|
809
|
+
} else {
|
|
810
|
+
if (result.issues.length === 0) return result;
|
|
811
|
+
results.push(result);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
815
|
+
return Promise.all(results).then((results$1) => {
|
|
816
|
+
return handleUnionResults(results$1, payload, inst, ctx);
|
|
817
|
+
});
|
|
818
|
+
};
|
|
819
|
+
});
|
|
820
|
+
const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
821
|
+
$ZodType.init(inst, def);
|
|
822
|
+
inst._zod.parse = (payload, ctx) => {
|
|
823
|
+
const input = payload.value;
|
|
824
|
+
const left = def.left._zod.run({
|
|
825
|
+
value: input,
|
|
826
|
+
issues: []
|
|
827
|
+
}, ctx);
|
|
828
|
+
const right = def.right._zod.run({
|
|
829
|
+
value: input,
|
|
830
|
+
issues: []
|
|
831
|
+
}, ctx);
|
|
832
|
+
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left$1, right$1]) => {
|
|
833
|
+
return handleIntersectionResults(payload, left$1, right$1);
|
|
834
|
+
});
|
|
835
|
+
return handleIntersectionResults(payload, left, right);
|
|
836
|
+
};
|
|
837
|
+
});
|
|
838
|
+
function mergeValues(a, b) {
|
|
839
|
+
if (a === b) return {
|
|
840
|
+
valid: true,
|
|
841
|
+
data: a
|
|
842
|
+
};
|
|
843
|
+
if (a instanceof Date && b instanceof Date && +a === +b) return {
|
|
844
|
+
valid: true,
|
|
845
|
+
data: a
|
|
846
|
+
};
|
|
847
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
848
|
+
const bKeys = Object.keys(b);
|
|
849
|
+
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
850
|
+
const newObj = {
|
|
851
|
+
...a,
|
|
852
|
+
...b
|
|
853
|
+
};
|
|
854
|
+
for (const key of sharedKeys) {
|
|
855
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
|
856
|
+
if (!sharedValue.valid) return {
|
|
857
|
+
valid: false,
|
|
858
|
+
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
859
|
+
};
|
|
860
|
+
newObj[key] = sharedValue.data;
|
|
861
|
+
}
|
|
862
|
+
return {
|
|
863
|
+
valid: true,
|
|
864
|
+
data: newObj
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
868
|
+
if (a.length !== b.length) return {
|
|
869
|
+
valid: false,
|
|
870
|
+
mergeErrorPath: []
|
|
871
|
+
};
|
|
872
|
+
const newArray = [];
|
|
873
|
+
for (let index = 0; index < a.length; index++) {
|
|
874
|
+
const itemA = a[index];
|
|
875
|
+
const itemB = b[index];
|
|
876
|
+
const sharedValue = mergeValues(itemA, itemB);
|
|
877
|
+
if (!sharedValue.valid) return {
|
|
878
|
+
valid: false,
|
|
879
|
+
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
880
|
+
};
|
|
881
|
+
newArray.push(sharedValue.data);
|
|
882
|
+
}
|
|
883
|
+
return {
|
|
884
|
+
valid: true,
|
|
885
|
+
data: newArray
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
return {
|
|
889
|
+
valid: false,
|
|
890
|
+
mergeErrorPath: []
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
function handleIntersectionResults(result, left, right) {
|
|
894
|
+
const unrecKeys = /* @__PURE__ */ new Map();
|
|
895
|
+
let unrecIssue;
|
|
896
|
+
for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
|
|
897
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
898
|
+
for (const k of iss.keys) {
|
|
899
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
900
|
+
unrecKeys.get(k).l = true;
|
|
901
|
+
}
|
|
902
|
+
} else result.issues.push(iss);
|
|
903
|
+
for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
|
|
904
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
905
|
+
unrecKeys.get(k).r = true;
|
|
906
|
+
}
|
|
907
|
+
else result.issues.push(iss);
|
|
908
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
909
|
+
if (bothKeys.length && unrecIssue) result.issues.push({
|
|
910
|
+
...unrecIssue,
|
|
911
|
+
keys: bothKeys
|
|
912
|
+
});
|
|
913
|
+
if (aborted(result)) return result;
|
|
914
|
+
const merged = mergeValues(left.value, right.value);
|
|
915
|
+
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
916
|
+
result.value = merged.data;
|
|
917
|
+
return result;
|
|
918
|
+
}
|
|
919
|
+
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
920
|
+
$ZodType.init(inst, def);
|
|
921
|
+
inst._zod.parse = (payload, ctx) => {
|
|
922
|
+
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
923
|
+
const _out = def.transform(payload.value, payload);
|
|
924
|
+
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
925
|
+
payload.value = output;
|
|
926
|
+
return payload;
|
|
927
|
+
});
|
|
928
|
+
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
929
|
+
payload.value = _out;
|
|
930
|
+
return payload;
|
|
931
|
+
};
|
|
932
|
+
});
|
|
933
|
+
function handleOptionalResult(result, input) {
|
|
934
|
+
if (result.issues.length && input === void 0) return {
|
|
935
|
+
issues: [],
|
|
936
|
+
value: void 0
|
|
937
|
+
};
|
|
938
|
+
return result;
|
|
939
|
+
}
|
|
940
|
+
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
941
|
+
$ZodType.init(inst, def);
|
|
942
|
+
inst._zod.optin = "optional";
|
|
943
|
+
inst._zod.optout = "optional";
|
|
944
|
+
defineLazy(inst._zod, "values", () => {
|
|
945
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
946
|
+
});
|
|
947
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
948
|
+
const pattern = def.innerType._zod.pattern;
|
|
949
|
+
return pattern ? /* @__PURE__ */ new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
950
|
+
});
|
|
951
|
+
inst._zod.parse = (payload, ctx) => {
|
|
952
|
+
if (def.innerType._zod.optin === "optional") {
|
|
953
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
954
|
+
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
|
|
955
|
+
return handleOptionalResult(result, payload.value);
|
|
956
|
+
}
|
|
957
|
+
if (payload.value === void 0) return payload;
|
|
958
|
+
return def.innerType._zod.run(payload, ctx);
|
|
959
|
+
};
|
|
960
|
+
});
|
|
961
|
+
const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
962
|
+
$ZodOptional.init(inst, def);
|
|
963
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
964
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
965
|
+
inst._zod.parse = (payload, ctx) => {
|
|
966
|
+
return def.innerType._zod.run(payload, ctx);
|
|
967
|
+
};
|
|
968
|
+
});
|
|
969
|
+
const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
970
|
+
$ZodType.init(inst, def);
|
|
971
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
972
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
973
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
974
|
+
const pattern = def.innerType._zod.pattern;
|
|
975
|
+
return pattern ? /* @__PURE__ */ new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
976
|
+
});
|
|
977
|
+
defineLazy(inst._zod, "values", () => {
|
|
978
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
979
|
+
});
|
|
980
|
+
inst._zod.parse = (payload, ctx) => {
|
|
981
|
+
if (payload.value === null) return payload;
|
|
982
|
+
return def.innerType._zod.run(payload, ctx);
|
|
983
|
+
};
|
|
984
|
+
});
|
|
985
|
+
const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
986
|
+
$ZodType.init(inst, def);
|
|
987
|
+
inst._zod.optin = "optional";
|
|
988
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
989
|
+
inst._zod.parse = (payload, ctx) => {
|
|
990
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
991
|
+
if (payload.value === void 0) {
|
|
992
|
+
payload.value = def.defaultValue;
|
|
993
|
+
/**
|
|
994
|
+
* $ZodDefault returns the default value immediately in forward direction.
|
|
995
|
+
* 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. */
|
|
996
|
+
return payload;
|
|
997
|
+
}
|
|
998
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
999
|
+
if (result instanceof Promise) return result.then((result$1) => handleDefaultResult(result$1, def));
|
|
1000
|
+
return handleDefaultResult(result, def);
|
|
1001
|
+
};
|
|
1002
|
+
});
|
|
1003
|
+
function handleDefaultResult(payload, def) {
|
|
1004
|
+
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
1005
|
+
return payload;
|
|
1006
|
+
}
|
|
1007
|
+
const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
1008
|
+
$ZodType.init(inst, def);
|
|
1009
|
+
inst._zod.optin = "optional";
|
|
1010
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1011
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1012
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
1013
|
+
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
1014
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1015
|
+
};
|
|
1016
|
+
});
|
|
1017
|
+
const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
1018
|
+
$ZodType.init(inst, def);
|
|
1019
|
+
defineLazy(inst._zod, "values", () => {
|
|
1020
|
+
const v = def.innerType._zod.values;
|
|
1021
|
+
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
1022
|
+
});
|
|
1023
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1024
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1025
|
+
if (result instanceof Promise) return result.then((result$1) => handleNonOptionalResult(result$1, inst));
|
|
1026
|
+
return handleNonOptionalResult(result, inst);
|
|
1027
|
+
};
|
|
1028
|
+
});
|
|
1029
|
+
function handleNonOptionalResult(payload, inst) {
|
|
1030
|
+
if (!payload.issues.length && payload.value === void 0) payload.issues.push({
|
|
1031
|
+
code: "invalid_type",
|
|
1032
|
+
expected: "nonoptional",
|
|
1033
|
+
input: payload.value,
|
|
1034
|
+
inst
|
|
1035
|
+
});
|
|
1036
|
+
return payload;
|
|
1037
|
+
}
|
|
1038
|
+
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
1039
|
+
$ZodType.init(inst, def);
|
|
1040
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1041
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1042
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1043
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1044
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
1045
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1046
|
+
if (result instanceof Promise) return result.then((result$1) => {
|
|
1047
|
+
payload.value = result$1.value;
|
|
1048
|
+
if (result$1.issues.length) {
|
|
1049
|
+
payload.value = def.catchValue({
|
|
1050
|
+
...payload,
|
|
1051
|
+
error: { issues: result$1.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
1052
|
+
input: payload.value
|
|
1053
|
+
});
|
|
1054
|
+
payload.issues = [];
|
|
1055
|
+
}
|
|
1056
|
+
return payload;
|
|
1057
|
+
});
|
|
1058
|
+
payload.value = result.value;
|
|
1059
|
+
if (result.issues.length) {
|
|
1060
|
+
payload.value = def.catchValue({
|
|
1061
|
+
...payload,
|
|
1062
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
1063
|
+
input: payload.value
|
|
1064
|
+
});
|
|
1065
|
+
payload.issues = [];
|
|
1066
|
+
}
|
|
1067
|
+
return payload;
|
|
1068
|
+
};
|
|
1069
|
+
});
|
|
1070
|
+
const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
1071
|
+
$ZodType.init(inst, def);
|
|
1072
|
+
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
1073
|
+
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
1074
|
+
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
1075
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
1076
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1077
|
+
if (ctx.direction === "backward") {
|
|
1078
|
+
const right = def.out._zod.run(payload, ctx);
|
|
1079
|
+
if (right instanceof Promise) return right.then((right$1) => handlePipeResult(right$1, def.in, ctx));
|
|
1080
|
+
return handlePipeResult(right, def.in, ctx);
|
|
1081
|
+
}
|
|
1082
|
+
const left = def.in._zod.run(payload, ctx);
|
|
1083
|
+
if (left instanceof Promise) return left.then((left$1) => handlePipeResult(left$1, def.out, ctx));
|
|
1084
|
+
return handlePipeResult(left, def.out, ctx);
|
|
1085
|
+
};
|
|
1086
|
+
});
|
|
1087
|
+
function handlePipeResult(left, next, ctx) {
|
|
1088
|
+
if (left.issues.length) {
|
|
1089
|
+
left.aborted = true;
|
|
1090
|
+
return left;
|
|
1091
|
+
}
|
|
1092
|
+
return next._zod.run({
|
|
1093
|
+
value: left.value,
|
|
1094
|
+
issues: left.issues
|
|
1095
|
+
}, ctx);
|
|
1096
|
+
}
|
|
1097
|
+
const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
1098
|
+
$ZodType.init(inst, def);
|
|
1099
|
+
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
1100
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1101
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
1102
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
1103
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1104
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
1105
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1106
|
+
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
1107
|
+
return handleReadonlyResult(result);
|
|
1108
|
+
};
|
|
1109
|
+
});
|
|
1110
|
+
function handleReadonlyResult(payload) {
|
|
1111
|
+
payload.value = Object.freeze(payload.value);
|
|
1112
|
+
return payload;
|
|
1113
|
+
}
|
|
1114
|
+
const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
1115
|
+
$ZodCheck.init(inst, def);
|
|
1116
|
+
$ZodType.init(inst, def);
|
|
1117
|
+
inst._zod.parse = (payload, _) => {
|
|
1118
|
+
return payload;
|
|
1119
|
+
};
|
|
1120
|
+
inst._zod.check = (payload) => {
|
|
1121
|
+
const input = payload.value;
|
|
1122
|
+
const r = def.fn(input);
|
|
1123
|
+
if (r instanceof Promise) return r.then((r$1) => handleRefineResult(r$1, payload, input, inst));
|
|
1124
|
+
handleRefineResult(r, payload, input, inst);
|
|
1125
|
+
};
|
|
1126
|
+
});
|
|
1127
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
1128
|
+
if (!result) {
|
|
1129
|
+
const _iss = {
|
|
1130
|
+
code: "custom",
|
|
1131
|
+
input,
|
|
1132
|
+
inst,
|
|
1133
|
+
path: [...inst._zod.def.path ?? []],
|
|
1134
|
+
continue: !inst._zod.def.abort
|
|
1135
|
+
};
|
|
1136
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
1137
|
+
payload.issues.push(issue(_iss));
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
186
1140
|
|
|
187
1141
|
//#endregion
|
|
188
1142
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js
|
|
@@ -195,9 +1149,9 @@ var $ZodRegistry = class {
|
|
|
195
1149
|
this._idmap = /* @__PURE__ */ new Map();
|
|
196
1150
|
}
|
|
197
1151
|
add(schema, ..._meta) {
|
|
198
|
-
const meta = _meta[0];
|
|
199
|
-
this._map.set(schema, meta);
|
|
200
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
1152
|
+
const meta$2 = _meta[0];
|
|
1153
|
+
this._map.set(schema, meta$2);
|
|
1154
|
+
if (meta$2 && typeof meta$2 === "object" && "id" in meta$2) this._idmap.set(meta$2.id, schema);
|
|
201
1155
|
return this;
|
|
202
1156
|
}
|
|
203
1157
|
clear() {
|
|
@@ -206,8 +1160,8 @@ var $ZodRegistry = class {
|
|
|
206
1160
|
return this;
|
|
207
1161
|
}
|
|
208
1162
|
remove(schema) {
|
|
209
|
-
const meta = this._map.get(schema);
|
|
210
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
1163
|
+
const meta$2 = this._map.get(schema);
|
|
1164
|
+
if (meta$2 && typeof meta$2 === "object" && "id" in meta$2) this._idmap.delete(meta$2.id);
|
|
211
1165
|
this._map.delete(schema);
|
|
212
1166
|
return this;
|
|
213
1167
|
}
|
|
@@ -234,6 +1188,115 @@ function registry() {
|
|
|
234
1188
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
235
1189
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
236
1190
|
|
|
1191
|
+
//#endregion
|
|
1192
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
1193
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1194
|
+
function _unknown(Class) {
|
|
1195
|
+
return new Class({ type: "unknown" });
|
|
1196
|
+
}
|
|
1197
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1198
|
+
function _maxLength(maximum, params) {
|
|
1199
|
+
return new $ZodCheckMaxLength({
|
|
1200
|
+
check: "max_length",
|
|
1201
|
+
...normalizeParams(params),
|
|
1202
|
+
maximum
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1206
|
+
function _minLength(minimum, params) {
|
|
1207
|
+
return new $ZodCheckMinLength({
|
|
1208
|
+
check: "min_length",
|
|
1209
|
+
...normalizeParams(params),
|
|
1210
|
+
minimum
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1214
|
+
function _length(length, params) {
|
|
1215
|
+
return new $ZodCheckLengthEquals({
|
|
1216
|
+
check: "length_equals",
|
|
1217
|
+
...normalizeParams(params),
|
|
1218
|
+
length
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1222
|
+
function _overwrite(tx) {
|
|
1223
|
+
return new $ZodCheckOverwrite({
|
|
1224
|
+
check: "overwrite",
|
|
1225
|
+
tx
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1229
|
+
function _array(Class, element, params) {
|
|
1230
|
+
return new Class({
|
|
1231
|
+
type: "array",
|
|
1232
|
+
element,
|
|
1233
|
+
...normalizeParams(params)
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1237
|
+
function _refine(Class, fn, _params) {
|
|
1238
|
+
return new Class({
|
|
1239
|
+
type: "custom",
|
|
1240
|
+
check: "custom",
|
|
1241
|
+
fn,
|
|
1242
|
+
...normalizeParams(_params)
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1246
|
+
function _superRefine(fn) {
|
|
1247
|
+
const ch = /* @__PURE__ */ _check((payload) => {
|
|
1248
|
+
payload.addIssue = (issue$1) => {
|
|
1249
|
+
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
|
|
1250
|
+
else {
|
|
1251
|
+
const _issue = issue$1;
|
|
1252
|
+
if (_issue.fatal) _issue.continue = false;
|
|
1253
|
+
_issue.code ?? (_issue.code = "custom");
|
|
1254
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
1255
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
1256
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
1257
|
+
payload.issues.push(issue(_issue));
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
return fn(payload.value, payload);
|
|
1261
|
+
});
|
|
1262
|
+
return ch;
|
|
1263
|
+
}
|
|
1264
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1265
|
+
function _check(fn, params) {
|
|
1266
|
+
const ch = new $ZodCheck({
|
|
1267
|
+
check: "custom",
|
|
1268
|
+
...normalizeParams(params)
|
|
1269
|
+
});
|
|
1270
|
+
ch._zod.check = fn;
|
|
1271
|
+
return ch;
|
|
1272
|
+
}
|
|
1273
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1274
|
+
function describe$1(description) {
|
|
1275
|
+
const ch = new $ZodCheck({ check: "describe" });
|
|
1276
|
+
ch._zod.onattach = [(inst) => {
|
|
1277
|
+
const existing = globalRegistry.get(inst) ?? {};
|
|
1278
|
+
globalRegistry.add(inst, {
|
|
1279
|
+
...existing,
|
|
1280
|
+
description
|
|
1281
|
+
});
|
|
1282
|
+
}];
|
|
1283
|
+
ch._zod.check = () => {};
|
|
1284
|
+
return ch;
|
|
1285
|
+
}
|
|
1286
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1287
|
+
function meta$1(metadata) {
|
|
1288
|
+
const ch = new $ZodCheck({ check: "meta" });
|
|
1289
|
+
ch._zod.onattach = [(inst) => {
|
|
1290
|
+
const existing = globalRegistry.get(inst) ?? {};
|
|
1291
|
+
globalRegistry.add(inst, {
|
|
1292
|
+
...existing,
|
|
1293
|
+
...metadata
|
|
1294
|
+
});
|
|
1295
|
+
}];
|
|
1296
|
+
ch._zod.check = () => {};
|
|
1297
|
+
return ch;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
237
1300
|
//#endregion
|
|
238
1301
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
|
|
239
1302
|
function initializeContext(params) {
|
|
@@ -295,8 +1358,8 @@ function process(schema, ctx, _params = {
|
|
|
295
1358
|
ctx.seen.get(parent).isParent = true;
|
|
296
1359
|
}
|
|
297
1360
|
}
|
|
298
|
-
const meta = ctx.metadataRegistry.get(schema);
|
|
299
|
-
if (meta) Object.assign(result.schema, meta);
|
|
1361
|
+
const meta$2 = ctx.metadataRegistry.get(schema);
|
|
1362
|
+
if (meta$2) Object.assign(result.schema, meta$2);
|
|
300
1363
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
301
1364
|
delete result.schema.examples;
|
|
302
1365
|
delete result.schema.default;
|
|
@@ -494,6 +1557,19 @@ function isTransforming(_schema, _ctx) {
|
|
|
494
1557
|
}
|
|
495
1558
|
return false;
|
|
496
1559
|
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Creates a toJSONSchema method for a schema instance.
|
|
1562
|
+
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
1563
|
+
*/
|
|
1564
|
+
const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
1565
|
+
const ctx = initializeContext({
|
|
1566
|
+
...params,
|
|
1567
|
+
processors
|
|
1568
|
+
});
|
|
1569
|
+
process(schema, ctx);
|
|
1570
|
+
extractDefs(ctx, schema);
|
|
1571
|
+
return finalize(ctx, schema);
|
|
1572
|
+
};
|
|
497
1573
|
const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
498
1574
|
const { libraryOptions, target } = params ?? {};
|
|
499
1575
|
const ctx = initializeContext({
|
|
@@ -964,6 +2040,336 @@ function toJSONSchema(input, params) {
|
|
|
964
2040
|
return finalize(ctx, input);
|
|
965
2041
|
}
|
|
966
2042
|
|
|
2043
|
+
//#endregion
|
|
2044
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
2045
|
+
const initializer = (inst, issues) => {
|
|
2046
|
+
$ZodError.init(inst, issues);
|
|
2047
|
+
inst.name = "ZodError";
|
|
2048
|
+
Object.defineProperties(inst, {
|
|
2049
|
+
format: { value: (mapper) => formatError(inst, mapper) },
|
|
2050
|
+
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
2051
|
+
addIssue: { value: (issue$1) => {
|
|
2052
|
+
inst.issues.push(issue$1);
|
|
2053
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
2054
|
+
} },
|
|
2055
|
+
addIssues: { value: (issues$1) => {
|
|
2056
|
+
inst.issues.push(...issues$1);
|
|
2057
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
2058
|
+
} },
|
|
2059
|
+
isEmpty: { get() {
|
|
2060
|
+
return inst.issues.length === 0;
|
|
2061
|
+
} }
|
|
2062
|
+
});
|
|
2063
|
+
};
|
|
2064
|
+
const ZodError = $constructor("ZodError", initializer);
|
|
2065
|
+
const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
|
|
2066
|
+
|
|
2067
|
+
//#endregion
|
|
2068
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js
|
|
2069
|
+
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
2070
|
+
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
2071
|
+
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
2072
|
+
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
2073
|
+
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
2074
|
+
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
2075
|
+
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
2076
|
+
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
2077
|
+
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
2078
|
+
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
2079
|
+
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
2080
|
+
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
2081
|
+
|
|
2082
|
+
//#endregion
|
|
2083
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
|
|
2084
|
+
const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
2085
|
+
$ZodType.init(inst, def);
|
|
2086
|
+
Object.assign(inst["~standard"], { jsonSchema: {
|
|
2087
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
2088
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
2089
|
+
} });
|
|
2090
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
2091
|
+
inst.def = def;
|
|
2092
|
+
inst.type = def.type;
|
|
2093
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
2094
|
+
inst.check = (...checks) => {
|
|
2095
|
+
return inst.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
2096
|
+
check: ch,
|
|
2097
|
+
def: { check: "custom" },
|
|
2098
|
+
onattach: []
|
|
2099
|
+
} } : ch)] }), { parent: true });
|
|
2100
|
+
};
|
|
2101
|
+
inst.with = inst.check;
|
|
2102
|
+
inst.clone = (def$1, params) => clone(inst, def$1, params);
|
|
2103
|
+
inst.brand = () => inst;
|
|
2104
|
+
inst.register = ((reg, meta$2) => {
|
|
2105
|
+
reg.add(inst, meta$2);
|
|
2106
|
+
return inst;
|
|
2107
|
+
});
|
|
2108
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
2109
|
+
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
2110
|
+
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
2111
|
+
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
2112
|
+
inst.spa = inst.safeParseAsync;
|
|
2113
|
+
inst.encode = (data, params) => encode(inst, data, params);
|
|
2114
|
+
inst.decode = (data, params) => decode(inst, data, params);
|
|
2115
|
+
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
2116
|
+
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
2117
|
+
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
2118
|
+
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
2119
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
2120
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
2121
|
+
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
2122
|
+
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
2123
|
+
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
2124
|
+
inst.optional = () => optional(inst);
|
|
2125
|
+
inst.exactOptional = () => exactOptional(inst);
|
|
2126
|
+
inst.nullable = () => nullable(inst);
|
|
2127
|
+
inst.nullish = () => optional(nullable(inst));
|
|
2128
|
+
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
2129
|
+
inst.array = () => array(inst);
|
|
2130
|
+
inst.or = (arg) => union([inst, arg]);
|
|
2131
|
+
inst.and = (arg) => intersection(inst, arg);
|
|
2132
|
+
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
2133
|
+
inst.default = (def$1) => _default(inst, def$1);
|
|
2134
|
+
inst.prefault = (def$1) => prefault(inst, def$1);
|
|
2135
|
+
inst.catch = (params) => _catch(inst, params);
|
|
2136
|
+
inst.pipe = (target) => pipe(inst, target);
|
|
2137
|
+
inst.readonly = () => readonly(inst);
|
|
2138
|
+
inst.describe = (description) => {
|
|
2139
|
+
const cl = inst.clone();
|
|
2140
|
+
globalRegistry.add(cl, { description });
|
|
2141
|
+
return cl;
|
|
2142
|
+
};
|
|
2143
|
+
Object.defineProperty(inst, "description", {
|
|
2144
|
+
get() {
|
|
2145
|
+
return globalRegistry.get(inst)?.description;
|
|
2146
|
+
},
|
|
2147
|
+
configurable: true
|
|
2148
|
+
});
|
|
2149
|
+
inst.meta = (...args) => {
|
|
2150
|
+
if (args.length === 0) return globalRegistry.get(inst);
|
|
2151
|
+
const cl = inst.clone();
|
|
2152
|
+
globalRegistry.add(cl, args[0]);
|
|
2153
|
+
return cl;
|
|
2154
|
+
};
|
|
2155
|
+
inst.isOptional = () => inst.safeParse(void 0).success;
|
|
2156
|
+
inst.isNullable = () => inst.safeParse(null).success;
|
|
2157
|
+
inst.apply = (fn) => fn(inst);
|
|
2158
|
+
return inst;
|
|
2159
|
+
});
|
|
2160
|
+
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
2161
|
+
$ZodUnknown.init(inst, def);
|
|
2162
|
+
ZodType.init(inst, def);
|
|
2163
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
2164
|
+
});
|
|
2165
|
+
function unknown() {
|
|
2166
|
+
return _unknown(ZodUnknown);
|
|
2167
|
+
}
|
|
2168
|
+
const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
2169
|
+
$ZodArray.init(inst, def);
|
|
2170
|
+
ZodType.init(inst, def);
|
|
2171
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
2172
|
+
inst.element = def.element;
|
|
2173
|
+
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
2174
|
+
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
2175
|
+
inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
|
|
2176
|
+
inst.length = (len, params) => inst.check(_length(len, params));
|
|
2177
|
+
inst.unwrap = () => inst.element;
|
|
2178
|
+
});
|
|
2179
|
+
function array(element, params) {
|
|
2180
|
+
return _array(ZodArray, element, params);
|
|
2181
|
+
}
|
|
2182
|
+
const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
2183
|
+
$ZodUnion.init(inst, def);
|
|
2184
|
+
ZodType.init(inst, def);
|
|
2185
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
2186
|
+
inst.options = def.options;
|
|
2187
|
+
});
|
|
2188
|
+
function union(options, params) {
|
|
2189
|
+
return new ZodUnion({
|
|
2190
|
+
type: "union",
|
|
2191
|
+
options,
|
|
2192
|
+
...normalizeParams(params)
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2195
|
+
const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
2196
|
+
$ZodIntersection.init(inst, def);
|
|
2197
|
+
ZodType.init(inst, def);
|
|
2198
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
2199
|
+
});
|
|
2200
|
+
function intersection(left, right) {
|
|
2201
|
+
return new ZodIntersection({
|
|
2202
|
+
type: "intersection",
|
|
2203
|
+
left,
|
|
2204
|
+
right
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2207
|
+
const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
2208
|
+
$ZodTransform.init(inst, def);
|
|
2209
|
+
ZodType.init(inst, def);
|
|
2210
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
2211
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2212
|
+
if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
2213
|
+
payload.addIssue = (issue$1) => {
|
|
2214
|
+
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
|
|
2215
|
+
else {
|
|
2216
|
+
const _issue = issue$1;
|
|
2217
|
+
if (_issue.fatal) _issue.continue = false;
|
|
2218
|
+
_issue.code ?? (_issue.code = "custom");
|
|
2219
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
2220
|
+
_issue.inst ?? (_issue.inst = inst);
|
|
2221
|
+
payload.issues.push(issue(_issue));
|
|
2222
|
+
}
|
|
2223
|
+
};
|
|
2224
|
+
const output = def.transform(payload.value, payload);
|
|
2225
|
+
if (output instanceof Promise) return output.then((output$1) => {
|
|
2226
|
+
payload.value = output$1;
|
|
2227
|
+
return payload;
|
|
2228
|
+
});
|
|
2229
|
+
payload.value = output;
|
|
2230
|
+
return payload;
|
|
2231
|
+
};
|
|
2232
|
+
});
|
|
2233
|
+
function transform(fn) {
|
|
2234
|
+
return new ZodTransform({
|
|
2235
|
+
type: "transform",
|
|
2236
|
+
transform: fn
|
|
2237
|
+
});
|
|
2238
|
+
}
|
|
2239
|
+
const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
2240
|
+
$ZodOptional.init(inst, def);
|
|
2241
|
+
ZodType.init(inst, def);
|
|
2242
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
2243
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2244
|
+
});
|
|
2245
|
+
function optional(innerType) {
|
|
2246
|
+
return new ZodOptional({
|
|
2247
|
+
type: "optional",
|
|
2248
|
+
innerType
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
const ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
2252
|
+
$ZodExactOptional.init(inst, def);
|
|
2253
|
+
ZodType.init(inst, def);
|
|
2254
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
2255
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2256
|
+
});
|
|
2257
|
+
function exactOptional(innerType) {
|
|
2258
|
+
return new ZodExactOptional({
|
|
2259
|
+
type: "optional",
|
|
2260
|
+
innerType
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
2264
|
+
$ZodNullable.init(inst, def);
|
|
2265
|
+
ZodType.init(inst, def);
|
|
2266
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
2267
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2268
|
+
});
|
|
2269
|
+
function nullable(innerType) {
|
|
2270
|
+
return new ZodNullable({
|
|
2271
|
+
type: "nullable",
|
|
2272
|
+
innerType
|
|
2273
|
+
});
|
|
2274
|
+
}
|
|
2275
|
+
const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
2276
|
+
$ZodDefault.init(inst, def);
|
|
2277
|
+
ZodType.init(inst, def);
|
|
2278
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
2279
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2280
|
+
inst.removeDefault = inst.unwrap;
|
|
2281
|
+
});
|
|
2282
|
+
function _default(innerType, defaultValue) {
|
|
2283
|
+
return new ZodDefault({
|
|
2284
|
+
type: "default",
|
|
2285
|
+
innerType,
|
|
2286
|
+
get defaultValue() {
|
|
2287
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
2288
|
+
}
|
|
2289
|
+
});
|
|
2290
|
+
}
|
|
2291
|
+
const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
2292
|
+
$ZodPrefault.init(inst, def);
|
|
2293
|
+
ZodType.init(inst, def);
|
|
2294
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
2295
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2296
|
+
});
|
|
2297
|
+
function prefault(innerType, defaultValue) {
|
|
2298
|
+
return new ZodPrefault({
|
|
2299
|
+
type: "prefault",
|
|
2300
|
+
innerType,
|
|
2301
|
+
get defaultValue() {
|
|
2302
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
2303
|
+
}
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
2307
|
+
$ZodNonOptional.init(inst, def);
|
|
2308
|
+
ZodType.init(inst, def);
|
|
2309
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
2310
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2311
|
+
});
|
|
2312
|
+
function nonoptional(innerType, params) {
|
|
2313
|
+
return new ZodNonOptional({
|
|
2314
|
+
type: "nonoptional",
|
|
2315
|
+
innerType,
|
|
2316
|
+
...normalizeParams(params)
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
2320
|
+
$ZodCatch.init(inst, def);
|
|
2321
|
+
ZodType.init(inst, def);
|
|
2322
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
2323
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2324
|
+
inst.removeCatch = inst.unwrap;
|
|
2325
|
+
});
|
|
2326
|
+
function _catch(innerType, catchValue) {
|
|
2327
|
+
return new ZodCatch({
|
|
2328
|
+
type: "catch",
|
|
2329
|
+
innerType,
|
|
2330
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
2334
|
+
$ZodPipe.init(inst, def);
|
|
2335
|
+
ZodType.init(inst, def);
|
|
2336
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
2337
|
+
inst.in = def.in;
|
|
2338
|
+
inst.out = def.out;
|
|
2339
|
+
});
|
|
2340
|
+
function pipe(in_, out) {
|
|
2341
|
+
return new ZodPipe({
|
|
2342
|
+
type: "pipe",
|
|
2343
|
+
in: in_,
|
|
2344
|
+
out
|
|
2345
|
+
});
|
|
2346
|
+
}
|
|
2347
|
+
const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
2348
|
+
$ZodReadonly.init(inst, def);
|
|
2349
|
+
ZodType.init(inst, def);
|
|
2350
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
2351
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
2352
|
+
});
|
|
2353
|
+
function readonly(innerType) {
|
|
2354
|
+
return new ZodReadonly({
|
|
2355
|
+
type: "readonly",
|
|
2356
|
+
innerType
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
2360
|
+
$ZodCustom.init(inst, def);
|
|
2361
|
+
ZodType.init(inst, def);
|
|
2362
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
2363
|
+
});
|
|
2364
|
+
function refine(fn, _params = {}) {
|
|
2365
|
+
return _refine(ZodCustom, fn, _params);
|
|
2366
|
+
}
|
|
2367
|
+
function superRefine(fn) {
|
|
2368
|
+
return _superRefine(fn);
|
|
2369
|
+
}
|
|
2370
|
+
const describe = describe$1;
|
|
2371
|
+
const meta = meta$1;
|
|
2372
|
+
|
|
967
2373
|
//#endregion
|
|
968
2374
|
//#region src/nodes/ConnectionCredentialExecutionContextFactory.ts
|
|
969
2375
|
/**
|
|
@@ -1089,28 +2495,28 @@ let NodeBackedToolRuntime = class NodeBackedToolRuntime$1 {
|
|
|
1089
2495
|
constructor(nodeResolver) {
|
|
1090
2496
|
this.nodeResolver = nodeResolver;
|
|
1091
2497
|
}
|
|
1092
|
-
async execute(config, args) {
|
|
1093
|
-
const nodeInput = config.toNodeItem({
|
|
2498
|
+
async execute(config$1, args) {
|
|
2499
|
+
const nodeInput = config$1.toNodeItem({
|
|
1094
2500
|
input: args.input,
|
|
1095
2501
|
item: args.item,
|
|
1096
2502
|
itemIndex: args.itemIndex,
|
|
1097
2503
|
items: args.items,
|
|
1098
2504
|
ctx: args.ctx,
|
|
1099
|
-
node: config.node
|
|
2505
|
+
node: config$1.node
|
|
1100
2506
|
});
|
|
1101
2507
|
const nodeCtx = {
|
|
1102
2508
|
...args.ctx,
|
|
1103
|
-
config: config.node
|
|
2509
|
+
config: config$1.node
|
|
1104
2510
|
};
|
|
1105
|
-
const resolvedNode = this.nodeResolver.resolve(config.node.type);
|
|
2511
|
+
const resolvedNode = this.nodeResolver.resolve(config$1.node.type);
|
|
1106
2512
|
const outputs = await this.executeResolvedNode(resolvedNode, nodeInput, nodeCtx);
|
|
1107
|
-
return config.toToolOutput({
|
|
2513
|
+
return config$1.toToolOutput({
|
|
1108
2514
|
input: args.input,
|
|
1109
2515
|
item: args.item,
|
|
1110
2516
|
itemIndex: args.itemIndex,
|
|
1111
2517
|
items: args.items,
|
|
1112
2518
|
ctx: args.ctx,
|
|
1113
|
-
node: config.node,
|
|
2519
|
+
node: config$1.node,
|
|
1114
2520
|
outputs
|
|
1115
2521
|
});
|
|
1116
2522
|
}
|
|
@@ -1146,21 +2552,43 @@ var _ref, _ref2;
|
|
|
1146
2552
|
let AIAgentNode = class AIAgentNode$1 {
|
|
1147
2553
|
kind = "node";
|
|
1148
2554
|
outputPorts = ["main"];
|
|
2555
|
+
/**
|
|
2556
|
+
* Engine applies {@link RunnableNodeConfig.mapInput} + parse before {@link #executeOne}. Prefer modeling
|
|
2557
|
+
* prompts as {@code { messages: [{ role, content }, ...] }} so persisted inputs are visible in the UI.
|
|
2558
|
+
*/
|
|
2559
|
+
inputSchema = unknown();
|
|
1149
2560
|
connectionCredentialExecutionContextFactory;
|
|
2561
|
+
/** One resolved model/tools bundle per activation context (same ctx across items in a batch). */
|
|
2562
|
+
preparedByExecutionContext = /* @__PURE__ */ new WeakMap();
|
|
1150
2563
|
constructor(nodeResolver, credentialSessions, nodeBackedToolRuntime, executionHelpers) {
|
|
1151
2564
|
this.nodeResolver = nodeResolver;
|
|
1152
2565
|
this.nodeBackedToolRuntime = nodeBackedToolRuntime;
|
|
1153
2566
|
this.executionHelpers = executionHelpers;
|
|
1154
2567
|
this.connectionCredentialExecutionContextFactory = this.executionHelpers.createConnectionCredentialExecutionContextFactory(credentialSessions);
|
|
1155
2568
|
}
|
|
1156
|
-
async
|
|
1157
|
-
const prepared = await this.
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1160
|
-
|
|
2569
|
+
async executeOne(args) {
|
|
2570
|
+
const prepared = await this.getOrPrepareExecution(args.ctx);
|
|
2571
|
+
const itemWithMappedJson = {
|
|
2572
|
+
...args.item,
|
|
2573
|
+
json: args.input
|
|
2574
|
+
};
|
|
2575
|
+
return (await this.runAgentForItem(prepared, itemWithMappedJson, args.itemIndex, args.items)).json;
|
|
2576
|
+
}
|
|
2577
|
+
async getOrPrepareExecution(ctx) {
|
|
2578
|
+
let pending = this.preparedByExecutionContext.get(ctx);
|
|
2579
|
+
if (!pending) {
|
|
2580
|
+
pending = this.prepareExecution(ctx);
|
|
2581
|
+
this.preparedByExecutionContext.set(ctx, pending);
|
|
2582
|
+
}
|
|
2583
|
+
try {
|
|
2584
|
+
return await pending;
|
|
2585
|
+
} catch (error) {
|
|
2586
|
+
this.preparedByExecutionContext.delete(ctx);
|
|
2587
|
+
throw error;
|
|
2588
|
+
}
|
|
1161
2589
|
}
|
|
1162
2590
|
/**
|
|
1163
|
-
* Resolves the chat model and tools once, then
|
|
2591
|
+
* Resolves the chat model and tools once per activation, then reuses for every item in the batch.
|
|
1164
2592
|
*/
|
|
1165
2593
|
async prepareExecution(ctx) {
|
|
1166
2594
|
const chatModelFactory = this.nodeResolver.resolve(ctx.config.chatModel.type);
|
|
@@ -1239,9 +2667,9 @@ let AIAgentNode = class AIAgentNode$1 {
|
|
|
1239
2667
|
return model.bindTools(itemScopedTools.map((entry) => entry.langChainTool));
|
|
1240
2668
|
}
|
|
1241
2669
|
resolveTools(toolConfigs) {
|
|
1242
|
-
const resolvedTools = toolConfigs.map((config) => ({
|
|
1243
|
-
config,
|
|
1244
|
-
runtime: this.resolveToolRuntime(config)
|
|
2670
|
+
const resolvedTools = toolConfigs.map((config$1) => ({
|
|
2671
|
+
config: config$1,
|
|
2672
|
+
runtime: this.resolveToolRuntime(config$1)
|
|
1245
2673
|
}));
|
|
1246
2674
|
const names = /* @__PURE__ */ new Set();
|
|
1247
2675
|
for (const entry of resolvedTools) {
|
|
@@ -1410,25 +2838,25 @@ let AIAgentNode = class AIAgentNode$1 {
|
|
|
1410
2838
|
return JSON.parse(json);
|
|
1411
2839
|
}
|
|
1412
2840
|
createPromptMessages(item, itemIndex, items, ctx) {
|
|
1413
|
-
return AgentMessageFactory.createPromptMessages(AgentMessageConfigNormalizer.
|
|
2841
|
+
return AgentMessageFactory.createPromptMessages(AgentMessageConfigNormalizer.resolveFromInputOrConfig(item.json, ctx.config, {
|
|
1414
2842
|
item,
|
|
1415
2843
|
itemIndex,
|
|
1416
2844
|
items,
|
|
1417
2845
|
ctx
|
|
1418
2846
|
}));
|
|
1419
2847
|
}
|
|
1420
|
-
resolveToolRuntime(config) {
|
|
1421
|
-
if (this.isNodeBackedToolConfig(config)) {
|
|
1422
|
-
const inputSchema = config.getInputSchema();
|
|
1423
|
-
if (inputSchema == null) throw new Error(`AIAgent tool "${config.name}": node-backed tool is missing inputSchema (cannot build LangChain tool).`);
|
|
2848
|
+
resolveToolRuntime(config$1) {
|
|
2849
|
+
if (this.isNodeBackedToolConfig(config$1)) {
|
|
2850
|
+
const inputSchema = config$1.getInputSchema();
|
|
2851
|
+
if (inputSchema == null) throw new Error(`AIAgent tool "${config$1.name}": node-backed tool is missing inputSchema (cannot build LangChain tool).`);
|
|
1424
2852
|
return {
|
|
1425
|
-
defaultDescription: `Run workflow node "${config.node.name ?? config.name}" as an AI tool.`,
|
|
2853
|
+
defaultDescription: `Run workflow node "${config$1.node.name ?? config$1.name}" as an AI tool.`,
|
|
1426
2854
|
inputSchema,
|
|
1427
|
-
execute: async (args) => await this.nodeBackedToolRuntime.execute(config, args)
|
|
2855
|
+
execute: async (args) => await this.nodeBackedToolRuntime.execute(config$1, args)
|
|
1428
2856
|
};
|
|
1429
2857
|
}
|
|
1430
|
-
const tool = this.nodeResolver.resolve(config.type);
|
|
1431
|
-
if (tool.inputSchema == null) throw new Error(`AIAgent tool "${config.name}": plugin tool "${String(config.type)}" is missing inputSchema.`);
|
|
2858
|
+
const tool = this.nodeResolver.resolve(config$1.type);
|
|
2859
|
+
if (tool.inputSchema == null) throw new Error(`AIAgent tool "${config$1.name}": plugin tool "${String(config$1.type)}" is missing inputSchema.`);
|
|
1432
2860
|
return {
|
|
1433
2861
|
defaultDescription: tool.defaultDescription,
|
|
1434
2862
|
inputSchema: tool.inputSchema,
|
|
@@ -1440,8 +2868,8 @@ let AIAgentNode = class AIAgentNode$1 {
|
|
|
1440
2868
|
* sending node-backed tools down the plugin-tool branch with `inputSchema: undefined` (LangChain then crashes in
|
|
1441
2869
|
* json-schema validation). {@link NodeBackedToolConfig#toolKind} is stable across copies.
|
|
1442
2870
|
*/
|
|
1443
|
-
isNodeBackedToolConfig(config) {
|
|
1444
|
-
return config instanceof NodeBackedToolConfig || typeof config === "object" && config !== null && config.toolKind === "nodeBacked";
|
|
2871
|
+
isNodeBackedToolConfig(config$1) {
|
|
2872
|
+
return config$1 instanceof NodeBackedToolConfig || typeof config$1 === "object" && config$1 !== null && config$1.toolKind === "nodeBacked";
|
|
1445
2873
|
}
|
|
1446
2874
|
resolveGuardrails(guardrails) {
|
|
1447
2875
|
const maxTurns = guardrails?.maxTurns ?? AgentGuardrailDefaults.maxTurns;
|
|
@@ -1485,6 +2913,8 @@ var AIAgent = class {
|
|
|
1485
2913
|
id;
|
|
1486
2914
|
retryPolicy;
|
|
1487
2915
|
guardrails;
|
|
2916
|
+
inputSchema;
|
|
2917
|
+
mapInput;
|
|
1488
2918
|
constructor(options) {
|
|
1489
2919
|
this.name = options.name;
|
|
1490
2920
|
this.messages = options.messages;
|
|
@@ -1493,6 +2923,8 @@ var AIAgent = class {
|
|
|
1493
2923
|
this.id = options.id;
|
|
1494
2924
|
this.retryPolicy = options.retryPolicy ?? RetryPolicy.defaultForAiAgent;
|
|
1495
2925
|
this.guardrails = options.guardrails;
|
|
2926
|
+
this.inputSchema = options.inputSchema;
|
|
2927
|
+
this.mapInput = options.mapInput;
|
|
1496
2928
|
}
|
|
1497
2929
|
};
|
|
1498
2930
|
|
|
@@ -1643,6 +3075,62 @@ var HttpRequest = class {
|
|
|
1643
3075
|
}
|
|
1644
3076
|
};
|
|
1645
3077
|
|
|
3078
|
+
//#endregion
|
|
3079
|
+
//#region src/nodes/AggregateNode.ts
|
|
3080
|
+
let AggregateNode = class AggregateNode$1 {
|
|
3081
|
+
kind = "node";
|
|
3082
|
+
outputPorts = ["main"];
|
|
3083
|
+
async execute(items, ctx) {
|
|
3084
|
+
if (items.length === 0) return { main: [] };
|
|
3085
|
+
return { main: [{ json: await Promise.resolve(ctx.config.aggregate(items, ctx)) }] };
|
|
3086
|
+
}
|
|
3087
|
+
};
|
|
3088
|
+
AggregateNode = __decorate([node({ packageName: "@codemation/core-nodes" })], AggregateNode);
|
|
3089
|
+
|
|
3090
|
+
//#endregion
|
|
3091
|
+
//#region src/nodes/aggregate.ts
|
|
3092
|
+
var Aggregate = class {
|
|
3093
|
+
kind = "node";
|
|
3094
|
+
type = AggregateNode;
|
|
3095
|
+
execution = { hint: "local" };
|
|
3096
|
+
icon = "lucide:layers";
|
|
3097
|
+
constructor(name, aggregate, id) {
|
|
3098
|
+
this.name = name;
|
|
3099
|
+
this.aggregate = aggregate;
|
|
3100
|
+
this.id = id;
|
|
3101
|
+
}
|
|
3102
|
+
};
|
|
3103
|
+
|
|
3104
|
+
//#endregion
|
|
3105
|
+
//#region src/nodes/FilterNode.ts
|
|
3106
|
+
let FilterNode = class FilterNode$1 {
|
|
3107
|
+
kind = "node";
|
|
3108
|
+
outputPorts = ["main"];
|
|
3109
|
+
async execute(items, ctx) {
|
|
3110
|
+
const out = [];
|
|
3111
|
+
for (let i = 0; i < items.length; i++) {
|
|
3112
|
+
const item = items[i];
|
|
3113
|
+
if (ctx.config.predicate(item, i, items, ctx)) out.push(item);
|
|
3114
|
+
}
|
|
3115
|
+
return { main: out };
|
|
3116
|
+
}
|
|
3117
|
+
};
|
|
3118
|
+
FilterNode = __decorate([node({ packageName: "@codemation/core-nodes" })], FilterNode);
|
|
3119
|
+
|
|
3120
|
+
//#endregion
|
|
3121
|
+
//#region src/nodes/filter.ts
|
|
3122
|
+
var Filter = class {
|
|
3123
|
+
kind = "node";
|
|
3124
|
+
type = FilterNode;
|
|
3125
|
+
execution = { hint: "local" };
|
|
3126
|
+
icon = "lucide:filter";
|
|
3127
|
+
constructor(name, predicate, id) {
|
|
3128
|
+
this.name = name;
|
|
3129
|
+
this.predicate = predicate;
|
|
3130
|
+
this.id = id;
|
|
3131
|
+
}
|
|
3132
|
+
};
|
|
3133
|
+
|
|
1646
3134
|
//#endregion
|
|
1647
3135
|
//#region src/nodes/IfNode.ts
|
|
1648
3136
|
let IfNode = class IfNode$1 {
|
|
@@ -1695,6 +3183,45 @@ var If = class {
|
|
|
1695
3183
|
}
|
|
1696
3184
|
};
|
|
1697
3185
|
|
|
3186
|
+
//#endregion
|
|
3187
|
+
//#region src/nodes/SplitNode.ts
|
|
3188
|
+
let SplitNode = class SplitNode$1 {
|
|
3189
|
+
kind = "node";
|
|
3190
|
+
outputPorts = ["main"];
|
|
3191
|
+
async execute(items, ctx) {
|
|
3192
|
+
const out = [];
|
|
3193
|
+
for (let i = 0; i < items.length; i++) {
|
|
3194
|
+
const item = items[i];
|
|
3195
|
+
const elements = ctx.config.getElements(item, ctx);
|
|
3196
|
+
for (let j = 0; j < elements.length; j++) out.push({
|
|
3197
|
+
...item,
|
|
3198
|
+
json: elements[j]
|
|
3199
|
+
});
|
|
3200
|
+
}
|
|
3201
|
+
return { main: out };
|
|
3202
|
+
}
|
|
3203
|
+
};
|
|
3204
|
+
SplitNode = __decorate([node({ packageName: "@codemation/core-nodes" })], SplitNode);
|
|
3205
|
+
|
|
3206
|
+
//#endregion
|
|
3207
|
+
//#region src/nodes/split.ts
|
|
3208
|
+
var Split = class {
|
|
3209
|
+
kind = "node";
|
|
3210
|
+
type = SplitNode;
|
|
3211
|
+
execution = { hint: "local" };
|
|
3212
|
+
/**
|
|
3213
|
+
* When splitting yields zero items for a batch, downstream single-input nodes still run once with an empty batch.
|
|
3214
|
+
* Mirrors {@link MapData}'s empty-output behavior.
|
|
3215
|
+
*/
|
|
3216
|
+
continueWhenEmptyOutput = true;
|
|
3217
|
+
icon = "lucide:ungroup";
|
|
3218
|
+
constructor(name, getElements, id) {
|
|
3219
|
+
this.name = name;
|
|
3220
|
+
this.getElements = getElements;
|
|
3221
|
+
this.id = id;
|
|
3222
|
+
}
|
|
3223
|
+
};
|
|
3224
|
+
|
|
1698
3225
|
//#endregion
|
|
1699
3226
|
//#region src/nodes/ManualTriggerNode.ts
|
|
1700
3227
|
let ManualTriggerNode = class ManualTriggerNode$1 {
|
|
@@ -1707,8 +3234,8 @@ let ManualTriggerNode = class ManualTriggerNode$1 {
|
|
|
1707
3234
|
async execute(items, ctx) {
|
|
1708
3235
|
return { main: this.resolveManualItems(items, ctx.config) };
|
|
1709
3236
|
}
|
|
1710
|
-
resolveManualItems(items, config) {
|
|
1711
|
-
return items.length > 0 ? items : config.defaultItems ?? [];
|
|
3237
|
+
resolveManualItems(items, config$1) {
|
|
3238
|
+
return items.length > 0 ? items : config$1.defaultItems ?? [];
|
|
1712
3239
|
}
|
|
1713
3240
|
};
|
|
1714
3241
|
ManualTriggerNode = __decorate([node({ packageName: "@codemation/core-nodes" })], ManualTriggerNode);
|
|
@@ -1743,16 +3270,9 @@ var ManualTrigger = class ManualTrigger {
|
|
|
1743
3270
|
let MapDataNode = class MapDataNode$1 {
|
|
1744
3271
|
kind = "node";
|
|
1745
3272
|
outputPorts = ["main"];
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
const item = items[i];
|
|
1750
|
-
out.push({
|
|
1751
|
-
...item,
|
|
1752
|
-
json: ctx.config.map(item, ctx)
|
|
1753
|
-
});
|
|
1754
|
-
}
|
|
1755
|
-
return { main: out };
|
|
3273
|
+
inputSchema = unknown();
|
|
3274
|
+
async executeOne(args) {
|
|
3275
|
+
return args.ctx.config.map(args.item, args.ctx);
|
|
1756
3276
|
}
|
|
1757
3277
|
};
|
|
1758
3278
|
MapDataNode = __decorate([node({ packageName: "@codemation/core-nodes" })], MapDataNode);
|
|
@@ -1804,16 +3324,16 @@ let MergeNode = class MergeNode$1 {
|
|
|
1804
3324
|
for (let i = 0; i < maxLen; i++) {
|
|
1805
3325
|
const json = {};
|
|
1806
3326
|
const paired = [];
|
|
1807
|
-
let meta;
|
|
3327
|
+
let meta$2;
|
|
1808
3328
|
for (const k of order) {
|
|
1809
3329
|
const item = (inputsByPort[k] ?? [])[i];
|
|
1810
3330
|
json[k] = item?.json;
|
|
1811
3331
|
if (item?.paired) paired.push(...item.paired);
|
|
1812
|
-
if (!meta && item?.meta) meta = { ...item.meta };
|
|
3332
|
+
if (!meta$2 && item?.meta) meta$2 = { ...item.meta };
|
|
1813
3333
|
}
|
|
1814
3334
|
const merged = { json };
|
|
1815
3335
|
if (paired.length > 0) merged.paired = paired;
|
|
1816
|
-
if (meta) merged.meta = meta;
|
|
3336
|
+
if (meta$2) merged.meta = meta$2;
|
|
1817
3337
|
out$1.push(merged);
|
|
1818
3338
|
}
|
|
1819
3339
|
return { main: out$1 };
|
|
@@ -2069,8 +3589,8 @@ function registerCoreNodes(container) {}
|
|
|
2069
3589
|
|
|
2070
3590
|
//#endregion
|
|
2071
3591
|
//#region src/workflowBuilder.types.ts
|
|
2072
|
-
function createWorkflowBuilder(meta) {
|
|
2073
|
-
return new WorkflowBuilder(meta, { makeMergeNode: (name) => new Merge(name, {
|
|
3592
|
+
function createWorkflowBuilder(meta$2) {
|
|
3593
|
+
return new WorkflowBuilder(meta$2, { makeMergeNode: (name) => new Merge(name, {
|
|
2074
3594
|
mode: "passThrough",
|
|
2075
3595
|
prefer: ["true", "false"]
|
|
2076
3596
|
}) });
|
|
@@ -2142,8 +3662,8 @@ var WorkflowBranchBuilder = class WorkflowBranchBuilder {
|
|
|
2142
3662
|
constructor(steps = []) {
|
|
2143
3663
|
this.steps = steps;
|
|
2144
3664
|
}
|
|
2145
|
-
then(config) {
|
|
2146
|
-
return new WorkflowBranchBuilder([...this.steps, config]);
|
|
3665
|
+
then(config$1) {
|
|
3666
|
+
return new WorkflowBranchBuilder([...this.steps, config$1]);
|
|
2147
3667
|
}
|
|
2148
3668
|
map(nameOrMapper, mapperOrUndefined, id) {
|
|
2149
3669
|
const name = typeof nameOrMapper === "string" ? nameOrMapper : "Map data";
|
|
@@ -2158,9 +3678,9 @@ var WorkflowBranchBuilder = class WorkflowBranchBuilder {
|
|
|
2158
3678
|
agent(nameOrOptions, optionsOrUndefined) {
|
|
2159
3679
|
return this.then(WorkflowAgentNodeFactory.create(nameOrOptions, optionsOrUndefined));
|
|
2160
3680
|
}
|
|
2161
|
-
node(definitionOrKey, config, name, id) {
|
|
3681
|
+
node(definitionOrKey, config$1, name, id) {
|
|
2162
3682
|
const definition = WorkflowDefinedNodeResolver.resolve(definitionOrKey);
|
|
2163
|
-
return this.then(definition.create(config, name, id));
|
|
3683
|
+
return this.then(definition.create(config$1, name, id));
|
|
2164
3684
|
}
|
|
2165
3685
|
getSteps() {
|
|
2166
3686
|
return this.steps;
|
|
@@ -2173,8 +3693,8 @@ var WorkflowChain = class WorkflowChain {
|
|
|
2173
3693
|
constructor(chain) {
|
|
2174
3694
|
this.chain = chain;
|
|
2175
3695
|
}
|
|
2176
|
-
then(config) {
|
|
2177
|
-
return new WorkflowChain(this.chain.then(config));
|
|
3696
|
+
then(config$1) {
|
|
3697
|
+
return new WorkflowChain(this.chain.then(config$1));
|
|
2178
3698
|
}
|
|
2179
3699
|
map(nameOrMapper, mapperOrUndefined, id) {
|
|
2180
3700
|
const name = typeof nameOrMapper === "string" ? nameOrMapper : "Map data";
|
|
@@ -2201,9 +3721,9 @@ var WorkflowChain = class WorkflowChain {
|
|
|
2201
3721
|
agent(nameOrOptions, optionsOrUndefined) {
|
|
2202
3722
|
return this.then(WorkflowAgentNodeFactory.create(nameOrOptions, optionsOrUndefined));
|
|
2203
3723
|
}
|
|
2204
|
-
node(definitionOrKey, config, name, id) {
|
|
3724
|
+
node(definitionOrKey, config$1, name, id) {
|
|
2205
3725
|
const definition = WorkflowDefinedNodeResolver.resolve(definitionOrKey);
|
|
2206
|
-
return this.then(definition.create(config, name, id));
|
|
3726
|
+
return this.then(definition.create(config$1, name, id));
|
|
2207
3727
|
}
|
|
2208
3728
|
build() {
|
|
2209
3729
|
return this.chain.build();
|
|
@@ -2332,5 +3852,5 @@ var ConnectionCredentialNodeConfigFactory = class {
|
|
|
2332
3852
|
};
|
|
2333
3853
|
|
|
2334
3854
|
//#endregion
|
|
2335
|
-
export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentToolCallPortMap, Callback, CallbackNode, CallbackResultNormalizer, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, HttpRequest, HttpRequestNode, If, IfNode, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, Merge, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, SubWorkflow, SubWorkflowNode, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, createWorkflowBuilder, openAiChatModelPresets, registerCoreNodes, workflow };
|
|
3855
|
+
export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentToolCallPortMap, Aggregate, AggregateNode, Callback, CallbackNode, CallbackResultNormalizer, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, Filter, FilterNode, HttpRequest, HttpRequestNode, If, IfNode, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, Merge, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, Split, SplitNode, SubWorkflow, SubWorkflowNode, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, createWorkflowBuilder, openAiChatModelPresets, registerCoreNodes, workflow };
|
|
2336
3856
|
//# sourceMappingURL=index.js.map
|