@oomol-lab/open-flow 0.1.0-beta.66 → 0.1.0-beta.68
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/ContentIcon-Sx9bywU-.js +11861 -0
- package/dist/browser/FlowCanvas-CXpaeurx.js +22721 -0
- package/dist/browser/{createResourceDialog-C-Si_cYs.js → createResourceDialog-BKmimKA_.js} +3 -2
- package/dist/browser/dialog-ZmfcwuMS.js +8785 -0
- package/dist/browser/event-sources.d.ts +4 -1
- package/dist/browser/exportSvg-D4CqCcx2.js +659 -0
- package/dist/browser/flow-authoring-node.d.ts +2 -0
- package/dist/browser/flow-authoring.js +6 -5
- package/dist/browser/flow-change.js +6 -5
- package/dist/browser/{flowChanges-T4_R5p1f.js → flowChanges-B5tZMcGr.js} +3440 -15004
- package/dist/browser/{flowRunInputEditorStore-DJqmR6Qh.js → flowRunInputEditorStore-ys1-w9GW.js} +2 -1
- package/dist/browser/{flowWorkspace-C0J5C0oM.js → flowWorkspace-zFBFtZPo.js} +1232 -23701
- package/dist/browser/languages-gYzoQqCi.js +68 -0
- package/dist/browser/licenses.md +24 -0
- package/dist/browser/preview.css +125 -55
- package/dist/browser/preview.js +16256 -15986
- package/dist/browser/theme.css +1 -0
- package/dist/browser/{icons-BD3m0RQq.js → tooltip-CJjYs_2I.js} +280 -9041
- package/dist/browser/ui.css +38 -4
- package/dist/browser/{value-BADHeZ9I.js → value-BbFQZZ_V.js} +1 -68
- package/dist/browser/workbench-contract.d.ts +1 -1
- package/dist/browser/workbench.css +2907 -2871
- package/dist/browser/workbench.d.ts +0 -1
- package/dist/browser/workbench.js +760 -461
- package/dist/browser/{workbenchSelect-B-PFpF_Q.js → workbenchSelect-CChdgugI.js} +2 -1
- package/dist/command/index.js +25 -25
- package/dist/common/authoringExamples.d.ts +2 -2
- package/dist/common/control-api-conformance.js +57 -12
- package/dist/common/control-api.d.ts +12 -2
- package/dist/common/control-api.js +41 -8
- package/dist/common/control-requests.js +7 -6
- package/dist/common/decision.js +5 -4
- package/dist/common/flow-encoding.js +7 -4
- package/dist/common/flow-semantics.js +11 -8
- package/dist/common/integration-trigger.js +5 -4
- package/dist/common/mcp.js +42 -9
- package/dist/common/openapi.js +5 -4
- package/dist/common/poll-trigger.js +5 -4
- package/dist/common/scheduler.js +5 -4
- package/dist/common/webhook-trigger.js +5 -4
- package/dist/common/workflow.js +5 -4
- package/package.json +1 -1
- package/skills/open-flow/SKILL.md +9 -0
- package/skills/open-flow/references/flow-authoring.md +2 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as DropdownMenuContent, N as DropdownMenuTrigger, T as DropdownMenuItem, d as PopoverContent, g as PopoverTrigger, h as PopoverTitle, it as providerIconAppearance, k as DropdownMenuSeparator, st as IconThemeContext, u as Popover, x as DropdownMenu } from "./ContentIcon-Sx9bywU-.js";
|
|
2
2
|
import { a as derive, i as compute, l as val } from "./dist-bO8nvHFH.js";
|
|
3
3
|
import { c as useLang, l as useTranslate, o as I18nProvider, u as useVal } from "./dist-BFmpkX4P.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { gr as cn, i as TooltipTrigger, mr as Button, n as TooltipContent, t as Tooltip } from "./tooltip-CJjYs_2I.js";
|
|
5
|
+
import { $ as dequal$1, A as upgradeRevisionContent, C as isTriggerNode, F as nodeInputMappings, O as resourceNameIssue, P as mapConditionSources, a as DialogFooter, b as FlowChangeError, d as Field, h as FieldLabel, i as DialogDescription, k as upgradeManualTrigger, l as Icon, m as FieldGroup, o as DialogHeader, p as FieldError, r as DialogContent, s as DialogTitle, t as Dialog, u as Spinner, x as applyFlowChanges, yt as Input } from "./dialog-ZmfcwuMS.js";
|
|
6
|
+
import { $ as providerIcon, An as string, At as WorkflowExportMenuItem, Bt as EmptyMedia, Cn as workflowCandidate, Ct as resetInputValues, Dn as invalidResponse, Dt as setServiceConnections, Et as setInputSources, Ft as InputGroupInput, Ht as Badge, It as Empty, J as connectorActionPorts, K as resourceData, Kt as createI18n, Lt as EmptyContent, Mn as controlErrorCode, Mt as followWorkbenchLink, Nt as InputGroup, On as jsonValue, Ot as updateStartInputDefs, Pt as InputGroupAddon, Qt as allConnectorConnectionsQuery, R as addNodeIntent, Rt as EmptyDescription, S as updateWebhook, St as repairNodeNames, Tt as setConnectorConnection, U as scopedValue, Ut as EventSourcesPage, V as combineSources, Vt as EmptyTitle, W as CacheResource, Xt as WorkbenchClient, Y as designerGraph, Yt as errorNotice, Zt as randomId, _ as updateTask, _t as restoreCanvasPresentation, a as nameCreatedNodes, an as triggerOutputDefinitions, at as Latest, b as updateTriggerConfig, bt as setNodeContentHidden, c as setTriggerConnection, cn as connectorActionMetadata, d as updateNodeDescription, dn as workflowFileName, dt as actionWithConnections, en as decodeTriggerCatalog, et as RunStore, f as updateNodeIcon, fn as workflowNameFromFile, ft as connectionCatalog, g as updateResolution, gt as removeComments, h as updateOutputPorts, ht as flowPresentation, i as deleteSelection, in as sampleErrorOutputs, it as flowResourceReferences, jn as ApiError, jt as IdTooltip, kn as record, kt as updateTriggerSchedule, l as setTriggerEventSource, ln as encodeWorkflowFile, m as updateNodeSettings, mt as commentIds, o as setInputValue, ot as deriveInspectorDiagnostics, p as updateNodeName, pt as canvasPresentationChange, q as resourceValue, r as applyFlowChanges$1, rn as normalizeTriggerOutputs, rt as revisionView, s as setInputVariable, sn as connection, st as diagnosticItems, t as addNode, u as updateCondition, un as parseWorkflowFile, v as updateTaskAdditionalInputs, vt as setComment, wt as setCodeActions, x as updateValue, xt as setNodePositions, y as updateTaskPorts, yt as setFlowViewport, z as deriveAddNodeOptions, zt as EmptyHeader } from "./flowChanges-B5tZMcGr.js";
|
|
7
|
+
import { a as uiLanguages, i as uiLanguageNames, n as isUiLanguage, r as resolveUiLanguage, t as importedWorkflowName } from "./languages-gYzoQqCi.js";
|
|
6
8
|
import { Suspense, forwardRef, lazy, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
7
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
10
|
import * as Cause from "effect/Cause";
|
|
@@ -189,24 +191,199 @@ function Skeleton({ className, ...props }) {
|
|
|
189
191
|
});
|
|
190
192
|
}
|
|
191
193
|
//#endregion
|
|
192
|
-
//#region src/workbench/browser/runtime/shell/
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
194
|
+
//#region src/workbench/browser/runtime/shell/flowReferences.tsx
|
|
195
|
+
function useFlowReferences(flowId, workspace) {
|
|
196
|
+
const [result, setResult] = useState();
|
|
197
|
+
const [status, setStatus] = useState("loading");
|
|
198
|
+
const [offset, setOffset] = useState(0);
|
|
199
|
+
const [attempt, setAttempt] = useState(0);
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
const controller = new AbortController();
|
|
202
|
+
setStatus("loading");
|
|
203
|
+
workspace.getFlowReferences(flowId, {
|
|
204
|
+
offset,
|
|
205
|
+
signal: controller.signal
|
|
206
|
+
}).then((page) => {
|
|
207
|
+
if (controller.signal.aborted) return;
|
|
208
|
+
setResult((previous) => {
|
|
209
|
+
const references = new Map((offset == 0 ? [] : previous?.references ?? []).map((item) => [item.flowId, item]));
|
|
210
|
+
for (const item of page.references) references.set(item.flowId, item);
|
|
211
|
+
return {
|
|
212
|
+
...page,
|
|
213
|
+
references: [...references.values()]
|
|
214
|
+
};
|
|
215
|
+
});
|
|
216
|
+
setStatus("ready");
|
|
217
|
+
}, () => {
|
|
218
|
+
if (controller.signal.aborted) return;
|
|
219
|
+
setStatus("failed");
|
|
220
|
+
});
|
|
221
|
+
return () => controller.abort();
|
|
222
|
+
}, [
|
|
223
|
+
workspace,
|
|
224
|
+
flowId,
|
|
225
|
+
offset,
|
|
226
|
+
attempt
|
|
227
|
+
]);
|
|
228
|
+
return {
|
|
229
|
+
result,
|
|
230
|
+
status,
|
|
231
|
+
retry: () => {
|
|
232
|
+
setStatus("loading");
|
|
233
|
+
setAttempt((value) => value + 1);
|
|
234
|
+
},
|
|
235
|
+
loadMore: () => {
|
|
236
|
+
if (status != "ready" || result?.nextOffset == null) return;
|
|
237
|
+
setStatus("loading");
|
|
238
|
+
setOffset(result.nextOffset);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
198
241
|
}
|
|
199
|
-
function
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
242
|
+
function FlowReferenceQuery({ flowId, workspace, ...navigation }) {
|
|
243
|
+
return /* @__PURE__ */ jsx(FlowReferenceResults, {
|
|
244
|
+
state: useFlowReferences(flowId, workspace),
|
|
245
|
+
...navigation
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function FlowReferenceResults({ state, hrefForFlow, onSelectFlow, showEmpty = true, summary, disabled = false }) {
|
|
249
|
+
const t = useTranslate();
|
|
250
|
+
const { result, status } = state;
|
|
251
|
+
const list = result != null && result.references.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
252
|
+
className: "space-y-3",
|
|
253
|
+
children: [/* @__PURE__ */ jsx("ul", {
|
|
254
|
+
className: "m-0 max-h-64 list-none space-y-3 overflow-y-auto p-0",
|
|
255
|
+
children: result.references.map((item) => {
|
|
256
|
+
const defaultView = item.draft ? "design" : "publications";
|
|
257
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
258
|
+
className: "flex items-start justify-between gap-3",
|
|
259
|
+
children: [/* @__PURE__ */ jsxs("a", {
|
|
260
|
+
className: "flex min-w-0 items-start gap-2 text-foreground no-underline hover:underline",
|
|
261
|
+
href: hrefForFlow(item, defaultView),
|
|
262
|
+
onClick: (event) => followWorkbenchLink(event, () => onSelectFlow(item, defaultView)),
|
|
263
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
264
|
+
"aria-hidden": "true",
|
|
265
|
+
className: "i-lucide-light:workflow mt-0.5 size-4 shrink-0 text-muted-foreground"
|
|
266
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
267
|
+
className: "min-w-0 break-words",
|
|
268
|
+
children: item.name ?? item.flowId
|
|
269
|
+
})]
|
|
270
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
271
|
+
className: "flex shrink-0 flex-wrap justify-end gap-1",
|
|
272
|
+
children: [item.draft && /* @__PURE__ */ jsx("a", {
|
|
273
|
+
className: "rounded-md bg-muted px-2 py-0.5 text-muted-foreground no-underline hover:underline",
|
|
274
|
+
href: hrefForFlow(item, "design"),
|
|
275
|
+
onClick: (event) => followWorkbenchLink(event, () => onSelectFlow(item, "design")),
|
|
276
|
+
children: t("flowReferences.draft")
|
|
277
|
+
}), item.live != null && /* @__PURE__ */ jsxs("a", {
|
|
278
|
+
className: "rounded-md bg-muted px-2 py-0.5 text-muted-foreground no-underline hover:underline",
|
|
279
|
+
href: hrefForFlow(item, "publications"),
|
|
280
|
+
onClick: (event) => followWorkbenchLink(event, () => onSelectFlow(item, "publications")),
|
|
281
|
+
children: [t("flowReferences.live"), !item.live.enabled && ` · ${t("flowReferences.disabled")}`]
|
|
282
|
+
})]
|
|
283
|
+
})]
|
|
284
|
+
}, item.flowId);
|
|
285
|
+
})
|
|
286
|
+
}), status != "failed" && result?.nextOffset != null && /* @__PURE__ */ jsx(Button, {
|
|
287
|
+
variant: "outline",
|
|
288
|
+
size: "sm",
|
|
289
|
+
disabled: disabled || status == "loading",
|
|
290
|
+
onClick: state.loadMore,
|
|
291
|
+
children: t("flowReferences.loadMore")
|
|
292
|
+
})]
|
|
293
|
+
});
|
|
294
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
295
|
+
className: "space-y-3 text-sm",
|
|
296
|
+
children: [
|
|
297
|
+
summary != null && list ? /* @__PURE__ */ jsxs("details", {
|
|
298
|
+
className: "group rounded-lg border border-border",
|
|
299
|
+
children: [/* @__PURE__ */ jsxs("summary", {
|
|
300
|
+
className: "flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 text-sm font-medium [&::-webkit-details-marker]:hidden",
|
|
301
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
302
|
+
"aria-hidden": "true",
|
|
303
|
+
className: "i-lucide-light:chevron-right shrink-0 text-muted-foreground group-open:rotate-90"
|
|
304
|
+
}), /* @__PURE__ */ jsx("span", { children: summary })]
|
|
305
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
306
|
+
className: "border-t border-border py-3 pr-3 pl-[calc(1.25rem+1em)]",
|
|
307
|
+
children: list
|
|
308
|
+
})]
|
|
309
|
+
}) : list,
|
|
310
|
+
status == "loading" && /* @__PURE__ */ jsx("p", {
|
|
311
|
+
className: "m-0 text-muted-foreground",
|
|
312
|
+
role: "status",
|
|
313
|
+
children: t("flowReferences.loading")
|
|
314
|
+
}),
|
|
315
|
+
status == "failed" && /* @__PURE__ */ jsxs("div", {
|
|
316
|
+
className: "space-y-2",
|
|
317
|
+
role: "alert",
|
|
318
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
319
|
+
className: "m-0 text-muted-foreground",
|
|
320
|
+
children: t("flowReferences.failed")
|
|
321
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
322
|
+
variant: "outline",
|
|
323
|
+
size: "sm",
|
|
324
|
+
disabled,
|
|
325
|
+
onClick: state.retry,
|
|
326
|
+
children: t("flowReferences.retry")
|
|
327
|
+
})]
|
|
328
|
+
}),
|
|
329
|
+
showEmpty && status == "ready" && result?.references.length == 0 && /* @__PURE__ */ jsx("p", {
|
|
330
|
+
className: "m-0 text-muted-foreground",
|
|
331
|
+
children: t("flowReferences.empty")
|
|
332
|
+
})
|
|
333
|
+
]
|
|
208
334
|
});
|
|
209
335
|
}
|
|
336
|
+
function FlowReferencesButton(props) {
|
|
337
|
+
const referenceCount = props.flow.referenceCount;
|
|
338
|
+
if (referenceCount == null || referenceCount == 0) return null;
|
|
339
|
+
return /* @__PURE__ */ jsx(FlowReferencesPopover, {
|
|
340
|
+
...props,
|
|
341
|
+
referenceCount
|
|
342
|
+
}, props.flow.flowId);
|
|
343
|
+
}
|
|
344
|
+
function FlowReferencesPopover({ flow, referenceCount, workspace, container, hrefForFlow, onSelectFlow }) {
|
|
345
|
+
const t = useTranslate();
|
|
346
|
+
const [open, setOpen] = useState(false);
|
|
347
|
+
const label = t("flowReferences.count", { count: referenceCount });
|
|
348
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
349
|
+
open,
|
|
350
|
+
onOpenChange: setOpen,
|
|
351
|
+
children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsxs(TooltipTrigger, {
|
|
352
|
+
render: /* @__PURE__ */ jsx(PopoverTrigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
353
|
+
"aria-label": label,
|
|
354
|
+
variant: "ghost",
|
|
355
|
+
size: "sm",
|
|
356
|
+
className: "text-muted-foreground"
|
|
357
|
+
}) }),
|
|
358
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
359
|
+
"aria-hidden": "true",
|
|
360
|
+
className: "i-lucide-light:link"
|
|
361
|
+
}), /* @__PURE__ */ jsx("span", { children: referenceCount })]
|
|
362
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
363
|
+
container,
|
|
364
|
+
collisionBoundary: [],
|
|
365
|
+
positionMethod: "fixed",
|
|
366
|
+
children: label
|
|
367
|
+
})] }), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
368
|
+
container,
|
|
369
|
+
collisionBoundary: [],
|
|
370
|
+
positionMethod: "fixed",
|
|
371
|
+
align: "end",
|
|
372
|
+
className: "w-96 max-w-[calc(100vw-2rem)] max-h-(--available-height) overflow-y-auto gap-4 p-4",
|
|
373
|
+
children: [/* @__PURE__ */ jsx(PopoverTitle, {
|
|
374
|
+
className: "break-words text-base font-semibold",
|
|
375
|
+
children: t("flowReferences.title", { name: flow.name })
|
|
376
|
+
}), open && /* @__PURE__ */ jsx(FlowReferenceQuery, {
|
|
377
|
+
flowId: flow.flowId,
|
|
378
|
+
workspace,
|
|
379
|
+
hrefForFlow,
|
|
380
|
+
onSelectFlow
|
|
381
|
+
})]
|
|
382
|
+
})]
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/workbench/browser/runtime/shell/flowDeletionDialog.tsx
|
|
210
387
|
function FlowDeletionImpact({ listeners, failed, onRetry }) {
|
|
211
388
|
const t = useTranslate();
|
|
212
389
|
if (failed) return /* @__PURE__ */ jsxs("div", {
|
|
@@ -228,11 +405,17 @@ function FlowDeletionImpact({ listeners, failed, onRetry }) {
|
|
|
228
405
|
children: t("sidebar.listenersLoading")
|
|
229
406
|
});
|
|
230
407
|
if (listeners.length == 0) return null;
|
|
231
|
-
return /* @__PURE__ */ jsxs("
|
|
232
|
-
className: "
|
|
233
|
-
children: [
|
|
234
|
-
|
|
235
|
-
/* @__PURE__ */ jsx("
|
|
408
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
409
|
+
className: "group rounded-lg border border-border text-sm",
|
|
410
|
+
children: [/* @__PURE__ */ jsxs("summary", {
|
|
411
|
+
className: "flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 font-medium [&::-webkit-details-marker]:hidden",
|
|
412
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
413
|
+
"aria-hidden": "true",
|
|
414
|
+
className: "i-lucide-light:chevron-right shrink-0 text-muted-foreground group-open:rotate-90"
|
|
415
|
+
}), /* @__PURE__ */ jsx("span", { children: t("flowReferences.deleteListeners", { count: listeners.length }) })]
|
|
416
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
417
|
+
className: "space-y-3 border-t border-border py-3 pr-3 pl-[calc(1.25rem+1em)]",
|
|
418
|
+
children: [/* @__PURE__ */ jsx("ul", {
|
|
236
419
|
className: "m-0 max-h-48 list-none space-y-2 overflow-y-auto p-0",
|
|
237
420
|
children: listeners.map((listener) => /* @__PURE__ */ jsxs("li", {
|
|
238
421
|
className: "break-words",
|
|
@@ -249,46 +432,117 @@ function FlowDeletionImpact({ listeners, failed, onRetry }) {
|
|
|
249
432
|
})
|
|
250
433
|
]
|
|
251
434
|
}, `${listener.flowId}/${listener.nodeId}`))
|
|
252
|
-
}),
|
|
253
|
-
|
|
254
|
-
className: "text-muted-foreground",
|
|
435
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
436
|
+
className: "m-0 text-muted-foreground",
|
|
255
437
|
children: t("sidebar.listenersImpact")
|
|
256
|
-
})
|
|
257
|
-
]
|
|
438
|
+
})]
|
|
439
|
+
})]
|
|
258
440
|
});
|
|
259
441
|
}
|
|
260
|
-
function
|
|
261
|
-
const [root, setRoot] = useState(null);
|
|
262
|
-
const renameAnchor = useRef(null);
|
|
263
|
-
const actionsButton = useRef(null);
|
|
264
|
-
const nameInput = useRef(null);
|
|
265
|
-
const cancelDelete = useRef(null);
|
|
266
|
-
const locale = useLang();
|
|
442
|
+
function FlowDeletionDialog({ flow, workspace, container, busy, finalFocus, onClose, onDelete, ...navigation }) {
|
|
267
443
|
const t = useTranslate();
|
|
268
|
-
const
|
|
269
|
-
const
|
|
444
|
+
const cancel = useRef(null);
|
|
445
|
+
const references = useFlowReferences(flow.flowId, workspace);
|
|
270
446
|
const [listeners, setListeners] = useState();
|
|
271
|
-
const [
|
|
272
|
-
const [
|
|
447
|
+
const [listenerStatus, setListenerStatus] = useState("loading");
|
|
448
|
+
const [attempt, setAttempt] = useState(0);
|
|
273
449
|
useEffect(() => {
|
|
274
|
-
if (mode != "delete") return;
|
|
275
450
|
const controller = new AbortController();
|
|
276
451
|
setListeners(void 0);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
if (
|
|
452
|
+
setListenerStatus("loading");
|
|
453
|
+
workspace.getErrorListeners(flow.flowId, controller.signal).then((value) => {
|
|
454
|
+
if (controller.signal.aborted) return;
|
|
455
|
+
setListeners(value);
|
|
456
|
+
setListenerStatus("ready");
|
|
280
457
|
}, () => {
|
|
281
|
-
if (!controller.signal.aborted)
|
|
458
|
+
if (!controller.signal.aborted) setListenerStatus("failed");
|
|
282
459
|
});
|
|
283
460
|
return () => controller.abort();
|
|
284
461
|
}, [
|
|
285
|
-
mode,
|
|
286
462
|
flow.flowId,
|
|
287
|
-
|
|
288
|
-
|
|
463
|
+
workspace,
|
|
464
|
+
attempt
|
|
289
465
|
]);
|
|
466
|
+
const hasReferences = references.result != null && references.result.total > 0;
|
|
467
|
+
const canDelete = busy == null && references.status == "ready" && listenerStatus == "ready";
|
|
468
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
469
|
+
open: true,
|
|
470
|
+
onOpenChange: (open) => {
|
|
471
|
+
if (!open && busy == null) onClose();
|
|
472
|
+
},
|
|
473
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
474
|
+
container,
|
|
475
|
+
initialFocus: cancel,
|
|
476
|
+
finalFocus,
|
|
477
|
+
showCloseButton: false,
|
|
478
|
+
className: "max-h-[calc(100dvh-2rem)] grid-rows-[auto_minmax(0,1fr)_auto]",
|
|
479
|
+
children: [
|
|
480
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, {
|
|
481
|
+
className: "break-words leading-snug",
|
|
482
|
+
children: t("sidebar.deleteFlowConfirm", { name: flow.name })
|
|
483
|
+
}), /* @__PURE__ */ jsx(DialogDescription, { children: t("resource.deleteDescription") })] }),
|
|
484
|
+
/* @__PURE__ */ jsxs("div", {
|
|
485
|
+
className: "min-h-0 space-y-2 overflow-y-auto",
|
|
486
|
+
children: [/* @__PURE__ */ jsx(FlowReferenceResults, {
|
|
487
|
+
state: references,
|
|
488
|
+
disabled: busy != null,
|
|
489
|
+
showEmpty: false,
|
|
490
|
+
summary: hasReferences ? t("flowReferences.deleteImpact", { count: references.result.total }) : void 0,
|
|
491
|
+
...navigation
|
|
492
|
+
}), /* @__PURE__ */ jsx(FlowDeletionImpact, {
|
|
493
|
+
listeners,
|
|
494
|
+
failed: listenerStatus == "failed",
|
|
495
|
+
onRetry: () => {
|
|
496
|
+
setListenerStatus("loading");
|
|
497
|
+
setAttempt((value) => value + 1);
|
|
498
|
+
}
|
|
499
|
+
})]
|
|
500
|
+
}),
|
|
501
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
|
|
502
|
+
ref: cancel,
|
|
503
|
+
variant: "outline",
|
|
504
|
+
disabled: busy != null,
|
|
505
|
+
onClick: onClose,
|
|
506
|
+
children: t("common.cancel")
|
|
507
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
508
|
+
disabled: !canDelete,
|
|
509
|
+
onClick: onDelete,
|
|
510
|
+
variant: "destructive",
|
|
511
|
+
children: t(busy == "flow" ? "common.deleting" : hasReferences ? "flowReferences.deleteAnyway" : "common.delete")
|
|
512
|
+
})] })
|
|
513
|
+
]
|
|
514
|
+
})
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/workbench/browser/runtime/shell/resourceBrowser.tsx
|
|
519
|
+
var CreateResourceDialog = lazy(() => import("./createResourceDialog-BKmimKA_.js"));
|
|
520
|
+
var flowIdTooltipAlignOffset = 44;
|
|
521
|
+
var renamePopoverAlignOffset = -12;
|
|
522
|
+
function compactFlowId(flowId) {
|
|
523
|
+
return flowId.length <= 20 ? flowId : `${flowId.slice(0, 10)}…${flowId.slice(-6)}`;
|
|
524
|
+
}
|
|
525
|
+
function formatUpdatedAt(updatedAt, locale) {
|
|
526
|
+
const date = new Date(updatedAt);
|
|
527
|
+
const current = /* @__PURE__ */ new Date();
|
|
528
|
+
return date.toLocaleString(locale, {
|
|
529
|
+
day: "numeric",
|
|
530
|
+
hour: "2-digit",
|
|
531
|
+
minute: "2-digit",
|
|
532
|
+
month: "short",
|
|
533
|
+
year: date.getFullYear() == current.getFullYear() ? void 0 : "numeric"
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
function FlowItem({ busy, flow, href, hrefForFlow, onSelect, store }) {
|
|
537
|
+
const [root, setRoot] = useState(null);
|
|
538
|
+
const renameAnchor = useRef(null);
|
|
539
|
+
const actionsButton = useRef(null);
|
|
540
|
+
const nameInput = useRef(null);
|
|
541
|
+
const locale = useLang();
|
|
542
|
+
const t = useTranslate();
|
|
543
|
+
const [mode, setMode] = useState("idle");
|
|
544
|
+
const [name, setName] = useState(flow.name);
|
|
290
545
|
const [pending, setPending] = useState();
|
|
291
|
-
const hasTeam = showTeam && Boolean(badge?.trim());
|
|
292
546
|
const changed = flow.live != null && flow.live.revisionId != flow.draftRevisionId;
|
|
293
547
|
const publicationStatus = flow.status == "retiring" ? "resource.retiring" : flow.live == null ? "resource.notPublished" : changed ? "resource.unpublishedChanges" : "resource.isPublished";
|
|
294
548
|
const publicationTone = flow.status == "retiring" ? "danger" : flow.live == null ? "neutral" : changed ? "running" : "success";
|
|
@@ -316,7 +570,6 @@ function FlowItem({ showTeam, badge, busy, flow, href, onSelect, store }) {
|
|
|
316
570
|
children: [
|
|
317
571
|
/* @__PURE__ */ jsxs("div", {
|
|
318
572
|
className: "resource-list-row flow-columns",
|
|
319
|
-
"data-has-team": hasTeam,
|
|
320
573
|
children: [
|
|
321
574
|
/* @__PURE__ */ jsxs("span", {
|
|
322
575
|
className: "resource-primary-cell",
|
|
@@ -439,11 +692,6 @@ function FlowItem({ showTeam, badge, busy, flow, href, onSelect, store }) {
|
|
|
439
692
|
alignOffset: flowIdTooltipAlignOffset
|
|
440
693
|
})
|
|
441
694
|
}),
|
|
442
|
-
showTeam && /* @__PURE__ */ jsx("span", {
|
|
443
|
-
className: "resource-team-cell",
|
|
444
|
-
title: badge,
|
|
445
|
-
children: hasTeam ? badge : "—"
|
|
446
|
-
}),
|
|
447
695
|
/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
448
696
|
render: /* @__PURE__ */ jsx("time", {
|
|
449
697
|
className: "resource-updated-at",
|
|
@@ -475,10 +723,16 @@ function FlowItem({ showTeam, badge, busy, flow, href, onSelect, store }) {
|
|
|
475
723
|
})
|
|
476
724
|
]
|
|
477
725
|
}),
|
|
478
|
-
/* @__PURE__ */
|
|
726
|
+
/* @__PURE__ */ jsxs("div", {
|
|
479
727
|
className: "resource-live-controls",
|
|
480
728
|
"aria-busy": pending != null,
|
|
481
|
-
children:
|
|
729
|
+
children: [/* @__PURE__ */ jsx(FlowReferencesButton, {
|
|
730
|
+
flow,
|
|
731
|
+
workspace: store.workspace,
|
|
732
|
+
container: root,
|
|
733
|
+
hrefForFlow,
|
|
734
|
+
onSelectFlow: onSelect
|
|
735
|
+
}), /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
482
736
|
render: /* @__PURE__ */ jsx(DropdownMenuTrigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
483
737
|
ref: actionsButton,
|
|
484
738
|
"aria-label": t("resource.actions"),
|
|
@@ -569,50 +823,28 @@ function FlowItem({ showTeam, badge, busy, flow, href, onSelect, store }) {
|
|
|
569
823
|
}), t("common.delete")]
|
|
570
824
|
})
|
|
571
825
|
]
|
|
572
|
-
})] })
|
|
826
|
+
})] })]
|
|
573
827
|
}),
|
|
574
|
-
/* @__PURE__ */ jsx(
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
children: [
|
|
585
|
-
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("sidebar.deleteFlowConfirm", { name: flow.name }) }), /* @__PURE__ */ jsx(DialogDescription, { children: t("resource.deleteDescription") })] }),
|
|
586
|
-
/* @__PURE__ */ jsx(FlowDeletionImpact, {
|
|
587
|
-
listeners,
|
|
588
|
-
failed: listenersFailed,
|
|
589
|
-
onRetry: () => setListenersRetry((value) => value + 1)
|
|
590
|
-
}),
|
|
591
|
-
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
592
|
-
render: /* @__PURE__ */ jsx(Button, {
|
|
593
|
-
ref: cancelDelete,
|
|
594
|
-
variant: "outline"
|
|
595
|
-
}),
|
|
596
|
-
children: t("common.cancel")
|
|
597
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
598
|
-
disabled: busy != null || listeners == null && !listenersFailed,
|
|
599
|
-
onClick: () => void remove(),
|
|
600
|
-
variant: "destructive",
|
|
601
|
-
children: t(busy == "flow" ? "common.deleting" : "common.delete")
|
|
602
|
-
})] })
|
|
603
|
-
]
|
|
604
|
-
})
|
|
828
|
+
mode == "delete" && /* @__PURE__ */ jsx(FlowDeletionDialog, {
|
|
829
|
+
flow,
|
|
830
|
+
workspace: store.workspace,
|
|
831
|
+
container: root,
|
|
832
|
+
busy,
|
|
833
|
+
finalFocus: () => actionsButton.current,
|
|
834
|
+
onClose: () => setMode("idle"),
|
|
835
|
+
onDelete: () => void remove(),
|
|
836
|
+
hrefForFlow,
|
|
837
|
+
onSelectFlow: onSelect
|
|
605
838
|
})
|
|
606
839
|
]
|
|
607
840
|
});
|
|
608
841
|
}
|
|
609
|
-
function FlowSkeleton(
|
|
842
|
+
function FlowSkeleton() {
|
|
610
843
|
return /* @__PURE__ */ jsxs("div", {
|
|
611
844
|
"aria-hidden": "true",
|
|
612
845
|
className: "resource-item-row",
|
|
613
846
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
614
847
|
className: "resource-list-row flow-columns",
|
|
615
|
-
"data-has-team": showTeam,
|
|
616
848
|
children: [
|
|
617
849
|
/* @__PURE__ */ jsxs("span", {
|
|
618
850
|
className: "resource-primary-cell",
|
|
@@ -622,7 +854,6 @@ function FlowSkeleton({ showTeam }) {
|
|
|
622
854
|
})]
|
|
623
855
|
}),
|
|
624
856
|
/* @__PURE__ */ jsx(Skeleton, { className: "resource-flow-id-cell h-3 w-36 max-w-full" }),
|
|
625
|
-
showTeam && /* @__PURE__ */ jsx(Skeleton, { className: "resource-team-cell h-3 w-24 max-w-full" }),
|
|
626
857
|
/* @__PURE__ */ jsx(Skeleton, { className: "resource-updated-at h-3 w-28 max-w-full" }),
|
|
627
858
|
/* @__PURE__ */ jsx(Skeleton, { className: "resource-publication-status h-3 w-16" }),
|
|
628
859
|
/* @__PURE__ */ jsx(Skeleton, { className: "resource-status h-3 w-16" })
|
|
@@ -633,7 +864,7 @@ function FlowSkeleton({ showTeam }) {
|
|
|
633
864
|
})]
|
|
634
865
|
});
|
|
635
866
|
}
|
|
636
|
-
var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisabled, createFlowField,
|
|
867
|
+
var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisabled, createFlowField, hrefForFlow, initializing = false, onCreateFlow, onImportFlow, onSelectFlow, store, language }, ref) {
|
|
637
868
|
const t = useTranslate();
|
|
638
869
|
const busy = useVal(store.workspace.$.busy);
|
|
639
870
|
const loadFailed = useVal(store.workspace.$.flowLoadFailed);
|
|
@@ -647,11 +878,9 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
647
878
|
const total = useVal(store.workspace.$.flowTotal);
|
|
648
879
|
const [creation$] = useState(() => val(void 0));
|
|
649
880
|
const creation = useVal(creation$);
|
|
650
|
-
const [importError, setImportError] = useState(false);
|
|
651
881
|
const fileInput = useRef(null);
|
|
652
882
|
const [filter, setFilter] = useState("");
|
|
653
883
|
const [name, setName] = useState("");
|
|
654
|
-
const showTeam = flows.some((flow) => (flowBadges?.[flow.flowId]?.trim().length ?? 0) > 0);
|
|
655
884
|
const normalized = filter.trim().toLocaleLowerCase();
|
|
656
885
|
const visible = flows.filter((flow) => flow.name.toLocaleLowerCase().includes(normalized));
|
|
657
886
|
const command = useRef();
|
|
@@ -664,12 +893,14 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
664
893
|
});
|
|
665
894
|
function openImport(input) {
|
|
666
895
|
if (initializing || store.workspace.$.busy.value != null || creation$.value != null || onImportFlow == null) return "unavailable";
|
|
667
|
-
setImportError(false);
|
|
668
896
|
let file;
|
|
669
897
|
try {
|
|
670
898
|
file = parseWorkflowFile(input.text);
|
|
671
899
|
} catch {
|
|
672
|
-
|
|
900
|
+
store.workspace.notify({
|
|
901
|
+
kind: "error",
|
|
902
|
+
message: t("resource.importInvalid")
|
|
903
|
+
});
|
|
673
904
|
return "invalid-file";
|
|
674
905
|
}
|
|
675
906
|
setName(file.name ?? (input.fileName == null ? importedWorkflowName(language) : workflowNameFromFile(input.fileName)));
|
|
@@ -748,13 +979,15 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
748
979
|
const file = event.target.files?.[0];
|
|
749
980
|
event.target.value = "";
|
|
750
981
|
if (file == null) return;
|
|
751
|
-
setImportError(false);
|
|
752
982
|
file.text().then((text) => {
|
|
753
983
|
command.current?.({
|
|
754
984
|
text,
|
|
755
985
|
fileName: file.name
|
|
756
986
|
});
|
|
757
|
-
}).catch(() =>
|
|
987
|
+
}).catch(() => store.workspace.notify({
|
|
988
|
+
kind: "error",
|
|
989
|
+
message: t("resource.importInvalid")
|
|
990
|
+
}));
|
|
758
991
|
}
|
|
759
992
|
}), /* @__PURE__ */ jsx(Button, {
|
|
760
993
|
variant: "outline",
|
|
@@ -774,14 +1007,10 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
774
1007
|
]
|
|
775
1008
|
})]
|
|
776
1009
|
}),
|
|
777
|
-
importError && /* @__PURE__ */ jsx("p", {
|
|
778
|
-
role: "alert",
|
|
779
|
-
children: t("resource.importInvalid")
|
|
780
|
-
}),
|
|
781
1010
|
/* @__PURE__ */ jsx("div", {
|
|
782
1011
|
className: "resource-table-scroll",
|
|
783
1012
|
children: /* @__PURE__ */ jsxs("div", {
|
|
784
|
-
className:
|
|
1013
|
+
className: "resource-table",
|
|
785
1014
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
786
1015
|
"aria-hidden": "true",
|
|
787
1016
|
className: "resource-list-columns-shell",
|
|
@@ -793,10 +1022,6 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
793
1022
|
className: "resource-flow-id-heading",
|
|
794
1023
|
children: t("resource.flowId")
|
|
795
1024
|
}),
|
|
796
|
-
showTeam && /* @__PURE__ */ jsx("span", {
|
|
797
|
-
className: "resource-team-heading",
|
|
798
|
-
children: t("resource.team")
|
|
799
|
-
}),
|
|
800
1025
|
/* @__PURE__ */ jsx("span", {
|
|
801
1026
|
className: "resource-updated-heading",
|
|
802
1027
|
children: t("resource.updated")
|
|
@@ -810,7 +1035,7 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
810
1035
|
})]
|
|
811
1036
|
}), /* @__PURE__ */ jsx("div", {
|
|
812
1037
|
className: "resource-list",
|
|
813
|
-
children: loading ? Array.from({ length: 5 }, (_, index) => /* @__PURE__ */ jsx(FlowSkeleton, {
|
|
1038
|
+
children: loading ? Array.from({ length: 5 }, (_, index) => /* @__PURE__ */ jsx(FlowSkeleton, {}, index)) : loadFailed ? /* @__PURE__ */ jsxs(Empty, {
|
|
814
1039
|
className: "min-h-64",
|
|
815
1040
|
role: "alert",
|
|
816
1041
|
children: [/* @__PURE__ */ jsxs(EmptyHeader, { children: [
|
|
@@ -849,11 +1074,10 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
849
1074
|
}), t("resource.newFlow")]
|
|
850
1075
|
}) })]
|
|
851
1076
|
}) : visible.map((flow) => /* @__PURE__ */ jsx(FlowItem, {
|
|
852
|
-
showTeam,
|
|
853
|
-
badge: flowBadges?.[flow.flowId],
|
|
854
1077
|
busy,
|
|
855
1078
|
flow,
|
|
856
1079
|
href: hrefForFlow(flow),
|
|
1080
|
+
hrefForFlow,
|
|
857
1081
|
onSelect: onSelectFlow,
|
|
858
1082
|
store
|
|
859
1083
|
}, flow.flowId))
|
|
@@ -1651,7 +1875,7 @@ function inputSignature(spec) {
|
|
|
1651
1875
|
}
|
|
1652
1876
|
async function inputEditor(spec, language, values) {
|
|
1653
1877
|
if (spec == null) return void 0;
|
|
1654
|
-
const { FlowRunInputEditorStore } = await import("./flowRunInputEditorStore-
|
|
1878
|
+
const { FlowRunInputEditorStore } = await import("./flowRunInputEditorStore-ys1-w9GW.js").then((n) => n.t);
|
|
1655
1879
|
const editor = new FlowRunInputEditorStore(spec.definitions, language, { allowOmittedNullable: spec.allowOmittedNullable });
|
|
1656
1880
|
const initial = values ?? spec.samples;
|
|
1657
1881
|
if (initial != null) editor.replaceValues(Object.fromEntries(spec.definitions.flatMap(({ handle }) => Object.hasOwn(initial, handle) ? [[handle, initial[handle]]] : [])));
|
|
@@ -3496,7 +3720,7 @@ function connectionDiagnostics(revision, actions, catalogs) {
|
|
|
3496
3720
|
const diagnostics = [];
|
|
3497
3721
|
for (const { nodeId, actionId, connectionId } of revision.connectorNodes()) {
|
|
3498
3722
|
const action = actions[actionId];
|
|
3499
|
-
if (action?.authenticated != true) continue;
|
|
3723
|
+
if (action?.authenticated != true || connectionId === "") continue;
|
|
3500
3724
|
const connection = connectionId == null ? void 0 : catalogs[action.serviceId]?.byId.get(connectionId);
|
|
3501
3725
|
if (connectionId != null && (catalogs[action.serviceId] == null || connection?.status == "active")) continue;
|
|
3502
3726
|
diagnostics.push({
|
|
@@ -3789,7 +4013,7 @@ var ConnectorStore = class {
|
|
|
3789
4013
|
}
|
|
3790
4014
|
}
|
|
3791
4015
|
async setConnection(nodeId, connectionId) {
|
|
3792
|
-
return await this.#workspace.setConnectorConnection(nodeId, connectionId);
|
|
4016
|
+
return await this.#workspace.nodes.setConnectorConnection(nodeId, connectionId);
|
|
3793
4017
|
}
|
|
3794
4018
|
async refreshAfterAuthorization() {
|
|
3795
4019
|
if (this.#disposed || this.#authorization == null) return;
|
|
@@ -3833,7 +4057,7 @@ var ConnectorStore = class {
|
|
|
3833
4057
|
const connection = created.length == 1 ? created[0] : catalog.preferred;
|
|
3834
4058
|
const selected = this.#workspace.$.revision.value?.node(target.nodeId);
|
|
3835
4059
|
const task = selected?.kind == "task" ? selected.definition : void 0;
|
|
3836
|
-
if (connection != null && this.#workspace.$.selectedNodeIds.value.includes(target.nodeId) && task != null && "executor" in task && task.executor.kind == "connector" && task.executor.connectionId == null) await this.#workspace.setConnectorConnection(target.nodeId, connection.connectionId);
|
|
4060
|
+
if (connection != null && this.#workspace.$.selectedNodeIds.value.includes(target.nodeId) && task != null && "executor" in task && task.executor.kind == "connector" && task.executor.connectionId == null) await this.#workspace.nodes.setConnectorConnection(target.nodeId, connection.connectionId);
|
|
3837
4061
|
}
|
|
3838
4062
|
#remember(source, ids) {
|
|
3839
4063
|
if (ids.some((id) => !source.value.includes(id))) source.set([.../* @__PURE__ */ new Set([...source.value, ...ids])]);
|
|
@@ -4106,7 +4330,7 @@ var TriggerStore = class {
|
|
|
4106
4330
|
}
|
|
4107
4331
|
}
|
|
4108
4332
|
async setConnection(triggerId, connectionId) {
|
|
4109
|
-
return await this.#workspace.setTriggerConnection(triggerId, connectionId);
|
|
4333
|
+
return await this.#workspace.nodes.setTriggerConnection(triggerId, connectionId);
|
|
4110
4334
|
}
|
|
4111
4335
|
async refreshAfterAuthorization() {
|
|
4112
4336
|
if (this.#disposed) return;
|
|
@@ -4141,7 +4365,7 @@ function inverseFlowChanges(content, operations) {
|
|
|
4141
4365
|
before: upgradeManualTrigger(requested.before),
|
|
4142
4366
|
node: upgradeManualTrigger(requested.node)
|
|
4143
4367
|
} : requested;
|
|
4144
|
-
const after = applyFlowChanges
|
|
4368
|
+
const after = applyFlowChanges(current, [operation]);
|
|
4145
4369
|
const restore = [];
|
|
4146
4370
|
switch (operation.kind) {
|
|
4147
4371
|
case "graph.node.replace":
|
|
@@ -4524,6 +4748,77 @@ function pasteNodes(revision, clipboard, identity) {
|
|
|
4524
4748
|
};
|
|
4525
4749
|
}
|
|
4526
4750
|
//#endregion
|
|
4751
|
+
//#region src/workbench/browser/runtime/editor/canvasClipboard.ts
|
|
4752
|
+
var CanvasClipboard = class {
|
|
4753
|
+
#value;
|
|
4754
|
+
constructor(identity, t) {
|
|
4755
|
+
this.identity = identity;
|
|
4756
|
+
this.t = t;
|
|
4757
|
+
}
|
|
4758
|
+
copy(revision, graph, nodeIds) {
|
|
4759
|
+
const selected = new Set(nodeIds);
|
|
4760
|
+
this.#value = {
|
|
4761
|
+
hiddenNodeIds: graph.nodes.flatMap((node) => node.contentHidden && selected.has(node.id) ? [node.id] : []),
|
|
4762
|
+
comments: graph.nodes.flatMap((node) => node.kind == "comment" && selected.has(node.id) ? [{
|
|
4763
|
+
content: node.content,
|
|
4764
|
+
position: node.position,
|
|
4765
|
+
sourceId: node.id,
|
|
4766
|
+
title: node.title
|
|
4767
|
+
}] : []),
|
|
4768
|
+
nodes: copyNodes(revision, nodeIds)
|
|
4769
|
+
};
|
|
4770
|
+
}
|
|
4771
|
+
paste(revision, graph, sourcePositions, offset = {
|
|
4772
|
+
x: 40,
|
|
4773
|
+
y: 40
|
|
4774
|
+
}) {
|
|
4775
|
+
if (this.#value == null) return;
|
|
4776
|
+
const hiddenNodeIds = new Set(this.#value.hiddenNodeIds);
|
|
4777
|
+
const pasted = pasteNodes(revision, this.#value.nodes, this.identity);
|
|
4778
|
+
const comments = this.#value.comments.map((comment) => ({
|
|
4779
|
+
...comment,
|
|
4780
|
+
nodeId: this.identity()
|
|
4781
|
+
}));
|
|
4782
|
+
if (pasted.nodeIds.length == 0 && comments.length == 0) return;
|
|
4783
|
+
const designerNodes = new Map(graph.nodes.map((node) => [node.id, node]));
|
|
4784
|
+
const added = /* @__PURE__ */ new Set([...pasted.nodeIds, ...comments.map((comment) => comment.nodeId)]);
|
|
4785
|
+
const occupied = new Set([...designerNodes].filter(([nodeId]) => !added.has(nodeId)).map(([, node]) => `${node.position.x}\0${node.position.y}`));
|
|
4786
|
+
const sources = [...pasted.sourceIds.map((sourceId) => sourcePositions?.[sourceId] ?? designerNodes.get(sourceId)?.position ?? {
|
|
4787
|
+
x: 80,
|
|
4788
|
+
y: 80
|
|
4789
|
+
}), ...comments.map((comment) => comment.position)];
|
|
4790
|
+
let step = 1;
|
|
4791
|
+
if (offset.x != 0 || offset.y != 0) while (sources.some((source) => occupied.has(`${source.x + offset.x * step}\0${source.y + offset.y * step}`))) step += 1;
|
|
4792
|
+
const positions = Object.fromEntries(pasted.sourceIds.map((sourceId, index) => {
|
|
4793
|
+
const source = sourcePositions?.[sourceId] ?? designerNodes.get(sourceId)?.position;
|
|
4794
|
+
return [pasted.nodeIds[index], {
|
|
4795
|
+
x: (source?.x ?? 80) + offset.x * step,
|
|
4796
|
+
y: (source?.y ?? 80) + offset.y * step
|
|
4797
|
+
}];
|
|
4798
|
+
}));
|
|
4799
|
+
return {
|
|
4800
|
+
changes: pasted.changes,
|
|
4801
|
+
nodeIds: [...pasted.nodeIds, ...comments.map((comment) => comment.nodeId)],
|
|
4802
|
+
update: (value) => {
|
|
4803
|
+
let next = setNodePositions(value, positions);
|
|
4804
|
+
for (const [index, sourceId] of pasted.sourceIds.entries()) if (hiddenNodeIds.has(sourceId)) next = setNodeContentHidden(next, pasted.nodeIds[index], true);
|
|
4805
|
+
for (const comment of comments) {
|
|
4806
|
+
if (hiddenNodeIds.has(comment.sourceId)) next = setNodeContentHidden(next, comment.nodeId, true);
|
|
4807
|
+
next = setComment(next, comment.nodeId, {
|
|
4808
|
+
content: comment.content,
|
|
4809
|
+
position: {
|
|
4810
|
+
x: comment.position.x + offset.x * step,
|
|
4811
|
+
y: comment.position.y + offset.y * step
|
|
4812
|
+
},
|
|
4813
|
+
title: this.t("addNode.commentCopy", { title: comment.title })
|
|
4814
|
+
});
|
|
4815
|
+
}
|
|
4816
|
+
return next;
|
|
4817
|
+
}
|
|
4818
|
+
};
|
|
4819
|
+
}
|
|
4820
|
+
};
|
|
4821
|
+
//#endregion
|
|
4527
4822
|
//#region src/workbench/browser/runtime/stores/canvasHistory.ts
|
|
4528
4823
|
var CanvasHistory = class {
|
|
4529
4824
|
constructor() {
|
|
@@ -4674,7 +4969,7 @@ var DraftChanges = class {
|
|
|
4674
4969
|
let projected = draft;
|
|
4675
4970
|
const pending = [];
|
|
4676
4971
|
for (const change of this.#pending) try {
|
|
4677
|
-
projected = applyFlowChanges(projected, change.changes);
|
|
4972
|
+
projected = applyFlowChanges$1(projected, change.changes);
|
|
4678
4973
|
pending.push(change);
|
|
4679
4974
|
} catch (error) {
|
|
4680
4975
|
if (!(error instanceof FlowChangeError)) throw error;
|
|
@@ -4684,7 +4979,7 @@ var DraftChanges = class {
|
|
|
4684
4979
|
return projected;
|
|
4685
4980
|
}
|
|
4686
4981
|
project(draft) {
|
|
4687
|
-
return this.#pending.reduce((current, pending) => applyFlowChanges(current, pending.changes), draft);
|
|
4982
|
+
return this.#pending.reduce((current, pending) => applyFlowChanges$1(current, pending.changes), draft);
|
|
4688
4983
|
}
|
|
4689
4984
|
async settled() {
|
|
4690
4985
|
await this.#queue;
|
|
@@ -4772,7 +5067,7 @@ var DraftChanges = class {
|
|
|
4772
5067
|
#applyCommitted(pending, base, change) {
|
|
4773
5068
|
const committed = {
|
|
4774
5069
|
...change.revision,
|
|
4775
|
-
content: applyFlowChanges(base, pending.changes).content
|
|
5070
|
+
content: applyFlowChanges$1(base, pending.changes).content
|
|
4776
5071
|
};
|
|
4777
5072
|
this.#pending = this.#pending.filter((candidate) => candidate !== pending);
|
|
4778
5073
|
this.#committed = committed;
|
|
@@ -4893,11 +5188,12 @@ var FlowCatalog = class {
|
|
|
4893
5188
|
limit: pageLimit
|
|
4894
5189
|
});
|
|
4895
5190
|
if (!current()) return;
|
|
4896
|
-
const
|
|
5191
|
+
const flows = new Map(this.#state.value.flows.map((flow) => [flow.flowId, flow]));
|
|
5192
|
+
for (const flow of page.flows) flows.set(flow.flowId, flow);
|
|
4897
5193
|
this.#set({
|
|
4898
5194
|
loadingMore: false,
|
|
4899
5195
|
nextCursor: page.nextCursor,
|
|
4900
|
-
flows: [...
|
|
5196
|
+
flows: [...flows.values()]
|
|
4901
5197
|
});
|
|
4902
5198
|
} catch (error) {
|
|
4903
5199
|
if (!current()) return;
|
|
@@ -4953,22 +5249,81 @@ var FlowCatalog = class {
|
|
|
4953
5249
|
this.#pending.delete(flow.flowId);
|
|
4954
5250
|
}
|
|
4955
5251
|
}
|
|
5252
|
+
create(name, create) {
|
|
5253
|
+
return this.#create(async () => create == null ? this.#client.createFlow(name) : this.#client.getFlow(await create(name)));
|
|
5254
|
+
}
|
|
5255
|
+
import(file, name, key, importer) {
|
|
5256
|
+
return this.#create(async () => importer == null ? this.#client.importFlow(file, {
|
|
5257
|
+
name,
|
|
5258
|
+
idempotencyKey: key
|
|
5259
|
+
}) : this.#client.getFlow(await importer(file, name, key)));
|
|
5260
|
+
}
|
|
5261
|
+
async #create(create) {
|
|
5262
|
+
try {
|
|
5263
|
+
const created = await create();
|
|
5264
|
+
if (this.#disposed) return;
|
|
5265
|
+
this.#insert(created);
|
|
5266
|
+
return created;
|
|
5267
|
+
} catch (error) {
|
|
5268
|
+
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
async delete(flowId) {
|
|
5272
|
+
const flow = this.flow(flowId);
|
|
5273
|
+
if (flow == null || flow.status == "retiring") return false;
|
|
5274
|
+
try {
|
|
5275
|
+
await this.#client.deleteFlow(flowId);
|
|
5276
|
+
if (this.#disposed) return false;
|
|
5277
|
+
this.#remove(flowId);
|
|
5278
|
+
this.#setNotice({
|
|
5279
|
+
kind: "success",
|
|
5280
|
+
message: this.#i18n.t("notice.flowDeleteAccepted", { name: flow.name })
|
|
5281
|
+
});
|
|
5282
|
+
return true;
|
|
5283
|
+
} catch (error) {
|
|
5284
|
+
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5285
|
+
return false;
|
|
5286
|
+
}
|
|
5287
|
+
}
|
|
5288
|
+
async rename(flowId, name) {
|
|
5289
|
+
const flow = this.flow(flowId);
|
|
5290
|
+
const nextName = name.trim();
|
|
5291
|
+
if (flow == null || nextName.length == 0) return false;
|
|
5292
|
+
if (flow.name == nextName) return true;
|
|
5293
|
+
try {
|
|
5294
|
+
const changed = await this.#client.renameFlow(flowId, nextName);
|
|
5295
|
+
if (this.#disposed) return false;
|
|
5296
|
+
this.include(changed);
|
|
5297
|
+
this.#setNotice({
|
|
5298
|
+
kind: "success",
|
|
5299
|
+
message: this.#i18n.t("notice.flowRenamed", { name: nextName })
|
|
5300
|
+
});
|
|
5301
|
+
return true;
|
|
5302
|
+
} catch (error) {
|
|
5303
|
+
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5304
|
+
return false;
|
|
5305
|
+
}
|
|
5306
|
+
}
|
|
4956
5307
|
include(flow) {
|
|
4957
5308
|
const index = this.#state.value.flows.findIndex((candidate) => candidate.flowId == flow.flowId);
|
|
4958
5309
|
if (index < 0) {
|
|
4959
5310
|
this.#set({ flows: [...this.#state.value.flows, flow] });
|
|
4960
5311
|
return;
|
|
4961
5312
|
}
|
|
4962
|
-
|
|
5313
|
+
const referenceCount = this.#state.value.flows[index].referenceCount;
|
|
5314
|
+
this.#set({ flows: this.#state.value.flows.with(index, {
|
|
5315
|
+
...flow,
|
|
5316
|
+
...referenceCount == null ? {} : { referenceCount }
|
|
5317
|
+
}) });
|
|
4963
5318
|
}
|
|
4964
|
-
insert(flow) {
|
|
5319
|
+
#insert(flow) {
|
|
4965
5320
|
if (this.#state.value.flows.some((candidate) => candidate.flowId == flow.flowId)) return;
|
|
4966
5321
|
this.#set({
|
|
4967
5322
|
flows: [...this.#state.value.flows, flow],
|
|
4968
5323
|
total: this.#state.value.total == null ? void 0 : this.#state.value.total + 1
|
|
4969
5324
|
});
|
|
4970
5325
|
}
|
|
4971
|
-
remove(flowId) {
|
|
5326
|
+
#remove(flowId) {
|
|
4972
5327
|
this.#set({
|
|
4973
5328
|
flows: this.#state.value.flows.filter((flow) => flow.flowId != flowId),
|
|
4974
5329
|
total: this.#state.value.total == null ? void 0 : this.#state.value.total - 1
|
|
@@ -5127,51 +5482,228 @@ var ModuleEditorSession = class {
|
|
|
5127
5482
|
}
|
|
5128
5483
|
};
|
|
5129
5484
|
//#endregion
|
|
5130
|
-
//#region src/workbench/browser/runtime/stores/
|
|
5131
|
-
var
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
#changes = Promise.resolve();
|
|
5137
|
-
#committed;
|
|
5138
|
-
#disposed = false;
|
|
5139
|
-
#failed = false;
|
|
5140
|
-
#pending = [];
|
|
5141
|
-
constructor(client, setNotice, setPresentation, i18n) {
|
|
5142
|
-
this.#client = client;
|
|
5143
|
-
this.#setNotice = setNotice;
|
|
5144
|
-
this.#setPresentation = setPresentation;
|
|
5145
|
-
this.#i18n = i18n;
|
|
5485
|
+
//#region src/workbench/browser/runtime/stores/nodeEdits.ts
|
|
5486
|
+
var NodeEdits = class {
|
|
5487
|
+
constructor(revision, save, identity) {
|
|
5488
|
+
this.revision = revision;
|
|
5489
|
+
this.save = save;
|
|
5490
|
+
this.identity = identity;
|
|
5146
5491
|
}
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5492
|
+
async saveErrorSources(nodeId, value) {
|
|
5493
|
+
const node = this.revision.value?.graph()?.nodes[nodeId];
|
|
5494
|
+
if (node?.kind != "error" || dequal$1(node.sourceFlowIds ?? [], value)) return false;
|
|
5495
|
+
return await this.save([{
|
|
5496
|
+
kind: "graph.trigger.sources.set",
|
|
5497
|
+
nodeId,
|
|
5498
|
+
before: node.sourceFlowIds,
|
|
5499
|
+
value: value.length == 0 ? void 0 : value
|
|
5500
|
+
}]);
|
|
5151
5501
|
}
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5502
|
+
async saveNodeSettings(nodeId, settings) {
|
|
5503
|
+
const revision = this.revision.value;
|
|
5504
|
+
if (revision == null) return false;
|
|
5505
|
+
const changes = updateNodeSettings(revision, nodeId, settings);
|
|
5506
|
+
return changes != null && await this.save(changes);
|
|
5155
5507
|
}
|
|
5156
|
-
async
|
|
5157
|
-
|
|
5158
|
-
|
|
5508
|
+
async saveNodeDescription(nodeId, description) {
|
|
5509
|
+
const revision = this.revision.value;
|
|
5510
|
+
if (revision == null) return false;
|
|
5511
|
+
const changes = updateNodeDescription(revision, nodeId, description);
|
|
5512
|
+
return changes != null && await this.save(changes);
|
|
5159
5513
|
}
|
|
5160
|
-
async
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
} while (pending !== this.#changes);
|
|
5514
|
+
async saveNodeIcon(nodeId, icon) {
|
|
5515
|
+
const revision = this.revision.value;
|
|
5516
|
+
if (revision == null) return false;
|
|
5517
|
+
const changes = updateNodeIcon(revision, nodeId, icon);
|
|
5518
|
+
return changes != null && await this.save(changes);
|
|
5166
5519
|
}
|
|
5167
|
-
async
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5520
|
+
async saveNodeTitle(nodeId, title) {
|
|
5521
|
+
const revision = this.revision.value;
|
|
5522
|
+
if (revision == null) return false;
|
|
5523
|
+
const changes = updateNodeName(revision, nodeId, title);
|
|
5524
|
+
return changes != null && await this.save(changes);
|
|
5525
|
+
}
|
|
5526
|
+
async setInputValue(nodeId, handle, value, deletion) {
|
|
5527
|
+
const revision = this.revision.value;
|
|
5528
|
+
if (revision == null) return false;
|
|
5529
|
+
const changes = setInputValue(revision, nodeId, handle, value);
|
|
5530
|
+
return changes != null && await this.save(changes, deletion);
|
|
5531
|
+
}
|
|
5532
|
+
async resetInputs(nodeId, handles) {
|
|
5533
|
+
const revision = this.revision.value;
|
|
5534
|
+
if (revision == null) return false;
|
|
5535
|
+
return await this.save(resetInputValues(revision.revision.content, nodeId, handles));
|
|
5536
|
+
}
|
|
5537
|
+
async saveOutputsDefs(nodeId, definitions, deletion, values) {
|
|
5538
|
+
const revision = this.revision.value;
|
|
5539
|
+
if (revision == null || revision.graph().nodes[nodeId]?.kind != "outputs") return false;
|
|
5540
|
+
return await this.save(updateOutputPorts(revision, nodeId, definitions, values), deletion);
|
|
5541
|
+
}
|
|
5542
|
+
async saveStartInputDefs(nodeId, inputDefs, deletion) {
|
|
5543
|
+
const revision = this.revision.value;
|
|
5544
|
+
if (revision == null || revision.graph().nodes[nodeId]?.kind != "start") return false;
|
|
5545
|
+
const changes = updateStartInputDefs(revision.revision.content, nodeId, inputDefs);
|
|
5546
|
+
return await this.save(changes, deletion);
|
|
5547
|
+
}
|
|
5548
|
+
async resetTriggerConfig(triggerId, names) {
|
|
5549
|
+
const revision = this.revision.value;
|
|
5550
|
+
if (revision == null) return false;
|
|
5551
|
+
const trigger = revision.graph()?.nodes[triggerId];
|
|
5552
|
+
if (trigger?.kind !== "poll" && trigger?.kind !== "integration") return false;
|
|
5553
|
+
const changes = (names == null ? Object.entries(trigger.config) : names.flatMap((name) => Object.hasOwn(trigger.config, name) ? [[name, trigger.config[name]]] : [])).map(([name, before]) => ({
|
|
5554
|
+
kind: "graph.trigger.config.set",
|
|
5555
|
+
nodeId: triggerId,
|
|
5556
|
+
name,
|
|
5557
|
+
before,
|
|
5558
|
+
value: void 0
|
|
5559
|
+
}));
|
|
5560
|
+
return await this.save(changes);
|
|
5561
|
+
}
|
|
5562
|
+
async setInputSource(nodeId, handle, source) {
|
|
5563
|
+
const revision = this.revision.value;
|
|
5564
|
+
if (revision == null) return false;
|
|
5565
|
+
return await this.save(setInputSources(revision.revision.content, nodeId, handle, [{
|
|
5566
|
+
kind: "node",
|
|
5567
|
+
...source
|
|
5568
|
+
}]));
|
|
5569
|
+
}
|
|
5570
|
+
async setInputVariable(nodeId, handle, name) {
|
|
5571
|
+
const revision = this.revision.value;
|
|
5572
|
+
if (revision == null) return false;
|
|
5573
|
+
const changes = name == null ? setInputValue(revision, nodeId, handle, void 0) : setInputVariable(revision, nodeId, handle, name, this.identity());
|
|
5574
|
+
return changes != null && await this.save(changes);
|
|
5575
|
+
}
|
|
5576
|
+
async saveCondition(nodeId, settings, deletion) {
|
|
5577
|
+
const revision = this.revision.value;
|
|
5578
|
+
if (revision == null) return false;
|
|
5579
|
+
const changes = updateCondition(revision, nodeId, settings);
|
|
5580
|
+
return changes != null && await this.save(changes, deletion);
|
|
5581
|
+
}
|
|
5582
|
+
async saveValue(nodeId, values, deletion) {
|
|
5583
|
+
const revision = this.revision.value;
|
|
5584
|
+
if (revision == null) return false;
|
|
5585
|
+
const changes = updateValue(revision, nodeId, values);
|
|
5586
|
+
return changes != null && await this.save(changes, deletion);
|
|
5587
|
+
}
|
|
5588
|
+
async saveResolution(nodeId, settings, deletion, values) {
|
|
5589
|
+
const revision = this.revision.value;
|
|
5590
|
+
if (revision == null) return false;
|
|
5591
|
+
const changes = updateResolution(revision, nodeId, settings, values);
|
|
5592
|
+
return changes != null && await this.save(changes, deletion);
|
|
5593
|
+
}
|
|
5594
|
+
async saveTaskSettings(nodeId, settings, deletion) {
|
|
5595
|
+
const revision = this.revision.value;
|
|
5596
|
+
if (revision == null) return false;
|
|
5597
|
+
const changes = updateTask(revision, nodeId, settings);
|
|
5598
|
+
return changes != null && await this.save(changes, deletion);
|
|
5599
|
+
}
|
|
5600
|
+
async saveTaskPorts(nodeId, ports, deletion, values) {
|
|
5601
|
+
const revision = this.revision.value;
|
|
5602
|
+
if (revision == null) return false;
|
|
5603
|
+
const changes = updateTaskPorts(revision, nodeId, ports, values);
|
|
5604
|
+
return changes != null && await this.save(changes, deletion);
|
|
5605
|
+
}
|
|
5606
|
+
async saveTaskAdditionalInputs(nodeId, inputs, deletion, values) {
|
|
5607
|
+
const revision = this.revision.value;
|
|
5608
|
+
if (revision == null) return false;
|
|
5609
|
+
const changes = updateTaskAdditionalInputs(revision, nodeId, inputs, values);
|
|
5610
|
+
return changes != null && await this.save(changes, deletion);
|
|
5611
|
+
}
|
|
5612
|
+
async setConnectorConnection(nodeId, connectionId) {
|
|
5613
|
+
const revision = this.revision.value;
|
|
5614
|
+
if (revision == null) return false;
|
|
5615
|
+
const changes = setConnectorConnection(revision.revision.content, nodeId, connectionId);
|
|
5616
|
+
return changes != null && await this.save(changes);
|
|
5617
|
+
}
|
|
5618
|
+
async setServiceConnections(providerId, connectionId, previousConnectionId) {
|
|
5619
|
+
const revision = this.revision.value;
|
|
5620
|
+
if (revision == null) return false;
|
|
5621
|
+
const changes = setServiceConnections(revision.revision.content, providerId, connectionId, previousConnectionId);
|
|
5622
|
+
return changes.length == 0 || await this.save(changes);
|
|
5623
|
+
}
|
|
5624
|
+
async setCodeActions(nodeId, capabilities) {
|
|
5625
|
+
const revision = this.revision.value;
|
|
5626
|
+
if (revision == null) return false;
|
|
5627
|
+
const changes = setCodeActions(revision.revision.content, nodeId, capabilities);
|
|
5628
|
+
return changes == null || await this.save(changes);
|
|
5629
|
+
}
|
|
5630
|
+
async setTriggerEventSource(triggerId, source) {
|
|
5631
|
+
const revision = this.revision.value;
|
|
5632
|
+
if (revision == null) return false;
|
|
5633
|
+
const changes = setTriggerEventSource(revision, triggerId, source);
|
|
5634
|
+
return changes != null && await this.save(changes);
|
|
5635
|
+
}
|
|
5636
|
+
async saveTriggerConfig(triggerId, name, value) {
|
|
5637
|
+
const revision = this.revision.value;
|
|
5638
|
+
if (revision == null) return false;
|
|
5639
|
+
const changes = updateTriggerConfig(revision, triggerId, name, value);
|
|
5640
|
+
return changes != null && await this.save(changes);
|
|
5641
|
+
}
|
|
5642
|
+
async saveTriggerSchedule(triggerId, schedule) {
|
|
5643
|
+
const revision = this.revision.value;
|
|
5644
|
+
if (revision == null) return false;
|
|
5645
|
+
const changes = updateTriggerSchedule(revision.revision.content, triggerId, schedule);
|
|
5646
|
+
return changes != null && await this.save(changes);
|
|
5647
|
+
}
|
|
5648
|
+
async saveWebhook(triggerId, settings, deletion) {
|
|
5649
|
+
const revision = this.revision.value;
|
|
5650
|
+
if (revision == null) return false;
|
|
5651
|
+
const changes = updateWebhook(revision, triggerId, settings);
|
|
5652
|
+
return changes != null && await this.save(changes, deletion);
|
|
5653
|
+
}
|
|
5654
|
+
async setTriggerConnection(triggerId, connectionId) {
|
|
5655
|
+
const revision = this.revision.value;
|
|
5656
|
+
if (revision == null) return false;
|
|
5657
|
+
const changes = setTriggerConnection(revision, triggerId, connectionId);
|
|
5658
|
+
return changes != null && await this.save(changes);
|
|
5659
|
+
}
|
|
5660
|
+
};
|
|
5661
|
+
//#endregion
|
|
5662
|
+
//#region src/workbench/browser/runtime/stores/presentationChanges.ts
|
|
5663
|
+
var PresentationChanges = class {
|
|
5664
|
+
#client;
|
|
5665
|
+
#i18n;
|
|
5666
|
+
#setNotice;
|
|
5667
|
+
#setPresentation;
|
|
5668
|
+
#changes = Promise.resolve();
|
|
5669
|
+
#committed;
|
|
5670
|
+
#disposed = false;
|
|
5671
|
+
#failed = false;
|
|
5672
|
+
#pending = [];
|
|
5673
|
+
constructor(client, setNotice, setPresentation, i18n) {
|
|
5674
|
+
this.#client = client;
|
|
5675
|
+
this.#setNotice = setNotice;
|
|
5676
|
+
this.#setPresentation = setPresentation;
|
|
5677
|
+
this.#i18n = i18n;
|
|
5678
|
+
}
|
|
5679
|
+
reset(presentation) {
|
|
5680
|
+
this.#failed = false;
|
|
5681
|
+
this.#committed = presentation;
|
|
5682
|
+
this.#pending = [];
|
|
5683
|
+
}
|
|
5684
|
+
dispose() {
|
|
5685
|
+
this.#disposed = true;
|
|
5686
|
+
this.#pending = [];
|
|
5687
|
+
}
|
|
5688
|
+
async flush() {
|
|
5689
|
+
await this.settled();
|
|
5690
|
+
return !this.#failed && !this.#disposed;
|
|
5691
|
+
}
|
|
5692
|
+
async settled() {
|
|
5693
|
+
let pending;
|
|
5694
|
+
do {
|
|
5695
|
+
pending = this.#changes;
|
|
5696
|
+
await pending;
|
|
5697
|
+
} while (pending !== this.#changes);
|
|
5698
|
+
}
|
|
5699
|
+
async change(flowId, presentation, current, update) {
|
|
5700
|
+
if (this.#disposed || this.#committed == null) return false;
|
|
5701
|
+
const value = update(presentation.value);
|
|
5702
|
+
if (dequal$1(value, presentation.value)) return true;
|
|
5703
|
+
const pending = {
|
|
5704
|
+
current,
|
|
5705
|
+
flowId,
|
|
5706
|
+
update
|
|
5175
5707
|
};
|
|
5176
5708
|
this.#pending.push(pending);
|
|
5177
5709
|
this.#setPresentation({
|
|
@@ -5345,10 +5877,6 @@ var WorkspaceModel = class {
|
|
|
5345
5877
|
};
|
|
5346
5878
|
//#endregion
|
|
5347
5879
|
//#region src/workbench/browser/runtime/stores/workspaceStore.ts
|
|
5348
|
-
var PASTE_OFFSET = {
|
|
5349
|
-
x: 40,
|
|
5350
|
-
y: 40
|
|
5351
|
-
};
|
|
5352
5880
|
var deletionMessageKeys = {
|
|
5353
5881
|
field: "history.deleted.field",
|
|
5354
5882
|
group: "history.deleted.group",
|
|
@@ -5393,6 +5921,9 @@ var WorkspaceStore = class {
|
|
|
5393
5921
|
this.filterTriggerConnections = filterTriggerConnections;
|
|
5394
5922
|
this.#canvasCommandListeners = /* @__PURE__ */ new Set();
|
|
5395
5923
|
this.#draftSession = new Latest();
|
|
5924
|
+
this.notify = (notice) => {
|
|
5925
|
+
if (!this.#disposed) this.#setNotice(notice);
|
|
5926
|
+
};
|
|
5396
5927
|
this.#history = new CanvasHistory();
|
|
5397
5928
|
this.history$ = this.#history.state$;
|
|
5398
5929
|
this.#diagnosticFocusId = 0;
|
|
@@ -5411,6 +5942,7 @@ var WorkspaceStore = class {
|
|
|
5411
5942
|
this.#client = client;
|
|
5412
5943
|
this.#setNotice = setNotice;
|
|
5413
5944
|
this.#identity = identity;
|
|
5945
|
+
this.#clipboard = new CanvasClipboard(identity, i18n.t);
|
|
5414
5946
|
this.#i18n = i18n;
|
|
5415
5947
|
this.#runChanged = runChanged;
|
|
5416
5948
|
this.#flows = new FlowCatalog(client, setNotice, i18n);
|
|
@@ -5434,6 +5966,7 @@ var WorkspaceStore = class {
|
|
|
5434
5966
|
});
|
|
5435
5967
|
this.#presentationChanges = new PresentationChanges(client, setNotice, (presentation) => this.#set({ presentation }), i18n);
|
|
5436
5968
|
this.$ = this.#model.$;
|
|
5969
|
+
this.nodes = new NodeEdits(this.$.revision, async (changes, deletion) => await this.#canvasChange("edit", 1, changes, void 0, void 0, deletion) && this.#model.value.draft != null, identity);
|
|
5437
5970
|
}
|
|
5438
5971
|
dispose() {
|
|
5439
5972
|
this.catalogs.dispose();
|
|
@@ -5519,13 +6052,14 @@ var WorkspaceStore = class {
|
|
|
5519
6052
|
try {
|
|
5520
6053
|
let invalidated = false;
|
|
5521
6054
|
let pendingRevision;
|
|
5522
|
-
const
|
|
6055
|
+
const changed = (revisionId) => {
|
|
5523
6056
|
if (!current()) return;
|
|
5524
6057
|
if (this.#draftChanges.committed == null) {
|
|
5525
6058
|
invalidated = true;
|
|
5526
6059
|
pendingRevision = revisionId;
|
|
5527
6060
|
} else if (revisionId != this.#draftChanges.committed.revisionId) this.#refreshDraft(revisionId);
|
|
5528
|
-
}
|
|
6061
|
+
};
|
|
6062
|
+
const subscription = this.#client.watchFlow(flowId, changed, (event) => {
|
|
5529
6063
|
if (current()) this.#runChanged(event);
|
|
5530
6064
|
}, (accessRevision) => {
|
|
5531
6065
|
if (current()) {
|
|
@@ -5536,8 +6070,18 @@ var WorkspaceStore = class {
|
|
|
5536
6070
|
if (current() && !this.#model.value.workspaceLoading) for (const execute of this.#canvasCommandListeners) execute(command);
|
|
5537
6071
|
});
|
|
5538
6072
|
this.#stopFlowWatch = subscription.stop;
|
|
5539
|
-
|
|
6073
|
+
let reading = false;
|
|
6074
|
+
subscription.ready.then(() => {
|
|
6075
|
+
if (reading) changed();
|
|
6076
|
+
}, (error) => {
|
|
6077
|
+
if (!current()) return;
|
|
6078
|
+
subscription.stop();
|
|
6079
|
+
this.#stopFlowWatch = void 0;
|
|
6080
|
+
this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
6081
|
+
});
|
|
6082
|
+
await Promise.resolve();
|
|
5540
6083
|
if (!current()) return false;
|
|
6084
|
+
reading = true;
|
|
5541
6085
|
let editor = await this.#client.getEditor(flowId);
|
|
5542
6086
|
for (let attempt = 0; current() && Object.values(revisionView(editor.draft).graph().nodes).some((node) => node.kind == "manual"); attempt += 1) {
|
|
5543
6087
|
if (attempt >= 3) throw new ApiError(409, controlErrorCode.flowRevisionConflict, "The Draft changed while upgrading its Start node.");
|
|
@@ -5660,72 +6204,46 @@ var WorkspaceStore = class {
|
|
|
5660
6204
|
}
|
|
5661
6205
|
}
|
|
5662
6206
|
createFlow(name, create) {
|
|
5663
|
-
return this.#createFlow(
|
|
6207
|
+
return this.#createFlow(() => this.#flows.create(name, create));
|
|
5664
6208
|
}
|
|
5665
6209
|
importFlow(file, name, key, importer) {
|
|
5666
|
-
return this.#createFlow(
|
|
5667
|
-
name,
|
|
5668
|
-
idempotencyKey: key
|
|
5669
|
-
}) : this.#client.getFlow(await importer(file, name, key)));
|
|
6210
|
+
return this.#createFlow(() => this.#flows.import(file, name, key, importer));
|
|
5670
6211
|
}
|
|
5671
6212
|
async #createFlow(create) {
|
|
5672
6213
|
if (!await this.saveModuleEditor()) return;
|
|
5673
6214
|
this.#set({ busy: "flow" });
|
|
5674
6215
|
try {
|
|
5675
|
-
|
|
5676
|
-
if (this.#disposed) return;
|
|
5677
|
-
this.#flows.insert(created);
|
|
5678
|
-
return created;
|
|
5679
|
-
} catch (error) {
|
|
5680
|
-
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
6216
|
+
return await create();
|
|
5681
6217
|
} finally {
|
|
5682
6218
|
this.#set({ busy: void 0 });
|
|
5683
6219
|
}
|
|
5684
6220
|
}
|
|
6221
|
+
getFlowReferences(flowId, options = {}) {
|
|
6222
|
+
return this.#client.getFlowReferences(flowId, {
|
|
6223
|
+
...options,
|
|
6224
|
+
direction: "incoming",
|
|
6225
|
+
limit: 50
|
|
6226
|
+
});
|
|
6227
|
+
}
|
|
5685
6228
|
getErrorListeners(flowId, signal) {
|
|
5686
6229
|
return this.#client.getErrorListeners(flowId, signal);
|
|
5687
6230
|
}
|
|
5688
6231
|
async deleteFlow(flowId) {
|
|
5689
6232
|
if (!await this.saveModuleEditor()) return false;
|
|
5690
|
-
const flow = this.#flows.flow(flowId);
|
|
5691
|
-
if (flow == null || flow.status == "retiring") return false;
|
|
5692
6233
|
this.#set({ busy: "flow" });
|
|
5693
6234
|
try {
|
|
5694
|
-
await this.#
|
|
5695
|
-
if (this.#disposed) return false;
|
|
5696
|
-
this.#flows.remove(flowId);
|
|
5697
|
-
this.#setNotice({
|
|
5698
|
-
kind: "success",
|
|
5699
|
-
message: this.#i18n.t("notice.flowDeleteAccepted", { name: flow.name })
|
|
5700
|
-
});
|
|
5701
|
-
return true;
|
|
5702
|
-
} catch (error) {
|
|
5703
|
-
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5704
|
-
return false;
|
|
6235
|
+
return await this.#flows.delete(flowId);
|
|
5705
6236
|
} finally {
|
|
5706
6237
|
this.#set({ busy: void 0 });
|
|
5707
6238
|
}
|
|
5708
6239
|
}
|
|
5709
6240
|
async renameFlow(flowId, name) {
|
|
5710
|
-
const flow = this.#flows.flow(flowId);
|
|
5711
|
-
const nextName = name.trim();
|
|
5712
|
-
if (flow == null || nextName.length == 0) return false;
|
|
5713
|
-
if (flow.name == nextName) return true;
|
|
5714
6241
|
this.#set({ busy: "flow" });
|
|
5715
|
-
let changed;
|
|
5716
6242
|
try {
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
6243
|
+
return await this.#flows.rename(flowId, name);
|
|
6244
|
+
} finally {
|
|
6245
|
+
this.#set({ busy: void 0 });
|
|
5721
6246
|
}
|
|
5722
|
-
this.#set({ busy: void 0 });
|
|
5723
|
-
if (changed == null) return false;
|
|
5724
|
-
this.#setNotice({
|
|
5725
|
-
kind: "success",
|
|
5726
|
-
message: this.#i18n.t("notice.flowRenamed", { name: nextName })
|
|
5727
|
-
});
|
|
5728
|
-
return true;
|
|
5729
6247
|
}
|
|
5730
6248
|
async addNode(option, position, connection) {
|
|
5731
6249
|
if (!await this.saveModuleEditor()) return;
|
|
@@ -5752,7 +6270,7 @@ var WorkspaceStore = class {
|
|
|
5752
6270
|
const edge = connection?.(nodeId);
|
|
5753
6271
|
const nodeChanges = addNode(revision, nodeId, intent);
|
|
5754
6272
|
if (nodeChanges == null) return;
|
|
5755
|
-
const changes = edge == null ? nodeChanges : [...nodeChanges, ...connect(applyFlowChanges(draft, nodeChanges).content, {
|
|
6273
|
+
const changes = edge == null ? nodeChanges : [...nodeChanges, ...connect(applyFlowChanges$1(draft, nodeChanges).content, {
|
|
5756
6274
|
source: edge.source,
|
|
5757
6275
|
target: edge.target,
|
|
5758
6276
|
...edge.sourceHandle.startsWith("$branch:") ? { sourceHandle: edge.sourceHandle.slice(8) } : {}
|
|
@@ -5802,168 +6320,19 @@ var WorkspaceStore = class {
|
|
|
5802
6320
|
copySelectedNodes() {
|
|
5803
6321
|
const revision = this.$.revision.value;
|
|
5804
6322
|
if (revision == null || this.#model.value.selectedNodeIds.length == 0) return;
|
|
5805
|
-
|
|
5806
|
-
this.#clipboard = {
|
|
5807
|
-
hiddenNodeIds: this.#designer().nodes.flatMap((node) => node.contentHidden && selected.has(node.id) ? [node.id] : []),
|
|
5808
|
-
comments: this.#designer().nodes.flatMap((node) => node.kind == "comment" && selected.has(node.id) ? [{
|
|
5809
|
-
content: node.content,
|
|
5810
|
-
position: node.position,
|
|
5811
|
-
sourceId: node.id,
|
|
5812
|
-
title: node.title
|
|
5813
|
-
}] : []),
|
|
5814
|
-
nodes: copyNodes(revision, this.#model.value.selectedNodeIds)
|
|
5815
|
-
};
|
|
6323
|
+
this.#clipboard.copy(revision, this.#designer(), this.#model.value.selectedNodeIds);
|
|
5816
6324
|
}
|
|
5817
|
-
async pasteNodes(sourcePositions, offset
|
|
6325
|
+
async pasteNodes(sourcePositions, offset) {
|
|
5818
6326
|
if (!await this.saveModuleEditor()) return;
|
|
5819
6327
|
const revision = this.$.revision.value;
|
|
5820
|
-
if (revision == null
|
|
5821
|
-
const
|
|
5822
|
-
|
|
5823
|
-
const comments = this.#clipboard.comments.map((comment) => ({
|
|
5824
|
-
...comment,
|
|
5825
|
-
nodeId: this.#identity()
|
|
5826
|
-
}));
|
|
5827
|
-
if (pasted.nodeIds.length == 0 && comments.length == 0) return;
|
|
5828
|
-
const designerNodes = new Map(this.#designer().nodes.map((node) => [node.id, node]));
|
|
5829
|
-
const added = /* @__PURE__ */ new Set([...pasted.nodeIds, ...comments.map((comment) => comment.nodeId)]);
|
|
5830
|
-
const occupied = new Set([...designerNodes].filter(([nodeId]) => !added.has(nodeId)).map(([, node]) => `${node.position.x}\0${node.position.y}`));
|
|
5831
|
-
const sources = [...pasted.sourceIds.map((sourceId) => sourcePositions?.[sourceId] ?? designerNodes.get(sourceId)?.position ?? {
|
|
5832
|
-
x: 80,
|
|
5833
|
-
y: 80
|
|
5834
|
-
}), ...comments.map((comment) => comment.position)];
|
|
5835
|
-
let step = 1;
|
|
5836
|
-
if (offset.x != 0 || offset.y != 0) while (sources.some((source) => occupied.has(`${source.x + offset.x * step}\0${source.y + offset.y * step}`))) step += 1;
|
|
5837
|
-
const positions = Object.fromEntries(pasted.sourceIds.map((sourceId, index) => {
|
|
5838
|
-
const source = sourcePositions?.[sourceId] ?? designerNodes.get(sourceId)?.position;
|
|
5839
|
-
return [pasted.nodeIds[index], {
|
|
5840
|
-
x: (source?.x ?? 80) + offset.x * step,
|
|
5841
|
-
y: (source?.y ?? 80) + offset.y * step
|
|
5842
|
-
}];
|
|
5843
|
-
}));
|
|
5844
|
-
await this.#canvasChange("paste", added.size, pasted.changes, (value) => {
|
|
5845
|
-
let next = setNodePositions(value, positions);
|
|
5846
|
-
for (const [index, sourceId] of pasted.sourceIds.entries()) if (hiddenNodeIds.has(sourceId)) next = setNodeContentHidden(next, pasted.nodeIds[index], true);
|
|
5847
|
-
for (const comment of comments) {
|
|
5848
|
-
if (hiddenNodeIds.has(comment.sourceId)) next = setNodeContentHidden(next, comment.nodeId, true);
|
|
5849
|
-
next = setComment(next, comment.nodeId, {
|
|
5850
|
-
content: comment.content,
|
|
5851
|
-
position: {
|
|
5852
|
-
x: comment.position.x + offset.x * step,
|
|
5853
|
-
y: comment.position.y + offset.y * step
|
|
5854
|
-
},
|
|
5855
|
-
title: this.#i18n.t("addNode.commentCopy", { title: comment.title })
|
|
5856
|
-
});
|
|
5857
|
-
}
|
|
5858
|
-
return next;
|
|
5859
|
-
}, [...pasted.nodeIds, ...comments.map((comment) => comment.nodeId)]);
|
|
6328
|
+
if (revision == null) return;
|
|
6329
|
+
const pasted = this.#clipboard.paste(revision, this.#designer(), sourcePositions, offset);
|
|
6330
|
+
if (pasted != null) await this.#canvasChange("paste", pasted.nodeIds.length, pasted.changes, pasted.update, pasted.nodeIds);
|
|
5860
6331
|
}
|
|
5861
6332
|
async duplicateSelectedNodes(positions, offset) {
|
|
5862
6333
|
this.copySelectedNodes();
|
|
5863
6334
|
await this.pasteNodes(positions, offset);
|
|
5864
6335
|
}
|
|
5865
|
-
async saveErrorSources(nodeId, value) {
|
|
5866
|
-
const node = this.$.revision.value?.graph()?.nodes[nodeId];
|
|
5867
|
-
if (node?.kind != "error" || dequal$1(node.sourceFlowIds ?? [], value)) return false;
|
|
5868
|
-
return await this.#editDraft([{
|
|
5869
|
-
kind: "graph.trigger.sources.set",
|
|
5870
|
-
nodeId,
|
|
5871
|
-
before: node.sourceFlowIds,
|
|
5872
|
-
value: value.length == 0 ? void 0 : value
|
|
5873
|
-
}]) != null;
|
|
5874
|
-
}
|
|
5875
|
-
async saveNodeSettings(nodeId, settings) {
|
|
5876
|
-
const revision = this.$.revision.value;
|
|
5877
|
-
if (revision == null) return false;
|
|
5878
|
-
const changes = updateNodeSettings(revision, nodeId, settings);
|
|
5879
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
5880
|
-
}
|
|
5881
|
-
async saveNodeDescription(nodeId, description) {
|
|
5882
|
-
const revision = this.$.revision.value;
|
|
5883
|
-
if (revision == null) return false;
|
|
5884
|
-
const changes = updateNodeDescription(revision, nodeId, description);
|
|
5885
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
5886
|
-
}
|
|
5887
|
-
async saveNodeIcon(nodeId, icon) {
|
|
5888
|
-
const revision = this.$.revision.value;
|
|
5889
|
-
if (revision == null) return false;
|
|
5890
|
-
const changes = updateNodeIcon(revision, nodeId, icon);
|
|
5891
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
5892
|
-
}
|
|
5893
|
-
async saveNodeTitle(nodeId, title) {
|
|
5894
|
-
const revision = this.$.revision.value;
|
|
5895
|
-
if (revision == null) return false;
|
|
5896
|
-
const changes = updateNodeName(revision, nodeId, title);
|
|
5897
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
5898
|
-
}
|
|
5899
|
-
async setInputValue(nodeId, handle, value, deletion) {
|
|
5900
|
-
const revision = this.$.revision.value;
|
|
5901
|
-
if (revision == null) return false;
|
|
5902
|
-
const changes = setInputValue(revision, nodeId, handle, value);
|
|
5903
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5904
|
-
}
|
|
5905
|
-
async resetInputs(nodeId, handles) {
|
|
5906
|
-
const revision = this.$.revision.value;
|
|
5907
|
-
if (revision == null) return false;
|
|
5908
|
-
return await this.#editDraft(resetInputValues(revision.revision.content, nodeId, handles)) != null;
|
|
5909
|
-
}
|
|
5910
|
-
async saveOutputsDefs(nodeId, definitions, deletion, values) {
|
|
5911
|
-
const revision = this.$.revision.value;
|
|
5912
|
-
if (revision == null || revision.graph().nodes[nodeId]?.kind != "outputs") return false;
|
|
5913
|
-
return await this.#editDraft(updateOutputPorts(revision, nodeId, definitions, values), deletion) != null;
|
|
5914
|
-
}
|
|
5915
|
-
async saveStartInputDefs(nodeId, inputDefs, deletion) {
|
|
5916
|
-
const revision = this.$.revision.value;
|
|
5917
|
-
if (revision == null || revision.graph().nodes[nodeId]?.kind != "start") return false;
|
|
5918
|
-
const changes = updateStartInputDefs(revision.revision.content, nodeId, inputDefs);
|
|
5919
|
-
return await this.#editDraft(changes, deletion) != null;
|
|
5920
|
-
}
|
|
5921
|
-
async resetTriggerConfig(triggerId, names) {
|
|
5922
|
-
const revision = this.$.revision.value;
|
|
5923
|
-
if (revision == null) return false;
|
|
5924
|
-
const trigger = revision.graph()?.nodes[triggerId];
|
|
5925
|
-
if (trigger?.kind !== "poll" && trigger?.kind !== "integration") return false;
|
|
5926
|
-
const changes = (names == null ? Object.entries(trigger.config) : names.flatMap((name) => Object.hasOwn(trigger.config, name) ? [[name, trigger.config[name]]] : [])).map(([name, before]) => ({
|
|
5927
|
-
kind: "graph.trigger.config.set",
|
|
5928
|
-
nodeId: triggerId,
|
|
5929
|
-
name,
|
|
5930
|
-
before,
|
|
5931
|
-
value: void 0
|
|
5932
|
-
}));
|
|
5933
|
-
return await this.#editDraft(changes) != null;
|
|
5934
|
-
}
|
|
5935
|
-
async setInputSource(nodeId, handle, source) {
|
|
5936
|
-
const revision = this.$.revision.value;
|
|
5937
|
-
if (revision == null) return false;
|
|
5938
|
-
return await this.#editDraft(setInputSources(revision.revision.content, nodeId, handle, [{
|
|
5939
|
-
kind: "node",
|
|
5940
|
-
...source
|
|
5941
|
-
}])) != null;
|
|
5942
|
-
}
|
|
5943
|
-
async setInputVariable(nodeId, handle, name) {
|
|
5944
|
-
const revision = this.$.revision.value;
|
|
5945
|
-
if (revision == null) return false;
|
|
5946
|
-
const changes = name == null ? setInputValue(revision, nodeId, handle, void 0) : setInputVariable(revision, nodeId, handle, name, this.#identity());
|
|
5947
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
5948
|
-
}
|
|
5949
|
-
async saveCondition(nodeId, settings, deletion) {
|
|
5950
|
-
const revision = this.$.revision.value;
|
|
5951
|
-
if (revision == null) return false;
|
|
5952
|
-
const changes = updateCondition(revision, nodeId, settings);
|
|
5953
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5954
|
-
}
|
|
5955
|
-
async saveValue(nodeId, values, deletion) {
|
|
5956
|
-
const revision = this.$.revision.value;
|
|
5957
|
-
if (revision == null) return false;
|
|
5958
|
-
const changes = updateValue(revision, nodeId, values);
|
|
5959
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5960
|
-
}
|
|
5961
|
-
async saveResolution(nodeId, settings, deletion, values) {
|
|
5962
|
-
const revision = this.$.revision.value;
|
|
5963
|
-
if (revision == null) return false;
|
|
5964
|
-
const changes = updateResolution(revision, nodeId, settings, values);
|
|
5965
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5966
|
-
}
|
|
5967
6336
|
async saveNodeContentHidden(nodeId, hidden) {
|
|
5968
6337
|
const node = this.#designer().nodes.find((candidate) => candidate.id == nodeId);
|
|
5969
6338
|
if (node == null || node.kind == "condition") return;
|
|
@@ -6000,36 +6369,6 @@ var WorkspaceStore = class {
|
|
|
6000
6369
|
loadOpenApiDocument(url, signal) {
|
|
6001
6370
|
return this.#client.loadOpenApiDocument(url, signal);
|
|
6002
6371
|
}
|
|
6003
|
-
async saveTaskSettings(nodeId, settings, deletion) {
|
|
6004
|
-
const revision = this.$.revision.value;
|
|
6005
|
-
if (revision == null) return false;
|
|
6006
|
-
const changes = updateTask(revision, nodeId, settings);
|
|
6007
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6008
|
-
}
|
|
6009
|
-
async saveTaskPorts(nodeId, ports, deletion, values) {
|
|
6010
|
-
const revision = this.$.revision.value;
|
|
6011
|
-
if (revision == null) return false;
|
|
6012
|
-
const changes = updateTaskPorts(revision, nodeId, ports, values);
|
|
6013
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6014
|
-
}
|
|
6015
|
-
async saveTaskAdditionalInputs(nodeId, inputs, deletion, values) {
|
|
6016
|
-
const revision = this.$.revision.value;
|
|
6017
|
-
if (revision == null) return false;
|
|
6018
|
-
const changes = updateTaskAdditionalInputs(revision, nodeId, inputs, values);
|
|
6019
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6020
|
-
}
|
|
6021
|
-
async setConnectorConnection(nodeId, connectionId) {
|
|
6022
|
-
const revision = this.$.revision.value;
|
|
6023
|
-
if (revision == null) return false;
|
|
6024
|
-
const changes = setConnectorConnection(revision.revision.content, nodeId, connectionId);
|
|
6025
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
6026
|
-
}
|
|
6027
|
-
async setCodeActions(nodeId, capabilities) {
|
|
6028
|
-
const revision = this.$.revision.value;
|
|
6029
|
-
if (revision == null) return false;
|
|
6030
|
-
const changes = setCodeActions(revision.revision.content, nodeId, capabilities);
|
|
6031
|
-
return changes == null || await this.#editDraft(changes) != null;
|
|
6032
|
-
}
|
|
6033
6372
|
get eventSourceClient() {
|
|
6034
6373
|
return this.#client;
|
|
6035
6374
|
}
|
|
@@ -6038,22 +6377,6 @@ var WorkspaceStore = class {
|
|
|
6038
6377
|
if (flowId == null) throw new Error("No Flow selected");
|
|
6039
6378
|
return await this.#client.listEventSources(flowId, signal);
|
|
6040
6379
|
}
|
|
6041
|
-
async setTriggerEventSource(triggerId, source) {
|
|
6042
|
-
const revision = this.$.revision.value;
|
|
6043
|
-
if (revision == null) return false;
|
|
6044
|
-
const trigger = revision.graph()?.nodes[triggerId];
|
|
6045
|
-
if (trigger?.kind != "integration" || trigger.definition.key != "feishu_app_bot.on_event" || source.provider != trigger.definition.provider) return false;
|
|
6046
|
-
const connectionChanges = setTriggerConnection(revision.revision.content, triggerId, source.connectionId);
|
|
6047
|
-
if (connectionChanges == null) return false;
|
|
6048
|
-
const changed = inputValue(trigger.config.sourceId, void 0) != source.sourceId;
|
|
6049
|
-
return await this.#editDraft([
|
|
6050
|
-
...connectionChanges,
|
|
6051
|
-
...updateTriggerConfig(revision.revision.content, triggerId, "sourceId", source.sourceId) ?? [],
|
|
6052
|
-
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "eventTypes", void 0) ?? [] : [],
|
|
6053
|
-
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "resource", void 0) ?? [] : [],
|
|
6054
|
-
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "chatIds", void 0) ?? [] : []
|
|
6055
|
-
]) != null;
|
|
6056
|
-
}
|
|
6057
6380
|
async loadTriggerConfigOptions(triggerId, field, signal) {
|
|
6058
6381
|
const flowId = this.#model.value.flowId;
|
|
6059
6382
|
const current = this.#draftSession.capture();
|
|
@@ -6062,42 +6385,6 @@ var WorkspaceStore = class {
|
|
|
6062
6385
|
if (this.#disposed || !current() || flowId == null) throw new DOMException("Draft changed", "AbortError");
|
|
6063
6386
|
return await this.#client.listTriggerConfigOptions(flowId, triggerId, field, signal);
|
|
6064
6387
|
}
|
|
6065
|
-
async saveTriggerConfig(triggerId, name, value) {
|
|
6066
|
-
const revision = this.$.revision.value;
|
|
6067
|
-
if (revision == null) return false;
|
|
6068
|
-
let changes = updateTriggerConfig(revision.revision.content, triggerId, name, value);
|
|
6069
|
-
if (changes == null) return false;
|
|
6070
|
-
const trigger = revision.graph()?.nodes[triggerId];
|
|
6071
|
-
if (changes.length > 0 && trigger?.kind == "integration" && trigger.definition.key == "feishu_app_bot.on_event" && name == "eventTypes") {
|
|
6072
|
-
const events = Array.isArray(value) ? value.filter((item) => typeof item == "string") : [];
|
|
6073
|
-
if (!supportsFeishuChatFilter(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content, triggerId, "chatIds", void 0) ?? []];
|
|
6074
|
-
const resource = inputValue(trigger.config.resource, void 0);
|
|
6075
|
-
if (isJsonObject(resource) && resource.kind != feishuResourceKind(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content, triggerId, "resource", void 0) ?? []];
|
|
6076
|
-
}
|
|
6077
|
-
if (changes.length > 0 && trigger?.kind == "poll" && trigger.definition.key == "linear.on_issue_changed" && name == "teamId") return await this.#editDraft([...changes, ...updateTriggerConfig(revision.revision.content, triggerId, "stateIds", void 0) ?? []]) != null;
|
|
6078
|
-
return await this.#editDraft(changes) != null;
|
|
6079
|
-
}
|
|
6080
|
-
async saveTriggerSchedule(triggerId, schedule) {
|
|
6081
|
-
const revision = this.$.revision.value;
|
|
6082
|
-
if (revision == null) return false;
|
|
6083
|
-
const changes = updateTriggerSchedule(revision.revision.content, triggerId, schedule);
|
|
6084
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
6085
|
-
}
|
|
6086
|
-
async saveWebhook(triggerId, settings, deletion) {
|
|
6087
|
-
const revision = this.$.revision.value;
|
|
6088
|
-
if (revision == null) return false;
|
|
6089
|
-
const changes = updateWebhook(revision, triggerId, settings);
|
|
6090
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6091
|
-
}
|
|
6092
|
-
async setTriggerConnection(triggerId, connectionId) {
|
|
6093
|
-
const revision = this.$.revision.value;
|
|
6094
|
-
if (revision == null) return false;
|
|
6095
|
-
const changes = setTriggerConnection(revision.revision.content, triggerId, connectionId);
|
|
6096
|
-
if (changes == null) return false;
|
|
6097
|
-
const trigger = revision.graph()?.nodes[triggerId];
|
|
6098
|
-
if (changes.length > 0 && trigger?.kind == "poll" && trigger.definition.key == "linear.on_issue_changed") return await this.#editDraft([...changes, ...["teamId", "stateIds"].flatMap((field) => updateTriggerConfig(revision.revision.content, triggerId, field, void 0) ?? [])]) != null;
|
|
6099
|
-
return await this.#editDraft(changes) != null;
|
|
6100
|
-
}
|
|
6101
6388
|
updateModuleSource(source) {
|
|
6102
6389
|
const editor = this.#model.value.moduleEditor;
|
|
6103
6390
|
if (this.#history.applying || this.#history.failed || editor == null || editor.source == source) return;
|
|
@@ -6168,9 +6455,6 @@ var WorkspaceStore = class {
|
|
|
6168
6455
|
}), [nodeId]) || this.#disposed) return;
|
|
6169
6456
|
return nodeId;
|
|
6170
6457
|
}
|
|
6171
|
-
async #editDraft(changes, deletion) {
|
|
6172
|
-
return await this.#canvasChange("edit", 1, changes, void 0, void 0, deletion) ? this.#model.value.draft : void 0;
|
|
6173
|
-
}
|
|
6174
6458
|
#notifyDeletion(deletion, entry) {
|
|
6175
6459
|
this.#setNotice({
|
|
6176
6460
|
kind: "success",
|
|
@@ -6189,7 +6473,7 @@ var WorkspaceStore = class {
|
|
|
6189
6473
|
const flowId = this.#model.value.flowId;
|
|
6190
6474
|
const draft = this.#model.value.draft;
|
|
6191
6475
|
if (flowId == null || draft == null) return;
|
|
6192
|
-
if (changes.length == 0 || dequal$1(applyFlowChanges(draft, changes).content, draft.content)) return draft;
|
|
6476
|
+
if (changes.length == 0 || dequal$1(applyFlowChanges$1(draft, changes).content, draft.content)) return draft;
|
|
6193
6477
|
const cleared = historyMode == "clear" && this.#history.clear();
|
|
6194
6478
|
const current = this.#draftSession.capture();
|
|
6195
6479
|
this.#history.pending++;
|
|
@@ -6283,7 +6567,7 @@ var WorkspaceStore = class {
|
|
|
6283
6567
|
if (draft == null || presentation == null) return false;
|
|
6284
6568
|
const next = update?.(presentation.value) ?? presentation.value;
|
|
6285
6569
|
const presentationChange = canvasPresentationChange(presentation.value, next);
|
|
6286
|
-
if (dequal$1(applyFlowChanges(draft, changes).content, draft.content) && presentationChange.nodeIds.length == 0) return true;
|
|
6570
|
+
if (dequal$1(applyFlowChanges$1(draft, changes).content, draft.content) && presentationChange.nodeIds.length == 0) return true;
|
|
6287
6571
|
const generation = this.#history.generation;
|
|
6288
6572
|
const inverse = inverseFlowChanges(draft.content, changes);
|
|
6289
6573
|
this.#history.pending++;
|
|
@@ -6700,6 +6984,23 @@ var WorkbenchStore = class {
|
|
|
6700
6984
|
dismissNotice() {
|
|
6701
6985
|
if (!this.#disposed) this.#notice.set(void 0);
|
|
6702
6986
|
}
|
|
6987
|
+
async exportSvg(language, options) {
|
|
6988
|
+
const model = this.$.designer.value;
|
|
6989
|
+
const title = this.workspace.$.flow.value?.name ?? this.workspace.$.flowId.value ?? "Workflow";
|
|
6990
|
+
try {
|
|
6991
|
+
const { downloadFlowSvg } = await import("./exportSvg-D4CqCcx2.js");
|
|
6992
|
+
await downloadFlowSvg(model, title, language, options);
|
|
6993
|
+
if (!this.#disposed) this.#notice.set({
|
|
6994
|
+
kind: "success",
|
|
6995
|
+
message: this.#i18n.t("resource.exportSvgComplete")
|
|
6996
|
+
});
|
|
6997
|
+
} catch {
|
|
6998
|
+
if (!this.#disposed) this.#notice.set({
|
|
6999
|
+
kind: "error",
|
|
7000
|
+
message: this.#i18n.t("resource.exportSvgFailed")
|
|
7001
|
+
});
|
|
7002
|
+
}
|
|
7003
|
+
}
|
|
6703
7004
|
invalidateVariableNames() {
|
|
6704
7005
|
this.#variableNamesStale = true;
|
|
6705
7006
|
}
|
|
@@ -6832,7 +7133,7 @@ var WorkbenchStore = class {
|
|
|
6832
7133
|
const executor = "executor" in node.node.task ? node.node.task.executor : void 0;
|
|
6833
7134
|
if (executor?.kind != "connector" || executor.action != action.actionId || executor.connectionId != null) return;
|
|
6834
7135
|
const connection = prepared.action.defaultConnection;
|
|
6835
|
-
if (connection != null) await this.workspace.setConnectorConnection(node.id, connection.connectionId);
|
|
7136
|
+
if (connection != null) await this.workspace.nodes.setConnectorConnection(node.id, connection.connectionId);
|
|
6836
7137
|
if (!this.#disposed && flowId == this.workspace.$.flowId.value) await this.connectors.refresh();
|
|
6837
7138
|
} catch (error) {
|
|
6838
7139
|
if (!this.#disposed && flowId == this.workspace.$.flowId.value) this.#notice.set(errorNotice(error, this.#i18n.t));
|
|
@@ -6941,7 +7242,7 @@ var WorkbenchStore = class {
|
|
|
6941
7242
|
};
|
|
6942
7243
|
//#endregion
|
|
6943
7244
|
//#region src/workbench/browser/runtime/openFlowWorkbench.tsx
|
|
6944
|
-
var FlowWorkspace = lazy(() => import("./flowWorkspace-
|
|
7245
|
+
var FlowWorkspace = lazy(() => import("./flowWorkspace-zFBFtZPo.js"));
|
|
6945
7246
|
function OpenFlowSessionGate({ action, description, error, onSubmit, onTokenChange, pending = false, title, token, tokenLabel }) {
|
|
6946
7247
|
const hasToken = token != null && tokenLabel != null && onTokenChange != null;
|
|
6947
7248
|
const tokenValue = token ?? "";
|
|
@@ -7047,7 +7348,7 @@ function FlowNameBridge({ store, onChange }) {
|
|
|
7047
7348
|
useEffect(() => () => onChange(void 0), [onChange]);
|
|
7048
7349
|
return null;
|
|
7049
7350
|
}
|
|
7050
|
-
function Workbench({ importRef, catalogWidth, createFlow, importFlow, createFlowDisabled, createFlowField,
|
|
7351
|
+
function Workbench({ importRef, catalogWidth, createFlow, importFlow, createFlowDisabled, createFlowField, connectionHref, hrefFor, initializing, language, navigation, onConfigureConnector, onManageConnectorAccess, onLanguageChange, store, theme }) {
|
|
7051
7352
|
const flowId = useVal(store.workspace.$.flowId);
|
|
7052
7353
|
return /* @__PURE__ */ jsx("div", {
|
|
7053
7354
|
className: "app-shell",
|
|
@@ -7056,10 +7357,9 @@ function Workbench({ importRef, catalogWidth, createFlow, importFlow, createFlow
|
|
|
7056
7357
|
catalogWidth,
|
|
7057
7358
|
createFlowDisabled,
|
|
7058
7359
|
createFlowField,
|
|
7059
|
-
|
|
7060
|
-
hrefForFlow: (flow) => hrefFor({
|
|
7360
|
+
hrefForFlow: (flow, view = "design") => hrefFor({
|
|
7061
7361
|
flowId: flow.flowId,
|
|
7062
|
-
view
|
|
7362
|
+
view
|
|
7063
7363
|
}),
|
|
7064
7364
|
initializing,
|
|
7065
7365
|
language,
|
|
@@ -7085,7 +7385,7 @@ function Workbench({ importRef, catalogWidth, createFlow, importFlow, createFlow
|
|
|
7085
7385
|
})
|
|
7086
7386
|
});
|
|
7087
7387
|
}
|
|
7088
|
-
var Session = forwardRef(function Session({ catalogWidth, createFlow, importFlow, createFlowDisabled, createFlowField,
|
|
7388
|
+
var Session = forwardRef(function Session({ catalogWidth, createFlow, importFlow, createFlowDisabled, createFlowField, connectionHref, host, hrefFor, language, location, onConfigureConnector, onManageConnectorAccess, onLanguageChange, onNavigate, onFlowNameChange, preferences, sessionKey, theme, variables = true }, ref) {
|
|
7089
7389
|
const importRef = useRef(null);
|
|
7090
7390
|
useImperativeHandle(ref, () => ({ openImport: (input) => importRef.current?.openImport(input) ?? "unavailable" }), []);
|
|
7091
7391
|
const navigate = useRef(onNavigate);
|
|
@@ -7157,7 +7457,6 @@ var Session = forwardRef(function Session({ catalogWidth, createFlow, importFlow
|
|
|
7157
7457
|
importFlow,
|
|
7158
7458
|
createFlowDisabled,
|
|
7159
7459
|
createFlowField,
|
|
7160
|
-
flowBadges,
|
|
7161
7460
|
connectionHref,
|
|
7162
7461
|
hrefFor,
|
|
7163
7462
|
initializing: !started,
|