@oomol-lab/open-flow 0.1.0-beta.74 → 0.1.0-beta.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +1 -0
  2. package/dist/browser/{ContentIcon-CUQHjQIw.js → ContentIcon-FCpKiwjp.js} +2 -1
  3. package/dist/browser/{FlowCanvas-Dtf8_cQp.js → FlowCanvas-dzRBnlUT.js} +1 -1
  4. package/dist/browser/{createResourceDialog-DI9pL-Yr.js → createResourceDialog-BeYDdUl-.js} +2 -2
  5. package/dist/browser/{dialog-BYJGvItc.js → dialog-ZtpsFbl4.js} +284 -13
  6. package/dist/browser/{exportSvg-BOoy7-Db.js → exportSvg-DqXw1yf-.js} +2 -2
  7. package/dist/browser/{flowChanges-RL-H4CjD.js → flowChanges-b_5UobFj.js} +285 -44
  8. package/dist/browser/{flowWorkspace-BkDsETj0.js → flowWorkspace-ItojZbO4.js} +414 -53
  9. package/dist/browser/preview.css +181 -176
  10. package/dist/browser/preview.js +955 -182
  11. package/dist/browser/workbench.css +181 -176
  12. package/dist/browser/workbench.js +12 -6
  13. package/dist/browser/{workbenchSelect-BcWPWGzw.js → workbenchSelect-M441Lz0d.js} +1 -1
  14. package/dist/command/index.js +36 -36
  15. package/dist/common/authoring.d.ts +4 -4
  16. package/dist/common/authoringExamples.d.ts +3 -2
  17. package/dist/common/authoringSchema.d.ts +67 -4
  18. package/dist/common/control-api-conformance.js +58 -7
  19. package/dist/common/control-api.js +58 -7
  20. package/dist/common/control-requests.d.ts +3 -3
  21. package/dist/common/control-requests.js +234 -62
  22. package/dist/common/engine-contract.d.ts +1 -0
  23. package/dist/common/flow-authoring.js +56 -7
  24. package/dist/common/flow-change.d.ts +1 -1
  25. package/dist/common/flow-change.js +56 -7
  26. package/dist/common/flow-encoding.js +55 -7
  27. package/dist/common/flow-graph.d.ts +2 -1
  28. package/dist/common/flow-retry.d.ts +1 -1
  29. package/dist/common/flow-semantics.js +810 -577
  30. package/dist/common/http-request.d.ts +156 -0
  31. package/dist/common/http-request.js +5254 -0
  32. package/dist/common/mcp.d.ts +3 -3
  33. package/dist/common/mcp.js +58 -7
  34. package/dist/common/run-events.js +11 -9
  35. package/dist/common/runtime-contract.js +3 -0
  36. package/dist/common/scheduler.d.ts +1 -1
  37. package/dist/common/scheduler.js +70 -21
  38. package/dist/common/webhook-response.d.ts +0 -2
  39. package/dist/common/webhook-trigger.js +12 -11
  40. package/package.json +5 -1
  41. package/skills/open-flow/references/flow-authoring.md +1 -0
  42. package/skills/open-flow/references/flow-n8n-conversion.md +19 -15
  43. package/src/control/common/api.ts +1 -0
  44. package/src/control/common/authoring.ts +14 -3
  45. package/src/control/common/authoringExamples.ts +8 -0
  46. package/src/control/common/authoringSchema.ts +30 -24
  47. package/src/execution/common/engineContract.ts +4 -0
  48. package/src/execution/common/events.ts +3 -0
  49. package/src/execution/common/node-execution.ts +4 -2
  50. package/src/execution/common/scheduler.ts +1 -0
  51. package/src/flow/common/change.ts +3 -2
  52. package/src/flow/common/changeSchema.ts +12 -3
  53. package/src/flow/common/graph.ts +10 -4
  54. package/src/flow/common/retry.ts +1 -1
  55. package/src/flow/common/semantics.ts +60 -3
  56. package/src/flow/common/webhookResponse.ts +3 -7
  57. package/src/{openapi → http}/common/authBindings.ts +3 -3
  58. package/src/http/common/headers.ts +5 -0
  59. package/src/http/common/httpRequest.ts +251 -0
  60. package/src/trigger/common/webhook.ts +4 -3
@@ -4128,439 +4128,84 @@ function decisionTaskIssues(task) {
4128
4128
  }] : []];
4129
4129
  }
4130
4130
  //#endregion
4131
- //#region src/openapi/common/openapi.ts
4132
- var methods = [
4133
- "get",
4134
- "put",
4135
- "post",
4136
- "delete",
4137
- "options",
4138
- "head",
4139
- "patch",
4140
- "trace"
4141
- ];
4142
- function object$1(value) {
4143
- if (value == null || typeof value != "object" || Array.isArray(value)) throw new Error("Expected an OpenAPI object.");
4144
- return value;
4145
- }
4146
- function httpUrl(value, base) {
4147
- const url = new URL(value, base);
4148
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash) throw new Error("An HTTP(S) URL without credentials or fragment is required.");
4149
- return url.href;
4131
+ //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/util.js
4132
+ function getEnumValues(entries) {
4133
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
4134
+ return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
4150
4135
  }
4151
- function parseOpenApi(value) {
4152
- const doc = object$1(value);
4153
- if (typeof doc.openapi != "string" || !/^3\.[01]\.\d+$/.test(doc.openapi)) throw new Error("Only OpenAPI 3.0 and 3.1 JSON documents are supported.");
4154
- object$1(doc.paths);
4155
- return doc;
4136
+ function joinValues(array, separator = "|") {
4137
+ return array.map((val) => stringifyPrimitive(val)).join(separator);
4156
4138
  }
4157
- function pointer(doc, ref) {
4158
- if (!ref.startsWith("#/")) throw new Error("External OpenAPI references are not supported.");
4159
- let value = doc;
4160
- for (const key of decodeURIComponent(ref.slice(2)).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"))) {
4161
- const source = object$1(value);
4162
- if (!Object.hasOwn(source, key)) throw new Error("An OpenAPI reference is missing.");
4163
- value = source[key];
4164
- }
4139
+ function jsonStringifyReplacer(_, value) {
4140
+ if (typeof value === "bigint") return value.toString();
4165
4141
  return value;
4166
4142
  }
4167
- function resolved(doc, value) {
4168
- let result = object$1(value);
4169
- const seen = /* @__PURE__ */ new Set();
4170
- while (typeof result.$ref == "string") {
4171
- if (seen.has(result.$ref)) throw new Error("Circular non-schema reference is unsupported.");
4172
- seen.add(result.$ref);
4173
- const { $ref, ...siblings } = result;
4174
- result = {
4175
- ...object$1(pointer(doc, $ref)),
4176
- ...siblings
4177
- };
4143
+ var Cached = class {
4144
+ constructor(getter) {
4145
+ this._getter = getter;
4146
+ this._value = void 0;
4178
4147
  }
4179
- return result;
4148
+ get value() {
4149
+ const getter = this._getter;
4150
+ if (getter !== void 0) {
4151
+ this._value = getter();
4152
+ this._getter = void 0;
4153
+ }
4154
+ return this._value;
4155
+ }
4156
+ };
4157
+ function cached(getter) {
4158
+ return new Cached(getter);
4180
4159
  }
4181
- function operation(doc, path, method) {
4182
- const item = resolved(doc, object$1(doc.paths)[path]);
4183
- if (!methods.includes(method) || item[method] == null) throw new Error("The selected operation is no longer available.");
4184
- return {
4185
- item,
4186
- op: object$1(item[method])
4187
- };
4160
+ function nullish(input) {
4161
+ return input === null || input === void 0;
4188
4162
  }
4189
- function servers(value, path, method) {
4190
- const doc = parseOpenApi(value);
4191
- const { item, op } = operation(doc, path, method);
4192
- const entries = op.servers ?? item.servers ?? doc.servers;
4193
- if (!Array.isArray(entries) || entries.length == 0) return [{ url: "/" }];
4194
- return entries.map(object$1);
4163
+ function cleanRegex(source) {
4164
+ const start = source.startsWith("^") ? 1 : 0;
4165
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
4166
+ return source.slice(start, end);
4195
4167
  }
4196
- function snapshot(documentValue, path, method) {
4197
- const doc = parseOpenApi(documentValue);
4198
- const { item, op } = operation(doc, path, method);
4199
- const security = op.security ?? doc.security ?? [];
4200
- const result = {
4201
- openapi: doc.openapi,
4202
- paths: { [path]: {
4203
- [method]: op,
4204
- ...item.parameters == null ? {} : { parameters: item.parameters }
4205
- } },
4206
- servers: servers(doc, path, method),
4207
- security
4208
- };
4209
- const visited = /* @__PURE__ */ new Set();
4210
- function copy(ref) {
4211
- if (visited.has(ref)) return;
4212
- visited.add(ref);
4213
- const value = pointer(doc, ref);
4214
- const keys = decodeURIComponent(ref.slice(2)).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"));
4215
- if (keys.some((key) => [
4216
- "__proto__",
4217
- "constructor",
4218
- "prototype"
4219
- ].includes(key))) throw new Error("Unsupported reference key.");
4220
- let target = result;
4221
- for (const key of keys.slice(0, -1)) {
4222
- if (!Object.hasOwn(target, key)) target[key] = {};
4223
- target = object$1(target[key]);
4224
- }
4225
- target[keys.at(-1)] = structuredClone(value);
4226
- visit(value);
4227
- }
4228
- function visit(value) {
4229
- if (value == null || typeof value != "object") return;
4230
- if (Array.isArray(value)) {
4231
- value.forEach(visit);
4232
- return;
4233
- }
4234
- if (typeof object$1(value).$ref == "string") copy(object$1(value).$ref);
4235
- for (const [key, child] of Object.entries(value)) if (![
4236
- "example",
4237
- "examples",
4238
- "default"
4239
- ].includes(key)) visit(child);
4240
- }
4241
- visit(result);
4242
- for (const entry of security) for (const name of Object.keys(object$1(entry))) copy(`#/components/securitySchemes/${name.replace(/~/g, "~0").replace(/\//g, "~1")}`);
4243
- return structuredClone(result);
4168
+ function floatSafeRemainder(val, step) {
4169
+ const ratio = val / step;
4170
+ const roundedRatio = Math.round(ratio);
4171
+ const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
4172
+ if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
4173
+ return ratio - roundedRatio;
4244
4174
  }
4245
- function schema$1(doc, schemaValue) {
4246
- const defs = {};
4247
- const ids = /* @__PURE__ */ new Map();
4248
- function convert(value) {
4249
- if (typeof value == "boolean") return value;
4250
- const source = object$1(value);
4251
- if (source.format == "binary" || source.$dynamicRef != null || source.$id != null) throw new Error("Binary and dynamically scoped schemas are unsupported.");
4252
- const result = {};
4253
- for (const [key, child] of Object.entries(source)) {
4254
- if ([
4255
- "nullable",
4256
- "example",
4257
- "xml",
4258
- "discriminator",
4259
- "__proto__"
4260
- ].includes(key)) continue;
4261
- if (key == "$ref") {
4262
- if (typeof child != "string") throw new Error("Invalid schema reference.");
4263
- let id = ids.get(child);
4264
- if (id == null) {
4265
- id = `s${ids.size}`;
4266
- ids.set(child, id);
4267
- defs[id] = convert(pointer(doc, child));
4268
- }
4269
- result.$ref = `#/$defs/${id}`;
4270
- } else if ([
4271
- "properties",
4272
- "patternProperties",
4273
- "$defs",
4274
- "definitions",
4275
- "dependentSchemas"
4276
- ].includes(key)) result[key] = Object.fromEntries(Object.entries(object$1(child)).map(([name, childSchema]) => [name, convert(childSchema)]));
4277
- else if ([
4278
- "allOf",
4279
- "anyOf",
4280
- "oneOf",
4281
- "prefixItems"
4282
- ].includes(key)) {
4283
- if (!Array.isArray(child)) throw new Error("Invalid schema composition.");
4284
- result[key] = child.map(convert);
4285
- } else if ([
4286
- "items",
4287
- "additionalProperties",
4288
- "not",
4289
- "if",
4290
- "then",
4291
- "else",
4292
- "contains",
4293
- "propertyNames",
4294
- "unevaluatedProperties"
4295
- ].includes(key)) result[key] = convert(child);
4296
- else result[key] = child;
4297
- }
4298
- if (source.nullable === true) return { anyOf: [result, { type: "null" }] };
4299
- for (const key of ["minimum", "maximum"]) {
4300
- const exclusive = key == "minimum" ? "exclusiveMinimum" : "exclusiveMaximum";
4301
- if (typeof result[exclusive] == "boolean") {
4302
- if (result[exclusive] && typeof result[key] == "number") {
4303
- result[exclusive] = result[key];
4304
- delete result[key];
4305
- } else delete result[exclusive];
4175
+ var EVALUATING = /* @__PURE__*/ Symbol("evaluating");
4176
+ function defineLazy(object, key, getter) {
4177
+ let value = void 0;
4178
+ Object.defineProperty(object, key, {
4179
+ get() {
4180
+ if (value === EVALUATING) return;
4181
+ if (value === void 0) {
4182
+ value = EVALUATING;
4183
+ value = getter();
4306
4184
  }
4307
- }
4308
- return result;
4309
- }
4310
- let converted = convert(schemaValue);
4311
- if (typeof converted == "object" && converted != null && typeof object$1(converted).$ref == "string") {
4312
- const id = String(object$1(converted).$ref).slice(8);
4313
- const { $ref: _ref, ...siblings } = object$1(converted);
4314
- converted = {
4315
- ...object$1(defs[id]),
4316
- ...siblings
4317
- };
4318
- }
4319
- if (typeof converted == "boolean") return converted;
4320
- return {
4321
- $schema: "https://json-schema.org/draft/2020-12/schema",
4322
- ...object$1(converted),
4323
- ...Object.keys(defs).length ? { $defs: defs } : {}
4324
- };
4185
+ return value;
4186
+ },
4187
+ set(v) {
4188
+ Object.defineProperty(object, key, { value: v });
4189
+ },
4190
+ configurable: true
4191
+ });
4325
4192
  }
4326
- function parameters(config) {
4327
- const doc = parseOpenApi(config.document);
4328
- const { item, op } = operation(doc, config.path, config.method);
4329
- const entries = /* @__PURE__ */ new Map();
4330
- for (const value of [...item.parameters ?? [], ...op.parameters ?? []]) {
4331
- const p = resolved(doc, value);
4332
- if (![
4333
- "path",
4334
- "query",
4335
- "header"
4336
- ].includes(String(p.in)) || typeof p.name != "string" || p.content != null) throw new Error("Only schema-based path, query and header parameters are supported.");
4337
- if (p.allowReserved === true) throw new Error("allowReserved parameters are unsupported.");
4338
- if ((p.style ?? (p.in == "query" ? "form" : "simple")) != (p.in == "query" ? "form" : "simple")) throw new Error("Only form query and simple path/header serialization are supported.");
4339
- entries.set(`${p.in}.${p.in == "header" ? p.name.toLowerCase() : p.name}`, p);
4340
- }
4341
- return [...entries.values()];
4193
+ function assignProp(target, prop, value) {
4194
+ Object.defineProperty(target, prop, {
4195
+ value,
4196
+ writable: true,
4197
+ enumerable: true,
4198
+ configurable: true
4199
+ });
4342
4200
  }
4343
- function jsonContent(doc, value) {
4344
- const content = resolved(doc, value);
4345
- const media = object$1(content.content);
4346
- const mediaType = media["application/json"] != null ? "application/json" : Object.keys(media).find((key) => /^application\/.+\+json$/.test(key));
4347
- const json = mediaType == null ? void 0 : media[mediaType];
4348
- if (json == null) throw new Error("Only JSON request and response bodies are supported.");
4349
- return {
4350
- schema: schema$1(doc, object$1(json).schema ?? {}),
4351
- required: content.required === true,
4352
- mediaType
4353
- };
4354
- }
4355
- function authHandles(auth) {
4356
- return auth.flatMap((scheme) => scheme.type == "basic" ? [`auth.${scheme.id}.username`, `auth.${scheme.id}.password`] : [`auth.${scheme.id}.token`]);
4357
- }
4358
- function openApiTask(config, name = "OpenAPI") {
4359
- if (!config.path) return {
4360
- name,
4361
- executor: config,
4362
- inputs: [],
4363
- outputs: []
4364
- };
4365
- const doc = parseOpenApi(config.document);
4366
- const { op } = operation(doc, config.path, config.method);
4367
- const params = parameters(config);
4368
- const inputs = params.map((p) => {
4369
- const jsonSchema = schema$1(doc, p.schema ?? {});
4370
- const defaultValue = typeof jsonSchema == "boolean" ? void 0 : object$1(jsonSchema).default;
4371
- return {
4372
- handle: `${p.in}.${p.name}`,
4373
- jsonSchema,
4374
- nullable: p.required !== true && p.in != "path" || matchesSchema(null, jsonSchema),
4375
- ...typeof p.description == "string" ? { description: p.description } : {},
4376
- ...defaultValue === void 0 ? {} : { value: defaultValue }
4377
- };
4378
- });
4379
- if (op.requestBody != null) {
4380
- if (config.method == "get" || config.method == "head") throw new Error("GET and HEAD request bodies are unsupported.");
4381
- const body = jsonContent(doc, op.requestBody);
4382
- inputs.push({
4383
- handle: "body",
4384
- jsonSchema: body.schema,
4385
- nullable: !body.required || matchesSchema(null, body.schema)
4386
- });
4387
- }
4388
- const occupied = new Set(params.map((p) => `${p.in}.${p.in == "header" ? String(p.name).toLowerCase() : p.name}`));
4389
- for (const auth of config.auth) {
4390
- const location = auth.type == "apiKey" ? `${auth.in}.${auth.in == "header" ? auth.name?.toLowerCase() : auth.name}` : "header.authorization";
4391
- if (occupied.has(location)) throw new Error("Authentication conflicts with a parameter or another security scheme.");
4392
- if (auth.type == "apiKey" && (!auth.name || !["header", "query"].includes(auth.in ?? ""))) throw new Error("API Key requires a name and location.");
4393
- occupied.add(location);
4394
- }
4395
- inputs.push(...authHandles(config.auth).map((handle) => ({
4396
- handle,
4397
- jsonSchema: { type: "string" },
4398
- nullable: false
4399
- })));
4400
- const responses = object$1(op.responses);
4401
- const schemas = [];
4402
- for (const [status, response] of Object.entries(responses)) if (/^2\d\d$|^2XX$/.test(status) || status == "default") {
4403
- const r = resolved(doc, response);
4404
- if (r.content == null) schemas.push({ type: "null" });
4405
- else {
4406
- jsonContent(doc, r);
4407
- for (const [mediaType, media] of Object.entries(object$1(r.content))) if (/^application\/(json|.+\+json)$/.test(mediaType)) schemas.push(schema$1(doc, object$1(media).schema ?? {}));
4408
- }
4409
- }
4410
- if (!schemas.length) throw new Error("A successful JSON response definition is required.");
4411
- return {
4412
- name,
4413
- executor: config,
4414
- inputs,
4415
- outputs: [
4416
- {
4417
- handle: "body",
4418
- jsonSchema: schemas.length == 1 ? schemas[0] : {
4419
- $schema: "https://json-schema.org/draft/2020-12/schema",
4420
- anyOf: schemas.map((s, index) => inlineSchema(s, index))
4421
- },
4422
- nullable: config.method == "head" || schemas.some((item) => matchesSchema(null, item))
4423
- },
4424
- {
4425
- handle: "statusCode",
4426
- jsonSchema: { type: "integer" },
4427
- nullable: false
4428
- },
4429
- {
4430
- handle: "headers",
4431
- jsonSchema: {
4432
- type: "object",
4433
- additionalProperties: { type: "string" }
4434
- },
4435
- nullable: false
4436
- }
4437
- ]
4438
- };
4439
- }
4440
- function inlineSchema(value, index) {
4441
- if (Array.isArray(value)) return value.map((item) => inlineSchema(item, index));
4442
- if (value == null || typeof value != "object") return value;
4443
- return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, key == "$ref" && typeof child == "string" && child.startsWith("#/") ? `#/anyOf/${index}/${child.slice(2)}` : inlineSchema(child, index)]));
4444
- }
4445
- /** The canvas validator and property panel share the same configuration contract. */
4446
- function openApiFieldIssues(task) {
4447
- if (task.executor.kind != "openapi") return [];
4448
- const config = task.executor;
4449
- let field = "sourceUrl";
4450
- try {
4451
- if (!config.sourceUrl.trim()) return [{
4452
- field,
4453
- message: "Enter an OpenAPI JSON document URL."
4454
- }];
4455
- httpUrl(config.sourceUrl);
4456
- field = "operation";
4457
- if (!config.path) return [{
4458
- field,
4459
- message: "Select an OpenAPI operation."
4460
- }];
4461
- field = "serverUrl";
4462
- httpUrl(config.serverUrl);
4463
- if (new URL(config.serverUrl).search) throw new Error("Server URLs must not contain a query string.");
4464
- field = "operation";
4465
- if (!dequal(config.document, snapshot(config.document, config.path, config.method))) return [{
4466
- field,
4467
- message: "Save only the selected operation and its dependencies."
4468
- }];
4469
- const expected = openApiTask(config, task.name);
4470
- if (!dequal(expected.inputs, task.inputs) || !dequal(expected.outputs, task.outputs)) return [{
4471
- field,
4472
- message: "OpenAPI ports must match the saved operation."
4473
- }];
4474
- return [];
4475
- } catch (error) {
4476
- return [{
4477
- field,
4478
- message: error.message
4479
- }];
4480
- }
4481
- }
4482
- function openApiIssues(task) {
4483
- return openApiFieldIssues(task).map((issue) => issue.message);
4484
- }
4485
- //#endregion
4486
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/util.js
4487
- function getEnumValues(entries) {
4488
- const numericValues = Object.values(entries).filter((v) => typeof v === "number");
4489
- return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
4490
- }
4491
- function joinValues(array, separator = "|") {
4492
- return array.map((val) => stringifyPrimitive(val)).join(separator);
4493
- }
4494
- function jsonStringifyReplacer(_, value) {
4495
- if (typeof value === "bigint") return value.toString();
4496
- return value;
4497
- }
4498
- var Cached = class {
4499
- constructor(getter) {
4500
- this._getter = getter;
4501
- this._value = void 0;
4502
- }
4503
- get value() {
4504
- const getter = this._getter;
4505
- if (getter !== void 0) {
4506
- this._value = getter();
4507
- this._getter = void 0;
4508
- }
4509
- return this._value;
4510
- }
4511
- };
4512
- function cached(getter) {
4513
- return new Cached(getter);
4514
- }
4515
- function nullish(input) {
4516
- return input === null || input === void 0;
4517
- }
4518
- function cleanRegex(source) {
4519
- const start = source.startsWith("^") ? 1 : 0;
4520
- const end = source.endsWith("$") ? source.length - 1 : source.length;
4521
- return source.slice(start, end);
4522
- }
4523
- function floatSafeRemainder(val, step) {
4524
- const ratio = val / step;
4525
- const roundedRatio = Math.round(ratio);
4526
- const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
4527
- if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
4528
- return ratio - roundedRatio;
4529
- }
4530
- var EVALUATING = /* @__PURE__*/ Symbol("evaluating");
4531
- function defineLazy(object, key, getter) {
4532
- let value = void 0;
4533
- Object.defineProperty(object, key, {
4534
- get() {
4535
- if (value === EVALUATING) return;
4536
- if (value === void 0) {
4537
- value = EVALUATING;
4538
- value = getter();
4539
- }
4540
- return value;
4541
- },
4542
- set(v) {
4543
- Object.defineProperty(object, key, { value: v });
4544
- },
4545
- configurable: true
4546
- });
4547
- }
4548
- function assignProp(target, prop, value) {
4549
- Object.defineProperty(target, prop, {
4550
- value,
4551
- writable: true,
4552
- enumerable: true,
4553
- configurable: true
4554
- });
4555
- }
4556
- /**
4557
- * Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
4558
- *
4559
- * Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
4560
- */
4561
- function rawShape(def) {
4562
- const desc = Object.getOwnPropertyDescriptor(def, "shape");
4563
- return desc?.get ? desc.get.raw : desc?.value;
4201
+ /**
4202
+ * Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
4203
+ *
4204
+ * Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
4205
+ */
4206
+ function rawShape(def) {
4207
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
4208
+ return desc?.get ? desc.get.raw : desc?.value;
4564
4209
  }
4565
4210
  function sourceShape(schema) {
4566
4211
  return rawShape(schema._zod.def) ?? schema._zod.def.shape;
@@ -9823,7 +9468,7 @@ var ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
9823
9468
  return required(ZodNonOptional, this, args[0]);
9824
9469
  }
9825
9470
  });
9826
- function object(shape, params) {
9471
+ function object$1(shape, params) {
9827
9472
  return new ZodObject({
9828
9473
  type: "object",
9829
9474
  shape: shape ?? {},
@@ -10064,101 +9709,648 @@ function nonoptional(innerType, params) {
10064
9709
  ...normalizeParams(params)
10065
9710
  });
10066
9711
  }
10067
- var ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => {
10068
- $ZodCatch.init(inst, def);
10069
- ZodType.init(inst, def);
10070
- inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
10071
- inst.unwrap = () => inst._zod.def.innerType;
10072
- inst.removeCatch = inst.unwrap;
10073
- });
10074
- function _catch(innerType, catchValue) {
10075
- return new ZodCatch({
10076
- type: "catch",
10077
- innerType,
10078
- catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
10079
- });
9712
+ var ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => {
9713
+ $ZodCatch.init(inst, def);
9714
+ ZodType.init(inst, def);
9715
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
9716
+ inst.unwrap = () => inst._zod.def.innerType;
9717
+ inst.removeCatch = inst.unwrap;
9718
+ });
9719
+ function _catch(innerType, catchValue) {
9720
+ return new ZodCatch({
9721
+ type: "catch",
9722
+ innerType,
9723
+ catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
9724
+ });
9725
+ }
9726
+ var ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
9727
+ $ZodPipe.init(inst, def);
9728
+ ZodType.init(inst, def);
9729
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
9730
+ inst.in = def.in;
9731
+ inst.out = def.out;
9732
+ });
9733
+ function pipe(in_, out) {
9734
+ return new ZodPipe({
9735
+ type: "pipe",
9736
+ in: in_,
9737
+ out
9738
+ });
9739
+ }
9740
+ var ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
9741
+ ZodPipe.init(inst, def);
9742
+ $ZodPreprocess.init(inst, def);
9743
+ });
9744
+ var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
9745
+ $ZodReadonly.init(inst, def);
9746
+ ZodType.init(inst, def);
9747
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
9748
+ inst.unwrap = () => inst._zod.def.innerType;
9749
+ });
9750
+ function readonly(innerType) {
9751
+ return new ZodReadonly({
9752
+ type: "readonly",
9753
+ innerType
9754
+ });
9755
+ }
9756
+ var ZodLazy = /*@__PURE__*/ $constructor("ZodLazy", (inst, def) => {
9757
+ $ZodLazy.init(inst, def);
9758
+ ZodType.init(inst, def);
9759
+ inst._zod.processJSONSchema = (ctx, json, params) => lazyProcessor(inst, ctx, json, params);
9760
+ inst.unwrap = () => inst._zod.def.getter();
9761
+ });
9762
+ function lazy(getter) {
9763
+ return new ZodLazy({
9764
+ type: "lazy",
9765
+ getter
9766
+ });
9767
+ }
9768
+ var ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
9769
+ $ZodCustom.init(inst, def);
9770
+ ZodType.init(inst, def);
9771
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
9772
+ });
9773
+ function refine(fn, _params = {}) {
9774
+ return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
9775
+ }
9776
+ function superRefine(fn, params) {
9777
+ return /* @__PURE__ */ _superRefine(fn, params);
9778
+ }
9779
+ function json$1(params) {
9780
+ const jsonSchema = lazy(() => {
9781
+ return union([
9782
+ string(params),
9783
+ number(),
9784
+ boolean(),
9785
+ _null(),
9786
+ array(jsonSchema),
9787
+ record$1(string(), jsonSchema)
9788
+ ]);
9789
+ });
9790
+ return jsonSchema;
9791
+ }
9792
+ function preprocess(fn, schema) {
9793
+ return new ZodPreprocess({
9794
+ type: "pipe",
9795
+ in: transform(fn),
9796
+ out: schema
9797
+ });
9798
+ }
9799
+ //#endregion
9800
+ //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/iso.js
9801
+ function datetime(params) {
9802
+ return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
9803
+ }
9804
+ //#endregion
9805
+ //#region src/http/common/headers.ts
9806
+ /** Header names are case-insensitive; never silently combine duplicate business fields. */
9807
+ function httpHeaderNameIssue(name, names) {
9808
+ if (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(name)) return "invalid";
9809
+ if (names.some((candidate) => candidate.toLowerCase() === name.toLowerCase())) return "duplicate";
9810
+ }
9811
+ //#endregion
9812
+ //#region src/http/common/httpRequest.ts
9813
+ var parameterSchema = strictObject({
9814
+ mode: _enum(["fields", "object"]).default("fields"),
9815
+ names: array(string()).default([])
9816
+ });
9817
+ var httpRequestConfigSchema = strictObject({
9818
+ method: _enum([
9819
+ "GET",
9820
+ "POST",
9821
+ "PUT",
9822
+ "PATCH",
9823
+ "DELETE",
9824
+ "HEAD",
9825
+ "OPTIONS"
9826
+ ]).default("GET"),
9827
+ query: parameterSchema.default({
9828
+ mode: "fields",
9829
+ names: []
9830
+ }),
9831
+ headers: parameterSchema.default({
9832
+ mode: "fields",
9833
+ names: []
9834
+ }),
9835
+ bodyFormat: _enum([
9836
+ "none",
9837
+ "json",
9838
+ "text",
9839
+ "form"
9840
+ ]).default("none"),
9841
+ authentication: union([
9842
+ strictObject({ type: literal("none") }),
9843
+ strictObject({ type: _enum(["bearer", "basic"]) }),
9844
+ strictObject({
9845
+ type: literal("apiKey"),
9846
+ name: string(),
9847
+ in: _enum(["header", "query"])
9848
+ })
9849
+ ]).default({ type: "none" }),
9850
+ responseFormat: _enum([
9851
+ "auto",
9852
+ "json",
9853
+ "text"
9854
+ ]).default("auto"),
9855
+ statusPolicy: _enum(["success", "all"]).default("success")
9856
+ });
9857
+ var httpRequestExecutorSchema = httpRequestConfigSchema.extend({ kind: literal("http-request") });
9858
+ var scalarSchema = { type: [
9859
+ "string",
9860
+ "number",
9861
+ "boolean"
9862
+ ] };
9863
+ var queryValueSchema = { anyOf: [scalarSchema, {
9864
+ type: "array",
9865
+ items: scalarSchema
9866
+ }] };
9867
+ var httpHeaderSchema = {
9868
+ type: "object",
9869
+ additionalProperties: { type: "string" }
9870
+ };
9871
+ var httpQuerySchema = {
9872
+ type: "object",
9873
+ additionalProperties: queryValueSchema
9874
+ };
9875
+ function httpAuthHandles(config) {
9876
+ return config.authentication.type == "none" ? [] : config.authentication.type == "basic" ? ["auth.username", "auth.password"] : ["auth.token"];
9877
+ }
9878
+ function retain(ports, old) {
9879
+ const remaining = new Map(ports.map((port) => [port.handle, port]));
9880
+ return [...old.flatMap((item) => {
9881
+ if ("group" in item) return [item];
9882
+ const next = remaining.get(item.handle);
9883
+ if (next == null) return [];
9884
+ remaining.delete(item.handle);
9885
+ return [dequal(item.jsonSchema, next.jsonSchema) && item.nullable == next.nullable ? item : next];
9886
+ }), ...remaining.values()];
9887
+ }
9888
+ function httpRequestTask(config = httpRequestConfigSchema.parse({}), name = "HTTP Request", previous) {
9889
+ const inputs = [{
9890
+ handle: "url",
9891
+ jsonSchema: { type: "string" },
9892
+ nullable: false
9893
+ }];
9894
+ for (const group of ["query", "headers"]) if (config[group].mode == "object") inputs.push({
9895
+ handle: group,
9896
+ jsonSchema: group == "query" ? httpQuerySchema : httpHeaderSchema,
9897
+ nullable: true
9898
+ });
9899
+ else for (const parameterName of config[group].names.filter((value) => value.trim())) inputs.push({
9900
+ handle: `${group == "query" ? "query" : "header"}.${parameterName}`,
9901
+ jsonSchema: group == "query" ? queryValueSchema : { type: "string" },
9902
+ nullable: true
9903
+ });
9904
+ if (config.bodyFormat != "none") inputs.push({
9905
+ handle: "body",
9906
+ jsonSchema: config.bodyFormat == "json" ? {} : config.bodyFormat == "text" ? { type: "string" } : httpQuerySchema,
9907
+ nullable: config.bodyFormat == "json"
9908
+ });
9909
+ inputs.push(...httpAuthHandles(config).map((handle) => ({
9910
+ handle,
9911
+ jsonSchema: { type: "string" },
9912
+ nullable: false
9913
+ })));
9914
+ const outputs = [
9915
+ {
9916
+ handle: "body",
9917
+ jsonSchema: config.responseFormat == "text" ? { type: "string" } : {},
9918
+ nullable: true
9919
+ },
9920
+ {
9921
+ handle: "statusCode",
9922
+ jsonSchema: { type: "integer" },
9923
+ nullable: false
9924
+ },
9925
+ {
9926
+ handle: "headers",
9927
+ jsonSchema: httpHeaderSchema,
9928
+ nullable: false
9929
+ }
9930
+ ];
9931
+ return {
9932
+ name,
9933
+ executor: {
9934
+ ...config,
9935
+ kind: "http-request"
9936
+ },
9937
+ inputs: retain(inputs, previous?.inputs ?? []),
9938
+ outputs: retain(outputs, previous?.outputs ?? [])
9939
+ };
9940
+ }
9941
+ function httpRequestIssues(config) {
9942
+ const issues = [];
9943
+ if (["GET", "HEAD"].includes(config.method) && config.bodyFormat != "none") issues.push({
9944
+ field: "bodyFormat",
9945
+ code: "bodyUnsupported",
9946
+ message: "GET and HEAD do not support a request body."
9947
+ });
9948
+ for (const group of ["query", "headers"]) {
9949
+ if (config[group].mode != "fields") continue;
9950
+ const seen = /* @__PURE__ */ new Set();
9951
+ for (const [index, name] of config[group].names.entries()) {
9952
+ const key = group == "headers" ? name.toLowerCase() : name;
9953
+ if (!name.trim() || seen.has(key)) issues.push({
9954
+ field: group,
9955
+ index,
9956
+ code: "parameterNamesInvalid",
9957
+ message: "Parameter names must be nonempty and unique."
9958
+ });
9959
+ seen.add(key);
9960
+ if (group == "headers" && httpHeaderNameIssue(name, []) === "invalid") issues.push({
9961
+ field: group,
9962
+ index,
9963
+ code: "headerNameInvalid",
9964
+ message: "Invalid HTTP header name."
9965
+ });
9966
+ }
9967
+ }
9968
+ const auth = config.authentication;
9969
+ if (auth.type != "none") {
9970
+ const group = auth.type == "apiKey" && auth.in == "query" ? "query" : "headers";
9971
+ const name = auth.type == "apiKey" ? auth.name : "authorization";
9972
+ if (!name.trim()) issues.push({
9973
+ field: "authentication",
9974
+ code: "keyNameRequired",
9975
+ message: "API Key requires a name."
9976
+ });
9977
+ if (group == "headers" && name.trim() && httpHeaderNameIssue(name, []) === "invalid") issues.push({
9978
+ field: "authentication",
9979
+ code: "headerNameInvalid",
9980
+ message: "Invalid authentication header name."
9981
+ });
9982
+ if (config[group].mode == "fields" && config[group].names.some((item) => group == "headers" ? item.toLowerCase() == name.toLowerCase() : item == name)) issues.push({
9983
+ field: "authentication",
9984
+ code: "authConflict",
9985
+ message: "Authentication conflicts with a request parameter."
9986
+ });
9987
+ }
9988
+ return issues;
9989
+ }
9990
+ function httpRequestUrl(value) {
9991
+ if (typeof value != "string" || !value.trim()) throw new Error("A URL is required.");
9992
+ const url = new URL(value);
9993
+ if (!["http:", "https:"].includes(url.protocol) || url.username || url.password) throw new Error("An HTTP(S) URL without credentials is required.");
9994
+ return url;
9995
+ }
9996
+ //#endregion
9997
+ //#region src/openapi/common/openapi.ts
9998
+ var methods = [
9999
+ "get",
10000
+ "put",
10001
+ "post",
10002
+ "delete",
10003
+ "options",
10004
+ "head",
10005
+ "patch",
10006
+ "trace"
10007
+ ];
10008
+ function object(value) {
10009
+ if (value == null || typeof value != "object" || Array.isArray(value)) throw new Error("Expected an OpenAPI object.");
10010
+ return value;
10011
+ }
10012
+ function httpUrl(value, base) {
10013
+ const url = new URL(value, base);
10014
+ if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash) throw new Error("An HTTP(S) URL without credentials or fragment is required.");
10015
+ return url.href;
10016
+ }
10017
+ function parseOpenApi(value) {
10018
+ const doc = object(value);
10019
+ if (typeof doc.openapi != "string" || !/^3\.[01]\.\d+$/.test(doc.openapi)) throw new Error("Only OpenAPI 3.0 and 3.1 JSON documents are supported.");
10020
+ object(doc.paths);
10021
+ return doc;
10022
+ }
10023
+ function pointer(doc, ref) {
10024
+ if (!ref.startsWith("#/")) throw new Error("External OpenAPI references are not supported.");
10025
+ let value = doc;
10026
+ for (const key of decodeURIComponent(ref.slice(2)).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"))) {
10027
+ const source = object(value);
10028
+ if (!Object.hasOwn(source, key)) throw new Error("An OpenAPI reference is missing.");
10029
+ value = source[key];
10030
+ }
10031
+ return value;
10032
+ }
10033
+ function resolved(doc, value) {
10034
+ let result = object(value);
10035
+ const seen = /* @__PURE__ */ new Set();
10036
+ while (typeof result.$ref == "string") {
10037
+ if (seen.has(result.$ref)) throw new Error("Circular non-schema reference is unsupported.");
10038
+ seen.add(result.$ref);
10039
+ const { $ref, ...siblings } = result;
10040
+ result = {
10041
+ ...object(pointer(doc, $ref)),
10042
+ ...siblings
10043
+ };
10044
+ }
10045
+ return result;
10046
+ }
10047
+ function operation(doc, path, method) {
10048
+ const item = resolved(doc, object(doc.paths)[path]);
10049
+ if (!methods.includes(method) || item[method] == null) throw new Error("The selected operation is no longer available.");
10050
+ return {
10051
+ item,
10052
+ op: object(item[method])
10053
+ };
10054
+ }
10055
+ function servers(value, path, method) {
10056
+ const doc = parseOpenApi(value);
10057
+ const { item, op } = operation(doc, path, method);
10058
+ const entries = op.servers ?? item.servers ?? doc.servers;
10059
+ if (!Array.isArray(entries) || entries.length == 0) return [{ url: "/" }];
10060
+ return entries.map(object);
10061
+ }
10062
+ function snapshot(documentValue, path, method) {
10063
+ const doc = parseOpenApi(documentValue);
10064
+ const { item, op } = operation(doc, path, method);
10065
+ const security = op.security ?? doc.security ?? [];
10066
+ const result = {
10067
+ openapi: doc.openapi,
10068
+ paths: { [path]: {
10069
+ [method]: op,
10070
+ ...item.parameters == null ? {} : { parameters: item.parameters }
10071
+ } },
10072
+ servers: servers(doc, path, method),
10073
+ security
10074
+ };
10075
+ const visited = /* @__PURE__ */ new Set();
10076
+ function copy(ref) {
10077
+ if (visited.has(ref)) return;
10078
+ visited.add(ref);
10079
+ const value = pointer(doc, ref);
10080
+ const keys = decodeURIComponent(ref.slice(2)).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"));
10081
+ if (keys.some((key) => [
10082
+ "__proto__",
10083
+ "constructor",
10084
+ "prototype"
10085
+ ].includes(key))) throw new Error("Unsupported reference key.");
10086
+ let target = result;
10087
+ for (const key of keys.slice(0, -1)) {
10088
+ if (!Object.hasOwn(target, key)) target[key] = {};
10089
+ target = object(target[key]);
10090
+ }
10091
+ target[keys.at(-1)] = structuredClone(value);
10092
+ visit(value);
10093
+ }
10094
+ function visit(value) {
10095
+ if (value == null || typeof value != "object") return;
10096
+ if (Array.isArray(value)) {
10097
+ value.forEach(visit);
10098
+ return;
10099
+ }
10100
+ if (typeof object(value).$ref == "string") copy(object(value).$ref);
10101
+ for (const [key, child] of Object.entries(value)) if (![
10102
+ "example",
10103
+ "examples",
10104
+ "default"
10105
+ ].includes(key)) visit(child);
10106
+ }
10107
+ visit(result);
10108
+ for (const entry of security) for (const name of Object.keys(object(entry))) copy(`#/components/securitySchemes/${name.replace(/~/g, "~0").replace(/\//g, "~1")}`);
10109
+ return structuredClone(result);
10110
+ }
10111
+ function schema$1(doc, schemaValue) {
10112
+ const defs = {};
10113
+ const ids = /* @__PURE__ */ new Map();
10114
+ function convert(value) {
10115
+ if (typeof value == "boolean") return value;
10116
+ const source = object(value);
10117
+ if (source.format == "binary" || source.$dynamicRef != null || source.$id != null) throw new Error("Binary and dynamically scoped schemas are unsupported.");
10118
+ const result = {};
10119
+ for (const [key, child] of Object.entries(source)) {
10120
+ if ([
10121
+ "nullable",
10122
+ "example",
10123
+ "xml",
10124
+ "discriminator",
10125
+ "__proto__"
10126
+ ].includes(key)) continue;
10127
+ if (key == "$ref") {
10128
+ if (typeof child != "string") throw new Error("Invalid schema reference.");
10129
+ let id = ids.get(child);
10130
+ if (id == null) {
10131
+ id = `s${ids.size}`;
10132
+ ids.set(child, id);
10133
+ defs[id] = convert(pointer(doc, child));
10134
+ }
10135
+ result.$ref = `#/$defs/${id}`;
10136
+ } else if ([
10137
+ "properties",
10138
+ "patternProperties",
10139
+ "$defs",
10140
+ "definitions",
10141
+ "dependentSchemas"
10142
+ ].includes(key)) result[key] = Object.fromEntries(Object.entries(object(child)).map(([name, childSchema]) => [name, convert(childSchema)]));
10143
+ else if ([
10144
+ "allOf",
10145
+ "anyOf",
10146
+ "oneOf",
10147
+ "prefixItems"
10148
+ ].includes(key)) {
10149
+ if (!Array.isArray(child)) throw new Error("Invalid schema composition.");
10150
+ result[key] = child.map(convert);
10151
+ } else if ([
10152
+ "items",
10153
+ "additionalProperties",
10154
+ "not",
10155
+ "if",
10156
+ "then",
10157
+ "else",
10158
+ "contains",
10159
+ "propertyNames",
10160
+ "unevaluatedProperties"
10161
+ ].includes(key)) result[key] = convert(child);
10162
+ else result[key] = child;
10163
+ }
10164
+ if (source.nullable === true) return { anyOf: [result, { type: "null" }] };
10165
+ for (const key of ["minimum", "maximum"]) {
10166
+ const exclusive = key == "minimum" ? "exclusiveMinimum" : "exclusiveMaximum";
10167
+ if (typeof result[exclusive] == "boolean") {
10168
+ if (result[exclusive] && typeof result[key] == "number") {
10169
+ result[exclusive] = result[key];
10170
+ delete result[key];
10171
+ } else delete result[exclusive];
10172
+ }
10173
+ }
10174
+ return result;
10175
+ }
10176
+ let converted = convert(schemaValue);
10177
+ if (typeof converted == "object" && converted != null && typeof object(converted).$ref == "string") {
10178
+ const id = String(object(converted).$ref).slice(8);
10179
+ const { $ref: _ref, ...siblings } = object(converted);
10180
+ converted = {
10181
+ ...object(defs[id]),
10182
+ ...siblings
10183
+ };
10184
+ }
10185
+ if (typeof converted == "boolean") return converted;
10186
+ return {
10187
+ $schema: "https://json-schema.org/draft/2020-12/schema",
10188
+ ...object(converted),
10189
+ ...Object.keys(defs).length ? { $defs: defs } : {}
10190
+ };
10191
+ }
10192
+ function parameters(config) {
10193
+ const doc = parseOpenApi(config.document);
10194
+ const { item, op } = operation(doc, config.path, config.method);
10195
+ const entries = /* @__PURE__ */ new Map();
10196
+ for (const value of [...item.parameters ?? [], ...op.parameters ?? []]) {
10197
+ const p = resolved(doc, value);
10198
+ if (![
10199
+ "path",
10200
+ "query",
10201
+ "header"
10202
+ ].includes(String(p.in)) || typeof p.name != "string" || p.content != null) throw new Error("Only schema-based path, query and header parameters are supported.");
10203
+ if (p.allowReserved === true) throw new Error("allowReserved parameters are unsupported.");
10204
+ if ((p.style ?? (p.in == "query" ? "form" : "simple")) != (p.in == "query" ? "form" : "simple")) throw new Error("Only form query and simple path/header serialization are supported.");
10205
+ entries.set(`${p.in}.${p.in == "header" ? p.name.toLowerCase() : p.name}`, p);
10206
+ }
10207
+ return [...entries.values()];
10080
10208
  }
10081
- var ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
10082
- $ZodPipe.init(inst, def);
10083
- ZodType.init(inst, def);
10084
- inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
10085
- inst.in = def.in;
10086
- inst.out = def.out;
10087
- });
10088
- function pipe(in_, out) {
10089
- return new ZodPipe({
10090
- type: "pipe",
10091
- in: in_,
10092
- out
10093
- });
10209
+ function jsonContent(doc, value) {
10210
+ const content = resolved(doc, value);
10211
+ const media = object(content.content);
10212
+ const mediaType = media["application/json"] != null ? "application/json" : Object.keys(media).find((key) => /^application\/.+\+json$/.test(key));
10213
+ const json = mediaType == null ? void 0 : media[mediaType];
10214
+ if (json == null) throw new Error("Only JSON request and response bodies are supported.");
10215
+ return {
10216
+ schema: schema$1(doc, object(json).schema ?? {}),
10217
+ required: content.required === true,
10218
+ mediaType
10219
+ };
10094
10220
  }
10095
- var ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
10096
- ZodPipe.init(inst, def);
10097
- $ZodPreprocess.init(inst, def);
10098
- });
10099
- var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
10100
- $ZodReadonly.init(inst, def);
10101
- ZodType.init(inst, def);
10102
- inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
10103
- inst.unwrap = () => inst._zod.def.innerType;
10104
- });
10105
- function readonly(innerType) {
10106
- return new ZodReadonly({
10107
- type: "readonly",
10108
- innerType
10109
- });
10221
+ function authHandles(auth) {
10222
+ return auth.flatMap((scheme) => scheme.type == "basic" ? [`auth.${scheme.id}.username`, `auth.${scheme.id}.password`] : [`auth.${scheme.id}.token`]);
10110
10223
  }
10111
- var ZodLazy = /*@__PURE__*/ $constructor("ZodLazy", (inst, def) => {
10112
- $ZodLazy.init(inst, def);
10113
- ZodType.init(inst, def);
10114
- inst._zod.processJSONSchema = (ctx, json, params) => lazyProcessor(inst, ctx, json, params);
10115
- inst.unwrap = () => inst._zod.def.getter();
10116
- });
10117
- function lazy(getter) {
10118
- return new ZodLazy({
10119
- type: "lazy",
10120
- getter
10224
+ function openApiTask(config, name = "OpenAPI") {
10225
+ if (!config.path) return {
10226
+ name,
10227
+ executor: config,
10228
+ inputs: [],
10229
+ outputs: []
10230
+ };
10231
+ const doc = parseOpenApi(config.document);
10232
+ const { op } = operation(doc, config.path, config.method);
10233
+ const params = parameters(config);
10234
+ const inputs = params.map((p) => {
10235
+ const jsonSchema = schema$1(doc, p.schema ?? {});
10236
+ const defaultValue = typeof jsonSchema == "boolean" ? void 0 : object(jsonSchema).default;
10237
+ return {
10238
+ handle: `${p.in}.${p.name}`,
10239
+ jsonSchema,
10240
+ nullable: p.required !== true && p.in != "path" || matchesSchema(null, jsonSchema),
10241
+ ...typeof p.description == "string" ? { description: p.description } : {},
10242
+ ...defaultValue === void 0 ? {} : { value: defaultValue }
10243
+ };
10121
10244
  });
10245
+ if (op.requestBody != null) {
10246
+ if (config.method == "get" || config.method == "head") throw new Error("GET and HEAD request bodies are unsupported.");
10247
+ const body = jsonContent(doc, op.requestBody);
10248
+ inputs.push({
10249
+ handle: "body",
10250
+ jsonSchema: body.schema,
10251
+ nullable: !body.required || matchesSchema(null, body.schema)
10252
+ });
10253
+ }
10254
+ const occupied = new Set(params.map((p) => `${p.in}.${p.in == "header" ? String(p.name).toLowerCase() : p.name}`));
10255
+ for (const auth of config.auth) {
10256
+ const location = auth.type == "apiKey" ? `${auth.in}.${auth.in == "header" ? auth.name?.toLowerCase() : auth.name}` : "header.authorization";
10257
+ if (occupied.has(location)) throw new Error("Authentication conflicts with a parameter or another security scheme.");
10258
+ if (auth.type == "apiKey" && (!auth.name || !["header", "query"].includes(auth.in ?? ""))) throw new Error("API Key requires a name and location.");
10259
+ occupied.add(location);
10260
+ }
10261
+ inputs.push(...authHandles(config.auth).map((handle) => ({
10262
+ handle,
10263
+ jsonSchema: { type: "string" },
10264
+ nullable: false
10265
+ })));
10266
+ const responses = object(op.responses);
10267
+ const schemas = [];
10268
+ for (const [status, response] of Object.entries(responses)) if (/^2\d\d$|^2XX$/.test(status) || status == "default") {
10269
+ const r = resolved(doc, response);
10270
+ if (r.content == null) schemas.push({ type: "null" });
10271
+ else {
10272
+ jsonContent(doc, r);
10273
+ for (const [mediaType, media] of Object.entries(object(r.content))) if (/^application\/(json|.+\+json)$/.test(mediaType)) schemas.push(schema$1(doc, object(media).schema ?? {}));
10274
+ }
10275
+ }
10276
+ if (!schemas.length) throw new Error("A successful JSON response definition is required.");
10277
+ return {
10278
+ name,
10279
+ executor: config,
10280
+ inputs,
10281
+ outputs: [
10282
+ {
10283
+ handle: "body",
10284
+ jsonSchema: schemas.length == 1 ? schemas[0] : {
10285
+ $schema: "https://json-schema.org/draft/2020-12/schema",
10286
+ anyOf: schemas.map((s, index) => inlineSchema(s, index))
10287
+ },
10288
+ nullable: config.method == "head" || schemas.some((item) => matchesSchema(null, item))
10289
+ },
10290
+ {
10291
+ handle: "statusCode",
10292
+ jsonSchema: { type: "integer" },
10293
+ nullable: false
10294
+ },
10295
+ {
10296
+ handle: "headers",
10297
+ jsonSchema: {
10298
+ type: "object",
10299
+ additionalProperties: { type: "string" }
10300
+ },
10301
+ nullable: false
10302
+ }
10303
+ ]
10304
+ };
10122
10305
  }
10123
- var ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
10124
- $ZodCustom.init(inst, def);
10125
- ZodType.init(inst, def);
10126
- inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
10127
- });
10128
- function refine(fn, _params = {}) {
10129
- return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
10130
- }
10131
- function superRefine(fn, params) {
10132
- return /* @__PURE__ */ _superRefine(fn, params);
10133
- }
10134
- function json$1(params) {
10135
- const jsonSchema = lazy(() => {
10136
- return union([
10137
- string(params),
10138
- number(),
10139
- boolean(),
10140
- _null(),
10141
- array(jsonSchema),
10142
- record$1(string(), jsonSchema)
10143
- ]);
10144
- });
10145
- return jsonSchema;
10306
+ function inlineSchema(value, index) {
10307
+ if (Array.isArray(value)) return value.map((item) => inlineSchema(item, index));
10308
+ if (value == null || typeof value != "object") return value;
10309
+ return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, key == "$ref" && typeof child == "string" && child.startsWith("#/") ? `#/anyOf/${index}/${child.slice(2)}` : inlineSchema(child, index)]));
10146
10310
  }
10147
- function preprocess(fn, schema) {
10148
- return new ZodPreprocess({
10149
- type: "pipe",
10150
- in: transform(fn),
10151
- out: schema
10152
- });
10311
+ /** The canvas validator and property panel share the same configuration contract. */
10312
+ function openApiFieldIssues(task) {
10313
+ if (task.executor.kind != "openapi") return [];
10314
+ const config = task.executor;
10315
+ let field = "sourceUrl";
10316
+ try {
10317
+ if (!config.sourceUrl.trim()) return [{
10318
+ field,
10319
+ message: "Enter an OpenAPI JSON document URL."
10320
+ }];
10321
+ httpUrl(config.sourceUrl);
10322
+ field = "operation";
10323
+ if (!config.path) return [{
10324
+ field,
10325
+ message: "Select an OpenAPI operation."
10326
+ }];
10327
+ field = "serverUrl";
10328
+ httpUrl(config.serverUrl);
10329
+ if (new URL(config.serverUrl).search) throw new Error("Server URLs must not contain a query string.");
10330
+ field = "operation";
10331
+ if (!dequal(config.document, snapshot(config.document, config.path, config.method))) return [{
10332
+ field,
10333
+ message: "Save only the selected operation and its dependencies."
10334
+ }];
10335
+ const expected = openApiTask(config, task.name);
10336
+ if (!dequal(expected.inputs, task.inputs) || !dequal(expected.outputs, task.outputs)) return [{
10337
+ field,
10338
+ message: "OpenAPI ports must match the saved operation."
10339
+ }];
10340
+ return [];
10341
+ } catch (error) {
10342
+ return [{
10343
+ field,
10344
+ message: error.message
10345
+ }];
10346
+ }
10153
10347
  }
10154
- //#endregion
10155
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/iso.js
10156
- function datetime(params) {
10157
- return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
10348
+ function openApiIssues(task) {
10349
+ return openApiFieldIssues(task).map((issue) => issue.message);
10158
10350
  }
10159
10351
  //#endregion
10160
10352
  //#region src/workflow/common/workflow.ts
10161
- var portSchema = object({
10353
+ var portSchema = object$1({
10162
10354
  handle: string().min(1),
10163
10355
  jsonSchema: json$1(),
10164
10356
  nullable: boolean(),
@@ -10168,7 +10360,7 @@ strictObject({
10168
10360
  inputs: array(portSchema).nullable(),
10169
10361
  outputs: array(portSchema).nullable()
10170
10362
  });
10171
- object({
10363
+ object$1({
10172
10364
  version: literal(1),
10173
10365
  flowId: string().min(1),
10174
10366
  name: string(),
@@ -10177,17 +10369,17 @@ object({
10177
10369
  inputs: array(portSchema),
10178
10370
  outputs: array(portSchema).nullable()
10179
10371
  });
10180
- object({
10372
+ object$1({
10181
10373
  version: literal(1),
10182
10374
  direction: _enum(["incoming", "outgoing"]),
10183
10375
  total: int().nonnegative(),
10184
10376
  nextOffset: int().nonnegative().optional(),
10185
- references: array(object({
10377
+ references: array(object$1({
10186
10378
  flowId: string(),
10187
10379
  name: string().nullable(),
10188
10380
  available: boolean(),
10189
10381
  draft: boolean(),
10190
- live: object({
10382
+ live: object$1({
10191
10383
  publicationId: string(),
10192
10384
  enabled: boolean()
10193
10385
  }).nullable()
@@ -10233,6 +10425,7 @@ var retryNodeTypes = [
10233
10425
  "code",
10234
10426
  "connector",
10235
10427
  "openapi",
10428
+ "http-request",
10236
10429
  "llm",
10237
10430
  "decision"
10238
10431
  ];
@@ -10251,11 +10444,11 @@ function supportsNodeRetry(node) {
10251
10444
  }
10252
10445
  //#endregion
10253
10446
  //#region src/flow/common/triggerScheduleSchema.ts
10254
- var triggerScheduleSchema = array(union([object({
10447
+ var triggerScheduleSchema = array(union([object$1({
10255
10448
  type: literal("cron"),
10256
10449
  expression: string(),
10257
10450
  timezone: string()
10258
- }), object({
10451
+ }), object$1({
10259
10452
  type: literal("every"),
10260
10453
  unit: _enum([
10261
10454
  "day",
@@ -10349,11 +10542,6 @@ function workflowOutputsPort(outputs) {
10349
10542
  nullable: false
10350
10543
  };
10351
10544
  }
10352
- /** Header names are case-insensitive; never silently combine duplicate business fields. */
10353
- function webhookHeaderNameIssue(name, names) {
10354
- if (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(name)) return "invalid";
10355
- if (names.some((candidate) => candidate.toLowerCase() === name.toLowerCase())) return "duplicate";
10356
- }
10357
10545
  /** Fixed inputs belong to the node, not author-supplied definitions. */
10358
10546
  var webhookResponseInputs = [
10359
10547
  {
@@ -10384,7 +10572,7 @@ function webhookHeaderValues(source) {
10384
10572
  const headers = {};
10385
10573
  const names = [];
10386
10574
  for (const [name, value] of Object.entries(source)) {
10387
- if (webhookHeaderNameIssue(name, names) != null) return;
10575
+ if (httpHeaderNameIssue(name, names) != null) return;
10388
10576
  if (typeof value !== "string" && typeof value !== "boolean" && !(typeof value === "number" && Number.isFinite(value))) return;
10389
10577
  const text = String(value);
10390
10578
  if ([...text].some((character) => character.charCodeAt(0) > 255 || /[\0\r\n]/.test(character))) return;
@@ -10401,7 +10589,7 @@ var text = string();
10401
10589
  var actionConnection = text.describe("Account selection: omit while unconfigured; use an account ID to select it; use \"\" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.");
10402
10590
  var json = json$1();
10403
10591
  var strings = array(text);
10404
- var port = object({
10592
+ var port = object$1({
10405
10593
  description: text.optional(),
10406
10594
  jsonSchema: json,
10407
10595
  nullable: boolean(),
@@ -10409,25 +10597,25 @@ var port = object({
10409
10597
  });
10410
10598
  var workflowInputDefs = array(port.strict());
10411
10599
  var input = port.extend({ value: json.optional() });
10412
- var group = object({
10600
+ var group = object$1({
10413
10601
  collapsed: boolean().optional(),
10414
10602
  group: text
10415
10603
  });
10416
- var source = union([object({
10604
+ var source = union([object$1({
10417
10605
  kind: literal("node"),
10418
10606
  nodeId: text,
10419
10607
  output: text,
10420
10608
  system: literal(true).optional(),
10421
10609
  field: text.optional()
10422
- }), object({
10610
+ }), object$1({
10423
10611
  kind: literal("binding"),
10424
10612
  bindingId: text
10425
10613
  })]);
10426
- var fixedInput = union([object({ kind: literal("unset") }), object({
10614
+ var fixedInput = union([object$1({ kind: literal("unset") }), object$1({
10427
10615
  kind: literal("value"),
10428
10616
  value: json
10429
10617
  })]);
10430
- var mapping = union([fixedInput, object({
10618
+ var mapping = union([fixedInput, object$1({
10431
10619
  kind: literal("sources"),
10432
10620
  sources: array(source)
10433
10621
  })]);
@@ -10477,20 +10665,20 @@ var workflowCapabilitySchema = strictObject({
10477
10665
  outputs: array(port).nullable()
10478
10666
  });
10479
10667
  var capability = union([connectorCapabilitySchema, workflowCapabilitySchema]);
10480
- var inline = object({
10668
+ var inline = object$1({
10481
10669
  ...ports,
10482
10670
  name: text,
10483
10671
  moduleId: text,
10484
10672
  capabilities: array(capability).optional()
10485
10673
  });
10486
- var agentValue = union([object({
10674
+ var agentValue = union([object$1({
10487
10675
  kind: literal("value"),
10488
10676
  value: json
10489
- }), object({
10677
+ }), object$1({
10490
10678
  kind: literal("input"),
10491
10679
  input: text
10492
10680
  })]);
10493
- var agentInput$1 = union([agentValue, object({ kind: literal("model") })]);
10681
+ var agentInput$1 = union([agentValue, object$1({ kind: literal("model") })]);
10494
10682
  var agentToolFields = {
10495
10683
  id: text,
10496
10684
  name: text,
@@ -10498,7 +10686,7 @@ var agentToolFields = {
10498
10686
  approval: boolean(),
10499
10687
  inputs: array(input.extend({ source: agentInput$1 }))
10500
10688
  };
10501
- var connectorAgentToolSchema = object({
10689
+ var connectorAgentToolSchema = object$1({
10502
10690
  ...agentToolFields,
10503
10691
  kind: literal("connector").optional(),
10504
10692
  action: text,
@@ -10531,24 +10719,24 @@ var decisionQuestion = discriminatedUnion("type", [
10531
10719
  criteria: strings
10532
10720
  })
10533
10721
  ]);
10534
- var managedFields = object({
10722
+ var managedFields = object$1({
10535
10723
  ...ports,
10536
10724
  name: text,
10537
10725
  executor: union([
10538
- object({
10726
+ object$1({
10539
10727
  kind: literal("connector"),
10540
10728
  action: text,
10541
10729
  connectionId: actionConnection.optional(),
10542
10730
  outputMode: literal("value").optional()
10543
10731
  }),
10544
- object({
10732
+ object$1({
10545
10733
  kind: literal("openapi"),
10546
10734
  sourceUrl: text,
10547
10735
  method: text,
10548
10736
  path: text,
10549
10737
  serverUrl: text,
10550
10738
  document: json,
10551
- auth: array(object({
10739
+ auth: array(object$1({
10552
10740
  id: text,
10553
10741
  type: _enum([
10554
10742
  "bearer",
@@ -10563,18 +10751,18 @@ var managedFields = object({
10563
10751
  kind: literal("decision"),
10564
10752
  questions: array(decisionQuestion)
10565
10753
  }),
10566
- object({
10754
+ object$1({
10567
10755
  kind: literal("llm"),
10568
10756
  mode: _enum(["chat", "json"])
10569
10757
  }),
10570
- object({
10758
+ object$1({
10571
10759
  kind: literal("agent"),
10572
10760
  code: boolean().optional(),
10573
10761
  model: text,
10574
10762
  prompt: text,
10575
10763
  maxRounds: number(),
10576
10764
  tools: array(union([workflowAgentToolSchema, connectorAgentToolSchema])),
10577
- notification: object({
10765
+ notification: object$1({
10578
10766
  action: text,
10579
10767
  connectionId: actionConnection.optional(),
10580
10768
  inputDefinitions: array(input),
@@ -10586,24 +10774,25 @@ var managedFields = object({
10586
10774
  kind: literal("workflow"),
10587
10775
  flowId: text,
10588
10776
  revisionId: text
10589
- })
10777
+ }),
10778
+ httpRequestExecutorSchema
10590
10779
  ])
10591
10780
  });
10592
10781
  var managed = managedFields.transform(limitDecisionTask);
10593
- var operand = union([object({
10782
+ var operand = union([object$1({
10594
10783
  kind: literal("value"),
10595
10784
  value: json.optional(),
10596
10785
  jsonSchema: json.optional()
10597
- }), object({
10786
+ }), object$1({
10598
10787
  kind: literal("source"),
10599
10788
  source
10600
10789
  })]);
10601
10790
  var condition = {
10602
10791
  matchMode: _enum(["first", "all"]),
10603
- cases: array(object({
10792
+ cases: array(object$1({
10604
10793
  description: text.optional(),
10605
10794
  output: text,
10606
- groups: array(object({ expressions: array(object({
10795
+ groups: array(object$1({ expressions: array(object$1({
10607
10796
  left: operand,
10608
10797
  operator: _enum([
10609
10798
  "!=",
@@ -10635,7 +10824,7 @@ var wait = {
10635
10824
  inputDefinitions: array(input),
10636
10825
  prompt: text
10637
10826
  };
10638
- var webhookOptions = object({
10827
+ var webhookOptions = object$1({
10639
10828
  allowedMethods: never().optional(),
10640
10829
  allowedOrigins: strings.optional(),
10641
10830
  noResponseBody: never().optional(),
@@ -10673,8 +10862,8 @@ var definition = {
10673
10862
  outputs: array(port).refine((definitions) => new Set(definitions.map((output) => output.handle)).size === definitions.length, "Duplicate Trigger output handle."),
10674
10863
  provider: text
10675
10864
  };
10676
- var endpoint = object({
10677
- body: object({
10865
+ var endpoint = object$1({
10866
+ body: object$1({
10678
10867
  allowArray: boolean(),
10679
10868
  allowEmpty: boolean(),
10680
10869
  formats: array(_enum([
@@ -10723,19 +10912,19 @@ var node = union([
10723
10912
  outputDefs: array(port.strict()),
10724
10913
  outputMappings: inputs
10725
10914
  }).omit({ inputs: true }),
10726
- object({
10915
+ object$1({
10727
10916
  ...base,
10728
10917
  inputs: record$1(text, never()),
10729
10918
  kind: literal("condition"),
10730
10919
  ...condition
10731
10920
  }),
10732
- object({
10921
+ object$1({
10733
10922
  ...base,
10734
10923
  inputs: unknown().transform(() => ({})).default({}),
10735
10924
  kind: literal("value"),
10736
10925
  values: array(input)
10737
10926
  }),
10738
- object({
10927
+ object$1({
10739
10928
  ...base,
10740
10929
  kind: literal("task"),
10741
10930
  task: union([inline, managed]),
@@ -10752,7 +10941,7 @@ var node = union([
10752
10941
  ...wait,
10753
10942
  autoContinue: waitAutoContinueDraftSchema.optional()
10754
10943
  }).omit({ timeoutMs: true }),
10755
- object({
10944
+ object$1({
10756
10945
  ...trigger,
10757
10946
  kind: literal("manual")
10758
10947
  }),
@@ -10766,33 +10955,33 @@ var node = union([
10766
10955
  kind: literal("error"),
10767
10956
  sourceFlowIds: sourceFlowIds.optional()
10768
10957
  }),
10769
- object({
10958
+ object$1({
10770
10959
  ...trigger,
10771
10960
  kind: literal("webhook"),
10772
10961
  ...webhook
10773
10962
  }),
10774
- object({
10963
+ object$1({
10775
10964
  ...trigger,
10776
10965
  kind: literal("cron"),
10777
10966
  cronTimes: triggerScheduleSchema
10778
10967
  }),
10779
- object({
10968
+ object$1({
10780
10969
  ...trigger,
10781
10970
  kind: literal("poll"),
10782
10971
  connectionId: text.min(1).optional(),
10783
10972
  config: record$1(text, fixedInput),
10784
- definition: object({
10973
+ definition: object$1({
10785
10974
  ...definition,
10786
10975
  type: literal("poll")
10787
10976
  }),
10788
10977
  pollTimes: triggerScheduleSchema
10789
10978
  }),
10790
- object({
10979
+ object$1({
10791
10980
  ...trigger,
10792
10981
  kind: literal("integration"),
10793
10982
  connectionId: text.min(1).optional(),
10794
10983
  config: record$1(text, fixedInput),
10795
- definition: object({
10984
+ definition: object$1({
10796
10985
  ...definition,
10797
10986
  type: literal("integration"),
10798
10987
  endpoint
@@ -10819,7 +11008,7 @@ var authoringDefinitionSchemas = {
10819
11008
  notification: true
10820
11009
  }).strict()
10821
11010
  };
10822
- var edge = object({
11011
+ var edge = object$1({
10823
11012
  source: text,
10824
11013
  target: text,
10825
11014
  sourceHandle: text.optional()
@@ -10828,24 +11017,24 @@ var at = {
10828
11017
  nodeId: text,
10829
11018
  target: never().optional()
10830
11019
  };
10831
- var graph = object({
11020
+ var graph = object$1({
10832
11021
  nodes: record$1(text, node),
10833
11022
  edges: array(edge).default([])
10834
11023
  });
10835
- var binding = object({
11024
+ var binding = object$1({
10836
11025
  kind: literal("variable"),
10837
11026
  target: text
10838
11027
  });
10839
- var module = object({
11028
+ var module = object$1({
10840
11029
  name: text,
10841
11030
  imports: strings,
10842
11031
  source: text
10843
11032
  });
10844
- var document = preprocess(normalizeDocument, object({
11033
+ var document = preprocess(normalizeDocument, object$1({
10845
11034
  bindings: record$1(text, binding),
10846
11035
  graph
10847
11036
  }));
10848
- object({
11037
+ object$1({
10849
11038
  modelVersion: union([
10850
11039
  literal(2),
10851
11040
  literal(4),
@@ -10916,21 +11105,21 @@ var shapes = {
10916
11105
  },
10917
11106
  "graph.node.delete": at,
10918
11107
  "graph.node.field.set": union([
10919
- object({
11108
+ object$1({
10920
11109
  ...at,
10921
11110
  kind: literal("graph.node.field.set"),
10922
11111
  field: literal("retry"),
10923
11112
  before: retryConfigurationSchema.optional(),
10924
11113
  value: retryConfigurationSchema.optional()
10925
11114
  }),
10926
- object({
11115
+ object$1({
10927
11116
  ...at,
10928
11117
  kind: literal("graph.node.field.set"),
10929
11118
  field: literal("connectionId"),
10930
11119
  before: text.min(1).optional(),
10931
11120
  value: text.min(1).optional()
10932
11121
  }),
10933
- object({
11122
+ object$1({
10934
11123
  ...at,
10935
11124
  kind: literal("graph.node.field.set"),
10936
11125
  field: _enum([
@@ -10942,14 +11131,14 @@ var shapes = {
10942
11131
  before: text.optional(),
10943
11132
  value: text.optional()
10944
11133
  }),
10945
- object({
11134
+ object$1({
10946
11135
  ...at,
10947
11136
  kind: literal("graph.node.field.set"),
10948
11137
  field: literal("maxExecutions"),
10949
11138
  before: number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),
10950
11139
  value: number().int().positive().max(Number.MAX_SAFE_INTEGER).optional()
10951
11140
  }),
10952
- object({
11141
+ object$1({
10953
11142
  ...at,
10954
11143
  kind: literal("graph.node.field.set"),
10955
11144
  field: literal("timeoutMs"),
@@ -10970,8 +11159,8 @@ var shapes = {
10970
11159
  },
10971
11160
  "graph.node.condition.set": {
10972
11161
  ...at,
10973
- before: object(condition),
10974
- value: object(condition)
11162
+ before: object$1(condition),
11163
+ value: object$1(condition)
10975
11164
  },
10976
11165
  "graph.node.values.set": {
10977
11166
  ...at,
@@ -10991,13 +11180,13 @@ var shapes = {
10991
11180
  },
10992
11181
  "graph.node.webhook.set": {
10993
11182
  ...at,
10994
- before: object(webhook),
10995
- value: object(webhook)
11183
+ before: object$1(webhook),
11184
+ value: object$1(webhook)
10996
11185
  },
10997
11186
  "graph.node.task.ports.set": {
10998
11187
  ...at,
10999
- before: object(ports),
11000
- value: object(ports)
11188
+ before: object$1(ports),
11189
+ value: object$1(ports)
11001
11190
  },
11002
11191
  "graph.node.task.name.set": {
11003
11192
  ...at,
@@ -11043,7 +11232,7 @@ var shapes = {
11043
11232
  value: union([inline, managed])
11044
11233
  }
11045
11234
  };
11046
- array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object({
11235
+ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object$1({
11047
11236
  kind: literal(kind),
11048
11237
  ...shape
11049
11238
  })])).values()])).min(1);
@@ -11704,6 +11893,7 @@ var currentEngineContract = "open-flow-engine/v8";
11704
11893
  var nodejsEngineContract = "open-flow-engine/v8/nodejs-compat-v1";
11705
11894
  var currentContract = {
11706
11895
  workflowTools: true,
11896
+ httpRequests: true,
11707
11897
  waitAutoContinue: true,
11708
11898
  webhookResponses: true,
11709
11899
  platformExports: /* @__PURE__ */ new Set(["engineContract", "identity"]),
@@ -11750,11 +11940,13 @@ function findEngineContract(contract) {
11750
11940
  if (contract == "open-flow-engine/v7" || contract == "open-flow-engine/v7/nodejs-compat-v1") return {
11751
11941
  ...contract.endsWith("/nodejs-compat-v1") ? nodejsContract : currentContract,
11752
11942
  workflowTools: false,
11943
+ httpRequests: false,
11753
11944
  platformSource: `export const engineContract = ${JSON.stringify(contract)}\nexport function identity(value) { return value }\n`
11754
11945
  };
11755
11946
  if (contract == "open-flow-engine/v6" || contract == "open-flow-engine/v6/nodejs-compat-v1") return {
11756
11947
  ...contract == "open-flow-engine/v6" ? currentContract : nodejsContract,
11757
11948
  workflowTools: false,
11949
+ httpRequests: false,
11758
11950
  waitAutoContinue: false,
11759
11951
  webhookResponses: false,
11760
11952
  platformSource: `export const engineContract = ${JSON.stringify(contract)}
@@ -12442,7 +12634,7 @@ function webhookResponseDiagnostics(graph, triggerId, path = `/document/graph/no
12442
12634
  if (headersSource == null) for (const [headers, location] of [[options.responseHeaders, `${path}/options/responseHeaders`], [headerOutputs, headersPath]]) {
12443
12635
  const names = [];
12444
12636
  for (const name of Object.keys(headers ?? {})) {
12445
- if (webhookHeaderNameIssue(name, names) != null) diagnostics.push(graphDiagnostic("trigger.webhook-response-header-name", "Use valid, unique HTTP header names.", location));
12637
+ if (httpHeaderNameIssue(name, names) != null) diagnostics.push(graphDiagnostic("trigger.webhook-response-header-name", "Use valid, unique HTTP header names.", location));
12446
12638
  names.push(name);
12447
12639
  }
12448
12640
  }
@@ -24746,12 +24938,47 @@ async function validateFlow(revision, engine) {
24746
24938
  message,
24747
24939
  path: `/document/graph/nodes/${nodeId}/task/executor`
24748
24940
  });
24749
- if (task.executor.kind == "openapi") {
24750
- const handles = authHandles(task.executor.auth);
24941
+ if (task.executor.kind == "http-request") {
24942
+ for (const issue of httpRequestIssues(task.executor)) checked.diagnostics.push({
24943
+ code: "http-request.config-invalid",
24944
+ column: 0,
24945
+ line: 1,
24946
+ message: issue.message,
24947
+ path: `/document/graph/nodes/${nodeId}/task/executor/${issue.field}`
24948
+ });
24949
+ if (node.inputs.url?.kind == "value") try {
24950
+ httpRequestUrl(node.inputs.url.value);
24951
+ } catch {
24952
+ checked.diagnostics.push({
24953
+ code: "http-request.url-invalid",
24954
+ column: 0,
24955
+ line: 1,
24956
+ message: "Enter an HTTP(S) URL without embedded credentials.",
24957
+ path: `/document/graph/nodes/${nodeId}/inputs/url`
24958
+ });
24959
+ }
24960
+ if (task.executor.bodyFormat != "none" && (node.inputs.body == null || node.inputs.body.kind == "unset")) checked.diagnostics.push({
24961
+ code: "http-request.body-required",
24962
+ column: 0,
24963
+ line: 1,
24964
+ message: "Set or bind the request body; JSON null is an explicit value.",
24965
+ path: `/document/graph/nodes/${nodeId}/inputs/body`
24966
+ });
24967
+ const expected = httpRequestTask(task.executor);
24968
+ if (!dequal(httpPortContracts(task.inputs), httpPortContracts(expected.inputs)) || !dequal(httpPortContracts(task.outputs), httpPortContracts(expected.outputs))) checked.diagnostics.push({
24969
+ code: "http-request.ports-invalid",
24970
+ column: 0,
24971
+ line: 1,
24972
+ message: "HTTP Request ports must match its configuration.",
24973
+ path: `/document/graph/nodes/${nodeId}/task`
24974
+ });
24975
+ }
24976
+ if (task.executor.kind == "openapi" || task.executor.kind == "http-request") {
24977
+ const handles = task.executor.kind == "openapi" ? authHandles(task.executor.auth) : httpAuthHandles(task.executor);
24751
24978
  for (const handle of handles) {
24752
24979
  const mapping = node.inputs[handle];
24753
24980
  if (mapping?.kind != "sources" || mapping.sources.length == 0) checked.diagnostics.push({
24754
- code: "openapi.auth-source",
24981
+ code: `${task.executor.kind}.auth-source`,
24755
24982
  column: 0,
24756
24983
  line: 1,
24757
24984
  message: "Authentication requires a deployment variable or upstream output.",
@@ -24837,9 +25064,15 @@ function runRevision(revision, triggerId) {
24837
25064
  }
24838
25065
  };
24839
25066
  }
25067
+ var httpPortContracts = (ports) => ports.filter((port) => "handle" in port).map(({ handle, jsonSchema, nullable }) => ({
25068
+ handle,
25069
+ jsonSchema,
25070
+ nullable
25071
+ })).toSorted((a, b) => a.handle.localeCompare(b.handle));
24840
25072
  async function prepareFlow(revision, engineContract, triggerId) {
24841
25073
  const engine = findEngineContract(engineContract);
24842
25074
  if (engine == null) return { kind: "engine-unsupported" };
25075
+ if (!engine.httpRequests && Object.values(revision.document.graph.nodes).some((node) => node.kind == "task" && "executor" in node.task && node.task.executor.kind == "http-request")) return { kind: "engine-unsupported" };
24843
25076
  if (!engine.workflowTools && Object.values(revision.document.graph.nodes).some((node) => nodeWorkflowReferences(node).some((ref) => ref.tool != null))) return { kind: "engine-unsupported" };
24844
25077
  if (triggerId != null) {
24845
25078
  const trigger = revision.document.graph.nodes[triggerId];