@oomol-lab/open-flow 0.1.0-alpha.1 → 0.1.0-alpha.12
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/README.md +5 -1
- package/dist/browser/addNodeOptions-BYQXyUmQ.js +9571 -0
- package/dist/browser/carbon-DMCVsjHo.js +53 -0
- package/dist/browser/{project-change.js → change-7rp2OZLm.js} +16 -46
- package/dist/browser/createResourceDialog-CWD62rU0.js +467 -0
- package/dist/browser/{dist-o4dBuwiG.js → dist-3Mj8q8Pr.js} +28 -28
- package/dist/browser/{dist-CIq6ue3I.js → dist-BKuSVKCC.js} +1115 -1103
- package/dist/browser/{dist-DL0SDskM.js → dist-BMqL-qR5.js} +473 -906
- package/dist/browser/{dist-CLZJNoWB.js → dist-BN4ZCyOB.js} +10 -10
- package/dist/browser/{dist-zyY--HOV.js → dist-BpopSHwP.js} +3 -3
- package/dist/browser/dist-C46JByB-.js +252 -0
- package/dist/browser/{dist-BbyiRq3c.js → dist-CJpzJrLM.js} +294 -284
- package/dist/browser/{dist-Djd02JSy.js → dist-CPuF50D9.js} +198 -198
- package/dist/browser/{dist-CvcmLAMW.js → dist-CUSrALSX.js} +115 -115
- package/dist/browser/dist-CeSZ2xSM.js +444 -0
- package/dist/browser/{dist-7oZK9QXZ.js → dist-DMi8_lU3.js} +5 -5
- package/dist/browser/{dist-B9OV3YTx.js → dist-DUzA0Ukh.js} +22 -22
- package/dist/browser/{dist-aWSZx4q1.js → dist-DWADUsVB.js} +75 -75
- package/dist/browser/{dist-BLk5M0uK.js → dist-Mecbzdl2.js} +3 -3
- package/dist/browser/{esm-DXw7EADW.js → esm-DmVDlOEJ.js} +14 -24
- package/dist/browser/flow-authoring-edge.d.ts +3 -0
- package/dist/browser/flow-authoring-module.d.ts +4 -0
- package/dist/browser/flow-authoring-node.d.ts +86 -0
- package/dist/browser/flow-authoring.d.ts +4 -0
- package/dist/browser/flow-authoring.js +783 -0
- package/dist/browser/{project-change.d.ts → flow-change.d.ts} +29 -37
- package/dist/browser/flow-change.js +234 -0
- package/dist/browser/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
- package/dist/browser/flowRunInputEditorStore-BYxwvHZl.js +8952 -0
- package/dist/browser/flowWorkspace-Bwqmoq-c.js +47439 -0
- package/dist/browser/languages-DgJehE1g.js +62 -0
- package/dist/browser/lib-C5Ipyfps.js +7856 -0
- package/dist/browser/{lib-S4ccuMeT.js → lib-GrGxYjsJ.js} +3 -5
- package/dist/browser/licenses.md +620 -12
- package/dist/browser/main-DmjVyuWr.js +76 -0
- package/dist/browser/{markdownContent-ZZFfSRqO.js → markdownContent-0teWaxq8.js} +5188 -5144
- package/dist/browser/theme.css +63 -0
- package/dist/browser/theme.css.d.ts +1 -0
- package/dist/browser/typeScriptSession-D5neIpug.js +2560 -0
- package/dist/browser/{composite-7VwgfnXx.js → useOpenInteractionType-CRgOHg5M.js} +2209 -2750
- package/dist/browser/workbench-contract.d.ts +6 -6
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.d.ts +18 -2
- package/dist/browser/workbench.js +4200 -2233
- package/dist/common/connector-action.d.ts +6 -0
- package/dist/common/connector-action.js +38 -30
- package/dist/common/control-api-conformance.js +262 -359
- package/dist/common/control-api-errors.d.ts +32 -24
- package/dist/common/control-api.d.ts +57 -73
- package/dist/common/control-api.js +199 -205
- package/dist/common/cron-trigger.d.ts +1 -1
- package/dist/common/cron-trigger.js +1 -1
- package/dist/common/flow-encoding.d.ts +11 -0
- package/dist/common/{project-encoding.js → flow-encoding.js} +14 -13
- package/dist/common/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
- package/dist/common/{project-semantics.d.ts → flow-semantics.d.ts} +11 -12
- package/dist/common/{project-semantics.js → flow-semantics.js} +959 -934
- package/dist/common/integration-trigger.d.ts +2 -1
- package/dist/common/integration-trigger.js +1 -1
- package/dist/common/licenses.md +1 -25
- package/dist/common/localization.d.ts +21 -0
- package/dist/common/localization.js +62 -0
- package/dist/common/poll-trigger.d.ts +1 -1
- package/dist/common/provider-triggers.js +1057 -948
- package/dist/common/run-lifecycle.js +1 -1
- package/dist/common/runtime-contract.d.ts +1 -1
- package/dist/common/runtime-contract.js +1 -1
- package/dist/common/scheduler.d.ts +8 -7
- package/dist/common/scheduler.js +251 -232
- package/dist/common/webhook-trigger.d.ts +1 -1
- package/dist/common/webhook-trigger.js +35 -1
- package/package.json +23 -10
- package/dist/browser/addNodeOptions-DqoIueCR.js +0 -33746
- package/dist/browser/carbon-nMY84Amv.js +0 -53
- package/dist/browser/createResourceDialog-ByuJWdSL.js +0 -439
- package/dist/browser/dist-n-z5HtaO.js +0 -4
- package/dist/browser/flowWorkspace-DwVMpcar.js +0 -22092
- package/dist/common/project-encoding.d.ts +0 -11
|
@@ -0,0 +1,783 @@
|
|
|
1
|
+
//#region ../../node_modules/.bun/nanoid@6.0.1/node_modules/nanoid/index.browser.js
|
|
2
|
+
var e = (e) => crypto.getRandomValues(new Uint8Array(e)), t = (e, t, n) => {
|
|
3
|
+
let r = 256 - 256 % e.length;
|
|
4
|
+
if (r === 256) {
|
|
5
|
+
let r = e.length - 1;
|
|
6
|
+
return (i = t) => {
|
|
7
|
+
if (!i) return "";
|
|
8
|
+
let a = "";
|
|
9
|
+
for (;;) {
|
|
10
|
+
let t = n(i), o = i;
|
|
11
|
+
for (; o--;) if (a += e[t[o] & r], a.length >= i) return a;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
let i = Math.ceil(409.6 * t / r);
|
|
16
|
+
return (a = t) => {
|
|
17
|
+
if (!a) return "";
|
|
18
|
+
let o = "";
|
|
19
|
+
for (;;) {
|
|
20
|
+
let t = n(i), s = i;
|
|
21
|
+
for (; s--;) if (t[s] < r && (o += e[t[s] % e.length], o.length >= a)) return o;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, n = (n, r = 21) => t(n, r | 0, e), r = "//#region generated meta", i = "//#endregion";
|
|
25
|
+
function a(e, t) {
|
|
26
|
+
let n = e.indexOf(r);
|
|
27
|
+
if (n < 0) return e;
|
|
28
|
+
let a = e.indexOf(`\n${i}`, n);
|
|
29
|
+
if (a < 0) return e;
|
|
30
|
+
let o = e.indexOf("\n", a + 1);
|
|
31
|
+
return o < 0 && (o = e.length), `${e.slice(0, n)}${r}\n${t}${i}${e.slice(o)}`;
|
|
32
|
+
}
|
|
33
|
+
function o(e, t, n) {
|
|
34
|
+
return e === "typescript" ? d(t, n) + "\n" : f(t, n) + "\n";
|
|
35
|
+
}
|
|
36
|
+
var s = /* @__PURE__ */ new Set(["color", "text"]), c = (e) => e.includes(" | ") ? `(${e})` : e;
|
|
37
|
+
function l(e) {
|
|
38
|
+
return !e || typeof e != "object" ? !1 : e.contentMediaType === "oomol/artifact" ? !0 : Array.isArray(e.anyOf) ? e.anyOf.some(l) : e.type === "object" ? Object.values(e.properties || {}).some(l) : e.type === "array" && l(e.items);
|
|
39
|
+
}
|
|
40
|
+
function u(e, t) {
|
|
41
|
+
return [...e, ...t].some((e) => l(e.json_schema));
|
|
42
|
+
}
|
|
43
|
+
function d(e = [], t = []) {
|
|
44
|
+
let n = ["type Inputs = {"];
|
|
45
|
+
for (let t of e) n.push(` ${t.handle}: ${p(t.json_schema, t.nullable)};`);
|
|
46
|
+
n.push("};"), n.push("type Outputs = {");
|
|
47
|
+
for (let e of t) n.push(` ${e.handle}: ${p(e.json_schema, e.nullable)};`);
|
|
48
|
+
return n.push("};"), u(e, t) && n.unshift("import type { ArtifactRef } from '@oomol-lab/open-flow'", ""), n.join("\n");
|
|
49
|
+
}
|
|
50
|
+
function f(e = [], t = []) {
|
|
51
|
+
let n = ["@typedef {{"];
|
|
52
|
+
for (let t of e) n.push(` ${t.handle}: ${p(t.json_schema, t.nullable)};`);
|
|
53
|
+
n.push("}} Inputs;"), n.push("@typedef {{");
|
|
54
|
+
for (let e of t) n.push(` ${e.handle}: ${p(e.json_schema, e.nullable)};`);
|
|
55
|
+
n.push("}} Outputs;"), u(e, t) && n.unshift("@import { ArtifactRef } from \"@oomol-lab/open-flow\"");
|
|
56
|
+
let r = n.map((e) => ` * ${e}`);
|
|
57
|
+
return r.unshift("/**"), r.push(" */"), r.join("\n");
|
|
58
|
+
}
|
|
59
|
+
function p(e, t) {
|
|
60
|
+
if (!e) return "any";
|
|
61
|
+
switch (e.contentMediaType) {
|
|
62
|
+
case "oomol/bin": return t ? "Uint8Array | null" : "Uint8Array";
|
|
63
|
+
case "oomol/artifact": return t ? "ArtifactRef | null" : "ArtifactRef";
|
|
64
|
+
}
|
|
65
|
+
if (s.has(e["ui:widget"])) return t ? "string | null" : "string";
|
|
66
|
+
if (Array.isArray(e.anyOf)) return m((t ? e.anyOf.concat({ type: "null" }) : e.anyOf).map((e) => c(p(e, !1)))) || "any";
|
|
67
|
+
if (Array.isArray(e.enum)) return m((t ? e.enum.concat(null) : e.enum).map((e) => JSON.stringify(e))) || "any";
|
|
68
|
+
switch (e.type) {
|
|
69
|
+
case "null": return "null";
|
|
70
|
+
case "boolean": return t ? "boolean | null" : "boolean";
|
|
71
|
+
case "integer":
|
|
72
|
+
case "number": return t ? "number | null" : "number";
|
|
73
|
+
case "string": return t ? "string | null" : "string";
|
|
74
|
+
case "object": {
|
|
75
|
+
let n = Object.keys(e.properties || {});
|
|
76
|
+
if (n.length === 0) return "Record<string, any>";
|
|
77
|
+
let r = Array.isArray(e?.required) ? new Set(e.required) : void 0, i = `{ ${n.map((t) => `${t}${r && !r.has(t) ? "?" : ""}: ${p(e.properties[t], !1)}`).join("; ")} }`;
|
|
78
|
+
return t ? `${i} | null` : i;
|
|
79
|
+
}
|
|
80
|
+
case "array":
|
|
81
|
+
if (e.uniqueItems && Array.isArray(e.items?.enum)) {
|
|
82
|
+
let n = `${c(p(e.items, !1))}[]`;
|
|
83
|
+
return t ? `${n} | null` : n;
|
|
84
|
+
}
|
|
85
|
+
{
|
|
86
|
+
let n = `${c(p(e.items, !1))}[]`;
|
|
87
|
+
return t ? `${n} | null` : n;
|
|
88
|
+
}
|
|
89
|
+
default: return "any";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function m(e) {
|
|
93
|
+
let t = Array.from(new Set(e.filter((e) => !!e)));
|
|
94
|
+
return t.length === 0 || t.includes("any") ? "any" : t.join(" | ");
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/flow/common/change.ts
|
|
98
|
+
var h = class extends Error {};
|
|
99
|
+
function g() {
|
|
100
|
+
throw new h();
|
|
101
|
+
}
|
|
102
|
+
function _(e, t) {
|
|
103
|
+
if (t.kind == "flow") return e.graph;
|
|
104
|
+
let n = e.subflows[t.id];
|
|
105
|
+
return n ?? g(), n.graph;
|
|
106
|
+
}
|
|
107
|
+
function v(e, t, n) {
|
|
108
|
+
if (t.kind == "flow") return {
|
|
109
|
+
...e,
|
|
110
|
+
graph: n
|
|
111
|
+
};
|
|
112
|
+
let r = e.subflows[t.id];
|
|
113
|
+
return r ?? g(), {
|
|
114
|
+
...e,
|
|
115
|
+
subflows: {
|
|
116
|
+
...e.subflows,
|
|
117
|
+
[t.id]: {
|
|
118
|
+
...r,
|
|
119
|
+
graph: n
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function y(e, t) {
|
|
125
|
+
if (!("inputs" in e)) return e;
|
|
126
|
+
let n = { ...e.inputs };
|
|
127
|
+
for (let [e, r] of Object.entries(n)) {
|
|
128
|
+
if (r.kind != "sources") continue;
|
|
129
|
+
let i = r.sources.filter((e) => e.kind != "node" || !t.has(e.nodeId));
|
|
130
|
+
i.length == 0 ? delete n[e] : n[e] = {
|
|
131
|
+
kind: "sources",
|
|
132
|
+
sources: i
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
...e,
|
|
137
|
+
inputs: n
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function b(e, t) {
|
|
141
|
+
let n = { ...e.document }, r = { ...e.modules };
|
|
142
|
+
for (let e of t) switch (e.kind) {
|
|
143
|
+
case "binding.create":
|
|
144
|
+
n.bindings[e.bindingId] != null && g(), n.bindings = {
|
|
145
|
+
...n.bindings,
|
|
146
|
+
[e.bindingId]: e.binding
|
|
147
|
+
};
|
|
148
|
+
break;
|
|
149
|
+
case "binding.replace":
|
|
150
|
+
n.bindings[e.bindingId] ?? g(), n.bindings = {
|
|
151
|
+
...n.bindings,
|
|
152
|
+
[e.bindingId]: e.binding
|
|
153
|
+
};
|
|
154
|
+
break;
|
|
155
|
+
case "binding.delete": {
|
|
156
|
+
n.bindings[e.bindingId] ?? g();
|
|
157
|
+
let t = { ...n.bindings };
|
|
158
|
+
delete t[e.bindingId], n.bindings = t;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case "graph.edge.connect": {
|
|
162
|
+
let t = _(n, e.target);
|
|
163
|
+
t.nodes[e.edge.source] ?? g();
|
|
164
|
+
let r = t.nodes[e.edge.target];
|
|
165
|
+
(r == null || !("inputs" in r)) && g();
|
|
166
|
+
let i = r.inputs[e.edge.targetHandle], a = {
|
|
167
|
+
kind: "node",
|
|
168
|
+
nodeId: e.edge.source,
|
|
169
|
+
output: e.edge.sourceHandle
|
|
170
|
+
}, o = i?.kind == "sources" ? i.sources.filter((e) => e.kind != "binding" || n.bindings[e.bindingId]?.kind != "variable") : [];
|
|
171
|
+
o.some((e) => e.kind == "node" && e.nodeId == a.nodeId && e.output == a.output) && g();
|
|
172
|
+
let s = {
|
|
173
|
+
...r,
|
|
174
|
+
inputs: {
|
|
175
|
+
...r.inputs,
|
|
176
|
+
[e.edge.targetHandle]: {
|
|
177
|
+
kind: "sources",
|
|
178
|
+
sources: [...o, a]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
Object.assign(n, v(n, e.target, { nodes: {
|
|
183
|
+
...t.nodes,
|
|
184
|
+
[e.edge.target]: s
|
|
185
|
+
} }));
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
case "graph.edge.disconnect": {
|
|
189
|
+
let t = _(n, e.target), r = t.nodes[e.edge.target];
|
|
190
|
+
(r == null || !("inputs" in r)) && g();
|
|
191
|
+
let i = r.inputs[e.edge.targetHandle];
|
|
192
|
+
i?.kind != "sources" && g();
|
|
193
|
+
let a = i.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
|
|
194
|
+
a.length == i.sources.length && g();
|
|
195
|
+
let o = { ...r.inputs };
|
|
196
|
+
a.length == 0 ? delete o[e.edge.targetHandle] : o[e.edge.targetHandle] = {
|
|
197
|
+
kind: "sources",
|
|
198
|
+
sources: a
|
|
199
|
+
}, Object.assign(n, v(n, e.target, { nodes: {
|
|
200
|
+
...t.nodes,
|
|
201
|
+
[e.edge.target]: {
|
|
202
|
+
...r,
|
|
203
|
+
inputs: o
|
|
204
|
+
}
|
|
205
|
+
} }));
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
case "graph.node.create": {
|
|
209
|
+
let t = _(n, e.target);
|
|
210
|
+
(t.nodes[e.nodeId] != null || e.target.kind == "subflow" && !("inputs" in e.node)) && g(), Object.assign(n, v(n, e.target, { nodes: {
|
|
211
|
+
...t.nodes,
|
|
212
|
+
[e.nodeId]: e.node
|
|
213
|
+
} }));
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
case "graph.node.delete": {
|
|
217
|
+
let t = _(n, e.target);
|
|
218
|
+
t.nodes[e.nodeId] ?? g();
|
|
219
|
+
let r = /* @__PURE__ */ new Set([e.nodeId]), i = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => r.has(e) ? [] : [[e, y(t, r)]]));
|
|
220
|
+
if (Object.assign(n, v(n, e.target, { nodes: i })), e.target.kind == "subflow") {
|
|
221
|
+
let t = n.subflows[e.target.id], i = t.outputs.map((e) => ({
|
|
222
|
+
...e,
|
|
223
|
+
sources: e.sources.filter((e) => e.kind != "node" || !r.has(e.nodeId))
|
|
224
|
+
}));
|
|
225
|
+
n.subflows = {
|
|
226
|
+
...n.subflows,
|
|
227
|
+
[e.target.id]: {
|
|
228
|
+
...t,
|
|
229
|
+
outputs: i
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
case "graph.node.replace": {
|
|
236
|
+
let t = _(n, e.target);
|
|
237
|
+
(t.nodes[e.nodeId] == null || e.target.kind == "subflow" && !("inputs" in e.node)) && g(), Object.assign(n, v(n, e.target, { nodes: {
|
|
238
|
+
...t.nodes,
|
|
239
|
+
[e.nodeId]: e.node
|
|
240
|
+
} }));
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
case "module.create":
|
|
244
|
+
r[e.moduleId] != null && g(), r[e.moduleId] = e.module;
|
|
245
|
+
break;
|
|
246
|
+
case "module.delete":
|
|
247
|
+
r[e.moduleId] ?? g(), delete r[e.moduleId];
|
|
248
|
+
break;
|
|
249
|
+
case "module.rename": {
|
|
250
|
+
let t = r[e.moduleId];
|
|
251
|
+
t ?? g(), r[e.moduleId] = {
|
|
252
|
+
...t,
|
|
253
|
+
name: e.name
|
|
254
|
+
};
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
case "module.source.replace": {
|
|
258
|
+
let t = r[e.moduleId];
|
|
259
|
+
t ?? g(), r[e.moduleId] = {
|
|
260
|
+
...t,
|
|
261
|
+
imports: e.imports,
|
|
262
|
+
source: e.source
|
|
263
|
+
};
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
case "subflow.create":
|
|
267
|
+
n.subflows[e.subflowId] != null && g(), n.subflows = {
|
|
268
|
+
...n.subflows,
|
|
269
|
+
[e.subflowId]: e.subflow
|
|
270
|
+
};
|
|
271
|
+
break;
|
|
272
|
+
case "subflow.definition.replace": {
|
|
273
|
+
let t = n.subflows[e.subflowId];
|
|
274
|
+
t ?? g(), n.subflows = {
|
|
275
|
+
...n.subflows,
|
|
276
|
+
[e.subflowId]: {
|
|
277
|
+
...e.definition,
|
|
278
|
+
graph: t.graph
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
case "subflow.delete": {
|
|
284
|
+
n.subflows[e.subflowId] ?? g();
|
|
285
|
+
let t = { ...n.subflows };
|
|
286
|
+
delete t[e.subflowId], n.subflows = t;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
case "task.create":
|
|
290
|
+
n.tasks[e.taskId] != null && g(), n.tasks = {
|
|
291
|
+
...n.tasks,
|
|
292
|
+
[e.taskId]: e.task
|
|
293
|
+
};
|
|
294
|
+
break;
|
|
295
|
+
case "task.delete": {
|
|
296
|
+
n.tasks[e.taskId] ?? g();
|
|
297
|
+
let t = { ...n.tasks };
|
|
298
|
+
delete t[e.taskId], n.tasks = t;
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
case "task.replace": n.tasks[e.taskId] ?? g(), n.tasks = {
|
|
302
|
+
...n.tasks,
|
|
303
|
+
[e.taskId]: e.task
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
return {
|
|
307
|
+
document: n,
|
|
308
|
+
modelVersion: e.modelVersion,
|
|
309
|
+
modules: r
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/flow/common/nodeChanges.ts
|
|
314
|
+
var x = "//#region generated meta\n/**\n * @typedef {{}} Inputs\n * @typedef {{}} Outputs\n */\n//#endregion\n\n/**\n * @import { TaskContext } from \"@oomol-lab/open-flow\"\n * @param {Inputs} input\n * @param {TaskContext<Outputs>} context\n * @returns {Promise<Partial<Outputs> | undefined | void>}\n */\nexport default async function (input, context) {\n return { result: input.value }\n}\n";
|
|
315
|
+
function S(e, t, n, r = void 0, i = {
|
|
316
|
+
inputs: [{
|
|
317
|
+
handle: "value",
|
|
318
|
+
jsonSchema: {},
|
|
319
|
+
nullable: !0,
|
|
320
|
+
value: null
|
|
321
|
+
}],
|
|
322
|
+
outputs: [{
|
|
323
|
+
handle: "result",
|
|
324
|
+
jsonSchema: {},
|
|
325
|
+
nullable: !0
|
|
326
|
+
}]
|
|
327
|
+
}) {
|
|
328
|
+
return [{
|
|
329
|
+
kind: "module.create",
|
|
330
|
+
module: {
|
|
331
|
+
...r ?? {
|
|
332
|
+
imports: [],
|
|
333
|
+
source: a(x, o("javascript", i.inputs.map((e) => ({
|
|
334
|
+
handle: e.handle,
|
|
335
|
+
json_schema: e.jsonSchema,
|
|
336
|
+
nullable: e.nullable
|
|
337
|
+
})), i.outputs.map((e) => ({
|
|
338
|
+
handle: e.handle,
|
|
339
|
+
json_schema: e.jsonSchema,
|
|
340
|
+
nullable: e.nullable
|
|
341
|
+
}))))
|
|
342
|
+
},
|
|
343
|
+
name: n
|
|
344
|
+
},
|
|
345
|
+
moduleId: t.moduleId
|
|
346
|
+
}, {
|
|
347
|
+
kind: "graph.node.create",
|
|
348
|
+
node: {
|
|
349
|
+
concurrency: 1,
|
|
350
|
+
inputs: z(i.inputs),
|
|
351
|
+
kind: "task",
|
|
352
|
+
name: n,
|
|
353
|
+
task: {
|
|
354
|
+
inputs: i.inputs,
|
|
355
|
+
moduleId: t.moduleId,
|
|
356
|
+
name: n,
|
|
357
|
+
outputs: i.outputs
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
nodeId: t.nodeId,
|
|
361
|
+
target: e
|
|
362
|
+
}];
|
|
363
|
+
}
|
|
364
|
+
function C(e, t, n) {
|
|
365
|
+
return [{
|
|
366
|
+
kind: "task.create",
|
|
367
|
+
task: n,
|
|
368
|
+
taskId: t.taskId
|
|
369
|
+
}, {
|
|
370
|
+
kind: "graph.node.create",
|
|
371
|
+
node: {
|
|
372
|
+
concurrency: 1,
|
|
373
|
+
inputs: z(n.inputs),
|
|
374
|
+
kind: "task",
|
|
375
|
+
name: n.name,
|
|
376
|
+
taskId: t.taskId
|
|
377
|
+
},
|
|
378
|
+
nodeId: t.nodeId,
|
|
379
|
+
target: e
|
|
380
|
+
}];
|
|
381
|
+
}
|
|
382
|
+
function w(e, t, n, r, i, a = {}) {
|
|
383
|
+
let o = a.inputs ?? {};
|
|
384
|
+
return C(e, t, {
|
|
385
|
+
executor: {
|
|
386
|
+
kind: "llm",
|
|
387
|
+
mode: r
|
|
388
|
+
},
|
|
389
|
+
inputs: [
|
|
390
|
+
{
|
|
391
|
+
handle: "messages",
|
|
392
|
+
jsonSchema: {
|
|
393
|
+
items: { type: "object" },
|
|
394
|
+
type: "array"
|
|
395
|
+
},
|
|
396
|
+
nullable: !0,
|
|
397
|
+
value: B(o, "messages", null)
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
handle: "input",
|
|
401
|
+
jsonSchema: { type: "string" },
|
|
402
|
+
nullable: !1,
|
|
403
|
+
value: B(o, "input", "Alex")
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
handle: "template",
|
|
407
|
+
jsonSchema: {
|
|
408
|
+
items: { type: "object" },
|
|
409
|
+
minItems: 1,
|
|
410
|
+
type: "array"
|
|
411
|
+
},
|
|
412
|
+
nullable: !1,
|
|
413
|
+
value: B(o, "template", [{
|
|
414
|
+
content: "Hello, I'm {{input}}",
|
|
415
|
+
role: "user"
|
|
416
|
+
}])
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
handle: "model",
|
|
420
|
+
jsonSchema: { type: "object" },
|
|
421
|
+
nullable: !1,
|
|
422
|
+
value: B(o, "model", { model: "deepseek-v4-flash" })
|
|
423
|
+
}
|
|
424
|
+
],
|
|
425
|
+
name: n,
|
|
426
|
+
outputs: [{
|
|
427
|
+
...a.output,
|
|
428
|
+
description: a.output?.description ?? i,
|
|
429
|
+
handle: "output",
|
|
430
|
+
jsonSchema: a.output?.jsonSchema ?? (r == "chat" ? { type: "string" } : {}),
|
|
431
|
+
nullable: a.output?.nullable ?? !1
|
|
432
|
+
}]
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
function T(e, t, n) {
|
|
436
|
+
return [{
|
|
437
|
+
kind: "graph.node.create",
|
|
438
|
+
node: {
|
|
439
|
+
cases: [{
|
|
440
|
+
expressions: [{
|
|
441
|
+
input: "value",
|
|
442
|
+
operator: "isTrue"
|
|
443
|
+
}],
|
|
444
|
+
output: "true",
|
|
445
|
+
relation: "all"
|
|
446
|
+
}],
|
|
447
|
+
concurrency: 1,
|
|
448
|
+
defaultOutput: "false",
|
|
449
|
+
input: {
|
|
450
|
+
handle: "value",
|
|
451
|
+
jsonSchema: {},
|
|
452
|
+
nullable: !0,
|
|
453
|
+
value: null
|
|
454
|
+
},
|
|
455
|
+
inputs: { value: {
|
|
456
|
+
kind: "value",
|
|
457
|
+
value: null
|
|
458
|
+
} },
|
|
459
|
+
kind: "condition",
|
|
460
|
+
name: n
|
|
461
|
+
},
|
|
462
|
+
nodeId: t,
|
|
463
|
+
target: e
|
|
464
|
+
}];
|
|
465
|
+
}
|
|
466
|
+
function E(e, t, n) {
|
|
467
|
+
return [{
|
|
468
|
+
kind: "graph.node.create",
|
|
469
|
+
node: {
|
|
470
|
+
concurrency: 1,
|
|
471
|
+
inputs: {},
|
|
472
|
+
kind: "value",
|
|
473
|
+
name: n,
|
|
474
|
+
values: [{
|
|
475
|
+
handle: "value",
|
|
476
|
+
jsonSchema: {},
|
|
477
|
+
nullable: !0,
|
|
478
|
+
value: null
|
|
479
|
+
}]
|
|
480
|
+
},
|
|
481
|
+
nodeId: t,
|
|
482
|
+
target: e
|
|
483
|
+
}];
|
|
484
|
+
}
|
|
485
|
+
function D(e, t, n) {
|
|
486
|
+
return [{
|
|
487
|
+
kind: "graph.node.create",
|
|
488
|
+
node: n,
|
|
489
|
+
nodeId: t,
|
|
490
|
+
target: e
|
|
491
|
+
}];
|
|
492
|
+
}
|
|
493
|
+
function O(e, t, n, r) {
|
|
494
|
+
let i = r.name ?? n.displayName, a = n.type == "poll" ? {
|
|
495
|
+
bindingId: t.bindingId,
|
|
496
|
+
config: r.config,
|
|
497
|
+
definition: n,
|
|
498
|
+
kind: "poll",
|
|
499
|
+
name: i,
|
|
500
|
+
pollTimes: r.schedule ?? [{
|
|
501
|
+
type: "every",
|
|
502
|
+
unit: "minute",
|
|
503
|
+
value: 5
|
|
504
|
+
}]
|
|
505
|
+
} : {
|
|
506
|
+
bindingId: t.bindingId,
|
|
507
|
+
config: r.config,
|
|
508
|
+
definition: n,
|
|
509
|
+
kind: "integration",
|
|
510
|
+
name: i
|
|
511
|
+
};
|
|
512
|
+
return [{
|
|
513
|
+
binding: {
|
|
514
|
+
kind: "connection",
|
|
515
|
+
target: r.connectionId
|
|
516
|
+
},
|
|
517
|
+
bindingId: t.bindingId,
|
|
518
|
+
kind: "binding.create"
|
|
519
|
+
}, {
|
|
520
|
+
kind: "graph.node.create",
|
|
521
|
+
node: a,
|
|
522
|
+
nodeId: t.nodeId,
|
|
523
|
+
target: e
|
|
524
|
+
}];
|
|
525
|
+
}
|
|
526
|
+
function k(e, t, n) {
|
|
527
|
+
let r = R(e, t)?.nodes;
|
|
528
|
+
if (r == null) return [];
|
|
529
|
+
let i = new Set(n), a = n.flatMap((e) => {
|
|
530
|
+
let n = r[e];
|
|
531
|
+
return n == null ? [] : [{
|
|
532
|
+
kind: "graph.node.delete",
|
|
533
|
+
nodeId: e,
|
|
534
|
+
target: t
|
|
535
|
+
}, ...n.kind == "task" && n.task != null ? [{
|
|
536
|
+
kind: "module.delete",
|
|
537
|
+
moduleId: n.task.moduleId
|
|
538
|
+
}] : []];
|
|
539
|
+
});
|
|
540
|
+
if (t.kind == "subflow") return N(e, a);
|
|
541
|
+
let o = new Set(n.flatMap((e) => {
|
|
542
|
+
let t = r[e];
|
|
543
|
+
return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
|
|
544
|
+
}));
|
|
545
|
+
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({
|
|
546
|
+
bindingId: t,
|
|
547
|
+
kind: "binding.delete"
|
|
548
|
+
});
|
|
549
|
+
return N(e, a);
|
|
550
|
+
}
|
|
551
|
+
function A(e, t, n, r) {
|
|
552
|
+
let i = R(e, t)?.nodes[n];
|
|
553
|
+
if (i == null || !("inputs" in i)) return;
|
|
554
|
+
let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
|
|
555
|
+
return V(t, n, {
|
|
556
|
+
...c,
|
|
557
|
+
...r
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
function j(e, t, n, r) {
|
|
561
|
+
let i = R(e, t)?.nodes[n];
|
|
562
|
+
if (i == null || !("inputs" in i)) return;
|
|
563
|
+
let a = { ...i.inputs };
|
|
564
|
+
for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
|
|
565
|
+
kind: "value",
|
|
566
|
+
value: t
|
|
567
|
+
};
|
|
568
|
+
return N(e, V(t, n, {
|
|
569
|
+
...i,
|
|
570
|
+
inputs: a
|
|
571
|
+
}));
|
|
572
|
+
}
|
|
573
|
+
function M(e, t, n, r, i, a) {
|
|
574
|
+
let o = R(e, t)?.nodes[n];
|
|
575
|
+
if (o == null || !("inputs" in o)) return;
|
|
576
|
+
let s = o.inputs[r], c = s?.kind == "sources" && s.sources.length == 1 && s.sources[0]?.kind == "binding" ? s.sources[0].bindingId : void 0, l = c == null ? void 0 : e.document.bindings[c], u = P(e.document);
|
|
577
|
+
if (c != null && l?.kind == "variable" && (u.get(c) ?? 0) == 1) return l.target == i ? [] : [{
|
|
578
|
+
binding: {
|
|
579
|
+
kind: "variable",
|
|
580
|
+
target: i
|
|
581
|
+
},
|
|
582
|
+
bindingId: c,
|
|
583
|
+
kind: "binding.replace"
|
|
584
|
+
}];
|
|
585
|
+
let d = {
|
|
586
|
+
...o.inputs,
|
|
587
|
+
[r]: {
|
|
588
|
+
kind: "sources",
|
|
589
|
+
sources: [{
|
|
590
|
+
bindingId: a,
|
|
591
|
+
kind: "binding"
|
|
592
|
+
}]
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
return [{
|
|
596
|
+
binding: {
|
|
597
|
+
kind: "variable",
|
|
598
|
+
target: i
|
|
599
|
+
},
|
|
600
|
+
bindingId: a,
|
|
601
|
+
kind: "binding.create"
|
|
602
|
+
}, ...N(e, V(t, n, {
|
|
603
|
+
...o,
|
|
604
|
+
inputs: d
|
|
605
|
+
}))];
|
|
606
|
+
}
|
|
607
|
+
function N(e, t) {
|
|
608
|
+
let n = P(e.document), r = b(e, t), i = P(r.document);
|
|
609
|
+
return [...t, ...[...n.keys()].flatMap((e) => i.has(e) || r.document.bindings[e]?.kind != "variable" ? [] : [{
|
|
610
|
+
bindingId: e,
|
|
611
|
+
kind: "binding.delete"
|
|
612
|
+
}])];
|
|
613
|
+
}
|
|
614
|
+
function P(e) {
|
|
615
|
+
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
616
|
+
t.set(e, (t.get(e) ?? 0) + 1);
|
|
617
|
+
};
|
|
618
|
+
for (let t of [e.graph, ...Object.values(e.subflows).map((e) => e.graph)]) for (let e of Object.values(t.nodes)) if ((e.kind == "poll" || e.kind == "integration") && n(e.bindingId), "inputs" in e) {
|
|
619
|
+
for (let t of Object.values(e.inputs)) if (t.kind == "sources") for (let e of t.sources) e.kind == "binding" && n(e.bindingId);
|
|
620
|
+
}
|
|
621
|
+
return t;
|
|
622
|
+
}
|
|
623
|
+
function F(e, t, n) {
|
|
624
|
+
let r = e.document.tasks[t];
|
|
625
|
+
if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
|
|
626
|
+
kind: "task.replace",
|
|
627
|
+
task: {
|
|
628
|
+
...r,
|
|
629
|
+
executor: {
|
|
630
|
+
...r.executor,
|
|
631
|
+
connectionId: n
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
taskId: t
|
|
635
|
+
}];
|
|
636
|
+
}
|
|
637
|
+
function I(e, t, n, r) {
|
|
638
|
+
let i = e.document.graph.nodes[n];
|
|
639
|
+
if (i == null) return;
|
|
640
|
+
let a = {
|
|
641
|
+
...r.description == null ? {} : { description: r.description },
|
|
642
|
+
icon: i.icon,
|
|
643
|
+
name: r.name
|
|
644
|
+
}, o;
|
|
645
|
+
switch (r.kind) {
|
|
646
|
+
case "webhook":
|
|
647
|
+
if (i.kind != "webhook") return;
|
|
648
|
+
o = Object.keys(r.options).length == 0 ? {
|
|
649
|
+
...a,
|
|
650
|
+
inputsDef: r.inputs,
|
|
651
|
+
kind: "webhook"
|
|
652
|
+
} : {
|
|
653
|
+
...a,
|
|
654
|
+
inputsDef: r.inputs,
|
|
655
|
+
kind: "webhook",
|
|
656
|
+
options: r.options
|
|
657
|
+
};
|
|
658
|
+
break;
|
|
659
|
+
case "cron":
|
|
660
|
+
if (i.kind != "cron") return;
|
|
661
|
+
o = {
|
|
662
|
+
...a,
|
|
663
|
+
cronTimes: r.schedule,
|
|
664
|
+
kind: "cron"
|
|
665
|
+
};
|
|
666
|
+
break;
|
|
667
|
+
case "poll":
|
|
668
|
+
if (i.kind != "poll") return;
|
|
669
|
+
o = {
|
|
670
|
+
...i,
|
|
671
|
+
...a,
|
|
672
|
+
config: r.config,
|
|
673
|
+
pollTimes: r.schedule
|
|
674
|
+
};
|
|
675
|
+
break;
|
|
676
|
+
case "integration":
|
|
677
|
+
if (i.kind != "integration") return;
|
|
678
|
+
o = {
|
|
679
|
+
...i,
|
|
680
|
+
...a,
|
|
681
|
+
config: r.config
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
return V(t, n, o);
|
|
685
|
+
}
|
|
686
|
+
function L(e, t, n, r) {
|
|
687
|
+
let i = e.document.graph.nodes[n];
|
|
688
|
+
if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
|
|
689
|
+
binding: {
|
|
690
|
+
kind: "connection",
|
|
691
|
+
target: r
|
|
692
|
+
},
|
|
693
|
+
bindingId: i.bindingId,
|
|
694
|
+
kind: "binding.replace"
|
|
695
|
+
}];
|
|
696
|
+
}
|
|
697
|
+
function R(e, t) {
|
|
698
|
+
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
699
|
+
}
|
|
700
|
+
function z(e) {
|
|
701
|
+
return Object.fromEntries(e.flatMap((e) => Object.hasOwn(e, "value") ? [[e.handle, {
|
|
702
|
+
kind: "value",
|
|
703
|
+
value: e.value
|
|
704
|
+
}]] : []));
|
|
705
|
+
}
|
|
706
|
+
function B(e, t, n) {
|
|
707
|
+
return e != null && Object.hasOwn(e, t) ? e[t] : n;
|
|
708
|
+
}
|
|
709
|
+
function V(e, t, n) {
|
|
710
|
+
return [{
|
|
711
|
+
kind: "graph.node.replace",
|
|
712
|
+
node: n,
|
|
713
|
+
nodeId: t,
|
|
714
|
+
target: e
|
|
715
|
+
}];
|
|
716
|
+
}
|
|
717
|
+
//#endregion
|
|
718
|
+
//#region src/flow/common/edgeChanges.ts
|
|
719
|
+
function H(e, t, n) {
|
|
720
|
+
let r = {
|
|
721
|
+
source: n.source,
|
|
722
|
+
sourceHandle: n.sourceHandle,
|
|
723
|
+
target: n.target,
|
|
724
|
+
targetHandle: n.targetHandle
|
|
725
|
+
}, i = W(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
|
|
726
|
+
return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : N(e, [{
|
|
727
|
+
edge: r,
|
|
728
|
+
kind: "graph.edge.connect",
|
|
729
|
+
target: t
|
|
730
|
+
}]);
|
|
731
|
+
}
|
|
732
|
+
function U(e, t, n) {
|
|
733
|
+
let r = {
|
|
734
|
+
source: n.source,
|
|
735
|
+
sourceHandle: n.sourceHandle,
|
|
736
|
+
target: n.target,
|
|
737
|
+
targetHandle: n.targetHandle
|
|
738
|
+
}, i = W(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
|
|
739
|
+
return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
|
|
740
|
+
edge: r,
|
|
741
|
+
kind: "graph.edge.disconnect",
|
|
742
|
+
target: t
|
|
743
|
+
}];
|
|
744
|
+
}
|
|
745
|
+
function W(e, t) {
|
|
746
|
+
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
747
|
+
}
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/flow/common/moduleChanges.ts
|
|
750
|
+
async function G(e) {
|
|
751
|
+
try {
|
|
752
|
+
let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
|
|
753
|
+
errorRecovery: !0,
|
|
754
|
+
sourceType: "module"
|
|
755
|
+
}).program, r = /* @__PURE__ */ new Set();
|
|
756
|
+
for (let e of n.body) {
|
|
757
|
+
if (e.type != "ImportDeclaration") continue;
|
|
758
|
+
let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
|
|
759
|
+
t?.[1] != null && r.add(t[1]);
|
|
760
|
+
}
|
|
761
|
+
return [...r].toSorted();
|
|
762
|
+
} catch {
|
|
763
|
+
return [];
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
function K(e, t, n) {
|
|
767
|
+
return [{
|
|
768
|
+
imports: n,
|
|
769
|
+
kind: "module.source.replace",
|
|
770
|
+
moduleId: e,
|
|
771
|
+
source: t
|
|
772
|
+
}];
|
|
773
|
+
}
|
|
774
|
+
function q(e, t) {
|
|
775
|
+
return [{
|
|
776
|
+
kind: "module.rename",
|
|
777
|
+
moduleId: e,
|
|
778
|
+
name: t
|
|
779
|
+
}];
|
|
780
|
+
}
|
|
781
|
+
var J = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
|
|
782
|
+
//#endregion
|
|
783
|
+
export { N as cleanVariableBindings, H as connect, J as createAuthoringId, D as createBuiltinTrigger, S as createCodeTask, T as createCondition, w as createLlmTask, C as createManagedTask, O as createProviderTrigger, E as createValue, k as deleteNodes, U as disconnect, G as moduleImports, q as renameModule, K as replaceModuleSource, F as setConnectorConnection, j as setInputValues, M as setInputVariable, L as setTriggerConnection, A as updateSettings, I as updateTrigger };
|