@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.js CHANGED
@@ -1,8 +1,527 @@
1
- import { AgentConfigInspector, AgentConnectionNodeCollector, AgentGuardrailDefaults, AgentMessageConfigNormalizer, CallableToolConfig, ChildExecutionScopeFactory, CodemationTelemetryAttributeNames, CodemationTelemetryMetricNames, ConnectionInvocationIdFactory, ConnectionNodeIdFactory, CoreTokens, DefinedNodeRegistry, GenAiTelemetryAttributeNames, ItemExprResolver, ItemsInputNormalizer, NodeBackedToolConfig, NodeOutputNormalizer, RetryPolicy, RunnableOutputBehaviorResolver, WorkflowBuilder, chatModel, emitPorts, getOriginIndexFromItem, inject, injectable, isPortsEmission, node } from "@codemation/core";
1
+ import { AgentConfigInspector, AgentConnectionNodeCollector, AgentGuardrailDefaults, AgentMessageConfigNormalizer, CallableToolConfig, ChildExecutionScopeFactory, CodemationTelemetryAttributeNames, CodemationTelemetryMetricNames, ConnectionInvocationIdFactory, ConnectionNodeIdFactory, CoreTokens, DefinedNodeRegistry, GenAiTelemetryAttributeNames, ItemExprResolver, ItemsInputNormalizer, NodeBackedToolConfig, NodeOutputNormalizer, RetryPolicy, RunnableOutputBehaviorResolver, WorkflowBuilder, chatModel, defineCredential, defineNode, emitPorts, getOriginIndexFromItem, inject, injectable, isPortsEmission, node } from "@codemation/core";
2
2
  import { createOpenAI } from "@ai-sdk/openai";
3
3
  import { CredentialResolverFactory } from "@codemation/core/bootstrap";
4
4
  import { Output, generateText, jsonSchema } from "ai";
5
+ import { Cron } from "croner";
5
6
 
7
+ //#region src/credentials/ApiKeyCredentialType.ts
8
+ /**
9
+ * API key credential that injects a key either as an HTTP header or a query parameter.
10
+ */
11
+ const apiKeyCredentialType = defineCredential({
12
+ key: "core-nodes.api-key",
13
+ label: "API Key",
14
+ description: "Authenticates requests by injecting an API key into a header or query parameter.",
15
+ public: {
16
+ placement: {
17
+ label: "Placement",
18
+ type: "string",
19
+ helpText: "Where to send the key: \"header\" (default) or \"query\".",
20
+ placeholder: "header"
21
+ },
22
+ name: {
23
+ label: "Parameter name",
24
+ type: "string",
25
+ helpText: "Header or query param name. Defaults to \"X-API-Key\" for headers, \"api_key\" for query.",
26
+ placeholder: "X-API-Key"
27
+ }
28
+ },
29
+ secret: { apiKey: {
30
+ label: "API Key",
31
+ type: "password",
32
+ required: true,
33
+ helpText: "The secret API key value."
34
+ } },
35
+ async createSession(args) {
36
+ const apiKey = String(args.material.apiKey ?? "");
37
+ if (!apiKey) throw new Error("API key credential material is incomplete: apiKey is required.");
38
+ const isQuery = String(args.publicConfig.placement ?? "header").toLowerCase() === "query";
39
+ const defaultName = isQuery ? "api_key" : "X-API-Key";
40
+ const paramName = String(args.publicConfig.name ?? "").trim() || defaultName;
41
+ return { applyToRequest: (_spec) => {
42
+ if (isQuery) return { query: { [paramName]: apiKey } };
43
+ return { headers: { [paramName]: apiKey } };
44
+ } };
45
+ },
46
+ async test(args) {
47
+ const apiKey = String(args.material.apiKey ?? "");
48
+ return {
49
+ status: apiKey.length > 0 ? "healthy" : "failing",
50
+ message: apiKey.length > 0 ? "API key is configured." : "API key is missing.",
51
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
52
+ };
53
+ }
54
+ });
55
+
56
+ //#endregion
57
+ //#region src/credentials/BasicAuthCredentialType.ts
58
+ /**
59
+ * HTTP Basic authentication credential.
60
+ * Session sets `Authorization: Basic <base64(username:password)>`.
61
+ */
62
+ const basicAuthCredentialType = defineCredential({
63
+ key: "core-nodes.basic-auth",
64
+ label: "Basic Auth",
65
+ description: "Authenticates requests using HTTP Basic Authentication (username + password).",
66
+ public: { username: {
67
+ label: "Username",
68
+ type: "string",
69
+ required: true,
70
+ helpText: "The username for HTTP Basic Authentication."
71
+ } },
72
+ secret: { password: {
73
+ label: "Password",
74
+ type: "password",
75
+ required: true,
76
+ helpText: "The password for HTTP Basic Authentication."
77
+ } },
78
+ async createSession(args) {
79
+ const username = String(args.publicConfig.username ?? "");
80
+ const password = String(args.material.password ?? "");
81
+ if (!username) throw new Error("Basic Auth credential is incomplete: username is required.");
82
+ const encoded = Buffer.from(`${username}:${password}`).toString("base64");
83
+ return { applyToRequest: (_spec) => ({ headers: { authorization: `Basic ${encoded}` } }) };
84
+ },
85
+ async test(args) {
86
+ const username = String(args.publicConfig.username ?? "");
87
+ const password = String(args.material.password ?? "");
88
+ const ok = username.length > 0 && password.length > 0;
89
+ return {
90
+ status: ok ? "healthy" : "failing",
91
+ message: ok ? "Basic Auth credentials are configured." : "Username or password is missing.",
92
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
93
+ };
94
+ }
95
+ });
96
+
97
+ //#endregion
98
+ //#region src/credentials/BearerTokenCredentialType.ts
99
+ /**
100
+ * Simple Bearer token credential.
101
+ * Session sets `Authorization: Bearer <token>` on every request.
102
+ */
103
+ const bearerTokenCredentialType = defineCredential({
104
+ key: "core-nodes.bearer-token",
105
+ label: "Bearer Token",
106
+ description: "Authenticates requests using a static Bearer token in the Authorization header.",
107
+ public: {},
108
+ secret: { token: {
109
+ label: "Token",
110
+ type: "password",
111
+ required: true,
112
+ helpText: "The Bearer token to include in the Authorization header."
113
+ } },
114
+ async createSession(args) {
115
+ const token = String(args.material.token ?? "");
116
+ if (!token) throw new Error("Bearer token credential material is incomplete: token is required.");
117
+ return { applyToRequest: (_spec) => ({ headers: { authorization: `Bearer ${token}` } }) };
118
+ },
119
+ async test(args) {
120
+ const token = String(args.material.token ?? "");
121
+ return {
122
+ status: token.length > 0 ? "healthy" : "failing",
123
+ message: token.length > 0 ? "Bearer token is configured." : "Token is missing.",
124
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
125
+ };
126
+ }
127
+ });
128
+
129
+ //#endregion
130
+ //#region src/credentials/OAuth2TokenExchangeFactory.ts
131
+ var OAuth2TokenExchangeFactory = class {
132
+ async create(args) {
133
+ const body = new URLSearchParams({
134
+ grant_type: "client_credentials",
135
+ client_id: args.clientId
136
+ });
137
+ if (args.scopes) body.set("scope", args.scopes);
138
+ if (args.audience) body.set("audience", args.audience);
139
+ const encoded = Buffer.from(`${args.clientId}:${args.clientSecret}`).toString("base64");
140
+ const response = await globalThis.fetch(args.tokenUrl, {
141
+ method: "POST",
142
+ headers: {
143
+ "content-type": "application/x-www-form-urlencoded",
144
+ authorization: `Basic ${encoded}`
145
+ },
146
+ body: body.toString()
147
+ });
148
+ if (!response.ok) {
149
+ const text = await response.text().catch(() => "");
150
+ throw new Error(`Token exchange failed (${response.status} ${response.statusText}): ${text}`);
151
+ }
152
+ const json = await response.json();
153
+ const token = String(json["access_token"] ?? "");
154
+ if (!token) throw new Error("Token exchange response did not include an access_token.");
155
+ return token;
156
+ }
157
+ };
158
+
159
+ //#endregion
160
+ //#region src/credentials/OAuth2ClientCredentialsTypeFactory.ts
161
+ /**
162
+ * OAuth2 client-credentials flow credential.
163
+ *
164
+ * This is a machine-to-machine flow: no user redirect occurs. The session
165
+ * POSTs to the configured `tokenUrl` with `client_credentials` grant, caches
166
+ * the resulting access token for the duration of the session, and injects it
167
+ * as `Authorization: Bearer <token>` on each request.
168
+ *
169
+ * Token caching is per-session only (one createSession call = one token fetch
170
+ * at most). Cross-session caching would require host-level state and is out of
171
+ * scope here. Because the engine creates a fresh session per execution, a new
172
+ * token is fetched once per node activation.
173
+ *
174
+ * NOTE: `auth` is intentionally omitted from the definition. The OAuth2
175
+ * `auth: { kind: "oauth2" }` shape signals an authorization-code / user-redirect
176
+ * flow; using it here would cause the host UI to render an OAuth consent button
177
+ * that goes nowhere. Client-credentials is a purely server-side flow.
178
+ */
179
+ const oauth2ClientCredentialsType = defineCredential({
180
+ key: "core-nodes.oauth2-client-credentials",
181
+ label: "OAuth2 Client Credentials",
182
+ description: "Machine-to-machine OAuth2 using the client_credentials grant. Exchanges client ID and secret for a bearer token before each workflow execution.",
183
+ public: {
184
+ tokenUrl: {
185
+ label: "Token URL",
186
+ type: "string",
187
+ required: true,
188
+ helpText: "The token endpoint URL, e.g. https://auth.example.com/oauth/token."
189
+ },
190
+ scopes: {
191
+ label: "Scopes",
192
+ type: "string",
193
+ helpText: "Space-separated list of OAuth2 scopes to request (optional)."
194
+ },
195
+ audience: {
196
+ label: "Audience",
197
+ type: "string",
198
+ helpText: "Optional audience parameter sent to the token endpoint.",
199
+ visibility: "advanced"
200
+ }
201
+ },
202
+ secret: {
203
+ clientId: {
204
+ label: "Client ID",
205
+ type: "string",
206
+ required: true
207
+ },
208
+ clientSecret: {
209
+ label: "Client Secret",
210
+ type: "password",
211
+ required: true
212
+ }
213
+ },
214
+ async createSession(args) {
215
+ const tokenUrl = String(args.publicConfig.tokenUrl ?? "");
216
+ const clientId = String(args.material.clientId ?? "");
217
+ const clientSecret = String(args.material.clientSecret ?? "");
218
+ if (!tokenUrl || !clientId || !clientSecret) throw new Error("OAuth2 client credentials are incomplete: tokenUrl, clientId, and clientSecret are required.");
219
+ const accessToken = await new OAuth2TokenExchangeFactory().create({
220
+ tokenUrl,
221
+ clientId,
222
+ clientSecret,
223
+ scopes: String(args.publicConfig.scopes ?? ""),
224
+ audience: String(args.publicConfig.audience ?? "")
225
+ });
226
+ return { applyToRequest: (_spec) => ({ headers: { authorization: `Bearer ${accessToken}` } }) };
227
+ },
228
+ async test(args) {
229
+ const tokenUrl = String(args.publicConfig.tokenUrl ?? "");
230
+ const clientId = String(args.material.clientId ?? "");
231
+ const clientSecret = String(args.material.clientSecret ?? "");
232
+ if (!tokenUrl || !clientId || !clientSecret) return {
233
+ status: "failing",
234
+ message: "tokenUrl, clientId, and clientSecret are all required.",
235
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
236
+ };
237
+ try {
238
+ await new OAuth2TokenExchangeFactory().create({
239
+ tokenUrl,
240
+ clientId,
241
+ clientSecret,
242
+ scopes: String(args.publicConfig.scopes ?? ""),
243
+ audience: String(args.publicConfig.audience ?? "")
244
+ });
245
+ return {
246
+ status: "healthy",
247
+ message: "Token exchange succeeded.",
248
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
249
+ };
250
+ } catch (error) {
251
+ return {
252
+ status: "failing",
253
+ message: error instanceof Error ? error.message : String(error),
254
+ testedAt: (/* @__PURE__ */ new Date()).toISOString()
255
+ };
256
+ }
257
+ }
258
+ });
259
+
260
+ //#endregion
261
+ //#region src/http/HttpRequestExecutor.ts
262
+ /**
263
+ * Executes a single HTTP request described by {@link HttpRequestSpec}.
264
+ *
265
+ * - Credential sessions provide header/query deltas via `applyToRequest`.
266
+ * - Body encoding is delegated to {@link HttpBodyBuilder}.
267
+ * - URL query merging is delegated to {@link HttpUrlBuilder}.
268
+ * - Binary response bodies: when `download.mode` triggers binary attach, the
269
+ * `bodyBinaryName` field is set in the result but the body is NOT read here.
270
+ * Callers that need binary attachment should use `buildRequest` to get the
271
+ * resolved URL + init and make the fetch + binary attach themselves.
272
+ *
273
+ * Collaborators (`fetch`, body builder, url builder) are injected so callers
274
+ * own construction at composition roots and tests can supply deterministic stubs.
275
+ */
276
+ var HttpRequestExecutor = class {
277
+ constructor(fetchFn, bodyBuilder, urlBuilder) {
278
+ this.fetchFn = fetchFn;
279
+ this.bodyBuilder = bodyBuilder;
280
+ this.urlBuilder = urlBuilder;
281
+ }
282
+ /**
283
+ * Builds the fetch init (headers, query, body) from the spec + credential delta,
284
+ * returning both the resolved URL and the RequestInit so callers can make the
285
+ * actual fetch call themselves (useful for streaming / binary attach).
286
+ */
287
+ async buildRequest(spec, item) {
288
+ const credentialDelta = spec.credential?.applyToRequest(spec) ?? {};
289
+ const mergedHeaders = {
290
+ ...spec.headers ?? {},
291
+ ...credentialDelta.headers ?? {}
292
+ };
293
+ const mergedQuery = {
294
+ ...spec.query ?? {},
295
+ ...credentialDelta.query ?? {}
296
+ };
297
+ const encodedBody = await this.bodyBuilder.build(spec.body, item, spec.ctx);
298
+ if (encodedBody && encodedBody.contentType) mergedHeaders["content-type"] = encodedBody.contentType;
299
+ return {
300
+ url: this.urlBuilder.build(spec.url, mergedQuery),
301
+ init: {
302
+ method: spec.method,
303
+ headers: mergedHeaders,
304
+ ...encodedBody ? { body: encodedBody.body } : {}
305
+ }
306
+ };
307
+ }
308
+ /**
309
+ * Executes an HTTP request and returns parsed result.
310
+ * For binary downloads (when `shouldAttachBody` is true), the body is NOT consumed
311
+ * and callers must call `ctx.binary.attach` directly using the resolved URL + init
312
+ * (available via `buildRequest`).
313
+ */
314
+ async execute(spec, item) {
315
+ const { url: resolvedUrl, init } = await this.buildRequest(spec, item);
316
+ const response = await this.fetchFn(resolvedUrl, init);
317
+ const responseHeaders = this.readHeaders(response.headers);
318
+ const mimeType = this.resolveMimeType(responseHeaders);
319
+ const downloadMode = spec.download?.mode ?? "auto";
320
+ const binaryName = spec.download?.binaryName ?? "body";
321
+ const shouldDownload = this.shouldAttachBody(downloadMode, mimeType);
322
+ const isJson = this.isJsonMimeType(mimeType);
323
+ let json;
324
+ let text;
325
+ let bodyBinaryName;
326
+ if (shouldDownload) bodyBinaryName = binaryName;
327
+ else if (isJson) try {
328
+ json = await response.json();
329
+ } catch {
330
+ text = await response.text();
331
+ }
332
+ else text = await response.text();
333
+ return {
334
+ url: resolvedUrl,
335
+ method: spec.method.toUpperCase(),
336
+ status: response.status,
337
+ ok: response.ok,
338
+ statusText: response.statusText,
339
+ mimeType,
340
+ headers: responseHeaders,
341
+ ...json !== void 0 ? { json } : {},
342
+ ...text !== void 0 ? { text } : {},
343
+ ...bodyBinaryName !== void 0 ? { bodyBinaryName } : {}
344
+ };
345
+ }
346
+ readHeaders(headers) {
347
+ const values = {};
348
+ headers.forEach((value, key) => {
349
+ values[key] = value;
350
+ });
351
+ return values;
352
+ }
353
+ resolveMimeType(headers) {
354
+ const contentType = headers["content-type"];
355
+ if (!contentType) return "application/octet-stream";
356
+ return contentType.split(";")[0]?.trim() || "application/octet-stream";
357
+ }
358
+ isJsonMimeType(mimeType) {
359
+ return mimeType === "application/json" || mimeType.endsWith("+json");
360
+ }
361
+ shouldAttachBody(mode, mimeType) {
362
+ if (mode === "always") return true;
363
+ if (mode === "never") return false;
364
+ return mimeType.startsWith("image/") || mimeType.startsWith("audio/") || mimeType.startsWith("video/") || mimeType === "application/pdf";
365
+ }
366
+ };
367
+
368
+ //#endregion
369
+ //#region src/http/HttpBodyBuilder.ts
370
+ /**
371
+ * Builds a fetch-compatible `BodyInit` + Content-Type pair from an {@link HttpBodySpec}.
372
+ * Multipart binaries are read from `item.binary` via `ctx.binary.openReadStream`.
373
+ */
374
+ var HttpBodyBuilder = class {
375
+ async build(spec, item, ctx) {
376
+ if (!spec || spec.kind === "none") return;
377
+ if (spec.kind === "json") return {
378
+ body: JSON.stringify(spec.data),
379
+ contentType: "application/json"
380
+ };
381
+ if (spec.kind === "form") {
382
+ const params = new URLSearchParams();
383
+ for (const [key, value] of Object.entries(spec.data)) params.append(key, value);
384
+ return {
385
+ body: params.toString(),
386
+ contentType: "application/x-www-form-urlencoded"
387
+ };
388
+ }
389
+ if (spec.kind === "multipart") {
390
+ const formData = new FormData();
391
+ for (const [key, value] of Object.entries(spec.fields)) formData.append(key, value);
392
+ if (spec.binaries) for (const [fieldName, binaryRef] of Object.entries(spec.binaries)) {
393
+ const attachment = item.binary?.[binaryRef];
394
+ if (attachment) {
395
+ const readResult = await ctx.binary.openReadStream(attachment);
396
+ if (readResult) {
397
+ const reader = readResult.body.getReader();
398
+ const chunks = [];
399
+ let done = false;
400
+ while (!done) {
401
+ const result = await reader.read();
402
+ done = result.done;
403
+ if (result.value) chunks.push(result.value);
404
+ }
405
+ const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
406
+ const merged = new Uint8Array(totalLength);
407
+ let offset = 0;
408
+ for (const chunk of chunks) {
409
+ merged.set(chunk, offset);
410
+ offset += chunk.length;
411
+ }
412
+ const blob = new Blob([merged], { type: attachment.mimeType });
413
+ formData.append(fieldName, blob, attachment.filename ?? binaryRef);
414
+ }
415
+ }
416
+ }
417
+ return {
418
+ body: formData,
419
+ contentType: ""
420
+ };
421
+ }
422
+ }
423
+ };
424
+
425
+ //#endregion
426
+ //#region src/http/HttpUrlBuilder.ts
427
+ /**
428
+ * Merges query parameters into a base URL.
429
+ * Handles both scalar and array values, and preserves any existing params.
430
+ */
431
+ var HttpUrlBuilder = class {
432
+ build(baseUrl, query) {
433
+ if (!query || Object.keys(query).length === 0) return baseUrl;
434
+ const parsed = new URL(baseUrl);
435
+ for (const [key, value] of Object.entries(query)) if (Array.isArray(value)) for (const entry of value) parsed.searchParams.append(key, entry);
436
+ else parsed.searchParams.append(key, value);
437
+ return parsed.toString();
438
+ }
439
+ };
440
+
441
+ //#endregion
442
+ //#region src/authoring/defineRestNode.types.ts
443
+ /**
444
+ * Substitutes `{name}` placeholders in a path template using values from `params`.
445
+ */
446
+ function substitutePath(template, params) {
447
+ return template.replace(/\{([^}]+)}/g, (_match, key) => {
448
+ const value = params[key];
449
+ return value !== void 0 ? String(value) : `{${key}}`;
450
+ });
451
+ }
452
+ /**
453
+ * Declarative helper for creating thin API-wrapper nodes.
454
+ *
455
+ * Usage:
456
+ * ```ts
457
+ * export const postMessage = defineRestNode({
458
+ * key: "slack.post-message",
459
+ * title: "Send Slack message",
460
+ * icon: "si:slack",
461
+ * api: { baseUrl: "https://slack.com/api", path: "/chat.postMessage", method: "POST" },
462
+ * credentials: { auth: bearerTokenCredentialType },
463
+ * inputSchema: z.object({ channel: z.string(), text: z.string() }),
464
+ * request: ({ input }) => ({
465
+ * body: { kind: "json", data: { channel: input.channel, text: input.text } },
466
+ * }),
467
+ * response: ({ json }) => ({ messageTs: (json as any).ts }),
468
+ * });
469
+ * ```
470
+ *
471
+ * - `defineRestNode` is a thin wrapper over `defineNode`; it does not introduce a new runtime kind.
472
+ * - Credential sessions are resolved via the `credentials` binding map (same as `defineNode`).
473
+ * - Path `{placeholder}` substitution is applied from `input` keys before the request is made.
474
+ * - Non-2xx responses throw an `Error` by default (`errorPolicy: "throw"`).
475
+ */
476
+ function defineRestNode(options) {
477
+ const errorPolicy = options.errorPolicy ?? "throw";
478
+ return defineNode({
479
+ key: options.key,
480
+ title: options.title,
481
+ description: options.description,
482
+ icon: options.icon,
483
+ credentials: options.credentials,
484
+ inputSchema: options.inputSchema,
485
+ async execute({ input, item, ctx }, { credentials }) {
486
+ const credentialSlot = options.credentials ? Object.keys(options.credentials)[0] : void 0;
487
+ const credential = credentialSlot ? await credentials[credentialSlot]?.() : void 0;
488
+ const inputRecord = input ?? {};
489
+ const requestShape = options.request ? await options.request({ input }) : {};
490
+ const pathParams = {
491
+ ...inputRecord,
492
+ ...requestShape.pathParams ?? {}
493
+ };
494
+ const resolvedPath = substitutePath(options.api.path, pathParams);
495
+ const resolvedUrl = `${options.api.baseUrl}${resolvedPath}`;
496
+ const result = await new HttpRequestExecutor(globalThis.fetch, new HttpBodyBuilder(), new HttpUrlBuilder()).execute({
497
+ url: resolvedUrl,
498
+ method: (options.api.method ?? "GET").toUpperCase(),
499
+ headers: requestShape.headers,
500
+ query: requestShape.query,
501
+ body: requestShape.body,
502
+ credential,
503
+ ctx
504
+ }, item);
505
+ if (errorPolicy === "throw" && !result.ok) throw new Error(`HTTP ${result.status} ${result.statusText} for ${result.method} ${result.url}`);
506
+ const responseCtx = {
507
+ status: result.status,
508
+ ok: result.ok,
509
+ statusText: result.statusText,
510
+ mimeType: result.mimeType,
511
+ headers: result.headers,
512
+ ...result.json !== void 0 ? { json: result.json } : {},
513
+ ...result.text !== void 0 ? { text: result.text } : {}
514
+ };
515
+ if (options.response) return await options.response({
516
+ ...responseCtx,
517
+ input
518
+ });
519
+ return { json: responseCtx };
520
+ }
521
+ });
522
+ }
523
+
524
+ //#endregion
6
525
  //#region \0@oxc-project+runtime@0.95.0/helpers/decorate.js
7
526
  function __decorate(decorators, target, key, desc) {
8
527
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -121,10 +640,21 @@ function cleanRegex(source) {
121
640
  const end = source.endsWith("$") ? source.length - 1 : source.length;
122
641
  return source.slice(start, end);
123
642
  }
643
+ function floatSafeRemainder(val, step) {
644
+ const valDecCount = (val.toString().split(".")[1] || "").length;
645
+ const stepString = step.toString();
646
+ let stepDecCount = (stepString.split(".")[1] || "").length;
647
+ if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
648
+ const match = stepString.match(/\d?e-(\d?)/);
649
+ if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
650
+ }
651
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
652
+ return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
653
+ }
124
654
  const EVALUATING = Symbol("evaluating");
125
- function defineLazy(object, key, getter) {
655
+ function defineLazy(object$1, key, getter) {
126
656
  let value = void 0;
127
- Object.defineProperty(object, key, {
657
+ Object.defineProperty(object$1, key, {
128
658
  get() {
129
659
  if (value === EVALUATING) return;
130
660
  if (value === void 0) {
@@ -134,11 +664,19 @@ function defineLazy(object, key, getter) {
134
664
  return value;
135
665
  },
136
666
  set(v) {
137
- Object.defineProperty(object, key, { value: v });
667
+ Object.defineProperty(object$1, key, { value: v });
138
668
  },
139
669
  configurable: true
140
670
  });
141
671
  }
672
+ function assignProp(target, prop, value) {
673
+ Object.defineProperty(target, prop, {
674
+ value,
675
+ writable: true,
676
+ enumerable: true,
677
+ configurable: true
678
+ });
679
+ }
142
680
  function mergeDefs(...defs) {
143
681
  const mergedDescriptors = {};
144
682
  for (const def of defs) {
@@ -147,6 +685,12 @@ function mergeDefs(...defs) {
147
685
  }
148
686
  return Object.defineProperties({}, mergedDescriptors);
149
687
  }
688
+ function esc(str) {
689
+ return JSON.stringify(str);
690
+ }
691
+ function slugify(input) {
692
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
693
+ }
150
694
  const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
151
695
  function isObject(data) {
152
696
  return typeof data === "object" && data !== null && !Array.isArray(data);
@@ -175,6 +719,14 @@ function shallowClone(o) {
175
719
  if (Array.isArray(o)) return [...o];
176
720
  return o;
177
721
  }
722
+ const propertyKeyTypes = new Set([
723
+ "string",
724
+ "number",
725
+ "symbol"
726
+ ]);
727
+ function escapeRegex(str) {
728
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
729
+ }
178
730
  function clone(inst, def, params) {
179
731
  const cl = new inst._zod.constr(def ?? inst._zod.def);
180
732
  if (!def || params?.parent) cl._zod.parent = inst;
@@ -195,6 +747,11 @@ function normalizeParams(_params) {
195
747
  };
196
748
  return params;
197
749
  }
750
+ function optionalKeys(shape) {
751
+ return Object.keys(shape).filter((k) => {
752
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
753
+ });
754
+ }
198
755
  const NUMBER_FORMAT_RANGES = {
199
756
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
200
757
  int32: [-2147483648, 2147483647],
@@ -202,6 +759,130 @@ const NUMBER_FORMAT_RANGES = {
202
759
  float32: [-34028234663852886e22, 34028234663852886e22],
203
760
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
204
761
  };
762
+ function pick(schema, mask) {
763
+ const currDef = schema._zod.def;
764
+ const checks = currDef.checks;
765
+ if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
766
+ return clone(schema, mergeDefs(schema._zod.def, {
767
+ get shape() {
768
+ const newShape = {};
769
+ for (const key in mask) {
770
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
771
+ if (!mask[key]) continue;
772
+ newShape[key] = currDef.shape[key];
773
+ }
774
+ assignProp(this, "shape", newShape);
775
+ return newShape;
776
+ },
777
+ checks: []
778
+ }));
779
+ }
780
+ function omit(schema, mask) {
781
+ const currDef = schema._zod.def;
782
+ const checks = currDef.checks;
783
+ if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
784
+ return clone(schema, mergeDefs(schema._zod.def, {
785
+ get shape() {
786
+ const newShape = { ...schema._zod.def.shape };
787
+ for (const key in mask) {
788
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
789
+ if (!mask[key]) continue;
790
+ delete newShape[key];
791
+ }
792
+ assignProp(this, "shape", newShape);
793
+ return newShape;
794
+ },
795
+ checks: []
796
+ }));
797
+ }
798
+ function extend(schema, shape) {
799
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
800
+ const checks = schema._zod.def.checks;
801
+ if (checks && checks.length > 0) {
802
+ const existingShape = schema._zod.def.shape;
803
+ 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.");
804
+ }
805
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
806
+ const _shape = {
807
+ ...schema._zod.def.shape,
808
+ ...shape
809
+ };
810
+ assignProp(this, "shape", _shape);
811
+ return _shape;
812
+ } }));
813
+ }
814
+ function safeExtend(schema, shape) {
815
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
816
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
817
+ const _shape = {
818
+ ...schema._zod.def.shape,
819
+ ...shape
820
+ };
821
+ assignProp(this, "shape", _shape);
822
+ return _shape;
823
+ } }));
824
+ }
825
+ function merge(a, b) {
826
+ return clone(a, mergeDefs(a._zod.def, {
827
+ get shape() {
828
+ const _shape = {
829
+ ...a._zod.def.shape,
830
+ ...b._zod.def.shape
831
+ };
832
+ assignProp(this, "shape", _shape);
833
+ return _shape;
834
+ },
835
+ get catchall() {
836
+ return b._zod.def.catchall;
837
+ },
838
+ checks: []
839
+ }));
840
+ }
841
+ function partial(Class, schema, mask) {
842
+ const checks = schema._zod.def.checks;
843
+ if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
844
+ return clone(schema, mergeDefs(schema._zod.def, {
845
+ get shape() {
846
+ const oldShape = schema._zod.def.shape;
847
+ const shape = { ...oldShape };
848
+ if (mask) for (const key in mask) {
849
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
850
+ if (!mask[key]) continue;
851
+ shape[key] = Class ? new Class({
852
+ type: "optional",
853
+ innerType: oldShape[key]
854
+ }) : oldShape[key];
855
+ }
856
+ else for (const key in oldShape) shape[key] = Class ? new Class({
857
+ type: "optional",
858
+ innerType: oldShape[key]
859
+ }) : oldShape[key];
860
+ assignProp(this, "shape", shape);
861
+ return shape;
862
+ },
863
+ checks: []
864
+ }));
865
+ }
866
+ function required(Class, schema, mask) {
867
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
868
+ const oldShape = schema._zod.def.shape;
869
+ const shape = { ...oldShape };
870
+ if (mask) for (const key in mask) {
871
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
872
+ if (!mask[key]) continue;
873
+ shape[key] = new Class({
874
+ type: "nonoptional",
875
+ innerType: oldShape[key]
876
+ });
877
+ }
878
+ else for (const key in oldShape) shape[key] = new Class({
879
+ type: "nonoptional",
880
+ innerType: oldShape[key]
881
+ });
882
+ assignProp(this, "shape", shape);
883
+ return shape;
884
+ } }));
885
+ }
205
886
  function aborted(x, startIndex = 0) {
206
887
  if (x.aborted === true) return true;
207
888
  for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
@@ -407,6 +1088,64 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
407
1088
  };
408
1089
  const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
409
1090
 
1091
+ //#endregion
1092
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js
1093
+ const cuid = /^[cC][^\s-]{8,}$/;
1094
+ const cuid2 = /^[0-9a-z]+$/;
1095
+ const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
1096
+ const xid = /^[0-9a-vA-V]{20}$/;
1097
+ const ksuid = /^[A-Za-z0-9]{27}$/;
1098
+ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
1099
+ /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
1100
+ 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)?)?)$/;
1101
+ /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
1102
+ 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})$/;
1103
+ /** Returns a regex for validating an RFC 9562/4122 UUID.
1104
+ *
1105
+ * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
1106
+ const uuid = (version$1) => {
1107
+ 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)$/;
1108
+ 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})$`);
1109
+ };
1110
+ /** Practical email validation */
1111
+ const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
1112
+ const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1113
+ function emoji() {
1114
+ return new RegExp(_emoji$1, "u");
1115
+ }
1116
+ 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])$/;
1117
+ 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}|:))$/;
1118
+ 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])$/;
1119
+ 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])$/;
1120
+ const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
1121
+ const base64url = /^[A-Za-z0-9_-]*$/;
1122
+ const e164 = /^\+[1-9]\d{6,14}$/;
1123
+ 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])))`;
1124
+ const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
1125
+ function timeSource(args) {
1126
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
1127
+ 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+)?)?`;
1128
+ }
1129
+ function time$1(args) {
1130
+ return /* @__PURE__ */ new RegExp(`^${timeSource(args)}$`);
1131
+ }
1132
+ function datetime$1(args) {
1133
+ const time$2 = timeSource({ precision: args.precision });
1134
+ const opts = ["Z"];
1135
+ if (args.local) opts.push("");
1136
+ if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
1137
+ const timeRegex = `${time$2}(?:${opts.join("|")})`;
1138
+ return /* @__PURE__ */ new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1139
+ }
1140
+ const string$1 = (params) => {
1141
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
1142
+ return /* @__PURE__ */ new RegExp(`^${regex}$`);
1143
+ };
1144
+ const integer = /^-?\d+$/;
1145
+ const number$1 = /^-?\d+(?:\.\d+)?$/;
1146
+ const lowercase = /^[^A-Z]*$/;
1147
+ const uppercase = /^[^a-z]*$/;
1148
+
410
1149
  //#endregion
411
1150
  //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
412
1151
  const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
@@ -415,6 +1154,145 @@ const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
415
1154
  inst._zod.def = def;
416
1155
  (_a$1 = inst._zod).onattach ?? (_a$1.onattach = []);
417
1156
  });
1157
+ const numericOriginMap = {
1158
+ number: "number",
1159
+ bigint: "bigint",
1160
+ object: "date"
1161
+ };
1162
+ const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
1163
+ $ZodCheck.init(inst, def);
1164
+ const origin = numericOriginMap[typeof def.value];
1165
+ inst._zod.onattach.push((inst$1) => {
1166
+ const bag = inst$1._zod.bag;
1167
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
1168
+ if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
1169
+ else bag.exclusiveMaximum = def.value;
1170
+ });
1171
+ inst._zod.check = (payload) => {
1172
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
1173
+ payload.issues.push({
1174
+ origin,
1175
+ code: "too_big",
1176
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
1177
+ input: payload.value,
1178
+ inclusive: def.inclusive,
1179
+ inst,
1180
+ continue: !def.abort
1181
+ });
1182
+ };
1183
+ });
1184
+ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
1185
+ $ZodCheck.init(inst, def);
1186
+ const origin = numericOriginMap[typeof def.value];
1187
+ inst._zod.onattach.push((inst$1) => {
1188
+ const bag = inst$1._zod.bag;
1189
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
1190
+ if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
1191
+ else bag.exclusiveMinimum = def.value;
1192
+ });
1193
+ inst._zod.check = (payload) => {
1194
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
1195
+ payload.issues.push({
1196
+ origin,
1197
+ code: "too_small",
1198
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
1199
+ input: payload.value,
1200
+ inclusive: def.inclusive,
1201
+ inst,
1202
+ continue: !def.abort
1203
+ });
1204
+ };
1205
+ });
1206
+ const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
1207
+ $ZodCheck.init(inst, def);
1208
+ inst._zod.onattach.push((inst$1) => {
1209
+ var _a$1;
1210
+ (_a$1 = inst$1._zod.bag).multipleOf ?? (_a$1.multipleOf = def.value);
1211
+ });
1212
+ inst._zod.check = (payload) => {
1213
+ if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
1214
+ if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
1215
+ payload.issues.push({
1216
+ origin: typeof payload.value,
1217
+ code: "not_multiple_of",
1218
+ divisor: def.value,
1219
+ input: payload.value,
1220
+ inst,
1221
+ continue: !def.abort
1222
+ });
1223
+ };
1224
+ });
1225
+ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
1226
+ $ZodCheck.init(inst, def);
1227
+ def.format = def.format || "float64";
1228
+ const isInt = def.format?.includes("int");
1229
+ const origin = isInt ? "int" : "number";
1230
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
1231
+ inst._zod.onattach.push((inst$1) => {
1232
+ const bag = inst$1._zod.bag;
1233
+ bag.format = def.format;
1234
+ bag.minimum = minimum;
1235
+ bag.maximum = maximum;
1236
+ if (isInt) bag.pattern = integer;
1237
+ });
1238
+ inst._zod.check = (payload) => {
1239
+ const input = payload.value;
1240
+ if (isInt) {
1241
+ if (!Number.isInteger(input)) {
1242
+ payload.issues.push({
1243
+ expected: origin,
1244
+ format: def.format,
1245
+ code: "invalid_type",
1246
+ continue: false,
1247
+ input,
1248
+ inst
1249
+ });
1250
+ return;
1251
+ }
1252
+ if (!Number.isSafeInteger(input)) {
1253
+ if (input > 0) payload.issues.push({
1254
+ input,
1255
+ code: "too_big",
1256
+ maximum: Number.MAX_SAFE_INTEGER,
1257
+ note: "Integers must be within the safe integer range.",
1258
+ inst,
1259
+ origin,
1260
+ inclusive: true,
1261
+ continue: !def.abort
1262
+ });
1263
+ else payload.issues.push({
1264
+ input,
1265
+ code: "too_small",
1266
+ minimum: Number.MIN_SAFE_INTEGER,
1267
+ note: "Integers must be within the safe integer range.",
1268
+ inst,
1269
+ origin,
1270
+ inclusive: true,
1271
+ continue: !def.abort
1272
+ });
1273
+ return;
1274
+ }
1275
+ }
1276
+ if (input < minimum) payload.issues.push({
1277
+ origin: "number",
1278
+ input,
1279
+ code: "too_small",
1280
+ minimum,
1281
+ inclusive: true,
1282
+ inst,
1283
+ continue: !def.abort
1284
+ });
1285
+ if (input > maximum) payload.issues.push({
1286
+ origin: "number",
1287
+ input,
1288
+ code: "too_big",
1289
+ maximum,
1290
+ inclusive: true,
1291
+ inst,
1292
+ continue: !def.abort
1293
+ });
1294
+ };
1295
+ });
418
1296
  const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
419
1297
  var _a$1;
420
1298
  $ZodCheck.init(inst, def);
@@ -503,17 +1381,166 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
503
1381
  });
504
1382
  };
505
1383
  });
506
- const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
1384
+ const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
1385
+ var _a$1, _b;
507
1386
  $ZodCheck.init(inst, def);
508
- inst._zod.check = (payload) => {
509
- payload.value = def.tx(payload.value);
510
- };
511
- });
512
-
513
- //#endregion
514
- //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
515
- const version = {
516
- major: 4,
1387
+ inst._zod.onattach.push((inst$1) => {
1388
+ const bag = inst$1._zod.bag;
1389
+ bag.format = def.format;
1390
+ if (def.pattern) {
1391
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1392
+ bag.patterns.add(def.pattern);
1393
+ }
1394
+ });
1395
+ if (def.pattern) (_a$1 = inst._zod).check ?? (_a$1.check = (payload) => {
1396
+ def.pattern.lastIndex = 0;
1397
+ if (def.pattern.test(payload.value)) return;
1398
+ payload.issues.push({
1399
+ origin: "string",
1400
+ code: "invalid_format",
1401
+ format: def.format,
1402
+ input: payload.value,
1403
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
1404
+ inst,
1405
+ continue: !def.abort
1406
+ });
1407
+ });
1408
+ else (_b = inst._zod).check ?? (_b.check = () => {});
1409
+ });
1410
+ const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
1411
+ $ZodCheckStringFormat.init(inst, def);
1412
+ inst._zod.check = (payload) => {
1413
+ def.pattern.lastIndex = 0;
1414
+ if (def.pattern.test(payload.value)) return;
1415
+ payload.issues.push({
1416
+ origin: "string",
1417
+ code: "invalid_format",
1418
+ format: "regex",
1419
+ input: payload.value,
1420
+ pattern: def.pattern.toString(),
1421
+ inst,
1422
+ continue: !def.abort
1423
+ });
1424
+ };
1425
+ });
1426
+ const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
1427
+ def.pattern ?? (def.pattern = lowercase);
1428
+ $ZodCheckStringFormat.init(inst, def);
1429
+ });
1430
+ const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
1431
+ def.pattern ?? (def.pattern = uppercase);
1432
+ $ZodCheckStringFormat.init(inst, def);
1433
+ });
1434
+ const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
1435
+ $ZodCheck.init(inst, def);
1436
+ const escapedRegex = escapeRegex(def.includes);
1437
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
1438
+ def.pattern = pattern;
1439
+ inst._zod.onattach.push((inst$1) => {
1440
+ const bag = inst$1._zod.bag;
1441
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1442
+ bag.patterns.add(pattern);
1443
+ });
1444
+ inst._zod.check = (payload) => {
1445
+ if (payload.value.includes(def.includes, def.position)) return;
1446
+ payload.issues.push({
1447
+ origin: "string",
1448
+ code: "invalid_format",
1449
+ format: "includes",
1450
+ includes: def.includes,
1451
+ input: payload.value,
1452
+ inst,
1453
+ continue: !def.abort
1454
+ });
1455
+ };
1456
+ });
1457
+ const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
1458
+ $ZodCheck.init(inst, def);
1459
+ const pattern = /* @__PURE__ */ new RegExp(`^${escapeRegex(def.prefix)}.*`);
1460
+ def.pattern ?? (def.pattern = pattern);
1461
+ inst._zod.onattach.push((inst$1) => {
1462
+ const bag = inst$1._zod.bag;
1463
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1464
+ bag.patterns.add(pattern);
1465
+ });
1466
+ inst._zod.check = (payload) => {
1467
+ if (payload.value.startsWith(def.prefix)) return;
1468
+ payload.issues.push({
1469
+ origin: "string",
1470
+ code: "invalid_format",
1471
+ format: "starts_with",
1472
+ prefix: def.prefix,
1473
+ input: payload.value,
1474
+ inst,
1475
+ continue: !def.abort
1476
+ });
1477
+ };
1478
+ });
1479
+ const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
1480
+ $ZodCheck.init(inst, def);
1481
+ const pattern = /* @__PURE__ */ new RegExp(`.*${escapeRegex(def.suffix)}$`);
1482
+ def.pattern ?? (def.pattern = pattern);
1483
+ inst._zod.onattach.push((inst$1) => {
1484
+ const bag = inst$1._zod.bag;
1485
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
1486
+ bag.patterns.add(pattern);
1487
+ });
1488
+ inst._zod.check = (payload) => {
1489
+ if (payload.value.endsWith(def.suffix)) return;
1490
+ payload.issues.push({
1491
+ origin: "string",
1492
+ code: "invalid_format",
1493
+ format: "ends_with",
1494
+ suffix: def.suffix,
1495
+ input: payload.value,
1496
+ inst,
1497
+ continue: !def.abort
1498
+ });
1499
+ };
1500
+ });
1501
+ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
1502
+ $ZodCheck.init(inst, def);
1503
+ inst._zod.check = (payload) => {
1504
+ payload.value = def.tx(payload.value);
1505
+ };
1506
+ });
1507
+
1508
+ //#endregion
1509
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
1510
+ var Doc = class {
1511
+ constructor(args = []) {
1512
+ this.content = [];
1513
+ this.indent = 0;
1514
+ if (this) this.args = args;
1515
+ }
1516
+ indented(fn) {
1517
+ this.indent += 1;
1518
+ fn(this);
1519
+ this.indent -= 1;
1520
+ }
1521
+ write(arg) {
1522
+ if (typeof arg === "function") {
1523
+ arg(this, { execution: "sync" });
1524
+ arg(this, { execution: "async" });
1525
+ return;
1526
+ }
1527
+ const lines = arg.split("\n").filter((x) => x);
1528
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
1529
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
1530
+ for (const line of dedented) this.content.push(line);
1531
+ }
1532
+ compile() {
1533
+ const F = Function;
1534
+ const args = this?.args;
1535
+ const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
1536
+ return new F(...args, lines.join("\n"));
1537
+ }
1538
+ };
1539
+
1540
+ //#endregion
1541
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
1542
+ const version = {
1543
+ major: 4,
517
1544
  minor: 3,
518
1545
  patch: 6
519
1546
  };
@@ -608,10 +1635,308 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
608
1635
  version: 1
609
1636
  }));
610
1637
  });
1638
+ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
1639
+ $ZodType.init(inst, def);
1640
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
1641
+ inst._zod.parse = (payload, _) => {
1642
+ if (def.coerce) try {
1643
+ payload.value = String(payload.value);
1644
+ } catch (_$1) {}
1645
+ if (typeof payload.value === "string") return payload;
1646
+ payload.issues.push({
1647
+ expected: "string",
1648
+ code: "invalid_type",
1649
+ input: payload.value,
1650
+ inst
1651
+ });
1652
+ return payload;
1653
+ };
1654
+ });
1655
+ const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
1656
+ $ZodCheckStringFormat.init(inst, def);
1657
+ $ZodString.init(inst, def);
1658
+ });
1659
+ const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
1660
+ def.pattern ?? (def.pattern = guid);
1661
+ $ZodStringFormat.init(inst, def);
1662
+ });
1663
+ const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
1664
+ if (def.version) {
1665
+ const v = {
1666
+ v1: 1,
1667
+ v2: 2,
1668
+ v3: 3,
1669
+ v4: 4,
1670
+ v5: 5,
1671
+ v6: 6,
1672
+ v7: 7,
1673
+ v8: 8
1674
+ }[def.version];
1675
+ if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
1676
+ def.pattern ?? (def.pattern = uuid(v));
1677
+ } else def.pattern ?? (def.pattern = uuid());
1678
+ $ZodStringFormat.init(inst, def);
1679
+ });
1680
+ const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
1681
+ def.pattern ?? (def.pattern = email);
1682
+ $ZodStringFormat.init(inst, def);
1683
+ });
1684
+ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
1685
+ $ZodStringFormat.init(inst, def);
1686
+ inst._zod.check = (payload) => {
1687
+ try {
1688
+ const trimmed = payload.value.trim();
1689
+ const url = new URL(trimmed);
1690
+ if (def.hostname) {
1691
+ def.hostname.lastIndex = 0;
1692
+ if (!def.hostname.test(url.hostname)) payload.issues.push({
1693
+ code: "invalid_format",
1694
+ format: "url",
1695
+ note: "Invalid hostname",
1696
+ pattern: def.hostname.source,
1697
+ input: payload.value,
1698
+ inst,
1699
+ continue: !def.abort
1700
+ });
1701
+ }
1702
+ if (def.protocol) {
1703
+ def.protocol.lastIndex = 0;
1704
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1705
+ code: "invalid_format",
1706
+ format: "url",
1707
+ note: "Invalid protocol",
1708
+ pattern: def.protocol.source,
1709
+ input: payload.value,
1710
+ inst,
1711
+ continue: !def.abort
1712
+ });
1713
+ }
1714
+ if (def.normalize) payload.value = url.href;
1715
+ else payload.value = trimmed;
1716
+ return;
1717
+ } catch (_) {
1718
+ payload.issues.push({
1719
+ code: "invalid_format",
1720
+ format: "url",
1721
+ input: payload.value,
1722
+ inst,
1723
+ continue: !def.abort
1724
+ });
1725
+ }
1726
+ };
1727
+ });
1728
+ const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
1729
+ def.pattern ?? (def.pattern = emoji());
1730
+ $ZodStringFormat.init(inst, def);
1731
+ });
1732
+ const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
1733
+ def.pattern ?? (def.pattern = nanoid);
1734
+ $ZodStringFormat.init(inst, def);
1735
+ });
1736
+ const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
1737
+ def.pattern ?? (def.pattern = cuid);
1738
+ $ZodStringFormat.init(inst, def);
1739
+ });
1740
+ const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
1741
+ def.pattern ?? (def.pattern = cuid2);
1742
+ $ZodStringFormat.init(inst, def);
1743
+ });
1744
+ const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
1745
+ def.pattern ?? (def.pattern = ulid);
1746
+ $ZodStringFormat.init(inst, def);
1747
+ });
1748
+ const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
1749
+ def.pattern ?? (def.pattern = xid);
1750
+ $ZodStringFormat.init(inst, def);
1751
+ });
1752
+ const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
1753
+ def.pattern ?? (def.pattern = ksuid);
1754
+ $ZodStringFormat.init(inst, def);
1755
+ });
1756
+ const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
1757
+ def.pattern ?? (def.pattern = datetime$1(def));
1758
+ $ZodStringFormat.init(inst, def);
1759
+ });
1760
+ const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
1761
+ def.pattern ?? (def.pattern = date$1);
1762
+ $ZodStringFormat.init(inst, def);
1763
+ });
1764
+ const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
1765
+ def.pattern ?? (def.pattern = time$1(def));
1766
+ $ZodStringFormat.init(inst, def);
1767
+ });
1768
+ const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
1769
+ def.pattern ?? (def.pattern = duration$1);
1770
+ $ZodStringFormat.init(inst, def);
1771
+ });
1772
+ const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
1773
+ def.pattern ?? (def.pattern = ipv4);
1774
+ $ZodStringFormat.init(inst, def);
1775
+ inst._zod.bag.format = `ipv4`;
1776
+ });
1777
+ const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
1778
+ def.pattern ?? (def.pattern = ipv6);
1779
+ $ZodStringFormat.init(inst, def);
1780
+ inst._zod.bag.format = `ipv6`;
1781
+ inst._zod.check = (payload) => {
1782
+ try {
1783
+ new URL(`http://[${payload.value}]`);
1784
+ } catch {
1785
+ payload.issues.push({
1786
+ code: "invalid_format",
1787
+ format: "ipv6",
1788
+ input: payload.value,
1789
+ inst,
1790
+ continue: !def.abort
1791
+ });
1792
+ }
1793
+ };
1794
+ });
1795
+ const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
1796
+ def.pattern ?? (def.pattern = cidrv4);
1797
+ $ZodStringFormat.init(inst, def);
1798
+ });
1799
+ const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
1800
+ def.pattern ?? (def.pattern = cidrv6);
1801
+ $ZodStringFormat.init(inst, def);
1802
+ inst._zod.check = (payload) => {
1803
+ const parts = payload.value.split("/");
1804
+ try {
1805
+ if (parts.length !== 2) throw new Error();
1806
+ const [address, prefix] = parts;
1807
+ if (!prefix) throw new Error();
1808
+ const prefixNum = Number(prefix);
1809
+ if (`${prefixNum}` !== prefix) throw new Error();
1810
+ if (prefixNum < 0 || prefixNum > 128) throw new Error();
1811
+ new URL(`http://[${address}]`);
1812
+ } catch {
1813
+ payload.issues.push({
1814
+ code: "invalid_format",
1815
+ format: "cidrv6",
1816
+ input: payload.value,
1817
+ inst,
1818
+ continue: !def.abort
1819
+ });
1820
+ }
1821
+ };
1822
+ });
1823
+ function isValidBase64(data) {
1824
+ if (data === "") return true;
1825
+ if (data.length % 4 !== 0) return false;
1826
+ try {
1827
+ atob(data);
1828
+ return true;
1829
+ } catch {
1830
+ return false;
1831
+ }
1832
+ }
1833
+ const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
1834
+ def.pattern ?? (def.pattern = base64);
1835
+ $ZodStringFormat.init(inst, def);
1836
+ inst._zod.bag.contentEncoding = "base64";
1837
+ inst._zod.check = (payload) => {
1838
+ if (isValidBase64(payload.value)) return;
1839
+ payload.issues.push({
1840
+ code: "invalid_format",
1841
+ format: "base64",
1842
+ input: payload.value,
1843
+ inst,
1844
+ continue: !def.abort
1845
+ });
1846
+ };
1847
+ });
1848
+ function isValidBase64URL(data) {
1849
+ if (!base64url.test(data)) return false;
1850
+ const base64$1 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1851
+ return isValidBase64(base64$1.padEnd(Math.ceil(base64$1.length / 4) * 4, "="));
1852
+ }
1853
+ const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
1854
+ def.pattern ?? (def.pattern = base64url);
1855
+ $ZodStringFormat.init(inst, def);
1856
+ inst._zod.bag.contentEncoding = "base64url";
1857
+ inst._zod.check = (payload) => {
1858
+ if (isValidBase64URL(payload.value)) return;
1859
+ payload.issues.push({
1860
+ code: "invalid_format",
1861
+ format: "base64url",
1862
+ input: payload.value,
1863
+ inst,
1864
+ continue: !def.abort
1865
+ });
1866
+ };
1867
+ });
1868
+ const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
1869
+ def.pattern ?? (def.pattern = e164);
1870
+ $ZodStringFormat.init(inst, def);
1871
+ });
1872
+ function isValidJWT(token, algorithm = null) {
1873
+ try {
1874
+ const tokensParts = token.split(".");
1875
+ if (tokensParts.length !== 3) return false;
1876
+ const [header] = tokensParts;
1877
+ if (!header) return false;
1878
+ const parsedHeader = JSON.parse(atob(header));
1879
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
1880
+ if (!parsedHeader.alg) return false;
1881
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
1882
+ return true;
1883
+ } catch {
1884
+ return false;
1885
+ }
1886
+ }
1887
+ const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
1888
+ $ZodStringFormat.init(inst, def);
1889
+ inst._zod.check = (payload) => {
1890
+ if (isValidJWT(payload.value, def.alg)) return;
1891
+ payload.issues.push({
1892
+ code: "invalid_format",
1893
+ format: "jwt",
1894
+ input: payload.value,
1895
+ inst,
1896
+ continue: !def.abort
1897
+ });
1898
+ };
1899
+ });
1900
+ const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
1901
+ $ZodType.init(inst, def);
1902
+ inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
1903
+ inst._zod.parse = (payload, _ctx) => {
1904
+ if (def.coerce) try {
1905
+ payload.value = Number(payload.value);
1906
+ } catch (_) {}
1907
+ const input = payload.value;
1908
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1909
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
1910
+ payload.issues.push({
1911
+ expected: "number",
1912
+ code: "invalid_type",
1913
+ input,
1914
+ inst,
1915
+ ...received ? { received } : {}
1916
+ });
1917
+ return payload;
1918
+ };
1919
+ });
1920
+ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
1921
+ $ZodCheckNumberFormat.init(inst, def);
1922
+ $ZodNumber.init(inst, def);
1923
+ });
611
1924
  const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
612
1925
  $ZodType.init(inst, def);
613
1926
  inst._zod.parse = (payload) => payload;
614
1927
  });
1928
+ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
1929
+ $ZodType.init(inst, def);
1930
+ inst._zod.parse = (payload, _ctx) => {
1931
+ payload.issues.push({
1932
+ expected: "never",
1933
+ code: "invalid_type",
1934
+ input: payload.value,
1935
+ inst
1936
+ });
1937
+ return payload;
1938
+ };
1939
+ });
615
1940
  function handleArrayResult(result, final, index) {
616
1941
  if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
617
1942
  final.value[index] = result.value;
@@ -644,6 +1969,207 @@ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
644
1969
  return payload;
645
1970
  };
646
1971
  });
1972
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
1973
+ if (result.issues.length) {
1974
+ if (isOptionalOut && !(key in input)) return;
1975
+ final.issues.push(...prefixIssues(key, result.issues));
1976
+ }
1977
+ if (result.value === void 0) {
1978
+ if (key in input) final.value[key] = void 0;
1979
+ } else final.value[key] = result.value;
1980
+ }
1981
+ function normalizeDef(def) {
1982
+ const keys = Object.keys(def.shape);
1983
+ 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`);
1984
+ const okeys = optionalKeys(def.shape);
1985
+ return {
1986
+ ...def,
1987
+ keys,
1988
+ keySet: new Set(keys),
1989
+ numKeys: keys.length,
1990
+ optionalKeys: new Set(okeys)
1991
+ };
1992
+ }
1993
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
1994
+ const unrecognized = [];
1995
+ const keySet = def.keySet;
1996
+ const _catchall = def.catchall._zod;
1997
+ const t = _catchall.def.type;
1998
+ const isOptionalOut = _catchall.optout === "optional";
1999
+ for (const key in input) {
2000
+ if (keySet.has(key)) continue;
2001
+ if (t === "never") {
2002
+ unrecognized.push(key);
2003
+ continue;
2004
+ }
2005
+ const r = _catchall.run({
2006
+ value: input[key],
2007
+ issues: []
2008
+ }, ctx);
2009
+ if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input, isOptionalOut)));
2010
+ else handlePropertyResult(r, payload, key, input, isOptionalOut);
2011
+ }
2012
+ if (unrecognized.length) payload.issues.push({
2013
+ code: "unrecognized_keys",
2014
+ keys: unrecognized,
2015
+ input,
2016
+ inst
2017
+ });
2018
+ if (!proms.length) return payload;
2019
+ return Promise.all(proms).then(() => {
2020
+ return payload;
2021
+ });
2022
+ }
2023
+ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
2024
+ $ZodType.init(inst, def);
2025
+ if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
2026
+ const sh = def.shape;
2027
+ Object.defineProperty(def, "shape", { get: () => {
2028
+ const newSh = { ...sh };
2029
+ Object.defineProperty(def, "shape", { value: newSh });
2030
+ return newSh;
2031
+ } });
2032
+ }
2033
+ const _normalized = cached(() => normalizeDef(def));
2034
+ defineLazy(inst._zod, "propValues", () => {
2035
+ const shape = def.shape;
2036
+ const propValues = {};
2037
+ for (const key in shape) {
2038
+ const field = shape[key]._zod;
2039
+ if (field.values) {
2040
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
2041
+ for (const v of field.values) propValues[key].add(v);
2042
+ }
2043
+ }
2044
+ return propValues;
2045
+ });
2046
+ const isObject$1 = isObject;
2047
+ const catchall = def.catchall;
2048
+ let value;
2049
+ inst._zod.parse = (payload, ctx) => {
2050
+ value ?? (value = _normalized.value);
2051
+ const input = payload.value;
2052
+ if (!isObject$1(input)) {
2053
+ payload.issues.push({
2054
+ expected: "object",
2055
+ code: "invalid_type",
2056
+ input,
2057
+ inst
2058
+ });
2059
+ return payload;
2060
+ }
2061
+ payload.value = {};
2062
+ const proms = [];
2063
+ const shape = value.shape;
2064
+ for (const key of value.keys) {
2065
+ const el = shape[key];
2066
+ const isOptionalOut = el._zod.optout === "optional";
2067
+ const r = el._zod.run({
2068
+ value: input[key],
2069
+ issues: []
2070
+ }, ctx);
2071
+ if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input, isOptionalOut)));
2072
+ else handlePropertyResult(r, payload, key, input, isOptionalOut);
2073
+ }
2074
+ if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
2075
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
2076
+ };
2077
+ });
2078
+ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
2079
+ $ZodObject.init(inst, def);
2080
+ const superParse = inst._zod.parse;
2081
+ const _normalized = cached(() => normalizeDef(def));
2082
+ const generateFastpass = (shape) => {
2083
+ const doc = new Doc([
2084
+ "shape",
2085
+ "payload",
2086
+ "ctx"
2087
+ ]);
2088
+ const normalized = _normalized.value;
2089
+ const parseStr = (key) => {
2090
+ const k = esc(key);
2091
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2092
+ };
2093
+ doc.write(`const input = payload.value;`);
2094
+ const ids = Object.create(null);
2095
+ let counter = 0;
2096
+ for (const key of normalized.keys) ids[key] = `key_${counter++}`;
2097
+ doc.write(`const newResult = {};`);
2098
+ for (const key of normalized.keys) {
2099
+ const id = ids[key];
2100
+ const k = esc(key);
2101
+ const isOptionalOut = shape[key]?._zod?.optout === "optional";
2102
+ doc.write(`const ${id} = ${parseStr(key)};`);
2103
+ if (isOptionalOut) doc.write(`
2104
+ if (${id}.issues.length) {
2105
+ if (${k} in input) {
2106
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2107
+ ...iss,
2108
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
2109
+ })));
2110
+ }
2111
+ }
2112
+
2113
+ if (${id}.value === undefined) {
2114
+ if (${k} in input) {
2115
+ newResult[${k}] = undefined;
2116
+ }
2117
+ } else {
2118
+ newResult[${k}] = ${id}.value;
2119
+ }
2120
+
2121
+ `);
2122
+ else doc.write(`
2123
+ if (${id}.issues.length) {
2124
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2125
+ ...iss,
2126
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
2127
+ })));
2128
+ }
2129
+
2130
+ if (${id}.value === undefined) {
2131
+ if (${k} in input) {
2132
+ newResult[${k}] = undefined;
2133
+ }
2134
+ } else {
2135
+ newResult[${k}] = ${id}.value;
2136
+ }
2137
+
2138
+ `);
2139
+ }
2140
+ doc.write(`payload.value = newResult;`);
2141
+ doc.write(`return payload;`);
2142
+ const fn = doc.compile();
2143
+ return (payload, ctx) => fn(shape, payload, ctx);
2144
+ };
2145
+ let fastpass;
2146
+ const isObject$1 = isObject;
2147
+ const jit = !globalConfig.jitless;
2148
+ const allowsEval$1 = allowsEval;
2149
+ const fastEnabled = jit && allowsEval$1.value;
2150
+ const catchall = def.catchall;
2151
+ let value;
2152
+ inst._zod.parse = (payload, ctx) => {
2153
+ value ?? (value = _normalized.value);
2154
+ const input = payload.value;
2155
+ if (!isObject$1(input)) {
2156
+ payload.issues.push({
2157
+ expected: "object",
2158
+ code: "invalid_type",
2159
+ input,
2160
+ inst
2161
+ });
2162
+ return payload;
2163
+ }
2164
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
2165
+ if (!fastpass) fastpass = generateFastpass(def.shape);
2166
+ payload = fastpass(payload, ctx);
2167
+ if (!catchall) return payload;
2168
+ return handleCatchall([], input, payload, ctx, value, inst);
2169
+ }
2170
+ return superParse(payload, ctx);
2171
+ };
2172
+ });
647
2173
  function handleUnionResults(results, final, inst, ctx) {
648
2174
  for (const result of results) if (result.issues.length === 0) {
649
2175
  final.value = result.value;
@@ -799,6 +2325,115 @@ function handleIntersectionResults(result, left, right) {
799
2325
  result.value = merged.data;
800
2326
  return result;
801
2327
  }
2328
+ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
2329
+ $ZodType.init(inst, def);
2330
+ inst._zod.parse = (payload, ctx) => {
2331
+ const input = payload.value;
2332
+ if (!isPlainObject(input)) {
2333
+ payload.issues.push({
2334
+ expected: "record",
2335
+ code: "invalid_type",
2336
+ input,
2337
+ inst
2338
+ });
2339
+ return payload;
2340
+ }
2341
+ const proms = [];
2342
+ const values = def.keyType._zod.values;
2343
+ if (values) {
2344
+ payload.value = {};
2345
+ const recordKeys = /* @__PURE__ */ new Set();
2346
+ for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2347
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
2348
+ const result = def.valueType._zod.run({
2349
+ value: input[key],
2350
+ issues: []
2351
+ }, ctx);
2352
+ if (result instanceof Promise) proms.push(result.then((result$1) => {
2353
+ if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
2354
+ payload.value[key] = result$1.value;
2355
+ }));
2356
+ else {
2357
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2358
+ payload.value[key] = result.value;
2359
+ }
2360
+ }
2361
+ let unrecognized;
2362
+ for (const key in input) if (!recordKeys.has(key)) {
2363
+ unrecognized = unrecognized ?? [];
2364
+ unrecognized.push(key);
2365
+ }
2366
+ if (unrecognized && unrecognized.length > 0) payload.issues.push({
2367
+ code: "unrecognized_keys",
2368
+ input,
2369
+ inst,
2370
+ keys: unrecognized
2371
+ });
2372
+ } else {
2373
+ payload.value = {};
2374
+ for (const key of Reflect.ownKeys(input)) {
2375
+ if (key === "__proto__") continue;
2376
+ let keyResult = def.keyType._zod.run({
2377
+ value: key,
2378
+ issues: []
2379
+ }, ctx);
2380
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
2381
+ if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
2382
+ const retryResult = def.keyType._zod.run({
2383
+ value: Number(key),
2384
+ issues: []
2385
+ }, ctx);
2386
+ if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
2387
+ if (retryResult.issues.length === 0) keyResult = retryResult;
2388
+ }
2389
+ if (keyResult.issues.length) {
2390
+ if (def.mode === "loose") payload.value[key] = input[key];
2391
+ else payload.issues.push({
2392
+ code: "invalid_key",
2393
+ origin: "record",
2394
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2395
+ input: key,
2396
+ path: [key],
2397
+ inst
2398
+ });
2399
+ continue;
2400
+ }
2401
+ const result = def.valueType._zod.run({
2402
+ value: input[key],
2403
+ issues: []
2404
+ }, ctx);
2405
+ if (result instanceof Promise) proms.push(result.then((result$1) => {
2406
+ if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
2407
+ payload.value[keyResult.value] = result$1.value;
2408
+ }));
2409
+ else {
2410
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2411
+ payload.value[keyResult.value] = result.value;
2412
+ }
2413
+ }
2414
+ }
2415
+ if (proms.length) return Promise.all(proms).then(() => payload);
2416
+ return payload;
2417
+ };
2418
+ });
2419
+ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
2420
+ $ZodType.init(inst, def);
2421
+ const values = getEnumValues(def.entries);
2422
+ const valuesSet = new Set(values);
2423
+ inst._zod.values = valuesSet;
2424
+ inst._zod.pattern = /* @__PURE__ */ new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
2425
+ inst._zod.parse = (payload, _ctx) => {
2426
+ const input = payload.value;
2427
+ if (valuesSet.has(input)) return payload;
2428
+ payload.issues.push({
2429
+ code: "invalid_value",
2430
+ values,
2431
+ input,
2432
+ inst
2433
+ });
2434
+ return payload;
2435
+ };
2436
+ });
802
2437
  const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
803
2438
  $ZodType.init(inst, def);
804
2439
  inst._zod.parse = (payload, ctx) => {
@@ -1068,14 +2703,353 @@ var $ZodRegistry = class {
1068
2703
  function registry() {
1069
2704
  return new $ZodRegistry();
1070
2705
  }
1071
- (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
1072
- const globalRegistry = globalThis.__zod_globalRegistry;
1073
-
1074
- //#endregion
1075
- //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
2706
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2707
+ const globalRegistry = globalThis.__zod_globalRegistry;
2708
+
2709
+ //#endregion
2710
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
2711
+ /* @__NO_SIDE_EFFECTS__ */
2712
+ function _string(Class, params) {
2713
+ return new Class({
2714
+ type: "string",
2715
+ ...normalizeParams(params)
2716
+ });
2717
+ }
2718
+ /* @__NO_SIDE_EFFECTS__ */
2719
+ function _email(Class, params) {
2720
+ return new Class({
2721
+ type: "string",
2722
+ format: "email",
2723
+ check: "string_format",
2724
+ abort: false,
2725
+ ...normalizeParams(params)
2726
+ });
2727
+ }
2728
+ /* @__NO_SIDE_EFFECTS__ */
2729
+ function _guid(Class, params) {
2730
+ return new Class({
2731
+ type: "string",
2732
+ format: "guid",
2733
+ check: "string_format",
2734
+ abort: false,
2735
+ ...normalizeParams(params)
2736
+ });
2737
+ }
2738
+ /* @__NO_SIDE_EFFECTS__ */
2739
+ function _uuid(Class, params) {
2740
+ return new Class({
2741
+ type: "string",
2742
+ format: "uuid",
2743
+ check: "string_format",
2744
+ abort: false,
2745
+ ...normalizeParams(params)
2746
+ });
2747
+ }
2748
+ /* @__NO_SIDE_EFFECTS__ */
2749
+ function _uuidv4(Class, params) {
2750
+ return new Class({
2751
+ type: "string",
2752
+ format: "uuid",
2753
+ check: "string_format",
2754
+ abort: false,
2755
+ version: "v4",
2756
+ ...normalizeParams(params)
2757
+ });
2758
+ }
2759
+ /* @__NO_SIDE_EFFECTS__ */
2760
+ function _uuidv6(Class, params) {
2761
+ return new Class({
2762
+ type: "string",
2763
+ format: "uuid",
2764
+ check: "string_format",
2765
+ abort: false,
2766
+ version: "v6",
2767
+ ...normalizeParams(params)
2768
+ });
2769
+ }
2770
+ /* @__NO_SIDE_EFFECTS__ */
2771
+ function _uuidv7(Class, params) {
2772
+ return new Class({
2773
+ type: "string",
2774
+ format: "uuid",
2775
+ check: "string_format",
2776
+ abort: false,
2777
+ version: "v7",
2778
+ ...normalizeParams(params)
2779
+ });
2780
+ }
2781
+ /* @__NO_SIDE_EFFECTS__ */
2782
+ function _url(Class, params) {
2783
+ return new Class({
2784
+ type: "string",
2785
+ format: "url",
2786
+ check: "string_format",
2787
+ abort: false,
2788
+ ...normalizeParams(params)
2789
+ });
2790
+ }
2791
+ /* @__NO_SIDE_EFFECTS__ */
2792
+ function _emoji(Class, params) {
2793
+ return new Class({
2794
+ type: "string",
2795
+ format: "emoji",
2796
+ check: "string_format",
2797
+ abort: false,
2798
+ ...normalizeParams(params)
2799
+ });
2800
+ }
2801
+ /* @__NO_SIDE_EFFECTS__ */
2802
+ function _nanoid(Class, params) {
2803
+ return new Class({
2804
+ type: "string",
2805
+ format: "nanoid",
2806
+ check: "string_format",
2807
+ abort: false,
2808
+ ...normalizeParams(params)
2809
+ });
2810
+ }
2811
+ /* @__NO_SIDE_EFFECTS__ */
2812
+ function _cuid(Class, params) {
2813
+ return new Class({
2814
+ type: "string",
2815
+ format: "cuid",
2816
+ check: "string_format",
2817
+ abort: false,
2818
+ ...normalizeParams(params)
2819
+ });
2820
+ }
2821
+ /* @__NO_SIDE_EFFECTS__ */
2822
+ function _cuid2(Class, params) {
2823
+ return new Class({
2824
+ type: "string",
2825
+ format: "cuid2",
2826
+ check: "string_format",
2827
+ abort: false,
2828
+ ...normalizeParams(params)
2829
+ });
2830
+ }
2831
+ /* @__NO_SIDE_EFFECTS__ */
2832
+ function _ulid(Class, params) {
2833
+ return new Class({
2834
+ type: "string",
2835
+ format: "ulid",
2836
+ check: "string_format",
2837
+ abort: false,
2838
+ ...normalizeParams(params)
2839
+ });
2840
+ }
2841
+ /* @__NO_SIDE_EFFECTS__ */
2842
+ function _xid(Class, params) {
2843
+ return new Class({
2844
+ type: "string",
2845
+ format: "xid",
2846
+ check: "string_format",
2847
+ abort: false,
2848
+ ...normalizeParams(params)
2849
+ });
2850
+ }
2851
+ /* @__NO_SIDE_EFFECTS__ */
2852
+ function _ksuid(Class, params) {
2853
+ return new Class({
2854
+ type: "string",
2855
+ format: "ksuid",
2856
+ check: "string_format",
2857
+ abort: false,
2858
+ ...normalizeParams(params)
2859
+ });
2860
+ }
2861
+ /* @__NO_SIDE_EFFECTS__ */
2862
+ function _ipv4(Class, params) {
2863
+ return new Class({
2864
+ type: "string",
2865
+ format: "ipv4",
2866
+ check: "string_format",
2867
+ abort: false,
2868
+ ...normalizeParams(params)
2869
+ });
2870
+ }
2871
+ /* @__NO_SIDE_EFFECTS__ */
2872
+ function _ipv6(Class, params) {
2873
+ return new Class({
2874
+ type: "string",
2875
+ format: "ipv6",
2876
+ check: "string_format",
2877
+ abort: false,
2878
+ ...normalizeParams(params)
2879
+ });
2880
+ }
2881
+ /* @__NO_SIDE_EFFECTS__ */
2882
+ function _cidrv4(Class, params) {
2883
+ return new Class({
2884
+ type: "string",
2885
+ format: "cidrv4",
2886
+ check: "string_format",
2887
+ abort: false,
2888
+ ...normalizeParams(params)
2889
+ });
2890
+ }
2891
+ /* @__NO_SIDE_EFFECTS__ */
2892
+ function _cidrv6(Class, params) {
2893
+ return new Class({
2894
+ type: "string",
2895
+ format: "cidrv6",
2896
+ check: "string_format",
2897
+ abort: false,
2898
+ ...normalizeParams(params)
2899
+ });
2900
+ }
2901
+ /* @__NO_SIDE_EFFECTS__ */
2902
+ function _base64(Class, params) {
2903
+ return new Class({
2904
+ type: "string",
2905
+ format: "base64",
2906
+ check: "string_format",
2907
+ abort: false,
2908
+ ...normalizeParams(params)
2909
+ });
2910
+ }
2911
+ /* @__NO_SIDE_EFFECTS__ */
2912
+ function _base64url(Class, params) {
2913
+ return new Class({
2914
+ type: "string",
2915
+ format: "base64url",
2916
+ check: "string_format",
2917
+ abort: false,
2918
+ ...normalizeParams(params)
2919
+ });
2920
+ }
2921
+ /* @__NO_SIDE_EFFECTS__ */
2922
+ function _e164(Class, params) {
2923
+ return new Class({
2924
+ type: "string",
2925
+ format: "e164",
2926
+ check: "string_format",
2927
+ abort: false,
2928
+ ...normalizeParams(params)
2929
+ });
2930
+ }
2931
+ /* @__NO_SIDE_EFFECTS__ */
2932
+ function _jwt(Class, params) {
2933
+ return new Class({
2934
+ type: "string",
2935
+ format: "jwt",
2936
+ check: "string_format",
2937
+ abort: false,
2938
+ ...normalizeParams(params)
2939
+ });
2940
+ }
2941
+ /* @__NO_SIDE_EFFECTS__ */
2942
+ function _isoDateTime(Class, params) {
2943
+ return new Class({
2944
+ type: "string",
2945
+ format: "datetime",
2946
+ check: "string_format",
2947
+ offset: false,
2948
+ local: false,
2949
+ precision: null,
2950
+ ...normalizeParams(params)
2951
+ });
2952
+ }
2953
+ /* @__NO_SIDE_EFFECTS__ */
2954
+ function _isoDate(Class, params) {
2955
+ return new Class({
2956
+ type: "string",
2957
+ format: "date",
2958
+ check: "string_format",
2959
+ ...normalizeParams(params)
2960
+ });
2961
+ }
2962
+ /* @__NO_SIDE_EFFECTS__ */
2963
+ function _isoTime(Class, params) {
2964
+ return new Class({
2965
+ type: "string",
2966
+ format: "time",
2967
+ check: "string_format",
2968
+ precision: null,
2969
+ ...normalizeParams(params)
2970
+ });
2971
+ }
2972
+ /* @__NO_SIDE_EFFECTS__ */
2973
+ function _isoDuration(Class, params) {
2974
+ return new Class({
2975
+ type: "string",
2976
+ format: "duration",
2977
+ check: "string_format",
2978
+ ...normalizeParams(params)
2979
+ });
2980
+ }
2981
+ /* @__NO_SIDE_EFFECTS__ */
2982
+ function _number(Class, params) {
2983
+ return new Class({
2984
+ type: "number",
2985
+ checks: [],
2986
+ ...normalizeParams(params)
2987
+ });
2988
+ }
2989
+ /* @__NO_SIDE_EFFECTS__ */
2990
+ function _int(Class, params) {
2991
+ return new Class({
2992
+ type: "number",
2993
+ check: "number_format",
2994
+ abort: false,
2995
+ format: "safeint",
2996
+ ...normalizeParams(params)
2997
+ });
2998
+ }
2999
+ /* @__NO_SIDE_EFFECTS__ */
3000
+ function _unknown(Class) {
3001
+ return new Class({ type: "unknown" });
3002
+ }
3003
+ /* @__NO_SIDE_EFFECTS__ */
3004
+ function _never(Class, params) {
3005
+ return new Class({
3006
+ type: "never",
3007
+ ...normalizeParams(params)
3008
+ });
3009
+ }
3010
+ /* @__NO_SIDE_EFFECTS__ */
3011
+ function _lt(value, params) {
3012
+ return new $ZodCheckLessThan({
3013
+ check: "less_than",
3014
+ ...normalizeParams(params),
3015
+ value,
3016
+ inclusive: false
3017
+ });
3018
+ }
3019
+ /* @__NO_SIDE_EFFECTS__ */
3020
+ function _lte(value, params) {
3021
+ return new $ZodCheckLessThan({
3022
+ check: "less_than",
3023
+ ...normalizeParams(params),
3024
+ value,
3025
+ inclusive: true
3026
+ });
3027
+ }
3028
+ /* @__NO_SIDE_EFFECTS__ */
3029
+ function _gt(value, params) {
3030
+ return new $ZodCheckGreaterThan({
3031
+ check: "greater_than",
3032
+ ...normalizeParams(params),
3033
+ value,
3034
+ inclusive: false
3035
+ });
3036
+ }
3037
+ /* @__NO_SIDE_EFFECTS__ */
3038
+ function _gte(value, params) {
3039
+ return new $ZodCheckGreaterThan({
3040
+ check: "greater_than",
3041
+ ...normalizeParams(params),
3042
+ value,
3043
+ inclusive: true
3044
+ });
3045
+ }
1076
3046
  /* @__NO_SIDE_EFFECTS__ */
1077
- function _unknown(Class) {
1078
- return new Class({ type: "unknown" });
3047
+ function _multipleOf(value, params) {
3048
+ return new $ZodCheckMultipleOf({
3049
+ check: "multiple_of",
3050
+ ...normalizeParams(params),
3051
+ value
3052
+ });
1079
3053
  }
1080
3054
  /* @__NO_SIDE_EFFECTS__ */
1081
3055
  function _maxLength(maximum, params) {
@@ -1102,6 +3076,58 @@ function _length(length, params) {
1102
3076
  });
1103
3077
  }
1104
3078
  /* @__NO_SIDE_EFFECTS__ */
3079
+ function _regex(pattern, params) {
3080
+ return new $ZodCheckRegex({
3081
+ check: "string_format",
3082
+ format: "regex",
3083
+ ...normalizeParams(params),
3084
+ pattern
3085
+ });
3086
+ }
3087
+ /* @__NO_SIDE_EFFECTS__ */
3088
+ function _lowercase(params) {
3089
+ return new $ZodCheckLowerCase({
3090
+ check: "string_format",
3091
+ format: "lowercase",
3092
+ ...normalizeParams(params)
3093
+ });
3094
+ }
3095
+ /* @__NO_SIDE_EFFECTS__ */
3096
+ function _uppercase(params) {
3097
+ return new $ZodCheckUpperCase({
3098
+ check: "string_format",
3099
+ format: "uppercase",
3100
+ ...normalizeParams(params)
3101
+ });
3102
+ }
3103
+ /* @__NO_SIDE_EFFECTS__ */
3104
+ function _includes(includes, params) {
3105
+ return new $ZodCheckIncludes({
3106
+ check: "string_format",
3107
+ format: "includes",
3108
+ ...normalizeParams(params),
3109
+ includes
3110
+ });
3111
+ }
3112
+ /* @__NO_SIDE_EFFECTS__ */
3113
+ function _startsWith(prefix, params) {
3114
+ return new $ZodCheckStartsWith({
3115
+ check: "string_format",
3116
+ format: "starts_with",
3117
+ ...normalizeParams(params),
3118
+ prefix
3119
+ });
3120
+ }
3121
+ /* @__NO_SIDE_EFFECTS__ */
3122
+ function _endsWith(suffix, params) {
3123
+ return new $ZodCheckEndsWith({
3124
+ check: "string_format",
3125
+ format: "ends_with",
3126
+ ...normalizeParams(params),
3127
+ suffix
3128
+ });
3129
+ }
3130
+ /* @__NO_SIDE_EFFECTS__ */
1105
3131
  function _overwrite(tx) {
1106
3132
  return new $ZodCheckOverwrite({
1107
3133
  check: "overwrite",
@@ -1109,6 +3135,26 @@ function _overwrite(tx) {
1109
3135
  });
1110
3136
  }
1111
3137
  /* @__NO_SIDE_EFFECTS__ */
3138
+ function _normalize(form) {
3139
+ return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
3140
+ }
3141
+ /* @__NO_SIDE_EFFECTS__ */
3142
+ function _trim() {
3143
+ return /* @__PURE__ */ _overwrite((input) => input.trim());
3144
+ }
3145
+ /* @__NO_SIDE_EFFECTS__ */
3146
+ function _toLowerCase() {
3147
+ return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
3148
+ }
3149
+ /* @__NO_SIDE_EFFECTS__ */
3150
+ function _toUpperCase() {
3151
+ return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
3152
+ }
3153
+ /* @__NO_SIDE_EFFECTS__ */
3154
+ function _slugify() {
3155
+ return /* @__PURE__ */ _overwrite((input) => slugify(input));
3156
+ }
3157
+ /* @__NO_SIDE_EFFECTS__ */
1112
3158
  function _array(Class, element, params) {
1113
3159
  return new Class({
1114
3160
  type: "array",
@@ -2035,13 +4081,13 @@ let OpenAiStrictJsonSchemaFactory = class OpenAiStrictJsonSchemaFactory$1 {
2035
4081
  this.executionHelpers = executionHelpers;
2036
4082
  }
2037
4083
  createStructuredOutputRecord(schema, options) {
2038
- const record = this.executionHelpers.createJsonSchemaRecord(schema, {
4084
+ const record$1 = this.executionHelpers.createJsonSchemaRecord(schema, {
2039
4085
  schemaName: options.schemaName,
2040
4086
  requireObjectRoot: false
2041
4087
  });
2042
- this.strictifyRecursive(record);
2043
- if (options.title !== void 0) record.title = options.title;
2044
- return record;
4088
+ this.strictifyRecursive(record$1);
4089
+ if (options.title !== void 0) record$1.title = options.title;
4090
+ return record$1;
2045
4091
  }
2046
4092
  strictifyRecursive(node$1) {
2047
4093
  if (!node$1 || typeof node$1 !== "object" || Array.isArray(node$1)) return;
@@ -2275,6 +4321,37 @@ AgentStructuredOutputRepairPromptFactory = _AgentStructuredOutputRepairPromptFac
2275
4321
  __decorateMetadata("design:paramtypes", [typeof (_ref$4 = typeof AIAgentExecutionHelpersFactory !== "undefined" && AIAgentExecutionHelpersFactory) === "function" ? _ref$4 : Object])
2276
4322
  ], AgentStructuredOutputRepairPromptFactory);
2277
4323
 
4324
+ //#endregion
4325
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js
4326
+ const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
4327
+ $ZodISODateTime.init(inst, def);
4328
+ ZodStringFormat.init(inst, def);
4329
+ });
4330
+ function datetime(params) {
4331
+ return _isoDateTime(ZodISODateTime, params);
4332
+ }
4333
+ const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
4334
+ $ZodISODate.init(inst, def);
4335
+ ZodStringFormat.init(inst, def);
4336
+ });
4337
+ function date(params) {
4338
+ return _isoDate(ZodISODate, params);
4339
+ }
4340
+ const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
4341
+ $ZodISOTime.init(inst, def);
4342
+ ZodStringFormat.init(inst, def);
4343
+ });
4344
+ function time(params) {
4345
+ return _isoTime(ZodISOTime, params);
4346
+ }
4347
+ const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
4348
+ $ZodISODuration.init(inst, def);
4349
+ ZodStringFormat.init(inst, def);
4350
+ });
4351
+ function duration(params) {
4352
+ return _isoDuration(ZodISODuration, params);
4353
+ }
4354
+
2278
4355
  //#endregion
2279
4356
  //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
2280
4357
  const initializer = (inst, issues) => {
@@ -2392,6 +4469,181 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2392
4469
  inst.apply = (fn) => fn(inst);
2393
4470
  return inst;
2394
4471
  });
4472
+ /** @internal */
4473
+ const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
4474
+ $ZodString.init(inst, def);
4475
+ ZodType.init(inst, def);
4476
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
4477
+ const bag = inst._zod.bag;
4478
+ inst.format = bag.format ?? null;
4479
+ inst.minLength = bag.minimum ?? null;
4480
+ inst.maxLength = bag.maximum ?? null;
4481
+ inst.regex = (...args) => inst.check(_regex(...args));
4482
+ inst.includes = (...args) => inst.check(_includes(...args));
4483
+ inst.startsWith = (...args) => inst.check(_startsWith(...args));
4484
+ inst.endsWith = (...args) => inst.check(_endsWith(...args));
4485
+ inst.min = (...args) => inst.check(_minLength(...args));
4486
+ inst.max = (...args) => inst.check(_maxLength(...args));
4487
+ inst.length = (...args) => inst.check(_length(...args));
4488
+ inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
4489
+ inst.lowercase = (params) => inst.check(_lowercase(params));
4490
+ inst.uppercase = (params) => inst.check(_uppercase(params));
4491
+ inst.trim = () => inst.check(_trim());
4492
+ inst.normalize = (...args) => inst.check(_normalize(...args));
4493
+ inst.toLowerCase = () => inst.check(_toLowerCase());
4494
+ inst.toUpperCase = () => inst.check(_toUpperCase());
4495
+ inst.slugify = () => inst.check(_slugify());
4496
+ });
4497
+ const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
4498
+ $ZodString.init(inst, def);
4499
+ _ZodString.init(inst, def);
4500
+ inst.email = (params) => inst.check(_email(ZodEmail, params));
4501
+ inst.url = (params) => inst.check(_url(ZodURL, params));
4502
+ inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
4503
+ inst.emoji = (params) => inst.check(_emoji(ZodEmoji, params));
4504
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
4505
+ inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
4506
+ inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
4507
+ inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
4508
+ inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
4509
+ inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
4510
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
4511
+ inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
4512
+ inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
4513
+ inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
4514
+ inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
4515
+ inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
4516
+ inst.xid = (params) => inst.check(_xid(ZodXID, params));
4517
+ inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
4518
+ inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
4519
+ inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
4520
+ inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
4521
+ inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
4522
+ inst.e164 = (params) => inst.check(_e164(ZodE164, params));
4523
+ inst.datetime = (params) => inst.check(datetime(params));
4524
+ inst.date = (params) => inst.check(date(params));
4525
+ inst.time = (params) => inst.check(time(params));
4526
+ inst.duration = (params) => inst.check(duration(params));
4527
+ });
4528
+ function string(params) {
4529
+ return _string(ZodString, params);
4530
+ }
4531
+ const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
4532
+ $ZodStringFormat.init(inst, def);
4533
+ _ZodString.init(inst, def);
4534
+ });
4535
+ const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
4536
+ $ZodEmail.init(inst, def);
4537
+ ZodStringFormat.init(inst, def);
4538
+ });
4539
+ const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
4540
+ $ZodGUID.init(inst, def);
4541
+ ZodStringFormat.init(inst, def);
4542
+ });
4543
+ const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
4544
+ $ZodUUID.init(inst, def);
4545
+ ZodStringFormat.init(inst, def);
4546
+ });
4547
+ const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
4548
+ $ZodURL.init(inst, def);
4549
+ ZodStringFormat.init(inst, def);
4550
+ });
4551
+ const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
4552
+ $ZodEmoji.init(inst, def);
4553
+ ZodStringFormat.init(inst, def);
4554
+ });
4555
+ const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
4556
+ $ZodNanoID.init(inst, def);
4557
+ ZodStringFormat.init(inst, def);
4558
+ });
4559
+ const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
4560
+ $ZodCUID.init(inst, def);
4561
+ ZodStringFormat.init(inst, def);
4562
+ });
4563
+ const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
4564
+ $ZodCUID2.init(inst, def);
4565
+ ZodStringFormat.init(inst, def);
4566
+ });
4567
+ const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
4568
+ $ZodULID.init(inst, def);
4569
+ ZodStringFormat.init(inst, def);
4570
+ });
4571
+ const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
4572
+ $ZodXID.init(inst, def);
4573
+ ZodStringFormat.init(inst, def);
4574
+ });
4575
+ const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
4576
+ $ZodKSUID.init(inst, def);
4577
+ ZodStringFormat.init(inst, def);
4578
+ });
4579
+ const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
4580
+ $ZodIPv4.init(inst, def);
4581
+ ZodStringFormat.init(inst, def);
4582
+ });
4583
+ const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
4584
+ $ZodIPv6.init(inst, def);
4585
+ ZodStringFormat.init(inst, def);
4586
+ });
4587
+ const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
4588
+ $ZodCIDRv4.init(inst, def);
4589
+ ZodStringFormat.init(inst, def);
4590
+ });
4591
+ const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
4592
+ $ZodCIDRv6.init(inst, def);
4593
+ ZodStringFormat.init(inst, def);
4594
+ });
4595
+ const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
4596
+ $ZodBase64.init(inst, def);
4597
+ ZodStringFormat.init(inst, def);
4598
+ });
4599
+ const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
4600
+ $ZodBase64URL.init(inst, def);
4601
+ ZodStringFormat.init(inst, def);
4602
+ });
4603
+ const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
4604
+ $ZodE164.init(inst, def);
4605
+ ZodStringFormat.init(inst, def);
4606
+ });
4607
+ const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
4608
+ $ZodJWT.init(inst, def);
4609
+ ZodStringFormat.init(inst, def);
4610
+ });
4611
+ const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
4612
+ $ZodNumber.init(inst, def);
4613
+ ZodType.init(inst, def);
4614
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
4615
+ inst.gt = (value, params) => inst.check(_gt(value, params));
4616
+ inst.gte = (value, params) => inst.check(_gte(value, params));
4617
+ inst.min = (value, params) => inst.check(_gte(value, params));
4618
+ inst.lt = (value, params) => inst.check(_lt(value, params));
4619
+ inst.lte = (value, params) => inst.check(_lte(value, params));
4620
+ inst.max = (value, params) => inst.check(_lte(value, params));
4621
+ inst.int = (params) => inst.check(int(params));
4622
+ inst.safe = (params) => inst.check(int(params));
4623
+ inst.positive = (params) => inst.check(_gt(0, params));
4624
+ inst.nonnegative = (params) => inst.check(_gte(0, params));
4625
+ inst.negative = (params) => inst.check(_lt(0, params));
4626
+ inst.nonpositive = (params) => inst.check(_lte(0, params));
4627
+ inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
4628
+ inst.step = (value, params) => inst.check(_multipleOf(value, params));
4629
+ inst.finite = () => inst;
4630
+ const bag = inst._zod.bag;
4631
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
4632
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
4633
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
4634
+ inst.isFinite = true;
4635
+ inst.format = bag.format ?? null;
4636
+ });
4637
+ function number(params) {
4638
+ return _number(ZodNumber, params);
4639
+ }
4640
+ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
4641
+ $ZodNumberFormat.init(inst, def);
4642
+ ZodNumber.init(inst, def);
4643
+ });
4644
+ function int(params) {
4645
+ return _int(ZodNumberFormat, params);
4646
+ }
2395
4647
  const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
2396
4648
  $ZodUnknown.init(inst, def);
2397
4649
  ZodType.init(inst, def);
@@ -2400,6 +4652,14 @@ const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
2400
4652
  function unknown() {
2401
4653
  return _unknown(ZodUnknown);
2402
4654
  }
4655
+ const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
4656
+ $ZodNever.init(inst, def);
4657
+ ZodType.init(inst, def);
4658
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
4659
+ });
4660
+ function never(params) {
4661
+ return _never(ZodNever, params);
4662
+ }
2403
4663
  const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
2404
4664
  $ZodArray.init(inst, def);
2405
4665
  ZodType.init(inst, def);
@@ -2414,6 +4674,53 @@ const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
2414
4674
  function array(element, params) {
2415
4675
  return _array(ZodArray, element, params);
2416
4676
  }
4677
+ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
4678
+ $ZodObjectJIT.init(inst, def);
4679
+ ZodType.init(inst, def);
4680
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
4681
+ defineLazy(inst, "shape", () => {
4682
+ return def.shape;
4683
+ });
4684
+ inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
4685
+ inst.catchall = (catchall) => inst.clone({
4686
+ ...inst._zod.def,
4687
+ catchall
4688
+ });
4689
+ inst.passthrough = () => inst.clone({
4690
+ ...inst._zod.def,
4691
+ catchall: unknown()
4692
+ });
4693
+ inst.loose = () => inst.clone({
4694
+ ...inst._zod.def,
4695
+ catchall: unknown()
4696
+ });
4697
+ inst.strict = () => inst.clone({
4698
+ ...inst._zod.def,
4699
+ catchall: never()
4700
+ });
4701
+ inst.strip = () => inst.clone({
4702
+ ...inst._zod.def,
4703
+ catchall: void 0
4704
+ });
4705
+ inst.extend = (incoming) => {
4706
+ return extend(inst, incoming);
4707
+ };
4708
+ inst.safeExtend = (incoming) => {
4709
+ return safeExtend(inst, incoming);
4710
+ };
4711
+ inst.merge = (other) => merge(inst, other);
4712
+ inst.pick = (mask) => pick(inst, mask);
4713
+ inst.omit = (mask) => omit(inst, mask);
4714
+ inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
4715
+ inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
4716
+ });
4717
+ function object(shape, params) {
4718
+ return new ZodObject({
4719
+ type: "object",
4720
+ shape: shape ?? {},
4721
+ ...normalizeParams(params)
4722
+ });
4723
+ }
2417
4724
  const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
2418
4725
  $ZodUnion.init(inst, def);
2419
4726
  ZodType.init(inst, def);
@@ -2439,6 +4746,58 @@ function intersection(left, right) {
2439
4746
  right
2440
4747
  });
2441
4748
  }
4749
+ const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
4750
+ $ZodRecord.init(inst, def);
4751
+ ZodType.init(inst, def);
4752
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
4753
+ inst.keyType = def.keyType;
4754
+ inst.valueType = def.valueType;
4755
+ });
4756
+ function record(keyType, valueType, params) {
4757
+ return new ZodRecord({
4758
+ type: "record",
4759
+ keyType,
4760
+ valueType,
4761
+ ...normalizeParams(params)
4762
+ });
4763
+ }
4764
+ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
4765
+ $ZodEnum.init(inst, def);
4766
+ ZodType.init(inst, def);
4767
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
4768
+ inst.enum = def.entries;
4769
+ inst.options = Object.values(def.entries);
4770
+ const keys = new Set(Object.keys(def.entries));
4771
+ inst.extract = (values, params) => {
4772
+ const newEntries = {};
4773
+ for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
4774
+ else throw new Error(`Key ${value} not found in enum`);
4775
+ return new ZodEnum({
4776
+ ...def,
4777
+ checks: [],
4778
+ ...normalizeParams(params),
4779
+ entries: newEntries
4780
+ });
4781
+ };
4782
+ inst.exclude = (values, params) => {
4783
+ const newEntries = { ...def.entries };
4784
+ for (const value of values) if (keys.has(value)) delete newEntries[value];
4785
+ else throw new Error(`Key ${value} not found in enum`);
4786
+ return new ZodEnum({
4787
+ ...def,
4788
+ checks: [],
4789
+ ...normalizeParams(params),
4790
+ entries: newEntries
4791
+ });
4792
+ };
4793
+ });
4794
+ function _enum(values, params) {
4795
+ return new ZodEnum({
4796
+ type: "enum",
4797
+ entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
4798
+ ...normalizeParams(params)
4799
+ });
4800
+ }
2442
4801
  const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
2443
4802
  $ZodTransform.init(inst, def);
2444
4803
  ZodType.init(inst, def);
@@ -4026,6 +6385,52 @@ var AIAgent = class {
4026
6385
  }
4027
6386
  };
4028
6387
 
6388
+ //#endregion
6389
+ //#region src/nodes/AssertionNode.ts
6390
+ let AssertionNode = class AssertionNode$1 {
6391
+ kind = "node";
6392
+ outputPorts = ["main"];
6393
+ async execute(args) {
6394
+ const ctx = args.ctx;
6395
+ const config$1 = ctx.config;
6396
+ try {
6397
+ return [...await config$1.assertions(args.item, ctx)];
6398
+ } catch (err) {
6399
+ const message = err instanceof Error ? err.message : String(err);
6400
+ return [{
6401
+ name: config$1.name ?? "assertion",
6402
+ score: 0,
6403
+ errored: true,
6404
+ message
6405
+ }];
6406
+ }
6407
+ }
6408
+ };
6409
+ AssertionNode = __decorate([node({ packageName: "@codemation/core-nodes" })], AssertionNode);
6410
+
6411
+ //#endregion
6412
+ //#region src/nodes/assertion.ts
6413
+ /**
6414
+ * Generic assertion node — the "callback" form. For declarative shorthands (StringEquals,
6415
+ * JudgeByAgent) compose this with helpers added in later phases. Sets `emitsAssertions: true`
6416
+ * so host-side persisters know to record its outputs as `TestAssertion` rows.
6417
+ */
6418
+ var Assertion = class {
6419
+ kind = "node";
6420
+ type = AssertionNode;
6421
+ icon;
6422
+ name;
6423
+ id;
6424
+ emitsAssertions = true;
6425
+ assertions;
6426
+ constructor(options) {
6427
+ this.name = options.name ?? "Assertion";
6428
+ this.id = options.id;
6429
+ this.icon = options.icon ?? "lucide:check-circle";
6430
+ this.assertions = options.assertions;
6431
+ }
6432
+ };
6433
+
4029
6434
  //#endregion
4030
6435
  //#region src/nodes/CallbackResultNormalizerFactory.ts
4031
6436
  var CallbackResultNormalizer = class {
@@ -4095,32 +6500,79 @@ let HttpRequestNode = class HttpRequestNode$1 {
4095
6500
  }
4096
6501
  async executeItem(item, ctx) {
4097
6502
  const url = this.resolveUrl(item, ctx);
4098
- const response = await fetch(url, { method: ctx.config.method });
6503
+ const credential = await this.resolveCredential(ctx);
6504
+ const spec = {
6505
+ url,
6506
+ method: ctx.config.method,
6507
+ headers: ctx.config.args.headers,
6508
+ query: ctx.config.args.query,
6509
+ body: ctx.config.args.body,
6510
+ credential,
6511
+ download: {
6512
+ mode: ctx.config.downloadMode,
6513
+ binaryName: ctx.config.binaryName
6514
+ },
6515
+ ctx
6516
+ };
6517
+ const { url: resolvedUrl, init } = await new HttpRequestExecutor(globalThis.fetch, new HttpBodyBuilder(), new HttpUrlBuilder()).buildRequest(spec, item);
6518
+ const response = await globalThis.fetch(resolvedUrl, init);
4099
6519
  const headers = this.readHeaders(response.headers);
4100
6520
  const mimeType = this.resolveMimeType(headers);
4101
- const bodyBinaryName = ctx.config.binaryName;
4102
- const shouldAttachBody = this.shouldAttachBody(ctx.config.downloadMode, mimeType);
4103
- let outputItem = { json: {
4104
- url,
6521
+ const binaryName = ctx.config.binaryName;
6522
+ if (this.shouldAttachBody(ctx.config.downloadMode, mimeType)) {
6523
+ const outputJson = {
6524
+ url: resolvedUrl,
6525
+ method: ctx.config.method,
6526
+ ok: response.ok,
6527
+ status: response.status,
6528
+ statusText: response.statusText,
6529
+ mimeType,
6530
+ headers,
6531
+ bodyBinaryName: binaryName
6532
+ };
6533
+ const attachment = await ctx.binary.attach({
6534
+ name: binaryName,
6535
+ body: response.body ? response.body : new Uint8Array(await response.arrayBuffer()),
6536
+ mimeType,
6537
+ filename: this.resolveFilename(resolvedUrl, headers)
6538
+ });
6539
+ let outputItem = { json: outputJson };
6540
+ outputItem = ctx.binary.withAttachment(outputItem, binaryName, attachment);
6541
+ return outputItem;
6542
+ }
6543
+ const isJson = this.isJsonMimeType(mimeType);
6544
+ let json;
6545
+ let text;
6546
+ if (isJson) try {
6547
+ json = await response.json();
6548
+ } catch {
6549
+ text = await response.text();
6550
+ }
6551
+ else text = await response.text();
6552
+ return { json: {
6553
+ url: resolvedUrl,
4105
6554
  method: ctx.config.method,
4106
6555
  ok: response.ok,
4107
6556
  status: response.status,
4108
6557
  statusText: response.statusText,
4109
6558
  mimeType,
4110
6559
  headers,
4111
- ...shouldAttachBody ? { bodyBinaryName } : {}
6560
+ ...json !== void 0 ? { json } : {},
6561
+ ...text !== void 0 ? { text } : {}
4112
6562
  } };
4113
- if (!shouldAttachBody) return outputItem;
4114
- const attachment = await ctx.binary.attach({
4115
- name: bodyBinaryName,
4116
- body: response.body ? response.body : new Uint8Array(await response.arrayBuffer()),
4117
- mimeType,
4118
- filename: this.resolveFilename(url, headers)
4119
- });
4120
- outputItem = ctx.binary.withAttachment(outputItem, bodyBinaryName, attachment);
4121
- return outputItem;
6563
+ }
6564
+ async resolveCredential(ctx) {
6565
+ const slotKey = ctx.config.args.credentialSlot;
6566
+ if (!slotKey) return;
6567
+ try {
6568
+ return await ctx.getCredential(slotKey);
6569
+ } catch {
6570
+ return;
6571
+ }
4122
6572
  }
4123
6573
  resolveUrl(item, ctx) {
6574
+ const literalUrl = ctx.config.args.url;
6575
+ if (literalUrl && literalUrl.trim().length > 0) return literalUrl.trim();
4124
6576
  const candidate = this.asRecord(item.json)[ctx.config.urlField];
4125
6577
  if (typeof candidate !== "string" || candidate.trim() === "") throw new Error(`HttpRequest node expected item.json.${ctx.config.urlField} to contain a URL string.`);
4126
6578
  return candidate;
@@ -4141,6 +6593,9 @@ let HttpRequestNode = class HttpRequestNode$1 {
4141
6593
  if (!contentType) return "application/octet-stream";
4142
6594
  return contentType.split(";")[0]?.trim() || "application/octet-stream";
4143
6595
  }
6596
+ isJsonMimeType(mimeType) {
6597
+ return mimeType === "application/json" || mimeType.endsWith("+json");
6598
+ }
4144
6599
  shouldAttachBody(mode, mimeType) {
4145
6600
  if (mode === "always") return true;
4146
6601
  if (mode === "never") return false;
@@ -4167,6 +6622,16 @@ HttpRequestNode = __decorate([node({ packageName: "@codemation/core-nodes" })],
4167
6622
 
4168
6623
  //#endregion
4169
6624
  //#region src/nodes/httpRequest.ts
6625
+ /**
6626
+ * The built-in HTTP request credential type IDs accepted by the `HttpRequest` node.
6627
+ * These match the four generic credential types shipped with `@codemation/core-nodes`.
6628
+ */
6629
+ const HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES = [
6630
+ bearerTokenCredentialType.definition.typeId,
6631
+ apiKeyCredentialType.definition.typeId,
6632
+ basicAuthCredentialType.definition.typeId,
6633
+ oauth2ClientCredentialsType.definition.typeId
6634
+ ];
4170
6635
  var HttpRequest = class {
4171
6636
  kind = "node";
4172
6637
  type = HttpRequestNode;
@@ -4192,6 +6657,16 @@ var HttpRequest = class {
4192
6657
  get downloadMode() {
4193
6658
  return this.args.downloadMode ?? "auto";
4194
6659
  }
6660
+ getCredentialRequirements() {
6661
+ if (!this.args.credentialSlot) return [];
6662
+ return [{
6663
+ slotKey: this.args.credentialSlot,
6664
+ label: "Authentication",
6665
+ acceptedTypes: HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES,
6666
+ optional: true,
6667
+ helpText: "Optional credential for authenticating the HTTP request."
6668
+ }];
6669
+ }
4195
6670
  };
4196
6671
 
4197
6672
  //#endregion
@@ -4317,6 +6792,40 @@ var If = class {
4317
6792
  }
4318
6793
  };
4319
6794
 
6795
+ //#endregion
6796
+ //#region src/nodes/IsTestRunNode.ts
6797
+ let IsTestRunNode = class IsTestRunNode$1 {
6798
+ kind = "node";
6799
+ execute(args) {
6800
+ const isTest = args.ctx.testContext !== void 0;
6801
+ return emitPorts({
6802
+ true: isTest ? [args.item] : [],
6803
+ false: isTest ? [] : [args.item]
6804
+ });
6805
+ }
6806
+ };
6807
+ IsTestRunNode = __decorate([node({ packageName: "@codemation/core-nodes" })], IsTestRunNode);
6808
+
6809
+ //#endregion
6810
+ //#region src/nodes/isTestRun.ts
6811
+ /**
6812
+ * Branches per-item on whether the current run is a test run. Output ports: `true`, `false`.
6813
+ * The wire payload is unchanged — this is a router, not a transform.
6814
+ */
6815
+ var IsTestRun = class {
6816
+ kind = "node";
6817
+ type = IsTestRunNode;
6818
+ execution = { hint: "local" };
6819
+ icon = "lucide:flask-conical";
6820
+ declaredOutputPorts = ["true", "false"];
6821
+ name;
6822
+ id;
6823
+ constructor(name = "Is test run?", id) {
6824
+ this.name = name;
6825
+ this.id = id;
6826
+ }
6827
+ };
6828
+
4320
6829
  //#endregion
4321
6830
  //#region src/nodes/SwitchNode.ts
4322
6831
  let SwitchNode = class SwitchNode$1 {
@@ -4381,6 +6890,75 @@ var Split = class {
4381
6890
  }
4382
6891
  };
4383
6892
 
6893
+ //#endregion
6894
+ //#region src/nodes/CronTriggerNode.ts
6895
+ let CronTriggerNode = class CronTriggerNode$1 {
6896
+ kind = "trigger";
6897
+ outputPorts = ["main"];
6898
+ async setup(ctx) {
6899
+ const job = ctx.config.createJob(async (self) => {
6900
+ const scheduledFor = self.currentRun()?.toISOString() ?? ctx.now().toISOString();
6901
+ await ctx.emit([{ json: {
6902
+ firedAt: ctx.now().toISOString(),
6903
+ scheduledFor
6904
+ } }]);
6905
+ });
6906
+ ctx.registerCleanup({ stop: () => {
6907
+ job.stop();
6908
+ } });
6909
+ }
6910
+ async execute(items, _ctx) {
6911
+ return { main: items };
6912
+ }
6913
+ async getTestItems(ctx) {
6914
+ const nowIso = ctx.now().toISOString();
6915
+ return [{ json: {
6916
+ firedAt: nowIso,
6917
+ scheduledFor: nowIso
6918
+ } }];
6919
+ }
6920
+ };
6921
+ CronTriggerNode = __decorate([node({ packageName: "@codemation/core-nodes" })], CronTriggerNode);
6922
+
6923
+ //#endregion
6924
+ //#region src/nodes/CronTriggerFactory.ts
6925
+ /**
6926
+ * Schedules a workflow on a standard cron expression.
6927
+ *
6928
+ * Each tick emits one item: `{ firedAt: string, scheduledFor: string }` — both ISO-8601 timestamps.
6929
+ * `firedAt` is the wall-clock moment the callback ran; `scheduledFor` is the cron-computed
6930
+ * firing instant (these differ when the job was delayed).
6931
+ *
6932
+ * Timezone defaults to UTC when omitted — cron without an explicit TZ is a DST footgun.
6933
+ */
6934
+ var CronTrigger = class {
6935
+ kind = "trigger";
6936
+ type = CronTriggerNode;
6937
+ icon = "lucide:clock";
6938
+ id;
6939
+ constructor(name, args, id) {
6940
+ this.name = name;
6941
+ this.args = args;
6942
+ new Cron(args.schedule, {
6943
+ paused: true,
6944
+ timezone: args.timezone
6945
+ });
6946
+ this.id = id;
6947
+ }
6948
+ get schedule() {
6949
+ return this.args.schedule;
6950
+ }
6951
+ get timezone() {
6952
+ return this.args.timezone;
6953
+ }
6954
+ createJob(callback) {
6955
+ return new Cron(this.args.schedule, {
6956
+ timezone: this.args.timezone,
6957
+ protect: true
6958
+ }, callback);
6959
+ }
6960
+ };
6961
+
4384
6962
  //#endregion
4385
6963
  //#region src/nodes/ManualTriggerNode.ts
4386
6964
  let ManualTriggerNode = class ManualTriggerNode$1 {
@@ -4612,6 +7190,52 @@ var SubWorkflow = class {
4612
7190
  }
4613
7191
  };
4614
7192
 
7193
+ //#endregion
7194
+ //#region src/nodes/TestTriggerNode.ts
7195
+ let TestTriggerNode = class TestTriggerNode$1 {
7196
+ kind = "trigger";
7197
+ outputPorts = ["main"];
7198
+ async setup(_ctx) {}
7199
+ async execute(items, _ctx) {
7200
+ return { main: items };
7201
+ }
7202
+ };
7203
+ TestTriggerNode = __decorate([node({ packageName: "@codemation/core-nodes" })], TestTriggerNode);
7204
+
7205
+ //#endregion
7206
+ //#region src/nodes/testTrigger.ts
7207
+ /**
7208
+ * Trigger config for a test fixture source. Drop one (or more) of these on the canvas alongside
7209
+ * a workflow's live triggers; clicking "Run tests" on the Tests tab invokes
7210
+ * {@link TestTriggerOptions.generateItems} via the TestSuiteOrchestrator.
7211
+ */
7212
+ var TestTrigger = class {
7213
+ kind = "trigger";
7214
+ triggerKind = "test";
7215
+ type = TestTriggerNode;
7216
+ icon;
7217
+ name;
7218
+ id;
7219
+ concurrency;
7220
+ description;
7221
+ generateItems;
7222
+ caseLabel;
7223
+ credentialRequirements;
7224
+ constructor(options) {
7225
+ this.name = options.name ?? "Test trigger";
7226
+ this.id = options.id;
7227
+ this.icon = options.icon ?? "lucide:flask-conical";
7228
+ this.concurrency = options.concurrency;
7229
+ this.description = options.description;
7230
+ this.credentialRequirements = options.credentialRequirements ?? [];
7231
+ this.generateItems = options.generateItems;
7232
+ this.caseLabel = options.caseLabel;
7233
+ }
7234
+ getCredentialRequirements() {
7235
+ return this.credentialRequirements;
7236
+ }
7237
+ };
7238
+
4615
7239
  //#endregion
4616
7240
  //#region src/nodes/WaitDurationFactory.ts
4617
7241
  var WaitDuration = class {
@@ -4792,10 +7416,10 @@ var WorkflowDefinedNodeResolver = class {
4792
7416
  //#endregion
4793
7417
  //#region src/workflowAuthoring/WorkflowDurationParser.types.ts
4794
7418
  var WorkflowDurationParser = class {
4795
- static parse(duration) {
4796
- if (typeof duration === "number") return Number.isFinite(duration) && duration > 0 ? Math.floor(duration) : 0;
4797
- const match = duration.trim().toLowerCase().match(/^(\d+)(ms|s|m|h)$/);
4798
- if (!match) throw new Error(`Unsupported wait duration "${duration}". Use a number of milliseconds or values like "500ms", "2s", "5m".`);
7419
+ static parse(duration$2) {
7420
+ if (typeof duration$2 === "number") return Number.isFinite(duration$2) && duration$2 > 0 ? Math.floor(duration$2) : 0;
7421
+ const match = duration$2.trim().toLowerCase().match(/^(\d+)(ms|s|m|h)$/);
7422
+ if (!match) throw new Error(`Unsupported wait duration "${duration$2}". Use a number of milliseconds or values like "500ms", "2s", "5m".`);
4799
7423
  const value = Number(match[1]);
4800
7424
  const unit = match[2];
4801
7425
  if (unit === "ms") return value;
@@ -4821,8 +7445,8 @@ var WorkflowBranchBuilder = class WorkflowBranchBuilder {
4821
7445
  }
4822
7446
  wait(nameOrDuration, durationOrUndefined, id) {
4823
7447
  const name = typeof nameOrDuration === "string" && durationOrUndefined !== void 0 ? nameOrDuration : "Wait";
4824
- const duration = durationOrUndefined ?? nameOrDuration;
4825
- return this.then(new Wait(name, WorkflowDurationParser.parse(duration), id));
7448
+ const duration$2 = durationOrUndefined ?? nameOrDuration;
7449
+ return this.then(new Wait(name, WorkflowDurationParser.parse(duration$2), id));
4826
7450
  }
4827
7451
  split(nameOrGetter, getElementsOrUndefined, id) {
4828
7452
  const name = typeof nameOrGetter === "string" ? nameOrGetter : "Split";
@@ -4867,8 +7491,8 @@ var WorkflowChain = class WorkflowChain {
4867
7491
  }
4868
7492
  wait(nameOrDuration, durationOrUndefined, id) {
4869
7493
  const name = typeof nameOrDuration === "string" && durationOrUndefined !== void 0 ? nameOrDuration : "Wait";
4870
- const duration = durationOrUndefined ?? nameOrDuration;
4871
- return this.then(new Wait(name, WorkflowDurationParser.parse(duration), id));
7494
+ const duration$2 = durationOrUndefined ?? nameOrDuration;
7495
+ return this.then(new Wait(name, WorkflowDurationParser.parse(duration$2), id));
4872
7496
  }
4873
7497
  split(nameOrGetter, getElementsOrUndefined, id) {
4874
7498
  const name = typeof nameOrGetter === "string" ? nameOrGetter : "Split";
@@ -5050,5 +7674,128 @@ var ConnectionCredentialNodeConfigFactory = class {
5050
7674
  };
5051
7675
 
5052
7676
  //#endregion
5053
- export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentStructuredOutputRepairPromptFactory, AgentStructuredOutputRunner, AgentToolCallPortMap, AgentToolErrorClassifier, AgentToolExecutionCoordinator, AgentToolRepairExhaustedError, AgentToolRepairPolicy, Aggregate, AggregateNode, Callback, CallbackNode, CallbackResultNormalizer, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, Filter, FilterNode, HttpRequest, HttpRequestNode, If, IfNode, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, Merge, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, OpenAiStrictJsonSchemaFactory, Split, SplitNode, SubWorkflow, SubWorkflowNode, Switch, SwitchNode, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, createWorkflowBuilder, openAiChatModelPresets, registerCoreNodes, workflow };
7677
+ //#region src/nodes/collections/collectionInsertNode.types.ts
7678
+ const collectionInsertNode = defineNode({
7679
+ key: "collection-insert",
7680
+ title: "Collection: Insert",
7681
+ description: "Insert a new row into a collection.",
7682
+ icon: "lucide:boxes",
7683
+ configSchema: object({
7684
+ collectionName: string(),
7685
+ data: record(string(), unknown())
7686
+ }),
7687
+ async execute(_args, { config: config$1, execution }) {
7688
+ const store = execution.collections?.[config$1.collectionName];
7689
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7690
+ return await store.insert(config$1.data);
7691
+ }
7692
+ });
7693
+
7694
+ //#endregion
7695
+ //#region src/nodes/collections/collectionGetNode.types.ts
7696
+ const collectionGetNode = defineNode({
7697
+ key: "collection-get",
7698
+ title: "Collection: Get",
7699
+ description: "Get a single row by id from a collection.",
7700
+ icon: "lucide:layers",
7701
+ configSchema: object({
7702
+ collectionName: string(),
7703
+ id: string()
7704
+ }),
7705
+ async execute(_args, { config: config$1, execution }) {
7706
+ const store = execution.collections?.[config$1.collectionName];
7707
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7708
+ const row = await store.get(config$1.id);
7709
+ if (row === null) return [];
7710
+ return row;
7711
+ }
7712
+ });
7713
+
7714
+ //#endregion
7715
+ //#region src/nodes/collections/collectionFindOneNode.types.ts
7716
+ const collectionFindOneNode = defineNode({
7717
+ key: "collection-find-one",
7718
+ title: "Collection: Find One",
7719
+ description: "Find a single row matching a filter in a collection.",
7720
+ icon: "lucide:filter",
7721
+ configSchema: object({
7722
+ collectionName: string(),
7723
+ where: record(string(), unknown())
7724
+ }),
7725
+ async execute(_args, { config: config$1, execution }) {
7726
+ const store = execution.collections?.[config$1.collectionName];
7727
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7728
+ const row = await store.findOne(config$1.where);
7729
+ if (row === null) return [];
7730
+ return row;
7731
+ }
7732
+ });
7733
+
7734
+ //#endregion
7735
+ //#region src/nodes/collections/collectionListNode.types.ts
7736
+ const collectionListNode = defineNode({
7737
+ key: "collection-list",
7738
+ title: "Collection: List",
7739
+ description: "List rows from a collection with optional pagination and filtering.",
7740
+ icon: "lucide:split",
7741
+ configSchema: object({
7742
+ collectionName: string(),
7743
+ limit: number().int().positive().optional(),
7744
+ offset: number().int().nonnegative().optional(),
7745
+ where: record(string(), unknown()).optional()
7746
+ }),
7747
+ async execute(_args, { config: config$1, execution }) {
7748
+ const store = execution.collections?.[config$1.collectionName];
7749
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7750
+ const { rows } = await store.list({
7751
+ limit: config$1.limit,
7752
+ offset: config$1.offset,
7753
+ where: config$1.where
7754
+ });
7755
+ return [...rows];
7756
+ }
7757
+ });
7758
+
7759
+ //#endregion
7760
+ //#region src/nodes/collections/collectionUpdateNode.types.ts
7761
+ const collectionUpdateNode = defineNode({
7762
+ key: "collection-update",
7763
+ title: "Collection: Update",
7764
+ description: "Update a row by id in a collection.",
7765
+ icon: "lucide:square-pen",
7766
+ configSchema: object({
7767
+ collectionName: string(),
7768
+ id: string(),
7769
+ patch: record(string(), unknown())
7770
+ }),
7771
+ async execute(_args, { config: config$1, execution }) {
7772
+ const store = execution.collections?.[config$1.collectionName];
7773
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7774
+ return await store.update(config$1.id, config$1.patch);
7775
+ }
7776
+ });
7777
+
7778
+ //#endregion
7779
+ //#region src/nodes/collections/collectionDeleteNode.types.ts
7780
+ const collectionDeleteNode = defineNode({
7781
+ key: "collection-delete",
7782
+ title: "Collection: Delete",
7783
+ description: "Delete a row by id from a collection.",
7784
+ icon: "lucide:braces",
7785
+ configSchema: object({
7786
+ collectionName: string(),
7787
+ id: string()
7788
+ }),
7789
+ async execute(_args, { config: config$1, execution }) {
7790
+ const store = execution.collections?.[config$1.collectionName];
7791
+ if (!store) throw new Error(`Collection "${config$1.collectionName}" is not registered. Add defineCollection to your codemation config.`);
7792
+ return {
7793
+ deleted: (await store.delete(config$1.id)).deleted,
7794
+ id: config$1.id
7795
+ };
7796
+ }
7797
+ });
7798
+
7799
+ //#endregion
7800
+ export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentStructuredOutputRepairPromptFactory, AgentStructuredOutputRunner, AgentToolCallPortMap, AgentToolErrorClassifier, AgentToolExecutionCoordinator, AgentToolRepairExhaustedError, AgentToolRepairPolicy, Aggregate, AggregateNode, Assertion, AssertionNode, Callback, CallbackNode, CallbackResultNormalizer, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, CronTrigger, CronTriggerNode, Filter, FilterNode, HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES, HttpRequest, HttpRequestNode, If, IfNode, IsTestRun, IsTestRunNode, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, Merge, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, OpenAiStrictJsonSchemaFactory, Split, SplitNode, SubWorkflow, SubWorkflowNode, Switch, SwitchNode, TestTrigger, TestTriggerNode, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, apiKeyCredentialType, basicAuthCredentialType, bearerTokenCredentialType, collectionDeleteNode, collectionFindOneNode, collectionGetNode, collectionInsertNode, collectionListNode, collectionUpdateNode, createWorkflowBuilder, defineRestNode, oauth2ClientCredentialsType, openAiChatModelPresets, registerCoreNodes, workflow };
5054
7801
  //# sourceMappingURL=index.js.map