@oomol-lab/open-flow 0.1.0-alpha.5 → 0.1.0-alpha.6

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 (37) hide show
  1. package/dist/browser/{addNodeOptions-B6tOfd2Y.js → addNodeOptions-C4wix0_u.js} +957 -1377
  2. package/dist/browser/{createLucideIcon-BlEx4FzJ.js → createLucideIcon-ggJB9CTC.js} +6 -37
  3. package/dist/browser/{createResourceDialog-CrBp3E8P.js → createResourceDialog-CESUCxOM.js} +2 -2
  4. package/dist/browser/{field-Daq9Lk-Y.js → field-CIrv7Rez.js} +1 -1
  5. package/dist/browser/{project-authoring-edge.d.ts → flow-authoring-edge.d.ts} +1 -1
  6. package/dist/browser/{project-authoring-module.d.ts → flow-authoring-module.d.ts} +1 -1
  7. package/dist/browser/{project-authoring-node.d.ts → flow-authoring-node.d.ts} +6 -12
  8. package/dist/browser/flow-authoring.d.ts +3 -0
  9. package/dist/browser/{project-authoring.js → flow-authoring.js} +43 -68
  10. package/dist/browser/{project-change.d.ts → flow-change.d.ts} +11 -26
  11. package/dist/browser/{project-change.js → flow-change.js} +8 -39
  12. package/dist/browser/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
  13. package/dist/browser/{flowWorkspace-CylW6hge.js → flowWorkspace-Bo0bz1Uz.js} +6351 -6516
  14. package/dist/browser/workbench-contract.d.ts +4 -4
  15. package/dist/browser/workbench.css +1 -1
  16. package/dist/browser/workbench.d.ts +1 -1
  17. package/dist/browser/workbench.js +896 -1051
  18. package/dist/common/control-api-conformance.js +136 -360
  19. package/dist/common/control-api-errors.d.ts +16 -24
  20. package/dist/common/control-api.d.ts +38 -67
  21. package/dist/common/control-api.js +135 -188
  22. package/dist/common/cron-trigger.d.ts +1 -1
  23. package/dist/common/{project-encoding.d.ts → flow-encoding.d.ts} +3 -3
  24. package/dist/common/{project-encoding.js → flow-encoding.js} +3 -6
  25. package/dist/common/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
  26. package/dist/common/{project-semantics.d.ts → flow-semantics.d.ts} +9 -12
  27. package/dist/common/{project-semantics.js → flow-semantics.js} +100 -110
  28. package/dist/common/integration-trigger.d.ts +1 -1
  29. package/dist/common/poll-trigger.d.ts +1 -1
  30. package/dist/common/runtime-contract.d.ts +1 -1
  31. package/dist/common/scheduler.d.ts +3 -2
  32. package/dist/common/scheduler.js +4 -4
  33. package/dist/common/webhook-trigger.d.ts +1 -1
  34. package/dist/common/webhook-trigger.js +1 -1
  35. package/package.json +13 -13
  36. package/dist/browser/project-authoring-flow.d.ts +0 -4
  37. package/dist/browser/project-authoring.d.ts +0 -4
@@ -91,23 +91,15 @@ function L() {
91
91
  throw new I();
92
92
  }
93
93
  function ae(e, t) {
94
- let n = t.kind == "flow" ? e.flows[t.id] : e.subflows[t.id];
94
+ if (t.kind == "flow") return e.graph;
95
+ let n = e.subflows[t.id];
95
96
  return n ?? L(), n.graph;
96
97
  }
97
98
  function oe(e, t, n) {
98
- if (t.kind == "flow") {
99
- let r = e.flows[t.id];
100
- return r ?? L(), {
101
- ...e,
102
- flows: {
103
- ...e.flows,
104
- [t.id]: {
105
- ...r,
106
- graph: n
107
- }
108
- }
109
- };
110
- }
99
+ if (t.kind == "flow") return {
100
+ ...e,
101
+ graph: n
102
+ };
111
103
  let r = e.subflows[t.id];
112
104
  return r ?? L(), {
113
105
  ...e,
@@ -157,29 +149,6 @@ function se(e, t) {
157
149
  delete t[e.bindingId], n.bindings = t;
158
150
  break;
159
151
  }
160
- case "flow.create":
161
- n.flows[e.flowId] != null && L(), n.flows = {
162
- ...n.flows,
163
- [e.flowId]: e.flow
164
- };
165
- break;
166
- case "flow.delete": {
167
- n.flows[e.flowId] ?? L();
168
- let t = { ...n.flows };
169
- delete t[e.flowId], n.flows = t;
170
- break;
171
- }
172
- case "flow.rename": {
173
- let t = n.flows[e.flowId];
174
- t ?? L(), n.flows = {
175
- ...n.flows,
176
- [e.flowId]: {
177
- ...t,
178
- name: e.name
179
- }
180
- };
181
- break;
182
- }
183
152
  case "graph.edge.connect": {
184
153
  let t = ae(n, e.target);
185
154
  t.nodes[e.edge.source] ?? L();
@@ -1,5 +1,5 @@
1
- import { $n as e, A as t, D as n, Ft as r, Hr as i, Jn as a, Nn as o, Nt as s, O as c, Pn as l, R as u, S as d, T as f, Y as p, _ as m, _t as h, b as g, c as _, ct as v, er as y, fr as b, it as x, j as S, lr as C, lt as w, nt as T, pt as E, rr as D, st as O, t as k, v as A, vr as j, y as M } from "./createLucideIcon-BlEx4FzJ.js";
2
- import { a as N, c as P, d as ee, i as te, l as ne, n as F, o as I, r as L, s as re, t as ie, u as ae } from "./field-Daq9Lk-Y.js";
1
+ import { $n as e, A as t, D as n, Ft as r, Hr as i, Jn as a, Nn as o, Nt as s, O as c, Pn as l, R as u, S as d, T as f, Y as p, _ as m, _t as h, b as g, c as _, ct as v, er as y, fr as b, it as x, j as S, lr as C, lt as w, nt as T, pt as E, rr as D, st as O, t as k, v as A, vr as j, y as M } from "./createLucideIcon-ggJB9CTC.js";
2
+ import { a as N, c as P, d as ee, i as te, l as ne, n as F, o as I, r as L, s as re, t as ie, u as ae } from "./field-CIrv7Rez.js";
3
3
  import * as R from "react";
4
4
  import { useEffect as oe, useRef as z, useState as se } from "react";
5
5
  import { Fragment as ce, jsx as B, jsxs as V } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { En as e, F as t, Mt as n, Nt as r, O as i, Yn as a, _r as o, ar as s, er as c, k as l, kr as u, mr as d, nt as f, tr as p, vr as m } from "./createLucideIcon-BlEx4FzJ.js";
1
+ import { En as e, F as t, Mt as n, Nt as r, O as i, Yn as a, _r as o, ar as s, er as c, k as l, kr as u, mr as d, nt as f, tr as p, vr as m } from "./createLucideIcon-ggJB9CTC.js";
2
2
  import * as h from "react";
3
3
  import { useMemo as g } from "react";
4
4
  import { jsx as _ } from "react/jsx-runtime";
@@ -1,3 +1,3 @@
1
- import type { ChangeOperation, GraphEdge, GraphTarget, RevisionContent } from './project-change.js';
1
+ import type { ChangeOperation, GraphEdge, GraphTarget, RevisionContent } from './flow-change.js';
2
2
  export declare function connect(content: RevisionContent, target: GraphTarget, edge: GraphEdge): readonly ChangeOperation[];
3
3
  export declare function disconnect(content: RevisionContent, target: GraphTarget, edge: GraphEdge): readonly ChangeOperation[];
@@ -1,4 +1,4 @@
1
- import type { ChangeOperation } from './project-change.js';
1
+ import type { ChangeOperation } from './flow-change.js';
2
2
  export declare function imports(source: string): Promise<readonly string[]>;
3
3
  export declare function replaceSource(moduleId: string, source: string, moduleImports: readonly string[]): readonly ChangeOperation[];
4
4
  export declare function rename(moduleId: string, name: string): readonly ChangeOperation[];
@@ -1,4 +1,4 @@
1
- import type { ChangeOperation, CodeModule, GraphTarget, JsonValue, PortDefinition, RevisionContent, TaskDefinition, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookOptions } from './project-change.js';
1
+ import type { ChangeOperation, CodeModule, GraphTarget, JsonValue, PortDefinition, RevisionContent, TaskDefinition, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookOptions } from './flow-change.js';
2
2
  export interface Settings {
3
3
  readonly concurrency: number;
4
4
  readonly name?: string;
@@ -48,16 +48,14 @@ export declare function createLlmTask(target: GraphTarget, identity: {
48
48
  }, name: string, mode: 'chat' | 'json', outputDescription: string, options?: LlmTaskOptions): readonly ChangeOperation[];
49
49
  export declare function createCondition(target: GraphTarget, nodeId: string, name: string): readonly ChangeOperation[];
50
50
  export declare function createValue(target: GraphTarget, nodeId: string, name: string): readonly ChangeOperation[];
51
- export declare function createBuiltinTrigger(target: {
52
- readonly id: string;
51
+ export declare function createBuiltinTrigger(target: Extract<GraphTarget, {
53
52
  readonly kind: 'flow';
54
- }, nodeId: string, node: Extract<TriggerNode, {
53
+ }>, nodeId: string, node: Extract<TriggerNode, {
55
54
  readonly kind: 'cron' | 'webhook';
56
55
  }>): readonly ChangeOperation[];
57
- export declare function createProviderTrigger(target: {
58
- readonly id: string;
56
+ export declare function createProviderTrigger(target: Extract<GraphTarget, {
59
57
  readonly kind: 'flow';
60
- }, identity: {
58
+ }>, identity: {
61
59
  readonly bindingId: string;
62
60
  readonly nodeId: string;
63
61
  }, definition: TriggerKeySnapshot, options: {
@@ -72,19 +70,15 @@ export declare function setInputValue(content: RevisionContent, target: GraphTar
72
70
  export declare function setInputValues(content: RevisionContent, target: GraphTarget, nodeId: string, values: Readonly<Record<string, JsonValue | undefined>>): readonly ChangeOperation[] | undefined;
73
71
  export declare function setConnectorConnection(content: RevisionContent, taskId: string, connectionId: string): readonly ChangeOperation[] | undefined;
74
72
  export declare function updateTrigger(content: RevisionContent, target: {
75
- readonly id: string;
76
73
  readonly kind: 'flow';
77
74
  }, nodeId: string, settings: TriggerSettings): readonly ChangeOperation[] | undefined;
78
75
  export declare function updateTriggerConfig(content: RevisionContent, target: {
79
- readonly id: string;
80
76
  readonly kind: 'flow';
81
77
  }, nodeId: string, name: string, value: JsonValue | undefined): readonly ChangeOperation[] | undefined;
82
78
  export declare function updateTriggerSchedule(content: RevisionContent, target: {
83
- readonly id: string;
84
79
  readonly kind: 'flow';
85
80
  }, nodeId: string, schedule: readonly TriggerSchedule[]): readonly ChangeOperation[] | undefined;
86
- export declare function setTriggerConnection(content: RevisionContent, target: {
87
- readonly id: string;
81
+ export declare function setTriggerConnection(content: RevisionContent, _target: {
88
82
  readonly kind: 'flow';
89
83
  }, nodeId: string, connectionId: string): readonly ChangeOperation[] | undefined;
90
84
  export {};
@@ -0,0 +1,3 @@
1
+ export { connect, disconnect } from './flow-authoring-edge.js';
2
+ export { imports as moduleImports, rename as renameModule, replaceSource as replaceModuleSource } from './flow-authoring-module.js';
3
+ export { createBuiltinTrigger, createCodeTask, createCondition, createLlmTask, createManagedTask, createProviderTrigger, createValue, deleteNodes, setConnectorConnection, setInputValues, setTriggerConnection, updateSettings, updateTrigger, } from './flow-authoring-node.js';
@@ -1,4 +1,4 @@
1
- //#region src/project/common/edgeChanges.ts
1
+ //#region src/flow/common/edgeChanges.ts
2
2
  function e(e, t, r) {
3
3
  let i = {
4
4
  source: r.source,
@@ -26,36 +26,11 @@ function t(e, t, r) {
26
26
  }];
27
27
  }
28
28
  function n(e, t) {
29
- return t.kind == "flow" ? e.document.flows[t.id]?.graph : e.document.subflows[t.id]?.graph;
29
+ return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
30
30
  }
31
31
  //#endregion
32
- //#region src/project/common/flowChanges.ts
33
- function r(e, t) {
34
- return [{
35
- flow: {
36
- graph: { nodes: {} },
37
- name: t
38
- },
39
- flowId: e,
40
- kind: "flow.create"
41
- }];
42
- }
43
- function i(e, t) {
44
- return [{
45
- flowId: e,
46
- kind: "flow.rename",
47
- name: t
48
- }];
49
- }
50
- function a(e) {
51
- return [{
52
- flowId: e,
53
- kind: "flow.delete"
54
- }];
55
- }
56
- //#endregion
57
- //#region src/project/common/moduleChanges.ts
58
- async function o(e) {
32
+ //#region src/flow/common/moduleChanges.ts
33
+ async function r(e) {
59
34
  try {
60
35
  let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
61
36
  errorRecovery: !0,
@@ -71,7 +46,7 @@ async function o(e) {
71
46
  return [];
72
47
  }
73
48
  }
74
- function s(e, t, n) {
49
+ function i(e, t, n) {
75
50
  return [{
76
51
  imports: n,
77
52
  kind: "module.source.replace",
@@ -79,7 +54,7 @@ function s(e, t, n) {
79
54
  source: t
80
55
  }];
81
56
  }
82
- function c(e, t) {
57
+ function a(e, t) {
83
58
  return [{
84
59
  kind: "module.rename",
85
60
  moduleId: e,
@@ -87,8 +62,8 @@ function c(e, t) {
87
62
  }];
88
63
  }
89
64
  //#endregion
90
- //#region src/project/common/nodeChanges.ts
91
- function l(e, t, n, r = {
65
+ //#region src/flow/common/nodeChanges.ts
66
+ function o(e, t, n, r = {
92
67
  imports: [],
93
68
  source: "export default function run(input) {\n return { result: input.value }\n}\n"
94
69
  }, i = {
@@ -113,7 +88,7 @@ function l(e, t, n, r = {
113
88
  kind: "graph.node.create",
114
89
  node: {
115
90
  concurrency: 1,
116
- inputs: C(i.inputs),
91
+ inputs: b(i.inputs),
117
92
  kind: "task",
118
93
  name: n,
119
94
  task: {
@@ -127,7 +102,7 @@ function l(e, t, n, r = {
127
102
  target: e
128
103
  }];
129
104
  }
130
- function u(e, t, n) {
105
+ function s(e, t, n) {
131
106
  return [{
132
107
  kind: "task.create",
133
108
  task: n,
@@ -136,7 +111,7 @@ function u(e, t, n) {
136
111
  kind: "graph.node.create",
137
112
  node: {
138
113
  concurrency: 1,
139
- inputs: C(n.inputs),
114
+ inputs: b(n.inputs),
140
115
  kind: "task",
141
116
  name: n.name,
142
117
  taskId: t.taskId
@@ -145,9 +120,9 @@ function u(e, t, n) {
145
120
  target: e
146
121
  }];
147
122
  }
148
- function d(e, t, n, r, i, a = {}) {
123
+ function c(e, t, n, r, i, a = {}) {
149
124
  let o = a.inputs ?? {};
150
- return u(e, t, {
125
+ return s(e, t, {
151
126
  executor: {
152
127
  kind: "llm",
153
128
  mode: r
@@ -159,12 +134,12 @@ function d(e, t, n, r, i, a = {}) {
159
134
  type: "array"
160
135
  },
161
136
  nullable: !0,
162
- value: w(o, "messages", null)
137
+ value: x(o, "messages", null)
163
138
  },
164
139
  input: {
165
140
  jsonSchema: { type: "string" },
166
141
  nullable: !1,
167
- value: w(o, "input", "Alex")
142
+ value: x(o, "input", "Alex")
168
143
  },
169
144
  template: {
170
145
  jsonSchema: {
@@ -173,7 +148,7 @@ function d(e, t, n, r, i, a = {}) {
173
148
  type: "array"
174
149
  },
175
150
  nullable: !1,
176
- value: w(o, "template", [{
151
+ value: x(o, "template", [{
177
152
  content: "Hello, I'm {{input}}",
178
153
  role: "user"
179
154
  }])
@@ -181,7 +156,7 @@ function d(e, t, n, r, i, a = {}) {
181
156
  model: {
182
157
  jsonSchema: { type: "object" },
183
158
  nullable: !1,
184
- value: w(o, "model", { model: "deepseek-v4-flash" })
159
+ value: x(o, "model", { model: "deepseek-v4-flash" })
185
160
  }
186
161
  },
187
162
  name: n,
@@ -192,7 +167,7 @@ function d(e, t, n, r, i, a = {}) {
192
167
  } }
193
168
  });
194
169
  }
195
- function f(e, t, n) {
170
+ function l(e, t, n) {
196
171
  return [{
197
172
  kind: "graph.node.create",
198
173
  node: {
@@ -223,7 +198,7 @@ function f(e, t, n) {
223
198
  target: e
224
199
  }];
225
200
  }
226
- function p(e, t, n) {
201
+ function u(e, t, n) {
227
202
  return [{
228
203
  kind: "graph.node.create",
229
204
  node: {
@@ -241,7 +216,7 @@ function p(e, t, n) {
241
216
  target: e
242
217
  }];
243
218
  }
244
- function m(e, t, n) {
219
+ function d(e, t, n) {
245
220
  return [{
246
221
  kind: "graph.node.create",
247
222
  node: n,
@@ -249,7 +224,7 @@ function m(e, t, n) {
249
224
  target: e
250
225
  }];
251
226
  }
252
- function h(e, t, n, r) {
227
+ function f(e, t, n, r) {
253
228
  let i = r.name ?? n.displayName, a = n.type == "poll" ? {
254
229
  bindingId: t.bindingId,
255
230
  config: r.config,
@@ -282,8 +257,8 @@ function h(e, t, n, r) {
282
257
  target: e
283
258
  }];
284
259
  }
285
- function g(e, t, n) {
286
- let r = S(e, t)?.nodes;
260
+ function p(e, t, n) {
261
+ let r = y(e, t)?.nodes;
287
262
  if (r == null) return [];
288
263
  let i = new Set(n), a = n.flatMap((e) => {
289
264
  let n = r[e];
@@ -301,35 +276,35 @@ function g(e, t, n) {
301
276
  let t = r[e];
302
277
  return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
303
278
  }));
304
- for (let n of o) Object.entries(e.document.flows).some(([e, r]) => Object.entries(r.graph.nodes).some(([r, a]) => !(e == t.id && i.has(r)) && (a.kind == "poll" || a.kind == "integration") && a.bindingId == n)) || a.push({
305
- bindingId: n,
279
+ for (let t of o) Object.entries(e.document.graph.nodes).some(([e, n]) => !i.has(e) && (n.kind == "poll" || n.kind == "integration") && n.bindingId == t) || a.push({
280
+ bindingId: t,
306
281
  kind: "binding.delete"
307
282
  });
308
283
  return a;
309
284
  }
310
- function _(e, t, n, r) {
311
- let i = S(e, t)?.nodes[n];
285
+ function m(e, t, n, r) {
286
+ let i = y(e, t)?.nodes[n];
312
287
  if (i == null || !("inputs" in i)) return;
313
288
  let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
314
- return T(t, n, {
289
+ return S(t, n, {
315
290
  ...c,
316
291
  ...r
317
292
  });
318
293
  }
319
- function v(e, t, n, r) {
320
- let i = S(e, t)?.nodes[n];
294
+ function h(e, t, n, r) {
295
+ let i = y(e, t)?.nodes[n];
321
296
  if (i == null || !("inputs" in i)) return;
322
297
  let a = { ...i.inputs };
323
298
  for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
324
299
  kind: "value",
325
300
  value: t
326
301
  };
327
- return T(t, n, {
302
+ return S(t, n, {
328
303
  ...i,
329
304
  inputs: a
330
305
  });
331
306
  }
332
- function y(e, t, n) {
307
+ function g(e, t, n) {
333
308
  let r = e.document.tasks[t];
334
309
  if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
335
310
  kind: "task.replace",
@@ -343,8 +318,8 @@ function y(e, t, n) {
343
318
  taskId: t
344
319
  }];
345
320
  }
346
- function b(e, t, n, r) {
347
- let i = e.document.flows[t.id]?.graph.nodes[n];
321
+ function _(e, t, n, r) {
322
+ let i = e.document.graph.nodes[n];
348
323
  if (i == null) return;
349
324
  let a = {
350
325
  ...r.description == null ? {} : { description: r.description },
@@ -389,10 +364,10 @@ function b(e, t, n, r) {
389
364
  config: r.config
390
365
  };
391
366
  }
392
- return T(t, n, o);
367
+ return S(t, n, o);
393
368
  }
394
- function x(e, t, n, r) {
395
- let i = e.document.flows[t.id]?.graph.nodes[n];
369
+ function v(e, t, n, r) {
370
+ let i = e.document.graph.nodes[n];
396
371
  if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
397
372
  binding: {
398
373
  kind: "connection",
@@ -402,19 +377,19 @@ function x(e, t, n, r) {
402
377
  kind: "binding.replace"
403
378
  }];
404
379
  }
405
- function S(e, t) {
406
- return t.kind == "flow" ? e.document.flows[t.id]?.graph : e.document.subflows[t.id]?.graph;
380
+ function y(e, t) {
381
+ return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
407
382
  }
408
- function C(e) {
383
+ function b(e) {
409
384
  return Object.fromEntries(Object.entries(e).flatMap(([e, t]) => Object.hasOwn(t, "value") ? [[e, {
410
385
  kind: "value",
411
386
  value: t.value
412
387
  }]] : []));
413
388
  }
414
- function w(e, t, n) {
389
+ function x(e, t, n) {
415
390
  return e != null && Object.hasOwn(e, t) ? e[t] : n;
416
391
  }
417
- function T(e, t, n) {
392
+ function S(e, t, n) {
418
393
  return [{
419
394
  kind: "graph.node.replace",
420
395
  node: n,
@@ -423,4 +398,4 @@ function T(e, t, n) {
423
398
  }];
424
399
  }
425
400
  //#endregion
426
- export { e as connect, m as createBuiltinTrigger, l as createCodeTask, f as createCondition, r as createFlow, d as createLlmTask, u as createManagedTask, h as createProviderTrigger, p as createValue, a as deleteFlow, g as deleteNodes, t as disconnect, o as moduleImports, i as renameFlow, c as renameModule, s as replaceModuleSource, y as setConnectorConnection, v as setInputValues, x as setTriggerConnection, _ as updateSettings, b as updateTrigger };
401
+ export { e as connect, d as createBuiltinTrigger, o as createCodeTask, l as createCondition, c as createLlmTask, s as createManagedTask, f as createProviderTrigger, u as createValue, p as deleteNodes, t as disconnect, r as moduleImports, a as renameModule, i as replaceModuleSource, g as setConnectorConnection, h as setInputValues, v as setTriggerConnection, m as updateSettings, _ as updateTrigger };
@@ -182,15 +182,12 @@ export type TriggerNode = (TriggerNodeBase & {
182
182
  readonly kind: 'integration';
183
183
  });
184
184
  export type GraphNode = ConditionNode | SubflowNode | TaskNode | TriggerNode | ValueNode;
185
- export interface ProjectDocument {
185
+ export interface FlowDocument {
186
186
  readonly bindings: Readonly<Record<string, {
187
187
  readonly kind: 'connection' | 'secret';
188
188
  readonly target: string;
189
189
  }>>;
190
- readonly flows: Readonly<Record<string, {
191
- readonly graph: Graph;
192
- readonly name: string;
193
- }>>;
190
+ readonly graph: Graph;
194
191
  readonly subflows: Readonly<Record<string, {
195
192
  readonly graph: Graph;
196
193
  readonly inputs: Readonly<Record<string, InputPortDefinition>>;
@@ -205,12 +202,11 @@ export interface CodeModule {
205
202
  readonly source: string;
206
203
  }
207
204
  export interface RevisionContent {
208
- readonly document: ProjectDocument;
205
+ readonly document: FlowDocument;
209
206
  readonly modelVersion: 1;
210
207
  readonly modules: Readonly<Record<string, CodeModule>>;
211
208
  }
212
209
  export type GraphTarget = {
213
- readonly id: string;
214
210
  readonly kind: 'flow';
215
211
  } | {
216
212
  readonly id: string;
@@ -223,27 +219,16 @@ export interface GraphEdge {
223
219
  readonly targetHandle: string;
224
220
  }
225
221
  export type ChangeOperation = {
226
- readonly binding: ProjectDocument['bindings'][string];
222
+ readonly binding: FlowDocument['bindings'][string];
227
223
  readonly bindingId: string;
228
224
  readonly kind: 'binding.create';
229
225
  } | {
230
- readonly binding: ProjectDocument['bindings'][string];
226
+ readonly binding: FlowDocument['bindings'][string];
231
227
  readonly bindingId: string;
232
228
  readonly kind: 'binding.replace';
233
229
  } | {
234
230
  readonly bindingId: string;
235
231
  readonly kind: 'binding.delete';
236
- } | {
237
- readonly flow: ProjectDocument['flows'][string];
238
- readonly flowId: string;
239
- readonly kind: 'flow.create';
240
- } | {
241
- readonly flowId: string;
242
- readonly kind: 'flow.delete';
243
- } | {
244
- readonly flowId: string;
245
- readonly kind: 'flow.rename';
246
- readonly name: string;
247
232
  } | {
248
233
  readonly kind: 'graph.edge.connect';
249
234
  readonly edge: GraphEdge;
@@ -284,10 +269,10 @@ export type ChangeOperation = {
284
269
  readonly source: string;
285
270
  } | {
286
271
  readonly kind: 'subflow.create';
287
- readonly subflow: ProjectDocument['subflows'][string];
272
+ readonly subflow: FlowDocument['subflows'][string];
288
273
  readonly subflowId: string;
289
274
  } | {
290
- readonly definition: Omit<ProjectDocument['subflows'][string], 'graph'>;
275
+ readonly definition: Omit<FlowDocument['subflows'][string], 'graph'>;
291
276
  readonly kind: 'subflow.definition.replace';
292
277
  readonly subflowId: string;
293
278
  } | {
@@ -295,17 +280,17 @@ export type ChangeOperation = {
295
280
  readonly subflowId: string;
296
281
  } | {
297
282
  readonly kind: 'task.create';
298
- readonly task: ProjectDocument['tasks'][string];
283
+ readonly task: FlowDocument['tasks'][string];
299
284
  readonly taskId: string;
300
285
  } | {
301
286
  readonly kind: 'task.delete';
302
287
  readonly taskId: string;
303
288
  } | {
304
289
  readonly kind: 'task.replace';
305
- readonly task: ProjectDocument['tasks'][string];
290
+ readonly task: FlowDocument['tasks'][string];
306
291
  readonly taskId: string;
307
292
  };
308
- export declare class ProjectChangeError extends Error {
293
+ export declare class FlowChangeError extends Error {
309
294
  }
310
- export declare function applyProjectChanges(content: RevisionContent, operations: readonly ChangeOperation[]): RevisionContent;
295
+ export declare function applyFlowChanges(content: RevisionContent, operations: readonly ChangeOperation[]): RevisionContent;
311
296
  export {};
@@ -1,4 +1,4 @@
1
- //#region src/project/common/change.ts
1
+ //#region src/flow/common/change.ts
2
2
  var e = 80;
3
3
  function t(e) {
4
4
  let t = e.trim();
@@ -15,23 +15,15 @@ function r() {
15
15
  throw new n();
16
16
  }
17
17
  function i(e, t) {
18
- let n = t.kind == "flow" ? e.flows[t.id] : e.subflows[t.id];
18
+ if (t.kind == "flow") return e.graph;
19
+ let n = e.subflows[t.id];
19
20
  return n ?? r(), n.graph;
20
21
  }
21
22
  function a(e, t, n) {
22
- if (t.kind == "flow") {
23
- let i = e.flows[t.id];
24
- return i ?? r(), {
25
- ...e,
26
- flows: {
27
- ...e.flows,
28
- [t.id]: {
29
- ...i,
30
- graph: n
31
- }
32
- }
33
- };
34
- }
23
+ if (t.kind == "flow") return {
24
+ ...e,
25
+ graph: n
26
+ };
35
27
  let i = e.subflows[t.id];
36
28
  return i ?? r(), {
37
29
  ...e,
@@ -81,29 +73,6 @@ function s(e, t) {
81
73
  delete t[e.bindingId], n.bindings = t;
82
74
  break;
83
75
  }
84
- case "flow.create":
85
- n.flows[e.flowId] != null && r(), n.flows = {
86
- ...n.flows,
87
- [e.flowId]: e.flow
88
- };
89
- break;
90
- case "flow.delete": {
91
- n.flows[e.flowId] ?? r();
92
- let t = { ...n.flows };
93
- delete t[e.flowId], n.flows = t;
94
- break;
95
- }
96
- case "flow.rename": {
97
- let t = n.flows[e.flowId];
98
- t ?? r(), n.flows = {
99
- ...n.flows,
100
- [e.flowId]: {
101
- ...t,
102
- name: e.name
103
- }
104
- };
105
- break;
106
- }
107
76
  case "graph.edge.connect": {
108
77
  let t = i(n, e.target);
109
78
  t.nodes[e.edge.source] ?? r();
@@ -256,4 +225,4 @@ function s(e, t) {
256
225
  };
257
226
  }
258
227
  //#endregion
259
- export { n as ProjectChangeError, s as applyProjectChanges, t as resourceNameIssue, e as resourceNameMaxLength };
228
+ export { n as FlowChangeError, s as applyFlowChanges, t as resourceNameIssue, e as resourceNameMaxLength };
@@ -1,12 +1,15 @@
1
- export type ProjectChangeEvent = {
1
+ export interface FlowCatalogEvent {
2
+ readonly kind: 'flows.changed';
3
+ readonly version: 1;
4
+ }
5
+ export type FlowChangeEvent = {
2
6
  readonly kind: 'draft.changed';
3
- readonly projectId: string;
7
+ readonly flowId: string;
4
8
  readonly revisionId: string;
5
9
  readonly version: 1;
6
10
  } | {
7
11
  readonly flowId: string;
8
12
  readonly kind: 'run.created';
9
- readonly projectId: string;
10
13
  readonly runId: string;
11
14
  readonly version: 1;
12
15
  };