@oomol-lab/open-flow 0.1.0-alpha.5 → 0.1.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/{addNodeOptions-B6tOfd2Y.js → addNodeOptions-DRndy4EK.js} +2237 -2599
- package/dist/browser/{createLucideIcon-BlEx4FzJ.js → createLucideIcon-CqjqCezK.js} +835 -869
- package/dist/browser/{createResourceDialog-CrBp3E8P.js → createResourceDialog-A64dDFCG.js} +140 -140
- package/dist/browser/{esm-CoE5_2w7.js → esm-YIGXG-Js.js} +1 -11
- package/dist/browser/{field-Daq9Lk-Y.js → field-CKGQHCIi.js} +88 -88
- package/dist/browser/{project-authoring-edge.d.ts → flow-authoring-edge.d.ts} +1 -1
- package/dist/browser/{project-authoring-module.d.ts → flow-authoring-module.d.ts} +1 -1
- package/dist/browser/{project-authoring-node.d.ts → flow-authoring-node.d.ts} +6 -12
- package/dist/browser/flow-authoring.d.ts +3 -0
- package/dist/browser/{project-authoring.js → flow-authoring.js} +72 -87
- package/dist/browser/{project-change.d.ts → flow-change.d.ts} +27 -36
- package/dist/browser/{project-change.js → flow-change.js} +69 -97
- package/dist/browser/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
- package/dist/browser/{flowWorkspace-CylW6hge.js → flowWorkspace-D7-rBA1-.js} +17147 -12754
- package/dist/browser/licenses.md +514 -0
- package/dist/browser/workbench-contract.d.ts +4 -4
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.d.ts +1 -1
- package/dist/browser/workbench.js +969 -1073
- package/dist/common/control-api-conformance.js +219 -352
- package/dist/common/control-api-errors.d.ts +16 -24
- package/dist/common/control-api.d.ts +39 -68
- package/dist/common/control-api.js +136 -189
- package/dist/common/cron-trigger.d.ts +1 -1
- package/dist/common/flow-encoding.d.ts +11 -0
- package/dist/common/{project-encoding.js → flow-encoding.js} +14 -13
- package/dist/common/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
- package/dist/common/{project-semantics.d.ts → flow-semantics.d.ts} +9 -12
- package/dist/common/{project-semantics.js → flow-semantics.js} +591 -592
- package/dist/common/integration-trigger.d.ts +1 -1
- package/dist/common/poll-trigger.d.ts +1 -1
- package/dist/common/runtime-contract.d.ts +1 -1
- package/dist/common/scheduler.d.ts +3 -2
- package/dist/common/scheduler.js +159 -154
- package/dist/common/webhook-trigger.d.ts +1 -1
- package/dist/common/webhook-trigger.js +1 -1
- package/package.json +13 -13
- package/dist/browser/project-authoring-flow.d.ts +0 -4
- package/dist/browser/project-authoring.d.ts +0 -4
- package/dist/common/project-encoding.d.ts +0 -11
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { a as e, f as t, i as n } from "./dist-C46JByB-.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Suspense as re, lazy as ie, useEffect as
|
|
5
|
-
import { jsx as
|
|
2
|
+
import { Ar as r, Dr as i, Ir as a, Or as o } from "./createLucideIcon-CqjqCezK.js";
|
|
3
|
+
import { $ as s, Q as c, Y as l, _ as u, a as d, c as f, d as p, f as m, g as h, i as g, l as _, m as v, n as ee, o as y, t as b, u as te, v as x, y as ne } from "./addNodeOptions-DRndy4EK.js";
|
|
4
|
+
import { Suspense as re, lazy as ie, useEffect as S, useRef as ae, useState as oe } from "react";
|
|
5
|
+
import { jsx as C, jsxs as se } from "react/jsx-runtime";
|
|
6
6
|
//#region src/workbench/browser/runtime/navigation.ts
|
|
7
|
-
|
|
8
|
-
return t == null ? "design" : e == "design" && t?.draft == null && t != null ? "publications" : e;
|
|
9
|
-
}
|
|
10
|
-
var le = class {
|
|
7
|
+
var ce = class {
|
|
11
8
|
#e;
|
|
12
9
|
#t;
|
|
13
10
|
#n;
|
|
@@ -19,12 +16,12 @@ var le = class {
|
|
|
19
16
|
#c;
|
|
20
17
|
constructor(e, n, r) {
|
|
21
18
|
this.#r = t("design"), this.#i = 0, this.#a = !1, this.#o = !1, this.#s = !1, this.#c = [], this.$ = { view: this.#r }, this.#l = () => {
|
|
22
|
-
this.#o && !this.#s && this.#
|
|
19
|
+
this.#o && !this.#s && this.#u(this.#r.value, !0);
|
|
23
20
|
}, this.#t = n, this.#e = r, this.#n = e, this.#r.set(n.view);
|
|
24
21
|
}
|
|
25
22
|
async start() {
|
|
26
23
|
let e = this.#t, t = ++this.#i;
|
|
27
|
-
this.#s = !0, this.#c.push(this.#n.workspace.$.
|
|
24
|
+
this.#s = !0, this.#c.push(this.#n.workspace.$.flowId.reaction(this.#l)), await this.#n.start(e.flowId), !(this.#a || t != this.#i) && (this.#u(e.view, !0), this.#s = !1, this.#o = !0);
|
|
28
25
|
}
|
|
29
26
|
dispose() {
|
|
30
27
|
this.#a = !0;
|
|
@@ -32,105 +29,65 @@ var le = class {
|
|
|
32
29
|
this.#r.dispose();
|
|
33
30
|
}
|
|
34
31
|
open(e) {
|
|
35
|
-
this.#i += 1, this.#s = !1, this.#
|
|
32
|
+
this.#i += 1, this.#s = !1, this.#u(e, !1);
|
|
36
33
|
}
|
|
37
|
-
async
|
|
34
|
+
async createFlow(e) {
|
|
38
35
|
let t = ++this.#i;
|
|
39
36
|
this.#s = !0;
|
|
40
37
|
try {
|
|
41
|
-
let n = await this.#n.
|
|
42
|
-
return n && t == this.#i && this.#
|
|
38
|
+
let n = await this.#n.createFlow(e);
|
|
39
|
+
return n && t == this.#i && this.#u("design", !1), n;
|
|
43
40
|
} finally {
|
|
44
41
|
t == this.#i && (this.#s = !1);
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
async
|
|
44
|
+
async createSubflow(e) {
|
|
48
45
|
let t = ++this.#i;
|
|
49
46
|
this.#s = !0;
|
|
50
47
|
try {
|
|
51
|
-
let n = await this.#n.workspace.createResource(
|
|
52
|
-
return n && t == this.#i && this.#
|
|
48
|
+
let n = await this.#n.workspace.createResource(e);
|
|
49
|
+
return n && t == this.#i && this.#u("design", !1), n;
|
|
53
50
|
} finally {
|
|
54
51
|
t == this.#i && (this.#s = !1);
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
|
-
selectFlow(e) {
|
|
58
|
-
if (this.#i += 1, this.#s = !0, !this.#n.workspace.selectTarget({
|
|
59
|
-
id: e.flowId,
|
|
60
|
-
kind: "flow"
|
|
61
|
-
})) {
|
|
62
|
-
this.#s = !1;
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
this.#n.runRequests.dismissInputs(), this.#d(e.draft == null ? "publications" : "design", !1), this.#s = !1;
|
|
66
|
-
}
|
|
67
|
-
async selectProject(e) {
|
|
54
|
+
async selectFlow(e) {
|
|
68
55
|
let t = ++this.#i;
|
|
69
|
-
this.#s = !0;
|
|
70
|
-
let n = this.#n.selectProject(e);
|
|
71
|
-
this.#d("design", !1);
|
|
72
|
-
try {
|
|
73
|
-
await n;
|
|
74
|
-
} finally {
|
|
75
|
-
t == this.#i && (this.#s = !1);
|
|
76
|
-
}
|
|
56
|
+
this.#s = !0, this.#n.runRequests.dismissInputs(), await this.#n.selectFlow(e.flowId), t == this.#i && (this.#u("design", !1), this.#s = !1);
|
|
77
57
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.#s = !1;
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
this.#n.runRequests.dismissInputs(), this.#d("design", !1), this.#s = !1;
|
|
58
|
+
openMainFlow() {
|
|
59
|
+
this.#n.workspace.selectTarget({ kind: "flow" }) && this.#u("design", !1);
|
|
84
60
|
}
|
|
85
|
-
async
|
|
61
|
+
async openFlows() {
|
|
86
62
|
let e = ++this.#i;
|
|
87
|
-
this.#s = !0;
|
|
88
|
-
let t = this.#n.start();
|
|
89
|
-
this.#d("design", !1);
|
|
90
|
-
try {
|
|
91
|
-
await t;
|
|
92
|
-
} finally {
|
|
93
|
-
e == this.#i && (this.#s = !1);
|
|
94
|
-
}
|
|
63
|
+
this.#s = !0, await this.#n.selectFlow(void 0), e == this.#i && (this.#u("design", !1), this.#s = !1);
|
|
95
64
|
}
|
|
96
65
|
async apply(e) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
#l;
|
|
100
|
-
async #u(e) {
|
|
66
|
+
if (w(e, this.#t)) return;
|
|
67
|
+
this.#t = e;
|
|
101
68
|
let t = ++this.#i;
|
|
102
69
|
this.#s = !0;
|
|
103
70
|
try {
|
|
104
|
-
|
|
105
|
-
else if (e.projectId != this.#n.workspace.$.projectId.value) await this.#n.selectProject(e.projectId, e.flowId);
|
|
106
|
-
else if (e.flowId == null) this.#n.workspace.selectTarget(void 0);
|
|
107
|
-
else if (e.flowId != null && e.flowId != this.#n.workspace.$.targetFlow.value?.flowId) {
|
|
108
|
-
let t = this.#n.workspace.$.flows.value.find((t) => t.flowId == e.flowId);
|
|
109
|
-
this.#n.workspace.selectTarget(t == null ? void 0 : {
|
|
110
|
-
id: t.flowId,
|
|
111
|
-
kind: "flow"
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
t == this.#i && this.#d(e.view, !0);
|
|
71
|
+
e.flowId != this.#n.workspace.$.flowId.value && await this.#n.selectFlow(e.flowId), t == this.#i && this.#u(e.view, !0);
|
|
115
72
|
} finally {
|
|
116
73
|
t == this.#i && (this.#s = !1, this.#o = !0);
|
|
117
74
|
}
|
|
118
75
|
}
|
|
119
|
-
#
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
view:
|
|
76
|
+
#l;
|
|
77
|
+
#u(e, t) {
|
|
78
|
+
let n = {
|
|
79
|
+
flowId: this.#n.workspace.$.flowId.value,
|
|
80
|
+
view: e
|
|
124
81
|
};
|
|
125
|
-
|
|
82
|
+
w(n, this.#t) || (this.#t = n, this.#e(n, { replace: t })), this.#r.set(e);
|
|
126
83
|
}
|
|
127
84
|
};
|
|
128
|
-
function
|
|
129
|
-
return e.
|
|
85
|
+
function w(e, t) {
|
|
86
|
+
return e.flowId == t.flowId && e.view == t.view;
|
|
130
87
|
}
|
|
131
88
|
//#endregion
|
|
132
89
|
//#region src/workbench/browser/runtime/publications/publicationStore.ts
|
|
133
|
-
var
|
|
90
|
+
var T = {
|
|
134
91
|
activities: [],
|
|
135
92
|
activitiesLoadFailed: !1,
|
|
136
93
|
activitiesLoading: !1,
|
|
@@ -143,23 +100,23 @@ var E = {
|
|
|
143
100
|
loadingMore: !1,
|
|
144
101
|
publications: [],
|
|
145
102
|
publishing: !1
|
|
146
|
-
},
|
|
147
|
-
function
|
|
148
|
-
return e?.
|
|
103
|
+
}, le = 20, ue = 50;
|
|
104
|
+
function E(e, t) {
|
|
105
|
+
return e?.flowId == t.flowId;
|
|
149
106
|
}
|
|
150
|
-
var
|
|
107
|
+
var de = class {
|
|
151
108
|
#e;
|
|
152
109
|
#t;
|
|
153
110
|
#n;
|
|
154
|
-
#r = new
|
|
155
|
-
#i = new
|
|
156
|
-
#a = new
|
|
157
|
-
#o = new
|
|
111
|
+
#r = new x();
|
|
112
|
+
#i = new x();
|
|
113
|
+
#a = new x();
|
|
114
|
+
#o = new x();
|
|
158
115
|
#s;
|
|
159
|
-
#c = t(
|
|
116
|
+
#c = t(T);
|
|
160
117
|
#l;
|
|
161
118
|
#u;
|
|
162
|
-
constructor(t, n, r, i = () => crypto.randomUUID(), a =
|
|
119
|
+
constructor(t, n, r, i = () => crypto.randomUUID(), a = l()) {
|
|
163
120
|
this.#e = t, this.#t = i, this.#n = a, this.#s = r, this.#l = n, this.$ = {
|
|
164
121
|
activities: e(this.#c, (e) => e.activities),
|
|
165
122
|
activitiesLoadFailed: e(this.#c, (e) => e.activitiesLoadFailed),
|
|
@@ -191,35 +148,32 @@ var fe = class {
|
|
|
191
148
|
this.#c.dispose();
|
|
192
149
|
}
|
|
193
150
|
reset() {
|
|
194
|
-
this.#r.invalidate(), this.#i.invalidate(), this.#a.invalidate(), this.#o.invalidate(), this.#u = void 0, this.#c.set(
|
|
151
|
+
this.#r.invalidate(), this.#i.invalidate(), this.#a.invalidate(), this.#o.invalidate(), this.#u = void 0, this.#c.set(T);
|
|
195
152
|
}
|
|
196
|
-
async load(e
|
|
197
|
-
let n =
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}, r = this.#r.begin();
|
|
201
|
-
D(this.#c.value.target, n) || (this.#u = void 0), this.#s(void 0), this.#c.set({
|
|
202
|
-
...E,
|
|
153
|
+
async load(e) {
|
|
154
|
+
let t = { flowId: e }, n = this.#r.begin();
|
|
155
|
+
E(this.#c.value.target, t) || (this.#u = void 0), this.#s(void 0), this.#c.set({
|
|
156
|
+
...T,
|
|
203
157
|
loading: !0,
|
|
204
|
-
target:
|
|
158
|
+
target: t
|
|
205
159
|
});
|
|
206
160
|
try {
|
|
207
|
-
let [e,
|
|
208
|
-
if (!
|
|
161
|
+
let [e, r, i] = await this.#p(t);
|
|
162
|
+
if (!n()) return;
|
|
209
163
|
this.#h({
|
|
210
164
|
bindings: i,
|
|
211
165
|
live: e,
|
|
212
166
|
loading: !1,
|
|
213
|
-
nextCursor:
|
|
214
|
-
publications:
|
|
215
|
-
total:
|
|
167
|
+
nextCursor: r.nextCursor,
|
|
168
|
+
publications: r.publications,
|
|
169
|
+
total: r.total
|
|
216
170
|
});
|
|
217
171
|
} catch (e) {
|
|
218
|
-
if (!
|
|
172
|
+
if (!n()) return;
|
|
219
173
|
this.#h({
|
|
220
174
|
loadFailed: !0,
|
|
221
175
|
loading: !1
|
|
222
|
-
}), this.#s(
|
|
176
|
+
}), this.#s(u(e, this.#n.t));
|
|
223
177
|
}
|
|
224
178
|
}
|
|
225
179
|
async loadMore() {
|
|
@@ -231,9 +185,9 @@ var fe = class {
|
|
|
231
185
|
loadingMore: !0
|
|
232
186
|
});
|
|
233
187
|
try {
|
|
234
|
-
let e = await this.#e.listPublications(n.
|
|
188
|
+
let e = await this.#e.listPublications(n.flowId, {
|
|
235
189
|
cursor: t,
|
|
236
|
-
limit:
|
|
190
|
+
limit: ue
|
|
237
191
|
});
|
|
238
192
|
if (!r()) return;
|
|
239
193
|
let i = new Set(this.#c.value.publications.map((e) => e.publicationId));
|
|
@@ -248,58 +202,53 @@ var fe = class {
|
|
|
248
202
|
this.#h({
|
|
249
203
|
loadMoreFailed: !0,
|
|
250
204
|
loadingMore: !1
|
|
251
|
-
}), this.#s(
|
|
205
|
+
}), this.#s(u(e, this.#n.t));
|
|
252
206
|
}
|
|
253
207
|
}
|
|
254
208
|
async publish() {
|
|
255
|
-
let e = this.#l.$.
|
|
256
|
-
if (e == null || t
|
|
257
|
-
let n = {
|
|
258
|
-
flowId: t.flowId,
|
|
259
|
-
projectId: e
|
|
260
|
-
}, r = t.live?.publication.publicationId ?? null, i = JSON.stringify({
|
|
209
|
+
let e = this.#l.$.targetFlow.value, t = this.#l.$.draft.value;
|
|
210
|
+
if (e == null || t == null || this.#c.value.changingTriggerId != null || this.#c.value.publishing || this.#c.value.rollingBackPublicationId != null) return !1;
|
|
211
|
+
let n = { flowId: e.flowId }, r = this.#l.$.live.value?.publication?.publicationId ?? null, i = JSON.stringify({
|
|
261
212
|
expectedLivePublicationId: r,
|
|
262
|
-
flowId:
|
|
213
|
+
flowId: e.flowId,
|
|
263
214
|
kind: "publish",
|
|
264
|
-
|
|
265
|
-
revisionId: t.draft.revisionId
|
|
215
|
+
revisionId: t.revisionId
|
|
266
216
|
}), a = this.#u?.signature == i ? this.#u : {
|
|
267
217
|
key: this.#t(),
|
|
268
218
|
signature: i
|
|
269
|
-
},
|
|
219
|
+
}, o = this.#i.begin();
|
|
270
220
|
this.#u = a, this.#s(void 0), this.#m(n, { publishing: !0 });
|
|
271
221
|
try {
|
|
272
|
-
return await this.#e.publishFlow(e, t.
|
|
222
|
+
return await this.#e.publishFlow(e.flowId, t.revisionId, r, { idempotencyKey: a.key }), !o() || (await this.#d(n), !o()) ? !1 : (this.#u = void 0, this.#s({
|
|
273
223
|
kind: "success",
|
|
274
|
-
message: this.#n.t("notice.published", { name:
|
|
224
|
+
message: this.#n.t("notice.published", { name: e.name })
|
|
275
225
|
}), !0);
|
|
276
226
|
} catch (e) {
|
|
277
|
-
return
|
|
227
|
+
return o() ? (e instanceof s && e.code == "live.conflict" && await this.#f(n), this.#s(u(e, this.#n.t)), !1) : !1;
|
|
278
228
|
} finally {
|
|
279
|
-
|
|
229
|
+
o() && this.#h({ publishing: !1 });
|
|
280
230
|
}
|
|
281
231
|
}
|
|
282
232
|
async rollback(e) {
|
|
283
233
|
let { live: t, rollingBackPublicationId: n, target: r } = this.#c.value, i = t?.publication?.publicationId;
|
|
284
|
-
if (r == null || i == null || this.#c.value.changingTriggerId != null || n != null || this.#c.value.publishing || e.
|
|
234
|
+
if (r == null || i == null || this.#c.value.changingTriggerId != null || n != null || this.#c.value.publishing || e.flowId != r.flowId) return !1;
|
|
285
235
|
let a = JSON.stringify({
|
|
286
236
|
currentPublicationId: i,
|
|
287
237
|
flowId: r.flowId,
|
|
288
238
|
kind: "rollback",
|
|
289
|
-
projectId: r.projectId,
|
|
290
239
|
targetPublicationId: e.publicationId
|
|
291
|
-
}),
|
|
240
|
+
}), o = this.#u?.signature == a ? this.#u : {
|
|
292
241
|
key: this.#t(),
|
|
293
242
|
signature: a
|
|
294
243
|
}, c = this.#i.begin();
|
|
295
|
-
this.#u =
|
|
244
|
+
this.#u = o, this.#s(void 0), this.#h({ rollingBackPublicationId: e.publicationId });
|
|
296
245
|
try {
|
|
297
|
-
return await this.#e.rollbackFlow(r.
|
|
246
|
+
return await this.#e.rollbackFlow(r.flowId, e.publicationId, i, { idempotencyKey: o.key }), !c() || (await this.#d(r), !c()) ? !1 : (this.#u = void 0, this.#s({
|
|
298
247
|
kind: "success",
|
|
299
248
|
message: this.#n.t("notice.rolledBack", { revision: e.revisionId })
|
|
300
249
|
}), !0);
|
|
301
250
|
} catch (e) {
|
|
302
|
-
return c() ? (e instanceof
|
|
251
|
+
return c() ? (e instanceof s && e.code == "live.conflict" && await this.#f(r), this.#s(u(e, this.#n.t)), !1) : !1;
|
|
303
252
|
} finally {
|
|
304
253
|
c() && this.#h({ rollingBackPublicationId: void 0 });
|
|
305
254
|
}
|
|
@@ -334,13 +283,13 @@ var fe = class {
|
|
|
334
283
|
testingTriggerId: void 0,
|
|
335
284
|
testResult: void 0
|
|
336
285
|
});
|
|
337
|
-
let [r, i] = await Promise.allSettled([this.#e.getFlowTriggerBinding(t.
|
|
286
|
+
let [r, i] = await Promise.allSettled([this.#e.getFlowTriggerBinding(t.flowId, e), this.#e.listFlowTriggerActivities(t.flowId, e, { limit: le })]);
|
|
338
287
|
if (n()) {
|
|
339
288
|
if (r.status == "rejected") {
|
|
340
289
|
this.#h({
|
|
341
290
|
activitiesLoading: !1,
|
|
342
291
|
detailLoading: !1
|
|
343
|
-
}), this.#s(
|
|
292
|
+
}), this.#s(u(r.reason, this.#n.t));
|
|
344
293
|
return;
|
|
345
294
|
}
|
|
346
295
|
this.#h({
|
|
@@ -354,7 +303,7 @@ var fe = class {
|
|
|
354
303
|
}) : (this.#h({
|
|
355
304
|
activitiesLoadFailed: !0,
|
|
356
305
|
activitiesLoading: !1
|
|
357
|
-
}), this.#s(
|
|
306
|
+
}), this.#s(u(i.reason, this.#n.t)));
|
|
358
307
|
}
|
|
359
308
|
}
|
|
360
309
|
async loadMoreTriggerActivities() {
|
|
@@ -366,9 +315,9 @@ var fe = class {
|
|
|
366
315
|
activitiesLoadingMore: !0
|
|
367
316
|
});
|
|
368
317
|
try {
|
|
369
|
-
let e = await this.#e.listFlowTriggerActivities(r.
|
|
318
|
+
let e = await this.#e.listFlowTriggerActivities(r.flowId, n, {
|
|
370
319
|
cursor: t,
|
|
371
|
-
limit:
|
|
320
|
+
limit: le
|
|
372
321
|
});
|
|
373
322
|
if (!i() || this.#c.value.selectedTriggerId != n) return;
|
|
374
323
|
let a = new Set(this.#c.value.activities.map((e) => e.activityId));
|
|
@@ -383,7 +332,7 @@ var fe = class {
|
|
|
383
332
|
this.#h({
|
|
384
333
|
activitiesLoadFailed: !0,
|
|
385
334
|
activitiesLoadingMore: !1
|
|
386
|
-
}), this.#s(
|
|
335
|
+
}), this.#s(u(e, this.#n.t));
|
|
387
336
|
}
|
|
388
337
|
}
|
|
389
338
|
async testTrigger() {
|
|
@@ -395,10 +344,10 @@ var fe = class {
|
|
|
395
344
|
testResult: void 0
|
|
396
345
|
});
|
|
397
346
|
try {
|
|
398
|
-
let e = await this.#e.testFlowPollTrigger(n.
|
|
347
|
+
let e = await this.#e.testFlowPollTrigger(n.flowId, t);
|
|
399
348
|
return !i() || this.#c.value.selectedTriggerId != t ? !1 : (this.#h({ testResult: e }), !0);
|
|
400
349
|
} catch (e) {
|
|
401
|
-
return i() && this.#c.value.selectedTriggerId == t && this.#s(
|
|
350
|
+
return i() && this.#c.value.selectedTriggerId == t && this.#s(u(e, this.#n.t)), !1;
|
|
402
351
|
} finally {
|
|
403
352
|
i() && this.#c.value.selectedTriggerId == t && this.#h({ testingTriggerId: void 0 });
|
|
404
353
|
}
|
|
@@ -409,21 +358,21 @@ var fe = class {
|
|
|
409
358
|
let n = this.#i.begin();
|
|
410
359
|
this.#h({ changingTriggerId: e.triggerNodeId });
|
|
411
360
|
try {
|
|
412
|
-
if (e.operatorState == "active" ? await this.#e.pauseFlowTrigger(t.
|
|
413
|
-
let r = await this.#e.listFlowTriggerBindings(t.
|
|
361
|
+
if (e.operatorState == "active" ? await this.#e.pauseFlowTrigger(t.flowId, e.triggerNodeId) : await this.#e.resumeFlowTrigger(t.flowId, e.triggerNodeId), !n()) return !1;
|
|
362
|
+
let r = await this.#e.listFlowTriggerBindings(t.flowId);
|
|
414
363
|
return n() ? (this.#h({ bindings: r }), this.#c.value.selectedTriggerId == e.triggerNodeId && this.openTrigger(e.triggerNodeId), this.#s({
|
|
415
364
|
kind: "success",
|
|
416
365
|
message: this.#n.t(e.operatorState == "active" ? "notice.triggerPaused" : "notice.triggerResumed")
|
|
417
366
|
}), !0) : !1;
|
|
418
367
|
} catch (e) {
|
|
419
|
-
return n() && this.#s(
|
|
368
|
+
return n() && this.#s(u(e, this.#n.t)), !1;
|
|
420
369
|
} finally {
|
|
421
370
|
n() && this.#h({ changingTriggerId: void 0 });
|
|
422
371
|
}
|
|
423
372
|
}
|
|
424
373
|
async #d(e) {
|
|
425
374
|
let [t, n, r] = await this.#p(e);
|
|
426
|
-
await this.#l.refreshFlows(),
|
|
375
|
+
this.#l.updateLive(t), await this.#l.refreshFlows(), E(this.#c.value.target, e) && this.#h({
|
|
427
376
|
bindings: r,
|
|
428
377
|
live: t,
|
|
429
378
|
loadFailed: !1,
|
|
@@ -441,17 +390,17 @@ var fe = class {
|
|
|
441
390
|
}
|
|
442
391
|
async #p(e) {
|
|
443
392
|
return await Promise.all([
|
|
444
|
-
this.#e.getLive(e.
|
|
445
|
-
this.#e.listPublications(e.
|
|
393
|
+
this.#e.getLive(e.flowId),
|
|
394
|
+
this.#e.listPublications(e.flowId, {
|
|
446
395
|
includeTotal: !0,
|
|
447
|
-
limit:
|
|
396
|
+
limit: ue
|
|
448
397
|
}),
|
|
449
|
-
this.#e.listFlowTriggerBindings(e.
|
|
398
|
+
this.#e.listFlowTriggerBindings(e.flowId)
|
|
450
399
|
]);
|
|
451
400
|
}
|
|
452
401
|
#m(e, t) {
|
|
453
|
-
|
|
454
|
-
...
|
|
402
|
+
E(this.#c.value.target, e) ? this.#h(t) : this.#c.set({
|
|
403
|
+
...T,
|
|
455
404
|
...t,
|
|
456
405
|
target: e
|
|
457
406
|
});
|
|
@@ -462,25 +411,22 @@ var fe = class {
|
|
|
462
411
|
...e
|
|
463
412
|
});
|
|
464
413
|
}
|
|
465
|
-
},
|
|
414
|
+
}, fe = { starting: !1 };
|
|
466
415
|
function pe(e) {
|
|
467
416
|
switch (e.kind) {
|
|
468
417
|
case "condition": return { [e.node.input.handle]: e.node.input };
|
|
469
|
-
case "subflow": return e.definition?.inputs ??
|
|
470
|
-
case "task": return e.definition?.inputs ??
|
|
418
|
+
case "subflow": return o(e.definition?.inputs ?? []);
|
|
419
|
+
case "task": return o(e.definition?.inputs ?? []);
|
|
471
420
|
case "value": return {};
|
|
472
421
|
}
|
|
473
422
|
}
|
|
474
423
|
function me(e) {
|
|
475
424
|
return e.node.name == null ? e.kind == "task" || e.kind == "subflow" ? e.definition?.name ?? e.id : e.id : e.node.name;
|
|
476
425
|
}
|
|
477
|
-
async function he(e, t
|
|
478
|
-
let { FlowRunInputEditorStore:
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
});
|
|
482
|
-
return a == null ? [] : Object.entries(a.nodes).toSorted(([e], [t]) => e.localeCompare(t)).flatMap(([e, t]) => {
|
|
483
|
-
let a = i.resolveNode(e, t);
|
|
426
|
+
async function he(e, t) {
|
|
427
|
+
let { FlowRunInputEditorStore: n } = await import("./flowRunInputEditorStore-DXOyyY7o.js").then((e) => e.n), r = h(e), i = r.graph({ kind: "flow" });
|
|
428
|
+
return i == null ? [] : Object.entries(i.nodes).toSorted(([e], [t]) => e.localeCompare(t)).flatMap(([e, i]) => {
|
|
429
|
+
let a = r.resolveNode(e, i);
|
|
484
430
|
if (a.kind == "trigger") return [];
|
|
485
431
|
let o = Object.entries(pe(a)).filter(([e, t]) => a.node.inputs[e] == null && !Object.hasOwn(t, "value")).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, t]) => Object.assign({
|
|
486
432
|
handle: e,
|
|
@@ -488,7 +434,7 @@ async function he(e, t, n) {
|
|
|
488
434
|
nullable: t.nullable
|
|
489
435
|
}, t.description == null ? {} : { description: t.description }));
|
|
490
436
|
return o.length == 0 ? [] : [{
|
|
491
|
-
editor: new
|
|
437
|
+
editor: new n(o, t),
|
|
492
438
|
nodeId: e,
|
|
493
439
|
title: me(a)
|
|
494
440
|
}];
|
|
@@ -498,13 +444,13 @@ var ge = class {
|
|
|
498
444
|
#e;
|
|
499
445
|
#t;
|
|
500
446
|
#n;
|
|
501
|
-
#r = new
|
|
502
|
-
#i = new
|
|
447
|
+
#r = new x();
|
|
448
|
+
#i = new x();
|
|
503
449
|
#a;
|
|
504
450
|
#o;
|
|
505
|
-
#s = t(
|
|
451
|
+
#s = t(fe);
|
|
506
452
|
#c;
|
|
507
|
-
constructor(t, n, r, i =
|
|
453
|
+
constructor(t, n, r, i = l(), a = () => crypto.randomUUID()) {
|
|
508
454
|
this.#e = t, this.#a = n, this.#o = r, this.#n = i, this.#t = a, this.$ = {
|
|
509
455
|
inputRequest: e(this.#s, (e) => e.inputRequest),
|
|
510
456
|
starting: e(this.#s, (e) => e.starting),
|
|
@@ -519,25 +465,24 @@ var ge = class {
|
|
|
519
465
|
reset() {
|
|
520
466
|
this.#r.invalidate(), this.#i.invalidate(), this.#c = void 0;
|
|
521
467
|
let e = this.#s.value.inputRequest;
|
|
522
|
-
this.#s.set(
|
|
468
|
+
this.#s.set(fe), this.#d(e);
|
|
523
469
|
}
|
|
524
|
-
async requestDraft(e, t
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
return await this.#l("draft", e, t, n, t.draft.revisionId, r);
|
|
470
|
+
async requestDraft(e, t) {
|
|
471
|
+
let n = this.#i.begin();
|
|
472
|
+
return await this.#l("draft", e, t, t.revisionId, n);
|
|
528
473
|
}
|
|
529
|
-
async requestLive(e
|
|
530
|
-
let
|
|
531
|
-
if (n == null) return "unavailable";
|
|
532
|
-
let r = this.#i.begin();
|
|
474
|
+
async requestLive(e) {
|
|
475
|
+
let t = this.#i.begin();
|
|
533
476
|
this.#o(void 0), this.#f({ starting: !0 });
|
|
534
477
|
try {
|
|
535
|
-
let
|
|
536
|
-
|
|
478
|
+
let n = (await this.#e.getLive(e.flowId)).publication;
|
|
479
|
+
if (n == null) return "unavailable";
|
|
480
|
+
let r = await this.#e.getRevision(e.flowId, n.revisionId);
|
|
481
|
+
return t() ? await this.#l("live", e, r, n.revisionId, t, n.publicationId) : "unavailable";
|
|
537
482
|
} catch (e) {
|
|
538
|
-
return
|
|
483
|
+
return t() && this.#o(u(e, this.#n.t)), "unavailable";
|
|
539
484
|
} finally {
|
|
540
|
-
|
|
485
|
+
t() && this.#f({ starting: !1 });
|
|
541
486
|
}
|
|
542
487
|
}
|
|
543
488
|
dismissInputs() {
|
|
@@ -551,7 +496,7 @@ var ge = class {
|
|
|
551
496
|
...e,
|
|
552
497
|
attempted: !0
|
|
553
498
|
} }), !1;
|
|
554
|
-
let t = Object.fromEntries(e.groups.map((e) => [e.nodeId, e.editor.values()])), n = await this.#u(e.source, e.
|
|
499
|
+
let t = Object.fromEntries(e.groups.map((e) => [e.nodeId, e.editor.values()])), n = await this.#u(e.source, e.flow, e.revisionId, t, e.publicationId);
|
|
555
500
|
return n && this.#s.value.inputRequest === e && this.dismissInputs(), n;
|
|
556
501
|
}
|
|
557
502
|
async #l(e, t, r, i, a, o) {
|
|
@@ -563,26 +508,26 @@ var ge = class {
|
|
|
563
508
|
}), this.#d(s);
|
|
564
509
|
let c;
|
|
565
510
|
try {
|
|
566
|
-
c = await he(
|
|
511
|
+
c = await he(r, this.#n.lang$);
|
|
567
512
|
} catch (e) {
|
|
568
|
-
throw
|
|
513
|
+
throw a() && this.#f({
|
|
569
514
|
starting: !1,
|
|
570
515
|
submitting: void 0
|
|
571
516
|
}), e;
|
|
572
517
|
}
|
|
573
|
-
if (!
|
|
518
|
+
if (!a()) {
|
|
574
519
|
for (let e of c) e.editor.dispose();
|
|
575
520
|
return "unavailable";
|
|
576
521
|
}
|
|
577
|
-
if (c.length == 0) return await this.#u(e, t,
|
|
522
|
+
if (c.length == 0) return await this.#u(e, t, i, {}, o) ? "started" : "unavailable";
|
|
578
523
|
let l = n((e) => c.every((t) => e(t.editor.valid$)));
|
|
579
524
|
return this.#f({
|
|
580
525
|
inputRequest: {
|
|
581
526
|
attempted: !1,
|
|
582
|
-
flow:
|
|
527
|
+
flow: t,
|
|
583
528
|
groups: c,
|
|
584
|
-
|
|
585
|
-
revisionId:
|
|
529
|
+
...o == null ? {} : { publicationId: o },
|
|
530
|
+
revisionId: i,
|
|
586
531
|
source: e,
|
|
587
532
|
valid: l
|
|
588
533
|
},
|
|
@@ -590,37 +535,36 @@ var ge = class {
|
|
|
590
535
|
submitting: void 0
|
|
591
536
|
}), "input";
|
|
592
537
|
}
|
|
593
|
-
async #u(e, t, n, r
|
|
594
|
-
if (e == "
|
|
595
|
-
let a = this.#r.capture(),
|
|
538
|
+
async #u(e, t, n, r = {}, i) {
|
|
539
|
+
if (e == "live" && i == null) return !1;
|
|
540
|
+
let a = this.#r.capture(), o = this.#a.prepareStart();
|
|
596
541
|
this.#o(void 0), this.#f({
|
|
597
542
|
starting: !0,
|
|
598
543
|
submitting: e
|
|
599
544
|
});
|
|
600
|
-
let
|
|
601
|
-
flowId:
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
inputs: i,
|
|
545
|
+
let s = e == "draft" ? {
|
|
546
|
+
flowId: t.flowId,
|
|
547
|
+
revisionId: n
|
|
548
|
+
} : { publicationId: i }, c = JSON.stringify({
|
|
549
|
+
inputs: r,
|
|
606
550
|
source: e,
|
|
607
|
-
...
|
|
608
|
-
}),
|
|
551
|
+
...s
|
|
552
|
+
}), l = this.#c?.signature == c ? this.#c : {
|
|
609
553
|
key: this.#t(),
|
|
610
|
-
signature:
|
|
554
|
+
signature: c
|
|
611
555
|
};
|
|
612
|
-
this.#c =
|
|
556
|
+
this.#c = l;
|
|
613
557
|
try {
|
|
614
|
-
let
|
|
615
|
-
idempotencyKey:
|
|
616
|
-
inputs:
|
|
617
|
-
}) : await this.#e.createLiveRun(
|
|
618
|
-
idempotencyKey:
|
|
619
|
-
inputs:
|
|
558
|
+
let s = e == "draft" ? await this.#e.createDraftRun(t.flowId, n, {
|
|
559
|
+
idempotencyKey: l.key,
|
|
560
|
+
inputs: r
|
|
561
|
+
}) : await this.#e.createLiveRun(i, {
|
|
562
|
+
idempotencyKey: l.key,
|
|
563
|
+
inputs: r
|
|
620
564
|
});
|
|
621
|
-
return !a() || !
|
|
565
|
+
return !a() || !o() ? !1 : (this.#c = void 0, this.#a.follow(s, o));
|
|
622
566
|
} catch (e) {
|
|
623
|
-
return a() &&
|
|
567
|
+
return a() && o() && this.#o(u(e, this.#n.t)), !1;
|
|
624
568
|
} finally {
|
|
625
569
|
a() && this.#f({
|
|
626
570
|
starting: !1,
|
|
@@ -640,18 +584,18 @@ var ge = class {
|
|
|
640
584
|
...e
|
|
641
585
|
});
|
|
642
586
|
}
|
|
643
|
-
},
|
|
587
|
+
}, D = {
|
|
644
588
|
actions: {},
|
|
645
589
|
catalogs: {}
|
|
646
590
|
};
|
|
647
|
-
function
|
|
591
|
+
function O(e) {
|
|
648
592
|
return Object.entries(e).map(([e, t]) => ({
|
|
649
593
|
description: t.description,
|
|
650
594
|
handle: e,
|
|
651
595
|
jsonSchema: t.jsonSchema
|
|
652
596
|
}));
|
|
653
597
|
}
|
|
654
|
-
function
|
|
598
|
+
function k(e, t) {
|
|
655
599
|
return {
|
|
656
600
|
connector: e,
|
|
657
601
|
description: e.defaultConnection == null ? t("addNode.connectorNeedsConnection", {
|
|
@@ -661,10 +605,10 @@ function j(e, t) {
|
|
|
661
605
|
group: t("addNode.connectorActions"),
|
|
662
606
|
icon: e.icon ?? ":carbon:connection-signal:",
|
|
663
607
|
id: `connector:${e.actionId}`,
|
|
664
|
-
inputs:
|
|
608
|
+
inputs: O(e.inputs),
|
|
665
609
|
kind: "connector",
|
|
666
610
|
label: e.name,
|
|
667
|
-
outputs:
|
|
611
|
+
outputs: O(e.outputs)
|
|
668
612
|
};
|
|
669
613
|
}
|
|
670
614
|
function _e(e, t) {
|
|
@@ -675,7 +619,7 @@ function _e(e, t) {
|
|
|
675
619
|
}
|
|
676
620
|
return [...n.values()].toSorted((e, t) => e[0].serviceName.localeCompare(t[0].serviceName)).map((e) => {
|
|
677
621
|
let n = e[0], r = e.map((e) => {
|
|
678
|
-
let n =
|
|
622
|
+
let n = k(e, t);
|
|
679
623
|
return {
|
|
680
624
|
description: n.description,
|
|
681
625
|
label: n.label,
|
|
@@ -710,7 +654,7 @@ function ve(e, t) {
|
|
|
710
654
|
serviceId: e.serviceId
|
|
711
655
|
};
|
|
712
656
|
}
|
|
713
|
-
function
|
|
657
|
+
function A(e) {
|
|
714
658
|
if (e?.kind != "task" || e.node.task != null) return;
|
|
715
659
|
let t = e.definition;
|
|
716
660
|
if (!(t == null || !("executor" in t) || t.executor.kind != "connector")) return {
|
|
@@ -720,7 +664,7 @@ function ye(e) {
|
|
|
720
664
|
taskId: e.node.taskId
|
|
721
665
|
};
|
|
722
666
|
}
|
|
723
|
-
var
|
|
667
|
+
var ye = class {
|
|
724
668
|
#e;
|
|
725
669
|
#t;
|
|
726
670
|
#n;
|
|
@@ -735,33 +679,33 @@ var be = class {
|
|
|
735
679
|
#d;
|
|
736
680
|
#f;
|
|
737
681
|
#p;
|
|
738
|
-
constructor(r, i, a, o, s =
|
|
739
|
-
this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new
|
|
682
|
+
constructor(r, i, a, o, s = l()) {
|
|
683
|
+
this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new x(), this.#l = t(D), this.#p = !1, this.browseAddNodeOptions = async (e) => {
|
|
740
684
|
if (this.#p) return;
|
|
741
|
-
let t = this.#u.$.
|
|
685
|
+
let t = this.#u.$.flowId.value;
|
|
742
686
|
if (t == null) return;
|
|
743
|
-
let n = this.#f ?? await this.#e.listConnectorProviders(
|
|
744
|
-
if (!(e.aborted || this.#p || t != this.#u.$.
|
|
687
|
+
let n = this.#f ?? await this.#e.listConnectorProviders(e);
|
|
688
|
+
if (!(e.aborted || this.#p || t != this.#u.$.flowId.value)) return this.#f = n, n.toSorted((e, t) => e.serviceName.localeCompare(t.serviceName)).map((e) => ve(e, this.#t.t));
|
|
745
689
|
}, this.provideAddNodeOptionChoices = async (e, t) => {
|
|
746
690
|
if (this.#p) return;
|
|
747
|
-
let n = this.#u.$.
|
|
691
|
+
let n = this.#u.$.flowId.value, r = this.#f?.find((t) => `connector-provider:${t.serviceId}` == e);
|
|
748
692
|
if (n == null || r == null) return;
|
|
749
|
-
let i = this.#r.get(r.serviceId) ?? await this.#e.listConnectorActions(
|
|
750
|
-
if (t.aborted || this.#p || n != this.#u.$.
|
|
693
|
+
let i = this.#r.get(r.serviceId) ?? await this.#e.listConnectorActions(r.serviceId, t);
|
|
694
|
+
if (t.aborted || this.#p || n != this.#u.$.flowId.value) return;
|
|
751
695
|
let a = i.map((e) => Object.assign({}, e, e.icon == null && r.icon != null ? { icon: r.icon } : {}, { serviceName: r.serviceName }));
|
|
752
696
|
return this.#r.set(r.serviceId, a), this.#v({ actions: {
|
|
753
697
|
...this.#l.value.actions,
|
|
754
698
|
...Object.fromEntries(a.map((e) => [e.actionId, e]))
|
|
755
|
-
} }), a.map((e) =>
|
|
699
|
+
} }), a.map((e) => k(e, this.#t.t));
|
|
756
700
|
}, this.provideAddNodeOptions = async (e, t) => {
|
|
757
701
|
if (this.#p) return;
|
|
758
|
-
let n = this.#u.$.
|
|
702
|
+
let n = this.#u.$.flowId.value;
|
|
759
703
|
if (n == null) return;
|
|
760
|
-
let r = e.trim(), i = r.length == 0 ? Object.values(this.#l.value.actions) : await this.#e.searchConnectorActions(
|
|
761
|
-
if (t.aborted || this.#p || n != this.#u.$.
|
|
704
|
+
let r = e.trim(), i = r.length == 0 ? Object.values(this.#l.value.actions) : await this.#e.searchConnectorActions(r, t);
|
|
705
|
+
if (t.aborted || this.#p || n != this.#u.$.flowId.value) return;
|
|
762
706
|
let a = { ...this.#l.value.actions };
|
|
763
707
|
for (let e of i) a[e.actionId] = e;
|
|
764
|
-
if (this.#v({ actions: a }), r.length != 0) return i.map((e) =>
|
|
708
|
+
if (this.#v({ actions: a }), r.length != 0) return i.map((e) => k(e, this.#t.t));
|
|
765
709
|
let o = new Map(i.map((e) => [e.actionId, e]));
|
|
766
710
|
for (let e of this.#u.$.revision.value?.connectorActionIds ?? []) {
|
|
767
711
|
let t = a[e];
|
|
@@ -769,9 +713,9 @@ var be = class {
|
|
|
769
713
|
}
|
|
770
714
|
return _e([...o.values()], this.#t.t);
|
|
771
715
|
}, this.#e = r, this.#n = o, this.#u = i, this.#c = a, this.#t = s;
|
|
772
|
-
let c = e(this.#l, (e) => e.actions),
|
|
716
|
+
let c = e(this.#l, (e) => e.actions), u = e(this.#l, (e) => e.catalogs);
|
|
773
717
|
this.#s = n((e) => {
|
|
774
|
-
let t =
|
|
718
|
+
let t = A(e(i.$.selection)), n = e(this.#l);
|
|
775
719
|
if (t == null) return { authorizationPending: !1 };
|
|
776
720
|
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);
|
|
777
721
|
return o == null && r?.defaultConnection?.connectionId == t.connectionId && (o = r.defaultConnection), {
|
|
@@ -785,7 +729,7 @@ var be = class {
|
|
|
785
729
|
}), this.$ = {
|
|
786
730
|
actionLoading: e(this.#l, (e) => e.actionLoading),
|
|
787
731
|
actions: c,
|
|
788
|
-
catalogs:
|
|
732
|
+
catalogs: u,
|
|
789
733
|
connectionLoading: e(this.#l, (e) => e.connectionLoading),
|
|
790
734
|
selectedAction: e(this.#s, (e) => e.action),
|
|
791
735
|
selectedActionError: e(this.#s, (e) => e.actionError),
|
|
@@ -801,11 +745,11 @@ var be = class {
|
|
|
801
745
|
this.#s.dispose(), this.#l.dispose();
|
|
802
746
|
}
|
|
803
747
|
reset() {
|
|
804
|
-
this.#p || (this.#a.invalidate(), this.#d = void 0, this.#r.clear(), this.#f = void 0, this.#i.clear(), this.#l.set(
|
|
748
|
+
this.#p || (this.#a.invalidate(), this.#d = void 0, this.#r.clear(), this.#f = void 0, this.#i.clear(), this.#l.set(D));
|
|
805
749
|
}
|
|
806
750
|
async refresh(e = !1) {
|
|
807
751
|
if (this.#p) return;
|
|
808
|
-
let t = this.#a.begin(), n = this.#u.$.
|
|
752
|
+
let t = this.#a.begin(), n = this.#u.$.flowId.value, r = A(this.#u.$.selection.value);
|
|
809
753
|
if (n == null || r == null) {
|
|
810
754
|
(this.#l.value.actionLoading != null || this.#l.value.connectionLoading != null) && this.#v({
|
|
811
755
|
actionLoading: void 0,
|
|
@@ -820,7 +764,7 @@ var be = class {
|
|
|
820
764
|
connectionLoading: void 0
|
|
821
765
|
});
|
|
822
766
|
try {
|
|
823
|
-
let i = await this.#m(
|
|
767
|
+
let i = await this.#m(r.actionId, e);
|
|
824
768
|
if (!this.#y(t, n)) return;
|
|
825
769
|
this.#v({ actions: {
|
|
826
770
|
...this.#l.value.actions,
|
|
@@ -829,7 +773,7 @@ var be = class {
|
|
|
829
773
|
} catch (e) {
|
|
830
774
|
this.#y(t, n) && this.#v({ actionError: {
|
|
831
775
|
actionId: r.actionId,
|
|
832
|
-
message:
|
|
776
|
+
message: u(e, this.#t.t).message
|
|
833
777
|
} });
|
|
834
778
|
} finally {
|
|
835
779
|
this.#y(t, n) && this.#l.value.actionLoading == r.actionId && this.#v({ actionLoading: void 0 });
|
|
@@ -837,24 +781,24 @@ var be = class {
|
|
|
837
781
|
}
|
|
838
782
|
async connect(e) {
|
|
839
783
|
if (this.#p) return;
|
|
840
|
-
let t = this.#u.$.
|
|
784
|
+
let t = this.#u.$.flowId.value;
|
|
841
785
|
if (t == null) return;
|
|
842
786
|
let n = this.#l.value.catalogs[e];
|
|
843
787
|
try {
|
|
844
|
-
if (!await this.#n.openExternalPage(() => this.#e.createConnectorConnectionPage(
|
|
788
|
+
if (!await this.#n.openExternalPage(() => this.#e.createConnectorConnectionPage(e))) {
|
|
845
789
|
this.#c({
|
|
846
790
|
kind: "error",
|
|
847
791
|
message: this.#t.t("notice.connectionPopupBlocked")
|
|
848
792
|
});
|
|
849
793
|
return;
|
|
850
794
|
}
|
|
851
|
-
if (this.#p || t != this.#u.$.
|
|
795
|
+
if (this.#p || t != this.#u.$.flowId.value) return;
|
|
852
796
|
this.#d = {
|
|
853
797
|
connectionIds: new Set(n?.all.map((e) => e.connectionId)),
|
|
854
798
|
serviceId: e
|
|
855
799
|
}, this.#v({ authorizationServiceId: e });
|
|
856
800
|
} catch (e) {
|
|
857
|
-
this.#p || this.#c(
|
|
801
|
+
this.#p || this.#c(u(e, this.#t.t));
|
|
858
802
|
}
|
|
859
803
|
}
|
|
860
804
|
async setConnection(e, t) {
|
|
@@ -865,9 +809,9 @@ var be = class {
|
|
|
865
809
|
let e = this.#d.serviceId;
|
|
866
810
|
this.#r.delete(e), this.#v({ authorizationServiceId: void 0 }), this.$.selectedAction.value?.serviceId == e && await this.refresh(!0), !this.#p && this.#d?.serviceId == e && (this.#d = void 0);
|
|
867
811
|
}
|
|
868
|
-
async #m(e, t
|
|
869
|
-
let
|
|
870
|
-
return !
|
|
812
|
+
async #m(e, t) {
|
|
813
|
+
let n = this.#l.value.actions[e];
|
|
814
|
+
return !t && n != null ? n : await this.#e.getConnectorAction(e);
|
|
871
815
|
}
|
|
872
816
|
async #h(e, t, n, r, i) {
|
|
873
817
|
this.#v({ connectionLoading: n });
|
|
@@ -884,20 +828,20 @@ var be = class {
|
|
|
884
828
|
if (!n && i != null) return i;
|
|
885
829
|
let a;
|
|
886
830
|
try {
|
|
887
|
-
a = await this.#e.listConnectorConnections(
|
|
831
|
+
a = await this.#e.listConnectorConnections(t);
|
|
888
832
|
} catch (n) {
|
|
889
833
|
this.#y(r, e) && this.#v({ connectionError: {
|
|
890
|
-
message:
|
|
834
|
+
message: u(n, this.#t.t).message,
|
|
891
835
|
serviceId: t
|
|
892
836
|
} });
|
|
893
837
|
return;
|
|
894
838
|
}
|
|
895
839
|
if (!this.#y(r, e)) return;
|
|
896
|
-
let
|
|
840
|
+
let o = d(a);
|
|
897
841
|
return this.#v({ catalogs: {
|
|
898
842
|
...this.#l.value.catalogs,
|
|
899
|
-
[t]:
|
|
900
|
-
} }),
|
|
843
|
+
[t]: o
|
|
844
|
+
} }), o;
|
|
901
845
|
}
|
|
902
846
|
async #_(e, t, n) {
|
|
903
847
|
let r = this.#d?.serviceId == t ? this.#d : void 0, i = r == null ? [] : n.active.filter((e) => !r.connectionIds.has(e.connectionId)), a = i.length == 1 ? i[0] : n.preferred, o = this.#u.$.revision.value?.task(e.taskId);
|
|
@@ -910,17 +854,17 @@ var be = class {
|
|
|
910
854
|
});
|
|
911
855
|
}
|
|
912
856
|
#y(e, t) {
|
|
913
|
-
return !this.#p && e() && t == this.#u.$.
|
|
857
|
+
return !this.#p && e() && t == this.#u.$.flowId.value;
|
|
914
858
|
}
|
|
915
859
|
async #b() {
|
|
916
860
|
if (this.#p) return;
|
|
917
|
-
let e = this.#a.capture(), t = this.#u.$.
|
|
861
|
+
let e = this.#a.capture(), t = this.#u.$.flowId.value, n = this.#u.$.revision.value;
|
|
918
862
|
if (t == null || n == null) return;
|
|
919
863
|
let r = [...n.connectorActionIds].filter((e) => this.#l.value.actions[e] == null && !this.#i.has(e));
|
|
920
864
|
if (r.length != 0) {
|
|
921
865
|
for (let e of r) this.#i.add(e);
|
|
922
866
|
try {
|
|
923
|
-
let n = await Promise.all(r.map((e) => this.#e.getConnectorAction(
|
|
867
|
+
let n = await Promise.all(r.map((e) => this.#e.getConnectorAction(e)));
|
|
924
868
|
if (!this.#y(e, t)) return;
|
|
925
869
|
let i = { ...this.#l.value.actions };
|
|
926
870
|
for (let e of n) i[e.actionId] = e;
|
|
@@ -932,8 +876,8 @@ var be = class {
|
|
|
932
876
|
}
|
|
933
877
|
}
|
|
934
878
|
}
|
|
935
|
-
},
|
|
936
|
-
function
|
|
879
|
+
}, j = { catalogs: {} }, M = 4, N = "trigger:";
|
|
880
|
+
function P(e, t) {
|
|
937
881
|
if (e?.kind != "trigger") return;
|
|
938
882
|
let n = e.trigger;
|
|
939
883
|
if (n.kind != "poll" && n.kind != "integration") return;
|
|
@@ -944,7 +888,7 @@ function F(e, t) {
|
|
|
944
888
|
triggerId: e.id
|
|
945
889
|
};
|
|
946
890
|
}
|
|
947
|
-
function
|
|
891
|
+
function F(e, t, n, r) {
|
|
948
892
|
return {
|
|
949
893
|
description: n,
|
|
950
894
|
group: r,
|
|
@@ -963,12 +907,12 @@ function I(e, t, n, r) {
|
|
|
963
907
|
}
|
|
964
908
|
};
|
|
965
909
|
}
|
|
966
|
-
function
|
|
910
|
+
function I(e, t) {
|
|
967
911
|
return {
|
|
968
912
|
choices: [],
|
|
969
913
|
description: t.t("addNode.triggerChooseConnection"),
|
|
970
914
|
group: t.t("addNode.triggers"),
|
|
971
|
-
id: `${
|
|
915
|
+
id: `${N}${e.key}`,
|
|
972
916
|
inputs: [],
|
|
973
917
|
kind: "trigger",
|
|
974
918
|
label: e.displayName,
|
|
@@ -977,10 +921,10 @@ function xe(e, t) {
|
|
|
977
921
|
}
|
|
978
922
|
function L(e, t, n) {
|
|
979
923
|
let r = n.t("addNode.triggers"), i = t.preferred;
|
|
980
|
-
return i == null ? t.active.length > 0 ? t.active.map((t) =>
|
|
924
|
+
return i == null ? t.active.length > 0 ? t.active.map((t) => F(e, t.connectionId, t.displayName, r)) : [{
|
|
981
925
|
description: n.t("addNode.triggerNeedsConnection", { provider: e.provider }),
|
|
982
926
|
group: r,
|
|
983
|
-
id: `${
|
|
927
|
+
id: `${N}${e.key}:connect`,
|
|
984
928
|
inputs: [],
|
|
985
929
|
kind: "trigger",
|
|
986
930
|
label: n.t("addNode.triggerAddConnection"),
|
|
@@ -989,12 +933,12 @@ function L(e, t, n) {
|
|
|
989
933
|
kind: "connect",
|
|
990
934
|
provider: e.provider
|
|
991
935
|
}
|
|
992
|
-
}] : [
|
|
936
|
+
}] : [F(e, i.connectionId, i.displayName, r)];
|
|
993
937
|
}
|
|
994
|
-
function
|
|
938
|
+
function be(e, t, n) {
|
|
995
939
|
let r = t.preferred;
|
|
996
|
-
if (r != null) return
|
|
997
|
-
let i =
|
|
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);
|
|
998
942
|
return {
|
|
999
943
|
...i,
|
|
1000
944
|
description: t.active.length == 0 ? n.t("addNode.triggerNeedsConnection", { provider: e.provider }) : i.description,
|
|
@@ -1009,7 +953,7 @@ function Se(e, t, n) {
|
|
|
1009
953
|
}))
|
|
1010
954
|
};
|
|
1011
955
|
}
|
|
1012
|
-
var
|
|
956
|
+
var xe = class {
|
|
1013
957
|
#e;
|
|
1014
958
|
#t;
|
|
1015
959
|
#n;
|
|
@@ -1021,19 +965,19 @@ var Ce = class {
|
|
|
1021
965
|
#c;
|
|
1022
966
|
#l;
|
|
1023
967
|
#u;
|
|
1024
|
-
constructor(r, i, a, o,
|
|
1025
|
-
this.#t = new AbortController(), this.#a = new
|
|
1026
|
-
let t = this.#l.$.
|
|
968
|
+
constructor(r, i, a, o, s = l()) {
|
|
969
|
+
this.#t = new AbortController(), this.#a = new x(), this.#c = t(j), this.#u = !1, this.browseAddNodeOptions = async (e) => {
|
|
970
|
+
let t = this.#l.$.flowId.value;
|
|
1027
971
|
if (e.aborted || this.#u || t == null || this.#l.$.target.value?.kind != "flow") return [];
|
|
1028
972
|
let n = await this.#d();
|
|
1029
|
-
if (!(e.aborted || this.#u || t != this.#l.$.
|
|
973
|
+
if (!(e.aborted || this.#u || t != this.#l.$.flowId.value)) return [...n.values()].map((e) => I(e, this.#i));
|
|
1030
974
|
}, this.provideAddNodeOptions = async (e, t) => {
|
|
1031
|
-
let n = this.#l.$.
|
|
975
|
+
let n = this.#l.$.flowId.value;
|
|
1032
976
|
if (t.aborted || this.#u || n == null || this.#l.$.target.value?.kind != "flow") return [];
|
|
1033
977
|
let r = e.trim().toLowerCase();
|
|
1034
978
|
if (r.length == 0) return [];
|
|
1035
979
|
let i = await this.#d();
|
|
1036
|
-
if (t.aborted || this.#u || n != this.#l.$.
|
|
980
|
+
if (t.aborted || this.#u || n != this.#l.$.flowId.value) return;
|
|
1037
981
|
let a = [...i.values()].filter((e) => [
|
|
1038
982
|
e.description,
|
|
1039
983
|
e.displayName,
|
|
@@ -1042,31 +986,31 @@ var Ce = class {
|
|
|
1042
986
|
e.provider,
|
|
1043
987
|
e.type
|
|
1044
988
|
].some((e) => e.toLowerCase().includes(r))), o = [...new Set(a.map((e) => e.provider))].filter((e) => this.#c.value.catalogs[e] == null);
|
|
1045
|
-
for (let e = 0; e < o.length; e +=
|
|
1046
|
-
let r = await Promise.all(o.slice(e, e +
|
|
1047
|
-
if (t.aborted || this.#u || n != this.#l.$.
|
|
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;
|
|
1048
992
|
this.#f({ catalogs: {
|
|
1049
993
|
...this.#c.value.catalogs,
|
|
1050
994
|
...Object.fromEntries(r)
|
|
1051
995
|
} });
|
|
1052
996
|
}
|
|
1053
|
-
return a.map((e) =>
|
|
997
|
+
return a.map((e) => be(e, this.#c.value.catalogs[e.provider], this.#i));
|
|
1054
998
|
}, this.provideAddNodeOptionChoices = async (e, t) => {
|
|
1055
|
-
let n = this.#l.$.
|
|
999
|
+
let n = this.#l.$.flowId.value, r = e.startsWith(N) ? e.slice(8) : void 0;
|
|
1056
1000
|
if (t.aborted || this.#u || n == null || r == null || this.#l.$.target.value?.kind != "flow") return;
|
|
1057
1001
|
let i = (await this.#d()).get(r);
|
|
1058
|
-
if (t.aborted || this.#u || n != this.#l.$.
|
|
1002
|
+
if (t.aborted || this.#u || n != this.#l.$.flowId.value || i == null) return;
|
|
1059
1003
|
let a = this.#c.value.catalogs[i.provider];
|
|
1060
1004
|
if (a == null) {
|
|
1061
|
-
if (a =
|
|
1005
|
+
if (a = d(await this.#n.listConnectorConnections(i.provider, t)), t.aborted || this.#u || n != this.#l.$.flowId.value) return;
|
|
1062
1006
|
this.#f({ catalogs: {
|
|
1063
1007
|
...this.#c.value.catalogs,
|
|
1064
1008
|
[i.provider]: a
|
|
1065
1009
|
} });
|
|
1066
1010
|
}
|
|
1067
1011
|
return L(i, a, this.#i);
|
|
1068
|
-
}, this.#n = r, this.#r = o, this.#i =
|
|
1069
|
-
let t = e(i.$.selection), n =
|
|
1012
|
+
}, 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 = P(t, i), r = e(this.#c);
|
|
1070
1014
|
if (t?.kind != "trigger") return { authorizationPending: !1 };
|
|
1071
1015
|
let a = t.trigger;
|
|
1072
1016
|
if (a.kind != "poll" && a.kind != "integration") return { authorizationPending: !1 };
|
|
@@ -1093,10 +1037,10 @@ var Ce = class {
|
|
|
1093
1037
|
this.#o.dispose(), this.#c.dispose();
|
|
1094
1038
|
}
|
|
1095
1039
|
reset() {
|
|
1096
|
-
this.#u || (this.#t.abort(), this.#t = new AbortController(), this.#e = void 0, this.#a.invalidate(), this.#c.set(
|
|
1040
|
+
this.#u || (this.#t.abort(), this.#t = new AbortController(), this.#e = void 0, this.#a.invalidate(), this.#c.set(j));
|
|
1097
1041
|
}
|
|
1098
1042
|
async refresh(e = !1) {
|
|
1099
|
-
let t = this.#a.begin(), n = this.#l.$.
|
|
1043
|
+
let t = this.#a.begin(), n = this.#l.$.flowId.value, r = P(this.#l.$.selection.value, this.#l);
|
|
1100
1044
|
if (!this.#u) {
|
|
1101
1045
|
if (n == null || r == null) {
|
|
1102
1046
|
this.#c.value.connectionLoading != null && this.#f({ connectionLoading: void 0 });
|
|
@@ -1108,7 +1052,7 @@ var Ce = class {
|
|
|
1108
1052
|
connectionLoading: r.provider
|
|
1109
1053
|
});
|
|
1110
1054
|
try {
|
|
1111
|
-
let e =
|
|
1055
|
+
let e = d(await this.#n.listConnectorConnections(r.provider));
|
|
1112
1056
|
if (!this.#p(t, n)) return;
|
|
1113
1057
|
this.#f({ catalogs: {
|
|
1114
1058
|
...this.#c.value.catalogs,
|
|
@@ -1116,7 +1060,7 @@ var Ce = class {
|
|
|
1116
1060
|
} });
|
|
1117
1061
|
} catch (e) {
|
|
1118
1062
|
this.#p(t, n) && this.#f({ connectionError: {
|
|
1119
|
-
message:
|
|
1063
|
+
message: u(e, this.#i.t).message,
|
|
1120
1064
|
provider: r.provider
|
|
1121
1065
|
} });
|
|
1122
1066
|
} finally {
|
|
@@ -1126,18 +1070,18 @@ var Ce = class {
|
|
|
1126
1070
|
}
|
|
1127
1071
|
}
|
|
1128
1072
|
async connect(e) {
|
|
1129
|
-
let t = this.#l.$.
|
|
1073
|
+
let t = this.#l.$.flowId.value;
|
|
1130
1074
|
if (!(this.#u || t == null)) try {
|
|
1131
|
-
if (!await this.#r.openExternalPage(() => this.#n.createConnectorConnectionPage(
|
|
1075
|
+
if (!await this.#r.openExternalPage(() => this.#n.createConnectorConnectionPage(e))) {
|
|
1132
1076
|
this.#s({
|
|
1133
1077
|
kind: "error",
|
|
1134
1078
|
message: this.#i.t("notice.connectionPopupBlocked")
|
|
1135
1079
|
});
|
|
1136
1080
|
return;
|
|
1137
1081
|
}
|
|
1138
|
-
!this.#u && t == this.#l.$.
|
|
1082
|
+
!this.#u && t == this.#l.$.flowId.value && this.#f({ authorizationProvider: e });
|
|
1139
1083
|
} catch (e) {
|
|
1140
|
-
this.#u || this.#s(
|
|
1084
|
+
this.#u || this.#s(u(e, this.#i.t));
|
|
1141
1085
|
}
|
|
1142
1086
|
}
|
|
1143
1087
|
async setConnection(e, t) {
|
|
@@ -1153,7 +1097,7 @@ var Ce = class {
|
|
|
1153
1097
|
delete t[e], this.#f({
|
|
1154
1098
|
authorizationProvider: void 0,
|
|
1155
1099
|
catalogs: t
|
|
1156
|
-
}),
|
|
1100
|
+
}), P(this.#l.$.selection.value, this.#l)?.provider == e && await this.refresh(!0);
|
|
1157
1101
|
}
|
|
1158
1102
|
#d() {
|
|
1159
1103
|
if (this.#e != null) return this.#e;
|
|
@@ -1169,11 +1113,11 @@ var Ce = class {
|
|
|
1169
1113
|
});
|
|
1170
1114
|
}
|
|
1171
1115
|
#p(e, t) {
|
|
1172
|
-
return !this.#u && e() && t == this.#l.$.
|
|
1116
|
+
return !this.#u && e() && t == this.#l.$.flowId.value;
|
|
1173
1117
|
}
|
|
1174
1118
|
};
|
|
1175
1119
|
//#endregion
|
|
1176
|
-
//#region src/
|
|
1120
|
+
//#region src/flow/common/edgeChanges.ts
|
|
1177
1121
|
function R(e, t, n) {
|
|
1178
1122
|
let r = {
|
|
1179
1123
|
source: n.source,
|
|
@@ -1187,7 +1131,7 @@ function R(e, t, n) {
|
|
|
1187
1131
|
target: t
|
|
1188
1132
|
}];
|
|
1189
1133
|
}
|
|
1190
|
-
function
|
|
1134
|
+
function Se(e, t, n) {
|
|
1191
1135
|
let r = {
|
|
1192
1136
|
source: n.source,
|
|
1193
1137
|
sourceHandle: n.sourceHandle,
|
|
@@ -1201,36 +1145,11 @@ function we(e, t, n) {
|
|
|
1201
1145
|
}];
|
|
1202
1146
|
}
|
|
1203
1147
|
function z(e, t) {
|
|
1204
|
-
return t.kind == "flow" ? e.document.
|
|
1205
|
-
}
|
|
1206
|
-
//#endregion
|
|
1207
|
-
//#region src/project/common/flowChanges.ts
|
|
1208
|
-
function Te(e, t) {
|
|
1209
|
-
return [{
|
|
1210
|
-
flow: {
|
|
1211
|
-
graph: { nodes: {} },
|
|
1212
|
-
name: t
|
|
1213
|
-
},
|
|
1214
|
-
flowId: e,
|
|
1215
|
-
kind: "flow.create"
|
|
1216
|
-
}];
|
|
1217
|
-
}
|
|
1218
|
-
function Ee(e, t) {
|
|
1219
|
-
return [{
|
|
1220
|
-
flowId: e,
|
|
1221
|
-
kind: "flow.rename",
|
|
1222
|
-
name: t
|
|
1223
|
-
}];
|
|
1224
|
-
}
|
|
1225
|
-
function De(e) {
|
|
1226
|
-
return [{
|
|
1227
|
-
flowId: e,
|
|
1228
|
-
kind: "flow.delete"
|
|
1229
|
-
}];
|
|
1148
|
+
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
1230
1149
|
}
|
|
1231
1150
|
//#endregion
|
|
1232
|
-
//#region src/
|
|
1233
|
-
async function
|
|
1151
|
+
//#region src/flow/common/moduleChanges.ts
|
|
1152
|
+
async function Ce(e) {
|
|
1234
1153
|
try {
|
|
1235
1154
|
let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
|
|
1236
1155
|
errorRecovery: !0,
|
|
@@ -1246,7 +1165,7 @@ async function Oe(e) {
|
|
|
1246
1165
|
return [];
|
|
1247
1166
|
}
|
|
1248
1167
|
}
|
|
1249
|
-
function
|
|
1168
|
+
function we(e, t, n) {
|
|
1250
1169
|
return [{
|
|
1251
1170
|
imports: n,
|
|
1252
1171
|
kind: "module.source.replace",
|
|
@@ -1255,20 +1174,22 @@ function ke(e, t, n) {
|
|
|
1255
1174
|
}];
|
|
1256
1175
|
}
|
|
1257
1176
|
//#endregion
|
|
1258
|
-
//#region src/
|
|
1259
|
-
function
|
|
1177
|
+
//#region src/flow/common/nodeChanges.ts
|
|
1178
|
+
function Te(e, t, n, r = {
|
|
1260
1179
|
imports: [],
|
|
1261
1180
|
source: "export default function run(input) {\n return { result: input.value }\n}\n"
|
|
1262
1181
|
}, i = {
|
|
1263
|
-
inputs: {
|
|
1182
|
+
inputs: [{
|
|
1183
|
+
handle: "value",
|
|
1264
1184
|
jsonSchema: {},
|
|
1265
1185
|
nullable: !0,
|
|
1266
1186
|
value: null
|
|
1267
|
-
}
|
|
1268
|
-
outputs: {
|
|
1187
|
+
}],
|
|
1188
|
+
outputs: [{
|
|
1189
|
+
handle: "result",
|
|
1269
1190
|
jsonSchema: {},
|
|
1270
1191
|
nullable: !0
|
|
1271
|
-
}
|
|
1192
|
+
}]
|
|
1272
1193
|
}) {
|
|
1273
1194
|
return [{
|
|
1274
1195
|
kind: "module.create",
|
|
@@ -1313,15 +1234,16 @@ function B(e, t, n) {
|
|
|
1313
1234
|
target: e
|
|
1314
1235
|
}];
|
|
1315
1236
|
}
|
|
1316
|
-
function
|
|
1237
|
+
function Ee(e, t, n, r, i, a = {}) {
|
|
1317
1238
|
let o = a.inputs ?? {};
|
|
1318
1239
|
return B(e, t, {
|
|
1319
1240
|
executor: {
|
|
1320
1241
|
kind: "llm",
|
|
1321
1242
|
mode: r
|
|
1322
1243
|
},
|
|
1323
|
-
inputs:
|
|
1324
|
-
|
|
1244
|
+
inputs: [
|
|
1245
|
+
{
|
|
1246
|
+
handle: "messages",
|
|
1325
1247
|
jsonSchema: {
|
|
1326
1248
|
items: { type: "object" },
|
|
1327
1249
|
type: "array"
|
|
@@ -1329,12 +1251,14 @@ function je(e, t, n, r, i, a = {}) {
|
|
|
1329
1251
|
nullable: !0,
|
|
1330
1252
|
value: W(o, "messages", null)
|
|
1331
1253
|
},
|
|
1332
|
-
|
|
1254
|
+
{
|
|
1255
|
+
handle: "input",
|
|
1333
1256
|
jsonSchema: { type: "string" },
|
|
1334
1257
|
nullable: !1,
|
|
1335
1258
|
value: W(o, "input", "Alex")
|
|
1336
1259
|
},
|
|
1337
|
-
|
|
1260
|
+
{
|
|
1261
|
+
handle: "template",
|
|
1338
1262
|
jsonSchema: {
|
|
1339
1263
|
items: { type: "object" },
|
|
1340
1264
|
minItems: 1,
|
|
@@ -1346,21 +1270,24 @@ function je(e, t, n, r, i, a = {}) {
|
|
|
1346
1270
|
role: "user"
|
|
1347
1271
|
}])
|
|
1348
1272
|
},
|
|
1349
|
-
|
|
1273
|
+
{
|
|
1274
|
+
handle: "model",
|
|
1350
1275
|
jsonSchema: { type: "object" },
|
|
1351
1276
|
nullable: !1,
|
|
1352
1277
|
value: W(o, "model", { model: "deepseek-v4-flash" })
|
|
1353
1278
|
}
|
|
1354
|
-
|
|
1279
|
+
],
|
|
1355
1280
|
name: n,
|
|
1356
|
-
outputs: {
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
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
|
+
}]
|
|
1361
1288
|
});
|
|
1362
1289
|
}
|
|
1363
|
-
function
|
|
1290
|
+
function De(e, t, n) {
|
|
1364
1291
|
return [{
|
|
1365
1292
|
kind: "graph.node.create",
|
|
1366
1293
|
node: {
|
|
@@ -1391,7 +1318,7 @@ function Me(e, t, n) {
|
|
|
1391
1318
|
target: e
|
|
1392
1319
|
}];
|
|
1393
1320
|
}
|
|
1394
|
-
function
|
|
1321
|
+
function Oe(e, t, n) {
|
|
1395
1322
|
return [{
|
|
1396
1323
|
kind: "graph.node.create",
|
|
1397
1324
|
node: {
|
|
@@ -1399,11 +1326,12 @@ function Ne(e, t, n) {
|
|
|
1399
1326
|
inputs: {},
|
|
1400
1327
|
kind: "value",
|
|
1401
1328
|
name: n,
|
|
1402
|
-
values: {
|
|
1329
|
+
values: [{
|
|
1330
|
+
handle: "value",
|
|
1403
1331
|
jsonSchema: {},
|
|
1404
1332
|
nullable: !0,
|
|
1405
1333
|
value: null
|
|
1406
|
-
}
|
|
1334
|
+
}]
|
|
1407
1335
|
},
|
|
1408
1336
|
nodeId: t,
|
|
1409
1337
|
target: e
|
|
@@ -1417,7 +1345,7 @@ function V(e, t, n) {
|
|
|
1417
1345
|
target: e
|
|
1418
1346
|
}];
|
|
1419
1347
|
}
|
|
1420
|
-
function
|
|
1348
|
+
function ke(e, t, n, r) {
|
|
1421
1349
|
let i = r.name ?? n.displayName, a = n.type == "poll" ? {
|
|
1422
1350
|
bindingId: t.bindingId,
|
|
1423
1351
|
config: r.config,
|
|
@@ -1450,7 +1378,7 @@ function Pe(e, t, n, r) {
|
|
|
1450
1378
|
target: e
|
|
1451
1379
|
}];
|
|
1452
1380
|
}
|
|
1453
|
-
function
|
|
1381
|
+
function Ae(e, t, n) {
|
|
1454
1382
|
let r = H(e, t)?.nodes;
|
|
1455
1383
|
if (r == null) return [];
|
|
1456
1384
|
let i = new Set(n), a = n.flatMap((e) => {
|
|
@@ -1469,13 +1397,13 @@ function Fe(e, t, n) {
|
|
|
1469
1397
|
let t = r[e];
|
|
1470
1398
|
return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
|
|
1471
1399
|
}));
|
|
1472
|
-
for (let
|
|
1473
|
-
bindingId:
|
|
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,
|
|
1474
1402
|
kind: "binding.delete"
|
|
1475
1403
|
});
|
|
1476
1404
|
return a;
|
|
1477
1405
|
}
|
|
1478
|
-
function
|
|
1406
|
+
function je(e, t, n, r) {
|
|
1479
1407
|
let i = H(e, t)?.nodes[n];
|
|
1480
1408
|
if (i == null || !("inputs" in i)) return;
|
|
1481
1409
|
let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
|
|
@@ -1484,10 +1412,10 @@ function Ie(e, t, n, r) {
|
|
|
1484
1412
|
...r
|
|
1485
1413
|
});
|
|
1486
1414
|
}
|
|
1487
|
-
function
|
|
1488
|
-
return
|
|
1415
|
+
function Me(e, t, n, r, i) {
|
|
1416
|
+
return Ne(e, t, n, { [r]: i });
|
|
1489
1417
|
}
|
|
1490
|
-
function
|
|
1418
|
+
function Ne(e, t, n, r) {
|
|
1491
1419
|
let i = H(e, t)?.nodes[n];
|
|
1492
1420
|
if (i == null || !("inputs" in i)) return;
|
|
1493
1421
|
let a = { ...i.inputs };
|
|
@@ -1500,7 +1428,7 @@ function Re(e, t, n, r) {
|
|
|
1500
1428
|
inputs: a
|
|
1501
1429
|
});
|
|
1502
1430
|
}
|
|
1503
|
-
function
|
|
1431
|
+
function Pe(e, t, n) {
|
|
1504
1432
|
let r = e.document.tasks[t];
|
|
1505
1433
|
if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
|
|
1506
1434
|
kind: "task.replace",
|
|
@@ -1514,11 +1442,12 @@ function ze(e, t, n) {
|
|
|
1514
1442
|
taskId: t
|
|
1515
1443
|
}];
|
|
1516
1444
|
}
|
|
1517
|
-
function
|
|
1518
|
-
let i = e.document.
|
|
1445
|
+
function Fe(e, t, n, r) {
|
|
1446
|
+
let i = e.document.graph.nodes[n];
|
|
1519
1447
|
if (i == null) return;
|
|
1520
1448
|
let a = {
|
|
1521
1449
|
...r.description == null ? {} : { description: r.description },
|
|
1450
|
+
icon: i.icon,
|
|
1522
1451
|
name: r.name
|
|
1523
1452
|
}, o;
|
|
1524
1453
|
switch (r.kind) {
|
|
@@ -1562,8 +1491,8 @@ function Be(e, t, n, r) {
|
|
|
1562
1491
|
}
|
|
1563
1492
|
return G(t, n, o);
|
|
1564
1493
|
}
|
|
1565
|
-
function
|
|
1566
|
-
let a = e.document.
|
|
1494
|
+
function Ie(e, t, n, r, i) {
|
|
1495
|
+
let a = e.document.graph.nodes[n];
|
|
1567
1496
|
if (a == null || a.kind != "integration" && a.kind != "poll") return;
|
|
1568
1497
|
let o = { ...a.config };
|
|
1569
1498
|
return i === void 0 ? delete o[r] : o[r] = i, G(t, n, {
|
|
@@ -1571,8 +1500,8 @@ function Ve(e, t, n, r, i) {
|
|
|
1571
1500
|
config: o
|
|
1572
1501
|
});
|
|
1573
1502
|
}
|
|
1574
|
-
function
|
|
1575
|
-
let i = e.document.
|
|
1503
|
+
function Le(e, t, n, r) {
|
|
1504
|
+
let i = e.document.graph.nodes[n];
|
|
1576
1505
|
if (i != null) switch (i.kind) {
|
|
1577
1506
|
case "cron": return G(t, n, {
|
|
1578
1507
|
...i,
|
|
@@ -1587,8 +1516,8 @@ function He(e, t, n, r) {
|
|
|
1587
1516
|
default: return;
|
|
1588
1517
|
}
|
|
1589
1518
|
}
|
|
1590
|
-
function
|
|
1591
|
-
let i = e.document.
|
|
1519
|
+
function Re(e, t, n, r) {
|
|
1520
|
+
let i = e.document.graph.nodes[n];
|
|
1592
1521
|
if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
|
|
1593
1522
|
binding: {
|
|
1594
1523
|
kind: "connection",
|
|
@@ -1599,12 +1528,12 @@ function Ue(e, t, n, r) {
|
|
|
1599
1528
|
}];
|
|
1600
1529
|
}
|
|
1601
1530
|
function H(e, t) {
|
|
1602
|
-
return t.kind == "flow" ? e.document.
|
|
1531
|
+
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
1603
1532
|
}
|
|
1604
1533
|
function U(e) {
|
|
1605
|
-
return Object.fromEntries(
|
|
1534
|
+
return Object.fromEntries(e.flatMap((e) => Object.hasOwn(e, "value") ? [[e.handle, {
|
|
1606
1535
|
kind: "value",
|
|
1607
|
-
value:
|
|
1536
|
+
value: e.value
|
|
1608
1537
|
}]] : []));
|
|
1609
1538
|
}
|
|
1610
1539
|
function W(e, t, n) {
|
|
@@ -1619,106 +1548,45 @@ function G(e, t, n) {
|
|
|
1619
1548
|
}];
|
|
1620
1549
|
}
|
|
1621
1550
|
//#endregion
|
|
1622
|
-
//#region src/workbench/browser/runtime/designer/
|
|
1551
|
+
//#region src/workbench/browser/runtime/designer/flowChanges.ts
|
|
1623
1552
|
function K(e, t) {
|
|
1624
|
-
return t == e || t.startsWith(`${e}/`);
|
|
1625
|
-
}
|
|
1626
|
-
function We(e, t) {
|
|
1627
|
-
return t.kind == "flow" ? t.id : e.flowIdsUsingSubflow(t.id)[0];
|
|
1628
|
-
}
|
|
1629
|
-
function Ge(e, t, n, r) {
|
|
1630
|
-
if (e == null || t == null || n == null) return [];
|
|
1631
|
-
if (r != null) return Xe(t, r, n.diagnostics);
|
|
1632
|
-
let i = `/document/${t.kind == "flow" ? "flows" : "subflows"}/${t.id}`;
|
|
1633
|
-
return n.diagnostics.filter((e) => K(i, e.path));
|
|
1634
|
-
}
|
|
1635
|
-
function Ke(e) {
|
|
1636
|
-
return e.startsWith("/modules/") ? "code" : /\/graph\/nodes\/[^/]+\/task(?:\/|$)/.test(e) ? "task" : e.includes("/graph/nodes/") ? "node" : e.startsWith("/document/tasks/") ? "task" : e.startsWith("/document/flows/") ? "flow" : "project";
|
|
1637
|
-
}
|
|
1638
|
-
function qe(e, t) {
|
|
1639
|
-
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";
|
|
1640
|
-
}
|
|
1641
|
-
function Je(e, t, n) {
|
|
1642
|
-
if (e == null || t == null) return;
|
|
1643
|
-
let r = `/document/${t.kind == "flow" ? "flows" : "subflows"}/${t.id}/graph/nodes/`;
|
|
1644
|
-
if (n.path.startsWith(r)) {
|
|
1645
|
-
let i = n.path.slice(r.length), a = i.indexOf("/"), o = a < 0 ? i : i.slice(0, a), s = e.node(t, o);
|
|
1646
|
-
return s == null ? void 0 : {
|
|
1647
|
-
nodeId: o,
|
|
1648
|
-
section: qe(s.node, a < 0 ? "" : i.slice(a))
|
|
1649
|
-
};
|
|
1650
|
-
}
|
|
1651
|
-
let i = /^\/document\/tasks\/([^/]+)(.*)$/.exec(n.path);
|
|
1652
|
-
if (i != null) {
|
|
1653
|
-
let n = e.findTaskNode(t, /* @__PURE__ */ new Set([i[1]]));
|
|
1654
|
-
return n == null ? void 0 : {
|
|
1655
|
-
nodeId: n,
|
|
1656
|
-
section: i[2].startsWith("/executor") ? "account" : "task"
|
|
1657
|
-
};
|
|
1658
|
-
}
|
|
1659
|
-
let a = /^\/modules\/([^/]+)\/source$/.exec(n.path);
|
|
1660
|
-
if (a != null) {
|
|
1661
|
-
let n = e.findModuleNode(t, a[1]);
|
|
1662
|
-
if (n != null) return {
|
|
1663
|
-
nodeId: n,
|
|
1664
|
-
section: "module"
|
|
1665
|
-
};
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
function Ye(e, t, n) {
|
|
1669
|
-
return n?.diagnostics.map((n) => ({
|
|
1670
|
-
diagnostic: n,
|
|
1671
|
-
location: Je(e, t, n),
|
|
1672
|
-
scope: Ke(n.path)
|
|
1673
|
-
})) ?? [];
|
|
1674
|
-
}
|
|
1675
|
-
function Xe(e, t, n) {
|
|
1676
|
-
let r = `/document/${e.kind == "flow" ? "flows" : "subflows"}/${e.id}/graph/nodes/${t.id}`, i = [r];
|
|
1677
|
-
if (t.kind == "task") {
|
|
1678
|
-
t.node.task == null ? i.push(`/document/tasks/${t.node.taskId}`) : i.push(`${r}/task`);
|
|
1679
|
-
let e = t.definition != null && "moduleId" in t.definition ? t.definition.moduleId : void 0;
|
|
1680
|
-
e != null && i.push(`/modules/${e}`);
|
|
1681
|
-
} else t.kind == "subflow" && i.push(`/document/subflows/${t.node.subflowId}`);
|
|
1682
|
-
return n.filter((e) => i.some((t) => K(t, e.path)));
|
|
1683
|
-
}
|
|
1684
|
-
//#endregion
|
|
1685
|
-
//#region src/workbench/browser/runtime/designer/projectChanges.ts
|
|
1686
|
-
function q(e, t) {
|
|
1687
1553
|
return {
|
|
1688
1554
|
...e,
|
|
1689
|
-
content:
|
|
1555
|
+
content: i(e.content, t)
|
|
1690
1556
|
};
|
|
1691
1557
|
}
|
|
1692
|
-
function
|
|
1693
|
-
return
|
|
1558
|
+
function ze(e, t) {
|
|
1559
|
+
return [{
|
|
1694
1560
|
kind: "subflow.create",
|
|
1695
1561
|
subflow: {
|
|
1696
1562
|
graph: { nodes: {} },
|
|
1697
|
-
inputs: {
|
|
1563
|
+
inputs: [{
|
|
1564
|
+
handle: "value",
|
|
1698
1565
|
jsonSchema: {},
|
|
1699
1566
|
nullable: !0,
|
|
1700
1567
|
value: null
|
|
1701
|
-
}
|
|
1702
|
-
name:
|
|
1703
|
-
outputs: {
|
|
1568
|
+
}],
|
|
1569
|
+
name: t,
|
|
1570
|
+
outputs: [{
|
|
1571
|
+
handle: "result",
|
|
1704
1572
|
jsonSchema: {},
|
|
1705
1573
|
nullable: !0,
|
|
1706
1574
|
sources: [{
|
|
1707
1575
|
input: "value",
|
|
1708
1576
|
kind: "flow"
|
|
1709
1577
|
}]
|
|
1710
|
-
}
|
|
1578
|
+
}]
|
|
1711
1579
|
},
|
|
1712
|
-
subflowId:
|
|
1580
|
+
subflowId: e
|
|
1713
1581
|
}];
|
|
1714
1582
|
}
|
|
1715
|
-
function
|
|
1583
|
+
function Be(e, t, n, r, i) {
|
|
1716
1584
|
switch (r.kind) {
|
|
1717
|
-
case "code": return
|
|
1585
|
+
case "code": return Te(t, {
|
|
1718
1586
|
moduleId: i(),
|
|
1719
1587
|
nodeId: n
|
|
1720
1588
|
}, r.name);
|
|
1721
|
-
case "llm": return
|
|
1589
|
+
case "llm": return Ee(t, {
|
|
1722
1590
|
nodeId: n,
|
|
1723
1591
|
taskId: i()
|
|
1724
1592
|
}, r.name, r.mode, r.outputDescription);
|
|
@@ -1731,15 +1599,15 @@ function Qe(e, t, n, r, i) {
|
|
|
1731
1599
|
...r.action.defaultConnection == null ? {} : { connectionId: r.action.defaultConnection.connectionId },
|
|
1732
1600
|
kind: "connector"
|
|
1733
1601
|
},
|
|
1734
|
-
inputs: r.action.inputs,
|
|
1602
|
+
inputs: Object.entries(r.action.inputs).map(([e, t]) => Object.assign({ handle: e }, t)),
|
|
1735
1603
|
name: r.action.name,
|
|
1736
|
-
outputs: r.action.outputs
|
|
1604
|
+
outputs: Object.entries(r.action.outputs).map(([e, t]) => Object.assign({ handle: e }, t))
|
|
1737
1605
|
});
|
|
1738
|
-
case "condition": return
|
|
1739
|
-
case "value": return
|
|
1606
|
+
case "condition": return De(t, n, r.name);
|
|
1607
|
+
case "value": return Oe(t, n, r.name);
|
|
1740
1608
|
case "subflow": {
|
|
1741
1609
|
let i = e.subflow(r.subflowId);
|
|
1742
|
-
return i == null ? void 0 :
|
|
1610
|
+
return i == null ? void 0 : tt(t, n, r.subflowId, i.inputs);
|
|
1743
1611
|
}
|
|
1744
1612
|
case "webhook": return t.kind == "flow" ? V(t, n, {
|
|
1745
1613
|
inputsDef: [],
|
|
@@ -1755,7 +1623,7 @@ function Qe(e, t, n, r, i) {
|
|
|
1755
1623
|
kind: "cron",
|
|
1756
1624
|
name: r.name
|
|
1757
1625
|
}) : void 0;
|
|
1758
|
-
case "provider-trigger": return t.kind == "flow" ?
|
|
1626
|
+
case "provider-trigger": return t.kind == "flow" ? ke(t, {
|
|
1759
1627
|
bindingId: i(),
|
|
1760
1628
|
nodeId: n
|
|
1761
1629
|
}, r.definition, {
|
|
@@ -1764,10 +1632,10 @@ function Qe(e, t, n, r, i) {
|
|
|
1764
1632
|
}) : void 0;
|
|
1765
1633
|
}
|
|
1766
1634
|
}
|
|
1767
|
-
function
|
|
1768
|
-
return
|
|
1635
|
+
function Ve(e, t, n) {
|
|
1636
|
+
return Ae(e.revision.content, t, n);
|
|
1769
1637
|
}
|
|
1770
|
-
function
|
|
1638
|
+
function He(e, t, n) {
|
|
1771
1639
|
let r = e.graph(t)?.nodes ?? {}, i = Object.fromEntries(n.flatMap((e) => r[e] == null ? [] : [[e, r[e]]]));
|
|
1772
1640
|
return {
|
|
1773
1641
|
modules: Object.fromEntries(Object.values(i).flatMap((t) => {
|
|
@@ -1778,7 +1646,7 @@ function et(e, t, n) {
|
|
|
1778
1646
|
nodes: i
|
|
1779
1647
|
};
|
|
1780
1648
|
}
|
|
1781
|
-
function
|
|
1649
|
+
function Ue(e, t, n, r) {
|
|
1782
1650
|
if (e.graph(t) == null) return {
|
|
1783
1651
|
changes: [],
|
|
1784
1652
|
nodeIds: [],
|
|
@@ -1878,25 +1746,47 @@ function tt(e, t, n, r) {
|
|
|
1878
1746
|
sourceIds: a
|
|
1879
1747
|
};
|
|
1880
1748
|
}
|
|
1881
|
-
function
|
|
1882
|
-
return
|
|
1749
|
+
function We(e, t, n, r) {
|
|
1750
|
+
return je(e.revision.content, t, n, r);
|
|
1883
1751
|
}
|
|
1884
|
-
function
|
|
1752
|
+
function Ge(e, t, n, r) {
|
|
1885
1753
|
let i = e.node(t, n)?.node;
|
|
1886
1754
|
if (i == null) return;
|
|
1887
1755
|
let { description: a, ...o } = i;
|
|
1888
|
-
return
|
|
1756
|
+
return Y(t, n, r == null ? o : {
|
|
1889
1757
|
...o,
|
|
1890
1758
|
description: r
|
|
1891
1759
|
});
|
|
1892
1760
|
}
|
|
1893
|
-
function
|
|
1894
|
-
|
|
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);
|
|
1895
1785
|
}
|
|
1896
|
-
function
|
|
1786
|
+
function Ye(e, t, n, r) {
|
|
1897
1787
|
let i = e.graph(t), a = i?.nodes[n];
|
|
1898
1788
|
if (i == null || a?.kind != "condition") return;
|
|
1899
|
-
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 =
|
|
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 = [];
|
|
1900
1790
|
for (let [e, o] of Object.entries(i.nodes)) {
|
|
1901
1791
|
if (!("inputs" in o)) continue;
|
|
1902
1792
|
let i = e == n, s = { ...o.inputs };
|
|
@@ -1941,68 +1831,69 @@ function at(e, t, n, r) {
|
|
|
1941
1831
|
}
|
|
1942
1832
|
return d;
|
|
1943
1833
|
}
|
|
1944
|
-
function
|
|
1834
|
+
function Xe(e, t, n, r) {
|
|
1945
1835
|
let i = e.node(t, n)?.node;
|
|
1946
|
-
if (i?.kind == "value") return
|
|
1836
|
+
if (i?.kind == "value") return Y(t, n, {
|
|
1947
1837
|
...i,
|
|
1948
|
-
values:
|
|
1838
|
+
values: r.map((e) => ({
|
|
1839
|
+
handle: e.handle,
|
|
1949
1840
|
...e.description == null ? {} : { description: e.description },
|
|
1950
1841
|
jsonSchema: e.jsonSchema ?? {},
|
|
1951
1842
|
nullable: e.nullable ?? !1,
|
|
1952
1843
|
...Object.hasOwn(e, "value") ? { value: e.value } : {}
|
|
1953
|
-
}
|
|
1844
|
+
}))
|
|
1954
1845
|
});
|
|
1955
1846
|
}
|
|
1956
|
-
function
|
|
1847
|
+
function Ze(e, t, n, r) {
|
|
1957
1848
|
let i = e.graph(t)?.nodes[n];
|
|
1958
1849
|
if (i?.kind == "task") switch (r.kind) {
|
|
1959
|
-
case "code": return i.task == null ? void 0 :
|
|
1850
|
+
case "code": return i.task == null ? void 0 : J(e, t, n, {
|
|
1960
1851
|
...i.task,
|
|
1961
|
-
|
|
1962
|
-
name: r.name,
|
|
1963
|
-
outputs: r.outputs
|
|
1852
|
+
name: r.name
|
|
1964
1853
|
});
|
|
1965
|
-
case "llm":
|
|
1966
|
-
|
|
1967
|
-
task
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
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
|
|
1971
1867
|
},
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
},
|
|
1976
|
-
taskId: i.taskId
|
|
1977
|
-
}];
|
|
1868
|
+
taskId: i.taskId
|
|
1869
|
+
}] : void 0;
|
|
1870
|
+
}
|
|
1978
1871
|
case "connector": {
|
|
1979
1872
|
if (i.task != null) return;
|
|
1980
1873
|
let t = e.task(i.taskId);
|
|
1981
1874
|
return t?.executor.kind == "connector" ? [{
|
|
1982
1875
|
kind: "task.replace",
|
|
1983
1876
|
task: {
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
name: r.name,
|
|
1987
|
-
outputs: r.outputs
|
|
1877
|
+
...t,
|
|
1878
|
+
name: r.name
|
|
1988
1879
|
},
|
|
1989
1880
|
taskId: i.taskId
|
|
1990
1881
|
}] : void 0;
|
|
1991
1882
|
}
|
|
1992
1883
|
}
|
|
1993
1884
|
}
|
|
1994
|
-
function
|
|
1885
|
+
function Qe(e, t, n, r) {
|
|
1995
1886
|
let i = e.graph(t)?.nodes[n];
|
|
1996
|
-
if (i?.kind == "task" && i.task != null) return
|
|
1887
|
+
if (i?.kind == "task" && i.task != null) return J(e, t, n, {
|
|
1997
1888
|
...i.task,
|
|
1998
1889
|
...r
|
|
1999
1890
|
});
|
|
2000
1891
|
}
|
|
2001
|
-
function
|
|
2002
|
-
let i = e.trigger(
|
|
1892
|
+
function $e(e, t, n, r) {
|
|
1893
|
+
let i = e.trigger(n);
|
|
2003
1894
|
if (i == null || i.kind != "webhook") return;
|
|
2004
1895
|
let { options: a, ...o } = i;
|
|
2005
|
-
return
|
|
1896
|
+
return Y(t, n, Object.keys(r.options).length == 0 ? {
|
|
2006
1897
|
...o,
|
|
2007
1898
|
inputsDef: r.inputs
|
|
2008
1899
|
} : {
|
|
@@ -2011,19 +1902,19 @@ function lt(e, t, n, r) {
|
|
|
2011
1902
|
options: r.options
|
|
2012
1903
|
});
|
|
2013
1904
|
}
|
|
2014
|
-
function
|
|
1905
|
+
function et(e, t, n) {
|
|
2015
1906
|
if (e.subflow(t) != null) return [{
|
|
2016
1907
|
definition: n,
|
|
2017
1908
|
kind: "subflow.definition.replace",
|
|
2018
1909
|
subflowId: t
|
|
2019
1910
|
}];
|
|
2020
1911
|
}
|
|
2021
|
-
function
|
|
1912
|
+
function tt(e, t, n, r) {
|
|
2022
1913
|
return [{
|
|
2023
1914
|
kind: "graph.node.create",
|
|
2024
1915
|
node: {
|
|
2025
1916
|
concurrency: 1,
|
|
2026
|
-
inputs:
|
|
1917
|
+
inputs: nt(r),
|
|
2027
1918
|
kind: "subflow",
|
|
2028
1919
|
subflowId: n
|
|
2029
1920
|
},
|
|
@@ -2031,57 +1922,57 @@ function dt(e, t, n, r) {
|
|
|
2031
1922
|
target: e
|
|
2032
1923
|
}];
|
|
2033
1924
|
}
|
|
2034
|
-
function
|
|
2035
|
-
return Object.fromEntries(
|
|
1925
|
+
function nt(e) {
|
|
1926
|
+
return Object.fromEntries(e.flatMap((e) => Object.hasOwn(e, "value") ? [[e.handle, {
|
|
2036
1927
|
kind: "value",
|
|
2037
|
-
value:
|
|
1928
|
+
value: e.value
|
|
2038
1929
|
}]] : []));
|
|
2039
1930
|
}
|
|
2040
|
-
function
|
|
2041
|
-
let n =
|
|
2042
|
-
return
|
|
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;
|
|
2043
1934
|
}
|
|
2044
|
-
function
|
|
1935
|
+
function J(e, t, n, r) {
|
|
2045
1936
|
let i = e.graph(t), a = i?.nodes[n];
|
|
2046
1937
|
if (i == null || a?.kind != "task" || a.task == null) return;
|
|
2047
|
-
let o =
|
|
2048
|
-
for (let [e,
|
|
2049
|
-
if (!("inputs" in
|
|
2050
|
-
let i = e == n,
|
|
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 };
|
|
2051
1942
|
if (e == n) {
|
|
2052
|
-
o != null && Object.hasOwn(
|
|
2053
|
-
for (let e of Object.keys(
|
|
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];
|
|
2054
1945
|
}
|
|
2055
|
-
for (let [e, t] of Object.entries(
|
|
1946
|
+
for (let [e, t] of Object.entries(f)) {
|
|
2056
1947
|
if (t.kind != "sources") continue;
|
|
2057
1948
|
let r = t.sources.flatMap((e) => e.kind != "node" || e.nodeId != n ? [e] : s != null && e.output == s[0] ? [{
|
|
2058
1949
|
...e,
|
|
2059
1950
|
output: s[1]
|
|
2060
|
-
}] :
|
|
2061
|
-
r.length == t.sources.length && r.every((e, n) => e === t.sources[n]) || (i = !0, r.length == 0 ? delete
|
|
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] = {
|
|
2062
1953
|
kind: "sources",
|
|
2063
1954
|
sources: r
|
|
2064
1955
|
});
|
|
2065
1956
|
}
|
|
2066
1957
|
if (!i) continue;
|
|
2067
|
-
let
|
|
1958
|
+
let p = e == n ? {
|
|
2068
1959
|
...a,
|
|
2069
|
-
inputs:
|
|
1960
|
+
inputs: f,
|
|
2070
1961
|
task: r
|
|
2071
1962
|
} : {
|
|
2072
|
-
...
|
|
2073
|
-
inputs:
|
|
1963
|
+
...d,
|
|
1964
|
+
inputs: f
|
|
2074
1965
|
};
|
|
2075
|
-
|
|
1966
|
+
u.push({
|
|
2076
1967
|
kind: "graph.node.replace",
|
|
2077
|
-
node:
|
|
1968
|
+
node: p,
|
|
2078
1969
|
nodeId: e,
|
|
2079
1970
|
target: t
|
|
2080
1971
|
});
|
|
2081
1972
|
}
|
|
2082
|
-
return
|
|
1973
|
+
return u;
|
|
2083
1974
|
}
|
|
2084
|
-
function
|
|
1975
|
+
function Y(e, t, n) {
|
|
2085
1976
|
return [{
|
|
2086
1977
|
kind: "graph.node.replace",
|
|
2087
1978
|
node: n,
|
|
@@ -2091,38 +1982,37 @@ function X(e, t, n) {
|
|
|
2091
1982
|
}
|
|
2092
1983
|
//#endregion
|
|
2093
1984
|
//#region src/workbench/browser/runtime/designer/remoteChangeTargets.ts
|
|
2094
|
-
function
|
|
2095
|
-
return e.kind == t.kind && e.id == t.id;
|
|
1985
|
+
function rt(e, t) {
|
|
1986
|
+
return e.kind == t.kind && (e.kind != "subflow" || t.kind == "subflow" && e.id == t.id);
|
|
2096
1987
|
}
|
|
2097
|
-
function
|
|
1988
|
+
function X(e, t, n, r) {
|
|
2098
1989
|
for (let [i, a] of Object.entries(t.graph(n)?.nodes ?? {})) r(a) && e.add(i);
|
|
2099
1990
|
}
|
|
2100
|
-
function
|
|
1991
|
+
function it(e, t, n, r) {
|
|
2101
1992
|
let i = /* @__PURE__ */ new Set();
|
|
2102
1993
|
for (let a of r) switch (a.kind) {
|
|
2103
1994
|
case "graph.node.create":
|
|
2104
1995
|
case "graph.node.replace":
|
|
2105
|
-
|
|
1996
|
+
rt(a.target, n) && i.add(a.nodeId);
|
|
2106
1997
|
break;
|
|
2107
1998
|
case "task.replace":
|
|
2108
|
-
|
|
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);
|
|
2109
2000
|
break;
|
|
2110
2001
|
case "module.source.replace":
|
|
2111
|
-
|
|
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);
|
|
2112
2003
|
break;
|
|
2113
|
-
case "subflow.definition.replace":
|
|
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);
|
|
2114
2005
|
}
|
|
2115
2006
|
return new Set([...i].filter((e) => t.selection(n, e) != null));
|
|
2116
2007
|
}
|
|
2117
2008
|
//#endregion
|
|
2118
2009
|
//#region src/workbench/browser/runtime/stores/draftChanges.ts
|
|
2119
|
-
function
|
|
2010
|
+
function at(e) {
|
|
2120
2011
|
if (e.length != 1) return;
|
|
2121
2012
|
let t = e[0];
|
|
2122
2013
|
switch (t.kind) {
|
|
2123
2014
|
case "binding.replace": return `${t.kind}:${t.bindingId}`;
|
|
2124
|
-
case "
|
|
2125
|
-
case "graph.node.replace": return `${t.kind}:${t.target.kind}:${t.target.id}:${t.nodeId}`;
|
|
2015
|
+
case "graph.node.replace": return `${t.kind}:${t.target.kind}:${t.target.kind == "subflow" ? t.target.id : ""}:${t.nodeId}`;
|
|
2126
2016
|
case "module.rename":
|
|
2127
2017
|
case "module.source.replace": return `${t.kind}:${t.moduleId}`;
|
|
2128
2018
|
case "subflow.definition.replace": return `${t.kind}:${t.subflowId}`;
|
|
@@ -2130,24 +2020,7 @@ function ht(e) {
|
|
|
2130
2020
|
default: return;
|
|
2131
2021
|
}
|
|
2132
2022
|
}
|
|
2133
|
-
|
|
2134
|
-
let r = new Map(e.map((e) => [e.flowId, e])), i = new Map(t.map((e) => [e.flowId, e]));
|
|
2135
|
-
return [...i.keys()].toSorted().map((e) => {
|
|
2136
|
-
let t = r.get(e), a = i.get(e), o = t?.live ?? null;
|
|
2137
|
-
return {
|
|
2138
|
-
draft: {
|
|
2139
|
-
closureDigest: a.closureDigest,
|
|
2140
|
-
name: a.name,
|
|
2141
|
-
revisionDigest: n.digest,
|
|
2142
|
-
revisionId: n.revisionId
|
|
2143
|
-
},
|
|
2144
|
-
flowId: e,
|
|
2145
|
-
hasUnpublishedChanges: o == null || o.publication.closureDigest != a.closureDigest,
|
|
2146
|
-
live: o
|
|
2147
|
-
};
|
|
2148
|
-
});
|
|
2149
|
-
}
|
|
2150
|
-
var _t = class {
|
|
2023
|
+
var ot = class {
|
|
2151
2024
|
#e;
|
|
2152
2025
|
#t;
|
|
2153
2026
|
#n;
|
|
@@ -2175,28 +2048,26 @@ var _t = class {
|
|
|
2175
2048
|
this.#a = e;
|
|
2176
2049
|
}
|
|
2177
2050
|
project(e) {
|
|
2178
|
-
return this.#o.reduce((e, t) =>
|
|
2051
|
+
return this.#o.reduce((e, t) => K(e, t.changes), e);
|
|
2179
2052
|
}
|
|
2180
2053
|
enqueue(e) {
|
|
2181
2054
|
let t = this.#s.then(e);
|
|
2182
2055
|
return this.#s = t, t;
|
|
2183
2056
|
}
|
|
2184
2057
|
async change(e, t, n, r = !0) {
|
|
2185
|
-
this.#t.beforeChange(r);
|
|
2186
|
-
let i = this.#
|
|
2187
|
-
|
|
2188
|
-
let
|
|
2189
|
-
if (s != null) return s.changes = n, await s.result;
|
|
2190
|
-
let c = {
|
|
2058
|
+
this.#t.beforeChange(r), this.#t.apply(K(t, n));
|
|
2059
|
+
let i = at(n), a = this.#o.at(-1), o = i != null && a != null && !a.started && at(a.changes) == i ? a : void 0;
|
|
2060
|
+
if (o != null) return o.changes = n, await o.result;
|
|
2061
|
+
let s = {
|
|
2191
2062
|
...e,
|
|
2192
2063
|
changes: n,
|
|
2193
2064
|
started: !1
|
|
2194
2065
|
};
|
|
2195
|
-
this.#a ??= t, this.#o.push(
|
|
2196
|
-
let
|
|
2197
|
-
|
|
2066
|
+
this.#a ??= t, this.#o.push(s), this.#i += 1;
|
|
2067
|
+
let c = this.#s.then(() => (s.started = !0, this.#c(s)));
|
|
2068
|
+
s.result = c, this.#s = c.then(() => void 0);
|
|
2198
2069
|
try {
|
|
2199
|
-
return await
|
|
2070
|
+
return await c;
|
|
2200
2071
|
} finally {
|
|
2201
2072
|
--this.#i, this.#i == 0 && this.#t.finishChanges();
|
|
2202
2073
|
}
|
|
@@ -2207,13 +2078,13 @@ var _t = class {
|
|
|
2207
2078
|
let n = this.#a;
|
|
2208
2079
|
if (n == null) return;
|
|
2209
2080
|
try {
|
|
2210
|
-
let t = await this.#e.changeDraft(e.
|
|
2081
|
+
let t = await this.#e.changeDraft(e.flowId, n.revisionId, e.changes);
|
|
2211
2082
|
if (!this.#t.current(e)) return;
|
|
2212
2083
|
if (t.revision.parentRevisionId != n.revisionId) throw Error("Invalid Draft change response.");
|
|
2213
2084
|
let r = this.#l(e, n, t);
|
|
2214
2085
|
return this.#o.length == 0 && this.#t.check(), r;
|
|
2215
2086
|
} catch (n) {
|
|
2216
|
-
if (n instanceof
|
|
2087
|
+
if (n instanceof s && n.code == "flow.revision-conflict") {
|
|
2217
2088
|
if (!t && await this.#t.recover(e)) {
|
|
2218
2089
|
t = !0;
|
|
2219
2090
|
continue;
|
|
@@ -2222,7 +2093,7 @@ var _t = class {
|
|
|
2222
2093
|
kind: "error",
|
|
2223
2094
|
message: this.#n.t("notice.draftConflict")
|
|
2224
2095
|
});
|
|
2225
|
-
} else this.#u(e), this.#t.current(e) && this.#r(
|
|
2096
|
+
} else this.#u(e), this.#t.current(e) && this.#r(u(n, this.#n.t));
|
|
2226
2097
|
return;
|
|
2227
2098
|
}
|
|
2228
2099
|
}
|
|
@@ -2230,95 +2101,28 @@ var _t = class {
|
|
|
2230
2101
|
#l(e, t, n) {
|
|
2231
2102
|
let r = {
|
|
2232
2103
|
...n.revision,
|
|
2233
|
-
content:
|
|
2104
|
+
content: K(t, e.changes).content
|
|
2234
2105
|
};
|
|
2235
2106
|
this.#o = this.#o.filter((t) => t !== e), this.#a = r;
|
|
2236
|
-
let i = this.#t.
|
|
2237
|
-
return this.#t.apply(this.project(r), a
|
|
2107
|
+
let i = this.#t.diagnostics(), a = this.#o.length == 0 && i?.revisionId == r.revisionId;
|
|
2108
|
+
return this.#t.apply(this.project(r), a), this.#t.headChanged(e.flowId, r.revisionId), r;
|
|
2238
2109
|
}
|
|
2239
2110
|
#u(e) {
|
|
2240
|
-
|
|
2241
|
-
let t = this.#t.flows();
|
|
2242
|
-
this.#t.apply(this.project(this.#a), t, t);
|
|
2243
|
-
}
|
|
2244
|
-
}, vt = class {
|
|
2245
|
-
#e;
|
|
2246
|
-
#t;
|
|
2247
|
-
#n;
|
|
2248
|
-
#r;
|
|
2249
|
-
#i = Promise.resolve();
|
|
2250
|
-
#a;
|
|
2251
|
-
#o = !1;
|
|
2252
|
-
#s = [];
|
|
2253
|
-
constructor(e, t, n, r) {
|
|
2254
|
-
this.#e = e, this.#n = t, this.#r = n, this.#t = r;
|
|
2255
|
-
}
|
|
2256
|
-
reset(e) {
|
|
2257
|
-
this.#a = e, this.#s = [];
|
|
2258
|
-
}
|
|
2259
|
-
dispose() {
|
|
2260
|
-
this.#o = !0, this.#s = [];
|
|
2261
|
-
}
|
|
2262
|
-
async change(e, t, n, r) {
|
|
2263
|
-
if (this.#o || this.#a == null) return;
|
|
2264
|
-
let i = r(t.value);
|
|
2265
|
-
if (i === t.value) return;
|
|
2266
|
-
let a = {
|
|
2267
|
-
current: n,
|
|
2268
|
-
projectId: e,
|
|
2269
|
-
update: r
|
|
2270
|
-
};
|
|
2271
|
-
this.#s.push(a), this.#r({
|
|
2272
|
-
...t,
|
|
2273
|
-
value: i
|
|
2274
|
-
}), this.#i = this.#i.then(async () => {
|
|
2275
|
-
if (this.#o || !n()) return;
|
|
2276
|
-
let t = this.#a, i = r(t.value);
|
|
2277
|
-
if (i === t.value) {
|
|
2278
|
-
this.#c(a, t);
|
|
2279
|
-
return;
|
|
2280
|
-
}
|
|
2281
|
-
try {
|
|
2282
|
-
let r = await this.#e.updatePresentation(e, t.revision, i);
|
|
2283
|
-
if (this.#o || !n()) return;
|
|
2284
|
-
this.#c(a, r);
|
|
2285
|
-
} catch (r) {
|
|
2286
|
-
if (this.#o || !n()) return;
|
|
2287
|
-
if (r instanceof u && r.code == "project.presentation-conflict") try {
|
|
2288
|
-
let t = await this.#e.getPresentation(e);
|
|
2289
|
-
if (this.#o || !n()) return;
|
|
2290
|
-
this.#c(a, t), this.#n({
|
|
2291
|
-
kind: "error",
|
|
2292
|
-
message: this.#t.t("notice.layoutConflict")
|
|
2293
|
-
});
|
|
2294
|
-
} catch (e) {
|
|
2295
|
-
!this.#o && n() && this.#n(o(e, this.#t.t));
|
|
2296
|
-
}
|
|
2297
|
-
else this.#c(a, t), this.#n(o(r, this.#t.t));
|
|
2298
|
-
}
|
|
2299
|
-
}), await this.#i;
|
|
2111
|
+
this.#o = this.#o.filter((t) => t !== e), !(!this.#t.current(e) || this.#a == null) && this.#t.apply(this.project(this.#a));
|
|
2300
2112
|
}
|
|
2301
|
-
|
|
2302
|
-
this.#s = this.#s.filter((t) => t !== e), this.#a = t;
|
|
2303
|
-
let n = this.#s.reduce((e, t) => t.update(e), t.value);
|
|
2304
|
-
this.#r(n === t.value ? t : {
|
|
2305
|
-
...t,
|
|
2306
|
-
value: n
|
|
2307
|
-
});
|
|
2308
|
-
}
|
|
2309
|
-
}, yt = 50, bt = {
|
|
2113
|
+
}, st = 50, ct = {
|
|
2310
2114
|
failed: !1,
|
|
2311
2115
|
loaded: !1,
|
|
2312
2116
|
loading: !0,
|
|
2313
2117
|
loadingMore: !1,
|
|
2314
2118
|
loadMoreFailed: !1,
|
|
2315
|
-
|
|
2316
|
-
},
|
|
2119
|
+
flows: []
|
|
2120
|
+
}, lt = class {
|
|
2317
2121
|
#e;
|
|
2318
2122
|
#t;
|
|
2319
|
-
#n = new
|
|
2123
|
+
#n = new x();
|
|
2320
2124
|
#r;
|
|
2321
|
-
#i = t(
|
|
2125
|
+
#i = t(ct);
|
|
2322
2126
|
#a = !1;
|
|
2323
2127
|
constructor(t, n, r) {
|
|
2324
2128
|
this.#e = t, this.#t = r, this.#r = n, this.$ = {
|
|
@@ -2327,7 +2131,7 @@ var _t = class {
|
|
|
2327
2131
|
loadingMore: e(this.#i, (e) => e.loadingMore),
|
|
2328
2132
|
loadMoreFailed: e(this.#i, (e) => e.loadMoreFailed),
|
|
2329
2133
|
nextCursor: e(this.#i, (e) => e.nextCursor),
|
|
2330
|
-
|
|
2134
|
+
flows: e(this.#i, (e) => e.flows),
|
|
2331
2135
|
total: e(this.#i, (e) => e.total)
|
|
2332
2136
|
};
|
|
2333
2137
|
}
|
|
@@ -2346,8 +2150,8 @@ var _t = class {
|
|
|
2346
2150
|
capture() {
|
|
2347
2151
|
return this.#n.capture();
|
|
2348
2152
|
}
|
|
2349
|
-
|
|
2350
|
-
return this.#i.value.
|
|
2153
|
+
flow(e) {
|
|
2154
|
+
return this.#i.value.flows.find((t) => t.flowId == e);
|
|
2351
2155
|
}
|
|
2352
2156
|
async reload() {
|
|
2353
2157
|
let e = this.#n.begin();
|
|
@@ -2358,20 +2162,20 @@ var _t = class {
|
|
|
2358
2162
|
loadingMore: !1,
|
|
2359
2163
|
loadMoreFailed: !1,
|
|
2360
2164
|
nextCursor: void 0,
|
|
2361
|
-
|
|
2165
|
+
flows: [],
|
|
2362
2166
|
total: void 0
|
|
2363
2167
|
});
|
|
2364
2168
|
try {
|
|
2365
|
-
let t = await this.#e.
|
|
2169
|
+
let t = await this.#e.listFlows({
|
|
2366
2170
|
includeTotal: !0,
|
|
2367
|
-
limit:
|
|
2171
|
+
limit: st
|
|
2368
2172
|
});
|
|
2369
2173
|
if (!e()) return;
|
|
2370
2174
|
this.#o({
|
|
2371
2175
|
loaded: !0,
|
|
2372
2176
|
loading: !1,
|
|
2373
2177
|
nextCursor: t.nextCursor,
|
|
2374
|
-
|
|
2178
|
+
flows: t.flows,
|
|
2375
2179
|
total: t.total
|
|
2376
2180
|
});
|
|
2377
2181
|
} catch (t) {
|
|
@@ -2379,7 +2183,7 @@ var _t = class {
|
|
|
2379
2183
|
this.#o({
|
|
2380
2184
|
failed: !0,
|
|
2381
2185
|
loading: !1
|
|
2382
|
-
}), this.#r(
|
|
2186
|
+
}), this.#r(u(t, this.#t.t));
|
|
2383
2187
|
}
|
|
2384
2188
|
}
|
|
2385
2189
|
async loadMore() {
|
|
@@ -2391,43 +2195,48 @@ var _t = class {
|
|
|
2391
2195
|
loadMoreFailed: !1
|
|
2392
2196
|
});
|
|
2393
2197
|
try {
|
|
2394
|
-
let e = await this.#e.
|
|
2198
|
+
let e = await this.#e.listFlows({
|
|
2395
2199
|
cursor: t,
|
|
2396
|
-
limit:
|
|
2200
|
+
limit: st
|
|
2397
2201
|
});
|
|
2398
2202
|
if (!n()) return;
|
|
2399
|
-
let r = new Set(this.#i.value.
|
|
2203
|
+
let r = new Set(this.#i.value.flows.map((e) => e.flowId));
|
|
2400
2204
|
this.#o({
|
|
2401
2205
|
loadingMore: !1,
|
|
2402
2206
|
nextCursor: e.nextCursor,
|
|
2403
|
-
|
|
2207
|
+
flows: [...this.#i.value.flows, ...e.flows.filter((e) => !r.has(e.flowId))]
|
|
2404
2208
|
});
|
|
2405
2209
|
} catch (e) {
|
|
2406
2210
|
if (!n()) return;
|
|
2407
2211
|
this.#o({
|
|
2408
2212
|
loadingMore: !1,
|
|
2409
2213
|
loadMoreFailed: !0
|
|
2410
|
-
}), this.#r(
|
|
2214
|
+
}), this.#r(u(e, this.#t.t));
|
|
2411
2215
|
}
|
|
2412
2216
|
}
|
|
2413
2217
|
async create(e) {
|
|
2414
|
-
let t = await this.#e.
|
|
2218
|
+
let t = await this.#e.createFlow(e);
|
|
2415
2219
|
if (!this.#a) return this.#o({
|
|
2416
|
-
|
|
2220
|
+
flows: [...this.#i.value.flows, t],
|
|
2417
2221
|
total: this.#i.value.total == null ? void 0 : this.#i.value.total + 1
|
|
2418
2222
|
}), t;
|
|
2419
2223
|
}
|
|
2420
2224
|
include(e) {
|
|
2421
|
-
|
|
2225
|
+
let t = this.#i.value.flows.findIndex((t) => t.flowId == e.flowId);
|
|
2226
|
+
if (t < 0) {
|
|
2227
|
+
this.#o({ flows: [...this.#i.value.flows, e] });
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2230
|
+
this.#o({ flows: this.#i.value.flows.with(t, e) });
|
|
2422
2231
|
}
|
|
2423
2232
|
remove(e) {
|
|
2424
2233
|
this.#o({
|
|
2425
|
-
|
|
2234
|
+
flows: this.#i.value.flows.filter((t) => t.flowId != e),
|
|
2426
2235
|
total: this.#i.value.total == null ? void 0 : this.#i.value.total - 1
|
|
2427
2236
|
});
|
|
2428
2237
|
}
|
|
2429
2238
|
advanceHead(e, t) {
|
|
2430
|
-
this.#o({
|
|
2239
|
+
this.#o({ flows: this.#i.value.flows.map((n) => n.flowId == e ? {
|
|
2431
2240
|
...n,
|
|
2432
2241
|
draftRevisionId: t
|
|
2433
2242
|
} : n) });
|
|
@@ -2438,22 +2247,149 @@ var _t = class {
|
|
|
2438
2247
|
...e
|
|
2439
2248
|
});
|
|
2440
2249
|
}
|
|
2441
|
-
},
|
|
2250
|
+
}, ut = class {
|
|
2251
|
+
#e;
|
|
2252
|
+
#t;
|
|
2253
|
+
#n;
|
|
2254
|
+
#r;
|
|
2255
|
+
#i = Promise.resolve();
|
|
2256
|
+
#a;
|
|
2257
|
+
#o = !1;
|
|
2258
|
+
#s = [];
|
|
2259
|
+
constructor(e, t, n, r) {
|
|
2260
|
+
this.#e = e, this.#n = t, this.#r = n, this.#t = r;
|
|
2261
|
+
}
|
|
2262
|
+
reset(e) {
|
|
2263
|
+
this.#a = e, this.#s = [];
|
|
2264
|
+
}
|
|
2265
|
+
dispose() {
|
|
2266
|
+
this.#o = !0, this.#s = [];
|
|
2267
|
+
}
|
|
2268
|
+
async change(e, t, n, r) {
|
|
2269
|
+
if (this.#o || this.#a == null) return;
|
|
2270
|
+
let i = r(t.value);
|
|
2271
|
+
if (i === t.value) return;
|
|
2272
|
+
let a = {
|
|
2273
|
+
current: n,
|
|
2274
|
+
flowId: e,
|
|
2275
|
+
update: r
|
|
2276
|
+
};
|
|
2277
|
+
this.#s.push(a), this.#r({
|
|
2278
|
+
...t,
|
|
2279
|
+
value: i
|
|
2280
|
+
}), this.#i = this.#i.then(async () => {
|
|
2281
|
+
if (this.#o || !n()) return;
|
|
2282
|
+
let t = this.#a, i = r(t.value);
|
|
2283
|
+
if (i === t.value) {
|
|
2284
|
+
this.#c(a, t);
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
try {
|
|
2288
|
+
let r = await this.#e.updatePresentation(e, t.revision, i);
|
|
2289
|
+
if (this.#o || !n()) return;
|
|
2290
|
+
this.#c(a, r);
|
|
2291
|
+
} catch (r) {
|
|
2292
|
+
if (this.#o || !n()) return;
|
|
2293
|
+
if (r instanceof s && r.code == "flow.presentation-conflict") try {
|
|
2294
|
+
let t = await this.#e.getPresentation(e);
|
|
2295
|
+
if (this.#o || !n()) return;
|
|
2296
|
+
this.#c(a, t), this.#n({
|
|
2297
|
+
kind: "error",
|
|
2298
|
+
message: this.#t.t("notice.layoutConflict")
|
|
2299
|
+
});
|
|
2300
|
+
} catch (e) {
|
|
2301
|
+
!this.#o && n() && this.#n(u(e, this.#t.t));
|
|
2302
|
+
}
|
|
2303
|
+
else this.#c(a, t), this.#n(u(r, this.#t.t));
|
|
2304
|
+
}
|
|
2305
|
+
}), await this.#i;
|
|
2306
|
+
}
|
|
2307
|
+
#c(e, t) {
|
|
2308
|
+
this.#s = this.#s.filter((t) => t !== e), this.#a = t;
|
|
2309
|
+
let n = this.#s.reduce((e, t) => t.update(e), t.value);
|
|
2310
|
+
this.#r(n === t.value ? t : {
|
|
2311
|
+
...t,
|
|
2312
|
+
value: n
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2316
|
+
//#endregion
|
|
2317
|
+
//#region src/workbench/browser/runtime/designer/diagnostics.ts
|
|
2318
|
+
function dt(e, t) {
|
|
2319
|
+
return t == e || t.startsWith(`${e}/`);
|
|
2320
|
+
}
|
|
2321
|
+
function ft(e, t, n, r) {
|
|
2322
|
+
if (e == null || t == null || n == null) return [];
|
|
2323
|
+
if (r != null) return _t(t, r, n.diagnostics);
|
|
2324
|
+
let i = t.kind == "flow" ? "/document/graph" : `/document/subflows/${t.id}`;
|
|
2325
|
+
return n.diagnostics.filter((e) => dt(i, e.path));
|
|
2326
|
+
}
|
|
2327
|
+
function pt(e) {
|
|
2328
|
+
return e.startsWith("/modules/") ? "code" : /\/graph\/nodes\/[^/]+\/task(?:\/|$)/.test(e) ? "task" : e.includes("/graph/nodes/") ? "node" : e.startsWith("/document/tasks/") ? "task" : "flow";
|
|
2329
|
+
}
|
|
2330
|
+
function mt(e, t) {
|
|
2331
|
+
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";
|
|
2332
|
+
}
|
|
2333
|
+
function ht(e, t, n) {
|
|
2334
|
+
if (e == null || t == null) return;
|
|
2335
|
+
let r = t.kind == "flow" ? "/document/graph/nodes/" : `/document/subflows/${t.id}/graph/nodes/`;
|
|
2336
|
+
if (n.path.startsWith(r)) {
|
|
2337
|
+
let i = n.path.slice(r.length), a = i.indexOf("/"), o = a < 0 ? i : i.slice(0, a), s = e.node(t, o);
|
|
2338
|
+
return s == null ? void 0 : {
|
|
2339
|
+
nodeId: o,
|
|
2340
|
+
section: mt(s.node, a < 0 ? "" : i.slice(a))
|
|
2341
|
+
};
|
|
2342
|
+
}
|
|
2343
|
+
let i = /^\/document\/tasks\/([^/]+)(.*)$/.exec(n.path);
|
|
2344
|
+
if (i != null) {
|
|
2345
|
+
let n = e.findTaskNode(t, /* @__PURE__ */ new Set([i[1]]));
|
|
2346
|
+
return n == null ? void 0 : {
|
|
2347
|
+
nodeId: n,
|
|
2348
|
+
section: i[2].startsWith("/executor") ? "account" : "task"
|
|
2349
|
+
};
|
|
2350
|
+
}
|
|
2351
|
+
let a = /^\/modules\/([^/]+)\/source$/.exec(n.path);
|
|
2352
|
+
if (a != null) {
|
|
2353
|
+
let n = e.findModuleNode(t, a[1]);
|
|
2354
|
+
if (n != null) return {
|
|
2355
|
+
nodeId: n,
|
|
2356
|
+
section: "module"
|
|
2357
|
+
};
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
function gt(e, t, n) {
|
|
2361
|
+
return n?.diagnostics.map((n) => ({
|
|
2362
|
+
diagnostic: n,
|
|
2363
|
+
location: ht(e, t, n),
|
|
2364
|
+
scope: pt(n.path)
|
|
2365
|
+
})) ?? [];
|
|
2366
|
+
}
|
|
2367
|
+
function _t(e, t, n) {
|
|
2368
|
+
let r = e.kind == "flow" ? `/document/graph/nodes/${t.id}` : `/document/subflows/${e.id}/graph/nodes/${t.id}`, i = [r];
|
|
2369
|
+
if (t.kind == "task") {
|
|
2370
|
+
t.node.task == null ? i.push(`/document/tasks/${t.node.taskId}`) : i.push(`${r}/task`);
|
|
2371
|
+
let e = t.definition != null && "moduleId" in t.definition ? t.definition.moduleId : void 0;
|
|
2372
|
+
e != null && i.push(`/modules/${e}`);
|
|
2373
|
+
} else t.kind == "subflow" && i.push(`/document/subflows/${t.node.subflowId}`);
|
|
2374
|
+
return n.filter((e) => i.some((t) => dt(t, e.path)));
|
|
2375
|
+
}
|
|
2376
|
+
//#endregion
|
|
2377
|
+
//#region src/workbench/browser/runtime/stores/workspaceModel.ts
|
|
2378
|
+
var vt = {
|
|
2442
2379
|
checkLoading: !1,
|
|
2443
|
-
flows: [],
|
|
2444
2380
|
selectedNodeIds: [],
|
|
2445
2381
|
workspaceLoadFailed: !1,
|
|
2446
2382
|
workspaceLoading: !1
|
|
2447
2383
|
};
|
|
2448
|
-
function
|
|
2384
|
+
function yt(e) {
|
|
2449
2385
|
return e.workspaceLoading ? "loading" : e.busy == "designer" ? "saving" : e.draft == null ? "noDraft" : "saved";
|
|
2450
2386
|
}
|
|
2451
|
-
function
|
|
2387
|
+
function Z(e, t) {
|
|
2452
2388
|
if (t.phase != null) return t.phase;
|
|
2453
2389
|
let n = e?.content.modules[t.moduleId];
|
|
2454
2390
|
return n == null ? "failed" : t.source == n.source ? "saved" : "dirty";
|
|
2455
2391
|
}
|
|
2456
|
-
function
|
|
2392
|
+
function Q(e, t, n) {
|
|
2457
2393
|
if (e == null || t == null || n.length != 1) return;
|
|
2458
2394
|
let r = e.node(t, n[0]);
|
|
2459
2395
|
if (!(r?.kind != "task" || r.definition == null || !("moduleId" in r.definition) || r.module == null)) return {
|
|
@@ -2461,72 +2397,69 @@ function $(e, t, n) {
|
|
|
2461
2397
|
source: r.module.source
|
|
2462
2398
|
};
|
|
2463
2399
|
}
|
|
2464
|
-
var
|
|
2400
|
+
var bt = class {
|
|
2465
2401
|
#e;
|
|
2466
|
-
#t = t(
|
|
2402
|
+
#t = t(vt);
|
|
2467
2403
|
#n;
|
|
2468
2404
|
constructor(t, r) {
|
|
2469
|
-
let i = e(this.#t, (e) => e.busy), a = e(this.#t, (e) => e.checkLoading), o = e(this.#t, (e) => e.diagnosticFocus), s = e(this.#t, (e) => e.diagnostics), c = e(this.#t, (e) => e.draft), l = e(this.#t, (e) =>
|
|
2405
|
+
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) => {
|
|
2470
2406
|
if (e.moduleEditor == null) return;
|
|
2471
2407
|
let { phase: t, ...n } = e.moduleEditor;
|
|
2472
2408
|
return {
|
|
2473
2409
|
...n,
|
|
2474
|
-
status:
|
|
2410
|
+
status: Z(e.draft, e.moduleEditor)
|
|
2475
2411
|
};
|
|
2476
|
-
}),
|
|
2412
|
+
}), 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 : h(e.draft)), g = e(this.#t, (e) => e.selectedNodeIds), _ = e(this.#t, (e) => e.target), v = e(this.#t, (e) => e.workspaceLoadFailed), y = e(this.#t, (e) => e.workspaceLoading);
|
|
2477
2413
|
this.#e = e(this.#t, (e) => ({
|
|
2478
|
-
revision: e.draft == null ? void 0 :
|
|
2414
|
+
revision: e.draft == null ? void 0 : h(e.draft),
|
|
2479
2415
|
target: e.target
|
|
2480
2416
|
}), { equal: (e, t) => e.revision === t.revision && e.target === t.target });
|
|
2481
|
-
let
|
|
2482
|
-
if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return
|
|
2417
|
+
let b = e(this.#t, (e) => {
|
|
2418
|
+
if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return h(e.draft).selection(e.target, e.selectedNodeIds[0]);
|
|
2483
2419
|
});
|
|
2484
2420
|
this.$ = {
|
|
2485
2421
|
addNodeOptions: n((e) => {
|
|
2486
2422
|
let { revision: n, target: r } = e(this.#e);
|
|
2487
|
-
return
|
|
2423
|
+
return ee(n?.revision, r, e(t.t$));
|
|
2488
2424
|
}),
|
|
2489
2425
|
busy: i,
|
|
2490
2426
|
checkLoading: a,
|
|
2491
2427
|
diagnosticFocus: o,
|
|
2492
|
-
diagnosticItems: e(this.#t, (e) =>
|
|
2428
|
+
diagnosticItems: e(this.#t, (e) => gt(e.draft == null ? void 0 : h(e.draft), e.target, e.diagnostics)),
|
|
2493
2429
|
diagnostics: s,
|
|
2494
2430
|
draft: c,
|
|
2495
|
-
|
|
2496
|
-
|
|
2431
|
+
flow: n((e) => {
|
|
2432
|
+
let t = e(f);
|
|
2433
|
+
return t == null ? void 0 : e(r.$.flows).find((e) => e.flowId == t);
|
|
2434
|
+
}),
|
|
2435
|
+
flowId: f,
|
|
2436
|
+
flowLoadFailed: r.$.failed,
|
|
2437
|
+
flowLoadMoreFailed: r.$.loadMoreFailed,
|
|
2438
|
+
flowLoading: r.$.loading,
|
|
2439
|
+
flowLoadingMore: r.$.loadingMore,
|
|
2440
|
+
flowNextCursor: r.$.nextCursor,
|
|
2441
|
+
flowTotal: r.$.total,
|
|
2442
|
+
flows: r.$.flows,
|
|
2443
|
+
inspectorDiagnostics: e(this.#t, (e) => ft(e.draft == null ? void 0 : h(e.draft), e.target, e.diagnostics, b.value)),
|
|
2444
|
+
live: p,
|
|
2497
2445
|
moduleDiagnostics: e(this.#t, (e) => {
|
|
2498
2446
|
let t = e.moduleEditor?.moduleId;
|
|
2499
2447
|
return t == null ? [] : e.diagnostics?.diagnostics.filter((e) => e.path.startsWith(`/modules/${t}/source`)) ?? [];
|
|
2500
2448
|
}),
|
|
2501
|
-
moduleEditor:
|
|
2502
|
-
nodeFocus:
|
|
2503
|
-
presentation:
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
projectLoadMoreFailed: r.$.loadMoreFailed,
|
|
2511
|
-
projectLoading: r.$.loading,
|
|
2512
|
-
projectLoadingMore: r.$.loadingMore,
|
|
2513
|
-
projectNextCursor: r.$.nextCursor,
|
|
2514
|
-
projectTotal: r.$.total,
|
|
2515
|
-
projects: r.$.projects,
|
|
2516
|
-
revision: h,
|
|
2517
|
-
selection: x,
|
|
2518
|
-
selectedNodeIds: _,
|
|
2519
|
-
status: e(this.#t, Ct),
|
|
2520
|
-
target: v,
|
|
2521
|
-
targetFlow: e(this.#t, (e) => e.target?.kind == "flow" ? e.flows.find((t) => t.flowId == e.target?.id) : void 0),
|
|
2449
|
+
moduleEditor: l,
|
|
2450
|
+
nodeFocus: u,
|
|
2451
|
+
presentation: d,
|
|
2452
|
+
revision: m,
|
|
2453
|
+
selection: b,
|
|
2454
|
+
selectedNodeIds: g,
|
|
2455
|
+
status: e(this.#t, yt),
|
|
2456
|
+
target: _,
|
|
2457
|
+
targetFlow: n((e) => e(_)?.kind == "flow" ? e(r.$.flows).find((t) => t.flowId == e(f)) : void 0),
|
|
2522
2458
|
targetName: e(this.#t, (e) => {
|
|
2523
|
-
if (e.target == null)
|
|
2524
|
-
if (e.draft == null) return e.target.id;
|
|
2525
|
-
let t = f(e.draft);
|
|
2526
|
-
return (e.target.kind == "flow" ? t.flow(e.target.id)?.name : t.subflow(e.target.id)?.name) ?? e.target.id;
|
|
2459
|
+
if (e.target != null) return e.target.kind == "flow" ? r.flow(e.flowId ?? "")?.name : e.draft == null ? e.target.id : h(e.draft).subflow(e.target.id)?.name ?? e.target.id;
|
|
2527
2460
|
}),
|
|
2528
|
-
workspaceLoadFailed:
|
|
2529
|
-
workspaceLoading:
|
|
2461
|
+
workspaceLoadFailed: v,
|
|
2462
|
+
workspaceLoading: y
|
|
2530
2463
|
}, this.#n = new Set(Object.values(r.$));
|
|
2531
2464
|
}
|
|
2532
2465
|
get value() {
|
|
@@ -2542,28 +2475,17 @@ var wt = class {
|
|
|
2542
2475
|
for (let e of Object.values(this.$)) this.#n.has(e) || e.dispose();
|
|
2543
2476
|
this.#e.dispose(), this.#t.dispose();
|
|
2544
2477
|
}
|
|
2545
|
-
},
|
|
2546
|
-
function
|
|
2547
|
-
if (
|
|
2548
|
-
if (r.kind == "subflow") {
|
|
2549
|
-
if (e.subflow(r.id) != null) return r;
|
|
2550
|
-
let n = c(t, null);
|
|
2551
|
-
return n == null ? void 0 : {
|
|
2552
|
-
id: n.flowId,
|
|
2553
|
-
kind: "flow"
|
|
2554
|
-
};
|
|
2555
|
-
}
|
|
2556
|
-
if (e.flow(r.id) != null) return r;
|
|
2557
|
-
let i = new Set(e.flowIds), a = n.filter((e) => e.draft != null).map((e) => e.flowId), o = a.indexOf(r.id), s = (o < 0 ? a : [...a.slice(o + 1), ...a.slice(0, o).toReversed()]).find((e) => i.has(e)) ?? t.find((e) => e.draft != null && i.has(e.flowId))?.flowId ?? i.values().next().value;
|
|
2558
|
-
return s == null ? void 0 : {
|
|
2559
|
-
id: s,
|
|
2560
|
-
kind: "flow"
|
|
2561
|
-
};
|
|
2478
|
+
}, xt = 250;
|
|
2479
|
+
function St(e, t) {
|
|
2480
|
+
if (t != null) return t.kind == "flow" || e.subflow(t.id) != null ? t : { kind: "flow" };
|
|
2562
2481
|
}
|
|
2563
|
-
|
|
2482
|
+
function $(e, t) {
|
|
2483
|
+
return e?.kind == t?.kind ? e?.kind != "subflow" || t?.kind == "subflow" && e.id == t.id : !1;
|
|
2484
|
+
}
|
|
2485
|
+
var Ct = class {
|
|
2564
2486
|
#e;
|
|
2565
2487
|
#t;
|
|
2566
|
-
#n = new
|
|
2488
|
+
#n = new x();
|
|
2567
2489
|
#r;
|
|
2568
2490
|
#i;
|
|
2569
2491
|
#a;
|
|
@@ -2582,182 +2504,166 @@ var Dt = class {
|
|
|
2582
2504
|
#v = !1;
|
|
2583
2505
|
#y = 0;
|
|
2584
2506
|
#b;
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2507
|
+
#x;
|
|
2508
|
+
constructor(e, t, n = () => crypto.randomUUID(), r = l(), i = () => {}) {
|
|
2509
|
+
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, {
|
|
2510
|
+
apply: (e, t) => this.#w(e, t),
|
|
2588
2511
|
beforeChange: (e) => {
|
|
2589
|
-
this.#
|
|
2512
|
+
this.#M(), this.#h = !1, e && (this.#B({ busy: "designer" }), this.#c(void 0));
|
|
2590
2513
|
},
|
|
2591
|
-
check: () => void this.#
|
|
2592
|
-
current: (e) => this.#
|
|
2514
|
+
check: () => void this.#E(),
|
|
2515
|
+
current: (e) => this.#z(e),
|
|
2593
2516
|
diagnostics: () => this.#l.value.diagnostics,
|
|
2594
2517
|
finishChanges: () => {
|
|
2595
|
-
!this.#_ && this.#l.value.busy == "designer" && this.#
|
|
2518
|
+
!this.#_ && this.#l.value.busy == "designer" && this.#B({ busy: void 0 });
|
|
2596
2519
|
},
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
}), this.#a = new vt(e, t, (e) => this.#z({ presentation: e }), r), this.$ = this.#l.$;
|
|
2520
|
+
headChanged: (e, t) => this.#N(e, t),
|
|
2521
|
+
recover: (e) => this.#O(e, !0)
|
|
2522
|
+
}), this.#a = new ut(e, t, (e) => this.#B({ presentation: e }), r), this.$ = this.#l.$;
|
|
2601
2523
|
}
|
|
2602
2524
|
dispose() {
|
|
2603
|
-
this.#
|
|
2525
|
+
this.#M(), this.#_ = !0, this.#n.invalidate(), this.#a.dispose(), this.#b?.(), this.#x?.(), this.#l.dispose(), this.#o.dispose();
|
|
2604
2526
|
}
|
|
2605
|
-
async start(e
|
|
2606
|
-
|
|
2607
|
-
await this.selectProject(e, t);
|
|
2608
|
-
return;
|
|
2609
|
-
}
|
|
2610
|
-
await this.selectProject(void 0) && (this.#o.loaded && !this.#o.$.failed.value || await this.reloadProjects());
|
|
2527
|
+
async start(e) {
|
|
2528
|
+
this.#b ??= this.#e.watchFlowCatalog(() => void this.reloadFlows()), await this.reloadFlows(), await this.selectFlow(e);
|
|
2611
2529
|
}
|
|
2612
|
-
async
|
|
2530
|
+
async reloadFlows() {
|
|
2613
2531
|
await this.#o.reload();
|
|
2614
2532
|
}
|
|
2615
|
-
async
|
|
2533
|
+
async loadMoreFlows() {
|
|
2616
2534
|
await this.#o.loadMore();
|
|
2617
2535
|
}
|
|
2618
|
-
async
|
|
2619
|
-
if (!this.#
|
|
2620
|
-
this.#
|
|
2621
|
-
let
|
|
2622
|
-
if (this.#n.invalidate(), this.#t.reset(), this.#a.reset(), this.#f = 0, this.#h = !1, this.#g = !1, this.#v = !1, this.#
|
|
2536
|
+
async selectFlow(e) {
|
|
2537
|
+
if (!this.#F()) return !1;
|
|
2538
|
+
this.#M();
|
|
2539
|
+
let t = this.#o.beginSelection();
|
|
2540
|
+
if (this.#n.invalidate(), this.#t.reset(), this.#a.reset(), this.#f = 0, this.#h = !1, this.#g = !1, this.#v = !1, this.#x?.(), this.#x = void 0, this.#B({
|
|
2623
2541
|
checkLoading: !1,
|
|
2624
2542
|
diagnosticFocus: void 0,
|
|
2625
2543
|
diagnostics: void 0,
|
|
2626
2544
|
draft: void 0,
|
|
2627
|
-
|
|
2545
|
+
live: void 0,
|
|
2628
2546
|
moduleEditor: void 0,
|
|
2629
2547
|
nodeFocus: void 0,
|
|
2630
2548
|
presentation: void 0,
|
|
2631
|
-
|
|
2549
|
+
flowId: e,
|
|
2632
2550
|
selectedNodeIds: [],
|
|
2633
|
-
target:
|
|
2634
|
-
id: t,
|
|
2635
|
-
kind: "flow"
|
|
2636
|
-
},
|
|
2551
|
+
target: e == null ? void 0 : { kind: "flow" },
|
|
2637
2552
|
workspaceLoadFailed: !1,
|
|
2638
2553
|
workspaceLoading: e != null
|
|
2639
2554
|
}), e == null) return !0;
|
|
2640
2555
|
try {
|
|
2641
|
-
let
|
|
2642
|
-
|
|
2556
|
+
let n = this.#o.flow(e), [r, i, a, o] = await Promise.all([
|
|
2557
|
+
n ?? this.#e.getFlow(e),
|
|
2643
2558
|
this.#e.getDraft(e),
|
|
2644
|
-
this.#e.
|
|
2559
|
+
this.#e.getLive(e),
|
|
2645
2560
|
this.#e.getPresentation(e)
|
|
2646
2561
|
]);
|
|
2647
|
-
if (!
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
draft: a,
|
|
2654
|
-
flows: o,
|
|
2655
|
-
presentation: s,
|
|
2656
|
-
target: l,
|
|
2562
|
+
if (!t()) return !1;
|
|
2563
|
+
this.#t.reset(i), this.#a.reset(o), this.#o.include(r), this.#B({
|
|
2564
|
+
draft: i,
|
|
2565
|
+
live: a,
|
|
2566
|
+
presentation: o,
|
|
2567
|
+
target: { kind: "flow" },
|
|
2657
2568
|
workspaceLoadFailed: !1,
|
|
2658
2569
|
workspaceLoading: !1
|
|
2659
|
-
}), this.#
|
|
2660
|
-
!this.#_ && e != this.#t.committed?.revisionId && this.#
|
|
2570
|
+
}), this.#E(), this.#x = this.#e.watchFlow(e, (e) => {
|
|
2571
|
+
!this.#_ && e != this.#t.committed?.revisionId && this.#D(e);
|
|
2661
2572
|
}, this.#s);
|
|
2662
2573
|
} catch (e) {
|
|
2663
|
-
return
|
|
2574
|
+
return t() ? (this.#B({
|
|
2664
2575
|
workspaceLoadFailed: !0,
|
|
2665
2576
|
workspaceLoading: !1
|
|
2666
|
-
}), this.#c(
|
|
2577
|
+
}), this.#c(u(e, this.#r.t)), !1) : !1;
|
|
2667
2578
|
}
|
|
2668
2579
|
return !0;
|
|
2669
2580
|
}
|
|
2670
2581
|
selectTarget(e) {
|
|
2671
|
-
return this.#
|
|
2582
|
+
return this.#F() ? (this.#M(), this.#B({
|
|
2672
2583
|
diagnosticFocus: void 0,
|
|
2673
2584
|
diagnostics: void 0,
|
|
2674
2585
|
moduleEditor: void 0,
|
|
2675
2586
|
nodeFocus: void 0,
|
|
2676
2587
|
selectedNodeIds: [],
|
|
2677
2588
|
target: e
|
|
2678
|
-
}), this.#
|
|
2589
|
+
}), this.#E(), !0) : !1;
|
|
2679
2590
|
}
|
|
2680
2591
|
selectNodes(e) {
|
|
2681
|
-
return e.length == this.#l.value.selectedNodeIds.length && e.every((e, t) => e == this.#l.value.selectedNodeIds[t]) ? !0 : this.#
|
|
2592
|
+
return e.length == this.#l.value.selectedNodeIds.length && e.every((e, t) => e == this.#l.value.selectedNodeIds[t]) ? !0 : this.#F() ? (this.#M(), this.#B({
|
|
2682
2593
|
diagnosticFocus: void 0,
|
|
2683
|
-
moduleEditor:
|
|
2594
|
+
moduleEditor: Q(this.#l.value.draft == null ? void 0 : h(this.#l.value.draft), this.#l.value.target, e),
|
|
2684
2595
|
nodeFocus: void 0,
|
|
2685
2596
|
selectedNodeIds: e
|
|
2686
2597
|
}), !0) : !1;
|
|
2687
2598
|
}
|
|
2688
|
-
async
|
|
2689
|
-
if (this.#
|
|
2690
|
-
this.#
|
|
2599
|
+
async createFlow(e) {
|
|
2600
|
+
if (this.#F()) {
|
|
2601
|
+
this.#B({ busy: "flow" }), this.#c(void 0);
|
|
2691
2602
|
try {
|
|
2692
2603
|
return await this.#o.create(e);
|
|
2693
2604
|
} catch (e) {
|
|
2694
|
-
this.#_ || this.#c(
|
|
2605
|
+
this.#_ || this.#c(u(e, this.#r.t));
|
|
2695
2606
|
} finally {
|
|
2696
|
-
this.#
|
|
2607
|
+
this.#B({ busy: void 0 });
|
|
2697
2608
|
}
|
|
2698
2609
|
}
|
|
2699
2610
|
}
|
|
2700
|
-
async
|
|
2701
|
-
if (!this.#
|
|
2702
|
-
let t = this.#o.
|
|
2611
|
+
async deleteFlow(e) {
|
|
2612
|
+
if (!this.#F()) return !1;
|
|
2613
|
+
let t = this.#o.flow(e);
|
|
2703
2614
|
if (t == null || t.status == "retiring") return !1;
|
|
2704
|
-
this.#
|
|
2615
|
+
this.#B({ busy: "flow" }), this.#c(void 0);
|
|
2705
2616
|
try {
|
|
2706
|
-
return await this.#e.
|
|
2617
|
+
return await this.#e.deleteFlow(e), !this.#_ && (this.#o.remove(e), this.#c({
|
|
2707
2618
|
kind: "success",
|
|
2708
|
-
message: this.#r.t("notice.
|
|
2619
|
+
message: this.#r.t("notice.flowDeleteAccepted", { name: t.name })
|
|
2709
2620
|
}), !0);
|
|
2710
2621
|
} catch (e) {
|
|
2711
|
-
return this.#_ || this.#c(
|
|
2622
|
+
return this.#_ || this.#c(u(e, this.#r.t)), !1;
|
|
2712
2623
|
} finally {
|
|
2713
|
-
this.#
|
|
2624
|
+
this.#B({ busy: void 0 });
|
|
2714
2625
|
}
|
|
2715
2626
|
}
|
|
2716
|
-
async createResource(e
|
|
2717
|
-
if (!this.#
|
|
2718
|
-
let
|
|
2719
|
-
this.#
|
|
2720
|
-
let
|
|
2721
|
-
return this.#
|
|
2722
|
-
id:
|
|
2723
|
-
kind:
|
|
2627
|
+
async createResource(e) {
|
|
2628
|
+
if (!this.#F() || this.#l.value.draft == null) return !1;
|
|
2629
|
+
let t = this.#i();
|
|
2630
|
+
this.#B({ busy: "resource" }), this.#c(void 0);
|
|
2631
|
+
let n = await this.#C(ze(t, e), !1);
|
|
2632
|
+
return this.#B({ busy: void 0 }), n != null && (this.selectTarget({
|
|
2633
|
+
id: t,
|
|
2634
|
+
kind: "subflow"
|
|
2724
2635
|
}), this.#c({
|
|
2725
2636
|
kind: "success",
|
|
2726
|
-
message: this.#r.t("notice.createdInDraft", { name:
|
|
2637
|
+
message: this.#r.t("notice.createdInDraft", { name: e })
|
|
2727
2638
|
}), !0);
|
|
2728
2639
|
}
|
|
2729
2640
|
async renameFlow(e, t) {
|
|
2730
|
-
let n = this
|
|
2641
|
+
let n = this.#o.flow(e), r = t.trim();
|
|
2731
2642
|
if (n == null || r.length == 0) return !1;
|
|
2732
2643
|
if (n.name == r) return !0;
|
|
2733
|
-
this.#
|
|
2734
|
-
let i
|
|
2735
|
-
|
|
2644
|
+
this.#B({ busy: "flow" }), this.#c(void 0);
|
|
2645
|
+
let i;
|
|
2646
|
+
try {
|
|
2647
|
+
i = await this.#e.renameFlow(e, r), i != null && this.#o.include(i);
|
|
2648
|
+
} catch (e) {
|
|
2649
|
+
this.#_ || this.#c(u(e, this.#r.t));
|
|
2650
|
+
}
|
|
2651
|
+
return this.#B({ busy: void 0 }), i != null && (this.#c({
|
|
2736
2652
|
kind: "success",
|
|
2737
2653
|
message: this.#r.t("notice.flowRenamed", { name: r })
|
|
2738
2654
|
}), !0);
|
|
2739
2655
|
}
|
|
2740
|
-
async deleteFlow(e) {
|
|
2741
|
-
let t = this.#l.value.flows.find((t) => t.flowId == e);
|
|
2742
|
-
if (t?.draft == null || this.#l.value.target?.kind == "flow" && this.#l.value.target.id == e && !this.#P()) return !1;
|
|
2743
|
-
this.#z({ busy: "resource" }), this.#c(void 0);
|
|
2744
|
-
let n = await this.#S(De(e), !1);
|
|
2745
|
-
return this.#z({ busy: void 0 }), n != null && (this.#c({
|
|
2746
|
-
kind: "success",
|
|
2747
|
-
message: this.#r.t("notice.flowDeleted", { name: t.draft.name })
|
|
2748
|
-
}), !0);
|
|
2749
|
-
}
|
|
2750
2656
|
async addNode(e, t, n) {
|
|
2751
|
-
if (!this.#
|
|
2657
|
+
if (!this.#F()) return;
|
|
2752
2658
|
let r = this.#l.value.draft, i = this.#l.value.target;
|
|
2753
2659
|
if (r == null || i == null) return;
|
|
2754
2660
|
let a = this.#i();
|
|
2755
|
-
if (e.kind == "comment") return await this.#
|
|
2756
|
-
let o =
|
|
2661
|
+
if (e.kind == "comment") return await this.#S(i, a, t);
|
|
2662
|
+
let o = h(r), s = b(e, o, i, this.#r.t);
|
|
2757
2663
|
if (s == null) return;
|
|
2758
|
-
let c =
|
|
2664
|
+
let c = Be(o, i, a, s, this.#i);
|
|
2759
2665
|
if (c == null) return;
|
|
2760
|
-
let l = n == null ? c : [...c, ...R(
|
|
2666
|
+
let l = n == null ? c : [...c, ...R(K(r, c).content, i, n(a))], u = this.#C(l);
|
|
2761
2667
|
this.selectNodes([a]);
|
|
2762
2668
|
let d = this.moveNodes({ [a]: t });
|
|
2763
2669
|
if (await u != null) return await d, a;
|
|
@@ -2766,19 +2672,19 @@ var Dt = class {
|
|
|
2766
2672
|
let t = this.$.revision.value, n = this.#l.value.target;
|
|
2767
2673
|
if (t == null || n == null) return;
|
|
2768
2674
|
let r = R(t.revision.content, n, e);
|
|
2769
|
-
r.length > 0 && await this.#
|
|
2675
|
+
r.length > 0 && await this.#C(r);
|
|
2770
2676
|
}
|
|
2771
2677
|
async disconnect(e) {
|
|
2772
2678
|
let t = this.$.revision.value, n = this.#l.value.target;
|
|
2773
2679
|
if (t == null || n == null) return;
|
|
2774
|
-
let r =
|
|
2775
|
-
r.length > 0 && await this.#
|
|
2680
|
+
let r = Se(t.revision.content, n, e);
|
|
2681
|
+
r.length > 0 && await this.#C(r);
|
|
2776
2682
|
}
|
|
2777
2683
|
async deleteSelectedNodes() {
|
|
2778
|
-
if (!this.#
|
|
2684
|
+
if (!this.#F()) return;
|
|
2779
2685
|
let e = this.$.revision.value, t = this.#l.value.target;
|
|
2780
2686
|
if (e == null || t == null || this.#l.value.selectedNodeIds.length == 0) return;
|
|
2781
|
-
let n =
|
|
2687
|
+
let n = g(this.#l.value.presentation?.value ?? {}, t), r = new Set(this.#l.value.selectedNodeIds.filter((e) => n.has(e))), i = Ve(e, t, this.#l.value.selectedNodeIds), a = i.length == 0 ? void 0 : this.#C(i), o = r.size == 0 ? void 0 : this.#T((e) => f(e, t, r));
|
|
2782
2688
|
this.selectNodes([]), (a == null || await a != null) && await o;
|
|
2783
2689
|
}
|
|
2784
2690
|
copySelectedNodes() {
|
|
@@ -2786,33 +2692,33 @@ var Dt = class {
|
|
|
2786
2692
|
if (e == null || t == null || this.#l.value.selectedNodeIds.length == 0) return;
|
|
2787
2693
|
let n = new Set(this.#l.value.selectedNodeIds);
|
|
2788
2694
|
this.#u = {
|
|
2789
|
-
comments: this.#
|
|
2695
|
+
comments: this.#P().nodes.flatMap((e) => e.kind == "comment" && n.has(e.id) ? [{
|
|
2790
2696
|
content: e.content,
|
|
2791
2697
|
position: e.position,
|
|
2792
2698
|
sourceId: e.id,
|
|
2793
2699
|
title: e.title
|
|
2794
2700
|
}] : []),
|
|
2795
|
-
nodes:
|
|
2701
|
+
nodes: He(e, t, this.#l.value.selectedNodeIds)
|
|
2796
2702
|
};
|
|
2797
2703
|
}
|
|
2798
|
-
async pasteNodes() {
|
|
2799
|
-
if (!this.#
|
|
2800
|
-
let
|
|
2801
|
-
if (
|
|
2802
|
-
let
|
|
2704
|
+
async pasteNodes(e) {
|
|
2705
|
+
if (!this.#F()) return;
|
|
2706
|
+
let t = this.$.revision.value, n = this.#l.value.target;
|
|
2707
|
+
if (t == null || n == null || this.#u == null) return;
|
|
2708
|
+
let r = Ue(t, n, this.#u.nodes, this.#i), i = r.changes.length == 0 ? void 0 : this.#C(r.changes), a = this.#u.comments.map((e) => ({
|
|
2803
2709
|
...e,
|
|
2804
2710
|
nodeId: this.#i()
|
|
2805
2711
|
}));
|
|
2806
|
-
if (
|
|
2807
|
-
let
|
|
2808
|
-
let
|
|
2809
|
-
return [
|
|
2810
|
-
x: (
|
|
2811
|
-
y: (
|
|
2712
|
+
if (r.nodeIds.length == 0 && a.length == 0) return;
|
|
2713
|
+
let o = new Map(this.#P().nodes.map((e) => [e.id, e])), s = Object.fromEntries(r.sourceIds.map((t, n) => {
|
|
2714
|
+
let i = e?.[t] ?? o.get(t)?.position;
|
|
2715
|
+
return [r.nodeIds[n], {
|
|
2716
|
+
x: (i?.x ?? 80) + 40,
|
|
2717
|
+
y: (i?.y ?? 80) + 40
|
|
2812
2718
|
}];
|
|
2813
|
-
})),
|
|
2814
|
-
let
|
|
2815
|
-
for (let e of
|
|
2719
|
+
})), c = this.#T((e) => {
|
|
2720
|
+
let t = p(e, n, s);
|
|
2721
|
+
for (let e of a) t = _(t, n, e.nodeId, {
|
|
2816
2722
|
content: e.content,
|
|
2817
2723
|
position: {
|
|
2818
2724
|
x: e.position.x + 40,
|
|
@@ -2820,48 +2726,60 @@ var Dt = class {
|
|
|
2820
2726
|
},
|
|
2821
2727
|
title: this.#r.t("addNode.commentCopy", { title: e.title })
|
|
2822
2728
|
});
|
|
2823
|
-
return
|
|
2729
|
+
return t;
|
|
2824
2730
|
});
|
|
2825
|
-
this.selectNodes([...
|
|
2731
|
+
this.selectNodes([...r.nodeIds, ...a.map((e) => e.nodeId)]), (i == null || await i != null) && await c;
|
|
2826
2732
|
}
|
|
2827
|
-
async duplicateSelectedNodes() {
|
|
2828
|
-
this.copySelectedNodes(), await this.pasteNodes();
|
|
2733
|
+
async duplicateSelectedNodes(e) {
|
|
2734
|
+
this.copySelectedNodes(), await this.pasteNodes(e);
|
|
2829
2735
|
}
|
|
2830
2736
|
async saveNodeSettings(e, t) {
|
|
2831
2737
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2832
2738
|
if (n == null || r == null) return !1;
|
|
2833
|
-
let i =
|
|
2834
|
-
return i != null && await this.#
|
|
2739
|
+
let i = We(n, r, e, t);
|
|
2740
|
+
return i != null && await this.#C(i) != null;
|
|
2835
2741
|
}
|
|
2836
2742
|
async saveNodeDescription(e, t) {
|
|
2837
2743
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2838
2744
|
if (n == null || r == null) return !1;
|
|
2839
|
-
let i =
|
|
2840
|
-
return i != null && await this.#
|
|
2745
|
+
let i = Ge(n, r, e, t);
|
|
2746
|
+
return i != null && await this.#C(i) != null;
|
|
2747
|
+
}
|
|
2748
|
+
async saveNodeIcon(e, t) {
|
|
2749
|
+
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2750
|
+
if (n == null || r == null) return !1;
|
|
2751
|
+
let i = Ke(n, r, e, t);
|
|
2752
|
+
return i != null && await this.#C(i) != null;
|
|
2753
|
+
}
|
|
2754
|
+
async saveNodeTitle(e, t) {
|
|
2755
|
+
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2756
|
+
if (n == null || r == null) return !1;
|
|
2757
|
+
let i = qe(n, r, e, t);
|
|
2758
|
+
return i != null && await this.#C(i) != null;
|
|
2841
2759
|
}
|
|
2842
2760
|
async setInputValue(e, t, n) {
|
|
2843
2761
|
let r = this.$.revision.value, i = this.#l.value.target;
|
|
2844
2762
|
if (r == null || i == null) return !1;
|
|
2845
|
-
let a =
|
|
2846
|
-
return a != null && await this.#
|
|
2763
|
+
let a = Je(r, i, e, t, n);
|
|
2764
|
+
return a != null && await this.#C(a) != null;
|
|
2847
2765
|
}
|
|
2848
2766
|
async saveCondition(e, t) {
|
|
2849
2767
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2850
2768
|
if (n == null || r == null) return !1;
|
|
2851
|
-
let i =
|
|
2852
|
-
return i != null && await this.#
|
|
2769
|
+
let i = Ye(n, r, e, t);
|
|
2770
|
+
return i != null && await this.#C(i) != null;
|
|
2853
2771
|
}
|
|
2854
2772
|
async saveValue(e, t) {
|
|
2855
2773
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2856
2774
|
if (n == null || r == null) return !1;
|
|
2857
|
-
let i =
|
|
2858
|
-
return i != null && await this.#
|
|
2775
|
+
let i = Xe(n, r, e, t);
|
|
2776
|
+
return i != null && await this.#C(i) != null;
|
|
2859
2777
|
}
|
|
2860
2778
|
async saveComment(e, t) {
|
|
2861
2779
|
let n = this.#l.value.target;
|
|
2862
2780
|
if (n == null) return;
|
|
2863
|
-
let r = this.#
|
|
2864
|
-
r != null && await this.#
|
|
2781
|
+
let r = this.#P().nodes.find((t) => t.id == e)?.position;
|
|
2782
|
+
r != null && await this.#T((i) => _(i, n, e, {
|
|
2865
2783
|
...t,
|
|
2866
2784
|
position: r
|
|
2867
2785
|
}));
|
|
@@ -2869,60 +2787,60 @@ var Dt = class {
|
|
|
2869
2787
|
async saveTaskSettings(e, t) {
|
|
2870
2788
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2871
2789
|
if (n == null || r == null) return !1;
|
|
2872
|
-
let i =
|
|
2873
|
-
return i != null && await this.#
|
|
2790
|
+
let i = Ze(n, r, e, t);
|
|
2791
|
+
return i != null && await this.#C(i) != null;
|
|
2874
2792
|
}
|
|
2875
2793
|
async saveCodeTaskPorts(e, t) {
|
|
2876
2794
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2877
2795
|
if (n == null || r == null) return !1;
|
|
2878
|
-
let i =
|
|
2879
|
-
return i != null && await this.#
|
|
2796
|
+
let i = Qe(n, r, e, t);
|
|
2797
|
+
return i != null && await this.#C(i) != null;
|
|
2880
2798
|
}
|
|
2881
2799
|
async setConnectorConnection(e, t) {
|
|
2882
2800
|
let n = this.$.revision.value;
|
|
2883
2801
|
if (n == null) return !1;
|
|
2884
|
-
let r =
|
|
2885
|
-
return r != null && await this.#
|
|
2802
|
+
let r = Pe(n.revision.content, e, t);
|
|
2803
|
+
return r != null && await this.#C(r) != null;
|
|
2886
2804
|
}
|
|
2887
2805
|
async saveTriggerSettings(e, t) {
|
|
2888
2806
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2889
2807
|
if (n == null || r?.kind != "flow") return !1;
|
|
2890
|
-
let i =
|
|
2891
|
-
return i != null && await this.#
|
|
2808
|
+
let i = Fe(n.revision.content, r, e, t);
|
|
2809
|
+
return i != null && await this.#C(i) != null;
|
|
2892
2810
|
}
|
|
2893
2811
|
async saveTriggerConfig(e, t, n) {
|
|
2894
2812
|
let r = this.$.revision.value, i = this.#l.value.target;
|
|
2895
2813
|
if (r == null || i?.kind != "flow") return !1;
|
|
2896
|
-
let a =
|
|
2897
|
-
return a != null && await this.#
|
|
2814
|
+
let a = Ie(r.revision.content, i, e, t, n);
|
|
2815
|
+
return a != null && await this.#C(a) != null;
|
|
2898
2816
|
}
|
|
2899
2817
|
async saveTriggerSchedule(e, t) {
|
|
2900
2818
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2901
2819
|
if (n == null || r?.kind != "flow") return !1;
|
|
2902
|
-
let i =
|
|
2903
|
-
return i != null && await this.#
|
|
2820
|
+
let i = Le(n.revision.content, r, e, t);
|
|
2821
|
+
return i != null && await this.#C(i) != null;
|
|
2904
2822
|
}
|
|
2905
2823
|
async saveWebhook(e, t) {
|
|
2906
2824
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2907
2825
|
if (n == null || r?.kind != "flow") return !1;
|
|
2908
|
-
let i =
|
|
2909
|
-
return i != null && await this.#
|
|
2826
|
+
let i = $e(n, r, e, t);
|
|
2827
|
+
return i != null && await this.#C(i) != null;
|
|
2910
2828
|
}
|
|
2911
2829
|
async setTriggerConnection(e, t) {
|
|
2912
2830
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2913
2831
|
if (n == null || r?.kind != "flow") return !1;
|
|
2914
|
-
let i =
|
|
2915
|
-
return i != null && await this.#
|
|
2832
|
+
let i = Re(n.revision.content, r, e, t);
|
|
2833
|
+
return i != null && await this.#C(i) != null;
|
|
2916
2834
|
}
|
|
2917
2835
|
async saveSubflowSettings(e, t) {
|
|
2918
2836
|
let n = this.$.revision.value;
|
|
2919
2837
|
if (n == null) return !1;
|
|
2920
|
-
let r =
|
|
2921
|
-
return r != null && await this.#
|
|
2838
|
+
let r = et(n, e, t);
|
|
2839
|
+
return r != null && await this.#C(r) != null;
|
|
2922
2840
|
}
|
|
2923
2841
|
updateModuleSource(e) {
|
|
2924
2842
|
let t = this.#l.value.moduleEditor;
|
|
2925
|
-
t != null && t.source != e && this.#
|
|
2843
|
+
t != null && t.source != e && this.#B({ moduleEditor: {
|
|
2926
2844
|
...t,
|
|
2927
2845
|
phase: void 0,
|
|
2928
2846
|
source: e
|
|
@@ -2933,10 +2851,10 @@ var Dt = class {
|
|
|
2933
2851
|
if (e == null) return;
|
|
2934
2852
|
let t = this.#l.value.draft?.content.modules[e.moduleId];
|
|
2935
2853
|
if (t == null) {
|
|
2936
|
-
this.#
|
|
2854
|
+
this.#B({ moduleEditor: void 0 });
|
|
2937
2855
|
return;
|
|
2938
2856
|
}
|
|
2939
|
-
this.#
|
|
2857
|
+
this.#B({ moduleEditor: {
|
|
2940
2858
|
moduleId: e.moduleId,
|
|
2941
2859
|
source: t.source
|
|
2942
2860
|
} });
|
|
@@ -2944,311 +2862,298 @@ var Dt = class {
|
|
|
2944
2862
|
async saveModuleEditor() {
|
|
2945
2863
|
let e = this.#l.value.moduleEditor;
|
|
2946
2864
|
if (e == null || e.phase == "saving") return !1;
|
|
2947
|
-
this.#
|
|
2865
|
+
this.#B({ moduleEditor: {
|
|
2948
2866
|
...e,
|
|
2949
2867
|
phase: "saving"
|
|
2950
2868
|
} });
|
|
2951
|
-
let t = await
|
|
2869
|
+
let t = await Ce(e.source);
|
|
2952
2870
|
if (this.#_) return !1;
|
|
2953
|
-
let n = await this.#
|
|
2954
|
-
return !this.#_ && this.#l.value.moduleEditor?.moduleId == e.moduleId && this.#
|
|
2871
|
+
let n = await this.#C(we(e.moduleId, e.source, t));
|
|
2872
|
+
return !this.#_ && this.#l.value.moduleEditor?.moduleId == e.moduleId && this.#B({ moduleEditor: {
|
|
2955
2873
|
...this.#l.value.moduleEditor,
|
|
2956
2874
|
phase: n == null ? "failed" : void 0
|
|
2957
2875
|
} }), n != null;
|
|
2958
2876
|
}
|
|
2959
|
-
async moveNodes(e) {
|
|
2960
|
-
let
|
|
2961
|
-
|
|
2877
|
+
async moveNodes(e, t = "detail") {
|
|
2878
|
+
let n = this.#l.value.target;
|
|
2879
|
+
n != null && await this.#T((r) => p(r, n, e, t));
|
|
2962
2880
|
}
|
|
2963
|
-
async moveViewport(e) {
|
|
2964
|
-
let
|
|
2965
|
-
if (
|
|
2966
|
-
let
|
|
2967
|
-
(
|
|
2881
|
+
async moveViewport(e, t = "detail") {
|
|
2882
|
+
let n = this.#l.value.target;
|
|
2883
|
+
if (n == null) return;
|
|
2884
|
+
let r = this.#P().viewport;
|
|
2885
|
+
(r.x != e.x || r.y != e.y || r.zoom != e.zoom) && this.#M(), await this.#T((r) => te(r, n, e, t));
|
|
2968
2886
|
}
|
|
2969
2887
|
async check() {
|
|
2970
|
-
await this.#
|
|
2888
|
+
await this.#E();
|
|
2971
2889
|
}
|
|
2972
2890
|
async refreshFlows() {
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2891
|
+
await this.reloadFlows();
|
|
2892
|
+
}
|
|
2893
|
+
updateLive(e) {
|
|
2894
|
+
e.flowId == this.#l.value.flowId && this.#B({ live: e });
|
|
2977
2895
|
}
|
|
2978
2896
|
locateNode(e) {
|
|
2979
2897
|
let t = this.$.revision.value, n = this.#l.value.target;
|
|
2980
|
-
return t == null || n == null || t.node(n, e) == null || !this.selectNodes([e]) ? !1 : (this.#
|
|
2898
|
+
return t == null || n == null || t.node(n, e) == null || !this.selectNodes([e]) ? !1 : (this.#B({ nodeFocus: {
|
|
2981
2899
|
nodeId: e,
|
|
2982
2900
|
requestId: ++this.#y
|
|
2983
2901
|
} }), !0);
|
|
2984
2902
|
}
|
|
2985
2903
|
locateDiagnostic(e) {
|
|
2986
|
-
return e.location == null || !this.selectNodes([e.location.nodeId]) ? !1 : (this.#
|
|
2904
|
+
return e.location == null || !this.selectNodes([e.location.nodeId]) ? !1 : (this.#B({ diagnosticFocus: {
|
|
2987
2905
|
...e.location,
|
|
2988
2906
|
diagnostic: e.diagnostic,
|
|
2989
2907
|
requestId: ++this.#d
|
|
2990
2908
|
} }), !0);
|
|
2991
2909
|
}
|
|
2992
|
-
async #
|
|
2993
|
-
let r = Math.max(0, ...this.#
|
|
2910
|
+
async #S(e, t, n) {
|
|
2911
|
+
let r = Math.max(0, ...this.#P().nodes.flatMap((e) => {
|
|
2994
2912
|
if (e.kind != "comment") return [];
|
|
2995
2913
|
let t = /#(\d+)$/.exec(e.title);
|
|
2996
2914
|
return t == null ? [] : [Number(t[1])];
|
|
2997
|
-
})), i = this.#
|
|
2915
|
+
})), i = this.#T((i) => _(i, e, t, {
|
|
2998
2916
|
content: "",
|
|
2999
2917
|
position: n,
|
|
3000
2918
|
title: this.#r.t("addNode.commentName", { number: r + 1 })
|
|
3001
2919
|
}));
|
|
3002
2920
|
if (this.selectNodes([t]), await i, !this.#_) return t;
|
|
3003
2921
|
}
|
|
3004
|
-
async #
|
|
3005
|
-
let n = this.#l.value.
|
|
2922
|
+
async #C(e, t = !0) {
|
|
2923
|
+
let n = this.#l.value.flowId, r = this.#l.value.draft;
|
|
3006
2924
|
if (n != null && r != null) return await this.#t.change({
|
|
3007
2925
|
current: this.#n.capture(),
|
|
3008
|
-
|
|
2926
|
+
flowId: n
|
|
3009
2927
|
}, r, e, t);
|
|
3010
2928
|
}
|
|
3011
|
-
#
|
|
3012
|
-
let
|
|
3013
|
-
return this.#
|
|
3014
|
-
diagnostics:
|
|
2929
|
+
#w(e, t = !1) {
|
|
2930
|
+
let n = this.#l.value.draft, { revision: r, selectedNodeIds: i, target: a } = this.#I(e), o = this.#l.value.moduleEditor;
|
|
2931
|
+
return this.#B({
|
|
2932
|
+
diagnostics: t ? this.#l.value.diagnostics : void 0,
|
|
3015
2933
|
draft: e,
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
}), a;
|
|
2934
|
+
moduleEditor: o != null && n != null && Z(n, o) != "saved" ? o : Q(r, a, i),
|
|
2935
|
+
selectedNodeIds: i,
|
|
2936
|
+
target: a
|
|
2937
|
+
}), r;
|
|
3021
2938
|
}
|
|
3022
|
-
async #
|
|
2939
|
+
async #T(e) {
|
|
3023
2940
|
if (this.#_) return;
|
|
3024
|
-
let t = this.#l.value.
|
|
2941
|
+
let t = this.#l.value.flowId, n = this.#l.value.presentation;
|
|
3025
2942
|
t != null && n != null && await this.#a.change(t, n, this.#o.capture(), e);
|
|
3026
2943
|
}
|
|
3027
|
-
async #
|
|
2944
|
+
async #E() {
|
|
3028
2945
|
if (this.#_) return;
|
|
3029
|
-
let e = this.#l.value.
|
|
2946
|
+
let e = this.#l.value.flowId, t = this.#l.value.draft, n = this.#l.value.target;
|
|
3030
2947
|
if (e == null || t == null || n == null) {
|
|
3031
|
-
n ?? this.#
|
|
3032
|
-
checkLoading: !1,
|
|
3033
|
-
diagnostics: void 0
|
|
3034
|
-
});
|
|
3035
|
-
return;
|
|
3036
|
-
}
|
|
3037
|
-
let r = We(f(t), n);
|
|
3038
|
-
if (r == null) {
|
|
3039
|
-
this.#z({
|
|
2948
|
+
n ?? this.#B({
|
|
3040
2949
|
checkLoading: !1,
|
|
3041
2950
|
diagnostics: void 0
|
|
3042
2951
|
});
|
|
3043
2952
|
return;
|
|
3044
2953
|
}
|
|
3045
|
-
this.#
|
|
2954
|
+
this.#B({
|
|
3046
2955
|
checkLoading: !0,
|
|
3047
2956
|
diagnosticFocus: void 0
|
|
3048
2957
|
});
|
|
3049
2958
|
try {
|
|
3050
|
-
let n = await this.#e.checkFlow(e, t.revisionId
|
|
3051
|
-
!this.#_ && e == this.#l.value.
|
|
2959
|
+
let n = await this.#e.checkFlow(e, t.revisionId);
|
|
2960
|
+
!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#B({ diagnostics: n });
|
|
3052
2961
|
} catch (n) {
|
|
3053
|
-
!this.#_ && e == this.#l.value.
|
|
2962
|
+
!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#c(u(n, this.#r.t));
|
|
3054
2963
|
} finally {
|
|
3055
|
-
!this.#_ && e == this.#l.value.
|
|
2964
|
+
!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#B({ checkLoading: !1 });
|
|
3056
2965
|
}
|
|
3057
2966
|
}
|
|
3058
|
-
async #
|
|
2967
|
+
async #D(e) {
|
|
3059
2968
|
if (this.#_) return;
|
|
3060
|
-
let t = this.#l.value.
|
|
2969
|
+
let t = this.#l.value.flowId;
|
|
3061
2970
|
if (t == null || (this.#f += 1, e != null && (this.#g = !0, this.#t.changing || (this.#h = !0)), this.#v)) return;
|
|
3062
2971
|
this.#v = !0;
|
|
3063
2972
|
let n = {
|
|
3064
2973
|
current: this.#n.capture(),
|
|
3065
|
-
|
|
2974
|
+
flowId: t
|
|
3066
2975
|
};
|
|
3067
2976
|
await this.#t.enqueue(async () => {
|
|
3068
2977
|
let e;
|
|
3069
2978
|
do {
|
|
3070
2979
|
e = this.#f;
|
|
3071
2980
|
let t = this.#h, r = this.#m, i = this.#g;
|
|
3072
|
-
this.#h = !1, this.#g = !1, await this.#
|
|
3073
|
-
} while (this.#
|
|
3074
|
-
}), this.#
|
|
2981
|
+
this.#h = !1, this.#g = !1, await this.#O(n, !1, i, t, r);
|
|
2982
|
+
} while (this.#z(n) && e != this.#f);
|
|
2983
|
+
}), this.#z(n) && (this.#v = !1);
|
|
3075
2984
|
}
|
|
3076
|
-
async #
|
|
2985
|
+
async #O(e, t, n = !1, r = !1, i = this.#m) {
|
|
3077
2986
|
try {
|
|
3078
2987
|
let t = r ? this.#l.value.target : void 0, a = this.#t.committed;
|
|
3079
2988
|
if (a == null) return !1;
|
|
3080
|
-
let o = await this.#e.syncDraft(e.
|
|
3081
|
-
if (!this.#
|
|
2989
|
+
let o = await this.#e.syncDraft(e.flowId, a.revisionId);
|
|
2990
|
+
if (!this.#z(e)) return !1;
|
|
3082
2991
|
if (o.kind == "changes" && o.revisions.length == 0) return !0;
|
|
3083
2992
|
let s;
|
|
3084
2993
|
try {
|
|
3085
|
-
s = this.#
|
|
2994
|
+
s = this.#k(a, o);
|
|
3086
2995
|
} catch {
|
|
3087
|
-
if (o = await this.#e.syncDraft(e.
|
|
3088
|
-
s = this.#
|
|
2996
|
+
if (o = await this.#e.syncDraft(e.flowId), !this.#z(e)) return !1;
|
|
2997
|
+
s = this.#k(a, o);
|
|
3089
2998
|
}
|
|
3090
2999
|
if (s.revisionId == a.revisionId) return !0;
|
|
3091
|
-
let c = o.kind == "changes" && t != null ?
|
|
3092
|
-
o.kind == "snapshot" && this.#
|
|
3093
|
-
let l = this.#
|
|
3094
|
-
return this.#
|
|
3095
|
-
kind:
|
|
3096
|
-
message: this.#r.t(
|
|
3097
|
-
}),
|
|
3000
|
+
let c = o.kind == "changes" && t != null ? it(h(a), h(s), t, o.revisions.flatMap((e) => e.operations)) : void 0;
|
|
3001
|
+
o.kind == "snapshot" && this.#M();
|
|
3002
|
+
let l = this.#L(s, !1);
|
|
3003
|
+
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({
|
|
3004
|
+
kind: l ? "error" : "success",
|
|
3005
|
+
message: this.#r.t(l ? "notice.moduleUpdated" : "notice.draftUpdated")
|
|
3006
|
+
}), this.#E()), !0;
|
|
3098
3007
|
} catch (n) {
|
|
3099
|
-
return t && this.#
|
|
3008
|
+
return t && this.#z(e) && this.#c(u(n, this.#r.t)), !1;
|
|
3100
3009
|
}
|
|
3101
3010
|
}
|
|
3102
|
-
#
|
|
3011
|
+
#k(e, t) {
|
|
3103
3012
|
if (t.kind == "snapshot") return t.draft;
|
|
3104
3013
|
let n = e;
|
|
3105
3014
|
for (let e of t.revisions) {
|
|
3106
3015
|
if (e.revision.parentRevisionId != n.revisionId) throw Error("Invalid Draft revision chain.");
|
|
3107
3016
|
n = {
|
|
3108
3017
|
...e.revision,
|
|
3109
|
-
content:
|
|
3018
|
+
content: K(n, e.operations).content
|
|
3110
3019
|
};
|
|
3111
3020
|
}
|
|
3112
3021
|
return n;
|
|
3113
3022
|
}
|
|
3114
|
-
#
|
|
3023
|
+
#A(e, t, n, r) {
|
|
3115
3024
|
let i = this.#l.value;
|
|
3116
|
-
if (!this.#
|
|
3025
|
+
if (!this.#z(e) || r != this.#m || !$(i.target, t)) return;
|
|
3117
3026
|
let a = this.#p;
|
|
3118
3027
|
if (a != null) {
|
|
3119
|
-
if (a.
|
|
3120
|
-
this.#
|
|
3028
|
+
if (a.flowId != e.flowId || !$(a.target, t)) {
|
|
3029
|
+
this.#M();
|
|
3121
3030
|
return;
|
|
3122
3031
|
}
|
|
3123
3032
|
for (let e of n) a.targets.add(e);
|
|
3124
|
-
globalThis.clearTimeout(a.timer), a.timer = globalThis.setTimeout(() => this.#
|
|
3033
|
+
globalThis.clearTimeout(a.timer), a.timer = globalThis.setTimeout(() => this.#j(), xt);
|
|
3125
3034
|
return;
|
|
3126
3035
|
}
|
|
3127
3036
|
n.size == 0 || i.selectedNodeIds.length > 0 || (this.#p = {
|
|
3128
3037
|
current: e.current,
|
|
3129
3038
|
generation: r,
|
|
3130
|
-
|
|
3039
|
+
flowId: e.flowId,
|
|
3131
3040
|
target: t,
|
|
3132
3041
|
targets: new Set(n),
|
|
3133
|
-
timer: globalThis.setTimeout(() => this.#
|
|
3134
|
-
viewport: this.#
|
|
3042
|
+
timer: globalThis.setTimeout(() => this.#j(), xt),
|
|
3043
|
+
viewport: this.#P().viewport
|
|
3135
3044
|
});
|
|
3136
3045
|
}
|
|
3137
|
-
#
|
|
3046
|
+
#j() {
|
|
3138
3047
|
let e = this.#p;
|
|
3139
3048
|
if (this.#p = void 0, e == null || !e.current() || e.generation != this.#m) return;
|
|
3140
3049
|
let t = this.#l.value;
|
|
3141
|
-
if (t.
|
|
3142
|
-
let n = this.#
|
|
3050
|
+
if (t.flowId != e.flowId || !$(t.target, e.target) || t.selectedNodeIds.length > 0) return;
|
|
3051
|
+
let n = this.#P().viewport;
|
|
3143
3052
|
if (n.x != e.viewport.x || n.y != e.viewport.y || n.zoom != e.viewport.zoom || t.draft == null) return;
|
|
3144
|
-
let r =
|
|
3145
|
-
i.length == 1 && this.#
|
|
3053
|
+
let r = h(t.draft), i = [...e.targets].filter((t) => r.selection(e.target, t) != null);
|
|
3054
|
+
i.length == 1 && this.#B({ nodeFocus: {
|
|
3146
3055
|
nodeId: i[0],
|
|
3147
3056
|
requestId: ++this.#y
|
|
3148
3057
|
} });
|
|
3149
3058
|
}
|
|
3150
|
-
#
|
|
3059
|
+
#M() {
|
|
3151
3060
|
this.#m += 1, this.#p != null && globalThis.clearTimeout(this.#p.timer), this.#p = void 0;
|
|
3152
3061
|
}
|
|
3153
|
-
#
|
|
3062
|
+
#N(e, t) {
|
|
3154
3063
|
this.#o.advanceHead(e, t);
|
|
3155
3064
|
}
|
|
3156
|
-
#
|
|
3065
|
+
#P() {
|
|
3157
3066
|
let e = this.#l.value;
|
|
3158
|
-
return
|
|
3067
|
+
return y(e.draft, e.target, e.presentation?.value, e.diagnostics?.diagnostics, {}, {}, this.#r.t);
|
|
3159
3068
|
}
|
|
3160
|
-
#
|
|
3069
|
+
#F() {
|
|
3161
3070
|
let e = this.#l.value.moduleEditor;
|
|
3162
|
-
return e == null ||
|
|
3071
|
+
return e == null || Z(this.#l.value.draft, e) == "saved" || (this.#c({
|
|
3163
3072
|
kind: "error",
|
|
3164
3073
|
message: this.#r.t("notice.unsavedCode")
|
|
3165
3074
|
}), !1);
|
|
3166
3075
|
}
|
|
3167
|
-
#
|
|
3168
|
-
let
|
|
3076
|
+
#I(e) {
|
|
3077
|
+
let t = h(e), n = St(t, this.#l.value.target);
|
|
3169
3078
|
return {
|
|
3170
|
-
revision:
|
|
3171
|
-
selectedNodeIds: this.#l.value.selectedNodeIds.filter((e) =>
|
|
3172
|
-
target:
|
|
3079
|
+
revision: t,
|
|
3080
|
+
selectedNodeIds: this.#l.value.selectedNodeIds.filter((e) => n != null && t.selection(n, e) != null),
|
|
3081
|
+
target: n
|
|
3173
3082
|
};
|
|
3174
3083
|
}
|
|
3175
|
-
#
|
|
3084
|
+
#L(e, t) {
|
|
3176
3085
|
this.#t.replaceCommitted(e);
|
|
3177
|
-
let
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
target: u
|
|
3188
|
-
}), a;
|
|
3189
|
-
}
|
|
3190
|
-
#L(e, t, n) {
|
|
3086
|
+
let n = this.#t.project(e), r = this.#l.value.moduleEditor, i = r != null && Z(this.#l.value.draft, r) != "saved", a = this.#I(n), o = a.target;
|
|
3087
|
+
return this.#B({
|
|
3088
|
+
diagnostics: t ? this.#l.value.diagnostics : void 0,
|
|
3089
|
+
draft: n,
|
|
3090
|
+
moduleEditor: this.#R(a.revision, o, a.selectedNodeIds),
|
|
3091
|
+
selectedNodeIds: a.selectedNodeIds,
|
|
3092
|
+
target: o
|
|
3093
|
+
}), i;
|
|
3094
|
+
}
|
|
3095
|
+
#R(e, t, n) {
|
|
3191
3096
|
let r = this.#l.value.moduleEditor;
|
|
3192
|
-
return r == null ||
|
|
3097
|
+
return r == null || Z(this.#l.value.draft, r) == "saved" ? Q(e, t, n) : {
|
|
3193
3098
|
...r,
|
|
3194
3099
|
phase: "failed"
|
|
3195
3100
|
};
|
|
3196
3101
|
}
|
|
3197
|
-
#R(e) {
|
|
3198
|
-
return !this.#_ && e.projectId == this.#l.value.projectId && e.current();
|
|
3199
|
-
}
|
|
3200
3102
|
#z(e) {
|
|
3103
|
+
return !this.#_ && e.flowId == this.#l.value.flowId && e.current();
|
|
3104
|
+
}
|
|
3105
|
+
#B(e) {
|
|
3201
3106
|
this.#_ || this.#l.set(e);
|
|
3202
3107
|
}
|
|
3203
3108
|
};
|
|
3204
3109
|
//#endregion
|
|
3205
3110
|
//#region src/workbench/browser/runtime/stores/workbenchStore.ts
|
|
3206
|
-
function
|
|
3111
|
+
function wt(e) {
|
|
3207
3112
|
return new Map(e.nodes.map((e) => [e.id, e]));
|
|
3208
3113
|
}
|
|
3209
|
-
function
|
|
3210
|
-
return e == null || t == null ? [] :
|
|
3114
|
+
function Tt(e, t) {
|
|
3115
|
+
return e == null || t == null ? [] : h(e).designerInputs(t);
|
|
3211
3116
|
}
|
|
3212
|
-
function
|
|
3213
|
-
if (e == null || t?.kind != "flow" || n?.revisionId != e.revisionId || n.flowId !=
|
|
3214
|
-
let a = r.find((
|
|
3215
|
-
return typeof a == "string" ? new Map(r.flatMap((
|
|
3216
|
-
let n =
|
|
3217
|
-
return
|
|
3117
|
+
function Et(e, t, n, r, i) {
|
|
3118
|
+
if (e == null || t?.kind != "flow" || n?.revisionId != e.revisionId || n.flowId != e.flowId) return /* @__PURE__ */ new Map();
|
|
3119
|
+
let a = r.find((t) => t.kind == "run.started" && t.payload.flowId == e.flowId)?.payload.scopeId;
|
|
3120
|
+
return typeof a == "string" ? new Map(r.flatMap((t) => {
|
|
3121
|
+
let n = t.payload.nodeId;
|
|
3122
|
+
return t.payload.scopeId == a && t.payload.flowId == e.flowId && typeof n == "string" && i.has(n) ? [[t.sequence, n]] : [];
|
|
3218
3123
|
})) : /* @__PURE__ */ new Map();
|
|
3219
3124
|
}
|
|
3220
|
-
var
|
|
3125
|
+
var Dt = { openExternalPage: async () => !1 }, Ot = class {
|
|
3221
3126
|
#e;
|
|
3222
3127
|
#t;
|
|
3223
3128
|
#n;
|
|
3224
3129
|
#r;
|
|
3225
|
-
constructor(r, i, a = () => crypto.randomUUID(), o =
|
|
3226
|
-
this.#e = new
|
|
3130
|
+
constructor(r, i, a = () => crypto.randomUUID(), o = l(), s = Dt) {
|
|
3131
|
+
this.#e = new x(), this.#n = t(), this.#r = !1, this.provideAddNodeOptions = async (e, t) => await this.#i([this.triggers.provideAddNodeOptions(e, t), this.connectors.provideAddNodeOptions(e, t)], t), this.browseAddNodeOptions = async (e) => await this.#i([this.triggers.browseAddNodeOptions(e), this.connectors.browseAddNodeOptions(e)], e), this.provideAddNodeOptionChoices = async (e, t) => await (e.startsWith("trigger:") ? this.triggers.provideAddNodeOptionChoices(e, t) : this.connectors.provideAddNodeOptionChoices(e, t)), this.#t = o;
|
|
3227
3132
|
let c = (e) => {
|
|
3228
3133
|
this.#r || this.#n.set(e);
|
|
3229
3134
|
};
|
|
3230
|
-
this.runs = new
|
|
3231
|
-
let
|
|
3135
|
+
this.runs = new v(r, c, o), this.workspace = new Ct(r, c, a, o, (e) => void this.#a(r, e)), this.connectors = new ye(r, this.workspace, c, s, o), this.triggers = new xe(r, this.workspace, c, s, o), this.publications = new de(r, this.workspace, c, a, o), this.runRequests = new ge(r, this.runs, c, o, a);
|
|
3136
|
+
let u = /* @__PURE__ */ new Map(), d, f = n((e) => {
|
|
3232
3137
|
let t = e(this.workspace.$.draft);
|
|
3233
|
-
|
|
3234
|
-
let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(this.workspace.$.diagnostics)?.diagnostics, a = e(this.connectors.$.actions), s = e(this.connectors.$.catalogs), c = e(o.t$),
|
|
3235
|
-
...
|
|
3236
|
-
r == null || n == null ? void 0 :
|
|
3138
|
+
d != t?.flowId && (u.clear(), d = t?.flowId);
|
|
3139
|
+
let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(this.workspace.$.diagnostics)?.diagnostics, a = e(this.connectors.$.actions), s = e(this.connectors.$.catalogs), c = e(o.t$), l = e(this.runs.$.run), f = e(this.runs.$.events), p = n == null ? "" : n.kind == "flow" ? "flow" : `subflow:${n.id}`, h = [
|
|
3140
|
+
...Tt(t, n),
|
|
3141
|
+
r == null || n == null ? void 0 : m(r, n),
|
|
3237
3142
|
i,
|
|
3238
3143
|
a,
|
|
3239
3144
|
s,
|
|
3240
3145
|
c,
|
|
3241
|
-
|
|
3146
|
+
l,
|
|
3242
3147
|
f,
|
|
3243
|
-
...
|
|
3244
|
-
],
|
|
3245
|
-
if (
|
|
3246
|
-
let
|
|
3247
|
-
return
|
|
3248
|
-
graph:
|
|
3249
|
-
inputs:
|
|
3250
|
-
}),
|
|
3251
|
-
}),
|
|
3148
|
+
...l == null ? [] : [t?.revisionId]
|
|
3149
|
+
], g = u.get(p);
|
|
3150
|
+
if (g != null && g.inputs.length == h.length && g.inputs.every((e, t) => e === h[t])) return g.graph;
|
|
3151
|
+
let _ = y(t, n, r, i, a, s, c, l, f);
|
|
3152
|
+
return u.set(p, {
|
|
3153
|
+
graph: _,
|
|
3154
|
+
inputs: h
|
|
3155
|
+
}), _;
|
|
3156
|
+
}), p = e(f, wt);
|
|
3252
3157
|
this.$ = {
|
|
3253
3158
|
busy: n((e) => {
|
|
3254
3159
|
let t = e(this.workspace.$.busy);
|
|
@@ -3259,13 +3164,13 @@ var jt = { openExternalPage: async () => !1 }, Mt = class {
|
|
|
3259
3164
|
if (e(this.publications.$.rollingBackPublicationId) != null) return "rollback";
|
|
3260
3165
|
if (e(this.publications.$.changingTriggerId) != null) return "trigger";
|
|
3261
3166
|
}),
|
|
3262
|
-
designer:
|
|
3263
|
-
designerNodeById:
|
|
3167
|
+
designer: f,
|
|
3168
|
+
designerNodeById: p,
|
|
3264
3169
|
notice: this.#n,
|
|
3265
|
-
runEventNodes: n((e) =>
|
|
3170
|
+
runEventNodes: n((e) => Et(e(this.workspace.$.draft), e(this.workspace.$.target), e(this.runs.$.run), e(this.runs.$.events), e(p))),
|
|
3266
3171
|
selectedDesignerNode: n((e) => {
|
|
3267
3172
|
let t = e(this.workspace.$.selectedNodeIds);
|
|
3268
|
-
return t.length == 1 ? e(
|
|
3173
|
+
return t.length == 1 ? e(p).get(t[0]) : void 0;
|
|
3269
3174
|
})
|
|
3270
3175
|
};
|
|
3271
3176
|
}
|
|
@@ -3274,27 +3179,31 @@ var jt = { openExternalPage: async () => !1 }, Mt = class {
|
|
|
3274
3179
|
for (let e of Object.values(this.$)) e.dispose();
|
|
3275
3180
|
this.connectors.dispose(), this.publications.dispose(), this.runRequests.dispose(), this.runs.dispose(), this.triggers.dispose(), this.workspace.dispose();
|
|
3276
3181
|
}
|
|
3277
|
-
async start(e
|
|
3278
|
-
this.#e.invalidate(), this.connectors.reset(), this.triggers.reset(), this.publications.reset(), this.runRequests.reset(), this.runs.reset(), await this.workspace.start(e
|
|
3182
|
+
async start(e) {
|
|
3183
|
+
this.#e.invalidate(), this.connectors.reset(), this.triggers.reset(), this.publications.reset(), this.runRequests.reset(), this.runs.reset(), await this.workspace.start(e);
|
|
3279
3184
|
}
|
|
3280
|
-
async
|
|
3281
|
-
await this.workspace.
|
|
3185
|
+
async retryFlows() {
|
|
3186
|
+
await this.workspace.reloadFlows();
|
|
3282
3187
|
}
|
|
3283
3188
|
dismissNotice() {
|
|
3284
3189
|
this.#r || this.#n.set(void 0);
|
|
3285
3190
|
}
|
|
3286
|
-
async
|
|
3287
|
-
return this.#r || (this.#e.invalidate(), this.#n.set(void 0), !await this.workspace.
|
|
3191
|
+
async selectFlow(e) {
|
|
3192
|
+
return this.#r || (this.#e.invalidate(), this.#n.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);
|
|
3288
3193
|
}
|
|
3289
|
-
async
|
|
3290
|
-
let t = await this.workspace.
|
|
3291
|
-
return this.#r || t == null ? !1 : (await this.
|
|
3194
|
+
async createFlow(e) {
|
|
3195
|
+
let t = await this.workspace.createFlow(e);
|
|
3196
|
+
return this.#r || t == null ? !1 : (await this.selectFlow(t.flowId), this.#r || this.#n.set({
|
|
3292
3197
|
kind: "success",
|
|
3293
3198
|
message: this.#t.t("notice.created", { name: t.name })
|
|
3294
3199
|
}), !0);
|
|
3295
3200
|
}
|
|
3296
3201
|
selectNodes(e) {
|
|
3297
|
-
|
|
3202
|
+
let t = this.workspace.$.selectedNodeIds.value;
|
|
3203
|
+
if (this.workspace.selectNodes(e)) {
|
|
3204
|
+
if (t === this.workspace.$.selectedNodeIds.value) return;
|
|
3205
|
+
this.connectors.refresh(), this.triggers.refresh();
|
|
3206
|
+
}
|
|
3298
3207
|
}
|
|
3299
3208
|
locateRunEvent(e) {
|
|
3300
3209
|
let t = this.$.runEventNodes.value.get(e);
|
|
@@ -3313,69 +3222,56 @@ var jt = { openExternalPage: async () => !1 }, Mt = class {
|
|
|
3313
3222
|
if (t.aborted || this.#r) return;
|
|
3314
3223
|
let r = n.filter((e) => e.status == "rejected");
|
|
3315
3224
|
if (r.length > 0 && r.length == n.length) throw r[0].reason;
|
|
3316
|
-
return r.length > 0 && this.#n.set(
|
|
3225
|
+
return r.length > 0 && this.#n.set(u(r[0].reason, this.#t.t)), n.flatMap((e) => e.status == "fulfilled" ? e.value ?? [] : []);
|
|
3317
3226
|
}
|
|
3318
3227
|
async refreshSelectedConnector(e = !1) {
|
|
3319
3228
|
await this.connectors.refresh(e);
|
|
3320
3229
|
}
|
|
3321
3230
|
async requestDraftRun() {
|
|
3322
|
-
let e = this.workspace.$.
|
|
3323
|
-
return e == null || t == null
|
|
3231
|
+
let e = this.workspace.$.targetFlow.value, t = this.workspace.$.draft.value;
|
|
3232
|
+
return e == null || t == null ? "unavailable" : await this.runRequests.requestDraft(e, t);
|
|
3324
3233
|
}
|
|
3325
3234
|
async requestLiveRun() {
|
|
3326
|
-
let e = this.workspace.$.
|
|
3327
|
-
return e == null
|
|
3235
|
+
let e = this.workspace.$.targetFlow.value;
|
|
3236
|
+
return e == null ? "unavailable" : await this.runRequests.requestLive(e);
|
|
3328
3237
|
}
|
|
3329
3238
|
async #a(e, t) {
|
|
3330
3239
|
let n = this.workspace.$.target.value;
|
|
3331
|
-
if (this.#r || this.runRequests.$.submitting.value != null ||
|
|
3240
|
+
if (this.#r || this.runRequests.$.submitting.value != null || n?.kind != "flow" || this.workspace.$.flowId.value != t.flowId) return;
|
|
3332
3241
|
let r = this.#e.begin();
|
|
3333
3242
|
try {
|
|
3334
3243
|
let n = await e.getRun(t.runId), i = this.workspace.$.target.value;
|
|
3335
|
-
if (!r() || this.#r ||
|
|
3244
|
+
if (!r() || this.#r || i?.kind != "flow" || this.workspace.$.flowId.value != t.flowId || n.flowId != t.flowId || n.runId != t.runId) return;
|
|
3336
3245
|
this.runs.followExternal(n);
|
|
3337
3246
|
} catch {
|
|
3338
3247
|
return;
|
|
3339
3248
|
}
|
|
3340
3249
|
}
|
|
3341
|
-
},
|
|
3342
|
-
function
|
|
3250
|
+
}, kt = ie(() => import("./flowWorkspace-D7-rBA1-.js").then((e) => e.t));
|
|
3251
|
+
function At({ host: e, store: t }) {
|
|
3343
3252
|
let n = a(t.$.notice);
|
|
3344
|
-
return
|
|
3253
|
+
return S(() => e.notify(n), [e, n]), S(() => () => e.notify(void 0), [e]), null;
|
|
3345
3254
|
}
|
|
3346
|
-
function
|
|
3347
|
-
let s = a(i.workspace.$.
|
|
3348
|
-
return /* @__PURE__ */
|
|
3255
|
+
function jt({ hrefFor: e, language: t, navigation: n, onLanguageChange: r, store: i, theme: o }) {
|
|
3256
|
+
let s = a(i.workspace.$.flowId);
|
|
3257
|
+
return /* @__PURE__ */ C("div", {
|
|
3349
3258
|
className: "app-shell",
|
|
3350
|
-
children: s == null ? /* @__PURE__ */
|
|
3351
|
-
hrefForProject: (t) => e({
|
|
3352
|
-
projectId: t,
|
|
3353
|
-
view: "design"
|
|
3354
|
-
}),
|
|
3355
|
-
language: t,
|
|
3356
|
-
onCreateProject: (e) => n.createProject(e),
|
|
3357
|
-
onLanguageChange: r,
|
|
3358
|
-
onSelectProject: (e) => void n.selectProject(e),
|
|
3359
|
-
store: i
|
|
3360
|
-
}) : c == null ? /* @__PURE__ */ w(ne, {
|
|
3259
|
+
children: s == null ? /* @__PURE__ */ C(ne, {
|
|
3361
3260
|
hrefForFlow: (t) => e({
|
|
3362
3261
|
flowId: t.flowId,
|
|
3363
|
-
|
|
3364
|
-
view: t.draft == null ? "publications" : "design"
|
|
3262
|
+
view: "design"
|
|
3365
3263
|
}),
|
|
3366
3264
|
language: t,
|
|
3367
3265
|
onCreateFlow: (e) => n.createFlow(e),
|
|
3368
3266
|
onLanguageChange: r,
|
|
3369
|
-
|
|
3370
|
-
onSelectFlow: (e) => n.selectFlow(e),
|
|
3371
|
-
projectsHref: e({ view: "design" }),
|
|
3267
|
+
onSelectFlow: (e) => void n.selectFlow(e),
|
|
3372
3268
|
store: i
|
|
3373
|
-
}) : /* @__PURE__ */
|
|
3374
|
-
fallback: /* @__PURE__ */
|
|
3269
|
+
}) : /* @__PURE__ */ C(re, {
|
|
3270
|
+
fallback: /* @__PURE__ */ C("main", {
|
|
3375
3271
|
"aria-busy": "true",
|
|
3376
3272
|
className: "workspace"
|
|
3377
3273
|
}),
|
|
3378
|
-
children: /* @__PURE__ */
|
|
3274
|
+
children: /* @__PURE__ */ C(kt, {
|
|
3379
3275
|
hrefFor: e,
|
|
3380
3276
|
language: t,
|
|
3381
3277
|
navigation: n,
|
|
@@ -3386,52 +3282,52 @@ function Ft({ hrefFor: e, language: t, navigation: n, onLanguageChange: r, store
|
|
|
3386
3282
|
})
|
|
3387
3283
|
});
|
|
3388
3284
|
}
|
|
3389
|
-
function
|
|
3390
|
-
let
|
|
3391
|
-
|
|
3392
|
-
let [{ i18n:
|
|
3393
|
-
let t =
|
|
3285
|
+
function Mt({ host: e, hrefFor: t, language: n, location: i, onLanguageChange: a, onNavigate: o, preferences: s, theme: u }) {
|
|
3286
|
+
let d = ae(o);
|
|
3287
|
+
d.current = o;
|
|
3288
|
+
let [{ i18n: f, navigation: p, store: m }] = oe(() => {
|
|
3289
|
+
let t = l(n), r = new Ot(new c((t, n) => e.request(t, n), (t, n) => e.subscribeFlow(t, n), (t) => e.subscribeFlowCatalog(t)), s, () => crypto.randomUUID(), t, e);
|
|
3394
3290
|
return {
|
|
3395
3291
|
i18n: t,
|
|
3396
|
-
navigation: new
|
|
3397
|
-
store:
|
|
3292
|
+
navigation: new ce(r, i, (e, t) => d.current(e, t)),
|
|
3293
|
+
store: r
|
|
3398
3294
|
};
|
|
3399
3295
|
});
|
|
3400
|
-
return
|
|
3401
|
-
|
|
3296
|
+
return S(() => {
|
|
3297
|
+
p.start();
|
|
3402
3298
|
let e = () => {
|
|
3403
|
-
|
|
3299
|
+
m.connectors.refreshAfterAuthorization(), m.triggers.refreshAfterAuthorization();
|
|
3404
3300
|
};
|
|
3405
3301
|
return globalThis.addEventListener("focus", e), () => {
|
|
3406
|
-
globalThis.removeEventListener("focus", e),
|
|
3302
|
+
globalThis.removeEventListener("focus", e), p.dispose(), m.dispose(), f.dispose();
|
|
3407
3303
|
};
|
|
3408
3304
|
}, [
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
]),
|
|
3413
|
-
|
|
3414
|
-
}, [
|
|
3415
|
-
i18n:
|
|
3305
|
+
f,
|
|
3306
|
+
p,
|
|
3307
|
+
m
|
|
3308
|
+
]), S(() => void p.apply(i), [i, p]), S(() => {
|
|
3309
|
+
f.lang != n && f.switchLang(n);
|
|
3310
|
+
}, [f, n]), /* @__PURE__ */ C(r, {
|
|
3311
|
+
i18n: f,
|
|
3416
3312
|
children: /* @__PURE__ */ se("div", {
|
|
3417
3313
|
className: "open-flow-workbench",
|
|
3418
|
-
"data-theme":
|
|
3419
|
-
children: [/* @__PURE__ */
|
|
3314
|
+
"data-theme": u,
|
|
3315
|
+
children: [/* @__PURE__ */ C(At, {
|
|
3420
3316
|
host: e,
|
|
3421
|
-
store:
|
|
3422
|
-
}), /* @__PURE__ */
|
|
3317
|
+
store: m
|
|
3318
|
+
}), /* @__PURE__ */ C(jt, {
|
|
3423
3319
|
hrefFor: t,
|
|
3424
3320
|
language: n,
|
|
3425
|
-
navigation:
|
|
3321
|
+
navigation: p,
|
|
3426
3322
|
onLanguageChange: a,
|
|
3427
|
-
store:
|
|
3428
|
-
theme:
|
|
3323
|
+
store: m,
|
|
3324
|
+
theme: u
|
|
3429
3325
|
})]
|
|
3430
3326
|
})
|
|
3431
3327
|
});
|
|
3432
3328
|
}
|
|
3433
|
-
function
|
|
3434
|
-
return /* @__PURE__ */
|
|
3329
|
+
function Nt({ sessionKey: e, ...t }) {
|
|
3330
|
+
return /* @__PURE__ */ C(Mt, { ...t }, e);
|
|
3435
3331
|
}
|
|
3436
3332
|
//#endregion
|
|
3437
|
-
export {
|
|
3333
|
+
export { Nt as OpenFlowWorkbench };
|