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