@oomol-lab/open-flow 0.1.0-beta.3 → 0.1.0-beta.5

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 (47) hide show
  1. package/dist/browser/DesignerIcon-XKBRy_0Q.js +2066 -0
  2. package/dist/browser/{createResourceDialog-BkZns-oZ.js → createResourceDialog-Cf7QpXp6.js} +161 -160
  3. package/dist/browser/{dist-BMqL-qR5.js → dist-BMRLCebL.js} +291 -292
  4. package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
  5. package/dist/browser/{dist-CJpzJrLM.js → dist-Cc0y2Pli.js} +811 -812
  6. package/dist/browser/{dist-DUzA0Ukh.js → dist-Dg_VXC8f.js} +134 -135
  7. package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
  8. package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
  9. package/dist/browser/dist-DxahK_I8.js +2688 -0
  10. package/dist/browser/{dist-CPuF50D9.js → dist-meg_oHVR.js} +335 -335
  11. package/dist/browser/{esm-C2UUqIUP.js → esm-xWDFFpGd.js} +5 -6
  12. package/dist/browser/flow-authoring-module.d.ts +2 -2
  13. package/dist/browser/flow-authoring-node.d.ts +5 -2
  14. package/dist/browser/flow-authoring.d.ts +1 -1
  15. package/dist/browser/flow-authoring.js +489 -209
  16. package/dist/browser/flow-change.d.ts +110 -9
  17. package/dist/browser/flow-change.js +319 -96
  18. package/dist/browser/flow-notifications.d.ts +5 -0
  19. package/dist/browser/{diagnostics-SDCyFuxm.js → flowChanges-CeMiiZIO.js} +4234 -3825
  20. package/dist/browser/{flowRunInputEditorStore-CwvOiIiU.js → flowRunInputEditorStore-DDidwd8h.js} +10 -2
  21. package/dist/browser/{flowWorkspace-BZ_eiQNR.js → flowWorkspace-VnS8nLMT.js} +35268 -35081
  22. package/dist/browser/{getPseudoElementBounds-ESJExRFX.js → getPseudoElementBounds-5LArT6Xc.js} +1827 -2322
  23. package/dist/browser/icons-CRxvozBE.js +726 -0
  24. package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-Bj2HDFRd.js} +256 -257
  25. package/dist/browser/waitNotificationInputs-ClCAEIAM.js +26 -0
  26. package/dist/browser/workbench.css +1 -1
  27. package/dist/browser/workbench.d.ts +1 -0
  28. package/dist/browser/workbench.js +851 -840
  29. package/dist/browser/{workbenchSelect-B2s1HV-Y.js → workbenchSelect-Cf1zlVm9.js} +479 -478
  30. package/dist/common/control-api-conformance.d.ts +1 -0
  31. package/dist/common/control-api-conformance.js +80 -19
  32. package/dist/common/control-api-errors.d.ts +4 -0
  33. package/dist/common/control-api.d.ts +26 -14
  34. package/dist/common/control-api.js +138 -89
  35. package/dist/common/flow-encoding.js +20 -8
  36. package/dist/common/flow-notifications.d.ts +5 -0
  37. package/dist/common/flow-semantics.d.ts +1 -0
  38. package/dist/common/flow-semantics.js +467 -381
  39. package/dist/common/run-events.js +2 -1
  40. package/dist/common/run-lifecycle.d.ts +17 -2
  41. package/dist/common/run-lifecycle.js +53 -2
  42. package/dist/common/scheduler.d.ts +64 -3
  43. package/dist/common/scheduler.js +417 -142
  44. package/dist/index.d.ts +1 -0
  45. package/package.json +1 -1
  46. package/dist/browser/dist-BpopSHwP.js +0 -1543
  47. package/dist/browser/dist-CUSrALSX.js +0 -1620
@@ -5,6 +5,7 @@ export interface ControlApiConformanceHarness {
5
5
  }
6
6
  export interface ControlApiConformanceCase {
7
7
  readonly name: string;
8
+ readonly runtime?: true;
8
9
  verify(harness: ControlApiConformanceHarness): Promise<void>;
9
10
  }
10
11
  export declare const controlApiConformanceCases: readonly ControlApiConformanceCase[];
@@ -62,17 +62,18 @@ function d(e, t, n) {
62
62
  async function f(e, t, n) {
63
63
  return c(await d(e, t, n), 201, "Create Flow");
64
64
  }
65
- function p(e, t, n, r) {
65
+ function p(e, t, n, r, i = `change-${crypto.randomUUID()}`) {
66
66
  return u(e, `/v1/flows/${encodeURIComponent(t)}/draft/changes`, {
67
67
  body: JSON.stringify({
68
68
  expectedRevisionId: n,
69
69
  operations: r,
70
70
  version: 1
71
71
  }),
72
+ headers: { "idempotency-key": i },
72
73
  method: "POST"
73
74
  });
74
75
  }
75
- function m(e, t, n, r = "marker") {
76
+ function m(e, t, n, r = "marker", i) {
76
77
  return p(e, t, n, [{
77
78
  kind: "graph.node.create",
78
79
  node: {
@@ -88,7 +89,7 @@ function m(e, t, n, r = "marker") {
88
89
  },
89
90
  nodeId: r,
90
91
  target: { kind: "flow" }
91
- }]);
92
+ }], i);
92
93
  }
93
94
  function h(e, t) {
94
95
  return s(a(e.revision, `${t} revision`).revisionId, `${t} revisionId`);
@@ -197,24 +198,25 @@ var b = [
197
198
  {
198
199
  name: "commits immutable Draft Revisions for one Flow",
199
200
  async verify(e) {
200
- 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");
201
- i(a(o.revision, "Changed Draft revision").parentRevisionId, r, "Changed Draft parent"), await l(await p(e, n, d, [{
202
- kind: "graph.node.replace",
203
- node: {
204
- concurrency: 1,
205
- inputs: {},
206
- kind: "value",
207
- values: [{
208
- handle: "ready",
209
- jsonSchema: { type: "boolean" },
210
- nullable: !1,
211
- value: !0
212
- }]
213
- },
201
+ 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 = h(o, "Changed Draft");
202
+ 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 p(e, n, d, [{
203
+ before: [{
204
+ handle: "ready",
205
+ jsonSchema: { type: "boolean" },
206
+ nullable: !1,
207
+ value: !0
208
+ }],
209
+ kind: "graph.node.values.set",
214
210
  nodeId: "marker",
215
- target: { kind: "flow" }
211
+ target: { kind: "flow" },
212
+ value: [{
213
+ handle: "ready",
214
+ jsonSchema: { type: "boolean" },
215
+ nullable: !1,
216
+ value: !0
217
+ }]
216
218
  }]), 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");
217
- let g = await c(await u(e, `/v1/flows/${n}/draft/sync?fromRevisionId=${r}`), 200, "Sync Draft");
219
+ let g = await c(await u(e, `/v1/flows/${n}/draft/sync`), 200, "Sync Draft");
218
220
  i(g.kind, "snapshot", "Draft sync kind"), i(a(g.draft, "Draft snapshot").revisionId, d, "Draft snapshot revisionId");
219
221
  }
220
222
  },
@@ -290,6 +292,65 @@ var b = [
290
292
  }), 200, "Cancel second Draft Run")).status, "canceled", "Second canceled Run status");
291
293
  }
292
294
  },
295
+ {
296
+ name: "pauses, resolves, resumes, and cancels waiting Draft Runs",
297
+ runtime: !0,
298
+ async verify(e) {
299
+ let t = await f(e, "Wait flow", "wait-flow"), d = s(t.flowId, "Wait Flow flowId"), m = `/v1/flows/${d}/revisions/${h(await c(await p(e, d, s(t.draftRevisionId, "Wait Flow revisionId"), [{
300
+ kind: "graph.node.create",
301
+ node: {
302
+ actions: ["approve", "reject"],
303
+ concurrency: 1,
304
+ inputs: { value: {
305
+ kind: "value",
306
+ value: { request: 1 }
307
+ } },
308
+ kind: "wait",
309
+ prompt: "Approve request 1?"
310
+ },
311
+ nodeId: "approval",
312
+ target: { kind: "flow" }
313
+ }]), 200, "Create Wait"), "Wait Revision")}/runs`, g = async (t, r) => c(await u(e, m, {
314
+ body: JSON.stringify({
315
+ engineContract: n,
316
+ inputs: {},
317
+ version: 1
318
+ }),
319
+ headers: { "idempotency-key": t },
320
+ method: "POST"
321
+ }), 202, r), _ = await g("wait-run", "Create Wait Run"), v = s(_.runId, "Wait Run runId"), y = _;
322
+ for (let t = 0; y.status != "waiting" && t < 200; t += 1) await new Promise((e) => setTimeout(e, 10)), y = await c(await u(e, `/v1/runs/${v}`), 200, "Read Wait Run");
323
+ i(y.status, "waiting", "Wait Run status");
324
+ let b = a(y.waiting, "Active Wait");
325
+ i(b.actions, ["approve", "reject"], "Wait actions"), i(b.nodeId, "approval", "Wait node"), i(b.prompt, "Approve request 1?", "Wait prompt"), s(b.expiresAt, "Wait expiry"), s(b.waitingSince, "Wait start");
326
+ let x = s(b.waitId, "Wait id");
327
+ 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), [v], "Waiting Run list");
328
+ let S = await c(await u(e, `/v1/runs/${v}/events`), 200, "Read waiting Run events");
329
+ i(S.done, !1, "Waiting events done"), o(S.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/${v}/result`), 409, "run.not-terminal", "Read waiting Run result");
330
+ let C = `/v1/runs/${v}/waits/${x}/resolve`, w = (t) => u(e, C, {
331
+ body: JSON.stringify({
332
+ action: t,
333
+ version: 1
334
+ }),
335
+ method: "POST"
336
+ });
337
+ await l(await w("continue"), 400, "run.invalid", "Reject unsupported Wait action");
338
+ let T = await c(await w("approve"), 200, "Approve Wait");
339
+ i(T.action, "approve", "Approved action"), i(T.resolutionAccepted, !0, "Approved resolution"), i(T.status, "queued", "Resolved Run status"), s(T.resolvedAt, "Wait resolution time");
340
+ let E = await c(await w("reject"), 200, "Reject resolved Wait");
341
+ i(E.action, "approve", "Winning action"), i(E.resolutionAccepted, !1, "Competing resolution");
342
+ for (let t = 0; y.status != "completed" && t < 200; t += 1) await new Promise((e) => setTimeout(e, 10)), y = await c(await u(e, `/v1/runs/${v}`), 200, "Read resumed Run");
343
+ i(y.status, "completed", "Resumed Run status"), i(y.waiting, void 0, "Completed Wait projection");
344
+ let D = await c(await w("approve"), 200, "Replay approved Wait");
345
+ i(D.resolutionAccepted, !0, "Replayed resolution"), i(D.status, "completed", "Replayed terminal status"), i(o((await c(await u(e, `/v1/runs/${v}/events`), 200, "Read resumed Run events")).events, "Completed events").filter((e) => a(e, "Completed event").kind == "run.resolved").length, 1, "Resolved event count");
346
+ let O = await g("wait-run-cancel", "Create cancelable Wait Run"), k = s(O.runId, "Cancelable Wait Run id"), A = O;
347
+ for (let t = 0; A.status != "waiting" && t < 200; t += 1) await new Promise((e) => setTimeout(e, 10)), A = await c(await u(e, `/v1/runs/${k}`), 200, "Read cancelable Wait Run");
348
+ i(A.status, "waiting", "Cancelable Wait status"), i((await c(await u(e, `/v1/runs/${k}/cancel`, {
349
+ body: JSON.stringify({ version: 1 }),
350
+ method: "POST"
351
+ }), 200, "Cancel waiting Run")).status, "canceled", "Canceled waiting Run status");
352
+ }
353
+ },
293
354
  {
294
355
  name: "rejects invalid and missing Flow control targets",
295
356
  async verify(e) {
@@ -27,6 +27,7 @@ export declare const controlErrorCode: {
27
27
  readonly runNotFound: 'run.not-found';
28
28
  readonly runNotTerminal: 'run.not-terminal';
29
29
  readonly runOverloaded: 'run.overloaded';
30
+ readonly runWaitNotFound: 'run.wait-not-found';
30
31
  readonly triggerKeyInvalid: 'trigger-key.invalid';
31
32
  readonly triggerKeyNotFound: 'trigger-key.not-found';
32
33
  readonly triggerNotFound: 'trigger.not-found';
@@ -120,6 +121,9 @@ export declare const controlErrorMetadata: {
120
121
  readonly "run.overloaded": {
121
122
  readonly status: 429;
122
123
  };
124
+ readonly "run.wait-not-found": {
125
+ readonly status: 404;
126
+ };
123
127
  readonly "trigger-key.invalid": {
124
128
  readonly status: 409;
125
129
  };
@@ -1,6 +1,6 @@
1
1
  import type { RunStatus } from './run-lifecycle.js';
2
- import type { ChangeOperation, InputPortDefinition, JsonValue, PortDefinition, RevisionContent, TriggerKeySnapshot } from '../browser/flow-change.js';
3
- export type { JsonValue, TriggerKeySnapshot } from '../browser/flow-change.js';
2
+ import type { ChangeOperation, InputPortDefinition, JsonValue, PortDefinition, RevisionContent, TriggerKeySnapshot, WaitAction } from '../browser/flow-change.js';
3
+ export type { JsonValue, TriggerKeySnapshot, WaitAction } from '../browser/flow-change.js';
4
4
  export type { RunStatus } from './run-lifecycle.js';
5
5
  export { controlErrorCode, controlErrorMetadata, type ControlErrorCode } from './control-api-errors.js';
6
6
  export type { FlowCatalogEvent, FlowChangeEvent } from './flow-notifications.js';
@@ -83,6 +83,7 @@ export interface ConnectorAction {
83
83
  readonly authenticated: boolean;
84
84
  readonly defaultConnection?: ConnectorConnection;
85
85
  readonly description: string;
86
+ readonly homepageUrl?: string;
86
87
  readonly icon?: string;
87
88
  readonly inputs: Readonly<Record<string, InputPortDefinition>>;
88
89
  readonly name: string;
@@ -91,6 +92,7 @@ export interface ConnectorAction {
91
92
  readonly serviceName: string;
92
93
  }
93
94
  export interface ConnectorProvider {
95
+ readonly homepageUrl?: string;
94
96
  readonly icon?: string;
95
97
  readonly serviceId: string;
96
98
  readonly serviceName: string;
@@ -112,18 +114,11 @@ export interface DraftChange {
112
114
  readonly revision: RevisionMetadata;
113
115
  readonly version: 1;
114
116
  }
115
- export type DraftSync = {
116
- readonly kind: 'changes';
117
- readonly revisions: readonly {
118
- readonly operations: readonly ChangeOperation[];
119
- readonly revision: RevisionMetadata;
120
- }[];
121
- readonly version: 1;
122
- } | {
117
+ export interface DraftSync {
123
118
  readonly draft: Draft;
124
119
  readonly kind: 'snapshot';
125
120
  readonly version: 1;
126
- };
121
+ }
127
122
  export interface Publication {
128
123
  readonly actorId: string;
129
124
  readonly closureDigest: string;
@@ -220,6 +215,14 @@ interface RunDetailsBase extends Run {
220
215
  readonly eventsExpiresAt?: string;
221
216
  readonly modelVersion: number;
222
217
  readonly revisionDigest: string;
218
+ readonly waiting?: {
219
+ readonly actions: readonly ['continue'] | readonly ['approve', 'reject'];
220
+ readonly expiresAt: string;
221
+ readonly nodeId: string;
222
+ readonly prompt: string;
223
+ readonly waitId: string;
224
+ readonly waitingSince: string;
225
+ };
223
226
  }
224
227
  export type DraftRun = RunDetailsBase & {
225
228
  readonly source: 'draft';
@@ -241,7 +244,7 @@ export interface RunPage {
241
244
  readonly runs: readonly Run[];
242
245
  readonly version: 1;
243
246
  }
244
- export type RunEventKind = 'node.artifact' | 'node.completed' | 'node.failed' | 'node.log' | 'node.output' | 'node.progress' | 'node.started' | 'run.canceled' | 'run.completed' | 'run.events-truncated' | 'run.failed' | 'run.indeterminate' | 'run.progress' | 'run.queued' | 'run.started';
247
+ export type RunEventKind = 'node.artifact' | 'node.completed' | 'node.failed' | 'node.log' | 'node.output' | 'node.progress' | 'node.started' | 'run.canceled' | 'run.completed' | 'run.events-truncated' | 'run.failed' | 'run.indeterminate' | 'run.progress' | 'run.queued' | 'run.resolved' | 'run.started' | 'run.waiting';
245
248
  export interface RunEvent {
246
249
  readonly createdAt: string;
247
250
  readonly kind: RunEventKind;
@@ -329,7 +332,7 @@ export declare class ControlClient {
329
332
  resumeFlowTrigger(flowId: string, triggerNodeId: string): Promise<TriggerBinding>;
330
333
  testFlowPollTrigger(flowId: string, triggerNodeId: string): Promise<PollTriggerTestResult>;
331
334
  getDraft(flowId: string): Promise<Draft>;
332
- syncDraft(flowId: string, fromRevisionId?: string): Promise<DraftSync>;
335
+ syncDraft(flowId: string): Promise<DraftSync>;
333
336
  getRevision(flowId: string, revisionId: string): Promise<Draft>;
334
337
  listConnectorProviders(signal?: AbortSignal, flowId?: string): Promise<readonly ConnectorProvider[]>;
335
338
  listConnectorActions(serviceId?: string, signal?: AbortSignal, flowId?: string): Promise<readonly ConnectorAction[]>;
@@ -337,7 +340,7 @@ export declare class ControlClient {
337
340
  getConnectorAction(actionId: string, signal?: AbortSignal, flowId?: string): Promise<ConnectorAction>;
338
341
  listConnectorConnections(serviceId: string, signal?: AbortSignal, flowId?: string): Promise<readonly ConnectorConnection[]>;
339
342
  createConnectorConnectionPage(serviceId: string, flowId?: string): Promise<string>;
340
- changeDraft(flowId: string, expectedRevisionId: string, operations: readonly ChangeOperation[]): Promise<DraftChange>;
343
+ changeDraft(flowId: string, expectedRevisionId: string, operations: readonly ChangeOperation[], changeId?: string): Promise<DraftChange>;
341
344
  checkFlow(flowId: string, revisionId: string): Promise<FlowCheck>;
342
345
  getLive(flowId: string): Promise<Live>;
343
346
  listPublications(flowId: string, options?: {
@@ -362,6 +365,15 @@ export declare class ControlClient {
362
365
  }): Promise<RunEvents>;
363
366
  getRunResult(runId: string): Promise<RunResult>;
364
367
  cancelRun(runId: string): Promise<RunCancellation>;
368
+ resolveRunWait(runId: string, waitId: string, action: WaitAction): Promise<{
369
+ readonly action: WaitAction | null;
370
+ readonly resolutionAccepted: boolean;
371
+ readonly resolvedAt: string | null;
372
+ readonly runId: string;
373
+ readonly status: RunStatus;
374
+ readonly version: 1;
375
+ readonly waitId: string;
376
+ }>;
365
377
  private connectorActions;
366
378
  protected request<Value = unknown>(path: string, init?: RequestInit): Promise<Value>;
367
379
  }