@oomol-lab/open-flow 0.1.0-alpha.4 → 0.1.0-alpha.6
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-CGyTkP99.js → addNodeOptions-C4wix0_u.js} +1008 -1428
- package/dist/browser/carbon-DMCVsjHo.js +53 -0
- package/dist/browser/{createLucideIcon-MmUpJrIU.js → createLucideIcon-ggJB9CTC.js} +86 -117
- package/dist/browser/{createResourceDialog-CIVfStiE.js → createResourceDialog-CESUCxOM.js} +12 -12
- package/dist/browser/{dist-BbyiRq3c.js → dist-B0Q2Mn0n.js} +117 -107
- package/dist/browser/{dist-B9OV3YTx.js → dist-Bc9TvHYl.js} +7 -7
- package/dist/browser/{dist-0lWKriL5.js → dist-C46JByB-.js} +1 -1
- package/dist/browser/{dist-CvcmLAMW.js → dist-CUkceEvN.js} +4 -4
- package/dist/browser/{dist-zyY--HOV.js → dist-CVtP-E2c.js} +2 -2
- package/dist/browser/{dist-CLZJNoWB.js → dist-D5mdziGP.js} +4 -4
- package/dist/browser/{dist-7oZK9QXZ.js → dist-DMi8_lU3.js} +5 -5
- package/dist/browser/{dist-DL0SDskM.js → dist-DQVavPcf.js} +9 -8
- package/dist/browser/{dist-aWSZx4q1.js → dist-DWzdGVm9.js} +2 -2
- package/dist/browser/{dist-Djd02JSy.js → dist-DXgEYMFx.js} +4 -4
- package/dist/browser/{dist-o4dBuwiG.js → dist-DhsGR_K3.js} +4 -4
- package/dist/browser/{dist-BLk5M0uK.js → dist-Mecbzdl2.js} +3 -3
- package/dist/browser/{dist-CIq6ue3I.js → dist-n9WmBm5w.js} +1115 -1103
- package/dist/browser/{esm-DXw7EADW.js → esm-CoE5_2w7.js} +5 -5
- package/dist/browser/{field-runIpvMd.js → field-CIrv7Rez.js} +6 -6
- 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} +44 -69
- package/dist/browser/{project-change.d.ts → flow-change.d.ts} +11 -26
- package/dist/browser/{project-change.js → flow-change.js} +8 -39
- package/dist/browser/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
- package/dist/browser/{flowRunInputEditorStore-B49C0ZmK.js → flowRunInputEditorStore-DXOyyY7o.js} +850 -675
- package/dist/browser/{flowWorkspace-CGsEHe2F.js → flowWorkspace-Bo0bz1Uz.js} +7040 -6875
- package/dist/browser/{lib-S4ccuMeT.js → lib-GrGxYjsJ.js} +3 -5
- package/dist/browser/licenses.md +11 -11
- package/dist/browser/{markdownContent-BvYiwIwR.js → markdownContent-ColGUxHy.js} +4046 -4018
- 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 +898 -1053
- package/dist/common/connector-action.js +1 -1
- package/dist/common/control-api-conformance.js +137 -361
- package/dist/common/control-api-errors.d.ts +16 -24
- package/dist/common/control-api.d.ts +38 -67
- package/dist/common/control-api.js +135 -188
- package/dist/common/cron-trigger.d.ts +1 -1
- package/dist/common/cron-trigger.js +1 -1
- package/dist/common/{project-encoding.d.ts → flow-encoding.d.ts} +3 -3
- package/dist/common/{project-encoding.js → flow-encoding.js} +3 -6
- 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} +103 -115
- package/dist/common/integration-trigger.d.ts +1 -1
- package/dist/common/integration-trigger.js +1 -1
- package/dist/common/poll-trigger.d.ts +1 -1
- package/dist/common/run-lifecycle.js +1 -1
- package/dist/common/runtime-contract.d.ts +1 -1
- package/dist/common/runtime-contract.js +1 -1
- package/dist/common/scheduler.d.ts +3 -2
- package/dist/common/scheduler.js +4 -4
- package/dist/common/webhook-trigger.d.ts +1 -1
- package/dist/common/webhook-trigger.js +2 -2
- package/package.json +13 -13
- package/dist/browser/carbon-nMY84Amv.js +0 -53
- package/dist/browser/project-authoring-flow.d.ts +0 -4
- package/dist/browser/project-authoring.d.ts +0 -4
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { a as e, f as t, i as n } from "./dist-
|
|
2
|
-
import { Ir as r, Rr as i, Wr as a } from "./createLucideIcon-
|
|
3
|
-
import { _ as o, a as s, c,
|
|
4
|
-
import { Suspense as re, lazy as ie, useEffect as
|
|
5
|
-
import { jsx as
|
|
1
|
+
import { a as e, f as t, i as n } from "./dist-C46JByB-.js";
|
|
2
|
+
import { Ir as r, Rr as i, Wr as a } from "./createLucideIcon-ggJB9CTC.js";
|
|
3
|
+
import { _ as o, a as s, at as c, c as l, ct as u, d, f, g as p, h as m, i as h, l as g, lt as _, n as ee, o as v, p as y, t as b, u as te, v as ne } from "./addNodeOptions-C4wix0_u.js";
|
|
4
|
+
import { Suspense as re, lazy as ie, useEffect as x, useRef as ae, useState as oe } from "react";
|
|
5
|
+
import { jsx as S, 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 (le(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
|
+
le(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 le(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 C = {
|
|
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
|
+
}, w = 20, ue = 50;
|
|
104
|
+
function T(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 o();
|
|
112
|
+
#i = new o();
|
|
113
|
+
#a = new o();
|
|
114
|
+
#o = new o();
|
|
158
115
|
#s;
|
|
159
|
-
#c = t(
|
|
116
|
+
#c = t(C);
|
|
160
117
|
#l;
|
|
161
118
|
#u;
|
|
162
|
-
constructor(t, n, r, i = () => crypto.randomUUID(), a =
|
|
119
|
+
constructor(t, n, r, i = () => crypto.randomUUID(), a = c()) {
|
|
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(C);
|
|
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
|
+
T(this.#c.value.target, t) || (this.#u = void 0), this.#s(void 0), this.#c.set({
|
|
156
|
+
...C,
|
|
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(p(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,60 +202,55 @@ var fe = class {
|
|
|
248
202
|
this.#h({
|
|
249
203
|
loadMoreFailed: !0,
|
|
250
204
|
loadingMore: !1
|
|
251
|
-
}), this.#s(
|
|
205
|
+
}), this.#s(p(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 _ && e.code == "live.conflict" && await this.#f(n), this.#s(p(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
|
-
},
|
|
295
|
-
this.#u =
|
|
243
|
+
}, s = this.#i.begin();
|
|
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 }), !s() || (await this.#d(r), !s()) ? !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
|
|
251
|
+
return s() ? (e instanceof _ && e.code == "live.conflict" && await this.#f(r), this.#s(p(e, this.#n.t)), !1) : !1;
|
|
303
252
|
} finally {
|
|
304
|
-
|
|
253
|
+
s() && this.#h({ rollingBackPublicationId: void 0 });
|
|
305
254
|
}
|
|
306
255
|
}
|
|
307
256
|
closeTrigger() {
|
|
@@ -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: w })]);
|
|
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(p(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(p(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: w
|
|
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(p(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(p(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(p(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(), T(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
|
+
T(this.#c.value.target, e) ? this.#h(t) : this.#c.set({
|
|
403
|
+
...C,
|
|
455
404
|
...t,
|
|
456
405
|
target: e
|
|
457
406
|
});
|
|
@@ -462,8 +411,8 @@ var fe = class {
|
|
|
462
411
|
...e
|
|
463
412
|
});
|
|
464
413
|
}
|
|
465
|
-
},
|
|
466
|
-
function
|
|
414
|
+
}, E = { starting: !1 };
|
|
415
|
+
function fe(e) {
|
|
467
416
|
switch (e.kind) {
|
|
468
417
|
case "condition": return { [e.node.input.handle]: e.node.input };
|
|
469
418
|
case "subflow": return e.definition?.inputs ?? {};
|
|
@@ -471,40 +420,37 @@ function pe(e) {
|
|
|
471
420
|
case "value": return {};
|
|
472
421
|
}
|
|
473
422
|
}
|
|
474
|
-
function
|
|
423
|
+
function pe(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
|
|
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 me(e, t) {
|
|
427
|
+
let { FlowRunInputEditorStore: n } = await import("./flowRunInputEditorStore-DXOyyY7o.js").then((e) => e.n), r = m(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
|
-
let o = Object.entries(
|
|
431
|
+
let o = Object.entries(fe(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,
|
|
487
433
|
jsonSchema: t.jsonSchema,
|
|
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
|
-
title:
|
|
439
|
+
title: pe(a)
|
|
494
440
|
}];
|
|
495
441
|
});
|
|
496
442
|
}
|
|
497
|
-
var
|
|
443
|
+
var he = class {
|
|
498
444
|
#e;
|
|
499
445
|
#t;
|
|
500
446
|
#n;
|
|
501
|
-
#r = new
|
|
502
|
-
#i = new
|
|
447
|
+
#r = new o();
|
|
448
|
+
#i = new o();
|
|
503
449
|
#a;
|
|
504
450
|
#o;
|
|
505
|
-
#s = t(
|
|
451
|
+
#s = t(E);
|
|
506
452
|
#c;
|
|
507
|
-
constructor(t, n, r, i =
|
|
453
|
+
constructor(t, n, r, i = c(), 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(E), 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(p(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
|
|
511
|
+
c = await me(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(p(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,13 +605,13 @@ 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
|
-
function
|
|
614
|
+
function ge(e, t) {
|
|
671
615
|
let n = /* @__PURE__ */ new Map();
|
|
672
616
|
for (let t of e) {
|
|
673
617
|
let e = n.get(t.serviceId) ?? [];
|
|
@@ -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,
|
|
@@ -696,7 +640,7 @@ function _e(e, t) {
|
|
|
696
640
|
};
|
|
697
641
|
});
|
|
698
642
|
}
|
|
699
|
-
function
|
|
643
|
+
function _e(e, t) {
|
|
700
644
|
return {
|
|
701
645
|
choices: [],
|
|
702
646
|
description: t("addNode.connectorBrowseActions"),
|
|
@@ -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 ve = class {
|
|
724
668
|
#e;
|
|
725
669
|
#t;
|
|
726
670
|
#n;
|
|
@@ -735,43 +679,43 @@ var be = class {
|
|
|
735
679
|
#d;
|
|
736
680
|
#f;
|
|
737
681
|
#p;
|
|
738
|
-
constructor(r, i, a,
|
|
739
|
-
this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new
|
|
682
|
+
constructor(r, i, a, s, l = c()) {
|
|
683
|
+
this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new o(), 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) => _e(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];
|
|
768
712
|
t != null && o.set(e, t);
|
|
769
713
|
}
|
|
770
|
-
return
|
|
771
|
-
}, this.#e = r, this.#n =
|
|
772
|
-
let
|
|
714
|
+
return ge([...o.values()], this.#t.t);
|
|
715
|
+
}, this.#e = r, this.#n = s, this.#u = i, this.#c = a, this.#t = l;
|
|
716
|
+
let u = e(this.#l, (e) => e.actions), d = 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), {
|
|
@@ -784,8 +728,8 @@ var be = class {
|
|
|
784
728
|
};
|
|
785
729
|
}), this.$ = {
|
|
786
730
|
actionLoading: e(this.#l, (e) => e.actionLoading),
|
|
787
|
-
actions:
|
|
788
|
-
catalogs:
|
|
731
|
+
actions: u,
|
|
732
|
+
catalogs: d,
|
|
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: p(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(p(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: p(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 = s(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,24 +907,24 @@ function I(e, t, n, r) {
|
|
|
963
907
|
}
|
|
964
908
|
};
|
|
965
909
|
}
|
|
966
|
-
function
|
|
910
|
+
function ye(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,
|
|
975
919
|
outputs: []
|
|
976
920
|
};
|
|
977
921
|
}
|
|
978
|
-
function
|
|
922
|
+
function be(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 xe(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 = ye(e, n), a = be(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 Se = 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,
|
|
1025
|
-
this.#t = new AbortController(), this.#a = new
|
|
1026
|
-
let t = this.#l.$.
|
|
968
|
+
constructor(r, i, a, l, u = c()) {
|
|
969
|
+
this.#t = new AbortController(), this.#a = new o(), 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) => ye(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, s(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) => xe(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 = s(await this.#n.listConnectorConnections(
|
|
1005
|
+
if (a = s(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
|
-
return
|
|
1068
|
-
}, this.#n = r, this.#r =
|
|
1069
|
-
let t = e(i.$.selection), n =
|
|
1011
|
+
return be(i, a, this.#i);
|
|
1012
|
+
}, this.#n = r, this.#r = l, this.#i = u, 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 = s(await this.#n.listConnectorConnections(
|
|
1055
|
+
let e = s(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: p(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(p(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,70 +1113,45 @@ 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/
|
|
1177
|
-
function
|
|
1120
|
+
//#region src/flow/common/edgeChanges.ts
|
|
1121
|
+
function I(e, t, n) {
|
|
1178
1122
|
let r = {
|
|
1179
1123
|
source: n.source,
|
|
1180
1124
|
sourceHandle: n.sourceHandle,
|
|
1181
1125
|
target: n.target,
|
|
1182
1126
|
targetHandle: n.targetHandle
|
|
1183
|
-
}, i =
|
|
1127
|
+
}, i = L(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
|
|
1184
1128
|
return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
|
|
1185
1129
|
edge: r,
|
|
1186
1130
|
kind: "graph.edge.connect",
|
|
1187
1131
|
target: t
|
|
1188
1132
|
}];
|
|
1189
1133
|
}
|
|
1190
|
-
function
|
|
1134
|
+
function Ce(e, t, n) {
|
|
1191
1135
|
let r = {
|
|
1192
1136
|
source: n.source,
|
|
1193
1137
|
sourceHandle: n.sourceHandle,
|
|
1194
1138
|
target: n.target,
|
|
1195
1139
|
targetHandle: n.targetHandle
|
|
1196
|
-
}, i =
|
|
1140
|
+
}, i = L(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
|
|
1197
1141
|
return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
|
|
1198
1142
|
edge: r,
|
|
1199
1143
|
kind: "graph.edge.disconnect",
|
|
1200
1144
|
target: t
|
|
1201
1145
|
}];
|
|
1202
1146
|
}
|
|
1203
|
-
function
|
|
1204
|
-
return t.kind == "flow" ? e.document.
|
|
1147
|
+
function L(e, t) {
|
|
1148
|
+
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
1205
1149
|
}
|
|
1206
1150
|
//#endregion
|
|
1207
|
-
//#region src/
|
|
1208
|
-
function
|
|
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
|
-
}];
|
|
1230
|
-
}
|
|
1231
|
-
//#endregion
|
|
1232
|
-
//#region src/project/common/moduleChanges.ts
|
|
1233
|
-
async function Oe(e) {
|
|
1151
|
+
//#region src/flow/common/moduleChanges.ts
|
|
1152
|
+
async function we(e) {
|
|
1234
1153
|
try {
|
|
1235
|
-
let { parse: t } = await import("./lib-
|
|
1154
|
+
let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
|
|
1236
1155
|
errorRecovery: !0,
|
|
1237
1156
|
sourceType: "module"
|
|
1238
1157
|
}).program, r = /* @__PURE__ */ new Set();
|
|
@@ -1246,7 +1165,7 @@ async function Oe(e) {
|
|
|
1246
1165
|
return [];
|
|
1247
1166
|
}
|
|
1248
1167
|
}
|
|
1249
|
-
function
|
|
1168
|
+
function Te(e, t, n) {
|
|
1250
1169
|
return [{
|
|
1251
1170
|
imports: n,
|
|
1252
1171
|
kind: "module.source.replace",
|
|
@@ -1255,8 +1174,8 @@ 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 Ee(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 = {
|
|
@@ -1281,7 +1200,7 @@ function Ae(e, t, n, r = {
|
|
|
1281
1200
|
kind: "graph.node.create",
|
|
1282
1201
|
node: {
|
|
1283
1202
|
concurrency: 1,
|
|
1284
|
-
inputs:
|
|
1203
|
+
inputs: V(i.inputs),
|
|
1285
1204
|
kind: "task",
|
|
1286
1205
|
name: n,
|
|
1287
1206
|
task: {
|
|
@@ -1295,7 +1214,7 @@ function Ae(e, t, n, r = {
|
|
|
1295
1214
|
target: e
|
|
1296
1215
|
}];
|
|
1297
1216
|
}
|
|
1298
|
-
function
|
|
1217
|
+
function R(e, t, n) {
|
|
1299
1218
|
return [{
|
|
1300
1219
|
kind: "task.create",
|
|
1301
1220
|
task: n,
|
|
@@ -1304,7 +1223,7 @@ function B(e, t, n) {
|
|
|
1304
1223
|
kind: "graph.node.create",
|
|
1305
1224
|
node: {
|
|
1306
1225
|
concurrency: 1,
|
|
1307
|
-
inputs:
|
|
1226
|
+
inputs: V(n.inputs),
|
|
1308
1227
|
kind: "task",
|
|
1309
1228
|
name: n.name,
|
|
1310
1229
|
taskId: t.taskId
|
|
@@ -1313,9 +1232,9 @@ function B(e, t, n) {
|
|
|
1313
1232
|
target: e
|
|
1314
1233
|
}];
|
|
1315
1234
|
}
|
|
1316
|
-
function
|
|
1235
|
+
function De(e, t, n, r, i, a = {}) {
|
|
1317
1236
|
let o = a.inputs ?? {};
|
|
1318
|
-
return
|
|
1237
|
+
return R(e, t, {
|
|
1319
1238
|
executor: {
|
|
1320
1239
|
kind: "llm",
|
|
1321
1240
|
mode: r
|
|
@@ -1327,12 +1246,12 @@ function je(e, t, n, r, i, a = {}) {
|
|
|
1327
1246
|
type: "array"
|
|
1328
1247
|
},
|
|
1329
1248
|
nullable: !0,
|
|
1330
|
-
value:
|
|
1249
|
+
value: H(o, "messages", null)
|
|
1331
1250
|
},
|
|
1332
1251
|
input: {
|
|
1333
1252
|
jsonSchema: { type: "string" },
|
|
1334
1253
|
nullable: !1,
|
|
1335
|
-
value:
|
|
1254
|
+
value: H(o, "input", "Alex")
|
|
1336
1255
|
},
|
|
1337
1256
|
template: {
|
|
1338
1257
|
jsonSchema: {
|
|
@@ -1341,7 +1260,7 @@ function je(e, t, n, r, i, a = {}) {
|
|
|
1341
1260
|
type: "array"
|
|
1342
1261
|
},
|
|
1343
1262
|
nullable: !1,
|
|
1344
|
-
value:
|
|
1263
|
+
value: H(o, "template", [{
|
|
1345
1264
|
content: "Hello, I'm {{input}}",
|
|
1346
1265
|
role: "user"
|
|
1347
1266
|
}])
|
|
@@ -1349,7 +1268,7 @@ function je(e, t, n, r, i, a = {}) {
|
|
|
1349
1268
|
model: {
|
|
1350
1269
|
jsonSchema: { type: "object" },
|
|
1351
1270
|
nullable: !1,
|
|
1352
|
-
value:
|
|
1271
|
+
value: H(o, "model", { model: "deepseek-v4-flash" })
|
|
1353
1272
|
}
|
|
1354
1273
|
},
|
|
1355
1274
|
name: n,
|
|
@@ -1360,7 +1279,7 @@ function je(e, t, n, r, i, a = {}) {
|
|
|
1360
1279
|
} }
|
|
1361
1280
|
});
|
|
1362
1281
|
}
|
|
1363
|
-
function
|
|
1282
|
+
function Oe(e, t, n) {
|
|
1364
1283
|
return [{
|
|
1365
1284
|
kind: "graph.node.create",
|
|
1366
1285
|
node: {
|
|
@@ -1391,7 +1310,7 @@ function Me(e, t, n) {
|
|
|
1391
1310
|
target: e
|
|
1392
1311
|
}];
|
|
1393
1312
|
}
|
|
1394
|
-
function
|
|
1313
|
+
function ke(e, t, n) {
|
|
1395
1314
|
return [{
|
|
1396
1315
|
kind: "graph.node.create",
|
|
1397
1316
|
node: {
|
|
@@ -1409,7 +1328,7 @@ function Ne(e, t, n) {
|
|
|
1409
1328
|
target: e
|
|
1410
1329
|
}];
|
|
1411
1330
|
}
|
|
1412
|
-
function
|
|
1331
|
+
function z(e, t, n) {
|
|
1413
1332
|
return [{
|
|
1414
1333
|
kind: "graph.node.create",
|
|
1415
1334
|
node: n,
|
|
@@ -1417,7 +1336,7 @@ function V(e, t, n) {
|
|
|
1417
1336
|
target: e
|
|
1418
1337
|
}];
|
|
1419
1338
|
}
|
|
1420
|
-
function
|
|
1339
|
+
function Ae(e, t, n, r) {
|
|
1421
1340
|
let i = r.name ?? n.displayName, a = n.type == "poll" ? {
|
|
1422
1341
|
bindingId: t.bindingId,
|
|
1423
1342
|
config: r.config,
|
|
@@ -1450,8 +1369,8 @@ function Pe(e, t, n, r) {
|
|
|
1450
1369
|
target: e
|
|
1451
1370
|
}];
|
|
1452
1371
|
}
|
|
1453
|
-
function
|
|
1454
|
-
let r =
|
|
1372
|
+
function je(e, t, n) {
|
|
1373
|
+
let r = B(e, t)?.nodes;
|
|
1455
1374
|
if (r == null) return [];
|
|
1456
1375
|
let i = new Set(n), a = n.flatMap((e) => {
|
|
1457
1376
|
let n = r[e];
|
|
@@ -1469,38 +1388,38 @@ function Fe(e, t, n) {
|
|
|
1469
1388
|
let t = r[e];
|
|
1470
1389
|
return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
|
|
1471
1390
|
}));
|
|
1472
|
-
for (let
|
|
1473
|
-
bindingId:
|
|
1391
|
+
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({
|
|
1392
|
+
bindingId: t,
|
|
1474
1393
|
kind: "binding.delete"
|
|
1475
1394
|
});
|
|
1476
1395
|
return a;
|
|
1477
1396
|
}
|
|
1478
|
-
function
|
|
1479
|
-
let i =
|
|
1397
|
+
function Me(e, t, n, r) {
|
|
1398
|
+
let i = B(e, t)?.nodes[n];
|
|
1480
1399
|
if (i == null || !("inputs" in i)) return;
|
|
1481
1400
|
let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
|
|
1482
|
-
return
|
|
1401
|
+
return U(t, n, {
|
|
1483
1402
|
...c,
|
|
1484
1403
|
...r
|
|
1485
1404
|
});
|
|
1486
1405
|
}
|
|
1487
|
-
function
|
|
1488
|
-
return
|
|
1406
|
+
function Ne(e, t, n, r, i) {
|
|
1407
|
+
return Pe(e, t, n, { [r]: i });
|
|
1489
1408
|
}
|
|
1490
|
-
function
|
|
1491
|
-
let i =
|
|
1409
|
+
function Pe(e, t, n, r) {
|
|
1410
|
+
let i = B(e, t)?.nodes[n];
|
|
1492
1411
|
if (i == null || !("inputs" in i)) return;
|
|
1493
1412
|
let a = { ...i.inputs };
|
|
1494
1413
|
for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
|
|
1495
1414
|
kind: "value",
|
|
1496
1415
|
value: t
|
|
1497
1416
|
};
|
|
1498
|
-
return
|
|
1417
|
+
return U(t, n, {
|
|
1499
1418
|
...i,
|
|
1500
1419
|
inputs: a
|
|
1501
1420
|
});
|
|
1502
1421
|
}
|
|
1503
|
-
function
|
|
1422
|
+
function Fe(e, t, n) {
|
|
1504
1423
|
let r = e.document.tasks[t];
|
|
1505
1424
|
if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
|
|
1506
1425
|
kind: "task.replace",
|
|
@@ -1514,8 +1433,8 @@ function ze(e, t, n) {
|
|
|
1514
1433
|
taskId: t
|
|
1515
1434
|
}];
|
|
1516
1435
|
}
|
|
1517
|
-
function
|
|
1518
|
-
let i = e.document.
|
|
1436
|
+
function Ie(e, t, n, r) {
|
|
1437
|
+
let i = e.document.graph.nodes[n];
|
|
1519
1438
|
if (i == null) return;
|
|
1520
1439
|
let a = {
|
|
1521
1440
|
...r.description == null ? {} : { description: r.description },
|
|
@@ -1560,25 +1479,25 @@ function Be(e, t, n, r) {
|
|
|
1560
1479
|
config: r.config
|
|
1561
1480
|
};
|
|
1562
1481
|
}
|
|
1563
|
-
return
|
|
1482
|
+
return U(t, n, o);
|
|
1564
1483
|
}
|
|
1565
|
-
function
|
|
1566
|
-
let a = e.document.
|
|
1484
|
+
function Le(e, t, n, r, i) {
|
|
1485
|
+
let a = e.document.graph.nodes[n];
|
|
1567
1486
|
if (a == null || a.kind != "integration" && a.kind != "poll") return;
|
|
1568
1487
|
let o = { ...a.config };
|
|
1569
|
-
return i === void 0 ? delete o[r] : o[r] = i,
|
|
1488
|
+
return i === void 0 ? delete o[r] : o[r] = i, U(t, n, {
|
|
1570
1489
|
...a,
|
|
1571
1490
|
config: o
|
|
1572
1491
|
});
|
|
1573
1492
|
}
|
|
1574
|
-
function
|
|
1575
|
-
let i = e.document.
|
|
1493
|
+
function Re(e, t, n, r) {
|
|
1494
|
+
let i = e.document.graph.nodes[n];
|
|
1576
1495
|
if (i != null) switch (i.kind) {
|
|
1577
|
-
case "cron": return
|
|
1496
|
+
case "cron": return U(t, n, {
|
|
1578
1497
|
...i,
|
|
1579
1498
|
cronTimes: r
|
|
1580
1499
|
});
|
|
1581
|
-
case "poll": return
|
|
1500
|
+
case "poll": return U(t, n, {
|
|
1582
1501
|
...i,
|
|
1583
1502
|
pollTimes: r
|
|
1584
1503
|
});
|
|
@@ -1587,8 +1506,8 @@ function He(e, t, n, r) {
|
|
|
1587
1506
|
default: return;
|
|
1588
1507
|
}
|
|
1589
1508
|
}
|
|
1590
|
-
function
|
|
1591
|
-
let i = e.document.
|
|
1509
|
+
function ze(e, t, n, r) {
|
|
1510
|
+
let i = e.document.graph.nodes[n];
|
|
1592
1511
|
if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
|
|
1593
1512
|
binding: {
|
|
1594
1513
|
kind: "connection",
|
|
@@ -1598,19 +1517,19 @@ function Ue(e, t, n, r) {
|
|
|
1598
1517
|
kind: "binding.replace"
|
|
1599
1518
|
}];
|
|
1600
1519
|
}
|
|
1601
|
-
function
|
|
1602
|
-
return t.kind == "flow" ? e.document.
|
|
1520
|
+
function B(e, t) {
|
|
1521
|
+
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
1603
1522
|
}
|
|
1604
|
-
function
|
|
1523
|
+
function V(e) {
|
|
1605
1524
|
return Object.fromEntries(Object.entries(e).flatMap(([e, t]) => Object.hasOwn(t, "value") ? [[e, {
|
|
1606
1525
|
kind: "value",
|
|
1607
1526
|
value: t.value
|
|
1608
1527
|
}]] : []));
|
|
1609
1528
|
}
|
|
1610
|
-
function
|
|
1529
|
+
function H(e, t, n) {
|
|
1611
1530
|
return e != null && Object.hasOwn(e, t) ? e[t] : n;
|
|
1612
1531
|
}
|
|
1613
|
-
function
|
|
1532
|
+
function U(e, t, n) {
|
|
1614
1533
|
return [{
|
|
1615
1534
|
kind: "graph.node.replace",
|
|
1616
1535
|
node: n,
|
|
@@ -1619,78 +1538,15 @@ function G(e, t, n) {
|
|
|
1619
1538
|
}];
|
|
1620
1539
|
}
|
|
1621
1540
|
//#endregion
|
|
1622
|
-
//#region src/workbench/browser/runtime/designer/
|
|
1623
|
-
function
|
|
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) {
|
|
1541
|
+
//#region src/workbench/browser/runtime/designer/flowChanges.ts
|
|
1542
|
+
function W(e, t) {
|
|
1687
1543
|
return {
|
|
1688
1544
|
...e,
|
|
1689
1545
|
content: r(e.content, t)
|
|
1690
1546
|
};
|
|
1691
1547
|
}
|
|
1692
|
-
function
|
|
1693
|
-
return
|
|
1548
|
+
function Be(e, t) {
|
|
1549
|
+
return [{
|
|
1694
1550
|
kind: "subflow.create",
|
|
1695
1551
|
subflow: {
|
|
1696
1552
|
graph: { nodes: {} },
|
|
@@ -1699,7 +1555,7 @@ function Ze(e, t, n) {
|
|
|
1699
1555
|
nullable: !0,
|
|
1700
1556
|
value: null
|
|
1701
1557
|
} },
|
|
1702
|
-
name:
|
|
1558
|
+
name: t,
|
|
1703
1559
|
outputs: { result: {
|
|
1704
1560
|
jsonSchema: {},
|
|
1705
1561
|
nullable: !0,
|
|
@@ -1709,20 +1565,20 @@ function Ze(e, t, n) {
|
|
|
1709
1565
|
}]
|
|
1710
1566
|
} }
|
|
1711
1567
|
},
|
|
1712
|
-
subflowId:
|
|
1568
|
+
subflowId: e
|
|
1713
1569
|
}];
|
|
1714
1570
|
}
|
|
1715
|
-
function
|
|
1571
|
+
function Ve(e, t, n, r, i) {
|
|
1716
1572
|
switch (r.kind) {
|
|
1717
|
-
case "code": return
|
|
1573
|
+
case "code": return Ee(t, {
|
|
1718
1574
|
moduleId: i(),
|
|
1719
1575
|
nodeId: n
|
|
1720
1576
|
}, r.name);
|
|
1721
|
-
case "llm": return
|
|
1577
|
+
case "llm": return De(t, {
|
|
1722
1578
|
nodeId: n,
|
|
1723
1579
|
taskId: i()
|
|
1724
1580
|
}, r.name, r.mode, r.outputDescription);
|
|
1725
|
-
case "connector": return
|
|
1581
|
+
case "connector": return R(t, {
|
|
1726
1582
|
nodeId: n,
|
|
1727
1583
|
taskId: i()
|
|
1728
1584
|
}, {
|
|
@@ -1735,18 +1591,18 @@ function Qe(e, t, n, r, i) {
|
|
|
1735
1591
|
name: r.action.name,
|
|
1736
1592
|
outputs: r.action.outputs
|
|
1737
1593
|
});
|
|
1738
|
-
case "condition": return
|
|
1739
|
-
case "value": return
|
|
1594
|
+
case "condition": return Oe(t, n, r.name);
|
|
1595
|
+
case "value": return ke(t, n, r.name);
|
|
1740
1596
|
case "subflow": {
|
|
1741
1597
|
let i = e.subflow(r.subflowId);
|
|
1742
|
-
return i == null ? void 0 :
|
|
1598
|
+
return i == null ? void 0 : et(t, n, r.subflowId, i.inputs);
|
|
1743
1599
|
}
|
|
1744
|
-
case "webhook": return t.kind == "flow" ?
|
|
1600
|
+
case "webhook": return t.kind == "flow" ? z(t, n, {
|
|
1745
1601
|
inputsDef: [],
|
|
1746
1602
|
kind: "webhook",
|
|
1747
1603
|
name: r.name
|
|
1748
1604
|
}) : void 0;
|
|
1749
|
-
case "cron": return t.kind == "flow" ?
|
|
1605
|
+
case "cron": return t.kind == "flow" ? z(t, n, {
|
|
1750
1606
|
cronTimes: [{
|
|
1751
1607
|
type: "every",
|
|
1752
1608
|
unit: "hour",
|
|
@@ -1755,7 +1611,7 @@ function Qe(e, t, n, r, i) {
|
|
|
1755
1611
|
kind: "cron",
|
|
1756
1612
|
name: r.name
|
|
1757
1613
|
}) : void 0;
|
|
1758
|
-
case "provider-trigger": return t.kind == "flow" ?
|
|
1614
|
+
case "provider-trigger": return t.kind == "flow" ? Ae(t, {
|
|
1759
1615
|
bindingId: i(),
|
|
1760
1616
|
nodeId: n
|
|
1761
1617
|
}, r.definition, {
|
|
@@ -1764,10 +1620,10 @@ function Qe(e, t, n, r, i) {
|
|
|
1764
1620
|
}) : void 0;
|
|
1765
1621
|
}
|
|
1766
1622
|
}
|
|
1767
|
-
function
|
|
1768
|
-
return
|
|
1623
|
+
function He(e, t, n) {
|
|
1624
|
+
return je(e.revision.content, t, n);
|
|
1769
1625
|
}
|
|
1770
|
-
function
|
|
1626
|
+
function Ue(e, t, n) {
|
|
1771
1627
|
let r = e.graph(t)?.nodes ?? {}, i = Object.fromEntries(n.flatMap((e) => r[e] == null ? [] : [[e, r[e]]]));
|
|
1772
1628
|
return {
|
|
1773
1629
|
modules: Object.fromEntries(Object.values(i).flatMap((t) => {
|
|
@@ -1778,7 +1634,7 @@ function et(e, t, n) {
|
|
|
1778
1634
|
nodes: i
|
|
1779
1635
|
};
|
|
1780
1636
|
}
|
|
1781
|
-
function
|
|
1637
|
+
function We(e, t, n, r) {
|
|
1782
1638
|
if (e.graph(t) == null) return {
|
|
1783
1639
|
changes: [],
|
|
1784
1640
|
nodeIds: [],
|
|
@@ -1878,25 +1734,25 @@ function tt(e, t, n, r) {
|
|
|
1878
1734
|
sourceIds: a
|
|
1879
1735
|
};
|
|
1880
1736
|
}
|
|
1881
|
-
function
|
|
1882
|
-
return
|
|
1737
|
+
function Ge(e, t, n, r) {
|
|
1738
|
+
return Me(e.revision.content, t, n, r);
|
|
1883
1739
|
}
|
|
1884
|
-
function
|
|
1740
|
+
function Ke(e, t, n, r) {
|
|
1885
1741
|
let i = e.node(t, n)?.node;
|
|
1886
1742
|
if (i == null) return;
|
|
1887
1743
|
let { description: a, ...o } = i;
|
|
1888
|
-
return
|
|
1744
|
+
return q(t, n, r == null ? o : {
|
|
1889
1745
|
...o,
|
|
1890
1746
|
description: r
|
|
1891
1747
|
});
|
|
1892
1748
|
}
|
|
1893
|
-
function
|
|
1894
|
-
return
|
|
1749
|
+
function qe(e, t, n, r, i) {
|
|
1750
|
+
return Ne(e.revision.content, t, n, r, i);
|
|
1895
1751
|
}
|
|
1896
|
-
function
|
|
1752
|
+
function Je(e, t, n, r) {
|
|
1897
1753
|
let i = e.graph(t), a = i?.nodes[n];
|
|
1898
1754
|
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 =
|
|
1755
|
+
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 = G(o, s), u = new Set(Object.keys(s)), d = [];
|
|
1900
1756
|
for (let [e, o] of Object.entries(i.nodes)) {
|
|
1901
1757
|
if (!("inputs" in o)) continue;
|
|
1902
1758
|
let i = e == n, s = { ...o.inputs };
|
|
@@ -1941,9 +1797,9 @@ function at(e, t, n, r) {
|
|
|
1941
1797
|
}
|
|
1942
1798
|
return d;
|
|
1943
1799
|
}
|
|
1944
|
-
function
|
|
1800
|
+
function Ye(e, t, n, r) {
|
|
1945
1801
|
let i = e.node(t, n)?.node;
|
|
1946
|
-
if (i?.kind == "value") return
|
|
1802
|
+
if (i?.kind == "value") return q(t, n, {
|
|
1947
1803
|
...i,
|
|
1948
1804
|
values: Object.fromEntries(r.map((e) => [e.handle, {
|
|
1949
1805
|
...e.description == null ? {} : { description: e.description },
|
|
@@ -1953,56 +1809,56 @@ function ot(e, t, n, r) {
|
|
|
1953
1809
|
}]))
|
|
1954
1810
|
});
|
|
1955
1811
|
}
|
|
1956
|
-
function
|
|
1812
|
+
function Xe(e, t, n, r) {
|
|
1957
1813
|
let i = e.graph(t)?.nodes[n];
|
|
1958
1814
|
if (i?.kind == "task") switch (r.kind) {
|
|
1959
|
-
case "code": return i.task == null ? void 0 :
|
|
1815
|
+
case "code": return i.task == null ? void 0 : K(e, t, n, {
|
|
1960
1816
|
...i.task,
|
|
1961
|
-
|
|
1962
|
-
name: r.name,
|
|
1963
|
-
outputs: r.outputs
|
|
1817
|
+
name: r.name
|
|
1964
1818
|
});
|
|
1965
|
-
case "llm":
|
|
1966
|
-
|
|
1967
|
-
task
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1819
|
+
case "llm": {
|
|
1820
|
+
if (i.task != null) return;
|
|
1821
|
+
let t = e.task(i.taskId);
|
|
1822
|
+
return t?.executor.kind == "llm" ? [{
|
|
1823
|
+
kind: "task.replace",
|
|
1824
|
+
task: {
|
|
1825
|
+
executor: {
|
|
1826
|
+
kind: "llm",
|
|
1827
|
+
mode: r.mode
|
|
1828
|
+
},
|
|
1829
|
+
inputs: t.inputs,
|
|
1830
|
+
name: r.name,
|
|
1831
|
+
outputs: t.outputs
|
|
1971
1832
|
},
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
},
|
|
1976
|
-
taskId: i.taskId
|
|
1977
|
-
}];
|
|
1833
|
+
taskId: i.taskId
|
|
1834
|
+
}] : void 0;
|
|
1835
|
+
}
|
|
1978
1836
|
case "connector": {
|
|
1979
1837
|
if (i.task != null) return;
|
|
1980
1838
|
let t = e.task(i.taskId);
|
|
1981
1839
|
return t?.executor.kind == "connector" ? [{
|
|
1982
1840
|
kind: "task.replace",
|
|
1983
1841
|
task: {
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
name: r.name,
|
|
1987
|
-
outputs: r.outputs
|
|
1842
|
+
...t,
|
|
1843
|
+
name: r.name
|
|
1988
1844
|
},
|
|
1989
1845
|
taskId: i.taskId
|
|
1990
1846
|
}] : void 0;
|
|
1991
1847
|
}
|
|
1992
1848
|
}
|
|
1993
1849
|
}
|
|
1994
|
-
function
|
|
1850
|
+
function Ze(e, t, n, r) {
|
|
1995
1851
|
let i = e.graph(t)?.nodes[n];
|
|
1996
|
-
if (i?.kind == "task" && i.task != null) return
|
|
1852
|
+
if (i?.kind == "task" && i.task != null) return K(e, t, n, {
|
|
1997
1853
|
...i.task,
|
|
1998
1854
|
...r
|
|
1999
1855
|
});
|
|
2000
1856
|
}
|
|
2001
|
-
function
|
|
2002
|
-
let i = e.trigger(
|
|
1857
|
+
function Qe(e, t, n, r) {
|
|
1858
|
+
let i = e.trigger(n);
|
|
2003
1859
|
if (i == null || i.kind != "webhook") return;
|
|
2004
1860
|
let { options: a, ...o } = i;
|
|
2005
|
-
return
|
|
1861
|
+
return q(t, n, Object.keys(r.options).length == 0 ? {
|
|
2006
1862
|
...o,
|
|
2007
1863
|
inputsDef: r.inputs
|
|
2008
1864
|
} : {
|
|
@@ -2011,19 +1867,19 @@ function lt(e, t, n, r) {
|
|
|
2011
1867
|
options: r.options
|
|
2012
1868
|
});
|
|
2013
1869
|
}
|
|
2014
|
-
function
|
|
1870
|
+
function $e(e, t, n) {
|
|
2015
1871
|
if (e.subflow(t) != null) return [{
|
|
2016
1872
|
definition: n,
|
|
2017
1873
|
kind: "subflow.definition.replace",
|
|
2018
1874
|
subflowId: t
|
|
2019
1875
|
}];
|
|
2020
1876
|
}
|
|
2021
|
-
function
|
|
1877
|
+
function et(e, t, n, r) {
|
|
2022
1878
|
return [{
|
|
2023
1879
|
kind: "graph.node.create",
|
|
2024
1880
|
node: {
|
|
2025
1881
|
concurrency: 1,
|
|
2026
|
-
inputs:
|
|
1882
|
+
inputs: tt(r),
|
|
2027
1883
|
kind: "subflow",
|
|
2028
1884
|
subflowId: n
|
|
2029
1885
|
},
|
|
@@ -2031,20 +1887,20 @@ function dt(e, t, n, r) {
|
|
|
2031
1887
|
target: e
|
|
2032
1888
|
}];
|
|
2033
1889
|
}
|
|
2034
|
-
function
|
|
1890
|
+
function tt(e) {
|
|
2035
1891
|
return Object.fromEntries(Object.entries(e).flatMap(([e, t]) => Object.hasOwn(t, "value") ? [[e, {
|
|
2036
1892
|
kind: "value",
|
|
2037
1893
|
value: t.value
|
|
2038
1894
|
}]] : []));
|
|
2039
1895
|
}
|
|
2040
|
-
function
|
|
1896
|
+
function G(e, t) {
|
|
2041
1897
|
let n = Object.keys(e).filter((e) => !Object.hasOwn(t, e)), r = Object.keys(t).filter((t) => !Object.hasOwn(e, t));
|
|
2042
1898
|
return n.length == 1 && r.length == 1 ? [n[0], r[0]] : void 0;
|
|
2043
1899
|
}
|
|
2044
|
-
function
|
|
1900
|
+
function K(e, t, n, r) {
|
|
2045
1901
|
let i = e.graph(t), a = i?.nodes[n];
|
|
2046
1902
|
if (i == null || a?.kind != "task" || a.task == null) return;
|
|
2047
|
-
let o =
|
|
1903
|
+
let o = G(a.task.inputs, r.inputs), s = G(a.task.outputs, r.outputs), c = new Set(Object.keys(r.outputs)), l = [];
|
|
2048
1904
|
for (let [e, u] of Object.entries(i.nodes)) {
|
|
2049
1905
|
if (!("inputs" in u)) continue;
|
|
2050
1906
|
let i = e == n, d = { ...u.inputs };
|
|
@@ -2081,7 +1937,7 @@ function Y(e, t, n, r) {
|
|
|
2081
1937
|
}
|
|
2082
1938
|
return l;
|
|
2083
1939
|
}
|
|
2084
|
-
function
|
|
1940
|
+
function q(e, t, n) {
|
|
2085
1941
|
return [{
|
|
2086
1942
|
kind: "graph.node.replace",
|
|
2087
1943
|
node: n,
|
|
@@ -2091,38 +1947,37 @@ function X(e, t, n) {
|
|
|
2091
1947
|
}
|
|
2092
1948
|
//#endregion
|
|
2093
1949
|
//#region src/workbench/browser/runtime/designer/remoteChangeTargets.ts
|
|
2094
|
-
function
|
|
2095
|
-
return e.kind == t.kind && e.id == t.id;
|
|
1950
|
+
function nt(e, t) {
|
|
1951
|
+
return e.kind == t.kind && (e.kind != "subflow" || t.kind == "subflow" && e.id == t.id);
|
|
2096
1952
|
}
|
|
2097
|
-
function
|
|
1953
|
+
function J(e, t, n, r) {
|
|
2098
1954
|
for (let [i, a] of Object.entries(t.graph(n)?.nodes ?? {})) r(a) && e.add(i);
|
|
2099
1955
|
}
|
|
2100
|
-
function
|
|
1956
|
+
function rt(e, t, n, r) {
|
|
2101
1957
|
let i = /* @__PURE__ */ new Set();
|
|
2102
1958
|
for (let a of r) switch (a.kind) {
|
|
2103
1959
|
case "graph.node.create":
|
|
2104
1960
|
case "graph.node.replace":
|
|
2105
|
-
|
|
1961
|
+
nt(a.target, n) && i.add(a.nodeId);
|
|
2106
1962
|
break;
|
|
2107
1963
|
case "task.replace":
|
|
2108
|
-
|
|
1964
|
+
J(i, e, n, (e) => e.kind == "task" && e.task == null && e.taskId == a.taskId), J(i, t, n, (e) => e.kind == "task" && e.task == null && e.taskId == a.taskId);
|
|
2109
1965
|
break;
|
|
2110
1966
|
case "module.source.replace":
|
|
2111
|
-
|
|
1967
|
+
J(i, e, n, (e) => e.kind == "task" && e.task?.moduleId == a.moduleId), J(i, t, n, (e) => e.kind == "task" && e.task?.moduleId == a.moduleId);
|
|
2112
1968
|
break;
|
|
2113
|
-
case "subflow.definition.replace":
|
|
1969
|
+
case "subflow.definition.replace": J(i, e, n, (e) => e.kind == "subflow" && e.subflowId == a.subflowId), J(i, t, n, (e) => e.kind == "subflow" && e.subflowId == a.subflowId);
|
|
2114
1970
|
}
|
|
2115
1971
|
return new Set([...i].filter((e) => t.selection(n, e) != null));
|
|
2116
1972
|
}
|
|
2117
1973
|
//#endregion
|
|
2118
1974
|
//#region src/workbench/browser/runtime/stores/draftChanges.ts
|
|
2119
|
-
function
|
|
1975
|
+
function Y(e) {
|
|
2120
1976
|
if (e.length != 1) return;
|
|
2121
1977
|
let t = e[0];
|
|
2122
1978
|
switch (t.kind) {
|
|
2123
1979
|
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}`;
|
|
1980
|
+
case "graph.node.replace": return `${t.kind}:${t.target.kind}:${t.target.kind == "subflow" ? t.target.id : ""}:${t.nodeId}`;
|
|
2126
1981
|
case "module.rename":
|
|
2127
1982
|
case "module.source.replace": return `${t.kind}:${t.moduleId}`;
|
|
2128
1983
|
case "subflow.definition.replace": return `${t.kind}:${t.subflowId}`;
|
|
@@ -2130,24 +1985,7 @@ function ht(e) {
|
|
|
2130
1985
|
default: return;
|
|
2131
1986
|
}
|
|
2132
1987
|
}
|
|
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 {
|
|
1988
|
+
var it = class {
|
|
2151
1989
|
#e;
|
|
2152
1990
|
#t;
|
|
2153
1991
|
#n;
|
|
@@ -2175,28 +2013,26 @@ var _t = class {
|
|
|
2175
2013
|
this.#a = e;
|
|
2176
2014
|
}
|
|
2177
2015
|
project(e) {
|
|
2178
|
-
return this.#o.reduce((e, t) =>
|
|
2016
|
+
return this.#o.reduce((e, t) => W(e, t.changes), e);
|
|
2179
2017
|
}
|
|
2180
2018
|
enqueue(e) {
|
|
2181
2019
|
let t = this.#s.then(e);
|
|
2182
2020
|
return this.#s = t, t;
|
|
2183
2021
|
}
|
|
2184
2022
|
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 = {
|
|
2023
|
+
this.#t.beforeChange(r), this.#t.apply(W(t, n));
|
|
2024
|
+
let i = Y(n), a = this.#o.at(-1), o = i != null && a != null && !a.started && Y(a.changes) == i ? a : void 0;
|
|
2025
|
+
if (o != null) return o.changes = n, await o.result;
|
|
2026
|
+
let s = {
|
|
2191
2027
|
...e,
|
|
2192
2028
|
changes: n,
|
|
2193
2029
|
started: !1
|
|
2194
2030
|
};
|
|
2195
|
-
this.#a ??= t, this.#o.push(
|
|
2196
|
-
let
|
|
2197
|
-
|
|
2031
|
+
this.#a ??= t, this.#o.push(s), this.#i += 1;
|
|
2032
|
+
let c = this.#s.then(() => (s.started = !0, this.#c(s)));
|
|
2033
|
+
s.result = c, this.#s = c.then(() => void 0);
|
|
2198
2034
|
try {
|
|
2199
|
-
return await
|
|
2035
|
+
return await c;
|
|
2200
2036
|
} finally {
|
|
2201
2037
|
--this.#i, this.#i == 0 && this.#t.finishChanges();
|
|
2202
2038
|
}
|
|
@@ -2207,13 +2043,13 @@ var _t = class {
|
|
|
2207
2043
|
let n = this.#a;
|
|
2208
2044
|
if (n == null) return;
|
|
2209
2045
|
try {
|
|
2210
|
-
let t = await this.#e.changeDraft(e.
|
|
2046
|
+
let t = await this.#e.changeDraft(e.flowId, n.revisionId, e.changes);
|
|
2211
2047
|
if (!this.#t.current(e)) return;
|
|
2212
2048
|
if (t.revision.parentRevisionId != n.revisionId) throw Error("Invalid Draft change response.");
|
|
2213
2049
|
let r = this.#l(e, n, t);
|
|
2214
2050
|
return this.#o.length == 0 && this.#t.check(), r;
|
|
2215
2051
|
} catch (n) {
|
|
2216
|
-
if (n instanceof
|
|
2052
|
+
if (n instanceof _ && n.code == "flow.revision-conflict") {
|
|
2217
2053
|
if (!t && await this.#t.recover(e)) {
|
|
2218
2054
|
t = !0;
|
|
2219
2055
|
continue;
|
|
@@ -2222,7 +2058,7 @@ var _t = class {
|
|
|
2222
2058
|
kind: "error",
|
|
2223
2059
|
message: this.#n.t("notice.draftConflict")
|
|
2224
2060
|
});
|
|
2225
|
-
} else this.#u(e), this.#t.current(e) && this.#r(
|
|
2061
|
+
} else this.#u(e), this.#t.current(e) && this.#r(p(n, this.#n.t));
|
|
2226
2062
|
return;
|
|
2227
2063
|
}
|
|
2228
2064
|
}
|
|
@@ -2230,95 +2066,28 @@ var _t = class {
|
|
|
2230
2066
|
#l(e, t, n) {
|
|
2231
2067
|
let r = {
|
|
2232
2068
|
...n.revision,
|
|
2233
|
-
content:
|
|
2069
|
+
content: W(t, e.changes).content
|
|
2234
2070
|
};
|
|
2235
2071
|
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
|
|
2072
|
+
let i = this.#t.diagnostics(), a = this.#o.length == 0 && i?.revisionId == r.revisionId;
|
|
2073
|
+
return this.#t.apply(this.project(r), a), this.#t.headChanged(e.flowId, r.revisionId), r;
|
|
2238
2074
|
}
|
|
2239
2075
|
#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;
|
|
2076
|
+
this.#o = this.#o.filter((t) => t !== e), !(!this.#t.current(e) || this.#a == null) && this.#t.apply(this.project(this.#a));
|
|
2300
2077
|
}
|
|
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 = {
|
|
2078
|
+
}, X = 50, at = {
|
|
2310
2079
|
failed: !1,
|
|
2311
2080
|
loaded: !1,
|
|
2312
2081
|
loading: !0,
|
|
2313
2082
|
loadingMore: !1,
|
|
2314
2083
|
loadMoreFailed: !1,
|
|
2315
|
-
|
|
2316
|
-
},
|
|
2084
|
+
flows: []
|
|
2085
|
+
}, ot = class {
|
|
2317
2086
|
#e;
|
|
2318
2087
|
#t;
|
|
2319
|
-
#n = new
|
|
2088
|
+
#n = new o();
|
|
2320
2089
|
#r;
|
|
2321
|
-
#i = t(
|
|
2090
|
+
#i = t(at);
|
|
2322
2091
|
#a = !1;
|
|
2323
2092
|
constructor(t, n, r) {
|
|
2324
2093
|
this.#e = t, this.#t = r, this.#r = n, this.$ = {
|
|
@@ -2327,7 +2096,7 @@ var _t = class {
|
|
|
2327
2096
|
loadingMore: e(this.#i, (e) => e.loadingMore),
|
|
2328
2097
|
loadMoreFailed: e(this.#i, (e) => e.loadMoreFailed),
|
|
2329
2098
|
nextCursor: e(this.#i, (e) => e.nextCursor),
|
|
2330
|
-
|
|
2099
|
+
flows: e(this.#i, (e) => e.flows),
|
|
2331
2100
|
total: e(this.#i, (e) => e.total)
|
|
2332
2101
|
};
|
|
2333
2102
|
}
|
|
@@ -2346,8 +2115,8 @@ var _t = class {
|
|
|
2346
2115
|
capture() {
|
|
2347
2116
|
return this.#n.capture();
|
|
2348
2117
|
}
|
|
2349
|
-
|
|
2350
|
-
return this.#i.value.
|
|
2118
|
+
flow(e) {
|
|
2119
|
+
return this.#i.value.flows.find((t) => t.flowId == e);
|
|
2351
2120
|
}
|
|
2352
2121
|
async reload() {
|
|
2353
2122
|
let e = this.#n.begin();
|
|
@@ -2358,20 +2127,20 @@ var _t = class {
|
|
|
2358
2127
|
loadingMore: !1,
|
|
2359
2128
|
loadMoreFailed: !1,
|
|
2360
2129
|
nextCursor: void 0,
|
|
2361
|
-
|
|
2130
|
+
flows: [],
|
|
2362
2131
|
total: void 0
|
|
2363
2132
|
});
|
|
2364
2133
|
try {
|
|
2365
|
-
let t = await this.#e.
|
|
2134
|
+
let t = await this.#e.listFlows({
|
|
2366
2135
|
includeTotal: !0,
|
|
2367
|
-
limit:
|
|
2136
|
+
limit: X
|
|
2368
2137
|
});
|
|
2369
2138
|
if (!e()) return;
|
|
2370
2139
|
this.#o({
|
|
2371
2140
|
loaded: !0,
|
|
2372
2141
|
loading: !1,
|
|
2373
2142
|
nextCursor: t.nextCursor,
|
|
2374
|
-
|
|
2143
|
+
flows: t.flows,
|
|
2375
2144
|
total: t.total
|
|
2376
2145
|
});
|
|
2377
2146
|
} catch (t) {
|
|
@@ -2379,7 +2148,7 @@ var _t = class {
|
|
|
2379
2148
|
this.#o({
|
|
2380
2149
|
failed: !0,
|
|
2381
2150
|
loading: !1
|
|
2382
|
-
}), this.#r(
|
|
2151
|
+
}), this.#r(p(t, this.#t.t));
|
|
2383
2152
|
}
|
|
2384
2153
|
}
|
|
2385
2154
|
async loadMore() {
|
|
@@ -2391,43 +2160,48 @@ var _t = class {
|
|
|
2391
2160
|
loadMoreFailed: !1
|
|
2392
2161
|
});
|
|
2393
2162
|
try {
|
|
2394
|
-
let e = await this.#e.
|
|
2163
|
+
let e = await this.#e.listFlows({
|
|
2395
2164
|
cursor: t,
|
|
2396
|
-
limit:
|
|
2165
|
+
limit: X
|
|
2397
2166
|
});
|
|
2398
2167
|
if (!n()) return;
|
|
2399
|
-
let r = new Set(this.#i.value.
|
|
2168
|
+
let r = new Set(this.#i.value.flows.map((e) => e.flowId));
|
|
2400
2169
|
this.#o({
|
|
2401
2170
|
loadingMore: !1,
|
|
2402
2171
|
nextCursor: e.nextCursor,
|
|
2403
|
-
|
|
2172
|
+
flows: [...this.#i.value.flows, ...e.flows.filter((e) => !r.has(e.flowId))]
|
|
2404
2173
|
});
|
|
2405
2174
|
} catch (e) {
|
|
2406
2175
|
if (!n()) return;
|
|
2407
2176
|
this.#o({
|
|
2408
2177
|
loadingMore: !1,
|
|
2409
2178
|
loadMoreFailed: !0
|
|
2410
|
-
}), this.#r(
|
|
2179
|
+
}), this.#r(p(e, this.#t.t));
|
|
2411
2180
|
}
|
|
2412
2181
|
}
|
|
2413
2182
|
async create(e) {
|
|
2414
|
-
let t = await this.#e.
|
|
2183
|
+
let t = await this.#e.createFlow(e);
|
|
2415
2184
|
if (!this.#a) return this.#o({
|
|
2416
|
-
|
|
2185
|
+
flows: [...this.#i.value.flows, t],
|
|
2417
2186
|
total: this.#i.value.total == null ? void 0 : this.#i.value.total + 1
|
|
2418
2187
|
}), t;
|
|
2419
2188
|
}
|
|
2420
2189
|
include(e) {
|
|
2421
|
-
|
|
2190
|
+
let t = this.#i.value.flows.findIndex((t) => t.flowId == e.flowId);
|
|
2191
|
+
if (t < 0) {
|
|
2192
|
+
this.#o({ flows: [...this.#i.value.flows, e] });
|
|
2193
|
+
return;
|
|
2194
|
+
}
|
|
2195
|
+
this.#o({ flows: this.#i.value.flows.with(t, e) });
|
|
2422
2196
|
}
|
|
2423
2197
|
remove(e) {
|
|
2424
2198
|
this.#o({
|
|
2425
|
-
|
|
2199
|
+
flows: this.#i.value.flows.filter((t) => t.flowId != e),
|
|
2426
2200
|
total: this.#i.value.total == null ? void 0 : this.#i.value.total - 1
|
|
2427
2201
|
});
|
|
2428
2202
|
}
|
|
2429
2203
|
advanceHead(e, t) {
|
|
2430
|
-
this.#o({
|
|
2204
|
+
this.#o({ flows: this.#i.value.flows.map((n) => n.flowId == e ? {
|
|
2431
2205
|
...n,
|
|
2432
2206
|
draftRevisionId: t
|
|
2433
2207
|
} : n) });
|
|
@@ -2438,22 +2212,149 @@ var _t = class {
|
|
|
2438
2212
|
...e
|
|
2439
2213
|
});
|
|
2440
2214
|
}
|
|
2441
|
-
},
|
|
2215
|
+
}, st = class {
|
|
2216
|
+
#e;
|
|
2217
|
+
#t;
|
|
2218
|
+
#n;
|
|
2219
|
+
#r;
|
|
2220
|
+
#i = Promise.resolve();
|
|
2221
|
+
#a;
|
|
2222
|
+
#o = !1;
|
|
2223
|
+
#s = [];
|
|
2224
|
+
constructor(e, t, n, r) {
|
|
2225
|
+
this.#e = e, this.#n = t, this.#r = n, this.#t = r;
|
|
2226
|
+
}
|
|
2227
|
+
reset(e) {
|
|
2228
|
+
this.#a = e, this.#s = [];
|
|
2229
|
+
}
|
|
2230
|
+
dispose() {
|
|
2231
|
+
this.#o = !0, this.#s = [];
|
|
2232
|
+
}
|
|
2233
|
+
async change(e, t, n, r) {
|
|
2234
|
+
if (this.#o || this.#a == null) return;
|
|
2235
|
+
let i = r(t.value);
|
|
2236
|
+
if (i === t.value) return;
|
|
2237
|
+
let a = {
|
|
2238
|
+
current: n,
|
|
2239
|
+
flowId: e,
|
|
2240
|
+
update: r
|
|
2241
|
+
};
|
|
2242
|
+
this.#s.push(a), this.#r({
|
|
2243
|
+
...t,
|
|
2244
|
+
value: i
|
|
2245
|
+
}), this.#i = this.#i.then(async () => {
|
|
2246
|
+
if (this.#o || !n()) return;
|
|
2247
|
+
let t = this.#a, i = r(t.value);
|
|
2248
|
+
if (i === t.value) {
|
|
2249
|
+
this.#c(a, t);
|
|
2250
|
+
return;
|
|
2251
|
+
}
|
|
2252
|
+
try {
|
|
2253
|
+
let r = await this.#e.updatePresentation(e, t.revision, i);
|
|
2254
|
+
if (this.#o || !n()) return;
|
|
2255
|
+
this.#c(a, r);
|
|
2256
|
+
} catch (r) {
|
|
2257
|
+
if (this.#o || !n()) return;
|
|
2258
|
+
if (r instanceof _ && r.code == "flow.presentation-conflict") try {
|
|
2259
|
+
let t = await this.#e.getPresentation(e);
|
|
2260
|
+
if (this.#o || !n()) return;
|
|
2261
|
+
this.#c(a, t), this.#n({
|
|
2262
|
+
kind: "error",
|
|
2263
|
+
message: this.#t.t("notice.layoutConflict")
|
|
2264
|
+
});
|
|
2265
|
+
} catch (e) {
|
|
2266
|
+
!this.#o && n() && this.#n(p(e, this.#t.t));
|
|
2267
|
+
}
|
|
2268
|
+
else this.#c(a, t), this.#n(p(r, this.#t.t));
|
|
2269
|
+
}
|
|
2270
|
+
}), await this.#i;
|
|
2271
|
+
}
|
|
2272
|
+
#c(e, t) {
|
|
2273
|
+
this.#s = this.#s.filter((t) => t !== e), this.#a = t;
|
|
2274
|
+
let n = this.#s.reduce((e, t) => t.update(e), t.value);
|
|
2275
|
+
this.#r(n === t.value ? t : {
|
|
2276
|
+
...t,
|
|
2277
|
+
value: n
|
|
2278
|
+
});
|
|
2279
|
+
}
|
|
2280
|
+
};
|
|
2281
|
+
//#endregion
|
|
2282
|
+
//#region src/workbench/browser/runtime/designer/diagnostics.ts
|
|
2283
|
+
function ct(e, t) {
|
|
2284
|
+
return t == e || t.startsWith(`${e}/`);
|
|
2285
|
+
}
|
|
2286
|
+
function lt(e, t, n, r) {
|
|
2287
|
+
if (e == null || t == null || n == null) return [];
|
|
2288
|
+
if (r != null) return mt(t, r, n.diagnostics);
|
|
2289
|
+
let i = t.kind == "flow" ? "/document/graph" : `/document/subflows/${t.id}`;
|
|
2290
|
+
return n.diagnostics.filter((e) => ct(i, e.path));
|
|
2291
|
+
}
|
|
2292
|
+
function ut(e) {
|
|
2293
|
+
return e.startsWith("/modules/") ? "code" : /\/graph\/nodes\/[^/]+\/task(?:\/|$)/.test(e) ? "task" : e.includes("/graph/nodes/") ? "node" : e.startsWith("/document/tasks/") ? "task" : "flow";
|
|
2294
|
+
}
|
|
2295
|
+
function dt(e, t) {
|
|
2296
|
+
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";
|
|
2297
|
+
}
|
|
2298
|
+
function ft(e, t, n) {
|
|
2299
|
+
if (e == null || t == null) return;
|
|
2300
|
+
let r = t.kind == "flow" ? "/document/graph/nodes/" : `/document/subflows/${t.id}/graph/nodes/`;
|
|
2301
|
+
if (n.path.startsWith(r)) {
|
|
2302
|
+
let i = n.path.slice(r.length), a = i.indexOf("/"), o = a < 0 ? i : i.slice(0, a), s = e.node(t, o);
|
|
2303
|
+
return s == null ? void 0 : {
|
|
2304
|
+
nodeId: o,
|
|
2305
|
+
section: dt(s.node, a < 0 ? "" : i.slice(a))
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
let i = /^\/document\/tasks\/([^/]+)(.*)$/.exec(n.path);
|
|
2309
|
+
if (i != null) {
|
|
2310
|
+
let n = e.findTaskNode(t, /* @__PURE__ */ new Set([i[1]]));
|
|
2311
|
+
return n == null ? void 0 : {
|
|
2312
|
+
nodeId: n,
|
|
2313
|
+
section: i[2].startsWith("/executor") ? "account" : "task"
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
let a = /^\/modules\/([^/]+)\/source$/.exec(n.path);
|
|
2317
|
+
if (a != null) {
|
|
2318
|
+
let n = e.findModuleNode(t, a[1]);
|
|
2319
|
+
if (n != null) return {
|
|
2320
|
+
nodeId: n,
|
|
2321
|
+
section: "module"
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
function pt(e, t, n) {
|
|
2326
|
+
return n?.diagnostics.map((n) => ({
|
|
2327
|
+
diagnostic: n,
|
|
2328
|
+
location: ft(e, t, n),
|
|
2329
|
+
scope: ut(n.path)
|
|
2330
|
+
})) ?? [];
|
|
2331
|
+
}
|
|
2332
|
+
function mt(e, t, n) {
|
|
2333
|
+
let r = e.kind == "flow" ? `/document/graph/nodes/${t.id}` : `/document/subflows/${e.id}/graph/nodes/${t.id}`, i = [r];
|
|
2334
|
+
if (t.kind == "task") {
|
|
2335
|
+
t.node.task == null ? i.push(`/document/tasks/${t.node.taskId}`) : i.push(`${r}/task`);
|
|
2336
|
+
let e = t.definition != null && "moduleId" in t.definition ? t.definition.moduleId : void 0;
|
|
2337
|
+
e != null && i.push(`/modules/${e}`);
|
|
2338
|
+
} else t.kind == "subflow" && i.push(`/document/subflows/${t.node.subflowId}`);
|
|
2339
|
+
return n.filter((e) => i.some((t) => ct(t, e.path)));
|
|
2340
|
+
}
|
|
2341
|
+
//#endregion
|
|
2342
|
+
//#region src/workbench/browser/runtime/stores/workspaceModel.ts
|
|
2343
|
+
var ht = {
|
|
2442
2344
|
checkLoading: !1,
|
|
2443
|
-
flows: [],
|
|
2444
2345
|
selectedNodeIds: [],
|
|
2445
2346
|
workspaceLoadFailed: !1,
|
|
2446
2347
|
workspaceLoading: !1
|
|
2447
2348
|
};
|
|
2448
|
-
function
|
|
2349
|
+
function gt(e) {
|
|
2449
2350
|
return e.workspaceLoading ? "loading" : e.busy == "designer" ? "saving" : e.draft == null ? "noDraft" : "saved";
|
|
2450
2351
|
}
|
|
2451
|
-
function
|
|
2352
|
+
function Z(e, t) {
|
|
2452
2353
|
if (t.phase != null) return t.phase;
|
|
2453
2354
|
let n = e?.content.modules[t.moduleId];
|
|
2454
2355
|
return n == null ? "failed" : t.source == n.source ? "saved" : "dirty";
|
|
2455
2356
|
}
|
|
2456
|
-
function
|
|
2357
|
+
function Q(e, t, n) {
|
|
2457
2358
|
if (e == null || t == null || n.length != 1) return;
|
|
2458
2359
|
let r = e.node(t, n[0]);
|
|
2459
2360
|
if (!(r?.kind != "task" || r.definition == null || !("moduleId" in r.definition) || r.module == null)) return {
|
|
@@ -2461,72 +2362,69 @@ function $(e, t, n) {
|
|
|
2461
2362
|
source: r.module.source
|
|
2462
2363
|
};
|
|
2463
2364
|
}
|
|
2464
|
-
var
|
|
2365
|
+
var _t = class {
|
|
2465
2366
|
#e;
|
|
2466
|
-
#t = t(
|
|
2367
|
+
#t = t(ht);
|
|
2467
2368
|
#n;
|
|
2468
2369
|
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) =>
|
|
2370
|
+
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
2371
|
if (e.moduleEditor == null) return;
|
|
2471
2372
|
let { phase: t, ...n } = e.moduleEditor;
|
|
2472
2373
|
return {
|
|
2473
2374
|
...n,
|
|
2474
|
-
status:
|
|
2375
|
+
status: Z(e.draft, e.moduleEditor)
|
|
2475
2376
|
};
|
|
2476
|
-
}),
|
|
2377
|
+
}), 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), h = e(this.#t, (e) => e.draft == null ? void 0 : m(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
2378
|
this.#e = e(this.#t, (e) => ({
|
|
2478
|
-
revision: e.draft == null ? void 0 :
|
|
2379
|
+
revision: e.draft == null ? void 0 : m(e.draft),
|
|
2479
2380
|
target: e.target
|
|
2480
2381
|
}), { 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
|
|
2382
|
+
let b = e(this.#t, (e) => {
|
|
2383
|
+
if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return m(e.draft).selection(e.target, e.selectedNodeIds[0]);
|
|
2483
2384
|
});
|
|
2484
2385
|
this.$ = {
|
|
2485
2386
|
addNodeOptions: n((e) => {
|
|
2486
2387
|
let { revision: n, target: r } = e(this.#e);
|
|
2487
|
-
return
|
|
2388
|
+
return ee(n?.revision, r, e(t.t$));
|
|
2488
2389
|
}),
|
|
2489
2390
|
busy: i,
|
|
2490
2391
|
checkLoading: a,
|
|
2491
2392
|
diagnosticFocus: o,
|
|
2492
|
-
diagnosticItems: e(this.#t, (e) =>
|
|
2393
|
+
diagnosticItems: e(this.#t, (e) => pt(e.draft == null ? void 0 : m(e.draft), e.target, e.diagnostics)),
|
|
2493
2394
|
diagnostics: s,
|
|
2494
2395
|
draft: c,
|
|
2495
|
-
|
|
2496
|
-
|
|
2396
|
+
flow: n((e) => {
|
|
2397
|
+
let t = e(f);
|
|
2398
|
+
return t == null ? void 0 : e(r.$.flows).find((e) => e.flowId == t);
|
|
2399
|
+
}),
|
|
2400
|
+
flowId: f,
|
|
2401
|
+
flowLoadFailed: r.$.failed,
|
|
2402
|
+
flowLoadMoreFailed: r.$.loadMoreFailed,
|
|
2403
|
+
flowLoading: r.$.loading,
|
|
2404
|
+
flowLoadingMore: r.$.loadingMore,
|
|
2405
|
+
flowNextCursor: r.$.nextCursor,
|
|
2406
|
+
flowTotal: r.$.total,
|
|
2407
|
+
flows: r.$.flows,
|
|
2408
|
+
inspectorDiagnostics: e(this.#t, (e) => lt(e.draft == null ? void 0 : m(e.draft), e.target, e.diagnostics, b.value)),
|
|
2409
|
+
live: p,
|
|
2497
2410
|
moduleDiagnostics: e(this.#t, (e) => {
|
|
2498
2411
|
let t = e.moduleEditor?.moduleId;
|
|
2499
2412
|
return t == null ? [] : e.diagnostics?.diagnostics.filter((e) => e.path.startsWith(`/modules/${t}/source`)) ?? [];
|
|
2500
2413
|
}),
|
|
2501
|
-
moduleEditor:
|
|
2502
|
-
nodeFocus:
|
|
2503
|
-
presentation:
|
|
2504
|
-
project: n((e) => {
|
|
2505
|
-
let t = e(m);
|
|
2506
|
-
return t == null ? void 0 : e(r.$.projects).find((e) => e.projectId == t);
|
|
2507
|
-
}),
|
|
2508
|
-
projectId: m,
|
|
2509
|
-
projectLoadFailed: r.$.failed,
|
|
2510
|
-
projectLoadMoreFailed: r.$.loadMoreFailed,
|
|
2511
|
-
projectLoading: r.$.loading,
|
|
2512
|
-
projectLoadingMore: r.$.loadingMore,
|
|
2513
|
-
projectNextCursor: r.$.nextCursor,
|
|
2514
|
-
projectTotal: r.$.total,
|
|
2515
|
-
projects: r.$.projects,
|
|
2414
|
+
moduleEditor: l,
|
|
2415
|
+
nodeFocus: u,
|
|
2416
|
+
presentation: d,
|
|
2516
2417
|
revision: h,
|
|
2517
|
-
selection:
|
|
2518
|
-
selectedNodeIds:
|
|
2519
|
-
status: e(this.#t,
|
|
2520
|
-
target:
|
|
2521
|
-
targetFlow:
|
|
2418
|
+
selection: b,
|
|
2419
|
+
selectedNodeIds: g,
|
|
2420
|
+
status: e(this.#t, gt),
|
|
2421
|
+
target: _,
|
|
2422
|
+
targetFlow: n((e) => e(_)?.kind == "flow" ? e(r.$.flows).find((t) => t.flowId == e(f)) : void 0),
|
|
2522
2423
|
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;
|
|
2424
|
+
if (e.target != null) return e.target.kind == "flow" ? r.flow(e.flowId ?? "")?.name : e.draft == null ? e.target.id : m(e.draft).subflow(e.target.id)?.name ?? e.target.id;
|
|
2527
2425
|
}),
|
|
2528
|
-
workspaceLoadFailed:
|
|
2529
|
-
workspaceLoading:
|
|
2426
|
+
workspaceLoadFailed: v,
|
|
2427
|
+
workspaceLoading: y
|
|
2530
2428
|
}, this.#n = new Set(Object.values(r.$));
|
|
2531
2429
|
}
|
|
2532
2430
|
get value() {
|
|
@@ -2542,28 +2440,17 @@ var wt = class {
|
|
|
2542
2440
|
for (let e of Object.values(this.$)) this.#n.has(e) || e.dispose();
|
|
2543
2441
|
this.#e.dispose(), this.#t.dispose();
|
|
2544
2442
|
}
|
|
2545
|
-
},
|
|
2546
|
-
function
|
|
2547
|
-
if (
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
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
|
-
};
|
|
2443
|
+
}, vt = 250;
|
|
2444
|
+
function yt(e, t) {
|
|
2445
|
+
if (t != null) return t.kind == "flow" || e.subflow(t.id) != null ? t : { kind: "flow" };
|
|
2446
|
+
}
|
|
2447
|
+
function $(e, t) {
|
|
2448
|
+
return e?.kind == t?.kind ? e?.kind != "subflow" || t?.kind == "subflow" && e.id == t.id : !1;
|
|
2562
2449
|
}
|
|
2563
|
-
var
|
|
2450
|
+
var bt = class {
|
|
2564
2451
|
#e;
|
|
2565
2452
|
#t;
|
|
2566
|
-
#n = new
|
|
2453
|
+
#n = new o();
|
|
2567
2454
|
#r;
|
|
2568
2455
|
#i;
|
|
2569
2456
|
#a;
|
|
@@ -2582,182 +2469,166 @@ var Dt = class {
|
|
|
2582
2469
|
#v = !1;
|
|
2583
2470
|
#y = 0;
|
|
2584
2471
|
#b;
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2472
|
+
#x;
|
|
2473
|
+
constructor(e, t, n = () => crypto.randomUUID(), r = c(), i = () => {}) {
|
|
2474
|
+
this.#e = e, this.#c = t, this.#i = n, this.#r = r, this.#s = i, this.#o = new ot(e, t, r), this.#l = new _t(r, this.#o), this.#t = new it(e, t, r, {
|
|
2475
|
+
apply: (e, t) => this.#w(e, t),
|
|
2588
2476
|
beforeChange: (e) => {
|
|
2589
|
-
this.#
|
|
2477
|
+
this.#M(), this.#h = !1, e && (this.#B({ busy: "designer" }), this.#c(void 0));
|
|
2590
2478
|
},
|
|
2591
|
-
check: () => void this.#
|
|
2592
|
-
current: (e) => this.#
|
|
2479
|
+
check: () => void this.#E(),
|
|
2480
|
+
current: (e) => this.#z(e),
|
|
2593
2481
|
diagnostics: () => this.#l.value.diagnostics,
|
|
2594
2482
|
finishChanges: () => {
|
|
2595
|
-
!this.#_ && this.#l.value.busy == "designer" && this.#
|
|
2483
|
+
!this.#_ && this.#l.value.busy == "designer" && this.#B({ busy: void 0 });
|
|
2596
2484
|
},
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
}), this.#a = new vt(e, t, (e) => this.#z({ presentation: e }), r), this.$ = this.#l.$;
|
|
2485
|
+
headChanged: (e, t) => this.#N(e, t),
|
|
2486
|
+
recover: (e) => this.#O(e, !0)
|
|
2487
|
+
}), this.#a = new st(e, t, (e) => this.#B({ presentation: e }), r), this.$ = this.#l.$;
|
|
2601
2488
|
}
|
|
2602
2489
|
dispose() {
|
|
2603
|
-
this.#
|
|
2490
|
+
this.#M(), this.#_ = !0, this.#n.invalidate(), this.#a.dispose(), this.#b?.(), this.#x?.(), this.#l.dispose(), this.#o.dispose();
|
|
2604
2491
|
}
|
|
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());
|
|
2492
|
+
async start(e) {
|
|
2493
|
+
this.#b ??= this.#e.watchFlowCatalog(() => void this.reloadFlows()), await this.reloadFlows(), await this.selectFlow(e);
|
|
2611
2494
|
}
|
|
2612
|
-
async
|
|
2495
|
+
async reloadFlows() {
|
|
2613
2496
|
await this.#o.reload();
|
|
2614
2497
|
}
|
|
2615
|
-
async
|
|
2498
|
+
async loadMoreFlows() {
|
|
2616
2499
|
await this.#o.loadMore();
|
|
2617
2500
|
}
|
|
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.#
|
|
2501
|
+
async selectFlow(e) {
|
|
2502
|
+
if (!this.#F()) return !1;
|
|
2503
|
+
this.#M();
|
|
2504
|
+
let t = this.#o.beginSelection();
|
|
2505
|
+
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
2506
|
checkLoading: !1,
|
|
2624
2507
|
diagnosticFocus: void 0,
|
|
2625
2508
|
diagnostics: void 0,
|
|
2626
2509
|
draft: void 0,
|
|
2627
|
-
|
|
2510
|
+
live: void 0,
|
|
2628
2511
|
moduleEditor: void 0,
|
|
2629
2512
|
nodeFocus: void 0,
|
|
2630
2513
|
presentation: void 0,
|
|
2631
|
-
|
|
2514
|
+
flowId: e,
|
|
2632
2515
|
selectedNodeIds: [],
|
|
2633
|
-
target:
|
|
2634
|
-
id: t,
|
|
2635
|
-
kind: "flow"
|
|
2636
|
-
},
|
|
2516
|
+
target: e == null ? void 0 : { kind: "flow" },
|
|
2637
2517
|
workspaceLoadFailed: !1,
|
|
2638
2518
|
workspaceLoading: e != null
|
|
2639
2519
|
}), e == null) return !0;
|
|
2640
2520
|
try {
|
|
2641
|
-
let
|
|
2642
|
-
|
|
2521
|
+
let n = this.#o.flow(e), [r, i, a, o] = await Promise.all([
|
|
2522
|
+
n ?? this.#e.getFlow(e),
|
|
2643
2523
|
this.#e.getDraft(e),
|
|
2644
|
-
this.#e.
|
|
2524
|
+
this.#e.getLive(e),
|
|
2645
2525
|
this.#e.getPresentation(e)
|
|
2646
2526
|
]);
|
|
2647
|
-
if (!
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
draft: a,
|
|
2654
|
-
flows: o,
|
|
2655
|
-
presentation: s,
|
|
2656
|
-
target: l,
|
|
2527
|
+
if (!t()) return !1;
|
|
2528
|
+
this.#t.reset(i), this.#a.reset(o), this.#o.include(r), this.#B({
|
|
2529
|
+
draft: i,
|
|
2530
|
+
live: a,
|
|
2531
|
+
presentation: o,
|
|
2532
|
+
target: { kind: "flow" },
|
|
2657
2533
|
workspaceLoadFailed: !1,
|
|
2658
2534
|
workspaceLoading: !1
|
|
2659
|
-
}), this.#
|
|
2660
|
-
!this.#_ && e != this.#t.committed?.revisionId && this.#
|
|
2535
|
+
}), this.#E(), this.#x = this.#e.watchFlow(e, (e) => {
|
|
2536
|
+
!this.#_ && e != this.#t.committed?.revisionId && this.#D(e);
|
|
2661
2537
|
}, this.#s);
|
|
2662
2538
|
} catch (e) {
|
|
2663
|
-
return
|
|
2539
|
+
return t() ? (this.#B({
|
|
2664
2540
|
workspaceLoadFailed: !0,
|
|
2665
2541
|
workspaceLoading: !1
|
|
2666
|
-
}), this.#c(
|
|
2542
|
+
}), this.#c(p(e, this.#r.t)), !1) : !1;
|
|
2667
2543
|
}
|
|
2668
2544
|
return !0;
|
|
2669
2545
|
}
|
|
2670
2546
|
selectTarget(e) {
|
|
2671
|
-
return this.#
|
|
2547
|
+
return this.#F() ? (this.#M(), this.#B({
|
|
2672
2548
|
diagnosticFocus: void 0,
|
|
2673
2549
|
diagnostics: void 0,
|
|
2674
2550
|
moduleEditor: void 0,
|
|
2675
2551
|
nodeFocus: void 0,
|
|
2676
2552
|
selectedNodeIds: [],
|
|
2677
2553
|
target: e
|
|
2678
|
-
}), this.#
|
|
2554
|
+
}), this.#E(), !0) : !1;
|
|
2679
2555
|
}
|
|
2680
2556
|
selectNodes(e) {
|
|
2681
|
-
return e.length == this.#l.value.selectedNodeIds.length && e.every((e, t) => e == this.#l.value.selectedNodeIds[t]) ? !0 : this.#
|
|
2557
|
+
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
2558
|
diagnosticFocus: void 0,
|
|
2683
|
-
moduleEditor:
|
|
2559
|
+
moduleEditor: Q(this.#l.value.draft == null ? void 0 : m(this.#l.value.draft), this.#l.value.target, e),
|
|
2684
2560
|
nodeFocus: void 0,
|
|
2685
2561
|
selectedNodeIds: e
|
|
2686
2562
|
}), !0) : !1;
|
|
2687
2563
|
}
|
|
2688
|
-
async
|
|
2689
|
-
if (this.#
|
|
2690
|
-
this.#
|
|
2564
|
+
async createFlow(e) {
|
|
2565
|
+
if (this.#F()) {
|
|
2566
|
+
this.#B({ busy: "flow" }), this.#c(void 0);
|
|
2691
2567
|
try {
|
|
2692
2568
|
return await this.#o.create(e);
|
|
2693
2569
|
} catch (e) {
|
|
2694
|
-
this.#_ || this.#c(
|
|
2570
|
+
this.#_ || this.#c(p(e, this.#r.t));
|
|
2695
2571
|
} finally {
|
|
2696
|
-
this.#
|
|
2572
|
+
this.#B({ busy: void 0 });
|
|
2697
2573
|
}
|
|
2698
2574
|
}
|
|
2699
2575
|
}
|
|
2700
|
-
async
|
|
2701
|
-
if (!this.#
|
|
2702
|
-
let t = this.#o.
|
|
2576
|
+
async deleteFlow(e) {
|
|
2577
|
+
if (!this.#F()) return !1;
|
|
2578
|
+
let t = this.#o.flow(e);
|
|
2703
2579
|
if (t == null || t.status == "retiring") return !1;
|
|
2704
|
-
this.#
|
|
2580
|
+
this.#B({ busy: "flow" }), this.#c(void 0);
|
|
2705
2581
|
try {
|
|
2706
|
-
return await this.#e.
|
|
2582
|
+
return await this.#e.deleteFlow(e), !this.#_ && (this.#o.remove(e), this.#c({
|
|
2707
2583
|
kind: "success",
|
|
2708
|
-
message: this.#r.t("notice.
|
|
2584
|
+
message: this.#r.t("notice.flowDeleteAccepted", { name: t.name })
|
|
2709
2585
|
}), !0);
|
|
2710
2586
|
} catch (e) {
|
|
2711
|
-
return this.#_ || this.#c(
|
|
2587
|
+
return this.#_ || this.#c(p(e, this.#r.t)), !1;
|
|
2712
2588
|
} finally {
|
|
2713
|
-
this.#
|
|
2589
|
+
this.#B({ busy: void 0 });
|
|
2714
2590
|
}
|
|
2715
2591
|
}
|
|
2716
|
-
async createResource(e
|
|
2717
|
-
if (!this.#
|
|
2718
|
-
let
|
|
2719
|
-
this.#
|
|
2720
|
-
let
|
|
2721
|
-
return this.#
|
|
2722
|
-
id:
|
|
2723
|
-
kind:
|
|
2592
|
+
async createResource(e) {
|
|
2593
|
+
if (!this.#F() || this.#l.value.draft == null) return !1;
|
|
2594
|
+
let t = this.#i();
|
|
2595
|
+
this.#B({ busy: "resource" }), this.#c(void 0);
|
|
2596
|
+
let n = await this.#C(Be(t, e), !1);
|
|
2597
|
+
return this.#B({ busy: void 0 }), n != null && (this.selectTarget({
|
|
2598
|
+
id: t,
|
|
2599
|
+
kind: "subflow"
|
|
2724
2600
|
}), this.#c({
|
|
2725
2601
|
kind: "success",
|
|
2726
|
-
message: this.#r.t("notice.createdInDraft", { name:
|
|
2602
|
+
message: this.#r.t("notice.createdInDraft", { name: e })
|
|
2727
2603
|
}), !0);
|
|
2728
2604
|
}
|
|
2729
2605
|
async renameFlow(e, t) {
|
|
2730
|
-
let n = this
|
|
2606
|
+
let n = this.#o.flow(e), r = t.trim();
|
|
2731
2607
|
if (n == null || r.length == 0) return !1;
|
|
2732
2608
|
if (n.name == r) return !0;
|
|
2733
|
-
this.#
|
|
2734
|
-
let i
|
|
2735
|
-
|
|
2609
|
+
this.#B({ busy: "flow" }), this.#c(void 0);
|
|
2610
|
+
let i;
|
|
2611
|
+
try {
|
|
2612
|
+
i = await this.#e.renameFlow(e, r), i != null && this.#o.include(i);
|
|
2613
|
+
} catch (e) {
|
|
2614
|
+
this.#_ || this.#c(p(e, this.#r.t));
|
|
2615
|
+
}
|
|
2616
|
+
return this.#B({ busy: void 0 }), i != null && (this.#c({
|
|
2736
2617
|
kind: "success",
|
|
2737
2618
|
message: this.#r.t("notice.flowRenamed", { name: r })
|
|
2738
2619
|
}), !0);
|
|
2739
2620
|
}
|
|
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
2621
|
async addNode(e, t, n) {
|
|
2751
|
-
if (!this.#
|
|
2622
|
+
if (!this.#F()) return;
|
|
2752
2623
|
let r = this.#l.value.draft, i = this.#l.value.target;
|
|
2753
2624
|
if (r == null || i == null) return;
|
|
2754
2625
|
let a = this.#i();
|
|
2755
|
-
if (e.kind == "comment") return await this.#
|
|
2756
|
-
let o =
|
|
2626
|
+
if (e.kind == "comment") return await this.#S(i, a, t);
|
|
2627
|
+
let o = m(r), s = b(e, o, i, this.#r.t);
|
|
2757
2628
|
if (s == null) return;
|
|
2758
|
-
let c =
|
|
2629
|
+
let c = Ve(o, i, a, s, this.#i);
|
|
2759
2630
|
if (c == null) return;
|
|
2760
|
-
let l = n == null ? c : [...c, ...
|
|
2631
|
+
let l = n == null ? c : [...c, ...I(W(r, c).content, i, n(a))], u = this.#C(l);
|
|
2761
2632
|
this.selectNodes([a]);
|
|
2762
2633
|
let d = this.moveNodes({ [a]: t });
|
|
2763
2634
|
if (await u != null) return await d, a;
|
|
@@ -2765,20 +2636,20 @@ var Dt = class {
|
|
|
2765
2636
|
async connect(e) {
|
|
2766
2637
|
let t = this.$.revision.value, n = this.#l.value.target;
|
|
2767
2638
|
if (t == null || n == null) return;
|
|
2768
|
-
let r =
|
|
2769
|
-
r.length > 0 && await this.#
|
|
2639
|
+
let r = I(t.revision.content, n, e);
|
|
2640
|
+
r.length > 0 && await this.#C(r);
|
|
2770
2641
|
}
|
|
2771
2642
|
async disconnect(e) {
|
|
2772
2643
|
let t = this.$.revision.value, n = this.#l.value.target;
|
|
2773
2644
|
if (t == null || n == null) return;
|
|
2774
|
-
let r =
|
|
2775
|
-
r.length > 0 && await this.#
|
|
2645
|
+
let r = Ce(t.revision.content, n, e);
|
|
2646
|
+
r.length > 0 && await this.#C(r);
|
|
2776
2647
|
}
|
|
2777
2648
|
async deleteSelectedNodes() {
|
|
2778
|
-
if (!this.#
|
|
2649
|
+
if (!this.#F()) return;
|
|
2779
2650
|
let e = this.$.revision.value, t = this.#l.value.target;
|
|
2780
2651
|
if (e == null || t == null || this.#l.value.selectedNodeIds.length == 0) return;
|
|
2781
|
-
let n =
|
|
2652
|
+
let n = h(this.#l.value.presentation?.value ?? {}, t), r = new Set(this.#l.value.selectedNodeIds.filter((e) => n.has(e))), i = He(e, t, this.#l.value.selectedNodeIds), a = i.length == 0 ? void 0 : this.#C(i), o = r.size == 0 ? void 0 : this.#T((e) => l(e, t, r));
|
|
2782
2653
|
this.selectNodes([]), (a == null || await a != null) && await o;
|
|
2783
2654
|
}
|
|
2784
2655
|
copySelectedNodes() {
|
|
@@ -2786,33 +2657,33 @@ var Dt = class {
|
|
|
2786
2657
|
if (e == null || t == null || this.#l.value.selectedNodeIds.length == 0) return;
|
|
2787
2658
|
let n = new Set(this.#l.value.selectedNodeIds);
|
|
2788
2659
|
this.#u = {
|
|
2789
|
-
comments: this.#
|
|
2660
|
+
comments: this.#P().nodes.flatMap((e) => e.kind == "comment" && n.has(e.id) ? [{
|
|
2790
2661
|
content: e.content,
|
|
2791
2662
|
position: e.position,
|
|
2792
2663
|
sourceId: e.id,
|
|
2793
2664
|
title: e.title
|
|
2794
2665
|
}] : []),
|
|
2795
|
-
nodes:
|
|
2666
|
+
nodes: Ue(e, t, this.#l.value.selectedNodeIds)
|
|
2796
2667
|
};
|
|
2797
2668
|
}
|
|
2798
2669
|
async pasteNodes() {
|
|
2799
|
-
if (!this.#
|
|
2670
|
+
if (!this.#F()) return;
|
|
2800
2671
|
let e = this.$.revision.value, t = this.#l.value.target;
|
|
2801
2672
|
if (e == null || t == null || this.#u == null) return;
|
|
2802
|
-
let n =
|
|
2673
|
+
let n = We(e, t, this.#u.nodes, this.#i), r = n.changes.length == 0 ? void 0 : this.#C(n.changes), i = this.#u.comments.map((e) => ({
|
|
2803
2674
|
...e,
|
|
2804
2675
|
nodeId: this.#i()
|
|
2805
2676
|
}));
|
|
2806
2677
|
if (n.nodeIds.length == 0 && i.length == 0) return;
|
|
2807
|
-
let a = new Map(this.#
|
|
2678
|
+
let a = new Map(this.#P().nodes.map((e) => [e.id, e])), o = Object.fromEntries(n.sourceIds.map((e, t) => {
|
|
2808
2679
|
let r = a.get(e);
|
|
2809
2680
|
return [n.nodeIds[t], {
|
|
2810
2681
|
x: (r?.position.x ?? 80) + 40,
|
|
2811
2682
|
y: (r?.position.y ?? 80) + 40
|
|
2812
2683
|
}];
|
|
2813
|
-
})), s = this.#
|
|
2684
|
+
})), s = this.#T((e) => {
|
|
2814
2685
|
let n = d(e, t, o);
|
|
2815
|
-
for (let e of i) n =
|
|
2686
|
+
for (let e of i) n = g(n, t, e.nodeId, {
|
|
2816
2687
|
content: e.content,
|
|
2817
2688
|
position: {
|
|
2818
2689
|
x: e.position.x + 40,
|
|
@@ -2830,38 +2701,38 @@ var Dt = class {
|
|
|
2830
2701
|
async saveNodeSettings(e, t) {
|
|
2831
2702
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2832
2703
|
if (n == null || r == null) return !1;
|
|
2833
|
-
let i =
|
|
2834
|
-
return i != null && await this.#
|
|
2704
|
+
let i = Ge(n, r, e, t);
|
|
2705
|
+
return i != null && await this.#C(i) != null;
|
|
2835
2706
|
}
|
|
2836
2707
|
async saveNodeDescription(e, t) {
|
|
2837
2708
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2838
2709
|
if (n == null || r == null) return !1;
|
|
2839
|
-
let i =
|
|
2840
|
-
return i != null && await this.#
|
|
2710
|
+
let i = Ke(n, r, e, t);
|
|
2711
|
+
return i != null && await this.#C(i) != null;
|
|
2841
2712
|
}
|
|
2842
2713
|
async setInputValue(e, t, n) {
|
|
2843
2714
|
let r = this.$.revision.value, i = this.#l.value.target;
|
|
2844
2715
|
if (r == null || i == null) return !1;
|
|
2845
|
-
let a =
|
|
2846
|
-
return a != null && await this.#
|
|
2716
|
+
let a = qe(r, i, e, t, n);
|
|
2717
|
+
return a != null && await this.#C(a) != null;
|
|
2847
2718
|
}
|
|
2848
2719
|
async saveCondition(e, t) {
|
|
2849
2720
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2850
2721
|
if (n == null || r == null) return !1;
|
|
2851
|
-
let i =
|
|
2852
|
-
return i != null && await this.#
|
|
2722
|
+
let i = Je(n, r, e, t);
|
|
2723
|
+
return i != null && await this.#C(i) != null;
|
|
2853
2724
|
}
|
|
2854
2725
|
async saveValue(e, t) {
|
|
2855
2726
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2856
2727
|
if (n == null || r == null) return !1;
|
|
2857
|
-
let i =
|
|
2858
|
-
return i != null && await this.#
|
|
2728
|
+
let i = Ye(n, r, e, t);
|
|
2729
|
+
return i != null && await this.#C(i) != null;
|
|
2859
2730
|
}
|
|
2860
2731
|
async saveComment(e, t) {
|
|
2861
2732
|
let n = this.#l.value.target;
|
|
2862
2733
|
if (n == null) return;
|
|
2863
|
-
let r = this.#
|
|
2864
|
-
r != null && await this.#
|
|
2734
|
+
let r = this.#P().nodes.find((t) => t.id == e)?.position;
|
|
2735
|
+
r != null && await this.#T((i) => g(i, n, e, {
|
|
2865
2736
|
...t,
|
|
2866
2737
|
position: r
|
|
2867
2738
|
}));
|
|
@@ -2869,60 +2740,60 @@ var Dt = class {
|
|
|
2869
2740
|
async saveTaskSettings(e, t) {
|
|
2870
2741
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2871
2742
|
if (n == null || r == null) return !1;
|
|
2872
|
-
let i =
|
|
2873
|
-
return i != null && await this.#
|
|
2743
|
+
let i = Xe(n, r, e, t);
|
|
2744
|
+
return i != null && await this.#C(i) != null;
|
|
2874
2745
|
}
|
|
2875
2746
|
async saveCodeTaskPorts(e, t) {
|
|
2876
2747
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2877
2748
|
if (n == null || r == null) return !1;
|
|
2878
|
-
let i =
|
|
2879
|
-
return i != null && await this.#
|
|
2749
|
+
let i = Ze(n, r, e, t);
|
|
2750
|
+
return i != null && await this.#C(i) != null;
|
|
2880
2751
|
}
|
|
2881
2752
|
async setConnectorConnection(e, t) {
|
|
2882
2753
|
let n = this.$.revision.value;
|
|
2883
2754
|
if (n == null) return !1;
|
|
2884
|
-
let r =
|
|
2885
|
-
return r != null && await this.#
|
|
2755
|
+
let r = Fe(n.revision.content, e, t);
|
|
2756
|
+
return r != null && await this.#C(r) != null;
|
|
2886
2757
|
}
|
|
2887
2758
|
async saveTriggerSettings(e, t) {
|
|
2888
2759
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2889
2760
|
if (n == null || r?.kind != "flow") return !1;
|
|
2890
|
-
let i =
|
|
2891
|
-
return i != null && await this.#
|
|
2761
|
+
let i = Ie(n.revision.content, r, e, t);
|
|
2762
|
+
return i != null && await this.#C(i) != null;
|
|
2892
2763
|
}
|
|
2893
2764
|
async saveTriggerConfig(e, t, n) {
|
|
2894
2765
|
let r = this.$.revision.value, i = this.#l.value.target;
|
|
2895
2766
|
if (r == null || i?.kind != "flow") return !1;
|
|
2896
|
-
let a =
|
|
2897
|
-
return a != null && await this.#
|
|
2767
|
+
let a = Le(r.revision.content, i, e, t, n);
|
|
2768
|
+
return a != null && await this.#C(a) != null;
|
|
2898
2769
|
}
|
|
2899
2770
|
async saveTriggerSchedule(e, t) {
|
|
2900
2771
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2901
2772
|
if (n == null || r?.kind != "flow") return !1;
|
|
2902
|
-
let i =
|
|
2903
|
-
return i != null && await this.#
|
|
2773
|
+
let i = Re(n.revision.content, r, e, t);
|
|
2774
|
+
return i != null && await this.#C(i) != null;
|
|
2904
2775
|
}
|
|
2905
2776
|
async saveWebhook(e, t) {
|
|
2906
2777
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2907
2778
|
if (n == null || r?.kind != "flow") return !1;
|
|
2908
|
-
let i =
|
|
2909
|
-
return i != null && await this.#
|
|
2779
|
+
let i = Qe(n, r, e, t);
|
|
2780
|
+
return i != null && await this.#C(i) != null;
|
|
2910
2781
|
}
|
|
2911
2782
|
async setTriggerConnection(e, t) {
|
|
2912
2783
|
let n = this.$.revision.value, r = this.#l.value.target;
|
|
2913
2784
|
if (n == null || r?.kind != "flow") return !1;
|
|
2914
|
-
let i =
|
|
2915
|
-
return i != null && await this.#
|
|
2785
|
+
let i = ze(n.revision.content, r, e, t);
|
|
2786
|
+
return i != null && await this.#C(i) != null;
|
|
2916
2787
|
}
|
|
2917
2788
|
async saveSubflowSettings(e, t) {
|
|
2918
2789
|
let n = this.$.revision.value;
|
|
2919
2790
|
if (n == null) return !1;
|
|
2920
|
-
let r =
|
|
2921
|
-
return r != null && await this.#
|
|
2791
|
+
let r = $e(n, e, t);
|
|
2792
|
+
return r != null && await this.#C(r) != null;
|
|
2922
2793
|
}
|
|
2923
2794
|
updateModuleSource(e) {
|
|
2924
2795
|
let t = this.#l.value.moduleEditor;
|
|
2925
|
-
t != null && t.source != e && this.#
|
|
2796
|
+
t != null && t.source != e && this.#B({ moduleEditor: {
|
|
2926
2797
|
...t,
|
|
2927
2798
|
phase: void 0,
|
|
2928
2799
|
source: e
|
|
@@ -2933,10 +2804,10 @@ var Dt = class {
|
|
|
2933
2804
|
if (e == null) return;
|
|
2934
2805
|
let t = this.#l.value.draft?.content.modules[e.moduleId];
|
|
2935
2806
|
if (t == null) {
|
|
2936
|
-
this.#
|
|
2807
|
+
this.#B({ moduleEditor: void 0 });
|
|
2937
2808
|
return;
|
|
2938
2809
|
}
|
|
2939
|
-
this.#
|
|
2810
|
+
this.#B({ moduleEditor: {
|
|
2940
2811
|
moduleId: e.moduleId,
|
|
2941
2812
|
source: t.source
|
|
2942
2813
|
} });
|
|
@@ -2944,311 +2815,298 @@ var Dt = class {
|
|
|
2944
2815
|
async saveModuleEditor() {
|
|
2945
2816
|
let e = this.#l.value.moduleEditor;
|
|
2946
2817
|
if (e == null || e.phase == "saving") return !1;
|
|
2947
|
-
this.#
|
|
2818
|
+
this.#B({ moduleEditor: {
|
|
2948
2819
|
...e,
|
|
2949
2820
|
phase: "saving"
|
|
2950
2821
|
} });
|
|
2951
|
-
let t = await
|
|
2822
|
+
let t = await we(e.source);
|
|
2952
2823
|
if (this.#_) return !1;
|
|
2953
|
-
let n = await this.#
|
|
2954
|
-
return !this.#_ && this.#l.value.moduleEditor?.moduleId == e.moduleId && this.#
|
|
2824
|
+
let n = await this.#C(Te(e.moduleId, e.source, t));
|
|
2825
|
+
return !this.#_ && this.#l.value.moduleEditor?.moduleId == e.moduleId && this.#B({ moduleEditor: {
|
|
2955
2826
|
...this.#l.value.moduleEditor,
|
|
2956
2827
|
phase: n == null ? "failed" : void 0
|
|
2957
2828
|
} }), n != null;
|
|
2958
2829
|
}
|
|
2959
2830
|
async moveNodes(e) {
|
|
2960
2831
|
let t = this.#l.value.target;
|
|
2961
|
-
t != null && await this.#
|
|
2832
|
+
t != null && await this.#T((n) => d(n, t, e));
|
|
2962
2833
|
}
|
|
2963
2834
|
async moveViewport(e) {
|
|
2964
2835
|
let t = this.#l.value.target;
|
|
2965
2836
|
if (t == null) return;
|
|
2966
|
-
let n = this.#
|
|
2967
|
-
(n.x != e.x || n.y != e.y || n.zoom != e.zoom) && this.#
|
|
2837
|
+
let n = this.#P().viewport;
|
|
2838
|
+
(n.x != e.x || n.y != e.y || n.zoom != e.zoom) && this.#M(), await this.#T((n) => te(n, t, e));
|
|
2968
2839
|
}
|
|
2969
2840
|
async check() {
|
|
2970
|
-
await this.#
|
|
2841
|
+
await this.#E();
|
|
2971
2842
|
}
|
|
2972
2843
|
async refreshFlows() {
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2844
|
+
await this.reloadFlows();
|
|
2845
|
+
}
|
|
2846
|
+
updateLive(e) {
|
|
2847
|
+
e.flowId == this.#l.value.flowId && this.#B({ live: e });
|
|
2977
2848
|
}
|
|
2978
2849
|
locateNode(e) {
|
|
2979
2850
|
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.#
|
|
2851
|
+
return t == null || n == null || t.node(n, e) == null || !this.selectNodes([e]) ? !1 : (this.#B({ nodeFocus: {
|
|
2981
2852
|
nodeId: e,
|
|
2982
2853
|
requestId: ++this.#y
|
|
2983
2854
|
} }), !0);
|
|
2984
2855
|
}
|
|
2985
2856
|
locateDiagnostic(e) {
|
|
2986
|
-
return e.location == null || !this.selectNodes([e.location.nodeId]) ? !1 : (this.#
|
|
2857
|
+
return e.location == null || !this.selectNodes([e.location.nodeId]) ? !1 : (this.#B({ diagnosticFocus: {
|
|
2987
2858
|
...e.location,
|
|
2988
2859
|
diagnostic: e.diagnostic,
|
|
2989
2860
|
requestId: ++this.#d
|
|
2990
2861
|
} }), !0);
|
|
2991
2862
|
}
|
|
2992
|
-
async #
|
|
2993
|
-
let r = Math.max(0, ...this.#
|
|
2863
|
+
async #S(e, t, n) {
|
|
2864
|
+
let r = Math.max(0, ...this.#P().nodes.flatMap((e) => {
|
|
2994
2865
|
if (e.kind != "comment") return [];
|
|
2995
2866
|
let t = /#(\d+)$/.exec(e.title);
|
|
2996
2867
|
return t == null ? [] : [Number(t[1])];
|
|
2997
|
-
})), i = this.#
|
|
2868
|
+
})), i = this.#T((i) => g(i, e, t, {
|
|
2998
2869
|
content: "",
|
|
2999
2870
|
position: n,
|
|
3000
2871
|
title: this.#r.t("addNode.commentName", { number: r + 1 })
|
|
3001
2872
|
}));
|
|
3002
2873
|
if (this.selectNodes([t]), await i, !this.#_) return t;
|
|
3003
2874
|
}
|
|
3004
|
-
async #
|
|
3005
|
-
let n = this.#l.value.
|
|
2875
|
+
async #C(e, t = !0) {
|
|
2876
|
+
let n = this.#l.value.flowId, r = this.#l.value.draft;
|
|
3006
2877
|
if (n != null && r != null) return await this.#t.change({
|
|
3007
2878
|
current: this.#n.capture(),
|
|
3008
|
-
|
|
2879
|
+
flowId: n
|
|
3009
2880
|
}, r, e, t);
|
|
3010
2881
|
}
|
|
3011
|
-
#
|
|
3012
|
-
let
|
|
3013
|
-
return this.#
|
|
3014
|
-
diagnostics:
|
|
2882
|
+
#w(e, t = !1) {
|
|
2883
|
+
let n = this.#l.value.draft, { revision: r, selectedNodeIds: i, target: a } = this.#I(e), o = this.#l.value.moduleEditor;
|
|
2884
|
+
return this.#B({
|
|
2885
|
+
diagnostics: t ? this.#l.value.diagnostics : void 0,
|
|
3015
2886
|
draft: e,
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
}), a;
|
|
2887
|
+
moduleEditor: o != null && n != null && Z(n, o) != "saved" ? o : Q(r, a, i),
|
|
2888
|
+
selectedNodeIds: i,
|
|
2889
|
+
target: a
|
|
2890
|
+
}), r;
|
|
3021
2891
|
}
|
|
3022
|
-
async #
|
|
2892
|
+
async #T(e) {
|
|
3023
2893
|
if (this.#_) return;
|
|
3024
|
-
let t = this.#l.value.
|
|
2894
|
+
let t = this.#l.value.flowId, n = this.#l.value.presentation;
|
|
3025
2895
|
t != null && n != null && await this.#a.change(t, n, this.#o.capture(), e);
|
|
3026
2896
|
}
|
|
3027
|
-
async #
|
|
2897
|
+
async #E() {
|
|
3028
2898
|
if (this.#_) return;
|
|
3029
|
-
let e = this.#l.value.
|
|
2899
|
+
let e = this.#l.value.flowId, t = this.#l.value.draft, n = this.#l.value.target;
|
|
3030
2900
|
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({
|
|
2901
|
+
n ?? this.#B({
|
|
3040
2902
|
checkLoading: !1,
|
|
3041
2903
|
diagnostics: void 0
|
|
3042
2904
|
});
|
|
3043
2905
|
return;
|
|
3044
2906
|
}
|
|
3045
|
-
this.#
|
|
2907
|
+
this.#B({
|
|
3046
2908
|
checkLoading: !0,
|
|
3047
2909
|
diagnosticFocus: void 0
|
|
3048
2910
|
});
|
|
3049
2911
|
try {
|
|
3050
|
-
let n = await this.#e.checkFlow(e, t.revisionId
|
|
3051
|
-
!this.#_ && e == this.#l.value.
|
|
2912
|
+
let n = await this.#e.checkFlow(e, t.revisionId);
|
|
2913
|
+
!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#B({ diagnostics: n });
|
|
3052
2914
|
} catch (n) {
|
|
3053
|
-
!this.#_ && e == this.#l.value.
|
|
2915
|
+
!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#c(p(n, this.#r.t));
|
|
3054
2916
|
} finally {
|
|
3055
|
-
!this.#_ && e == this.#l.value.
|
|
2917
|
+
!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#B({ checkLoading: !1 });
|
|
3056
2918
|
}
|
|
3057
2919
|
}
|
|
3058
|
-
async #
|
|
2920
|
+
async #D(e) {
|
|
3059
2921
|
if (this.#_) return;
|
|
3060
|
-
let t = this.#l.value.
|
|
2922
|
+
let t = this.#l.value.flowId;
|
|
3061
2923
|
if (t == null || (this.#f += 1, e != null && (this.#g = !0, this.#t.changing || (this.#h = !0)), this.#v)) return;
|
|
3062
2924
|
this.#v = !0;
|
|
3063
2925
|
let n = {
|
|
3064
2926
|
current: this.#n.capture(),
|
|
3065
|
-
|
|
2927
|
+
flowId: t
|
|
3066
2928
|
};
|
|
3067
2929
|
await this.#t.enqueue(async () => {
|
|
3068
2930
|
let e;
|
|
3069
2931
|
do {
|
|
3070
2932
|
e = this.#f;
|
|
3071
2933
|
let t = this.#h, r = this.#m, i = this.#g;
|
|
3072
|
-
this.#h = !1, this.#g = !1, await this.#
|
|
3073
|
-
} while (this.#
|
|
3074
|
-
}), this.#
|
|
2934
|
+
this.#h = !1, this.#g = !1, await this.#O(n, !1, i, t, r);
|
|
2935
|
+
} while (this.#z(n) && e != this.#f);
|
|
2936
|
+
}), this.#z(n) && (this.#v = !1);
|
|
3075
2937
|
}
|
|
3076
|
-
async #
|
|
2938
|
+
async #O(e, t, n = !1, r = !1, i = this.#m) {
|
|
3077
2939
|
try {
|
|
3078
2940
|
let t = r ? this.#l.value.target : void 0, a = this.#t.committed;
|
|
3079
2941
|
if (a == null) return !1;
|
|
3080
|
-
let o = await this.#e.syncDraft(e.
|
|
3081
|
-
if (!this.#
|
|
2942
|
+
let o = await this.#e.syncDraft(e.flowId, a.revisionId);
|
|
2943
|
+
if (!this.#z(e)) return !1;
|
|
3082
2944
|
if (o.kind == "changes" && o.revisions.length == 0) return !0;
|
|
3083
2945
|
let s;
|
|
3084
2946
|
try {
|
|
3085
|
-
s = this.#
|
|
2947
|
+
s = this.#k(a, o);
|
|
3086
2948
|
} catch {
|
|
3087
|
-
if (o = await this.#e.syncDraft(e.
|
|
3088
|
-
s = this.#
|
|
2949
|
+
if (o = await this.#e.syncDraft(e.flowId), !this.#z(e)) return !1;
|
|
2950
|
+
s = this.#k(a, o);
|
|
3089
2951
|
}
|
|
3090
2952
|
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
|
-
}),
|
|
2953
|
+
let c = o.kind == "changes" && t != null ? rt(m(a), m(s), t, o.revisions.flatMap((e) => e.operations)) : void 0;
|
|
2954
|
+
o.kind == "snapshot" && this.#M();
|
|
2955
|
+
let l = this.#L(s, !1);
|
|
2956
|
+
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({
|
|
2957
|
+
kind: l ? "error" : "success",
|
|
2958
|
+
message: this.#r.t(l ? "notice.moduleUpdated" : "notice.draftUpdated")
|
|
2959
|
+
}), this.#E()), !0;
|
|
3098
2960
|
} catch (n) {
|
|
3099
|
-
return t && this.#
|
|
2961
|
+
return t && this.#z(e) && this.#c(p(n, this.#r.t)), !1;
|
|
3100
2962
|
}
|
|
3101
2963
|
}
|
|
3102
|
-
#
|
|
2964
|
+
#k(e, t) {
|
|
3103
2965
|
if (t.kind == "snapshot") return t.draft;
|
|
3104
2966
|
let n = e;
|
|
3105
2967
|
for (let e of t.revisions) {
|
|
3106
2968
|
if (e.revision.parentRevisionId != n.revisionId) throw Error("Invalid Draft revision chain.");
|
|
3107
2969
|
n = {
|
|
3108
2970
|
...e.revision,
|
|
3109
|
-
content:
|
|
2971
|
+
content: W(n, e.operations).content
|
|
3110
2972
|
};
|
|
3111
2973
|
}
|
|
3112
2974
|
return n;
|
|
3113
2975
|
}
|
|
3114
|
-
#
|
|
2976
|
+
#A(e, t, n, r) {
|
|
3115
2977
|
let i = this.#l.value;
|
|
3116
|
-
if (!this.#
|
|
2978
|
+
if (!this.#z(e) || r != this.#m || !$(i.target, t)) return;
|
|
3117
2979
|
let a = this.#p;
|
|
3118
2980
|
if (a != null) {
|
|
3119
|
-
if (a.
|
|
3120
|
-
this.#
|
|
2981
|
+
if (a.flowId != e.flowId || !$(a.target, t)) {
|
|
2982
|
+
this.#M();
|
|
3121
2983
|
return;
|
|
3122
2984
|
}
|
|
3123
2985
|
for (let e of n) a.targets.add(e);
|
|
3124
|
-
globalThis.clearTimeout(a.timer), a.timer = globalThis.setTimeout(() => this.#
|
|
2986
|
+
globalThis.clearTimeout(a.timer), a.timer = globalThis.setTimeout(() => this.#j(), vt);
|
|
3125
2987
|
return;
|
|
3126
2988
|
}
|
|
3127
2989
|
n.size == 0 || i.selectedNodeIds.length > 0 || (this.#p = {
|
|
3128
2990
|
current: e.current,
|
|
3129
2991
|
generation: r,
|
|
3130
|
-
|
|
2992
|
+
flowId: e.flowId,
|
|
3131
2993
|
target: t,
|
|
3132
2994
|
targets: new Set(n),
|
|
3133
|
-
timer: globalThis.setTimeout(() => this.#
|
|
3134
|
-
viewport: this.#
|
|
2995
|
+
timer: globalThis.setTimeout(() => this.#j(), vt),
|
|
2996
|
+
viewport: this.#P().viewport
|
|
3135
2997
|
});
|
|
3136
2998
|
}
|
|
3137
|
-
#
|
|
2999
|
+
#j() {
|
|
3138
3000
|
let e = this.#p;
|
|
3139
3001
|
if (this.#p = void 0, e == null || !e.current() || e.generation != this.#m) return;
|
|
3140
3002
|
let t = this.#l.value;
|
|
3141
|
-
if (t.
|
|
3142
|
-
let n = this.#
|
|
3003
|
+
if (t.flowId != e.flowId || !$(t.target, e.target) || t.selectedNodeIds.length > 0) return;
|
|
3004
|
+
let n = this.#P().viewport;
|
|
3143
3005
|
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.#
|
|
3006
|
+
let r = m(t.draft), i = [...e.targets].filter((t) => r.selection(e.target, t) != null);
|
|
3007
|
+
i.length == 1 && this.#B({ nodeFocus: {
|
|
3146
3008
|
nodeId: i[0],
|
|
3147
3009
|
requestId: ++this.#y
|
|
3148
3010
|
} });
|
|
3149
3011
|
}
|
|
3150
|
-
#
|
|
3012
|
+
#M() {
|
|
3151
3013
|
this.#m += 1, this.#p != null && globalThis.clearTimeout(this.#p.timer), this.#p = void 0;
|
|
3152
3014
|
}
|
|
3153
|
-
#
|
|
3015
|
+
#N(e, t) {
|
|
3154
3016
|
this.#o.advanceHead(e, t);
|
|
3155
3017
|
}
|
|
3156
|
-
#
|
|
3018
|
+
#P() {
|
|
3157
3019
|
let e = this.#l.value;
|
|
3158
|
-
return
|
|
3020
|
+
return v(e.draft, e.target, e.presentation?.value, e.diagnostics?.diagnostics, {}, {}, this.#r.t);
|
|
3159
3021
|
}
|
|
3160
|
-
#
|
|
3022
|
+
#F() {
|
|
3161
3023
|
let e = this.#l.value.moduleEditor;
|
|
3162
|
-
return e == null ||
|
|
3024
|
+
return e == null || Z(this.#l.value.draft, e) == "saved" || (this.#c({
|
|
3163
3025
|
kind: "error",
|
|
3164
3026
|
message: this.#r.t("notice.unsavedCode")
|
|
3165
3027
|
}), !1);
|
|
3166
3028
|
}
|
|
3167
|
-
#
|
|
3168
|
-
let
|
|
3029
|
+
#I(e) {
|
|
3030
|
+
let t = m(e), n = yt(t, this.#l.value.target);
|
|
3169
3031
|
return {
|
|
3170
|
-
revision:
|
|
3171
|
-
selectedNodeIds: this.#l.value.selectedNodeIds.filter((e) =>
|
|
3172
|
-
target:
|
|
3032
|
+
revision: t,
|
|
3033
|
+
selectedNodeIds: this.#l.value.selectedNodeIds.filter((e) => n != null && t.selection(n, e) != null),
|
|
3034
|
+
target: n
|
|
3173
3035
|
};
|
|
3174
3036
|
}
|
|
3175
|
-
#
|
|
3037
|
+
#L(e, t) {
|
|
3176
3038
|
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) {
|
|
3039
|
+
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;
|
|
3040
|
+
return this.#B({
|
|
3041
|
+
diagnostics: t ? this.#l.value.diagnostics : void 0,
|
|
3042
|
+
draft: n,
|
|
3043
|
+
moduleEditor: this.#R(a.revision, o, a.selectedNodeIds),
|
|
3044
|
+
selectedNodeIds: a.selectedNodeIds,
|
|
3045
|
+
target: o
|
|
3046
|
+
}), i;
|
|
3047
|
+
}
|
|
3048
|
+
#R(e, t, n) {
|
|
3191
3049
|
let r = this.#l.value.moduleEditor;
|
|
3192
|
-
return r == null ||
|
|
3050
|
+
return r == null || Z(this.#l.value.draft, r) == "saved" ? Q(e, t, n) : {
|
|
3193
3051
|
...r,
|
|
3194
3052
|
phase: "failed"
|
|
3195
3053
|
};
|
|
3196
3054
|
}
|
|
3197
|
-
#R(e) {
|
|
3198
|
-
return !this.#_ && e.projectId == this.#l.value.projectId && e.current();
|
|
3199
|
-
}
|
|
3200
3055
|
#z(e) {
|
|
3056
|
+
return !this.#_ && e.flowId == this.#l.value.flowId && e.current();
|
|
3057
|
+
}
|
|
3058
|
+
#B(e) {
|
|
3201
3059
|
this.#_ || this.#l.set(e);
|
|
3202
3060
|
}
|
|
3203
3061
|
};
|
|
3204
3062
|
//#endregion
|
|
3205
3063
|
//#region src/workbench/browser/runtime/stores/workbenchStore.ts
|
|
3206
|
-
function
|
|
3064
|
+
function xt(e) {
|
|
3207
3065
|
return new Map(e.nodes.map((e) => [e.id, e]));
|
|
3208
3066
|
}
|
|
3209
|
-
function
|
|
3210
|
-
return e == null || t == null ? [] :
|
|
3067
|
+
function St(e, t) {
|
|
3068
|
+
return e == null || t == null ? [] : m(e).designerInputs(t);
|
|
3211
3069
|
}
|
|
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
|
|
3070
|
+
function Ct(e, t, n, r, i) {
|
|
3071
|
+
if (e == null || t?.kind != "flow" || n?.revisionId != e.revisionId || n.flowId != e.flowId) return /* @__PURE__ */ new Map();
|
|
3072
|
+
let a = r.find((t) => t.kind == "run.started" && t.payload.flowId == e.flowId)?.payload.scopeId;
|
|
3073
|
+
return typeof a == "string" ? new Map(r.flatMap((t) => {
|
|
3074
|
+
let n = t.payload.nodeId;
|
|
3075
|
+
return t.payload.scopeId == a && t.payload.flowId == e.flowId && typeof n == "string" && i.has(n) ? [[t.sequence, n]] : [];
|
|
3218
3076
|
})) : /* @__PURE__ */ new Map();
|
|
3219
3077
|
}
|
|
3220
|
-
var
|
|
3078
|
+
var wt = { openExternalPage: async () => !1 }, Tt = class {
|
|
3221
3079
|
#e;
|
|
3222
3080
|
#t;
|
|
3223
3081
|
#n;
|
|
3224
3082
|
#r;
|
|
3225
|
-
constructor(r, i, a = () => crypto.randomUUID(),
|
|
3226
|
-
this.#e = new
|
|
3227
|
-
let
|
|
3083
|
+
constructor(r, i, a = () => crypto.randomUUID(), s = c(), l = wt) {
|
|
3084
|
+
this.#e = new o(), 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 = s;
|
|
3085
|
+
let u = (e) => {
|
|
3228
3086
|
this.#r || this.#n.set(e);
|
|
3229
3087
|
};
|
|
3230
|
-
this.runs = new
|
|
3231
|
-
let
|
|
3088
|
+
this.runs = new y(r, u, s), this.workspace = new bt(r, u, a, s, (e) => void this.#a(r, e)), this.connectors = new ve(r, this.workspace, u, l, s), this.triggers = new Se(r, this.workspace, u, l, s), this.publications = new de(r, this.workspace, u, a, s), this.runRequests = new he(r, this.runs, u, s, a);
|
|
3089
|
+
let d = /* @__PURE__ */ new Map(), p, m = n((e) => {
|
|
3232
3090
|
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),
|
|
3235
|
-
...
|
|
3236
|
-
r == null || n == null ? void 0 :
|
|
3091
|
+
p != t?.flowId && (d.clear(), p = t?.flowId);
|
|
3092
|
+
let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(this.workspace.$.diagnostics)?.diagnostics, a = e(this.connectors.$.actions), o = e(this.connectors.$.catalogs), c = e(s.t$), l = e(this.runs.$.run), u = e(this.runs.$.events), m = n == null ? "" : n.kind == "flow" ? "flow" : `subflow:${n.id}`, h = [
|
|
3093
|
+
...St(t, n),
|
|
3094
|
+
r == null || n == null ? void 0 : f(r, n),
|
|
3237
3095
|
i,
|
|
3238
3096
|
a,
|
|
3239
|
-
|
|
3097
|
+
o,
|
|
3240
3098
|
c,
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
...
|
|
3244
|
-
],
|
|
3245
|
-
if (
|
|
3246
|
-
let
|
|
3247
|
-
return
|
|
3248
|
-
graph:
|
|
3249
|
-
inputs:
|
|
3250
|
-
}),
|
|
3251
|
-
}),
|
|
3099
|
+
l,
|
|
3100
|
+
u,
|
|
3101
|
+
...l == null ? [] : [t?.revisionId]
|
|
3102
|
+
], g = d.get(m);
|
|
3103
|
+
if (g != null && g.inputs.length == h.length && g.inputs.every((e, t) => e === h[t])) return g.graph;
|
|
3104
|
+
let _ = v(t, n, r, i, a, o, c, l, u);
|
|
3105
|
+
return d.set(m, {
|
|
3106
|
+
graph: _,
|
|
3107
|
+
inputs: h
|
|
3108
|
+
}), _;
|
|
3109
|
+
}), h = e(m, xt);
|
|
3252
3110
|
this.$ = {
|
|
3253
3111
|
busy: n((e) => {
|
|
3254
3112
|
let t = e(this.workspace.$.busy);
|
|
@@ -3259,13 +3117,13 @@ var jt = { openExternalPage: async () => !1 }, Mt = class {
|
|
|
3259
3117
|
if (e(this.publications.$.rollingBackPublicationId) != null) return "rollback";
|
|
3260
3118
|
if (e(this.publications.$.changingTriggerId) != null) return "trigger";
|
|
3261
3119
|
}),
|
|
3262
|
-
designer:
|
|
3263
|
-
designerNodeById:
|
|
3120
|
+
designer: m,
|
|
3121
|
+
designerNodeById: h,
|
|
3264
3122
|
notice: this.#n,
|
|
3265
|
-
runEventNodes: n((e) =>
|
|
3123
|
+
runEventNodes: n((e) => Ct(e(this.workspace.$.draft), e(this.workspace.$.target), e(this.runs.$.run), e(this.runs.$.events), e(h))),
|
|
3266
3124
|
selectedDesignerNode: n((e) => {
|
|
3267
3125
|
let t = e(this.workspace.$.selectedNodeIds);
|
|
3268
|
-
return t.length == 1 ? e(
|
|
3126
|
+
return t.length == 1 ? e(h).get(t[0]) : void 0;
|
|
3269
3127
|
})
|
|
3270
3128
|
};
|
|
3271
3129
|
}
|
|
@@ -3274,21 +3132,21 @@ var jt = { openExternalPage: async () => !1 }, Mt = class {
|
|
|
3274
3132
|
for (let e of Object.values(this.$)) e.dispose();
|
|
3275
3133
|
this.connectors.dispose(), this.publications.dispose(), this.runRequests.dispose(), this.runs.dispose(), this.triggers.dispose(), this.workspace.dispose();
|
|
3276
3134
|
}
|
|
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
|
|
3135
|
+
async start(e) {
|
|
3136
|
+
this.#e.invalidate(), this.connectors.reset(), this.triggers.reset(), this.publications.reset(), this.runRequests.reset(), this.runs.reset(), await this.workspace.start(e);
|
|
3279
3137
|
}
|
|
3280
|
-
async
|
|
3281
|
-
await this.workspace.
|
|
3138
|
+
async retryFlows() {
|
|
3139
|
+
await this.workspace.reloadFlows();
|
|
3282
3140
|
}
|
|
3283
3141
|
dismissNotice() {
|
|
3284
3142
|
this.#r || this.#n.set(void 0);
|
|
3285
3143
|
}
|
|
3286
|
-
async
|
|
3287
|
-
return this.#r || (this.#e.invalidate(), this.#n.set(void 0), !await this.workspace.
|
|
3144
|
+
async selectFlow(e) {
|
|
3145
|
+
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
3146
|
}
|
|
3289
|
-
async
|
|
3290
|
-
let t = await this.workspace.
|
|
3291
|
-
return this.#r || t == null ? !1 : (await this.
|
|
3147
|
+
async createFlow(e) {
|
|
3148
|
+
let t = await this.workspace.createFlow(e);
|
|
3149
|
+
return this.#r || t == null ? !1 : (await this.selectFlow(t.flowId), this.#r || this.#n.set({
|
|
3292
3150
|
kind: "success",
|
|
3293
3151
|
message: this.#t.t("notice.created", { name: t.name })
|
|
3294
3152
|
}), !0);
|
|
@@ -3313,69 +3171,56 @@ var jt = { openExternalPage: async () => !1 }, Mt = class {
|
|
|
3313
3171
|
if (t.aborted || this.#r) return;
|
|
3314
3172
|
let r = n.filter((e) => e.status == "rejected");
|
|
3315
3173
|
if (r.length > 0 && r.length == n.length) throw r[0].reason;
|
|
3316
|
-
return r.length > 0 && this.#n.set(
|
|
3174
|
+
return r.length > 0 && this.#n.set(p(r[0].reason, this.#t.t)), n.flatMap((e) => e.status == "fulfilled" ? e.value ?? [] : []);
|
|
3317
3175
|
}
|
|
3318
3176
|
async refreshSelectedConnector(e = !1) {
|
|
3319
3177
|
await this.connectors.refresh(e);
|
|
3320
3178
|
}
|
|
3321
3179
|
async requestDraftRun() {
|
|
3322
|
-
let e = this.workspace.$.
|
|
3323
|
-
return e == null || t == null
|
|
3180
|
+
let e = this.workspace.$.targetFlow.value, t = this.workspace.$.draft.value;
|
|
3181
|
+
return e == null || t == null ? "unavailable" : await this.runRequests.requestDraft(e, t);
|
|
3324
3182
|
}
|
|
3325
3183
|
async requestLiveRun() {
|
|
3326
|
-
let e = this.workspace.$.
|
|
3327
|
-
return e == null
|
|
3184
|
+
let e = this.workspace.$.targetFlow.value;
|
|
3185
|
+
return e == null ? "unavailable" : await this.runRequests.requestLive(e);
|
|
3328
3186
|
}
|
|
3329
3187
|
async #a(e, t) {
|
|
3330
3188
|
let n = this.workspace.$.target.value;
|
|
3331
|
-
if (this.#r || this.runRequests.$.submitting.value != null ||
|
|
3189
|
+
if (this.#r || this.runRequests.$.submitting.value != null || n?.kind != "flow" || this.workspace.$.flowId.value != t.flowId) return;
|
|
3332
3190
|
let r = this.#e.begin();
|
|
3333
3191
|
try {
|
|
3334
3192
|
let n = await e.getRun(t.runId), i = this.workspace.$.target.value;
|
|
3335
|
-
if (!r() || this.#r ||
|
|
3193
|
+
if (!r() || this.#r || i?.kind != "flow" || this.workspace.$.flowId.value != t.flowId || n.flowId != t.flowId || n.runId != t.runId) return;
|
|
3336
3194
|
this.runs.followExternal(n);
|
|
3337
3195
|
} catch {
|
|
3338
3196
|
return;
|
|
3339
3197
|
}
|
|
3340
3198
|
}
|
|
3341
|
-
},
|
|
3342
|
-
function
|
|
3199
|
+
}, Et = ie(() => import("./flowWorkspace-Bo0bz1Uz.js"));
|
|
3200
|
+
function Dt({ host: e, store: t }) {
|
|
3343
3201
|
let n = a(t.$.notice);
|
|
3344
|
-
return
|
|
3202
|
+
return x(() => e.notify(n), [e, n]), x(() => () => e.notify(void 0), [e]), null;
|
|
3345
3203
|
}
|
|
3346
|
-
function
|
|
3347
|
-
let s = a(i.workspace.$.
|
|
3348
|
-
return /* @__PURE__ */
|
|
3204
|
+
function Ot({ hrefFor: e, language: t, navigation: n, onLanguageChange: r, store: i, theme: o }) {
|
|
3205
|
+
let s = a(i.workspace.$.flowId);
|
|
3206
|
+
return /* @__PURE__ */ S("div", {
|
|
3349
3207
|
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, {
|
|
3208
|
+
children: s == null ? /* @__PURE__ */ S(ne, {
|
|
3361
3209
|
hrefForFlow: (t) => e({
|
|
3362
3210
|
flowId: t.flowId,
|
|
3363
|
-
|
|
3364
|
-
view: t.draft == null ? "publications" : "design"
|
|
3211
|
+
view: "design"
|
|
3365
3212
|
}),
|
|
3366
3213
|
language: t,
|
|
3367
3214
|
onCreateFlow: (e) => n.createFlow(e),
|
|
3368
3215
|
onLanguageChange: r,
|
|
3369
|
-
|
|
3370
|
-
onSelectFlow: (e) => n.selectFlow(e),
|
|
3371
|
-
projectsHref: e({ view: "design" }),
|
|
3216
|
+
onSelectFlow: (e) => void n.selectFlow(e),
|
|
3372
3217
|
store: i
|
|
3373
|
-
}) : /* @__PURE__ */
|
|
3374
|
-
fallback: /* @__PURE__ */
|
|
3218
|
+
}) : /* @__PURE__ */ S(re, {
|
|
3219
|
+
fallback: /* @__PURE__ */ S("main", {
|
|
3375
3220
|
"aria-busy": "true",
|
|
3376
3221
|
className: "workspace"
|
|
3377
3222
|
}),
|
|
3378
|
-
children: /* @__PURE__ */
|
|
3223
|
+
children: /* @__PURE__ */ S(Et, {
|
|
3379
3224
|
hrefFor: e,
|
|
3380
3225
|
language: t,
|
|
3381
3226
|
navigation: n,
|
|
@@ -3386,52 +3231,52 @@ function Ft({ hrefFor: e, language: t, navigation: n, onLanguageChange: r, store
|
|
|
3386
3231
|
})
|
|
3387
3232
|
});
|
|
3388
3233
|
}
|
|
3389
|
-
function
|
|
3390
|
-
let
|
|
3391
|
-
|
|
3392
|
-
let [{ i18n:
|
|
3393
|
-
let t =
|
|
3234
|
+
function kt({ host: e, hrefFor: t, language: n, location: r, onLanguageChange: a, onNavigate: o, preferences: s, theme: l }) {
|
|
3235
|
+
let d = ae(o);
|
|
3236
|
+
d.current = o;
|
|
3237
|
+
let [{ i18n: f, navigation: p, store: m }] = oe(() => {
|
|
3238
|
+
let t = c(n), i = new Tt(new u((t, n) => e.request(t, n), (t, n) => e.subscribeFlow(t, n), (t) => e.subscribeFlowCatalog(t)), s, () => crypto.randomUUID(), t, e);
|
|
3394
3239
|
return {
|
|
3395
3240
|
i18n: t,
|
|
3396
|
-
navigation: new
|
|
3241
|
+
navigation: new ce(i, r, (e, t) => d.current(e, t)),
|
|
3397
3242
|
store: i
|
|
3398
3243
|
};
|
|
3399
3244
|
});
|
|
3400
|
-
return
|
|
3401
|
-
|
|
3245
|
+
return x(() => {
|
|
3246
|
+
p.start();
|
|
3402
3247
|
let e = () => {
|
|
3403
|
-
|
|
3248
|
+
m.connectors.refreshAfterAuthorization(), m.triggers.refreshAfterAuthorization();
|
|
3404
3249
|
};
|
|
3405
3250
|
return globalThis.addEventListener("focus", e), () => {
|
|
3406
|
-
globalThis.removeEventListener("focus", e),
|
|
3251
|
+
globalThis.removeEventListener("focus", e), p.dispose(), m.dispose(), f.dispose();
|
|
3407
3252
|
};
|
|
3408
3253
|
}, [
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
]),
|
|
3413
|
-
|
|
3414
|
-
}, [
|
|
3415
|
-
i18n:
|
|
3254
|
+
f,
|
|
3255
|
+
p,
|
|
3256
|
+
m
|
|
3257
|
+
]), x(() => void p.apply(r), [r, p]), x(() => {
|
|
3258
|
+
f.lang != n && f.switchLang(n);
|
|
3259
|
+
}, [f, n]), /* @__PURE__ */ S(i, {
|
|
3260
|
+
i18n: f,
|
|
3416
3261
|
children: /* @__PURE__ */ se("div", {
|
|
3417
3262
|
className: "open-flow-workbench",
|
|
3418
|
-
"data-theme":
|
|
3419
|
-
children: [/* @__PURE__ */
|
|
3263
|
+
"data-theme": l,
|
|
3264
|
+
children: [/* @__PURE__ */ S(Dt, {
|
|
3420
3265
|
host: e,
|
|
3421
|
-
store:
|
|
3422
|
-
}), /* @__PURE__ */
|
|
3266
|
+
store: m
|
|
3267
|
+
}), /* @__PURE__ */ S(Ot, {
|
|
3423
3268
|
hrefFor: t,
|
|
3424
3269
|
language: n,
|
|
3425
|
-
navigation:
|
|
3270
|
+
navigation: p,
|
|
3426
3271
|
onLanguageChange: a,
|
|
3427
|
-
store:
|
|
3428
|
-
theme:
|
|
3272
|
+
store: m,
|
|
3273
|
+
theme: l
|
|
3429
3274
|
})]
|
|
3430
3275
|
})
|
|
3431
3276
|
});
|
|
3432
3277
|
}
|
|
3433
|
-
function
|
|
3434
|
-
return /* @__PURE__ */
|
|
3278
|
+
function At({ sessionKey: e, ...t }) {
|
|
3279
|
+
return /* @__PURE__ */ S(kt, { ...t }, e);
|
|
3435
3280
|
}
|
|
3436
3281
|
//#endregion
|
|
3437
|
-
export {
|
|
3282
|
+
export { At as OpenFlowWorkbench };
|