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