@oomol-lab/open-flow 0.1.0-beta.5 → 0.1.0-beta.7
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.
- package/dist/browser/{createResourceDialog-Cf7QpXp6.js → createResourceDialog-DNBueSYZ.js} +2 -2
- package/dist/browser/{esm-xWDFFpGd.js → esm-DZSIl5hJ.js} +1 -1
- package/dist/browser/flow-authoring.js +52 -42
- package/dist/browser/flow-change.d.ts +3 -0
- package/dist/browser/flow-change.js +46 -42
- package/dist/browser/{flowChanges-CeMiiZIO.js → flowChanges-CixKyW54.js} +980 -954
- package/dist/browser/{flowWorkspace-VnS8nLMT.js → flowWorkspace-DnsRkjYz.js} +14919 -14970
- package/dist/browser/{icons-CRxvozBE.js → icons-KIOgjHpD.js} +47 -43
- package/dist/browser/{typeScriptSession-Bj2HDFRd.js → typeScriptSession-_TgJ_7Oq.js} +1 -1
- package/dist/browser/{waitNotificationInputs-ClCAEIAM.js → waitNotificationInputs-Doc3I12s.js} +1 -1
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.js +358 -299
- package/dist/browser/{workbenchSelect-Cf1zlVm9.js → workbenchSelect-CbXrdwxW.js} +1 -1
- package/dist/common/control-api-conformance.js +12 -4
- package/dist/common/flow-encoding.js +4 -0
- package/dist/common/flow-semantics.js +8 -10
- package/dist/common/runtime-contract.d.ts +1 -1
- package/dist/common/runtime-contract.js +27 -0
- package/dist/common/scheduler.d.ts +1 -1
- package/dist/common/scheduler.js +17 -18
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -36,14 +36,18 @@ function i(e) {
|
|
|
36
36
|
function a(e) {
|
|
37
37
|
return Object.fromEntries(e.flatMap((e) => "handle" in e ? [[e.handle, e]] : []));
|
|
38
38
|
}
|
|
39
|
-
var o = class extends Error {
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
var o = class extends Error {
|
|
40
|
+
constructor(e) {
|
|
41
|
+
super(e), this.name = "FlowChangeError";
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
function s(e) {
|
|
45
|
+
throw new o(e);
|
|
42
46
|
}
|
|
43
47
|
function c(e, t) {
|
|
44
48
|
if (t.kind == "flow") return e.graph;
|
|
45
49
|
let n = e.subflows[t.id];
|
|
46
|
-
return n ?? s(), n.graph;
|
|
50
|
+
return n ?? s("The target Subflow does not exist."), n.graph;
|
|
47
51
|
}
|
|
48
52
|
function l(e, t, n) {
|
|
49
53
|
if (t.kind == "flow") return {
|
|
@@ -51,7 +55,7 @@ function l(e, t, n) {
|
|
|
51
55
|
graph: n
|
|
52
56
|
};
|
|
53
57
|
let r = e.subflows[t.id];
|
|
54
|
-
return r ?? s(), {
|
|
58
|
+
return r ?? s("The target Subflow does not exist."), {
|
|
55
59
|
...e,
|
|
56
60
|
subflows: {
|
|
57
61
|
...e.subflows,
|
|
@@ -82,20 +86,20 @@ function d(e, n) {
|
|
|
82
86
|
let r = { ...e.document }, i = { ...e.modules };
|
|
83
87
|
for (let e of n) switch (e.kind) {
|
|
84
88
|
case "binding.create":
|
|
85
|
-
r.bindings[e.bindingId] != null && s(), r.bindings = {
|
|
89
|
+
r.bindings[e.bindingId] != null && s("A Binding with this ID already exists."), r.bindings = {
|
|
86
90
|
...r.bindings,
|
|
87
91
|
[e.bindingId]: e.binding
|
|
88
92
|
};
|
|
89
93
|
break;
|
|
90
94
|
case "binding.delete": {
|
|
91
|
-
r.bindings[e.bindingId] ?? s();
|
|
95
|
+
r.bindings[e.bindingId] ?? s("The Binding does not exist.");
|
|
92
96
|
let t = { ...r.bindings };
|
|
93
97
|
delete t[e.bindingId], r.bindings = t;
|
|
94
98
|
break;
|
|
95
99
|
}
|
|
96
100
|
case "binding.target.set": {
|
|
97
101
|
let t = r.bindings[e.bindingId];
|
|
98
|
-
|
|
102
|
+
t ?? s("The Binding does not exist."), t.target != e.before && s("The Binding target changed before this operation was applied."), r.bindings = {
|
|
99
103
|
...r.bindings,
|
|
100
104
|
[e.bindingId]: {
|
|
101
105
|
...t,
|
|
@@ -106,17 +110,17 @@ function d(e, n) {
|
|
|
106
110
|
}
|
|
107
111
|
case "graph.edge.connect": {
|
|
108
112
|
let n = c(r, e.target);
|
|
109
|
-
n.nodes[e.edge.source] ?? s();
|
|
113
|
+
n.nodes[e.edge.source] ?? s("The source Node does not exist.");
|
|
110
114
|
let i = n.nodes[e.edge.target];
|
|
111
|
-
(i == null || !("inputs" in i)) && s();
|
|
115
|
+
(i == null || !("inputs" in i)) && s("The target Node does not accept inputs.");
|
|
112
116
|
let a = i.inputs[e.edge.targetHandle];
|
|
113
|
-
t(a, e.before) || s();
|
|
117
|
+
t(a, e.before) || s("The target input changed before this operation was applied.");
|
|
114
118
|
let o = {
|
|
115
119
|
kind: "node",
|
|
116
120
|
nodeId: e.edge.source,
|
|
117
121
|
output: e.edge.sourceHandle
|
|
118
122
|
}, u = a?.kind == "sources" ? a.sources.filter((e) => e.kind != "binding" || r.bindings[e.bindingId]?.kind != "variable") : [];
|
|
119
|
-
u.some((e) => e.kind == "node" && e.nodeId == o.nodeId && e.output == o.output) && s();
|
|
123
|
+
u.some((e) => e.kind == "node" && e.nodeId == o.nodeId && e.output == o.output) && s("The Nodes are already connected.");
|
|
120
124
|
let d = {
|
|
121
125
|
...i,
|
|
122
126
|
inputs: {
|
|
@@ -135,11 +139,11 @@ function d(e, n) {
|
|
|
135
139
|
}
|
|
136
140
|
case "graph.edge.disconnect": {
|
|
137
141
|
let n = c(r, e.target), i = n.nodes[e.edge.target];
|
|
138
|
-
(i == null || !("inputs" in i)) && s();
|
|
142
|
+
(i == null || !("inputs" in i)) && s("The target Node does not accept inputs.");
|
|
139
143
|
let a = i.inputs[e.edge.targetHandle];
|
|
140
|
-
(a?.kind != "sources" || !t(a, e.before)) && s();
|
|
144
|
+
(a?.kind != "sources" || !t(a, e.before)) && s("The target input changed before this operation was applied.");
|
|
141
145
|
let o = a.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
|
|
142
|
-
o.length == a.sources.length && s();
|
|
146
|
+
o.length == a.sources.length && s("The Nodes are not connected.");
|
|
143
147
|
let u = { ...i.inputs };
|
|
144
148
|
o.length == 0 ? delete u[e.edge.targetHandle] : u[e.edge.targetHandle] = {
|
|
145
149
|
kind: "sources",
|
|
@@ -155,7 +159,7 @@ function d(e, n) {
|
|
|
155
159
|
}
|
|
156
160
|
case "graph.node.additional-inputs.set": {
|
|
157
161
|
let n = c(r, e.target), i = n.nodes[e.nodeId];
|
|
158
|
-
|
|
162
|
+
i?.kind != "task" && s("The Task Node does not exist."), t(i.additionalInputs, e.before) || s("The Task Node inputs changed before this operation was applied.");
|
|
159
163
|
let { additionalInputs: a, ...o } = i, u = e.value == null ? o : {
|
|
160
164
|
...o,
|
|
161
165
|
additionalInputs: e.value
|
|
@@ -168,7 +172,7 @@ function d(e, n) {
|
|
|
168
172
|
}
|
|
169
173
|
case "graph.node.condition.set": {
|
|
170
174
|
let n = c(r, e.target), i = n.nodes[e.nodeId];
|
|
171
|
-
i?.kind != "condition" && s(), (!t(i.cases, e.before.cases) || i.defaultOutput != e.before.defaultOutput || !t(i.input, e.before.input)) && s();
|
|
175
|
+
i?.kind != "condition" && s("The Condition Node does not exist."), (!t(i.cases, e.before.cases) || i.defaultOutput != e.before.defaultOutput || !t(i.input, e.before.input)) && s("The Condition Node changed before this operation was applied.");
|
|
172
176
|
let { defaultOutput: a, ...o } = i, u = e.value.defaultOutput == null ? {
|
|
173
177
|
...o,
|
|
174
178
|
...e.value
|
|
@@ -184,7 +188,7 @@ function d(e, n) {
|
|
|
184
188
|
}
|
|
185
189
|
case "graph.node.create": {
|
|
186
190
|
let t = c(r, e.target);
|
|
187
|
-
|
|
191
|
+
t.nodes[e.nodeId] != null && s("A Node with this ID already exists in the target graph."), e.target.kind == "subflow" && !("inputs" in e.node) && s("Trigger Nodes cannot be created inside a Subflow."), Object.assign(r, l(r, e.target, { nodes: {
|
|
188
192
|
...t.nodes,
|
|
189
193
|
[e.nodeId]: e.node
|
|
190
194
|
} }));
|
|
@@ -192,7 +196,7 @@ function d(e, n) {
|
|
|
192
196
|
}
|
|
193
197
|
case "graph.node.delete": {
|
|
194
198
|
let t = c(r, e.target);
|
|
195
|
-
t.nodes[e.nodeId] ?? s();
|
|
199
|
+
t.nodes[e.nodeId] ?? s("The Node does not exist in the target graph.");
|
|
196
200
|
let n = /* @__PURE__ */ new Set([e.nodeId]), i = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => n.has(e) ? [] : [[e, u(t, n)]]));
|
|
197
201
|
if (Object.assign(r, l(r, e.target, { nodes: i })), e.target.kind == "subflow") {
|
|
198
202
|
let t = r.subflows[e.target.id], i = t.outputs.map((e) => ({
|
|
@@ -211,7 +215,7 @@ function d(e, n) {
|
|
|
211
215
|
}
|
|
212
216
|
case "graph.node.field.set": {
|
|
213
217
|
let n = c(r, e.target), i = n.nodes[e.nodeId];
|
|
214
|
-
|
|
218
|
+
i ?? s("The Node does not exist in the target graph."), t(Reflect.get(i, e.field), e.before) || s("The Node field changed before this operation was applied."), e.field == "concurrency" && e.value == null && s("Node concurrency cannot be removed.");
|
|
215
219
|
let a = { ...i };
|
|
216
220
|
e.value == null ? Reflect.deleteProperty(a, e.field) : Object.assign(a, { [e.field]: e.value }), Object.assign(r, l(r, e.target, { nodes: {
|
|
217
221
|
...n.nodes,
|
|
@@ -221,7 +225,7 @@ function d(e, n) {
|
|
|
221
225
|
}
|
|
222
226
|
case "graph.node.input.set": {
|
|
223
227
|
let n = c(r, e.target), i = n.nodes[e.nodeId];
|
|
224
|
-
(i == null || !("inputs" in i)
|
|
228
|
+
(i == null || !("inputs" in i)) && s("The Node does not accept inputs."), t(i.inputs[e.handle], e.before) || s("The Node input changed before this operation was applied.");
|
|
225
229
|
let a = { ...i.inputs };
|
|
226
230
|
e.value == null ? delete a[e.handle] : a[e.handle] = e.value, Object.assign(r, l(r, e.target, { nodes: {
|
|
227
231
|
...n.nodes,
|
|
@@ -234,7 +238,7 @@ function d(e, n) {
|
|
|
234
238
|
}
|
|
235
239
|
case "graph.node.task.name.set": {
|
|
236
240
|
let t = c(r, e.target), n = t.nodes[e.nodeId];
|
|
237
|
-
(n?.kind != "task" || n.task == null
|
|
241
|
+
(n?.kind != "task" || n.task == null) && s("The inline Task Node does not exist."), n.task.name != e.before && s("The inline Task name changed before this operation was applied.");
|
|
238
242
|
let i = {
|
|
239
243
|
...n,
|
|
240
244
|
task: {
|
|
@@ -250,10 +254,10 @@ function d(e, n) {
|
|
|
250
254
|
}
|
|
251
255
|
case "graph.node.task.ports.set": {
|
|
252
256
|
let n = c(r, e.target), i = n.nodes[e.nodeId];
|
|
253
|
-
(i?.kind != "task" || i.task == null
|
|
257
|
+
(i?.kind != "task" || i.task == null) && s("The inline Task Node does not exist."), t({
|
|
254
258
|
inputs: i.task.inputs,
|
|
255
259
|
outputs: i.task.outputs
|
|
256
|
-
}, e.before)
|
|
260
|
+
}, e.before) || s("The inline Task ports changed before this operation was applied.");
|
|
257
261
|
let a = {
|
|
258
262
|
...i,
|
|
259
263
|
task: {
|
|
@@ -269,7 +273,7 @@ function d(e, n) {
|
|
|
269
273
|
}
|
|
270
274
|
case "graph.node.values.set": {
|
|
271
275
|
let n = c(r, e.target), i = n.nodes[e.nodeId];
|
|
272
|
-
|
|
276
|
+
i?.kind != "value" && s("The Value Node does not exist."), t(i.values, e.before) || s("The Value Node changed before this operation was applied."), Object.assign(r, l(r, e.target, { nodes: {
|
|
273
277
|
...n.nodes,
|
|
274
278
|
[e.nodeId]: {
|
|
275
279
|
...i,
|
|
@@ -284,7 +288,7 @@ function d(e, n) {
|
|
|
284
288
|
actions: i.actions,
|
|
285
289
|
...i.notification == null ? {} : { notification: i.notification },
|
|
286
290
|
prompt: i.prompt
|
|
287
|
-
}, e.before)) && s();
|
|
291
|
+
}, e.before)) && s("The Wait Node changed before this operation was applied.");
|
|
288
292
|
let { notification: a, ...o } = i, c = e.value.notification == null ? {
|
|
289
293
|
...o,
|
|
290
294
|
...e.value
|
|
@@ -300,7 +304,7 @@ function d(e, n) {
|
|
|
300
304
|
}
|
|
301
305
|
case "graph.node.webhook.set": {
|
|
302
306
|
let n = c(r, e.target), i = n.nodes[e.nodeId];
|
|
303
|
-
|
|
307
|
+
i?.kind != "webhook" && s("The Webhook Node does not exist."), (!t(i.inputsDef, e.before.inputsDef) || !t(i.options, e.before.options)) && s("The Webhook Node changed before this operation was applied.");
|
|
304
308
|
let { options: a, ...o } = i, u = e.value.options == null ? {
|
|
305
309
|
...o,
|
|
306
310
|
inputsDef: e.value.inputsDef
|
|
@@ -316,7 +320,7 @@ function d(e, n) {
|
|
|
316
320
|
}
|
|
317
321
|
case "graph.trigger.config.set": {
|
|
318
322
|
let n = r.graph, i = n.nodes[e.nodeId];
|
|
319
|
-
(i == null || i.kind != "integration" && i.kind != "poll"
|
|
323
|
+
(i == null || i.kind != "integration" && i.kind != "poll") && s("The configurable Trigger Node does not exist."), t(i.config[e.name], e.before) || s("The Trigger configuration changed before this operation was applied.");
|
|
320
324
|
let a = { ...i.config };
|
|
321
325
|
e.value === void 0 ? delete a[e.name] : a[e.name] = e.value, r.graph = { nodes: {
|
|
322
326
|
...n.nodes,
|
|
@@ -329,7 +333,7 @@ function d(e, n) {
|
|
|
329
333
|
}
|
|
330
334
|
case "graph.trigger.schedule.set": {
|
|
331
335
|
let n = r.graph, i = n.nodes[e.nodeId];
|
|
332
|
-
(i == null || i.kind != "cron" && i.kind != "poll") && s(), t(i.kind == "cron" ? i.cronTimes : i.pollTimes, e.before) || s();
|
|
336
|
+
(i == null || i.kind != "cron" && i.kind != "poll") && s("The scheduled Trigger Node does not exist."), t(i.kind == "cron" ? i.cronTimes : i.pollTimes, e.before) || s("The Trigger schedule changed before this operation was applied.");
|
|
333
337
|
let a = i.kind == "cron" ? {
|
|
334
338
|
...i,
|
|
335
339
|
cronTimes: e.value
|
|
@@ -344,14 +348,14 @@ function d(e, n) {
|
|
|
344
348
|
break;
|
|
345
349
|
}
|
|
346
350
|
case "module.create":
|
|
347
|
-
i[e.moduleId] != null && s(), i[e.moduleId] = e.module;
|
|
351
|
+
i[e.moduleId] != null && s("A CodeModule with this ID already exists."), i[e.moduleId] = e.module;
|
|
348
352
|
break;
|
|
349
353
|
case "module.delete":
|
|
350
|
-
i[e.moduleId] ?? s(), delete i[e.moduleId];
|
|
354
|
+
i[e.moduleId] ?? s("The CodeModule does not exist."), delete i[e.moduleId];
|
|
351
355
|
break;
|
|
352
356
|
case "module.rename": {
|
|
353
357
|
let t = i[e.moduleId];
|
|
354
|
-
|
|
358
|
+
t ?? s("The CodeModule does not exist."), t.name != e.before && s("The CodeModule name changed before this operation was applied."), i[e.moduleId] = {
|
|
355
359
|
...t,
|
|
356
360
|
name: e.name
|
|
357
361
|
};
|
|
@@ -359,7 +363,7 @@ function d(e, n) {
|
|
|
359
363
|
}
|
|
360
364
|
case "module.source.replace": {
|
|
361
365
|
let n = i[e.moduleId];
|
|
362
|
-
|
|
366
|
+
n ?? s("The CodeModule does not exist."), (n.source != e.beforeSource || !t(n.imports, e.beforeImports)) && s("The CodeModule source changed before this operation was applied."), i[e.moduleId] = {
|
|
363
367
|
...n,
|
|
364
368
|
imports: e.imports,
|
|
365
369
|
source: e.source
|
|
@@ -367,18 +371,18 @@ function d(e, n) {
|
|
|
367
371
|
break;
|
|
368
372
|
}
|
|
369
373
|
case "subflow.create":
|
|
370
|
-
r.subflows[e.subflowId] != null && s(), r.subflows = {
|
|
374
|
+
r.subflows[e.subflowId] != null && s("A Subflow with this ID already exists."), r.subflows = {
|
|
371
375
|
...r.subflows,
|
|
372
376
|
[e.subflowId]: e.subflow
|
|
373
377
|
};
|
|
374
378
|
break;
|
|
375
379
|
case "subflow.definition.set": {
|
|
376
380
|
let n = r.subflows[e.subflowId];
|
|
377
|
-
|
|
381
|
+
n ?? s("The Subflow does not exist."), t({
|
|
378
382
|
inputs: n.inputs,
|
|
379
383
|
name: n.name,
|
|
380
384
|
outputs: n.outputs
|
|
381
|
-
}, e.before)
|
|
385
|
+
}, e.before) || s("The Subflow definition changed before this operation was applied."), r.subflows = {
|
|
382
386
|
...r.subflows,
|
|
383
387
|
[e.subflowId]: {
|
|
384
388
|
...e.definition,
|
|
@@ -388,20 +392,20 @@ function d(e, n) {
|
|
|
388
392
|
break;
|
|
389
393
|
}
|
|
390
394
|
case "subflow.delete": {
|
|
391
|
-
r.subflows[e.subflowId] ?? s();
|
|
395
|
+
r.subflows[e.subflowId] ?? s("The Subflow does not exist.");
|
|
392
396
|
let t = { ...r.subflows };
|
|
393
397
|
delete t[e.subflowId], r.subflows = t;
|
|
394
398
|
break;
|
|
395
399
|
}
|
|
396
400
|
case "task.create":
|
|
397
|
-
r.tasks[e.taskId] != null && s(), r.tasks = {
|
|
401
|
+
r.tasks[e.taskId] != null && s("A Task with this ID already exists."), r.tasks = {
|
|
398
402
|
...r.tasks,
|
|
399
403
|
[e.taskId]: e.task
|
|
400
404
|
};
|
|
401
405
|
break;
|
|
402
406
|
case "task.connector.connection.set": {
|
|
403
407
|
let t = r.tasks[e.taskId];
|
|
404
|
-
(t == null || !("executor" in t) || t.executor.kind != "connector"
|
|
408
|
+
(t == null || !("executor" in t) || t.executor.kind != "connector") && s("The Connector Task does not exist."), t.executor.connectionId != e.before && s("The Connector Task connection changed before this operation was applied.");
|
|
405
409
|
let { connectionId: n, ...i } = t.executor, a = e.value == null ? i : {
|
|
406
410
|
...i,
|
|
407
411
|
connectionId: e.value
|
|
@@ -416,14 +420,14 @@ function d(e, n) {
|
|
|
416
420
|
break;
|
|
417
421
|
}
|
|
418
422
|
case "task.delete": {
|
|
419
|
-
r.tasks[e.taskId] ?? s();
|
|
423
|
+
r.tasks[e.taskId] ?? s("The Task does not exist.");
|
|
420
424
|
let t = { ...r.tasks };
|
|
421
425
|
delete t[e.taskId], r.tasks = t;
|
|
422
426
|
break;
|
|
423
427
|
}
|
|
424
428
|
case "task.llm.mode.set": {
|
|
425
429
|
let t = r.tasks[e.taskId];
|
|
426
|
-
(t == null || !("executor" in t) || t.executor.kind != "llm"
|
|
430
|
+
(t == null || !("executor" in t) || t.executor.kind != "llm") && s("The LLM Task does not exist."), t.executor.mode != e.before && s("The LLM Task mode changed before this operation was applied."), r.tasks = {
|
|
427
431
|
...r.tasks,
|
|
428
432
|
[e.taskId]: {
|
|
429
433
|
...t,
|
|
@@ -437,7 +441,7 @@ function d(e, n) {
|
|
|
437
441
|
}
|
|
438
442
|
case "task.name.set": {
|
|
439
443
|
let t = r.tasks[e.taskId];
|
|
440
|
-
|
|
444
|
+
t ?? s("The Task does not exist."), t.name != e.before && s("The Task name changed before this operation was applied."), r.tasks = {
|
|
441
445
|
...r.tasks,
|
|
442
446
|
[e.taskId]: {
|
|
443
447
|
...t,
|