@oomol-lab/open-flow 0.1.0-beta.1 → 0.1.0-beta.11

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 (69) hide show
  1. package/dist/browser/DesignerIcon-ckcKnxxJ.js +2267 -0
  2. package/dist/browser/createResourceDialog-DhIU-HYW.js +111 -0
  3. package/dist/browser/{dist-CPuF50D9.js → dist-BZ5PTFAs.js} +1 -1
  4. package/dist/browser/dist-Bmb2mZvW.js +795 -0
  5. package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
  6. package/dist/browser/dist-CP0883sY.js +4 -0
  7. package/dist/browser/{dist-CJpzJrLM.js → dist-Ce71Szg7.js} +894 -895
  8. package/dist/browser/dist-DSe6KRsr.js +1224 -0
  9. package/dist/browser/{dist-DUzA0Ukh.js → dist-DY4qlXTK.js} +140 -141
  10. package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
  11. package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
  12. package/dist/browser/dist-DxahK_I8.js +2688 -0
  13. package/dist/browser/{esm-DGQbgYoJ.js → esm-C64_h7HF.js} +58 -59
  14. package/dist/browser/flow-authoring-module.d.ts +2 -2
  15. package/dist/browser/flow-authoring-node.d.ts +17 -7
  16. package/dist/browser/flow-authoring.d.ts +1 -1
  17. package/dist/browser/flow-authoring.js +5329 -286
  18. package/dist/browser/flow-change-schema.d.ts +3 -0
  19. package/dist/browser/flow-change.d.ts +131 -14
  20. package/dist/browser/flow-change.js +5216 -114
  21. package/dist/browser/flow-notifications.d.ts +5 -0
  22. package/dist/browser/flowChanges-BINNGoug.js +12896 -0
  23. package/dist/browser/{flowRunInputEditorStore-BeyUSWpO.js → flowRunInputEditorStore-NPGePkvP.js} +775 -776
  24. package/dist/browser/flowWorkspace-Dp_b8KXF.js +158409 -0
  25. package/dist/browser/{getPseudoElementBounds-ESJExRFX.js → getPseudoElementBounds-Dfqo78k7.js} +2051 -2542
  26. package/dist/browser/{languages-DgJehE1g.js → languages-i3Xmpt6S.js} +6 -15
  27. package/dist/browser/licenses.md +82 -0
  28. package/dist/browser/{markdownContent-DdlIRN3_.js → markdownContent-BawLYUjh.js} +24 -24
  29. package/dist/browser/select-CbQHq-GM.js +6851 -0
  30. package/dist/browser/theme.css +34 -34
  31. package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-BoV-FDl3.js} +68 -69
  32. package/dist/browser/waitNotificationInputs-fzyKN6mk.js +29 -0
  33. package/dist/browser/workbench-contract.d.ts +8 -2
  34. package/dist/browser/workbench.css +1 -1
  35. package/dist/browser/workbench.d.ts +3 -1
  36. package/dist/browser/workbench.js +1647 -1299
  37. package/dist/browser/workbenchSelect-BjbJjlNd.js +435 -0
  38. package/dist/common/control-api-conformance.d.ts +1 -0
  39. package/dist/common/control-api-conformance.js +309 -81
  40. package/dist/common/control-api-errors.d.ts +12 -0
  41. package/dist/common/control-api.d.ts +95 -23
  42. package/dist/common/control-api.js +567 -364
  43. package/dist/common/engine-contract.d.ts +1 -1
  44. package/dist/common/flow-encoding.js +33 -15
  45. package/dist/common/flow-graph.d.ts +6 -0
  46. package/dist/common/flow-modules.d.ts +20 -0
  47. package/dist/common/flow-notifications.d.ts +5 -0
  48. package/dist/common/flow-schema.d.ts +8 -0
  49. package/dist/common/flow-semantics.d.ts +7 -5
  50. package/dist/common/flow-semantics.js +8880 -1702
  51. package/dist/common/integration-trigger.d.ts +2 -0
  52. package/dist/common/provider-triggers.js +4 -1
  53. package/dist/common/run-events.d.ts +2 -2
  54. package/dist/common/run-events.js +10 -16
  55. package/dist/common/run-lifecycle.d.ts +17 -2
  56. package/dist/common/run-lifecycle.js +53 -2
  57. package/dist/common/runtime-contract.d.ts +10 -2
  58. package/dist/common/runtime-contract.js +143 -6
  59. package/dist/common/scheduler.d.ts +52 -13
  60. package/dist/common/scheduler.js +7315 -242
  61. package/dist/index.d.ts +6 -5
  62. package/package.json +1 -1
  63. package/dist/browser/createResourceDialog-DXQz0thK.js +0 -504
  64. package/dist/browser/diagnostics-BGoGFvHA.js +0 -9237
  65. package/dist/browser/dist-BMqL-qR5.js +0 -1894
  66. package/dist/browser/dist-BpopSHwP.js +0 -1543
  67. package/dist/browser/dist-CUSrALSX.js +0 -1620
  68. package/dist/browser/flowWorkspace-DwyxAOBH.js +0 -47615
  69. package/dist/browser/workbenchSelect-B2s1HV-Y.js +0 -1374
@@ -19,6 +19,8 @@ var e = {
19
19
  pageInvalidCursor: "page.invalid-cursor",
20
20
  publicationConflict: "publication.conflict",
21
21
  publicationNotFound: "publication.not-found",
22
+ publicationUnsupported: "publication.unsupported",
23
+ publishOperationNotFound: "publication.operation-not-found",
22
24
  routeNotFound: "route.not-found",
23
25
  runConflict: "run.conflict",
24
26
  runEventsExpired: "run.events-expired",
@@ -26,6 +28,7 @@ var e = {
26
28
  runNotFound: "run.not-found",
27
29
  runNotTerminal: "run.not-terminal",
28
30
  runOverloaded: "run.overloaded",
31
+ runWaitNotFound: "run.wait-not-found",
29
32
  triggerKeyInvalid: "trigger-key.invalid",
30
33
  triggerKeyNotFound: "trigger-key.not-found",
31
34
  triggerNotFound: "trigger.not-found",
@@ -52,6 +55,8 @@ var e = {
52
55
  [e.pageInvalidCursor]: { status: 400 },
53
56
  [e.publicationConflict]: { status: 409 },
54
57
  [e.publicationNotFound]: { status: 404 },
58
+ [e.publicationUnsupported]: { status: 409 },
59
+ [e.publishOperationNotFound]: { status: 404 },
55
60
  [e.routeNotFound]: { status: 404 },
56
61
  [e.runConflict]: { status: 409 },
57
62
  [e.runEventsExpired]: { status: 410 },
@@ -59,6 +64,7 @@ var e = {
59
64
  [e.runNotFound]: { status: 404 },
60
65
  [e.runNotTerminal]: { status: 409 },
61
66
  [e.runOverloaded]: { status: 429 },
67
+ [e.runWaitNotFound]: { status: 404 },
62
68
  [e.triggerKeyInvalid]: { status: 409 },
63
69
  [e.triggerKeyNotFound]: { status: 404 },
64
70
  [e.triggerNotFound]: { status: 404 },
@@ -72,37 +78,59 @@ var e = {
72
78
  "indeterminate",
73
79
  "queued",
74
80
  "running",
75
- "starting"
76
- ], r = class extends Error {
81
+ "starting",
82
+ "waiting"
83
+ ];
84
+ //#endregion
85
+ //#region src/control/common/random.ts
86
+ function r() {
87
+ let e = globalThis.crypto;
88
+ if (e != null) {
89
+ try {
90
+ if (typeof e.randomUUID == "function") return e.randomUUID();
91
+ } catch {}
92
+ if (typeof e.getRandomValues == "function") {
93
+ let t = e.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
94
+ t[6] = (t[6] ?? 0) & 15 | 64, t[8] = (t[8] ?? 0) & 63 | 128;
95
+ let n = Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
96
+ return `${n.slice(0, 8)}-${n.slice(8, 12)}-${n.slice(12, 16)}-${n.slice(16, 20)}-${n.slice(20)}`;
97
+ }
98
+ }
99
+ return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
100
+ }
101
+ //#endregion
102
+ //#region src/control/common/api.ts
103
+ var i = class extends Error {
77
104
  constructor(e, t, n) {
78
105
  super(n), this.code = t, this.name = "ApiError", this.status = e;
79
106
  }
80
107
  };
81
- function i() {
82
- throw new r(502, "response.invalid", "The Control API returned an invalid response.");
83
- }
84
- function a(e) {
85
- return typeof e != "object" || !e || Array.isArray(e) ? i() : e;
108
+ function a() {
109
+ throw new i(502, "response.invalid", "The Control API returned an invalid response.");
86
110
  }
87
111
  function o(e) {
88
- return typeof e == "string" && e.length > 0 ? e : i();
112
+ return typeof e != "object" || !e || Array.isArray(e) ? a() : e;
89
113
  }
90
- function s(e, t) {
91
- let n = Object.keys(e);
92
- (n.length != t.length || n.some((e) => !t.includes(e))) && i();
114
+ function s(e) {
115
+ return typeof e == "string" && e.length > 0 ? e : a();
93
116
  }
94
- function c(e) {
95
- return Number.isSafeInteger(e) ? e : i();
117
+ function c(e, t) {
118
+ let n = Object.keys(e);
119
+ (n.length != t.length || n.some((e) => !t.includes(e))) && a();
96
120
  }
97
121
  function l(e) {
98
- if (e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e)) return e;
99
- if (Array.isArray(e)) return e.map(l);
100
- let t = a(e);
101
- return Object.fromEntries(Object.entries(t).map(([e, t]) => [e, l(t)]));
122
+ return Number.isSafeInteger(e) ? e : a();
102
123
  }
103
124
  function u(e) {
104
- let t = a(e);
105
- s(t, [
125
+ if (e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e)) return e;
126
+ if (Array.isArray(e)) return e.map(u);
127
+ let t = o(e);
128
+ return Object.fromEntries(Object.entries(t).map(([e, t]) => [e, u(t)]));
129
+ }
130
+ function d(e) {
131
+ let t = o(e);
132
+ c(t, [
133
+ ...Object.hasOwn(t, "alias") ? ["alias"] : [],
106
134
  "connectionId",
107
135
  "displayName",
108
136
  "isDefault",
@@ -110,101 +138,112 @@ function u(e) {
110
138
  "status"
111
139
  ]);
112
140
  let n = t.status;
113
- return n != "active" && n != "disconnected" && n != "error" && n != "reauth_required" || typeof t.isDefault != "boolean" ? i() : {
114
- connectionId: o(t.connectionId),
115
- displayName: o(t.displayName),
141
+ return n != "active" && n != "disconnected" && n != "error" && n != "reauth_required" || typeof t.isDefault != "boolean" ? a() : {
142
+ ...t.alias === void 0 ? {} : { alias: s(t.alias) },
143
+ connectionId: s(t.connectionId),
144
+ displayName: s(t.displayName),
116
145
  isDefault: t.isDefault,
117
- serviceId: o(t.serviceId),
146
+ serviceId: s(t.serviceId),
118
147
  status: n
119
148
  };
120
149
  }
121
- function d(e, t = !1) {
122
- let n = a(e), r = n.description, o = t && Object.hasOwn(n, "value");
123
- return s(n, [
150
+ function f(e, t = !1) {
151
+ let n = o(e), r = n.description, i = t && Object.hasOwn(n, "value");
152
+ return c(n, [
124
153
  "jsonSchema",
125
154
  "nullable",
126
155
  ...r == null ? [] : ["description"],
127
- ...o ? ["value"] : []
128
- ]), r != null && typeof r != "string" || typeof n.nullable != "boolean" ? i() : {
156
+ ...i ? ["value"] : []
157
+ ]), r != null && typeof r != "string" || typeof n.nullable != "boolean" ? a() : {
129
158
  ...r == null ? {} : { description: r },
130
- jsonSchema: l(n.jsonSchema),
159
+ jsonSchema: u(n.jsonSchema),
131
160
  nullable: n.nullable,
132
- ...o ? { value: l(n.value) } : {}
161
+ ...i ? { value: u(n.value) } : {}
133
162
  };
134
163
  }
135
- function f(e) {
136
- return d(e, !0);
164
+ function p(e) {
165
+ return f(e, !0);
137
166
  }
138
- function p(e, t) {
139
- return Object.fromEntries(Object.entries(a(e)).map(([e, n]) => [e, t(n)]));
167
+ function m(e, t) {
168
+ return Object.fromEntries(Object.entries(o(e)).map(([e, n]) => [e, t(n)]));
140
169
  }
141
- function m(e) {
142
- let t = a(e), n = t.icon, r = t.defaultConnection != null;
143
- if (s(t, [
170
+ function h(e) {
171
+ let t = o(e), n = t.homepageUrl, r = t.icon, i = t.defaultConnection != null;
172
+ if (c(t, [
144
173
  "actionId",
145
- ...r ? ["defaultConnection"] : [],
174
+ ...Object.hasOwn(t, "inputSchema") ? ["inputSchema"] : [],
175
+ ...Object.hasOwn(t, "outputSchema") ? ["outputSchema"] : [],
176
+ "authenticated",
177
+ ...i ? ["defaultConnection"] : [],
146
178
  "description",
147
- ...n == null ? [] : ["icon"],
179
+ ...n == null ? [] : ["homepageUrl"],
180
+ ...r == null ? [] : ["icon"],
148
181
  "inputs",
149
182
  "name",
150
183
  "outputs",
151
184
  "serviceId",
152
185
  "serviceName"
153
- ]), n != null && typeof n != "string") return i();
154
- let c = {
155
- actionId: o(t.actionId),
156
- ...r ? { defaultConnection: u(t.defaultConnection) } : {},
157
- description: typeof t.description == "string" ? t.description : i(),
158
- ...n == null ? {} : { icon: n },
159
- inputs: p(t.inputs, f),
160
- name: o(t.name),
161
- outputs: p(t.outputs, d),
162
- serviceId: o(t.serviceId),
163
- serviceName: o(t.serviceName)
164
- };
165
- return c.defaultConnection != null && (c.defaultConnection.serviceId != c.serviceId || c.defaultConnection.status != "active") ? i() : c;
186
+ ]), n != null && typeof n != "string" || r != null && typeof r != "string") return a();
187
+ let l = {
188
+ ...t.inputSchema === void 0 ? {} : { inputSchema: u(t.inputSchema) },
189
+ ...t.outputSchema === void 0 ? {} : { outputSchema: u(t.outputSchema) },
190
+ actionId: s(t.actionId),
191
+ authenticated: typeof t.authenticated == "boolean" ? t.authenticated : a(),
192
+ ...i ? { defaultConnection: d(t.defaultConnection) } : {},
193
+ description: typeof t.description == "string" ? t.description : a(),
194
+ ...n == null ? {} : { homepageUrl: n },
195
+ ...r == null ? {} : { icon: r },
196
+ inputs: m(t.inputs, p),
197
+ name: s(t.name),
198
+ outputs: m(t.outputs, f),
199
+ serviceId: s(t.serviceId),
200
+ serviceName: s(t.serviceName)
201
+ };
202
+ return l.defaultConnection != null && (l.defaultConnection.serviceId != l.serviceId || l.defaultConnection.status != "active") ? a() : l;
166
203
  }
167
- function h(e) {
168
- let t = a(e), n = t.icon;
169
- return s(t, [
204
+ function g(e) {
205
+ let t = o(e), n = t.homepageUrl, r = t.icon;
206
+ return c(t, [
170
207
  "serviceId",
171
208
  "serviceName",
172
- ...n == null ? [] : ["icon"]
173
- ]), n != null && typeof n != "string" ? i() : {
174
- ...n == null ? {} : { icon: n },
175
- serviceId: o(t.serviceId),
176
- serviceName: o(t.serviceName)
209
+ ...n == null ? [] : ["homepageUrl"],
210
+ ...r == null ? [] : ["icon"]
211
+ ]), n != null && typeof n != "string" || r != null && typeof r != "string" ? a() : {
212
+ ...n == null ? {} : { homepageUrl: n },
213
+ ...r == null ? {} : { icon: r },
214
+ serviceId: s(t.serviceId),
215
+ serviceName: s(t.serviceName)
177
216
  };
178
217
  }
179
- function g(e) {
180
- let t = a(e), n = t.type;
181
- return n != "integration" && n != "poll" ? i() : {
182
- description: typeof t.description == "string" ? t.description : i(),
183
- displayName: o(t.displayName),
184
- key: o(t.key),
185
- name: o(t.name),
186
- provider: o(t.provider),
218
+ function _(e) {
219
+ let t = o(e), n = t.type;
220
+ return n != "integration" && n != "poll" ? a() : {
221
+ description: typeof t.description == "string" ? t.description : a(),
222
+ displayName: s(t.displayName),
223
+ key: s(t.key),
224
+ name: s(t.name),
225
+ provider: s(t.provider),
187
226
  type: n
188
227
  };
189
228
  }
190
- function _(e) {
191
- let t = a(e), n = g(t), r = {
192
- configSchema: l(t.configSchema),
193
- definitionVersion: c(t.definitionVersion),
229
+ function v(e) {
230
+ let t = o(e), n = _(t), r = {
231
+ configSchema: u(t.configSchema),
232
+ definitionVersion: l(t.definitionVersion),
194
233
  description: n.description,
195
234
  displayName: n.displayName,
196
235
  key: n.key,
197
236
  name: n.name,
198
- payloadSchema: l(t.payloadSchema),
237
+ payloadSchema: u(t.payloadSchema),
199
238
  provider: n.provider
200
239
  };
201
240
  if (n.type == "poll") return {
202
241
  ...r,
203
242
  type: "poll"
204
243
  };
205
- let s = a(t.endpoint), u = a(s.body);
206
- if (!Array.isArray(s.methods) || !Array.isArray(u.formats) || typeof u.allowArray != "boolean" || typeof u.allowEmpty != "boolean") return i();
207
- let d = s.methods.map(o), f = u.formats.map(o), p = c(s.successStatus);
244
+ let i = o(t.endpoint), c = o(i.body);
245
+ if (!Array.isArray(i.methods) || !Array.isArray(c.formats) || typeof c.allowArray != "boolean" || typeof c.allowEmpty != "boolean") return a();
246
+ let d = i.methods.map(s), f = c.formats.map(s), p = l(i.successStatus);
208
247
  return d.some((e) => ![
209
248
  "DELETE",
210
249
  "GET",
@@ -217,12 +256,12 @@ function _(e) {
217
256
  "json",
218
257
  "multipart",
219
258
  "text"
220
- ].includes(e)) || p < 200 || p > 299 ? i() : {
259
+ ].includes(e)) || p < 200 || p > 299 ? a() : {
221
260
  ...r,
222
261
  endpoint: {
223
262
  body: {
224
- allowArray: u.allowArray,
225
- allowEmpty: u.allowEmpty,
263
+ allowArray: c.allowArray,
264
+ allowEmpty: c.allowEmpty,
226
265
  formats: f
227
266
  },
228
267
  methods: d,
@@ -231,18 +270,18 @@ function _(e) {
231
270
  type: "integration"
232
271
  };
233
272
  }
234
- var v = /* @__PURE__ */ new Set([
273
+ var y = /* @__PURE__ */ new Set([
235
274
  "cron",
236
275
  "integration",
237
276
  "poll",
238
277
  "webhook"
239
- ]), y = /* @__PURE__ */ new Set([
278
+ ]), b = /* @__PURE__ */ new Set([
240
279
  "failed",
241
280
  "healthy",
242
281
  "initializing",
243
282
  "needs_reauth",
244
283
  "suspended"
245
- ]), b = /* @__PURE__ */ new Set([
284
+ ]), x = /* @__PURE__ */ new Set([
246
285
  "delivery.failed",
247
286
  "health.failed",
248
287
  "health.needs_reauth",
@@ -251,282 +290,377 @@ var v = /* @__PURE__ */ new Set([
251
290
  "operator.paused",
252
291
  "operator.resumed"
253
292
  ]);
254
- function x(e) {
255
- if (e != null) return o(e);
256
- }
257
293
  function S(e) {
258
- let t = a(e), n = t.health, r = t.kind, s = t.operatorState, l = c(t.runtimeVersion);
259
- return t.version != 1 || typeof n != "string" || !y.has(n) || typeof r != "string" || !v.has(r) || s != "active" && s != "paused" || l <= 0 ? i() : {
260
- ...t.currentPublicationId == null ? {} : { currentPublicationId: o(t.currentPublicationId) },
261
- ...t.currentRevisionId == null ? {} : { currentRevisionId: o(t.currentRevisionId) },
262
- ...t.endpointUrl == null ? {} : { endpointUrl: o(t.endpointUrl) },
263
- flowId: o(t.flowId),
294
+ if (e != null) return s(e);
295
+ }
296
+ function C(e) {
297
+ let t = o(e), n = t.health, r = t.kind, i = t.operatorState, c = l(t.runtimeVersion);
298
+ return t.version != 1 || typeof n != "string" || !b.has(n) || typeof r != "string" || !y.has(r) || i != "active" && i != "paused" || c <= 0 ? a() : {
299
+ ...t.currentPublicationId == null ? {} : { currentPublicationId: s(t.currentPublicationId) },
300
+ ...t.currentRevisionId == null ? {} : { currentRevisionId: s(t.currentRevisionId) },
301
+ ...t.endpointUrl == null ? {} : { endpointUrl: s(t.endpointUrl) },
302
+ flowId: s(t.flowId),
264
303
  health: n,
265
304
  kind: r,
266
- ...t.lastErrorCode == null ? {} : { lastErrorCode: o(t.lastErrorCode) },
267
- operatorState: s,
268
- runtimeVersion: l,
269
- triggerNodeId: o(t.triggerNodeId),
270
- updatedAt: o(t.updatedAt),
305
+ ...t.lastErrorCode == null ? {} : { lastErrorCode: s(t.lastErrorCode) },
306
+ operatorState: i,
307
+ runtimeVersion: c,
308
+ triggerNodeId: s(t.triggerNodeId),
309
+ updatedAt: s(t.updatedAt),
271
310
  version: 1
272
311
  };
273
312
  }
274
- function C(e) {
275
- let t = a(e);
313
+ function ee(e) {
314
+ let t = o(e);
276
315
  return t.version == 1 ? {
277
- binding: S(t.binding),
316
+ binding: C(t.binding),
278
317
  version: 1
279
- } : i();
318
+ } : a();
280
319
  }
281
- function w(e) {
282
- let t = a(e), n = t.kind;
283
- if (typeof n != "string" || !b.has(n)) return i();
284
- let r = x(t.errorCode), s = x(t.errorMessage);
285
- return s != null && s.length > 512 ? i() : {
286
- activityId: o(t.activityId),
287
- createdAt: o(t.createdAt),
320
+ function te(e) {
321
+ let t = o(e), n = t.kind;
322
+ if (typeof n != "string" || !x.has(n)) return a();
323
+ let r = S(t.errorCode), i = S(t.errorMessage);
324
+ return i != null && i.length > 512 ? a() : {
325
+ activityId: s(t.activityId),
326
+ createdAt: s(t.createdAt),
288
327
  ...r == null ? {} : { errorCode: r },
289
- ...s == null ? {} : { errorMessage: s },
328
+ ...i == null ? {} : { errorMessage: i },
290
329
  kind: n
291
330
  };
292
331
  }
293
- function T(e) {
294
- let t = a(e), n = x(t.nextCursor);
295
- return t.version != 1 || !Array.isArray(t.activities) ? i() : {
296
- activities: t.activities.map(w),
332
+ function w(e) {
333
+ let t = o(e), n = S(t.nextCursor);
334
+ return t.version != 1 || !Array.isArray(t.activities) ? a() : {
335
+ activities: t.activities.map(te),
297
336
  ...n == null ? {} : { nextCursor: n },
298
337
  version: 1
299
338
  };
300
339
  }
301
- function E(e) {
302
- let t = a(e), n = c(t.filtered);
303
- return t.version != 1 || !Array.isArray(t.events) || typeof t.hasMore != "boolean" || n < 0 ? i() : {
340
+ function T(e) {
341
+ let t = o(e), n = l(t.filtered);
342
+ return t.version != 1 || !Array.isArray(t.events) || typeof t.hasMore != "boolean" || n < 0 ? a() : {
304
343
  events: t.events.map((e) => {
305
- let t = a(e);
306
- return Object.fromEntries(Object.entries(t).map(([e, t]) => [e, l(t)]));
344
+ let t = o(e);
345
+ return Object.fromEntries(Object.entries(t).map(([e, t]) => [e, u(t)]));
307
346
  }),
308
347
  filtered: n,
309
348
  hasMore: t.hasMore,
310
349
  version: 1
311
350
  };
312
351
  }
313
- function D(e) {
314
- let t = a(e), n = t.status;
315
- return t.version != 1 || n != "active" && n != "retiring" ? i() : {
316
- createdAt: o(t.createdAt),
317
- draftRevisionId: o(t.draftRevisionId),
318
- flowId: o(t.flowId),
319
- name: o(t.name),
352
+ function E(e) {
353
+ let t = o(e), n = t.status;
354
+ if (t.version != 1 || n != "active" && n != "retiring") return a();
355
+ let r = t.live == null ? void 0 : o(t.live);
356
+ return r != null && typeof r.enabled != "boolean" ? a() : {
357
+ ...r == null ? {} : { live: {
358
+ enabled: r.enabled,
359
+ publicationId: s(r.publicationId),
360
+ revisionId: s(r.revisionId)
361
+ } },
362
+ createdAt: s(t.createdAt),
363
+ draftRevisionId: s(t.draftRevisionId),
364
+ flowId: s(t.flowId),
365
+ name: s(t.name),
320
366
  status: n,
321
- updatedAt: o(t.updatedAt),
367
+ updatedAt: s(t.updatedAt),
322
368
  version: 1
323
369
  };
324
370
  }
325
- function O(e) {
326
- let t = a(e);
327
- if (t.version != 1 || !Array.isArray(t.flows)) return i();
371
+ function D(e) {
372
+ let t = o(e);
373
+ if (t.version != 1 || !Array.isArray(t.flows)) return a();
328
374
  let n = t.nextCursor, r = t.total;
329
- return n != null && typeof n != "string" || r != null && !Number.isSafeInteger(r) ? i() : {
375
+ return n != null && typeof n != "string" || r != null && !Number.isSafeInteger(r) ? a() : {
330
376
  ...n == null ? {} : { nextCursor: n },
331
- flows: t.flows.map(D),
377
+ flows: t.flows.map(E),
332
378
  ...r == null ? {} : { total: r },
333
379
  version: 1
334
380
  };
335
381
  }
336
- function k(e) {
337
- let t = a(e);
338
- if (s(t, [
382
+ function O(e) {
383
+ let t = o(e);
384
+ if (c(t, [
339
385
  "name",
340
386
  "updatedAt",
341
387
  "value",
342
388
  "version"
343
- ]), t.version != 1 || typeof t.value != "string") return i();
344
- let n = o(t.updatedAt);
389
+ ]), t.version != 1 || typeof t.value != "string") return a();
390
+ let n = s(t.updatedAt);
345
391
  try {
346
- if (new Date(n).toISOString() != n) return i();
392
+ if (new Date(n).toISOString() != n) return a();
347
393
  } catch {
348
- return i();
394
+ return a();
349
395
  }
350
396
  return {
351
- name: o(t.name),
397
+ name: s(t.name),
352
398
  updatedAt: n,
353
399
  value: t.value,
354
400
  version: 1
355
401
  };
356
402
  }
357
- function A(e) {
358
- let t = a(e), n = t.parentRevisionId;
359
- return t.version != 1 || n !== null && typeof n != "string" ? i() : {
360
- actorId: o(t.actorId),
361
- createdAt: o(t.createdAt),
362
- digest: o(t.digest),
363
- flowId: o(t.flowId),
364
- modelVersion: c(t.modelVersion),
403
+ function k(e) {
404
+ let t = o(e), n = t.parentRevisionId;
405
+ return t.version != 1 || n !== null && typeof n != "string" ? a() : {
406
+ actorId: s(t.actorId),
407
+ createdAt: s(t.createdAt),
408
+ digest: s(t.digest),
409
+ flowId: s(t.flowId),
410
+ modelVersion: l(t.modelVersion),
365
411
  parentRevisionId: n,
366
- revisionId: o(t.revisionId),
412
+ revisionId: s(t.revisionId),
367
413
  version: 1
368
414
  };
369
415
  }
370
- function j(e) {
371
- let t = a(e), n = a(t.content);
372
- return n.modelVersion == 1 ? (a(n.document), a(n.modules), {
373
- ...A(t),
416
+ function A(e) {
417
+ let t = o(e), n = o(t.content);
418
+ return n.modelVersion == 1 ? (o(n.document), o(n.modules), {
419
+ ...k(t),
374
420
  content: t.content
375
- }) : i();
421
+ }) : a();
422
+ }
423
+ function j(e) {
424
+ let t = o(e);
425
+ return c(t, [
426
+ "revision",
427
+ "updatedAt",
428
+ "value",
429
+ "version"
430
+ ]), t.version != 1 || l(t.revision) < 1 ? a() : {
431
+ revision: l(t.revision),
432
+ updatedAt: s(t.updatedAt),
433
+ value: Object.fromEntries(Object.entries(o(t.value)).map(([e, t]) => [e, u(t)])),
434
+ version: 1
435
+ };
376
436
  }
377
437
  function M(e) {
378
- let t = a(e);
438
+ let t = o(e);
379
439
  return t.version == 1 ? {
380
- revision: A(t.revision),
440
+ revision: k(t.revision),
381
441
  version: 1
382
- } : i();
442
+ } : a();
383
443
  }
384
444
  function N(e) {
385
- let t = a(e);
386
- return t.version == 1 ? t.kind == "snapshot" ? {
387
- draft: j(t.draft),
445
+ let t = o(e);
446
+ return t.version != 1 || t.kind != "snapshot" ? a() : {
447
+ draft: A(t.draft),
388
448
  kind: "snapshot",
389
449
  version: 1
390
- } : t.kind != "changes" || !Array.isArray(t.revisions) ? i() : {
391
- kind: "changes",
392
- revisions: t.revisions.map((e) => {
393
- let t = a(e);
394
- if (!Array.isArray(t.operations) || t.operations.length == 0) return i();
395
- for (let e of t.operations) if (typeof a(e).kind != "string") return i();
396
- return {
397
- operations: t.operations,
398
- revision: A(t.revision)
399
- };
400
- }),
401
- version: 1
402
- } : i();
450
+ };
403
451
  }
404
452
  function P(e) {
405
- let t = a(e), n = t.operation, r = t.sourcePublicationId;
406
- return t.version != 1 || n != "publish" && n != "rollback" || r != null && typeof r != "string" ? i() : {
407
- actorId: o(t.actorId),
408
- closureDigest: o(t.closureDigest),
409
- createdAt: o(t.createdAt),
410
- engineContract: o(t.engineContract),
411
- flowId: o(t.flowId),
412
- modelVersion: c(t.modelVersion),
453
+ let t = o(e), n = t.operation, r = t.sourcePublicationId;
454
+ return t.version != 1 || n != "publish" && n != "rollback" || r != null && typeof r != "string" ? a() : {
455
+ actorId: s(t.actorId),
456
+ closureDigest: s(t.closureDigest),
457
+ createdAt: s(t.createdAt),
458
+ engineContract: s(t.engineContract),
459
+ flowId: s(t.flowId),
460
+ modelVersion: l(t.modelVersion),
413
461
  operation: n,
414
- publicationId: o(t.publicationId),
415
- revisionDigest: o(t.revisionDigest),
416
- revisionId: o(t.revisionId),
462
+ publicationId: s(t.publicationId),
463
+ revisionDigest: s(t.revisionDigest),
464
+ revisionId: s(t.revisionId),
417
465
  ...r == null ? {} : { sourcePublicationId: r },
418
466
  version: 1
419
467
  };
420
468
  }
421
469
  function F(e) {
422
- let t = a(e), n = t.values == null ? void 0 : a(t.values);
423
- return {
424
- code: o(t.code),
425
- column: c(t.column),
426
- line: c(t.line),
427
- message: o(t.message),
428
- path: typeof t.path == "string" ? t.path : i(),
429
- ...n == null ? {} : { values: Object.fromEntries(Object.entries(n).map(([e, t]) => [e, typeof t == "string" || typeof t == "number" ? t : i()])) }
470
+ let t = o(e), n = t.status, r = {
471
+ createdAt: s(t.createdAt),
472
+ flowId: s(t.flowId),
473
+ operationId: s(t.operationId),
474
+ revisionId: s(t.revisionId),
475
+ updatedAt: s(t.updatedAt),
476
+ version: 1
430
477
  };
478
+ if (t.version != 1) return a();
479
+ switch (n) {
480
+ case "pending": return c(t, [
481
+ "createdAt",
482
+ "flowId",
483
+ "operationId",
484
+ "revisionId",
485
+ "status",
486
+ "updatedAt",
487
+ "version"
488
+ ]), {
489
+ ...r,
490
+ status: n
491
+ };
492
+ case "succeeded": return c(t, [
493
+ "createdAt",
494
+ "flowId",
495
+ "operationId",
496
+ "publicationId",
497
+ "revisionId",
498
+ "status",
499
+ "updatedAt",
500
+ "version"
501
+ ]), {
502
+ ...r,
503
+ publicationId: s(t.publicationId),
504
+ status: n
505
+ };
506
+ case "failed": {
507
+ c(t, [
508
+ "createdAt",
509
+ "flowId",
510
+ "issue",
511
+ "operationId",
512
+ "revisionId",
513
+ "status",
514
+ "updatedAt",
515
+ "version"
516
+ ]);
517
+ let e = o(t.issue), i = e.nodeId;
518
+ return c(e, [
519
+ "code",
520
+ "message",
521
+ ...i == null ? [] : ["nodeId"]
522
+ ]), {
523
+ ...r,
524
+ issue: {
525
+ code: s(e.code),
526
+ message: s(e.message),
527
+ ...i == null ? {} : { nodeId: s(i) }
528
+ },
529
+ status: n
530
+ };
531
+ }
532
+ default: return a();
533
+ }
431
534
  }
432
535
  function I(e) {
433
- let t = a(e);
434
- return t.version != 1 || typeof t.valid != "boolean" || !Array.isArray(t.diagnostics) ? i() : {
435
- closureDigest: o(t.closureDigest),
436
- diagnostics: t.diagnostics.map(F),
437
- engineContract: o(t.engineContract),
438
- flowId: o(t.flowId),
439
- modelVersion: c(t.modelVersion),
440
- revisionDigest: o(t.revisionDigest),
441
- revisionId: o(t.revisionId),
536
+ let t = o(e), n = t.values == null ? void 0 : o(t.values);
537
+ return {
538
+ code: s(t.code),
539
+ column: l(t.column),
540
+ line: l(t.line),
541
+ message: s(t.message),
542
+ path: typeof t.path == "string" ? t.path : a(),
543
+ ...n == null ? {} : { values: Object.fromEntries(Object.entries(n).map(([e, t]) => [e, typeof t == "string" || typeof t == "number" ? t : a()])) }
544
+ };
545
+ }
546
+ function L(e) {
547
+ let t = o(e);
548
+ return t.version != 1 || typeof t.valid != "boolean" || !Array.isArray(t.diagnostics) ? a() : {
549
+ closureDigest: s(t.closureDigest),
550
+ diagnostics: t.diagnostics.map(I),
551
+ engineContract: s(t.engineContract),
552
+ flowId: s(t.flowId),
553
+ modelVersion: l(t.modelVersion),
554
+ revisionDigest: s(t.revisionDigest),
555
+ revisionId: s(t.revisionId),
442
556
  valid: t.valid,
443
557
  version: 1
444
558
  };
445
559
  }
446
- function L(e) {
447
- let t = a(e), n = t.status, r = t.publication;
448
- return t.version != 1 || typeof t.hasUnpublishedChanges != "boolean" || n != "not-published" && n != "runnable" && n != "suspended" || n == "not-published" && r !== null || n != "not-published" && r === null ? i() : {
449
- flowId: o(t.flowId),
560
+ function R(e) {
561
+ let t = o(e), n = t.status, r = t.publication;
562
+ return t.version != 1 || typeof t.hasUnpublishedChanges != "boolean" || n != "not-published" && n != "runnable" && n != "suspended" || n == "not-published" && r !== null || n != "not-published" && r === null ? a() : {
563
+ flowId: s(t.flowId),
450
564
  hasUnpublishedChanges: t.hasUnpublishedChanges,
451
565
  publication: r === null ? null : P(r),
452
- revision: c(t.revision),
566
+ revision: l(t.revision),
453
567
  status: n,
454
568
  version: 1
455
569
  };
456
570
  }
457
- function R(e) {
458
- let t = a(e), n = t.nextCursor, r = t.total;
459
- return t.version != 1 || !Array.isArray(t.publications) || n != null && typeof n != "string" || r != null && !Number.isSafeInteger(r) ? i() : {
571
+ function z(e) {
572
+ let t = o(e), n = t.nextCursor, r = t.total;
573
+ return t.version != 1 || !Array.isArray(t.publications) || n != null && typeof n != "string" || r != null && !Number.isSafeInteger(r) ? a() : {
460
574
  ...n == null ? {} : { nextCursor: n },
461
575
  publications: t.publications.map(P),
462
576
  ...r == null ? {} : { total: r },
463
577
  version: 1
464
578
  };
465
579
  }
466
- var z = new Set(n);
467
- function B(e) {
468
- return typeof e == "string" && z.has(e) ? e : i();
469
- }
580
+ var B = new Set(n);
470
581
  function V(e) {
471
- let t = a(e), n = t.source, r = t.startedAt, s = t.finishedAt;
472
- return t.version != 1 || n != "draft" && n != "live" && n != "trigger" || r != null && typeof r != "string" || s != null && typeof s != "string" ? i() : {
473
- createdAt: o(t.createdAt),
474
- ...s == null ? {} : { finishedAt: s },
475
- flowId: o(t.flowId),
476
- revisionId: o(t.revisionId),
477
- runId: o(t.runId),
582
+ return typeof e == "string" && B.has(e) ? e : a();
583
+ }
584
+ function H(e) {
585
+ let t = o(e), n = t.source, r = t.startedAt, i = t.finishedAt;
586
+ return t.version != 1 || n != "draft" && n != "live" && n != "trigger" || r != null && typeof r != "string" || i != null && typeof i != "string" ? a() : {
587
+ createdAt: s(t.createdAt),
588
+ ...i == null ? {} : { finishedAt: i },
589
+ flowId: s(t.flowId),
590
+ revisionId: s(t.revisionId),
591
+ runId: s(t.runId),
478
592
  source: n,
479
593
  ...r == null ? {} : { startedAt: r },
480
- status: B(t.status),
594
+ status: V(t.status),
481
595
  version: 1
482
596
  };
483
597
  }
484
- function H(e) {
485
- let t = a(e), n = V(t), r = t.eventsExpiresAt;
486
- if (r != null && typeof r != "string") return i();
487
- let s = {
598
+ function U(e) {
599
+ let t = o(e);
600
+ c(t, [
601
+ "actions",
602
+ "expiresAt",
603
+ "nodeId",
604
+ "prompt",
605
+ "waitId",
606
+ "waitingSince"
607
+ ]);
608
+ let n = t.actions;
609
+ return !Array.isArray(n) || !(n.length == 1 && n[0] == "continue" || n.length == 2 && n[0] == "approve" && n[1] == "reject") ? a() : {
610
+ actions: n,
611
+ expiresAt: s(t.expiresAt),
612
+ nodeId: s(t.nodeId),
613
+ prompt: s(t.prompt),
614
+ waitId: s(t.waitId),
615
+ waitingSince: s(t.waitingSince)
616
+ };
617
+ }
618
+ function W(e) {
619
+ let t = o(e), n = H(t), r = t.eventsExpiresAt;
620
+ if (r != null && typeof r != "string" || n.status != "waiting" && t.waiting !== void 0) return a();
621
+ let i = n.status == "waiting" ? U(t.waiting) : void 0, c = {
488
622
  ...n,
489
- closureDigest: o(t.closureDigest),
490
- engineContract: o(t.engineContract),
491
- engineDigest: o(t.engineDigest),
623
+ closureDigest: s(t.closureDigest),
624
+ engineContract: s(t.engineContract),
625
+ engineDigest: s(t.engineDigest),
492
626
  ...r == null ? {} : { eventsExpiresAt: r },
493
- modelVersion: c(t.modelVersion),
494
- revisionDigest: o(t.revisionDigest)
627
+ modelVersion: l(t.modelVersion),
628
+ revisionDigest: s(t.revisionDigest),
629
+ ...i == null ? {} : { waiting: i }
495
630
  };
496
631
  switch (n.source) {
497
632
  case "draft": return {
498
- ...s,
633
+ ...c,
499
634
  source: "draft"
500
635
  };
501
636
  case "live": return {
502
- ...s,
503
- publicationId: o(t.publicationId),
637
+ ...c,
638
+ publicationId: s(t.publicationId),
504
639
  source: "live"
505
640
  };
506
641
  case "trigger": return {
507
- ...s,
508
- occurrenceId: o(t.occurrenceId),
509
- publicationId: o(t.publicationId),
642
+ ...c,
643
+ occurrenceId: s(t.occurrenceId),
644
+ publicationId: s(t.publicationId),
510
645
  source: "trigger",
511
- triggerNodeId: o(t.triggerNodeId)
646
+ triggerNodeId: s(t.triggerNodeId)
512
647
  };
513
648
  }
514
649
  }
515
- function U(e) {
516
- let t = a(e), n = t.nextCursor;
517
- return t.version != 1 || !Array.isArray(t.runs) || n != null && typeof n != "string" ? i() : {
518
- flowId: o(t.flowId),
650
+ function G(e) {
651
+ let t = o(e), n = t.nextCursor;
652
+ return t.version != 1 || !Array.isArray(t.runs) || n != null && typeof n != "string" ? a() : {
653
+ flowId: s(t.flowId),
519
654
  ...n == null ? {} : { nextCursor: n },
520
- runs: t.runs.map(V),
655
+ runs: t.runs.map(H),
521
656
  version: 1
522
657
  };
523
658
  }
524
- var W = /* @__PURE__ */ new Set([
659
+ var K = /* @__PURE__ */ new Set([
525
660
  "node.artifact",
526
661
  "node.completed",
527
662
  "node.failed",
528
663
  "node.log",
529
- "node.output",
530
664
  "node.progress",
531
665
  "node.started",
532
666
  "run.canceled",
@@ -536,85 +670,109 @@ var W = /* @__PURE__ */ new Set([
536
670
  "run.indeterminate",
537
671
  "run.progress",
538
672
  "run.queued",
539
- "run.started"
673
+ "run.resolved",
674
+ "run.started",
675
+ "run.waiting"
540
676
  ]);
541
- function G(e) {
542
- let t = a(e), n = t.kind, r = c(t.sequence), s = t.sourceSequence;
543
- return typeof n != "string" || !W.has(n) || r < 0 || s != null && (!Number.isSafeInteger(s) || s < 0) ? i() : {
544
- createdAt: o(t.createdAt),
677
+ function q(e) {
678
+ let t = o(e), n = t.kind, r = l(t.sequence), i = t.sourceSequence;
679
+ return typeof n != "string" || !K.has(n) || r < 0 || i != null && (!Number.isSafeInteger(i) || i < 0) ? a() : {
680
+ createdAt: s(t.createdAt),
545
681
  kind: n,
546
- payload: a(t.payload),
682
+ payload: o(t.payload),
547
683
  sequence: r,
548
- ...s == null ? {} : { sourceSequence: s }
684
+ ...i == null ? {} : { sourceSequence: i }
549
685
  };
550
686
  }
551
- function K(e) {
552
- let t = a(e), n = t.eventsExpiresAt, r = c(t.nextAfter);
553
- return t.version != 1 || !Array.isArray(t.events) || typeof t.done != "boolean" || typeof t.historyComplete != "boolean" || n != null && typeof n != "string" || r < 0 ? i() : {
687
+ function J(e) {
688
+ let t = o(e), n = t.eventsExpiresAt, r = l(t.nextAfter);
689
+ return t.version != 1 || !Array.isArray(t.events) || typeof t.done != "boolean" || typeof t.historyComplete != "boolean" || n != null && typeof n != "string" || r < 0 ? a() : {
554
690
  done: t.done,
555
- events: t.events.map(G),
691
+ events: t.events.map(q),
556
692
  ...n == null ? {} : { eventsExpiresAt: n },
557
693
  historyComplete: t.historyComplete,
558
694
  nextAfter: r,
559
- runId: o(t.runId),
695
+ runId: s(t.runId),
560
696
  version: 1
561
697
  };
562
698
  }
563
- function q(e) {
564
- let t = a(e), n = B(t.status);
565
- return t.version != 1 || typeof t.cancelAccepted != "boolean" || n == "queued" || n == "starting" || n == "running" ? i() : {
699
+ function Y(e) {
700
+ let t = o(e), n = V(t.status);
701
+ return t.version != 1 || typeof t.cancelAccepted != "boolean" || n == "queued" || n == "starting" || n == "running" || n == "waiting" ? a() : {
566
702
  cancelAccepted: t.cancelAccepted,
567
- runId: o(t.runId),
703
+ runId: s(t.runId),
568
704
  status: n,
569
705
  version: 1
570
706
  };
571
707
  }
572
- function J(e) {
573
- let t = a(e), n = t.status;
574
- if (t.version != 1) return i();
708
+ function X(e) {
709
+ let t = o(e);
710
+ c(t, [
711
+ "action",
712
+ "resolutionAccepted",
713
+ "resolvedAt",
714
+ "runId",
715
+ "status",
716
+ "version",
717
+ "waitId"
718
+ ]);
719
+ let n = t.action, r = t.resolvedAt;
720
+ return t.version != 1 || typeof t.resolutionAccepted != "boolean" || n !== null && n != "approve" && n != "continue" && n != "reject" || r !== null && typeof r != "string" || n === null != (r === null) || t.resolutionAccepted && n === null ? a() : {
721
+ action: n,
722
+ resolutionAccepted: t.resolutionAccepted,
723
+ resolvedAt: r,
724
+ runId: s(t.runId),
725
+ status: V(t.status),
726
+ version: 1,
727
+ waitId: s(t.waitId)
728
+ };
729
+ }
730
+ function Z(e) {
731
+ let t = o(e), n = t.status;
732
+ if (t.version != 1) return a();
575
733
  let r = {
576
- finishedAt: o(t.finishedAt),
577
- runId: o(t.runId),
734
+ finishedAt: s(t.finishedAt),
735
+ runId: s(t.runId),
578
736
  version: 1
579
737
  };
580
738
  if (n == "completed") return Object.hasOwn(t, "result") ? {
581
739
  ...r,
582
740
  result: t.result,
583
741
  status: "completed"
584
- } : i();
742
+ } : a();
585
743
  if (n == "canceled") return {
586
744
  ...r,
587
745
  status: "canceled"
588
746
  };
589
747
  if (n == "failed") {
590
- let e = a(t.error);
748
+ let e = o(t.error);
591
749
  return {
592
750
  ...r,
593
751
  error: {
594
- code: o(e.code),
595
- message: o(e.message)
752
+ code: s(e.code),
753
+ message: s(e.message)
596
754
  },
597
755
  status: "failed"
598
756
  };
599
757
  }
600
758
  if (n == "indeterminate") {
601
- let e = a(t.error);
759
+ let e = o(t.error);
602
760
  return {
603
761
  ...r,
604
762
  error: {
605
- code: o(e.code),
606
- message: o(e.message)
763
+ code: s(e.code),
764
+ message: s(e.message)
607
765
  },
608
766
  status: "indeterminate"
609
767
  };
610
768
  }
611
- return i();
769
+ return a();
612
770
  }
613
- var Y = encodeURIComponent;
614
- function X(e) {
615
- return `${e}-${crypto.randomUUID()}`;
771
+ var Q = encodeURIComponent;
772
+ function $(e) {
773
+ return `${e}-${r()}`;
616
774
  }
617
- var Z = class {
775
+ var ne = class {
618
776
  constructor(e) {
619
777
  this.requestControl = e;
620
778
  }
@@ -622,30 +780,30 @@ var Z = class {
622
780
  let t = new URLSearchParams();
623
781
  e.cursor != null && t.set("cursor", e.cursor), e.limit != null && t.set("limit", String(e.limit)), e.includeTotal != null && t.set("includeTotal", String(e.includeTotal));
624
782
  let n = t.size == 0 ? "" : `?${t}`;
625
- return O(await this.request(`/v1/flows${n}`));
783
+ return D(await this.request(`/v1/flows${n}`));
626
784
  }
627
785
  async listVariables() {
628
- let e = a(await this.request("/v1/variables"));
629
- return s(e, ["variables", "version"]), e.version != 1 || !Array.isArray(e.variables) ? i() : {
630
- variables: e.variables.map(k),
786
+ let e = o(await this.request("/v1/variables"));
787
+ return c(e, ["variables", "version"]), e.version != 1 || !Array.isArray(e.variables) ? a() : {
788
+ variables: e.variables.map(O),
631
789
  version: 1
632
790
  };
633
791
  }
634
792
  async getVariable(e) {
635
- return k(await this.request(`/v1/variables/${Y(e)}`));
793
+ return O(await this.request(`/v1/variables/${Q(e)}`));
636
794
  }
637
795
  async putVariable(e, t) {
638
- return k(await this.request(`/v1/variables/${Y(e)}`, {
796
+ return O(await this.request(`/v1/variables/${Q(e)}`, {
639
797
  body: JSON.stringify({ value: t }),
640
798
  method: "PUT"
641
799
  }));
642
800
  }
643
801
  async deleteVariable(e) {
644
- let t = a(await this.request(`/v1/variables/${Y(e)}`, { method: "DELETE" }));
645
- if (s(t, ["version"]), t.version != 1) return i();
802
+ let t = o(await this.request(`/v1/variables/${Q(e)}`, { method: "DELETE" }));
803
+ if (c(t, ["version"]), t.version != 1) return a();
646
804
  }
647
- async createFlow(e, t = `flow-${crypto.randomUUID()}`) {
648
- return D(await this.request("/v1/flows", {
805
+ async createFlow(e, t = `flow-${r()}`) {
806
+ return E(await this.request("/v1/flows", {
649
807
  body: JSON.stringify({
650
808
  name: e,
651
809
  version: 1
@@ -655,10 +813,10 @@ var Z = class {
655
813
  }));
656
814
  }
657
815
  async getFlow(e) {
658
- return D(await this.request(`/v1/flows/${Y(e)}`));
816
+ return E(await this.request(`/v1/flows/${Q(e)}`));
659
817
  }
660
818
  async renameFlow(e, t) {
661
- return D(await this.request(`/v1/flows/${Y(e)}`, {
819
+ return E(await this.request(`/v1/flows/${Q(e)}`, {
662
820
  body: JSON.stringify({
663
821
  name: t,
664
822
  version: 1
@@ -667,64 +825,84 @@ var Z = class {
667
825
  }));
668
826
  }
669
827
  async deleteFlow(e) {
670
- return D(await this.request(`/v1/flows/${Y(e)}`, { method: "DELETE" }));
828
+ return E(await this.request(`/v1/flows/${Q(e)}`, { method: "DELETE" }));
671
829
  }
672
830
  async listTriggerKeys(e) {
673
- let t = a(await this.request("/v1/trigger-keys", { signal: e }));
674
- return t.version != 1 || !Array.isArray(t.keys) ? i() : t.keys.map(g);
831
+ let t = o(await this.request("/v1/trigger-keys", { signal: e }));
832
+ return t.version != 1 || !Array.isArray(t.keys) ? a() : t.keys.map(_);
675
833
  }
676
834
  async listTriggerDefinitions(e) {
677
- let t = a(await this.request("/v1/trigger-keys/catalog", { signal: e }));
678
- return t.version != 1 || !Array.isArray(t.definitions) ? i() : t.definitions.map(_);
835
+ let t = o(await this.request("/v1/trigger-keys/catalog", { signal: e }));
836
+ return t.version != 1 || !Array.isArray(t.definitions) ? a() : t.definitions.map(v);
679
837
  }
680
838
  async getTriggerKey(e, t) {
681
- let n = a(await this.request(`/v1/trigger-keys/${Y(e)}`, { signal: t }));
682
- return n.version == 1 ? _(n.definition) : i();
839
+ let n = o(await this.request(`/v1/trigger-keys/${Q(e)}`, { signal: t }));
840
+ return n.version == 1 ? v(n.definition) : a();
683
841
  }
684
- async listFlowTriggerBindings(e) {
685
- let t = a(await this.request(`/v1/flows/${Y(e)}/triggers`));
686
- return t.version != 1 || o(t.flowId) != e || !Array.isArray(t.bindings) ? i() : t.bindings.map(S);
842
+ async listFlowTriggerBindings(e, t) {
843
+ let n = o(await this.request(`/v1/flows/${Q(e)}/triggers`, { signal: t }));
844
+ return n.version != 1 || s(n.flowId) != e || !Array.isArray(n.bindings) ? a() : n.bindings.map(C);
687
845
  }
688
846
  async getFlowTriggerBinding(e, t) {
689
- return C(await this.request(`/v1/flows/${Y(e)}/triggers/${Y(t)}`));
847
+ return ee(await this.request(`/v1/flows/${Q(e)}/triggers/${Q(t)}`));
690
848
  }
691
849
  async listFlowTriggerActivities(e, t, n = {}) {
692
850
  let r = new URLSearchParams();
693
851
  n.cursor != null && r.set("cursor", n.cursor), n.limit != null && r.set("limit", String(n.limit));
694
852
  let i = r.size == 0 ? "" : `?${r}`;
695
- return T(await this.request(`/v1/flows/${Y(e)}/triggers/${Y(t)}/activities${i}`));
853
+ return w(await this.request(`/v1/flows/${Q(e)}/triggers/${Q(t)}/activities${i}`));
696
854
  }
697
855
  async pauseFlowTrigger(e, t) {
698
- return S(await this.request(`/v1/flows/${Y(e)}/triggers/${Y(t)}/pause`, {
856
+ return C(await this.request(`/v1/flows/${Q(e)}/triggers/${Q(t)}/pause`, {
699
857
  body: JSON.stringify({ version: 1 }),
700
858
  method: "POST"
701
859
  }));
702
860
  }
703
861
  async resumeFlowTrigger(e, t) {
704
- return S(await this.request(`/v1/flows/${Y(e)}/triggers/${Y(t)}/resume`, {
862
+ return C(await this.request(`/v1/flows/${Q(e)}/triggers/${Q(t)}/resume`, {
705
863
  body: JSON.stringify({ version: 1 }),
706
864
  method: "POST"
707
865
  }));
708
866
  }
709
867
  async testFlowPollTrigger(e, t) {
710
- return E(await this.request(`/v1/flows/${Y(e)}/triggers/${Y(t)}/test`, {
868
+ return T(await this.request(`/v1/flows/${Q(e)}/triggers/${Q(t)}/test`, {
711
869
  body: JSON.stringify({ version: 1 }),
712
870
  method: "POST"
713
871
  }));
714
872
  }
873
+ async getEditor(e) {
874
+ let t = o(await this.request(`/v1/flows/${Q(e)}/editor`));
875
+ if (c(t, [
876
+ "flow",
877
+ "draft",
878
+ "live",
879
+ "presentation",
880
+ "version"
881
+ ]), t.version != 1) return a();
882
+ let n = {
883
+ flow: E(t.flow),
884
+ draft: A(t.draft),
885
+ live: R(t.live),
886
+ presentation: j(t.presentation),
887
+ version: 1
888
+ };
889
+ return n.flow.flowId != e || n.draft.flowId != e || n.live.flowId != e || n.flow.draftRevisionId != n.draft.revisionId ? a() : n;
890
+ }
891
+ async getPresentation(e) {
892
+ return j(await this.request(`/v1/flows/${Q(e)}/presentation`));
893
+ }
715
894
  async getDraft(e) {
716
- return j(await this.request(`/v1/flows/${Y(e)}/draft`));
895
+ return A(await this.request(`/v1/flows/${Q(e)}/draft`));
717
896
  }
718
- async syncDraft(e, t) {
719
- let n = t == null ? "" : `?fromRevisionId=${Y(t)}`;
720
- return N(await this.request(`/v1/flows/${Y(e)}/draft/sync${n}`));
897
+ async syncDraft(e) {
898
+ return N(await this.request(`/v1/flows/${Q(e)}/draft/sync`));
721
899
  }
722
900
  async getRevision(e, t) {
723
- return j(await this.request(`/v1/flows/${Y(e)}/revisions/${Y(t)}`));
901
+ return A(await this.request(`/v1/flows/${Q(e)}/revisions/${Q(t)}`));
724
902
  }
725
903
  async listConnectorProviders(e, t) {
726
- let n = a(await this.request(`/v1/connector/providers${t == null ? "" : `?flowId=${Y(t)}`}`, { signal: e }));
727
- return s(n, ["providers", "version"]), n.version != 1 || !Array.isArray(n.providers) ? i() : n.providers.map(h);
904
+ let n = o(await this.request(`/v1/connector/providers${t == null ? "" : `?flowId=${Q(t)}`}`, { signal: e }));
905
+ return c(n, ["providers", "version"]), n.version != 1 || !Array.isArray(n.providers) ? a() : n.providers.map(g);
728
906
  }
729
907
  async listConnectorActions(e, t, n) {
730
908
  return await this.connectorActions({
@@ -739,149 +917,174 @@ var Z = class {
739
917
  }, t);
740
918
  }
741
919
  async getConnectorAction(e, t, n) {
742
- let r = a(await this.request(`/v1/connector/actions/${Y(e)}${n == null ? "" : `?flowId=${Y(n)}`}`, { signal: t }));
743
- return s(r, ["action", "version"]), r.version == 1 ? m(r.action) : i();
920
+ let r = o(await this.request(`/v1/connector/actions/${Q(e)}${n == null ? "" : `?flowId=${Q(n)}`}`, { signal: t }));
921
+ return c(r, ["action", "version"]), r.version == 1 ? h(r.action) : a();
744
922
  }
745
923
  async listConnectorConnections(e, t, n) {
746
- let r = a(await this.request(`/v1/connector/connections/${Y(e)}${n == null ? "" : `?flowId=${Y(n)}`}`, { signal: t }));
747
- return s(r, [
924
+ let r = o(await this.request(`/v1/connector/connections/${Q(e)}${n == null ? "" : `?flowId=${Q(n)}`}`, { signal: t }));
925
+ return c(r, [
748
926
  "connections",
749
927
  "serviceId",
750
928
  "version"
751
- ]), r.version != 1 || o(r.serviceId) != e || !Array.isArray(r.connections) ? i() : r.connections.map(u);
929
+ ]), r.version != 1 || s(r.serviceId) != e || !Array.isArray(r.connections) ? a() : r.connections.map(d);
752
930
  }
753
931
  async createConnectorConnectionPage(e, t) {
754
- let n = a(await this.request(`/v1/connector/connections/${Y(e)}/page${t == null ? "" : `?flowId=${Y(t)}`}`, {
932
+ let n = o(await this.request(`/v1/connector/connections/${Q(e)}/page${t == null ? "" : `?flowId=${Q(t)}`}`, {
755
933
  body: JSON.stringify({ version: 1 }),
756
934
  method: "POST"
757
935
  }));
758
- if (s(n, ["url", "version"]), n.version != 1) return i();
936
+ if (c(n, ["url", "version"]), n.version != 1) return a();
759
937
  try {
760
- let e = new URL(o(n.url));
761
- return e.protocol != "http:" && e.protocol != "https:" ? i() : e.href;
938
+ let e = new URL(s(n.url));
939
+ return e.protocol != "http:" && e.protocol != "https:" ? a() : e.href;
762
940
  } catch {
763
- return i();
941
+ return a();
764
942
  }
765
943
  }
766
- async changeDraft(e, t, n) {
767
- return M(await this.request(`/v1/flows/${Y(e)}/draft/changes`, {
944
+ async changeDraft(e, t, n, r = $("change")) {
945
+ return M(await this.request(`/v1/flows/${Q(e)}/draft/changes`, {
768
946
  body: JSON.stringify({
769
947
  expectedRevisionId: t,
770
948
  operations: n,
771
949
  version: 1
772
950
  }),
951
+ headers: { "idempotency-key": r },
773
952
  method: "POST"
774
953
  }));
775
954
  }
776
955
  async checkFlow(e, t) {
777
- return I(await this.request(`/v1/flows/${Y(e)}/revisions/${Y(t)}/check`, {
956
+ return L(await this.request(`/v1/flows/${Q(e)}/revisions/${Q(t)}/check`, {
778
957
  body: JSON.stringify({
779
- engineContract: "open-flow-engine/v1",
958
+ engineContract: "open-flow-engine/v2",
780
959
  version: 1
781
960
  }),
782
961
  method: "POST"
783
962
  }));
784
963
  }
785
- async getLive(e) {
786
- return L(await this.request(`/v1/flows/${Y(e)}/live`));
964
+ async getLive(e, t) {
965
+ return R(await this.request(`/v1/flows/${Q(e)}/live`, { signal: t }));
787
966
  }
788
- async listPublications(e, t = {}) {
789
- let n = new URLSearchParams();
790
- t.cursor != null && n.set("cursor", t.cursor), t.limit != null && n.set("limit", String(t.limit)), t.includeTotal != null && n.set("includeTotal", String(t.includeTotal));
791
- let r = n.size == 0 ? "" : `?${n}`;
792
- return R(await this.request(`/v1/flows/${Y(e)}/publications${r}`));
967
+ async listPublications(e, t = {}, n) {
968
+ let r = new URLSearchParams();
969
+ t.cursor != null && r.set("cursor", t.cursor), t.limit != null && r.set("limit", String(t.limit)), t.includeTotal != null && r.set("includeTotal", String(t.includeTotal));
970
+ let i = r.size == 0 ? "" : `?${r}`;
971
+ return z(await this.request(`/v1/flows/${Q(e)}/publications${i}`, { signal: n }));
793
972
  }
794
- async createDraftRun(e, t, n = {}) {
795
- let r = H(await this.request(`/v1/flows/${Y(e)}/revisions/${Y(t)}/runs`, {
973
+ async createDraftRun(e, t, n) {
974
+ let r = W(await this.request(`/v1/flows/${Q(e)}/revisions/${Q(t)}/runs`, {
796
975
  body: JSON.stringify({
797
- engineContract: "open-flow-engine/v1",
976
+ engineContract: "open-flow-engine/v2",
798
977
  inputs: n.inputs ?? {},
978
+ trigger: n.trigger,
799
979
  version: 1
800
980
  }),
801
- headers: { "idempotency-key": n.idempotencyKey ?? X("run") },
981
+ headers: { "idempotency-key": n.idempotencyKey ?? $("run") },
802
982
  method: "POST"
803
983
  }));
804
- return r.source == "draft" ? r : i();
984
+ return r.source == "draft" ? r : a();
805
985
  }
806
- async createLiveRun(e, t = {}) {
807
- let n = H(await this.request("/v1/runs", {
986
+ async createLiveRun(e, t) {
987
+ let n = W(await this.request("/v1/runs", {
808
988
  body: JSON.stringify({
809
989
  inputs: t.inputs ?? {},
990
+ trigger: t.trigger,
810
991
  publicationId: e,
811
992
  version: 1
812
993
  }),
813
- headers: { "idempotency-key": t.idempotencyKey ?? X("run") },
994
+ headers: { "idempotency-key": t.idempotencyKey ?? $("run") },
814
995
  method: "POST"
815
996
  }));
816
- return n.source == "live" ? n : i();
997
+ return n.source == "live" ? n : a();
998
+ }
999
+ async setFlowEnabled(e, t, n) {
1000
+ return E(await this.request(`/v1/flows/${Q(e)}/enabled`, {
1001
+ method: "PUT",
1002
+ body: JSON.stringify({
1003
+ enabled: n,
1004
+ expectedPublicationId: t,
1005
+ version: 1
1006
+ })
1007
+ }));
817
1008
  }
818
1009
  async publishFlow(e, t, n, r = {}) {
819
- return P(await this.request(`/v1/flows/${Y(e)}/revisions/${Y(t)}/publications`, {
1010
+ return F(await this.request(`/v1/flows/${Q(e)}/revisions/${Q(t)}/publications`, {
820
1011
  body: JSON.stringify({
821
- engineContract: "open-flow-engine/v1",
1012
+ engineContract: "open-flow-engine/v2",
822
1013
  expectedLivePublicationId: n,
823
1014
  version: 1
824
1015
  }),
825
- headers: { "idempotency-key": r.idempotencyKey ?? X("publication") },
1016
+ headers: { "idempotency-key": r.idempotencyKey ?? $("publication") },
826
1017
  method: "POST"
827
1018
  }));
828
1019
  }
1020
+ async getPublishOperation(e, t, n) {
1021
+ return F(await this.request(`/v1/flows/${Q(e)}/publish-operations/${Q(t)}`, { signal: n }));
1022
+ }
829
1023
  async rollbackFlow(e, t, n, r = {}) {
830
- return P(await this.request(`/v1/flows/${Y(e)}/publications/${Y(t)}/rollback`, {
1024
+ return P(await this.request(`/v1/flows/${Q(e)}/publications/${Q(t)}/rollback`, {
831
1025
  body: JSON.stringify({
832
1026
  expectedLivePublicationId: n,
833
1027
  version: 1
834
1028
  }),
835
- headers: { "idempotency-key": r.idempotencyKey ?? X("publication") },
1029
+ headers: { "idempotency-key": r.idempotencyKey ?? $("publication") },
836
1030
  method: "POST"
837
1031
  }));
838
1032
  }
839
- async getRun(e) {
840
- return H(await this.request(`/v1/runs/${Y(e)}`));
1033
+ async getRun(e, t) {
1034
+ return W(await this.request(`/v1/runs/${Q(e)}`, { signal: t }));
841
1035
  }
842
1036
  async listRuns(e, t = {}) {
843
1037
  let n = new URLSearchParams();
844
1038
  t.cursor != null && n.set("cursor", t.cursor), t.limit != null && n.set("limit", String(t.limit)), t.status != null && n.set("status", t.status);
845
1039
  let r = n.size == 0 ? "" : `?${n}`;
846
- return U(await this.request(`/v1/flows/${Y(e)}/runs${r}`));
1040
+ return G(await this.request(`/v1/flows/${Q(e)}/runs${r}`));
847
1041
  }
848
- async getRunEvents(e, t = {}) {
849
- let n = new URLSearchParams();
850
- t.after != null && n.set("after", String(t.after)), t.limit != null && n.set("limit", String(t.limit));
851
- let r = n.size == 0 ? "" : `?${n}`;
852
- return K(await this.request(`/v1/runs/${Y(e)}/events${r}`));
1042
+ async getRunEvents(e, t = {}, n) {
1043
+ let r = new URLSearchParams();
1044
+ t.after != null && r.set("after", String(t.after)), t.limit != null && r.set("limit", String(t.limit));
1045
+ let i = r.size == 0 ? "" : `?${r}`;
1046
+ return J(await this.request(`/v1/runs/${Q(e)}/events${i}`, { signal: n }));
853
1047
  }
854
- async getRunResult(e) {
855
- return J(await this.request(`/v1/runs/${Y(e)}/result`));
1048
+ async getRunResult(e, t) {
1049
+ return Z(await this.request(`/v1/runs/${Q(e)}/result`, { signal: t }));
856
1050
  }
857
1051
  async cancelRun(e) {
858
- return q(await this.request(`/v1/runs/${Y(e)}/cancel`, {
1052
+ return Y(await this.request(`/v1/runs/${Q(e)}/cancel`, {
859
1053
  body: JSON.stringify({ version: 1 }),
860
1054
  method: "POST"
861
1055
  }));
862
1056
  }
1057
+ async resolveRunWait(e, t, n) {
1058
+ return X(await this.request(`/v1/runs/${Q(e)}/waits/${Q(t)}/resolve`, {
1059
+ body: JSON.stringify({
1060
+ action: n,
1061
+ version: 1
1062
+ }),
1063
+ method: "POST"
1064
+ }));
1065
+ }
863
1066
  async connectorActions(e, t) {
864
- let n = Object.entries(e).map(([e, t]) => `${Y(e)}=${Y(t)}`).join("&"), r = n == "" ? "" : `?${n}`, o = a(await this.request(`/v1/connector/actions${r}`, { signal: t }));
865
- return s(o, ["actions", "version"]), o.version != 1 || !Array.isArray(o.actions) ? i() : o.actions.map(m);
1067
+ let n = Object.entries(e).map(([e, t]) => `${Q(e)}=${Q(t)}`).join("&"), r = n == "" ? "" : `?${n}`, i = o(await this.request(`/v1/connector/actions${r}`, { signal: t }));
1068
+ return c(i, ["actions", "version"]), i.version != 1 || !Array.isArray(i.actions) ? a() : i.actions.map(h);
866
1069
  }
867
1070
  async request(e, t = {}) {
868
1071
  let n = new Headers(t.headers);
869
1072
  t.body != null && n.set("content-type", "application/json");
870
- let o = await this.requestControl(e, {
1073
+ let r = await this.requestControl(e, {
871
1074
  ...t,
872
1075
  headers: n
873
1076
  }), s;
874
1077
  try {
875
- s = await o.json();
1078
+ s = await r.json();
876
1079
  } catch {
877
- return i();
1080
+ return a();
878
1081
  }
879
- if (!o.ok) {
880
- let e = a(s).error, t = e == null ? void 0 : a(e);
881
- throw new r(o.status, typeof t?.code == "string" ? t.code : "request.failed", typeof t?.message == "string" ? t.message : `Request failed with status ${o.status}.`);
1082
+ if (!r.ok) {
1083
+ let e = o(s).error, t = e == null ? void 0 : o(e);
1084
+ throw new i(r.status, typeof t?.code == "string" ? t.code : "request.failed", typeof t?.message == "string" ? t.message : `Request failed with status ${r.status}.`);
882
1085
  }
883
1086
  return s;
884
1087
  }
885
1088
  };
886
1089
  //#endregion
887
- export { r as ApiError, Z as ControlClient, e as controlErrorCode, t as controlErrorMetadata };
1090
+ export { i as ApiError, ne as ControlClient, e as controlErrorCode, t as controlErrorMetadata };