@oomol-lab/open-flow 0.1.0-alpha.9 → 0.1.0-beta.1
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/{createResourceDialog-A64dDFCG.js → createResourceDialog-DXQz0thK.js} +228 -191
- package/dist/browser/diagnostics-BGoGFvHA.js +9237 -0
- package/dist/browser/{dist-DhsGR_K3.js → dist-3Mj8q8Pr.js} +27 -27
- package/dist/browser/{dist-n9WmBm5w.js → dist-BKuSVKCC.js} +1 -1
- package/dist/browser/{dist-DQVavPcf.js → dist-BMqL-qR5.js} +469 -903
- package/dist/browser/{dist-D5mdziGP.js → dist-BN4ZCyOB.js} +9 -9
- package/dist/browser/{dist-CVtP-E2c.js → dist-BpopSHwP.js} +1 -1
- package/dist/browser/{dist-B0Q2Mn0n.js → dist-CJpzJrLM.js} +191 -191
- package/dist/browser/{dist-DXgEYMFx.js → dist-CPuF50D9.js} +196 -196
- package/dist/browser/{dist-CUkceEvN.js → dist-CUSrALSX.js} +113 -113
- package/dist/browser/dist-CeSZ2xSM.js +444 -0
- package/dist/browser/{dist-Bc9TvHYl.js → dist-DUzA0Ukh.js} +20 -20
- package/dist/browser/{dist-DWzdGVm9.js → dist-DWADUsVB.js} +74 -74
- package/dist/browser/{esm-YIGXG-Js.js → esm-DGQbgYoJ.js} +13 -13
- package/dist/browser/flow-authoring-node.d.ts +3 -1
- package/dist/browser/flow-authoring.d.ts +2 -1
- package/dist/browser/flow-authoring.js +386 -96
- package/dist/browser/flow-change.d.ts +9 -4
- package/dist/browser/flow-change.js +49 -46
- package/dist/browser/{flowRunInputEditorStore-DXOyyY7o.js → flowRunInputEditorStore-BeyUSWpO.js} +1644 -908
- package/dist/browser/{flowWorkspace-D7-rBA1-.js → flowWorkspace-DwyxAOBH.js} +18384 -16381
- package/dist/browser/getPseudoElementBounds-ESJExRFX.js +7642 -0
- package/dist/browser/languages-DgJehE1g.js +62 -0
- package/dist/browser/lib-C5Ipyfps.js +7856 -0
- package/dist/browser/licenses.md +119 -1
- package/dist/browser/main-DmjVyuWr.js +76 -0
- package/dist/browser/{markdownContent-ColGUxHy.js → markdownContent-DdlIRN3_.js} +4811 -4795
- package/dist/browser/theme.css +63 -0
- package/dist/browser/theme.css.d.ts +1 -0
- package/dist/browser/typeScriptSession-mPCiA9sV.js +2579 -0
- package/dist/browser/workbench-contract.d.ts +2 -1
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.d.ts +45 -1
- package/dist/browser/workbench.js +980 -1322
- package/dist/browser/workbenchSelect-B2s1HV-Y.js +1374 -0
- package/dist/common/connector-action.d.ts +6 -0
- package/dist/common/connector-action.js +37 -29
- package/dist/common/control-api-conformance.js +45 -4
- package/dist/common/control-api-errors.d.ts +16 -0
- package/dist/common/control-api.d.ts +20 -6
- package/dist/common/control-api.js +151 -95
- package/dist/common/flow-encoding.d.ts +2 -2
- package/dist/common/flow-encoding.js +4 -1
- package/dist/common/flow-semantics.d.ts +3 -0
- package/dist/common/flow-semantics.js +939 -844
- 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/scheduler.d.ts +5 -5
- package/dist/common/scheduler.js +250 -236
- package/package.json +10 -1
- package/dist/browser/addNodeOptions-DRndy4EK.js +0 -6910
- package/dist/browser/createLucideIcon-CqjqCezK.js +0 -5537
- package/dist/browser/field-CKGQHCIi.js +0 -312
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { a as e, f as t, i as n } from "./dist-C46JByB-.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { a as r, i, s as a, t as o } from "./main-DmjVyuWr.js";
|
|
3
|
+
import { At as s, It as c, Jn as l, Kn as u, Mt as d, Ot as f, Qn as p, Xn as m, Yn as h, Zn as g, er as _, jt as v } from "./getPseudoElementBounds-ESJExRFX.js";
|
|
4
|
+
import { A as y, At as b, B as x, C as S, Ct as C, D as w, Dt as ee, E as T, Et as te, Ft as E, G as ne, H as D, I as O, K as re, Lt as k, M as A, Mt as ie, N as j, Nt as ae, O as M, Ot as oe, P as se, Pt as ce, R as N, Rt as P, S as le, Tt as ue, U as de, V as fe, W as pe, _ as me, a as F, b as he, c as ge, d as _e, f as ve, g as ye, h as be, i as xe, j as I, jt as Se, kt as Ce, l as we, m as Te, n as Ee, p as De, q as Oe, s as ke, t as Ae, u as je, v as Me, w as Ne, wt as L, x as Pe, y as Fe, z as R } from "./diagnostics-BGoGFvHA.js";
|
|
5
|
+
import { t as Ie } from "./workbenchSelect-B2s1HV-Y.js";
|
|
6
|
+
import { a as Le, i as Re, n as ze, r as Be } from "./languages-DgJehE1g.js";
|
|
7
|
+
import { Suspense as Ve, lazy as He, useEffect as z, useRef as Ue, useState as B } from "react";
|
|
8
|
+
import { Fragment as We, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
6
9
|
//#region src/workbench/browser/runtime/navigation.ts
|
|
7
|
-
var
|
|
10
|
+
var Ge = class {
|
|
8
11
|
#e;
|
|
9
12
|
#t;
|
|
10
13
|
#n;
|
|
@@ -31,14 +34,14 @@ var ce = class {
|
|
|
31
34
|
open(e) {
|
|
32
35
|
this.#i += 1, this.#s = !1, this.#u(e, !1);
|
|
33
36
|
}
|
|
34
|
-
async createFlow(e) {
|
|
35
|
-
let
|
|
37
|
+
async createFlow(e, t) {
|
|
38
|
+
let n = ++this.#i;
|
|
36
39
|
this.#s = !0;
|
|
37
40
|
try {
|
|
38
|
-
let
|
|
39
|
-
return
|
|
41
|
+
let r = await this.#n.createFlow(e, t);
|
|
42
|
+
return r && n == this.#i && this.#u("design", !1), r;
|
|
40
43
|
} finally {
|
|
41
|
-
|
|
44
|
+
n == this.#i && (this.#s = !1);
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
async createSubflow(e) {
|
|
@@ -63,7 +66,7 @@ var ce = class {
|
|
|
63
66
|
this.#s = !0, await this.#n.selectFlow(void 0), e == this.#i && (this.#u("design", !1), this.#s = !1);
|
|
64
67
|
}
|
|
65
68
|
async apply(e) {
|
|
66
|
-
if (
|
|
69
|
+
if (Ke(e, this.#t)) return;
|
|
67
70
|
this.#t = e;
|
|
68
71
|
let t = ++this.#i;
|
|
69
72
|
this.#s = !0;
|
|
@@ -79,15 +82,450 @@ var ce = class {
|
|
|
79
82
|
flowId: this.#n.workspace.$.flowId.value,
|
|
80
83
|
view: e
|
|
81
84
|
};
|
|
82
|
-
|
|
85
|
+
Ke(n, this.#t) || (this.#t = n, this.#e(n, { replace: t })), this.#r.set(e);
|
|
83
86
|
}
|
|
84
87
|
};
|
|
85
|
-
function
|
|
88
|
+
function Ke(e, t) {
|
|
86
89
|
return e.flowId == t.flowId && e.view == t.view;
|
|
87
90
|
}
|
|
88
91
|
//#endregion
|
|
89
|
-
//#region src/workbench/browser/runtime/
|
|
90
|
-
var
|
|
92
|
+
//#region src/workbench/browser/runtime/shell/resourceBrowser.tsx
|
|
93
|
+
var qe = He(() => import("./createResourceDialog-DXQz0thK.js")), Je = Le.map((e) => ({
|
|
94
|
+
label: Re[e],
|
|
95
|
+
value: e
|
|
96
|
+
}));
|
|
97
|
+
function Ye({ language: e, onLanguageChange: t }) {
|
|
98
|
+
let n = r(), [i, a] = B(null);
|
|
99
|
+
return t == null ? null : /* @__PURE__ */ H("div", {
|
|
100
|
+
className: "resource-language",
|
|
101
|
+
ref: a,
|
|
102
|
+
children: [/* @__PURE__ */ V("span", {
|
|
103
|
+
className: "sr-only",
|
|
104
|
+
children: n("language.label")
|
|
105
|
+
}), /* @__PURE__ */ V(Ie, {
|
|
106
|
+
ariaLabel: n("language.label"),
|
|
107
|
+
onValueChange: (e) => t(e),
|
|
108
|
+
options: Je,
|
|
109
|
+
portalRoot: i,
|
|
110
|
+
value: e
|
|
111
|
+
})]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function Xe({ badge: e, busy: t, flow: n, href: a, onSelect: o, store: s }) {
|
|
115
|
+
let l = i(), u = r(), [d, m] = B("idle"), [h, y] = B(n.name), b = v(h);
|
|
116
|
+
async function x(e) {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
let t = h.trim();
|
|
119
|
+
v(t) == null && await s.workspace.renameFlow(n.flowId, t) && m("idle");
|
|
120
|
+
}
|
|
121
|
+
async function S() {
|
|
122
|
+
await s.workspace.deleteFlow(n.flowId) && m("idle");
|
|
123
|
+
}
|
|
124
|
+
return /* @__PURE__ */ H("div", {
|
|
125
|
+
className: "resource-item-row",
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ H(p, {
|
|
128
|
+
"aria-disabled": n.status == "retiring",
|
|
129
|
+
className: "resource-list-row flow-columns",
|
|
130
|
+
nativeButton: !1,
|
|
131
|
+
onClick: (e) => {
|
|
132
|
+
if (n.status == "retiring") {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
C(e, () => o(n));
|
|
137
|
+
},
|
|
138
|
+
render: /* @__PURE__ */ V("a", { href: n.status == "retiring" ? void 0 : a }),
|
|
139
|
+
tabIndex: n.status == "retiring" ? -1 : void 0,
|
|
140
|
+
variant: "ghost",
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ H("span", {
|
|
143
|
+
className: "resource-primary-cell",
|
|
144
|
+
children: [/* @__PURE__ */ V("span", {
|
|
145
|
+
className: "resource-icon",
|
|
146
|
+
children: /* @__PURE__ */ V(f, { name: "flow" })
|
|
147
|
+
}), /* @__PURE__ */ H("span", { children: [/* @__PURE__ */ H("span", {
|
|
148
|
+
className: "flex min-w-0 items-center gap-2",
|
|
149
|
+
children: [/* @__PURE__ */ V("strong", {
|
|
150
|
+
className: "min-w-0 truncate",
|
|
151
|
+
children: n.name
|
|
152
|
+
}), e != null && /* @__PURE__ */ V(ce, {
|
|
153
|
+
className: "min-w-0 shrink",
|
|
154
|
+
title: e,
|
|
155
|
+
variant: "secondary",
|
|
156
|
+
children: /* @__PURE__ */ V("span", {
|
|
157
|
+
className: "truncate",
|
|
158
|
+
children: e
|
|
159
|
+
})
|
|
160
|
+
})]
|
|
161
|
+
}), /* @__PURE__ */ V("code", {
|
|
162
|
+
translate: "no",
|
|
163
|
+
children: n.flowId
|
|
164
|
+
})] })]
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ V("time", {
|
|
167
|
+
dateTime: n.updatedAt,
|
|
168
|
+
children: new Date(n.updatedAt).toLocaleString(l)
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ H("span", {
|
|
171
|
+
className: `resource-status ${n.status == "active" ? "active" : "warning"}`,
|
|
172
|
+
children: [/* @__PURE__ */ V("span", {
|
|
173
|
+
"aria-hidden": "true",
|
|
174
|
+
className: `status-dot ${n.status == "active" ? "success" : "running"}`
|
|
175
|
+
}), u(n.status == "active" ? "resource.active" : "resource.retiring")]
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
}),
|
|
179
|
+
n.status == "active" && /* @__PURE__ */ V(p, {
|
|
180
|
+
"aria-expanded": d != "idle",
|
|
181
|
+
"aria-label": u("sidebar.flowActions", { name: n.name }),
|
|
182
|
+
className: _("resource-row-more", d != "idle" && "active"),
|
|
183
|
+
disabled: t != null,
|
|
184
|
+
onClick: () => m(d == "idle" ? "actions" : "idle"),
|
|
185
|
+
size: "icon-sm",
|
|
186
|
+
variant: "ghost",
|
|
187
|
+
children: /* @__PURE__ */ V(f, { name: "more" })
|
|
188
|
+
}),
|
|
189
|
+
d == "actions" && /* @__PURE__ */ H("div", {
|
|
190
|
+
className: "resource-row-actions",
|
|
191
|
+
children: [/* @__PURE__ */ V(p, {
|
|
192
|
+
onClick: () => {
|
|
193
|
+
y(n.name), m("rename");
|
|
194
|
+
},
|
|
195
|
+
size: "sm",
|
|
196
|
+
variant: "outline",
|
|
197
|
+
children: u("common.rename")
|
|
198
|
+
}), /* @__PURE__ */ V(p, {
|
|
199
|
+
onClick: () => m("delete"),
|
|
200
|
+
size: "sm",
|
|
201
|
+
variant: "destructive",
|
|
202
|
+
children: u("common.delete")
|
|
203
|
+
})]
|
|
204
|
+
}),
|
|
205
|
+
d == "rename" && /* @__PURE__ */ H("form", {
|
|
206
|
+
className: "resource-row-form",
|
|
207
|
+
onSubmit: (e) => void x(e),
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ V(g, {
|
|
210
|
+
htmlFor: `rename-flow-${n.flowId}`,
|
|
211
|
+
children: u("sidebar.renameFlow", { name: n.name })
|
|
212
|
+
}),
|
|
213
|
+
/* @__PURE__ */ H("span", {
|
|
214
|
+
className: "resource-row-field",
|
|
215
|
+
children: [/* @__PURE__ */ V(c, {
|
|
216
|
+
autoComplete: "off",
|
|
217
|
+
"aria-invalid": h.length > 0 && b != null,
|
|
218
|
+
autoFocus: !0,
|
|
219
|
+
id: `rename-flow-${n.flowId}`,
|
|
220
|
+
name: "flow-name",
|
|
221
|
+
onChange: (e) => y(e.target.value),
|
|
222
|
+
required: !0,
|
|
223
|
+
value: h
|
|
224
|
+
}), h.length > 0 && b != null && /* @__PURE__ */ V("small", {
|
|
225
|
+
className: "resource-name-message error",
|
|
226
|
+
children: u(`resource.nameIssue.${b}`, { max: 80 })
|
|
227
|
+
})]
|
|
228
|
+
}),
|
|
229
|
+
/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V(p, {
|
|
230
|
+
onClick: () => m("idle"),
|
|
231
|
+
size: "sm",
|
|
232
|
+
variant: "outline",
|
|
233
|
+
children: u("common.cancel")
|
|
234
|
+
}), /* @__PURE__ */ V(p, {
|
|
235
|
+
disabled: t != null || b != null,
|
|
236
|
+
size: "sm",
|
|
237
|
+
type: "submit",
|
|
238
|
+
children: u("common.save")
|
|
239
|
+
})] })
|
|
240
|
+
]
|
|
241
|
+
}),
|
|
242
|
+
d == "delete" && /* @__PURE__ */ H("div", {
|
|
243
|
+
className: "resource-row-confirm",
|
|
244
|
+
role: "group",
|
|
245
|
+
"aria-label": u("sidebar.deleteFlow", { name: n.name }),
|
|
246
|
+
children: [/* @__PURE__ */ V("span", { children: /* @__PURE__ */ V("strong", { children: u("sidebar.deleteFlowConfirm", { name: n.name }) }) }), /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V(p, {
|
|
247
|
+
onClick: () => m("idle"),
|
|
248
|
+
size: "sm",
|
|
249
|
+
variant: "outline",
|
|
250
|
+
children: u("common.cancel")
|
|
251
|
+
}), /* @__PURE__ */ V(p, {
|
|
252
|
+
disabled: t != null,
|
|
253
|
+
onClick: () => void S(),
|
|
254
|
+
size: "sm",
|
|
255
|
+
variant: "destructive",
|
|
256
|
+
children: u(t == "flow" ? "common.deleting" : "common.delete")
|
|
257
|
+
})] })]
|
|
258
|
+
})
|
|
259
|
+
]
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function Ze() {
|
|
263
|
+
return /* @__PURE__ */ H("div", {
|
|
264
|
+
"aria-hidden": "true",
|
|
265
|
+
className: "resource-list-row resource-skeleton-row flow-columns",
|
|
266
|
+
children: [
|
|
267
|
+
/* @__PURE__ */ H("span", {
|
|
268
|
+
className: "resource-primary-cell",
|
|
269
|
+
children: [/* @__PURE__ */ V(L, { className: "size-8 shrink-0" }), /* @__PURE__ */ H("span", {
|
|
270
|
+
className: "resource-skeleton-copy",
|
|
271
|
+
children: [/* @__PURE__ */ V(L, { className: "h-3.5 w-36" }), /* @__PURE__ */ V(L, { className: "h-2.5 w-48 max-w-full" })]
|
|
272
|
+
})]
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ V(L, { className: "h-3 w-28" }),
|
|
275
|
+
/* @__PURE__ */ V(L, { className: "h-3 w-16" })
|
|
276
|
+
]
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
function Qe({ createFlowDisabled: e, createFlowField: t, flowBadges: n, hrefForFlow: i, hostAction: o, hostTitle: s, language: c, onCreateFlow: l, onHostAction: u, onLanguageChange: d, onSelectFlow: m, store: h }) {
|
|
280
|
+
let g = r(), _ = a(h.workspace.$.busy), y = a(h.workspace.$.flowLoadFailed), x = a(h.workspace.$.flowLoadMoreFailed), S = a(h.workspace.$.flowLoading), C = a(h.workspace.$.flowLoadingMore), w = a(h.workspace.$.flowNextCursor), T = a(h.workspace.$.flows), E = a(h.workspace.$.flowTotal), [ne, D] = B(!1), [O, re] = B(""), [k, A] = B(""), j = O.trim().toLocaleLowerCase(), M = T.filter((e) => e.name.toLocaleLowerCase().includes(j));
|
|
281
|
+
async function se(e) {
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
let t = k.trim();
|
|
284
|
+
v(t) != null || !await l(t) || (D(!1), A(""));
|
|
285
|
+
}
|
|
286
|
+
return /* @__PURE__ */ V("main", {
|
|
287
|
+
className: "resource-browser",
|
|
288
|
+
children: /* @__PURE__ */ H("div", {
|
|
289
|
+
className: "resource-page",
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ H("header", {
|
|
292
|
+
className: "resource-page-header",
|
|
293
|
+
children: [/* @__PURE__ */ V("div", {
|
|
294
|
+
className: "resource-heading",
|
|
295
|
+
children: /* @__PURE__ */ V("h1", { children: g("resource.flows") })
|
|
296
|
+
}), /* @__PURE__ */ H("div", {
|
|
297
|
+
className: "resource-page-actions",
|
|
298
|
+
children: [
|
|
299
|
+
/* @__PURE__ */ V(Ye, {
|
|
300
|
+
language: c,
|
|
301
|
+
onLanguageChange: d
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ H(p, {
|
|
304
|
+
disabled: _ != null,
|
|
305
|
+
onClick: () => D(!0),
|
|
306
|
+
children: [/* @__PURE__ */ V(f, {
|
|
307
|
+
"data-icon": "inline-start",
|
|
308
|
+
name: "plus"
|
|
309
|
+
}), g("resource.newFlow")]
|
|
310
|
+
}),
|
|
311
|
+
o != null && s != null && u != null && /* @__PURE__ */ V(Oe, {
|
|
312
|
+
action: o,
|
|
313
|
+
onAction: u,
|
|
314
|
+
title: s
|
|
315
|
+
})
|
|
316
|
+
]
|
|
317
|
+
})]
|
|
318
|
+
}),
|
|
319
|
+
/* @__PURE__ */ H("section", {
|
|
320
|
+
"aria-labelledby": "flow-list-title",
|
|
321
|
+
className: "resource-list-section",
|
|
322
|
+
children: [
|
|
323
|
+
/* @__PURE__ */ H("div", {
|
|
324
|
+
className: "resource-list-title",
|
|
325
|
+
children: [/* @__PURE__ */ H("div", {
|
|
326
|
+
className: "resource-list-heading",
|
|
327
|
+
children: [/* @__PURE__ */ V("h2", {
|
|
328
|
+
id: "flow-list-title",
|
|
329
|
+
children: g("resource.allFlows")
|
|
330
|
+
}), !S && /* @__PURE__ */ V("span", { children: g("resource.flowCount", { count: E ?? T.length }) })]
|
|
331
|
+
}), /* @__PURE__ */ H("div", {
|
|
332
|
+
className: "resource-list-actions",
|
|
333
|
+
children: [/* @__PURE__ */ H(ue, {
|
|
334
|
+
className: "w-full sm:w-56",
|
|
335
|
+
children: [/* @__PURE__ */ V(te, { children: /* @__PURE__ */ V(f, {
|
|
336
|
+
name: "search",
|
|
337
|
+
size: 17
|
|
338
|
+
}) }), /* @__PURE__ */ V(ee, {
|
|
339
|
+
autoComplete: "off",
|
|
340
|
+
"aria-label": g("resource.searchFlows"),
|
|
341
|
+
name: "flow-search",
|
|
342
|
+
onChange: (e) => re(e.target.value),
|
|
343
|
+
placeholder: g("resource.searchFlows"),
|
|
344
|
+
value: O
|
|
345
|
+
})]
|
|
346
|
+
}), /* @__PURE__ */ V(p, {
|
|
347
|
+
"aria-label": g("common.refresh"),
|
|
348
|
+
disabled: S || _ != null,
|
|
349
|
+
onClick: () => void h.workspace.reloadFlows(),
|
|
350
|
+
size: "icon",
|
|
351
|
+
title: g("common.refresh"),
|
|
352
|
+
variant: "outline",
|
|
353
|
+
children: /* @__PURE__ */ V(f, { name: "refresh" })
|
|
354
|
+
})]
|
|
355
|
+
})]
|
|
356
|
+
}),
|
|
357
|
+
/* @__PURE__ */ H("div", {
|
|
358
|
+
"aria-hidden": "true",
|
|
359
|
+
className: "resource-list-columns flow-columns",
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ V("span", { children: g("resource.name") }),
|
|
362
|
+
/* @__PURE__ */ V("span", { children: g("resource.updated") }),
|
|
363
|
+
/* @__PURE__ */ V("span", { children: g("resource.status") })
|
|
364
|
+
]
|
|
365
|
+
}),
|
|
366
|
+
/* @__PURE__ */ V("div", {
|
|
367
|
+
className: "resource-list",
|
|
368
|
+
children: S ? Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ V(Ze, {}, t)) : y ? /* @__PURE__ */ H(oe, {
|
|
369
|
+
className: "min-h-64",
|
|
370
|
+
role: "alert",
|
|
371
|
+
children: [/* @__PURE__ */ H(Se, { children: [
|
|
372
|
+
/* @__PURE__ */ V(ie, {
|
|
373
|
+
variant: "icon",
|
|
374
|
+
children: /* @__PURE__ */ V(f, {
|
|
375
|
+
name: "alert",
|
|
376
|
+
size: 20
|
|
377
|
+
})
|
|
378
|
+
}),
|
|
379
|
+
/* @__PURE__ */ V(ae, { children: g("resource.flowsLoadFailed") }),
|
|
380
|
+
/* @__PURE__ */ V(b, { children: g("resource.flowsLoadFailedDescription") })
|
|
381
|
+
] }), /* @__PURE__ */ V(Ce, { children: /* @__PURE__ */ V(p, {
|
|
382
|
+
onClick: () => void h.retryFlows(),
|
|
383
|
+
variant: "outline",
|
|
384
|
+
children: g("empty.retry")
|
|
385
|
+
}) })]
|
|
386
|
+
}) : M.length == 0 ? /* @__PURE__ */ H(oe, {
|
|
387
|
+
className: "min-h-64",
|
|
388
|
+
children: [/* @__PURE__ */ H(Se, { children: [
|
|
389
|
+
/* @__PURE__ */ V(ie, {
|
|
390
|
+
variant: "icon",
|
|
391
|
+
children: /* @__PURE__ */ V(f, {
|
|
392
|
+
name: "flow",
|
|
393
|
+
size: 20
|
|
394
|
+
})
|
|
395
|
+
}),
|
|
396
|
+
/* @__PURE__ */ V(ae, { children: g(j.length == 0 ? "resource.noFlows" : "resource.noMatchingFlows") }),
|
|
397
|
+
/* @__PURE__ */ V(b, { children: g(j.length == 0 ? "resource.noFlowsDescription" : "resource.noMatchingDescription") })
|
|
398
|
+
] }), j.length == 0 && /* @__PURE__ */ V(Ce, { children: /* @__PURE__ */ H(p, {
|
|
399
|
+
onClick: () => D(!0),
|
|
400
|
+
variant: "outline",
|
|
401
|
+
children: [/* @__PURE__ */ V(f, {
|
|
402
|
+
"data-icon": "inline-start",
|
|
403
|
+
name: "plus"
|
|
404
|
+
}), g("resource.newFlow")]
|
|
405
|
+
}) })]
|
|
406
|
+
}) : M.map((e) => /* @__PURE__ */ V(Xe, {
|
|
407
|
+
badge: n?.[e.flowId],
|
|
408
|
+
busy: _,
|
|
409
|
+
flow: e,
|
|
410
|
+
href: i(e),
|
|
411
|
+
onSelect: m,
|
|
412
|
+
store: h
|
|
413
|
+
}, e.flowId))
|
|
414
|
+
}),
|
|
415
|
+
w != null && /* @__PURE__ */ V("div", {
|
|
416
|
+
className: "resource-list-footer",
|
|
417
|
+
children: /* @__PURE__ */ V(p, {
|
|
418
|
+
disabled: C,
|
|
419
|
+
onClick: () => void h.workspace.loadMoreFlows(),
|
|
420
|
+
variant: "outline",
|
|
421
|
+
children: g(C ? "resource.loadingMore" : x ? "resource.retryLoadMore" : "resource.loadMore")
|
|
422
|
+
})
|
|
423
|
+
})
|
|
424
|
+
]
|
|
425
|
+
}),
|
|
426
|
+
ne && /* @__PURE__ */ V(Ve, {
|
|
427
|
+
fallback: null,
|
|
428
|
+
children: /* @__PURE__ */ V(qe, {
|
|
429
|
+
disabled: e,
|
|
430
|
+
field: t,
|
|
431
|
+
id: "flow-name",
|
|
432
|
+
issue: v(k),
|
|
433
|
+
label: g("resource.flowName"),
|
|
434
|
+
name: k,
|
|
435
|
+
onNameChange: A,
|
|
436
|
+
onOpenChange: D,
|
|
437
|
+
onSubmit: (e) => void se(e),
|
|
438
|
+
pending: _ == "flow",
|
|
439
|
+
title: g("resource.newFlow")
|
|
440
|
+
})
|
|
441
|
+
})
|
|
442
|
+
]
|
|
443
|
+
})
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region ../../node_modules/.bun/nanoid@6.0.1/node_modules/nanoid/index.browser.js
|
|
448
|
+
var $e = (e) => crypto.getRandomValues(new Uint8Array(e)), et = (e, t, n) => {
|
|
449
|
+
let r = 256 - 256 % e.length;
|
|
450
|
+
if (r === 256) {
|
|
451
|
+
let r = e.length - 1;
|
|
452
|
+
return (i = t) => {
|
|
453
|
+
if (!i) return "";
|
|
454
|
+
let a = "";
|
|
455
|
+
for (;;) {
|
|
456
|
+
let t = n(i), o = i;
|
|
457
|
+
for (; o--;) if (a += e[t[o] & r], a.length >= i) return a;
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
let i = Math.ceil(409.6 * t / r);
|
|
462
|
+
return (a = t) => {
|
|
463
|
+
if (!a) return "";
|
|
464
|
+
let o = "";
|
|
465
|
+
for (;;) {
|
|
466
|
+
let t = n(i), s = i;
|
|
467
|
+
for (; s--;) if (t[s] < r && (o += e[t[s] % e.length], o.length >= a)) return o;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
}, tt = (e, t = 21) => et(e, t | 0, $e);
|
|
471
|
+
//#endregion
|
|
472
|
+
//#region src/flow/common/edgeChanges.ts
|
|
473
|
+
function nt(e, t, n) {
|
|
474
|
+
let r = {
|
|
475
|
+
source: n.source,
|
|
476
|
+
sourceHandle: n.sourceHandle,
|
|
477
|
+
target: n.target,
|
|
478
|
+
targetHandle: n.targetHandle
|
|
479
|
+
}, i = it(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
|
|
480
|
+
return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : fe(e, [{
|
|
481
|
+
edge: r,
|
|
482
|
+
kind: "graph.edge.connect",
|
|
483
|
+
target: t
|
|
484
|
+
}]);
|
|
485
|
+
}
|
|
486
|
+
function rt(e, t, n) {
|
|
487
|
+
let r = {
|
|
488
|
+
source: n.source,
|
|
489
|
+
sourceHandle: n.sourceHandle,
|
|
490
|
+
target: n.target,
|
|
491
|
+
targetHandle: n.targetHandle
|
|
492
|
+
}, i = it(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
|
|
493
|
+
return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
|
|
494
|
+
edge: r,
|
|
495
|
+
kind: "graph.edge.disconnect",
|
|
496
|
+
target: t
|
|
497
|
+
}];
|
|
498
|
+
}
|
|
499
|
+
function it(e, t) {
|
|
500
|
+
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
501
|
+
}
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region src/flow/common/moduleChanges.ts
|
|
504
|
+
async function at(e) {
|
|
505
|
+
try {
|
|
506
|
+
let { parse: t } = await import("./lib-C5Ipyfps.js").then((e) => e.t), n = t(e, {
|
|
507
|
+
errorRecovery: !0,
|
|
508
|
+
sourceType: "module"
|
|
509
|
+
}).program, r = /* @__PURE__ */ new Set();
|
|
510
|
+
for (let e of n.body) {
|
|
511
|
+
if (e.type != "ImportDeclaration") continue;
|
|
512
|
+
let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
|
|
513
|
+
t?.[1] != null && r.add(t[1]);
|
|
514
|
+
}
|
|
515
|
+
return [...r].toSorted();
|
|
516
|
+
} catch {
|
|
517
|
+
return [];
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
function ot(e, t, n) {
|
|
521
|
+
return [{
|
|
522
|
+
imports: n,
|
|
523
|
+
kind: "module.source.replace",
|
|
524
|
+
moduleId: e,
|
|
525
|
+
source: t
|
|
526
|
+
}];
|
|
527
|
+
}
|
|
528
|
+
var st = tt("23456789abcdefghjkmnpqrstuvwxyz", 10), U = {
|
|
91
529
|
activities: [],
|
|
92
530
|
activitiesLoadFailed: !1,
|
|
93
531
|
activitiesLoading: !1,
|
|
@@ -100,11 +538,11 @@ var T = {
|
|
|
100
538
|
loadingMore: !1,
|
|
101
539
|
publications: [],
|
|
102
540
|
publishing: !1
|
|
103
|
-
},
|
|
104
|
-
function
|
|
541
|
+
}, ct = 20, lt = 50;
|
|
542
|
+
function W(e, t) {
|
|
105
543
|
return e?.flowId == t.flowId;
|
|
106
544
|
}
|
|
107
|
-
var
|
|
545
|
+
var ut = class {
|
|
108
546
|
#e;
|
|
109
547
|
#t;
|
|
110
548
|
#n;
|
|
@@ -113,10 +551,10 @@ var de = class {
|
|
|
113
551
|
#a = new x();
|
|
114
552
|
#o = new x();
|
|
115
553
|
#s;
|
|
116
|
-
#c = t(
|
|
554
|
+
#c = t(U);
|
|
117
555
|
#l;
|
|
118
556
|
#u;
|
|
119
|
-
constructor(t, n, r, i = () => crypto.randomUUID(), a =
|
|
557
|
+
constructor(t, n, r, i = () => crypto.randomUUID(), a = E()) {
|
|
120
558
|
this.#e = t, this.#t = i, this.#n = a, this.#s = r, this.#l = n, this.$ = {
|
|
121
559
|
activities: e(this.#c, (e) => e.activities),
|
|
122
560
|
activitiesLoadFailed: e(this.#c, (e) => e.activitiesLoadFailed),
|
|
@@ -148,12 +586,12 @@ var de = class {
|
|
|
148
586
|
this.#c.dispose();
|
|
149
587
|
}
|
|
150
588
|
reset() {
|
|
151
|
-
this.#r.invalidate(), this.#i.invalidate(), this.#a.invalidate(), this.#o.invalidate(), this.#u = void 0, this.#c.set(
|
|
589
|
+
this.#r.invalidate(), this.#i.invalidate(), this.#a.invalidate(), this.#o.invalidate(), this.#u = void 0, this.#c.set(U);
|
|
152
590
|
}
|
|
153
591
|
async load(e) {
|
|
154
592
|
let t = { flowId: e }, n = this.#r.begin();
|
|
155
|
-
|
|
156
|
-
...
|
|
593
|
+
W(this.#c.value.target, t) || (this.#u = void 0), this.#s(void 0), this.#c.set({
|
|
594
|
+
...U,
|
|
157
595
|
loading: !0,
|
|
158
596
|
target: t
|
|
159
597
|
});
|
|
@@ -173,7 +611,7 @@ var de = class {
|
|
|
173
611
|
this.#h({
|
|
174
612
|
loadFailed: !0,
|
|
175
613
|
loading: !1
|
|
176
|
-
}), this.#s(
|
|
614
|
+
}), this.#s(R(e, this.#n.t));
|
|
177
615
|
}
|
|
178
616
|
}
|
|
179
617
|
async loadMore() {
|
|
@@ -187,7 +625,7 @@ var de = class {
|
|
|
187
625
|
try {
|
|
188
626
|
let e = await this.#e.listPublications(n.flowId, {
|
|
189
627
|
cursor: t,
|
|
190
|
-
limit:
|
|
628
|
+
limit: lt
|
|
191
629
|
});
|
|
192
630
|
if (!r()) return;
|
|
193
631
|
let i = new Set(this.#c.value.publications.map((e) => e.publicationId));
|
|
@@ -202,7 +640,7 @@ var de = class {
|
|
|
202
640
|
this.#h({
|
|
203
641
|
loadMoreFailed: !0,
|
|
204
642
|
loadingMore: !1
|
|
205
|
-
}), this.#s(
|
|
643
|
+
}), this.#s(R(e, this.#n.t));
|
|
206
644
|
}
|
|
207
645
|
}
|
|
208
646
|
async publish() {
|
|
@@ -224,7 +662,7 @@ var de = class {
|
|
|
224
662
|
message: this.#n.t("notice.published", { name: e.name })
|
|
225
663
|
}), !0);
|
|
226
664
|
} catch (e) {
|
|
227
|
-
return o() ? (e instanceof
|
|
665
|
+
return o() ? (e instanceof P && e.code == "live.conflict" && await this.#f(n), this.#s(R(e, this.#n.t)), !1) : !1;
|
|
228
666
|
} finally {
|
|
229
667
|
o() && this.#h({ publishing: !1 });
|
|
230
668
|
}
|
|
@@ -240,17 +678,17 @@ var de = class {
|
|
|
240
678
|
}), o = this.#u?.signature == a ? this.#u : {
|
|
241
679
|
key: this.#t(),
|
|
242
680
|
signature: a
|
|
243
|
-
},
|
|
681
|
+
}, s = this.#i.begin();
|
|
244
682
|
this.#u = o, this.#s(void 0), this.#h({ rollingBackPublicationId: e.publicationId });
|
|
245
683
|
try {
|
|
246
|
-
return await this.#e.rollbackFlow(r.flowId, e.publicationId, i, { idempotencyKey: o.key }), !
|
|
684
|
+
return await this.#e.rollbackFlow(r.flowId, e.publicationId, i, { idempotencyKey: o.key }), !s() || (await this.#d(r), !s()) ? !1 : (this.#u = void 0, this.#s({
|
|
247
685
|
kind: "success",
|
|
248
686
|
message: this.#n.t("notice.rolledBack", { revision: e.revisionId })
|
|
249
687
|
}), !0);
|
|
250
688
|
} catch (e) {
|
|
251
|
-
return
|
|
689
|
+
return s() ? (e instanceof P && e.code == "live.conflict" && await this.#f(r), this.#s(R(e, this.#n.t)), !1) : !1;
|
|
252
690
|
} finally {
|
|
253
|
-
|
|
691
|
+
s() && this.#h({ rollingBackPublicationId: void 0 });
|
|
254
692
|
}
|
|
255
693
|
}
|
|
256
694
|
closeTrigger() {
|
|
@@ -283,13 +721,13 @@ var de = class {
|
|
|
283
721
|
testingTriggerId: void 0,
|
|
284
722
|
testResult: void 0
|
|
285
723
|
});
|
|
286
|
-
let [r, i] = await Promise.allSettled([this.#e.getFlowTriggerBinding(t.flowId, e), this.#e.listFlowTriggerActivities(t.flowId, e, { limit:
|
|
724
|
+
let [r, i] = await Promise.allSettled([this.#e.getFlowTriggerBinding(t.flowId, e), this.#e.listFlowTriggerActivities(t.flowId, e, { limit: ct })]);
|
|
287
725
|
if (n()) {
|
|
288
726
|
if (r.status == "rejected") {
|
|
289
727
|
this.#h({
|
|
290
728
|
activitiesLoading: !1,
|
|
291
729
|
detailLoading: !1
|
|
292
|
-
}), this.#s(
|
|
730
|
+
}), this.#s(R(r.reason, this.#n.t));
|
|
293
731
|
return;
|
|
294
732
|
}
|
|
295
733
|
this.#h({
|
|
@@ -303,7 +741,7 @@ var de = class {
|
|
|
303
741
|
}) : (this.#h({
|
|
304
742
|
activitiesLoadFailed: !0,
|
|
305
743
|
activitiesLoading: !1
|
|
306
|
-
}), this.#s(
|
|
744
|
+
}), this.#s(R(i.reason, this.#n.t)));
|
|
307
745
|
}
|
|
308
746
|
}
|
|
309
747
|
async loadMoreTriggerActivities() {
|
|
@@ -317,7 +755,7 @@ var de = class {
|
|
|
317
755
|
try {
|
|
318
756
|
let e = await this.#e.listFlowTriggerActivities(r.flowId, n, {
|
|
319
757
|
cursor: t,
|
|
320
|
-
limit:
|
|
758
|
+
limit: ct
|
|
321
759
|
});
|
|
322
760
|
if (!i() || this.#c.value.selectedTriggerId != n) return;
|
|
323
761
|
let a = new Set(this.#c.value.activities.map((e) => e.activityId));
|
|
@@ -332,7 +770,7 @@ var de = class {
|
|
|
332
770
|
this.#h({
|
|
333
771
|
activitiesLoadFailed: !0,
|
|
334
772
|
activitiesLoadingMore: !1
|
|
335
|
-
}), this.#s(
|
|
773
|
+
}), this.#s(R(e, this.#n.t));
|
|
336
774
|
}
|
|
337
775
|
}
|
|
338
776
|
async testTrigger() {
|
|
@@ -347,7 +785,7 @@ var de = class {
|
|
|
347
785
|
let e = await this.#e.testFlowPollTrigger(n.flowId, t);
|
|
348
786
|
return !i() || this.#c.value.selectedTriggerId != t ? !1 : (this.#h({ testResult: e }), !0);
|
|
349
787
|
} catch (e) {
|
|
350
|
-
return i() && this.#c.value.selectedTriggerId == t && this.#s(
|
|
788
|
+
return i() && this.#c.value.selectedTriggerId == t && this.#s(R(e, this.#n.t)), !1;
|
|
351
789
|
} finally {
|
|
352
790
|
i() && this.#c.value.selectedTriggerId == t && this.#h({ testingTriggerId: void 0 });
|
|
353
791
|
}
|
|
@@ -365,14 +803,14 @@ var de = class {
|
|
|
365
803
|
message: this.#n.t(e.operatorState == "active" ? "notice.triggerPaused" : "notice.triggerResumed")
|
|
366
804
|
}), !0) : !1;
|
|
367
805
|
} catch (e) {
|
|
368
|
-
return n() && this.#s(
|
|
806
|
+
return n() && this.#s(R(e, this.#n.t)), !1;
|
|
369
807
|
} finally {
|
|
370
808
|
n() && this.#h({ changingTriggerId: void 0 });
|
|
371
809
|
}
|
|
372
810
|
}
|
|
373
811
|
async #d(e) {
|
|
374
812
|
let [t, n, r] = await this.#p(e);
|
|
375
|
-
this.#l.updateLive(t), await this.#l.refreshFlows(),
|
|
813
|
+
this.#l.updateLive(t), await this.#l.refreshFlows(), W(this.#c.value.target, e) && this.#h({
|
|
376
814
|
bindings: r,
|
|
377
815
|
live: t,
|
|
378
816
|
loadFailed: !1,
|
|
@@ -393,14 +831,14 @@ var de = class {
|
|
|
393
831
|
this.#e.getLive(e.flowId),
|
|
394
832
|
this.#e.listPublications(e.flowId, {
|
|
395
833
|
includeTotal: !0,
|
|
396
|
-
limit:
|
|
834
|
+
limit: lt
|
|
397
835
|
}),
|
|
398
836
|
this.#e.listFlowTriggerBindings(e.flowId)
|
|
399
837
|
]);
|
|
400
838
|
}
|
|
401
839
|
#m(e, t) {
|
|
402
|
-
|
|
403
|
-
...
|
|
840
|
+
W(this.#c.value.target, e) ? this.#h(t) : this.#c.set({
|
|
841
|
+
...U,
|
|
404
842
|
...t,
|
|
405
843
|
target: e
|
|
406
844
|
});
|
|
@@ -411,24 +849,24 @@ var de = class {
|
|
|
411
849
|
...e
|
|
412
850
|
});
|
|
413
851
|
}
|
|
414
|
-
},
|
|
415
|
-
function
|
|
852
|
+
}, dt = { starting: !1 };
|
|
853
|
+
function ft(e) {
|
|
416
854
|
switch (e.kind) {
|
|
417
855
|
case "condition": return { [e.node.input.handle]: e.node.input };
|
|
418
|
-
case "subflow": return
|
|
419
|
-
case "task": return
|
|
856
|
+
case "subflow": return s(e.definition?.inputs ?? []);
|
|
857
|
+
case "task": return s(e.definition?.inputs ?? []);
|
|
420
858
|
case "value": return {};
|
|
421
859
|
}
|
|
422
860
|
}
|
|
423
|
-
function
|
|
861
|
+
function pt(e) {
|
|
424
862
|
return e.node.name == null ? e.kind == "task" || e.kind == "subflow" ? e.definition?.name ?? e.id : e.id : e.node.name;
|
|
425
863
|
}
|
|
426
|
-
async function
|
|
427
|
-
let { FlowRunInputEditorStore: n } = await import("./flowRunInputEditorStore-
|
|
864
|
+
async function mt(e, t) {
|
|
865
|
+
let { FlowRunInputEditorStore: n } = await import("./flowRunInputEditorStore-BeyUSWpO.js").then((e) => e.n), r = N(e), i = r.graph({ kind: "flow" });
|
|
428
866
|
return i == null ? [] : Object.entries(i.nodes).toSorted(([e], [t]) => e.localeCompare(t)).flatMap(([e, i]) => {
|
|
429
867
|
let a = r.resolveNode(e, i);
|
|
430
868
|
if (a.kind == "trigger") return [];
|
|
431
|
-
let o = Object.entries(
|
|
869
|
+
let o = Object.entries(ft(a)).filter(([e, t]) => a.node.inputs[e] == null && !Object.hasOwn(t, "value")).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, t]) => Object.assign({
|
|
432
870
|
handle: e,
|
|
433
871
|
jsonSchema: t.jsonSchema,
|
|
434
872
|
nullable: t.nullable
|
|
@@ -436,11 +874,11 @@ async function he(e, t) {
|
|
|
436
874
|
return o.length == 0 ? [] : [{
|
|
437
875
|
editor: new n(o, t),
|
|
438
876
|
nodeId: e,
|
|
439
|
-
title:
|
|
877
|
+
title: pt(a)
|
|
440
878
|
}];
|
|
441
879
|
});
|
|
442
880
|
}
|
|
443
|
-
var
|
|
881
|
+
var ht = class {
|
|
444
882
|
#e;
|
|
445
883
|
#t;
|
|
446
884
|
#n;
|
|
@@ -448,9 +886,9 @@ var ge = class {
|
|
|
448
886
|
#i = new x();
|
|
449
887
|
#a;
|
|
450
888
|
#o;
|
|
451
|
-
#s = t(
|
|
889
|
+
#s = t(dt);
|
|
452
890
|
#c;
|
|
453
|
-
constructor(t, n, r, i =
|
|
891
|
+
constructor(t, n, r, i = E(), a = () => crypto.randomUUID()) {
|
|
454
892
|
this.#e = t, this.#a = n, this.#o = r, this.#n = i, this.#t = a, this.$ = {
|
|
455
893
|
inputRequest: e(this.#s, (e) => e.inputRequest),
|
|
456
894
|
starting: e(this.#s, (e) => e.starting),
|
|
@@ -465,7 +903,7 @@ var ge = class {
|
|
|
465
903
|
reset() {
|
|
466
904
|
this.#r.invalidate(), this.#i.invalidate(), this.#c = void 0;
|
|
467
905
|
let e = this.#s.value.inputRequest;
|
|
468
|
-
this.#s.set(
|
|
906
|
+
this.#s.set(dt), this.#d(e);
|
|
469
907
|
}
|
|
470
908
|
async requestDraft(e, t) {
|
|
471
909
|
let n = this.#i.begin();
|
|
@@ -480,7 +918,7 @@ var ge = class {
|
|
|
480
918
|
let r = await this.#e.getRevision(e.flowId, n.revisionId);
|
|
481
919
|
return t() ? await this.#l("live", e, r, n.revisionId, t, n.publicationId) : "unavailable";
|
|
482
920
|
} catch (e) {
|
|
483
|
-
return t() && this.#o(
|
|
921
|
+
return t() && this.#o(R(e, this.#n.t)), "unavailable";
|
|
484
922
|
} finally {
|
|
485
923
|
t() && this.#f({ starting: !1 });
|
|
486
924
|
}
|
|
@@ -504,11 +942,11 @@ var ge = class {
|
|
|
504
942
|
this.#f({
|
|
505
943
|
inputRequest: void 0,
|
|
506
944
|
starting: !0,
|
|
507
|
-
submitting:
|
|
945
|
+
submitting: void 0
|
|
508
946
|
}), this.#d(s);
|
|
509
947
|
let c;
|
|
510
948
|
try {
|
|
511
|
-
c = await
|
|
949
|
+
c = await mt(r, this.#n.lang$);
|
|
512
950
|
} catch (e) {
|
|
513
951
|
throw a() && this.#f({
|
|
514
952
|
starting: !1,
|
|
@@ -564,7 +1002,7 @@ var ge = class {
|
|
|
564
1002
|
});
|
|
565
1003
|
return !a() || !o() ? !1 : (this.#c = void 0, this.#a.follow(s, o));
|
|
566
1004
|
} catch (e) {
|
|
567
|
-
return a() && o() && this.#o(
|
|
1005
|
+
return a() && o() && this.#o(R(e, this.#n.t)), !1;
|
|
568
1006
|
} finally {
|
|
569
1007
|
a() && this.#f({
|
|
570
1008
|
starting: !1,
|
|
@@ -584,18 +1022,18 @@ var ge = class {
|
|
|
584
1022
|
...e
|
|
585
1023
|
});
|
|
586
1024
|
}
|
|
587
|
-
},
|
|
1025
|
+
}, gt = {
|
|
588
1026
|
actions: {},
|
|
589
1027
|
catalogs: {}
|
|
590
1028
|
};
|
|
591
|
-
function
|
|
1029
|
+
function _t(e) {
|
|
592
1030
|
return Object.entries(e).map(([e, t]) => ({
|
|
593
1031
|
description: t.description,
|
|
594
1032
|
handle: e,
|
|
595
1033
|
jsonSchema: t.jsonSchema
|
|
596
1034
|
}));
|
|
597
1035
|
}
|
|
598
|
-
function
|
|
1036
|
+
function G(e, t) {
|
|
599
1037
|
return {
|
|
600
1038
|
connector: e,
|
|
601
1039
|
description: e.defaultConnection == null ? t("addNode.connectorNeedsConnection", {
|
|
@@ -605,13 +1043,13 @@ function k(e, t) {
|
|
|
605
1043
|
group: t("addNode.connectorActions"),
|
|
606
1044
|
icon: e.icon ?? ":carbon:connection-signal:",
|
|
607
1045
|
id: `connector:${e.actionId}`,
|
|
608
|
-
inputs:
|
|
1046
|
+
inputs: _t(e.inputs),
|
|
609
1047
|
kind: "connector",
|
|
610
1048
|
label: e.name,
|
|
611
|
-
outputs:
|
|
1049
|
+
outputs: _t(e.outputs)
|
|
612
1050
|
};
|
|
613
1051
|
}
|
|
614
|
-
function
|
|
1052
|
+
function vt(e, t) {
|
|
615
1053
|
let n = /* @__PURE__ */ new Map();
|
|
616
1054
|
for (let t of e) {
|
|
617
1055
|
let e = n.get(t.serviceId) ?? [];
|
|
@@ -619,7 +1057,7 @@ function _e(e, t) {
|
|
|
619
1057
|
}
|
|
620
1058
|
return [...n.values()].toSorted((e, t) => e[0].serviceName.localeCompare(t[0].serviceName)).map((e) => {
|
|
621
1059
|
let n = e[0], r = e.map((e) => {
|
|
622
|
-
let n =
|
|
1060
|
+
let n = G(e, t);
|
|
623
1061
|
return {
|
|
624
1062
|
description: n.description,
|
|
625
1063
|
label: n.label,
|
|
@@ -640,7 +1078,7 @@ function _e(e, t) {
|
|
|
640
1078
|
};
|
|
641
1079
|
});
|
|
642
1080
|
}
|
|
643
|
-
function
|
|
1081
|
+
function yt(e, t) {
|
|
644
1082
|
return {
|
|
645
1083
|
choices: [],
|
|
646
1084
|
description: t("addNode.connectorBrowseActions"),
|
|
@@ -654,7 +1092,7 @@ function ve(e, t) {
|
|
|
654
1092
|
serviceId: e.serviceId
|
|
655
1093
|
};
|
|
656
1094
|
}
|
|
657
|
-
function
|
|
1095
|
+
function bt(e) {
|
|
658
1096
|
if (e?.kind != "task" || e.node.task != null) return;
|
|
659
1097
|
let t = e.definition;
|
|
660
1098
|
if (!(t == null || !("executor" in t) || t.executor.kind != "connector")) return {
|
|
@@ -664,7 +1102,7 @@ function A(e) {
|
|
|
664
1102
|
taskId: e.node.taskId
|
|
665
1103
|
};
|
|
666
1104
|
}
|
|
667
|
-
var
|
|
1105
|
+
var xt = class {
|
|
668
1106
|
#e;
|
|
669
1107
|
#t;
|
|
670
1108
|
#n;
|
|
@@ -679,43 +1117,44 @@ var ye = class {
|
|
|
679
1117
|
#d;
|
|
680
1118
|
#f;
|
|
681
1119
|
#p;
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
1120
|
+
#m;
|
|
1121
|
+
constructor(r, i, a, o, s = E()) {
|
|
1122
|
+
this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new x(), this.#u = t(gt), this.#m = !1, this.browseAddNodeOptions = async (e) => {
|
|
1123
|
+
if (this.#m) return;
|
|
1124
|
+
let t = this.#d.$.flowId.value;
|
|
686
1125
|
if (t == null) return;
|
|
687
|
-
let n = this.#
|
|
688
|
-
if (!(e.aborted || this.#
|
|
1126
|
+
let n = this.#p ?? await this.#e.listConnectorProviders(e, t);
|
|
1127
|
+
if (!(e.aborted || this.#m || t != this.#d.$.flowId.value)) return this.#p = n, n.toSorted((e, t) => e.serviceName.localeCompare(t.serviceName)).map((e) => yt(e, this.#t.t));
|
|
689
1128
|
}, this.provideAddNodeOptionChoices = async (e, t) => {
|
|
690
|
-
if (this.#
|
|
691
|
-
let n = this.#
|
|
1129
|
+
if (this.#m) return;
|
|
1130
|
+
let n = this.#d.$.flowId.value, r = this.#p?.find((t) => `connector-provider:${t.serviceId}` == e);
|
|
692
1131
|
if (n == null || r == null) return;
|
|
693
|
-
let i = this.#r.get(r.serviceId) ?? await this.#e.listConnectorActions(r.serviceId, t);
|
|
694
|
-
if (t.aborted || this.#
|
|
1132
|
+
let i = this.#r.get(r.serviceId) ?? await this.#e.listConnectorActions(r.serviceId, t, n);
|
|
1133
|
+
if (t.aborted || this.#m || n != this.#d.$.flowId.value) return;
|
|
695
1134
|
let a = i.map((e) => Object.assign({}, e, e.icon == null && r.icon != null ? { icon: r.icon } : {}, { serviceName: r.serviceName }));
|
|
696
|
-
return this.#r.set(r.serviceId, a), this.#
|
|
697
|
-
...this.#
|
|
1135
|
+
return this.#r.set(r.serviceId, a), this.#y({ actions: {
|
|
1136
|
+
...this.#u.value.actions,
|
|
698
1137
|
...Object.fromEntries(a.map((e) => [e.actionId, e]))
|
|
699
|
-
} }), a.map((e) =>
|
|
1138
|
+
} }), a.map((e) => G(e, this.#t.t));
|
|
700
1139
|
}, this.provideAddNodeOptions = async (e, t) => {
|
|
701
|
-
if (this.#
|
|
702
|
-
let n = this.#
|
|
1140
|
+
if (this.#m) return;
|
|
1141
|
+
let n = this.#d.$.flowId.value;
|
|
703
1142
|
if (n == null) return;
|
|
704
|
-
let r = e.trim(), i = r.length == 0 ? Object.values(this.#
|
|
705
|
-
if (t.aborted || this.#
|
|
706
|
-
let a = { ...this.#
|
|
1143
|
+
let r = e.trim(), i = r.length == 0 ? Object.values(this.#u.value.actions) : await this.#e.searchConnectorActions(r, t, n);
|
|
1144
|
+
if (t.aborted || this.#m || n != this.#d.$.flowId.value) return;
|
|
1145
|
+
let a = { ...this.#u.value.actions };
|
|
707
1146
|
for (let e of i) a[e.actionId] = e;
|
|
708
|
-
if (this.#
|
|
1147
|
+
if (this.#y({ actions: a }), r.length != 0) return i.map((e) => G(e, this.#t.t));
|
|
709
1148
|
let o = new Map(i.map((e) => [e.actionId, e]));
|
|
710
|
-
for (let e of this.#
|
|
1149
|
+
for (let e of this.#d.$.revision.value?.connectorActionIds ?? []) {
|
|
711
1150
|
let t = a[e];
|
|
712
1151
|
t != null && o.set(e, t);
|
|
713
1152
|
}
|
|
714
|
-
return
|
|
715
|
-
}, this.#e = r, this.#n = o, this.#
|
|
716
|
-
let c = e(this.#
|
|
717
|
-
this.#
|
|
718
|
-
let t =
|
|
1153
|
+
return vt([...o.values()], this.#t.t);
|
|
1154
|
+
}, this.#e = r, this.#n = o, this.#d = i, this.#l = a, this.#t = s;
|
|
1155
|
+
let c = e(this.#u, (e) => e.actions), l = e(this.#u, (e) => e.catalogs);
|
|
1156
|
+
this.#c = n((e) => {
|
|
1157
|
+
let t = bt(e(i.$.selection)), n = e(this.#u);
|
|
719
1158
|
if (t == null) return { authorizationPending: !1 };
|
|
720
1159
|
let r = n.actions[t.actionId], a = r == null ? void 0 : n.catalogs[r.serviceId], o = t.connectionId == null ? void 0 : a?.byId.get(t.connectionId);
|
|
721
1160
|
return o == null && r?.defaultConnection?.connectionId == t.connectionId && (o = r.defaultConnection), {
|
|
@@ -727,148 +1166,148 @@ var ye = class {
|
|
|
727
1166
|
connectionError: r != null && n.connectionError?.serviceId == r.serviceId ? n.connectionError.message : void 0
|
|
728
1167
|
};
|
|
729
1168
|
}), this.$ = {
|
|
730
|
-
actionLoading: e(this.#
|
|
1169
|
+
actionLoading: e(this.#u, (e) => e.actionLoading),
|
|
731
1170
|
actions: c,
|
|
732
|
-
catalogs:
|
|
733
|
-
connectionLoading: e(this.#
|
|
734
|
-
selectedAction: e(this.#
|
|
735
|
-
selectedActionError: e(this.#
|
|
736
|
-
selectedActiveConnections: e(this.#
|
|
737
|
-
selectedAuthorizationPending: e(this.#
|
|
738
|
-
selectedConnection: e(this.#
|
|
739
|
-
selectedConnectionError: e(this.#
|
|
740
|
-
}, this.#o = i.$.revision.reaction(() => void this.#
|
|
1171
|
+
catalogs: l,
|
|
1172
|
+
connectionLoading: e(this.#u, (e) => e.connectionLoading),
|
|
1173
|
+
selectedAction: e(this.#c, (e) => e.action),
|
|
1174
|
+
selectedActionError: e(this.#c, (e) => e.actionError),
|
|
1175
|
+
selectedActiveConnections: e(this.#c, (e) => e.activeConnections),
|
|
1176
|
+
selectedAuthorizationPending: e(this.#c, (e) => e.authorizationPending),
|
|
1177
|
+
selectedConnection: e(this.#c, (e) => e.connection),
|
|
1178
|
+
selectedConnectionError: e(this.#c, (e) => e.connectionError)
|
|
1179
|
+
}, this.#o = i.$.flowId.reaction(() => this.reset()), this.#s = i.$.revision.reaction(() => void this.#x());
|
|
741
1180
|
}
|
|
742
1181
|
dispose() {
|
|
743
|
-
this.#
|
|
1182
|
+
this.#m = !0, this.#a.invalidate(), this.#o(), this.#s();
|
|
744
1183
|
for (let e of Object.values(this.$)) e.dispose();
|
|
745
|
-
this.#
|
|
1184
|
+
this.#c.dispose(), this.#u.dispose();
|
|
746
1185
|
}
|
|
747
1186
|
reset() {
|
|
748
|
-
this.#
|
|
1187
|
+
this.#m || (this.#a.invalidate(), this.#f = void 0, this.#r.clear(), this.#p = void 0, this.#i.clear(), this.#u.set(gt));
|
|
749
1188
|
}
|
|
750
1189
|
async refresh(e = !1) {
|
|
751
|
-
if (this.#
|
|
752
|
-
let t = this.#a.begin(), n = this.#
|
|
1190
|
+
if (this.#m) return;
|
|
1191
|
+
let t = this.#a.begin(), n = this.#d.$.flowId.value, r = bt(this.#d.$.selection.value);
|
|
753
1192
|
if (n == null || r == null) {
|
|
754
|
-
(this.#
|
|
1193
|
+
(this.#u.value.actionLoading != null || this.#u.value.connectionLoading != null) && this.#y({
|
|
755
1194
|
actionLoading: void 0,
|
|
756
1195
|
connectionLoading: void 0
|
|
757
1196
|
});
|
|
758
1197
|
return;
|
|
759
1198
|
}
|
|
760
|
-
this.#
|
|
1199
|
+
this.#y({
|
|
761
1200
|
actionError: void 0,
|
|
762
1201
|
actionLoading: r.actionId,
|
|
763
1202
|
connectionError: void 0,
|
|
764
1203
|
connectionLoading: void 0
|
|
765
1204
|
});
|
|
766
1205
|
try {
|
|
767
|
-
let i = await this.#
|
|
768
|
-
if (!this.#
|
|
769
|
-
this.#
|
|
770
|
-
...this.#
|
|
1206
|
+
let i = await this.#h(r.actionId, e);
|
|
1207
|
+
if (!this.#b(t, n)) return;
|
|
1208
|
+
this.#y({ actions: {
|
|
1209
|
+
...this.#u.value.actions,
|
|
771
1210
|
[i.actionId]: i
|
|
772
|
-
} }), await this.#
|
|
1211
|
+
} }), await this.#g(n, r, i.serviceId, e, t);
|
|
773
1212
|
} catch (e) {
|
|
774
|
-
this.#
|
|
1213
|
+
this.#b(t, n) && this.#y({ actionError: {
|
|
775
1214
|
actionId: r.actionId,
|
|
776
|
-
message:
|
|
1215
|
+
message: R(e, this.#t.t).message
|
|
777
1216
|
} });
|
|
778
1217
|
} finally {
|
|
779
|
-
this.#
|
|
1218
|
+
this.#b(t, n) && this.#u.value.actionLoading == r.actionId && this.#y({ actionLoading: void 0 });
|
|
780
1219
|
}
|
|
781
1220
|
}
|
|
782
1221
|
async connect(e) {
|
|
783
|
-
if (this.#
|
|
784
|
-
let t = this.#
|
|
1222
|
+
if (this.#m) return;
|
|
1223
|
+
let t = this.#d.$.flowId.value;
|
|
785
1224
|
if (t == null) return;
|
|
786
|
-
let n = this.#
|
|
1225
|
+
let n = this.#u.value.catalogs[e];
|
|
787
1226
|
try {
|
|
788
|
-
if (!await this.#n.openExternalPage(() => this.#e.createConnectorConnectionPage(e))) {
|
|
789
|
-
this.#
|
|
1227
|
+
if (!await this.#n.openExternalPage(() => this.#e.createConnectorConnectionPage(e, t))) {
|
|
1228
|
+
this.#l({
|
|
790
1229
|
kind: "error",
|
|
791
1230
|
message: this.#t.t("notice.connectionPopupBlocked")
|
|
792
1231
|
});
|
|
793
1232
|
return;
|
|
794
1233
|
}
|
|
795
|
-
if (this.#
|
|
796
|
-
this.#
|
|
1234
|
+
if (this.#m || t != this.#d.$.flowId.value) return;
|
|
1235
|
+
this.#f = {
|
|
797
1236
|
connectionIds: new Set(n?.all.map((e) => e.connectionId)),
|
|
798
1237
|
serviceId: e
|
|
799
|
-
}, this.#
|
|
1238
|
+
}, this.#y({ authorizationServiceId: e });
|
|
800
1239
|
} catch (e) {
|
|
801
|
-
this.#
|
|
1240
|
+
this.#m || this.#l(R(e, this.#t.t));
|
|
802
1241
|
}
|
|
803
1242
|
}
|
|
804
1243
|
async setConnection(e, t) {
|
|
805
|
-
return await this.#
|
|
1244
|
+
return await this.#d.setConnectorConnection(e, t);
|
|
806
1245
|
}
|
|
807
1246
|
async refreshAfterAuthorization() {
|
|
808
|
-
if (this.#
|
|
809
|
-
let e = this.#
|
|
810
|
-
this.#r.delete(e), this.#
|
|
1247
|
+
if (this.#m || this.#f == null) return;
|
|
1248
|
+
let e = this.#f.serviceId;
|
|
1249
|
+
this.#r.delete(e), this.#y({ authorizationServiceId: void 0 }), this.$.selectedAction.value?.serviceId == e && await this.refresh(!0), !this.#m && this.#f?.serviceId == e && (this.#f = void 0);
|
|
811
1250
|
}
|
|
812
|
-
async #
|
|
813
|
-
let n = this.#
|
|
814
|
-
return !t && n != null ? n : await this.#e.getConnectorAction(e);
|
|
1251
|
+
async #h(e, t) {
|
|
1252
|
+
let n = this.#u.value.actions[e];
|
|
1253
|
+
return !t && n != null ? n : await this.#e.getConnectorAction(e, void 0, this.#d.$.flowId.value);
|
|
815
1254
|
}
|
|
816
|
-
async #
|
|
817
|
-
this.#
|
|
1255
|
+
async #g(e, t, n, r, i) {
|
|
1256
|
+
this.#y({ connectionLoading: n });
|
|
818
1257
|
try {
|
|
819
|
-
let a = await this.#
|
|
820
|
-
if (a == null || !this.#
|
|
821
|
-
await this.#
|
|
1258
|
+
let a = await this.#_(e, n, r, i);
|
|
1259
|
+
if (a == null || !this.#b(i, e)) return;
|
|
1260
|
+
await this.#v(t, n, a);
|
|
822
1261
|
} finally {
|
|
823
|
-
this.#
|
|
1262
|
+
this.#b(i, e) && this.#u.value.connectionLoading == n && this.#y({ connectionLoading: void 0 });
|
|
824
1263
|
}
|
|
825
1264
|
}
|
|
826
|
-
async #
|
|
827
|
-
let i = this.#
|
|
1265
|
+
async #_(e, t, n, r) {
|
|
1266
|
+
let i = this.#u.value.catalogs[t];
|
|
828
1267
|
if (!n && i != null) return i;
|
|
829
1268
|
let a;
|
|
830
1269
|
try {
|
|
831
|
-
a = await this.#e.listConnectorConnections(t);
|
|
1270
|
+
a = await this.#e.listConnectorConnections(t, void 0, e);
|
|
832
1271
|
} catch (n) {
|
|
833
|
-
this.#
|
|
834
|
-
message:
|
|
1272
|
+
this.#b(r, e) && this.#y({ connectionError: {
|
|
1273
|
+
message: R(n, this.#t.t).message,
|
|
835
1274
|
serviceId: t
|
|
836
1275
|
} });
|
|
837
1276
|
return;
|
|
838
1277
|
}
|
|
839
|
-
if (!this.#
|
|
840
|
-
let o =
|
|
841
|
-
return this.#
|
|
842
|
-
...this.#
|
|
1278
|
+
if (!this.#b(r, e)) return;
|
|
1279
|
+
let o = w(a);
|
|
1280
|
+
return this.#y({ catalogs: {
|
|
1281
|
+
...this.#u.value.catalogs,
|
|
843
1282
|
[t]: o
|
|
844
1283
|
} }), o;
|
|
845
1284
|
}
|
|
846
|
-
async #
|
|
847
|
-
let r = this.#
|
|
848
|
-
a != null && this.#
|
|
1285
|
+
async #v(e, t, n) {
|
|
1286
|
+
let r = this.#f?.serviceId == t ? this.#f : void 0, i = r == null ? [] : n.active.filter((e) => !r.connectionIds.has(e.connectionId)), a = i.length == 1 ? i[0] : n.preferred, o = this.#d.$.revision.value?.task(e.taskId);
|
|
1287
|
+
a != null && this.#d.$.selectedNodeIds.value.includes(e.nodeId) && o != null && "executor" in o && o.executor.kind == "connector" && o.executor.connectionId == null && await this.#d.setConnectorConnection(e.taskId, a.connectionId);
|
|
849
1288
|
}
|
|
850
|
-
#
|
|
851
|
-
this.#
|
|
852
|
-
...this.#
|
|
1289
|
+
#y(e) {
|
|
1290
|
+
this.#m || this.#u.set({
|
|
1291
|
+
...this.#u.value,
|
|
853
1292
|
...e
|
|
854
1293
|
});
|
|
855
1294
|
}
|
|
856
|
-
#
|
|
857
|
-
return !this.#
|
|
1295
|
+
#b(e, t) {
|
|
1296
|
+
return !this.#m && e() && t == this.#d.$.flowId.value;
|
|
858
1297
|
}
|
|
859
|
-
async #
|
|
860
|
-
if (this.#
|
|
861
|
-
let e = this.#a.capture(), t = this.#
|
|
1298
|
+
async #x() {
|
|
1299
|
+
if (this.#m) return;
|
|
1300
|
+
let e = this.#a.capture(), t = this.#d.$.flowId.value, n = this.#d.$.revision.value;
|
|
862
1301
|
if (t == null || n == null) return;
|
|
863
|
-
let r = [...n.connectorActionIds].filter((e) => this.#
|
|
1302
|
+
let r = [...n.connectorActionIds].filter((e) => this.#u.value.actions[e] == null && !this.#i.has(e));
|
|
864
1303
|
if (r.length != 0) {
|
|
865
1304
|
for (let e of r) this.#i.add(e);
|
|
866
1305
|
try {
|
|
867
|
-
let n = await Promise.all(r.map((e) => this.#e.getConnectorAction(e)));
|
|
868
|
-
if (!this.#
|
|
869
|
-
let i = { ...this.#
|
|
1306
|
+
let n = await Promise.all(r.map((e) => this.#e.getConnectorAction(e, void 0, t)));
|
|
1307
|
+
if (!this.#b(e, t)) return;
|
|
1308
|
+
let i = { ...this.#u.value.actions };
|
|
870
1309
|
for (let e of n) i[e.actionId] = e;
|
|
871
|
-
this.#
|
|
1310
|
+
this.#y({ actions: i });
|
|
872
1311
|
} catch {
|
|
873
1312
|
return;
|
|
874
1313
|
} finally {
|
|
@@ -876,8 +1315,8 @@ var ye = class {
|
|
|
876
1315
|
}
|
|
877
1316
|
}
|
|
878
1317
|
}
|
|
879
|
-
},
|
|
880
|
-
function
|
|
1318
|
+
}, St = { catalogs: {} }, Ct = 4, K = "trigger:";
|
|
1319
|
+
function q(e, t) {
|
|
881
1320
|
if (e?.kind != "trigger") return;
|
|
882
1321
|
let n = e.trigger;
|
|
883
1322
|
if (n.kind != "poll" && n.kind != "integration") return;
|
|
@@ -888,7 +1327,7 @@ function P(e, t) {
|
|
|
888
1327
|
triggerId: e.id
|
|
889
1328
|
};
|
|
890
1329
|
}
|
|
891
|
-
function
|
|
1330
|
+
function J(e, t, n, r) {
|
|
892
1331
|
return {
|
|
893
1332
|
description: n,
|
|
894
1333
|
group: r,
|
|
@@ -907,24 +1346,24 @@ function F(e, t, n, r) {
|
|
|
907
1346
|
}
|
|
908
1347
|
};
|
|
909
1348
|
}
|
|
910
|
-
function
|
|
1349
|
+
function wt(e, t) {
|
|
911
1350
|
return {
|
|
912
1351
|
choices: [],
|
|
913
1352
|
description: t.t("addNode.triggerChooseConnection"),
|
|
914
1353
|
group: t.t("addNode.triggers"),
|
|
915
|
-
id: `${
|
|
1354
|
+
id: `${K}${e.key}`,
|
|
916
1355
|
inputs: [],
|
|
917
1356
|
kind: "trigger",
|
|
918
1357
|
label: e.displayName,
|
|
919
1358
|
outputs: []
|
|
920
1359
|
};
|
|
921
1360
|
}
|
|
922
|
-
function
|
|
1361
|
+
function Tt(e, t, n) {
|
|
923
1362
|
let r = n.t("addNode.triggers"), i = t.preferred;
|
|
924
|
-
return i == null ? t.active.length > 0 ? t.active.map((t) =>
|
|
1363
|
+
return i == null ? t.active.length > 0 ? t.active.map((t) => J(e, t.connectionId, t.displayName, r)) : [{
|
|
925
1364
|
description: n.t("addNode.triggerNeedsConnection", { provider: e.provider }),
|
|
926
1365
|
group: r,
|
|
927
|
-
id: `${
|
|
1366
|
+
id: `${K}${e.key}:connect`,
|
|
928
1367
|
inputs: [],
|
|
929
1368
|
kind: "trigger",
|
|
930
1369
|
label: n.t("addNode.triggerAddConnection"),
|
|
@@ -933,12 +1372,12 @@ function L(e, t, n) {
|
|
|
933
1372
|
kind: "connect",
|
|
934
1373
|
provider: e.provider
|
|
935
1374
|
}
|
|
936
|
-
}] : [
|
|
1375
|
+
}] : [J(e, i.connectionId, i.displayName, r)];
|
|
937
1376
|
}
|
|
938
|
-
function
|
|
1377
|
+
function Et(e, t, n) {
|
|
939
1378
|
let r = t.preferred;
|
|
940
|
-
if (r != null) return
|
|
941
|
-
let i =
|
|
1379
|
+
if (r != null) return J(e, r.connectionId, r.displayName, n.t("addNode.triggers"));
|
|
1380
|
+
let i = wt(e, n), a = Tt(e, t, n);
|
|
942
1381
|
return {
|
|
943
1382
|
...i,
|
|
944
1383
|
description: t.active.length == 0 ? n.t("addNode.triggerNeedsConnection", { provider: e.provider }) : i.description,
|
|
@@ -953,7 +1392,7 @@ function be(e, t, n) {
|
|
|
953
1392
|
}))
|
|
954
1393
|
};
|
|
955
1394
|
}
|
|
956
|
-
var
|
|
1395
|
+
var Dt = class {
|
|
957
1396
|
#e;
|
|
958
1397
|
#t;
|
|
959
1398
|
#n;
|
|
@@ -965,12 +1404,12 @@ var xe = class {
|
|
|
965
1404
|
#c;
|
|
966
1405
|
#l;
|
|
967
1406
|
#u;
|
|
968
|
-
constructor(r, i, a, o, s =
|
|
969
|
-
this.#t = new AbortController(), this.#a = new x(), this.#c = t(
|
|
1407
|
+
constructor(r, i, a, o, s = E()) {
|
|
1408
|
+
this.#t = new AbortController(), this.#a = new x(), this.#c = t(St), this.#u = !1, this.browseAddNodeOptions = async (e) => {
|
|
970
1409
|
let t = this.#l.$.flowId.value;
|
|
971
1410
|
if (e.aborted || this.#u || t == null || this.#l.$.target.value?.kind != "flow") return [];
|
|
972
1411
|
let n = await this.#d();
|
|
973
|
-
if (!(e.aborted || this.#u || t != this.#l.$.flowId.value)) return [...n.values()].map((e) =>
|
|
1412
|
+
if (!(e.aborted || this.#u || t != this.#l.$.flowId.value)) return [...n.values()].map((e) => wt(e, this.#i));
|
|
974
1413
|
}, this.provideAddNodeOptions = async (e, t) => {
|
|
975
1414
|
let n = this.#l.$.flowId.value;
|
|
976
1415
|
if (t.aborted || this.#u || n == null || this.#l.$.target.value?.kind != "flow") return [];
|
|
@@ -986,31 +1425,31 @@ var xe = class {
|
|
|
986
1425
|
e.provider,
|
|
987
1426
|
e.type
|
|
988
1427
|
].some((e) => e.toLowerCase().includes(r))), o = [...new Set(a.map((e) => e.provider))].filter((e) => this.#c.value.catalogs[e] == null);
|
|
989
|
-
for (let e = 0; e < o.length; e +=
|
|
990
|
-
let r = await Promise.all(o.slice(e, e +
|
|
1428
|
+
for (let e = 0; e < o.length; e += Ct) {
|
|
1429
|
+
let r = await Promise.all(o.slice(e, e + Ct).map(async (e) => [e, w(await this.#n.listConnectorConnections(e, t, n))]));
|
|
991
1430
|
if (t.aborted || this.#u || n != this.#l.$.flowId.value) return;
|
|
992
1431
|
this.#f({ catalogs: {
|
|
993
1432
|
...this.#c.value.catalogs,
|
|
994
1433
|
...Object.fromEntries(r)
|
|
995
1434
|
} });
|
|
996
1435
|
}
|
|
997
|
-
return a.map((e) =>
|
|
1436
|
+
return a.map((e) => Et(e, this.#c.value.catalogs[e.provider], this.#i));
|
|
998
1437
|
}, this.provideAddNodeOptionChoices = async (e, t) => {
|
|
999
|
-
let n = this.#l.$.flowId.value, r = e.startsWith(
|
|
1438
|
+
let n = this.#l.$.flowId.value, r = e.startsWith(K) ? e.slice(8) : void 0;
|
|
1000
1439
|
if (t.aborted || this.#u || n == null || r == null || this.#l.$.target.value?.kind != "flow") return;
|
|
1001
1440
|
let i = (await this.#d()).get(r);
|
|
1002
1441
|
if (t.aborted || this.#u || n != this.#l.$.flowId.value || i == null) return;
|
|
1003
1442
|
let a = this.#c.value.catalogs[i.provider];
|
|
1004
1443
|
if (a == null) {
|
|
1005
|
-
if (a =
|
|
1444
|
+
if (a = w(await this.#n.listConnectorConnections(i.provider, t, n)), t.aborted || this.#u || n != this.#l.$.flowId.value) return;
|
|
1006
1445
|
this.#f({ catalogs: {
|
|
1007
1446
|
...this.#c.value.catalogs,
|
|
1008
1447
|
[i.provider]: a
|
|
1009
1448
|
} });
|
|
1010
1449
|
}
|
|
1011
|
-
return
|
|
1450
|
+
return Tt(i, a, this.#i);
|
|
1012
1451
|
}, this.#n = r, this.#r = o, this.#i = s, this.#s = a, this.#l = i, this.#o = n((e) => {
|
|
1013
|
-
let t = e(i.$.selection), n =
|
|
1452
|
+
let t = e(i.$.selection), n = q(t, i), r = e(this.#c);
|
|
1014
1453
|
if (t?.kind != "trigger") return { authorizationPending: !1 };
|
|
1015
1454
|
let a = t.trigger;
|
|
1016
1455
|
if (a.kind != "poll" && a.kind != "integration") return { authorizationPending: !1 };
|
|
@@ -1037,10 +1476,10 @@ var xe = class {
|
|
|
1037
1476
|
this.#o.dispose(), this.#c.dispose();
|
|
1038
1477
|
}
|
|
1039
1478
|
reset() {
|
|
1040
|
-
this.#u || (this.#t.abort(), this.#t = new AbortController(), this.#e = void 0, this.#a.invalidate(), this.#c.set(
|
|
1479
|
+
this.#u || (this.#t.abort(), this.#t = new AbortController(), this.#e = void 0, this.#a.invalidate(), this.#c.set(St));
|
|
1041
1480
|
}
|
|
1042
1481
|
async refresh(e = !1) {
|
|
1043
|
-
let t = this.#a.begin(), n = this.#l.$.flowId.value, r =
|
|
1482
|
+
let t = this.#a.begin(), n = this.#l.$.flowId.value, r = q(this.#l.$.selection.value, this.#l);
|
|
1044
1483
|
if (!this.#u) {
|
|
1045
1484
|
if (n == null || r == null) {
|
|
1046
1485
|
this.#c.value.connectionLoading != null && this.#f({ connectionLoading: void 0 });
|
|
@@ -1052,7 +1491,7 @@ var xe = class {
|
|
|
1052
1491
|
connectionLoading: r.provider
|
|
1053
1492
|
});
|
|
1054
1493
|
try {
|
|
1055
|
-
let e =
|
|
1494
|
+
let e = w(await this.#n.listConnectorConnections(r.provider, void 0, n));
|
|
1056
1495
|
if (!this.#p(t, n)) return;
|
|
1057
1496
|
this.#f({ catalogs: {
|
|
1058
1497
|
...this.#c.value.catalogs,
|
|
@@ -1060,7 +1499,7 @@ var xe = class {
|
|
|
1060
1499
|
} });
|
|
1061
1500
|
} catch (e) {
|
|
1062
1501
|
this.#p(t, n) && this.#f({ connectionError: {
|
|
1063
|
-
message:
|
|
1502
|
+
message: R(e, this.#i.t).message,
|
|
1064
1503
|
provider: r.provider
|
|
1065
1504
|
} });
|
|
1066
1505
|
} finally {
|
|
@@ -1072,7 +1511,7 @@ var xe = class {
|
|
|
1072
1511
|
async connect(e) {
|
|
1073
1512
|
let t = this.#l.$.flowId.value;
|
|
1074
1513
|
if (!(this.#u || t == null)) try {
|
|
1075
|
-
if (!await this.#r.openExternalPage(() => this.#n.createConnectorConnectionPage(e))) {
|
|
1514
|
+
if (!await this.#r.openExternalPage(() => this.#n.createConnectorConnectionPage(e, t))) {
|
|
1076
1515
|
this.#s({
|
|
1077
1516
|
kind: "error",
|
|
1078
1517
|
message: this.#i.t("notice.connectionPopupBlocked")
|
|
@@ -1081,7 +1520,7 @@ var xe = class {
|
|
|
1081
1520
|
}
|
|
1082
1521
|
!this.#u && t == this.#l.$.flowId.value && this.#f({ authorizationProvider: e });
|
|
1083
1522
|
} catch (e) {
|
|
1084
|
-
this.#u || this.#s(
|
|
1523
|
+
this.#u || this.#s(R(e, this.#i.t));
|
|
1085
1524
|
}
|
|
1086
1525
|
}
|
|
1087
1526
|
async setConnection(e, t) {
|
|
@@ -1097,7 +1536,7 @@ var xe = class {
|
|
|
1097
1536
|
delete t[e], this.#f({
|
|
1098
1537
|
authorizationProvider: void 0,
|
|
1099
1538
|
catalogs: t
|
|
1100
|
-
}),
|
|
1539
|
+
}), q(this.#l.$.selection.value, this.#l)?.provider == e && await this.refresh(!0);
|
|
1101
1540
|
}
|
|
1102
1541
|
#d() {
|
|
1103
1542
|
if (this.#e != null) return this.#e;
|
|
@@ -1117,897 +1556,33 @@ var xe = class {
|
|
|
1117
1556
|
}
|
|
1118
1557
|
};
|
|
1119
1558
|
//#endregion
|
|
1120
|
-
//#region src/flow/common/edgeChanges.ts
|
|
1121
|
-
function R(e, t, n) {
|
|
1122
|
-
let r = {
|
|
1123
|
-
source: n.source,
|
|
1124
|
-
sourceHandle: n.sourceHandle,
|
|
1125
|
-
target: n.target,
|
|
1126
|
-
targetHandle: n.targetHandle
|
|
1127
|
-
}, i = z(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
|
|
1128
|
-
return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
|
|
1129
|
-
edge: r,
|
|
1130
|
-
kind: "graph.edge.connect",
|
|
1131
|
-
target: t
|
|
1132
|
-
}];
|
|
1133
|
-
}
|
|
1134
|
-
function Se(e, t, n) {
|
|
1135
|
-
let r = {
|
|
1136
|
-
source: n.source,
|
|
1137
|
-
sourceHandle: n.sourceHandle,
|
|
1138
|
-
target: n.target,
|
|
1139
|
-
targetHandle: n.targetHandle
|
|
1140
|
-
}, i = z(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
|
|
1141
|
-
return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
|
|
1142
|
-
edge: r,
|
|
1143
|
-
kind: "graph.edge.disconnect",
|
|
1144
|
-
target: t
|
|
1145
|
-
}];
|
|
1146
|
-
}
|
|
1147
|
-
function z(e, t) {
|
|
1148
|
-
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
1149
|
-
}
|
|
1150
|
-
//#endregion
|
|
1151
|
-
//#region src/flow/common/moduleChanges.ts
|
|
1152
|
-
async function Ce(e) {
|
|
1153
|
-
try {
|
|
1154
|
-
let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
|
|
1155
|
-
errorRecovery: !0,
|
|
1156
|
-
sourceType: "module"
|
|
1157
|
-
}).program, r = /* @__PURE__ */ new Set();
|
|
1158
|
-
for (let e of n.body) {
|
|
1159
|
-
if (e.type != "ImportDeclaration") continue;
|
|
1160
|
-
let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
|
|
1161
|
-
t?.[1] != null && r.add(t[1]);
|
|
1162
|
-
}
|
|
1163
|
-
return [...r].toSorted();
|
|
1164
|
-
} catch {
|
|
1165
|
-
return [];
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
function we(e, t, n) {
|
|
1169
|
-
return [{
|
|
1170
|
-
imports: n,
|
|
1171
|
-
kind: "module.source.replace",
|
|
1172
|
-
moduleId: e,
|
|
1173
|
-
source: t
|
|
1174
|
-
}];
|
|
1175
|
-
}
|
|
1176
|
-
//#endregion
|
|
1177
|
-
//#region src/flow/common/nodeChanges.ts
|
|
1178
|
-
function Te(e, t, n, r = {
|
|
1179
|
-
imports: [],
|
|
1180
|
-
source: "export default function run(input) {\n return { result: input.value }\n}\n"
|
|
1181
|
-
}, i = {
|
|
1182
|
-
inputs: [{
|
|
1183
|
-
handle: "value",
|
|
1184
|
-
jsonSchema: {},
|
|
1185
|
-
nullable: !0,
|
|
1186
|
-
value: null
|
|
1187
|
-
}],
|
|
1188
|
-
outputs: [{
|
|
1189
|
-
handle: "result",
|
|
1190
|
-
jsonSchema: {},
|
|
1191
|
-
nullable: !0
|
|
1192
|
-
}]
|
|
1193
|
-
}) {
|
|
1194
|
-
return [{
|
|
1195
|
-
kind: "module.create",
|
|
1196
|
-
module: {
|
|
1197
|
-
...r,
|
|
1198
|
-
name: n
|
|
1199
|
-
},
|
|
1200
|
-
moduleId: t.moduleId
|
|
1201
|
-
}, {
|
|
1202
|
-
kind: "graph.node.create",
|
|
1203
|
-
node: {
|
|
1204
|
-
concurrency: 1,
|
|
1205
|
-
inputs: U(i.inputs),
|
|
1206
|
-
kind: "task",
|
|
1207
|
-
name: n,
|
|
1208
|
-
task: {
|
|
1209
|
-
inputs: i.inputs,
|
|
1210
|
-
moduleId: t.moduleId,
|
|
1211
|
-
name: n,
|
|
1212
|
-
outputs: i.outputs
|
|
1213
|
-
}
|
|
1214
|
-
},
|
|
1215
|
-
nodeId: t.nodeId,
|
|
1216
|
-
target: e
|
|
1217
|
-
}];
|
|
1218
|
-
}
|
|
1219
|
-
function B(e, t, n) {
|
|
1220
|
-
return [{
|
|
1221
|
-
kind: "task.create",
|
|
1222
|
-
task: n,
|
|
1223
|
-
taskId: t.taskId
|
|
1224
|
-
}, {
|
|
1225
|
-
kind: "graph.node.create",
|
|
1226
|
-
node: {
|
|
1227
|
-
concurrency: 1,
|
|
1228
|
-
inputs: U(n.inputs),
|
|
1229
|
-
kind: "task",
|
|
1230
|
-
name: n.name,
|
|
1231
|
-
taskId: t.taskId
|
|
1232
|
-
},
|
|
1233
|
-
nodeId: t.nodeId,
|
|
1234
|
-
target: e
|
|
1235
|
-
}];
|
|
1236
|
-
}
|
|
1237
|
-
function Ee(e, t, n, r, i, a = {}) {
|
|
1238
|
-
let o = a.inputs ?? {};
|
|
1239
|
-
return B(e, t, {
|
|
1240
|
-
executor: {
|
|
1241
|
-
kind: "llm",
|
|
1242
|
-
mode: r
|
|
1243
|
-
},
|
|
1244
|
-
inputs: [
|
|
1245
|
-
{
|
|
1246
|
-
handle: "messages",
|
|
1247
|
-
jsonSchema: {
|
|
1248
|
-
items: { type: "object" },
|
|
1249
|
-
type: "array"
|
|
1250
|
-
},
|
|
1251
|
-
nullable: !0,
|
|
1252
|
-
value: W(o, "messages", null)
|
|
1253
|
-
},
|
|
1254
|
-
{
|
|
1255
|
-
handle: "input",
|
|
1256
|
-
jsonSchema: { type: "string" },
|
|
1257
|
-
nullable: !1,
|
|
1258
|
-
value: W(o, "input", "Alex")
|
|
1259
|
-
},
|
|
1260
|
-
{
|
|
1261
|
-
handle: "template",
|
|
1262
|
-
jsonSchema: {
|
|
1263
|
-
items: { type: "object" },
|
|
1264
|
-
minItems: 1,
|
|
1265
|
-
type: "array"
|
|
1266
|
-
},
|
|
1267
|
-
nullable: !1,
|
|
1268
|
-
value: W(o, "template", [{
|
|
1269
|
-
content: "Hello, I'm {{input}}",
|
|
1270
|
-
role: "user"
|
|
1271
|
-
}])
|
|
1272
|
-
},
|
|
1273
|
-
{
|
|
1274
|
-
handle: "model",
|
|
1275
|
-
jsonSchema: { type: "object" },
|
|
1276
|
-
nullable: !1,
|
|
1277
|
-
value: W(o, "model", { model: "deepseek-v4-flash" })
|
|
1278
|
-
}
|
|
1279
|
-
],
|
|
1280
|
-
name: n,
|
|
1281
|
-
outputs: [{
|
|
1282
|
-
...a.output,
|
|
1283
|
-
description: a.output?.description ?? i,
|
|
1284
|
-
handle: "output",
|
|
1285
|
-
jsonSchema: a.output?.jsonSchema ?? (r == "chat" ? { type: "string" } : {}),
|
|
1286
|
-
nullable: a.output?.nullable ?? !1
|
|
1287
|
-
}]
|
|
1288
|
-
});
|
|
1289
|
-
}
|
|
1290
|
-
function De(e, t, n) {
|
|
1291
|
-
return [{
|
|
1292
|
-
kind: "graph.node.create",
|
|
1293
|
-
node: {
|
|
1294
|
-
cases: [{
|
|
1295
|
-
expressions: [{
|
|
1296
|
-
input: "value",
|
|
1297
|
-
operator: "isTrue"
|
|
1298
|
-
}],
|
|
1299
|
-
output: "true",
|
|
1300
|
-
relation: "all"
|
|
1301
|
-
}],
|
|
1302
|
-
concurrency: 1,
|
|
1303
|
-
defaultOutput: "false",
|
|
1304
|
-
input: {
|
|
1305
|
-
handle: "value",
|
|
1306
|
-
jsonSchema: {},
|
|
1307
|
-
nullable: !0,
|
|
1308
|
-
value: null
|
|
1309
|
-
},
|
|
1310
|
-
inputs: { value: {
|
|
1311
|
-
kind: "value",
|
|
1312
|
-
value: null
|
|
1313
|
-
} },
|
|
1314
|
-
kind: "condition",
|
|
1315
|
-
name: n
|
|
1316
|
-
},
|
|
1317
|
-
nodeId: t,
|
|
1318
|
-
target: e
|
|
1319
|
-
}];
|
|
1320
|
-
}
|
|
1321
|
-
function Oe(e, t, n) {
|
|
1322
|
-
return [{
|
|
1323
|
-
kind: "graph.node.create",
|
|
1324
|
-
node: {
|
|
1325
|
-
concurrency: 1,
|
|
1326
|
-
inputs: {},
|
|
1327
|
-
kind: "value",
|
|
1328
|
-
name: n,
|
|
1329
|
-
values: [{
|
|
1330
|
-
handle: "value",
|
|
1331
|
-
jsonSchema: {},
|
|
1332
|
-
nullable: !0,
|
|
1333
|
-
value: null
|
|
1334
|
-
}]
|
|
1335
|
-
},
|
|
1336
|
-
nodeId: t,
|
|
1337
|
-
target: e
|
|
1338
|
-
}];
|
|
1339
|
-
}
|
|
1340
|
-
function V(e, t, n) {
|
|
1341
|
-
return [{
|
|
1342
|
-
kind: "graph.node.create",
|
|
1343
|
-
node: n,
|
|
1344
|
-
nodeId: t,
|
|
1345
|
-
target: e
|
|
1346
|
-
}];
|
|
1347
|
-
}
|
|
1348
|
-
function ke(e, t, n, r) {
|
|
1349
|
-
let i = r.name ?? n.displayName, a = n.type == "poll" ? {
|
|
1350
|
-
bindingId: t.bindingId,
|
|
1351
|
-
config: r.config,
|
|
1352
|
-
definition: n,
|
|
1353
|
-
kind: "poll",
|
|
1354
|
-
name: i,
|
|
1355
|
-
pollTimes: r.schedule ?? [{
|
|
1356
|
-
type: "every",
|
|
1357
|
-
unit: "minute",
|
|
1358
|
-
value: 5
|
|
1359
|
-
}]
|
|
1360
|
-
} : {
|
|
1361
|
-
bindingId: t.bindingId,
|
|
1362
|
-
config: r.config,
|
|
1363
|
-
definition: n,
|
|
1364
|
-
kind: "integration",
|
|
1365
|
-
name: i
|
|
1366
|
-
};
|
|
1367
|
-
return [{
|
|
1368
|
-
binding: {
|
|
1369
|
-
kind: "connection",
|
|
1370
|
-
target: r.connectionId
|
|
1371
|
-
},
|
|
1372
|
-
bindingId: t.bindingId,
|
|
1373
|
-
kind: "binding.create"
|
|
1374
|
-
}, {
|
|
1375
|
-
kind: "graph.node.create",
|
|
1376
|
-
node: a,
|
|
1377
|
-
nodeId: t.nodeId,
|
|
1378
|
-
target: e
|
|
1379
|
-
}];
|
|
1380
|
-
}
|
|
1381
|
-
function Ae(e, t, n) {
|
|
1382
|
-
let r = H(e, t)?.nodes;
|
|
1383
|
-
if (r == null) return [];
|
|
1384
|
-
let i = new Set(n), a = n.flatMap((e) => {
|
|
1385
|
-
let n = r[e];
|
|
1386
|
-
return n == null ? [] : [{
|
|
1387
|
-
kind: "graph.node.delete",
|
|
1388
|
-
nodeId: e,
|
|
1389
|
-
target: t
|
|
1390
|
-
}, ...n.kind == "task" && n.task != null ? [{
|
|
1391
|
-
kind: "module.delete",
|
|
1392
|
-
moduleId: n.task.moduleId
|
|
1393
|
-
}] : []];
|
|
1394
|
-
});
|
|
1395
|
-
if (t.kind == "subflow") return a;
|
|
1396
|
-
let o = new Set(n.flatMap((e) => {
|
|
1397
|
-
let t = r[e];
|
|
1398
|
-
return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
|
|
1399
|
-
}));
|
|
1400
|
-
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({
|
|
1401
|
-
bindingId: t,
|
|
1402
|
-
kind: "binding.delete"
|
|
1403
|
-
});
|
|
1404
|
-
return a;
|
|
1405
|
-
}
|
|
1406
|
-
function je(e, t, n, r) {
|
|
1407
|
-
let i = H(e, t)?.nodes[n];
|
|
1408
|
-
if (i == null || !("inputs" in i)) return;
|
|
1409
|
-
let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
|
|
1410
|
-
return G(t, n, {
|
|
1411
|
-
...c,
|
|
1412
|
-
...r
|
|
1413
|
-
});
|
|
1414
|
-
}
|
|
1415
|
-
function Me(e, t, n, r, i) {
|
|
1416
|
-
return Ne(e, t, n, { [r]: i });
|
|
1417
|
-
}
|
|
1418
|
-
function Ne(e, t, n, r) {
|
|
1419
|
-
let i = H(e, t)?.nodes[n];
|
|
1420
|
-
if (i == null || !("inputs" in i)) return;
|
|
1421
|
-
let a = { ...i.inputs };
|
|
1422
|
-
for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
|
|
1423
|
-
kind: "value",
|
|
1424
|
-
value: t
|
|
1425
|
-
};
|
|
1426
|
-
return G(t, n, {
|
|
1427
|
-
...i,
|
|
1428
|
-
inputs: a
|
|
1429
|
-
});
|
|
1430
|
-
}
|
|
1431
|
-
function Pe(e, t, n) {
|
|
1432
|
-
let r = e.document.tasks[t];
|
|
1433
|
-
if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
|
|
1434
|
-
kind: "task.replace",
|
|
1435
|
-
task: {
|
|
1436
|
-
...r,
|
|
1437
|
-
executor: {
|
|
1438
|
-
...r.executor,
|
|
1439
|
-
connectionId: n
|
|
1440
|
-
}
|
|
1441
|
-
},
|
|
1442
|
-
taskId: t
|
|
1443
|
-
}];
|
|
1444
|
-
}
|
|
1445
|
-
function Fe(e, t, n, r) {
|
|
1446
|
-
let i = e.document.graph.nodes[n];
|
|
1447
|
-
if (i == null) return;
|
|
1448
|
-
let a = {
|
|
1449
|
-
...r.description == null ? {} : { description: r.description },
|
|
1450
|
-
icon: i.icon,
|
|
1451
|
-
name: r.name
|
|
1452
|
-
}, o;
|
|
1453
|
-
switch (r.kind) {
|
|
1454
|
-
case "webhook":
|
|
1455
|
-
if (i.kind != "webhook") return;
|
|
1456
|
-
o = Object.keys(r.options).length == 0 ? {
|
|
1457
|
-
...a,
|
|
1458
|
-
inputsDef: r.inputs,
|
|
1459
|
-
kind: "webhook"
|
|
1460
|
-
} : {
|
|
1461
|
-
...a,
|
|
1462
|
-
inputsDef: r.inputs,
|
|
1463
|
-
kind: "webhook",
|
|
1464
|
-
options: r.options
|
|
1465
|
-
};
|
|
1466
|
-
break;
|
|
1467
|
-
case "cron":
|
|
1468
|
-
if (i.kind != "cron") return;
|
|
1469
|
-
o = {
|
|
1470
|
-
...a,
|
|
1471
|
-
cronTimes: r.schedule,
|
|
1472
|
-
kind: "cron"
|
|
1473
|
-
};
|
|
1474
|
-
break;
|
|
1475
|
-
case "poll":
|
|
1476
|
-
if (i.kind != "poll") return;
|
|
1477
|
-
o = {
|
|
1478
|
-
...i,
|
|
1479
|
-
...a,
|
|
1480
|
-
config: r.config,
|
|
1481
|
-
pollTimes: r.schedule
|
|
1482
|
-
};
|
|
1483
|
-
break;
|
|
1484
|
-
case "integration":
|
|
1485
|
-
if (i.kind != "integration") return;
|
|
1486
|
-
o = {
|
|
1487
|
-
...i,
|
|
1488
|
-
...a,
|
|
1489
|
-
config: r.config
|
|
1490
|
-
};
|
|
1491
|
-
}
|
|
1492
|
-
return G(t, n, o);
|
|
1493
|
-
}
|
|
1494
|
-
function Ie(e, t, n, r, i) {
|
|
1495
|
-
let a = e.document.graph.nodes[n];
|
|
1496
|
-
if (a == null || a.kind != "integration" && a.kind != "poll") return;
|
|
1497
|
-
let o = { ...a.config };
|
|
1498
|
-
return i === void 0 ? delete o[r] : o[r] = i, G(t, n, {
|
|
1499
|
-
...a,
|
|
1500
|
-
config: o
|
|
1501
|
-
});
|
|
1502
|
-
}
|
|
1503
|
-
function Le(e, t, n, r) {
|
|
1504
|
-
let i = e.document.graph.nodes[n];
|
|
1505
|
-
if (i != null) switch (i.kind) {
|
|
1506
|
-
case "cron": return G(t, n, {
|
|
1507
|
-
...i,
|
|
1508
|
-
cronTimes: r
|
|
1509
|
-
});
|
|
1510
|
-
case "poll": return G(t, n, {
|
|
1511
|
-
...i,
|
|
1512
|
-
pollTimes: r
|
|
1513
|
-
});
|
|
1514
|
-
case "integration":
|
|
1515
|
-
case "webhook": return;
|
|
1516
|
-
default: return;
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
function Re(e, t, n, r) {
|
|
1520
|
-
let i = e.document.graph.nodes[n];
|
|
1521
|
-
if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
|
|
1522
|
-
binding: {
|
|
1523
|
-
kind: "connection",
|
|
1524
|
-
target: r
|
|
1525
|
-
},
|
|
1526
|
-
bindingId: i.bindingId,
|
|
1527
|
-
kind: "binding.replace"
|
|
1528
|
-
}];
|
|
1529
|
-
}
|
|
1530
|
-
function H(e, t) {
|
|
1531
|
-
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
1532
|
-
}
|
|
1533
|
-
function U(e) {
|
|
1534
|
-
return Object.fromEntries(e.flatMap((e) => Object.hasOwn(e, "value") ? [[e.handle, {
|
|
1535
|
-
kind: "value",
|
|
1536
|
-
value: e.value
|
|
1537
|
-
}]] : []));
|
|
1538
|
-
}
|
|
1539
|
-
function W(e, t, n) {
|
|
1540
|
-
return e != null && Object.hasOwn(e, t) ? e[t] : n;
|
|
1541
|
-
}
|
|
1542
|
-
function G(e, t, n) {
|
|
1543
|
-
return [{
|
|
1544
|
-
kind: "graph.node.replace",
|
|
1545
|
-
node: n,
|
|
1546
|
-
nodeId: t,
|
|
1547
|
-
target: e
|
|
1548
|
-
}];
|
|
1549
|
-
}
|
|
1550
|
-
//#endregion
|
|
1551
|
-
//#region src/workbench/browser/runtime/designer/flowChanges.ts
|
|
1552
|
-
function K(e, t) {
|
|
1553
|
-
return {
|
|
1554
|
-
...e,
|
|
1555
|
-
content: i(e.content, t)
|
|
1556
|
-
};
|
|
1557
|
-
}
|
|
1558
|
-
function ze(e, t) {
|
|
1559
|
-
return [{
|
|
1560
|
-
kind: "subflow.create",
|
|
1561
|
-
subflow: {
|
|
1562
|
-
graph: { nodes: {} },
|
|
1563
|
-
inputs: [{
|
|
1564
|
-
handle: "value",
|
|
1565
|
-
jsonSchema: {},
|
|
1566
|
-
nullable: !0,
|
|
1567
|
-
value: null
|
|
1568
|
-
}],
|
|
1569
|
-
name: t,
|
|
1570
|
-
outputs: [{
|
|
1571
|
-
handle: "result",
|
|
1572
|
-
jsonSchema: {},
|
|
1573
|
-
nullable: !0,
|
|
1574
|
-
sources: [{
|
|
1575
|
-
input: "value",
|
|
1576
|
-
kind: "flow"
|
|
1577
|
-
}]
|
|
1578
|
-
}]
|
|
1579
|
-
},
|
|
1580
|
-
subflowId: e
|
|
1581
|
-
}];
|
|
1582
|
-
}
|
|
1583
|
-
function Be(e, t, n, r, i) {
|
|
1584
|
-
switch (r.kind) {
|
|
1585
|
-
case "code": return Te(t, {
|
|
1586
|
-
moduleId: i(),
|
|
1587
|
-
nodeId: n
|
|
1588
|
-
}, r.name);
|
|
1589
|
-
case "llm": return Ee(t, {
|
|
1590
|
-
nodeId: n,
|
|
1591
|
-
taskId: i()
|
|
1592
|
-
}, r.name, r.mode, r.outputDescription);
|
|
1593
|
-
case "connector": return B(t, {
|
|
1594
|
-
nodeId: n,
|
|
1595
|
-
taskId: i()
|
|
1596
|
-
}, {
|
|
1597
|
-
executor: {
|
|
1598
|
-
action: r.action.actionId,
|
|
1599
|
-
...r.action.defaultConnection == null ? {} : { connectionId: r.action.defaultConnection.connectionId },
|
|
1600
|
-
kind: "connector"
|
|
1601
|
-
},
|
|
1602
|
-
inputs: Object.entries(r.action.inputs).map(([e, t]) => Object.assign({ handle: e }, t)),
|
|
1603
|
-
name: r.action.name,
|
|
1604
|
-
outputs: Object.entries(r.action.outputs).map(([e, t]) => Object.assign({ handle: e }, t))
|
|
1605
|
-
});
|
|
1606
|
-
case "condition": return De(t, n, r.name);
|
|
1607
|
-
case "value": return Oe(t, n, r.name);
|
|
1608
|
-
case "subflow": {
|
|
1609
|
-
let i = e.subflow(r.subflowId);
|
|
1610
|
-
return i == null ? void 0 : tt(t, n, r.subflowId, i.inputs);
|
|
1611
|
-
}
|
|
1612
|
-
case "webhook": return t.kind == "flow" ? V(t, n, {
|
|
1613
|
-
inputsDef: [],
|
|
1614
|
-
kind: "webhook",
|
|
1615
|
-
name: r.name
|
|
1616
|
-
}) : void 0;
|
|
1617
|
-
case "cron": return t.kind == "flow" ? V(t, n, {
|
|
1618
|
-
cronTimes: [{
|
|
1619
|
-
type: "every",
|
|
1620
|
-
unit: "hour",
|
|
1621
|
-
value: 1
|
|
1622
|
-
}],
|
|
1623
|
-
kind: "cron",
|
|
1624
|
-
name: r.name
|
|
1625
|
-
}) : void 0;
|
|
1626
|
-
case "provider-trigger": return t.kind == "flow" ? ke(t, {
|
|
1627
|
-
bindingId: i(),
|
|
1628
|
-
nodeId: n
|
|
1629
|
-
}, r.definition, {
|
|
1630
|
-
config: {},
|
|
1631
|
-
connectionId: r.connectionId
|
|
1632
|
-
}) : void 0;
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
function Ve(e, t, n) {
|
|
1636
|
-
return Ae(e.revision.content, t, n);
|
|
1637
|
-
}
|
|
1638
|
-
function He(e, t, n) {
|
|
1639
|
-
let r = e.graph(t)?.nodes ?? {}, i = Object.fromEntries(n.flatMap((e) => r[e] == null ? [] : [[e, r[e]]]));
|
|
1640
|
-
return {
|
|
1641
|
-
modules: Object.fromEntries(Object.values(i).flatMap((t) => {
|
|
1642
|
-
if (t.kind != "task" || t.task == null) return [];
|
|
1643
|
-
let n = e.revision.content.modules[t.task.moduleId];
|
|
1644
|
-
return n == null ? [] : [[t.task.moduleId, n]];
|
|
1645
|
-
})),
|
|
1646
|
-
nodes: i
|
|
1647
|
-
};
|
|
1648
|
-
}
|
|
1649
|
-
function Ue(e, t, n, r) {
|
|
1650
|
-
if (e.graph(t) == null) return {
|
|
1651
|
-
changes: [],
|
|
1652
|
-
nodeIds: [],
|
|
1653
|
-
sourceIds: []
|
|
1654
|
-
};
|
|
1655
|
-
let i = Object.entries(n.nodes).filter(([, e]) => (t.kind == "flow" || "inputs" in e) && (e.kind != "task" || e.task == null || n.modules[e.task.moduleId] != null)), a = i.map(([e]) => e), o = new Map(a.map((e) => [e, r()])), s = [];
|
|
1656
|
-
for (let [a, c] of i) {
|
|
1657
|
-
let i = o.get(a);
|
|
1658
|
-
if (!("inputs" in c)) {
|
|
1659
|
-
if (c.kind == "poll" || c.kind == "integration") {
|
|
1660
|
-
let n = e.binding(c.bindingId);
|
|
1661
|
-
if (n == null) continue;
|
|
1662
|
-
let a = r();
|
|
1663
|
-
s.push({
|
|
1664
|
-
binding: n,
|
|
1665
|
-
bindingId: a,
|
|
1666
|
-
kind: "binding.create"
|
|
1667
|
-
}), s.push({
|
|
1668
|
-
kind: "graph.node.create",
|
|
1669
|
-
node: {
|
|
1670
|
-
...c,
|
|
1671
|
-
bindingId: a,
|
|
1672
|
-
name: `${c.name} copy`
|
|
1673
|
-
},
|
|
1674
|
-
nodeId: i,
|
|
1675
|
-
target: t
|
|
1676
|
-
});
|
|
1677
|
-
} else s.push({
|
|
1678
|
-
kind: "graph.node.create",
|
|
1679
|
-
node: {
|
|
1680
|
-
...c,
|
|
1681
|
-
name: `${c.name} copy`
|
|
1682
|
-
},
|
|
1683
|
-
nodeId: i,
|
|
1684
|
-
target: t
|
|
1685
|
-
});
|
|
1686
|
-
continue;
|
|
1687
|
-
}
|
|
1688
|
-
let l = {};
|
|
1689
|
-
for (let [e, t] of Object.entries(c.inputs)) {
|
|
1690
|
-
if (t.kind == "value") {
|
|
1691
|
-
l[e] = t;
|
|
1692
|
-
continue;
|
|
1693
|
-
}
|
|
1694
|
-
let n = [];
|
|
1695
|
-
for (let e of t.sources) {
|
|
1696
|
-
if (e.kind != "node") {
|
|
1697
|
-
n.push(e);
|
|
1698
|
-
continue;
|
|
1699
|
-
}
|
|
1700
|
-
let t = o.get(e.nodeId);
|
|
1701
|
-
t != null && n.push({
|
|
1702
|
-
...e,
|
|
1703
|
-
nodeId: t
|
|
1704
|
-
});
|
|
1705
|
-
}
|
|
1706
|
-
n.length > 0 && (l[e] = {
|
|
1707
|
-
kind: "sources",
|
|
1708
|
-
sources: n
|
|
1709
|
-
});
|
|
1710
|
-
}
|
|
1711
|
-
let u = {
|
|
1712
|
-
...c,
|
|
1713
|
-
inputs: l,
|
|
1714
|
-
...c.name == null ? {} : { name: `${c.name} copy` }
|
|
1715
|
-
};
|
|
1716
|
-
if (c.kind == "task" && c.task != null) {
|
|
1717
|
-
let e = r(), t = n.modules[c.task.moduleId];
|
|
1718
|
-
s.push({
|
|
1719
|
-
kind: "module.create",
|
|
1720
|
-
module: {
|
|
1721
|
-
...t,
|
|
1722
|
-
name: `${t.name} copy`
|
|
1723
|
-
},
|
|
1724
|
-
moduleId: e
|
|
1725
|
-
}), u = {
|
|
1726
|
-
...c,
|
|
1727
|
-
inputs: l,
|
|
1728
|
-
...c.name == null ? {} : { name: `${c.name} copy` },
|
|
1729
|
-
task: {
|
|
1730
|
-
...c.task,
|
|
1731
|
-
moduleId: e,
|
|
1732
|
-
name: `${c.task.name} copy`
|
|
1733
|
-
}
|
|
1734
|
-
};
|
|
1735
|
-
}
|
|
1736
|
-
s.push({
|
|
1737
|
-
kind: "graph.node.create",
|
|
1738
|
-
node: u,
|
|
1739
|
-
nodeId: i,
|
|
1740
|
-
target: t
|
|
1741
|
-
});
|
|
1742
|
-
}
|
|
1743
|
-
return {
|
|
1744
|
-
changes: s,
|
|
1745
|
-
nodeIds: [...o.values()],
|
|
1746
|
-
sourceIds: a
|
|
1747
|
-
};
|
|
1748
|
-
}
|
|
1749
|
-
function We(e, t, n, r) {
|
|
1750
|
-
return je(e.revision.content, t, n, r);
|
|
1751
|
-
}
|
|
1752
|
-
function Ge(e, t, n, r) {
|
|
1753
|
-
let i = e.node(t, n)?.node;
|
|
1754
|
-
if (i == null) return;
|
|
1755
|
-
let { description: a, ...o } = i;
|
|
1756
|
-
return Y(t, n, r == null ? o : {
|
|
1757
|
-
...o,
|
|
1758
|
-
description: r
|
|
1759
|
-
});
|
|
1760
|
-
}
|
|
1761
|
-
function Ke(e, t, n, r) {
|
|
1762
|
-
let i = e.node(t, n)?.node;
|
|
1763
|
-
if (i == null) return;
|
|
1764
|
-
let { icon: a, ...o } = i;
|
|
1765
|
-
return Y(t, n, r == null ? o : {
|
|
1766
|
-
...o,
|
|
1767
|
-
icon: r
|
|
1768
|
-
});
|
|
1769
|
-
}
|
|
1770
|
-
function qe(e, t, n, r) {
|
|
1771
|
-
let i = e.node(t, n)?.node;
|
|
1772
|
-
if (i == null) return;
|
|
1773
|
-
if (!("inputs" in i)) return Y(t, n, {
|
|
1774
|
-
...i,
|
|
1775
|
-
name: r ?? i.name
|
|
1776
|
-
});
|
|
1777
|
-
let { name: a, ...o } = i;
|
|
1778
|
-
return Y(t, n, r == null ? o : {
|
|
1779
|
-
...o,
|
|
1780
|
-
name: r
|
|
1781
|
-
});
|
|
1782
|
-
}
|
|
1783
|
-
function Je(e, t, n, r, i) {
|
|
1784
|
-
return Me(e.revision.content, t, n, r, i);
|
|
1785
|
-
}
|
|
1786
|
-
function Ye(e, t, n, r) {
|
|
1787
|
-
let i = e.graph(t), a = i?.nodes[n];
|
|
1788
|
-
if (i == null || a?.kind != "condition") return;
|
|
1789
|
-
let o = Object.fromEntries([...a.cases.map((e) => [e.output, !0]), ...a.defaultOutput == null ? [] : [[a.defaultOutput, !0]]]), s = Object.fromEntries([...r.cases.map((e) => [e.output, !0]), ...r.defaultOutput == null ? [] : [[r.defaultOutput, !0]]]), c = a.input.handle == r.input.handle ? void 0 : [a.input.handle, r.input.handle], l = q(Object.keys(o).map((e) => ({ handle: e })), Object.keys(s).map((e) => ({ handle: e }))), u = new Set(Object.keys(s)), d = [];
|
|
1790
|
-
for (let [e, o] of Object.entries(i.nodes)) {
|
|
1791
|
-
if (!("inputs" in o)) continue;
|
|
1792
|
-
let i = e == n, s = { ...o.inputs };
|
|
1793
|
-
if (e == n) {
|
|
1794
|
-
c != null && Object.hasOwn(s, c[0]) && (s[c[1]] = s[c[0]], delete s[c[0]]);
|
|
1795
|
-
for (let e of Object.keys(s)) e != r.input.handle && delete s[e];
|
|
1796
|
-
}
|
|
1797
|
-
for (let [e, t] of Object.entries(s)) {
|
|
1798
|
-
if (t.kind != "sources") continue;
|
|
1799
|
-
let r = t.sources.flatMap((e) => e.kind != "node" || e.nodeId != n ? [e] : l != null && e.output == l[0] ? [{
|
|
1800
|
-
...e,
|
|
1801
|
-
output: l[1]
|
|
1802
|
-
}] : u.has(e.output) ? [e] : []);
|
|
1803
|
-
r.length == t.sources.length && r.every((e, n) => e === t.sources[n]) || (i = !0, r.length == 0 ? delete s[e] : s[e] = {
|
|
1804
|
-
kind: "sources",
|
|
1805
|
-
sources: r
|
|
1806
|
-
});
|
|
1807
|
-
}
|
|
1808
|
-
if (i) {
|
|
1809
|
-
if (e == n) {
|
|
1810
|
-
let { defaultOutput: n, ...i } = a;
|
|
1811
|
-
d.push({
|
|
1812
|
-
kind: "graph.node.replace",
|
|
1813
|
-
node: {
|
|
1814
|
-
...i,
|
|
1815
|
-
...r,
|
|
1816
|
-
inputs: s
|
|
1817
|
-
},
|
|
1818
|
-
nodeId: e,
|
|
1819
|
-
target: t
|
|
1820
|
-
});
|
|
1821
|
-
} else d.push({
|
|
1822
|
-
kind: "graph.node.replace",
|
|
1823
|
-
node: {
|
|
1824
|
-
...o,
|
|
1825
|
-
inputs: s
|
|
1826
|
-
},
|
|
1827
|
-
nodeId: e,
|
|
1828
|
-
target: t
|
|
1829
|
-
});
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
return d;
|
|
1833
|
-
}
|
|
1834
|
-
function Xe(e, t, n, r) {
|
|
1835
|
-
let i = e.node(t, n)?.node;
|
|
1836
|
-
if (i?.kind == "value") return Y(t, n, {
|
|
1837
|
-
...i,
|
|
1838
|
-
values: r.map((e) => ({
|
|
1839
|
-
handle: e.handle,
|
|
1840
|
-
...e.description == null ? {} : { description: e.description },
|
|
1841
|
-
jsonSchema: e.jsonSchema ?? {},
|
|
1842
|
-
nullable: e.nullable ?? !1,
|
|
1843
|
-
...Object.hasOwn(e, "value") ? { value: e.value } : {}
|
|
1844
|
-
}))
|
|
1845
|
-
});
|
|
1846
|
-
}
|
|
1847
|
-
function Ze(e, t, n, r) {
|
|
1848
|
-
let i = e.graph(t)?.nodes[n];
|
|
1849
|
-
if (i?.kind == "task") switch (r.kind) {
|
|
1850
|
-
case "code": return i.task == null ? void 0 : J(e, t, n, {
|
|
1851
|
-
...i.task,
|
|
1852
|
-
name: r.name
|
|
1853
|
-
});
|
|
1854
|
-
case "llm": {
|
|
1855
|
-
if (i.task != null) return;
|
|
1856
|
-
let t = e.task(i.taskId);
|
|
1857
|
-
return t?.executor.kind == "llm" ? [{
|
|
1858
|
-
kind: "task.replace",
|
|
1859
|
-
task: {
|
|
1860
|
-
executor: {
|
|
1861
|
-
kind: "llm",
|
|
1862
|
-
mode: r.mode
|
|
1863
|
-
},
|
|
1864
|
-
inputs: t.inputs,
|
|
1865
|
-
name: r.name,
|
|
1866
|
-
outputs: t.outputs
|
|
1867
|
-
},
|
|
1868
|
-
taskId: i.taskId
|
|
1869
|
-
}] : void 0;
|
|
1870
|
-
}
|
|
1871
|
-
case "connector": {
|
|
1872
|
-
if (i.task != null) return;
|
|
1873
|
-
let t = e.task(i.taskId);
|
|
1874
|
-
return t?.executor.kind == "connector" ? [{
|
|
1875
|
-
kind: "task.replace",
|
|
1876
|
-
task: {
|
|
1877
|
-
...t,
|
|
1878
|
-
name: r.name
|
|
1879
|
-
},
|
|
1880
|
-
taskId: i.taskId
|
|
1881
|
-
}] : void 0;
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
function Qe(e, t, n, r) {
|
|
1886
|
-
let i = e.graph(t)?.nodes[n];
|
|
1887
|
-
if (i?.kind == "task" && i.task != null) return J(e, t, n, {
|
|
1888
|
-
...i.task,
|
|
1889
|
-
...r
|
|
1890
|
-
});
|
|
1891
|
-
}
|
|
1892
|
-
function $e(e, t, n, r) {
|
|
1893
|
-
let i = e.trigger(n);
|
|
1894
|
-
if (i == null || i.kind != "webhook") return;
|
|
1895
|
-
let { options: a, ...o } = i;
|
|
1896
|
-
return Y(t, n, Object.keys(r.options).length == 0 ? {
|
|
1897
|
-
...o,
|
|
1898
|
-
inputsDef: r.inputs
|
|
1899
|
-
} : {
|
|
1900
|
-
...i,
|
|
1901
|
-
inputsDef: r.inputs,
|
|
1902
|
-
options: r.options
|
|
1903
|
-
});
|
|
1904
|
-
}
|
|
1905
|
-
function et(e, t, n) {
|
|
1906
|
-
if (e.subflow(t) != null) return [{
|
|
1907
|
-
definition: n,
|
|
1908
|
-
kind: "subflow.definition.replace",
|
|
1909
|
-
subflowId: t
|
|
1910
|
-
}];
|
|
1911
|
-
}
|
|
1912
|
-
function tt(e, t, n, r) {
|
|
1913
|
-
return [{
|
|
1914
|
-
kind: "graph.node.create",
|
|
1915
|
-
node: {
|
|
1916
|
-
concurrency: 1,
|
|
1917
|
-
inputs: nt(r),
|
|
1918
|
-
kind: "subflow",
|
|
1919
|
-
subflowId: n
|
|
1920
|
-
},
|
|
1921
|
-
nodeId: t,
|
|
1922
|
-
target: e
|
|
1923
|
-
}];
|
|
1924
|
-
}
|
|
1925
|
-
function nt(e) {
|
|
1926
|
-
return Object.fromEntries(e.flatMap((e) => Object.hasOwn(e, "value") ? [[e.handle, {
|
|
1927
|
-
kind: "value",
|
|
1928
|
-
value: e.value
|
|
1929
|
-
}]] : []));
|
|
1930
|
-
}
|
|
1931
|
-
function q(e, t) {
|
|
1932
|
-
let n = new Set(e.map((e) => e.handle)), r = new Set(t.map((e) => e.handle)), i = [...n].filter((e) => !r.has(e)), a = [...r].filter((e) => !n.has(e));
|
|
1933
|
-
return i.length == 1 && a.length == 1 ? [i[0], a[0]] : void 0;
|
|
1934
|
-
}
|
|
1935
|
-
function J(e, t, n, r) {
|
|
1936
|
-
let i = e.graph(t), a = i?.nodes[n];
|
|
1937
|
-
if (i == null || a?.kind != "task" || a.task == null) return;
|
|
1938
|
-
let o = q(a.task.inputs, r.inputs), s = q(a.task.outputs, r.outputs), c = new Set(r.inputs.map((e) => e.handle)), l = new Set(r.outputs.map((e) => e.handle)), u = [];
|
|
1939
|
-
for (let [e, d] of Object.entries(i.nodes)) {
|
|
1940
|
-
if (!("inputs" in d)) continue;
|
|
1941
|
-
let i = e == n, f = { ...d.inputs };
|
|
1942
|
-
if (e == n) {
|
|
1943
|
-
o != null && Object.hasOwn(f, o[0]) && (f[o[1]] = f[o[0]], delete f[o[0]]);
|
|
1944
|
-
for (let e of Object.keys(f)) c.has(e) || delete f[e];
|
|
1945
|
-
}
|
|
1946
|
-
for (let [e, t] of Object.entries(f)) {
|
|
1947
|
-
if (t.kind != "sources") continue;
|
|
1948
|
-
let r = t.sources.flatMap((e) => e.kind != "node" || e.nodeId != n ? [e] : s != null && e.output == s[0] ? [{
|
|
1949
|
-
...e,
|
|
1950
|
-
output: s[1]
|
|
1951
|
-
}] : l.has(e.output) ? [e] : []);
|
|
1952
|
-
r.length == t.sources.length && r.every((e, n) => e === t.sources[n]) || (i = !0, r.length == 0 ? delete f[e] : f[e] = {
|
|
1953
|
-
kind: "sources",
|
|
1954
|
-
sources: r
|
|
1955
|
-
});
|
|
1956
|
-
}
|
|
1957
|
-
if (!i) continue;
|
|
1958
|
-
let p = e == n ? {
|
|
1959
|
-
...a,
|
|
1960
|
-
inputs: f,
|
|
1961
|
-
task: r
|
|
1962
|
-
} : {
|
|
1963
|
-
...d,
|
|
1964
|
-
inputs: f
|
|
1965
|
-
};
|
|
1966
|
-
u.push({
|
|
1967
|
-
kind: "graph.node.replace",
|
|
1968
|
-
node: p,
|
|
1969
|
-
nodeId: e,
|
|
1970
|
-
target: t
|
|
1971
|
-
});
|
|
1972
|
-
}
|
|
1973
|
-
return u;
|
|
1974
|
-
}
|
|
1975
|
-
function Y(e, t, n) {
|
|
1976
|
-
return [{
|
|
1977
|
-
kind: "graph.node.replace",
|
|
1978
|
-
node: n,
|
|
1979
|
-
nodeId: t,
|
|
1980
|
-
target: e
|
|
1981
|
-
}];
|
|
1982
|
-
}
|
|
1983
|
-
//#endregion
|
|
1984
1559
|
//#region src/workbench/browser/runtime/designer/remoteChangeTargets.ts
|
|
1985
|
-
function
|
|
1560
|
+
function Ot(e, t) {
|
|
1986
1561
|
return e.kind == t.kind && (e.kind != "subflow" || t.kind == "subflow" && e.id == t.id);
|
|
1987
1562
|
}
|
|
1988
|
-
function
|
|
1563
|
+
function Y(e, t, n, r) {
|
|
1989
1564
|
for (let [i, a] of Object.entries(t.graph(n)?.nodes ?? {})) r(a) && e.add(i);
|
|
1990
1565
|
}
|
|
1991
|
-
function
|
|
1566
|
+
function kt(e, t, n, r) {
|
|
1992
1567
|
let i = /* @__PURE__ */ new Set();
|
|
1993
1568
|
for (let a of r) switch (a.kind) {
|
|
1994
1569
|
case "graph.node.create":
|
|
1995
1570
|
case "graph.node.replace":
|
|
1996
|
-
|
|
1571
|
+
Ot(a.target, n) && i.add(a.nodeId);
|
|
1997
1572
|
break;
|
|
1998
1573
|
case "task.replace":
|
|
1999
|
-
|
|
1574
|
+
Y(i, e, n, (e) => e.kind == "task" && e.task == null && e.taskId == a.taskId), Y(i, t, n, (e) => e.kind == "task" && e.task == null && e.taskId == a.taskId);
|
|
2000
1575
|
break;
|
|
2001
1576
|
case "module.source.replace":
|
|
2002
|
-
|
|
1577
|
+
Y(i, e, n, (e) => e.kind == "task" && e.task?.moduleId == a.moduleId), Y(i, t, n, (e) => e.kind == "task" && e.task?.moduleId == a.moduleId);
|
|
2003
1578
|
break;
|
|
2004
|
-
case "subflow.definition.replace":
|
|
1579
|
+
case "subflow.definition.replace": Y(i, e, n, (e) => e.kind == "subflow" && e.subflowId == a.subflowId), Y(i, t, n, (e) => e.kind == "subflow" && e.subflowId == a.subflowId);
|
|
2005
1580
|
}
|
|
2006
1581
|
return new Set([...i].filter((e) => t.selection(n, e) != null));
|
|
2007
1582
|
}
|
|
2008
1583
|
//#endregion
|
|
2009
1584
|
//#region src/workbench/browser/runtime/stores/draftChanges.ts
|
|
2010
|
-
function
|
|
1585
|
+
function At(e) {
|
|
2011
1586
|
if (e.length != 1) return;
|
|
2012
1587
|
let t = e[0];
|
|
2013
1588
|
switch (t.kind) {
|
|
@@ -2020,7 +1595,7 @@ function at(e) {
|
|
|
2020
1595
|
default: return;
|
|
2021
1596
|
}
|
|
2022
1597
|
}
|
|
2023
|
-
var
|
|
1598
|
+
var jt = class {
|
|
2024
1599
|
#e;
|
|
2025
1600
|
#t;
|
|
2026
1601
|
#n;
|
|
@@ -2048,15 +1623,15 @@ var ot = class {
|
|
|
2048
1623
|
this.#a = e;
|
|
2049
1624
|
}
|
|
2050
1625
|
project(e) {
|
|
2051
|
-
return this.#o.reduce((e, t) =>
|
|
1626
|
+
return this.#o.reduce((e, t) => F(e, t.changes), e);
|
|
2052
1627
|
}
|
|
2053
1628
|
enqueue(e) {
|
|
2054
1629
|
let t = this.#s.then(e);
|
|
2055
1630
|
return this.#s = t, t;
|
|
2056
1631
|
}
|
|
2057
1632
|
async change(e, t, n, r = !0) {
|
|
2058
|
-
this.#t.beforeChange(r), this.#t.apply(
|
|
2059
|
-
let i =
|
|
1633
|
+
this.#t.beforeChange(r), this.#t.apply(F(t, n));
|
|
1634
|
+
let i = At(n), a = this.#o.at(-1), o = i != null && a != null && !a.started && At(a.changes) == i ? a : void 0;
|
|
2060
1635
|
if (o != null) return o.changes = n, await o.result;
|
|
2061
1636
|
let s = {
|
|
2062
1637
|
...e,
|
|
@@ -2084,7 +1659,7 @@ var ot = class {
|
|
|
2084
1659
|
let r = this.#l(e, n, t);
|
|
2085
1660
|
return this.#o.length == 0 && this.#t.check(), r;
|
|
2086
1661
|
} catch (n) {
|
|
2087
|
-
if (n instanceof
|
|
1662
|
+
if (n instanceof P && n.code == "flow.revision-conflict") {
|
|
2088
1663
|
if (!t && await this.#t.recover(e)) {
|
|
2089
1664
|
t = !0;
|
|
2090
1665
|
continue;
|
|
@@ -2093,7 +1668,7 @@ var ot = class {
|
|
|
2093
1668
|
kind: "error",
|
|
2094
1669
|
message: this.#n.t("notice.draftConflict")
|
|
2095
1670
|
});
|
|
2096
|
-
} else this.#u(e), this.#t.current(e) && this.#r(
|
|
1671
|
+
} else this.#u(e), this.#t.current(e) && this.#r(R(n, this.#n.t));
|
|
2097
1672
|
return;
|
|
2098
1673
|
}
|
|
2099
1674
|
}
|
|
@@ -2101,7 +1676,7 @@ var ot = class {
|
|
|
2101
1676
|
#l(e, t, n) {
|
|
2102
1677
|
let r = {
|
|
2103
1678
|
...n.revision,
|
|
2104
|
-
content:
|
|
1679
|
+
content: F(t, e.changes).content
|
|
2105
1680
|
};
|
|
2106
1681
|
this.#o = this.#o.filter((t) => t !== e), this.#a = r;
|
|
2107
1682
|
let i = this.#t.diagnostics(), a = this.#o.length == 0 && i?.revisionId == r.revisionId;
|
|
@@ -2110,19 +1685,19 @@ var ot = class {
|
|
|
2110
1685
|
#u(e) {
|
|
2111
1686
|
this.#o = this.#o.filter((t) => t !== e), !(!this.#t.current(e) || this.#a == null) && this.#t.apply(this.project(this.#a));
|
|
2112
1687
|
}
|
|
2113
|
-
},
|
|
1688
|
+
}, X = 50, Mt = {
|
|
2114
1689
|
failed: !1,
|
|
2115
1690
|
loaded: !1,
|
|
2116
1691
|
loading: !0,
|
|
2117
1692
|
loadingMore: !1,
|
|
2118
1693
|
loadMoreFailed: !1,
|
|
2119
1694
|
flows: []
|
|
2120
|
-
},
|
|
1695
|
+
}, Nt = class {
|
|
2121
1696
|
#e;
|
|
2122
1697
|
#t;
|
|
2123
1698
|
#n = new x();
|
|
2124
1699
|
#r;
|
|
2125
|
-
#i = t(
|
|
1700
|
+
#i = t(Mt);
|
|
2126
1701
|
#a = !1;
|
|
2127
1702
|
constructor(t, n, r) {
|
|
2128
1703
|
this.#e = t, this.#t = r, this.#r = n, this.$ = {
|
|
@@ -2164,7 +1739,7 @@ var ot = class {
|
|
|
2164
1739
|
try {
|
|
2165
1740
|
let t = await this.#e.listFlows({
|
|
2166
1741
|
includeTotal: !0,
|
|
2167
|
-
limit:
|
|
1742
|
+
limit: X
|
|
2168
1743
|
});
|
|
2169
1744
|
if (!e()) return;
|
|
2170
1745
|
this.#o({
|
|
@@ -2179,7 +1754,7 @@ var ot = class {
|
|
|
2179
1754
|
this.#o({
|
|
2180
1755
|
failed: !0,
|
|
2181
1756
|
loading: !1
|
|
2182
|
-
}), this.#r(
|
|
1757
|
+
}), this.#r(R(t, this.#t.t));
|
|
2183
1758
|
}
|
|
2184
1759
|
}
|
|
2185
1760
|
async loadMore() {
|
|
@@ -2193,7 +1768,7 @@ var ot = class {
|
|
|
2193
1768
|
try {
|
|
2194
1769
|
let e = await this.#e.listFlows({
|
|
2195
1770
|
cursor: t,
|
|
2196
|
-
limit:
|
|
1771
|
+
limit: X
|
|
2197
1772
|
});
|
|
2198
1773
|
if (!n()) return;
|
|
2199
1774
|
let r = new Set(this.#i.value.flows.map((e) => e.flowId));
|
|
@@ -2207,7 +1782,7 @@ var ot = class {
|
|
|
2207
1782
|
this.#o({
|
|
2208
1783
|
loadingMore: !1,
|
|
2209
1784
|
loadMoreFailed: !0
|
|
2210
|
-
}), this.#r(
|
|
1785
|
+
}), this.#r(R(e, this.#t.t));
|
|
2211
1786
|
}
|
|
2212
1787
|
}
|
|
2213
1788
|
async create(e) {
|
|
@@ -2225,6 +1800,12 @@ var ot = class {
|
|
|
2225
1800
|
}
|
|
2226
1801
|
this.#o({ flows: this.#i.value.flows.with(t, e) });
|
|
2227
1802
|
}
|
|
1803
|
+
insert(e) {
|
|
1804
|
+
this.#i.value.flows.some((t) => t.flowId == e.flowId) || this.#o({
|
|
1805
|
+
flows: [...this.#i.value.flows, e],
|
|
1806
|
+
total: this.#i.value.total == null ? void 0 : this.#i.value.total + 1
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
2228
1809
|
remove(e) {
|
|
2229
1810
|
this.#o({
|
|
2230
1811
|
flows: this.#i.value.flows.filter((t) => t.flowId != e),
|
|
@@ -2243,7 +1824,7 @@ var ot = class {
|
|
|
2243
1824
|
...e
|
|
2244
1825
|
});
|
|
2245
1826
|
}
|
|
2246
|
-
},
|
|
1827
|
+
}, Pt = class {
|
|
2247
1828
|
#e;
|
|
2248
1829
|
#t;
|
|
2249
1830
|
#n;
|
|
@@ -2286,7 +1867,7 @@ var ot = class {
|
|
|
2286
1867
|
this.#c(a, r);
|
|
2287
1868
|
} catch (r) {
|
|
2288
1869
|
if (this.#o || !n()) return;
|
|
2289
|
-
if (r instanceof
|
|
1870
|
+
if (r instanceof P && r.code == "flow.presentation-conflict") try {
|
|
2290
1871
|
let t = await this.#e.getPresentation(e);
|
|
2291
1872
|
if (this.#o || !n()) return;
|
|
2292
1873
|
this.#c(a, t), this.#n({
|
|
@@ -2294,9 +1875,9 @@ var ot = class {
|
|
|
2294
1875
|
message: this.#t.t("notice.layoutConflict")
|
|
2295
1876
|
});
|
|
2296
1877
|
} catch (e) {
|
|
2297
|
-
!this.#o && n() && this.#n(
|
|
1878
|
+
!this.#o && n() && this.#n(R(e, this.#t.t));
|
|
2298
1879
|
}
|
|
2299
|
-
else this.#c(a, t), this.#n(
|
|
1880
|
+
else this.#c(a, t), this.#n(R(r, this.#t.t));
|
|
2300
1881
|
}
|
|
2301
1882
|
}), await this.#i;
|
|
2302
1883
|
}
|
|
@@ -2308,76 +1889,13 @@ var ot = class {
|
|
|
2308
1889
|
value: n
|
|
2309
1890
|
});
|
|
2310
1891
|
}
|
|
2311
|
-
}
|
|
2312
|
-
//#endregion
|
|
2313
|
-
//#region src/workbench/browser/runtime/designer/diagnostics.ts
|
|
2314
|
-
function dt(e, t) {
|
|
2315
|
-
return t == e || t.startsWith(`${e}/`);
|
|
2316
|
-
}
|
|
2317
|
-
function ft(e, t, n, r) {
|
|
2318
|
-
if (e == null || t == null || n == null) return [];
|
|
2319
|
-
if (r != null) return _t(t, r, n.diagnostics);
|
|
2320
|
-
let i = t.kind == "flow" ? "/document/graph" : `/document/subflows/${t.id}`;
|
|
2321
|
-
return n.diagnostics.filter((e) => dt(i, e.path));
|
|
2322
|
-
}
|
|
2323
|
-
function pt(e) {
|
|
2324
|
-
return e.startsWith("/modules/") ? "code" : /\/graph\/nodes\/[^/]+\/task(?:\/|$)/.test(e) ? "task" : e.includes("/graph/nodes/") ? "node" : e.startsWith("/document/tasks/") ? "task" : "flow";
|
|
2325
|
-
}
|
|
2326
|
-
function mt(e, t) {
|
|
2327
|
-
return t.startsWith("/inputs/") ? "inputs" : e.kind == "task" && t.startsWith("/task") ? "task" : e.kind == "condition" && (t.startsWith("/cases/") || t.startsWith("/input") || t.startsWith("/defaultOutput")) ? "condition" : "node";
|
|
2328
|
-
}
|
|
2329
|
-
function ht(e, t, n) {
|
|
2330
|
-
if (e == null || t == null) return;
|
|
2331
|
-
let r = t.kind == "flow" ? "/document/graph/nodes/" : `/document/subflows/${t.id}/graph/nodes/`;
|
|
2332
|
-
if (n.path.startsWith(r)) {
|
|
2333
|
-
let i = n.path.slice(r.length), a = i.indexOf("/"), o = a < 0 ? i : i.slice(0, a), s = e.node(t, o);
|
|
2334
|
-
return s == null ? void 0 : {
|
|
2335
|
-
nodeId: o,
|
|
2336
|
-
section: mt(s.node, a < 0 ? "" : i.slice(a))
|
|
2337
|
-
};
|
|
2338
|
-
}
|
|
2339
|
-
let i = /^\/document\/tasks\/([^/]+)(.*)$/.exec(n.path);
|
|
2340
|
-
if (i != null) {
|
|
2341
|
-
let n = e.findTaskNode(t, /* @__PURE__ */ new Set([i[1]]));
|
|
2342
|
-
return n == null ? void 0 : {
|
|
2343
|
-
nodeId: n,
|
|
2344
|
-
section: i[2].startsWith("/executor") ? "account" : "task"
|
|
2345
|
-
};
|
|
2346
|
-
}
|
|
2347
|
-
let a = /^\/modules\/([^/]+)\/source$/.exec(n.path);
|
|
2348
|
-
if (a != null) {
|
|
2349
|
-
let n = e.findModuleNode(t, a[1]);
|
|
2350
|
-
if (n != null) return {
|
|
2351
|
-
nodeId: n,
|
|
2352
|
-
section: "module"
|
|
2353
|
-
};
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
function gt(e, t, n) {
|
|
2357
|
-
return n?.diagnostics.map((n) => ({
|
|
2358
|
-
diagnostic: n,
|
|
2359
|
-
location: ht(e, t, n),
|
|
2360
|
-
scope: pt(n.path)
|
|
2361
|
-
})) ?? [];
|
|
2362
|
-
}
|
|
2363
|
-
function _t(e, t, n) {
|
|
2364
|
-
let r = e.kind == "flow" ? `/document/graph/nodes/${t.id}` : `/document/subflows/${e.id}/graph/nodes/${t.id}`, i = [r];
|
|
2365
|
-
if (t.kind == "task") {
|
|
2366
|
-
t.node.task == null ? i.push(`/document/tasks/${t.node.taskId}`) : i.push(`${r}/task`);
|
|
2367
|
-
let e = t.definition != null && "moduleId" in t.definition ? t.definition.moduleId : void 0;
|
|
2368
|
-
e != null && i.push(`/modules/${e}`);
|
|
2369
|
-
} else t.kind == "subflow" && i.push(`/document/subflows/${t.node.subflowId}`);
|
|
2370
|
-
return n.filter((e) => i.some((t) => dt(t, e.path)));
|
|
2371
|
-
}
|
|
2372
|
-
//#endregion
|
|
2373
|
-
//#region src/workbench/browser/runtime/stores/workspaceModel.ts
|
|
2374
|
-
var vt = {
|
|
1892
|
+
}, Ft = {
|
|
2375
1893
|
checkLoading: !1,
|
|
2376
1894
|
selectedNodeIds: [],
|
|
2377
1895
|
workspaceLoadFailed: !1,
|
|
2378
1896
|
workspaceLoading: !1
|
|
2379
1897
|
};
|
|
2380
|
-
function
|
|
1898
|
+
function It(e) {
|
|
2381
1899
|
return e.workspaceLoading ? "loading" : e.busy == "designer" ? "saving" : e.draft == null ? "noDraft" : "saved";
|
|
2382
1900
|
}
|
|
2383
1901
|
function Z(e, t) {
|
|
@@ -2393,9 +1911,9 @@ function Q(e, t, n) {
|
|
|
2393
1911
|
source: r.module.source
|
|
2394
1912
|
};
|
|
2395
1913
|
}
|
|
2396
|
-
var
|
|
1914
|
+
var Lt = class {
|
|
2397
1915
|
#e;
|
|
2398
|
-
#t = t(
|
|
1916
|
+
#t = t(Ft);
|
|
2399
1917
|
#n;
|
|
2400
1918
|
constructor(t, r) {
|
|
2401
1919
|
let i = e(this.#t, (e) => e.busy), a = e(this.#t, (e) => e.checkLoading), o = e(this.#t, (e) => e.diagnosticFocus), s = e(this.#t, (e) => e.diagnostics), c = e(this.#t, (e) => e.draft), l = e(this.#t, (e) => {
|
|
@@ -2405,23 +1923,23 @@ var bt = class {
|
|
|
2405
1923
|
...n,
|
|
2406
1924
|
status: Z(e.draft, e.moduleEditor)
|
|
2407
1925
|
};
|
|
2408
|
-
}), u = e(this.#t, (e) => e.nodeFocus), d = e(this.#t, (e) => e.presentation), f = e(this.#t, (e) => e.flowId), p = e(this.#t, (e) => e.live), m = e(this.#t, (e) => e.draft == null ? void 0 :
|
|
1926
|
+
}), u = e(this.#t, (e) => e.nodeFocus), d = e(this.#t, (e) => e.presentation), f = e(this.#t, (e) => e.flowId), p = e(this.#t, (e) => e.live), m = e(this.#t, (e) => e.draft == null ? void 0 : N(e.draft)), h = e(this.#t, (e) => e.selectedNodeIds), g = e(this.#t, (e) => e.target), _ = e(this.#t, (e) => e.workspaceLoadFailed), v = e(this.#t, (e) => e.workspaceLoading);
|
|
2409
1927
|
this.#e = e(this.#t, (e) => ({
|
|
2410
|
-
revision: e.draft == null ? void 0 :
|
|
1928
|
+
revision: e.draft == null ? void 0 : N(e.draft),
|
|
2411
1929
|
target: e.target
|
|
2412
1930
|
}), { equal: (e, t) => e.revision === t.revision && e.target === t.target });
|
|
2413
|
-
let
|
|
2414
|
-
if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return
|
|
1931
|
+
let y = e(this.#t, (e) => {
|
|
1932
|
+
if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return N(e.draft).selection(e.target, e.selectedNodeIds[0]);
|
|
2415
1933
|
});
|
|
2416
1934
|
this.$ = {
|
|
2417
1935
|
addNodeOptions: n((e) => {
|
|
2418
1936
|
let { revision: n, target: r } = e(this.#e);
|
|
2419
|
-
return
|
|
1937
|
+
return Ne(n?.revision, r, e(t.t$));
|
|
2420
1938
|
}),
|
|
2421
1939
|
busy: i,
|
|
2422
1940
|
checkLoading: a,
|
|
2423
1941
|
diagnosticFocus: o,
|
|
2424
|
-
diagnosticItems: e(this.#t, (e) =>
|
|
1942
|
+
diagnosticItems: e(this.#t, (e) => Ee(e.draft == null ? void 0 : N(e.draft), e.target, e.diagnostics)),
|
|
2425
1943
|
diagnostics: s,
|
|
2426
1944
|
draft: c,
|
|
2427
1945
|
flow: n((e) => {
|
|
@@ -2436,7 +1954,7 @@ var bt = class {
|
|
|
2436
1954
|
flowNextCursor: r.$.nextCursor,
|
|
2437
1955
|
flowTotal: r.$.total,
|
|
2438
1956
|
flows: r.$.flows,
|
|
2439
|
-
inspectorDiagnostics: e(this.#t, (e) =>
|
|
1957
|
+
inspectorDiagnostics: e(this.#t, (e) => Ae(e.draft == null ? void 0 : N(e.draft), e.target, e.diagnostics, y.value)),
|
|
2440
1958
|
live: p,
|
|
2441
1959
|
moduleDiagnostics: e(this.#t, (e) => {
|
|
2442
1960
|
let t = e.moduleEditor?.moduleId;
|
|
@@ -2446,16 +1964,16 @@ var bt = class {
|
|
|
2446
1964
|
nodeFocus: u,
|
|
2447
1965
|
presentation: d,
|
|
2448
1966
|
revision: m,
|
|
2449
|
-
selection:
|
|
2450
|
-
selectedNodeIds:
|
|
2451
|
-
status: e(this.#t,
|
|
2452
|
-
target:
|
|
2453
|
-
targetFlow: n((e) => e(
|
|
1967
|
+
selection: y,
|
|
1968
|
+
selectedNodeIds: h,
|
|
1969
|
+
status: e(this.#t, It),
|
|
1970
|
+
target: g,
|
|
1971
|
+
targetFlow: n((e) => e(g)?.kind == "flow" ? e(r.$.flows).find((t) => t.flowId == e(f)) : void 0),
|
|
2454
1972
|
targetName: e(this.#t, (e) => {
|
|
2455
|
-
if (e.target != null) return e.target.kind == "flow" ? r.flow(e.flowId ?? "")?.name : e.draft == null ? e.target.id :
|
|
1973
|
+
if (e.target != null) return e.target.kind == "flow" ? r.flow(e.flowId ?? "")?.name : e.draft == null ? e.target.id : N(e.draft).subflow(e.target.id)?.name ?? e.target.id;
|
|
2456
1974
|
}),
|
|
2457
|
-
workspaceLoadFailed:
|
|
2458
|
-
workspaceLoading:
|
|
1975
|
+
workspaceLoadFailed: _,
|
|
1976
|
+
workspaceLoading: v
|
|
2459
1977
|
}, this.#n = new Set(Object.values(r.$));
|
|
2460
1978
|
}
|
|
2461
1979
|
get value() {
|
|
@@ -2471,14 +1989,14 @@ var bt = class {
|
|
|
2471
1989
|
for (let e of Object.values(this.$)) this.#n.has(e) || e.dispose();
|
|
2472
1990
|
this.#e.dispose(), this.#t.dispose();
|
|
2473
1991
|
}
|
|
2474
|
-
},
|
|
2475
|
-
function
|
|
1992
|
+
}, Rt = 250;
|
|
1993
|
+
function zt(e, t) {
|
|
2476
1994
|
if (t != null) return t.kind == "flow" || e.subflow(t.id) != null ? t : { kind: "flow" };
|
|
2477
1995
|
}
|
|
2478
1996
|
function $(e, t) {
|
|
2479
1997
|
return e?.kind == t?.kind ? e?.kind != "subflow" || t?.kind == "subflow" && e.id == t.id : !1;
|
|
2480
1998
|
}
|
|
2481
|
-
var
|
|
1999
|
+
var Bt = class {
|
|
2482
2000
|
#e;
|
|
2483
2001
|
#t;
|
|
2484
2002
|
#n = new x();
|
|
@@ -2501,8 +2019,8 @@ var Ct = class {
|
|
|
2501
2019
|
#y = 0;
|
|
2502
2020
|
#b;
|
|
2503
2021
|
#x;
|
|
2504
|
-
constructor(e, t, n =
|
|
2505
|
-
this.#e = e, this.#c = t, this.#i = n, this.#r = r, this.#s = i, this.#o = new
|
|
2022
|
+
constructor(e, t, n = st, r = E(), i = () => {}) {
|
|
2023
|
+
this.#e = e, this.#c = t, this.#i = n, this.#r = r, this.#s = i, this.#o = new Nt(e, t, r), this.#l = new Lt(r, this.#o), this.#t = new jt(e, t, r, {
|
|
2506
2024
|
apply: (e, t) => this.#w(e, t),
|
|
2507
2025
|
beforeChange: (e) => {
|
|
2508
2026
|
this.#M(), this.#h = !1, e && (this.#B({ busy: "designer" }), this.#c(void 0));
|
|
@@ -2515,7 +2033,7 @@ var Ct = class {
|
|
|
2515
2033
|
},
|
|
2516
2034
|
headChanged: (e, t) => this.#N(e, t),
|
|
2517
2035
|
recover: (e) => this.#O(e, !0)
|
|
2518
|
-
}), this.#a = new
|
|
2036
|
+
}), this.#a = new Pt(e, t, (e) => this.#B({ presentation: e }), r), this.$ = this.#l.$;
|
|
2519
2037
|
}
|
|
2520
2038
|
dispose() {
|
|
2521
2039
|
this.#M(), this.#_ = !0, this.#n.invalidate(), this.#a.dispose(), this.#b?.(), this.#x?.(), this.#l.dispose(), this.#o.dispose();
|
|
@@ -2570,7 +2088,7 @@ var Ct = class {
|
|
|
2570
2088
|
return t() ? (this.#B({
|
|
2571
2089
|
workspaceLoadFailed: !0,
|
|
2572
2090
|
workspaceLoading: !1
|
|
2573
|
-
}), this.#c(
|
|
2091
|
+
}), this.#c(R(e, this.#r.t)), !1) : !1;
|
|
2574
2092
|
}
|
|
2575
2093
|
return !0;
|
|
2576
2094
|
}
|
|
@@ -2587,18 +2105,20 @@ var Ct = class {
|
|
|
2587
2105
|
selectNodes(e) {
|
|
2588
2106
|
return e.length == this.#l.value.selectedNodeIds.length && e.every((e, t) => e == this.#l.value.selectedNodeIds[t]) ? !0 : this.#F() ? (this.#M(), this.#B({
|
|
2589
2107
|
diagnosticFocus: void 0,
|
|
2590
|
-
moduleEditor: Q(this.#l.value.draft == null ? void 0 :
|
|
2108
|
+
moduleEditor: Q(this.#l.value.draft == null ? void 0 : N(this.#l.value.draft), this.#l.value.target, e),
|
|
2591
2109
|
nodeFocus: void 0,
|
|
2592
2110
|
selectedNodeIds: e
|
|
2593
2111
|
}), !0) : !1;
|
|
2594
2112
|
}
|
|
2595
|
-
async createFlow(e) {
|
|
2113
|
+
async createFlow(e, t) {
|
|
2596
2114
|
if (this.#F()) {
|
|
2597
2115
|
this.#B({ busy: "flow" }), this.#c(void 0);
|
|
2598
2116
|
try {
|
|
2599
|
-
return await this.#o.create(e);
|
|
2117
|
+
if (t == null) return await this.#o.create(e);
|
|
2118
|
+
let n = await this.#e.getFlow(await t(e));
|
|
2119
|
+
return this.#o.insert(n), n;
|
|
2600
2120
|
} catch (e) {
|
|
2601
|
-
this.#_ || this.#c(
|
|
2121
|
+
this.#_ || this.#c(R(e, this.#r.t));
|
|
2602
2122
|
} finally {
|
|
2603
2123
|
this.#B({ busy: void 0 });
|
|
2604
2124
|
}
|
|
@@ -2615,7 +2135,7 @@ var Ct = class {
|
|
|
2615
2135
|
message: this.#r.t("notice.flowDeleteAccepted", { name: t.name })
|
|
2616
2136
|
}), !0);
|
|
2617
2137
|
} catch (e) {
|
|
2618
|
-
return this.#_ || this.#c(
|
|
2138
|
+
return this.#_ || this.#c(R(e, this.#r.t)), !1;
|
|
2619
2139
|
} finally {
|
|
2620
2140
|
this.#B({ busy: void 0 });
|
|
2621
2141
|
}
|
|
@@ -2624,7 +2144,7 @@ var Ct = class {
|
|
|
2624
2144
|
if (!this.#F() || this.#l.value.draft == null) return !1;
|
|
2625
2145
|
let t = this.#i();
|
|
2626
2146
|
this.#B({ busy: "resource" }), this.#c(void 0);
|
|
2627
|
-
let n = await this.#C(
|
|
2147
|
+
let n = await this.#C(ge(t, e), !1);
|
|
2628
2148
|
return this.#B({ busy: void 0 }), n != null && (this.selectTarget({
|
|
2629
2149
|
id: t,
|
|
2630
2150
|
kind: "subflow"
|
|
@@ -2642,7 +2162,7 @@ var Ct = class {
|
|
|
2642
2162
|
try {
|
|
2643
2163
|
i = await this.#e.renameFlow(e, r), i != null && this.#o.include(i);
|
|
2644
2164
|
} catch (e) {
|
|
2645
|
-
this.#_ || this.#c(
|
|
2165
|
+
this.#_ || this.#c(R(e, this.#r.t));
|
|
2646
2166
|
}
|
|
2647
2167
|
return this.#B({ busy: void 0 }), i != null && (this.#c({
|
|
2648
2168
|
kind: "success",
|
|
@@ -2655,32 +2175,35 @@ var Ct = class {
|
|
|
2655
2175
|
if (r == null || i == null) return;
|
|
2656
2176
|
let a = this.#i();
|
|
2657
2177
|
if (e.kind == "comment") return await this.#S(i, a, t);
|
|
2658
|
-
let o =
|
|
2178
|
+
let o = N(r), s = S(e, o, i, this.#r.t);
|
|
2659
2179
|
if (s == null) return;
|
|
2660
|
-
let c =
|
|
2180
|
+
let c = xe(o, i, a, s, this.#i);
|
|
2661
2181
|
if (c == null) return;
|
|
2662
|
-
let l = n == null ? c : [...c, ...
|
|
2182
|
+
let l = n == null ? c : [...c, ...nt(F(r, c).content, i, n(a))], u = this.#C(l);
|
|
2663
2183
|
this.selectNodes([a]);
|
|
2664
2184
|
let d = this.moveNodes({ [a]: t });
|
|
2665
|
-
if (await u != null
|
|
2185
|
+
if (await u != null && (await d, !this.#_)) return this.#B({ nodeFocus: {
|
|
2186
|
+
nodeId: a,
|
|
2187
|
+
requestId: ++this.#y
|
|
2188
|
+
} }), a;
|
|
2666
2189
|
}
|
|
2667
2190
|
async connect(e) {
|
|
2668
2191
|
let t = this.$.revision.value, n = this.#l.value.target;
|
|
2669
2192
|
if (t == null || n == null) return;
|
|
2670
|
-
let r =
|
|
2193
|
+
let r = nt(t.revision.content, n, e);
|
|
2671
2194
|
r.length > 0 && await this.#C(r);
|
|
2672
2195
|
}
|
|
2673
2196
|
async disconnect(e) {
|
|
2674
2197
|
let t = this.$.revision.value, n = this.#l.value.target;
|
|
2675
2198
|
if (t == null || n == null) return;
|
|
2676
|
-
let r =
|
|
2199
|
+
let r = rt(t.revision.content, n, e);
|
|
2677
2200
|
r.length > 0 && await this.#C(r);
|
|
2678
2201
|
}
|
|
2679
2202
|
async deleteSelectedNodes() {
|
|
2680
2203
|
if (!this.#F()) return;
|
|
2681
2204
|
let e = this.$.revision.value, t = this.#l.value.target;
|
|
2682
2205
|
if (e == null || t == null || this.#l.value.selectedNodeIds.length == 0) return;
|
|
2683
|
-
let n =
|
|
2206
|
+
let n = T(this.#l.value.presentation?.value ?? {}, t), r = new Set(this.#l.value.selectedNodeIds.filter((e) => n.has(e))), i = we(e, t, this.#l.value.selectedNodeIds), a = i.length == 0 ? void 0 : this.#C(i), o = r.size == 0 ? void 0 : this.#T((e) => y(e, t, r));
|
|
2684
2207
|
this.selectNodes([]), (a == null || await a != null) && await o;
|
|
2685
2208
|
}
|
|
2686
2209
|
copySelectedNodes() {
|
|
@@ -2694,14 +2217,14 @@ var Ct = class {
|
|
|
2694
2217
|
sourceId: e.id,
|
|
2695
2218
|
title: e.title
|
|
2696
2219
|
}] : []),
|
|
2697
|
-
nodes:
|
|
2220
|
+
nodes: ke(e, t, this.#l.value.selectedNodeIds)
|
|
2698
2221
|
};
|
|
2699
2222
|
}
|
|
2700
2223
|
async pasteNodes(e) {
|
|
2701
2224
|
if (!this.#F()) return;
|
|
2702
2225
|
let t = this.$.revision.value, n = this.#l.value.target;
|
|
2703
2226
|
if (t == null || n == null || this.#u == null) return;
|
|
2704
|
-
let r =
|
|
2227
|
+
let r = je(t, n, this.#u.nodes, this.#i), i = r.changes.length == 0 ? void 0 : this.#C(r.changes), a = this.#u.comments.map((e) => ({
|
|
2705
2228
|
...e,
|
|
2706
2229
|
nodeId: this.#i()
|
|
2707
2230
|
}));
|
|
@@ -2713,8 +2236,8 @@ var Ct = class {
|
|
|
2713
2236
|
y: (i?.y ?? 80) + 40
|
|
2714
2237
|
}];
|
|
2715
2238
|
})), c = this.#T((e) => {
|
|
2716
|
-
let t =
|
|
2717
|
-
for (let e of a) t =
|
|
2239
|
+
let t = j(e, n, s);
|
|
2240
|
+
for (let e of a) t = I(t, n, e.nodeId, {
|
|
2718
2241
|
content: e.content,
|
|
2719
2242
|
position: {
|
|
2720
2243
|
x: e.position.x + 40,
|
|
@@ -2732,50 +2255,56 @@ var Ct = class {
|
|
|
2732
2255
|
async saveNodeSettings(e, t) {
|
|
2733
2256
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2734
2257
|
if (n == null || r == null) return !1;
|
|
2735
|
-
let i =
|
|
2258
|
+
let i = Me(n, r, e, t);
|
|
2736
2259
|
return i != null && await this.#C(i) != null;
|
|
2737
2260
|
}
|
|
2738
2261
|
async saveNodeDescription(e, t) {
|
|
2739
2262
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2740
2263
|
if (n == null || r == null) return !1;
|
|
2741
|
-
let i =
|
|
2264
|
+
let i = be(n, r, e, t);
|
|
2742
2265
|
return i != null && await this.#C(i) != null;
|
|
2743
2266
|
}
|
|
2744
2267
|
async saveNodeIcon(e, t) {
|
|
2745
2268
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2746
2269
|
if (n == null || r == null) return !1;
|
|
2747
|
-
let i =
|
|
2270
|
+
let i = ye(n, r, e, t);
|
|
2748
2271
|
return i != null && await this.#C(i) != null;
|
|
2749
2272
|
}
|
|
2750
2273
|
async saveNodeTitle(e, t) {
|
|
2751
2274
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2752
2275
|
if (n == null || r == null) return !1;
|
|
2753
|
-
let i =
|
|
2276
|
+
let i = me(n, r, e, t);
|
|
2754
2277
|
return i != null && await this.#C(i) != null;
|
|
2755
2278
|
}
|
|
2756
2279
|
async setInputValue(e, t, n) {
|
|
2757
2280
|
let r = this.$.revision.value, i = this.#l.value.target;
|
|
2758
2281
|
if (r == null || i == null) return !1;
|
|
2759
|
-
let a =
|
|
2282
|
+
let a = _e(r, i, e, t, n);
|
|
2283
|
+
return a != null && await this.#C(a) != null;
|
|
2284
|
+
}
|
|
2285
|
+
async setInputVariable(e, t, n) {
|
|
2286
|
+
let r = this.$.revision.value, i = this.#l.value.target;
|
|
2287
|
+
if (r == null || i == null) return !1;
|
|
2288
|
+
let a = n == null ? _e(r, i, e, t, void 0) : ve(r, i, e, t, n, this.#i());
|
|
2760
2289
|
return a != null && await this.#C(a) != null;
|
|
2761
2290
|
}
|
|
2762
2291
|
async saveCondition(e, t) {
|
|
2763
2292
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2764
2293
|
if (n == null || r == null) return !1;
|
|
2765
|
-
let i =
|
|
2294
|
+
let i = Te(n, r, e, t);
|
|
2766
2295
|
return i != null && await this.#C(i) != null;
|
|
2767
2296
|
}
|
|
2768
2297
|
async saveValue(e, t) {
|
|
2769
2298
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2770
2299
|
if (n == null || r == null) return !1;
|
|
2771
|
-
let i =
|
|
2300
|
+
let i = Pe(n, r, e, t);
|
|
2772
2301
|
return i != null && await this.#C(i) != null;
|
|
2773
2302
|
}
|
|
2774
2303
|
async saveComment(e, t) {
|
|
2775
2304
|
let n = this.#l.value.target;
|
|
2776
2305
|
if (n == null) return;
|
|
2777
2306
|
let r = this.#P().nodes.find((t) => t.id == e)?.position;
|
|
2778
|
-
r != null && await this.#T((i) =>
|
|
2307
|
+
r != null && await this.#T((i) => I(i, n, e, {
|
|
2779
2308
|
...t,
|
|
2780
2309
|
position: r
|
|
2781
2310
|
}));
|
|
@@ -2783,55 +2312,55 @@ var Ct = class {
|
|
|
2783
2312
|
async saveTaskSettings(e, t) {
|
|
2784
2313
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2785
2314
|
if (n == null || r == null) return !1;
|
|
2786
|
-
let i =
|
|
2315
|
+
let i = he(n, r, e, t);
|
|
2787
2316
|
return i != null && await this.#C(i) != null;
|
|
2788
2317
|
}
|
|
2789
2318
|
async saveCodeTaskPorts(e, t) {
|
|
2790
2319
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2791
2320
|
if (n == null || r == null) return !1;
|
|
2792
|
-
let i =
|
|
2321
|
+
let i = De(n, r, e, t);
|
|
2793
2322
|
return i != null && await this.#C(i) != null;
|
|
2794
2323
|
}
|
|
2795
2324
|
async setConnectorConnection(e, t) {
|
|
2796
2325
|
let n = this.$.revision.value;
|
|
2797
2326
|
if (n == null) return !1;
|
|
2798
|
-
let r =
|
|
2327
|
+
let r = D(n.revision.content, e, t);
|
|
2799
2328
|
return r != null && await this.#C(r) != null;
|
|
2800
2329
|
}
|
|
2801
2330
|
async saveTriggerSettings(e, t) {
|
|
2802
2331
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2803
2332
|
if (n == null || r?.kind != "flow") return !1;
|
|
2804
|
-
let i =
|
|
2333
|
+
let i = pe(n.revision.content, r, e, t);
|
|
2805
2334
|
return i != null && await this.#C(i) != null;
|
|
2806
2335
|
}
|
|
2807
2336
|
async saveTriggerConfig(e, t, n) {
|
|
2808
2337
|
let r = this.$.revision.value, i = this.#l.value.target;
|
|
2809
2338
|
if (r == null || i?.kind != "flow") return !1;
|
|
2810
|
-
let a =
|
|
2339
|
+
let a = ne(r.revision.content, i, e, t, n);
|
|
2811
2340
|
return a != null && await this.#C(a) != null;
|
|
2812
2341
|
}
|
|
2813
2342
|
async saveTriggerSchedule(e, t) {
|
|
2814
2343
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2815
2344
|
if (n == null || r?.kind != "flow") return !1;
|
|
2816
|
-
let i =
|
|
2345
|
+
let i = re(n.revision.content, r, e, t);
|
|
2817
2346
|
return i != null && await this.#C(i) != null;
|
|
2818
2347
|
}
|
|
2819
2348
|
async saveWebhook(e, t) {
|
|
2820
2349
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2821
2350
|
if (n == null || r?.kind != "flow") return !1;
|
|
2822
|
-
let i =
|
|
2351
|
+
let i = le(n, r, e, t);
|
|
2823
2352
|
return i != null && await this.#C(i) != null;
|
|
2824
2353
|
}
|
|
2825
2354
|
async setTriggerConnection(e, t) {
|
|
2826
2355
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2827
2356
|
if (n == null || r?.kind != "flow") return !1;
|
|
2828
|
-
let i =
|
|
2357
|
+
let i = de(n.revision.content, r, e, t);
|
|
2829
2358
|
return i != null && await this.#C(i) != null;
|
|
2830
2359
|
}
|
|
2831
2360
|
async saveSubflowSettings(e, t) {
|
|
2832
2361
|
let n = this.$.revision.value;
|
|
2833
2362
|
if (n == null) return !1;
|
|
2834
|
-
let r =
|
|
2363
|
+
let r = Fe(n, e, t);
|
|
2835
2364
|
return r != null && await this.#C(r) != null;
|
|
2836
2365
|
}
|
|
2837
2366
|
updateModuleSource(e) {
|
|
@@ -2862,9 +2391,9 @@ var Ct = class {
|
|
|
2862
2391
|
...e,
|
|
2863
2392
|
phase: "saving"
|
|
2864
2393
|
} });
|
|
2865
|
-
let t = await
|
|
2394
|
+
let t = await at(e.source);
|
|
2866
2395
|
if (this.#_) return !1;
|
|
2867
|
-
let n = await this.#C(
|
|
2396
|
+
let n = await this.#C(ot(e.moduleId, e.source, t));
|
|
2868
2397
|
return !this.#_ && this.#l.value.moduleEditor?.moduleId == e.moduleId && this.#B({ moduleEditor: {
|
|
2869
2398
|
...this.#l.value.moduleEditor,
|
|
2870
2399
|
phase: n == null ? "failed" : void 0
|
|
@@ -2872,13 +2401,13 @@ var Ct = class {
|
|
|
2872
2401
|
}
|
|
2873
2402
|
async moveNodes(e, t = "detail") {
|
|
2874
2403
|
let n = this.#l.value.target;
|
|
2875
|
-
n != null && await this.#T((r) =>
|
|
2404
|
+
n != null && await this.#T((r) => j(r, n, e, t));
|
|
2876
2405
|
}
|
|
2877
2406
|
async moveViewport(e, t = "detail") {
|
|
2878
2407
|
let n = this.#l.value.target;
|
|
2879
2408
|
if (n == null) return;
|
|
2880
2409
|
let r = this.#P().viewport;
|
|
2881
|
-
(r.x != e.x || r.y != e.y || r.zoom != e.zoom) && this.#M(), await this.#T((r) =>
|
|
2410
|
+
(r.x != e.x || r.y != e.y || r.zoom != e.zoom) && this.#M(), await this.#T((r) => A(r, n, e, t));
|
|
2882
2411
|
}
|
|
2883
2412
|
async check() {
|
|
2884
2413
|
await this.#E();
|
|
@@ -2908,7 +2437,7 @@ var Ct = class {
|
|
|
2908
2437
|
if (e.kind != "comment") return [];
|
|
2909
2438
|
let t = /#(\d+)$/.exec(e.title);
|
|
2910
2439
|
return t == null ? [] : [Number(t[1])];
|
|
2911
|
-
})), i = this.#T((i) =>
|
|
2440
|
+
})), i = this.#T((i) => I(i, e, t, {
|
|
2912
2441
|
content: "",
|
|
2913
2442
|
position: n,
|
|
2914
2443
|
title: this.#r.t("addNode.commentName", { number: r + 1 })
|
|
@@ -2955,7 +2484,7 @@ var Ct = class {
|
|
|
2955
2484
|
let n = await this.#e.checkFlow(e, t.revisionId);
|
|
2956
2485
|
!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#B({ diagnostics: n });
|
|
2957
2486
|
} catch (n) {
|
|
2958
|
-
!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#c(
|
|
2487
|
+
!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#c(R(n, this.#r.t));
|
|
2959
2488
|
} finally {
|
|
2960
2489
|
!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#B({ checkLoading: !1 });
|
|
2961
2490
|
}
|
|
@@ -2993,7 +2522,7 @@ var Ct = class {
|
|
|
2993
2522
|
s = this.#k(a, o);
|
|
2994
2523
|
}
|
|
2995
2524
|
if (s.revisionId == a.revisionId) return !0;
|
|
2996
|
-
let c = o.kind == "changes" && t != null ?
|
|
2525
|
+
let c = o.kind == "changes" && t != null ? kt(N(a), N(s), t, o.revisions.flatMap((e) => e.operations)) : void 0;
|
|
2997
2526
|
o.kind == "snapshot" && this.#M();
|
|
2998
2527
|
let l = this.#L(s, !1);
|
|
2999
2528
|
return this.#N(e.flowId, s.revisionId), o.kind == "changes" && o.revisions.length > 0 && t != null && c != null && i == this.#m && this.#A(e, t, c, i), n && (this.#c({
|
|
@@ -3001,7 +2530,7 @@ var Ct = class {
|
|
|
3001
2530
|
message: this.#r.t(l ? "notice.moduleUpdated" : "notice.draftUpdated")
|
|
3002
2531
|
}), this.#E()), !0;
|
|
3003
2532
|
} catch (n) {
|
|
3004
|
-
return t && this.#z(e) && this.#c(
|
|
2533
|
+
return t && this.#z(e) && this.#c(R(n, this.#r.t)), !1;
|
|
3005
2534
|
}
|
|
3006
2535
|
}
|
|
3007
2536
|
#k(e, t) {
|
|
@@ -3011,7 +2540,7 @@ var Ct = class {
|
|
|
3011
2540
|
if (e.revision.parentRevisionId != n.revisionId) throw Error("Invalid Draft revision chain.");
|
|
3012
2541
|
n = {
|
|
3013
2542
|
...e.revision,
|
|
3014
|
-
content:
|
|
2543
|
+
content: F(n, e.operations).content
|
|
3015
2544
|
};
|
|
3016
2545
|
}
|
|
3017
2546
|
return n;
|
|
@@ -3026,7 +2555,7 @@ var Ct = class {
|
|
|
3026
2555
|
return;
|
|
3027
2556
|
}
|
|
3028
2557
|
for (let e of n) a.targets.add(e);
|
|
3029
|
-
globalThis.clearTimeout(a.timer), a.timer = globalThis.setTimeout(() => this.#j(),
|
|
2558
|
+
globalThis.clearTimeout(a.timer), a.timer = globalThis.setTimeout(() => this.#j(), Rt);
|
|
3030
2559
|
return;
|
|
3031
2560
|
}
|
|
3032
2561
|
n.size == 0 || i.selectedNodeIds.length > 0 || (this.#p = {
|
|
@@ -3035,7 +2564,7 @@ var Ct = class {
|
|
|
3035
2564
|
flowId: e.flowId,
|
|
3036
2565
|
target: t,
|
|
3037
2566
|
targets: new Set(n),
|
|
3038
|
-
timer: globalThis.setTimeout(() => this.#j(),
|
|
2567
|
+
timer: globalThis.setTimeout(() => this.#j(), Rt),
|
|
3039
2568
|
viewport: this.#P().viewport
|
|
3040
2569
|
});
|
|
3041
2570
|
}
|
|
@@ -3046,7 +2575,7 @@ var Ct = class {
|
|
|
3046
2575
|
if (t.flowId != e.flowId || !$(t.target, e.target) || t.selectedNodeIds.length > 0) return;
|
|
3047
2576
|
let n = this.#P().viewport;
|
|
3048
2577
|
if (n.x != e.viewport.x || n.y != e.viewport.y || n.zoom != e.viewport.zoom || t.draft == null) return;
|
|
3049
|
-
let r =
|
|
2578
|
+
let r = N(t.draft), i = [...e.targets].filter((t) => r.selection(e.target, t) != null);
|
|
3050
2579
|
i.length == 1 && this.#B({ nodeFocus: {
|
|
3051
2580
|
nodeId: i[0],
|
|
3052
2581
|
requestId: ++this.#y
|
|
@@ -3060,7 +2589,7 @@ var Ct = class {
|
|
|
3060
2589
|
}
|
|
3061
2590
|
#P() {
|
|
3062
2591
|
let e = this.#l.value;
|
|
3063
|
-
return
|
|
2592
|
+
return M(e.draft, e.target, e.presentation?.value, e.diagnostics?.diagnostics, {}, {}, this.#r.t);
|
|
3064
2593
|
}
|
|
3065
2594
|
#F() {
|
|
3066
2595
|
let e = this.#l.value.moduleEditor;
|
|
@@ -3070,7 +2599,7 @@ var Ct = class {
|
|
|
3070
2599
|
}), !1);
|
|
3071
2600
|
}
|
|
3072
2601
|
#I(e) {
|
|
3073
|
-
let t =
|
|
2602
|
+
let t = N(e), n = zt(t, this.#l.value.target);
|
|
3074
2603
|
return {
|
|
3075
2604
|
revision: t,
|
|
3076
2605
|
selectedNodeIds: this.#l.value.selectedNodeIds.filter((e) => n != null && t.selection(n, e) != null),
|
|
@@ -3104,13 +2633,13 @@ var Ct = class {
|
|
|
3104
2633
|
};
|
|
3105
2634
|
//#endregion
|
|
3106
2635
|
//#region src/workbench/browser/runtime/stores/workbenchStore.ts
|
|
3107
|
-
function
|
|
2636
|
+
function Vt(e) {
|
|
3108
2637
|
return new Map(e.nodes.map((e) => [e.id, e]));
|
|
3109
2638
|
}
|
|
3110
|
-
function
|
|
3111
|
-
return e == null || t == null ? [] :
|
|
2639
|
+
function Ht(e, t) {
|
|
2640
|
+
return e == null || t == null ? [] : N(e).designerInputs(t);
|
|
3112
2641
|
}
|
|
3113
|
-
function
|
|
2642
|
+
function Ut(e, t, n, r, i) {
|
|
3114
2643
|
if (e == null || t?.kind != "flow" || n?.revisionId != e.revisionId || n.flowId != e.flowId) return /* @__PURE__ */ new Map();
|
|
3115
2644
|
let a = r.find((t) => t.kind == "run.started" && t.payload.flowId == e.flowId)?.payload.scopeId;
|
|
3116
2645
|
return typeof a == "string" ? new Map(r.flatMap((t) => {
|
|
@@ -3118,38 +2647,47 @@ function Et(e, t, n, r, i) {
|
|
|
3118
2647
|
return t.payload.scopeId == a && t.payload.flowId == e.flowId && typeof n == "string" && i.has(n) ? [[t.sequence, n]] : [];
|
|
3119
2648
|
})) : /* @__PURE__ */ new Map();
|
|
3120
2649
|
}
|
|
3121
|
-
var
|
|
2650
|
+
var Wt = { openExternalPage: async () => !1 }, Gt = class {
|
|
3122
2651
|
#e;
|
|
3123
2652
|
#t;
|
|
3124
2653
|
#n;
|
|
3125
2654
|
#r;
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
2655
|
+
#i;
|
|
2656
|
+
#a;
|
|
2657
|
+
#o;
|
|
2658
|
+
#s;
|
|
2659
|
+
#c;
|
|
2660
|
+
#l;
|
|
2661
|
+
constructor(r, i, a = () => crypto.randomUUID(), o = E(), s = Wt, c = !0) {
|
|
2662
|
+
this.#t = new x(), this.#r = t(), this.#a = t([]), this.#o = t(!1), this.#s = t(!1), this.#c = new x(), this.#l = !1, this.provideAddNodeOptions = async (e, t) => await this.#u([this.triggers.provideAddNodeOptions(e, t), this.connectors.provideAddNodeOptions(e, t)], t), this.browseAddNodeOptions = async (e) => await this.#u([this.triggers.browseAddNodeOptions(e), this.connectors.browseAddNodeOptions(e)], e), this.provideAddNodeOptionChoices = async (e, t) => await (e.startsWith("trigger:") ? this.triggers.provideAddNodeOptionChoices(e, t) : this.connectors.provideAddNodeOptionChoices(e, t)), this.#e = r, this.#n = o, this.#i = c;
|
|
2663
|
+
let l = (e) => {
|
|
2664
|
+
this.#l || this.#r.set(e);
|
|
3130
2665
|
};
|
|
3131
|
-
this.runs = new
|
|
2666
|
+
this.runs = new O(r, l, o), this.workspace = new Bt(r, l, st, o, (e) => void this.#d(r, e)), this.connectors = new xt(r, this.workspace, l, s, o), this.triggers = new Dt(r, this.workspace, l, s, o), this.publications = new ut(r, this.workspace, l, a, o), this.runRequests = new ht(r, this.runs, l, o, a);
|
|
3132
2667
|
let u = /* @__PURE__ */ new Map(), d, f = n((e) => {
|
|
3133
2668
|
let t = e(this.workspace.$.draft);
|
|
3134
2669
|
d != t?.flowId && (u.clear(), d = t?.flowId);
|
|
3135
|
-
let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(this.workspace.$.diagnostics)?.diagnostics, a = e(this.connectors.$.actions), s = e(this.connectors.$.catalogs), c = e(o.t$), l = e(this.runs.$.run), f = e(this.runs.$.events), p = n == null ? "" : n.kind == "flow" ? "flow" : `subflow:${n.id}`,
|
|
3136
|
-
...
|
|
3137
|
-
r == null || n == null ? void 0 :
|
|
2670
|
+
let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(this.workspace.$.diagnostics)?.diagnostics, a = e(this.connectors.$.actions), s = e(this.connectors.$.catalogs), c = e(o.t$), l = e(this.runs.$.run), f = e(this.runs.$.events), p = e(this.#a), m = e(this.#o), h = e(this.#s), g = n == null ? "" : n.kind == "flow" ? "flow" : `subflow:${n.id}`, _ = [
|
|
2671
|
+
...Ht(t, n),
|
|
2672
|
+
r == null || n == null ? void 0 : se(r, n),
|
|
3138
2673
|
i,
|
|
3139
2674
|
a,
|
|
3140
2675
|
s,
|
|
3141
2676
|
c,
|
|
3142
2677
|
l,
|
|
3143
2678
|
f,
|
|
2679
|
+
p,
|
|
2680
|
+
m,
|
|
2681
|
+
h,
|
|
3144
2682
|
...l == null ? [] : [t?.revisionId]
|
|
3145
|
-
],
|
|
3146
|
-
if (
|
|
3147
|
-
let
|
|
3148
|
-
return u.set(
|
|
3149
|
-
graph:
|
|
3150
|
-
inputs:
|
|
3151
|
-
}),
|
|
3152
|
-
}), p = e(f,
|
|
2683
|
+
], v = u.get(g);
|
|
2684
|
+
if (v != null && v.inputs.length == _.length && v.inputs.every((e, t) => e === _[t])) return v.graph;
|
|
2685
|
+
let y = M(t, n, r, i, a, s, c, l, f, p, m, h, this.#i);
|
|
2686
|
+
return u.set(g, {
|
|
2687
|
+
graph: y,
|
|
2688
|
+
inputs: _
|
|
2689
|
+
}), y;
|
|
2690
|
+
}), p = e(f, Vt);
|
|
3153
2691
|
this.$ = {
|
|
3154
2692
|
busy: n((e) => {
|
|
3155
2693
|
let t = e(this.workspace.$.busy);
|
|
@@ -3162,36 +2700,53 @@ var Dt = { openExternalPage: async () => !1 }, Ot = class {
|
|
|
3162
2700
|
}),
|
|
3163
2701
|
designer: f,
|
|
3164
2702
|
designerNodeById: p,
|
|
3165
|
-
notice: this.#
|
|
3166
|
-
runEventNodes: n((e) =>
|
|
2703
|
+
notice: this.#r,
|
|
2704
|
+
runEventNodes: n((e) => Ut(e(this.workspace.$.draft), e(this.workspace.$.target), e(this.runs.$.run), e(this.runs.$.events), e(p))),
|
|
3167
2705
|
selectedDesignerNode: n((e) => {
|
|
3168
2706
|
let t = e(this.workspace.$.selectedNodeIds);
|
|
3169
2707
|
return t.length == 1 ? e(p).get(t[0]) : void 0;
|
|
3170
|
-
})
|
|
2708
|
+
}),
|
|
2709
|
+
variableNames: this.#a,
|
|
2710
|
+
variableNamesLoaded: this.#o,
|
|
2711
|
+
variableNamesLoading: this.#s
|
|
3171
2712
|
};
|
|
3172
2713
|
}
|
|
3173
2714
|
dispose() {
|
|
3174
|
-
this.#
|
|
2715
|
+
this.#l = !0, this.#t.invalidate(), this.#c.invalidate();
|
|
3175
2716
|
for (let e of Object.values(this.$)) e.dispose();
|
|
3176
|
-
this.connectors.dispose(), this.publications.dispose(), this.runRequests.dispose(), this.runs.dispose(), this.triggers.dispose(), this.workspace.dispose();
|
|
2717
|
+
this.connectors.dispose(), this.publications.dispose(), this.runRequests.dispose(), this.runs.dispose(), this.triggers.dispose(), this.workspace.dispose(), this.#a.dispose(), this.#o.dispose(), this.#s.dispose();
|
|
3177
2718
|
}
|
|
3178
2719
|
async start(e) {
|
|
3179
|
-
this.#
|
|
2720
|
+
this.#t.invalidate(), this.connectors.reset(), this.triggers.reset(), this.publications.reset(), this.runRequests.reset(), this.runs.reset(), await this.workspace.start(e);
|
|
3180
2721
|
}
|
|
3181
2722
|
async retryFlows() {
|
|
3182
2723
|
await this.workspace.reloadFlows();
|
|
3183
2724
|
}
|
|
3184
2725
|
dismissNotice() {
|
|
3185
|
-
this.#
|
|
2726
|
+
this.#l || this.#r.set(void 0);
|
|
2727
|
+
}
|
|
2728
|
+
async refreshVariableNames() {
|
|
2729
|
+
if (this.#l || !this.#i) return;
|
|
2730
|
+
let e = this.#c.begin();
|
|
2731
|
+
this.#s.set(!0);
|
|
2732
|
+
try {
|
|
2733
|
+
let { variables: t } = await this.#e.listVariables();
|
|
2734
|
+
if (!e() || this.#l) return;
|
|
2735
|
+
this.#a.set(t.map((e) => e.name)), this.#o.set(!0);
|
|
2736
|
+
} catch (t) {
|
|
2737
|
+
e() && !this.#l && this.#r.set(R(t, this.#n.t));
|
|
2738
|
+
} finally {
|
|
2739
|
+
e() && !this.#l && this.#s.set(!1);
|
|
2740
|
+
}
|
|
3186
2741
|
}
|
|
3187
2742
|
async selectFlow(e) {
|
|
3188
|
-
return this.#
|
|
2743
|
+
return this.#l || (this.#t.invalidate(), this.#r.set(void 0), !await this.workspace.selectFlow(e)) ? !1 : (this.connectors.reset(), this.triggers.reset(), this.publications.reset(), this.runRequests.reset(), this.runs.reset(), !0);
|
|
3189
2744
|
}
|
|
3190
|
-
async createFlow(e) {
|
|
3191
|
-
let
|
|
3192
|
-
return this.#
|
|
2745
|
+
async createFlow(e, t) {
|
|
2746
|
+
let n = await this.workspace.createFlow(e, t);
|
|
2747
|
+
return this.#l || n == null ? !1 : (await this.selectFlow(n.flowId), this.#l || this.#r.set({
|
|
3193
2748
|
kind: "success",
|
|
3194
|
-
message: this.#
|
|
2749
|
+
message: this.#n.t("notice.created", { name: n.name })
|
|
3195
2750
|
}), !0);
|
|
3196
2751
|
}
|
|
3197
2752
|
selectNodes(e) {
|
|
@@ -3213,12 +2768,12 @@ var Dt = { openExternalPage: async () => !1 }, Ot = class {
|
|
|
3213
2768
|
let r = await this.workspace.addNode(e, t, n);
|
|
3214
2769
|
return r != null && e.kind == "connector" && this.connectors.refresh(), r != null && e.kind == "trigger" && this.triggers.refresh(), r;
|
|
3215
2770
|
}
|
|
3216
|
-
async #
|
|
2771
|
+
async #u(e, t) {
|
|
3217
2772
|
let n = await Promise.allSettled(e);
|
|
3218
|
-
if (t.aborted || this.#
|
|
2773
|
+
if (t.aborted || this.#l) return;
|
|
3219
2774
|
let r = n.filter((e) => e.status == "rejected");
|
|
3220
2775
|
if (r.length > 0 && r.length == n.length) throw r[0].reason;
|
|
3221
|
-
return r.length > 0 && this.#
|
|
2776
|
+
return r.length > 0 && this.#r.set(R(r[0].reason, this.#n.t)), n.flatMap((e) => e.status == "fulfilled" ? e.value ?? [] : []);
|
|
3222
2777
|
}
|
|
3223
2778
|
async refreshSelectedConnector(e = !1) {
|
|
3224
2779
|
await this.connectors.refresh(e);
|
|
@@ -3231,99 +2786,202 @@ var Dt = { openExternalPage: async () => !1 }, Ot = class {
|
|
|
3231
2786
|
let e = this.workspace.$.targetFlow.value;
|
|
3232
2787
|
return e == null ? "unavailable" : await this.runRequests.requestLive(e);
|
|
3233
2788
|
}
|
|
3234
|
-
async #
|
|
2789
|
+
async #d(e, t) {
|
|
3235
2790
|
let n = this.workspace.$.target.value;
|
|
3236
|
-
if (this.#
|
|
3237
|
-
let r = this.#
|
|
2791
|
+
if (this.#l || this.runRequests.$.submitting.value != null || n?.kind != "flow" || this.workspace.$.flowId.value != t.flowId) return;
|
|
2792
|
+
let r = this.#t.begin();
|
|
3238
2793
|
try {
|
|
3239
2794
|
let n = await e.getRun(t.runId), i = this.workspace.$.target.value;
|
|
3240
|
-
if (!r() || this.#
|
|
2795
|
+
if (!r() || this.#l || i?.kind != "flow" || this.workspace.$.flowId.value != t.flowId || n.flowId != t.flowId || n.runId != t.runId) return;
|
|
3241
2796
|
this.runs.followExternal(n);
|
|
3242
2797
|
} catch {
|
|
3243
2798
|
return;
|
|
3244
2799
|
}
|
|
3245
2800
|
}
|
|
3246
|
-
},
|
|
3247
|
-
function
|
|
2801
|
+
}, Kt = He(() => import("./flowWorkspace-DwyxAOBH.js").then((e) => e.t));
|
|
2802
|
+
function qt({ action: e, description: t, error: n, onSubmit: r, onTokenChange: i, pending: a = !1, title: o, token: s, tokenLabel: f }) {
|
|
2803
|
+
let g = s != null && f != null && i != null, _ = s ?? "", v = /* @__PURE__ */ H(We, { children: [
|
|
2804
|
+
/* @__PURE__ */ V("div", {
|
|
2805
|
+
"aria-hidden": "true",
|
|
2806
|
+
className: "flex size-10 items-center justify-center rounded-lg bg-muted text-muted-foreground",
|
|
2807
|
+
children: /* @__PURE__ */ H("svg", {
|
|
2808
|
+
className: "size-5",
|
|
2809
|
+
fill: "none",
|
|
2810
|
+
stroke: "currentColor",
|
|
2811
|
+
strokeLinecap: "round",
|
|
2812
|
+
strokeLinejoin: "round",
|
|
2813
|
+
strokeWidth: "1.8",
|
|
2814
|
+
viewBox: "0 0 24 24",
|
|
2815
|
+
children: [/* @__PURE__ */ V("rect", {
|
|
2816
|
+
height: "9",
|
|
2817
|
+
rx: "2",
|
|
2818
|
+
width: "14",
|
|
2819
|
+
x: "5",
|
|
2820
|
+
y: "11"
|
|
2821
|
+
}), /* @__PURE__ */ V("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })]
|
|
2822
|
+
})
|
|
2823
|
+
}),
|
|
2824
|
+
/* @__PURE__ */ H("header", {
|
|
2825
|
+
className: "flex flex-col gap-2",
|
|
2826
|
+
children: [/* @__PURE__ */ V("h1", {
|
|
2827
|
+
className: "text-xl font-semibold tracking-tight text-balance",
|
|
2828
|
+
children: o
|
|
2829
|
+
}), /* @__PURE__ */ V("p", {
|
|
2830
|
+
className: "text-sm/relaxed text-muted-foreground text-pretty",
|
|
2831
|
+
children: t
|
|
2832
|
+
})]
|
|
2833
|
+
}),
|
|
2834
|
+
g && /* @__PURE__ */ V(h, { children: /* @__PURE__ */ H(u, {
|
|
2835
|
+
"data-invalid": n != null,
|
|
2836
|
+
children: [
|
|
2837
|
+
/* @__PURE__ */ V(m, {
|
|
2838
|
+
htmlFor: "session-token",
|
|
2839
|
+
children: f
|
|
2840
|
+
}),
|
|
2841
|
+
/* @__PURE__ */ V(c, {
|
|
2842
|
+
autoComplete: "username",
|
|
2843
|
+
name: "username",
|
|
2844
|
+
type: "hidden",
|
|
2845
|
+
value: "open-flow",
|
|
2846
|
+
readOnly: !0
|
|
2847
|
+
}),
|
|
2848
|
+
/* @__PURE__ */ V(c, {
|
|
2849
|
+
autoComplete: "current-password",
|
|
2850
|
+
"aria-invalid": n != null,
|
|
2851
|
+
autoFocus: !0,
|
|
2852
|
+
className: "h-9",
|
|
2853
|
+
id: "session-token",
|
|
2854
|
+
name: "session-token",
|
|
2855
|
+
onChange: (e) => i?.(e.target.value),
|
|
2856
|
+
spellCheck: !1,
|
|
2857
|
+
type: "password",
|
|
2858
|
+
value: _
|
|
2859
|
+
}),
|
|
2860
|
+
n != null && /* @__PURE__ */ V(l, { children: n })
|
|
2861
|
+
]
|
|
2862
|
+
}) }),
|
|
2863
|
+
e != null && r != null && /* @__PURE__ */ H(p, {
|
|
2864
|
+
disabled: a || g && _.length == 0,
|
|
2865
|
+
size: "lg",
|
|
2866
|
+
type: "submit",
|
|
2867
|
+
children: [a && /* @__PURE__ */ V(d, {
|
|
2868
|
+
"aria-label": e,
|
|
2869
|
+
"data-icon": "inline-start"
|
|
2870
|
+
}), e]
|
|
2871
|
+
}),
|
|
2872
|
+
a && e == null && /* @__PURE__ */ V(d, { "aria-label": t })
|
|
2873
|
+
] }), y = "m-auto flex w-full max-w-[420px] flex-col gap-5 rounded-xl bg-card p-6 shadow-lg shadow-black/10";
|
|
2874
|
+
return /* @__PURE__ */ V("main", {
|
|
2875
|
+
className: "open-flow-workbench",
|
|
2876
|
+
children: /* @__PURE__ */ V("div", {
|
|
2877
|
+
className: "grid h-full overflow-auto bg-muted/20 p-4",
|
|
2878
|
+
children: r == null ? /* @__PURE__ */ V("section", {
|
|
2879
|
+
"aria-busy": a,
|
|
2880
|
+
className: y,
|
|
2881
|
+
children: v
|
|
2882
|
+
}) : /* @__PURE__ */ V("form", {
|
|
2883
|
+
"aria-busy": a,
|
|
2884
|
+
className: y,
|
|
2885
|
+
onSubmit: r,
|
|
2886
|
+
children: v
|
|
2887
|
+
})
|
|
2888
|
+
})
|
|
2889
|
+
});
|
|
2890
|
+
}
|
|
2891
|
+
function Jt({ host: e, store: t }) {
|
|
3248
2892
|
let n = a(t.$.notice);
|
|
3249
|
-
return
|
|
2893
|
+
return z(() => e.notify(n), [e, n]), z(() => () => e.notify(void 0), [e]), null;
|
|
3250
2894
|
}
|
|
3251
|
-
function
|
|
3252
|
-
let
|
|
3253
|
-
return /* @__PURE__ */
|
|
2895
|
+
function Yt({ createFlow: e, createFlowDisabled: t, createFlowField: n, flowBadges: r, hrefFor: i, hostAction: o, hostTitle: s, language: c, navigation: l, onHostAction: u, onLanguageChange: d, store: f, theme: p }) {
|
|
2896
|
+
let m = a(f.workspace.$.flowId);
|
|
2897
|
+
return /* @__PURE__ */ V("div", {
|
|
3254
2898
|
className: "app-shell",
|
|
3255
|
-
children:
|
|
3256
|
-
|
|
3257
|
-
|
|
2899
|
+
children: m == null ? /* @__PURE__ */ V(Qe, {
|
|
2900
|
+
createFlowDisabled: t,
|
|
2901
|
+
createFlowField: n,
|
|
2902
|
+
flowBadges: r,
|
|
2903
|
+
hrefForFlow: (e) => i({
|
|
2904
|
+
flowId: e.flowId,
|
|
3258
2905
|
view: "design"
|
|
3259
2906
|
}),
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
2907
|
+
hostAction: o,
|
|
2908
|
+
hostTitle: s,
|
|
2909
|
+
language: c,
|
|
2910
|
+
onCreateFlow: (t) => l.createFlow(t, e),
|
|
2911
|
+
onHostAction: u,
|
|
2912
|
+
onLanguageChange: d,
|
|
2913
|
+
onSelectFlow: (e) => void l.selectFlow(e),
|
|
2914
|
+
store: f
|
|
2915
|
+
}) : /* @__PURE__ */ V(Ve, {
|
|
2916
|
+
fallback: /* @__PURE__ */ V("main", {
|
|
3267
2917
|
"aria-busy": "true",
|
|
3268
2918
|
className: "workspace"
|
|
3269
2919
|
}),
|
|
3270
|
-
children: /* @__PURE__ */
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
2920
|
+
children: /* @__PURE__ */ V(Kt, {
|
|
2921
|
+
hostAction: o,
|
|
2922
|
+
hostTitle: s,
|
|
2923
|
+
hrefFor: i,
|
|
2924
|
+
navigation: l,
|
|
2925
|
+
onHostAction: u,
|
|
2926
|
+
store: f,
|
|
2927
|
+
theme: p
|
|
3277
2928
|
})
|
|
3278
2929
|
})
|
|
3279
2930
|
});
|
|
3280
2931
|
}
|
|
3281
|
-
function
|
|
3282
|
-
let
|
|
3283
|
-
|
|
3284
|
-
let [{ i18n:
|
|
3285
|
-
let
|
|
2932
|
+
function Xt({ createFlow: e, createFlowDisabled: t, createFlowField: n, flowBadges: r, host: i, hostAction: a, hostTitle: s, hrefFor: c, language: l, location: u, onHostAction: d, onLanguageChange: f, onNavigate: p, preferences: m, theme: h, variables: g = !0 }) {
|
|
2933
|
+
let _ = Ue(p);
|
|
2934
|
+
_.current = p;
|
|
2935
|
+
let [{ i18n: v, navigation: y, store: b }] = B(() => {
|
|
2936
|
+
let e = E(l), t = new Gt(new k((e, t) => i.request(e, t), (e, t) => i.subscribeFlow(e, t), (e) => i.subscribeFlowCatalog(e)), m, () => crypto.randomUUID(), e, i, g);
|
|
3286
2937
|
return {
|
|
3287
|
-
i18n:
|
|
3288
|
-
navigation: new
|
|
3289
|
-
store:
|
|
2938
|
+
i18n: e,
|
|
2939
|
+
navigation: new Ge(t, u, (e, t) => _.current(e, t)),
|
|
2940
|
+
store: t
|
|
3290
2941
|
};
|
|
3291
2942
|
});
|
|
3292
|
-
return
|
|
3293
|
-
|
|
2943
|
+
return z(() => {
|
|
2944
|
+
y.start();
|
|
3294
2945
|
let e = () => {
|
|
3295
|
-
|
|
2946
|
+
b.connectors.refreshAfterAuthorization(), b.triggers.refreshAfterAuthorization(), b.refreshVariableNames();
|
|
3296
2947
|
};
|
|
3297
2948
|
return globalThis.addEventListener("focus", e), () => {
|
|
3298
|
-
globalThis.removeEventListener("focus", e),
|
|
2949
|
+
globalThis.removeEventListener("focus", e), y.dispose(), b.dispose(), v.dispose();
|
|
3299
2950
|
};
|
|
3300
2951
|
}, [
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
]),
|
|
3305
|
-
|
|
3306
|
-
}, [
|
|
3307
|
-
i18n:
|
|
3308
|
-
children: /* @__PURE__ */
|
|
3309
|
-
className: "open-flow-workbench",
|
|
3310
|
-
"data-theme":
|
|
3311
|
-
children: [/* @__PURE__ */
|
|
3312
|
-
host:
|
|
3313
|
-
store:
|
|
3314
|
-
}), /* @__PURE__ */
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
2952
|
+
v,
|
|
2953
|
+
y,
|
|
2954
|
+
b
|
|
2955
|
+
]), z(() => void y.apply(u), [u, y]), z(() => {
|
|
2956
|
+
v.lang != l && v.switchLang(l);
|
|
2957
|
+
}, [v, l]), /* @__PURE__ */ V(o, {
|
|
2958
|
+
i18n: v,
|
|
2959
|
+
children: /* @__PURE__ */ H("div", {
|
|
2960
|
+
className: "open-flow-theme open-flow-workbench",
|
|
2961
|
+
"data-theme": h,
|
|
2962
|
+
children: [/* @__PURE__ */ V(Jt, {
|
|
2963
|
+
host: i,
|
|
2964
|
+
store: b
|
|
2965
|
+
}), /* @__PURE__ */ V(Yt, {
|
|
2966
|
+
createFlow: e,
|
|
2967
|
+
createFlowDisabled: t,
|
|
2968
|
+
createFlowField: n,
|
|
2969
|
+
flowBadges: r,
|
|
2970
|
+
hostAction: a,
|
|
2971
|
+
hostTitle: s,
|
|
2972
|
+
hrefFor: c,
|
|
2973
|
+
language: l,
|
|
2974
|
+
navigation: y,
|
|
2975
|
+
onHostAction: d,
|
|
2976
|
+
onLanguageChange: f,
|
|
2977
|
+
store: b,
|
|
2978
|
+
theme: h
|
|
3321
2979
|
})]
|
|
3322
2980
|
})
|
|
3323
2981
|
});
|
|
3324
2982
|
}
|
|
3325
|
-
function
|
|
3326
|
-
return /* @__PURE__ */
|
|
2983
|
+
function Zt({ sessionKey: e, ...t }) {
|
|
2984
|
+
return /* @__PURE__ */ V(Xt, { ...t }, e);
|
|
3327
2985
|
}
|
|
3328
2986
|
//#endregion
|
|
3329
|
-
export {
|
|
2987
|
+
export { qt as OpenFlowSessionGate, Zt as OpenFlowWorkbench, ze as isWorkbenchLanguage, Be as resolveWorkbenchLanguage, Re as workbenchLanguageNames, Le as workbenchLanguages };
|