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