@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
@@ -116,28 +116,38 @@ var ApiError = class extends Error {
116
116
  };
117
117
  //#endregion
118
118
  //#region src/control/common/decoding.ts
119
- function invalidResponse() {
120
- throw new ApiError(502, "response.invalid", "The Control API returned an invalid response.");
119
+ var InvalidResponseError = class extends ApiError {
120
+ constructor(detail) {
121
+ super(502, "response.invalid", `The Control API returned an invalid response.${detail == null ? "" : ` ${detail}`}`);
122
+ this.detail = detail;
123
+ }
124
+ };
125
+ function invalidResponse(detail) {
126
+ throw new InvalidResponseError(detail);
121
127
  }
122
- function record$2(value) {
123
- if (value == null || typeof value != "object" || Array.isArray(value)) return invalidResponse();
128
+ function record$3(value) {
129
+ if (value == null || typeof value != "object" || Array.isArray(value)) return invalidResponse("Expected an object.");
124
130
  return value;
125
131
  }
126
132
  function string$1(value) {
127
- return typeof value == "string" && value.length > 0 ? value : invalidResponse();
133
+ return typeof value == "string" && value.length > 0 ? value : invalidResponse("Expected a non-empty string.");
128
134
  }
129
135
  function exact(value, keys) {
130
136
  const actual = Object.keys(value);
131
- if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) invalidResponse();
137
+ if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) {
138
+ const missing = keys.filter((key) => !Object.hasOwn(value, key));
139
+ const unexpected = actual.filter((key) => !keys.includes(key));
140
+ invalidResponse([missing.length > 0 ? `Missing fields: ${missing.join(", ")}.` : "", unexpected.length > 0 ? `Unexpected fields: ${unexpected.join(", ")}.` : ""].filter(Boolean).join(" "));
141
+ }
132
142
  }
133
143
  function integer$1(value) {
134
- return Number.isSafeInteger(value) ? value : invalidResponse();
144
+ return Number.isSafeInteger(value) ? value : invalidResponse("Expected a safe integer.");
135
145
  }
136
146
  function jsonValue(value) {
137
147
  if (value === null || typeof value == "boolean" || typeof value == "string") return value;
138
148
  if (typeof value == "number" && Number.isFinite(value)) return value;
139
149
  if (Array.isArray(value)) return value.map(jsonValue);
140
- const source = record$2(value);
150
+ const source = record$3(value);
141
151
  return Object.fromEntries(Object.entries(source).map(([key, item]) => [key, jsonValue(item)]));
142
152
  }
143
153
  function optionalString(value) {
@@ -2927,6 +2937,9 @@ function handlePipeResult(left, next, ctx) {
2927
2937
  issues: left.issues
2928
2938
  }, ctx);
2929
2939
  }
2940
+ var $ZodPreprocess = /*@__PURE__*/ $constructor("$ZodPreprocess", (inst, def) => {
2941
+ $ZodPipe.init(inst, def);
2942
+ });
2930
2943
  var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2931
2944
  $ZodType.init(inst, def);
2932
2945
  defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
@@ -5542,7 +5555,7 @@ var ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
5542
5555
  inst.keyType = def.keyType;
5543
5556
  inst.valueType = def.valueType;
5544
5557
  });
5545
- function record$1(keyType, valueType, params) {
5558
+ function record$2(keyType, valueType, params) {
5546
5559
  if (!valueType || !valueType._zod) return new ZodRecord({
5547
5560
  type: "record",
5548
5561
  keyType: string(),
@@ -5751,6 +5764,10 @@ function pipe(in_, out) {
5751
5764
  out
5752
5765
  });
5753
5766
  }
5767
+ var ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
5768
+ ZodPipe.init(inst, def);
5769
+ $ZodPreprocess.init(inst, def);
5770
+ });
5754
5771
  var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
5755
5772
  $ZodReadonly.init(inst, def);
5756
5773
  ZodType.init(inst, def);
@@ -5794,18 +5811,25 @@ function json$3(params) {
5794
5811
  boolean(),
5795
5812
  _null(),
5796
5813
  array(jsonSchema),
5797
- record$1(string(), jsonSchema)
5814
+ record$2(string(), jsonSchema)
5798
5815
  ]);
5799
5816
  });
5800
5817
  return jsonSchema;
5801
5818
  }
5819
+ function preprocess(fn, schema) {
5820
+ return new ZodPreprocess({
5821
+ type: "pipe",
5822
+ in: transform(fn),
5823
+ out: schema
5824
+ });
5825
+ }
5802
5826
  //#endregion
5803
5827
  //#region src/openapi/common/authBindings.ts
5804
5828
  /** Never allow credentials to enter a Revision as literal node inputs. */
5805
5829
  function assertOpenApiAuthBindings(document) {
5806
- for (const graph of [document.graph, ...Object.values(document.subflows).map((subflow) => subflow.graph)]) for (const node of Object.values(graph.nodes)) {
5807
- if (node.kind != "task" || node.taskId == null || document.tasks[node.taskId]?.executor.kind != "openapi") continue;
5808
- 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.");
5830
+ for (const node of Object.values(document.graph.nodes)) {
5831
+ if (node.kind != "task" || !("executor" in node.task) || node.task.executor.kind != "openapi") continue;
5832
+ 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.");
5809
5833
  }
5810
5834
  }
5811
5835
  //#endregion
@@ -8455,7 +8479,7 @@ var isObject = (x) => x !== null && typeof x === "object";
8455
8479
  var isPlainObject = (x) => isObject(x) && !isArray(x);
8456
8480
  var toPlainObject = (x) => isPlainObject(x) ? x : void 0;
8457
8481
  //#endregion
8458
- //#region src/manifest/common/schemaComparer.ts
8482
+ //#region src/flow/common/schemaComparer.ts
8459
8483
  function isStringLikeSchema(value) {
8460
8484
  return toPlainObject(value)?.type === "string";
8461
8485
  }
@@ -8698,24 +8722,15 @@ var group = object({
8698
8722
  collapsed: boolean().optional(),
8699
8723
  group: text
8700
8724
  });
8701
- var nodeSource = object({
8725
+ var source = union([object({
8702
8726
  kind: literal("node"),
8703
8727
  nodeId: text,
8704
8728
  output: text,
8705
8729
  field: text.optional()
8706
- });
8707
- var flowSource = object({
8708
- kind: literal("flow"),
8709
- input: text
8710
- });
8711
- var source = union([
8712
- nodeSource,
8713
- flowSource,
8714
- object({
8715
- kind: literal("binding"),
8716
- bindingId: text
8717
- })
8718
- ]);
8730
+ }), object({
8731
+ kind: literal("binding"),
8732
+ bindingId: text
8733
+ })]);
8719
8734
  var fixedInput = union([object({ kind: literal("unset") }), object({
8720
8735
  kind: literal("value"),
8721
8736
  value: json$2
@@ -8724,7 +8739,7 @@ var mapping = union([fixedInput, object({
8724
8739
  kind: literal("sources"),
8725
8740
  sources: array(source)
8726
8741
  })]);
8727
- var inputs = record$1(text, mapping);
8742
+ var inputs = record$2(text, mapping);
8728
8743
  var ports$1 = {
8729
8744
  inputs: array(union([input, group])),
8730
8745
  outputs: array(union([port$1, group]))
@@ -8852,9 +8867,11 @@ var managed = object({
8852
8867
  inputs: array(input.extend({ source: agentInput }))
8853
8868
  })),
8854
8869
  notification: object({
8855
- taskId: text,
8870
+ action: text,
8871
+ connectionId: text.optional(),
8872
+ inputDefinitions: array(input),
8856
8873
  messageHandle: text,
8857
- inputs: record$1(text, agentValue)
8874
+ inputs: record$2(text, agentValue)
8858
8875
  }).optional()
8859
8876
  })
8860
8877
  ])
@@ -8909,7 +8926,7 @@ var webhookOptions = object({
8909
8926
  allowedOrigins: strings.optional(),
8910
8927
  noResponseBody: never().optional(),
8911
8928
  responseData: text.optional(),
8912
- responseHeaders: record$1(text, text).optional(),
8929
+ responseHeaders: record$2(text, text).optional(),
8913
8930
  responseStatusCode: number().int().min(200).max(599).optional()
8914
8931
  });
8915
8932
  var webhook = {
@@ -8965,7 +8982,7 @@ var base = {
8965
8982
  var node = union([
8966
8983
  object({
8967
8984
  ...base,
8968
- inputs: record$1(text, never()),
8985
+ inputs: record$2(text, never()),
8969
8986
  kind: literal("condition"),
8970
8987
  ...condition
8971
8988
  }),
@@ -8975,21 +8992,10 @@ var node = union([
8975
8992
  kind: literal("value"),
8976
8993
  values: array(input)
8977
8994
  }),
8978
- object({
8979
- ...base,
8980
- kind: literal("subflow"),
8981
- subflowId: text
8982
- }),
8983
8995
  object({
8984
8996
  ...base,
8985
8997
  kind: literal("task"),
8986
- task: inline,
8987
- additionalInputs: array(input).optional()
8988
- }),
8989
- object({
8990
- ...base,
8991
- kind: literal("task"),
8992
- taskId: text,
8998
+ task: union([inline, managed]),
8993
8999
  additionalInputs: array(input).optional()
8994
9000
  }),
8995
9001
  strictObject({
@@ -9025,7 +9031,7 @@ var node = union([
9025
9031
  ...trigger,
9026
9032
  kind: literal("poll"),
9027
9033
  connectionId: text.min(1).optional(),
9028
- config: record$1(text, fixedInput),
9034
+ config: record$2(text, fixedInput),
9029
9035
  definition: object({
9030
9036
  ...definition,
9031
9037
  type: literal("poll")
@@ -9036,7 +9042,7 @@ var node = union([
9036
9042
  ...trigger,
9037
9043
  kind: literal("integration"),
9038
9044
  connectionId: text.min(1).optional(),
9039
- config: record$1(text, fixedInput),
9045
+ config: record$2(text, fixedInput),
9040
9046
  definition: object({
9041
9047
  ...definition,
9042
9048
  type: literal("integration"),
@@ -9044,10 +9050,6 @@ var node = union([
9044
9050
  })
9045
9051
  })
9046
9052
  ]);
9047
- var target = union([object({ kind: literal("flow") }), object({
9048
- kind: literal("subflow"),
9049
- id: text
9050
- })]);
9051
9053
  var edge = object({
9052
9054
  source: text,
9053
9055
  target: text,
@@ -9055,15 +9057,10 @@ var edge = object({
9055
9057
  });
9056
9058
  var at = {
9057
9059
  nodeId: text,
9058
- target
9060
+ target: never().optional()
9059
9061
  };
9060
- var subflow = object({
9061
- name: text,
9062
- inputs: array(input),
9063
- outputs: array(port$1.extend({ sources: array(union([nodeSource, flowSource])) }))
9064
- });
9065
9062
  var graph = object({
9066
- nodes: record$1(text, node),
9063
+ nodes: record$2(text, node),
9067
9064
  edges: array(edge).default([])
9068
9065
  });
9069
9066
  var binding = object({
@@ -9075,29 +9072,40 @@ var module = object({
9075
9072
  imports: strings,
9076
9073
  source: text
9077
9074
  });
9078
- var document = object({
9079
- bindings: record$1(text, binding),
9080
- graph,
9081
- subflows: record$1(text, subflow.extend({ graph })),
9082
- tasks: record$1(text, managed)
9083
- });
9075
+ var document = preprocess(rejectRetiredDefinitions, object({
9076
+ bindings: record$2(text, binding),
9077
+ graph
9078
+ }));
9084
9079
  var revision = object({
9085
9080
  modelVersion: union([
9086
9081
  literal(2),
9087
9082
  literal(4),
9088
- literal(5)
9083
+ literal(5),
9084
+ literal(6)
9089
9085
  ]),
9090
9086
  document,
9091
- modules: record$1(text, module)
9087
+ modules: record$2(text, module)
9092
9088
  });
9093
9089
  revision.extend({
9094
9090
  kind: literal("open-flow-flow-revision"),
9095
9091
  version: literal(1)
9096
9092
  });
9093
+ function rejectRetiredDefinitions(value) {
9094
+ const candidate = record$1(value);
9095
+ 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.");
9096
+ if (Object.values(record$1(record$1(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record$1(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
9097
+ const subflows = candidate.subflows;
9098
+ 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.");
9099
+ if (Object.values(record$1(record$1(candidate.graph).nodes)).some((candidateNode) => record$1(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
9100
+ return value;
9101
+ }
9102
+ function record$1(value) {
9103
+ return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
9104
+ }
9097
9105
  function decodeRevisionContent(value) {
9098
9106
  checkJsonDepth(value);
9099
9107
  const content = revision.parse(value);
9100
- checkErrorModelVersion(content);
9108
+ checkModelVersion(content);
9101
9109
  assertOpenApiAuthBindings(content.document);
9102
9110
  return content;
9103
9111
  }
@@ -9118,12 +9126,12 @@ var shapes = {
9118
9126
  value: text
9119
9127
  },
9120
9128
  "graph.edge.connect": {
9121
- target,
9122
- edge
9129
+ edge,
9130
+ target: never().optional()
9123
9131
  },
9124
9132
  "graph.edge.disconnect": {
9125
- target,
9126
- edge
9133
+ edge,
9134
+ target: never().optional()
9127
9135
  },
9128
9136
  "graph.node.create": {
9129
9137
  ...at,
@@ -9187,13 +9195,11 @@ var shapes = {
9187
9195
  },
9188
9196
  "graph.node.resolution.set": {
9189
9197
  ...at,
9190
- target: object({ kind: literal("flow") }),
9191
9198
  before: object(wait),
9192
9199
  value: object(wait)
9193
9200
  },
9194
9201
  "graph.node.webhook.set": {
9195
9202
  ...at,
9196
- target: object({ kind: literal("flow") }),
9197
9203
  before: object(webhook),
9198
9204
  value: object(webhook)
9199
9205
  },
@@ -9240,58 +9246,19 @@ var shapes = {
9240
9246
  imports: strings,
9241
9247
  source: text
9242
9248
  },
9243
- "subflow.create": {
9244
- subflowId: text,
9245
- subflow: subflow.extend({ graph })
9246
- },
9247
- "subflow.definition.set": {
9248
- subflowId: text,
9249
- before: subflow,
9250
- definition: subflow
9251
- },
9252
- "subflow.delete": { subflowId: text },
9253
- "task.create": {
9254
- taskId: text,
9255
- task: managed
9256
- },
9257
- "task.delete": { taskId: text },
9258
- "task.connector.connection.set": {
9259
- taskId: text,
9260
- before: text.optional(),
9261
- value: text.optional()
9262
- },
9263
- "task.decision.set": {
9264
- taskId: text,
9265
- before: managed,
9266
- value: managed
9267
- },
9268
- "task.openapi.set": {
9269
- taskId: text,
9270
- before: managed,
9271
- value: managed
9272
- },
9273
- "task.agent.set": {
9274
- taskId: text,
9275
- before: managed,
9276
- value: managed
9277
- },
9278
- "task.llm.mode.set": {
9279
- taskId: text,
9280
- before: _enum(["chat", "json"]),
9281
- value: _enum(["chat", "json"])
9282
- },
9283
- "task.name.set": {
9284
- taskId: text,
9285
- before: text,
9286
- value: text
9249
+ "graph.node.task.set": {
9250
+ ...at,
9251
+ before: union([inline, managed]),
9252
+ value: union([inline, managed])
9287
9253
  }
9288
9254
  };
9289
9255
  array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object({
9290
9256
  kind: literal(kind),
9291
9257
  ...shape
9292
9258
  })])).values()])).min(1);
9293
- function checkErrorModelVersion(content) {
9294
- 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.");
9259
+ function checkModelVersion(content) {
9260
+ 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.");
9261
+ 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.");
9295
9262
  }
9296
9263
  //#endregion
9297
9264
  //#region src/flow/common/change.ts
@@ -9329,7 +9296,7 @@ function parseProviderAccessSource(value) {
9329
9296
  //#endregion
9330
9297
  //#region src/control/common/connectorDecoders.ts
9331
9298
  function accessPermissions(value) {
9332
- const source = record$2(value);
9299
+ const source = record$3(value);
9333
9300
  exact(source, [
9334
9301
  "actionIds",
9335
9302
  "allActions",
@@ -9338,10 +9305,19 @@ function accessPermissions(value) {
9338
9305
  "configured",
9339
9306
  "proxy"
9340
9307
  ]);
9341
- 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();
9308
+ if (!Array.isArray(source.actionIds)) return invalidResponse("permissions.actionIds: expected an array.");
9309
+ if (!Array.isArray(source.triggerIds)) return invalidResponse("permissions.triggerIds: expected an array.");
9310
+ if (typeof source.allActions != "boolean") return invalidResponse("permissions.allActions: expected a boolean.");
9311
+ if (typeof source.allTriggers != "boolean") return invalidResponse("permissions.allTriggers: expected a boolean.");
9312
+ if (typeof source.configured != "boolean") return invalidResponse("permissions.configured: expected a boolean.");
9313
+ if (typeof source.proxy != "boolean") return invalidResponse("permissions.proxy: expected a boolean.");
9342
9314
  const actionIds = source.actionIds.map(string$1);
9343
9315
  const triggerIds = source.triggerIds.map(string$1);
9344
- 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();
9316
+ if (new Set(actionIds).size != actionIds.length) return invalidResponse("permissions.actionIds: duplicate IDs.");
9317
+ if (source.allActions && actionIds.length != 0) return invalidResponse("permissions.actionIds: must be empty when allActions is true.");
9318
+ if (new Set(triggerIds).size != triggerIds.length) return invalidResponse("permissions.triggerIds: duplicate IDs.");
9319
+ if (source.allTriggers && triggerIds.length != 0) return invalidResponse("permissions.triggerIds: must be empty when allTriggers is true.");
9320
+ if (source.proxy && (!source.allActions || !source.allTriggers || source.configured)) return invalidResponse("permissions.proxy: requires allActions=true, allTriggers=true and configured=false.");
9345
9321
  return {
9346
9322
  actionIds,
9347
9323
  triggerIds,
@@ -9352,7 +9328,7 @@ function accessPermissions(value) {
9352
9328
  };
9353
9329
  }
9354
9330
  function accessBinding(value, candidate) {
9355
- const source = record$2(value);
9331
+ const source = record$3(value);
9356
9332
  const policyRevision = source.policyRevision;
9357
9333
  const status = source.status;
9358
9334
  const isDefault = source.isDefault;
@@ -9371,15 +9347,15 @@ function accessBinding(value, candidate) {
9371
9347
  "providerId",
9372
9348
  ...candidate ? [] : ["status"]
9373
9349
  ]);
9374
- if (policyRevision != null && typeof policyRevision != "string") return invalidResponse();
9375
- if (candidate && isDefault !== void 0 && typeof isDefault != "boolean") return invalidResponse();
9376
- if (permissionGroupName !== void 0 && permissionGroupName !== null && typeof permissionGroupName != "string") return invalidResponse();
9350
+ if (policyRevision != null && typeof policyRevision != "string") return invalidResponse("policyRevision: expected a string.");
9351
+ if (candidate && isDefault !== void 0 && typeof isDefault != "boolean") return invalidResponse("isDefault: expected a boolean.");
9352
+ if (permissionGroupName !== void 0 && permissionGroupName !== null && typeof permissionGroupName != "string") return invalidResponse("permissionGroupName: expected a string or null.");
9377
9353
  if (!candidate && status != "active" && status != "forbidden" && status != "invalid" && status != "missing") return invalidResponse();
9378
9354
  let bindingSource;
9379
9355
  try {
9380
9356
  bindingSource = parseProviderAccessSource(source.source);
9381
9357
  } catch {
9382
- return invalidResponse();
9358
+ return invalidResponse("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.");
9383
9359
  }
9384
9360
  return {
9385
9361
  accessBindingId: string$1(source.accessBindingId),
@@ -9395,11 +9371,11 @@ function accessBinding(value, candidate) {
9395
9371
  };
9396
9372
  }
9397
9373
  function accessMode(value) {
9398
- if (value != "implicit" && value != "selectable") return invalidResponse();
9374
+ if (value != "implicit" && value != "selectable") return invalidResponse("mode: expected implicit or selectable.");
9399
9375
  return value;
9400
9376
  }
9401
9377
  function connectorAccess(value) {
9402
- const source = record$2(value);
9378
+ const source = record$3(value);
9403
9379
  exact(source, [
9404
9380
  "accessRevision",
9405
9381
  "bindings",
@@ -9446,7 +9422,7 @@ function connectorAccess(value) {
9446
9422
  function accessGrants(value) {
9447
9423
  if (!Array.isArray(value)) return invalidResponse();
9448
9424
  const bindings = value.map((candidate) => {
9449
- const entry = record$2(candidate);
9425
+ const entry = record$3(candidate);
9450
9426
  exact(entry, [
9451
9427
  "accessBindingId",
9452
9428
  "connectionId",
@@ -9475,7 +9451,7 @@ function accessGrants(value) {
9475
9451
  return bindings;
9476
9452
  }
9477
9453
  function connectorAccessSnapshot(value) {
9478
- const source = record$2(value);
9454
+ const source = record$3(value);
9479
9455
  exact(source, [
9480
9456
  "mode",
9481
9457
  "sharedAccessDigest",
@@ -9497,17 +9473,19 @@ function connectorAccessSnapshot(value) {
9497
9473
  };
9498
9474
  }
9499
9475
  function connectorAccessCandidates(value, providerId) {
9500
- const source = record$2(value);
9476
+ const source = record$3(value);
9501
9477
  exact(source, [
9502
9478
  "candidates",
9503
9479
  "mode",
9504
9480
  "providerId",
9505
9481
  "version"
9506
9482
  ]);
9507
- if (source.version != 1 || string$1(source.providerId) != providerId || !Array.isArray(source.candidates)) return invalidResponse();
9483
+ if (source.version != 1) return invalidResponse("version: expected 1.");
9484
+ if (string$1(source.providerId) != providerId) return invalidResponse("providerId: does not match the requested provider.");
9485
+ if (!Array.isArray(source.candidates)) return invalidResponse("candidates: expected an array.");
9508
9486
  const candidates = source.candidates.map((candidate) => accessBinding(candidate, true));
9509
- if (candidates.some((candidate) => candidate.providerId != providerId)) return invalidResponse();
9510
- if (new Set(candidates.map((candidate) => candidate.accessBindingId)).size != candidates.length) return invalidResponse();
9487
+ if (candidates.some((candidate) => candidate.providerId != providerId)) return invalidResponse("candidates[].providerId: does not match the requested provider.");
9488
+ if (new Set(candidates.map((candidate) => candidate.accessBindingId)).size != candidates.length) return invalidResponse("candidates[].accessBindingId: duplicate IDs.");
9511
9489
  return {
9512
9490
  candidates,
9513
9491
  mode: accessMode(source.mode),
@@ -9516,17 +9494,18 @@ function connectorAccessCandidates(value, providerId) {
9516
9494
  };
9517
9495
  }
9518
9496
  function connectorAccessCandidatesBatch(value, providerIds) {
9519
- const source = record$2(value);
9497
+ const source = record$3(value);
9520
9498
  exact(source, ["results", "version"]);
9521
- if (source.version != 1 || !Array.isArray(source.results)) return invalidResponse();
9499
+ if (source.version != 1) return invalidResponse("version: expected 1.");
9500
+ if (!Array.isArray(source.results)) return invalidResponse("results: expected an array.");
9522
9501
  const remaining = new Set(providerIds);
9523
9502
  const results = source.results.map((entry) => {
9524
- const item = record$2(entry);
9503
+ const item = record$3(entry);
9525
9504
  const providerId = string$1(item.providerId);
9526
- if (!remaining.delete(providerId)) return invalidResponse();
9505
+ if (!remaining.delete(providerId)) return invalidResponse("results[].providerId: duplicate or unrequested provider.");
9527
9506
  if (!Object.hasOwn(item, "error")) return connectorAccessCandidates(item, providerId);
9528
9507
  exact(item, ["providerId", "error"]);
9529
- const error = record$2(item.error);
9508
+ const error = record$3(item.error);
9530
9509
  exact(error, ["code", "message"]);
9531
9510
  return {
9532
9511
  providerId,
@@ -9536,14 +9515,14 @@ function connectorAccessCandidatesBatch(value, providerIds) {
9536
9515
  }
9537
9516
  };
9538
9517
  });
9539
- if (remaining.size != 0) return invalidResponse();
9518
+ if (remaining.size != 0) return invalidResponse("results: missing requested providers.");
9540
9519
  return {
9541
9520
  results,
9542
9521
  version: 1
9543
9522
  };
9544
9523
  }
9545
9524
  function connection(value) {
9546
- const source = record$2(value);
9525
+ const source = record$3(value);
9547
9526
  exact(source, [
9548
9527
  ...Object.hasOwn(source, "providerAccountId") ? ["providerAccountId"] : [],
9549
9528
  ...Object.hasOwn(source, "alias") ? ["alias"] : [],
@@ -9570,7 +9549,7 @@ function connection(value) {
9570
9549
  };
9571
9550
  }
9572
9551
  function port(value, input = false) {
9573
- const source = record$2(value);
9552
+ const source = record$3(value);
9574
9553
  const description = source.description;
9575
9554
  const hasValue = input && Object.hasOwn(source, "value");
9576
9555
  exact(source, [
@@ -9592,10 +9571,10 @@ function inputPort(value) {
9592
9571
  return port(value, true);
9593
9572
  }
9594
9573
  function ports(value, decode) {
9595
- return Object.fromEntries(Object.entries(record$2(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9574
+ return Object.fromEntries(Object.entries(record$3(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9596
9575
  }
9597
9576
  function connectorActionMetadata(value) {
9598
- const source = record$2(value);
9577
+ const source = record$3(value);
9599
9578
  const homepageUrl = source.homepageUrl;
9600
9579
  const icon = source.icon;
9601
9580
  exact(source, [
@@ -9634,7 +9613,7 @@ function connectorActionMetadata(value) {
9634
9613
  };
9635
9614
  }
9636
9615
  function connectorAction(value) {
9637
- const { defaultConnection, ...metadata } = record$2(value);
9616
+ const { defaultConnection, ...metadata } = record$3(value);
9638
9617
  const action = connectorActionMetadata(metadata);
9639
9618
  if (defaultConnection == null) return action;
9640
9619
  const preferred = connection(defaultConnection);
@@ -9645,7 +9624,7 @@ function connectorAction(value) {
9645
9624
  };
9646
9625
  }
9647
9626
  function connectorProvider(value) {
9648
- const source = record$2(value);
9627
+ const source = record$3(value);
9649
9628
  const homepageUrl = source.homepageUrl;
9650
9629
  const icon = source.icon;
9651
9630
  if (source.noSetup !== void 0 && typeof source.noSetup != "boolean") return invalidResponse();
@@ -9734,7 +9713,7 @@ var configInputsSchema = array(union([strictObject({
9734
9713
  //#endregion
9735
9714
  //#region src/control/common/triggerDecoders.ts
9736
9715
  function triggerKeySummary(value) {
9737
- const source = record$2(value);
9716
+ const source = record$3(value);
9738
9717
  const type = source.type;
9739
9718
  if (type != "integration" && type != "poll") return invalidResponse();
9740
9719
  return {
@@ -9747,7 +9726,7 @@ function triggerKeySummary(value) {
9747
9726
  };
9748
9727
  }
9749
9728
  function triggerKey(value) {
9750
- const source = record$2(value);
9729
+ const source = record$3(value);
9751
9730
  const summary = triggerKeySummary(source);
9752
9731
  const base = {
9753
9732
  configInputs: configInputsSchema.parse(source.configInputs),
@@ -9757,7 +9736,7 @@ function triggerKey(value) {
9757
9736
  key: summary.key,
9758
9737
  name: summary.name,
9759
9738
  outputs: (Array.isArray(source.outputs) ? source.outputs : invalidResponse()).map((entry) => {
9760
- const port = record$2(entry);
9739
+ const port = record$3(entry);
9761
9740
  return Object.assign({
9762
9741
  handle: string$1(port.handle),
9763
9742
  jsonSchema: jsonValue(port.jsonSchema),
@@ -9770,8 +9749,8 @@ function triggerKey(value) {
9770
9749
  ...base,
9771
9750
  type: "poll"
9772
9751
  };
9773
- const endpoint = record$2(source.endpoint);
9774
- const body = record$2(endpoint.body);
9752
+ const endpoint = record$3(source.endpoint);
9753
+ const body = record$3(endpoint.body);
9775
9754
  if (!Array.isArray(endpoint.methods) || !Array.isArray(body.formats) || typeof body.allowArray != "boolean" || typeof body.allowEmpty != "boolean") return invalidResponse();
9776
9755
  const methods = endpoint.methods.map(string$1);
9777
9756
  const formats = body.formats.map(string$1);
@@ -9827,9 +9806,9 @@ var triggerActivityKinds = /* @__PURE__ */ new Set([
9827
9806
  "operator.resumed"
9828
9807
  ]);
9829
9808
  function triggerBinding(value) {
9830
- const source = record$2(value);
9809
+ const source = record$3(value);
9831
9810
  const health = source.health;
9832
- const listener = source.listener == null ? void 0 : record$2(source.listener);
9811
+ const listener = source.listener == null ? void 0 : record$3(source.listener);
9833
9812
  if (listener != null && listener.health != "healthy" && listener.health != "failed" && listener.health != "needs_reauth") return invalidResponse();
9834
9813
  const kind = source.kind;
9835
9814
  const operatorState = source.operatorState;
@@ -9858,7 +9837,7 @@ function triggerBinding(value) {
9858
9837
  };
9859
9838
  }
9860
9839
  function triggerBindingDetail(value) {
9861
- const source = record$2(value);
9840
+ const source = record$3(value);
9862
9841
  if (source.version != 1) return invalidResponse();
9863
9842
  return {
9864
9843
  binding: triggerBinding(source.binding),
@@ -9866,7 +9845,7 @@ function triggerBindingDetail(value) {
9866
9845
  };
9867
9846
  }
9868
9847
  function triggerActivity(value) {
9869
- const source = record$2(value);
9848
+ const source = record$3(value);
9870
9849
  const kind = source.kind;
9871
9850
  if (typeof kind != "string" || !triggerActivityKinds.has(kind)) return invalidResponse();
9872
9851
  const errorCode = optionalString(source.errorCode);
@@ -9881,7 +9860,7 @@ function triggerActivity(value) {
9881
9860
  };
9882
9861
  }
9883
9862
  function triggerActivityPage(value) {
9884
- const source = record$2(value);
9863
+ const source = record$3(value);
9885
9864
  const nextCursor = optionalString(source.nextCursor);
9886
9865
  if (source.version != 1 || !Array.isArray(source.activities)) return invalidResponse();
9887
9866
  return {
@@ -9891,12 +9870,12 @@ function triggerActivityPage(value) {
9891
9870
  };
9892
9871
  }
9893
9872
  function pollTriggerTestResult(value) {
9894
- const source = record$2(value);
9873
+ const source = record$3(value);
9895
9874
  const filtered = integer$1(source.filtered);
9896
9875
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.hasMore != "boolean" || filtered < 0) return invalidResponse();
9897
9876
  return {
9898
9877
  events: source.events.map((event) => {
9899
- const object = record$2(event);
9878
+ const object = record$3(event);
9900
9879
  return Object.fromEntries(Object.entries(object).map(([key, item]) => [key, jsonValue(item)]));
9901
9880
  }),
9902
9881
  filtered,
@@ -9907,7 +9886,7 @@ function pollTriggerTestResult(value) {
9907
9886
  //#endregion
9908
9887
  //#region src/control/common/triggerCatalog.ts
9909
9888
  function decodeTriggerCatalog(value) {
9910
- const source = record$2(value);
9889
+ const source = record$3(value);
9911
9890
  exact(source, [
9912
9891
  "version",
9913
9892
  "locale",
@@ -9916,12 +9895,12 @@ function decodeTriggerCatalog(value) {
9916
9895
  ]);
9917
9896
  if (source.version != 3 || !isUiLanguage(source.locale) || !Array.isArray(source.definitions)) return invalidResponse();
9918
9897
  const definitions = source.definitions.map(triggerKey);
9919
- const entries = record$2(source.display);
9898
+ const entries = record$3(source.display);
9920
9899
  const keys = new Set(definitions.map((definition) => definition.key));
9921
9900
  if (keys.size != definitions.length || Object.keys(entries).length != keys.size) return invalidResponse();
9922
9901
  const display = Object.fromEntries(definitions.map((definition) => {
9923
9902
  const { key } = definition;
9924
- const copy = record$2(entries[key]);
9903
+ const copy = record$3(entries[key]);
9925
9904
  exact(copy, [
9926
9905
  "configInputs",
9927
9906
  "configInputLabels",
@@ -9945,12 +9924,12 @@ function decodeTriggerCatalog(value) {
9945
9924
  };
9946
9925
  }
9947
9926
  function descriptions(value, handles) {
9948
- const source = record$2(value);
9927
+ const source = record$3(value);
9949
9928
  exact(source, handles);
9950
9929
  return Object.fromEntries(Object.entries(source).map(([handle, description]) => [handle, string$1(description)]));
9951
9930
  }
9952
9931
  function labels(value, handles) {
9953
- const source = record$2(value);
9932
+ const source = record$3(value);
9954
9933
  if (Object.keys(source).some((handle) => !handles.includes(handle))) return invalidResponse();
9955
9934
  return Object.fromEntries(Object.entries(source).map(([handle, label]) => {
9956
9935
  const text = string$1(label);
@@ -10023,7 +10002,7 @@ function schemaPath(value) {
10023
10002
  return value.map((part) => typeof part == "string" || Number.isSafeInteger(part) ? part : invalidResponse());
10024
10003
  }
10025
10004
  function schemaMismatch(value) {
10026
- const source = record$2(value);
10005
+ const source = record$3(value);
10027
10006
  const kind = string$1(source.kind);
10028
10007
  if (kind == "artifact" || kind == "binary" || kind == "nullable") return { kind };
10029
10008
  if (kind == "schema") return {
@@ -10040,8 +10019,8 @@ function schemaMismatch(value) {
10040
10019
  };
10041
10020
  }
10042
10021
  function diagnostic(value) {
10043
- const source = record$2(value);
10044
- const values = source.values == null ? void 0 : record$2(source.values);
10022
+ const source = record$3(value);
10023
+ const values = source.values == null ? void 0 : record$3(source.values);
10045
10024
  return {
10046
10025
  code: string$1(source.code),
10047
10026
  column: integer$1(source.column),
@@ -10054,7 +10033,7 @@ function diagnostic(value) {
10054
10033
  };
10055
10034
  }
10056
10035
  function flowCheck(value) {
10057
- const source = record$2(value);
10036
+ const source = record$3(value);
10058
10037
  if (source.version != 1 || typeof source.valid != "boolean" || !Array.isArray(source.diagnostics)) return invalidResponse();
10059
10038
  return {
10060
10039
  closureDigest: string$1(source.closureDigest),
@@ -10079,7 +10058,7 @@ function connectorProvidersQuery(flowId, locale) {
10079
10058
  return {
10080
10059
  path: `/v1/connector/providers${parameters ? `?${parameters}` : ""}`,
10081
10060
  decode: (value) => {
10082
- const source = record$2(value);
10061
+ const source = record$3(value);
10083
10062
  exact(source, ["providers", "version"]);
10084
10063
  if (source.version != 1 || !Array.isArray(source.providers)) return invalidResponse();
10085
10064
  return source.providers.map(connectorProvider);
@@ -10094,7 +10073,7 @@ function connectorActionQuery(actionId, flowId, locale) {
10094
10073
  return {
10095
10074
  path: `/v1/connector/actions/${encodeURIComponent(actionId)}${parameters ? `?${parameters}` : ""}`,
10096
10075
  decode: (value) => {
10097
- const source = record$2(value);
10076
+ const source = record$3(value);
10098
10077
  exact(source, ["action", "version"]);
10099
10078
  if (source.version != 1) return invalidResponse();
10100
10079
  return connectorAction(source.action);
@@ -10105,7 +10084,7 @@ function allConnectorConnectionsQuery(flowId) {
10105
10084
  return {
10106
10085
  path: `/v1/connector/connections${scope(flowId)}`,
10107
10086
  decode: (value) => {
10108
- const source = record$2(value);
10087
+ const source = record$3(value);
10109
10088
  exact(source, ["connections", "version"]);
10110
10089
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
10111
10090
  return source.connections.map(connection);
@@ -10116,7 +10095,7 @@ function connectorConnectionsQuery(serviceId, flowId) {
10116
10095
  return {
10117
10096
  path: `/v1/connector/connections/${encodeURIComponent(serviceId)}${scope(flowId)}`,
10118
10097
  decode: (value) => {
10119
- const source = record$2(value);
10098
+ const source = record$3(value);
10120
10099
  exact(source, [
10121
10100
  "connections",
10122
10101
  "serviceId",
@@ -10130,11 +10109,11 @@ function connectorConnectionsQuery(serviceId, flowId) {
10130
10109
  //#endregion
10131
10110
  //#region src/control/common/flowDecoders.ts
10132
10111
  function flow(value) {
10133
- const source = record$2(value);
10112
+ const source = record$3(value);
10134
10113
  const status = source.status;
10135
10114
  if (source.version != 1) return invalidResponse();
10136
10115
  if (status != "active" && status != "retiring") return invalidResponse();
10137
- const target = source.live == null ? void 0 : record$2(source.live);
10116
+ const target = source.live == null ? void 0 : record$3(source.live);
10138
10117
  if (target != null && typeof target.enabled != "boolean") return invalidResponse();
10139
10118
  return {
10140
10119
  ...target == null ? {} : { live: {
@@ -10153,7 +10132,7 @@ function flow(value) {
10153
10132
  };
10154
10133
  }
10155
10134
  function flowPage(value) {
10156
- const source = record$2(value);
10135
+ const source = record$3(value);
10157
10136
  if (source.version != 1 || !Array.isArray(source.flows)) return invalidResponse();
10158
10137
  const nextCursor = source.nextCursor;
10159
10138
  const total = source.total;
@@ -10167,7 +10146,7 @@ function flowPage(value) {
10167
10146
  };
10168
10147
  }
10169
10148
  function variable(value) {
10170
- const source = record$2(value);
10149
+ const source = record$3(value);
10171
10150
  exact(source, [
10172
10151
  "name",
10173
10152
  "updatedAt",
@@ -10189,7 +10168,7 @@ function variable(value) {
10189
10168
  };
10190
10169
  }
10191
10170
  function errorListener(value) {
10192
- const source = record$2(value);
10171
+ const source = record$3(value);
10193
10172
  if (typeof source.enabled != "boolean") return invalidResponse();
10194
10173
  return {
10195
10174
  flowId: string$1(source.flowId),
@@ -10202,8 +10181,8 @@ function errorListener(value) {
10202
10181
  //#endregion
10203
10182
  //#region src/control/common/publicationDecoders.ts
10204
10183
  function publication(value) {
10205
- const source = record$2(value);
10206
- const liveEnd = source.liveEnd == null ? void 0 : record$2(source.liveEnd);
10184
+ const source = record$3(value);
10185
+ const liveEnd = source.liveEnd == null ? void 0 : record$3(source.liveEnd);
10207
10186
  if (liveEnd != null && typeof liveEnd.enabled != "boolean") return invalidResponse();
10208
10187
  const operation = source.operation;
10209
10188
  const sourcePublicationId = source.sourcePublicationId;
@@ -10231,7 +10210,7 @@ function publication(value) {
10231
10210
  };
10232
10211
  }
10233
10212
  function publishOperation(value) {
10234
- const source = record$2(value);
10213
+ const source = record$3(value);
10235
10214
  const status = source.status;
10236
10215
  const common = {
10237
10216
  createdAt: string$1(source.createdAt),
@@ -10284,7 +10263,7 @@ function publishOperation(value) {
10284
10263
  "updatedAt",
10285
10264
  "version"
10286
10265
  ]);
10287
- const issue = record$2(source.issue);
10266
+ const issue = record$3(source.issue);
10288
10267
  const nodeId = issue.nodeId;
10289
10268
  exact(issue, [
10290
10269
  "code",
@@ -10305,7 +10284,7 @@ function publishOperation(value) {
10305
10284
  }
10306
10285
  }
10307
10286
  function live(value) {
10308
- const source = record$2(value);
10287
+ const source = record$3(value);
10309
10288
  const status = source.status;
10310
10289
  const candidate = source.publication;
10311
10290
  if (source.version != 1 || typeof source.hasUnpublishedChanges != "boolean") return invalidResponse();
@@ -10322,7 +10301,7 @@ function live(value) {
10322
10301
  };
10323
10302
  }
10324
10303
  function publicationPage(value) {
10325
- const source = record$2(value);
10304
+ const source = record$3(value);
10326
10305
  const nextCursor = source.nextCursor;
10327
10306
  const total = source.total;
10328
10307
  if (source.version != 1 || !Array.isArray(source.publications)) return invalidResponse();
@@ -10338,7 +10317,7 @@ function publicationPage(value) {
10338
10317
  //#endregion
10339
10318
  //#region src/control/common/revisionDecoders.ts
10340
10319
  function revisionMetadata(value) {
10341
- const source = record$2(value);
10320
+ const source = record$3(value);
10342
10321
  const parentRevisionId = source.parentRevisionId;
10343
10322
  if (source.version != 1 || parentRevisionId !== null && typeof parentRevisionId != "string") return invalidResponse();
10344
10323
  return {
@@ -10353,7 +10332,7 @@ function revisionMetadata(value) {
10353
10332
  };
10354
10333
  }
10355
10334
  function draft(value) {
10356
- const source = record$2(value);
10335
+ const source = record$3(value);
10357
10336
  try {
10358
10337
  return {
10359
10338
  ...revisionMetadata(source),
@@ -10364,17 +10343,17 @@ function draft(value) {
10364
10343
  }
10365
10344
  }
10366
10345
  function presentation(value) {
10367
- const source = record$2(value);
10346
+ const source = record$3(value);
10368
10347
  if (source.version != 1 || integer$1(source.revision) < 1) return invalidResponse();
10369
10348
  return {
10370
10349
  revision: integer$1(source.revision),
10371
10350
  updatedAt: string$1(source.updatedAt),
10372
- value: Object.fromEntries(Object.entries(record$2(source.value)).map(([key, item]) => [key, jsonValue(item)])),
10351
+ value: Object.fromEntries(Object.entries(record$3(source.value)).map(([key, item]) => [key, jsonValue(item)])),
10373
10352
  version: 1
10374
10353
  };
10375
10354
  }
10376
10355
  function draftChange(value) {
10377
- const source = record$2(value);
10356
+ const source = record$3(value);
10378
10357
  if (source.version != 1) return invalidResponse();
10379
10358
  return {
10380
10359
  revision: revisionMetadata(source.revision),
@@ -10382,7 +10361,7 @@ function draftChange(value) {
10382
10361
  };
10383
10362
  }
10384
10363
  function draftSync(value) {
10385
- const source = record$2(value);
10364
+ const source = record$3(value);
10386
10365
  if (source.version != 1 || source.kind != "snapshot") return invalidResponse();
10387
10366
  return {
10388
10367
  draft: draft(source.draft),
@@ -10408,7 +10387,7 @@ function runStatus(value) {
10408
10387
  return typeof value == "string" && runStatusSet.has(value) ? value : invalidResponse();
10409
10388
  }
10410
10389
  function run(value) {
10411
- const source = record$2(value);
10390
+ const source = record$3(value);
10412
10391
  const kind = source.source;
10413
10392
  const startedAt = source.startedAt;
10414
10393
  const finishedAt = source.finishedAt;
@@ -10428,7 +10407,7 @@ function run(value) {
10428
10407
  };
10429
10408
  }
10430
10409
  function runWaiting(value) {
10431
- const source = record$2(value);
10410
+ const source = record$3(value);
10432
10411
  exact(source, [
10433
10412
  "actions",
10434
10413
  "expiresAt",
@@ -10449,7 +10428,7 @@ function runWaiting(value) {
10449
10428
  };
10450
10429
  }
10451
10430
  function runDetails(value) {
10452
- const source = record$2(value);
10431
+ const source = record$3(value);
10453
10432
  const summary = run(source);
10454
10433
  const eventsExpiresAt = source.eventsExpiresAt;
10455
10434
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
@@ -10495,7 +10474,7 @@ function runDetails(value) {
10495
10474
  }
10496
10475
  }
10497
10476
  function runPage(value) {
10498
- const source = record$2(value);
10477
+ const source = record$3(value);
10499
10478
  const nextCursor = source.nextCursor;
10500
10479
  if (source.version != 1 || !Array.isArray(source.runs)) return invalidResponse();
10501
10480
  if (nextCursor != null && typeof nextCursor != "string") return invalidResponse();
@@ -10507,7 +10486,7 @@ function runPage(value) {
10507
10486
  };
10508
10487
  }
10509
10488
  function runCancellation(value) {
10510
- const source = record$2(value);
10489
+ const source = record$3(value);
10511
10490
  const status = runStatus(source.status);
10512
10491
  if (source.version != 1 || typeof source.cancelAccepted != "boolean" || status == "queued" || status == "starting" || status == "running" || status == "waiting") return invalidResponse();
10513
10492
  return {
@@ -10518,7 +10497,7 @@ function runCancellation(value) {
10518
10497
  };
10519
10498
  }
10520
10499
  function waitResolution(value) {
10521
- const source = record$2(value);
10500
+ const source = record$3(value);
10522
10501
  exact(source, [
10523
10502
  "action",
10524
10503
  "comment",
@@ -10544,7 +10523,7 @@ function waitResolution(value) {
10544
10523
  };
10545
10524
  }
10546
10525
  function runResult(value) {
10547
- const source = record$2(value);
10526
+ const source = record$3(value);
10548
10527
  const status = source.status;
10549
10528
  if (source.version != 1) return invalidResponse();
10550
10529
  const base = {
@@ -10565,7 +10544,7 @@ function runResult(value) {
10565
10544
  status: "canceled"
10566
10545
  };
10567
10546
  if (status == "failed") {
10568
- const error = record$2(source.error);
10547
+ const error = record$3(source.error);
10569
10548
  return {
10570
10549
  ...base,
10571
10550
  error: runFailure(error),
@@ -10573,7 +10552,7 @@ function runResult(value) {
10573
10552
  };
10574
10553
  }
10575
10554
  if (status == "indeterminate") {
10576
- const error = record$2(source.error);
10555
+ const error = record$3(source.error);
10577
10556
  return {
10578
10557
  ...base,
10579
10558
  error: runFailure(error),
@@ -10583,7 +10562,7 @@ function runResult(value) {
10583
10562
  return invalidResponse();
10584
10563
  }
10585
10564
  function errorHandling(source) {
10586
- const errorSource = source.errorSource == null ? void 0 : record$2(source.errorSource);
10565
+ const errorSource = source.errorSource == null ? void 0 : record$3(source.errorSource);
10587
10566
  if (source.errorDispatches != null && !Array.isArray(source.errorDispatches)) return invalidResponse();
10588
10567
  return {
10589
10568
  ...errorSource == null ? {} : { errorSource: {
@@ -10591,7 +10570,7 @@ function errorHandling(source) {
10591
10570
  runId: string$1(errorSource.runId)
10592
10571
  } },
10593
10572
  ...source.errorDispatches == null ? {} : { errorDispatches: source.errorDispatches.map((value) => {
10594
- const dispatch = record$2(value);
10573
+ const dispatch = record$3(value);
10595
10574
  const flowId = string$1(dispatch.flowId);
10596
10575
  switch (dispatch.status) {
10597
10576
  case "pending": return {
@@ -10643,14 +10622,14 @@ function randomId() {
10643
10622
  //#endregion
10644
10623
  //#region src/control/common/api.ts
10645
10624
  function decodeRunEvent(value) {
10646
- const source = record$2(value);
10625
+ const source = record$3(value);
10647
10626
  const sequence = integer$1(source.sequence);
10648
10627
  if (sequence < 0) return invalidResponse();
10649
10628
  const base = {
10650
10629
  createdAt: string$1(source.createdAt),
10651
10630
  sequence
10652
10631
  };
10653
- const payload = record$2(source.payload);
10632
+ const payload = record$3(source.payload);
10654
10633
  const kind = source.kind;
10655
10634
  switch (kind) {
10656
10635
  case "run.queued": return {
@@ -10736,7 +10715,7 @@ function decodeRunEvent(value) {
10736
10715
  switch (kind) {
10737
10716
  case "node.started": {
10738
10717
  const nodeKind = payload.nodeKind;
10739
- 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();
10718
+ 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();
10740
10719
  return {
10741
10720
  ...base,
10742
10721
  kind,
@@ -10753,11 +10732,11 @@ function decodeRunEvent(value) {
10753
10732
  kind,
10754
10733
  payload: {
10755
10734
  ...node,
10756
- outputs: Object.fromEntries(Object.entries(record$2(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
10735
+ outputs: Object.fromEntries(Object.entries(record$3(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
10757
10736
  }
10758
10737
  };
10759
10738
  case "node.failed": {
10760
- const error = record$2(payload.error);
10739
+ const error = record$3(payload.error);
10761
10740
  return {
10762
10741
  ...base,
10763
10742
  kind,
@@ -10792,7 +10771,7 @@ function decodeRunEvent(value) {
10792
10771
  }
10793
10772
  };
10794
10773
  case "node.artifact": {
10795
- const artifact = record$2(payload.artifact);
10774
+ const artifact = record$3(payload.artifact);
10796
10775
  const size = integer$1(artifact.size);
10797
10776
  const digest = string$1(artifact.digest);
10798
10777
  if (artifact.kind != "artifact" || size < 0 || !/^sha256:[0-9a-f]{64}$/.test(digest)) return invalidResponse();
@@ -10821,7 +10800,7 @@ function eventProgress(value) {
10821
10800
  return typeof value == "number" && Number.isFinite(value) && value >= 0 && value <= 100 ? value : invalidResponse();
10822
10801
  }
10823
10802
  function runEvents(value) {
10824
- const source = record$2(value);
10803
+ const source = record$3(value);
10825
10804
  const eventsExpiresAt = source.eventsExpiresAt;
10826
10805
  const nextAfter = integer$1(source.nextAfter);
10827
10806
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.done != "boolean" || typeof source.historyComplete != "boolean") return invalidResponse();
@@ -10846,7 +10825,7 @@ var ControlClient = class {
10846
10825
  this.requestControl = requestControl;
10847
10826
  }
10848
10827
  async loadOpenApiDocument(url, signal) {
10849
- const result = record$2(await this.request("/v1/openapi/document", {
10828
+ const result = record$3(await this.request("/v1/openapi/document", {
10850
10829
  method: "POST",
10851
10830
  body: JSON.stringify({
10852
10831
  url,
@@ -10869,7 +10848,7 @@ var ControlClient = class {
10869
10848
  return decodeEventSources(await this.request("/v1/event-sources" + (flowId == null ? "" : `?flowId=${segment(flowId)}`), { signal }));
10870
10849
  }
10871
10850
  async listEventSourceConnections(teamId, signal) {
10872
- const source = record$2(await this.request(`/v1/event-sources/connections${teamId == null ? "" : `?teamId=${segment(teamId)}`}`, { signal }));
10851
+ const source = record$3(await this.request(`/v1/event-sources/connections${teamId == null ? "" : `?teamId=${segment(teamId)}`}`, { signal }));
10873
10852
  exact(source, ["version", "connections"]);
10874
10853
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
10875
10854
  return source.connections.map(connection);
@@ -10896,7 +10875,7 @@ var ControlClient = class {
10896
10875
  });
10897
10876
  }
10898
10877
  async listVariables() {
10899
- const source = record$2(await this.request("/v1/variables"));
10878
+ const source = record$3(await this.request("/v1/variables"));
10900
10879
  exact(source, ["variables", "version"]);
10901
10880
  if (source.version != 1 || !Array.isArray(source.variables)) return invalidResponse();
10902
10881
  return {
@@ -10914,7 +10893,7 @@ var ControlClient = class {
10914
10893
  }));
10915
10894
  }
10916
10895
  async deleteVariable(name) {
10917
- const source = record$2(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
10896
+ const source = record$3(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
10918
10897
  exact(source, ["version"]);
10919
10898
  if (source.version != 1) return invalidResponse();
10920
10899
  }
@@ -10933,7 +10912,7 @@ var ControlClient = class {
10933
10912
  return flow(await this.request(`/v1/flows/${segment(flowId)}`));
10934
10913
  }
10935
10914
  async getErrorListeners(flowId, signal) {
10936
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
10915
+ const source = record$3(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
10937
10916
  if (source.version != 1 || !Array.isArray(source.listeners)) return invalidResponse();
10938
10917
  return source.listeners.map(errorListener);
10939
10918
  }
@@ -10950,12 +10929,12 @@ var ControlClient = class {
10950
10929
  return flow(await this.request(`/v1/flows/${segment(flowId)}`, { method: "DELETE" }));
10951
10930
  }
10952
10931
  async listTriggerKeys(signal, locale) {
10953
- const source = record$2(await this.request(`/v1/trigger-keys${locale == null ? "" : `?locale=${encodeURIComponent(locale)}`}`, { signal }));
10932
+ const source = record$3(await this.request(`/v1/trigger-keys${locale == null ? "" : `?locale=${encodeURIComponent(locale)}`}`, { signal }));
10954
10933
  if (source.version != 1 || !Array.isArray(source.keys)) return invalidResponse();
10955
10934
  return source.keys.map(triggerKeySummary);
10956
10935
  }
10957
10936
  async listTriggerDefinitions(signal) {
10958
- const source = record$2(await this.request("/v1/trigger-keys/catalog", { signal }));
10937
+ const source = record$3(await this.request("/v1/trigger-keys/catalog", { signal }));
10959
10938
  if (source.version != 2 || !Array.isArray(source.definitions)) return invalidResponse();
10960
10939
  return source.definitions.map(triggerKey);
10961
10940
  }
@@ -10997,12 +10976,12 @@ var ControlClient = class {
10997
10976
  };
10998
10977
  }
10999
10978
  async getTriggerKey(key, signal) {
11000
- const source = record$2(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
10979
+ const source = record$3(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
11001
10980
  if (source.version != 1) return invalidResponse();
11002
10981
  return triggerKey(source.definition);
11003
10982
  }
11004
10983
  async listFlowTriggerBindings(flowId, signal) {
11005
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/triggers`, { signal }));
10984
+ const source = record$3(await this.request(`/v1/flows/${segment(flowId)}/triggers`, { signal }));
11006
10985
  if (source.version != 1 || string$1(source.flowId) != flowId || !Array.isArray(source.bindings)) return invalidResponse();
11007
10986
  return source.bindings.map(triggerBinding);
11008
10987
  }
@@ -11035,7 +11014,7 @@ var ControlClient = class {
11035
11014
  }));
11036
11015
  }
11037
11016
  async getEditor(flowId) {
11038
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11017
+ const source = record$3(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11039
11018
  if (source.version != 1) return invalidResponse();
11040
11019
  const result = {
11041
11020
  flow: flow(source.flow),
@@ -11048,7 +11027,7 @@ var ControlClient = class {
11048
11027
  return result;
11049
11028
  }
11050
11029
  async getPublicationPresentation(flowId, publicationId, signal) {
11051
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/publications/${segment(publicationId)}/presentation`, { signal }));
11030
+ const source = record$3(await this.request(`/v1/flows/${segment(flowId)}/publications/${segment(publicationId)}/presentation`, { signal }));
11052
11031
  if (source.version != 1) return invalidResponse();
11053
11032
  return {
11054
11033
  version: 1,
@@ -11068,11 +11047,11 @@ var ControlClient = class {
11068
11047
  return draft(await this.request(`/v1/flows/${segment(flowId)}/revisions/${segment(revisionId)}`, { signal }));
11069
11048
  }
11070
11049
  async listTriggerConfigOptions(flowId, nodeId, field, signal) {
11071
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(nodeId)}/options/${segment(field)}`, { signal }));
11050
+ const source = record$3(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(nodeId)}/options/${segment(field)}`, { signal }));
11072
11051
  exact(source, ["options", "version"]);
11073
11052
  if (source.version != 1 || !Array.isArray(source.options) || source.options.length > 1e3) return invalidResponse();
11074
11053
  return source.options.map((value) => {
11075
- const item = record$2(value);
11054
+ const item = record$3(value);
11076
11055
  exact(item, [
11077
11056
  "value",
11078
11057
  "label",
@@ -11091,7 +11070,7 @@ var ControlClient = class {
11091
11070
  });
11092
11071
  }
11093
11072
  async listConnectorTeams(signal) {
11094
- const source = record$2(await this.request("/v1/connector/teams", { signal }));
11073
+ const source = record$3(await this.request("/v1/connector/teams", { signal }));
11095
11074
  exact(source, [
11096
11075
  "enabled",
11097
11076
  "teams",
@@ -11101,7 +11080,7 @@ var ControlClient = class {
11101
11080
  return {
11102
11081
  enabled: source.enabled,
11103
11082
  teams: source.teams.map((value) => {
11104
- const team = record$2(value);
11083
+ const team = record$3(value);
11105
11084
  exact(team, [
11106
11085
  "id",
11107
11086
  "name",
@@ -11208,7 +11187,7 @@ var ControlClient = class {
11208
11187
  const parameters = new URLSearchParams();
11209
11188
  if (flowId != null) parameters.set("flowId", flowId);
11210
11189
  if (teamId != null) parameters.set("teamId", teamId);
11211
- const source = record$2(await this.request(`/v1/connector/connections/${segment(serviceId)}/page${parameters.size == 0 ? "" : `?${parameters}`}`, {
11190
+ const source = record$3(await this.request(`/v1/connector/connections/${segment(serviceId)}/page${parameters.size == 0 ? "" : `?${parameters}`}`, {
11212
11191
  body: JSON.stringify({ version: 1 }),
11213
11192
  method: "POST"
11214
11193
  }));
@@ -11379,7 +11358,7 @@ var ControlClient = class {
11379
11358
  const query = Object.entries(parameters).map(([key, value]) => `${segment(key)}=${segment(value)}`).join("&");
11380
11359
  const suffix = query == "" ? "" : `?${query}`;
11381
11360
  return this.connectorRequest(`/v1/connector/actions${suffix}`, "actions", signal, (value) => {
11382
- const source = record$2(value);
11361
+ const source = record$3(value);
11383
11362
  exact(source, ["actions", "version"]);
11384
11363
  if (source.version != 1 || !Array.isArray(source.actions)) return invalidResponse();
11385
11364
  return source.actions.map(connectorAction);
@@ -11402,8 +11381,8 @@ var ControlClient = class {
11402
11381
  } catch {
11403
11382
  return invalidResponse();
11404
11383
  }
11405
- const error = record$2(value).error;
11406
- const source = error == null ? void 0 : record$2(error);
11384
+ const error = record$3(value).error;
11385
+ const source = error == null ? void 0 : record$3(error);
11407
11386
  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}.`);
11408
11387
  }
11409
11388
  return response;
@@ -11514,8 +11493,7 @@ function addValueNode(harness, flowId, revisionId, nodeId = "marker", changeId)
11514
11493
  value: true
11515
11494
  }]
11516
11495
  },
11517
- nodeId,
11518
- target: { kind: "flow" }
11496
+ nodeId
11519
11497
  }], changeId);
11520
11498
  }
11521
11499
  async function addManualTrigger(harness, flowId, revisionId) {
@@ -11525,8 +11503,7 @@ async function addManualTrigger(harness, flowId, revisionId) {
11525
11503
  kind: "manual",
11526
11504
  name: "Start"
11527
11505
  },
11528
- nodeId: "start",
11529
- target: { kind: "flow" }
11506
+ nodeId: "start"
11530
11507
  }]), 200, "Add manual trigger"), "Manual trigger Revision");
11531
11508
  }
11532
11509
  function changedRevisionId(change, message) {
@@ -11762,7 +11739,6 @@ var controlApiConformanceCases = [
11762
11739
  }],
11763
11740
  kind: "graph.node.values.set",
11764
11741
  nodeId: "marker",
11765
- target: { kind: "flow" },
11766
11742
  value: [{
11767
11743
  handle: "ready",
11768
11744
  jsonSchema: { type: "boolean" },
@@ -11891,7 +11867,6 @@ var controlApiConformanceCases = [
11891
11867
  {
11892
11868
  kind: "graph.node.create",
11893
11869
  nodeId: "other",
11894
- target: { kind: "flow" },
11895
11870
  node: {
11896
11871
  kind: "webhook",
11897
11872
  method: "POST",
@@ -11902,7 +11877,6 @@ var controlApiConformanceCases = [
11902
11877
  {
11903
11878
  kind: "graph.node.create",
11904
11879
  nodeId: "broken",
11905
- target: { kind: "flow" },
11906
11880
  node: {
11907
11881
  kind: "task",
11908
11882
  name: "Broken",
@@ -11917,7 +11891,6 @@ var controlApiConformanceCases = [
11917
11891
  },
11918
11892
  {
11919
11893
  kind: "graph.edge.connect",
11920
- target: { kind: "flow" },
11921
11894
  edge: {
11922
11895
  source: "other",
11923
11896
  target: "broken"
@@ -12101,15 +12074,13 @@ var controlApiConformanceCases = [
12101
12074
  name: "Approval",
12102
12075
  prompt: "Approve request 1?"
12103
12076
  },
12104
- nodeId: "approval",
12105
- target: { kind: "flow" }
12077
+ nodeId: "approval"
12106
12078
  }, {
12107
12079
  kind: "graph.edge.connect",
12108
12080
  edge: {
12109
12081
  source: "start",
12110
12082
  target: "approval"
12111
- },
12112
- target: { kind: "flow" }
12083
+ }
12113
12084
  }]), 200, "Create Wait"), "Wait Revision")}/runs`;
12114
12085
  const create = async (key, message) => json(await request(harness, runPath, {
12115
12086
  body: JSON.stringify({
@@ -12445,8 +12416,7 @@ var triggerControlApiConformanceCases = [{
12445
12416
  kind: "cron",
12446
12417
  name: "Scheduled"
12447
12418
  },
12448
- nodeId: "cron",
12449
- target: { kind: "flow" }
12419
+ nodeId: "cron"
12450
12420
  }, {
12451
12421
  kind: "graph.node.create",
12452
12422
  node: {
@@ -12455,8 +12425,7 @@ var triggerControlApiConformanceCases = [{
12455
12425
  method: "POST",
12456
12426
  name: "Incoming"
12457
12427
  },
12458
- nodeId: "webhook",
12459
- target: { kind: "flow" }
12428
+ nodeId: "webhook"
12460
12429
  }]), 200, "Create Trigger nodes"), "Trigger Revision");
12461
12430
  const publication = (await completePublish(harness, await publishRequest(harness, flowId, triggerRevisionId, null, "trigger-publication"), 202, "Publish Trigger Flow")).publication;
12462
12431
  const publicationId = requiredString(publication.publicationId, "Trigger Publication");
@@ -12499,8 +12468,7 @@ var triggerControlApiConformanceCases = [{
12499
12468
  await error(await request(harness, `${base}/cron/activities?cursor=${encodeURIComponent(cursor)}`), 400, "page.invalid-cursor", "Activity cursor belongs to one Trigger");
12500
12469
  await completePublish(harness, await publishRequest(harness, flowId, changedRevisionId(await json(await changeRequest(harness, flowId, triggerRevisionId, [{
12501
12470
  kind: "graph.node.delete",
12502
- nodeId: "webhook",
12503
- target: { kind: "flow" }
12471
+ nodeId: "webhook"
12504
12472
  }]), 200, "Delete Webhook"), "Retired Trigger Revision"), publicationId, "retire-trigger"), 202, "Publish retired Trigger");
12505
12473
  equal(record((await json(await request(harness, webhookPath), 200, "Read retired Webhook")).binding, "Retired Webhook").currentPublicationId, void 0, "Retired Publication");
12506
12474
  }
@@ -12899,7 +12867,6 @@ function pollControlApiConformanceCases(fixture) {
12899
12867
  const changed = await json(await changeRequest(harness, flow.flowId, flow.draftRevisionId, [{
12900
12868
  kind: "graph.node.create",
12901
12869
  nodeId: "poll",
12902
- target: { kind: "flow" },
12903
12870
  node: {
12904
12871
  kind: "poll",
12905
12872
  name: "Poll",