@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,7 +19,7 @@ function t(n, r) {
19
19
  }
20
20
  //#endregion
21
21
  //#region src/control/common/conformance.ts
22
- var n = "open-flow-engine/v1";
22
+ var n = "open-flow-engine/v2";
23
23
  function r(e) {
24
24
  throw Error(e);
25
25
  }
@@ -38,9 +38,11 @@ function s(e, t) {
38
38
  async function c(e, t, n) {
39
39
  return i(e.status, t, `${n} status`), a(await e.json().catch(() => r(`${n} body: expected JSON.`)), `${n} body`);
40
40
  }
41
- async function l(e, t, n, r) {
42
- let o = await c(e, t, r);
43
- i(a(o.error, `${r} error`).code, n, `${r} error code`), i(o.version, 1, `${r} version`);
41
+ async function l(e, t, n, o, l) {
42
+ let u = await c(e, t, o), d = a(u.error, `${o} error`);
43
+ i(d.code, n, `${o} error code`);
44
+ let f = s(d.message, `${o} error message`);
45
+ l != null && !f.includes(l) && r(`${o} error message: expected ${JSON.stringify(l)} in ${JSON.stringify(f)}.`), i(u.version, 1, `${o} version`);
44
46
  }
45
47
  function u(e, t, n = {}) {
46
48
  let r = new Headers(n.headers);
@@ -62,23 +64,24 @@ function d(e, t, n) {
62
64
  async function f(e, t, n) {
63
65
  return c(await d(e, t, n), 201, "Create Flow");
64
66
  }
65
- function p(e, t, n, r) {
67
+ function p(e, t, n, r, i = `change-${crypto.randomUUID()}`) {
66
68
  return u(e, `/v1/flows/${encodeURIComponent(t)}/draft/changes`, {
67
69
  body: JSON.stringify({
68
70
  expectedRevisionId: n,
69
71
  operations: r,
70
72
  version: 1
71
73
  }),
74
+ headers: { "idempotency-key": i },
72
75
  method: "POST"
73
76
  });
74
77
  }
75
- function m(e, t, n, r = "marker") {
78
+ function m(e, t, n, r = "marker", i) {
76
79
  return p(e, t, n, [{
77
80
  kind: "graph.node.create",
78
81
  node: {
79
- concurrency: 1,
80
82
  inputs: {},
81
83
  kind: "value",
84
+ name: r,
82
85
  values: [{
83
86
  handle: "ready",
84
87
  jsonSchema: { type: "boolean" },
@@ -88,12 +91,23 @@ function m(e, t, n, r = "marker") {
88
91
  },
89
92
  nodeId: r,
90
93
  target: { kind: "flow" }
91
- }]);
94
+ }], i);
95
+ }
96
+ async function h(e, t, n) {
97
+ return g(await c(await p(e, t, n, [{
98
+ kind: "graph.node.create",
99
+ node: {
100
+ kind: "manual",
101
+ name: "Start"
102
+ },
103
+ nodeId: "start",
104
+ target: { kind: "flow" }
105
+ }]), 200, "Add manual trigger"), "Manual trigger Revision");
92
106
  }
93
- function h(e, t) {
107
+ function g(e, t) {
94
108
  return s(a(e.revision, `${t} revision`).revisionId, `${t} revisionId`);
95
109
  }
96
- function g(e, t, r, i, a) {
110
+ function _(e, t, r, i, a) {
97
111
  return u(e, `/v1/flows/${encodeURIComponent(t)}/revisions/${encodeURIComponent(r)}/publications`, {
98
112
  body: JSON.stringify({
99
113
  engineContract: n,
@@ -104,7 +118,17 @@ function g(e, t, r, i, a) {
104
118
  method: "POST"
105
119
  });
106
120
  }
107
- function _(e, t, n, r, i) {
121
+ async function v(e, t, n, r) {
122
+ let o = await c(t, n, r), l = s(o.operationId, `${r} operationId`);
123
+ for (let t = 0; o.status == "pending" && t < 100; t += 1) await new Promise((e) => setTimeout(e, 10)), o = await c(await u(e, `/v1/flows/${s(o.flowId, `${r} flowId`)}/publish-operations/${l}`), 200, `${r} operation`);
124
+ i(o.status, "succeeded", `${r} terminal status`);
125
+ let d = s(o.publicationId, `${r} publicationId`), f = a((await c(await u(e, `/v1/flows/${s(o.flowId, `${r} flowId`)}/live`), 200, `${r} Live`)).publication, `${r} Publication`);
126
+ return i(f.publicationId, d, `${r} Live Publication`), {
127
+ operation: o,
128
+ publication: f
129
+ };
130
+ }
131
+ function y(e, t, n, r, i) {
108
132
  return u(e, `/v1/flows/${encodeURIComponent(t)}/publications/${encodeURIComponent(n)}/rollback`, {
109
133
  body: JSON.stringify({
110
134
  expectedLivePublicationId: r,
@@ -114,10 +138,14 @@ function _(e, t, n, r, i) {
114
138
  method: "POST"
115
139
  });
116
140
  }
117
- function v(e, t, n) {
141
+ function b(e, t, n) {
118
142
  return u(e, "/v1/runs", {
119
143
  body: JSON.stringify({
120
144
  inputs: {},
145
+ trigger: {
146
+ nodeId: "start",
147
+ payload: {}
148
+ },
121
149
  publicationId: t,
122
150
  version: 1
123
151
  }),
@@ -125,7 +153,7 @@ function v(e, t, n) {
125
153
  method: "POST"
126
154
  });
127
155
  }
128
- var y = [
156
+ var x = [
129
157
  {
130
158
  name: "manages deployment Variables with stable limits and exact-case identity",
131
159
  async verify(e) {
@@ -187,34 +215,65 @@ var y = [
187
215
  {
188
216
  name: "commits immutable Draft Revisions for one Flow",
189
217
  async verify(e) {
190
- let t = await f(e, "Draft flow", "draft-flow"), n = s(t.flowId, "Draft Flow flowId"), r = s(t.draftRevisionId, "Draft Flow revisionId"), o = await c(await m(e, n, r), 200, "Change Draft"), d = h(o, "Changed Draft");
191
- i(a(o.revision, "Changed Draft revision").parentRevisionId, r, "Changed Draft parent"), await l(await p(e, n, d, [{
192
- kind: "graph.node.replace",
193
- node: {
194
- concurrency: 1,
195
- inputs: {},
196
- kind: "value",
197
- values: [{
198
- handle: "ready",
199
- jsonSchema: { type: "boolean" },
200
- nullable: !1,
201
- value: !0
202
- }]
203
- },
218
+ let t = await f(e, "Draft flow", "draft-flow"), n = s(t.flowId, "Draft Flow flowId"), r = s(t.draftRevisionId, "Draft Flow revisionId"), o = await c(await m(e, n, r, "marker", "draft-change"), 200, "Change Draft"), d = g(o, "Changed Draft");
219
+ i(a(o.revision, "Changed Draft revision").parentRevisionId, r, "Changed Draft parent"), i(await c(await m(e, n, r, "marker", "draft-change"), 200, "Replay Draft change"), o, "Replayed Draft change"), await l(await m(e, n, r, "another-marker", "draft-change"), 409, "flow.conflict", "Conflicting Draft change replay"), await l(await m(e, n, d, "marker"), 400, "flow.invalid", "Duplicate Draft Node", "A Node with this ID already exists"), await l(await p(e, n, d, [{
220
+ before: [{
221
+ handle: "ready",
222
+ jsonSchema: { type: "boolean" },
223
+ nullable: !1,
224
+ value: !0
225
+ }],
226
+ kind: "graph.node.values.set",
204
227
  nodeId: "marker",
205
- target: { kind: "flow" }
228
+ target: { kind: "flow" },
229
+ value: [{
230
+ handle: "ready",
231
+ jsonSchema: { type: "boolean" },
232
+ nullable: !1,
233
+ value: !0
234
+ }]
206
235
  }]), 400, "flow.invalid", "No-op Draft change"), await l(await m(e, n, r, "stale"), 412, "flow.revision-conflict", "Stale Draft change"), i(a(a(a(a((await c(await u(e, `/v1/flows/${n}/revisions/${r}`), 200, "Read old Revision")).content, "Old content").document, "Old document").graph, "Old graph").nodes, "Old nodes"), {}, "Old Revision nodes"), i((await c(await u(e, `/v1/flows/${n}/draft`), 200, "Read Draft")).revisionId, d, "Draft revisionId");
207
- let g = await c(await u(e, `/v1/flows/${n}/draft/sync?fromRevisionId=${r}`), 200, "Sync Draft");
208
- i(g.kind, "snapshot", "Draft sync kind"), i(a(g.draft, "Draft snapshot").revisionId, d, "Draft snapshot revisionId");
236
+ let h = await c(await u(e, `/v1/flows/${n}/draft/sync`), 200, "Sync Draft");
237
+ i(h.kind, "snapshot", "Draft sync kind"), i(a(h.draft, "Draft snapshot").revisionId, d, "Draft snapshot revisionId");
238
+ }
239
+ },
240
+ {
241
+ name: "loads the current editor without changing Draft or Presentation",
242
+ async verify(e) {
243
+ let t = await f(e, "Editor flow", "editor-flow"), n = s(t.flowId, "Editor Flow identity"), r = await c(await m(e, n, s(t.draftRevisionId, "Editor Draft identity"), "marker"), 200, "Change editor Draft"), o = await c(await u(e, `/v1/flows/${n}/presentation`, {
244
+ method: "PUT",
245
+ body: JSON.stringify({
246
+ expectedRevision: 1,
247
+ value: { nodes: { marker: {
248
+ x: 12,
249
+ y: 24
250
+ } } },
251
+ version: 1
252
+ })
253
+ }), 200, "Update editor Presentation"), d = await c(await u(e, `/v1/flows/${n}/editor`), 200, "Read editor");
254
+ i(d.version, 1, "Editor version"), i(a(d.flow, "Editor Flow").draftRevisionId, g(r, "Editor change"), "Editor Draft head");
255
+ for (let t of [
256
+ "flow",
257
+ "draft",
258
+ "live",
259
+ "presentation"
260
+ ]) {
261
+ let r = t == "flow" ? `/v1/flows/${n}` : `/v1/flows/${n}/${t}`;
262
+ i(d[t], await c(await u(e, r), 200, `Read editor ${t}`), `Editor ${t}`);
263
+ }
264
+ i(d.presentation, o, "Reading editor preserves Presentation"), await l(await u(e, "/v1/flows/missing-editor/editor"), 404, "flow.not-found", "Read missing editor");
209
265
  }
210
266
  },
211
267
  {
212
268
  name: "keeps Presentation CAS independent from the Draft head",
213
269
  async verify(e) {
214
- let t = await f(e, "Presentation flow", "presentation-flow"), n = s(t.flowId, "Presentation Flow flowId"), r = s(t.draftRevisionId, "Presentation Flow revisionId"), a = `/v1/flows/${n}/presentation`, o = { nodes: { task: {
215
- x: 120,
216
- y: 80
217
- } } }, d = await c(await u(e, a, {
270
+ let t = await f(e, "Presentation flow", "presentation-flow"), n = s(t.flowId, "Presentation Flow flowId"), r = s(t.draftRevisionId, "Presentation Flow revisionId"), a = `/v1/flows/${n}/presentation`, o = {
271
+ edges: [],
272
+ nodes: { task: {
273
+ x: 120,
274
+ y: 80
275
+ } }
276
+ }, d = await c(await u(e, a, {
218
277
  body: JSON.stringify({
219
278
  expectedRevision: 1,
220
279
  value: o,
@@ -242,7 +301,7 @@ var y = [
242
301
  {
243
302
  name: "validates, admits, lists, and cancels one Draft Run",
244
303
  async verify(e) {
245
- let t = await f(e, "Run flow", "run-flow"), r = s(t.flowId, "Run Flow flowId"), d = s(t.draftRevisionId, "Run Flow revisionId");
304
+ let t = await f(e, "Run flow", "run-flow"), r = s(t.flowId, "Run Flow flowId"), d = await h(e, r, s(t.draftRevisionId, "Run Flow revisionId"));
246
305
  i((await c(await u(e, `/v1/flows/${r}/revisions/${d}/check`, {
247
306
  body: JSON.stringify({
248
307
  engineContract: n,
@@ -250,36 +309,153 @@ var y = [
250
309
  }),
251
310
  method: "POST"
252
311
  }), 200, "Check Flow")).valid, !0, "Flow validity");
253
- let p = `/v1/flows/${r}/revisions/${d}/runs`, m = () => u(e, p, {
312
+ let p = `/v1/flows/${r}/revisions/${d}/runs`;
313
+ for (let t of [
314
+ void 0,
315
+ {
316
+ nodeId: "missing",
317
+ payload: {}
318
+ },
319
+ {
320
+ nodeId: "start",
321
+ payload: { unexpected: !0 }
322
+ }
323
+ ]) await l(await u(e, p, {
324
+ body: JSON.stringify({
325
+ engineContract: n,
326
+ inputs: {},
327
+ trigger: t,
328
+ version: 1
329
+ }),
330
+ headers: { "idempotency-key": `invalid-entry-${JSON.stringify(t)}` },
331
+ method: "POST"
332
+ }), 400, "run.invalid", "Reject invalid start node or payload");
333
+ let m = () => u(e, p, {
334
+ body: JSON.stringify({
335
+ engineContract: n,
336
+ inputs: {},
337
+ trigger: {
338
+ nodeId: "start",
339
+ payload: {}
340
+ },
341
+ version: 1
342
+ }),
343
+ headers: { "idempotency-key": "draft-run" },
344
+ method: "POST"
345
+ }), g = await c(await m(), 202, "Create Draft Run"), _ = s(g.runId, "Draft Run runId");
346
+ i(await c(await m(), 200, "Replay Draft Run"), g, "Replayed Draft Run"), await l(await u(e, p, {
254
347
  body: JSON.stringify({
255
348
  engineContract: n,
256
349
  inputs: {},
350
+ trigger: {
351
+ nodeId: "another",
352
+ payload: {}
353
+ },
257
354
  version: 1
258
355
  }),
259
356
  headers: { "idempotency-key": "draft-run" },
260
357
  method: "POST"
261
- }), h = await c(await m(), 202, "Create Draft Run"), g = s(h.runId, "Draft Run runId");
262
- i(await c(await m(), 200, "Replay Draft Run"), h, "Replayed Draft Run"), await l(await u(e, `/v1/runs/${g}/result`), 409, "run.not-terminal", "Read queued Run result");
263
- let _ = s((await c(await u(e, p, {
358
+ }), 409, "run.conflict", "Changing the entry conflicts with the original Run request"), await l(await u(e, `/v1/runs/${_}/result`), 409, "run.not-terminal", "Read queued Run result");
359
+ let v = s((await c(await u(e, p, {
264
360
  body: JSON.stringify({
265
361
  engineContract: n,
266
362
  inputs: {},
363
+ trigger: {
364
+ nodeId: "start",
365
+ payload: {}
366
+ },
267
367
  version: 1
268
368
  }),
269
369
  headers: { "idempotency-key": "draft-run-second" },
270
370
  method: "POST"
271
- }), 202, "Create second Draft Run")).runId, "Second Draft Run"), v = await c(await u(e, `/v1/flows/${r}/runs?limit=1`), 200, "List Runs");
272
- i(o(v.runs, "Runs").map((e) => a(e, "Run").runId), [_], "Listed Runs");
273
- let y = s(v.nextCursor, "Run cursor");
274
- i(o((await c(await u(e, `/v1/flows/${r}/runs?limit=1&cursor=${encodeURIComponent(y)}`), 200, "List next Runs")).runs, "Next Runs").map((e) => a(e, "Run").runId), [g], "Listed next Runs"), i((await c(await u(e, `/v1/runs/${g}/cancel`, {
371
+ }), 202, "Create second Draft Run")).runId, "Second Draft Run"), y = await c(await u(e, `/v1/flows/${r}/runs?limit=1`), 200, "List Runs");
372
+ i(o(y.runs, "Runs").map((e) => a(e, "Run").runId), [v], "Listed Runs");
373
+ let b = s(y.nextCursor, "Run cursor");
374
+ i(o((await c(await u(e, `/v1/flows/${r}/runs?limit=1&cursor=${encodeURIComponent(b)}`), 200, "List next Runs")).runs, "Next Runs").map((e) => a(e, "Run").runId), [_], "Listed next Runs"), await l(await u(e, `/v1/flows/${s((await f(e, "Other Run flow", "other-run-flow")).flowId, "Other Run Flow flowId")}/runs?limit=1&cursor=${encodeURIComponent(b)}`), 400, "page.invalid-cursor", "Reject Run cursor from another Flow"), i((await c(await u(e, `/v1/runs/${_}/cancel`, {
275
375
  body: JSON.stringify({ version: 1 }),
276
376
  method: "POST"
277
- }), 200, "Cancel Run")).status, "canceled", "Canceled Run status"), i((await c(await u(e, `/v1/runs/${g}/result`), 200, "Read canceled Run result")).status, "canceled", "Canceled Run result"), i((await c(await u(e, `/v1/runs/${g}/events`), 200, "Read canceled Run events")).done, !0, "Canceled Run events"), i((await c(await u(e, `/v1/runs/${_}/cancel`, {
377
+ }), 200, "Cancel Run")).status, "canceled", "Canceled Run status"), i((await c(await u(e, `/v1/runs/${_}/result`), 200, "Read canceled Run result")).status, "canceled", "Canceled Run result"), i((await c(await u(e, `/v1/runs/${_}/events`), 200, "Read canceled Run events")).done, !0, "Canceled Run events"), i((await c(await u(e, `/v1/runs/${v}/cancel`, {
278
378
  body: JSON.stringify({ version: 1 }),
279
379
  method: "POST"
280
380
  }), 200, "Cancel second Draft Run")).status, "canceled", "Second canceled Run status");
281
381
  }
282
382
  },
383
+ {
384
+ name: "pauses, resolves, resumes, and cancels waiting Draft Runs",
385
+ runtime: !0,
386
+ async verify(e) {
387
+ let t = await f(e, "Wait flow", "wait-flow"), d = s(t.flowId, "Wait Flow flowId"), m = `/v1/flows/${d}/revisions/${g(await c(await p(e, d, await h(e, d, s(t.draftRevisionId, "Wait Flow revisionId")), [{
388
+ kind: "graph.node.create",
389
+ node: {
390
+ actions: ["approve", "reject"],
391
+ input: {
392
+ handle: "value",
393
+ jsonSchema: {},
394
+ nullable: !0,
395
+ value: null
396
+ },
397
+ inputs: { value: {
398
+ kind: "value",
399
+ value: { request: 1 }
400
+ } },
401
+ kind: "wait",
402
+ name: "Approval",
403
+ prompt: "Approve request 1?"
404
+ },
405
+ nodeId: "approval",
406
+ target: { kind: "flow" }
407
+ }, {
408
+ kind: "graph.edge.connect",
409
+ edge: {
410
+ source: "start",
411
+ target: "approval"
412
+ },
413
+ target: { kind: "flow" }
414
+ }]), 200, "Create Wait"), "Wait Revision")}/runs`, _ = async (t, r) => c(await u(e, m, {
415
+ body: JSON.stringify({
416
+ engineContract: n,
417
+ inputs: {},
418
+ trigger: {
419
+ nodeId: "start",
420
+ payload: {}
421
+ },
422
+ version: 1
423
+ }),
424
+ headers: { "idempotency-key": t },
425
+ method: "POST"
426
+ }), 202, r), v = await _("wait-run", "Create Wait Run"), y = s(v.runId, "Wait Run runId"), b = v;
427
+ for (let t = 0; b.status != "waiting" && t < 200; t += 1) await new Promise((e) => setTimeout(e, 10)), b = await c(await u(e, `/v1/runs/${y}`), 200, "Read Wait Run");
428
+ i(b.status, "waiting", "Wait Run status");
429
+ let x = a(b.waiting, "Active Wait");
430
+ i(x.actions, ["approve", "reject"], "Wait actions"), i(x.nodeId, "approval", "Wait node"), i(x.prompt, "Approve request 1?", "Wait prompt"), s(x.expiresAt, "Wait expiry"), s(x.waitingSince, "Wait start");
431
+ let S = s(x.waitId, "Wait id");
432
+ i(o((await c(await u(e, `/v1/flows/${d}/runs?status=waiting`), 200, "List waiting Runs")).runs, "Waiting Runs").map((e) => a(e, "Waiting Run").runId), [y], "Waiting Run list");
433
+ let C = await c(await u(e, `/v1/runs/${y}/events`), 200, "Read waiting Run events");
434
+ i(C.done, !1, "Waiting events done"), o(C.events, "Waiting events").some((e) => a(e, "Waiting event").kind == "run.waiting") || r("Waiting Run must contain run.waiting."), await l(await u(e, `/v1/runs/${y}/result`), 409, "run.not-terminal", "Read waiting Run result");
435
+ let w = `/v1/runs/${y}/waits/${S}/resolve`, T = (t) => u(e, w, {
436
+ body: JSON.stringify({
437
+ action: t,
438
+ version: 1
439
+ }),
440
+ method: "POST"
441
+ });
442
+ await l(await T("continue"), 400, "run.invalid", "Reject unsupported Wait action");
443
+ let E = await c(await T("approve"), 200, "Approve Wait");
444
+ i(E.action, "approve", "Approved action"), i(E.resolutionAccepted, !0, "Approved resolution"), i(E.status, "queued", "Resolved Run status"), s(E.resolvedAt, "Wait resolution time");
445
+ let D = await c(await T("reject"), 200, "Reject resolved Wait");
446
+ i(D.action, "approve", "Winning action"), i(D.resolutionAccepted, !1, "Competing resolution");
447
+ for (let t = 0; b.status != "completed" && t < 200; t += 1) await new Promise((e) => setTimeout(e, 10)), b = await c(await u(e, `/v1/runs/${y}`), 200, "Read resumed Run");
448
+ i(b.status, "completed", "Resumed Run status"), i(b.waiting, void 0, "Completed Wait projection");
449
+ let O = await c(await T("approve"), 200, "Replay approved Wait");
450
+ i(O.resolutionAccepted, !0, "Replayed resolution"), i(O.status, "completed", "Replayed terminal status"), i(o((await c(await u(e, `/v1/runs/${y}/events`), 200, "Read resumed Run events")).events, "Completed events").filter((e) => a(e, "Completed event").kind == "run.resolved").length, 1, "Resolved event count");
451
+ let k = await _("wait-run-cancel", "Create cancelable Wait Run"), A = s(k.runId, "Cancelable Wait Run id"), j = k;
452
+ for (let t = 0; j.status != "waiting" && t < 200; t += 1) await new Promise((e) => setTimeout(e, 10)), j = await c(await u(e, `/v1/runs/${A}`), 200, "Read cancelable Wait Run");
453
+ i(j.status, "waiting", "Cancelable Wait status"), i((await c(await u(e, `/v1/runs/${A}/cancel`, {
454
+ body: JSON.stringify({ version: 1 }),
455
+ method: "POST"
456
+ }), 200, "Cancel waiting Run")).status, "canceled", "Canceled waiting Run status");
457
+ }
458
+ },
283
459
  {
284
460
  name: "rejects invalid and missing Flow control targets",
285
461
  async verify(e) {
@@ -313,6 +489,10 @@ var y = [
313
489
  body: JSON.stringify({
314
490
  engineContract: n,
315
491
  inputs: {},
492
+ trigger: {
493
+ nodeId: "start",
494
+ payload: {}
495
+ },
316
496
  version: 1
317
497
  }),
318
498
  headers: { "idempotency-key": r },
@@ -321,35 +501,74 @@ var y = [
321
501
  await l(await p(c, "unsupported-engine/v1", "unsupported-run"), 409, "engine.unsupported", "Run unsupported Engine"), await l(await p(r, n, "missing-revision-run"), 404, "flow.not-found", "Run missing Revision");
322
502
  }
323
503
  }
324
- ], b = [{
325
- name: "publishes one immutable Flow with idempotent Live CAS",
326
- async verify(e) {
327
- let t = await f(e, "Publication flow", "publication-flow"), n = s(t.flowId, "Publication Flow flowId"), r = s(t.draftRevisionId, "Publication Flow revisionId");
328
- i((await c(await u(e, `/v1/flows/${n}/live`), 200, "Read Live")).status, "not-published", "Initial Live status");
329
- let a = () => g(e, n, r, null, "publication-first"), o = await c(await a(), 201, "Publish Flow"), d = s(o.publicationId, "Publication id");
330
- i(await c(await a(), 200, "Replay Publish"), o, "Replayed Publication"), await l(await g(e, n, r, d, "publication-first"), 409, "publication.conflict", "Conflicting replay"), i((await c(await u(e, `/v1/flows/${n}/live`), 200, "Read published Live")).publication, o, "Live Publication");
331
- let p = await c(await u(e, `/v1/flows/${n}/publications?includeTotal=true`), 200, "List Publications");
332
- i(p.publications, [o], "Publication history"), i(p.total, 1, "Publication total"), await l(await u(e, `/v1/flows/${n}/revisions/${r}/publications`, {
333
- body: JSON.stringify({
334
- engineContract: "unsupported-engine/v1",
335
- expectedLivePublicationId: d,
336
- version: 1
337
- }),
338
- headers: { "idempotency-key": "unsupported-publication" },
339
- method: "POST"
340
- }), 409, "engine.unsupported", "Publish unsupported Engine"), await l(await g(e, n, "00000000-0000-7000-8000-000000000002", d, "missing-revision-publication"), 404, "flow.not-found", "Publish missing Revision"), await l(await _(e, n, "00000000-0000-7000-8000-000000000004", d, "missing-rollback"), 404, "publication.not-found", "Rollback missing Publication"), await l(await v(e, "00000000-0000-7000-8000-000000000004", "missing-publication-run"), 404, "publication.not-found", "Run missing Publication");
341
- }
342
- }, {
343
- name: "rolls back immutable history and fixes a Live Run target",
344
- async verify(e) {
345
- let t = await f(e, "Rollback flow", "rollback-flow"), n = s(t.flowId, "Rollback Flow flowId"), r = s(t.draftRevisionId, "Rollback Flow revisionId"), a = s((await c(await g(e, n, r, null, "publish-first"), 201, "Publish first Revision")).publicationId, "First Publication"), o = s((await c(await g(e, n, h(await c(await m(e, n, r), 200, "Change Draft"), "Second Revision"), a, "publish-second"), 201, "Publish second Revision")).publicationId, "Second Publication");
346
- await l(await v(e, a, "stale-live-run"), 412, "live.conflict", "Run stale Publication");
347
- let d = () => _(e, n, a, o, "rollback-first"), p = await c(await d(), 201, "Rollback Flow"), y = s(p.publicationId, "Rollback Publication");
348
- i(p.operation, "rollback", "Rollback operation"), i(p.sourcePublicationId, a, "Rollback source"), i(await c(await d(), 200, "Replay Rollback"), p, "Replayed Rollback");
349
- let b = await c(await v(e, y, "rollback-run"), 202, "Create Live Run");
350
- i(b.flowId, n, "Live Run flowId"), i(b.revisionId, r, "Live Run revisionId"), await c(await u(e, `/v1/flows/${n}`, { method: "DELETE" }), 202, "Retire Flow"), await l(await v(e, y, "retired-run"), 409, "flow.busy", "Run retired Flow");
504
+ ], S = [
505
+ {
506
+ name: "controls Live admission independently from publishing and Draft testing",
507
+ async verify(e) {
508
+ let t = await f(e, "Enabled flow", "enabled-flow"), r = s(t.flowId, "Flow id"), o = await h(e, r, s(t.draftRevisionId, "Draft id")), d = (t, n) => u(e, `/v1/flows/${r}/enabled`, {
509
+ method: "PUT",
510
+ body: JSON.stringify({
511
+ enabled: t,
512
+ expectedPublicationId: n,
513
+ version: 1
514
+ })
515
+ });
516
+ await l(await d(!0, "missing"), 409, "flow.conflict", "Cannot enable unpublished Flow");
517
+ let p = s((await v(e, await _(e, r, o, null, "enable-first"), 202, "Publish")).publication.publicationId, "Publication id"), m = await c(await d(!1, p), 200, "Disable");
518
+ i(m.live, {
519
+ enabled: !1,
520
+ publicationId: p,
521
+ revisionId: o
522
+ }, "Disabled summary"), i((await c(await u(e, "/v1/flows"), 200, "List disabled Flow")).flows, [m], "List includes Live state"), i((await c(await u(e, `/v1/flows/${r}/live`), 200, "Disabled Live")).status, "suspended", "Disabled Live status"), await l(await b(e, p, "disabled-run"), 412, "live.conflict", "Disabled Live rejects Run"), await c(await u(e, `/v1/flows/${r}/revisions/${o}/runs`, {
523
+ method: "POST",
524
+ headers: { "idempotency-key": "disabled-draft" },
525
+ body: JSON.stringify({
526
+ engineContract: n,
527
+ inputs: {},
528
+ trigger: {
529
+ nodeId: "start",
530
+ payload: {}
531
+ },
532
+ version: 1
533
+ })
534
+ }), 202, "Disabled Flow permits Draft test");
535
+ let g = s((await v(e, await _(e, r, o, p, "enable-next"), 202, "Publish disabled Flow")).publication.publicationId, "Next Publication id");
536
+ i(a((await c(await u(e, `/v1/flows/${r}`), 200, "Read Flow")).live, "Live").enabled, !1, "Publish preserves disabled state"), await l(await d(!0, p), 409, "flow.conflict", "Stale switch rejects"), await c(await d(!0, g), 200, "Enable"), await c(await b(e, g, "enabled-run"), 202, "Enabled Live accepts Run");
537
+ }
538
+ },
539
+ {
540
+ name: "publishes one immutable Flow with idempotent Live CAS",
541
+ async verify(e) {
542
+ let t = await f(e, "Publication flow", "publication-flow"), n = s(t.flowId, "Publication Flow flowId"), r = await h(e, n, s(t.draftRevisionId, "Publication Flow revisionId"));
543
+ i((await c(await u(e, `/v1/flows/${n}/live`), 200, "Read Live")).status, "not-published", "Initial Live status");
544
+ let a = () => _(e, n, r, null, "publication-first"), o = await v(e, await a(), 202, "Publish Flow"), d = o.publication, p = s(d.publicationId, "Publication id");
545
+ i(await c(await a(), 202, "Replay Publish"), o.operation, "Replayed Publish operation"), await l(await _(e, n, r, p, "publication-first"), 409, "publication.conflict", "Conflicting replay");
546
+ let m = await c(await u(e, `/v1/flows/${n}/live`), 200, "Read published Live");
547
+ i(m.publication, d, "Live Publication"), i((await c(await u(e, `/v1/flows/${n}/editor`), 200, "Read published editor")).live, m, "Published editor Live projection");
548
+ let g = await c(await u(e, `/v1/flows/${n}/publications?includeTotal=true`), 200, "List Publications");
549
+ i(g.publications, [d], "Publication history"), i(g.total, 1, "Publication total"), await l(await u(e, `/v1/flows/${n}/revisions/${r}/publications`, {
550
+ body: JSON.stringify({
551
+ engineContract: "unsupported-engine/v1",
552
+ expectedLivePublicationId: p,
553
+ version: 1
554
+ }),
555
+ headers: { "idempotency-key": "unsupported-publication" },
556
+ method: "POST"
557
+ }), 409, "engine.unsupported", "Publish unsupported Engine"), await l(await _(e, n, "00000000-0000-7000-8000-000000000002", p, "missing-revision-publication"), 404, "flow.not-found", "Publish missing Revision"), await l(await y(e, n, "00000000-0000-7000-8000-000000000004", p, "missing-rollback"), 404, "publication.not-found", "Rollback missing Publication"), await l(await b(e, "00000000-0000-7000-8000-000000000004", "missing-publication-run"), 404, "publication.not-found", "Run missing Publication");
558
+ }
559
+ },
560
+ {
561
+ name: "rolls back immutable history and fixes a Live Run target",
562
+ async verify(e) {
563
+ let t = await f(e, "Rollback flow", "rollback-flow"), n = s(t.flowId, "Rollback Flow flowId"), r = await h(e, n, s(t.draftRevisionId, "Rollback Flow revisionId")), a = (await v(e, await _(e, n, r, null, "publish-first"), 202, "Publish first Revision")).publication, o = s(a.publicationId, "First Publication"), d = (await v(e, await _(e, n, g(await c(await m(e, n, r), 200, "Change Draft"), "Second Revision"), o, "publish-second"), 202, "Publish second Revision")).publication, p = s(d.publicationId, "Second Publication");
564
+ await l(await b(e, o, "stale-live-run"), 412, "live.conflict", "Run stale Publication");
565
+ let x = () => y(e, n, o, p, "rollback-first"), S = await c(await x(), 201, "Rollback Flow"), C = s(S.publicationId, "Rollback Publication");
566
+ i(S.operation, "rollback", "Rollback operation"), i(S.sourcePublicationId, o, "Rollback source"), i(await c(await x(), 200, "Replay Rollback"), S, "Replayed Rollback");
567
+ let w = await c(await b(e, C, "rollback-run"), 202, "Create Live Run");
568
+ i(w.flowId, n, "Live Run flowId"), i(w.revisionId, r, "Live Run revisionId"), await c(await u(e, `/v1/flows/${n}`, { method: "DELETE" }), 202, "Retire Flow"), await l(await b(e, C, "retired-run"), 409, "flow.busy", "Run retired Flow");
569
+ }
351
570
  }
352
- }], x = [{
571
+ ], C = [{
353
572
  name: "exposes one deployment-scoped Trigger Key catalog",
354
573
  async verify(e) {
355
574
  let t = await c(await u(e, "/v1/trigger-keys"), 200, "List Trigger Keys"), n = await c(await u(e, "/v1/trigger-keys/catalog"), 200, "List Trigger definitions"), r = o(t.keys, "Trigger Keys").map((e) => a(e, "Trigger Key")), d = o(n.definitions, "Trigger definitions").map((e) => a(e, "Trigger definition"));
@@ -363,7 +582,7 @@ var y = [
363
582
  }, {
364
583
  name: "operates and retires one Live Trigger binding",
365
584
  async verify(e) {
366
- let t = await f(e, "Trigger flow", "trigger-flow"), n = s(t.flowId, "Trigger Flow flowId"), r = h(await c(await p(e, n, s(t.draftRevisionId, "Trigger Flow revisionId"), [{
585
+ let t = await f(e, "Trigger flow", "trigger-flow"), n = s(t.flowId, "Trigger Flow flowId"), r = g(await c(await p(e, n, s(t.draftRevisionId, "Trigger Flow revisionId"), [{
367
586
  kind: "graph.node.create",
368
587
  node: {
369
588
  cronTimes: [{
@@ -385,20 +604,29 @@ var y = [
385
604
  },
386
605
  nodeId: "webhook",
387
606
  target: { kind: "flow" }
388
- }]), 200, "Create Trigger nodes"), "Trigger Revision"), l = s((await c(await g(e, n, r, null, "trigger-publication"), 201, "Publish Trigger Flow")).publicationId, "Trigger Publication"), d = `/v1/flows/${n}/triggers`, m = o((await c(await u(e, d), 200, "List Trigger bindings")).bindings, "Trigger bindings").map((e) => a(e, "Trigger binding"));
389
- i(m.map((e) => e.triggerNodeId), ["cron", "webhook"], "Trigger binding order");
390
- for (let e of m) i(e.currentPublicationId, l, "Trigger Publication");
391
- let _ = `${d}/webhook`, v = s(a((await c(await u(e, _), 200, "Read Webhook")).binding, "Webhook").endpointUrl, "Webhook endpoint"), y = (t) => u(e, `${_}/${t}`, {
607
+ }]), 200, "Create Trigger nodes"), "Trigger Revision"), l = (await v(e, await _(e, n, r, null, "trigger-publication"), 202, "Publish Trigger Flow")).publication, d = s(l.publicationId, "Trigger Publication"), m = `/v1/flows/${n}/triggers`, h = o((await c(await u(e, m), 200, "List Trigger bindings")).bindings, "Trigger bindings").map((e) => a(e, "Trigger binding"));
608
+ i(h.map((e) => e.triggerNodeId), ["cron", "webhook"], "Trigger binding order");
609
+ for (let e of h) i(e.currentPublicationId, d, "Trigger Publication");
610
+ let y = `${m}/webhook`, b = s(a((await c(await u(e, y), 200, "Read Webhook")).binding, "Webhook").endpointUrl, "Webhook endpoint"), x = (t) => u(e, `${y}/${t}`, {
392
611
  body: JSON.stringify({ version: 1 }),
393
612
  method: "POST"
394
613
  });
395
- i((await c(await y("pause"), 200, "Pause Webhook")).operatorState, "paused", "Paused state"), i((await e.request(new Request(v, { method: "POST" }))).status, 404, "Paused callback"), i((await c(await y("resume"), 200, "Resume Webhook")).operatorState, "active", "Resumed state"), i((await e.request(new Request(v, { method: "POST" }))).status, 200, "Resumed callback"), await c(await g(e, n, h(await c(await p(e, n, r, [{
614
+ i((await c(await x("pause"), 200, "Pause Webhook")).operatorState, "paused", "Paused state"), i((await e.request(new Request(b, { method: "POST" }))).status, 404, "Paused callback"), i((await c(await x("resume"), 200, "Resume Webhook")).operatorState, "active", "Resumed state"), i((await e.request(new Request(b, { method: "POST" }))).status, 200, "Resumed callback");
615
+ let S = (t) => u(e, `/v1/flows/${n}/enabled`, {
616
+ method: "PUT",
617
+ body: JSON.stringify({
618
+ enabled: t,
619
+ expectedPublicationId: d,
620
+ version: 1
621
+ })
622
+ });
623
+ await c(await S(!1), 200, "Disable Trigger Flow"), i((await e.request(new Request(b, { method: "POST" }))).status, 404, "Disabled Flow blocks callback"), await c(await x("pause"), 200, "Pause binding while Flow disabled"), await c(await S(!0), 200, "Enable Trigger Flow"), i((await e.request(new Request(b, { method: "POST" }))).status, 404, "Enabling preserves binding pause"), await c(await x("resume"), 200, "Resume binding after enabling Flow"), i((await e.request(new Request(b, { method: "POST" }))).status, 200, "Enabled Flow permits callback"), await v(e, await _(e, n, g(await c(await p(e, n, r, [{
396
624
  kind: "graph.node.delete",
397
625
  nodeId: "webhook",
398
626
  target: { kind: "flow" }
399
- }]), 200, "Delete Webhook"), "Retired Trigger Revision"), l, "retire-trigger"), 201, "Publish retired Trigger"), i(a((await c(await u(e, _), 200, "Read retired Webhook")).binding, "Retired Webhook").currentPublicationId, void 0, "Retired Publication");
627
+ }]), 200, "Delete Webhook"), "Retired Trigger Revision"), d, "retire-trigger"), 202, "Publish retired Trigger"), i(a((await c(await u(e, y), 200, "Read retired Webhook")).binding, "Retired Webhook").currentPublicationId, void 0, "Retired Publication");
400
628
  }
401
- }], S = [{
629
+ }], w = [{
402
630
  name: "projects the deployment Connector catalog and authorized Connections",
403
631
  async verify(e) {
404
632
  let t = o((await c(await u(e, "/v1/connector/providers"), 200, "List Connector Providers")).providers, "Connector Providers").map((e) => a(e, "Connector Provider")), n = o((await c(await u(e, "/v1/connector/actions"), 200, "List Connector Actions")).actions, "Connector Actions").map((e) => a(e, "Connector Action"));
@@ -420,4 +648,4 @@ var y = [
420
648
  }
421
649
  }];
422
650
  //#endregion
423
- export { S as connectorControlApiConformanceCases, y as controlApiConformanceCases, b as publicationControlApiConformanceCases, x as triggerControlApiConformanceCases };
651
+ export { w as connectorControlApiConformanceCases, x as controlApiConformanceCases, S as publicationControlApiConformanceCases, C as triggerControlApiConformanceCases };
@@ -18,6 +18,8 @@ export declare const controlErrorCode: {
18
18
  readonly pageInvalidCursor: 'page.invalid-cursor';
19
19
  readonly publicationConflict: 'publication.conflict';
20
20
  readonly publicationNotFound: 'publication.not-found';
21
+ readonly publicationUnsupported: 'publication.unsupported';
22
+ readonly publishOperationNotFound: 'publication.operation-not-found';
21
23
  readonly routeNotFound: 'route.not-found';
22
24
  readonly runConflict: 'run.conflict';
23
25
  readonly runEventsExpired: 'run.events-expired';
@@ -25,6 +27,7 @@ export declare const controlErrorCode: {
25
27
  readonly runNotFound: 'run.not-found';
26
28
  readonly runNotTerminal: 'run.not-terminal';
27
29
  readonly runOverloaded: 'run.overloaded';
30
+ readonly runWaitNotFound: 'run.wait-not-found';
28
31
  readonly triggerKeyInvalid: 'trigger-key.invalid';
29
32
  readonly triggerKeyNotFound: 'trigger-key.not-found';
30
33
  readonly triggerNotFound: 'trigger.not-found';
@@ -91,6 +94,12 @@ export declare const controlErrorMetadata: {
91
94
  readonly "publication.not-found": {
92
95
  readonly status: 404;
93
96
  };
97
+ readonly "publication.unsupported": {
98
+ readonly status: 409;
99
+ };
100
+ readonly "publication.operation-not-found": {
101
+ readonly status: 404;
102
+ };
94
103
  readonly "route.not-found": {
95
104
  readonly status: 404;
96
105
  };
@@ -112,6 +121,9 @@ export declare const controlErrorMetadata: {
112
121
  readonly "run.overloaded": {
113
122
  readonly status: 429;
114
123
  };
124
+ readonly "run.wait-not-found": {
125
+ readonly status: 404;
126
+ };
115
127
  readonly "trigger-key.invalid": {
116
128
  readonly status: 409;
117
129
  };