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