@codemation/core-nodes 1.0.2 → 1.1.0

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/dist/index.cjs +2851 -63
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +1556 -684
  5. package/dist/index.d.ts +1556 -684
  6. package/dist/index.js +2796 -49
  7. package/dist/index.js.map +1 -1
  8. package/package.json +5 -3
  9. package/src/authoring/defineRestNode.types.ts +204 -0
  10. package/src/credentials/ApiKeyCredentialType.ts +60 -0
  11. package/src/credentials/BasicAuthCredentialType.ts +51 -0
  12. package/src/credentials/BearerTokenCredentialType.ts +40 -0
  13. package/src/credentials/OAuth2ClientCredentialsTypeFactory.ts +117 -0
  14. package/src/credentials/OAuth2TokenExchangeFactory.ts +52 -0
  15. package/src/credentials/index.ts +4 -0
  16. package/src/http/HttpBodyBuilder.ts +90 -0
  17. package/src/http/HttpRequestExecutor.ts +150 -0
  18. package/src/http/HttpUrlBuilder.ts +22 -0
  19. package/src/http/httpRequest.types.ts +69 -0
  20. package/src/index.ts +9 -0
  21. package/src/nodes/AssertionNode.ts +42 -0
  22. package/src/nodes/CronTriggerFactory.ts +45 -0
  23. package/src/nodes/CronTriggerNode.ts +40 -0
  24. package/src/nodes/HttpRequestNodeFactory.ts +99 -23
  25. package/src/nodes/IsTestRunNode.ts +25 -0
  26. package/src/nodes/TestTriggerNode.ts +33 -0
  27. package/src/nodes/assertion.ts +42 -0
  28. package/src/nodes/collections/collectionDeleteNode.types.ts +23 -0
  29. package/src/nodes/collections/collectionFindOneNode.types.ts +26 -0
  30. package/src/nodes/collections/collectionGetNode.types.ts +26 -0
  31. package/src/nodes/collections/collectionInsertNode.types.ts +22 -0
  32. package/src/nodes/collections/collectionListNode.types.ts +30 -0
  33. package/src/nodes/collections/collectionUpdateNode.types.ts +23 -0
  34. package/src/nodes/collections/index.ts +6 -0
  35. package/src/nodes/httpRequest.ts +61 -1
  36. package/src/nodes/isTestRun.ts +24 -0
  37. package/src/nodes/testTrigger.ts +72 -0
package/dist/index.cjs CHANGED
@@ -29,7 +29,527 @@ let __codemation_core_bootstrap = require("@codemation/core/bootstrap");
29
29
  __codemation_core_bootstrap = __toESM(__codemation_core_bootstrap);
30
30
  let ai = require("ai");
31
31
  ai = __toESM(ai);
32
+ let croner = require("croner");
33
+ croner = __toESM(croner);
32
34
 
35
+ //#region src/credentials/ApiKeyCredentialType.ts
36
+ /**
37
+ * API key credential that injects a key either as an HTTP header or a query parameter.
38
+ */
39
+ const apiKeyCredentialType = (0, __codemation_core.defineCredential)({
40
+ key: "core-nodes.api-key",
41
+ label: "API Key",
42
+ description: "Authenticates requests by injecting an API key into a header or query parameter.",
43
+ public: {
44
+ placement: {
45
+ label: "Placement",
46
+ type: "string",
47
+ helpText: "Where to send the key: \"header\" (default) or \"query\".",
48
+ placeholder: "header"
49
+ },
50
+ name: {
51
+ label: "Parameter name",
52
+ type: "string",
53
+ helpText: "Header or query param name. Defaults to \"X-API-Key\" for headers, \"api_key\" for query.",
54
+ placeholder: "X-API-Key"
55
+ }
56
+ },
57
+ secret: { apiKey: {
58
+ label: "API Key",
59
+ type: "password",
60
+ required: true,
61
+ helpText: "The secret API key value."
62
+ } },
63
+ async createSession(args) {
64
+ const apiKey = String(args.material.apiKey ?? "");
65
+ if (!apiKey) throw new Error("API key credential material is incomplete: apiKey is required.");
66
+ const isQuery = String(args.publicConfig.placement ?? "header").toLowerCase() === "query";
67
+ const defaultName = isQuery ? "api_key" : "X-API-Key";
68
+ const paramName = String(args.publicConfig.name ?? "").trim() || defaultName;
69
+ return { applyToRequest: (_spec) => {
70
+ if (isQuery) return { query: { [paramName]: apiKey } };
71
+ return { headers: { [paramName]: apiKey } };
72
+ } };
73
+ },
74
+ async test(args) {
75
+ const apiKey = String(args.material.apiKey ?? "");
76
+ return {
77
+ status: apiKey.length > 0 ? "healthy" : "failing",
78
+ message: apiKey.length > 0 ? "API key is configured." : "API key is missing.",
79
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
80
+ };
81
+ }
82
+ });
83
+
84
+ //#endregion
85
+ //#region src/credentials/BasicAuthCredentialType.ts
86
+ /**
87
+ * HTTP Basic authentication credential.
88
+ * Session sets `Authorization: Basic <base64(username:password)>`.
89
+ */
90
+ const basicAuthCredentialType = (0, __codemation_core.defineCredential)({
91
+ key: "core-nodes.basic-auth",
92
+ label: "Basic Auth",
93
+ description: "Authenticates requests using HTTP Basic Authentication (username + password).",
94
+ public: { username: {
95
+ label: "Username",
96
+ type: "string",
97
+ required: true,
98
+ helpText: "The username for HTTP Basic Authentication."
99
+ } },
100
+ secret: { password: {
101
+ label: "Password",
102
+ type: "password",
103
+ required: true,
104
+ helpText: "The password for HTTP Basic Authentication."
105
+ } },
106
+ async createSession(args) {
107
+ const username = String(args.publicConfig.username ?? "");
108
+ const password = String(args.material.password ?? "");
109
+ if (!username) throw new Error("Basic Auth credential is incomplete: username is required.");
110
+ const encoded = Buffer.from(`${username}:${password}`).toString("base64");
111
+ return { applyToRequest: (_spec) => ({ headers: { authorization: `Basic ${encoded}` } }) };
112
+ },
113
+ async test(args) {
114
+ const username = String(args.publicConfig.username ?? "");
115
+ const password = String(args.material.password ?? "");
116
+ const ok = username.length > 0 && password.length > 0;
117
+ return {
118
+ status: ok ? "healthy" : "failing",
119
+ message: ok ? "Basic Auth credentials are configured." : "Username or password is missing.",
120
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
121
+ };
122
+ }
123
+ });
124
+
125
+ //#endregion
126
+ //#region src/credentials/BearerTokenCredentialType.ts
127
+ /**
128
+ * Simple Bearer token credential.
129
+ * Session sets `Authorization: Bearer <token>` on every request.
130
+ */
131
+ const bearerTokenCredentialType = (0, __codemation_core.defineCredential)({
132
+ key: "core-nodes.bearer-token",
133
+ label: "Bearer Token",
134
+ description: "Authenticates requests using a static Bearer token in the Authorization header.",
135
+ public: {},
136
+ secret: { token: {
137
+ label: "Token",
138
+ type: "password",
139
+ required: true,
140
+ helpText: "The Bearer token to include in the Authorization header."
141
+ } },
142
+ async createSession(args) {
143
+ const token = String(args.material.token ?? "");
144
+ if (!token) throw new Error("Bearer token credential material is incomplete: token is required.");
145
+ return { applyToRequest: (_spec) => ({ headers: { authorization: `Bearer ${token}` } }) };
146
+ },
147
+ async test(args) {
148
+ const token = String(args.material.token ?? "");
149
+ return {
150
+ status: token.length > 0 ? "healthy" : "failing",
151
+ message: token.length > 0 ? "Bearer token is configured." : "Token is missing.",
152
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
153
+ };
154
+ }
155
+ });
156
+
157
+ //#endregion
158
+ //#region src/credentials/OAuth2TokenExchangeFactory.ts
159
+ var OAuth2TokenExchangeFactory = class {
160
+ async create(args) {
161
+ const body = new URLSearchParams({
162
+ grant_type: "client_credentials",
163
+ client_id: args.clientId
164
+ });
165
+ if (args.scopes) body.set("scope", args.scopes);
166
+ if (args.audience) body.set("audience", args.audience);
167
+ const encoded = Buffer.from(`${args.clientId}:${args.clientSecret}`).toString("base64");
168
+ const response = await globalThis.fetch(args.tokenUrl, {
169
+ method: "POST",
170
+ headers: {
171
+ "content-type": "application/x-www-form-urlencoded",
172
+ authorization: `Basic ${encoded}`
173
+ },
174
+ body: body.toString()
175
+ });
176
+ if (!response.ok) {
177
+ const text = await response.text().catch(() => "");
178
+ throw new Error(`Token exchange failed (${response.status} ${response.statusText}): ${text}`);
179
+ }
180
+ const json = await response.json();
181
+ const token = String(json["access_token"] ?? "");
182
+ if (!token) throw new Error("Token exchange response did not include an access_token.");
183
+ return token;
184
+ }
185
+ };
186
+
187
+ //#endregion
188
+ //#region src/credentials/OAuth2ClientCredentialsTypeFactory.ts
189
+ /**
190
+ * OAuth2 client-credentials flow credential.
191
+ *
192
+ * This is a machine-to-machine flow: no user redirect occurs. The session
193
+ * POSTs to the configured `tokenUrl` with `client_credentials` grant, caches
194
+ * the resulting access token for the duration of the session, and injects it
195
+ * as `Authorization: Bearer <token>` on each request.
196
+ *
197
+ * Token caching is per-session only (one createSession call = one token fetch
198
+ * at most). Cross-session caching would require host-level state and is out of
199
+ * scope here. Because the engine creates a fresh session per execution, a new
200
+ * token is fetched once per node activation.
201
+ *
202
+ * NOTE: `auth` is intentionally omitted from the definition. The OAuth2
203
+ * `auth: { kind: "oauth2" }` shape signals an authorization-code / user-redirect
204
+ * flow; using it here would cause the host UI to render an OAuth consent button
205
+ * that goes nowhere. Client-credentials is a purely server-side flow.
206
+ */
207
+ const oauth2ClientCredentialsType = (0, __codemation_core.defineCredential)({
208
+ key: "core-nodes.oauth2-client-credentials",
209
+ label: "OAuth2 Client Credentials",
210
+ description: "Machine-to-machine OAuth2 using the client_credentials grant. Exchanges client ID and secret for a bearer token before each workflow execution.",
211
+ public: {
212
+ tokenUrl: {
213
+ label: "Token URL",
214
+ type: "string",
215
+ required: true,
216
+ helpText: "The token endpoint URL, e.g. https://auth.example.com/oauth/token."
217
+ },
218
+ scopes: {
219
+ label: "Scopes",
220
+ type: "string",
221
+ helpText: "Space-separated list of OAuth2 scopes to request (optional)."
222
+ },
223
+ audience: {
224
+ label: "Audience",
225
+ type: "string",
226
+ helpText: "Optional audience parameter sent to the token endpoint.",
227
+ visibility: "advanced"
228
+ }
229
+ },
230
+ secret: {
231
+ clientId: {
232
+ label: "Client ID",
233
+ type: "string",
234
+ required: true
235
+ },
236
+ clientSecret: {
237
+ label: "Client Secret",
238
+ type: "password",
239
+ required: true
240
+ }
241
+ },
242
+ async createSession(args) {
243
+ const tokenUrl = String(args.publicConfig.tokenUrl ?? "");
244
+ const clientId = String(args.material.clientId ?? "");
245
+ const clientSecret = String(args.material.clientSecret ?? "");
246
+ if (!tokenUrl || !clientId || !clientSecret) throw new Error("OAuth2 client credentials are incomplete: tokenUrl, clientId, and clientSecret are required.");
247
+ const accessToken = await new OAuth2TokenExchangeFactory().create({
248
+ tokenUrl,
249
+ clientId,
250
+ clientSecret,
251
+ scopes: String(args.publicConfig.scopes ?? ""),
252
+ audience: String(args.publicConfig.audience ?? "")
253
+ });
254
+ return { applyToRequest: (_spec) => ({ headers: { authorization: `Bearer ${accessToken}` } }) };
255
+ },
256
+ async test(args) {
257
+ const tokenUrl = String(args.publicConfig.tokenUrl ?? "");
258
+ const clientId = String(args.material.clientId ?? "");
259
+ const clientSecret = String(args.material.clientSecret ?? "");
260
+ if (!tokenUrl || !clientId || !clientSecret) return {
261
+ status: "failing",
262
+ message: "tokenUrl, clientId, and clientSecret are all required.",
263
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
264
+ };
265
+ try {
266
+ await new OAuth2TokenExchangeFactory().create({
267
+ tokenUrl,
268
+ clientId,
269
+ clientSecret,
270
+ scopes: String(args.publicConfig.scopes ?? ""),
271
+ audience: String(args.publicConfig.audience ?? "")
272
+ });
273
+ return {
274
+ status: "healthy",
275
+ message: "Token exchange succeeded.",
276
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
277
+ };
278
+ } catch (error) {
279
+ return {
280
+ status: "failing",
281
+ message: error instanceof Error ? error.message : String(error),
282
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
283
+ };
284
+ }
285
+ }
286
+ });
287
+
288
+ //#endregion
289
+ //#region src/http/HttpRequestExecutor.ts
290
+ /**
291
+ * Executes a single HTTP request described by {@link HttpRequestSpec}.
292
+ *
293
+ * - Credential sessions provide header/query deltas via `applyToRequest`.
294
+ * - Body encoding is delegated to {@link HttpBodyBuilder}.
295
+ * - URL query merging is delegated to {@link HttpUrlBuilder}.
296
+ * - Binary response bodies: when `download.mode` triggers binary attach, the
297
+ * `bodyBinaryName` field is set in the result but the body is NOT read here.
298
+ * Callers that need binary attachment should use `buildRequest` to get the
299
+ * resolved URL + init and make the fetch + binary attach themselves.
300
+ *
301
+ * Collaborators (`fetch`, body builder, url builder) are injected so callers
302
+ * own construction at composition roots and tests can supply deterministic stubs.
303
+ */
304
+ var HttpRequestExecutor = class {
305
+ constructor(fetchFn, bodyBuilder, urlBuilder) {
306
+ this.fetchFn = fetchFn;
307
+ this.bodyBuilder = bodyBuilder;
308
+ this.urlBuilder = urlBuilder;
309
+ }
310
+ /**
311
+ * Builds the fetch init (headers, query, body) from the spec + credential delta,
312
+ * returning both the resolved URL and the RequestInit so callers can make the
313
+ * actual fetch call themselves (useful for streaming / binary attach).
314
+ */
315
+ async buildRequest(spec, item) {
316
+ const credentialDelta = spec.credential?.applyToRequest(spec) ?? {};
317
+ const mergedHeaders = {
318
+ ...spec.headers ?? {},
319
+ ...credentialDelta.headers ?? {}
320
+ };
321
+ const mergedQuery = {
322
+ ...spec.query ?? {},
323
+ ...credentialDelta.query ?? {}
324
+ };
325
+ const encodedBody = await this.bodyBuilder.build(spec.body, item, spec.ctx);
326
+ if (encodedBody && encodedBody.contentType) mergedHeaders["content-type"] = encodedBody.contentType;
327
+ return {
328
+ url: this.urlBuilder.build(spec.url, mergedQuery),
329
+ init: {
330
+ method: spec.method,
331
+ headers: mergedHeaders,
332
+ ...encodedBody ? { body: encodedBody.body } : {}
333
+ }
334
+ };
335
+ }
336
+ /**
337
+ * Executes an HTTP request and returns parsed result.
338
+ * For binary downloads (when `shouldAttachBody` is true), the body is NOT consumed
339
+ * and callers must call `ctx.binary.attach` directly using the resolved URL + init
340
+ * (available via `buildRequest`).
341
+ */
342
+ async execute(spec, item) {
343
+ const { url: resolvedUrl, init } = await this.buildRequest(spec, item);
344
+ const response = await this.fetchFn(resolvedUrl, init);
345
+ const responseHeaders = this.readHeaders(response.headers);
346
+ const mimeType = this.resolveMimeType(responseHeaders);
347
+ const downloadMode = spec.download?.mode ?? "auto";
348
+ const binaryName = spec.download?.binaryName ?? "body";
349
+ const shouldDownload = this.shouldAttachBody(downloadMode, mimeType);
350
+ const isJson = this.isJsonMimeType(mimeType);
351
+ let json;
352
+ let text;
353
+ let bodyBinaryName;
354
+ if (shouldDownload) bodyBinaryName = binaryName;
355
+ else if (isJson) try {
356
+ json = await response.json();
357
+ } catch {
358
+ text = await response.text();
359
+ }
360
+ else text = await response.text();
361
+ return {
362
+ url: resolvedUrl,
363
+ method: spec.method.toUpperCase(),
364
+ status: response.status,
365
+ ok: response.ok,
366
+ statusText: response.statusText,
367
+ mimeType,
368
+ headers: responseHeaders,
369
+ ...json !== void 0 ? { json } : {},
370
+ ...text !== void 0 ? { text } : {},
371
+ ...bodyBinaryName !== void 0 ? { bodyBinaryName } : {}
372
+ };
373
+ }
374
+ readHeaders(headers) {
375
+ const values = {};
376
+ headers.forEach((value, key) => {
377
+ values[key] = value;
378
+ });
379
+ return values;
380
+ }
381
+ resolveMimeType(headers) {
382
+ const contentType = headers["content-type"];
383
+ if (!contentType) return "application/octet-stream";
384
+ return contentType.split(";")[0]?.trim() || "application/octet-stream";
385
+ }
386
+ isJsonMimeType(mimeType) {
387
+ return mimeType === "application/json" || mimeType.endsWith("+json");
388
+ }
389
+ shouldAttachBody(mode, mimeType) {
390
+ if (mode === "always") return true;
391
+ if (mode === "never") return false;
392
+ return mimeType.startsWith("image/") || mimeType.startsWith("audio/") || mimeType.startsWith("video/") || mimeType === "application/pdf";
393
+ }
394
+ };
395
+
396
+ //#endregion
397
+ //#region src/http/HttpBodyBuilder.ts
398
+ /**
399
+ * Builds a fetch-compatible `BodyInit` + Content-Type pair from an {@link HttpBodySpec}.
400
+ * Multipart binaries are read from `item.binary` via `ctx.binary.openReadStream`.
401
+ */
402
+ var HttpBodyBuilder = class {
403
+ async build(spec, item, ctx) {
404
+ if (!spec || spec.kind === "none") return;
405
+ if (spec.kind === "json") return {
406
+ body: JSON.stringify(spec.data),
407
+ contentType: "application/json"
408
+ };
409
+ if (spec.kind === "form") {
410
+ const params = new URLSearchParams();
411
+ for (const [key, value] of Object.entries(spec.data)) params.append(key, value);
412
+ return {
413
+ body: params.toString(),
414
+ contentType: "application/x-www-form-urlencoded"
415
+ };
416
+ }
417
+ if (spec.kind === "multipart") {
418
+ const formData = new FormData();
419
+ for (const [key, value] of Object.entries(spec.fields)) formData.append(key, value);
420
+ if (spec.binaries) for (const [fieldName, binaryRef] of Object.entries(spec.binaries)) {
421
+ const attachment = item.binary?.[binaryRef];
422
+ if (attachment) {
423
+ const readResult = await ctx.binary.openReadStream(attachment);
424
+ if (readResult) {
425
+ const reader = readResult.body.getReader();
426
+ const chunks = [];
427
+ let done = false;
428
+ while (!done) {
429
+ const result = await reader.read();
430
+ done = result.done;
431
+ if (result.value) chunks.push(result.value);
432
+ }
433
+ const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
434
+ const merged = new Uint8Array(totalLength);
435
+ let offset = 0;
436
+ for (const chunk of chunks) {
437
+ merged.set(chunk, offset);
438
+ offset += chunk.length;
439
+ }
440
+ const blob = new Blob([merged], { type: attachment.mimeType });
441
+ formData.append(fieldName, blob, attachment.filename ?? binaryRef);
442
+ }
443
+ }
444
+ }
445
+ return {
446
+ body: formData,
447
+ contentType: ""
448
+ };
449
+ }
450
+ }
451
+ };
452
+
453
+ //#endregion
454
+ //#region src/http/HttpUrlBuilder.ts
455
+ /**
456
+ * Merges query parameters into a base URL.
457
+ * Handles both scalar and array values, and preserves any existing params.
458
+ */
459
+ var HttpUrlBuilder = class {
460
+ build(baseUrl, query) {
461
+ if (!query || Object.keys(query).length === 0) return baseUrl;
462
+ const parsed = new URL(baseUrl);
463
+ for (const [key, value] of Object.entries(query)) if (Array.isArray(value)) for (const entry of value) parsed.searchParams.append(key, entry);
464
+ else parsed.searchParams.append(key, value);
465
+ return parsed.toString();
466
+ }
467
+ };
468
+
469
+ //#endregion
470
+ //#region src/authoring/defineRestNode.types.ts
471
+ /**
472
+ * Substitutes `{name}` placeholders in a path template using values from `params`.
473
+ */
474
+ function substitutePath(template, params) {
475
+ return template.replace(/\{([^}]+)}/g, (_match, key) => {
476
+ const value = params[key];
477
+ return value !== void 0 ? String(value) : `{${key}}`;
478
+ });
479
+ }
480
+ /**
481
+ * Declarative helper for creating thin API-wrapper nodes.
482
+ *
483
+ * Usage:
484
+ * ```ts
485
+ * export const postMessage = defineRestNode({
486
+ * key: "slack.post-message",
487
+ * title: "Send Slack message",
488
+ * icon: "si:slack",
489
+ * api: { baseUrl: "https://slack.com/api", path: "/chat.postMessage", method: "POST" },
490
+ * credentials: { auth: bearerTokenCredentialType },
491
+ * inputSchema: z.object({ channel: z.string(), text: z.string() }),
492
+ * request: ({ input }) => ({
493
+ * body: { kind: "json", data: { channel: input.channel, text: input.text } },
494
+ * }),
495
+ * response: ({ json }) => ({ messageTs: (json as any).ts }),
496
+ * });
497
+ * ```
498
+ *
499
+ * - `defineRestNode` is a thin wrapper over `defineNode`; it does not introduce a new runtime kind.
500
+ * - Credential sessions are resolved via the `credentials` binding map (same as `defineNode`).
501
+ * - Path `{placeholder}` substitution is applied from `input` keys before the request is made.
502
+ * - Non-2xx responses throw an `Error` by default (`errorPolicy: "throw"`).
503
+ */
504
+ function defineRestNode(options) {
505
+ const errorPolicy = options.errorPolicy ?? "throw";
506
+ return (0, __codemation_core.defineNode)({
507
+ key: options.key,
508
+ title: options.title,
509
+ description: options.description,
510
+ icon: options.icon,
511
+ credentials: options.credentials,
512
+ inputSchema: options.inputSchema,
513
+ async execute({ input, item, ctx }, { credentials }) {
514
+ const credentialSlot = options.credentials ? Object.keys(options.credentials)[0] : void 0;
515
+ const credential = credentialSlot ? await credentials[credentialSlot]?.() : void 0;
516
+ const inputRecord = input ?? {};
517
+ const requestShape = options.request ? await options.request({ input }) : {};
518
+ const pathParams = {
519
+ ...inputRecord,
520
+ ...requestShape.pathParams ?? {}
521
+ };
522
+ const resolvedPath = substitutePath(options.api.path, pathParams);
523
+ const resolvedUrl = `${options.api.baseUrl}${resolvedPath}`;
524
+ const result = await new HttpRequestExecutor(globalThis.fetch, new HttpBodyBuilder(), new HttpUrlBuilder()).execute({
525
+ url: resolvedUrl,
526
+ method: (options.api.method ?? "GET").toUpperCase(),
527
+ headers: requestShape.headers,
528
+ query: requestShape.query,
529
+ body: requestShape.body,
530
+ credential,
531
+ ctx
532
+ }, item);
533
+ if (errorPolicy === "throw" && !result.ok) throw new Error(`HTTP ${result.status} ${result.statusText} for ${result.method} ${result.url}`);
534
+ const responseCtx = {
535
+ status: result.status,
536
+ ok: result.ok,
537
+ statusText: result.statusText,
538
+ mimeType: result.mimeType,
539
+ headers: result.headers,
540
+ ...result.json !== void 0 ? { json: result.json } : {},
541
+ ...result.text !== void 0 ? { text: result.text } : {}
542
+ };
543
+ if (options.response) return await options.response({
544
+ ...responseCtx,
545
+ input
546
+ });
547
+ return { json: responseCtx };
548
+ }
549
+ });
550
+ }
551
+
552
+ //#endregion
33
553
  //#region \0@oxc-project+runtime@0.95.0/helpers/decorate.js
34
554
  function __decorate(decorators, target, key, desc) {
35
555
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -148,10 +668,21 @@ function cleanRegex(source) {
148
668
  const end = source.endsWith("$") ? source.length - 1 : source.length;
149
669
  return source.slice(start, end);
150
670
  }
671
+ function floatSafeRemainder(val, step) {
672
+ const valDecCount = (val.toString().split(".")[1] || "").length;
673
+ const stepString = step.toString();
674
+ let stepDecCount = (stepString.split(".")[1] || "").length;
675
+ if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
676
+ const match = stepString.match(/\d?e-(\d?)/);
677
+ if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
678
+ }
679
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
680
+ return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
681
+ }
151
682
  const EVALUATING = Symbol("evaluating");
152
- function defineLazy(object, key, getter) {
683
+ function defineLazy(object$1, key, getter) {
153
684
  let value = void 0;
154
- Object.defineProperty(object, key, {
685
+ Object.defineProperty(object$1, key, {
155
686
  get() {
156
687
  if (value === EVALUATING) return;
157
688
  if (value === void 0) {
@@ -161,11 +692,19 @@ function defineLazy(object, key, getter) {
161
692
  return value;
162
693
  },
163
694
  set(v) {
164
- Object.defineProperty(object, key, { value: v });
695
+ Object.defineProperty(object$1, key, { value: v });
165
696
  },
166
697
  configurable: true
167
698
  });
168
699
  }
700
+ function assignProp(target, prop, value) {
701
+ Object.defineProperty(target, prop, {
702
+ value,
703
+ writable: true,
704
+ enumerable: true,
705
+ configurable: true
706
+ });
707
+ }
169
708
  function mergeDefs(...defs) {
170
709
  const mergedDescriptors = {};
171
710
  for (const def of defs) {
@@ -174,6 +713,12 @@ function mergeDefs(...defs) {
174
713
  }
175
714
  return Object.defineProperties({}, mergedDescriptors);
176
715
  }
716
+ function esc(str) {
717
+ return JSON.stringify(str);
718
+ }
719
+ function slugify(input) {
720
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
721
+ }
177
722
  const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
178
723
  function isObject(data) {
179
724
  return typeof data === "object" && data !== null && !Array.isArray(data);
@@ -202,6 +747,14 @@ function shallowClone(o) {
202
747
  if (Array.isArray(o)) return [...o];
203
748
  return o;
204
749
  }
750
+ const propertyKeyTypes = new Set([
751
+ "string",
752
+ "number",
753
+ "symbol"
754
+ ]);
755
+ function escapeRegex(str) {
756
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
757
+ }
205
758
  function clone(inst, def, params) {
206
759
  const cl = new inst._zod.constr(def ?? inst._zod.def);
207
760
  if (!def || params?.parent) cl._zod.parent = inst;
@@ -222,6 +775,11 @@ function normalizeParams(_params) {
222
775
  };
223
776
  return params;
224
777
  }
778
+ function optionalKeys(shape) {
779
+ return Object.keys(shape).filter((k) => {
780
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
781
+ });
782
+ }
225
783
  const NUMBER_FORMAT_RANGES = {
226
784
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
227
785
  int32: [-2147483648, 2147483647],
@@ -229,6 +787,130 @@ const NUMBER_FORMAT_RANGES = {
229
787
  float32: [-34028234663852886e22, 34028234663852886e22],
230
788
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
231
789
  };
790
+ function pick(schema, mask) {
791
+ const currDef = schema._zod.def;
792
+ const checks = currDef.checks;
793
+ if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
794
+ return clone(schema, mergeDefs(schema._zod.def, {
795
+ get shape() {
796
+ const newShape = {};
797
+ for (const key in mask) {
798
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
799
+ if (!mask[key]) continue;
800
+ newShape[key] = currDef.shape[key];
801
+ }
802
+ assignProp(this, "shape", newShape);
803
+ return newShape;
804
+ },
805
+ checks: []
806
+ }));
807
+ }
808
+ function omit(schema, mask) {
809
+ const currDef = schema._zod.def;
810
+ const checks = currDef.checks;
811
+ if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
812
+ return clone(schema, mergeDefs(schema._zod.def, {
813
+ get shape() {
814
+ const newShape = { ...schema._zod.def.shape };
815
+ for (const key in mask) {
816
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
817
+ if (!mask[key]) continue;
818
+ delete newShape[key];
819
+ }
820
+ assignProp(this, "shape", newShape);
821
+ return newShape;
822
+ },
823
+ checks: []
824
+ }));
825
+ }
826
+ function extend(schema, shape) {
827
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
828
+ const checks = schema._zod.def.checks;
829
+ if (checks && checks.length > 0) {
830
+ const existingShape = schema._zod.def.shape;
831
+ for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
832
+ }
833
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
834
+ const _shape = {
835
+ ...schema._zod.def.shape,
836
+ ...shape
837
+ };
838
+ assignProp(this, "shape", _shape);
839
+ return _shape;
840
+ } }));
841
+ }
842
+ function safeExtend(schema, shape) {
843
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
844
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
845
+ const _shape = {
846
+ ...schema._zod.def.shape,
847
+ ...shape
848
+ };
849
+ assignProp(this, "shape", _shape);
850
+ return _shape;
851
+ } }));
852
+ }
853
+ function merge(a, b) {
854
+ return clone(a, mergeDefs(a._zod.def, {
855
+ get shape() {
856
+ const _shape = {
857
+ ...a._zod.def.shape,
858
+ ...b._zod.def.shape
859
+ };
860
+ assignProp(this, "shape", _shape);
861
+ return _shape;
862
+ },
863
+ get catchall() {
864
+ return b._zod.def.catchall;
865
+ },
866
+ checks: []
867
+ }));
868
+ }
869
+ function partial(Class, schema, mask) {
870
+ const checks = schema._zod.def.checks;
871
+ if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
872
+ return clone(schema, mergeDefs(schema._zod.def, {
873
+ get shape() {
874
+ const oldShape = schema._zod.def.shape;
875
+ const shape = { ...oldShape };
876
+ if (mask) for (const key in mask) {
877
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
878
+ if (!mask[key]) continue;
879
+ shape[key] = Class ? new Class({
880
+ type: "optional",
881
+ innerType: oldShape[key]
882
+ }) : oldShape[key];
883
+ }
884
+ else for (const key in oldShape) shape[key] = Class ? new Class({
885
+ type: "optional",
886
+ innerType: oldShape[key]
887
+ }) : oldShape[key];
888
+ assignProp(this, "shape", shape);
889
+ return shape;
890
+ },
891
+ checks: []
892
+ }));
893
+ }
894
+ function required(Class, schema, mask) {
895
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
896
+ const oldShape = schema._zod.def.shape;
897
+ const shape = { ...oldShape };
898
+ if (mask) for (const key in mask) {
899
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
900
+ if (!mask[key]) continue;
901
+ shape[key] = new Class({
902
+ type: "nonoptional",
903
+ innerType: oldShape[key]
904
+ });
905
+ }
906
+ else for (const key in oldShape) shape[key] = new Class({
907
+ type: "nonoptional",
908
+ innerType: oldShape[key]
909
+ });
910
+ assignProp(this, "shape", shape);
911
+ return shape;
912
+ } }));
913
+ }
232
914
  function aborted(x, startIndex = 0) {
233
915
  if (x.aborted === true) return true;
234
916
  for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
@@ -434,6 +1116,64 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
434
1116
  };
435
1117
  const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
436
1118
 
1119
+ //#endregion
1120
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js
1121
+ const cuid = /^[cC][^\s-]{8,}$/;
1122
+ const cuid2 = /^[0-9a-z]+$/;
1123
+ const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
1124
+ const xid = /^[0-9a-vA-V]{20}$/;
1125
+ const ksuid = /^[A-Za-z0-9]{27}$/;
1126
+ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
1127
+ /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
1128
+ const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
1129
+ /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
1130
+ const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
1131
+ /** Returns a regex for validating an RFC 9562/4122 UUID.
1132
+ *
1133
+ * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
1134
+ const uuid = (version$1) => {
1135
+ if (!version$1) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
1136
+ return /* @__PURE__ */ new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version$1}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
1137
+ };
1138
+ /** Practical email validation */
1139
+ const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
1140
+ const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1141
+ function emoji() {
1142
+ return new RegExp(_emoji$1, "u");
1143
+ }
1144
+ const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
1145
+ const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
1146
+ const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
1147
+ const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
1148
+ const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
1149
+ const base64url = /^[A-Za-z0-9_-]*$/;
1150
+ const e164 = /^\+[1-9]\d{6,14}$/;
1151
+ const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
1152
+ const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
1153
+ function timeSource(args) {
1154
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
1155
+ return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
1156
+ }
1157
+ function time$1(args) {
1158
+ return /* @__PURE__ */ new RegExp(`^${timeSource(args)}$`);
1159
+ }
1160
+ function datetime$1(args) {
1161
+ const time$2 = timeSource({ precision: args.precision });
1162
+ const opts = ["Z"];
1163
+ if (args.local) opts.push("");
1164
+ if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
1165
+ const timeRegex = `${time$2}(?:${opts.join("|")})`;
1166
+ return /* @__PURE__ */ new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1167
+ }
1168
+ const string$1 = (params) => {
1169
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
1170
+ return /* @__PURE__ */ new RegExp(`^${regex}$`);
1171
+ };
1172
+ const integer = /^-?\d+$/;
1173
+ const number$1 = /^-?\d+(?:\.\d+)?$/;
1174
+ const lowercase = /^[^A-Z]*$/;
1175
+ const uppercase = /^[^a-z]*$/;
1176
+
437
1177
  //#endregion
438
1178
  //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
439
1179
  const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
@@ -442,6 +1182,145 @@ const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
442
1182
  inst._zod.def = def;
443
1183
  (_a$1 = inst._zod).onattach ?? (_a$1.onattach = []);
444
1184
  });
1185
+ const numericOriginMap = {
1186
+ number: "number",
1187
+ bigint: "bigint",
1188
+ object: "date"
1189
+ };
1190
+ const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
1191
+ $ZodCheck.init(inst, def);
1192
+ const origin = numericOriginMap[typeof def.value];
1193
+ inst._zod.onattach.push((inst$1) => {
1194
+ const bag = inst$1._zod.bag;
1195
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
1196
+ if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
1197
+ else bag.exclusiveMaximum = def.value;
1198
+ });
1199
+ inst._zod.check = (payload) => {
1200
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
1201
+ payload.issues.push({
1202
+ origin,
1203
+ code: "too_big",
1204
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
1205
+ input: payload.value,
1206
+ inclusive: def.inclusive,
1207
+ inst,
1208
+ continue: !def.abort
1209
+ });
1210
+ };
1211
+ });
1212
+ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
1213
+ $ZodCheck.init(inst, def);
1214
+ const origin = numericOriginMap[typeof def.value];
1215
+ inst._zod.onattach.push((inst$1) => {
1216
+ const bag = inst$1._zod.bag;
1217
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
1218
+ if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
1219
+ else bag.exclusiveMinimum = def.value;
1220
+ });
1221
+ inst._zod.check = (payload) => {
1222
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
1223
+ payload.issues.push({
1224
+ origin,
1225
+ code: "too_small",
1226
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
1227
+ input: payload.value,
1228
+ inclusive: def.inclusive,
1229
+ inst,
1230
+ continue: !def.abort
1231
+ });
1232
+ };
1233
+ });
1234
+ const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
1235
+ $ZodCheck.init(inst, def);
1236
+ inst._zod.onattach.push((inst$1) => {
1237
+ var _a$1;
1238
+ (_a$1 = inst$1._zod.bag).multipleOf ?? (_a$1.multipleOf = def.value);
1239
+ });
1240
+ inst._zod.check = (payload) => {
1241
+ if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
1242
+ if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
1243
+ payload.issues.push({
1244
+ origin: typeof payload.value,
1245
+ code: "not_multiple_of",
1246
+ divisor: def.value,
1247
+ input: payload.value,
1248
+ inst,
1249
+ continue: !def.abort
1250
+ });
1251
+ };
1252
+ });
1253
+ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
1254
+ $ZodCheck.init(inst, def);
1255
+ def.format = def.format || "float64";
1256
+ const isInt = def.format?.includes("int");
1257
+ const origin = isInt ? "int" : "number";
1258
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
1259
+ inst._zod.onattach.push((inst$1) => {
1260
+ const bag = inst$1._zod.bag;
1261
+ bag.format = def.format;
1262
+ bag.minimum = minimum;
1263
+ bag.maximum = maximum;
1264
+ if (isInt) bag.pattern = integer;
1265
+ });
1266
+ inst._zod.check = (payload) => {
1267
+ const input = payload.value;
1268
+ if (isInt) {
1269
+ if (!Number.isInteger(input)) {
1270
+ payload.issues.push({
1271
+ expected: origin,
1272
+ format: def.format,
1273
+ code: "invalid_type",
1274
+ continue: false,
1275
+ input,
1276
+ inst
1277
+ });
1278
+ return;
1279
+ }
1280
+ if (!Number.isSafeInteger(input)) {
1281
+ if (input > 0) payload.issues.push({
1282
+ input,
1283
+ code: "too_big",
1284
+ maximum: Number.MAX_SAFE_INTEGER,
1285
+ note: "Integers must be within the safe integer range.",
1286
+ inst,
1287
+ origin,
1288
+ inclusive: true,
1289
+ continue: !def.abort
1290
+ });
1291
+ else payload.issues.push({
1292
+ input,
1293
+ code: "too_small",
1294
+ minimum: Number.MIN_SAFE_INTEGER,
1295
+ note: "Integers must be within the safe integer range.",
1296
+ inst,
1297
+ origin,
1298
+ inclusive: true,
1299
+ continue: !def.abort
1300
+ });
1301
+ return;
1302
+ }
1303
+ }
1304
+ if (input < minimum) payload.issues.push({
1305
+ origin: "number",
1306
+ input,
1307
+ code: "too_small",
1308
+ minimum,
1309
+ inclusive: true,
1310
+ inst,
1311
+ continue: !def.abort
1312
+ });
1313
+ if (input > maximum) payload.issues.push({
1314
+ origin: "number",
1315
+ input,
1316
+ code: "too_big",
1317
+ maximum,
1318
+ inclusive: true,
1319
+ inst,
1320
+ continue: !def.abort
1321
+ });
1322
+ };
1323
+ });
445
1324
  const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
446
1325
  var _a$1;
447
1326
  $ZodCheck.init(inst, def);
@@ -530,17 +1409,166 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
530
1409
  });
531
1410
  };
532
1411
  });
533
- const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
1412
+ const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
1413
+ var _a$1, _b;
534
1414
  $ZodCheck.init(inst, def);
535
- inst._zod.check = (payload) => {
536
- payload.value = def.tx(payload.value);
537
- };
538
- });
539
-
540
- //#endregion
541
- //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
542
- const version = {
543
- major: 4,
1415
+ inst._zod.onattach.push((inst$1) => {
1416
+ const bag = inst$1._zod.bag;
1417
+ bag.format = def.format;
1418
+ if (def.pattern) {
1419
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1420
+ bag.patterns.add(def.pattern);
1421
+ }
1422
+ });
1423
+ if (def.pattern) (_a$1 = inst._zod).check ?? (_a$1.check = (payload) => {
1424
+ def.pattern.lastIndex = 0;
1425
+ if (def.pattern.test(payload.value)) return;
1426
+ payload.issues.push({
1427
+ origin: "string",
1428
+ code: "invalid_format",
1429
+ format: def.format,
1430
+ input: payload.value,
1431
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
1432
+ inst,
1433
+ continue: !def.abort
1434
+ });
1435
+ });
1436
+ else (_b = inst._zod).check ?? (_b.check = () => {});
1437
+ });
1438
+ const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
1439
+ $ZodCheckStringFormat.init(inst, def);
1440
+ inst._zod.check = (payload) => {
1441
+ def.pattern.lastIndex = 0;
1442
+ if (def.pattern.test(payload.value)) return;
1443
+ payload.issues.push({
1444
+ origin: "string",
1445
+ code: "invalid_format",
1446
+ format: "regex",
1447
+ input: payload.value,
1448
+ pattern: def.pattern.toString(),
1449
+ inst,
1450
+ continue: !def.abort
1451
+ });
1452
+ };
1453
+ });
1454
+ const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
1455
+ def.pattern ?? (def.pattern = lowercase);
1456
+ $ZodCheckStringFormat.init(inst, def);
1457
+ });
1458
+ const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
1459
+ def.pattern ?? (def.pattern = uppercase);
1460
+ $ZodCheckStringFormat.init(inst, def);
1461
+ });
1462
+ const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
1463
+ $ZodCheck.init(inst, def);
1464
+ const escapedRegex = escapeRegex(def.includes);
1465
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
1466
+ def.pattern = pattern;
1467
+ inst._zod.onattach.push((inst$1) => {
1468
+ const bag = inst$1._zod.bag;
1469
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1470
+ bag.patterns.add(pattern);
1471
+ });
1472
+ inst._zod.check = (payload) => {
1473
+ if (payload.value.includes(def.includes, def.position)) return;
1474
+ payload.issues.push({
1475
+ origin: "string",
1476
+ code: "invalid_format",
1477
+ format: "includes",
1478
+ includes: def.includes,
1479
+ input: payload.value,
1480
+ inst,
1481
+ continue: !def.abort
1482
+ });
1483
+ };
1484
+ });
1485
+ const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
1486
+ $ZodCheck.init(inst, def);
1487
+ const pattern = /* @__PURE__ */ new RegExp(`^${escapeRegex(def.prefix)}.*`);
1488
+ def.pattern ?? (def.pattern = pattern);
1489
+ inst._zod.onattach.push((inst$1) => {
1490
+ const bag = inst$1._zod.bag;
1491
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1492
+ bag.patterns.add(pattern);
1493
+ });
1494
+ inst._zod.check = (payload) => {
1495
+ if (payload.value.startsWith(def.prefix)) return;
1496
+ payload.issues.push({
1497
+ origin: "string",
1498
+ code: "invalid_format",
1499
+ format: "starts_with",
1500
+ prefix: def.prefix,
1501
+ input: payload.value,
1502
+ inst,
1503
+ continue: !def.abort
1504
+ });
1505
+ };
1506
+ });
1507
+ const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
1508
+ $ZodCheck.init(inst, def);
1509
+ const pattern = /* @__PURE__ */ new RegExp(`.*${escapeRegex(def.suffix)}$`);
1510
+ def.pattern ?? (def.pattern = pattern);
1511
+ inst._zod.onattach.push((inst$1) => {
1512
+ const bag = inst$1._zod.bag;
1513
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1514
+ bag.patterns.add(pattern);
1515
+ });
1516
+ inst._zod.check = (payload) => {
1517
+ if (payload.value.endsWith(def.suffix)) return;
1518
+ payload.issues.push({
1519
+ origin: "string",
1520
+ code: "invalid_format",
1521
+ format: "ends_with",
1522
+ suffix: def.suffix,
1523
+ input: payload.value,
1524
+ inst,
1525
+ continue: !def.abort
1526
+ });
1527
+ };
1528
+ });
1529
+ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
1530
+ $ZodCheck.init(inst, def);
1531
+ inst._zod.check = (payload) => {
1532
+ payload.value = def.tx(payload.value);
1533
+ };
1534
+ });
1535
+
1536
+ //#endregion
1537
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
1538
+ var Doc = class {
1539
+ constructor(args = []) {
1540
+ this.content = [];
1541
+ this.indent = 0;
1542
+ if (this) this.args = args;
1543
+ }
1544
+ indented(fn) {
1545
+ this.indent += 1;
1546
+ fn(this);
1547
+ this.indent -= 1;
1548
+ }
1549
+ write(arg) {
1550
+ if (typeof arg === "function") {
1551
+ arg(this, { execution: "sync" });
1552
+ arg(this, { execution: "async" });
1553
+ return;
1554
+ }
1555
+ const lines = arg.split("\n").filter((x) => x);
1556
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
1557
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
1558
+ for (const line of dedented) this.content.push(line);
1559
+ }
1560
+ compile() {
1561
+ const F = Function;
1562
+ const args = this?.args;
1563
+ const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
1564
+ return new F(...args, lines.join("\n"));
1565
+ }
1566
+ };
1567
+
1568
+ //#endregion
1569
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
1570
+ const version = {
1571
+ major: 4,
544
1572
  minor: 3,
545
1573
  patch: 6
546
1574
  };
@@ -635,10 +1663,308 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
635
1663
  version: 1
636
1664
  }));
637
1665
  });
1666
+ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
1667
+ $ZodType.init(inst, def);
1668
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
1669
+ inst._zod.parse = (payload, _) => {
1670
+ if (def.coerce) try {
1671
+ payload.value = String(payload.value);
1672
+ } catch (_$1) {}
1673
+ if (typeof payload.value === "string") return payload;
1674
+ payload.issues.push({
1675
+ expected: "string",
1676
+ code: "invalid_type",
1677
+ input: payload.value,
1678
+ inst
1679
+ });
1680
+ return payload;
1681
+ };
1682
+ });
1683
+ const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
1684
+ $ZodCheckStringFormat.init(inst, def);
1685
+ $ZodString.init(inst, def);
1686
+ });
1687
+ const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
1688
+ def.pattern ?? (def.pattern = guid);
1689
+ $ZodStringFormat.init(inst, def);
1690
+ });
1691
+ const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
1692
+ if (def.version) {
1693
+ const v = {
1694
+ v1: 1,
1695
+ v2: 2,
1696
+ v3: 3,
1697
+ v4: 4,
1698
+ v5: 5,
1699
+ v6: 6,
1700
+ v7: 7,
1701
+ v8: 8
1702
+ }[def.version];
1703
+ if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
1704
+ def.pattern ?? (def.pattern = uuid(v));
1705
+ } else def.pattern ?? (def.pattern = uuid());
1706
+ $ZodStringFormat.init(inst, def);
1707
+ });
1708
+ const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
1709
+ def.pattern ?? (def.pattern = email);
1710
+ $ZodStringFormat.init(inst, def);
1711
+ });
1712
+ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
1713
+ $ZodStringFormat.init(inst, def);
1714
+ inst._zod.check = (payload) => {
1715
+ try {
1716
+ const trimmed = payload.value.trim();
1717
+ const url = new URL(trimmed);
1718
+ if (def.hostname) {
1719
+ def.hostname.lastIndex = 0;
1720
+ if (!def.hostname.test(url.hostname)) payload.issues.push({
1721
+ code: "invalid_format",
1722
+ format: "url",
1723
+ note: "Invalid hostname",
1724
+ pattern: def.hostname.source,
1725
+ input: payload.value,
1726
+ inst,
1727
+ continue: !def.abort
1728
+ });
1729
+ }
1730
+ if (def.protocol) {
1731
+ def.protocol.lastIndex = 0;
1732
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1733
+ code: "invalid_format",
1734
+ format: "url",
1735
+ note: "Invalid protocol",
1736
+ pattern: def.protocol.source,
1737
+ input: payload.value,
1738
+ inst,
1739
+ continue: !def.abort
1740
+ });
1741
+ }
1742
+ if (def.normalize) payload.value = url.href;
1743
+ else payload.value = trimmed;
1744
+ return;
1745
+ } catch (_) {
1746
+ payload.issues.push({
1747
+ code: "invalid_format",
1748
+ format: "url",
1749
+ input: payload.value,
1750
+ inst,
1751
+ continue: !def.abort
1752
+ });
1753
+ }
1754
+ };
1755
+ });
1756
+ const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
1757
+ def.pattern ?? (def.pattern = emoji());
1758
+ $ZodStringFormat.init(inst, def);
1759
+ });
1760
+ const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
1761
+ def.pattern ?? (def.pattern = nanoid);
1762
+ $ZodStringFormat.init(inst, def);
1763
+ });
1764
+ const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
1765
+ def.pattern ?? (def.pattern = cuid);
1766
+ $ZodStringFormat.init(inst, def);
1767
+ });
1768
+ const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
1769
+ def.pattern ?? (def.pattern = cuid2);
1770
+ $ZodStringFormat.init(inst, def);
1771
+ });
1772
+ const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
1773
+ def.pattern ?? (def.pattern = ulid);
1774
+ $ZodStringFormat.init(inst, def);
1775
+ });
1776
+ const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
1777
+ def.pattern ?? (def.pattern = xid);
1778
+ $ZodStringFormat.init(inst, def);
1779
+ });
1780
+ const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
1781
+ def.pattern ?? (def.pattern = ksuid);
1782
+ $ZodStringFormat.init(inst, def);
1783
+ });
1784
+ const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
1785
+ def.pattern ?? (def.pattern = datetime$1(def));
1786
+ $ZodStringFormat.init(inst, def);
1787
+ });
1788
+ const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
1789
+ def.pattern ?? (def.pattern = date$1);
1790
+ $ZodStringFormat.init(inst, def);
1791
+ });
1792
+ const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
1793
+ def.pattern ?? (def.pattern = time$1(def));
1794
+ $ZodStringFormat.init(inst, def);
1795
+ });
1796
+ const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
1797
+ def.pattern ?? (def.pattern = duration$1);
1798
+ $ZodStringFormat.init(inst, def);
1799
+ });
1800
+ const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
1801
+ def.pattern ?? (def.pattern = ipv4);
1802
+ $ZodStringFormat.init(inst, def);
1803
+ inst._zod.bag.format = `ipv4`;
1804
+ });
1805
+ const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
1806
+ def.pattern ?? (def.pattern = ipv6);
1807
+ $ZodStringFormat.init(inst, def);
1808
+ inst._zod.bag.format = `ipv6`;
1809
+ inst._zod.check = (payload) => {
1810
+ try {
1811
+ new URL(`http://[${payload.value}]`);
1812
+ } catch {
1813
+ payload.issues.push({
1814
+ code: "invalid_format",
1815
+ format: "ipv6",
1816
+ input: payload.value,
1817
+ inst,
1818
+ continue: !def.abort
1819
+ });
1820
+ }
1821
+ };
1822
+ });
1823
+ const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
1824
+ def.pattern ?? (def.pattern = cidrv4);
1825
+ $ZodStringFormat.init(inst, def);
1826
+ });
1827
+ const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
1828
+ def.pattern ?? (def.pattern = cidrv6);
1829
+ $ZodStringFormat.init(inst, def);
1830
+ inst._zod.check = (payload) => {
1831
+ const parts = payload.value.split("/");
1832
+ try {
1833
+ if (parts.length !== 2) throw new Error();
1834
+ const [address, prefix] = parts;
1835
+ if (!prefix) throw new Error();
1836
+ const prefixNum = Number(prefix);
1837
+ if (`${prefixNum}` !== prefix) throw new Error();
1838
+ if (prefixNum < 0 || prefixNum > 128) throw new Error();
1839
+ new URL(`http://[${address}]`);
1840
+ } catch {
1841
+ payload.issues.push({
1842
+ code: "invalid_format",
1843
+ format: "cidrv6",
1844
+ input: payload.value,
1845
+ inst,
1846
+ continue: !def.abort
1847
+ });
1848
+ }
1849
+ };
1850
+ });
1851
+ function isValidBase64(data) {
1852
+ if (data === "") return true;
1853
+ if (data.length % 4 !== 0) return false;
1854
+ try {
1855
+ atob(data);
1856
+ return true;
1857
+ } catch {
1858
+ return false;
1859
+ }
1860
+ }
1861
+ const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
1862
+ def.pattern ?? (def.pattern = base64);
1863
+ $ZodStringFormat.init(inst, def);
1864
+ inst._zod.bag.contentEncoding = "base64";
1865
+ inst._zod.check = (payload) => {
1866
+ if (isValidBase64(payload.value)) return;
1867
+ payload.issues.push({
1868
+ code: "invalid_format",
1869
+ format: "base64",
1870
+ input: payload.value,
1871
+ inst,
1872
+ continue: !def.abort
1873
+ });
1874
+ };
1875
+ });
1876
+ function isValidBase64URL(data) {
1877
+ if (!base64url.test(data)) return false;
1878
+ const base64$1 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1879
+ return isValidBase64(base64$1.padEnd(Math.ceil(base64$1.length / 4) * 4, "="));
1880
+ }
1881
+ const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
1882
+ def.pattern ?? (def.pattern = base64url);
1883
+ $ZodStringFormat.init(inst, def);
1884
+ inst._zod.bag.contentEncoding = "base64url";
1885
+ inst._zod.check = (payload) => {
1886
+ if (isValidBase64URL(payload.value)) return;
1887
+ payload.issues.push({
1888
+ code: "invalid_format",
1889
+ format: "base64url",
1890
+ input: payload.value,
1891
+ inst,
1892
+ continue: !def.abort
1893
+ });
1894
+ };
1895
+ });
1896
+ const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
1897
+ def.pattern ?? (def.pattern = e164);
1898
+ $ZodStringFormat.init(inst, def);
1899
+ });
1900
+ function isValidJWT(token, algorithm = null) {
1901
+ try {
1902
+ const tokensParts = token.split(".");
1903
+ if (tokensParts.length !== 3) return false;
1904
+ const [header] = tokensParts;
1905
+ if (!header) return false;
1906
+ const parsedHeader = JSON.parse(atob(header));
1907
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
1908
+ if (!parsedHeader.alg) return false;
1909
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
1910
+ return true;
1911
+ } catch {
1912
+ return false;
1913
+ }
1914
+ }
1915
+ const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
1916
+ $ZodStringFormat.init(inst, def);
1917
+ inst._zod.check = (payload) => {
1918
+ if (isValidJWT(payload.value, def.alg)) return;
1919
+ payload.issues.push({
1920
+ code: "invalid_format",
1921
+ format: "jwt",
1922
+ input: payload.value,
1923
+ inst,
1924
+ continue: !def.abort
1925
+ });
1926
+ };
1927
+ });
1928
+ const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
1929
+ $ZodType.init(inst, def);
1930
+ inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
1931
+ inst._zod.parse = (payload, _ctx) => {
1932
+ if (def.coerce) try {
1933
+ payload.value = Number(payload.value);
1934
+ } catch (_) {}
1935
+ const input = payload.value;
1936
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1937
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
1938
+ payload.issues.push({
1939
+ expected: "number",
1940
+ code: "invalid_type",
1941
+ input,
1942
+ inst,
1943
+ ...received ? { received } : {}
1944
+ });
1945
+ return payload;
1946
+ };
1947
+ });
1948
+ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
1949
+ $ZodCheckNumberFormat.init(inst, def);
1950
+ $ZodNumber.init(inst, def);
1951
+ });
638
1952
  const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
639
1953
  $ZodType.init(inst, def);
640
1954
  inst._zod.parse = (payload) => payload;
641
1955
  });
1956
+ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
1957
+ $ZodType.init(inst, def);
1958
+ inst._zod.parse = (payload, _ctx) => {
1959
+ payload.issues.push({
1960
+ expected: "never",
1961
+ code: "invalid_type",
1962
+ input: payload.value,
1963
+ inst
1964
+ });
1965
+ return payload;
1966
+ };
1967
+ });
642
1968
  function handleArrayResult(result, final, index) {
643
1969
  if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
644
1970
  final.value[index] = result.value;
@@ -671,6 +1997,207 @@ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
671
1997
  return payload;
672
1998
  };
673
1999
  });
2000
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
2001
+ if (result.issues.length) {
2002
+ if (isOptionalOut && !(key in input)) return;
2003
+ final.issues.push(...prefixIssues(key, result.issues));
2004
+ }
2005
+ if (result.value === void 0) {
2006
+ if (key in input) final.value[key] = void 0;
2007
+ } else final.value[key] = result.value;
2008
+ }
2009
+ function normalizeDef(def) {
2010
+ const keys = Object.keys(def.shape);
2011
+ for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
2012
+ const okeys = optionalKeys(def.shape);
2013
+ return {
2014
+ ...def,
2015
+ keys,
2016
+ keySet: new Set(keys),
2017
+ numKeys: keys.length,
2018
+ optionalKeys: new Set(okeys)
2019
+ };
2020
+ }
2021
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
2022
+ const unrecognized = [];
2023
+ const keySet = def.keySet;
2024
+ const _catchall = def.catchall._zod;
2025
+ const t = _catchall.def.type;
2026
+ const isOptionalOut = _catchall.optout === "optional";
2027
+ for (const key in input) {
2028
+ if (keySet.has(key)) continue;
2029
+ if (t === "never") {
2030
+ unrecognized.push(key);
2031
+ continue;
2032
+ }
2033
+ const r = _catchall.run({
2034
+ value: input[key],
2035
+ issues: []
2036
+ }, ctx);
2037
+ if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input, isOptionalOut)));
2038
+ else handlePropertyResult(r, payload, key, input, isOptionalOut);
2039
+ }
2040
+ if (unrecognized.length) payload.issues.push({
2041
+ code: "unrecognized_keys",
2042
+ keys: unrecognized,
2043
+ input,
2044
+ inst
2045
+ });
2046
+ if (!proms.length) return payload;
2047
+ return Promise.all(proms).then(() => {
2048
+ return payload;
2049
+ });
2050
+ }
2051
+ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
2052
+ $ZodType.init(inst, def);
2053
+ if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
2054
+ const sh = def.shape;
2055
+ Object.defineProperty(def, "shape", { get: () => {
2056
+ const newSh = { ...sh };
2057
+ Object.defineProperty(def, "shape", { value: newSh });
2058
+ return newSh;
2059
+ } });
2060
+ }
2061
+ const _normalized = cached(() => normalizeDef(def));
2062
+ defineLazy(inst._zod, "propValues", () => {
2063
+ const shape = def.shape;
2064
+ const propValues = {};
2065
+ for (const key in shape) {
2066
+ const field = shape[key]._zod;
2067
+ if (field.values) {
2068
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
2069
+ for (const v of field.values) propValues[key].add(v);
2070
+ }
2071
+ }
2072
+ return propValues;
2073
+ });
2074
+ const isObject$1 = isObject;
2075
+ const catchall = def.catchall;
2076
+ let value;
2077
+ inst._zod.parse = (payload, ctx) => {
2078
+ value ?? (value = _normalized.value);
2079
+ const input = payload.value;
2080
+ if (!isObject$1(input)) {
2081
+ payload.issues.push({
2082
+ expected: "object",
2083
+ code: "invalid_type",
2084
+ input,
2085
+ inst
2086
+ });
2087
+ return payload;
2088
+ }
2089
+ payload.value = {};
2090
+ const proms = [];
2091
+ const shape = value.shape;
2092
+ for (const key of value.keys) {
2093
+ const el = shape[key];
2094
+ const isOptionalOut = el._zod.optout === "optional";
2095
+ const r = el._zod.run({
2096
+ value: input[key],
2097
+ issues: []
2098
+ }, ctx);
2099
+ if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input, isOptionalOut)));
2100
+ else handlePropertyResult(r, payload, key, input, isOptionalOut);
2101
+ }
2102
+ if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
2103
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
2104
+ };
2105
+ });
2106
+ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
2107
+ $ZodObject.init(inst, def);
2108
+ const superParse = inst._zod.parse;
2109
+ const _normalized = cached(() => normalizeDef(def));
2110
+ const generateFastpass = (shape) => {
2111
+ const doc = new Doc([
2112
+ "shape",
2113
+ "payload",
2114
+ "ctx"
2115
+ ]);
2116
+ const normalized = _normalized.value;
2117
+ const parseStr = (key) => {
2118
+ const k = esc(key);
2119
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2120
+ };
2121
+ doc.write(`const input = payload.value;`);
2122
+ const ids = Object.create(null);
2123
+ let counter = 0;
2124
+ for (const key of normalized.keys) ids[key] = `key_${counter++}`;
2125
+ doc.write(`const newResult = {};`);
2126
+ for (const key of normalized.keys) {
2127
+ const id = ids[key];
2128
+ const k = esc(key);
2129
+ const isOptionalOut = shape[key]?._zod?.optout === "optional";
2130
+ doc.write(`const ${id} = ${parseStr(key)};`);
2131
+ if (isOptionalOut) doc.write(`
2132
+ if (${id}.issues.length) {
2133
+ if (${k} in input) {
2134
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2135
+ ...iss,
2136
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
2137
+ })));
2138
+ }
2139
+ }
2140
+
2141
+ if (${id}.value === undefined) {
2142
+ if (${k} in input) {
2143
+ newResult[${k}] = undefined;
2144
+ }
2145
+ } else {
2146
+ newResult[${k}] = ${id}.value;
2147
+ }
2148
+
2149
+ `);
2150
+ else doc.write(`
2151
+ if (${id}.issues.length) {
2152
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2153
+ ...iss,
2154
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
2155
+ })));
2156
+ }
2157
+
2158
+ if (${id}.value === undefined) {
2159
+ if (${k} in input) {
2160
+ newResult[${k}] = undefined;
2161
+ }
2162
+ } else {
2163
+ newResult[${k}] = ${id}.value;
2164
+ }
2165
+
2166
+ `);
2167
+ }
2168
+ doc.write(`payload.value = newResult;`);
2169
+ doc.write(`return payload;`);
2170
+ const fn = doc.compile();
2171
+ return (payload, ctx) => fn(shape, payload, ctx);
2172
+ };
2173
+ let fastpass;
2174
+ const isObject$1 = isObject;
2175
+ const jit = !globalConfig.jitless;
2176
+ const allowsEval$1 = allowsEval;
2177
+ const fastEnabled = jit && allowsEval$1.value;
2178
+ const catchall = def.catchall;
2179
+ let value;
2180
+ inst._zod.parse = (payload, ctx) => {
2181
+ value ?? (value = _normalized.value);
2182
+ const input = payload.value;
2183
+ if (!isObject$1(input)) {
2184
+ payload.issues.push({
2185
+ expected: "object",
2186
+ code: "invalid_type",
2187
+ input,
2188
+ inst
2189
+ });
2190
+ return payload;
2191
+ }
2192
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
2193
+ if (!fastpass) fastpass = generateFastpass(def.shape);
2194
+ payload = fastpass(payload, ctx);
2195
+ if (!catchall) return payload;
2196
+ return handleCatchall([], input, payload, ctx, value, inst);
2197
+ }
2198
+ return superParse(payload, ctx);
2199
+ };
2200
+ });
674
2201
  function handleUnionResults(results, final, inst, ctx) {
675
2202
  for (const result of results) if (result.issues.length === 0) {
676
2203
  final.value = result.value;
@@ -826,6 +2353,115 @@ function handleIntersectionResults(result, left, right) {
826
2353
  result.value = merged.data;
827
2354
  return result;
828
2355
  }
2356
+ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
2357
+ $ZodType.init(inst, def);
2358
+ inst._zod.parse = (payload, ctx) => {
2359
+ const input = payload.value;
2360
+ if (!isPlainObject(input)) {
2361
+ payload.issues.push({
2362
+ expected: "record",
2363
+ code: "invalid_type",
2364
+ input,
2365
+ inst
2366
+ });
2367
+ return payload;
2368
+ }
2369
+ const proms = [];
2370
+ const values = def.keyType._zod.values;
2371
+ if (values) {
2372
+ payload.value = {};
2373
+ const recordKeys = /* @__PURE__ */ new Set();
2374
+ for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2375
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
2376
+ const result = def.valueType._zod.run({
2377
+ value: input[key],
2378
+ issues: []
2379
+ }, ctx);
2380
+ if (result instanceof Promise) proms.push(result.then((result$1) => {
2381
+ if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
2382
+ payload.value[key] = result$1.value;
2383
+ }));
2384
+ else {
2385
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2386
+ payload.value[key] = result.value;
2387
+ }
2388
+ }
2389
+ let unrecognized;
2390
+ for (const key in input) if (!recordKeys.has(key)) {
2391
+ unrecognized = unrecognized ?? [];
2392
+ unrecognized.push(key);
2393
+ }
2394
+ if (unrecognized && unrecognized.length > 0) payload.issues.push({
2395
+ code: "unrecognized_keys",
2396
+ input,
2397
+ inst,
2398
+ keys: unrecognized
2399
+ });
2400
+ } else {
2401
+ payload.value = {};
2402
+ for (const key of Reflect.ownKeys(input)) {
2403
+ if (key === "__proto__") continue;
2404
+ let keyResult = def.keyType._zod.run({
2405
+ value: key,
2406
+ issues: []
2407
+ }, ctx);
2408
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
2409
+ if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
2410
+ const retryResult = def.keyType._zod.run({
2411
+ value: Number(key),
2412
+ issues: []
2413
+ }, ctx);
2414
+ if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
2415
+ if (retryResult.issues.length === 0) keyResult = retryResult;
2416
+ }
2417
+ if (keyResult.issues.length) {
2418
+ if (def.mode === "loose") payload.value[key] = input[key];
2419
+ else payload.issues.push({
2420
+ code: "invalid_key",
2421
+ origin: "record",
2422
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2423
+ input: key,
2424
+ path: [key],
2425
+ inst
2426
+ });
2427
+ continue;
2428
+ }
2429
+ const result = def.valueType._zod.run({
2430
+ value: input[key],
2431
+ issues: []
2432
+ }, ctx);
2433
+ if (result instanceof Promise) proms.push(result.then((result$1) => {
2434
+ if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
2435
+ payload.value[keyResult.value] = result$1.value;
2436
+ }));
2437
+ else {
2438
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2439
+ payload.value[keyResult.value] = result.value;
2440
+ }
2441
+ }
2442
+ }
2443
+ if (proms.length) return Promise.all(proms).then(() => payload);
2444
+ return payload;
2445
+ };
2446
+ });
2447
+ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
2448
+ $ZodType.init(inst, def);
2449
+ const values = getEnumValues(def.entries);
2450
+ const valuesSet = new Set(values);
2451
+ inst._zod.values = valuesSet;
2452
+ inst._zod.pattern = /* @__PURE__ */ new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
2453
+ inst._zod.parse = (payload, _ctx) => {
2454
+ const input = payload.value;
2455
+ if (valuesSet.has(input)) return payload;
2456
+ payload.issues.push({
2457
+ code: "invalid_value",
2458
+ values,
2459
+ input,
2460
+ inst
2461
+ });
2462
+ return payload;
2463
+ };
2464
+ });
829
2465
  const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
830
2466
  $ZodType.init(inst, def);
831
2467
  inst._zod.parse = (payload, ctx) => {
@@ -1101,31 +2737,422 @@ const globalRegistry = globalThis.__zod_globalRegistry;
1101
2737
  //#endregion
1102
2738
  //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
1103
2739
  /* @__NO_SIDE_EFFECTS__ */
1104
- function _unknown(Class) {
1105
- return new Class({ type: "unknown" });
2740
+ function _string(Class, params) {
2741
+ return new Class({
2742
+ type: "string",
2743
+ ...normalizeParams(params)
2744
+ });
2745
+ }
2746
+ /* @__NO_SIDE_EFFECTS__ */
2747
+ function _email(Class, params) {
2748
+ return new Class({
2749
+ type: "string",
2750
+ format: "email",
2751
+ check: "string_format",
2752
+ abort: false,
2753
+ ...normalizeParams(params)
2754
+ });
2755
+ }
2756
+ /* @__NO_SIDE_EFFECTS__ */
2757
+ function _guid(Class, params) {
2758
+ return new Class({
2759
+ type: "string",
2760
+ format: "guid",
2761
+ check: "string_format",
2762
+ abort: false,
2763
+ ...normalizeParams(params)
2764
+ });
2765
+ }
2766
+ /* @__NO_SIDE_EFFECTS__ */
2767
+ function _uuid(Class, params) {
2768
+ return new Class({
2769
+ type: "string",
2770
+ format: "uuid",
2771
+ check: "string_format",
2772
+ abort: false,
2773
+ ...normalizeParams(params)
2774
+ });
2775
+ }
2776
+ /* @__NO_SIDE_EFFECTS__ */
2777
+ function _uuidv4(Class, params) {
2778
+ return new Class({
2779
+ type: "string",
2780
+ format: "uuid",
2781
+ check: "string_format",
2782
+ abort: false,
2783
+ version: "v4",
2784
+ ...normalizeParams(params)
2785
+ });
2786
+ }
2787
+ /* @__NO_SIDE_EFFECTS__ */
2788
+ function _uuidv6(Class, params) {
2789
+ return new Class({
2790
+ type: "string",
2791
+ format: "uuid",
2792
+ check: "string_format",
2793
+ abort: false,
2794
+ version: "v6",
2795
+ ...normalizeParams(params)
2796
+ });
2797
+ }
2798
+ /* @__NO_SIDE_EFFECTS__ */
2799
+ function _uuidv7(Class, params) {
2800
+ return new Class({
2801
+ type: "string",
2802
+ format: "uuid",
2803
+ check: "string_format",
2804
+ abort: false,
2805
+ version: "v7",
2806
+ ...normalizeParams(params)
2807
+ });
2808
+ }
2809
+ /* @__NO_SIDE_EFFECTS__ */
2810
+ function _url(Class, params) {
2811
+ return new Class({
2812
+ type: "string",
2813
+ format: "url",
2814
+ check: "string_format",
2815
+ abort: false,
2816
+ ...normalizeParams(params)
2817
+ });
2818
+ }
2819
+ /* @__NO_SIDE_EFFECTS__ */
2820
+ function _emoji(Class, params) {
2821
+ return new Class({
2822
+ type: "string",
2823
+ format: "emoji",
2824
+ check: "string_format",
2825
+ abort: false,
2826
+ ...normalizeParams(params)
2827
+ });
2828
+ }
2829
+ /* @__NO_SIDE_EFFECTS__ */
2830
+ function _nanoid(Class, params) {
2831
+ return new Class({
2832
+ type: "string",
2833
+ format: "nanoid",
2834
+ check: "string_format",
2835
+ abort: false,
2836
+ ...normalizeParams(params)
2837
+ });
2838
+ }
2839
+ /* @__NO_SIDE_EFFECTS__ */
2840
+ function _cuid(Class, params) {
2841
+ return new Class({
2842
+ type: "string",
2843
+ format: "cuid",
2844
+ check: "string_format",
2845
+ abort: false,
2846
+ ...normalizeParams(params)
2847
+ });
2848
+ }
2849
+ /* @__NO_SIDE_EFFECTS__ */
2850
+ function _cuid2(Class, params) {
2851
+ return new Class({
2852
+ type: "string",
2853
+ format: "cuid2",
2854
+ check: "string_format",
2855
+ abort: false,
2856
+ ...normalizeParams(params)
2857
+ });
2858
+ }
2859
+ /* @__NO_SIDE_EFFECTS__ */
2860
+ function _ulid(Class, params) {
2861
+ return new Class({
2862
+ type: "string",
2863
+ format: "ulid",
2864
+ check: "string_format",
2865
+ abort: false,
2866
+ ...normalizeParams(params)
2867
+ });
2868
+ }
2869
+ /* @__NO_SIDE_EFFECTS__ */
2870
+ function _xid(Class, params) {
2871
+ return new Class({
2872
+ type: "string",
2873
+ format: "xid",
2874
+ check: "string_format",
2875
+ abort: false,
2876
+ ...normalizeParams(params)
2877
+ });
2878
+ }
2879
+ /* @__NO_SIDE_EFFECTS__ */
2880
+ function _ksuid(Class, params) {
2881
+ return new Class({
2882
+ type: "string",
2883
+ format: "ksuid",
2884
+ check: "string_format",
2885
+ abort: false,
2886
+ ...normalizeParams(params)
2887
+ });
2888
+ }
2889
+ /* @__NO_SIDE_EFFECTS__ */
2890
+ function _ipv4(Class, params) {
2891
+ return new Class({
2892
+ type: "string",
2893
+ format: "ipv4",
2894
+ check: "string_format",
2895
+ abort: false,
2896
+ ...normalizeParams(params)
2897
+ });
2898
+ }
2899
+ /* @__NO_SIDE_EFFECTS__ */
2900
+ function _ipv6(Class, params) {
2901
+ return new Class({
2902
+ type: "string",
2903
+ format: "ipv6",
2904
+ check: "string_format",
2905
+ abort: false,
2906
+ ...normalizeParams(params)
2907
+ });
2908
+ }
2909
+ /* @__NO_SIDE_EFFECTS__ */
2910
+ function _cidrv4(Class, params) {
2911
+ return new Class({
2912
+ type: "string",
2913
+ format: "cidrv4",
2914
+ check: "string_format",
2915
+ abort: false,
2916
+ ...normalizeParams(params)
2917
+ });
2918
+ }
2919
+ /* @__NO_SIDE_EFFECTS__ */
2920
+ function _cidrv6(Class, params) {
2921
+ return new Class({
2922
+ type: "string",
2923
+ format: "cidrv6",
2924
+ check: "string_format",
2925
+ abort: false,
2926
+ ...normalizeParams(params)
2927
+ });
2928
+ }
2929
+ /* @__NO_SIDE_EFFECTS__ */
2930
+ function _base64(Class, params) {
2931
+ return new Class({
2932
+ type: "string",
2933
+ format: "base64",
2934
+ check: "string_format",
2935
+ abort: false,
2936
+ ...normalizeParams(params)
2937
+ });
2938
+ }
2939
+ /* @__NO_SIDE_EFFECTS__ */
2940
+ function _base64url(Class, params) {
2941
+ return new Class({
2942
+ type: "string",
2943
+ format: "base64url",
2944
+ check: "string_format",
2945
+ abort: false,
2946
+ ...normalizeParams(params)
2947
+ });
2948
+ }
2949
+ /* @__NO_SIDE_EFFECTS__ */
2950
+ function _e164(Class, params) {
2951
+ return new Class({
2952
+ type: "string",
2953
+ format: "e164",
2954
+ check: "string_format",
2955
+ abort: false,
2956
+ ...normalizeParams(params)
2957
+ });
2958
+ }
2959
+ /* @__NO_SIDE_EFFECTS__ */
2960
+ function _jwt(Class, params) {
2961
+ return new Class({
2962
+ type: "string",
2963
+ format: "jwt",
2964
+ check: "string_format",
2965
+ abort: false,
2966
+ ...normalizeParams(params)
2967
+ });
2968
+ }
2969
+ /* @__NO_SIDE_EFFECTS__ */
2970
+ function _isoDateTime(Class, params) {
2971
+ return new Class({
2972
+ type: "string",
2973
+ format: "datetime",
2974
+ check: "string_format",
2975
+ offset: false,
2976
+ local: false,
2977
+ precision: null,
2978
+ ...normalizeParams(params)
2979
+ });
2980
+ }
2981
+ /* @__NO_SIDE_EFFECTS__ */
2982
+ function _isoDate(Class, params) {
2983
+ return new Class({
2984
+ type: "string",
2985
+ format: "date",
2986
+ check: "string_format",
2987
+ ...normalizeParams(params)
2988
+ });
2989
+ }
2990
+ /* @__NO_SIDE_EFFECTS__ */
2991
+ function _isoTime(Class, params) {
2992
+ return new Class({
2993
+ type: "string",
2994
+ format: "time",
2995
+ check: "string_format",
2996
+ precision: null,
2997
+ ...normalizeParams(params)
2998
+ });
2999
+ }
3000
+ /* @__NO_SIDE_EFFECTS__ */
3001
+ function _isoDuration(Class, params) {
3002
+ return new Class({
3003
+ type: "string",
3004
+ format: "duration",
3005
+ check: "string_format",
3006
+ ...normalizeParams(params)
3007
+ });
3008
+ }
3009
+ /* @__NO_SIDE_EFFECTS__ */
3010
+ function _number(Class, params) {
3011
+ return new Class({
3012
+ type: "number",
3013
+ checks: [],
3014
+ ...normalizeParams(params)
3015
+ });
3016
+ }
3017
+ /* @__NO_SIDE_EFFECTS__ */
3018
+ function _int(Class, params) {
3019
+ return new Class({
3020
+ type: "number",
3021
+ check: "number_format",
3022
+ abort: false,
3023
+ format: "safeint",
3024
+ ...normalizeParams(params)
3025
+ });
3026
+ }
3027
+ /* @__NO_SIDE_EFFECTS__ */
3028
+ function _unknown(Class) {
3029
+ return new Class({ type: "unknown" });
3030
+ }
3031
+ /* @__NO_SIDE_EFFECTS__ */
3032
+ function _never(Class, params) {
3033
+ return new Class({
3034
+ type: "never",
3035
+ ...normalizeParams(params)
3036
+ });
3037
+ }
3038
+ /* @__NO_SIDE_EFFECTS__ */
3039
+ function _lt(value, params) {
3040
+ return new $ZodCheckLessThan({
3041
+ check: "less_than",
3042
+ ...normalizeParams(params),
3043
+ value,
3044
+ inclusive: false
3045
+ });
3046
+ }
3047
+ /* @__NO_SIDE_EFFECTS__ */
3048
+ function _lte(value, params) {
3049
+ return new $ZodCheckLessThan({
3050
+ check: "less_than",
3051
+ ...normalizeParams(params),
3052
+ value,
3053
+ inclusive: true
3054
+ });
3055
+ }
3056
+ /* @__NO_SIDE_EFFECTS__ */
3057
+ function _gt(value, params) {
3058
+ return new $ZodCheckGreaterThan({
3059
+ check: "greater_than",
3060
+ ...normalizeParams(params),
3061
+ value,
3062
+ inclusive: false
3063
+ });
3064
+ }
3065
+ /* @__NO_SIDE_EFFECTS__ */
3066
+ function _gte(value, params) {
3067
+ return new $ZodCheckGreaterThan({
3068
+ check: "greater_than",
3069
+ ...normalizeParams(params),
3070
+ value,
3071
+ inclusive: true
3072
+ });
3073
+ }
3074
+ /* @__NO_SIDE_EFFECTS__ */
3075
+ function _multipleOf(value, params) {
3076
+ return new $ZodCheckMultipleOf({
3077
+ check: "multiple_of",
3078
+ ...normalizeParams(params),
3079
+ value
3080
+ });
3081
+ }
3082
+ /* @__NO_SIDE_EFFECTS__ */
3083
+ function _maxLength(maximum, params) {
3084
+ return new $ZodCheckMaxLength({
3085
+ check: "max_length",
3086
+ ...normalizeParams(params),
3087
+ maximum
3088
+ });
3089
+ }
3090
+ /* @__NO_SIDE_EFFECTS__ */
3091
+ function _minLength(minimum, params) {
3092
+ return new $ZodCheckMinLength({
3093
+ check: "min_length",
3094
+ ...normalizeParams(params),
3095
+ minimum
3096
+ });
3097
+ }
3098
+ /* @__NO_SIDE_EFFECTS__ */
3099
+ function _length(length, params) {
3100
+ return new $ZodCheckLengthEquals({
3101
+ check: "length_equals",
3102
+ ...normalizeParams(params),
3103
+ length
3104
+ });
3105
+ }
3106
+ /* @__NO_SIDE_EFFECTS__ */
3107
+ function _regex(pattern, params) {
3108
+ return new $ZodCheckRegex({
3109
+ check: "string_format",
3110
+ format: "regex",
3111
+ ...normalizeParams(params),
3112
+ pattern
3113
+ });
3114
+ }
3115
+ /* @__NO_SIDE_EFFECTS__ */
3116
+ function _lowercase(params) {
3117
+ return new $ZodCheckLowerCase({
3118
+ check: "string_format",
3119
+ format: "lowercase",
3120
+ ...normalizeParams(params)
3121
+ });
1106
3122
  }
1107
3123
  /* @__NO_SIDE_EFFECTS__ */
1108
- function _maxLength(maximum, params) {
1109
- return new $ZodCheckMaxLength({
1110
- check: "max_length",
3124
+ function _uppercase(params) {
3125
+ return new $ZodCheckUpperCase({
3126
+ check: "string_format",
3127
+ format: "uppercase",
3128
+ ...normalizeParams(params)
3129
+ });
3130
+ }
3131
+ /* @__NO_SIDE_EFFECTS__ */
3132
+ function _includes(includes, params) {
3133
+ return new $ZodCheckIncludes({
3134
+ check: "string_format",
3135
+ format: "includes",
1111
3136
  ...normalizeParams(params),
1112
- maximum
3137
+ includes
1113
3138
  });
1114
3139
  }
1115
3140
  /* @__NO_SIDE_EFFECTS__ */
1116
- function _minLength(minimum, params) {
1117
- return new $ZodCheckMinLength({
1118
- check: "min_length",
3141
+ function _startsWith(prefix, params) {
3142
+ return new $ZodCheckStartsWith({
3143
+ check: "string_format",
3144
+ format: "starts_with",
1119
3145
  ...normalizeParams(params),
1120
- minimum
3146
+ prefix
1121
3147
  });
1122
3148
  }
1123
3149
  /* @__NO_SIDE_EFFECTS__ */
1124
- function _length(length, params) {
1125
- return new $ZodCheckLengthEquals({
1126
- check: "length_equals",
3150
+ function _endsWith(suffix, params) {
3151
+ return new $ZodCheckEndsWith({
3152
+ check: "string_format",
3153
+ format: "ends_with",
1127
3154
  ...normalizeParams(params),
1128
- length
3155
+ suffix
1129
3156
  });
1130
3157
  }
1131
3158
  /* @__NO_SIDE_EFFECTS__ */
@@ -1136,6 +3163,26 @@ function _overwrite(tx) {
1136
3163
  });
1137
3164
  }
1138
3165
  /* @__NO_SIDE_EFFECTS__ */
3166
+ function _normalize(form) {
3167
+ return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
3168
+ }
3169
+ /* @__NO_SIDE_EFFECTS__ */
3170
+ function _trim() {
3171
+ return /* @__PURE__ */ _overwrite((input) => input.trim());
3172
+ }
3173
+ /* @__NO_SIDE_EFFECTS__ */
3174
+ function _toLowerCase() {
3175
+ return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
3176
+ }
3177
+ /* @__NO_SIDE_EFFECTS__ */
3178
+ function _toUpperCase() {
3179
+ return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
3180
+ }
3181
+ /* @__NO_SIDE_EFFECTS__ */
3182
+ function _slugify() {
3183
+ return /* @__PURE__ */ _overwrite((input) => slugify(input));
3184
+ }
3185
+ /* @__NO_SIDE_EFFECTS__ */
1139
3186
  function _array(Class, element, params) {
1140
3187
  return new Class({
1141
3188
  type: "array",
@@ -2010,9 +4057,9 @@ let AIAgentExecutionHelpersFactory = class AIAgentExecutionHelpersFactory$1 {
2010
4057
  /**
2011
4058
  * `@cfworker/json-schema` iterates `schema.required` with `for...of`; it must be a string array or absent.
2012
4059
  */
2013
- sanitizeJsonSchemaRequiredKeywordsForCfworker(node$16) {
2014
- if (!node$16 || typeof node$16 !== "object" || Array.isArray(node$16)) return;
2015
- const o = node$16;
4060
+ sanitizeJsonSchemaRequiredKeywordsForCfworker(node$20) {
4061
+ if (!node$20 || typeof node$20 !== "object" || Array.isArray(node$20)) return;
4062
+ const o = node$20;
2016
4063
  const req = o.required;
2017
4064
  if (req !== void 0 && !Array.isArray(req)) delete o.required;
2018
4065
  else if (Array.isArray(req)) {
@@ -2062,17 +4109,17 @@ let OpenAiStrictJsonSchemaFactory = class OpenAiStrictJsonSchemaFactory$1 {
2062
4109
  this.executionHelpers = executionHelpers;
2063
4110
  }
2064
4111
  createStructuredOutputRecord(schema, options) {
2065
- const record = this.executionHelpers.createJsonSchemaRecord(schema, {
4112
+ const record$1 = this.executionHelpers.createJsonSchemaRecord(schema, {
2066
4113
  schemaName: options.schemaName,
2067
4114
  requireObjectRoot: false
2068
4115
  });
2069
- this.strictifyRecursive(record);
2070
- if (options.title !== void 0) record.title = options.title;
2071
- return record;
4116
+ this.strictifyRecursive(record$1);
4117
+ if (options.title !== void 0) record$1.title = options.title;
4118
+ return record$1;
2072
4119
  }
2073
- strictifyRecursive(node$16) {
2074
- if (!node$16 || typeof node$16 !== "object" || Array.isArray(node$16)) return;
2075
- const o = node$16;
4120
+ strictifyRecursive(node$20) {
4121
+ if (!node$20 || typeof node$20 !== "object" || Array.isArray(node$20)) return;
4122
+ const o = node$20;
2076
4123
  this.stripOpenAiRejectedKeywords(o);
2077
4124
  if (this.isObjectNode(o)) {
2078
4125
  const props = this.readPropertiesObject(o);
@@ -2302,6 +4349,37 @@ AgentStructuredOutputRepairPromptFactory = _AgentStructuredOutputRepairPromptFac
2302
4349
  __decorateMetadata("design:paramtypes", [typeof (_ref$4 = typeof AIAgentExecutionHelpersFactory !== "undefined" && AIAgentExecutionHelpersFactory) === "function" ? _ref$4 : Object])
2303
4350
  ], AgentStructuredOutputRepairPromptFactory);
2304
4351
 
4352
+ //#endregion
4353
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js
4354
+ const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
4355
+ $ZodISODateTime.init(inst, def);
4356
+ ZodStringFormat.init(inst, def);
4357
+ });
4358
+ function datetime(params) {
4359
+ return _isoDateTime(ZodISODateTime, params);
4360
+ }
4361
+ const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
4362
+ $ZodISODate.init(inst, def);
4363
+ ZodStringFormat.init(inst, def);
4364
+ });
4365
+ function date(params) {
4366
+ return _isoDate(ZodISODate, params);
4367
+ }
4368
+ const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
4369
+ $ZodISOTime.init(inst, def);
4370
+ ZodStringFormat.init(inst, def);
4371
+ });
4372
+ function time(params) {
4373
+ return _isoTime(ZodISOTime, params);
4374
+ }
4375
+ const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
4376
+ $ZodISODuration.init(inst, def);
4377
+ ZodStringFormat.init(inst, def);
4378
+ });
4379
+ function duration(params) {
4380
+ return _isoDuration(ZodISODuration, params);
4381
+ }
4382
+
2305
4383
  //#endregion
2306
4384
  //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
2307
4385
  const initializer = (inst, issues) => {
@@ -2419,6 +4497,181 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2419
4497
  inst.apply = (fn) => fn(inst);
2420
4498
  return inst;
2421
4499
  });
4500
+ /** @internal */
4501
+ const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
4502
+ $ZodString.init(inst, def);
4503
+ ZodType.init(inst, def);
4504
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
4505
+ const bag = inst._zod.bag;
4506
+ inst.format = bag.format ?? null;
4507
+ inst.minLength = bag.minimum ?? null;
4508
+ inst.maxLength = bag.maximum ?? null;
4509
+ inst.regex = (...args) => inst.check(_regex(...args));
4510
+ inst.includes = (...args) => inst.check(_includes(...args));
4511
+ inst.startsWith = (...args) => inst.check(_startsWith(...args));
4512
+ inst.endsWith = (...args) => inst.check(_endsWith(...args));
4513
+ inst.min = (...args) => inst.check(_minLength(...args));
4514
+ inst.max = (...args) => inst.check(_maxLength(...args));
4515
+ inst.length = (...args) => inst.check(_length(...args));
4516
+ inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
4517
+ inst.lowercase = (params) => inst.check(_lowercase(params));
4518
+ inst.uppercase = (params) => inst.check(_uppercase(params));
4519
+ inst.trim = () => inst.check(_trim());
4520
+ inst.normalize = (...args) => inst.check(_normalize(...args));
4521
+ inst.toLowerCase = () => inst.check(_toLowerCase());
4522
+ inst.toUpperCase = () => inst.check(_toUpperCase());
4523
+ inst.slugify = () => inst.check(_slugify());
4524
+ });
4525
+ const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
4526
+ $ZodString.init(inst, def);
4527
+ _ZodString.init(inst, def);
4528
+ inst.email = (params) => inst.check(_email(ZodEmail, params));
4529
+ inst.url = (params) => inst.check(_url(ZodURL, params));
4530
+ inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
4531
+ inst.emoji = (params) => inst.check(_emoji(ZodEmoji, params));
4532
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
4533
+ inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
4534
+ inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
4535
+ inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
4536
+ inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
4537
+ inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
4538
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
4539
+ inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
4540
+ inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
4541
+ inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
4542
+ inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
4543
+ inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
4544
+ inst.xid = (params) => inst.check(_xid(ZodXID, params));
4545
+ inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
4546
+ inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
4547
+ inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
4548
+ inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
4549
+ inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
4550
+ inst.e164 = (params) => inst.check(_e164(ZodE164, params));
4551
+ inst.datetime = (params) => inst.check(datetime(params));
4552
+ inst.date = (params) => inst.check(date(params));
4553
+ inst.time = (params) => inst.check(time(params));
4554
+ inst.duration = (params) => inst.check(duration(params));
4555
+ });
4556
+ function string(params) {
4557
+ return _string(ZodString, params);
4558
+ }
4559
+ const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
4560
+ $ZodStringFormat.init(inst, def);
4561
+ _ZodString.init(inst, def);
4562
+ });
4563
+ const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
4564
+ $ZodEmail.init(inst, def);
4565
+ ZodStringFormat.init(inst, def);
4566
+ });
4567
+ const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
4568
+ $ZodGUID.init(inst, def);
4569
+ ZodStringFormat.init(inst, def);
4570
+ });
4571
+ const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
4572
+ $ZodUUID.init(inst, def);
4573
+ ZodStringFormat.init(inst, def);
4574
+ });
4575
+ const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
4576
+ $ZodURL.init(inst, def);
4577
+ ZodStringFormat.init(inst, def);
4578
+ });
4579
+ const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
4580
+ $ZodEmoji.init(inst, def);
4581
+ ZodStringFormat.init(inst, def);
4582
+ });
4583
+ const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
4584
+ $ZodNanoID.init(inst, def);
4585
+ ZodStringFormat.init(inst, def);
4586
+ });
4587
+ const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
4588
+ $ZodCUID.init(inst, def);
4589
+ ZodStringFormat.init(inst, def);
4590
+ });
4591
+ const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
4592
+ $ZodCUID2.init(inst, def);
4593
+ ZodStringFormat.init(inst, def);
4594
+ });
4595
+ const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
4596
+ $ZodULID.init(inst, def);
4597
+ ZodStringFormat.init(inst, def);
4598
+ });
4599
+ const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
4600
+ $ZodXID.init(inst, def);
4601
+ ZodStringFormat.init(inst, def);
4602
+ });
4603
+ const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
4604
+ $ZodKSUID.init(inst, def);
4605
+ ZodStringFormat.init(inst, def);
4606
+ });
4607
+ const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
4608
+ $ZodIPv4.init(inst, def);
4609
+ ZodStringFormat.init(inst, def);
4610
+ });
4611
+ const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
4612
+ $ZodIPv6.init(inst, def);
4613
+ ZodStringFormat.init(inst, def);
4614
+ });
4615
+ const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
4616
+ $ZodCIDRv4.init(inst, def);
4617
+ ZodStringFormat.init(inst, def);
4618
+ });
4619
+ const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
4620
+ $ZodCIDRv6.init(inst, def);
4621
+ ZodStringFormat.init(inst, def);
4622
+ });
4623
+ const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
4624
+ $ZodBase64.init(inst, def);
4625
+ ZodStringFormat.init(inst, def);
4626
+ });
4627
+ const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
4628
+ $ZodBase64URL.init(inst, def);
4629
+ ZodStringFormat.init(inst, def);
4630
+ });
4631
+ const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
4632
+ $ZodE164.init(inst, def);
4633
+ ZodStringFormat.init(inst, def);
4634
+ });
4635
+ const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
4636
+ $ZodJWT.init(inst, def);
4637
+ ZodStringFormat.init(inst, def);
4638
+ });
4639
+ const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
4640
+ $ZodNumber.init(inst, def);
4641
+ ZodType.init(inst, def);
4642
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
4643
+ inst.gt = (value, params) => inst.check(_gt(value, params));
4644
+ inst.gte = (value, params) => inst.check(_gte(value, params));
4645
+ inst.min = (value, params) => inst.check(_gte(value, params));
4646
+ inst.lt = (value, params) => inst.check(_lt(value, params));
4647
+ inst.lte = (value, params) => inst.check(_lte(value, params));
4648
+ inst.max = (value, params) => inst.check(_lte(value, params));
4649
+ inst.int = (params) => inst.check(int(params));
4650
+ inst.safe = (params) => inst.check(int(params));
4651
+ inst.positive = (params) => inst.check(_gt(0, params));
4652
+ inst.nonnegative = (params) => inst.check(_gte(0, params));
4653
+ inst.negative = (params) => inst.check(_lt(0, params));
4654
+ inst.nonpositive = (params) => inst.check(_lte(0, params));
4655
+ inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
4656
+ inst.step = (value, params) => inst.check(_multipleOf(value, params));
4657
+ inst.finite = () => inst;
4658
+ const bag = inst._zod.bag;
4659
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
4660
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
4661
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
4662
+ inst.isFinite = true;
4663
+ inst.format = bag.format ?? null;
4664
+ });
4665
+ function number(params) {
4666
+ return _number(ZodNumber, params);
4667
+ }
4668
+ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
4669
+ $ZodNumberFormat.init(inst, def);
4670
+ ZodNumber.init(inst, def);
4671
+ });
4672
+ function int(params) {
4673
+ return _int(ZodNumberFormat, params);
4674
+ }
2422
4675
  const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
2423
4676
  $ZodUnknown.init(inst, def);
2424
4677
  ZodType.init(inst, def);
@@ -2427,6 +4680,14 @@ const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
2427
4680
  function unknown() {
2428
4681
  return _unknown(ZodUnknown);
2429
4682
  }
4683
+ const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
4684
+ $ZodNever.init(inst, def);
4685
+ ZodType.init(inst, def);
4686
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
4687
+ });
4688
+ function never(params) {
4689
+ return _never(ZodNever, params);
4690
+ }
2430
4691
  const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
2431
4692
  $ZodArray.init(inst, def);
2432
4693
  ZodType.init(inst, def);
@@ -2441,6 +4702,53 @@ const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
2441
4702
  function array(element, params) {
2442
4703
  return _array(ZodArray, element, params);
2443
4704
  }
4705
+ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
4706
+ $ZodObjectJIT.init(inst, def);
4707
+ ZodType.init(inst, def);
4708
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
4709
+ defineLazy(inst, "shape", () => {
4710
+ return def.shape;
4711
+ });
4712
+ inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
4713
+ inst.catchall = (catchall) => inst.clone({
4714
+ ...inst._zod.def,
4715
+ catchall
4716
+ });
4717
+ inst.passthrough = () => inst.clone({
4718
+ ...inst._zod.def,
4719
+ catchall: unknown()
4720
+ });
4721
+ inst.loose = () => inst.clone({
4722
+ ...inst._zod.def,
4723
+ catchall: unknown()
4724
+ });
4725
+ inst.strict = () => inst.clone({
4726
+ ...inst._zod.def,
4727
+ catchall: never()
4728
+ });
4729
+ inst.strip = () => inst.clone({
4730
+ ...inst._zod.def,
4731
+ catchall: void 0
4732
+ });
4733
+ inst.extend = (incoming) => {
4734
+ return extend(inst, incoming);
4735
+ };
4736
+ inst.safeExtend = (incoming) => {
4737
+ return safeExtend(inst, incoming);
4738
+ };
4739
+ inst.merge = (other) => merge(inst, other);
4740
+ inst.pick = (mask) => pick(inst, mask);
4741
+ inst.omit = (mask) => omit(inst, mask);
4742
+ inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
4743
+ inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
4744
+ });
4745
+ function object(shape, params) {
4746
+ return new ZodObject({
4747
+ type: "object",
4748
+ shape: shape ?? {},
4749
+ ...normalizeParams(params)
4750
+ });
4751
+ }
2444
4752
  const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
2445
4753
  $ZodUnion.init(inst, def);
2446
4754
  ZodType.init(inst, def);
@@ -2466,6 +4774,58 @@ function intersection(left, right) {
2466
4774
  right
2467
4775
  });
2468
4776
  }
4777
+ const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
4778
+ $ZodRecord.init(inst, def);
4779
+ ZodType.init(inst, def);
4780
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
4781
+ inst.keyType = def.keyType;
4782
+ inst.valueType = def.valueType;
4783
+ });
4784
+ function record(keyType, valueType, params) {
4785
+ return new ZodRecord({
4786
+ type: "record",
4787
+ keyType,
4788
+ valueType,
4789
+ ...normalizeParams(params)
4790
+ });
4791
+ }
4792
+ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
4793
+ $ZodEnum.init(inst, def);
4794
+ ZodType.init(inst, def);
4795
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
4796
+ inst.enum = def.entries;
4797
+ inst.options = Object.values(def.entries);
4798
+ const keys = new Set(Object.keys(def.entries));
4799
+ inst.extract = (values, params) => {
4800
+ const newEntries = {};
4801
+ for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
4802
+ else throw new Error(`Key ${value} not found in enum`);
4803
+ return new ZodEnum({
4804
+ ...def,
4805
+ checks: [],
4806
+ ...normalizeParams(params),
4807
+ entries: newEntries
4808
+ });
4809
+ };
4810
+ inst.exclude = (values, params) => {
4811
+ const newEntries = { ...def.entries };
4812
+ for (const value of values) if (keys.has(value)) delete newEntries[value];
4813
+ else throw new Error(`Key ${value} not found in enum`);
4814
+ return new ZodEnum({
4815
+ ...def,
4816
+ checks: [],
4817
+ ...normalizeParams(params),
4818
+ entries: newEntries
4819
+ });
4820
+ };
4821
+ });
4822
+ function _enum(values, params) {
4823
+ return new ZodEnum({
4824
+ type: "enum",
4825
+ entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
4826
+ ...normalizeParams(params)
4827
+ });
4828
+ }
2469
4829
  const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
2470
4830
  $ZodTransform.init(inst, def);
2471
4831
  ZodType.init(inst, def);
@@ -4053,6 +6413,52 @@ var AIAgent = class {
4053
6413
  }
4054
6414
  };
4055
6415
 
6416
+ //#endregion
6417
+ //#region src/nodes/AssertionNode.ts
6418
+ let AssertionNode = class AssertionNode$1 {
6419
+ kind = "node";
6420
+ outputPorts = ["main"];
6421
+ async execute(args) {
6422
+ const ctx = args.ctx;
6423
+ const config$1 = ctx.config;
6424
+ try {
6425
+ return [...await config$1.assertions(args.item, ctx)];
6426
+ } catch (err) {
6427
+ const message = err instanceof Error ? err.message : String(err);
6428
+ return [{
6429
+ name: config$1.name ?? "assertion",
6430
+ score: 0,
6431
+ errored: true,
6432
+ message
6433
+ }];
6434
+ }
6435
+ }
6436
+ };
6437
+ AssertionNode = __decorate([(0, __codemation_core.node)({ packageName: "@codemation/core-nodes" })], AssertionNode);
6438
+
6439
+ //#endregion
6440
+ //#region src/nodes/assertion.ts
6441
+ /**
6442
+ * Generic assertion node — the "callback" form. For declarative shorthands (StringEquals,
6443
+ * JudgeByAgent) compose this with helpers added in later phases. Sets `emitsAssertions: true`
6444
+ * so host-side persisters know to record its outputs as `TestAssertion` rows.
6445
+ */
6446
+ var Assertion = class {
6447
+ kind = "node";
6448
+ type = AssertionNode;
6449
+ icon;
6450
+ name;
6451
+ id;
6452
+ emitsAssertions = true;
6453
+ assertions;
6454
+ constructor(options) {
6455
+ this.name = options.name ?? "Assertion";
6456
+ this.id = options.id;
6457
+ this.icon = options.icon ?? "lucide:check-circle";
6458
+ this.assertions = options.assertions;
6459
+ }
6460
+ };
6461
+
4056
6462
  //#endregion
4057
6463
  //#region src/nodes/CallbackResultNormalizerFactory.ts
4058
6464
  var CallbackResultNormalizer = class {
@@ -4122,32 +6528,79 @@ let HttpRequestNode = class HttpRequestNode$1 {
4122
6528
  }
4123
6529
  async executeItem(item, ctx) {
4124
6530
  const url = this.resolveUrl(item, ctx);
4125
- const response = await fetch(url, { method: ctx.config.method });
6531
+ const credential = await this.resolveCredential(ctx);
6532
+ const spec = {
6533
+ url,
6534
+ method: ctx.config.method,
6535
+ headers: ctx.config.args.headers,
6536
+ query: ctx.config.args.query,
6537
+ body: ctx.config.args.body,
6538
+ credential,
6539
+ download: {
6540
+ mode: ctx.config.downloadMode,
6541
+ binaryName: ctx.config.binaryName
6542
+ },
6543
+ ctx
6544
+ };
6545
+ const { url: resolvedUrl, init } = await new HttpRequestExecutor(globalThis.fetch, new HttpBodyBuilder(), new HttpUrlBuilder()).buildRequest(spec, item);
6546
+ const response = await globalThis.fetch(resolvedUrl, init);
4126
6547
  const headers = this.readHeaders(response.headers);
4127
6548
  const mimeType = this.resolveMimeType(headers);
4128
- const bodyBinaryName = ctx.config.binaryName;
4129
- const shouldAttachBody = this.shouldAttachBody(ctx.config.downloadMode, mimeType);
4130
- let outputItem = { json: {
4131
- url,
6549
+ const binaryName = ctx.config.binaryName;
6550
+ if (this.shouldAttachBody(ctx.config.downloadMode, mimeType)) {
6551
+ const outputJson = {
6552
+ url: resolvedUrl,
6553
+ method: ctx.config.method,
6554
+ ok: response.ok,
6555
+ status: response.status,
6556
+ statusText: response.statusText,
6557
+ mimeType,
6558
+ headers,
6559
+ bodyBinaryName: binaryName
6560
+ };
6561
+ const attachment = await ctx.binary.attach({
6562
+ name: binaryName,
6563
+ body: response.body ? response.body : new Uint8Array(await response.arrayBuffer()),
6564
+ mimeType,
6565
+ filename: this.resolveFilename(resolvedUrl, headers)
6566
+ });
6567
+ let outputItem = { json: outputJson };
6568
+ outputItem = ctx.binary.withAttachment(outputItem, binaryName, attachment);
6569
+ return outputItem;
6570
+ }
6571
+ const isJson = this.isJsonMimeType(mimeType);
6572
+ let json;
6573
+ let text;
6574
+ if (isJson) try {
6575
+ json = await response.json();
6576
+ } catch {
6577
+ text = await response.text();
6578
+ }
6579
+ else text = await response.text();
6580
+ return { json: {
6581
+ url: resolvedUrl,
4132
6582
  method: ctx.config.method,
4133
6583
  ok: response.ok,
4134
6584
  status: response.status,
4135
6585
  statusText: response.statusText,
4136
6586
  mimeType,
4137
6587
  headers,
4138
- ...shouldAttachBody ? { bodyBinaryName } : {}
6588
+ ...json !== void 0 ? { json } : {},
6589
+ ...text !== void 0 ? { text } : {}
4139
6590
  } };
4140
- if (!shouldAttachBody) return outputItem;
4141
- const attachment = await ctx.binary.attach({
4142
- name: bodyBinaryName,
4143
- body: response.body ? response.body : new Uint8Array(await response.arrayBuffer()),
4144
- mimeType,
4145
- filename: this.resolveFilename(url, headers)
4146
- });
4147
- outputItem = ctx.binary.withAttachment(outputItem, bodyBinaryName, attachment);
4148
- return outputItem;
6591
+ }
6592
+ async resolveCredential(ctx) {
6593
+ const slotKey = ctx.config.args.credentialSlot;
6594
+ if (!slotKey) return;
6595
+ try {
6596
+ return await ctx.getCredential(slotKey);
6597
+ } catch {
6598
+ return;
6599
+ }
4149
6600
  }
4150
6601
  resolveUrl(item, ctx) {
6602
+ const literalUrl = ctx.config.args.url;
6603
+ if (literalUrl && literalUrl.trim().length > 0) return literalUrl.trim();
4151
6604
  const candidate = this.asRecord(item.json)[ctx.config.urlField];
4152
6605
  if (typeof candidate !== "string" || candidate.trim() === "") throw new Error(`HttpRequest node expected item.json.${ctx.config.urlField} to contain a URL string.`);
4153
6606
  return candidate;
@@ -4168,6 +6621,9 @@ let HttpRequestNode = class HttpRequestNode$1 {
4168
6621
  if (!contentType) return "application/octet-stream";
4169
6622
  return contentType.split(";")[0]?.trim() || "application/octet-stream";
4170
6623
  }
6624
+ isJsonMimeType(mimeType) {
6625
+ return mimeType === "application/json" || mimeType.endsWith("+json");
6626
+ }
4171
6627
  shouldAttachBody(mode, mimeType) {
4172
6628
  if (mode === "always") return true;
4173
6629
  if (mode === "never") return false;
@@ -4194,6 +6650,16 @@ HttpRequestNode = __decorate([(0, __codemation_core.node)({ packageName: "@codem
4194
6650
 
4195
6651
  //#endregion
4196
6652
  //#region src/nodes/httpRequest.ts
6653
+ /**
6654
+ * The built-in HTTP request credential type IDs accepted by the `HttpRequest` node.
6655
+ * These match the four generic credential types shipped with `@codemation/core-nodes`.
6656
+ */
6657
+ const HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES = [
6658
+ bearerTokenCredentialType.definition.typeId,
6659
+ apiKeyCredentialType.definition.typeId,
6660
+ basicAuthCredentialType.definition.typeId,
6661
+ oauth2ClientCredentialsType.definition.typeId
6662
+ ];
4197
6663
  var HttpRequest = class {
4198
6664
  kind = "node";
4199
6665
  type = HttpRequestNode;
@@ -4219,6 +6685,16 @@ var HttpRequest = class {
4219
6685
  get downloadMode() {
4220
6686
  return this.args.downloadMode ?? "auto";
4221
6687
  }
6688
+ getCredentialRequirements() {
6689
+ if (!this.args.credentialSlot) return [];
6690
+ return [{
6691
+ slotKey: this.args.credentialSlot,
6692
+ label: "Authentication",
6693
+ acceptedTypes: HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES,
6694
+ optional: true,
6695
+ helpText: "Optional credential for authenticating the HTTP request."
6696
+ }];
6697
+ }
4222
6698
  };
4223
6699
 
4224
6700
  //#endregion
@@ -4344,6 +6820,40 @@ var If = class {
4344
6820
  }
4345
6821
  };
4346
6822
 
6823
+ //#endregion
6824
+ //#region src/nodes/IsTestRunNode.ts
6825
+ let IsTestRunNode = class IsTestRunNode$1 {
6826
+ kind = "node";
6827
+ execute(args) {
6828
+ const isTest = args.ctx.testContext !== void 0;
6829
+ return (0, __codemation_core.emitPorts)({
6830
+ true: isTest ? [args.item] : [],
6831
+ false: isTest ? [] : [args.item]
6832
+ });
6833
+ }
6834
+ };
6835
+ IsTestRunNode = __decorate([(0, __codemation_core.node)({ packageName: "@codemation/core-nodes" })], IsTestRunNode);
6836
+
6837
+ //#endregion
6838
+ //#region src/nodes/isTestRun.ts
6839
+ /**
6840
+ * Branches per-item on whether the current run is a test run. Output ports: `true`, `false`.
6841
+ * The wire payload is unchanged — this is a router, not a transform.
6842
+ */
6843
+ var IsTestRun = class {
6844
+ kind = "node";
6845
+ type = IsTestRunNode;
6846
+ execution = { hint: "local" };
6847
+ icon = "lucide:flask-conical";
6848
+ declaredOutputPorts = ["true", "false"];
6849
+ name;
6850
+ id;
6851
+ constructor(name = "Is test run?", id) {
6852
+ this.name = name;
6853
+ this.id = id;
6854
+ }
6855
+ };
6856
+
4347
6857
  //#endregion
4348
6858
  //#region src/nodes/SwitchNode.ts
4349
6859
  let SwitchNode = class SwitchNode$1 {
@@ -4408,6 +6918,75 @@ var Split = class {
4408
6918
  }
4409
6919
  };
4410
6920
 
6921
+ //#endregion
6922
+ //#region src/nodes/CronTriggerNode.ts
6923
+ let CronTriggerNode = class CronTriggerNode$1 {
6924
+ kind = "trigger";
6925
+ outputPorts = ["main"];
6926
+ async setup(ctx) {
6927
+ const job = ctx.config.createJob(async (self) => {
6928
+ const scheduledFor = self.currentRun()?.toISOString() ?? ctx.now().toISOString();
6929
+ await ctx.emit([{ json: {
6930
+ firedAt: ctx.now().toISOString(),
6931
+ scheduledFor
6932
+ } }]);
6933
+ });
6934
+ ctx.registerCleanup({ stop: () => {
6935
+ job.stop();
6936
+ } });
6937
+ }
6938
+ async execute(items, _ctx) {
6939
+ return { main: items };
6940
+ }
6941
+ async getTestItems(ctx) {
6942
+ const nowIso = ctx.now().toISOString();
6943
+ return [{ json: {
6944
+ firedAt: nowIso,
6945
+ scheduledFor: nowIso
6946
+ } }];
6947
+ }
6948
+ };
6949
+ CronTriggerNode = __decorate([(0, __codemation_core.node)({ packageName: "@codemation/core-nodes" })], CronTriggerNode);
6950
+
6951
+ //#endregion
6952
+ //#region src/nodes/CronTriggerFactory.ts
6953
+ /**
6954
+ * Schedules a workflow on a standard cron expression.
6955
+ *
6956
+ * Each tick emits one item: `{ firedAt: string, scheduledFor: string }` — both ISO-8601 timestamps.
6957
+ * `firedAt` is the wall-clock moment the callback ran; `scheduledFor` is the cron-computed
6958
+ * firing instant (these differ when the job was delayed).
6959
+ *
6960
+ * Timezone defaults to UTC when omitted — cron without an explicit TZ is a DST footgun.
6961
+ */
6962
+ var CronTrigger = class {
6963
+ kind = "trigger";
6964
+ type = CronTriggerNode;
6965
+ icon = "lucide:clock";
6966
+ id;
6967
+ constructor(name, args, id) {
6968
+ this.name = name;
6969
+ this.args = args;
6970
+ new croner.Cron(args.schedule, {
6971
+ paused: true,
6972
+ timezone: args.timezone
6973
+ });
6974
+ this.id = id;
6975
+ }
6976
+ get schedule() {
6977
+ return this.args.schedule;
6978
+ }
6979
+ get timezone() {
6980
+ return this.args.timezone;
6981
+ }
6982
+ createJob(callback) {
6983
+ return new croner.Cron(this.args.schedule, {
6984
+ timezone: this.args.timezone,
6985
+ protect: true
6986
+ }, callback);
6987
+ }
6988
+ };
6989
+
4411
6990
  //#endregion
4412
6991
  //#region src/nodes/ManualTriggerNode.ts
4413
6992
  let ManualTriggerNode = class ManualTriggerNode$1 {
@@ -4639,6 +7218,52 @@ var SubWorkflow = class {
4639
7218
  }
4640
7219
  };
4641
7220
 
7221
+ //#endregion
7222
+ //#region src/nodes/TestTriggerNode.ts
7223
+ let TestTriggerNode = class TestTriggerNode$1 {
7224
+ kind = "trigger";
7225
+ outputPorts = ["main"];
7226
+ async setup(_ctx) {}
7227
+ async execute(items, _ctx) {
7228
+ return { main: items };
7229
+ }
7230
+ };
7231
+ TestTriggerNode = __decorate([(0, __codemation_core.node)({ packageName: "@codemation/core-nodes" })], TestTriggerNode);
7232
+
7233
+ //#endregion
7234
+ //#region src/nodes/testTrigger.ts
7235
+ /**
7236
+ * Trigger config for a test fixture source. Drop one (or more) of these on the canvas alongside
7237
+ * a workflow's live triggers; clicking "Run tests" on the Tests tab invokes
7238
+ * {@link TestTriggerOptions.generateItems} via the TestSuiteOrchestrator.
7239
+ */
7240
+ var TestTrigger = class {
7241
+ kind = "trigger";
7242
+ triggerKind = "test";
7243
+ type = TestTriggerNode;
7244
+ icon;
7245
+ name;
7246
+ id;
7247
+ concurrency;
7248
+ description;
7249
+ generateItems;
7250
+ caseLabel;
7251
+ credentialRequirements;
7252
+ constructor(options) {
7253
+ this.name = options.name ?? "Test trigger";
7254
+ this.id = options.id;
7255
+ this.icon = options.icon ?? "lucide:flask-conical";
7256
+ this.concurrency = options.concurrency;
7257
+ this.description = options.description;
7258
+ this.credentialRequirements = options.credentialRequirements ?? [];
7259
+ this.generateItems = options.generateItems;
7260
+ this.caseLabel = options.caseLabel;
7261
+ }
7262
+ getCredentialRequirements() {
7263
+ return this.credentialRequirements;
7264
+ }
7265
+ };
7266
+
4642
7267
  //#endregion
4643
7268
  //#region src/nodes/WaitDurationFactory.ts
4644
7269
  var WaitDuration = class {
@@ -4819,10 +7444,10 @@ var WorkflowDefinedNodeResolver = class {
4819
7444
  //#endregion
4820
7445
  //#region src/workflowAuthoring/WorkflowDurationParser.types.ts
4821
7446
  var WorkflowDurationParser = class {
4822
- static parse(duration) {
4823
- if (typeof duration === "number") return Number.isFinite(duration) && duration > 0 ? Math.floor(duration) : 0;
4824
- const match = duration.trim().toLowerCase().match(/^(\d+)(ms|s|m|h)$/);
4825
- if (!match) throw new Error(`Unsupported wait duration "${duration}". Use a number of milliseconds or values like "500ms", "2s", "5m".`);
7447
+ static parse(duration$2) {
7448
+ if (typeof duration$2 === "number") return Number.isFinite(duration$2) && duration$2 > 0 ? Math.floor(duration$2) : 0;
7449
+ const match = duration$2.trim().toLowerCase().match(/^(\d+)(ms|s|m|h)$/);
7450
+ if (!match) throw new Error(`Unsupported wait duration "${duration$2}". Use a number of milliseconds or values like "500ms", "2s", "5m".`);
4826
7451
  const value = Number(match[1]);
4827
7452
  const unit = match[2];
4828
7453
  if (unit === "ms") return value;
@@ -4848,8 +7473,8 @@ var WorkflowBranchBuilder = class WorkflowBranchBuilder {
4848
7473
  }
4849
7474
  wait(nameOrDuration, durationOrUndefined, id) {
4850
7475
  const name = typeof nameOrDuration === "string" && durationOrUndefined !== void 0 ? nameOrDuration : "Wait";
4851
- const duration = durationOrUndefined ?? nameOrDuration;
4852
- return this.then(new Wait(name, WorkflowDurationParser.parse(duration), id));
7476
+ const duration$2 = durationOrUndefined ?? nameOrDuration;
7477
+ return this.then(new Wait(name, WorkflowDurationParser.parse(duration$2), id));
4853
7478
  }
4854
7479
  split(nameOrGetter, getElementsOrUndefined, id) {
4855
7480
  const name = typeof nameOrGetter === "string" ? nameOrGetter : "Split";
@@ -4894,8 +7519,8 @@ var WorkflowChain = class WorkflowChain {
4894
7519
  }
4895
7520
  wait(nameOrDuration, durationOrUndefined, id) {
4896
7521
  const name = typeof nameOrDuration === "string" && durationOrUndefined !== void 0 ? nameOrDuration : "Wait";
4897
- const duration = durationOrUndefined ?? nameOrDuration;
4898
- return this.then(new Wait(name, WorkflowDurationParser.parse(duration), id));
7522
+ const duration$2 = durationOrUndefined ?? nameOrDuration;
7523
+ return this.then(new Wait(name, WorkflowDurationParser.parse(duration$2), id));
4899
7524
  }
4900
7525
  split(nameOrGetter, getElementsOrUndefined, id) {
4901
7526
  const name = typeof nameOrGetter === "string" ? nameOrGetter : "Split";
@@ -4995,9 +7620,9 @@ var AIAgentConnectionWorkflowExpander = class {
4995
7620
  const connectionsByParentAndName = this.createConnectionsByParentAndName(workflow$1);
4996
7621
  const extraNodes = [];
4997
7622
  let connectionsChanged = false;
4998
- for (const node$16 of workflow$1.nodes) {
4999
- if (node$16.type !== AIAgentNode || !__codemation_core.AgentConfigInspector.isAgentNodeConfig(node$16.config)) continue;
5000
- for (const connectionNode of __codemation_core.AgentConnectionNodeCollector.collect(node$16.id, node$16.config)) {
7623
+ for (const node$20 of workflow$1.nodes) {
7624
+ if (node$20.type !== AIAgentNode || !__codemation_core.AgentConfigInspector.isAgentNodeConfig(node$20.config)) continue;
7625
+ for (const connectionNode of __codemation_core.AgentConnectionNodeCollector.collect(node$20.id, node$20.config)) {
5001
7626
  if (!existingChildIds.has(connectionNode.nodeId)) {
5002
7627
  this.assertNoIdCollision(workflow$1, extraNodes, existingChildIds, connectionNode.nodeId);
5003
7628
  extraNodes.push({
@@ -5076,6 +7701,129 @@ var ConnectionCredentialNodeConfigFactory = class {
5076
7701
  }
5077
7702
  };
5078
7703
 
7704
+ //#endregion
7705
+ //#region src/nodes/collections/collectionInsertNode.types.ts
7706
+ const collectionInsertNode = (0, __codemation_core.defineNode)({
7707
+ key: "collection-insert",
7708
+ title: "Collection: Insert",
7709
+ description: "Insert a new row into a collection.",
7710
+ icon: "lucide:boxes",
7711
+ configSchema: object({
7712
+ collectionName: string(),
7713
+ data: record(string(), unknown())
7714
+ }),
7715
+ async execute(_args, { config: config$1, execution }) {
7716
+ const store = execution.collections?.[config$1.collectionName];
7717
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7718
+ return await store.insert(config$1.data);
7719
+ }
7720
+ });
7721
+
7722
+ //#endregion
7723
+ //#region src/nodes/collections/collectionGetNode.types.ts
7724
+ const collectionGetNode = (0, __codemation_core.defineNode)({
7725
+ key: "collection-get",
7726
+ title: "Collection: Get",
7727
+ description: "Get a single row by id from a collection.",
7728
+ icon: "lucide:layers",
7729
+ configSchema: object({
7730
+ collectionName: string(),
7731
+ id: string()
7732
+ }),
7733
+ async execute(_args, { config: config$1, execution }) {
7734
+ const store = execution.collections?.[config$1.collectionName];
7735
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7736
+ const row = await store.get(config$1.id);
7737
+ if (row === null) return [];
7738
+ return row;
7739
+ }
7740
+ });
7741
+
7742
+ //#endregion
7743
+ //#region src/nodes/collections/collectionFindOneNode.types.ts
7744
+ const collectionFindOneNode = (0, __codemation_core.defineNode)({
7745
+ key: "collection-find-one",
7746
+ title: "Collection: Find One",
7747
+ description: "Find a single row matching a filter in a collection.",
7748
+ icon: "lucide:filter",
7749
+ configSchema: object({
7750
+ collectionName: string(),
7751
+ where: record(string(), unknown())
7752
+ }),
7753
+ async execute(_args, { config: config$1, execution }) {
7754
+ const store = execution.collections?.[config$1.collectionName];
7755
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7756
+ const row = await store.findOne(config$1.where);
7757
+ if (row === null) return [];
7758
+ return row;
7759
+ }
7760
+ });
7761
+
7762
+ //#endregion
7763
+ //#region src/nodes/collections/collectionListNode.types.ts
7764
+ const collectionListNode = (0, __codemation_core.defineNode)({
7765
+ key: "collection-list",
7766
+ title: "Collection: List",
7767
+ description: "List rows from a collection with optional pagination and filtering.",
7768
+ icon: "lucide:split",
7769
+ configSchema: object({
7770
+ collectionName: string(),
7771
+ limit: number().int().positive().optional(),
7772
+ offset: number().int().nonnegative().optional(),
7773
+ where: record(string(), unknown()).optional()
7774
+ }),
7775
+ async execute(_args, { config: config$1, execution }) {
7776
+ const store = execution.collections?.[config$1.collectionName];
7777
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7778
+ const { rows } = await store.list({
7779
+ limit: config$1.limit,
7780
+ offset: config$1.offset,
7781
+ where: config$1.where
7782
+ });
7783
+ return [...rows];
7784
+ }
7785
+ });
7786
+
7787
+ //#endregion
7788
+ //#region src/nodes/collections/collectionUpdateNode.types.ts
7789
+ const collectionUpdateNode = (0, __codemation_core.defineNode)({
7790
+ key: "collection-update",
7791
+ title: "Collection: Update",
7792
+ description: "Update a row by id in a collection.",
7793
+ icon: "lucide:square-pen",
7794
+ configSchema: object({
7795
+ collectionName: string(),
7796
+ id: string(),
7797
+ patch: record(string(), unknown())
7798
+ }),
7799
+ async execute(_args, { config: config$1, execution }) {
7800
+ const store = execution.collections?.[config$1.collectionName];
7801
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7802
+ return await store.update(config$1.id, config$1.patch);
7803
+ }
7804
+ });
7805
+
7806
+ //#endregion
7807
+ //#region src/nodes/collections/collectionDeleteNode.types.ts
7808
+ const collectionDeleteNode = (0, __codemation_core.defineNode)({
7809
+ key: "collection-delete",
7810
+ title: "Collection: Delete",
7811
+ description: "Delete a row by id from a collection.",
7812
+ icon: "lucide:braces",
7813
+ configSchema: object({
7814
+ collectionName: string(),
7815
+ id: string()
7816
+ }),
7817
+ async execute(_args, { config: config$1, execution }) {
7818
+ const store = execution.collections?.[config$1.collectionName];
7819
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7820
+ return {
7821
+ deleted: (await store.delete(config$1.id)).deleted,
7822
+ id: config$1.id
7823
+ };
7824
+ }
7825
+ });
7826
+
5079
7827
  //#endregion
5080
7828
  exports.AIAgent = AIAgent;
5081
7829
  exports.AIAgentConnectionWorkflowExpander = AIAgentConnectionWorkflowExpander;
@@ -5133,6 +7881,13 @@ Object.defineProperty(exports, 'AggregateNode', {
5133
7881
  return AggregateNode;
5134
7882
  }
5135
7883
  });
7884
+ exports.Assertion = Assertion;
7885
+ Object.defineProperty(exports, 'AssertionNode', {
7886
+ enumerable: true,
7887
+ get: function () {
7888
+ return AssertionNode;
7889
+ }
7890
+ });
5136
7891
  exports.Callback = Callback;
5137
7892
  Object.defineProperty(exports, 'CallbackNode', {
5138
7893
  enumerable: true,
@@ -5150,6 +7905,13 @@ Object.defineProperty(exports, 'ConnectionCredentialNode', {
5150
7905
  });
5151
7906
  exports.ConnectionCredentialNodeConfig = ConnectionCredentialNodeConfig;
5152
7907
  exports.ConnectionCredentialNodeConfigFactory = ConnectionCredentialNodeConfigFactory;
7908
+ exports.CronTrigger = CronTrigger;
7909
+ Object.defineProperty(exports, 'CronTriggerNode', {
7910
+ enumerable: true,
7911
+ get: function () {
7912
+ return CronTriggerNode;
7913
+ }
7914
+ });
5153
7915
  exports.Filter = Filter;
5154
7916
  Object.defineProperty(exports, 'FilterNode', {
5155
7917
  enumerable: true,
@@ -5157,6 +7919,7 @@ Object.defineProperty(exports, 'FilterNode', {
5157
7919
  return FilterNode;
5158
7920
  }
5159
7921
  });
7922
+ exports.HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES = HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES;
5160
7923
  exports.HttpRequest = HttpRequest;
5161
7924
  Object.defineProperty(exports, 'HttpRequestNode', {
5162
7925
  enumerable: true,
@@ -5171,6 +7934,13 @@ Object.defineProperty(exports, 'IfNode', {
5171
7934
  return IfNode;
5172
7935
  }
5173
7936
  });
7937
+ exports.IsTestRun = IsTestRun;
7938
+ Object.defineProperty(exports, 'IsTestRunNode', {
7939
+ enumerable: true,
7940
+ get: function () {
7941
+ return IsTestRunNode;
7942
+ }
7943
+ });
5174
7944
  exports.ManualTrigger = ManualTrigger;
5175
7945
  Object.defineProperty(exports, 'ManualTriggerNode', {
5176
7946
  enumerable: true,
@@ -5234,6 +8004,13 @@ Object.defineProperty(exports, 'SwitchNode', {
5234
8004
  return SwitchNode;
5235
8005
  }
5236
8006
  });
8007
+ exports.TestTrigger = TestTrigger;
8008
+ Object.defineProperty(exports, 'TestTriggerNode', {
8009
+ enumerable: true,
8010
+ get: function () {
8011
+ return TestTriggerNode;
8012
+ }
8013
+ });
5237
8014
  exports.Wait = Wait;
5238
8015
  exports.WaitDuration = WaitDuration;
5239
8016
  Object.defineProperty(exports, 'WaitNode', {
@@ -5254,7 +8031,18 @@ Object.defineProperty(exports, 'WebhookTriggerNode', {
5254
8031
  exports.WorkflowAuthoringBuilder = WorkflowAuthoringBuilder;
5255
8032
  exports.WorkflowBranchBuilder = WorkflowBranchBuilder;
5256
8033
  exports.WorkflowChain = WorkflowChain;
8034
+ exports.apiKeyCredentialType = apiKeyCredentialType;
8035
+ exports.basicAuthCredentialType = basicAuthCredentialType;
8036
+ exports.bearerTokenCredentialType = bearerTokenCredentialType;
8037
+ exports.collectionDeleteNode = collectionDeleteNode;
8038
+ exports.collectionFindOneNode = collectionFindOneNode;
8039
+ exports.collectionGetNode = collectionGetNode;
8040
+ exports.collectionInsertNode = collectionInsertNode;
8041
+ exports.collectionListNode = collectionListNode;
8042
+ exports.collectionUpdateNode = collectionUpdateNode;
5257
8043
  exports.createWorkflowBuilder = createWorkflowBuilder;
8044
+ exports.defineRestNode = defineRestNode;
8045
+ exports.oauth2ClientCredentialsType = oauth2ClientCredentialsType;
5258
8046
  exports.openAiChatModelPresets = openAiChatModelPresets;
5259
8047
  exports.registerCoreNodes = registerCoreNodes;
5260
8048
  exports.workflow = workflow;