@oomol-lab/open-flow 0.1.0-beta.55 → 0.1.0-beta.56

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 (43) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/{createResourceDialog-4H5_lZ6s.js → createResourceDialog-Btjes3wD.js} +2 -2
  3. package/dist/browser/flow-authoring-edge.d.ts +3 -3
  4. package/dist/browser/flow-authoring-node.d.ts +26 -46
  5. package/dist/browser/flow-authoring.js +9155 -21002
  6. package/dist/browser/flow-change-schema.d.ts +1 -1
  7. package/dist/browser/flow-change.d.ts +14 -104
  8. package/dist/browser/flow-change.js +121 -296
  9. package/dist/browser/{flowChanges-ZzG-f9cg.js → flowChanges-BxutPLYO.js} +1494 -1830
  10. package/dist/browser/{flowWorkspace-ChpRaTMX.js → flowWorkspace-Dg4mqfa6.js} +118 -293
  11. package/dist/browser/{icons-CdAB9wyS.js → icons-p2A9zs8t.js} +126 -317
  12. package/dist/browser/lib-DrKav3HG.js +11403 -0
  13. package/dist/browser/preview.css +1 -1
  14. package/dist/browser/preview.js +9308 -9565
  15. package/dist/browser/ui-idTooltip.d.ts +11 -0
  16. package/dist/browser/ui.d.ts +5 -0
  17. package/dist/browser/ui.js +83 -1
  18. package/dist/browser/workbench.css +1 -1
  19. package/dist/browser/workbench.js +210 -411
  20. package/dist/browser/{workbenchSelect-BRZN4ish.js → workbenchSelect-LRp_Xjeq.js} +1 -1
  21. package/dist/common/control-api-conformance.js +212 -245
  22. package/dist/common/control-api.d.ts +6 -6
  23. package/dist/common/control-api.js +216 -250
  24. package/dist/common/control-requests.js +468 -1476
  25. package/dist/common/decision.js +6325 -6369
  26. package/dist/common/flow-agent.d.ts +1 -1
  27. package/dist/common/flow-connectionUsage.d.ts +1 -2
  28. package/dist/common/flow-encoding.d.ts +2 -4
  29. package/dist/common/flow-encoding.js +119 -180
  30. package/dist/common/flow-graph.d.ts +10 -10
  31. package/dist/common/flow-semantics.d.ts +4 -9
  32. package/dist/common/flow-semantics.js +9024 -9230
  33. package/dist/common/flowInspection.d.ts +3 -21
  34. package/dist/common/integration-trigger.js +8642 -8686
  35. package/dist/common/mcp.d.ts +0 -1
  36. package/dist/common/mcp.js +117 -140
  37. package/dist/common/openapi.js +6325 -6369
  38. package/dist/common/poll-trigger.js +8642 -8686
  39. package/dist/common/run-events.js +0 -1
  40. package/dist/common/scheduler.d.ts +3 -9
  41. package/dist/common/scheduler.js +116 -207
  42. package/dist/common/webhook-trigger.js +6325 -6369
  43. package/package.json +1 -1
@@ -139,28 +139,38 @@ var ApiError = class extends Error {
139
139
  };
140
140
  //#endregion
141
141
  //#region src/control/common/decoding.ts
142
- function invalidResponse() {
143
- throw new ApiError(502, "response.invalid", "The Control API returned an invalid response.");
142
+ var InvalidResponseError = class extends ApiError {
143
+ constructor(detail) {
144
+ super(502, "response.invalid", `The Control API returned an invalid response.${detail == null ? "" : ` ${detail}`}`);
145
+ this.detail = detail;
146
+ }
147
+ };
148
+ function invalidResponse(detail) {
149
+ throw new InvalidResponseError(detail);
144
150
  }
145
- function record$1(value) {
146
- if (value == null || typeof value != "object" || Array.isArray(value)) return invalidResponse();
151
+ function record$2(value) {
152
+ if (value == null || typeof value != "object" || Array.isArray(value)) return invalidResponse("Expected an object.");
147
153
  return value;
148
154
  }
149
155
  function string$1(value) {
150
- return typeof value == "string" && value.length > 0 ? value : invalidResponse();
156
+ return typeof value == "string" && value.length > 0 ? value : invalidResponse("Expected a non-empty string.");
151
157
  }
152
158
  function exact(value, keys) {
153
159
  const actual = Object.keys(value);
154
- if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) invalidResponse();
160
+ if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) {
161
+ const missing = keys.filter((key) => !Object.hasOwn(value, key));
162
+ const unexpected = actual.filter((key) => !keys.includes(key));
163
+ invalidResponse([missing.length > 0 ? `Missing fields: ${missing.join(", ")}.` : "", unexpected.length > 0 ? `Unexpected fields: ${unexpected.join(", ")}.` : ""].filter(Boolean).join(" "));
164
+ }
155
165
  }
156
166
  function integer$1(value) {
157
- return Number.isSafeInteger(value) ? value : invalidResponse();
167
+ return Number.isSafeInteger(value) ? value : invalidResponse("Expected a safe integer.");
158
168
  }
159
169
  function jsonValue(value) {
160
170
  if (value === null || typeof value == "boolean" || typeof value == "string") return value;
161
171
  if (typeof value == "number" && Number.isFinite(value)) return value;
162
172
  if (Array.isArray(value)) return value.map(jsonValue);
163
- const source = record$1(value);
173
+ const source = record$2(value);
164
174
  return Object.fromEntries(Object.entries(source).map(([key, item]) => [key, jsonValue(item)]));
165
175
  }
166
176
  function optionalString(value) {
@@ -2950,6 +2960,9 @@ function handlePipeResult(left, next, ctx) {
2950
2960
  issues: left.issues
2951
2961
  }, ctx);
2952
2962
  }
2963
+ var $ZodPreprocess = /*@__PURE__*/ $constructor("$ZodPreprocess", (inst, def) => {
2964
+ $ZodPipe.init(inst, def);
2965
+ });
2953
2966
  var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2954
2967
  $ZodType.init(inst, def);
2955
2968
  defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
@@ -5565,7 +5578,7 @@ var ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
5565
5578
  inst.keyType = def.keyType;
5566
5579
  inst.valueType = def.valueType;
5567
5580
  });
5568
- function record(keyType, valueType, params) {
5581
+ function record$1(keyType, valueType, params) {
5569
5582
  if (!valueType || !valueType._zod) return new ZodRecord({
5570
5583
  type: "record",
5571
5584
  keyType: string(),
@@ -5774,6 +5787,10 @@ function pipe(in_, out) {
5774
5787
  out
5775
5788
  });
5776
5789
  }
5790
+ var ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
5791
+ ZodPipe.init(inst, def);
5792
+ $ZodPreprocess.init(inst, def);
5793
+ });
5777
5794
  var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
5778
5795
  $ZodReadonly.init(inst, def);
5779
5796
  ZodType.init(inst, def);
@@ -5817,18 +5834,25 @@ function json$2(params) {
5817
5834
  boolean(),
5818
5835
  _null(),
5819
5836
  array(jsonSchema),
5820
- record(string(), jsonSchema)
5837
+ record$1(string(), jsonSchema)
5821
5838
  ]);
5822
5839
  });
5823
5840
  return jsonSchema;
5824
5841
  }
5842
+ function preprocess(fn, schema) {
5843
+ return new ZodPreprocess({
5844
+ type: "pipe",
5845
+ in: transform(fn),
5846
+ out: schema
5847
+ });
5848
+ }
5825
5849
  //#endregion
5826
5850
  //#region src/openapi/common/authBindings.ts
5827
5851
  /** Never allow credentials to enter a Revision as literal node inputs. */
5828
5852
  function assertOpenApiAuthBindings(document) {
5829
- for (const graph of [document.graph, ...Object.values(document.subflows).map((subflow) => subflow.graph)]) for (const node of Object.values(graph.nodes)) {
5830
- if (node.kind != "task" || node.taskId == null || document.tasks[node.taskId]?.executor.kind != "openapi") continue;
5831
- for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && (mapping.kind == "value" || mapping.kind == "sources" && mapping.sources.some((source) => source.kind == "flow"))) throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
5853
+ for (const node of Object.values(document.graph.nodes)) {
5854
+ if (node.kind != "task" || !("executor" in node.task) || node.task.executor.kind != "openapi") continue;
5855
+ for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
5832
5856
  }
5833
5857
  }
5834
5858
  //#endregion
@@ -8502,7 +8526,7 @@ var isObject = (x) => x !== null && typeof x === "object";
8502
8526
  var isPlainObject = (x) => isObject(x) && !isArray(x);
8503
8527
  var toPlainObject = (x) => isPlainObject(x) ? x : void 0;
8504
8528
  //#endregion
8505
- //#region src/manifest/common/schemaComparer.ts
8529
+ //#region src/flow/common/schemaComparer.ts
8506
8530
  function isStringLikeSchema(value) {
8507
8531
  return toPlainObject(value)?.type === "string";
8508
8532
  }
@@ -8748,24 +8772,15 @@ var group = object({
8748
8772
  collapsed: boolean().optional(),
8749
8773
  group: text
8750
8774
  });
8751
- var nodeSource = object({
8775
+ var source = union([object({
8752
8776
  kind: literal("node"),
8753
8777
  nodeId: text,
8754
8778
  output: text,
8755
8779
  field: text.optional()
8756
- });
8757
- var flowSource = object({
8758
- kind: literal("flow"),
8759
- input: text
8760
- });
8761
- var source = union([
8762
- nodeSource,
8763
- flowSource,
8764
- object({
8765
- kind: literal("binding"),
8766
- bindingId: text
8767
- })
8768
- ]);
8780
+ }), object({
8781
+ kind: literal("binding"),
8782
+ bindingId: text
8783
+ })]);
8769
8784
  var fixedInput = union([object({ kind: literal("unset") }), object({
8770
8785
  kind: literal("value"),
8771
8786
  value: json$1
@@ -8774,7 +8789,7 @@ var mapping = union([fixedInput, object({
8774
8789
  kind: literal("sources"),
8775
8790
  sources: array(source)
8776
8791
  })]);
8777
- var inputs = record(text, mapping);
8792
+ var inputs = record$1(text, mapping);
8778
8793
  var ports$1 = {
8779
8794
  inputs: array(union([input, group])),
8780
8795
  outputs: array(union([port$1, group]))
@@ -8902,9 +8917,11 @@ var managed = object({
8902
8917
  inputs: array(input.extend({ source: agentInput }))
8903
8918
  })),
8904
8919
  notification: object({
8905
- taskId: text,
8920
+ action: text,
8921
+ connectionId: text.optional(),
8922
+ inputDefinitions: array(input),
8906
8923
  messageHandle: text,
8907
- inputs: record(text, agentValue)
8924
+ inputs: record$1(text, agentValue)
8908
8925
  }).optional()
8909
8926
  })
8910
8927
  ])
@@ -8959,7 +8976,7 @@ var webhookOptions = object({
8959
8976
  allowedOrigins: strings.optional(),
8960
8977
  noResponseBody: never().optional(),
8961
8978
  responseData: text.optional(),
8962
- responseHeaders: record(text, text).optional(),
8979
+ responseHeaders: record$1(text, text).optional(),
8963
8980
  responseStatusCode: number().int().min(200).max(599).optional()
8964
8981
  });
8965
8982
  var webhook = {
@@ -9015,7 +9032,7 @@ var base = {
9015
9032
  var node = union([
9016
9033
  object({
9017
9034
  ...base,
9018
- inputs: record(text, never()),
9035
+ inputs: record$1(text, never()),
9019
9036
  kind: literal("condition"),
9020
9037
  ...condition
9021
9038
  }),
@@ -9025,21 +9042,10 @@ var node = union([
9025
9042
  kind: literal("value"),
9026
9043
  values: array(input)
9027
9044
  }),
9028
- object({
9029
- ...base,
9030
- kind: literal("subflow"),
9031
- subflowId: text
9032
- }),
9033
- object({
9034
- ...base,
9035
- kind: literal("task"),
9036
- task: inline,
9037
- additionalInputs: array(input).optional()
9038
- }),
9039
9045
  object({
9040
9046
  ...base,
9041
9047
  kind: literal("task"),
9042
- taskId: text,
9048
+ task: union([inline, managed]),
9043
9049
  additionalInputs: array(input).optional()
9044
9050
  }),
9045
9051
  strictObject({
@@ -9075,7 +9081,7 @@ var node = union([
9075
9081
  ...trigger,
9076
9082
  kind: literal("poll"),
9077
9083
  connectionId: text.min(1).optional(),
9078
- config: record(text, fixedInput),
9084
+ config: record$1(text, fixedInput),
9079
9085
  definition: object({
9080
9086
  ...definition,
9081
9087
  type: literal("poll")
@@ -9086,7 +9092,7 @@ var node = union([
9086
9092
  ...trigger,
9087
9093
  kind: literal("integration"),
9088
9094
  connectionId: text.min(1).optional(),
9089
- config: record(text, fixedInput),
9095
+ config: record$1(text, fixedInput),
9090
9096
  definition: object({
9091
9097
  ...definition,
9092
9098
  type: literal("integration"),
@@ -9094,10 +9100,6 @@ var node = union([
9094
9100
  })
9095
9101
  })
9096
9102
  ]);
9097
- var target = union([object({ kind: literal("flow") }), object({
9098
- kind: literal("subflow"),
9099
- id: text
9100
- })]);
9101
9103
  var edge = object({
9102
9104
  source: text,
9103
9105
  target: text,
@@ -9105,15 +9107,10 @@ var edge = object({
9105
9107
  });
9106
9108
  var at = {
9107
9109
  nodeId: text,
9108
- target
9110
+ target: never().optional()
9109
9111
  };
9110
- var subflow = object({
9111
- name: text,
9112
- inputs: array(input),
9113
- outputs: array(port$1.extend({ sources: array(union([nodeSource, flowSource])) }))
9114
- });
9115
9112
  var graph = object({
9116
- nodes: record(text, node),
9113
+ nodes: record$1(text, node),
9117
9114
  edges: array(edge).default([])
9118
9115
  });
9119
9116
  var binding = object({
@@ -9125,29 +9122,40 @@ var module = object({
9125
9122
  imports: strings,
9126
9123
  source: text
9127
9124
  });
9128
- var document = object({
9129
- bindings: record(text, binding),
9130
- graph,
9131
- subflows: record(text, subflow.extend({ graph })),
9132
- tasks: record(text, managed)
9133
- });
9125
+ var document = preprocess(rejectRetiredDefinitions, object({
9126
+ bindings: record$1(text, binding),
9127
+ graph
9128
+ }));
9134
9129
  var revision = object({
9135
9130
  modelVersion: union([
9136
9131
  literal(2),
9137
9132
  literal(4),
9138
- literal(5)
9133
+ literal(5),
9134
+ literal(6)
9139
9135
  ]),
9140
9136
  document,
9141
- modules: record(text, module)
9137
+ modules: record$1(text, module)
9142
9138
  });
9143
9139
  revision.extend({
9144
9140
  kind: literal("open-flow-flow-revision"),
9145
9141
  version: literal(1)
9146
9142
  });
9143
+ function rejectRetiredDefinitions(value) {
9144
+ const candidate = record(value);
9145
+ if (candidate.tasks !== void 0 && (candidate.tasks === null || typeof candidate.tasks !== "object" || Array.isArray(candidate.tasks) || Object.keys(candidate.tasks).length > 0)) throw new TypeError("Independent Task definitions are no longer supported.");
9146
+ if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
9147
+ const subflows = candidate.subflows;
9148
+ if (subflows !== void 0 && (subflows === null || typeof subflows !== "object" || Array.isArray(subflows) || Object.keys(subflows).length > 0)) throw new TypeError("Subflows are no longer supported.");
9149
+ if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
9150
+ return value;
9151
+ }
9152
+ function record(value) {
9153
+ return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
9154
+ }
9147
9155
  function decodeRevisionContent(value) {
9148
9156
  checkJsonDepth(value);
9149
9157
  const content = revision.parse(value);
9150
- checkErrorModelVersion(content);
9158
+ checkModelVersion(content);
9151
9159
  assertOpenApiAuthBindings(content.document);
9152
9160
  return content;
9153
9161
  }
@@ -9168,12 +9176,12 @@ var shapes = {
9168
9176
  value: text
9169
9177
  },
9170
9178
  "graph.edge.connect": {
9171
- target,
9172
- edge
9179
+ edge,
9180
+ target: never().optional()
9173
9181
  },
9174
9182
  "graph.edge.disconnect": {
9175
- target,
9176
- edge
9183
+ edge,
9184
+ target: never().optional()
9177
9185
  },
9178
9186
  "graph.node.create": {
9179
9187
  ...at,
@@ -9237,13 +9245,11 @@ var shapes = {
9237
9245
  },
9238
9246
  "graph.node.resolution.set": {
9239
9247
  ...at,
9240
- target: object({ kind: literal("flow") }),
9241
9248
  before: object(wait),
9242
9249
  value: object(wait)
9243
9250
  },
9244
9251
  "graph.node.webhook.set": {
9245
9252
  ...at,
9246
- target: object({ kind: literal("flow") }),
9247
9253
  before: object(webhook),
9248
9254
  value: object(webhook)
9249
9255
  },
@@ -9290,58 +9296,19 @@ var shapes = {
9290
9296
  imports: strings,
9291
9297
  source: text
9292
9298
  },
9293
- "subflow.create": {
9294
- subflowId: text,
9295
- subflow: subflow.extend({ graph })
9296
- },
9297
- "subflow.definition.set": {
9298
- subflowId: text,
9299
- before: subflow,
9300
- definition: subflow
9301
- },
9302
- "subflow.delete": { subflowId: text },
9303
- "task.create": {
9304
- taskId: text,
9305
- task: managed
9306
- },
9307
- "task.delete": { taskId: text },
9308
- "task.connector.connection.set": {
9309
- taskId: text,
9310
- before: text.optional(),
9311
- value: text.optional()
9312
- },
9313
- "task.decision.set": {
9314
- taskId: text,
9315
- before: managed,
9316
- value: managed
9317
- },
9318
- "task.openapi.set": {
9319
- taskId: text,
9320
- before: managed,
9321
- value: managed
9322
- },
9323
- "task.agent.set": {
9324
- taskId: text,
9325
- before: managed,
9326
- value: managed
9327
- },
9328
- "task.llm.mode.set": {
9329
- taskId: text,
9330
- before: _enum(["chat", "json"]),
9331
- value: _enum(["chat", "json"])
9332
- },
9333
- "task.name.set": {
9334
- taskId: text,
9335
- before: text,
9336
- value: text
9299
+ "graph.node.task.set": {
9300
+ ...at,
9301
+ before: union([inline, managed]),
9302
+ value: union([inline, managed])
9337
9303
  }
9338
9304
  };
9339
9305
  array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object({
9340
9306
  kind: literal(kind),
9341
9307
  ...shape
9342
9308
  })])).values()])).min(1);
9343
- function checkErrorModelVersion(content) {
9344
- if (content.modelVersion < 5 && [content.document.graph, ...Object.values(content.document.subflows).map((item) => item.graph)].some((item) => Object.values(item.nodes).some((itemNode) => itemNode.kind == "error"))) throw new TypeError("Error workflows require Flow model version 5.");
9309
+ function checkModelVersion(content) {
9310
+ if (content.modelVersion < 6 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task)) throw new TypeError("Node-owned managed Tasks require Flow model version 6.");
9311
+ if (content.modelVersion < 5 && Object.values(content.document.graph.nodes).some((itemNode) => itemNode.kind == "error")) throw new TypeError("Error workflows require Flow model version 5.");
9345
9312
  }
9346
9313
  //#endregion
9347
9314
  //#region src/flow/common/condition.ts
@@ -9432,7 +9399,7 @@ async function providerAccessBindingId(teamId, identity) {
9432
9399
  //#endregion
9433
9400
  //#region src/control/common/connectorDecoders.ts
9434
9401
  function accessPermissions(value) {
9435
- const source = record$1(value);
9402
+ const source = record$2(value);
9436
9403
  exact(source, [
9437
9404
  "actionIds",
9438
9405
  "allActions",
@@ -9441,10 +9408,19 @@ function accessPermissions(value) {
9441
9408
  "configured",
9442
9409
  "proxy"
9443
9410
  ]);
9444
- if (!Array.isArray(source.triggerIds) || typeof source.allTriggers != "boolean" || !Array.isArray(source.actionIds) || typeof source.allActions != "boolean" || typeof source.configured != "boolean" || typeof source.proxy != "boolean") return invalidResponse();
9411
+ if (!Array.isArray(source.actionIds)) return invalidResponse("permissions.actionIds: expected an array.");
9412
+ if (!Array.isArray(source.triggerIds)) return invalidResponse("permissions.triggerIds: expected an array.");
9413
+ if (typeof source.allActions != "boolean") return invalidResponse("permissions.allActions: expected a boolean.");
9414
+ if (typeof source.allTriggers != "boolean") return invalidResponse("permissions.allTriggers: expected a boolean.");
9415
+ if (typeof source.configured != "boolean") return invalidResponse("permissions.configured: expected a boolean.");
9416
+ if (typeof source.proxy != "boolean") return invalidResponse("permissions.proxy: expected a boolean.");
9445
9417
  const actionIds = source.actionIds.map(string$1);
9446
9418
  const triggerIds = source.triggerIds.map(string$1);
9447
- if (new Set(actionIds).size != actionIds.length || source.allActions && actionIds.length != 0 || new Set(triggerIds).size != triggerIds.length || source.allTriggers && triggerIds.length != 0 || source.proxy && (!source.allActions || !source.allTriggers || source.configured)) return invalidResponse();
9419
+ if (new Set(actionIds).size != actionIds.length) return invalidResponse("permissions.actionIds: duplicate IDs.");
9420
+ if (source.allActions && actionIds.length != 0) return invalidResponse("permissions.actionIds: must be empty when allActions is true.");
9421
+ if (new Set(triggerIds).size != triggerIds.length) return invalidResponse("permissions.triggerIds: duplicate IDs.");
9422
+ if (source.allTriggers && triggerIds.length != 0) return invalidResponse("permissions.triggerIds: must be empty when allTriggers is true.");
9423
+ if (source.proxy && (!source.allActions || !source.allTriggers || source.configured)) return invalidResponse("permissions.proxy: requires allActions=true, allTriggers=true and configured=false.");
9448
9424
  return {
9449
9425
  actionIds,
9450
9426
  triggerIds,
@@ -9455,7 +9431,7 @@ function accessPermissions(value) {
9455
9431
  };
9456
9432
  }
9457
9433
  function accessBinding(value, candidate) {
9458
- const source = record$1(value);
9434
+ const source = record$2(value);
9459
9435
  const policyRevision = source.policyRevision;
9460
9436
  const status = source.status;
9461
9437
  const isDefault = source.isDefault;
@@ -9474,15 +9450,15 @@ function accessBinding(value, candidate) {
9474
9450
  "providerId",
9475
9451
  ...candidate ? [] : ["status"]
9476
9452
  ]);
9477
- if (policyRevision != null && typeof policyRevision != "string") return invalidResponse();
9478
- if (candidate && isDefault !== void 0 && typeof isDefault != "boolean") return invalidResponse();
9479
- if (permissionGroupName !== void 0 && permissionGroupName !== null && typeof permissionGroupName != "string") return invalidResponse();
9453
+ if (policyRevision != null && typeof policyRevision != "string") return invalidResponse("policyRevision: expected a string.");
9454
+ if (candidate && isDefault !== void 0 && typeof isDefault != "boolean") return invalidResponse("isDefault: expected a boolean.");
9455
+ if (permissionGroupName !== void 0 && permissionGroupName !== null && typeof permissionGroupName != "string") return invalidResponse("permissionGroupName: expected a string or null.");
9480
9456
  if (!candidate && status != "active" && status != "forbidden" && status != "invalid" && status != "missing") return invalidResponse();
9481
9457
  let bindingSource;
9482
9458
  try {
9483
9459
  bindingSource = parseProviderAccessSource(source.source);
9484
9460
  } catch {
9485
- return invalidResponse();
9461
+ return invalidResponse("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.");
9486
9462
  }
9487
9463
  return {
9488
9464
  accessBindingId: string$1(source.accessBindingId),
@@ -9498,11 +9474,11 @@ function accessBinding(value, candidate) {
9498
9474
  };
9499
9475
  }
9500
9476
  function accessMode(value) {
9501
- if (value != "implicit" && value != "selectable") return invalidResponse();
9477
+ if (value != "implicit" && value != "selectable") return invalidResponse("mode: expected implicit or selectable.");
9502
9478
  return value;
9503
9479
  }
9504
9480
  function connectorAccess(value) {
9505
- const source = record$1(value);
9481
+ const source = record$2(value);
9506
9482
  exact(source, [
9507
9483
  "accessRevision",
9508
9484
  "bindings",
@@ -9549,7 +9525,7 @@ function connectorAccess(value) {
9549
9525
  function accessGrants(value) {
9550
9526
  if (!Array.isArray(value)) return invalidResponse();
9551
9527
  const bindings = value.map((candidate) => {
9552
- const entry = record$1(candidate);
9528
+ const entry = record$2(candidate);
9553
9529
  exact(entry, [
9554
9530
  "accessBindingId",
9555
9531
  "connectionId",
@@ -9578,7 +9554,7 @@ function accessGrants(value) {
9578
9554
  return bindings;
9579
9555
  }
9580
9556
  function connectorAccessSnapshot(value) {
9581
- const source = record$1(value);
9557
+ const source = record$2(value);
9582
9558
  exact(source, [
9583
9559
  "mode",
9584
9560
  "sharedAccessDigest",
@@ -9600,17 +9576,19 @@ function connectorAccessSnapshot(value) {
9600
9576
  };
9601
9577
  }
9602
9578
  function connectorAccessCandidates(value, providerId) {
9603
- const source = record$1(value);
9579
+ const source = record$2(value);
9604
9580
  exact(source, [
9605
9581
  "candidates",
9606
9582
  "mode",
9607
9583
  "providerId",
9608
9584
  "version"
9609
9585
  ]);
9610
- if (source.version != 1 || string$1(source.providerId) != providerId || !Array.isArray(source.candidates)) return invalidResponse();
9586
+ if (source.version != 1) return invalidResponse("version: expected 1.");
9587
+ if (string$1(source.providerId) != providerId) return invalidResponse("providerId: does not match the requested provider.");
9588
+ if (!Array.isArray(source.candidates)) return invalidResponse("candidates: expected an array.");
9611
9589
  const candidates = source.candidates.map((candidate) => accessBinding(candidate, true));
9612
- if (candidates.some((candidate) => candidate.providerId != providerId)) return invalidResponse();
9613
- if (new Set(candidates.map((candidate) => candidate.accessBindingId)).size != candidates.length) return invalidResponse();
9590
+ if (candidates.some((candidate) => candidate.providerId != providerId)) return invalidResponse("candidates[].providerId: does not match the requested provider.");
9591
+ if (new Set(candidates.map((candidate) => candidate.accessBindingId)).size != candidates.length) return invalidResponse("candidates[].accessBindingId: duplicate IDs.");
9614
9592
  return {
9615
9593
  candidates,
9616
9594
  mode: accessMode(source.mode),
@@ -9619,17 +9597,18 @@ function connectorAccessCandidates(value, providerId) {
9619
9597
  };
9620
9598
  }
9621
9599
  function connectorAccessCandidatesBatch(value, providerIds) {
9622
- const source = record$1(value);
9600
+ const source = record$2(value);
9623
9601
  exact(source, ["results", "version"]);
9624
- if (source.version != 1 || !Array.isArray(source.results)) return invalidResponse();
9602
+ if (source.version != 1) return invalidResponse("version: expected 1.");
9603
+ if (!Array.isArray(source.results)) return invalidResponse("results: expected an array.");
9625
9604
  const remaining = new Set(providerIds);
9626
9605
  const results = source.results.map((entry) => {
9627
- const item = record$1(entry);
9606
+ const item = record$2(entry);
9628
9607
  const providerId = string$1(item.providerId);
9629
- if (!remaining.delete(providerId)) return invalidResponse();
9608
+ if (!remaining.delete(providerId)) return invalidResponse("results[].providerId: duplicate or unrequested provider.");
9630
9609
  if (!Object.hasOwn(item, "error")) return connectorAccessCandidates(item, providerId);
9631
9610
  exact(item, ["providerId", "error"]);
9632
- const error = record$1(item.error);
9611
+ const error = record$2(item.error);
9633
9612
  exact(error, ["code", "message"]);
9634
9613
  return {
9635
9614
  providerId,
@@ -9639,14 +9618,14 @@ function connectorAccessCandidatesBatch(value, providerIds) {
9639
9618
  }
9640
9619
  };
9641
9620
  });
9642
- if (remaining.size != 0) return invalidResponse();
9621
+ if (remaining.size != 0) return invalidResponse("results: missing requested providers.");
9643
9622
  return {
9644
9623
  results,
9645
9624
  version: 1
9646
9625
  };
9647
9626
  }
9648
9627
  function connection(value) {
9649
- const source = record$1(value);
9628
+ const source = record$2(value);
9650
9629
  exact(source, [
9651
9630
  ...Object.hasOwn(source, "providerAccountId") ? ["providerAccountId"] : [],
9652
9631
  ...Object.hasOwn(source, "alias") ? ["alias"] : [],
@@ -9673,7 +9652,7 @@ function connection(value) {
9673
9652
  };
9674
9653
  }
9675
9654
  function port(value, input = false) {
9676
- const source = record$1(value);
9655
+ const source = record$2(value);
9677
9656
  const description = source.description;
9678
9657
  const hasValue = input && Object.hasOwn(source, "value");
9679
9658
  exact(source, [
@@ -9695,10 +9674,10 @@ function inputPort(value) {
9695
9674
  return port(value, true);
9696
9675
  }
9697
9676
  function ports(value, decode) {
9698
- return Object.fromEntries(Object.entries(record$1(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9677
+ return Object.fromEntries(Object.entries(record$2(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9699
9678
  }
9700
9679
  function connectorActionMetadata(value) {
9701
- const source = record$1(value);
9680
+ const source = record$2(value);
9702
9681
  const homepageUrl = source.homepageUrl;
9703
9682
  const icon = source.icon;
9704
9683
  exact(source, [
@@ -9737,7 +9716,7 @@ function connectorActionMetadata(value) {
9737
9716
  };
9738
9717
  }
9739
9718
  function connectorAction(value) {
9740
- const { defaultConnection, ...metadata } = record$1(value);
9719
+ const { defaultConnection, ...metadata } = record$2(value);
9741
9720
  const action = connectorActionMetadata(metadata);
9742
9721
  if (defaultConnection == null) return action;
9743
9722
  const preferred = connection(defaultConnection);
@@ -9748,7 +9727,7 @@ function connectorAction(value) {
9748
9727
  };
9749
9728
  }
9750
9729
  function connectorProvider(value) {
9751
- const source = record$1(value);
9730
+ const source = record$2(value);
9752
9731
  const homepageUrl = source.homepageUrl;
9753
9732
  const icon = source.icon;
9754
9733
  if (source.noSetup !== void 0 && typeof source.noSetup != "boolean") return invalidResponse();
@@ -9896,12 +9875,11 @@ function triggerOutputPorts(trigger) {
9896
9875
  }
9897
9876
  //#endregion
9898
9877
  //#region src/flow/common/graph.ts
9899
- function nodeInputPorts(document, node) {
9878
+ function nodeInputPorts(node) {
9900
9879
  switch (node.kind) {
9901
9880
  case "condition": return conditionInputPorts(node);
9902
9881
  case "value": return {};
9903
- case "subflow": return portsByHandle(document.subflows[node.subflowId]?.inputs ?? []);
9904
- case "task": return portsByHandle([...node.task != null ? node.task.inputs : document.tasks[node.taskId]?.inputs ?? [], ...node.additionalInputs ?? []]);
9882
+ case "task": return portsByHandle([...node.task.inputs, ...node.additionalInputs ?? []]);
9905
9883
  case "approval":
9906
9884
  case "wait": return portsByHandle(node.inputDefinitions);
9907
9885
  case "cron":
@@ -9947,12 +9925,11 @@ function resolutionOutputPorts(node) {
9947
9925
  })]))
9948
9926
  };
9949
9927
  }
9950
- function nodeOutputPorts(document, node) {
9928
+ function nodeOutputPorts(node) {
9951
9929
  switch (node.kind) {
9952
9930
  case "condition": return {};
9953
9931
  case "value": return portsByHandle(node.values);
9954
- case "subflow": return portsByHandle(document.subflows[node.subflowId]?.outputs ?? []);
9955
- case "task": return portsByHandle(node.task != null ? node.task.outputs : document.tasks[node.taskId]?.outputs ?? []);
9932
+ case "task": return portsByHandle(node.task.outputs);
9956
9933
  case "approval":
9957
9934
  case "wait": return resolutionOutputPorts(node);
9958
9935
  case "cron":
@@ -10003,15 +9980,6 @@ function flowInspection(inspected, live, full = false) {
10003
9980
  draft: {
10004
9981
  revisionId: draft.revisionId,
10005
9982
  graph: inspectGraph(document, document.graph),
10006
- subflows: Object.fromEntries(Object.entries(document.subflows).map(([id, subflow]) => [id, {
10007
- name: subflow.name,
10008
- inputs: inspectPorts(subflow.inputs),
10009
- outputs: subflow.outputs.map((port) => ({
10010
- handle: port.handle,
10011
- sources: port.sources
10012
- })),
10013
- graph: inspectGraph(document, subflow.graph)
10014
- }])),
10015
9983
  bindings: document.bindings,
10016
9984
  modules: Object.fromEntries(Object.entries(modules).map(([id, module]) => [id, {
10017
9985
  name: module.name,
@@ -10041,18 +10009,17 @@ function inspectGraph(document, graph) {
10041
10009
  edges: graph.edges
10042
10010
  };
10043
10011
  }
10044
- function inspectNode(document, node) {
10045
- const inputs = nodeInputPorts(document, node);
10012
+ function inspectNode(_document, node) {
10013
+ const inputs = nodeInputPorts(node);
10046
10014
  const defaults = Object.fromEntries(Object.entries(inputs).flatMap(([handle, port]) => Object.hasOwn(port, "value") && !("inputs" in node && Object.hasOwn(node.inputs, handle)) ? [[handle, port.value]] : []));
10047
10015
  const ports = {
10048
10016
  inputHandles: Object.keys(inputs),
10049
- outputHandles: Object.keys(nodeOutputPorts(document, node)),
10017
+ outputHandles: Object.keys(nodeOutputPorts(node)),
10050
10018
  ...Object.keys(defaults).length == 0 ? {} : { inputDefaults: defaults }
10051
10019
  };
10052
10020
  switch (node.kind) {
10053
10021
  case "task": {
10054
- const { task: inline, additionalInputs: _additional, ...instance } = node;
10055
- const task = inline ?? document.tasks[node.taskId];
10022
+ const { task, additionalInputs: _additional, ...instance } = node;
10056
10023
  return {
10057
10024
  ...instance,
10058
10025
  ...ports,
@@ -10112,8 +10079,7 @@ function inspectNode(document, node) {
10112
10079
  };
10113
10080
  case "error":
10114
10081
  case "manual":
10115
- case "cron":
10116
- case "subflow": return {
10082
+ case "cron": return {
10117
10083
  ...node,
10118
10084
  ...ports
10119
10085
  };
@@ -10144,7 +10110,7 @@ function nodeDetails(content, nodeId, node) {
10144
10110
  node,
10145
10111
  nodeId
10146
10112
  };
10147
- if (node.task != null) {
10113
+ if ("moduleId" in node.task) {
10148
10114
  const module = content.modules[node.task.moduleId];
10149
10115
  return {
10150
10116
  node,
@@ -10152,7 +10118,7 @@ function nodeDetails(content, nodeId, node) {
10152
10118
  ...module == null ? {} : { module }
10153
10119
  };
10154
10120
  }
10155
- const task = content.document.tasks[node.taskId];
10121
+ const task = node.task;
10156
10122
  return {
10157
10123
  node,
10158
10124
  nodeId,
@@ -10225,7 +10191,7 @@ var configInputsSchema = array(union([strictObject({
10225
10191
  //#endregion
10226
10192
  //#region src/control/common/triggerDecoders.ts
10227
10193
  function triggerKeySummary(value) {
10228
- const source = record$1(value);
10194
+ const source = record$2(value);
10229
10195
  const type = source.type;
10230
10196
  if (type != "integration" && type != "poll") return invalidResponse();
10231
10197
  return {
@@ -10238,7 +10204,7 @@ function triggerKeySummary(value) {
10238
10204
  };
10239
10205
  }
10240
10206
  function triggerKey(value) {
10241
- const source = record$1(value);
10207
+ const source = record$2(value);
10242
10208
  const summary = triggerKeySummary(source);
10243
10209
  const base = {
10244
10210
  configInputs: configInputsSchema.parse(source.configInputs),
@@ -10248,7 +10214,7 @@ function triggerKey(value) {
10248
10214
  key: summary.key,
10249
10215
  name: summary.name,
10250
10216
  outputs: (Array.isArray(source.outputs) ? source.outputs : invalidResponse()).map((entry) => {
10251
- const port = record$1(entry);
10217
+ const port = record$2(entry);
10252
10218
  return Object.assign({
10253
10219
  handle: string$1(port.handle),
10254
10220
  jsonSchema: jsonValue(port.jsonSchema),
@@ -10261,8 +10227,8 @@ function triggerKey(value) {
10261
10227
  ...base,
10262
10228
  type: "poll"
10263
10229
  };
10264
- const endpoint = record$1(source.endpoint);
10265
- const body = record$1(endpoint.body);
10230
+ const endpoint = record$2(source.endpoint);
10231
+ const body = record$2(endpoint.body);
10266
10232
  if (!Array.isArray(endpoint.methods) || !Array.isArray(body.formats) || typeof body.allowArray != "boolean" || typeof body.allowEmpty != "boolean") return invalidResponse();
10267
10233
  const methods = endpoint.methods.map(string$1);
10268
10234
  const formats = body.formats.map(string$1);
@@ -10318,9 +10284,9 @@ var triggerActivityKinds = /* @__PURE__ */ new Set([
10318
10284
  "operator.resumed"
10319
10285
  ]);
10320
10286
  function triggerBinding(value) {
10321
- const source = record$1(value);
10287
+ const source = record$2(value);
10322
10288
  const health = source.health;
10323
- const listener = source.listener == null ? void 0 : record$1(source.listener);
10289
+ const listener = source.listener == null ? void 0 : record$2(source.listener);
10324
10290
  if (listener != null && listener.health != "healthy" && listener.health != "failed" && listener.health != "needs_reauth") return invalidResponse();
10325
10291
  const kind = source.kind;
10326
10292
  const operatorState = source.operatorState;
@@ -10349,7 +10315,7 @@ function triggerBinding(value) {
10349
10315
  };
10350
10316
  }
10351
10317
  function triggerBindingDetail(value) {
10352
- const source = record$1(value);
10318
+ const source = record$2(value);
10353
10319
  if (source.version != 1) return invalidResponse();
10354
10320
  return {
10355
10321
  binding: triggerBinding(source.binding),
@@ -10357,7 +10323,7 @@ function triggerBindingDetail(value) {
10357
10323
  };
10358
10324
  }
10359
10325
  function triggerActivity(value) {
10360
- const source = record$1(value);
10326
+ const source = record$2(value);
10361
10327
  const kind = source.kind;
10362
10328
  if (typeof kind != "string" || !triggerActivityKinds.has(kind)) return invalidResponse();
10363
10329
  const errorCode = optionalString(source.errorCode);
@@ -10372,7 +10338,7 @@ function triggerActivity(value) {
10372
10338
  };
10373
10339
  }
10374
10340
  function triggerActivityPage(value) {
10375
- const source = record$1(value);
10341
+ const source = record$2(value);
10376
10342
  const nextCursor = optionalString(source.nextCursor);
10377
10343
  if (source.version != 1 || !Array.isArray(source.activities)) return invalidResponse();
10378
10344
  return {
@@ -10382,12 +10348,12 @@ function triggerActivityPage(value) {
10382
10348
  };
10383
10349
  }
10384
10350
  function pollTriggerTestResult(value) {
10385
- const source = record$1(value);
10351
+ const source = record$2(value);
10386
10352
  const filtered = integer$1(source.filtered);
10387
10353
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.hasMore != "boolean" || filtered < 0) return invalidResponse();
10388
10354
  return {
10389
10355
  events: source.events.map((event) => {
10390
- const object = record$1(event);
10356
+ const object = record$2(event);
10391
10357
  return Object.fromEntries(Object.entries(object).map(([key, item]) => [key, jsonValue(item)]));
10392
10358
  }),
10393
10359
  filtered,
@@ -10398,7 +10364,7 @@ function pollTriggerTestResult(value) {
10398
10364
  //#endregion
10399
10365
  //#region src/control/common/triggerCatalog.ts
10400
10366
  function decodeTriggerCatalog(value) {
10401
- const source = record$1(value);
10367
+ const source = record$2(value);
10402
10368
  exact(source, [
10403
10369
  "version",
10404
10370
  "locale",
@@ -10407,12 +10373,12 @@ function decodeTriggerCatalog(value) {
10407
10373
  ]);
10408
10374
  if (source.version != 3 || !isUiLanguage(source.locale) || !Array.isArray(source.definitions)) return invalidResponse();
10409
10375
  const definitions = source.definitions.map(triggerKey);
10410
- const entries = record$1(source.display);
10376
+ const entries = record$2(source.display);
10411
10377
  const keys = new Set(definitions.map((definition) => definition.key));
10412
10378
  if (keys.size != definitions.length || Object.keys(entries).length != keys.size) return invalidResponse();
10413
10379
  const display = Object.fromEntries(definitions.map((definition) => {
10414
10380
  const { key } = definition;
10415
- const copy = record$1(entries[key]);
10381
+ const copy = record$2(entries[key]);
10416
10382
  exact(copy, [
10417
10383
  "configInputs",
10418
10384
  "configInputLabels",
@@ -10436,12 +10402,12 @@ function decodeTriggerCatalog(value) {
10436
10402
  };
10437
10403
  }
10438
10404
  function descriptions(value, handles) {
10439
- const source = record$1(value);
10405
+ const source = record$2(value);
10440
10406
  exact(source, handles);
10441
10407
  return Object.fromEntries(Object.entries(source).map(([handle, description]) => [handle, string$1(description)]));
10442
10408
  }
10443
10409
  function labels(value, handles) {
10444
- const source = record$1(value);
10410
+ const source = record$2(value);
10445
10411
  if (Object.keys(source).some((handle) => !handles.includes(handle))) return invalidResponse();
10446
10412
  return Object.fromEntries(Object.entries(source).map(([handle, label]) => {
10447
10413
  const text = string$1(label);
@@ -10637,7 +10603,7 @@ function schemaPath(value) {
10637
10603
  return value.map((part) => typeof part == "string" || Number.isSafeInteger(part) ? part : invalidResponse());
10638
10604
  }
10639
10605
  function schemaMismatch(value) {
10640
- const source = record$1(value);
10606
+ const source = record$2(value);
10641
10607
  const kind = string$1(source.kind);
10642
10608
  if (kind == "artifact" || kind == "binary" || kind == "nullable") return { kind };
10643
10609
  if (kind == "schema") return {
@@ -10654,8 +10620,8 @@ function schemaMismatch(value) {
10654
10620
  };
10655
10621
  }
10656
10622
  function diagnostic(value) {
10657
- const source = record$1(value);
10658
- const values = source.values == null ? void 0 : record$1(source.values);
10623
+ const source = record$2(value);
10624
+ const values = source.values == null ? void 0 : record$2(source.values);
10659
10625
  return {
10660
10626
  code: string$1(source.code),
10661
10627
  column: integer$1(source.column),
@@ -10668,7 +10634,7 @@ function diagnostic(value) {
10668
10634
  };
10669
10635
  }
10670
10636
  function flowCheck(value) {
10671
- const source = record$1(value);
10637
+ const source = record$2(value);
10672
10638
  if (source.version != 1 || typeof source.valid != "boolean" || !Array.isArray(source.diagnostics)) return invalidResponse();
10673
10639
  return {
10674
10640
  closureDigest: string$1(source.closureDigest),
@@ -10693,7 +10659,7 @@ function connectorProvidersQuery(flowId, locale) {
10693
10659
  return {
10694
10660
  path: `/v1/connector/providers${parameters ? `?${parameters}` : ""}`,
10695
10661
  decode: (value) => {
10696
- const source = record$1(value);
10662
+ const source = record$2(value);
10697
10663
  exact(source, ["providers", "version"]);
10698
10664
  if (source.version != 1 || !Array.isArray(source.providers)) return invalidResponse();
10699
10665
  return source.providers.map(connectorProvider);
@@ -10708,7 +10674,7 @@ function connectorActionQuery(actionId, flowId, locale) {
10708
10674
  return {
10709
10675
  path: `/v1/connector/actions/${encodeURIComponent(actionId)}${parameters ? `?${parameters}` : ""}`,
10710
10676
  decode: (value) => {
10711
- const source = record$1(value);
10677
+ const source = record$2(value);
10712
10678
  exact(source, ["action", "version"]);
10713
10679
  if (source.version != 1) return invalidResponse();
10714
10680
  return connectorAction(source.action);
@@ -10719,7 +10685,7 @@ function allConnectorConnectionsQuery(flowId) {
10719
10685
  return {
10720
10686
  path: `/v1/connector/connections${scope(flowId)}`,
10721
10687
  decode: (value) => {
10722
- const source = record$1(value);
10688
+ const source = record$2(value);
10723
10689
  exact(source, ["connections", "version"]);
10724
10690
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
10725
10691
  return source.connections.map(connection);
@@ -10730,7 +10696,7 @@ function connectorConnectionsQuery(serviceId, flowId) {
10730
10696
  return {
10731
10697
  path: `/v1/connector/connections/${encodeURIComponent(serviceId)}${scope(flowId)}`,
10732
10698
  decode: (value) => {
10733
- const source = record$1(value);
10699
+ const source = record$2(value);
10734
10700
  exact(source, [
10735
10701
  "connections",
10736
10702
  "serviceId",
@@ -10744,11 +10710,11 @@ function connectorConnectionsQuery(serviceId, flowId) {
10744
10710
  //#endregion
10745
10711
  //#region src/control/common/flowDecoders.ts
10746
10712
  function flow(value) {
10747
- const source = record$1(value);
10713
+ const source = record$2(value);
10748
10714
  const status = source.status;
10749
10715
  if (source.version != 1) return invalidResponse();
10750
10716
  if (status != "active" && status != "retiring") return invalidResponse();
10751
- const target = source.live == null ? void 0 : record$1(source.live);
10717
+ const target = source.live == null ? void 0 : record$2(source.live);
10752
10718
  if (target != null && typeof target.enabled != "boolean") return invalidResponse();
10753
10719
  return {
10754
10720
  ...target == null ? {} : { live: {
@@ -10767,7 +10733,7 @@ function flow(value) {
10767
10733
  };
10768
10734
  }
10769
10735
  function flowPage(value) {
10770
- const source = record$1(value);
10736
+ const source = record$2(value);
10771
10737
  if (source.version != 1 || !Array.isArray(source.flows)) return invalidResponse();
10772
10738
  const nextCursor = source.nextCursor;
10773
10739
  const total = source.total;
@@ -10781,7 +10747,7 @@ function flowPage(value) {
10781
10747
  };
10782
10748
  }
10783
10749
  function variable(value) {
10784
- const source = record$1(value);
10750
+ const source = record$2(value);
10785
10751
  exact(source, [
10786
10752
  "name",
10787
10753
  "updatedAt",
@@ -10803,7 +10769,7 @@ function variable(value) {
10803
10769
  };
10804
10770
  }
10805
10771
  function errorListener(value) {
10806
- const source = record$1(value);
10772
+ const source = record$2(value);
10807
10773
  if (typeof source.enabled != "boolean") return invalidResponse();
10808
10774
  return {
10809
10775
  flowId: string$1(source.flowId),
@@ -10816,8 +10782,8 @@ function errorListener(value) {
10816
10782
  //#endregion
10817
10783
  //#region src/control/common/publicationDecoders.ts
10818
10784
  function publication(value) {
10819
- const source = record$1(value);
10820
- const liveEnd = source.liveEnd == null ? void 0 : record$1(source.liveEnd);
10785
+ const source = record$2(value);
10786
+ const liveEnd = source.liveEnd == null ? void 0 : record$2(source.liveEnd);
10821
10787
  if (liveEnd != null && typeof liveEnd.enabled != "boolean") return invalidResponse();
10822
10788
  const operation = source.operation;
10823
10789
  const sourcePublicationId = source.sourcePublicationId;
@@ -10845,7 +10811,7 @@ function publication(value) {
10845
10811
  };
10846
10812
  }
10847
10813
  function publishOperation(value) {
10848
- const source = record$1(value);
10814
+ const source = record$2(value);
10849
10815
  const status = source.status;
10850
10816
  const common = {
10851
10817
  createdAt: string$1(source.createdAt),
@@ -10898,7 +10864,7 @@ function publishOperation(value) {
10898
10864
  "updatedAt",
10899
10865
  "version"
10900
10866
  ]);
10901
- const issue = record$1(source.issue);
10867
+ const issue = record$2(source.issue);
10902
10868
  const nodeId = issue.nodeId;
10903
10869
  exact(issue, [
10904
10870
  "code",
@@ -10919,7 +10885,7 @@ function publishOperation(value) {
10919
10885
  }
10920
10886
  }
10921
10887
  function live(value) {
10922
- const source = record$1(value);
10888
+ const source = record$2(value);
10923
10889
  const status = source.status;
10924
10890
  const candidate = source.publication;
10925
10891
  if (source.version != 1 || typeof source.hasUnpublishedChanges != "boolean") return invalidResponse();
@@ -10936,7 +10902,7 @@ function live(value) {
10936
10902
  };
10937
10903
  }
10938
10904
  function publicationPage(value) {
10939
- const source = record$1(value);
10905
+ const source = record$2(value);
10940
10906
  const nextCursor = source.nextCursor;
10941
10907
  const total = source.total;
10942
10908
  if (source.version != 1 || !Array.isArray(source.publications)) return invalidResponse();
@@ -10952,7 +10918,7 @@ function publicationPage(value) {
10952
10918
  //#endregion
10953
10919
  //#region src/control/common/revisionDecoders.ts
10954
10920
  function revisionMetadata(value) {
10955
- const source = record$1(value);
10921
+ const source = record$2(value);
10956
10922
  const parentRevisionId = source.parentRevisionId;
10957
10923
  if (source.version != 1 || parentRevisionId !== null && typeof parentRevisionId != "string") return invalidResponse();
10958
10924
  return {
@@ -10967,7 +10933,7 @@ function revisionMetadata(value) {
10967
10933
  };
10968
10934
  }
10969
10935
  function draft(value) {
10970
- const source = record$1(value);
10936
+ const source = record$2(value);
10971
10937
  try {
10972
10938
  return {
10973
10939
  ...revisionMetadata(source),
@@ -10978,17 +10944,17 @@ function draft(value) {
10978
10944
  }
10979
10945
  }
10980
10946
  function presentation(value) {
10981
- const source = record$1(value);
10947
+ const source = record$2(value);
10982
10948
  if (source.version != 1 || integer$1(source.revision) < 1) return invalidResponse();
10983
10949
  return {
10984
10950
  revision: integer$1(source.revision),
10985
10951
  updatedAt: string$1(source.updatedAt),
10986
- value: Object.fromEntries(Object.entries(record$1(source.value)).map(([key, item]) => [key, jsonValue(item)])),
10952
+ value: Object.fromEntries(Object.entries(record$2(source.value)).map(([key, item]) => [key, jsonValue(item)])),
10987
10953
  version: 1
10988
10954
  };
10989
10955
  }
10990
10956
  function draftChange(value) {
10991
- const source = record$1(value);
10957
+ const source = record$2(value);
10992
10958
  if (source.version != 1) return invalidResponse();
10993
10959
  return {
10994
10960
  revision: revisionMetadata(source.revision),
@@ -10996,7 +10962,7 @@ function draftChange(value) {
10996
10962
  };
10997
10963
  }
10998
10964
  function draftSync(value) {
10999
- const source = record$1(value);
10965
+ const source = record$2(value);
11000
10966
  if (source.version != 1 || source.kind != "snapshot") return invalidResponse();
11001
10967
  return {
11002
10968
  draft: draft(source.draft),
@@ -11022,7 +10988,7 @@ function runStatus(value) {
11022
10988
  return typeof value == "string" && runStatusSet.has(value) ? value : invalidResponse();
11023
10989
  }
11024
10990
  function run(value) {
11025
- const source = record$1(value);
10991
+ const source = record$2(value);
11026
10992
  const kind = source.source;
11027
10993
  const startedAt = source.startedAt;
11028
10994
  const finishedAt = source.finishedAt;
@@ -11042,7 +11008,7 @@ function run(value) {
11042
11008
  };
11043
11009
  }
11044
11010
  function runWaiting(value) {
11045
- const source = record$1(value);
11011
+ const source = record$2(value);
11046
11012
  exact(source, [
11047
11013
  "actions",
11048
11014
  "expiresAt",
@@ -11063,7 +11029,7 @@ function runWaiting(value) {
11063
11029
  };
11064
11030
  }
11065
11031
  function runDetails(value) {
11066
- const source = record$1(value);
11032
+ const source = record$2(value);
11067
11033
  const summary = run(source);
11068
11034
  const eventsExpiresAt = source.eventsExpiresAt;
11069
11035
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
@@ -11109,7 +11075,7 @@ function runDetails(value) {
11109
11075
  }
11110
11076
  }
11111
11077
  function runPage(value) {
11112
- const source = record$1(value);
11078
+ const source = record$2(value);
11113
11079
  const nextCursor = source.nextCursor;
11114
11080
  if (source.version != 1 || !Array.isArray(source.runs)) return invalidResponse();
11115
11081
  if (nextCursor != null && typeof nextCursor != "string") return invalidResponse();
@@ -11121,7 +11087,7 @@ function runPage(value) {
11121
11087
  };
11122
11088
  }
11123
11089
  function runCancellation(value) {
11124
- const source = record$1(value);
11090
+ const source = record$2(value);
11125
11091
  const status = runStatus(source.status);
11126
11092
  if (source.version != 1 || typeof source.cancelAccepted != "boolean" || status == "queued" || status == "starting" || status == "running" || status == "waiting") return invalidResponse();
11127
11093
  return {
@@ -11132,7 +11098,7 @@ function runCancellation(value) {
11132
11098
  };
11133
11099
  }
11134
11100
  function waitResolution(value) {
11135
- const source = record$1(value);
11101
+ const source = record$2(value);
11136
11102
  exact(source, [
11137
11103
  "action",
11138
11104
  "comment",
@@ -11158,7 +11124,7 @@ function waitResolution(value) {
11158
11124
  };
11159
11125
  }
11160
11126
  function runResult(value) {
11161
- const source = record$1(value);
11127
+ const source = record$2(value);
11162
11128
  const status = source.status;
11163
11129
  if (source.version != 1) return invalidResponse();
11164
11130
  const base = {
@@ -11179,7 +11145,7 @@ function runResult(value) {
11179
11145
  status: "canceled"
11180
11146
  };
11181
11147
  if (status == "failed") {
11182
- const error = record$1(source.error);
11148
+ const error = record$2(source.error);
11183
11149
  return {
11184
11150
  ...base,
11185
11151
  error: runFailure(error),
@@ -11187,7 +11153,7 @@ function runResult(value) {
11187
11153
  };
11188
11154
  }
11189
11155
  if (status == "indeterminate") {
11190
- const error = record$1(source.error);
11156
+ const error = record$2(source.error);
11191
11157
  return {
11192
11158
  ...base,
11193
11159
  error: runFailure(error),
@@ -11197,7 +11163,7 @@ function runResult(value) {
11197
11163
  return invalidResponse();
11198
11164
  }
11199
11165
  function errorHandling(source) {
11200
- const errorSource = source.errorSource == null ? void 0 : record$1(source.errorSource);
11166
+ const errorSource = source.errorSource == null ? void 0 : record$2(source.errorSource);
11201
11167
  if (source.errorDispatches != null && !Array.isArray(source.errorDispatches)) return invalidResponse();
11202
11168
  return {
11203
11169
  ...errorSource == null ? {} : { errorSource: {
@@ -11205,7 +11171,7 @@ function errorHandling(source) {
11205
11171
  runId: string$1(errorSource.runId)
11206
11172
  } },
11207
11173
  ...source.errorDispatches == null ? {} : { errorDispatches: source.errorDispatches.map((value) => {
11208
- const dispatch = record$1(value);
11174
+ const dispatch = record$2(value);
11209
11175
  const flowId = string$1(dispatch.flowId);
11210
11176
  switch (dispatch.status) {
11211
11177
  case "pending": return {
@@ -11260,14 +11226,14 @@ function isRunTerminalEvent(event) {
11260
11226
  return event?.kind == "run.completed" || event?.kind == "run.failed" || event?.kind == "run.canceled" || event?.kind == "run.indeterminate";
11261
11227
  }
11262
11228
  function decodeRunEvent(value) {
11263
- const source = record$1(value);
11229
+ const source = record$2(value);
11264
11230
  const sequence = integer$1(source.sequence);
11265
11231
  if (sequence < 0) return invalidResponse();
11266
11232
  const base = {
11267
11233
  createdAt: string$1(source.createdAt),
11268
11234
  sequence
11269
11235
  };
11270
- const payload = record$1(source.payload);
11236
+ const payload = record$2(source.payload);
11271
11237
  const kind = source.kind;
11272
11238
  switch (kind) {
11273
11239
  case "run.queued": return {
@@ -11353,7 +11319,7 @@ function decodeRunEvent(value) {
11353
11319
  switch (kind) {
11354
11320
  case "node.started": {
11355
11321
  const nodeKind = payload.nodeKind;
11356
- if (nodeKind !== void 0 && nodeKind !== "approval" && nodeKind !== "condition" && nodeKind !== "connector" && nodeKind !== "javascript" && nodeKind !== "decision" && nodeKind !== "openapi" && nodeKind !== "llm" && nodeKind !== "agent" && nodeKind !== "subflow" && nodeKind !== "value" && nodeKind !== "wait") return invalidResponse();
11322
+ if (nodeKind !== void 0 && nodeKind !== "approval" && nodeKind !== "condition" && nodeKind !== "connector" && nodeKind !== "javascript" && nodeKind !== "decision" && nodeKind !== "openapi" && nodeKind !== "llm" && nodeKind !== "agent" && nodeKind !== "value" && nodeKind !== "wait") return invalidResponse();
11357
11323
  return {
11358
11324
  ...base,
11359
11325
  kind,
@@ -11370,11 +11336,11 @@ function decodeRunEvent(value) {
11370
11336
  kind,
11371
11337
  payload: {
11372
11338
  ...node,
11373
- outputs: Object.fromEntries(Object.entries(record$1(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
11339
+ outputs: Object.fromEntries(Object.entries(record$2(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
11374
11340
  }
11375
11341
  };
11376
11342
  case "node.failed": {
11377
- const error = record$1(payload.error);
11343
+ const error = record$2(payload.error);
11378
11344
  return {
11379
11345
  ...base,
11380
11346
  kind,
@@ -11409,7 +11375,7 @@ function decodeRunEvent(value) {
11409
11375
  }
11410
11376
  };
11411
11377
  case "node.artifact": {
11412
- const artifact = record$1(payload.artifact);
11378
+ const artifact = record$2(payload.artifact);
11413
11379
  const size = integer$1(artifact.size);
11414
11380
  const digest = string$1(artifact.digest);
11415
11381
  if (artifact.kind != "artifact" || size < 0 || !/^sha256:[0-9a-f]{64}$/.test(digest)) return invalidResponse();
@@ -11438,7 +11404,7 @@ function eventProgress(value) {
11438
11404
  return typeof value == "number" && Number.isFinite(value) && value >= 0 && value <= 100 ? value : invalidResponse();
11439
11405
  }
11440
11406
  function runEvents(value) {
11441
- const source = record$1(value);
11407
+ const source = record$2(value);
11442
11408
  const eventsExpiresAt = source.eventsExpiresAt;
11443
11409
  const nextAfter = integer$1(source.nextAfter);
11444
11410
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.done != "boolean" || typeof source.historyComplete != "boolean") return invalidResponse();
@@ -11463,7 +11429,7 @@ var ControlClient = class {
11463
11429
  this.requestControl = requestControl;
11464
11430
  }
11465
11431
  async loadOpenApiDocument(url, signal) {
11466
- const result = record$1(await this.request("/v1/openapi/document", {
11432
+ const result = record$2(await this.request("/v1/openapi/document", {
11467
11433
  method: "POST",
11468
11434
  body: JSON.stringify({
11469
11435
  url,
@@ -11486,7 +11452,7 @@ var ControlClient = class {
11486
11452
  return decodeEventSources(await this.request("/v1/event-sources" + (flowId == null ? "" : `?flowId=${segment(flowId)}`), { signal }));
11487
11453
  }
11488
11454
  async listEventSourceConnections(teamId, signal) {
11489
- const source = record$1(await this.request(`/v1/event-sources/connections${teamId == null ? "" : `?teamId=${segment(teamId)}`}`, { signal }));
11455
+ const source = record$2(await this.request(`/v1/event-sources/connections${teamId == null ? "" : `?teamId=${segment(teamId)}`}`, { signal }));
11490
11456
  exact(source, ["version", "connections"]);
11491
11457
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
11492
11458
  return source.connections.map(connection);
@@ -11513,7 +11479,7 @@ var ControlClient = class {
11513
11479
  });
11514
11480
  }
11515
11481
  async listVariables() {
11516
- const source = record$1(await this.request("/v1/variables"));
11482
+ const source = record$2(await this.request("/v1/variables"));
11517
11483
  exact(source, ["variables", "version"]);
11518
11484
  if (source.version != 1 || !Array.isArray(source.variables)) return invalidResponse();
11519
11485
  return {
@@ -11531,7 +11497,7 @@ var ControlClient = class {
11531
11497
  }));
11532
11498
  }
11533
11499
  async deleteVariable(name) {
11534
- const source = record$1(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
11500
+ const source = record$2(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
11535
11501
  exact(source, ["version"]);
11536
11502
  if (source.version != 1) return invalidResponse();
11537
11503
  }
@@ -11550,7 +11516,7 @@ var ControlClient = class {
11550
11516
  return flow(await this.request(`/v1/flows/${segment(flowId)}`));
11551
11517
  }
11552
11518
  async getErrorListeners(flowId, signal) {
11553
- const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
11519
+ const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
11554
11520
  if (source.version != 1 || !Array.isArray(source.listeners)) return invalidResponse();
11555
11521
  return source.listeners.map(errorListener);
11556
11522
  }
@@ -11567,12 +11533,12 @@ var ControlClient = class {
11567
11533
  return flow(await this.request(`/v1/flows/${segment(flowId)}`, { method: "DELETE" }));
11568
11534
  }
11569
11535
  async listTriggerKeys(signal, locale) {
11570
- const source = record$1(await this.request(`/v1/trigger-keys${locale == null ? "" : `?locale=${encodeURIComponent(locale)}`}`, { signal }));
11536
+ const source = record$2(await this.request(`/v1/trigger-keys${locale == null ? "" : `?locale=${encodeURIComponent(locale)}`}`, { signal }));
11571
11537
  if (source.version != 1 || !Array.isArray(source.keys)) return invalidResponse();
11572
11538
  return source.keys.map(triggerKeySummary);
11573
11539
  }
11574
11540
  async listTriggerDefinitions(signal) {
11575
- const source = record$1(await this.request("/v1/trigger-keys/catalog", { signal }));
11541
+ const source = record$2(await this.request("/v1/trigger-keys/catalog", { signal }));
11576
11542
  if (source.version != 2 || !Array.isArray(source.definitions)) return invalidResponse();
11577
11543
  return source.definitions.map(triggerKey);
11578
11544
  }
@@ -11614,12 +11580,12 @@ var ControlClient = class {
11614
11580
  };
11615
11581
  }
11616
11582
  async getTriggerKey(key, signal) {
11617
- const source = record$1(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
11583
+ const source = record$2(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
11618
11584
  if (source.version != 1) return invalidResponse();
11619
11585
  return triggerKey(source.definition);
11620
11586
  }
11621
11587
  async listFlowTriggerBindings(flowId, signal) {
11622
- const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/triggers`, { signal }));
11588
+ const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/triggers`, { signal }));
11623
11589
  if (source.version != 1 || string$1(source.flowId) != flowId || !Array.isArray(source.bindings)) return invalidResponse();
11624
11590
  return source.bindings.map(triggerBinding);
11625
11591
  }
@@ -11652,7 +11618,7 @@ var ControlClient = class {
11652
11618
  }));
11653
11619
  }
11654
11620
  async getEditor(flowId) {
11655
- const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11621
+ const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11656
11622
  if (source.version != 1) return invalidResponse();
11657
11623
  const result = {
11658
11624
  flow: flow(source.flow),
@@ -11665,7 +11631,7 @@ var ControlClient = class {
11665
11631
  return result;
11666
11632
  }
11667
11633
  async getPublicationPresentation(flowId, publicationId, signal) {
11668
- const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/publications/${segment(publicationId)}/presentation`, { signal }));
11634
+ const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/publications/${segment(publicationId)}/presentation`, { signal }));
11669
11635
  if (source.version != 1) return invalidResponse();
11670
11636
  return {
11671
11637
  version: 1,
@@ -11685,11 +11651,11 @@ var ControlClient = class {
11685
11651
  return draft(await this.request(`/v1/flows/${segment(flowId)}/revisions/${segment(revisionId)}`, { signal }));
11686
11652
  }
11687
11653
  async listTriggerConfigOptions(flowId, nodeId, field, signal) {
11688
- const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(nodeId)}/options/${segment(field)}`, { signal }));
11654
+ const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(nodeId)}/options/${segment(field)}`, { signal }));
11689
11655
  exact(source, ["options", "version"]);
11690
11656
  if (source.version != 1 || !Array.isArray(source.options) || source.options.length > 1e3) return invalidResponse();
11691
11657
  return source.options.map((value) => {
11692
- const item = record$1(value);
11658
+ const item = record$2(value);
11693
11659
  exact(item, [
11694
11660
  "value",
11695
11661
  "label",
@@ -11708,7 +11674,7 @@ var ControlClient = class {
11708
11674
  });
11709
11675
  }
11710
11676
  async listConnectorTeams(signal) {
11711
- const source = record$1(await this.request("/v1/connector/teams", { signal }));
11677
+ const source = record$2(await this.request("/v1/connector/teams", { signal }));
11712
11678
  exact(source, [
11713
11679
  "enabled",
11714
11680
  "teams",
@@ -11718,7 +11684,7 @@ var ControlClient = class {
11718
11684
  return {
11719
11685
  enabled: source.enabled,
11720
11686
  teams: source.teams.map((value) => {
11721
- const team = record$1(value);
11687
+ const team = record$2(value);
11722
11688
  exact(team, [
11723
11689
  "id",
11724
11690
  "name",
@@ -11825,7 +11791,7 @@ var ControlClient = class {
11825
11791
  const parameters = new URLSearchParams();
11826
11792
  if (flowId != null) parameters.set("flowId", flowId);
11827
11793
  if (teamId != null) parameters.set("teamId", teamId);
11828
- const source = record$1(await this.request(`/v1/connector/connections/${segment(serviceId)}/page${parameters.size == 0 ? "" : `?${parameters}`}`, {
11794
+ const source = record$2(await this.request(`/v1/connector/connections/${segment(serviceId)}/page${parameters.size == 0 ? "" : `?${parameters}`}`, {
11829
11795
  body: JSON.stringify({ version: 1 }),
11830
11796
  method: "POST"
11831
11797
  }));
@@ -11996,7 +11962,7 @@ var ControlClient = class {
11996
11962
  const query = Object.entries(parameters).map(([key, value]) => `${segment(key)}=${segment(value)}`).join("&");
11997
11963
  const suffix = query == "" ? "" : `?${query}`;
11998
11964
  return this.connectorRequest(`/v1/connector/actions${suffix}`, "actions", signal, (value) => {
11999
- const source = record$1(value);
11965
+ const source = record$2(value);
12000
11966
  exact(source, ["actions", "version"]);
12001
11967
  if (source.version != 1 || !Array.isArray(source.actions)) return invalidResponse();
12002
11968
  return source.actions.map(connectorAction);
@@ -12019,8 +11985,8 @@ var ControlClient = class {
12019
11985
  } catch {
12020
11986
  return invalidResponse();
12021
11987
  }
12022
- const error = record$1(value).error;
12023
- const source = error == null ? void 0 : record$1(error);
11988
+ const error = record$2(value).error;
11989
+ const source = error == null ? void 0 : record$2(error);
12024
11990
  throw new ApiError(response.status, typeof source?.code == "string" ? source.code : "request.failed", typeof source?.message == "string" ? source.message : `Request failed with status ${response.status}.`);
12025
11991
  }
12026
11992
  return response;