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

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 (51) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/{createResourceDialog-4H5_lZ6s.js → createResourceDialog-C23SBjYd.js} +2 -2
  3. package/dist/browser/flow-authoring-edge.d.ts +3 -3
  4. package/dist/browser/flow-authoring-node.d.ts +30 -46
  5. package/dist/browser/flow-authoring.js +9215 -21030
  6. package/dist/browser/flow-change-schema.d.ts +267 -1
  7. package/dist/browser/flow-change.d.ts +19 -104
  8. package/dist/browser/flow-change.js +154 -298
  9. package/dist/browser/{flowChanges-ZzG-f9cg.js → flowChanges-fBiAeTzR.js} +2347 -2216
  10. package/dist/browser/{flowWorkspace-ChpRaTMX.js → flowWorkspace-MqcEfg7T.js} +118 -293
  11. package/dist/browser/{icons-CdAB9wyS.js → icons-6oQ8Q9Wm.js} +4309 -4454
  12. package/dist/browser/lib-DrKav3HG.js +11403 -0
  13. package/dist/browser/preview.css +1 -1
  14. package/dist/browser/preview.js +9609 -9548
  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 +227 -417
  20. package/dist/browser/{workbenchSelect-BRZN4ish.js → workbenchSelect-DpLbIr29.js} +1 -1
  21. package/dist/common/authoring.d.ts +207 -0
  22. package/dist/common/authoringSchema.d.ts +1293 -0
  23. package/dist/common/control-api-conformance.js +1060 -623
  24. package/dist/common/control-api-errors.d.ts +2 -1
  25. package/dist/common/control-api.d.ts +87 -6
  26. package/dist/common/control-api.js +1058 -705
  27. package/dist/common/control-requests.d.ts +128 -0
  28. package/dist/common/control-requests.js +2913 -1145
  29. package/dist/common/decision.js +6337 -6371
  30. package/dist/common/flow-agent.d.ts +1 -1
  31. package/dist/common/flow-connectionUsage.d.ts +1 -2
  32. package/dist/common/flow-encoding.d.ts +2 -4
  33. package/dist/common/flow-encoding.js +131 -182
  34. package/dist/common/flow-graph.d.ts +10 -10
  35. package/dist/common/flow-semantics.d.ts +13 -9
  36. package/dist/common/flow-semantics.js +9051 -9232
  37. package/dist/common/flowInspection.d.ts +3 -21
  38. package/dist/common/integration-trigger.js +8653 -8687
  39. package/dist/common/lib-DrKav3HG.js +11403 -0
  40. package/dist/common/mcp.d.ts +120 -12
  41. package/dist/common/mcp.js +537 -188
  42. package/dist/common/openapi.js +6337 -6371
  43. package/dist/common/poll-trigger.js +8653 -8687
  44. package/dist/common/run-events.js +0 -1
  45. package/dist/common/scheduler.d.ts +3 -9
  46. package/dist/common/scheduler.js +128 -209
  47. package/dist/common/webhook-trigger.js +6337 -6371
  48. package/package.json +7 -1
  49. package/skills/open-flow/SKILL.md +32 -0
  50. package/skills/open-flow/references/flow-authoring.md +356 -0
  51. package/skills/open-flow/references/flow-n8n-conversion.md +196 -0
@@ -1,173 +1,3 @@
1
- //#region src/control/common/providerIconSprite.ts
2
- /** Optional artwork must never make an otherwise usable catalog unavailable. */
3
- function providerIconAppearance(metadata, position) {
4
- if (!metadata || typeof metadata != "object" || !position || typeof position != "object") return {};
5
- const m = metadata;
6
- const p = position;
7
- if (typeof m.version != "string" || ![
8
- m.pixelRatio,
9
- m.iconSize,
10
- m.width,
11
- m.height
12
- ].every((v) => Number.isInteger(v) && v > 0) || ![
13
- m.bleed,
14
- p.x,
15
- p.y
16
- ].every((v) => Number.isInteger(v) && v >= 0) || p.x + m.iconSize > m.width || p.y + m.iconSize > m.height) return {};
17
- try {
18
- for (const url of [m.lightUrl, m.darkUrl]) if (typeof url != "string" || ![
19
- "https:",
20
- "http:",
21
- "data:"
22
- ].includes(new URL(url).protocol)) return {};
23
- } catch {
24
- return {};
25
- }
26
- return {
27
- iconSprite: m,
28
- iconSpritePosition: {
29
- x: p.x,
30
- y: p.y
31
- }
32
- };
33
- }
34
- //#endregion
35
- //#region src/control/common/errors.ts
36
- var controlErrorCode = {
37
- authenticationRequired: "authentication.required",
38
- authorizationDenied: "authorization.denied",
39
- bindingUnresolved: "binding.unresolved",
40
- connectorActionNotFound: "connector.action-not-found",
41
- connectorAccessConflict: "connector.access-conflict",
42
- connectorAccessInvalid: "connector.access-invalid",
43
- connectorAccessRequired: "connector.access-required",
44
- connectorAccessUnsupported: "connector.access-unsupported",
45
- connectorUnconfigured: "connector.unconfigured",
46
- connectorUnavailable: "connector.unavailable",
47
- connectorConsoleUnconfigured: "connector.console-unconfigured",
48
- engineUnavailable: "engine.unavailable",
49
- engineUnsupported: "engine.unsupported",
50
- eventSourceInvalid: "event-source.invalid",
51
- eventSourceIdentityUnavailable: "event-source.identity-unavailable",
52
- eventSourceNotFound: "event-source.not-found",
53
- eventSourceConflict: "event-source.conflict",
54
- flowInvalid: "flow.invalid",
55
- flowRepairRequired: "flow.repair-required",
56
- flowUpgradeRequired: "flow.upgrade-required",
57
- flowNotFound: "flow.not-found",
58
- flowBusy: "flow.busy",
59
- flowConflict: "flow.conflict",
60
- flowPresentationConflict: "flow.presentation-conflict",
61
- flowRevisionConflict: "flow.revision-conflict",
62
- liveConflict: "live.conflict",
63
- liveNotFound: "live.not-found",
64
- pageInvalidCursor: "page.invalid-cursor",
65
- publicationConflict: "publication.conflict",
66
- publicationNotFound: "publication.not-found",
67
- publicationUnsupported: "publication.unsupported",
68
- publishOperationNotFound: "publication.operation-not-found",
69
- routeNotFound: "route.not-found",
70
- runConflict: "run.conflict",
71
- runEventsExpired: "run.events-expired",
72
- runInvalid: "run.invalid",
73
- runNotFound: "run.not-found",
74
- runNotTerminal: "run.not-terminal",
75
- runOverloaded: "run.overloaded",
76
- runWaitNotFound: "run.wait-not-found",
77
- triggerKeyInvalid: "trigger-key.invalid",
78
- triggerKeyNotFound: "trigger-key.not-found",
79
- triggerNotFound: "trigger.not-found",
80
- variableInvalid: "variable.invalid",
81
- variableLimitReached: "variable.limit-reached",
82
- variableNotFound: "variable.not-found"
83
- };
84
- var controlErrorMetadata = {
85
- [controlErrorCode.eventSourceInvalid]: { status: 400 },
86
- [controlErrorCode.eventSourceIdentityUnavailable]: { status: 409 },
87
- [controlErrorCode.eventSourceNotFound]: { status: 404 },
88
- [controlErrorCode.eventSourceConflict]: { status: 409 },
89
- [controlErrorCode.authenticationRequired]: { status: 401 },
90
- [controlErrorCode.authorizationDenied]: { status: 403 },
91
- [controlErrorCode.bindingUnresolved]: { status: 409 },
92
- [controlErrorCode.connectorActionNotFound]: { status: 404 },
93
- [controlErrorCode.connectorAccessConflict]: { status: 412 },
94
- [controlErrorCode.connectorAccessInvalid]: { status: 409 },
95
- [controlErrorCode.connectorAccessRequired]: { status: 409 },
96
- [controlErrorCode.connectorAccessUnsupported]: { status: 409 },
97
- [controlErrorCode.connectorUnconfigured]: { status: 503 },
98
- [controlErrorCode.connectorUnavailable]: { status: 503 },
99
- [controlErrorCode.connectorConsoleUnconfigured]: { status: 503 },
100
- [controlErrorCode.engineUnavailable]: { status: 503 },
101
- [controlErrorCode.engineUnsupported]: { status: 409 },
102
- [controlErrorCode.flowInvalid]: { status: 400 },
103
- [controlErrorCode.flowRepairRequired]: { status: 409 },
104
- [controlErrorCode.flowUpgradeRequired]: { status: 409 },
105
- [controlErrorCode.flowNotFound]: { status: 404 },
106
- [controlErrorCode.flowBusy]: { status: 409 },
107
- [controlErrorCode.flowConflict]: { status: 409 },
108
- [controlErrorCode.flowPresentationConflict]: { status: 412 },
109
- [controlErrorCode.flowRevisionConflict]: { status: 412 },
110
- [controlErrorCode.liveConflict]: { status: 412 },
111
- [controlErrorCode.liveNotFound]: { status: 404 },
112
- [controlErrorCode.pageInvalidCursor]: { status: 400 },
113
- [controlErrorCode.publicationConflict]: { status: 409 },
114
- [controlErrorCode.publicationNotFound]: { status: 404 },
115
- [controlErrorCode.publicationUnsupported]: { status: 409 },
116
- [controlErrorCode.publishOperationNotFound]: { status: 404 },
117
- [controlErrorCode.routeNotFound]: { status: 404 },
118
- [controlErrorCode.runConflict]: { status: 409 },
119
- [controlErrorCode.runEventsExpired]: { status: 410 },
120
- [controlErrorCode.runInvalid]: { status: 400 },
121
- [controlErrorCode.runNotFound]: { status: 404 },
122
- [controlErrorCode.runNotTerminal]: { status: 409 },
123
- [controlErrorCode.runOverloaded]: { status: 429 },
124
- [controlErrorCode.runWaitNotFound]: { status: 404 },
125
- [controlErrorCode.triggerKeyInvalid]: { status: 409 },
126
- [controlErrorCode.triggerKeyNotFound]: { status: 404 },
127
- [controlErrorCode.triggerNotFound]: { status: 404 },
128
- [controlErrorCode.variableInvalid]: { status: 400 },
129
- [controlErrorCode.variableLimitReached]: { status: 409 },
130
- [controlErrorCode.variableNotFound]: { status: 404 }
131
- };
132
- var ApiError = class extends Error {
133
- constructor(status, code, message) {
134
- super(message);
135
- this.code = code;
136
- this.name = "ApiError";
137
- this.status = status;
138
- }
139
- };
140
- //#endregion
141
- //#region src/control/common/decoding.ts
142
- function invalidResponse() {
143
- throw new ApiError(502, "response.invalid", "The Control API returned an invalid response.");
144
- }
145
- function record$1(value) {
146
- if (value == null || typeof value != "object" || Array.isArray(value)) return invalidResponse();
147
- return value;
148
- }
149
- function string$1(value) {
150
- return typeof value == "string" && value.length > 0 ? value : invalidResponse();
151
- }
152
- function exact(value, keys) {
153
- const actual = Object.keys(value);
154
- if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) invalidResponse();
155
- }
156
- function integer$1(value) {
157
- return Number.isSafeInteger(value) ? value : invalidResponse();
158
- }
159
- function jsonValue(value) {
160
- if (value === null || typeof value == "boolean" || typeof value == "string") return value;
161
- if (typeof value == "number" && Number.isFinite(value)) return value;
162
- if (Array.isArray(value)) return value.map(jsonValue);
163
- const source = record$1(value);
164
- return Object.fromEntries(Object.entries(source).map(([key, item]) => [key, jsonValue(item)]));
165
- }
166
- function optionalString(value) {
167
- if (value == null) return;
168
- return string$1(value);
169
- }
170
- //#endregion
171
1
  //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/util.js
172
2
  function getEnumValues(entries) {
173
3
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -1200,7 +1030,7 @@ function datetime(args) {
1200
1030
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1201
1031
  }
1202
1032
  var anyString = /^[\s\S]{0,}$/;
1203
- var integer = /^-?\d+$/;
1033
+ var integer$1 = /^-?\d+$/;
1204
1034
  var number$1 = /^-?\d+(?:\.\d+)?$/;
1205
1035
  var boolean$1 = /^(?:true|false)$/i;
1206
1036
  var _null$2 = /^null$/i;
@@ -2950,6 +2780,9 @@ function handlePipeResult(left, next, ctx) {
2950
2780
  issues: left.issues
2951
2781
  }, ctx);
2952
2782
  }
2783
+ var $ZodPreprocess = /*@__PURE__*/ $constructor("$ZodPreprocess", (inst, def) => {
2784
+ $ZodPipe.init(inst, def);
2785
+ });
2953
2786
  var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2954
2787
  $ZodType.init(inst, def);
2955
2788
  defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
@@ -4684,7 +4517,7 @@ function stringifyKeyNames(bySchema, json, visited) {
4684
4517
  else if (typeof rest.const === "number") rest.const = String(rest.const);
4685
4518
  if (!numericType) return rest;
4686
4519
  rest.type = "string";
4687
- if (!values) rest.pattern = (types.includes("number") ? number$1 : integer).source;
4520
+ if (!values) rest.pattern = (types.includes("number") ? number$1 : integer$1).source;
4688
4521
  return rest;
4689
4522
  }
4690
4523
  /** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */
@@ -5217,7 +5050,7 @@ var ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
5217
5050
  return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
5218
5051
  }
5219
5052
  });
5220
- function string(params) {
5053
+ function string$1(params) {
5221
5054
  return /* @__PURE__ */ _string(ZodString, params);
5222
5055
  }
5223
5056
  var ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
@@ -5565,10 +5398,10 @@ var ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
5565
5398
  inst.keyType = def.keyType;
5566
5399
  inst.valueType = def.valueType;
5567
5400
  });
5568
- function record(keyType, valueType, params) {
5401
+ function record$2(keyType, valueType, params) {
5569
5402
  if (!valueType || !valueType._zod) return new ZodRecord({
5570
5403
  type: "record",
5571
- keyType: string(),
5404
+ keyType: string$1(),
5572
5405
  valueType: keyType,
5573
5406
  ...normalizeParams(valueType)
5574
5407
  });
@@ -5774,6 +5607,10 @@ function pipe(in_, out) {
5774
5607
  out
5775
5608
  });
5776
5609
  }
5610
+ var ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
5611
+ ZodPipe.init(inst, def);
5612
+ $ZodPreprocess.init(inst, def);
5613
+ });
5777
5614
  var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
5778
5615
  $ZodReadonly.init(inst, def);
5779
5616
  ZodType.init(inst, def);
@@ -5809,27 +5646,25 @@ function refine(fn, _params = {}) {
5809
5646
  function superRefine(fn, params) {
5810
5647
  return /* @__PURE__ */ _superRefine(fn, params);
5811
5648
  }
5812
- function json$2(params) {
5649
+ function json$3(params) {
5813
5650
  const jsonSchema = lazy(() => {
5814
5651
  return union([
5815
- string(params),
5652
+ string$1(params),
5816
5653
  number(),
5817
5654
  boolean(),
5818
5655
  _null(),
5819
5656
  array(jsonSchema),
5820
- record(string(), jsonSchema)
5657
+ record$2(string$1(), jsonSchema)
5821
5658
  ]);
5822
5659
  });
5823
5660
  return jsonSchema;
5824
5661
  }
5825
- //#endregion
5826
- //#region src/openapi/common/authBindings.ts
5827
- /** Never allow credentials to enter a Revision as literal node inputs. */
5828
- 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.");
5832
- }
5662
+ function preprocess(fn, schema) {
5663
+ return new ZodPreprocess({
5664
+ type: "pipe",
5665
+ in: transform(fn),
5666
+ out: schema
5667
+ });
5833
5668
  }
5834
5669
  //#endregion
5835
5670
  //#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
@@ -5856,6 +5691,65 @@ function dequal(foo, bar) {
5856
5691
  return foo !== foo && bar !== bar;
5857
5692
  }
5858
5693
  //#endregion
5694
+ //#region src/openapi/common/authBindings.ts
5695
+ /** Never allow credentials to enter a Revision as literal node inputs. */
5696
+ function assertOpenApiAuthBindings(document) {
5697
+ for (const node of Object.values(document.graph.nodes)) {
5698
+ if (node.kind != "task" || !("executor" in node.task) || node.task.executor.kind != "openapi") continue;
5699
+ 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.");
5700
+ }
5701
+ }
5702
+ //#endregion
5703
+ //#region src/flow/common/condition.ts
5704
+ var unaryOperator = (operator) => operator.startsWith("is");
5705
+ var operandHandle = (caseIndex, groupIndex, expressionIndex, side) => `${caseIndex}/${groupIndex}/${expressionIndex}/${side}`;
5706
+ /** Derived addresses let operand bindings use the ordinary input analysis and editor. Never persisted as node inputs. */
5707
+ function conditionOperands(node) {
5708
+ return node.cases.flatMap((item, c) => item.groups.flatMap((group, g) => group.expressions.flatMap((expression, e) => [{
5709
+ handle: operandHandle(c, g, e, "left"),
5710
+ operand: expression.left,
5711
+ expression,
5712
+ side: "left"
5713
+ }, ...!unaryOperator(expression.operator) ? [{
5714
+ handle: operandHandle(c, g, e, "right"),
5715
+ operand: expression.right ?? { kind: "value" },
5716
+ expression,
5717
+ side: "right"
5718
+ }] : []])));
5719
+ }
5720
+ function conditionInputPorts(node) {
5721
+ return Object.fromEntries(conditionOperands(node).map(({ handle, operand }) => [handle, {
5722
+ jsonSchema: operand.kind === "value" ? operand.jsonSchema ?? {} : {},
5723
+ nullable: operand.kind === "value" ? operand.value === null : true
5724
+ }]));
5725
+ }
5726
+ //#endregion
5727
+ //#region src/flow/common/change.ts
5728
+ var schemaKeywords = /* @__PURE__ */ new Set([
5729
+ "const",
5730
+ "enum",
5731
+ "exclusiveMaximum",
5732
+ "exclusiveMinimum",
5733
+ "maximum",
5734
+ "maxItems",
5735
+ "maxLength",
5736
+ "maxProperties",
5737
+ "minimum",
5738
+ "minItems",
5739
+ "minLength",
5740
+ "minProperties",
5741
+ "multipleOf",
5742
+ "pattern",
5743
+ "required",
5744
+ "type"
5745
+ ]);
5746
+ function isSchemaKeyword(value) {
5747
+ return schemaKeywords.has(value);
5748
+ }
5749
+ function portsByHandle(ports) {
5750
+ return Object.fromEntries(ports.flatMap((port) => "handle" in port ? [[port.handle, port]] : []));
5751
+ }
5752
+ //#endregion
5859
5753
  //#region src/json-schema-subset/utils.ts
5860
5754
  var nextId = 0;
5861
5755
  function createId() {
@@ -6275,7 +6169,7 @@ var ExpressionKind = Object.freeze({
6275
6169
  });
6276
6170
  //#endregion
6277
6171
  //#region src/json-schema-subset/expression/expression.ts
6278
- var expression = (delegate) => (e1, e2) => {
6172
+ var expression$1 = (delegate) => (e1, e2) => {
6279
6173
  const rootNode = {
6280
6174
  parent: null,
6281
6175
  swapped: false,
@@ -8263,7 +8157,7 @@ function checkWithResult(extendsContext, schema1, schema2) {
8263
8157
  const describe = describer();
8264
8158
  const equals = schemaEqualsChecker(extendsContext);
8265
8159
  context.isEquals = wrapEqualsCheckerWithCache(isDeepEquals);
8266
- context.calculate = expression({
8160
+ context.calculate = expression$1({
8267
8161
  describe,
8268
8162
  equals,
8269
8163
  calculate,
@@ -8502,7 +8396,7 @@ var isObject = (x) => x !== null && typeof x === "object";
8502
8396
  var isPlainObject = (x) => isObject(x) && !isArray(x);
8503
8397
  var toPlainObject = (x) => isPlainObject(x) ? x : void 0;
8504
8398
  //#endregion
8505
- //#region src/manifest/common/schemaComparer.ts
8399
+ //#region src/flow/common/schemaComparer.ts
8506
8400
  function isStringLikeSchema(value) {
8507
8401
  return toPlainObject(value)?.type === "string";
8508
8402
  }
@@ -8709,8 +8603,8 @@ function checkJsonDepth(value, depth = 0) {
8709
8603
  //#region src/flow/common/triggerScheduleSchema.ts
8710
8604
  var triggerScheduleSchema = array(union([object({
8711
8605
  type: literal("cron"),
8712
- expression: string(),
8713
- timezone: string()
8606
+ expression: string$1(),
8607
+ timezone: string$1()
8714
8608
  }), object({
8715
8609
  type: literal("every"),
8716
8610
  unit: _enum([
@@ -8734,47 +8628,38 @@ var webhookMethods = [
8734
8628
  function webhookSupportsBody(method) {
8735
8629
  return method !== "GET";
8736
8630
  }
8737
- var text = string();
8738
- var json$1 = json$2();
8739
- var strings = array(text);
8631
+ var text = string$1();
8632
+ var json$2 = json$3();
8633
+ var strings$1 = array(text);
8740
8634
  var port$1 = object({
8741
8635
  description: text.optional(),
8742
- jsonSchema: json$1,
8636
+ jsonSchema: json$2,
8743
8637
  nullable: boolean(),
8744
8638
  handle: text
8745
8639
  });
8746
- var input = port$1.extend({ value: json$1.optional() });
8640
+ var input = port$1.extend({ value: json$2.optional() });
8747
8641
  var group = object({
8748
8642
  collapsed: boolean().optional(),
8749
8643
  group: text
8750
8644
  });
8751
- var nodeSource = object({
8645
+ var source = union([object({
8752
8646
  kind: literal("node"),
8753
8647
  nodeId: text,
8754
8648
  output: text,
8755
8649
  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
- ]);
8650
+ }), object({
8651
+ kind: literal("binding"),
8652
+ bindingId: text
8653
+ })]);
8769
8654
  var fixedInput = union([object({ kind: literal("unset") }), object({
8770
8655
  kind: literal("value"),
8771
- value: json$1
8656
+ value: json$2
8772
8657
  })]);
8773
8658
  var mapping = union([fixedInput, object({
8774
8659
  kind: literal("sources"),
8775
8660
  sources: array(source)
8776
8661
  })]);
8777
- var inputs = record(text, mapping);
8662
+ var inputs = record$2(text, mapping);
8778
8663
  var ports$1 = {
8779
8664
  inputs: array(union([input, group])),
8780
8665
  outputs: array(union([port$1, group]))
@@ -8819,7 +8704,7 @@ var inline = object({
8819
8704
  });
8820
8705
  var agentValue = union([object({
8821
8706
  kind: literal("value"),
8822
- value: json$1
8707
+ value: json$2
8823
8708
  }), object({
8824
8709
  kind: literal("input"),
8825
8710
  input: text
@@ -8848,10 +8733,10 @@ var decisionQuestion = discriminatedUnion("type", [
8848
8733
  name: text,
8849
8734
  instructions: text,
8850
8735
  type: literal("score"),
8851
- criteria: strings
8736
+ criteria: strings$1
8852
8737
  })
8853
8738
  ]);
8854
- var managed = object({
8739
+ var managedFields = object({
8855
8740
  ...ports$1,
8856
8741
  name: text,
8857
8742
  executor: union([
@@ -8866,7 +8751,7 @@ var managed = object({
8866
8751
  method: text,
8867
8752
  path: text,
8868
8753
  serverUrl: text,
8869
- document: json$1,
8754
+ document: json$2,
8870
8755
  auth: array(object({
8871
8756
  id: text,
8872
8757
  type: _enum([
@@ -8902,17 +8787,20 @@ var managed = object({
8902
8787
  inputs: array(input.extend({ source: agentInput }))
8903
8788
  })),
8904
8789
  notification: object({
8905
- taskId: text,
8790
+ action: text,
8791
+ connectionId: text.optional(),
8792
+ inputDefinitions: array(input),
8906
8793
  messageHandle: text,
8907
- inputs: record(text, agentValue)
8794
+ inputs: record$2(text, agentValue)
8908
8795
  }).optional()
8909
8796
  })
8910
8797
  ])
8911
- }).transform(limitDecisionTask);
8912
- var operand = union([object({
8798
+ });
8799
+ var managed = managedFields.transform(limitDecisionTask);
8800
+ var operand$1 = union([object({
8913
8801
  kind: literal("value"),
8914
- value: json$1.optional(),
8915
- jsonSchema: json$1.optional()
8802
+ value: json$2.optional(),
8803
+ jsonSchema: json$2.optional()
8916
8804
  }), object({
8917
8805
  kind: literal("source"),
8918
8806
  source
@@ -8923,7 +8811,7 @@ var condition = {
8923
8811
  description: text.optional(),
8924
8812
  output: text,
8925
8813
  groups: array(object({ expressions: array(object({
8926
- left: operand,
8814
+ left: operand$1,
8927
8815
  operator: _enum([
8928
8816
  "!=",
8929
8817
  "<",
@@ -8946,7 +8834,7 @@ var condition = {
8946
8834
  "notHasValue",
8947
8835
  "startsWith"
8948
8836
  ]),
8949
- right: operand.optional()
8837
+ right: operand$1.optional()
8950
8838
  })) }))
8951
8839
  }))
8952
8840
  };
@@ -8956,10 +8844,10 @@ var wait = {
8956
8844
  };
8957
8845
  var webhookOptions = object({
8958
8846
  allowedMethods: never().optional(),
8959
- allowedOrigins: strings.optional(),
8847
+ allowedOrigins: strings$1.optional(),
8960
8848
  noResponseBody: never().optional(),
8961
8849
  responseData: text.optional(),
8962
- responseHeaders: record(text, text).optional(),
8850
+ responseHeaders: record$2(text, text).optional(),
8963
8851
  responseStatusCode: number().int().min(200).max(599).optional()
8964
8852
  });
8965
8853
  var webhook = {
@@ -9015,7 +8903,7 @@ var base = {
9015
8903
  var node = union([
9016
8904
  object({
9017
8905
  ...base,
9018
- inputs: record(text, never()),
8906
+ inputs: record$2(text, never()),
9019
8907
  kind: literal("condition"),
9020
8908
  ...condition
9021
8909
  }),
@@ -9025,21 +8913,10 @@ var node = union([
9025
8913
  kind: literal("value"),
9026
8914
  values: array(input)
9027
8915
  }),
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
8916
  object({
9040
8917
  ...base,
9041
8918
  kind: literal("task"),
9042
- taskId: text,
8919
+ task: union([inline, managed]),
9043
8920
  additionalInputs: array(input).optional()
9044
8921
  }),
9045
8922
  strictObject({
@@ -9075,7 +8952,7 @@ var node = union([
9075
8952
  ...trigger,
9076
8953
  kind: literal("poll"),
9077
8954
  connectionId: text.min(1).optional(),
9078
- config: record(text, fixedInput),
8955
+ config: record$2(text, fixedInput),
9079
8956
  definition: object({
9080
8957
  ...definition,
9081
8958
  type: literal("poll")
@@ -9086,7 +8963,7 @@ var node = union([
9086
8963
  ...trigger,
9087
8964
  kind: literal("integration"),
9088
8965
  connectionId: text.min(1).optional(),
9089
- config: record(text, fixedInput),
8966
+ config: record$2(text, fixedInput),
9090
8967
  definition: object({
9091
8968
  ...definition,
9092
8969
  type: literal("integration"),
@@ -9094,10 +8971,25 @@ var node = union([
9094
8971
  })
9095
8972
  })
9096
8973
  ]);
9097
- var target = union([object({ kind: literal("flow") }), object({
9098
- kind: literal("subflow"),
9099
- id: text
9100
- })]);
8974
+ /** Configuration schemas shared by the node authoring boundary. */
8975
+ var authoringDefinitionSchemas = {
8976
+ input,
8977
+ port: port$1,
8978
+ ports: ports$1,
8979
+ condition: strictObject(condition),
8980
+ wait: strictObject(wait),
8981
+ webhook: strictObject(webhook),
8982
+ schedule: triggerScheduleSchema,
8983
+ capabilities: array(capability),
8984
+ connector: managedFields.shape.executor.options[0].omit({ kind: true }).strict(),
8985
+ openapi: managedFields.shape.executor.options[1].omit({ kind: true }).strict(),
8986
+ decision: managedFields.shape.executor.options[2].omit({ kind: true }).strict(),
8987
+ llm: managedFields.shape.executor.options[3].omit({ kind: true }).strict(),
8988
+ agent: managedFields.shape.executor.options[4].omit({
8989
+ kind: true,
8990
+ notification: true
8991
+ }).strict()
8992
+ };
9101
8993
  var edge = object({
9102
8994
  source: text,
9103
8995
  target: text,
@@ -9105,15 +8997,10 @@ var edge = object({
9105
8997
  });
9106
8998
  var at = {
9107
8999
  nodeId: text,
9108
- target
9000
+ target: never().optional()
9109
9001
  };
9110
- var subflow = object({
9111
- name: text,
9112
- inputs: array(input),
9113
- outputs: array(port$1.extend({ sources: array(union([nodeSource, flowSource])) }))
9114
- });
9115
9002
  var graph = object({
9116
- nodes: record(text, node),
9003
+ nodes: record$2(text, node),
9117
9004
  edges: array(edge).default([])
9118
9005
  });
9119
9006
  var binding = object({
@@ -9122,32 +9009,43 @@ var binding = object({
9122
9009
  });
9123
9010
  var module = object({
9124
9011
  name: text,
9125
- imports: strings,
9012
+ imports: strings$1,
9126
9013
  source: text
9127
9014
  });
9128
- var document = object({
9129
- bindings: record(text, binding),
9130
- graph,
9131
- subflows: record(text, subflow.extend({ graph })),
9132
- tasks: record(text, managed)
9133
- });
9015
+ var document = preprocess(rejectRetiredDefinitions, object({
9016
+ bindings: record$2(text, binding),
9017
+ graph
9018
+ }));
9134
9019
  var revision = object({
9135
9020
  modelVersion: union([
9136
9021
  literal(2),
9137
9022
  literal(4),
9138
- literal(5)
9023
+ literal(5),
9024
+ literal(6)
9139
9025
  ]),
9140
9026
  document,
9141
- modules: record(text, module)
9027
+ modules: record$2(text, module)
9142
9028
  });
9143
9029
  revision.extend({
9144
9030
  kind: literal("open-flow-flow-revision"),
9145
9031
  version: literal(1)
9146
9032
  });
9033
+ function rejectRetiredDefinitions(value) {
9034
+ const candidate = record$1(value);
9035
+ 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.");
9036
+ 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.");
9037
+ const subflows = candidate.subflows;
9038
+ 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.");
9039
+ 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.");
9040
+ return value;
9041
+ }
9042
+ function record$1(value) {
9043
+ return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
9044
+ }
9147
9045
  function decodeRevisionContent(value) {
9148
9046
  checkJsonDepth(value);
9149
9047
  const content = revision.parse(value);
9150
- checkErrorModelVersion(content);
9048
+ checkModelVersion(content);
9151
9049
  assertOpenApiAuthBindings(content.document);
9152
9050
  return content;
9153
9051
  }
@@ -9168,17 +9066,22 @@ var shapes = {
9168
9066
  value: text
9169
9067
  },
9170
9068
  "graph.edge.connect": {
9171
- target,
9172
- edge
9069
+ edge,
9070
+ target: never().optional()
9173
9071
  },
9174
9072
  "graph.edge.disconnect": {
9175
- target,
9176
- edge
9073
+ edge,
9074
+ target: never().optional()
9177
9075
  },
9178
9076
  "graph.node.create": {
9179
9077
  ...at,
9180
9078
  node
9181
9079
  },
9080
+ "graph.node.replace": {
9081
+ ...at,
9082
+ before: node,
9083
+ node
9084
+ },
9182
9085
  "graph.node.delete": at,
9183
9086
  "graph.node.field.set": union([
9184
9087
  object({
@@ -9237,13 +9140,11 @@ var shapes = {
9237
9140
  },
9238
9141
  "graph.node.resolution.set": {
9239
9142
  ...at,
9240
- target: object({ kind: literal("flow") }),
9241
9143
  before: object(wait),
9242
9144
  value: object(wait)
9243
9145
  },
9244
9146
  "graph.node.webhook.set": {
9245
9147
  ...at,
9246
- target: object({ kind: literal("flow") }),
9247
9148
  before: object(webhook),
9248
9149
  value: object(webhook)
9249
9150
  },
@@ -9285,113 +9186,497 @@ var shapes = {
9285
9186
  },
9286
9187
  "module.source.replace": {
9287
9188
  moduleId: text,
9288
- beforeImports: strings,
9189
+ beforeImports: strings$1,
9289
9190
  beforeSource: text,
9290
- imports: strings,
9191
+ imports: strings$1,
9291
9192
  source: text
9292
9193
  },
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
9194
+ "graph.node.task.set": {
9195
+ ...at,
9196
+ before: union([inline, managed]),
9197
+ value: union([inline, managed])
9337
9198
  }
9338
9199
  };
9339
9200
  array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object({
9340
9201
  kind: literal(kind),
9341
9202
  ...shape
9342
9203
  })])).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.");
9204
+ function checkModelVersion(content) {
9205
+ 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.");
9206
+ 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
9207
  }
9346
9208
  //#endregion
9347
- //#region src/flow/common/condition.ts
9348
- var unaryOperator = (operator) => operator.startsWith("is");
9349
- var operandHandle = (caseIndex, groupIndex, expressionIndex, side) => `${caseIndex}/${groupIndex}/${expressionIndex}/${side}`;
9350
- /** Derived addresses let operand bindings use the ordinary input analysis and editor. Never persisted as node inputs. */
9351
- function conditionOperands(node) {
9352
- return node.cases.flatMap((item, c) => item.groups.flatMap((group, g) => group.expressions.flatMap((expression, e) => [{
9353
- handle: operandHandle(c, g, e, "left"),
9354
- operand: expression.left,
9355
- expression,
9356
- side: "left"
9357
- }, ...!unaryOperator(expression.operator) ? [{
9358
- handle: operandHandle(c, g, e, "right"),
9359
- operand: expression.right ?? { kind: "value" },
9360
- expression,
9361
- side: "right"
9362
- }] : []])));
9363
- }
9364
- function conditionInputPorts(node) {
9365
- return Object.fromEntries(conditionOperands(node).map(({ handle, operand }) => [handle, {
9366
- jsonSchema: operand.kind === "value" ? operand.jsonSchema ?? {} : {},
9367
- nullable: operand.kind === "value" ? operand.value === null : true
9368
- }]));
9369
- }
9209
+ //#region src/control/common/authoringLlm.ts
9210
+ var authoringLlmConfiguration = strictObject({
9211
+ mode: _enum(["chat", "json"]),
9212
+ resultSchema: json$3(),
9213
+ model: json$3().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),
9214
+ template: json$3().optional().describe("Default message templates: [{role: \"system\" | \"user\" | \"assistant\", content: \"Text with {{namedInput}}\"}]."),
9215
+ messages: json$3().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")
9216
+ });
9370
9217
  //#endregion
9371
- //#region src/flow/common/change.ts
9372
- var schemaKeywords = /* @__PURE__ */ new Set([
9373
- "const",
9374
- "enum",
9375
- "exclusiveMaximum",
9376
- "exclusiveMinimum",
9377
- "maximum",
9378
- "maxItems",
9379
- "maxLength",
9380
- "maxProperties",
9381
- "minimum",
9382
- "minItems",
9383
- "minLength",
9384
- "minProperties",
9385
- "multipleOf",
9386
- "pattern",
9387
- "required",
9388
- "type"
9218
+ //#region src/control/common/authoringOpenApi.ts
9219
+ var authenticationSchema = union([
9220
+ strictObject({ schemes: array(string$1().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.") }),
9221
+ strictObject({ type: _enum(["bearer", "basic"]) }),
9222
+ strictObject({
9223
+ type: literal("apiKey"),
9224
+ name: string$1().min(1),
9225
+ in: _enum(["header", "query"])
9226
+ })
9389
9227
  ]);
9390
- function isSchemaKeyword(value) {
9391
- return schemaKeywords.has(value);
9228
+ strictObject({
9229
+ sourceUrl: string$1().min(1),
9230
+ path: string$1().min(1),
9231
+ method: string$1().min(1),
9232
+ serverUrl: string$1().optional(),
9233
+ authentication: authenticationSchema.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")
9234
+ });
9235
+ //#endregion
9236
+ //#region src/control/common/authoringSchema.ts
9237
+ var id$1 = string$1().min(1);
9238
+ var json$1 = json$3();
9239
+ var patch = record$2(id$1, json$1);
9240
+ var type = _enum([
9241
+ "manual",
9242
+ "webhook",
9243
+ "cron",
9244
+ "error",
9245
+ "poll",
9246
+ "integration",
9247
+ "code",
9248
+ "connector",
9249
+ "agent",
9250
+ "llm",
9251
+ "decision",
9252
+ "openapi",
9253
+ "condition",
9254
+ "value",
9255
+ "wait",
9256
+ "approval"
9257
+ ]);
9258
+ var referenceSchema = id$1.describe("An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as \"step\", reference \"$step\", never bare \"step\". Aliases are local to one batch.");
9259
+ var output = strictObject({
9260
+ kind: literal("output"),
9261
+ node: referenceSchema,
9262
+ port: id$1.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),
9263
+ field: string$1().optional()
9264
+ });
9265
+ var variable$1 = strictObject({
9266
+ kind: literal("variable"),
9267
+ name: id$1
9268
+ });
9269
+ var authoringSourceSchema = union([
9270
+ output,
9271
+ variable$1,
9272
+ strictObject({
9273
+ kind: literal("value"),
9274
+ value: json$1
9275
+ }),
9276
+ strictObject({ kind: literal("unset") }),
9277
+ strictObject({ kind: literal("default") }),
9278
+ strictObject({
9279
+ kind: literal("sources"),
9280
+ sources: array(union([output, variable$1])).min(1)
9281
+ })
9282
+ ]);
9283
+ var operand = union([
9284
+ strictObject({
9285
+ kind: literal("value"),
9286
+ value: json$1.optional(),
9287
+ schema: json$1.optional()
9288
+ }),
9289
+ output,
9290
+ variable$1
9291
+ ]);
9292
+ var agentTool = authoringDefinitionSchemas.agent.shape.tools.element.omit({
9293
+ id: true,
9294
+ inputs: true
9295
+ }).extend({ inputs: record$2(id$1, authoringDefinitionSchemas.agent.shape.tools.element.shape.inputs.element.shape.source).optional().describe("Action input sources by name. The tool resolves types from the Action. New inputs default to model-provided; existing sources are preserved when omitted.") }).strict();
9296
+ var notification = strictObject({
9297
+ ...authoringDefinitionSchemas.connector.shape,
9298
+ messageHandle: id$1,
9299
+ inputs: record$2(id$1, union([strictObject({
9300
+ kind: literal("value"),
9301
+ value: json$1
9302
+ }), strictObject({
9303
+ kind: literal("input"),
9304
+ input: id$1
9305
+ })]))
9306
+ });
9307
+ var field = strictObject({
9308
+ schema: json$1.optional(),
9309
+ nullable: boolean().optional(),
9310
+ description: string$1().optional()
9311
+ });
9312
+ var inputFields = record$2(id$1, field.extend({ default: json$1.optional() })).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data.");
9313
+ var outputFields = record$2(id$1, field).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true.");
9314
+ var expression = strictObject({
9315
+ left: operand,
9316
+ operator: authoringDefinitionSchemas.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,
9317
+ right: operand.optional()
9318
+ });
9319
+ var all = strictObject({ all: array(expression) });
9320
+ var when = union([
9321
+ expression,
9322
+ all,
9323
+ strictObject({ any: array(union([expression, all])) })
9324
+ ]);
9325
+ strictObject({}), strictObject({ sourceFlowIds: array(id$1).optional() }), authoringDefinitionSchemas.webhook.omit({ bodyFields: true }).extend({ body: inputFields }).strict(), strictObject({ schedule: authoringDefinitionSchemas.schedule }), strictObject({
9326
+ key: id$1,
9327
+ connectionId: id$1.optional(),
9328
+ schedule: authoringDefinitionSchemas.schedule
9329
+ }), strictObject({
9330
+ key: id$1,
9331
+ connectionId: id$1.optional()
9332
+ }), strictObject({
9333
+ inputs: inputFields,
9334
+ outputs: outputFields,
9335
+ capabilities: authoringDefinitionSchemas.capabilities.optional()
9336
+ }), authoringDefinitionSchemas.connector.strict(), authoringDefinitionSchemas.agent.omit({
9337
+ prompt: true,
9338
+ tools: true
9339
+ }).extend({
9340
+ inputs: inputFields,
9341
+ resultSchema: json$1.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),
9342
+ tools: array(agentTool),
9343
+ notification: notification.optional()
9344
+ }).strict(), authoringLlmConfiguration.extend({ inputs: inputFields }), authoringDefinitionSchemas.decision, strictObject({
9345
+ match: _enum(["first", "all"]),
9346
+ branches: array(strictObject({
9347
+ name: id$1,
9348
+ description: string$1().optional(),
9349
+ when
9350
+ }))
9351
+ }), strictObject({
9352
+ values: patch,
9353
+ outputs: outputFields
9354
+ }), strictObject({ inputs: inputFields }), strictObject({ inputs: inputFields });
9355
+ var updates = strictObject({
9356
+ name: id$1.optional(),
9357
+ description: string$1().optional(),
9358
+ icon: string$1().optional(),
9359
+ maxExecutions: int().positive().optional(),
9360
+ timeoutMs: number().nonnegative().optional(),
9361
+ config: patch.optional().describe("Recursively merge configuration; omitted fields remain unchanged and arrays replace as a whole. This includes schema objects: {} does not clear an existing schema. Use clear paths to remove fields, e.g. [\"config\",\"inputs\",\"amount\",\"schema\",\"type\"].")
9362
+ });
9363
+ var authoringEditSchema = discriminatedUnion("op", [
9364
+ strictObject({
9365
+ op: literal("node.add"),
9366
+ as: id$1.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),
9367
+ type,
9368
+ name: id$1,
9369
+ config: patch.optional(),
9370
+ inputs: record$2(id$1, authoringSourceSchema).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),
9371
+ code: string$1().optional(),
9372
+ prompt: string$1().optional()
9373
+ }),
9374
+ strictObject({
9375
+ op: literal("node.update"),
9376
+ node: referenceSchema,
9377
+ set: updates.optional(),
9378
+ clear: array(array(id$1).min(1)).optional()
9379
+ }),
9380
+ strictObject({
9381
+ op: literal("node.remove"),
9382
+ node: referenceSchema
9383
+ }),
9384
+ strictObject({
9385
+ op: literal("input.set"),
9386
+ node: referenceSchema,
9387
+ input: id$1,
9388
+ source: authoringSourceSchema
9389
+ }),
9390
+ strictObject({
9391
+ op: _enum(["edge.connect", "edge.disconnect"]),
9392
+ source: referenceSchema,
9393
+ target: referenceSchema,
9394
+ branch: id$1.optional()
9395
+ }),
9396
+ strictObject({
9397
+ op: literal("text.edit"),
9398
+ node: referenceSchema,
9399
+ field: _enum(["code", "prompt"]),
9400
+ oldText: id$1,
9401
+ newText: string$1()
9402
+ }),
9403
+ strictObject({
9404
+ op: literal("text.set"),
9405
+ node: referenceSchema,
9406
+ field: _enum(["code", "prompt"]),
9407
+ text: string$1()
9408
+ })
9409
+ ]);
9410
+ strictObject({
9411
+ baseRevision: id$1,
9412
+ requestId: id$1.max(256),
9413
+ edits: array(authoringEditSchema).min(1).max(1e3)
9414
+ });
9415
+ strictObject({
9416
+ revision: id$1.optional().describe("Fixed revision from a previous read; omit to read the current draft."),
9417
+ nodes: array(id$1).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),
9418
+ text: strictObject({
9419
+ node: id$1,
9420
+ field: _enum(["code", "prompt"]),
9421
+ start: int().positive().default(1),
9422
+ lines: int().min(1).max(200).default(80)
9423
+ }).optional().describe("Read code or prompt by line (1-based). Mutually exclusive with nodes. Follow nextStart at the same revision until truncated is false.")
9424
+ }).refine((v) => v.nodes == null || v.text == null, "Choose nodes or text.").meta({
9425
+ not: { required: ["nodes", "text"] },
9426
+ description: "Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."
9427
+ });
9428
+ strictObject({ revisionId: id$1 });
9429
+ strictObject({
9430
+ revision: id$1.optional(),
9431
+ query: id$1.max(1e3),
9432
+ type: type.optional(),
9433
+ offset: int().nonnegative().default(0),
9434
+ limit: int().min(1).max(100).default(20)
9435
+ });
9436
+ strictObject({
9437
+ type: type.optional(),
9438
+ action: id$1.optional()
9439
+ }).refine((v) => v.type == null || v.action == null, "Choose type or action.");
9440
+ var authoringDiagnosticSchema = object({
9441
+ code: id$1,
9442
+ message: string$1(),
9443
+ nodes: array(id$1),
9444
+ field: string$1().optional(),
9445
+ line: number().optional(),
9446
+ column: number().optional()
9447
+ });
9448
+ var authoringCheckResponse = object({
9449
+ flowId: id$1,
9450
+ revisionId: id$1,
9451
+ valid: boolean(),
9452
+ diagnostics: array(authoringDiagnosticSchema),
9453
+ version: literal(1)
9454
+ });
9455
+ var authoringEditResponse = object({
9456
+ flowId: id$1,
9457
+ saved: literal(true),
9458
+ revision: id$1,
9459
+ nodes: record$2(id$1, id$1),
9460
+ changes: array(object({
9461
+ index: int(),
9462
+ op: id$1,
9463
+ node: id$1.optional()
9464
+ })),
9465
+ validation: object({
9466
+ status: _enum([
9467
+ "valid",
9468
+ "invalid",
9469
+ "unavailable"
9470
+ ]),
9471
+ diagnostics: array(authoringDiagnosticSchema).optional()
9472
+ }),
9473
+ version: literal(1)
9474
+ });
9475
+ var authoringReadResponse = object({
9476
+ flowId: id$1,
9477
+ revision: id$1,
9478
+ data: object({
9479
+ nodes: array(record$2(string$1(), json$1)).optional(),
9480
+ edges: array(json$1).optional(),
9481
+ text: record$2(string$1(), json$1).optional()
9482
+ }),
9483
+ version: literal(1)
9484
+ });
9485
+ var authoringSearchResponse = object({
9486
+ flowId: id$1,
9487
+ revision: id$1,
9488
+ data: object({
9489
+ matches: array(object({
9490
+ node: id$1,
9491
+ field: id$1,
9492
+ line: int().optional(),
9493
+ excerpt: string$1()
9494
+ })),
9495
+ total: int(),
9496
+ nextOffset: int().optional()
9497
+ }),
9498
+ version: literal(1)
9499
+ });
9500
+ //#endregion
9501
+ //#region src/control/common/providerIconSprite.ts
9502
+ /** Optional artwork must never make an otherwise usable catalog unavailable. */
9503
+ function providerIconAppearance(metadata, position) {
9504
+ if (!metadata || typeof metadata != "object" || !position || typeof position != "object") return {};
9505
+ const m = metadata;
9506
+ const p = position;
9507
+ if (typeof m.version != "string" || ![
9508
+ m.pixelRatio,
9509
+ m.iconSize,
9510
+ m.width,
9511
+ m.height
9512
+ ].every((v) => Number.isInteger(v) && v > 0) || ![
9513
+ m.bleed,
9514
+ p.x,
9515
+ p.y
9516
+ ].every((v) => Number.isInteger(v) && v >= 0) || p.x + m.iconSize > m.width || p.y + m.iconSize > m.height) return {};
9517
+ try {
9518
+ for (const url of [m.lightUrl, m.darkUrl]) if (typeof url != "string" || ![
9519
+ "https:",
9520
+ "http:",
9521
+ "data:"
9522
+ ].includes(new URL(url).protocol)) return {};
9523
+ } catch {
9524
+ return {};
9525
+ }
9526
+ return {
9527
+ iconSprite: m,
9528
+ iconSpritePosition: {
9529
+ x: p.x,
9530
+ y: p.y
9531
+ }
9532
+ };
9392
9533
  }
9393
- function portsByHandle(ports) {
9394
- return Object.fromEntries(ports.flatMap((port) => "handle" in port ? [[port.handle, port]] : []));
9534
+ //#endregion
9535
+ //#region src/control/common/errors.ts
9536
+ var controlErrorCode = {
9537
+ authenticationRequired: "authentication.required",
9538
+ authorizationDenied: "authorization.denied",
9539
+ bindingUnresolved: "binding.unresolved",
9540
+ connectorActionNotFound: "connector.action-not-found",
9541
+ connectorAccessConflict: "connector.access-conflict",
9542
+ connectorAccessInvalid: "connector.access-invalid",
9543
+ connectorAccessRequired: "connector.access-required",
9544
+ connectorAccessUnsupported: "connector.access-unsupported",
9545
+ connectorUnconfigured: "connector.unconfigured",
9546
+ connectorUnavailable: "connector.unavailable",
9547
+ connectorConsoleUnconfigured: "connector.console-unconfigured",
9548
+ engineUnavailable: "engine.unavailable",
9549
+ engineUnsupported: "engine.unsupported",
9550
+ eventSourceInvalid: "event-source.invalid",
9551
+ eventSourceIdentityUnavailable: "event-source.identity-unavailable",
9552
+ eventSourceNotFound: "event-source.not-found",
9553
+ eventSourceConflict: "event-source.conflict",
9554
+ flowInvalid: "flow.invalid",
9555
+ flowRepairRequired: "flow.repair-required",
9556
+ flowUpgradeRequired: "flow.upgrade-required",
9557
+ flowNotFound: "flow.not-found",
9558
+ flowBusy: "flow.busy",
9559
+ flowConflict: "flow.conflict",
9560
+ flowPresentationConflict: "flow.presentation-conflict",
9561
+ flowRevisionConflict: "flow.revision-conflict",
9562
+ liveConflict: "live.conflict",
9563
+ liveNotFound: "live.not-found",
9564
+ pageInvalidCursor: "page.invalid-cursor",
9565
+ publicationConflict: "publication.conflict",
9566
+ publicationNotFound: "publication.not-found",
9567
+ publicationUnsupported: "publication.unsupported",
9568
+ publishOperationNotFound: "publication.operation-not-found",
9569
+ routeNotFound: "route.not-found",
9570
+ runConflict: "run.conflict",
9571
+ runEventsExpired: "run.events-expired",
9572
+ runInvalid: "run.invalid",
9573
+ runNotFound: "run.not-found",
9574
+ runNotTerminal: "run.not-terminal",
9575
+ runOverloaded: "run.overloaded",
9576
+ runWaitNotFound: "run.wait-not-found",
9577
+ triggerKeyInvalid: "trigger-key.invalid",
9578
+ triggerKeyNotFound: "trigger-key.not-found",
9579
+ triggerNotFound: "trigger.not-found",
9580
+ variableInvalid: "variable.invalid",
9581
+ variableLimitReached: "variable.limit-reached",
9582
+ variableNotFound: "variable.not-found"
9583
+ };
9584
+ var controlErrorMetadata = {
9585
+ [controlErrorCode.eventSourceInvalid]: { status: 400 },
9586
+ [controlErrorCode.eventSourceIdentityUnavailable]: { status: 409 },
9587
+ [controlErrorCode.eventSourceNotFound]: { status: 404 },
9588
+ [controlErrorCode.eventSourceConflict]: { status: 409 },
9589
+ [controlErrorCode.authenticationRequired]: { status: 401 },
9590
+ [controlErrorCode.authorizationDenied]: { status: 403 },
9591
+ [controlErrorCode.bindingUnresolved]: { status: 409 },
9592
+ [controlErrorCode.connectorActionNotFound]: { status: 404 },
9593
+ [controlErrorCode.connectorAccessConflict]: { status: 412 },
9594
+ [controlErrorCode.connectorAccessInvalid]: { status: 409 },
9595
+ [controlErrorCode.connectorAccessRequired]: { status: 409 },
9596
+ [controlErrorCode.connectorAccessUnsupported]: { status: 409 },
9597
+ [controlErrorCode.connectorUnconfigured]: { status: 503 },
9598
+ [controlErrorCode.connectorUnavailable]: { status: 503 },
9599
+ [controlErrorCode.connectorConsoleUnconfigured]: { status: 503 },
9600
+ [controlErrorCode.engineUnavailable]: { status: 503 },
9601
+ [controlErrorCode.engineUnsupported]: { status: 409 },
9602
+ [controlErrorCode.flowInvalid]: { status: 400 },
9603
+ [controlErrorCode.flowRepairRequired]: { status: 409 },
9604
+ [controlErrorCode.flowUpgradeRequired]: { status: 409 },
9605
+ [controlErrorCode.flowNotFound]: { status: 404 },
9606
+ [controlErrorCode.flowBusy]: { status: 409 },
9607
+ [controlErrorCode.flowConflict]: { status: 409 },
9608
+ [controlErrorCode.flowPresentationConflict]: { status: 412 },
9609
+ [controlErrorCode.flowRevisionConflict]: { status: 412 },
9610
+ [controlErrorCode.liveConflict]: { status: 412 },
9611
+ [controlErrorCode.liveNotFound]: { status: 404 },
9612
+ [controlErrorCode.pageInvalidCursor]: { status: 400 },
9613
+ [controlErrorCode.publicationConflict]: { status: 409 },
9614
+ [controlErrorCode.publicationNotFound]: { status: 404 },
9615
+ [controlErrorCode.publicationUnsupported]: { status: 409 },
9616
+ [controlErrorCode.publishOperationNotFound]: { status: 404 },
9617
+ [controlErrorCode.routeNotFound]: { status: 404 },
9618
+ [controlErrorCode.runConflict]: { status: 409 },
9619
+ [controlErrorCode.runEventsExpired]: { status: 410 },
9620
+ [controlErrorCode.runInvalid]: { status: 400 },
9621
+ [controlErrorCode.runNotFound]: { status: 404 },
9622
+ [controlErrorCode.runNotTerminal]: { status: 409 },
9623
+ [controlErrorCode.runOverloaded]: { status: 429 },
9624
+ [controlErrorCode.runWaitNotFound]: { status: 404 },
9625
+ [controlErrorCode.triggerKeyInvalid]: { status: 409 },
9626
+ [controlErrorCode.triggerKeyNotFound]: { status: 404 },
9627
+ [controlErrorCode.triggerNotFound]: { status: 404 },
9628
+ [controlErrorCode.variableInvalid]: { status: 400 },
9629
+ [controlErrorCode.variableLimitReached]: { status: 409 },
9630
+ [controlErrorCode.variableNotFound]: { status: 404 }
9631
+ };
9632
+ var ApiError = class extends Error {
9633
+ constructor(status, code, message, details) {
9634
+ super(message);
9635
+ this.code = code;
9636
+ this.details = details;
9637
+ this.name = "ApiError";
9638
+ this.status = status;
9639
+ }
9640
+ };
9641
+ //#endregion
9642
+ //#region src/control/common/decoding.ts
9643
+ var InvalidResponseError = class extends ApiError {
9644
+ constructor(detail) {
9645
+ super(502, "response.invalid", `The Control API returned an invalid response.${detail == null ? "" : ` ${detail}`}`);
9646
+ this.detail = detail;
9647
+ }
9648
+ };
9649
+ function invalidResponse(detail) {
9650
+ throw new InvalidResponseError(detail);
9651
+ }
9652
+ function record(value) {
9653
+ if (value == null || typeof value != "object" || Array.isArray(value)) return invalidResponse("Expected an object.");
9654
+ return value;
9655
+ }
9656
+ function string(value) {
9657
+ return typeof value == "string" && value.length > 0 ? value : invalidResponse("Expected a non-empty string.");
9658
+ }
9659
+ function exact(value, keys) {
9660
+ const actual = Object.keys(value);
9661
+ if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) {
9662
+ const missing = keys.filter((key) => !Object.hasOwn(value, key));
9663
+ const unexpected = actual.filter((key) => !keys.includes(key));
9664
+ invalidResponse([missing.length > 0 ? `Missing fields: ${missing.join(", ")}.` : "", unexpected.length > 0 ? `Unexpected fields: ${unexpected.join(", ")}.` : ""].filter(Boolean).join(" "));
9665
+ }
9666
+ }
9667
+ function integer(value) {
9668
+ return Number.isSafeInteger(value) ? value : invalidResponse("Expected a safe integer.");
9669
+ }
9670
+ function jsonValue(value) {
9671
+ if (value === null || typeof value == "boolean" || typeof value == "string") return value;
9672
+ if (typeof value == "number" && Number.isFinite(value)) return value;
9673
+ if (Array.isArray(value)) return value.map(jsonValue);
9674
+ const source = record(value);
9675
+ return Object.fromEntries(Object.entries(source).map(([key, item]) => [key, jsonValue(item)]));
9676
+ }
9677
+ function optionalString(value) {
9678
+ if (value == null) return;
9679
+ return string(value);
9395
9680
  }
9396
9681
  //#endregion
9397
9682
  //#region src/flow/common/encoding.ts
@@ -9414,7 +9699,7 @@ async function digestBytes(bytes) {
9414
9699
  //#region src/control/common/providerAccess.ts
9415
9700
  var sourceSchema = discriminatedUnion("kind", [strictObject({ kind: literal("admin-delegation") }), strictObject({
9416
9701
  kind: literal("policy"),
9417
- ruleId: string().min(1).nullable()
9702
+ ruleId: string$1().min(1).nullable()
9418
9703
  })]);
9419
9704
  function parseProviderAccessSource(value) {
9420
9705
  return sourceSchema.parse(value);
@@ -9432,7 +9717,7 @@ async function providerAccessBindingId(teamId, identity) {
9432
9717
  //#endregion
9433
9718
  //#region src/control/common/connectorDecoders.ts
9434
9719
  function accessPermissions(value) {
9435
- const source = record$1(value);
9720
+ const source = record(value);
9436
9721
  exact(source, [
9437
9722
  "actionIds",
9438
9723
  "allActions",
@@ -9441,10 +9726,19 @@ function accessPermissions(value) {
9441
9726
  "configured",
9442
9727
  "proxy"
9443
9728
  ]);
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();
9445
- const actionIds = source.actionIds.map(string$1);
9446
- 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();
9729
+ if (!Array.isArray(source.actionIds)) return invalidResponse("permissions.actionIds: expected an array.");
9730
+ if (!Array.isArray(source.triggerIds)) return invalidResponse("permissions.triggerIds: expected an array.");
9731
+ if (typeof source.allActions != "boolean") return invalidResponse("permissions.allActions: expected a boolean.");
9732
+ if (typeof source.allTriggers != "boolean") return invalidResponse("permissions.allTriggers: expected a boolean.");
9733
+ if (typeof source.configured != "boolean") return invalidResponse("permissions.configured: expected a boolean.");
9734
+ if (typeof source.proxy != "boolean") return invalidResponse("permissions.proxy: expected a boolean.");
9735
+ const actionIds = source.actionIds.map(string);
9736
+ const triggerIds = source.triggerIds.map(string);
9737
+ if (new Set(actionIds).size != actionIds.length) return invalidResponse("permissions.actionIds: duplicate IDs.");
9738
+ if (source.allActions && actionIds.length != 0) return invalidResponse("permissions.actionIds: must be empty when allActions is true.");
9739
+ if (new Set(triggerIds).size != triggerIds.length) return invalidResponse("permissions.triggerIds: duplicate IDs.");
9740
+ if (source.allTriggers && triggerIds.length != 0) return invalidResponse("permissions.triggerIds: must be empty when allTriggers is true.");
9741
+ if (source.proxy && (!source.allActions || !source.allTriggers || source.configured)) return invalidResponse("permissions.proxy: requires allActions=true, allTriggers=true and configured=false.");
9448
9742
  return {
9449
9743
  actionIds,
9450
9744
  triggerIds,
@@ -9455,7 +9749,7 @@ function accessPermissions(value) {
9455
9749
  };
9456
9750
  }
9457
9751
  function accessBinding(value, candidate) {
9458
- const source = record$1(value);
9752
+ const source = record(value);
9459
9753
  const policyRevision = source.policyRevision;
9460
9754
  const status = source.status;
9461
9755
  const isDefault = source.isDefault;
@@ -9474,35 +9768,35 @@ function accessBinding(value, candidate) {
9474
9768
  "providerId",
9475
9769
  ...candidate ? [] : ["status"]
9476
9770
  ]);
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();
9771
+ if (policyRevision != null && typeof policyRevision != "string") return invalidResponse("policyRevision: expected a string.");
9772
+ if (candidate && isDefault !== void 0 && typeof isDefault != "boolean") return invalidResponse("isDefault: expected a boolean.");
9773
+ if (permissionGroupName !== void 0 && permissionGroupName !== null && typeof permissionGroupName != "string") return invalidResponse("permissionGroupName: expected a string or null.");
9480
9774
  if (!candidate && status != "active" && status != "forbidden" && status != "invalid" && status != "missing") return invalidResponse();
9481
9775
  let bindingSource;
9482
9776
  try {
9483
9777
  bindingSource = parseProviderAccessSource(source.source);
9484
9778
  } catch {
9485
- return invalidResponse();
9779
+ return invalidResponse("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.");
9486
9780
  }
9487
9781
  return {
9488
- accessBindingId: string$1(source.accessBindingId),
9489
- connectionId: string$1(source.connectionId),
9782
+ accessBindingId: string(source.accessBindingId),
9783
+ connectionId: string(source.connectionId),
9490
9784
  source: bindingSource,
9491
- connectionDisplayName: string$1(legacy ? source.displayName : source.connectionDisplayName),
9785
+ connectionDisplayName: string(legacy ? source.displayName : source.connectionDisplayName),
9492
9786
  ...candidate && typeof isDefault == "boolean" ? { isDefault } : {},
9493
9787
  ...permissions == null ? {} : { permissions },
9494
9788
  ...permissionGroupName === void 0 ? {} : { permissionGroupName },
9495
9789
  ...policyRevision == null ? {} : { policyRevision },
9496
- providerId: string$1(source.providerId),
9790
+ providerId: string(source.providerId),
9497
9791
  ...candidate ? {} : { status }
9498
9792
  };
9499
9793
  }
9500
9794
  function accessMode(value) {
9501
- if (value != "implicit" && value != "selectable") return invalidResponse();
9795
+ if (value != "implicit" && value != "selectable") return invalidResponse("mode: expected implicit or selectable.");
9502
9796
  return value;
9503
9797
  }
9504
9798
  function connectorAccess(value) {
9505
- const source = record$1(value);
9799
+ const source = record(value);
9506
9800
  exact(source, [
9507
9801
  "accessRevision",
9508
9802
  "bindings",
@@ -9512,12 +9806,12 @@ function connectorAccess(value) {
9512
9806
  ..."discardedBindingCount" in source ? ["discardedBindingCount"] : [],
9513
9807
  "version"
9514
9808
  ]);
9515
- const accessRevision = integer$1(source.accessRevision);
9809
+ const accessRevision = integer(source.accessRevision);
9516
9810
  if (source.version != 1 || accessRevision < 0 || !Array.isArray(source.bindings)) return invalidResponse();
9517
9811
  if ("providerIds" in source && !Array.isArray(source.providerIds)) return invalidResponse();
9518
- const providerIds = source.providerIds == null ? void 0 : source.providerIds.map((id) => string$1(id));
9812
+ const providerIds = source.providerIds == null ? void 0 : source.providerIds.map((id) => string(id));
9519
9813
  if (providerIds != null && new Set(providerIds).size != providerIds.length) return invalidResponse();
9520
- let discardedBindingCount = source.discardedBindingCount == null ? 0 : integer$1(source.discardedBindingCount);
9814
+ let discardedBindingCount = source.discardedBindingCount == null ? 0 : integer(source.discardedBindingCount);
9521
9815
  if (discardedBindingCount < 0) return invalidResponse();
9522
9816
  const bindings = [];
9523
9817
  for (const entry of source.bindings) try {
@@ -9542,14 +9836,14 @@ function connectorAccess(value) {
9542
9836
  ...providerIds == null ? {} : { providerIds },
9543
9837
  bindings,
9544
9838
  mode: accessMode(source.mode),
9545
- sharedAccessDigest: string$1(source.sharedAccessDigest),
9839
+ sharedAccessDigest: string(source.sharedAccessDigest),
9546
9840
  version: 1
9547
9841
  };
9548
9842
  }
9549
9843
  function accessGrants(value) {
9550
9844
  if (!Array.isArray(value)) return invalidResponse();
9551
9845
  const bindings = value.map((candidate) => {
9552
- const entry = record$1(candidate);
9846
+ const entry = record(candidate);
9553
9847
  exact(entry, [
9554
9848
  "accessBindingId",
9555
9849
  "connectionId",
@@ -9566,11 +9860,11 @@ function accessGrants(value) {
9566
9860
  }
9567
9861
  if (entry.permissionGroupName != null && typeof entry.permissionGroupName != "string") return invalidResponse();
9568
9862
  return {
9569
- accessBindingId: string$1(entry.accessBindingId),
9570
- connectionId: string$1(entry.connectionId),
9571
- providerId: string$1(entry.providerId),
9863
+ accessBindingId: string(entry.accessBindingId),
9864
+ connectionId: string(entry.connectionId),
9865
+ providerId: string(entry.providerId),
9572
9866
  source: identity,
9573
- connectionDisplayName: string$1(entry.connectionDisplayName),
9867
+ connectionDisplayName: string(entry.connectionDisplayName),
9574
9868
  ..."permissionGroupName" in entry ? { permissionGroupName: entry.permissionGroupName } : {}
9575
9869
  };
9576
9870
  });
@@ -9578,7 +9872,7 @@ function accessGrants(value) {
9578
9872
  return bindings;
9579
9873
  }
9580
9874
  function connectorAccessSnapshot(value) {
9581
- const source = record$1(value);
9875
+ const source = record(value);
9582
9876
  exact(source, [
9583
9877
  "mode",
9584
9878
  "sharedAccessDigest",
@@ -9593,24 +9887,26 @@ function connectorAccessSnapshot(value) {
9593
9887
  if (mode == "implicit" && (sharedBindings.length > 0 || selectedBindings.length > 0)) return invalidResponse();
9594
9888
  return {
9595
9889
  mode,
9596
- sharedAccessDigest: string$1(source.sharedAccessDigest),
9890
+ sharedAccessDigest: string(source.sharedAccessDigest),
9597
9891
  sharedBindings,
9598
9892
  selectedBindings,
9599
9893
  version: 2
9600
9894
  };
9601
9895
  }
9602
9896
  function connectorAccessCandidates(value, providerId) {
9603
- const source = record$1(value);
9897
+ const source = record(value);
9604
9898
  exact(source, [
9605
9899
  "candidates",
9606
9900
  "mode",
9607
9901
  "providerId",
9608
9902
  "version"
9609
9903
  ]);
9610
- if (source.version != 1 || string$1(source.providerId) != providerId || !Array.isArray(source.candidates)) return invalidResponse();
9904
+ if (source.version != 1) return invalidResponse("version: expected 1.");
9905
+ if (string(source.providerId) != providerId) return invalidResponse("providerId: does not match the requested provider.");
9906
+ if (!Array.isArray(source.candidates)) return invalidResponse("candidates: expected an array.");
9611
9907
  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();
9908
+ if (candidates.some((candidate) => candidate.providerId != providerId)) return invalidResponse("candidates[].providerId: does not match the requested provider.");
9909
+ if (new Set(candidates.map((candidate) => candidate.accessBindingId)).size != candidates.length) return invalidResponse("candidates[].accessBindingId: duplicate IDs.");
9614
9910
  return {
9615
9911
  candidates,
9616
9912
  mode: accessMode(source.mode),
@@ -9619,34 +9915,35 @@ function connectorAccessCandidates(value, providerId) {
9619
9915
  };
9620
9916
  }
9621
9917
  function connectorAccessCandidatesBatch(value, providerIds) {
9622
- const source = record$1(value);
9918
+ const source = record(value);
9623
9919
  exact(source, ["results", "version"]);
9624
- if (source.version != 1 || !Array.isArray(source.results)) return invalidResponse();
9920
+ if (source.version != 1) return invalidResponse("version: expected 1.");
9921
+ if (!Array.isArray(source.results)) return invalidResponse("results: expected an array.");
9625
9922
  const remaining = new Set(providerIds);
9626
9923
  const results = source.results.map((entry) => {
9627
- const item = record$1(entry);
9628
- const providerId = string$1(item.providerId);
9629
- if (!remaining.delete(providerId)) return invalidResponse();
9924
+ const item = record(entry);
9925
+ const providerId = string(item.providerId);
9926
+ if (!remaining.delete(providerId)) return invalidResponse("results[].providerId: duplicate or unrequested provider.");
9630
9927
  if (!Object.hasOwn(item, "error")) return connectorAccessCandidates(item, providerId);
9631
9928
  exact(item, ["providerId", "error"]);
9632
- const error = record$1(item.error);
9929
+ const error = record(item.error);
9633
9930
  exact(error, ["code", "message"]);
9634
9931
  return {
9635
9932
  providerId,
9636
9933
  error: {
9637
- code: string$1(error.code),
9638
- message: string$1(error.message)
9934
+ code: string(error.code),
9935
+ message: string(error.message)
9639
9936
  }
9640
9937
  };
9641
9938
  });
9642
- if (remaining.size != 0) return invalidResponse();
9939
+ if (remaining.size != 0) return invalidResponse("results: missing requested providers.");
9643
9940
  return {
9644
9941
  results,
9645
9942
  version: 1
9646
9943
  };
9647
9944
  }
9648
9945
  function connection(value) {
9649
- const source = record$1(value);
9946
+ const source = record(value);
9650
9947
  exact(source, [
9651
9948
  ...Object.hasOwn(source, "providerAccountId") ? ["providerAccountId"] : [],
9652
9949
  ...Object.hasOwn(source, "alias") ? ["alias"] : [],
@@ -9662,18 +9959,18 @@ function connection(value) {
9662
9959
  if (status != "active" && status != "disconnected" && status != "error" && status != "reauth_required") return invalidResponse();
9663
9960
  if (typeof source.isDefault != "boolean") return invalidResponse();
9664
9961
  return {
9665
- ...source.providerAccountId === void 0 ? {} : { providerAccountId: string$1(source.providerAccountId) },
9666
- ...source.alias === void 0 ? {} : { alias: string$1(source.alias) },
9962
+ ...source.providerAccountId === void 0 ? {} : { providerAccountId: string(source.providerAccountId) },
9963
+ ...source.alias === void 0 ? {} : { alias: string(source.alias) },
9667
9964
  ...source.builtInAccount === void 0 ? {} : { builtInAccount: source.builtInAccount },
9668
- connectionId: string$1(source.connectionId),
9669
- displayName: string$1(source.displayName),
9965
+ connectionId: string(source.connectionId),
9966
+ displayName: string(source.displayName),
9670
9967
  isDefault: source.isDefault,
9671
- serviceId: string$1(source.serviceId),
9968
+ serviceId: string(source.serviceId),
9672
9969
  status
9673
9970
  };
9674
9971
  }
9675
9972
  function port(value, input = false) {
9676
- const source = record$1(value);
9973
+ const source = record(value);
9677
9974
  const description = source.description;
9678
9975
  const hasValue = input && Object.hasOwn(source, "value");
9679
9976
  exact(source, [
@@ -9695,10 +9992,10 @@ function inputPort(value) {
9695
9992
  return port(value, true);
9696
9993
  }
9697
9994
  function ports(value, decode) {
9698
- return Object.fromEntries(Object.entries(record$1(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9995
+ return Object.fromEntries(Object.entries(record(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9699
9996
  }
9700
9997
  function connectorActionMetadata(value) {
9701
- const source = record$1(value);
9998
+ const source = record(value);
9702
9999
  const homepageUrl = source.homepageUrl;
9703
10000
  const icon = source.icon;
9704
10001
  exact(source, [
@@ -9722,22 +10019,22 @@ function connectorActionMetadata(value) {
9722
10019
  return {
9723
10020
  ...source.inputSchema === void 0 ? {} : { inputSchema: jsonValue(source.inputSchema) },
9724
10021
  ...source.outputSchema === void 0 ? {} : { outputSchema: jsonValue(source.outputSchema) },
9725
- actionId: string$1(source.actionId),
9726
- ...source.operationType == null ? {} : { operationType: string$1(source.operationType) },
10022
+ actionId: string(source.actionId),
10023
+ ...source.operationType == null ? {} : { operationType: string(source.operationType) },
9727
10024
  authenticated: typeof source.authenticated == "boolean" ? source.authenticated : invalidResponse(),
9728
10025
  description: typeof source.description == "string" ? source.description : invalidResponse(),
9729
10026
  ...homepageUrl == null ? {} : { homepageUrl },
9730
10027
  ...icon == null ? {} : { icon },
9731
10028
  ...providerIconAppearance(source.iconSprite, source.iconSpritePosition),
9732
10029
  inputs: ports(source.inputs, inputPort),
9733
- name: string$1(source.name),
10030
+ name: string(source.name),
9734
10031
  outputs: ports(source.outputs, port),
9735
- serviceId: string$1(source.serviceId),
9736
- serviceName: string$1(source.serviceName)
10032
+ serviceId: string(source.serviceId),
10033
+ serviceName: string(source.serviceName)
9737
10034
  };
9738
10035
  }
9739
10036
  function connectorAction(value) {
9740
- const { defaultConnection, ...metadata } = record$1(value);
10037
+ const { defaultConnection, ...metadata } = record(value);
9741
10038
  const action = connectorActionMetadata(metadata);
9742
10039
  if (defaultConnection == null) return action;
9743
10040
  const preferred = connection(defaultConnection);
@@ -9748,7 +10045,7 @@ function connectorAction(value) {
9748
10045
  };
9749
10046
  }
9750
10047
  function connectorProvider(value) {
9751
- const source = record$1(value);
10048
+ const source = record(value);
9752
10049
  const homepageUrl = source.homepageUrl;
9753
10050
  const icon = source.icon;
9754
10051
  if (source.noSetup !== void 0 && typeof source.noSetup != "boolean") return invalidResponse();
@@ -9766,8 +10063,8 @@ function connectorProvider(value) {
9766
10063
  ...homepageUrl == null ? {} : { homepageUrl },
9767
10064
  ...icon == null ? {} : { icon },
9768
10065
  ...providerIconAppearance(source.iconSprite, source.iconSpritePosition),
9769
- serviceId: string$1(source.serviceId),
9770
- serviceName: string$1(source.serviceName),
10066
+ serviceId: string(source.serviceId),
10067
+ serviceName: string(source.serviceName),
9771
10068
  ...source.noSetup === void 0 ? {} : { noSetup: source.noSetup }
9772
10069
  };
9773
10070
  }
@@ -9896,12 +10193,11 @@ function triggerOutputPorts(trigger) {
9896
10193
  }
9897
10194
  //#endregion
9898
10195
  //#region src/flow/common/graph.ts
9899
- function nodeInputPorts(document, node) {
10196
+ function nodeInputPorts(node) {
9900
10197
  switch (node.kind) {
9901
10198
  case "condition": return conditionInputPorts(node);
9902
10199
  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 ?? []]);
10200
+ case "task": return portsByHandle([...node.task.inputs, ...node.additionalInputs ?? []]);
9905
10201
  case "approval":
9906
10202
  case "wait": return portsByHandle(node.inputDefinitions);
9907
10203
  case "cron":
@@ -9947,12 +10243,11 @@ function resolutionOutputPorts(node) {
9947
10243
  })]))
9948
10244
  };
9949
10245
  }
9950
- function nodeOutputPorts(document, node) {
10246
+ function nodeOutputPorts(node) {
9951
10247
  switch (node.kind) {
9952
10248
  case "condition": return {};
9953
10249
  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 ?? []);
10250
+ case "task": return portsByHandle(node.task.outputs);
9956
10251
  case "approval":
9957
10252
  case "wait": return resolutionOutputPorts(node);
9958
10253
  case "cron":
@@ -10003,15 +10298,6 @@ function flowInspection(inspected, live, full = false) {
10003
10298
  draft: {
10004
10299
  revisionId: draft.revisionId,
10005
10300
  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
10301
  bindings: document.bindings,
10016
10302
  modules: Object.fromEntries(Object.entries(modules).map(([id, module]) => [id, {
10017
10303
  name: module.name,
@@ -10041,18 +10327,17 @@ function inspectGraph(document, graph) {
10041
10327
  edges: graph.edges
10042
10328
  };
10043
10329
  }
10044
- function inspectNode(document, node) {
10045
- const inputs = nodeInputPorts(document, node);
10330
+ function inspectNode(_document, node) {
10331
+ const inputs = nodeInputPorts(node);
10046
10332
  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
10333
  const ports = {
10048
10334
  inputHandles: Object.keys(inputs),
10049
- outputHandles: Object.keys(nodeOutputPorts(document, node)),
10335
+ outputHandles: Object.keys(nodeOutputPorts(node)),
10050
10336
  ...Object.keys(defaults).length == 0 ? {} : { inputDefaults: defaults }
10051
10337
  };
10052
10338
  switch (node.kind) {
10053
10339
  case "task": {
10054
- const { task: inline, additionalInputs: _additional, ...instance } = node;
10055
- const task = inline ?? document.tasks[node.taskId];
10340
+ const { task, additionalInputs: _additional, ...instance } = node;
10056
10341
  return {
10057
10342
  ...instance,
10058
10343
  ...ports,
@@ -10112,8 +10397,7 @@ function inspectNode(document, node) {
10112
10397
  };
10113
10398
  case "error":
10114
10399
  case "manual":
10115
- case "cron":
10116
- case "subflow": return {
10400
+ case "cron": return {
10117
10401
  ...node,
10118
10402
  ...ports
10119
10403
  };
@@ -10144,7 +10428,7 @@ function nodeDetails(content, nodeId, node) {
10144
10428
  node,
10145
10429
  nodeId
10146
10430
  };
10147
- if (node.task != null) {
10431
+ if ("moduleId" in node.task) {
10148
10432
  const module = content.modules[node.task.moduleId];
10149
10433
  return {
10150
10434
  node,
@@ -10152,7 +10436,7 @@ function nodeDetails(content, nodeId, node) {
10152
10436
  ...module == null ? {} : { module }
10153
10437
  };
10154
10438
  }
10155
- const task = content.document.tasks[node.taskId];
10439
+ const task = node.task;
10156
10440
  return {
10157
10441
  node,
10158
10442
  nodeId,
@@ -10161,9 +10445,9 @@ function nodeDetails(content, nodeId, node) {
10161
10445
  }
10162
10446
  //#endregion
10163
10447
  //#region src/control/common/eventSources.ts
10164
- var id = string().min(1).max(256);
10165
- var eventType = string().regex(/^[a-z][a-z0-9_.]{0,127}$/);
10166
- var name = string().trim().min(1).max(128);
10448
+ var id = string$1().min(1).max(256);
10449
+ var eventType = string$1().regex(/^[a-z][a-z0-9_.]{0,127}$/);
10450
+ var name = string$1().trim().min(1).max(128);
10167
10451
  var eventSourceSchema = strictObject({
10168
10452
  version: literal(1),
10169
10453
  sourceId: id,
@@ -10178,13 +10462,13 @@ var eventSourceSchema = strictObject({
10178
10462
  manageSubscriptions: boolean(),
10179
10463
  verificationTokenConfigured: boolean(),
10180
10464
  encryptKeyConfigured: boolean(),
10181
- endpointUrl: string().nullable(),
10182
- verifiedAt: string().nullable(),
10183
- lastReceivedAt: string().nullable(),
10184
- updatedAt: string(),
10465
+ endpointUrl: string$1().nullable(),
10466
+ verifiedAt: string$1().nullable(),
10467
+ lastReceivedAt: string$1().nullable(),
10468
+ updatedAt: string$1(),
10185
10469
  consumers: array(strictObject({
10186
10470
  flowId: id,
10187
- flowName: string(),
10471
+ flowName: string$1(),
10188
10472
  triggerNodeId: id
10189
10473
  }))
10190
10474
  });
@@ -10213,32 +10497,32 @@ function isUiLanguage(value) {
10213
10497
  //#endregion
10214
10498
  //#region src/trigger/common/configSchema.ts
10215
10499
  var configInputsSchema = array(union([strictObject({
10216
- handle: string().min(1),
10217
- description: string().optional(),
10218
- jsonSchema: json$2(),
10500
+ handle: string$1().min(1),
10501
+ description: string$1().optional(),
10502
+ jsonSchema: json$3(),
10219
10503
  nullable: boolean(),
10220
- value: json$2().optional()
10504
+ value: json$3().optional()
10221
10505
  }), strictObject({
10222
- group: string(),
10506
+ group: string$1(),
10223
10507
  collapsed: boolean().optional()
10224
10508
  })]));
10225
10509
  //#endregion
10226
10510
  //#region src/control/common/triggerDecoders.ts
10227
10511
  function triggerKeySummary(value) {
10228
- const source = record$1(value);
10512
+ const source = record(value);
10229
10513
  const type = source.type;
10230
10514
  if (type != "integration" && type != "poll") return invalidResponse();
10231
10515
  return {
10232
10516
  description: typeof source.description == "string" ? source.description : invalidResponse(),
10233
- displayName: string$1(source.displayName),
10234
- key: string$1(source.key),
10235
- name: string$1(source.name),
10236
- provider: string$1(source.provider),
10517
+ displayName: string(source.displayName),
10518
+ key: string(source.key),
10519
+ name: string(source.name),
10520
+ provider: string(source.provider),
10237
10521
  type
10238
10522
  };
10239
10523
  }
10240
10524
  function triggerKey(value) {
10241
- const source = record$1(value);
10525
+ const source = record(value);
10242
10526
  const summary = triggerKeySummary(source);
10243
10527
  const base = {
10244
10528
  configInputs: configInputsSchema.parse(source.configInputs),
@@ -10248,12 +10532,12 @@ function triggerKey(value) {
10248
10532
  key: summary.key,
10249
10533
  name: summary.name,
10250
10534
  outputs: (Array.isArray(source.outputs) ? source.outputs : invalidResponse()).map((entry) => {
10251
- const port = record$1(entry);
10535
+ const port = record(entry);
10252
10536
  return Object.assign({
10253
- handle: string$1(port.handle),
10537
+ handle: string(port.handle),
10254
10538
  jsonSchema: jsonValue(port.jsonSchema),
10255
10539
  nullable: typeof port.nullable === "boolean" ? port.nullable : invalidResponse()
10256
- }, port.description == null ? {} : { description: string$1(port.description) });
10540
+ }, port.description == null ? {} : { description: string(port.description) });
10257
10541
  }),
10258
10542
  provider: summary.provider
10259
10543
  };
@@ -10261,12 +10545,12 @@ function triggerKey(value) {
10261
10545
  ...base,
10262
10546
  type: "poll"
10263
10547
  };
10264
- const endpoint = record$1(source.endpoint);
10265
- const body = record$1(endpoint.body);
10548
+ const endpoint = record(source.endpoint);
10549
+ const body = record(endpoint.body);
10266
10550
  if (!Array.isArray(endpoint.methods) || !Array.isArray(body.formats) || typeof body.allowArray != "boolean" || typeof body.allowEmpty != "boolean") return invalidResponse();
10267
- const methods = endpoint.methods.map(string$1);
10268
- const formats = body.formats.map(string$1);
10269
- const successStatus = integer$1(endpoint.successStatus);
10551
+ const methods = endpoint.methods.map(string);
10552
+ const formats = body.formats.map(string);
10553
+ const successStatus = integer(endpoint.successStatus);
10270
10554
  if (methods.some((method) => ![
10271
10555
  "DELETE",
10272
10556
  "GET",
@@ -10318,38 +10602,38 @@ var triggerActivityKinds = /* @__PURE__ */ new Set([
10318
10602
  "operator.resumed"
10319
10603
  ]);
10320
10604
  function triggerBinding(value) {
10321
- const source = record$1(value);
10605
+ const source = record(value);
10322
10606
  const health = source.health;
10323
- const listener = source.listener == null ? void 0 : record$1(source.listener);
10607
+ const listener = source.listener == null ? void 0 : record(source.listener);
10324
10608
  if (listener != null && listener.health != "healthy" && listener.health != "failed" && listener.health != "needs_reauth") return invalidResponse();
10325
10609
  const kind = source.kind;
10326
10610
  const operatorState = source.operatorState;
10327
- const runtimeVersion = integer$1(source.runtimeVersion);
10611
+ const runtimeVersion = integer(source.runtimeVersion);
10328
10612
  if (source.version != 1 || typeof health != "string" || !triggerHealth.has(health)) return invalidResponse();
10329
10613
  if (typeof kind != "string" || !triggerKinds.has(kind)) return invalidResponse();
10330
10614
  if (operatorState != "active" && operatorState != "paused") return invalidResponse();
10331
10615
  if (runtimeVersion <= 0) return invalidResponse();
10332
10616
  return {
10333
- ...source.currentPublicationId == null ? {} : { currentPublicationId: string$1(source.currentPublicationId) },
10334
- ...source.currentRevisionId == null ? {} : { currentRevisionId: string$1(source.currentRevisionId) },
10335
- ...source.endpointUrl == null ? {} : { endpointUrl: string$1(source.endpointUrl) },
10617
+ ...source.currentPublicationId == null ? {} : { currentPublicationId: string(source.currentPublicationId) },
10618
+ ...source.currentRevisionId == null ? {} : { currentRevisionId: string(source.currentRevisionId) },
10619
+ ...source.endpointUrl == null ? {} : { endpointUrl: string(source.endpointUrl) },
10336
10620
  ...listener == null ? {} : { listener: {
10337
10621
  health: listener.health,
10338
- ...listener.lastErrorCode == null ? {} : { lastErrorCode: string$1(listener.lastErrorCode) }
10622
+ ...listener.lastErrorCode == null ? {} : { lastErrorCode: string(listener.lastErrorCode) }
10339
10623
  } },
10340
- flowId: string$1(source.flowId),
10624
+ flowId: string(source.flowId),
10341
10625
  health,
10342
10626
  kind,
10343
- ...source.lastErrorCode == null ? {} : { lastErrorCode: string$1(source.lastErrorCode) },
10627
+ ...source.lastErrorCode == null ? {} : { lastErrorCode: string(source.lastErrorCode) },
10344
10628
  operatorState,
10345
10629
  runtimeVersion,
10346
- triggerNodeId: string$1(source.triggerNodeId),
10347
- updatedAt: string$1(source.updatedAt),
10630
+ triggerNodeId: string(source.triggerNodeId),
10631
+ updatedAt: string(source.updatedAt),
10348
10632
  version: 1
10349
10633
  };
10350
10634
  }
10351
10635
  function triggerBindingDetail(value) {
10352
- const source = record$1(value);
10636
+ const source = record(value);
10353
10637
  if (source.version != 1) return invalidResponse();
10354
10638
  return {
10355
10639
  binding: triggerBinding(source.binding),
@@ -10357,22 +10641,22 @@ function triggerBindingDetail(value) {
10357
10641
  };
10358
10642
  }
10359
10643
  function triggerActivity(value) {
10360
- const source = record$1(value);
10644
+ const source = record(value);
10361
10645
  const kind = source.kind;
10362
10646
  if (typeof kind != "string" || !triggerActivityKinds.has(kind)) return invalidResponse();
10363
10647
  const errorCode = optionalString(source.errorCode);
10364
10648
  const errorMessage = optionalString(source.errorMessage);
10365
10649
  if (errorMessage != null && errorMessage.length > 512) return invalidResponse();
10366
10650
  return {
10367
- activityId: string$1(source.activityId),
10368
- createdAt: string$1(source.createdAt),
10651
+ activityId: string(source.activityId),
10652
+ createdAt: string(source.createdAt),
10369
10653
  ...errorCode == null ? {} : { errorCode },
10370
10654
  ...errorMessage == null ? {} : { errorMessage },
10371
10655
  kind
10372
10656
  };
10373
10657
  }
10374
10658
  function triggerActivityPage(value) {
10375
- const source = record$1(value);
10659
+ const source = record(value);
10376
10660
  const nextCursor = optionalString(source.nextCursor);
10377
10661
  if (source.version != 1 || !Array.isArray(source.activities)) return invalidResponse();
10378
10662
  return {
@@ -10382,12 +10666,12 @@ function triggerActivityPage(value) {
10382
10666
  };
10383
10667
  }
10384
10668
  function pollTriggerTestResult(value) {
10385
- const source = record$1(value);
10386
- const filtered = integer$1(source.filtered);
10669
+ const source = record(value);
10670
+ const filtered = integer(source.filtered);
10387
10671
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.hasMore != "boolean" || filtered < 0) return invalidResponse();
10388
10672
  return {
10389
10673
  events: source.events.map((event) => {
10390
- const object = record$1(event);
10674
+ const object = record(event);
10391
10675
  return Object.fromEntries(Object.entries(object).map(([key, item]) => [key, jsonValue(item)]));
10392
10676
  }),
10393
10677
  filtered,
@@ -10398,7 +10682,7 @@ function pollTriggerTestResult(value) {
10398
10682
  //#endregion
10399
10683
  //#region src/control/common/triggerCatalog.ts
10400
10684
  function decodeTriggerCatalog(value) {
10401
- const source = record$1(value);
10685
+ const source = record(value);
10402
10686
  exact(source, [
10403
10687
  "version",
10404
10688
  "locale",
@@ -10407,12 +10691,12 @@ function decodeTriggerCatalog(value) {
10407
10691
  ]);
10408
10692
  if (source.version != 3 || !isUiLanguage(source.locale) || !Array.isArray(source.definitions)) return invalidResponse();
10409
10693
  const definitions = source.definitions.map(triggerKey);
10410
- const entries = record$1(source.display);
10694
+ const entries = record(source.display);
10411
10695
  const keys = new Set(definitions.map((definition) => definition.key));
10412
10696
  if (keys.size != definitions.length || Object.keys(entries).length != keys.size) return invalidResponse();
10413
10697
  const display = Object.fromEntries(definitions.map((definition) => {
10414
10698
  const { key } = definition;
10415
- const copy = record$1(entries[key]);
10699
+ const copy = record(entries[key]);
10416
10700
  exact(copy, [
10417
10701
  "configInputs",
10418
10702
  "configInputLabels",
@@ -10423,8 +10707,8 @@ function decodeTriggerCatalog(value) {
10423
10707
  return [key, {
10424
10708
  configInputs: descriptions(copy.configInputs, definition.configInputs.flatMap((field) => "handle" in field ? [field.handle] : [])),
10425
10709
  configInputLabels: labels(copy.configInputLabels, definition.configInputs.flatMap((field) => "handle" in field ? [field.handle] : [])),
10426
- displayName: string$1(copy.displayName),
10427
- description: string$1(copy.description),
10710
+ displayName: string(copy.displayName),
10711
+ description: string(copy.description),
10428
10712
  outputs: descriptions(copy.outputs, definition.outputs.map((field) => field.handle))
10429
10713
  }];
10430
10714
  }));
@@ -10436,15 +10720,15 @@ function decodeTriggerCatalog(value) {
10436
10720
  };
10437
10721
  }
10438
10722
  function descriptions(value, handles) {
10439
- const source = record$1(value);
10723
+ const source = record(value);
10440
10724
  exact(source, handles);
10441
- return Object.fromEntries(Object.entries(source).map(([handle, description]) => [handle, string$1(description)]));
10725
+ return Object.fromEntries(Object.entries(source).map(([handle, description]) => [handle, string(description)]));
10442
10726
  }
10443
10727
  function labels(value, handles) {
10444
- const source = record$1(value);
10728
+ const source = record(value);
10445
10729
  if (Object.keys(source).some((handle) => !handles.includes(handle))) return invalidResponse();
10446
10730
  return Object.fromEntries(Object.entries(source).map(([handle, label]) => {
10447
- const text = string$1(label);
10731
+ const text = string(label);
10448
10732
  return text.trim().length == 0 ? invalidResponse() : [handle, text];
10449
10733
  }));
10450
10734
  }
@@ -10463,16 +10747,16 @@ function searchTriggerKeys(keys, query) {
10463
10747
  //#endregion
10464
10748
  //#region src/control/common/resultQuery.ts
10465
10749
  var resultQuerySchema = strictObject({
10466
- pointer: string().max(4096).default(""),
10750
+ pointer: string$1().max(4096).default(""),
10467
10751
  offset: number().int().nonnegative().default(0),
10468
10752
  limit: number().int().min(1).max(100).default(20),
10469
10753
  maxBytes: number().int().min(1).max(1048576).default(15e3)
10470
10754
  });
10471
10755
  //#endregion
10472
10756
  //#region src/control/common/results.ts
10473
- var json = json$2();
10757
+ var json = json$3();
10474
10758
  var entry = strictObject({
10475
- pointer: string(),
10759
+ pointer: string$1(),
10476
10760
  type: _enum([
10477
10761
  "object",
10478
10762
  "array",
@@ -10491,26 +10775,26 @@ var page = entry.extend({
10491
10775
  entries: array(entry).optional()
10492
10776
  });
10493
10777
  var result = strictObject({
10494
- resultId: string().min(1),
10495
- callId: string().min(1),
10496
- toolId: string().min(1),
10778
+ resultId: string$1().min(1),
10779
+ callId: string$1().min(1),
10780
+ toolId: string$1().min(1),
10497
10781
  source: discriminatedUnion("kind", [strictObject({
10498
10782
  kind: literal("connector"),
10499
- action: string().min(1)
10783
+ action: string$1().min(1)
10500
10784
  }), strictObject({ kind: literal("code") })]),
10501
10785
  bytes: number().int().nonnegative(),
10502
- digest: string().regex(/^[a-f0-9]{64}$/),
10503
- createdAt: string().datetime()
10786
+ digest: string$1().regex(/^[a-f0-9]{64}$/),
10787
+ createdAt: string$1().datetime()
10504
10788
  });
10505
10789
  var listSchema = strictObject({
10506
10790
  version: literal(1),
10507
- runId: string(),
10791
+ runId: string$1(),
10508
10792
  results: array(result),
10509
- nextAfter: string().optional()
10793
+ nextAfter: string$1().optional()
10510
10794
  });
10511
10795
  var readSchema = strictObject({
10512
10796
  version: literal(1),
10513
- runId: string(),
10797
+ runId: string$1(),
10514
10798
  result,
10515
10799
  page
10516
10800
  });
@@ -10637,8 +10921,8 @@ function schemaPath(value) {
10637
10921
  return value.map((part) => typeof part == "string" || Number.isSafeInteger(part) ? part : invalidResponse());
10638
10922
  }
10639
10923
  function schemaMismatch(value) {
10640
- const source = record$1(value);
10641
- const kind = string$1(source.kind);
10924
+ const source = record(value);
10925
+ const kind = string(source.kind);
10642
10926
  if (kind == "artifact" || kind == "binary" || kind == "nullable") return { kind };
10643
10927
  if (kind == "schema") return {
10644
10928
  kind,
@@ -10654,30 +10938,30 @@ function schemaMismatch(value) {
10654
10938
  };
10655
10939
  }
10656
10940
  function diagnostic(value) {
10657
- const source = record$1(value);
10658
- const values = source.values == null ? void 0 : record$1(source.values);
10941
+ const source = record(value);
10942
+ const values = source.values == null ? void 0 : record(source.values);
10659
10943
  return {
10660
- code: string$1(source.code),
10661
- column: integer$1(source.column),
10662
- ...source.fields === void 0 ? {} : { fields: Array.isArray(source.fields) ? source.fields.map(string$1) : invalidResponse() },
10663
- line: integer$1(source.line),
10664
- message: string$1(source.message),
10944
+ code: string(source.code),
10945
+ column: integer(source.column),
10946
+ ...source.fields === void 0 ? {} : { fields: Array.isArray(source.fields) ? source.fields.map(string) : invalidResponse() },
10947
+ line: integer(source.line),
10948
+ message: string(source.message),
10665
10949
  mismatch: source.mismatch == null ? void 0 : schemaMismatch(source.mismatch),
10666
10950
  path: typeof source.path == "string" ? source.path : invalidResponse(),
10667
10951
  ...values == null ? {} : { values: Object.fromEntries(Object.entries(values).map(([key, candidate]) => [key, typeof candidate == "string" || typeof candidate == "number" ? candidate : invalidResponse()])) }
10668
10952
  };
10669
10953
  }
10670
10954
  function flowCheck(value) {
10671
- const source = record$1(value);
10955
+ const source = record(value);
10672
10956
  if (source.version != 1 || typeof source.valid != "boolean" || !Array.isArray(source.diagnostics)) return invalidResponse();
10673
10957
  return {
10674
- closureDigest: string$1(source.closureDigest),
10958
+ closureDigest: string(source.closureDigest),
10675
10959
  diagnostics: source.diagnostics.map(diagnostic),
10676
- engineContract: string$1(source.engineContract),
10677
- flowId: string$1(source.flowId),
10678
- modelVersion: integer$1(source.modelVersion),
10679
- revisionDigest: string$1(source.revisionDigest),
10680
- revisionId: string$1(source.revisionId),
10960
+ engineContract: string(source.engineContract),
10961
+ flowId: string(source.flowId),
10962
+ modelVersion: integer(source.modelVersion),
10963
+ revisionDigest: string(source.revisionDigest),
10964
+ revisionId: string(source.revisionId),
10681
10965
  valid: source.valid,
10682
10966
  version: 1
10683
10967
  };
@@ -10693,7 +10977,7 @@ function connectorProvidersQuery(flowId, locale) {
10693
10977
  return {
10694
10978
  path: `/v1/connector/providers${parameters ? `?${parameters}` : ""}`,
10695
10979
  decode: (value) => {
10696
- const source = record$1(value);
10980
+ const source = record(value);
10697
10981
  exact(source, ["providers", "version"]);
10698
10982
  if (source.version != 1 || !Array.isArray(source.providers)) return invalidResponse();
10699
10983
  return source.providers.map(connectorProvider);
@@ -10708,7 +10992,7 @@ function connectorActionQuery(actionId, flowId, locale) {
10708
10992
  return {
10709
10993
  path: `/v1/connector/actions/${encodeURIComponent(actionId)}${parameters ? `?${parameters}` : ""}`,
10710
10994
  decode: (value) => {
10711
- const source = record$1(value);
10995
+ const source = record(value);
10712
10996
  exact(source, ["action", "version"]);
10713
10997
  if (source.version != 1) return invalidResponse();
10714
10998
  return connectorAction(source.action);
@@ -10719,7 +11003,7 @@ function allConnectorConnectionsQuery(flowId) {
10719
11003
  return {
10720
11004
  path: `/v1/connector/connections${scope(flowId)}`,
10721
11005
  decode: (value) => {
10722
- const source = record$1(value);
11006
+ const source = record(value);
10723
11007
  exact(source, ["connections", "version"]);
10724
11008
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
10725
11009
  return source.connections.map(connection);
@@ -10730,44 +11014,82 @@ function connectorConnectionsQuery(serviceId, flowId) {
10730
11014
  return {
10731
11015
  path: `/v1/connector/connections/${encodeURIComponent(serviceId)}${scope(flowId)}`,
10732
11016
  decode: (value) => {
10733
- const source = record$1(value);
11017
+ const source = record(value);
10734
11018
  exact(source, [
10735
11019
  "connections",
10736
11020
  "serviceId",
10737
11021
  "version"
10738
11022
  ]);
10739
- if (source.version != 1 || string$1(source.serviceId) != serviceId || !Array.isArray(source.connections)) return invalidResponse();
11023
+ if (source.version != 1 || string(source.serviceId) != serviceId || !Array.isArray(source.connections)) return invalidResponse();
10740
11024
  return source.connections.map(connection);
10741
11025
  }
10742
11026
  };
10743
11027
  }
10744
11028
  //#endregion
10745
11029
  //#region src/control/common/flowDecoders.ts
11030
+ function strings(value) {
11031
+ return Array.isArray(value) ? value.map(string) : invalidResponse();
11032
+ }
11033
+ function resourceReferences(input) {
11034
+ const source = record(input);
11035
+ const draft = source.draft === null ? null : record(source.draft);
11036
+ const shared = record(source.sharedAccess);
11037
+ if (draft != null && !Array.isArray(draft.connections)) return invalidResponse();
11038
+ if (!Array.isArray(shared.bindings)) return invalidResponse();
11039
+ const accessRevision = integer(shared.accessRevision);
11040
+ if (accessRevision < 0) return invalidResponse();
11041
+ return {
11042
+ draft: draft == null ? null : {
11043
+ variableNames: strings(draft.variableNames),
11044
+ errorSourceFlowIds: strings(draft.errorSourceFlowIds),
11045
+ connections: draft.connections.map((value) => {
11046
+ const connection = record(value);
11047
+ return {
11048
+ providerId: string(connection.providerId),
11049
+ connectionId: string(connection.connectionId)
11050
+ };
11051
+ })
11052
+ },
11053
+ sharedAccess: {
11054
+ accessRevision,
11055
+ providerIds: strings(shared.providerIds),
11056
+ bindings: shared.bindings.map((value) => {
11057
+ const binding = record(value);
11058
+ return {
11059
+ providerId: string(binding.providerId),
11060
+ connectionId: binding.connectionId === null ? null : string(binding.connectionId),
11061
+ accessBindingId: string(binding.accessBindingId)
11062
+ };
11063
+ })
11064
+ }
11065
+ };
11066
+ }
10746
11067
  function flow(value) {
10747
- const source = record$1(value);
11068
+ const source = record(value);
10748
11069
  const status = source.status;
10749
11070
  if (source.version != 1) return invalidResponse();
10750
11071
  if (status != "active" && status != "retiring") return invalidResponse();
10751
- const target = source.live == null ? void 0 : record$1(source.live);
11072
+ const target = source.live == null ? void 0 : record(source.live);
10752
11073
  if (target != null && typeof target.enabled != "boolean") return invalidResponse();
10753
11074
  return {
10754
11075
  ...target == null ? {} : { live: {
10755
11076
  enabled: target.enabled,
10756
- publicationId: string$1(target.publicationId),
10757
- revisionId: string$1(target.revisionId)
11077
+ publicationId: string(target.publicationId),
11078
+ revisionId: string(target.revisionId)
10758
11079
  } },
10759
- createdAt: string$1(source.createdAt),
10760
- ...source.connectorTeamId == null ? {} : { connectorTeamId: string$1(source.connectorTeamId) },
10761
- draftRevisionId: string$1(source.draftRevisionId),
10762
- flowId: string$1(source.flowId),
10763
- name: string$1(source.name),
11080
+ createdAt: string(source.createdAt),
11081
+ ...source.connectorTeamId == null ? {} : { connectorTeamId: string(source.connectorTeamId) },
11082
+ draftRevisionId: string(source.draftRevisionId),
11083
+ resourceReferences: resourceReferences(source.resourceReferences),
11084
+ flowId: string(source.flowId),
11085
+ name: string(source.name),
10764
11086
  status,
10765
- updatedAt: string$1(source.updatedAt),
11087
+ updatedAt: string(source.updatedAt),
10766
11088
  version: 1
10767
11089
  };
10768
11090
  }
10769
11091
  function flowPage(value) {
10770
- const source = record$1(value);
11092
+ const source = record(value);
10771
11093
  if (source.version != 1 || !Array.isArray(source.flows)) return invalidResponse();
10772
11094
  const nextCursor = source.nextCursor;
10773
11095
  const total = source.total;
@@ -10781,7 +11103,7 @@ function flowPage(value) {
10781
11103
  };
10782
11104
  }
10783
11105
  function variable(value) {
10784
- const source = record$1(value);
11106
+ const source = record(value);
10785
11107
  exact(source, [
10786
11108
  "name",
10787
11109
  "updatedAt",
@@ -10789,35 +11111,35 @@ function variable(value) {
10789
11111
  "version"
10790
11112
  ]);
10791
11113
  if (source.version != 1 || typeof source.value != "string") return invalidResponse();
10792
- const updatedAt = string$1(source.updatedAt);
11114
+ const updatedAt = string(source.updatedAt);
10793
11115
  try {
10794
11116
  if (new Date(updatedAt).toISOString() != updatedAt) return invalidResponse();
10795
11117
  } catch {
10796
11118
  return invalidResponse();
10797
11119
  }
10798
11120
  return {
10799
- name: string$1(source.name),
11121
+ name: string(source.name),
10800
11122
  updatedAt,
10801
11123
  value: source.value,
10802
11124
  version: 1
10803
11125
  };
10804
11126
  }
10805
11127
  function errorListener(value) {
10806
- const source = record$1(value);
11128
+ const source = record(value);
10807
11129
  if (typeof source.enabled != "boolean") return invalidResponse();
10808
11130
  return {
10809
- flowId: string$1(source.flowId),
10810
- flowName: string$1(source.flowName),
10811
- nodeId: string$1(source.nodeId),
10812
- nodeName: string$1(source.nodeName),
11131
+ flowId: string(source.flowId),
11132
+ flowName: string(source.flowName),
11133
+ nodeId: string(source.nodeId),
11134
+ nodeName: string(source.nodeName),
10813
11135
  enabled: source.enabled
10814
11136
  };
10815
11137
  }
10816
11138
  //#endregion
10817
11139
  //#region src/control/common/publicationDecoders.ts
10818
11140
  function publication(value) {
10819
- const source = record$1(value);
10820
- const liveEnd = source.liveEnd == null ? void 0 : record$1(source.liveEnd);
11141
+ const source = record(value);
11142
+ const liveEnd = source.liveEnd == null ? void 0 : record(source.liveEnd);
10821
11143
  if (liveEnd != null && typeof liveEnd.enabled != "boolean") return invalidResponse();
10822
11144
  const operation = source.operation;
10823
11145
  const sourcePublicationId = source.sourcePublicationId;
@@ -10827,32 +11149,32 @@ function publication(value) {
10827
11149
  return {
10828
11150
  ...liveEnd == null ? {} : { liveEnd: {
10829
11151
  enabled: liveEnd.enabled,
10830
- endedAt: string$1(liveEnd.endedAt)
11152
+ endedAt: string(liveEnd.endedAt)
10831
11153
  } },
10832
- actorId: string$1(source.actorId),
10833
- closureDigest: string$1(source.closureDigest),
10834
- createdAt: string$1(source.createdAt),
10835
- engineContract: string$1(source.engineContract),
10836
- flowId: string$1(source.flowId),
10837
- modelVersion: integer$1(source.modelVersion),
11154
+ actorId: string(source.actorId),
11155
+ closureDigest: string(source.closureDigest),
11156
+ createdAt: string(source.createdAt),
11157
+ engineContract: string(source.engineContract),
11158
+ flowId: string(source.flowId),
11159
+ modelVersion: integer(source.modelVersion),
10838
11160
  operation,
10839
- publicationId: string$1(source.publicationId),
10840
- sharedAccessDigest: string$1(source.sharedAccessDigest),
10841
- revisionDigest: string$1(source.revisionDigest),
10842
- revisionId: string$1(source.revisionId),
11161
+ publicationId: string(source.publicationId),
11162
+ sharedAccessDigest: string(source.sharedAccessDigest),
11163
+ revisionDigest: string(source.revisionDigest),
11164
+ revisionId: string(source.revisionId),
10843
11165
  ...sourcePublicationId == null ? {} : { sourcePublicationId },
10844
11166
  version: 1
10845
11167
  };
10846
11168
  }
10847
11169
  function publishOperation(value) {
10848
- const source = record$1(value);
11170
+ const source = record(value);
10849
11171
  const status = source.status;
10850
11172
  const common = {
10851
- createdAt: string$1(source.createdAt),
10852
- flowId: string$1(source.flowId),
10853
- operationId: string$1(source.operationId),
10854
- revisionId: string$1(source.revisionId),
10855
- updatedAt: string$1(source.updatedAt),
11173
+ createdAt: string(source.createdAt),
11174
+ flowId: string(source.flowId),
11175
+ operationId: string(source.operationId),
11176
+ revisionId: string(source.revisionId),
11177
+ updatedAt: string(source.updatedAt),
10856
11178
  version: 1
10857
11179
  };
10858
11180
  if (source.version != 1) return invalidResponse();
@@ -10884,7 +11206,7 @@ function publishOperation(value) {
10884
11206
  ]);
10885
11207
  return {
10886
11208
  ...common,
10887
- publicationId: string$1(source.publicationId),
11209
+ publicationId: string(source.publicationId),
10888
11210
  status
10889
11211
  };
10890
11212
  case "failed": {
@@ -10898,7 +11220,7 @@ function publishOperation(value) {
10898
11220
  "updatedAt",
10899
11221
  "version"
10900
11222
  ]);
10901
- const issue = record$1(source.issue);
11223
+ const issue = record(source.issue);
10902
11224
  const nodeId = issue.nodeId;
10903
11225
  exact(issue, [
10904
11226
  "code",
@@ -10908,9 +11230,9 @@ function publishOperation(value) {
10908
11230
  return {
10909
11231
  ...common,
10910
11232
  issue: {
10911
- code: string$1(issue.code),
10912
- message: string$1(issue.message),
10913
- ...nodeId == null ? {} : { nodeId: string$1(nodeId) }
11233
+ code: string(issue.code),
11234
+ message: string(issue.message),
11235
+ ...nodeId == null ? {} : { nodeId: string(nodeId) }
10914
11236
  },
10915
11237
  status
10916
11238
  };
@@ -10919,7 +11241,7 @@ function publishOperation(value) {
10919
11241
  }
10920
11242
  }
10921
11243
  function live(value) {
10922
- const source = record$1(value);
11244
+ const source = record(value);
10923
11245
  const status = source.status;
10924
11246
  const candidate = source.publication;
10925
11247
  if (source.version != 1 || typeof source.hasUnpublishedChanges != "boolean") return invalidResponse();
@@ -10927,16 +11249,16 @@ function live(value) {
10927
11249
  if (status == "not-published" && candidate !== null) return invalidResponse();
10928
11250
  if (status != "not-published" && candidate === null) return invalidResponse();
10929
11251
  return {
10930
- flowId: string$1(source.flowId),
11252
+ flowId: string(source.flowId),
10931
11253
  hasUnpublishedChanges: source.hasUnpublishedChanges,
10932
11254
  publication: candidate === null ? null : publication(candidate),
10933
- revision: integer$1(source.revision),
11255
+ revision: integer(source.revision),
10934
11256
  status,
10935
11257
  version: 1
10936
11258
  };
10937
11259
  }
10938
11260
  function publicationPage(value) {
10939
- const source = record$1(value);
11261
+ const source = record(value);
10940
11262
  const nextCursor = source.nextCursor;
10941
11263
  const total = source.total;
10942
11264
  if (source.version != 1 || !Array.isArray(source.publications)) return invalidResponse();
@@ -10952,22 +11274,22 @@ function publicationPage(value) {
10952
11274
  //#endregion
10953
11275
  //#region src/control/common/revisionDecoders.ts
10954
11276
  function revisionMetadata(value) {
10955
- const source = record$1(value);
11277
+ const source = record(value);
10956
11278
  const parentRevisionId = source.parentRevisionId;
10957
11279
  if (source.version != 1 || parentRevisionId !== null && typeof parentRevisionId != "string") return invalidResponse();
10958
11280
  return {
10959
- actorId: string$1(source.actorId),
10960
- createdAt: string$1(source.createdAt),
10961
- digest: string$1(source.digest),
10962
- flowId: string$1(source.flowId),
10963
- modelVersion: integer$1(source.modelVersion),
11281
+ actorId: string(source.actorId),
11282
+ createdAt: string(source.createdAt),
11283
+ digest: string(source.digest),
11284
+ flowId: string(source.flowId),
11285
+ modelVersion: integer(source.modelVersion),
10964
11286
  parentRevisionId,
10965
- revisionId: string$1(source.revisionId),
11287
+ revisionId: string(source.revisionId),
10966
11288
  version: 1
10967
11289
  };
10968
11290
  }
10969
11291
  function draft(value) {
10970
- const source = record$1(value);
11292
+ const source = record(value);
10971
11293
  try {
10972
11294
  return {
10973
11295
  ...revisionMetadata(source),
@@ -10978,17 +11300,17 @@ function draft(value) {
10978
11300
  }
10979
11301
  }
10980
11302
  function presentation(value) {
10981
- const source = record$1(value);
10982
- if (source.version != 1 || integer$1(source.revision) < 1) return invalidResponse();
11303
+ const source = record(value);
11304
+ if (source.version != 1 || integer(source.revision) < 1) return invalidResponse();
10983
11305
  return {
10984
- revision: integer$1(source.revision),
10985
- updatedAt: string$1(source.updatedAt),
10986
- value: Object.fromEntries(Object.entries(record$1(source.value)).map(([key, item]) => [key, jsonValue(item)])),
11306
+ revision: integer(source.revision),
11307
+ updatedAt: string(source.updatedAt),
11308
+ value: Object.fromEntries(Object.entries(record(source.value)).map(([key, item]) => [key, jsonValue(item)])),
10987
11309
  version: 1
10988
11310
  };
10989
11311
  }
10990
11312
  function draftChange(value) {
10991
- const source = record$1(value);
11313
+ const source = record(value);
10992
11314
  if (source.version != 1) return invalidResponse();
10993
11315
  return {
10994
11316
  revision: revisionMetadata(source.revision),
@@ -10996,7 +11318,7 @@ function draftChange(value) {
10996
11318
  };
10997
11319
  }
10998
11320
  function draftSync(value) {
10999
- const source = record$1(value);
11321
+ const source = record(value);
11000
11322
  if (source.version != 1 || source.kind != "snapshot") return invalidResponse();
11001
11323
  return {
11002
11324
  draft: draft(source.draft),
@@ -11022,7 +11344,7 @@ function runStatus(value) {
11022
11344
  return typeof value == "string" && runStatusSet.has(value) ? value : invalidResponse();
11023
11345
  }
11024
11346
  function run(value) {
11025
- const source = record$1(value);
11347
+ const source = record(value);
11026
11348
  const kind = source.source;
11027
11349
  const startedAt = source.startedAt;
11028
11350
  const finishedAt = source.finishedAt;
@@ -11030,11 +11352,11 @@ function run(value) {
11030
11352
  if (startedAt != null && typeof startedAt != "string") return invalidResponse();
11031
11353
  if (finishedAt != null && typeof finishedAt != "string") return invalidResponse();
11032
11354
  return {
11033
- createdAt: string$1(source.createdAt),
11355
+ createdAt: string(source.createdAt),
11034
11356
  ...finishedAt == null ? {} : { finishedAt },
11035
- flowId: string$1(source.flowId),
11036
- revisionId: string$1(source.revisionId),
11037
- runId: string$1(source.runId),
11357
+ flowId: string(source.flowId),
11358
+ revisionId: string(source.revisionId),
11359
+ runId: string(source.runId),
11038
11360
  source: kind,
11039
11361
  ...startedAt == null ? {} : { startedAt },
11040
11362
  status: runStatus(source.status),
@@ -11042,7 +11364,7 @@ function run(value) {
11042
11364
  };
11043
11365
  }
11044
11366
  function runWaiting(value) {
11045
- const source = record$1(value);
11367
+ const source = record(value);
11046
11368
  exact(source, [
11047
11369
  "actions",
11048
11370
  "expiresAt",
@@ -11055,15 +11377,15 @@ function runWaiting(value) {
11055
11377
  if (!Array.isArray(actions) || !(actions.length == 1 && actions[0] == "continue" || actions.length == 2 && actions[0] == "approve" && actions[1] == "reject")) return invalidResponse();
11056
11378
  return {
11057
11379
  actions,
11058
- expiresAt: string$1(source.expiresAt),
11059
- nodeId: string$1(source.nodeId),
11060
- prompt: string$1(source.prompt),
11061
- waitId: string$1(source.waitId),
11062
- waitingSince: string$1(source.waitingSince)
11380
+ expiresAt: string(source.expiresAt),
11381
+ nodeId: string(source.nodeId),
11382
+ prompt: string(source.prompt),
11383
+ waitId: string(source.waitId),
11384
+ waitingSince: string(source.waitingSince)
11063
11385
  };
11064
11386
  }
11065
11387
  function runDetails(value) {
11066
- const source = record$1(value);
11388
+ const source = record(value);
11067
11389
  const summary = run(source);
11068
11390
  const eventsExpiresAt = source.eventsExpiresAt;
11069
11391
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
@@ -11083,13 +11405,13 @@ function runDetails(value) {
11083
11405
  const details = {
11084
11406
  ...summary,
11085
11407
  ...errorHandling(source),
11086
- closureDigest: string$1(source.closureDigest),
11087
- engineContract: string$1(source.engineContract),
11088
- engineDigest: string$1(source.engineDigest),
11408
+ closureDigest: string(source.closureDigest),
11409
+ engineContract: string(source.engineContract),
11410
+ engineDigest: string(source.engineDigest),
11089
11411
  ...eventsExpiresAt == null ? {} : { eventsExpiresAt },
11090
- modelVersion: integer$1(source.modelVersion),
11091
- sharedAccessDigest: string$1(source.sharedAccessDigest),
11092
- revisionDigest: string$1(source.revisionDigest),
11412
+ modelVersion: integer(source.modelVersion),
11413
+ sharedAccessDigest: string(source.sharedAccessDigest),
11414
+ revisionDigest: string(source.revisionDigest),
11093
11415
  ...state
11094
11416
  };
11095
11417
  switch (summary.source) {
@@ -11099,40 +11421,40 @@ function runDetails(value) {
11099
11421
  };
11100
11422
  case "live": return {
11101
11423
  ...details,
11102
- publicationId: string$1(source.publicationId),
11424
+ publicationId: string(source.publicationId),
11103
11425
  source: "live",
11104
11426
  ...source.occurrenceId === void 0 ? {} : {
11105
- occurrenceId: string$1(source.occurrenceId),
11106
- triggerNodeId: string$1(source.triggerNodeId)
11427
+ occurrenceId: string(source.occurrenceId),
11428
+ triggerNodeId: string(source.triggerNodeId)
11107
11429
  }
11108
11430
  };
11109
11431
  }
11110
11432
  }
11111
11433
  function runPage(value) {
11112
- const source = record$1(value);
11434
+ const source = record(value);
11113
11435
  const nextCursor = source.nextCursor;
11114
11436
  if (source.version != 1 || !Array.isArray(source.runs)) return invalidResponse();
11115
11437
  if (nextCursor != null && typeof nextCursor != "string") return invalidResponse();
11116
11438
  return {
11117
- flowId: string$1(source.flowId),
11439
+ flowId: string(source.flowId),
11118
11440
  ...nextCursor == null ? {} : { nextCursor },
11119
11441
  runs: source.runs.map(run),
11120
11442
  version: 1
11121
11443
  };
11122
11444
  }
11123
11445
  function runCancellation(value) {
11124
- const source = record$1(value);
11446
+ const source = record(value);
11125
11447
  const status = runStatus(source.status);
11126
11448
  if (source.version != 1 || typeof source.cancelAccepted != "boolean" || status == "queued" || status == "starting" || status == "running" || status == "waiting") return invalidResponse();
11127
11449
  return {
11128
11450
  cancelAccepted: source.cancelAccepted,
11129
- runId: string$1(source.runId),
11451
+ runId: string(source.runId),
11130
11452
  status,
11131
11453
  version: 1
11132
11454
  };
11133
11455
  }
11134
11456
  function waitResolution(value) {
11135
- const source = record$1(value);
11457
+ const source = record(value);
11136
11458
  exact(source, [
11137
11459
  "action",
11138
11460
  "comment",
@@ -11151,19 +11473,19 @@ function waitResolution(value) {
11151
11473
  comment: source.comment,
11152
11474
  resolutionAccepted: source.resolutionAccepted,
11153
11475
  resolvedAt,
11154
- runId: string$1(source.runId),
11476
+ runId: string(source.runId),
11155
11477
  status: runStatus(source.status),
11156
11478
  version: 1,
11157
- waitId: string$1(source.waitId)
11479
+ waitId: string(source.waitId)
11158
11480
  };
11159
11481
  }
11160
11482
  function runResult(value) {
11161
- const source = record$1(value);
11483
+ const source = record(value);
11162
11484
  const status = source.status;
11163
11485
  if (source.version != 1) return invalidResponse();
11164
11486
  const base = {
11165
- finishedAt: string$1(source.finishedAt),
11166
- runId: string$1(source.runId),
11487
+ finishedAt: string(source.finishedAt),
11488
+ runId: string(source.runId),
11167
11489
  version: 1
11168
11490
  };
11169
11491
  if (status == "completed") {
@@ -11179,7 +11501,7 @@ function runResult(value) {
11179
11501
  status: "canceled"
11180
11502
  };
11181
11503
  if (status == "failed") {
11182
- const error = record$1(source.error);
11504
+ const error = record(source.error);
11183
11505
  return {
11184
11506
  ...base,
11185
11507
  error: runFailure(error),
@@ -11187,7 +11509,7 @@ function runResult(value) {
11187
11509
  };
11188
11510
  }
11189
11511
  if (status == "indeterminate") {
11190
- const error = record$1(source.error);
11512
+ const error = record(source.error);
11191
11513
  return {
11192
11514
  ...base,
11193
11515
  error: runFailure(error),
@@ -11197,16 +11519,16 @@ function runResult(value) {
11197
11519
  return invalidResponse();
11198
11520
  }
11199
11521
  function errorHandling(source) {
11200
- const errorSource = source.errorSource == null ? void 0 : record$1(source.errorSource);
11522
+ const errorSource = source.errorSource == null ? void 0 : record(source.errorSource);
11201
11523
  if (source.errorDispatches != null && !Array.isArray(source.errorDispatches)) return invalidResponse();
11202
11524
  return {
11203
11525
  ...errorSource == null ? {} : { errorSource: {
11204
- flowId: string$1(errorSource.flowId),
11205
- runId: string$1(errorSource.runId)
11526
+ flowId: string(errorSource.flowId),
11527
+ runId: string(errorSource.runId)
11206
11528
  } },
11207
11529
  ...source.errorDispatches == null ? {} : { errorDispatches: source.errorDispatches.map((value) => {
11208
- const dispatch = record$1(value);
11209
- const flowId = string$1(dispatch.flowId);
11530
+ const dispatch = record(value);
11531
+ const flowId = string(dispatch.flowId);
11210
11532
  switch (dispatch.status) {
11211
11533
  case "pending": return {
11212
11534
  status: "pending",
@@ -11215,12 +11537,12 @@ function errorHandling(source) {
11215
11537
  case "dispatched": return {
11216
11538
  status: "dispatched",
11217
11539
  flowId,
11218
- runId: string$1(dispatch.runId)
11540
+ runId: string(dispatch.runId)
11219
11541
  };
11220
11542
  case "failed": return {
11221
11543
  status: "failed",
11222
11544
  flowId,
11223
- message: string$1(dispatch.message)
11545
+ message: string(dispatch.message)
11224
11546
  };
11225
11547
  default: return invalidResponse();
11226
11548
  }
@@ -11229,11 +11551,11 @@ function errorHandling(source) {
11229
11551
  }
11230
11552
  function runFailure(error) {
11231
11553
  return {
11232
- code: string$1(error.code),
11233
- message: string$1(error.message),
11234
- ...error.nodeId === void 0 ? {} : { nodeId: string$1(error.nodeId) },
11235
- ...error.jobId === void 0 ? {} : { jobId: string$1(error.jobId) },
11236
- ...error.path === void 0 ? {} : { path: (Array.isArray(error.path) ? error.path : invalidResponse()).map(string$1) }
11554
+ code: string(error.code),
11555
+ message: string(error.message),
11556
+ ...error.nodeId === void 0 ? {} : { nodeId: string(error.nodeId) },
11557
+ ...error.jobId === void 0 ? {} : { jobId: string(error.jobId) },
11558
+ ...error.path === void 0 ? {} : { path: (Array.isArray(error.path) ? error.path : invalidResponse()).map(string) }
11237
11559
  };
11238
11560
  }
11239
11561
  //#endregion
@@ -11260,14 +11582,14 @@ function isRunTerminalEvent(event) {
11260
11582
  return event?.kind == "run.completed" || event?.kind == "run.failed" || event?.kind == "run.canceled" || event?.kind == "run.indeterminate";
11261
11583
  }
11262
11584
  function decodeRunEvent(value) {
11263
- const source = record$1(value);
11264
- const sequence = integer$1(source.sequence);
11585
+ const source = record(value);
11586
+ const sequence = integer(source.sequence);
11265
11587
  if (sequence < 0) return invalidResponse();
11266
11588
  const base = {
11267
- createdAt: string$1(source.createdAt),
11589
+ createdAt: string(source.createdAt),
11268
11590
  sequence
11269
11591
  };
11270
- const payload = record$1(source.payload);
11592
+ const payload = record(source.payload);
11271
11593
  const kind = source.kind;
11272
11594
  switch (kind) {
11273
11595
  case "run.queued": return {
@@ -11279,17 +11601,17 @@ function decodeRunEvent(value) {
11279
11601
  ...base,
11280
11602
  kind,
11281
11603
  payload: {
11282
- flowId: string$1(payload.flowId),
11283
- scopeId: string$1(payload.scopeId),
11284
- ...payload.parentScopeId === void 0 ? {} : { parentScopeId: string$1(payload.parentScopeId) }
11604
+ flowId: string(payload.flowId),
11605
+ scopeId: string(payload.scopeId),
11606
+ ...payload.parentScopeId === void 0 ? {} : { parentScopeId: string(payload.parentScopeId) }
11285
11607
  }
11286
11608
  };
11287
11609
  case "run.progress": return {
11288
11610
  ...base,
11289
11611
  kind,
11290
11612
  payload: {
11291
- flowId: string$1(payload.flowId),
11292
- scopeId: string$1(payload.scopeId),
11613
+ flowId: string(payload.flowId),
11614
+ scopeId: string(payload.scopeId),
11293
11615
  progress: eventProgress(payload.progress)
11294
11616
  }
11295
11617
  };
@@ -11298,16 +11620,16 @@ function decodeRunEvent(value) {
11298
11620
  return {
11299
11621
  ...base,
11300
11622
  kind,
11301
- payload: { waitIds: payload.waitIds.map((id) => string$1(id)) }
11623
+ payload: { waitIds: payload.waitIds.map((id) => string(id)) }
11302
11624
  };
11303
11625
  case "wait.created": return {
11304
11626
  ...base,
11305
11627
  kind,
11306
11628
  payload: {
11307
- expiresAt: string$1(payload.expiresAt),
11308
- nodeId: string$1(payload.nodeId),
11309
- waitId: string$1(payload.waitId),
11310
- waitingSince: string$1(payload.waitingSince)
11629
+ expiresAt: string(payload.expiresAt),
11630
+ nodeId: string(payload.nodeId),
11631
+ waitId: string(payload.waitId),
11632
+ waitingSince: string(payload.waitingSince)
11311
11633
  }
11312
11634
  };
11313
11635
  case "run.resolved": {
@@ -11320,8 +11642,8 @@ function decodeRunEvent(value) {
11320
11642
  payload: {
11321
11643
  action,
11322
11644
  comment: payload.comment,
11323
- resolvedAt: string$1(payload.resolvedAt),
11324
- waitId: string$1(payload.waitId)
11645
+ resolvedAt: string(payload.resolvedAt),
11646
+ waitId: string(payload.waitId)
11325
11647
  }
11326
11648
  };
11327
11649
  }
@@ -11345,23 +11667,23 @@ function decodeRunEvent(value) {
11345
11667
  case "node.progress":
11346
11668
  case "node.artifact": {
11347
11669
  const node = {
11348
- flowId: string$1(payload.flowId),
11349
- scopeId: string$1(payload.scopeId),
11350
- nodeId: string$1(payload.nodeId),
11351
- executionId: string$1(payload.executionId)
11670
+ flowId: string(payload.flowId),
11671
+ scopeId: string(payload.scopeId),
11672
+ nodeId: string(payload.nodeId),
11673
+ executionId: string(payload.executionId)
11352
11674
  };
11353
11675
  switch (kind) {
11354
11676
  case "node.started": {
11355
11677
  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();
11678
+ 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
11679
  return {
11358
11680
  ...base,
11359
11681
  kind,
11360
11682
  payload: {
11361
11683
  ...node,
11362
11684
  ...nodeKind === void 0 ? {} : { nodeKind },
11363
- ...payload.nodeTitle === void 0 ? {} : { nodeTitle: string$1(payload.nodeTitle) },
11364
- ...payload.operation === void 0 ? {} : { operation: string$1(payload.operation) }
11685
+ ...payload.nodeTitle === void 0 ? {} : { nodeTitle: string(payload.nodeTitle) },
11686
+ ...payload.operation === void 0 ? {} : { operation: string(payload.operation) }
11365
11687
  }
11366
11688
  };
11367
11689
  }
@@ -11370,19 +11692,19 @@ function decodeRunEvent(value) {
11370
11692
  kind,
11371
11693
  payload: {
11372
11694
  ...node,
11373
- outputs: Object.fromEntries(Object.entries(record$1(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
11695
+ outputs: Object.fromEntries(Object.entries(record(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
11374
11696
  }
11375
11697
  };
11376
11698
  case "node.failed": {
11377
- const error = record$1(payload.error);
11699
+ const error = record(payload.error);
11378
11700
  return {
11379
11701
  ...base,
11380
11702
  kind,
11381
11703
  payload: {
11382
11704
  ...node,
11383
11705
  error: {
11384
- code: string$1(error.code),
11385
- message: string$1(error.message)
11706
+ code: string(error.code),
11707
+ message: string(error.message)
11386
11708
  }
11387
11709
  }
11388
11710
  };
@@ -11396,7 +11718,7 @@ function decodeRunEvent(value) {
11396
11718
  payload: {
11397
11719
  ...node,
11398
11720
  level,
11399
- message: string$1(payload.message)
11721
+ message: string(payload.message)
11400
11722
  }
11401
11723
  };
11402
11724
  }
@@ -11409,9 +11731,9 @@ function decodeRunEvent(value) {
11409
11731
  }
11410
11732
  };
11411
11733
  case "node.artifact": {
11412
- const artifact = record$1(payload.artifact);
11413
- const size = integer$1(artifact.size);
11414
- const digest = string$1(artifact.digest);
11734
+ const artifact = record(payload.artifact);
11735
+ const size = integer(artifact.size);
11736
+ const digest = string(artifact.digest);
11415
11737
  if (artifact.kind != "artifact" || size < 0 || !/^sha256:[0-9a-f]{64}$/.test(digest)) return invalidResponse();
11416
11738
  return {
11417
11739
  ...base,
@@ -11420,11 +11742,11 @@ function decodeRunEvent(value) {
11420
11742
  ...node,
11421
11743
  artifact: {
11422
11744
  kind: "artifact",
11423
- id: string$1(artifact.id),
11424
- name: string$1(artifact.name),
11745
+ id: string(artifact.id),
11746
+ name: string(artifact.name),
11425
11747
  size,
11426
11748
  digest,
11427
- ...artifact.mediaType === void 0 ? {} : { mediaType: string$1(artifact.mediaType) }
11749
+ ...artifact.mediaType === void 0 ? {} : { mediaType: string(artifact.mediaType) }
11428
11750
  }
11429
11751
  }
11430
11752
  };
@@ -11438,9 +11760,9 @@ function eventProgress(value) {
11438
11760
  return typeof value == "number" && Number.isFinite(value) && value >= 0 && value <= 100 ? value : invalidResponse();
11439
11761
  }
11440
11762
  function runEvents(value) {
11441
- const source = record$1(value);
11763
+ const source = record(value);
11442
11764
  const eventsExpiresAt = source.eventsExpiresAt;
11443
- const nextAfter = integer$1(source.nextAfter);
11765
+ const nextAfter = integer(source.nextAfter);
11444
11766
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.done != "boolean" || typeof source.historyComplete != "boolean") return invalidResponse();
11445
11767
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
11446
11768
  if (nextAfter < 0) return invalidResponse();
@@ -11450,7 +11772,7 @@ function runEvents(value) {
11450
11772
  ...eventsExpiresAt == null ? {} : { eventsExpiresAt },
11451
11773
  historyComplete: source.historyComplete,
11452
11774
  nextAfter,
11453
- runId: string$1(source.runId),
11775
+ runId: string(source.runId),
11454
11776
  version: 1
11455
11777
  };
11456
11778
  }
@@ -11463,7 +11785,7 @@ var ControlClient = class {
11463
11785
  this.requestControl = requestControl;
11464
11786
  }
11465
11787
  async loadOpenApiDocument(url, signal) {
11466
- const result = record$1(await this.request("/v1/openapi/document", {
11788
+ const result = record(await this.request("/v1/openapi/document", {
11467
11789
  method: "POST",
11468
11790
  body: JSON.stringify({
11469
11791
  url,
@@ -11486,7 +11808,7 @@ var ControlClient = class {
11486
11808
  return decodeEventSources(await this.request("/v1/event-sources" + (flowId == null ? "" : `?flowId=${segment(flowId)}`), { signal }));
11487
11809
  }
11488
11810
  async listEventSourceConnections(teamId, signal) {
11489
- const source = record$1(await this.request(`/v1/event-sources/connections${teamId == null ? "" : `?teamId=${segment(teamId)}`}`, { signal }));
11811
+ const source = record(await this.request(`/v1/event-sources/connections${teamId == null ? "" : `?teamId=${segment(teamId)}`}`, { signal }));
11490
11812
  exact(source, ["version", "connections"]);
11491
11813
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
11492
11814
  return source.connections.map(connection);
@@ -11513,7 +11835,7 @@ var ControlClient = class {
11513
11835
  });
11514
11836
  }
11515
11837
  async listVariables() {
11516
- const source = record$1(await this.request("/v1/variables"));
11838
+ const source = record(await this.request("/v1/variables"));
11517
11839
  exact(source, ["variables", "version"]);
11518
11840
  if (source.version != 1 || !Array.isArray(source.variables)) return invalidResponse();
11519
11841
  return {
@@ -11531,7 +11853,7 @@ var ControlClient = class {
11531
11853
  }));
11532
11854
  }
11533
11855
  async deleteVariable(name) {
11534
- const source = record$1(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
11856
+ const source = record(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
11535
11857
  exact(source, ["version"]);
11536
11858
  if (source.version != 1) return invalidResponse();
11537
11859
  }
@@ -11550,7 +11872,7 @@ var ControlClient = class {
11550
11872
  return flow(await this.request(`/v1/flows/${segment(flowId)}`));
11551
11873
  }
11552
11874
  async getErrorListeners(flowId, signal) {
11553
- const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
11875
+ const source = record(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
11554
11876
  if (source.version != 1 || !Array.isArray(source.listeners)) return invalidResponse();
11555
11877
  return source.listeners.map(errorListener);
11556
11878
  }
@@ -11567,12 +11889,12 @@ var ControlClient = class {
11567
11889
  return flow(await this.request(`/v1/flows/${segment(flowId)}`, { method: "DELETE" }));
11568
11890
  }
11569
11891
  async listTriggerKeys(signal, locale) {
11570
- const source = record$1(await this.request(`/v1/trigger-keys${locale == null ? "" : `?locale=${encodeURIComponent(locale)}`}`, { signal }));
11892
+ const source = record(await this.request(`/v1/trigger-keys${locale == null ? "" : `?locale=${encodeURIComponent(locale)}`}`, { signal }));
11571
11893
  if (source.version != 1 || !Array.isArray(source.keys)) return invalidResponse();
11572
11894
  return source.keys.map(triggerKeySummary);
11573
11895
  }
11574
11896
  async listTriggerDefinitions(signal) {
11575
- const source = record$1(await this.request("/v1/trigger-keys/catalog", { signal }));
11897
+ const source = record(await this.request("/v1/trigger-keys/catalog", { signal }));
11576
11898
  if (source.version != 2 || !Array.isArray(source.definitions)) return invalidResponse();
11577
11899
  return source.definitions.map(triggerKey);
11578
11900
  }
@@ -11614,13 +11936,13 @@ var ControlClient = class {
11614
11936
  };
11615
11937
  }
11616
11938
  async getTriggerKey(key, signal) {
11617
- const source = record$1(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
11939
+ const source = record(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
11618
11940
  if (source.version != 1) return invalidResponse();
11619
11941
  return triggerKey(source.definition);
11620
11942
  }
11621
11943
  async listFlowTriggerBindings(flowId, signal) {
11622
- const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/triggers`, { signal }));
11623
- if (source.version != 1 || string$1(source.flowId) != flowId || !Array.isArray(source.bindings)) return invalidResponse();
11944
+ const source = record(await this.request(`/v1/flows/${segment(flowId)}/triggers`, { signal }));
11945
+ if (source.version != 1 || string(source.flowId) != flowId || !Array.isArray(source.bindings)) return invalidResponse();
11624
11946
  return source.bindings.map(triggerBinding);
11625
11947
  }
11626
11948
  async getFlowTriggerBinding(flowId, triggerNodeId) {
@@ -11652,7 +11974,7 @@ var ControlClient = class {
11652
11974
  }));
11653
11975
  }
11654
11976
  async getEditor(flowId) {
11655
- const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11977
+ const source = record(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11656
11978
  if (source.version != 1) return invalidResponse();
11657
11979
  const result = {
11658
11980
  flow: flow(source.flow),
@@ -11665,7 +11987,7 @@ var ControlClient = class {
11665
11987
  return result;
11666
11988
  }
11667
11989
  async getPublicationPresentation(flowId, publicationId, signal) {
11668
- const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/publications/${segment(publicationId)}/presentation`, { signal }));
11990
+ const source = record(await this.request(`/v1/flows/${segment(flowId)}/publications/${segment(publicationId)}/presentation`, { signal }));
11669
11991
  if (source.version != 1) return invalidResponse();
11670
11992
  return {
11671
11993
  version: 1,
@@ -11685,30 +12007,30 @@ var ControlClient = class {
11685
12007
  return draft(await this.request(`/v1/flows/${segment(flowId)}/revisions/${segment(revisionId)}`, { signal }));
11686
12008
  }
11687
12009
  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 }));
12010
+ const source = record(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(nodeId)}/options/${segment(field)}`, { signal }));
11689
12011
  exact(source, ["options", "version"]);
11690
12012
  if (source.version != 1 || !Array.isArray(source.options) || source.options.length > 1e3) return invalidResponse();
11691
12013
  return source.options.map((value) => {
11692
- const item = record$1(value);
12014
+ const item = record(value);
11693
12015
  exact(item, [
11694
12016
  "value",
11695
12017
  "label",
11696
12018
  ...item.color == null ? [] : ["color"]
11697
12019
  ]);
11698
- const color = item.color == null ? void 0 : string$1(item.color);
12020
+ const color = item.color == null ? void 0 : string(item.color);
11699
12021
  if (color != null && !/^#[0-9a-fA-F]{6}$/.test(color)) return invalidResponse();
11700
12022
  return color == null ? {
11701
- value: string$1(item.value),
11702
- label: string$1(item.label)
12023
+ value: string(item.value),
12024
+ label: string(item.label)
11703
12025
  } : {
11704
- value: string$1(item.value),
11705
- label: string$1(item.label),
12026
+ value: string(item.value),
12027
+ label: string(item.label),
11706
12028
  color
11707
12029
  };
11708
12030
  });
11709
12031
  }
11710
12032
  async listConnectorTeams(signal) {
11711
- const source = record$1(await this.request("/v1/connector/teams", { signal }));
12033
+ const source = record(await this.request("/v1/connector/teams", { signal }));
11712
12034
  exact(source, [
11713
12035
  "enabled",
11714
12036
  "teams",
@@ -11718,7 +12040,7 @@ var ControlClient = class {
11718
12040
  return {
11719
12041
  enabled: source.enabled,
11720
12042
  teams: source.teams.map((value) => {
11721
- const team = record$1(value);
12043
+ const team = record(value);
11722
12044
  exact(team, [
11723
12045
  "id",
11724
12046
  "name",
@@ -11726,8 +12048,8 @@ var ControlClient = class {
11726
12048
  ]);
11727
12049
  if (typeof team.systemCreated != "boolean") return invalidResponse();
11728
12050
  return {
11729
- id: string$1(team.id),
11730
- name: string$1(team.name),
12051
+ id: string(team.id),
12052
+ name: string(team.name),
11731
12053
  systemCreated: team.systemCreated
11732
12054
  };
11733
12055
  }),
@@ -11825,20 +12147,51 @@ var ControlClient = class {
11825
12147
  const parameters = new URLSearchParams();
11826
12148
  if (flowId != null) parameters.set("flowId", flowId);
11827
12149
  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}`}`, {
12150
+ const source = record(await this.request(`/v1/connector/connections/${segment(serviceId)}/page${parameters.size == 0 ? "" : `?${parameters}`}`, {
11829
12151
  body: JSON.stringify({ version: 1 }),
11830
12152
  method: "POST"
11831
12153
  }));
11832
12154
  exact(source, ["url", "version"]);
11833
12155
  if (source.version != 1) return invalidResponse();
11834
12156
  try {
11835
- const url = new URL(string$1(source.url));
12157
+ const url = new URL(string(source.url));
11836
12158
  if (url.protocol != "http:" && url.protocol != "https:") return invalidResponse();
11837
12159
  return url.href;
11838
12160
  } catch {
11839
12161
  return invalidResponse();
11840
12162
  }
11841
12163
  }
12164
+ async readAuthoring(flowId, query = {}) {
12165
+ return authoringReadResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/read`, {
12166
+ method: "POST",
12167
+ body: JSON.stringify(query)
12168
+ }));
12169
+ }
12170
+ async searchAuthoring(flowId, query) {
12171
+ return authoringSearchResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/search`, {
12172
+ method: "POST",
12173
+ body: JSON.stringify(query)
12174
+ }));
12175
+ }
12176
+ async authoringSchema(flowId, query) {
12177
+ return record(await this.request(`/v1/flows/${segment(flowId)}/authoring/schema`, {
12178
+ method: "POST",
12179
+ body: JSON.stringify(query)
12180
+ }));
12181
+ }
12182
+ async editAuthoring(flowId, request) {
12183
+ return authoringEditResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/edit`, {
12184
+ method: "POST",
12185
+ headers: { "idempotency-key": request.requestId },
12186
+ body: JSON.stringify(request)
12187
+ }));
12188
+ }
12189
+ async checkAuthoring(flowId, revisionId) {
12190
+ return authoringCheckResponse.parse(await this.request(`/v1/flows/${segment(flowId)}/authoring/check`, {
12191
+ method: "POST",
12192
+ body: JSON.stringify({ revisionId })
12193
+ }));
12194
+ }
11842
12195
  async changeDraft(flowId, expectedRevisionId, operations, changeId = operationKey("change")) {
11843
12196
  return draftChange(await this.request(`/v1/flows/${segment(flowId)}/draft/changes`, {
11844
12197
  body: JSON.stringify({
@@ -11996,7 +12349,7 @@ var ControlClient = class {
11996
12349
  const query = Object.entries(parameters).map(([key, value]) => `${segment(key)}=${segment(value)}`).join("&");
11997
12350
  const suffix = query == "" ? "" : `?${query}`;
11998
12351
  return this.connectorRequest(`/v1/connector/actions${suffix}`, "actions", signal, (value) => {
11999
- const source = record$1(value);
12352
+ const source = record(value);
12000
12353
  exact(source, ["actions", "version"]);
12001
12354
  if (source.version != 1 || !Array.isArray(source.actions)) return invalidResponse();
12002
12355
  return source.actions.map(connectorAction);
@@ -12019,9 +12372,9 @@ var ControlClient = class {
12019
12372
  } catch {
12020
12373
  return invalidResponse();
12021
12374
  }
12022
- const error = record$1(value).error;
12023
- const source = error == null ? void 0 : record$1(error);
12024
- 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}.`);
12375
+ const error = record(value).error;
12376
+ const source = error == null ? void 0 : record(error);
12377
+ 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}.`, source?.details == null ? void 0 : record(source.details));
12025
12378
  }
12026
12379
  return response;
12027
12380
  }