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

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 (36) hide show
  1. package/dist/browser/{createResourceDialog-Btjes3wD.js → createResourceDialog-C23SBjYd.js} +2 -2
  2. package/dist/browser/flow-authoring-node.d.ts +6 -2
  3. package/dist/browser/flow-authoring.js +44 -12
  4. package/dist/browser/flow-change-schema.d.ts +266 -0
  5. package/dist/browser/flow-change.d.ts +5 -0
  6. package/dist/browser/flow-change.js +33 -2
  7. package/dist/browser/{flowChanges-BxutPLYO.js → flowChanges-fBiAeTzR.js} +954 -487
  8. package/dist/browser/{flowWorkspace-Dg4mqfa6.js → flowWorkspace-MqcEfg7T.js} +3 -3
  9. package/dist/browser/{icons-p2A9zs8t.js → icons-6oQ8Q9Wm.js} +4298 -4252
  10. package/dist/browser/preview.js +354 -36
  11. package/dist/browser/workbench.js +21 -10
  12. package/dist/browser/{workbenchSelect-LRp_Xjeq.js → workbenchSelect-DpLbIr29.js} +1 -1
  13. package/dist/common/authoring.d.ts +207 -0
  14. package/dist/common/authoringSchema.d.ts +1293 -0
  15. package/dist/common/control-api-conformance.js +975 -505
  16. package/dist/common/control-api-errors.d.ts +2 -1
  17. package/dist/common/control-api.d.ts +81 -0
  18. package/dist/common/control-api.js +973 -586
  19. package/dist/common/control-requests.d.ts +128 -0
  20. package/dist/common/control-requests.js +3122 -346
  21. package/dist/common/decision.js +12 -2
  22. package/dist/common/flow-encoding.js +12 -2
  23. package/dist/common/flow-semantics.d.ts +9 -0
  24. package/dist/common/flow-semantics.js +28 -3
  25. package/dist/common/integration-trigger.js +12 -2
  26. package/dist/common/lib-DrKav3HG.js +11403 -0
  27. package/dist/common/mcp.d.ts +120 -11
  28. package/dist/common/mcp.js +423 -51
  29. package/dist/common/openapi.js +12 -2
  30. package/dist/common/poll-trigger.js +12 -2
  31. package/dist/common/scheduler.js +12 -2
  32. package/dist/common/webhook-trigger.js +12 -2
  33. package/package.json +7 -1
  34. package/skills/open-flow/SKILL.md +32 -0
  35. package/skills/open-flow/references/flow-authoring.md +356 -0
  36. package/skills/open-flow/references/flow-n8n-conversion.md +196 -0
@@ -1,183 +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
- var InvalidResponseError = class extends ApiError {
143
- constructor(detail) {
144
- super(502, "response.invalid", `The Control API returned an invalid response.${detail == null ? "" : ` ${detail}`}`);
145
- this.detail = detail;
146
- }
147
- };
148
- function invalidResponse(detail) {
149
- throw new InvalidResponseError(detail);
150
- }
151
- function record$2(value) {
152
- if (value == null || typeof value != "object" || Array.isArray(value)) return invalidResponse("Expected an object.");
153
- return value;
154
- }
155
- function string$1(value) {
156
- return typeof value == "string" && value.length > 0 ? value : invalidResponse("Expected a non-empty string.");
157
- }
158
- function exact(value, keys) {
159
- const actual = Object.keys(value);
160
- if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) {
161
- const missing = keys.filter((key) => !Object.hasOwn(value, key));
162
- const unexpected = actual.filter((key) => !keys.includes(key));
163
- invalidResponse([missing.length > 0 ? `Missing fields: ${missing.join(", ")}.` : "", unexpected.length > 0 ? `Unexpected fields: ${unexpected.join(", ")}.` : ""].filter(Boolean).join(" "));
164
- }
165
- }
166
- function integer$1(value) {
167
- return Number.isSafeInteger(value) ? value : invalidResponse("Expected a safe integer.");
168
- }
169
- function jsonValue(value) {
170
- if (value === null || typeof value == "boolean" || typeof value == "string") return value;
171
- if (typeof value == "number" && Number.isFinite(value)) return value;
172
- if (Array.isArray(value)) return value.map(jsonValue);
173
- const source = record$2(value);
174
- return Object.fromEntries(Object.entries(source).map(([key, item]) => [key, jsonValue(item)]));
175
- }
176
- function optionalString(value) {
177
- if (value == null) return;
178
- return string$1(value);
179
- }
180
- //#endregion
181
1
  //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/util.js
182
2
  function getEnumValues(entries) {
183
3
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -1210,7 +1030,7 @@ function datetime(args) {
1210
1030
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1211
1031
  }
1212
1032
  var anyString = /^[\s\S]{0,}$/;
1213
- var integer = /^-?\d+$/;
1033
+ var integer$1 = /^-?\d+$/;
1214
1034
  var number$1 = /^-?\d+(?:\.\d+)?$/;
1215
1035
  var boolean$1 = /^(?:true|false)$/i;
1216
1036
  var _null$2 = /^null$/i;
@@ -4697,7 +4517,7 @@ function stringifyKeyNames(bySchema, json, visited) {
4697
4517
  else if (typeof rest.const === "number") rest.const = String(rest.const);
4698
4518
  if (!numericType) return rest;
4699
4519
  rest.type = "string";
4700
- if (!values) rest.pattern = (types.includes("number") ? number$1 : integer).source;
4520
+ if (!values) rest.pattern = (types.includes("number") ? number$1 : integer$1).source;
4701
4521
  return rest;
4702
4522
  }
4703
4523
  /** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */
@@ -5230,7 +5050,7 @@ var ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
5230
5050
  return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
5231
5051
  }
5232
5052
  });
5233
- function string(params) {
5053
+ function string$1(params) {
5234
5054
  return /* @__PURE__ */ _string(ZodString, params);
5235
5055
  }
5236
5056
  var ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
@@ -5578,10 +5398,10 @@ var ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
5578
5398
  inst.keyType = def.keyType;
5579
5399
  inst.valueType = def.valueType;
5580
5400
  });
5581
- function record$1(keyType, valueType, params) {
5401
+ function record$2(keyType, valueType, params) {
5582
5402
  if (!valueType || !valueType._zod) return new ZodRecord({
5583
5403
  type: "record",
5584
- keyType: string(),
5404
+ keyType: string$1(),
5585
5405
  valueType: keyType,
5586
5406
  ...normalizeParams(valueType)
5587
5407
  });
@@ -5826,15 +5646,15 @@ function refine(fn, _params = {}) {
5826
5646
  function superRefine(fn, params) {
5827
5647
  return /* @__PURE__ */ _superRefine(fn, params);
5828
5648
  }
5829
- function json$2(params) {
5649
+ function json$3(params) {
5830
5650
  const jsonSchema = lazy(() => {
5831
5651
  return union([
5832
- string(params),
5652
+ string$1(params),
5833
5653
  number(),
5834
5654
  boolean(),
5835
5655
  _null(),
5836
5656
  array(jsonSchema),
5837
- record$1(string(), jsonSchema)
5657
+ record$2(string$1(), jsonSchema)
5838
5658
  ]);
5839
5659
  });
5840
5660
  return jsonSchema;
@@ -5847,15 +5667,6 @@ function preprocess(fn, schema) {
5847
5667
  });
5848
5668
  }
5849
5669
  //#endregion
5850
- //#region src/openapi/common/authBindings.ts
5851
- /** Never allow credentials to enter a Revision as literal node inputs. */
5852
- function assertOpenApiAuthBindings(document) {
5853
- for (const node of Object.values(document.graph.nodes)) {
5854
- if (node.kind != "task" || !("executor" in node.task) || node.task.executor.kind != "openapi") continue;
5855
- for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
5856
- }
5857
- }
5858
- //#endregion
5859
5670
  //#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
5860
5671
  var has = Object.prototype.hasOwnProperty;
5861
5672
  function dequal(foo, bar) {
@@ -5880,6 +5691,65 @@ function dequal(foo, bar) {
5880
5691
  return foo !== foo && bar !== bar;
5881
5692
  }
5882
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
5883
5753
  //#region src/json-schema-subset/utils.ts
5884
5754
  var nextId = 0;
5885
5755
  function createId() {
@@ -6299,7 +6169,7 @@ var ExpressionKind = Object.freeze({
6299
6169
  });
6300
6170
  //#endregion
6301
6171
  //#region src/json-schema-subset/expression/expression.ts
6302
- var expression = (delegate) => (e1, e2) => {
6172
+ var expression$1 = (delegate) => (e1, e2) => {
6303
6173
  const rootNode = {
6304
6174
  parent: null,
6305
6175
  swapped: false,
@@ -8287,7 +8157,7 @@ function checkWithResult(extendsContext, schema1, schema2) {
8287
8157
  const describe = describer();
8288
8158
  const equals = schemaEqualsChecker(extendsContext);
8289
8159
  context.isEquals = wrapEqualsCheckerWithCache(isDeepEquals);
8290
- context.calculate = expression({
8160
+ context.calculate = expression$1({
8291
8161
  describe,
8292
8162
  equals,
8293
8163
  calculate,
@@ -8733,8 +8603,8 @@ function checkJsonDepth(value, depth = 0) {
8733
8603
  //#region src/flow/common/triggerScheduleSchema.ts
8734
8604
  var triggerScheduleSchema = array(union([object({
8735
8605
  type: literal("cron"),
8736
- expression: string(),
8737
- timezone: string()
8606
+ expression: string$1(),
8607
+ timezone: string$1()
8738
8608
  }), object({
8739
8609
  type: literal("every"),
8740
8610
  unit: _enum([
@@ -8758,16 +8628,16 @@ var webhookMethods = [
8758
8628
  function webhookSupportsBody(method) {
8759
8629
  return method !== "GET";
8760
8630
  }
8761
- var text = string();
8762
- var json$1 = json$2();
8763
- var strings = array(text);
8631
+ var text = string$1();
8632
+ var json$2 = json$3();
8633
+ var strings$1 = array(text);
8764
8634
  var port$1 = object({
8765
8635
  description: text.optional(),
8766
- jsonSchema: json$1,
8636
+ jsonSchema: json$2,
8767
8637
  nullable: boolean(),
8768
8638
  handle: text
8769
8639
  });
8770
- var input = port$1.extend({ value: json$1.optional() });
8640
+ var input = port$1.extend({ value: json$2.optional() });
8771
8641
  var group = object({
8772
8642
  collapsed: boolean().optional(),
8773
8643
  group: text
@@ -8783,13 +8653,13 @@ var source = union([object({
8783
8653
  })]);
8784
8654
  var fixedInput = union([object({ kind: literal("unset") }), object({
8785
8655
  kind: literal("value"),
8786
- value: json$1
8656
+ value: json$2
8787
8657
  })]);
8788
8658
  var mapping = union([fixedInput, object({
8789
8659
  kind: literal("sources"),
8790
8660
  sources: array(source)
8791
8661
  })]);
8792
- var inputs = record$1(text, mapping);
8662
+ var inputs = record$2(text, mapping);
8793
8663
  var ports$1 = {
8794
8664
  inputs: array(union([input, group])),
8795
8665
  outputs: array(union([port$1, group]))
@@ -8834,7 +8704,7 @@ var inline = object({
8834
8704
  });
8835
8705
  var agentValue = union([object({
8836
8706
  kind: literal("value"),
8837
- value: json$1
8707
+ value: json$2
8838
8708
  }), object({
8839
8709
  kind: literal("input"),
8840
8710
  input: text
@@ -8863,10 +8733,10 @@ var decisionQuestion = discriminatedUnion("type", [
8863
8733
  name: text,
8864
8734
  instructions: text,
8865
8735
  type: literal("score"),
8866
- criteria: strings
8736
+ criteria: strings$1
8867
8737
  })
8868
8738
  ]);
8869
- var managed = object({
8739
+ var managedFields = object({
8870
8740
  ...ports$1,
8871
8741
  name: text,
8872
8742
  executor: union([
@@ -8881,7 +8751,7 @@ var managed = object({
8881
8751
  method: text,
8882
8752
  path: text,
8883
8753
  serverUrl: text,
8884
- document: json$1,
8754
+ document: json$2,
8885
8755
  auth: array(object({
8886
8756
  id: text,
8887
8757
  type: _enum([
@@ -8921,15 +8791,16 @@ var managed = object({
8921
8791
  connectionId: text.optional(),
8922
8792
  inputDefinitions: array(input),
8923
8793
  messageHandle: text,
8924
- inputs: record$1(text, agentValue)
8794
+ inputs: record$2(text, agentValue)
8925
8795
  }).optional()
8926
8796
  })
8927
8797
  ])
8928
- }).transform(limitDecisionTask);
8929
- var operand = union([object({
8798
+ });
8799
+ var managed = managedFields.transform(limitDecisionTask);
8800
+ var operand$1 = union([object({
8930
8801
  kind: literal("value"),
8931
- value: json$1.optional(),
8932
- jsonSchema: json$1.optional()
8802
+ value: json$2.optional(),
8803
+ jsonSchema: json$2.optional()
8933
8804
  }), object({
8934
8805
  kind: literal("source"),
8935
8806
  source
@@ -8940,7 +8811,7 @@ var condition = {
8940
8811
  description: text.optional(),
8941
8812
  output: text,
8942
8813
  groups: array(object({ expressions: array(object({
8943
- left: operand,
8814
+ left: operand$1,
8944
8815
  operator: _enum([
8945
8816
  "!=",
8946
8817
  "<",
@@ -8963,7 +8834,7 @@ var condition = {
8963
8834
  "notHasValue",
8964
8835
  "startsWith"
8965
8836
  ]),
8966
- right: operand.optional()
8837
+ right: operand$1.optional()
8967
8838
  })) }))
8968
8839
  }))
8969
8840
  };
@@ -8973,10 +8844,10 @@ var wait = {
8973
8844
  };
8974
8845
  var webhookOptions = object({
8975
8846
  allowedMethods: never().optional(),
8976
- allowedOrigins: strings.optional(),
8847
+ allowedOrigins: strings$1.optional(),
8977
8848
  noResponseBody: never().optional(),
8978
8849
  responseData: text.optional(),
8979
- responseHeaders: record$1(text, text).optional(),
8850
+ responseHeaders: record$2(text, text).optional(),
8980
8851
  responseStatusCode: number().int().min(200).max(599).optional()
8981
8852
  });
8982
8853
  var webhook = {
@@ -9032,7 +8903,7 @@ var base = {
9032
8903
  var node = union([
9033
8904
  object({
9034
8905
  ...base,
9035
- inputs: record$1(text, never()),
8906
+ inputs: record$2(text, never()),
9036
8907
  kind: literal("condition"),
9037
8908
  ...condition
9038
8909
  }),
@@ -9081,7 +8952,7 @@ var node = union([
9081
8952
  ...trigger,
9082
8953
  kind: literal("poll"),
9083
8954
  connectionId: text.min(1).optional(),
9084
- config: record$1(text, fixedInput),
8955
+ config: record$2(text, fixedInput),
9085
8956
  definition: object({
9086
8957
  ...definition,
9087
8958
  type: literal("poll")
@@ -9092,7 +8963,7 @@ var node = union([
9092
8963
  ...trigger,
9093
8964
  kind: literal("integration"),
9094
8965
  connectionId: text.min(1).optional(),
9095
- config: record$1(text, fixedInput),
8966
+ config: record$2(text, fixedInput),
9096
8967
  definition: object({
9097
8968
  ...definition,
9098
8969
  type: literal("integration"),
@@ -9100,6 +8971,25 @@ var node = union([
9100
8971
  })
9101
8972
  })
9102
8973
  ]);
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
+ };
9103
8993
  var edge = object({
9104
8994
  source: text,
9105
8995
  target: text,
@@ -9110,7 +9000,7 @@ var at = {
9110
9000
  target: never().optional()
9111
9001
  };
9112
9002
  var graph = object({
9113
- nodes: record$1(text, node),
9003
+ nodes: record$2(text, node),
9114
9004
  edges: array(edge).default([])
9115
9005
  });
9116
9006
  var binding = object({
@@ -9119,11 +9009,11 @@ var binding = object({
9119
9009
  });
9120
9010
  var module = object({
9121
9011
  name: text,
9122
- imports: strings,
9012
+ imports: strings$1,
9123
9013
  source: text
9124
9014
  });
9125
9015
  var document = preprocess(rejectRetiredDefinitions, object({
9126
- bindings: record$1(text, binding),
9016
+ bindings: record$2(text, binding),
9127
9017
  graph
9128
9018
  }));
9129
9019
  var revision = object({
@@ -9134,22 +9024,22 @@ var revision = object({
9134
9024
  literal(6)
9135
9025
  ]),
9136
9026
  document,
9137
- modules: record$1(text, module)
9027
+ modules: record$2(text, module)
9138
9028
  });
9139
9029
  revision.extend({
9140
9030
  kind: literal("open-flow-flow-revision"),
9141
9031
  version: literal(1)
9142
9032
  });
9143
9033
  function rejectRetiredDefinitions(value) {
9144
- const candidate = record(value);
9034
+ const candidate = record$1(value);
9145
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.");
9146
- if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
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.");
9147
9037
  const subflows = candidate.subflows;
9148
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.");
9149
- if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes 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.");
9150
9040
  return value;
9151
9041
  }
9152
- function record(value) {
9042
+ function record$1(value) {
9153
9043
  return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
9154
9044
  }
9155
9045
  function decodeRevisionContent(value) {
@@ -9187,6 +9077,11 @@ var shapes = {
9187
9077
  ...at,
9188
9078
  node
9189
9079
  },
9080
+ "graph.node.replace": {
9081
+ ...at,
9082
+ before: node,
9083
+ node
9084
+ },
9190
9085
  "graph.node.delete": at,
9191
9086
  "graph.node.field.set": union([
9192
9087
  object({
@@ -9291,9 +9186,9 @@ var shapes = {
9291
9186
  },
9292
9187
  "module.source.replace": {
9293
9188
  moduleId: text,
9294
- beforeImports: strings,
9189
+ beforeImports: strings$1,
9295
9190
  beforeSource: text,
9296
- imports: strings,
9191
+ imports: strings$1,
9297
9192
  source: text
9298
9193
  },
9299
9194
  "graph.node.task.set": {
@@ -9311,54 +9206,477 @@ function checkModelVersion(content) {
9311
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.");
9312
9207
  }
9313
9208
  //#endregion
9314
- //#region src/flow/common/condition.ts
9315
- var unaryOperator = (operator) => operator.startsWith("is");
9316
- var operandHandle = (caseIndex, groupIndex, expressionIndex, side) => `${caseIndex}/${groupIndex}/${expressionIndex}/${side}`;
9317
- /** Derived addresses let operand bindings use the ordinary input analysis and editor. Never persisted as node inputs. */
9318
- function conditionOperands(node) {
9319
- return node.cases.flatMap((item, c) => item.groups.flatMap((group, g) => group.expressions.flatMap((expression, e) => [{
9320
- handle: operandHandle(c, g, e, "left"),
9321
- operand: expression.left,
9322
- expression,
9323
- side: "left"
9324
- }, ...!unaryOperator(expression.operator) ? [{
9325
- handle: operandHandle(c, g, e, "right"),
9326
- operand: expression.right ?? { kind: "value" },
9327
- expression,
9328
- side: "right"
9329
- }] : []])));
9330
- }
9331
- function conditionInputPorts(node) {
9332
- return Object.fromEntries(conditionOperands(node).map(({ handle, operand }) => [handle, {
9333
- jsonSchema: operand.kind === "value" ? operand.jsonSchema ?? {} : {},
9334
- nullable: operand.kind === "value" ? operand.value === null : true
9335
- }]));
9336
- }
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
+ });
9337
9217
  //#endregion
9338
- //#region src/flow/common/change.ts
9339
- var schemaKeywords = /* @__PURE__ */ new Set([
9340
- "const",
9341
- "enum",
9342
- "exclusiveMaximum",
9343
- "exclusiveMinimum",
9344
- "maximum",
9345
- "maxItems",
9346
- "maxLength",
9347
- "maxProperties",
9348
- "minimum",
9349
- "minItems",
9350
- "minLength",
9351
- "minProperties",
9352
- "multipleOf",
9353
- "pattern",
9354
- "required",
9355
- "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
+ })
9356
9227
  ]);
9357
- function isSchemaKeyword(value) {
9358
- 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
+ };
9359
9533
  }
9360
- function portsByHandle(ports) {
9361
- 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);
9362
9680
  }
9363
9681
  //#endregion
9364
9682
  //#region src/flow/common/encoding.ts
@@ -9381,7 +9699,7 @@ async function digestBytes(bytes) {
9381
9699
  //#region src/control/common/providerAccess.ts
9382
9700
  var sourceSchema = discriminatedUnion("kind", [strictObject({ kind: literal("admin-delegation") }), strictObject({
9383
9701
  kind: literal("policy"),
9384
- ruleId: string().min(1).nullable()
9702
+ ruleId: string$1().min(1).nullable()
9385
9703
  })]);
9386
9704
  function parseProviderAccessSource(value) {
9387
9705
  return sourceSchema.parse(value);
@@ -9399,7 +9717,7 @@ async function providerAccessBindingId(teamId, identity) {
9399
9717
  //#endregion
9400
9718
  //#region src/control/common/connectorDecoders.ts
9401
9719
  function accessPermissions(value) {
9402
- const source = record$2(value);
9720
+ const source = record(value);
9403
9721
  exact(source, [
9404
9722
  "actionIds",
9405
9723
  "allActions",
@@ -9414,8 +9732,8 @@ function accessPermissions(value) {
9414
9732
  if (typeof source.allTriggers != "boolean") return invalidResponse("permissions.allTriggers: expected a boolean.");
9415
9733
  if (typeof source.configured != "boolean") return invalidResponse("permissions.configured: expected a boolean.");
9416
9734
  if (typeof source.proxy != "boolean") return invalidResponse("permissions.proxy: expected a boolean.");
9417
- const actionIds = source.actionIds.map(string$1);
9418
- const triggerIds = source.triggerIds.map(string$1);
9735
+ const actionIds = source.actionIds.map(string);
9736
+ const triggerIds = source.triggerIds.map(string);
9419
9737
  if (new Set(actionIds).size != actionIds.length) return invalidResponse("permissions.actionIds: duplicate IDs.");
9420
9738
  if (source.allActions && actionIds.length != 0) return invalidResponse("permissions.actionIds: must be empty when allActions is true.");
9421
9739
  if (new Set(triggerIds).size != triggerIds.length) return invalidResponse("permissions.triggerIds: duplicate IDs.");
@@ -9431,7 +9749,7 @@ function accessPermissions(value) {
9431
9749
  };
9432
9750
  }
9433
9751
  function accessBinding(value, candidate) {
9434
- const source = record$2(value);
9752
+ const source = record(value);
9435
9753
  const policyRevision = source.policyRevision;
9436
9754
  const status = source.status;
9437
9755
  const isDefault = source.isDefault;
@@ -9461,15 +9779,15 @@ function accessBinding(value, candidate) {
9461
9779
  return invalidResponse("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.");
9462
9780
  }
9463
9781
  return {
9464
- accessBindingId: string$1(source.accessBindingId),
9465
- connectionId: string$1(source.connectionId),
9782
+ accessBindingId: string(source.accessBindingId),
9783
+ connectionId: string(source.connectionId),
9466
9784
  source: bindingSource,
9467
- connectionDisplayName: string$1(legacy ? source.displayName : source.connectionDisplayName),
9785
+ connectionDisplayName: string(legacy ? source.displayName : source.connectionDisplayName),
9468
9786
  ...candidate && typeof isDefault == "boolean" ? { isDefault } : {},
9469
9787
  ...permissions == null ? {} : { permissions },
9470
9788
  ...permissionGroupName === void 0 ? {} : { permissionGroupName },
9471
9789
  ...policyRevision == null ? {} : { policyRevision },
9472
- providerId: string$1(source.providerId),
9790
+ providerId: string(source.providerId),
9473
9791
  ...candidate ? {} : { status }
9474
9792
  };
9475
9793
  }
@@ -9478,7 +9796,7 @@ function accessMode(value) {
9478
9796
  return value;
9479
9797
  }
9480
9798
  function connectorAccess(value) {
9481
- const source = record$2(value);
9799
+ const source = record(value);
9482
9800
  exact(source, [
9483
9801
  "accessRevision",
9484
9802
  "bindings",
@@ -9488,12 +9806,12 @@ function connectorAccess(value) {
9488
9806
  ..."discardedBindingCount" in source ? ["discardedBindingCount"] : [],
9489
9807
  "version"
9490
9808
  ]);
9491
- const accessRevision = integer$1(source.accessRevision);
9809
+ const accessRevision = integer(source.accessRevision);
9492
9810
  if (source.version != 1 || accessRevision < 0 || !Array.isArray(source.bindings)) return invalidResponse();
9493
9811
  if ("providerIds" in source && !Array.isArray(source.providerIds)) return invalidResponse();
9494
- 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));
9495
9813
  if (providerIds != null && new Set(providerIds).size != providerIds.length) return invalidResponse();
9496
- let discardedBindingCount = source.discardedBindingCount == null ? 0 : integer$1(source.discardedBindingCount);
9814
+ let discardedBindingCount = source.discardedBindingCount == null ? 0 : integer(source.discardedBindingCount);
9497
9815
  if (discardedBindingCount < 0) return invalidResponse();
9498
9816
  const bindings = [];
9499
9817
  for (const entry of source.bindings) try {
@@ -9518,14 +9836,14 @@ function connectorAccess(value) {
9518
9836
  ...providerIds == null ? {} : { providerIds },
9519
9837
  bindings,
9520
9838
  mode: accessMode(source.mode),
9521
- sharedAccessDigest: string$1(source.sharedAccessDigest),
9839
+ sharedAccessDigest: string(source.sharedAccessDigest),
9522
9840
  version: 1
9523
9841
  };
9524
9842
  }
9525
9843
  function accessGrants(value) {
9526
9844
  if (!Array.isArray(value)) return invalidResponse();
9527
9845
  const bindings = value.map((candidate) => {
9528
- const entry = record$2(candidate);
9846
+ const entry = record(candidate);
9529
9847
  exact(entry, [
9530
9848
  "accessBindingId",
9531
9849
  "connectionId",
@@ -9542,11 +9860,11 @@ function accessGrants(value) {
9542
9860
  }
9543
9861
  if (entry.permissionGroupName != null && typeof entry.permissionGroupName != "string") return invalidResponse();
9544
9862
  return {
9545
- accessBindingId: string$1(entry.accessBindingId),
9546
- connectionId: string$1(entry.connectionId),
9547
- providerId: string$1(entry.providerId),
9863
+ accessBindingId: string(entry.accessBindingId),
9864
+ connectionId: string(entry.connectionId),
9865
+ providerId: string(entry.providerId),
9548
9866
  source: identity,
9549
- connectionDisplayName: string$1(entry.connectionDisplayName),
9867
+ connectionDisplayName: string(entry.connectionDisplayName),
9550
9868
  ..."permissionGroupName" in entry ? { permissionGroupName: entry.permissionGroupName } : {}
9551
9869
  };
9552
9870
  });
@@ -9554,7 +9872,7 @@ function accessGrants(value) {
9554
9872
  return bindings;
9555
9873
  }
9556
9874
  function connectorAccessSnapshot(value) {
9557
- const source = record$2(value);
9875
+ const source = record(value);
9558
9876
  exact(source, [
9559
9877
  "mode",
9560
9878
  "sharedAccessDigest",
@@ -9569,14 +9887,14 @@ function connectorAccessSnapshot(value) {
9569
9887
  if (mode == "implicit" && (sharedBindings.length > 0 || selectedBindings.length > 0)) return invalidResponse();
9570
9888
  return {
9571
9889
  mode,
9572
- sharedAccessDigest: string$1(source.sharedAccessDigest),
9890
+ sharedAccessDigest: string(source.sharedAccessDigest),
9573
9891
  sharedBindings,
9574
9892
  selectedBindings,
9575
9893
  version: 2
9576
9894
  };
9577
9895
  }
9578
9896
  function connectorAccessCandidates(value, providerId) {
9579
- const source = record$2(value);
9897
+ const source = record(value);
9580
9898
  exact(source, [
9581
9899
  "candidates",
9582
9900
  "mode",
@@ -9584,7 +9902,7 @@ function connectorAccessCandidates(value, providerId) {
9584
9902
  "version"
9585
9903
  ]);
9586
9904
  if (source.version != 1) return invalidResponse("version: expected 1.");
9587
- if (string$1(source.providerId) != providerId) return invalidResponse("providerId: does not match the requested provider.");
9905
+ if (string(source.providerId) != providerId) return invalidResponse("providerId: does not match the requested provider.");
9588
9906
  if (!Array.isArray(source.candidates)) return invalidResponse("candidates: expected an array.");
9589
9907
  const candidates = source.candidates.map((candidate) => accessBinding(candidate, true));
9590
9908
  if (candidates.some((candidate) => candidate.providerId != providerId)) return invalidResponse("candidates[].providerId: does not match the requested provider.");
@@ -9597,24 +9915,24 @@ function connectorAccessCandidates(value, providerId) {
9597
9915
  };
9598
9916
  }
9599
9917
  function connectorAccessCandidatesBatch(value, providerIds) {
9600
- const source = record$2(value);
9918
+ const source = record(value);
9601
9919
  exact(source, ["results", "version"]);
9602
9920
  if (source.version != 1) return invalidResponse("version: expected 1.");
9603
9921
  if (!Array.isArray(source.results)) return invalidResponse("results: expected an array.");
9604
9922
  const remaining = new Set(providerIds);
9605
9923
  const results = source.results.map((entry) => {
9606
- const item = record$2(entry);
9607
- const providerId = string$1(item.providerId);
9924
+ const item = record(entry);
9925
+ const providerId = string(item.providerId);
9608
9926
  if (!remaining.delete(providerId)) return invalidResponse("results[].providerId: duplicate or unrequested provider.");
9609
9927
  if (!Object.hasOwn(item, "error")) return connectorAccessCandidates(item, providerId);
9610
9928
  exact(item, ["providerId", "error"]);
9611
- const error = record$2(item.error);
9929
+ const error = record(item.error);
9612
9930
  exact(error, ["code", "message"]);
9613
9931
  return {
9614
9932
  providerId,
9615
9933
  error: {
9616
- code: string$1(error.code),
9617
- message: string$1(error.message)
9934
+ code: string(error.code),
9935
+ message: string(error.message)
9618
9936
  }
9619
9937
  };
9620
9938
  });
@@ -9625,7 +9943,7 @@ function connectorAccessCandidatesBatch(value, providerIds) {
9625
9943
  };
9626
9944
  }
9627
9945
  function connection(value) {
9628
- const source = record$2(value);
9946
+ const source = record(value);
9629
9947
  exact(source, [
9630
9948
  ...Object.hasOwn(source, "providerAccountId") ? ["providerAccountId"] : [],
9631
9949
  ...Object.hasOwn(source, "alias") ? ["alias"] : [],
@@ -9641,18 +9959,18 @@ function connection(value) {
9641
9959
  if (status != "active" && status != "disconnected" && status != "error" && status != "reauth_required") return invalidResponse();
9642
9960
  if (typeof source.isDefault != "boolean") return invalidResponse();
9643
9961
  return {
9644
- ...source.providerAccountId === void 0 ? {} : { providerAccountId: string$1(source.providerAccountId) },
9645
- ...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) },
9646
9964
  ...source.builtInAccount === void 0 ? {} : { builtInAccount: source.builtInAccount },
9647
- connectionId: string$1(source.connectionId),
9648
- displayName: string$1(source.displayName),
9965
+ connectionId: string(source.connectionId),
9966
+ displayName: string(source.displayName),
9649
9967
  isDefault: source.isDefault,
9650
- serviceId: string$1(source.serviceId),
9968
+ serviceId: string(source.serviceId),
9651
9969
  status
9652
9970
  };
9653
9971
  }
9654
9972
  function port(value, input = false) {
9655
- const source = record$2(value);
9973
+ const source = record(value);
9656
9974
  const description = source.description;
9657
9975
  const hasValue = input && Object.hasOwn(source, "value");
9658
9976
  exact(source, [
@@ -9674,10 +9992,10 @@ function inputPort(value) {
9674
9992
  return port(value, true);
9675
9993
  }
9676
9994
  function ports(value, decode) {
9677
- return Object.fromEntries(Object.entries(record$2(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9995
+ return Object.fromEntries(Object.entries(record(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9678
9996
  }
9679
9997
  function connectorActionMetadata(value) {
9680
- const source = record$2(value);
9998
+ const source = record(value);
9681
9999
  const homepageUrl = source.homepageUrl;
9682
10000
  const icon = source.icon;
9683
10001
  exact(source, [
@@ -9701,22 +10019,22 @@ function connectorActionMetadata(value) {
9701
10019
  return {
9702
10020
  ...source.inputSchema === void 0 ? {} : { inputSchema: jsonValue(source.inputSchema) },
9703
10021
  ...source.outputSchema === void 0 ? {} : { outputSchema: jsonValue(source.outputSchema) },
9704
- actionId: string$1(source.actionId),
9705
- ...source.operationType == null ? {} : { operationType: string$1(source.operationType) },
10022
+ actionId: string(source.actionId),
10023
+ ...source.operationType == null ? {} : { operationType: string(source.operationType) },
9706
10024
  authenticated: typeof source.authenticated == "boolean" ? source.authenticated : invalidResponse(),
9707
10025
  description: typeof source.description == "string" ? source.description : invalidResponse(),
9708
10026
  ...homepageUrl == null ? {} : { homepageUrl },
9709
10027
  ...icon == null ? {} : { icon },
9710
10028
  ...providerIconAppearance(source.iconSprite, source.iconSpritePosition),
9711
10029
  inputs: ports(source.inputs, inputPort),
9712
- name: string$1(source.name),
10030
+ name: string(source.name),
9713
10031
  outputs: ports(source.outputs, port),
9714
- serviceId: string$1(source.serviceId),
9715
- serviceName: string$1(source.serviceName)
10032
+ serviceId: string(source.serviceId),
10033
+ serviceName: string(source.serviceName)
9716
10034
  };
9717
10035
  }
9718
10036
  function connectorAction(value) {
9719
- const { defaultConnection, ...metadata } = record$2(value);
10037
+ const { defaultConnection, ...metadata } = record(value);
9720
10038
  const action = connectorActionMetadata(metadata);
9721
10039
  if (defaultConnection == null) return action;
9722
10040
  const preferred = connection(defaultConnection);
@@ -9727,7 +10045,7 @@ function connectorAction(value) {
9727
10045
  };
9728
10046
  }
9729
10047
  function connectorProvider(value) {
9730
- const source = record$2(value);
10048
+ const source = record(value);
9731
10049
  const homepageUrl = source.homepageUrl;
9732
10050
  const icon = source.icon;
9733
10051
  if (source.noSetup !== void 0 && typeof source.noSetup != "boolean") return invalidResponse();
@@ -9745,8 +10063,8 @@ function connectorProvider(value) {
9745
10063
  ...homepageUrl == null ? {} : { homepageUrl },
9746
10064
  ...icon == null ? {} : { icon },
9747
10065
  ...providerIconAppearance(source.iconSprite, source.iconSpritePosition),
9748
- serviceId: string$1(source.serviceId),
9749
- serviceName: string$1(source.serviceName),
10066
+ serviceId: string(source.serviceId),
10067
+ serviceName: string(source.serviceName),
9750
10068
  ...source.noSetup === void 0 ? {} : { noSetup: source.noSetup }
9751
10069
  };
9752
10070
  }
@@ -10127,9 +10445,9 @@ function nodeDetails(content, nodeId, node) {
10127
10445
  }
10128
10446
  //#endregion
10129
10447
  //#region src/control/common/eventSources.ts
10130
- var id = string().min(1).max(256);
10131
- var eventType = string().regex(/^[a-z][a-z0-9_.]{0,127}$/);
10132
- 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);
10133
10451
  var eventSourceSchema = strictObject({
10134
10452
  version: literal(1),
10135
10453
  sourceId: id,
@@ -10144,13 +10462,13 @@ var eventSourceSchema = strictObject({
10144
10462
  manageSubscriptions: boolean(),
10145
10463
  verificationTokenConfigured: boolean(),
10146
10464
  encryptKeyConfigured: boolean(),
10147
- endpointUrl: string().nullable(),
10148
- verifiedAt: string().nullable(),
10149
- lastReceivedAt: string().nullable(),
10150
- updatedAt: string(),
10465
+ endpointUrl: string$1().nullable(),
10466
+ verifiedAt: string$1().nullable(),
10467
+ lastReceivedAt: string$1().nullable(),
10468
+ updatedAt: string$1(),
10151
10469
  consumers: array(strictObject({
10152
10470
  flowId: id,
10153
- flowName: string(),
10471
+ flowName: string$1(),
10154
10472
  triggerNodeId: id
10155
10473
  }))
10156
10474
  });
@@ -10179,32 +10497,32 @@ function isUiLanguage(value) {
10179
10497
  //#endregion
10180
10498
  //#region src/trigger/common/configSchema.ts
10181
10499
  var configInputsSchema = array(union([strictObject({
10182
- handle: string().min(1),
10183
- description: string().optional(),
10184
- jsonSchema: json$2(),
10500
+ handle: string$1().min(1),
10501
+ description: string$1().optional(),
10502
+ jsonSchema: json$3(),
10185
10503
  nullable: boolean(),
10186
- value: json$2().optional()
10504
+ value: json$3().optional()
10187
10505
  }), strictObject({
10188
- group: string(),
10506
+ group: string$1(),
10189
10507
  collapsed: boolean().optional()
10190
10508
  })]));
10191
10509
  //#endregion
10192
10510
  //#region src/control/common/triggerDecoders.ts
10193
10511
  function triggerKeySummary(value) {
10194
- const source = record$2(value);
10512
+ const source = record(value);
10195
10513
  const type = source.type;
10196
10514
  if (type != "integration" && type != "poll") return invalidResponse();
10197
10515
  return {
10198
10516
  description: typeof source.description == "string" ? source.description : invalidResponse(),
10199
- displayName: string$1(source.displayName),
10200
- key: string$1(source.key),
10201
- name: string$1(source.name),
10202
- 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),
10203
10521
  type
10204
10522
  };
10205
10523
  }
10206
10524
  function triggerKey(value) {
10207
- const source = record$2(value);
10525
+ const source = record(value);
10208
10526
  const summary = triggerKeySummary(source);
10209
10527
  const base = {
10210
10528
  configInputs: configInputsSchema.parse(source.configInputs),
@@ -10214,12 +10532,12 @@ function triggerKey(value) {
10214
10532
  key: summary.key,
10215
10533
  name: summary.name,
10216
10534
  outputs: (Array.isArray(source.outputs) ? source.outputs : invalidResponse()).map((entry) => {
10217
- const port = record$2(entry);
10535
+ const port = record(entry);
10218
10536
  return Object.assign({
10219
- handle: string$1(port.handle),
10537
+ handle: string(port.handle),
10220
10538
  jsonSchema: jsonValue(port.jsonSchema),
10221
10539
  nullable: typeof port.nullable === "boolean" ? port.nullable : invalidResponse()
10222
- }, port.description == null ? {} : { description: string$1(port.description) });
10540
+ }, port.description == null ? {} : { description: string(port.description) });
10223
10541
  }),
10224
10542
  provider: summary.provider
10225
10543
  };
@@ -10227,12 +10545,12 @@ function triggerKey(value) {
10227
10545
  ...base,
10228
10546
  type: "poll"
10229
10547
  };
10230
- const endpoint = record$2(source.endpoint);
10231
- const body = record$2(endpoint.body);
10548
+ const endpoint = record(source.endpoint);
10549
+ const body = record(endpoint.body);
10232
10550
  if (!Array.isArray(endpoint.methods) || !Array.isArray(body.formats) || typeof body.allowArray != "boolean" || typeof body.allowEmpty != "boolean") return invalidResponse();
10233
- const methods = endpoint.methods.map(string$1);
10234
- const formats = body.formats.map(string$1);
10235
- 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);
10236
10554
  if (methods.some((method) => ![
10237
10555
  "DELETE",
10238
10556
  "GET",
@@ -10284,38 +10602,38 @@ var triggerActivityKinds = /* @__PURE__ */ new Set([
10284
10602
  "operator.resumed"
10285
10603
  ]);
10286
10604
  function triggerBinding(value) {
10287
- const source = record$2(value);
10605
+ const source = record(value);
10288
10606
  const health = source.health;
10289
- const listener = source.listener == null ? void 0 : record$2(source.listener);
10607
+ const listener = source.listener == null ? void 0 : record(source.listener);
10290
10608
  if (listener != null && listener.health != "healthy" && listener.health != "failed" && listener.health != "needs_reauth") return invalidResponse();
10291
10609
  const kind = source.kind;
10292
10610
  const operatorState = source.operatorState;
10293
- const runtimeVersion = integer$1(source.runtimeVersion);
10611
+ const runtimeVersion = integer(source.runtimeVersion);
10294
10612
  if (source.version != 1 || typeof health != "string" || !triggerHealth.has(health)) return invalidResponse();
10295
10613
  if (typeof kind != "string" || !triggerKinds.has(kind)) return invalidResponse();
10296
10614
  if (operatorState != "active" && operatorState != "paused") return invalidResponse();
10297
10615
  if (runtimeVersion <= 0) return invalidResponse();
10298
10616
  return {
10299
- ...source.currentPublicationId == null ? {} : { currentPublicationId: string$1(source.currentPublicationId) },
10300
- ...source.currentRevisionId == null ? {} : { currentRevisionId: string$1(source.currentRevisionId) },
10301
- ...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) },
10302
10620
  ...listener == null ? {} : { listener: {
10303
10621
  health: listener.health,
10304
- ...listener.lastErrorCode == null ? {} : { lastErrorCode: string$1(listener.lastErrorCode) }
10622
+ ...listener.lastErrorCode == null ? {} : { lastErrorCode: string(listener.lastErrorCode) }
10305
10623
  } },
10306
- flowId: string$1(source.flowId),
10624
+ flowId: string(source.flowId),
10307
10625
  health,
10308
10626
  kind,
10309
- ...source.lastErrorCode == null ? {} : { lastErrorCode: string$1(source.lastErrorCode) },
10627
+ ...source.lastErrorCode == null ? {} : { lastErrorCode: string(source.lastErrorCode) },
10310
10628
  operatorState,
10311
10629
  runtimeVersion,
10312
- triggerNodeId: string$1(source.triggerNodeId),
10313
- updatedAt: string$1(source.updatedAt),
10630
+ triggerNodeId: string(source.triggerNodeId),
10631
+ updatedAt: string(source.updatedAt),
10314
10632
  version: 1
10315
10633
  };
10316
10634
  }
10317
10635
  function triggerBindingDetail(value) {
10318
- const source = record$2(value);
10636
+ const source = record(value);
10319
10637
  if (source.version != 1) return invalidResponse();
10320
10638
  return {
10321
10639
  binding: triggerBinding(source.binding),
@@ -10323,22 +10641,22 @@ function triggerBindingDetail(value) {
10323
10641
  };
10324
10642
  }
10325
10643
  function triggerActivity(value) {
10326
- const source = record$2(value);
10644
+ const source = record(value);
10327
10645
  const kind = source.kind;
10328
10646
  if (typeof kind != "string" || !triggerActivityKinds.has(kind)) return invalidResponse();
10329
10647
  const errorCode = optionalString(source.errorCode);
10330
10648
  const errorMessage = optionalString(source.errorMessage);
10331
10649
  if (errorMessage != null && errorMessage.length > 512) return invalidResponse();
10332
10650
  return {
10333
- activityId: string$1(source.activityId),
10334
- createdAt: string$1(source.createdAt),
10651
+ activityId: string(source.activityId),
10652
+ createdAt: string(source.createdAt),
10335
10653
  ...errorCode == null ? {} : { errorCode },
10336
10654
  ...errorMessage == null ? {} : { errorMessage },
10337
10655
  kind
10338
10656
  };
10339
10657
  }
10340
10658
  function triggerActivityPage(value) {
10341
- const source = record$2(value);
10659
+ const source = record(value);
10342
10660
  const nextCursor = optionalString(source.nextCursor);
10343
10661
  if (source.version != 1 || !Array.isArray(source.activities)) return invalidResponse();
10344
10662
  return {
@@ -10348,12 +10666,12 @@ function triggerActivityPage(value) {
10348
10666
  };
10349
10667
  }
10350
10668
  function pollTriggerTestResult(value) {
10351
- const source = record$2(value);
10352
- const filtered = integer$1(source.filtered);
10669
+ const source = record(value);
10670
+ const filtered = integer(source.filtered);
10353
10671
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.hasMore != "boolean" || filtered < 0) return invalidResponse();
10354
10672
  return {
10355
10673
  events: source.events.map((event) => {
10356
- const object = record$2(event);
10674
+ const object = record(event);
10357
10675
  return Object.fromEntries(Object.entries(object).map(([key, item]) => [key, jsonValue(item)]));
10358
10676
  }),
10359
10677
  filtered,
@@ -10364,7 +10682,7 @@ function pollTriggerTestResult(value) {
10364
10682
  //#endregion
10365
10683
  //#region src/control/common/triggerCatalog.ts
10366
10684
  function decodeTriggerCatalog(value) {
10367
- const source = record$2(value);
10685
+ const source = record(value);
10368
10686
  exact(source, [
10369
10687
  "version",
10370
10688
  "locale",
@@ -10373,12 +10691,12 @@ function decodeTriggerCatalog(value) {
10373
10691
  ]);
10374
10692
  if (source.version != 3 || !isUiLanguage(source.locale) || !Array.isArray(source.definitions)) return invalidResponse();
10375
10693
  const definitions = source.definitions.map(triggerKey);
10376
- const entries = record$2(source.display);
10694
+ const entries = record(source.display);
10377
10695
  const keys = new Set(definitions.map((definition) => definition.key));
10378
10696
  if (keys.size != definitions.length || Object.keys(entries).length != keys.size) return invalidResponse();
10379
10697
  const display = Object.fromEntries(definitions.map((definition) => {
10380
10698
  const { key } = definition;
10381
- const copy = record$2(entries[key]);
10699
+ const copy = record(entries[key]);
10382
10700
  exact(copy, [
10383
10701
  "configInputs",
10384
10702
  "configInputLabels",
@@ -10389,8 +10707,8 @@ function decodeTriggerCatalog(value) {
10389
10707
  return [key, {
10390
10708
  configInputs: descriptions(copy.configInputs, definition.configInputs.flatMap((field) => "handle" in field ? [field.handle] : [])),
10391
10709
  configInputLabels: labels(copy.configInputLabels, definition.configInputs.flatMap((field) => "handle" in field ? [field.handle] : [])),
10392
- displayName: string$1(copy.displayName),
10393
- description: string$1(copy.description),
10710
+ displayName: string(copy.displayName),
10711
+ description: string(copy.description),
10394
10712
  outputs: descriptions(copy.outputs, definition.outputs.map((field) => field.handle))
10395
10713
  }];
10396
10714
  }));
@@ -10402,15 +10720,15 @@ function decodeTriggerCatalog(value) {
10402
10720
  };
10403
10721
  }
10404
10722
  function descriptions(value, handles) {
10405
- const source = record$2(value);
10723
+ const source = record(value);
10406
10724
  exact(source, handles);
10407
- 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)]));
10408
10726
  }
10409
10727
  function labels(value, handles) {
10410
- const source = record$2(value);
10728
+ const source = record(value);
10411
10729
  if (Object.keys(source).some((handle) => !handles.includes(handle))) return invalidResponse();
10412
10730
  return Object.fromEntries(Object.entries(source).map(([handle, label]) => {
10413
- const text = string$1(label);
10731
+ const text = string(label);
10414
10732
  return text.trim().length == 0 ? invalidResponse() : [handle, text];
10415
10733
  }));
10416
10734
  }
@@ -10429,16 +10747,16 @@ function searchTriggerKeys(keys, query) {
10429
10747
  //#endregion
10430
10748
  //#region src/control/common/resultQuery.ts
10431
10749
  var resultQuerySchema = strictObject({
10432
- pointer: string().max(4096).default(""),
10750
+ pointer: string$1().max(4096).default(""),
10433
10751
  offset: number().int().nonnegative().default(0),
10434
10752
  limit: number().int().min(1).max(100).default(20),
10435
10753
  maxBytes: number().int().min(1).max(1048576).default(15e3)
10436
10754
  });
10437
10755
  //#endregion
10438
10756
  //#region src/control/common/results.ts
10439
- var json = json$2();
10757
+ var json = json$3();
10440
10758
  var entry = strictObject({
10441
- pointer: string(),
10759
+ pointer: string$1(),
10442
10760
  type: _enum([
10443
10761
  "object",
10444
10762
  "array",
@@ -10457,26 +10775,26 @@ var page = entry.extend({
10457
10775
  entries: array(entry).optional()
10458
10776
  });
10459
10777
  var result = strictObject({
10460
- resultId: string().min(1),
10461
- callId: string().min(1),
10462
- toolId: string().min(1),
10778
+ resultId: string$1().min(1),
10779
+ callId: string$1().min(1),
10780
+ toolId: string$1().min(1),
10463
10781
  source: discriminatedUnion("kind", [strictObject({
10464
10782
  kind: literal("connector"),
10465
- action: string().min(1)
10783
+ action: string$1().min(1)
10466
10784
  }), strictObject({ kind: literal("code") })]),
10467
10785
  bytes: number().int().nonnegative(),
10468
- digest: string().regex(/^[a-f0-9]{64}$/),
10469
- createdAt: string().datetime()
10786
+ digest: string$1().regex(/^[a-f0-9]{64}$/),
10787
+ createdAt: string$1().datetime()
10470
10788
  });
10471
10789
  var listSchema = strictObject({
10472
10790
  version: literal(1),
10473
- runId: string(),
10791
+ runId: string$1(),
10474
10792
  results: array(result),
10475
- nextAfter: string().optional()
10793
+ nextAfter: string$1().optional()
10476
10794
  });
10477
10795
  var readSchema = strictObject({
10478
10796
  version: literal(1),
10479
- runId: string(),
10797
+ runId: string$1(),
10480
10798
  result,
10481
10799
  page
10482
10800
  });
@@ -10603,8 +10921,8 @@ function schemaPath(value) {
10603
10921
  return value.map((part) => typeof part == "string" || Number.isSafeInteger(part) ? part : invalidResponse());
10604
10922
  }
10605
10923
  function schemaMismatch(value) {
10606
- const source = record$2(value);
10607
- const kind = string$1(source.kind);
10924
+ const source = record(value);
10925
+ const kind = string(source.kind);
10608
10926
  if (kind == "artifact" || kind == "binary" || kind == "nullable") return { kind };
10609
10927
  if (kind == "schema") return {
10610
10928
  kind,
@@ -10620,30 +10938,30 @@ function schemaMismatch(value) {
10620
10938
  };
10621
10939
  }
10622
10940
  function diagnostic(value) {
10623
- const source = record$2(value);
10624
- const values = source.values == null ? void 0 : record$2(source.values);
10941
+ const source = record(value);
10942
+ const values = source.values == null ? void 0 : record(source.values);
10625
10943
  return {
10626
- code: string$1(source.code),
10627
- column: integer$1(source.column),
10628
- ...source.fields === void 0 ? {} : { fields: Array.isArray(source.fields) ? source.fields.map(string$1) : invalidResponse() },
10629
- line: integer$1(source.line),
10630
- 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),
10631
10949
  mismatch: source.mismatch == null ? void 0 : schemaMismatch(source.mismatch),
10632
10950
  path: typeof source.path == "string" ? source.path : invalidResponse(),
10633
10951
  ...values == null ? {} : { values: Object.fromEntries(Object.entries(values).map(([key, candidate]) => [key, typeof candidate == "string" || typeof candidate == "number" ? candidate : invalidResponse()])) }
10634
10952
  };
10635
10953
  }
10636
10954
  function flowCheck(value) {
10637
- const source = record$2(value);
10955
+ const source = record(value);
10638
10956
  if (source.version != 1 || typeof source.valid != "boolean" || !Array.isArray(source.diagnostics)) return invalidResponse();
10639
10957
  return {
10640
- closureDigest: string$1(source.closureDigest),
10958
+ closureDigest: string(source.closureDigest),
10641
10959
  diagnostics: source.diagnostics.map(diagnostic),
10642
- engineContract: string$1(source.engineContract),
10643
- flowId: string$1(source.flowId),
10644
- modelVersion: integer$1(source.modelVersion),
10645
- revisionDigest: string$1(source.revisionDigest),
10646
- 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),
10647
10965
  valid: source.valid,
10648
10966
  version: 1
10649
10967
  };
@@ -10659,7 +10977,7 @@ function connectorProvidersQuery(flowId, locale) {
10659
10977
  return {
10660
10978
  path: `/v1/connector/providers${parameters ? `?${parameters}` : ""}`,
10661
10979
  decode: (value) => {
10662
- const source = record$2(value);
10980
+ const source = record(value);
10663
10981
  exact(source, ["providers", "version"]);
10664
10982
  if (source.version != 1 || !Array.isArray(source.providers)) return invalidResponse();
10665
10983
  return source.providers.map(connectorProvider);
@@ -10674,7 +10992,7 @@ function connectorActionQuery(actionId, flowId, locale) {
10674
10992
  return {
10675
10993
  path: `/v1/connector/actions/${encodeURIComponent(actionId)}${parameters ? `?${parameters}` : ""}`,
10676
10994
  decode: (value) => {
10677
- const source = record$2(value);
10995
+ const source = record(value);
10678
10996
  exact(source, ["action", "version"]);
10679
10997
  if (source.version != 1) return invalidResponse();
10680
10998
  return connectorAction(source.action);
@@ -10685,7 +11003,7 @@ function allConnectorConnectionsQuery(flowId) {
10685
11003
  return {
10686
11004
  path: `/v1/connector/connections${scope(flowId)}`,
10687
11005
  decode: (value) => {
10688
- const source = record$2(value);
11006
+ const source = record(value);
10689
11007
  exact(source, ["connections", "version"]);
10690
11008
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
10691
11009
  return source.connections.map(connection);
@@ -10696,44 +11014,82 @@ function connectorConnectionsQuery(serviceId, flowId) {
10696
11014
  return {
10697
11015
  path: `/v1/connector/connections/${encodeURIComponent(serviceId)}${scope(flowId)}`,
10698
11016
  decode: (value) => {
10699
- const source = record$2(value);
11017
+ const source = record(value);
10700
11018
  exact(source, [
10701
11019
  "connections",
10702
11020
  "serviceId",
10703
11021
  "version"
10704
11022
  ]);
10705
- 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();
10706
11024
  return source.connections.map(connection);
10707
11025
  }
10708
11026
  };
10709
11027
  }
10710
11028
  //#endregion
10711
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
+ }
10712
11067
  function flow(value) {
10713
- const source = record$2(value);
11068
+ const source = record(value);
10714
11069
  const status = source.status;
10715
11070
  if (source.version != 1) return invalidResponse();
10716
11071
  if (status != "active" && status != "retiring") return invalidResponse();
10717
- const target = source.live == null ? void 0 : record$2(source.live);
11072
+ const target = source.live == null ? void 0 : record(source.live);
10718
11073
  if (target != null && typeof target.enabled != "boolean") return invalidResponse();
10719
11074
  return {
10720
11075
  ...target == null ? {} : { live: {
10721
11076
  enabled: target.enabled,
10722
- publicationId: string$1(target.publicationId),
10723
- revisionId: string$1(target.revisionId)
11077
+ publicationId: string(target.publicationId),
11078
+ revisionId: string(target.revisionId)
10724
11079
  } },
10725
- createdAt: string$1(source.createdAt),
10726
- ...source.connectorTeamId == null ? {} : { connectorTeamId: string$1(source.connectorTeamId) },
10727
- draftRevisionId: string$1(source.draftRevisionId),
10728
- flowId: string$1(source.flowId),
10729
- 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),
10730
11086
  status,
10731
- updatedAt: string$1(source.updatedAt),
11087
+ updatedAt: string(source.updatedAt),
10732
11088
  version: 1
10733
11089
  };
10734
11090
  }
10735
11091
  function flowPage(value) {
10736
- const source = record$2(value);
11092
+ const source = record(value);
10737
11093
  if (source.version != 1 || !Array.isArray(source.flows)) return invalidResponse();
10738
11094
  const nextCursor = source.nextCursor;
10739
11095
  const total = source.total;
@@ -10747,7 +11103,7 @@ function flowPage(value) {
10747
11103
  };
10748
11104
  }
10749
11105
  function variable(value) {
10750
- const source = record$2(value);
11106
+ const source = record(value);
10751
11107
  exact(source, [
10752
11108
  "name",
10753
11109
  "updatedAt",
@@ -10755,35 +11111,35 @@ function variable(value) {
10755
11111
  "version"
10756
11112
  ]);
10757
11113
  if (source.version != 1 || typeof source.value != "string") return invalidResponse();
10758
- const updatedAt = string$1(source.updatedAt);
11114
+ const updatedAt = string(source.updatedAt);
10759
11115
  try {
10760
11116
  if (new Date(updatedAt).toISOString() != updatedAt) return invalidResponse();
10761
11117
  } catch {
10762
11118
  return invalidResponse();
10763
11119
  }
10764
11120
  return {
10765
- name: string$1(source.name),
11121
+ name: string(source.name),
10766
11122
  updatedAt,
10767
11123
  value: source.value,
10768
11124
  version: 1
10769
11125
  };
10770
11126
  }
10771
11127
  function errorListener(value) {
10772
- const source = record$2(value);
11128
+ const source = record(value);
10773
11129
  if (typeof source.enabled != "boolean") return invalidResponse();
10774
11130
  return {
10775
- flowId: string$1(source.flowId),
10776
- flowName: string$1(source.flowName),
10777
- nodeId: string$1(source.nodeId),
10778
- 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),
10779
11135
  enabled: source.enabled
10780
11136
  };
10781
11137
  }
10782
11138
  //#endregion
10783
11139
  //#region src/control/common/publicationDecoders.ts
10784
11140
  function publication(value) {
10785
- const source = record$2(value);
10786
- const liveEnd = source.liveEnd == null ? void 0 : record$2(source.liveEnd);
11141
+ const source = record(value);
11142
+ const liveEnd = source.liveEnd == null ? void 0 : record(source.liveEnd);
10787
11143
  if (liveEnd != null && typeof liveEnd.enabled != "boolean") return invalidResponse();
10788
11144
  const operation = source.operation;
10789
11145
  const sourcePublicationId = source.sourcePublicationId;
@@ -10793,32 +11149,32 @@ function publication(value) {
10793
11149
  return {
10794
11150
  ...liveEnd == null ? {} : { liveEnd: {
10795
11151
  enabled: liveEnd.enabled,
10796
- endedAt: string$1(liveEnd.endedAt)
11152
+ endedAt: string(liveEnd.endedAt)
10797
11153
  } },
10798
- actorId: string$1(source.actorId),
10799
- closureDigest: string$1(source.closureDigest),
10800
- createdAt: string$1(source.createdAt),
10801
- engineContract: string$1(source.engineContract),
10802
- flowId: string$1(source.flowId),
10803
- 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),
10804
11160
  operation,
10805
- publicationId: string$1(source.publicationId),
10806
- sharedAccessDigest: string$1(source.sharedAccessDigest),
10807
- revisionDigest: string$1(source.revisionDigest),
10808
- 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),
10809
11165
  ...sourcePublicationId == null ? {} : { sourcePublicationId },
10810
11166
  version: 1
10811
11167
  };
10812
11168
  }
10813
11169
  function publishOperation(value) {
10814
- const source = record$2(value);
11170
+ const source = record(value);
10815
11171
  const status = source.status;
10816
11172
  const common = {
10817
- createdAt: string$1(source.createdAt),
10818
- flowId: string$1(source.flowId),
10819
- operationId: string$1(source.operationId),
10820
- revisionId: string$1(source.revisionId),
10821
- 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),
10822
11178
  version: 1
10823
11179
  };
10824
11180
  if (source.version != 1) return invalidResponse();
@@ -10850,7 +11206,7 @@ function publishOperation(value) {
10850
11206
  ]);
10851
11207
  return {
10852
11208
  ...common,
10853
- publicationId: string$1(source.publicationId),
11209
+ publicationId: string(source.publicationId),
10854
11210
  status
10855
11211
  };
10856
11212
  case "failed": {
@@ -10864,7 +11220,7 @@ function publishOperation(value) {
10864
11220
  "updatedAt",
10865
11221
  "version"
10866
11222
  ]);
10867
- const issue = record$2(source.issue);
11223
+ const issue = record(source.issue);
10868
11224
  const nodeId = issue.nodeId;
10869
11225
  exact(issue, [
10870
11226
  "code",
@@ -10874,9 +11230,9 @@ function publishOperation(value) {
10874
11230
  return {
10875
11231
  ...common,
10876
11232
  issue: {
10877
- code: string$1(issue.code),
10878
- message: string$1(issue.message),
10879
- ...nodeId == null ? {} : { nodeId: string$1(nodeId) }
11233
+ code: string(issue.code),
11234
+ message: string(issue.message),
11235
+ ...nodeId == null ? {} : { nodeId: string(nodeId) }
10880
11236
  },
10881
11237
  status
10882
11238
  };
@@ -10885,7 +11241,7 @@ function publishOperation(value) {
10885
11241
  }
10886
11242
  }
10887
11243
  function live(value) {
10888
- const source = record$2(value);
11244
+ const source = record(value);
10889
11245
  const status = source.status;
10890
11246
  const candidate = source.publication;
10891
11247
  if (source.version != 1 || typeof source.hasUnpublishedChanges != "boolean") return invalidResponse();
@@ -10893,16 +11249,16 @@ function live(value) {
10893
11249
  if (status == "not-published" && candidate !== null) return invalidResponse();
10894
11250
  if (status != "not-published" && candidate === null) return invalidResponse();
10895
11251
  return {
10896
- flowId: string$1(source.flowId),
11252
+ flowId: string(source.flowId),
10897
11253
  hasUnpublishedChanges: source.hasUnpublishedChanges,
10898
11254
  publication: candidate === null ? null : publication(candidate),
10899
- revision: integer$1(source.revision),
11255
+ revision: integer(source.revision),
10900
11256
  status,
10901
11257
  version: 1
10902
11258
  };
10903
11259
  }
10904
11260
  function publicationPage(value) {
10905
- const source = record$2(value);
11261
+ const source = record(value);
10906
11262
  const nextCursor = source.nextCursor;
10907
11263
  const total = source.total;
10908
11264
  if (source.version != 1 || !Array.isArray(source.publications)) return invalidResponse();
@@ -10918,22 +11274,22 @@ function publicationPage(value) {
10918
11274
  //#endregion
10919
11275
  //#region src/control/common/revisionDecoders.ts
10920
11276
  function revisionMetadata(value) {
10921
- const source = record$2(value);
11277
+ const source = record(value);
10922
11278
  const parentRevisionId = source.parentRevisionId;
10923
11279
  if (source.version != 1 || parentRevisionId !== null && typeof parentRevisionId != "string") return invalidResponse();
10924
11280
  return {
10925
- actorId: string$1(source.actorId),
10926
- createdAt: string$1(source.createdAt),
10927
- digest: string$1(source.digest),
10928
- flowId: string$1(source.flowId),
10929
- 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),
10930
11286
  parentRevisionId,
10931
- revisionId: string$1(source.revisionId),
11287
+ revisionId: string(source.revisionId),
10932
11288
  version: 1
10933
11289
  };
10934
11290
  }
10935
11291
  function draft(value) {
10936
- const source = record$2(value);
11292
+ const source = record(value);
10937
11293
  try {
10938
11294
  return {
10939
11295
  ...revisionMetadata(source),
@@ -10944,17 +11300,17 @@ function draft(value) {
10944
11300
  }
10945
11301
  }
10946
11302
  function presentation(value) {
10947
- const source = record$2(value);
10948
- 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();
10949
11305
  return {
10950
- revision: integer$1(source.revision),
10951
- updatedAt: string$1(source.updatedAt),
10952
- value: Object.fromEntries(Object.entries(record$2(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)])),
10953
11309
  version: 1
10954
11310
  };
10955
11311
  }
10956
11312
  function draftChange(value) {
10957
- const source = record$2(value);
11313
+ const source = record(value);
10958
11314
  if (source.version != 1) return invalidResponse();
10959
11315
  return {
10960
11316
  revision: revisionMetadata(source.revision),
@@ -10962,7 +11318,7 @@ function draftChange(value) {
10962
11318
  };
10963
11319
  }
10964
11320
  function draftSync(value) {
10965
- const source = record$2(value);
11321
+ const source = record(value);
10966
11322
  if (source.version != 1 || source.kind != "snapshot") return invalidResponse();
10967
11323
  return {
10968
11324
  draft: draft(source.draft),
@@ -10988,7 +11344,7 @@ function runStatus(value) {
10988
11344
  return typeof value == "string" && runStatusSet.has(value) ? value : invalidResponse();
10989
11345
  }
10990
11346
  function run(value) {
10991
- const source = record$2(value);
11347
+ const source = record(value);
10992
11348
  const kind = source.source;
10993
11349
  const startedAt = source.startedAt;
10994
11350
  const finishedAt = source.finishedAt;
@@ -10996,11 +11352,11 @@ function run(value) {
10996
11352
  if (startedAt != null && typeof startedAt != "string") return invalidResponse();
10997
11353
  if (finishedAt != null && typeof finishedAt != "string") return invalidResponse();
10998
11354
  return {
10999
- createdAt: string$1(source.createdAt),
11355
+ createdAt: string(source.createdAt),
11000
11356
  ...finishedAt == null ? {} : { finishedAt },
11001
- flowId: string$1(source.flowId),
11002
- revisionId: string$1(source.revisionId),
11003
- runId: string$1(source.runId),
11357
+ flowId: string(source.flowId),
11358
+ revisionId: string(source.revisionId),
11359
+ runId: string(source.runId),
11004
11360
  source: kind,
11005
11361
  ...startedAt == null ? {} : { startedAt },
11006
11362
  status: runStatus(source.status),
@@ -11008,7 +11364,7 @@ function run(value) {
11008
11364
  };
11009
11365
  }
11010
11366
  function runWaiting(value) {
11011
- const source = record$2(value);
11367
+ const source = record(value);
11012
11368
  exact(source, [
11013
11369
  "actions",
11014
11370
  "expiresAt",
@@ -11021,15 +11377,15 @@ function runWaiting(value) {
11021
11377
  if (!Array.isArray(actions) || !(actions.length == 1 && actions[0] == "continue" || actions.length == 2 && actions[0] == "approve" && actions[1] == "reject")) return invalidResponse();
11022
11378
  return {
11023
11379
  actions,
11024
- expiresAt: string$1(source.expiresAt),
11025
- nodeId: string$1(source.nodeId),
11026
- prompt: string$1(source.prompt),
11027
- waitId: string$1(source.waitId),
11028
- 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)
11029
11385
  };
11030
11386
  }
11031
11387
  function runDetails(value) {
11032
- const source = record$2(value);
11388
+ const source = record(value);
11033
11389
  const summary = run(source);
11034
11390
  const eventsExpiresAt = source.eventsExpiresAt;
11035
11391
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
@@ -11049,13 +11405,13 @@ function runDetails(value) {
11049
11405
  const details = {
11050
11406
  ...summary,
11051
11407
  ...errorHandling(source),
11052
- closureDigest: string$1(source.closureDigest),
11053
- engineContract: string$1(source.engineContract),
11054
- engineDigest: string$1(source.engineDigest),
11408
+ closureDigest: string(source.closureDigest),
11409
+ engineContract: string(source.engineContract),
11410
+ engineDigest: string(source.engineDigest),
11055
11411
  ...eventsExpiresAt == null ? {} : { eventsExpiresAt },
11056
- modelVersion: integer$1(source.modelVersion),
11057
- sharedAccessDigest: string$1(source.sharedAccessDigest),
11058
- revisionDigest: string$1(source.revisionDigest),
11412
+ modelVersion: integer(source.modelVersion),
11413
+ sharedAccessDigest: string(source.sharedAccessDigest),
11414
+ revisionDigest: string(source.revisionDigest),
11059
11415
  ...state
11060
11416
  };
11061
11417
  switch (summary.source) {
@@ -11065,40 +11421,40 @@ function runDetails(value) {
11065
11421
  };
11066
11422
  case "live": return {
11067
11423
  ...details,
11068
- publicationId: string$1(source.publicationId),
11424
+ publicationId: string(source.publicationId),
11069
11425
  source: "live",
11070
11426
  ...source.occurrenceId === void 0 ? {} : {
11071
- occurrenceId: string$1(source.occurrenceId),
11072
- triggerNodeId: string$1(source.triggerNodeId)
11427
+ occurrenceId: string(source.occurrenceId),
11428
+ triggerNodeId: string(source.triggerNodeId)
11073
11429
  }
11074
11430
  };
11075
11431
  }
11076
11432
  }
11077
11433
  function runPage(value) {
11078
- const source = record$2(value);
11434
+ const source = record(value);
11079
11435
  const nextCursor = source.nextCursor;
11080
11436
  if (source.version != 1 || !Array.isArray(source.runs)) return invalidResponse();
11081
11437
  if (nextCursor != null && typeof nextCursor != "string") return invalidResponse();
11082
11438
  return {
11083
- flowId: string$1(source.flowId),
11439
+ flowId: string(source.flowId),
11084
11440
  ...nextCursor == null ? {} : { nextCursor },
11085
11441
  runs: source.runs.map(run),
11086
11442
  version: 1
11087
11443
  };
11088
11444
  }
11089
11445
  function runCancellation(value) {
11090
- const source = record$2(value);
11446
+ const source = record(value);
11091
11447
  const status = runStatus(source.status);
11092
11448
  if (source.version != 1 || typeof source.cancelAccepted != "boolean" || status == "queued" || status == "starting" || status == "running" || status == "waiting") return invalidResponse();
11093
11449
  return {
11094
11450
  cancelAccepted: source.cancelAccepted,
11095
- runId: string$1(source.runId),
11451
+ runId: string(source.runId),
11096
11452
  status,
11097
11453
  version: 1
11098
11454
  };
11099
11455
  }
11100
11456
  function waitResolution(value) {
11101
- const source = record$2(value);
11457
+ const source = record(value);
11102
11458
  exact(source, [
11103
11459
  "action",
11104
11460
  "comment",
@@ -11117,19 +11473,19 @@ function waitResolution(value) {
11117
11473
  comment: source.comment,
11118
11474
  resolutionAccepted: source.resolutionAccepted,
11119
11475
  resolvedAt,
11120
- runId: string$1(source.runId),
11476
+ runId: string(source.runId),
11121
11477
  status: runStatus(source.status),
11122
11478
  version: 1,
11123
- waitId: string$1(source.waitId)
11479
+ waitId: string(source.waitId)
11124
11480
  };
11125
11481
  }
11126
11482
  function runResult(value) {
11127
- const source = record$2(value);
11483
+ const source = record(value);
11128
11484
  const status = source.status;
11129
11485
  if (source.version != 1) return invalidResponse();
11130
11486
  const base = {
11131
- finishedAt: string$1(source.finishedAt),
11132
- runId: string$1(source.runId),
11487
+ finishedAt: string(source.finishedAt),
11488
+ runId: string(source.runId),
11133
11489
  version: 1
11134
11490
  };
11135
11491
  if (status == "completed") {
@@ -11145,7 +11501,7 @@ function runResult(value) {
11145
11501
  status: "canceled"
11146
11502
  };
11147
11503
  if (status == "failed") {
11148
- const error = record$2(source.error);
11504
+ const error = record(source.error);
11149
11505
  return {
11150
11506
  ...base,
11151
11507
  error: runFailure(error),
@@ -11153,7 +11509,7 @@ function runResult(value) {
11153
11509
  };
11154
11510
  }
11155
11511
  if (status == "indeterminate") {
11156
- const error = record$2(source.error);
11512
+ const error = record(source.error);
11157
11513
  return {
11158
11514
  ...base,
11159
11515
  error: runFailure(error),
@@ -11163,16 +11519,16 @@ function runResult(value) {
11163
11519
  return invalidResponse();
11164
11520
  }
11165
11521
  function errorHandling(source) {
11166
- const errorSource = source.errorSource == null ? void 0 : record$2(source.errorSource);
11522
+ const errorSource = source.errorSource == null ? void 0 : record(source.errorSource);
11167
11523
  if (source.errorDispatches != null && !Array.isArray(source.errorDispatches)) return invalidResponse();
11168
11524
  return {
11169
11525
  ...errorSource == null ? {} : { errorSource: {
11170
- flowId: string$1(errorSource.flowId),
11171
- runId: string$1(errorSource.runId)
11526
+ flowId: string(errorSource.flowId),
11527
+ runId: string(errorSource.runId)
11172
11528
  } },
11173
11529
  ...source.errorDispatches == null ? {} : { errorDispatches: source.errorDispatches.map((value) => {
11174
- const dispatch = record$2(value);
11175
- const flowId = string$1(dispatch.flowId);
11530
+ const dispatch = record(value);
11531
+ const flowId = string(dispatch.flowId);
11176
11532
  switch (dispatch.status) {
11177
11533
  case "pending": return {
11178
11534
  status: "pending",
@@ -11181,12 +11537,12 @@ function errorHandling(source) {
11181
11537
  case "dispatched": return {
11182
11538
  status: "dispatched",
11183
11539
  flowId,
11184
- runId: string$1(dispatch.runId)
11540
+ runId: string(dispatch.runId)
11185
11541
  };
11186
11542
  case "failed": return {
11187
11543
  status: "failed",
11188
11544
  flowId,
11189
- message: string$1(dispatch.message)
11545
+ message: string(dispatch.message)
11190
11546
  };
11191
11547
  default: return invalidResponse();
11192
11548
  }
@@ -11195,11 +11551,11 @@ function errorHandling(source) {
11195
11551
  }
11196
11552
  function runFailure(error) {
11197
11553
  return {
11198
- code: string$1(error.code),
11199
- message: string$1(error.message),
11200
- ...error.nodeId === void 0 ? {} : { nodeId: string$1(error.nodeId) },
11201
- ...error.jobId === void 0 ? {} : { jobId: string$1(error.jobId) },
11202
- ...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) }
11203
11559
  };
11204
11560
  }
11205
11561
  //#endregion
@@ -11226,14 +11582,14 @@ function isRunTerminalEvent(event) {
11226
11582
  return event?.kind == "run.completed" || event?.kind == "run.failed" || event?.kind == "run.canceled" || event?.kind == "run.indeterminate";
11227
11583
  }
11228
11584
  function decodeRunEvent(value) {
11229
- const source = record$2(value);
11230
- const sequence = integer$1(source.sequence);
11585
+ const source = record(value);
11586
+ const sequence = integer(source.sequence);
11231
11587
  if (sequence < 0) return invalidResponse();
11232
11588
  const base = {
11233
- createdAt: string$1(source.createdAt),
11589
+ createdAt: string(source.createdAt),
11234
11590
  sequence
11235
11591
  };
11236
- const payload = record$2(source.payload);
11592
+ const payload = record(source.payload);
11237
11593
  const kind = source.kind;
11238
11594
  switch (kind) {
11239
11595
  case "run.queued": return {
@@ -11245,17 +11601,17 @@ function decodeRunEvent(value) {
11245
11601
  ...base,
11246
11602
  kind,
11247
11603
  payload: {
11248
- flowId: string$1(payload.flowId),
11249
- scopeId: string$1(payload.scopeId),
11250
- ...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) }
11251
11607
  }
11252
11608
  };
11253
11609
  case "run.progress": return {
11254
11610
  ...base,
11255
11611
  kind,
11256
11612
  payload: {
11257
- flowId: string$1(payload.flowId),
11258
- scopeId: string$1(payload.scopeId),
11613
+ flowId: string(payload.flowId),
11614
+ scopeId: string(payload.scopeId),
11259
11615
  progress: eventProgress(payload.progress)
11260
11616
  }
11261
11617
  };
@@ -11264,16 +11620,16 @@ function decodeRunEvent(value) {
11264
11620
  return {
11265
11621
  ...base,
11266
11622
  kind,
11267
- payload: { waitIds: payload.waitIds.map((id) => string$1(id)) }
11623
+ payload: { waitIds: payload.waitIds.map((id) => string(id)) }
11268
11624
  };
11269
11625
  case "wait.created": return {
11270
11626
  ...base,
11271
11627
  kind,
11272
11628
  payload: {
11273
- expiresAt: string$1(payload.expiresAt),
11274
- nodeId: string$1(payload.nodeId),
11275
- waitId: string$1(payload.waitId),
11276
- 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)
11277
11633
  }
11278
11634
  };
11279
11635
  case "run.resolved": {
@@ -11286,8 +11642,8 @@ function decodeRunEvent(value) {
11286
11642
  payload: {
11287
11643
  action,
11288
11644
  comment: payload.comment,
11289
- resolvedAt: string$1(payload.resolvedAt),
11290
- waitId: string$1(payload.waitId)
11645
+ resolvedAt: string(payload.resolvedAt),
11646
+ waitId: string(payload.waitId)
11291
11647
  }
11292
11648
  };
11293
11649
  }
@@ -11311,10 +11667,10 @@ function decodeRunEvent(value) {
11311
11667
  case "node.progress":
11312
11668
  case "node.artifact": {
11313
11669
  const node = {
11314
- flowId: string$1(payload.flowId),
11315
- scopeId: string$1(payload.scopeId),
11316
- nodeId: string$1(payload.nodeId),
11317
- 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)
11318
11674
  };
11319
11675
  switch (kind) {
11320
11676
  case "node.started": {
@@ -11326,8 +11682,8 @@ function decodeRunEvent(value) {
11326
11682
  payload: {
11327
11683
  ...node,
11328
11684
  ...nodeKind === void 0 ? {} : { nodeKind },
11329
- ...payload.nodeTitle === void 0 ? {} : { nodeTitle: string$1(payload.nodeTitle) },
11330
- ...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) }
11331
11687
  }
11332
11688
  };
11333
11689
  }
@@ -11336,19 +11692,19 @@ function decodeRunEvent(value) {
11336
11692
  kind,
11337
11693
  payload: {
11338
11694
  ...node,
11339
- outputs: Object.fromEntries(Object.entries(record$2(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
11695
+ outputs: Object.fromEntries(Object.entries(record(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
11340
11696
  }
11341
11697
  };
11342
11698
  case "node.failed": {
11343
- const error = record$2(payload.error);
11699
+ const error = record(payload.error);
11344
11700
  return {
11345
11701
  ...base,
11346
11702
  kind,
11347
11703
  payload: {
11348
11704
  ...node,
11349
11705
  error: {
11350
- code: string$1(error.code),
11351
- message: string$1(error.message)
11706
+ code: string(error.code),
11707
+ message: string(error.message)
11352
11708
  }
11353
11709
  }
11354
11710
  };
@@ -11362,7 +11718,7 @@ function decodeRunEvent(value) {
11362
11718
  payload: {
11363
11719
  ...node,
11364
11720
  level,
11365
- message: string$1(payload.message)
11721
+ message: string(payload.message)
11366
11722
  }
11367
11723
  };
11368
11724
  }
@@ -11375,9 +11731,9 @@ function decodeRunEvent(value) {
11375
11731
  }
11376
11732
  };
11377
11733
  case "node.artifact": {
11378
- const artifact = record$2(payload.artifact);
11379
- const size = integer$1(artifact.size);
11380
- const digest = string$1(artifact.digest);
11734
+ const artifact = record(payload.artifact);
11735
+ const size = integer(artifact.size);
11736
+ const digest = string(artifact.digest);
11381
11737
  if (artifact.kind != "artifact" || size < 0 || !/^sha256:[0-9a-f]{64}$/.test(digest)) return invalidResponse();
11382
11738
  return {
11383
11739
  ...base,
@@ -11386,11 +11742,11 @@ function decodeRunEvent(value) {
11386
11742
  ...node,
11387
11743
  artifact: {
11388
11744
  kind: "artifact",
11389
- id: string$1(artifact.id),
11390
- name: string$1(artifact.name),
11745
+ id: string(artifact.id),
11746
+ name: string(artifact.name),
11391
11747
  size,
11392
11748
  digest,
11393
- ...artifact.mediaType === void 0 ? {} : { mediaType: string$1(artifact.mediaType) }
11749
+ ...artifact.mediaType === void 0 ? {} : { mediaType: string(artifact.mediaType) }
11394
11750
  }
11395
11751
  }
11396
11752
  };
@@ -11404,9 +11760,9 @@ function eventProgress(value) {
11404
11760
  return typeof value == "number" && Number.isFinite(value) && value >= 0 && value <= 100 ? value : invalidResponse();
11405
11761
  }
11406
11762
  function runEvents(value) {
11407
- const source = record$2(value);
11763
+ const source = record(value);
11408
11764
  const eventsExpiresAt = source.eventsExpiresAt;
11409
- const nextAfter = integer$1(source.nextAfter);
11765
+ const nextAfter = integer(source.nextAfter);
11410
11766
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.done != "boolean" || typeof source.historyComplete != "boolean") return invalidResponse();
11411
11767
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
11412
11768
  if (nextAfter < 0) return invalidResponse();
@@ -11416,7 +11772,7 @@ function runEvents(value) {
11416
11772
  ...eventsExpiresAt == null ? {} : { eventsExpiresAt },
11417
11773
  historyComplete: source.historyComplete,
11418
11774
  nextAfter,
11419
- runId: string$1(source.runId),
11775
+ runId: string(source.runId),
11420
11776
  version: 1
11421
11777
  };
11422
11778
  }
@@ -11429,7 +11785,7 @@ var ControlClient = class {
11429
11785
  this.requestControl = requestControl;
11430
11786
  }
11431
11787
  async loadOpenApiDocument(url, signal) {
11432
- const result = record$2(await this.request("/v1/openapi/document", {
11788
+ const result = record(await this.request("/v1/openapi/document", {
11433
11789
  method: "POST",
11434
11790
  body: JSON.stringify({
11435
11791
  url,
@@ -11452,7 +11808,7 @@ var ControlClient = class {
11452
11808
  return decodeEventSources(await this.request("/v1/event-sources" + (flowId == null ? "" : `?flowId=${segment(flowId)}`), { signal }));
11453
11809
  }
11454
11810
  async listEventSourceConnections(teamId, signal) {
11455
- const source = record$2(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 }));
11456
11812
  exact(source, ["version", "connections"]);
11457
11813
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
11458
11814
  return source.connections.map(connection);
@@ -11479,7 +11835,7 @@ var ControlClient = class {
11479
11835
  });
11480
11836
  }
11481
11837
  async listVariables() {
11482
- const source = record$2(await this.request("/v1/variables"));
11838
+ const source = record(await this.request("/v1/variables"));
11483
11839
  exact(source, ["variables", "version"]);
11484
11840
  if (source.version != 1 || !Array.isArray(source.variables)) return invalidResponse();
11485
11841
  return {
@@ -11497,7 +11853,7 @@ var ControlClient = class {
11497
11853
  }));
11498
11854
  }
11499
11855
  async deleteVariable(name) {
11500
- const source = record$2(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
11856
+ const source = record(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
11501
11857
  exact(source, ["version"]);
11502
11858
  if (source.version != 1) return invalidResponse();
11503
11859
  }
@@ -11516,7 +11872,7 @@ var ControlClient = class {
11516
11872
  return flow(await this.request(`/v1/flows/${segment(flowId)}`));
11517
11873
  }
11518
11874
  async getErrorListeners(flowId, signal) {
11519
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
11875
+ const source = record(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
11520
11876
  if (source.version != 1 || !Array.isArray(source.listeners)) return invalidResponse();
11521
11877
  return source.listeners.map(errorListener);
11522
11878
  }
@@ -11533,12 +11889,12 @@ var ControlClient = class {
11533
11889
  return flow(await this.request(`/v1/flows/${segment(flowId)}`, { method: "DELETE" }));
11534
11890
  }
11535
11891
  async listTriggerKeys(signal, locale) {
11536
- const source = record$2(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 }));
11537
11893
  if (source.version != 1 || !Array.isArray(source.keys)) return invalidResponse();
11538
11894
  return source.keys.map(triggerKeySummary);
11539
11895
  }
11540
11896
  async listTriggerDefinitions(signal) {
11541
- const source = record$2(await this.request("/v1/trigger-keys/catalog", { signal }));
11897
+ const source = record(await this.request("/v1/trigger-keys/catalog", { signal }));
11542
11898
  if (source.version != 2 || !Array.isArray(source.definitions)) return invalidResponse();
11543
11899
  return source.definitions.map(triggerKey);
11544
11900
  }
@@ -11580,13 +11936,13 @@ var ControlClient = class {
11580
11936
  };
11581
11937
  }
11582
11938
  async getTriggerKey(key, signal) {
11583
- const source = record$2(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
11939
+ const source = record(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
11584
11940
  if (source.version != 1) return invalidResponse();
11585
11941
  return triggerKey(source.definition);
11586
11942
  }
11587
11943
  async listFlowTriggerBindings(flowId, signal) {
11588
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/triggers`, { signal }));
11589
- 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();
11590
11946
  return source.bindings.map(triggerBinding);
11591
11947
  }
11592
11948
  async getFlowTriggerBinding(flowId, triggerNodeId) {
@@ -11618,7 +11974,7 @@ var ControlClient = class {
11618
11974
  }));
11619
11975
  }
11620
11976
  async getEditor(flowId) {
11621
- const source = record$2(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11977
+ const source = record(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11622
11978
  if (source.version != 1) return invalidResponse();
11623
11979
  const result = {
11624
11980
  flow: flow(source.flow),
@@ -11631,7 +11987,7 @@ var ControlClient = class {
11631
11987
  return result;
11632
11988
  }
11633
11989
  async getPublicationPresentation(flowId, publicationId, signal) {
11634
- const source = record$2(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 }));
11635
11991
  if (source.version != 1) return invalidResponse();
11636
11992
  return {
11637
11993
  version: 1,
@@ -11651,30 +12007,30 @@ var ControlClient = class {
11651
12007
  return draft(await this.request(`/v1/flows/${segment(flowId)}/revisions/${segment(revisionId)}`, { signal }));
11652
12008
  }
11653
12009
  async listTriggerConfigOptions(flowId, nodeId, field, signal) {
11654
- const source = record$2(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 }));
11655
12011
  exact(source, ["options", "version"]);
11656
12012
  if (source.version != 1 || !Array.isArray(source.options) || source.options.length > 1e3) return invalidResponse();
11657
12013
  return source.options.map((value) => {
11658
- const item = record$2(value);
12014
+ const item = record(value);
11659
12015
  exact(item, [
11660
12016
  "value",
11661
12017
  "label",
11662
12018
  ...item.color == null ? [] : ["color"]
11663
12019
  ]);
11664
- const color = item.color == null ? void 0 : string$1(item.color);
12020
+ const color = item.color == null ? void 0 : string(item.color);
11665
12021
  if (color != null && !/^#[0-9a-fA-F]{6}$/.test(color)) return invalidResponse();
11666
12022
  return color == null ? {
11667
- value: string$1(item.value),
11668
- label: string$1(item.label)
12023
+ value: string(item.value),
12024
+ label: string(item.label)
11669
12025
  } : {
11670
- value: string$1(item.value),
11671
- label: string$1(item.label),
12026
+ value: string(item.value),
12027
+ label: string(item.label),
11672
12028
  color
11673
12029
  };
11674
12030
  });
11675
12031
  }
11676
12032
  async listConnectorTeams(signal) {
11677
- const source = record$2(await this.request("/v1/connector/teams", { signal }));
12033
+ const source = record(await this.request("/v1/connector/teams", { signal }));
11678
12034
  exact(source, [
11679
12035
  "enabled",
11680
12036
  "teams",
@@ -11684,7 +12040,7 @@ var ControlClient = class {
11684
12040
  return {
11685
12041
  enabled: source.enabled,
11686
12042
  teams: source.teams.map((value) => {
11687
- const team = record$2(value);
12043
+ const team = record(value);
11688
12044
  exact(team, [
11689
12045
  "id",
11690
12046
  "name",
@@ -11692,8 +12048,8 @@ var ControlClient = class {
11692
12048
  ]);
11693
12049
  if (typeof team.systemCreated != "boolean") return invalidResponse();
11694
12050
  return {
11695
- id: string$1(team.id),
11696
- name: string$1(team.name),
12051
+ id: string(team.id),
12052
+ name: string(team.name),
11697
12053
  systemCreated: team.systemCreated
11698
12054
  };
11699
12055
  }),
@@ -11791,20 +12147,51 @@ var ControlClient = class {
11791
12147
  const parameters = new URLSearchParams();
11792
12148
  if (flowId != null) parameters.set("flowId", flowId);
11793
12149
  if (teamId != null) parameters.set("teamId", teamId);
11794
- const source = record$2(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}`}`, {
11795
12151
  body: JSON.stringify({ version: 1 }),
11796
12152
  method: "POST"
11797
12153
  }));
11798
12154
  exact(source, ["url", "version"]);
11799
12155
  if (source.version != 1) return invalidResponse();
11800
12156
  try {
11801
- const url = new URL(string$1(source.url));
12157
+ const url = new URL(string(source.url));
11802
12158
  if (url.protocol != "http:" && url.protocol != "https:") return invalidResponse();
11803
12159
  return url.href;
11804
12160
  } catch {
11805
12161
  return invalidResponse();
11806
12162
  }
11807
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
+ }
11808
12195
  async changeDraft(flowId, expectedRevisionId, operations, changeId = operationKey("change")) {
11809
12196
  return draftChange(await this.request(`/v1/flows/${segment(flowId)}/draft/changes`, {
11810
12197
  body: JSON.stringify({
@@ -11962,7 +12349,7 @@ var ControlClient = class {
11962
12349
  const query = Object.entries(parameters).map(([key, value]) => `${segment(key)}=${segment(value)}`).join("&");
11963
12350
  const suffix = query == "" ? "" : `?${query}`;
11964
12351
  return this.connectorRequest(`/v1/connector/actions${suffix}`, "actions", signal, (value) => {
11965
- const source = record$2(value);
12352
+ const source = record(value);
11966
12353
  exact(source, ["actions", "version"]);
11967
12354
  if (source.version != 1 || !Array.isArray(source.actions)) return invalidResponse();
11968
12355
  return source.actions.map(connectorAction);
@@ -11985,9 +12372,9 @@ var ControlClient = class {
11985
12372
  } catch {
11986
12373
  return invalidResponse();
11987
12374
  }
11988
- const error = record$2(value).error;
11989
- const source = error == null ? void 0 : record$2(error);
11990
- throw new ApiError(response.status, typeof source?.code == "string" ? source.code : "request.failed", typeof source?.message == "string" ? source.message : `Request failed with status ${response.status}.`);
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));
11991
12378
  }
11992
12379
  return response;
11993
12380
  }