@oomol-lab/open-flow 0.1.0-beta.55 → 0.1.0-beta.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/browser/{createResourceDialog-4H5_lZ6s.js → createResourceDialog-Btjes3wD.js} +2 -2
- package/dist/browser/flow-authoring-edge.d.ts +3 -3
- package/dist/browser/flow-authoring-node.d.ts +26 -46
- package/dist/browser/flow-authoring.js +9155 -21002
- package/dist/browser/flow-change-schema.d.ts +1 -1
- package/dist/browser/flow-change.d.ts +14 -104
- package/dist/browser/flow-change.js +121 -296
- package/dist/browser/{flowChanges-ZzG-f9cg.js → flowChanges-BxutPLYO.js} +1494 -1830
- package/dist/browser/{flowWorkspace-ChpRaTMX.js → flowWorkspace-Dg4mqfa6.js} +118 -293
- package/dist/browser/{icons-CdAB9wyS.js → icons-p2A9zs8t.js} +126 -317
- package/dist/browser/lib-DrKav3HG.js +11403 -0
- package/dist/browser/preview.css +1 -1
- package/dist/browser/preview.js +9308 -9565
- package/dist/browser/ui-idTooltip.d.ts +11 -0
- package/dist/browser/ui.d.ts +5 -0
- package/dist/browser/ui.js +83 -1
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.js +210 -411
- package/dist/browser/{workbenchSelect-BRZN4ish.js → workbenchSelect-LRp_Xjeq.js} +1 -1
- package/dist/common/control-api-conformance.js +212 -245
- package/dist/common/control-api.d.ts +6 -6
- package/dist/common/control-api.js +216 -250
- package/dist/common/control-requests.js +468 -1476
- package/dist/common/decision.js +6325 -6369
- package/dist/common/flow-agent.d.ts +1 -1
- package/dist/common/flow-connectionUsage.d.ts +1 -2
- package/dist/common/flow-encoding.d.ts +2 -4
- package/dist/common/flow-encoding.js +119 -180
- package/dist/common/flow-graph.d.ts +10 -10
- package/dist/common/flow-semantics.d.ts +4 -9
- package/dist/common/flow-semantics.js +9024 -9230
- package/dist/common/flowInspection.d.ts +3 -21
- package/dist/common/integration-trigger.js +8642 -8686
- package/dist/common/mcp.d.ts +0 -1
- package/dist/common/mcp.js +117 -140
- package/dist/common/openapi.js +6325 -6369
- package/dist/common/poll-trigger.js +8642 -8686
- package/dist/common/run-events.js +0 -1
- package/dist/common/scheduler.d.ts +3 -9
- package/dist/common/scheduler.js +116 -207
- package/dist/common/webhook-trigger.js +6325 -6369
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { An as
|
|
1
|
+
import { $ as RunStore, $t as InputGroupInput, An as sampleErrorOutputs, At as setCodeActions, B as CacheResource, Bn as jsonValue, Bt as PopoverContent, Cn as WorkbenchClient, Ct as restoreCanvasPresentation, Dn as decodeTriggerCatalog, Dt as setNodePositions, Et as setNodeContentHidden, F as feishuResourceKind, Fn as connection, Ft as updateTriggerSchedule, Gt as PopoverTrigger, H as resourceData, Hn as string, I as supportsFeishuChatFilter, In as connectorActionMetadata, It as IdTooltip, J as providerIcon, Kn as IconThemeContext, L as combineSources, Ln as inputValue, Lt as followWorkbenchLink, M as addNodeIntent, Mn as isJsonObject, Mt as setInputSources, N as deriveAddNodeOptions, Nt as setTriggerConnection, Ot as repairNodeNames, Pt as updateTriggerConfig, Qt as InputGroupAddon, Rn as providerIconAppearance, Rt as Switch, Sn as errorNotice, St as removeComments, Tn as allConnectorConnectionsQuery, Tt as setFlowViewport, U as resourceValue, Un as ApiError, Vn as record, W as designerGraph, Wn as controlErrorCode, Wt as PopoverTitle, Zt as InputGroup, _ as updateValue, _t as actionWithConnections, a as nameCreatedNodes, an as EmptyTitle, bt as commentIds, c as updateCondition, d as updateNodeName, dt as Latest, en as Empty, f as updateNodeSettings, ft as deriveInspectorDiagnostics, g as updateTaskPorts, h as updateTaskAdditionalInputs, i as deleteSelection, in as EmptyMedia, jn as triggerOutputDefinitions, jt as setConnectorConnection, kt as resetInputValues, l as updateNodeDescription, ln as createI18n, m as updateTask, nn as EmptyDescription, nt as revisionView, o as setInputValue, on as EventSourcesPage, p as updateResolution, pt as diagnosticItems, r as applyFlowChanges, rn as EmptyHeader, s as setInputVariable, t as addNode, tn as EmptyContent, u as updateNodeIcon, v as updateWebhook, vt as connectionCatalog, wn as randomId, wt as setComment, xt as flowPresentation, yt as canvasPresentationChange, z as scopedValue, zn as invalidResponse, zt as Popover } from "./flowChanges-BxutPLYO.js";
|
|
2
2
|
import { a as derive, i as compute, l as val } from "./dist-bO8nvHFH.js";
|
|
3
3
|
import { a as toPlainObject, c as useLang, l as useTranslate, o as I18nProvider, u as useVal } from "./dist-BFmpkX4P.js";
|
|
4
|
-
import { D as FlowChangeError, E as FieldLabel, L as mapConditionSources, O as applyFlowChanges$1, P as resourceNameIssue, R as nodeInputMappings, S as Field, T as FieldGroup, a as DialogDescription, c as DialogTitle, d as TooltipContent, gi as Button, i as DialogContent, ir as Input, it as dequal$1, n as Dialog, o as DialogFooter, p as TooltipTrigger, r as DialogClose, s as DialogHeader, t as Icon, u as Tooltip, vi as cn, w as FieldError, x as Spinner } from "./icons-
|
|
4
|
+
import { D as FlowChangeError, E as FieldLabel, L as mapConditionSources, O as applyFlowChanges$1, P as resourceNameIssue, R as nodeInputMappings, S as Field, T as FieldGroup, a as DialogDescription, c as DialogTitle, d as TooltipContent, gi as Button, i as DialogContent, ir as Input, it as dequal$1, n as Dialog, o as DialogFooter, p as TooltipTrigger, r as DialogClose, s as DialogHeader, t as Icon, u as Tooltip, vi as cn, w as FieldError, x as Spinner } from "./icons-p2A9zs8t.js";
|
|
5
5
|
import { c as isUiLanguage, d as uiLanguages, l as resolveUiLanguage, u as uiLanguageNames } from "./value-DL_poNiC.js";
|
|
6
6
|
import { Suspense, lazy, useEffect, useRef, useState } from "react";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -106,17 +106,6 @@ var NavigationStore = class {
|
|
|
106
106
|
if (change == this.#change) this.#syncing = false;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
async createSubflow(name) {
|
|
110
|
-
const change = ++this.#change;
|
|
111
|
-
this.#syncing = true;
|
|
112
|
-
try {
|
|
113
|
-
const created = await this.#store.workspace.createResource(name);
|
|
114
|
-
if (created && change == this.#change) this.#write("design", false);
|
|
115
|
-
return created;
|
|
116
|
-
} finally {
|
|
117
|
-
if (change == this.#change) this.#syncing = false;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
109
|
async selectFlow(flow) {
|
|
121
110
|
const change = ++this.#change;
|
|
122
111
|
this.#syncing = true;
|
|
@@ -128,7 +117,7 @@ var NavigationStore = class {
|
|
|
128
117
|
}
|
|
129
118
|
}
|
|
130
119
|
openMainFlow() {
|
|
131
|
-
|
|
120
|
+
this.#write("design", false);
|
|
132
121
|
}
|
|
133
122
|
async openFlows() {
|
|
134
123
|
const change = ++this.#change;
|
|
@@ -195,7 +184,7 @@ function Skeleton({ className, ...props }) {
|
|
|
195
184
|
}
|
|
196
185
|
//#endregion
|
|
197
186
|
//#region src/workbench/browser/runtime/shell/resourceBrowser.tsx
|
|
198
|
-
var CreateResourceDialog = lazy(() => import("./createResourceDialog-
|
|
187
|
+
var CreateResourceDialog = lazy(() => import("./createResourceDialog-Btjes3wD.js"));
|
|
199
188
|
var flowIdTooltipAlignOffset = 44;
|
|
200
189
|
var renamePopoverAlignOffset = -12;
|
|
201
190
|
var renamePopoverVerticalShift = 8;
|
|
@@ -873,25 +862,20 @@ var customRandom = (alphabet, defaultSize, getRandom) => {
|
|
|
873
862
|
var customAlphabet = (alphabet, size = 21) => customRandom(alphabet, size | 0, random);
|
|
874
863
|
//#endregion
|
|
875
864
|
//#region src/flow/common/edgeChanges.ts
|
|
876
|
-
function connect(content,
|
|
877
|
-
if (graph
|
|
865
|
+
function connect(content, edge) {
|
|
866
|
+
if (content.document.graph?.edges.some((candidate) => dequal$1(candidate, edge))) return [];
|
|
878
867
|
return [{
|
|
879
868
|
edge,
|
|
880
|
-
kind: "graph.edge.connect"
|
|
881
|
-
target
|
|
869
|
+
kind: "graph.edge.connect"
|
|
882
870
|
}];
|
|
883
871
|
}
|
|
884
|
-
function disconnect(content,
|
|
885
|
-
if (!graph
|
|
872
|
+
function disconnect(content, edge) {
|
|
873
|
+
if (!content.document.graph?.edges.some((candidate) => dequal$1(candidate, edge))) return [];
|
|
886
874
|
return [{
|
|
887
875
|
edge,
|
|
888
|
-
kind: "graph.edge.disconnect"
|
|
889
|
-
target
|
|
876
|
+
kind: "graph.edge.disconnect"
|
|
890
877
|
}];
|
|
891
878
|
}
|
|
892
|
-
function graph(content, target) {
|
|
893
|
-
return target.kind == "flow" ? content.document.graph : content.document.subflows[target.id]?.graph;
|
|
894
|
-
}
|
|
895
879
|
//#endregion
|
|
896
880
|
//#region src/flow/common/moduleChanges.ts
|
|
897
881
|
async function imports(source) {
|
|
@@ -925,11 +909,11 @@ function replaceSource(moduleId, beforeSource, beforeImports, source, moduleImpo
|
|
|
925
909
|
var createAuthoringId = customAlphabet("23456789abcdefghjkmnpqrstuvwxyz", 10);
|
|
926
910
|
//#endregion
|
|
927
911
|
//#region src/workbench/browser/runtime/editor/triggerDiagnosticPresentation.ts
|
|
928
|
-
function presentTriggerDiagnostics(items, revision,
|
|
929
|
-
if (revision == null
|
|
912
|
+
function presentTriggerDiagnostics(items, revision, displays, language, t) {
|
|
913
|
+
if (revision == null) return items;
|
|
930
914
|
return items.map((item) => {
|
|
931
915
|
if (item.diagnostic.code != "trigger.config-incomplete" || item.location == null) return item;
|
|
932
|
-
const node = revision.node(
|
|
916
|
+
const node = revision.node(item.location.nodeId)?.node;
|
|
933
917
|
if (node?.kind != "integration" && node?.kind != "poll") return item;
|
|
934
918
|
const labels = displays?.[node.definition.key]?.configInputLabels;
|
|
935
919
|
const names = item.diagnostic.fields?.map((field) => labels?.[field]);
|
|
@@ -1071,7 +1055,7 @@ var PublicationStore = class {
|
|
|
1071
1055
|
}
|
|
1072
1056
|
});
|
|
1073
1057
|
if (!warm && operation?.status == "pending") {
|
|
1074
|
-
const flow = this.#workspace.$.
|
|
1058
|
+
const flow = this.#workspace.$.flow.value;
|
|
1075
1059
|
this.#observe(target, operation, this.#operation.begin(), flow?.flowId == target.flowId ? flow.name : target.flowId);
|
|
1076
1060
|
}
|
|
1077
1061
|
} catch (error) {
|
|
@@ -1117,7 +1101,7 @@ var PublicationStore = class {
|
|
|
1117
1101
|
async publish() {
|
|
1118
1102
|
const flowId = this.#workspace.$.flowId.value;
|
|
1119
1103
|
if (!await this.#workspace.saveModuleEditor() || flowId != this.#workspace.$.flowId.value) return false;
|
|
1120
|
-
const flow = this.#workspace.$.
|
|
1104
|
+
const flow = this.#workspace.$.flow.value;
|
|
1121
1105
|
const draft = this.#workspace.$.draft.value;
|
|
1122
1106
|
if (flow == null || draft == null || this.#state.value.changingTriggerId != null || this.#state.value.publishing || this.#state.value.rollingBackPublicationId != null) return false;
|
|
1123
1107
|
const target = { flowId: flow.flowId };
|
|
@@ -1482,7 +1466,7 @@ var PublicationStore = class {
|
|
|
1482
1466
|
//#region src/workbench/browser/runtime/runs/runRequestStore.ts
|
|
1483
1467
|
var initialState$5 = { starting: false };
|
|
1484
1468
|
function inputSpec(draft, triggerId) {
|
|
1485
|
-
const trigger = revisionView(draft).graph(
|
|
1469
|
+
const trigger = revisionView(draft).graph()?.nodes[triggerId];
|
|
1486
1470
|
if (trigger == null || "inputs" in trigger || trigger.kind == "manual" || trigger.kind == "cron") return void 0;
|
|
1487
1471
|
const definitions = triggerOutputDefinitions(trigger);
|
|
1488
1472
|
return definitions.length === 0 ? void 0 : {
|
|
@@ -1506,7 +1490,7 @@ async function inputEditor(spec, language, values) {
|
|
|
1506
1490
|
return editor;
|
|
1507
1491
|
}
|
|
1508
1492
|
function testOutputs(revision, triggerId) {
|
|
1509
|
-
const node = revisionView(revision).graph(
|
|
1493
|
+
const node = revisionView(revision).graph()?.nodes[triggerId];
|
|
1510
1494
|
if (node?.kind == "error") return sampleErrorOutputs;
|
|
1511
1495
|
return node?.kind === "cron" ? { scheduledAt: (/* @__PURE__ */ new Date()).toISOString() } : {};
|
|
1512
1496
|
}
|
|
@@ -1658,7 +1642,7 @@ var RunRequestStore = class {
|
|
|
1658
1642
|
submitting: void 0
|
|
1659
1643
|
});
|
|
1660
1644
|
this.#disposeInputRequest(previous);
|
|
1661
|
-
const graph = revisionView(revision).graph(
|
|
1645
|
+
const graph = revisionView(revision).graph();
|
|
1662
1646
|
const triggers = Object.entries(graph?.nodes ?? {}).flatMap(([nodeId, node]) => "inputs" in node ? [] : [{
|
|
1663
1647
|
nodeId,
|
|
1664
1648
|
title: node.name
|
|
@@ -3409,36 +3393,31 @@ function providerOption(provider, t) {
|
|
|
3409
3393
|
serviceId: provider.serviceId
|
|
3410
3394
|
};
|
|
3411
3395
|
}
|
|
3412
|
-
function connectorTarget(selection
|
|
3396
|
+
function connectorTarget(selection) {
|
|
3413
3397
|
if (selection == null) return;
|
|
3414
|
-
const
|
|
3415
|
-
if (taskId == null) return;
|
|
3416
|
-
const task = selection.kind == "task" ? selection.definition : revision?.task(taskId);
|
|
3398
|
+
const task = selection.kind == "task" ? selection.definition : void 0;
|
|
3417
3399
|
if (task == null || !("executor" in task) || task.executor.kind != "connector") return;
|
|
3418
3400
|
return {
|
|
3419
3401
|
actionId: task.executor.action,
|
|
3420
3402
|
connectionId: task.executor.connectionId,
|
|
3421
|
-
nodeId: selection.id
|
|
3422
|
-
taskId
|
|
3403
|
+
nodeId: selection.id
|
|
3423
3404
|
};
|
|
3424
3405
|
}
|
|
3425
3406
|
function connectionDiagnostics(revision, actions, catalogs) {
|
|
3426
3407
|
if (revision == null) return [];
|
|
3427
3408
|
const diagnostics = [];
|
|
3428
|
-
for (const
|
|
3429
|
-
const
|
|
3430
|
-
if (task?.executor.kind != "connector") continue;
|
|
3431
|
-
const action = actions[task.executor.action];
|
|
3409
|
+
for (const { nodeId, actionId, connectionId } of revision.connectorNodes()) {
|
|
3410
|
+
const action = actions[actionId];
|
|
3432
3411
|
if (action?.authenticated != true) continue;
|
|
3433
|
-
const connection =
|
|
3434
|
-
if (
|
|
3412
|
+
const connection = connectionId == null ? void 0 : catalogs[action.serviceId]?.byId.get(connectionId);
|
|
3413
|
+
if (connectionId != null && (catalogs[action.serviceId] == null || connection?.status == "active")) continue;
|
|
3435
3414
|
diagnostics.push({
|
|
3436
3415
|
code: "task.connector-connection-required",
|
|
3437
3416
|
column: 0,
|
|
3438
3417
|
line: 1,
|
|
3439
|
-
message: `Connector Task "${
|
|
3440
|
-
path: `/document/
|
|
3441
|
-
values: {
|
|
3418
|
+
message: `Connector Task "${nodeId}" requires an active Connection.`,
|
|
3419
|
+
path: `/document/graph/nodes/${nodeId}/task/executor/connectionId`,
|
|
3420
|
+
values: { nodeId }
|
|
3442
3421
|
});
|
|
3443
3422
|
}
|
|
3444
3423
|
return diagnostics;
|
|
@@ -3550,7 +3529,7 @@ var ConnectorStore = class {
|
|
|
3550
3529
|
}));
|
|
3551
3530
|
});
|
|
3552
3531
|
this.#selected = compute((get) => {
|
|
3553
|
-
const target = connectorTarget(get(workspace.$.selection)
|
|
3532
|
+
const target = connectorTarget(get(workspace.$.selection));
|
|
3554
3533
|
const state = get(this.#state);
|
|
3555
3534
|
if (target == null) return { authorizationPending: false };
|
|
3556
3535
|
const action = get(actions)[target.actionId];
|
|
@@ -3648,7 +3627,7 @@ var ConnectorStore = class {
|
|
|
3648
3627
|
if (this.#disposed) return;
|
|
3649
3628
|
const current = this.#refresh.begin();
|
|
3650
3629
|
const flowId = this.#workspace.$.flowId.value;
|
|
3651
|
-
const target = connectorTarget(this.#workspace.$.selection.value
|
|
3630
|
+
const target = connectorTarget(this.#workspace.$.selection.value);
|
|
3652
3631
|
if (flowId == null || target == null) {
|
|
3653
3632
|
if (this.#state.value.actionLoading != null || this.#state.value.connectionLoading != null) this.#set({
|
|
3654
3633
|
actionLoading: void 0,
|
|
@@ -3718,8 +3697,8 @@ var ConnectorStore = class {
|
|
|
3718
3697
|
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
3719
3698
|
}
|
|
3720
3699
|
}
|
|
3721
|
-
async setConnection(
|
|
3722
|
-
return await this.#workspace.setConnectorConnection(
|
|
3700
|
+
async setConnection(nodeId, connectionId) {
|
|
3701
|
+
return await this.#workspace.setConnectorConnection(nodeId, connectionId);
|
|
3723
3702
|
}
|
|
3724
3703
|
async refreshAfterAuthorization() {
|
|
3725
3704
|
if (this.#disposed || this.#authorization == null) return;
|
|
@@ -3761,8 +3740,9 @@ var ConnectorStore = class {
|
|
|
3761
3740
|
const authorization = this.#authorization?.serviceId == serviceId ? this.#authorization : void 0;
|
|
3762
3741
|
const created = authorization == null ? [] : catalog.active.filter((connection) => !authorization.connectionIds.has(connection.connectionId));
|
|
3763
3742
|
const connection = created.length == 1 ? created[0] : catalog.preferred;
|
|
3764
|
-
const
|
|
3765
|
-
|
|
3743
|
+
const selected = this.#workspace.$.revision.value?.node(target.nodeId);
|
|
3744
|
+
const task = selected?.kind == "task" ? selected.definition : void 0;
|
|
3745
|
+
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);
|
|
3766
3746
|
}
|
|
3767
3747
|
#remember(source, ids) {
|
|
3768
3748
|
if (ids.some((id) => !source.value.includes(id))) source.set([.../* @__PURE__ */ new Set([...source.value, ...ids])]);
|
|
@@ -3783,7 +3763,7 @@ var ConnectorStore = class {
|
|
|
3783
3763
|
const flowId = this.#workspace.$.flowId.value;
|
|
3784
3764
|
const revision = this.#workspace.$.revision.value;
|
|
3785
3765
|
if (flowId == null || revision == null) return;
|
|
3786
|
-
if (Object.values(revision.graph(
|
|
3766
|
+
if (Object.values(revision.graph()?.nodes ?? {}).some((node) => node.kind == "integration" || node.kind == "poll")) this.data.providers.get(flowId, this.#language);
|
|
3787
3767
|
const missing = [...revision.connectorActionIds].filter((actionId) => this.$.actions.value[actionId] == null && !this.#loadingActions.has(actionId));
|
|
3788
3768
|
if (missing.length > 0) {
|
|
3789
3769
|
for (const actionId of missing) this.#loadingActions.add(actionId);
|
|
@@ -3799,10 +3779,8 @@ var ConnectorStore = class {
|
|
|
3799
3779
|
}
|
|
3800
3780
|
if (!this.#isCurrent(current, flowId)) return;
|
|
3801
3781
|
const services = /* @__PURE__ */ new Set();
|
|
3802
|
-
for (const
|
|
3803
|
-
const
|
|
3804
|
-
if (task?.executor.kind != "connector") continue;
|
|
3805
|
-
const action = this.$.actions.value[task.executor.action];
|
|
3782
|
+
for (const { actionId } of revision.connectorNodes()) {
|
|
3783
|
+
const action = this.$.actions.value[actionId];
|
|
3806
3784
|
if (action?.authenticated == true) services.add(action.serviceId);
|
|
3807
3785
|
}
|
|
3808
3786
|
await Promise.all([...services].map((serviceId) => this.#loadCatalog(flowId, serviceId, false, current)));
|
|
@@ -3974,7 +3952,7 @@ var TriggerStore = class {
|
|
|
3974
3952
|
return scopedValue(signal, (get) => {
|
|
3975
3953
|
const state = get(source);
|
|
3976
3954
|
get(this.#i18n.t$);
|
|
3977
|
-
const enabled = get(this.#workspace.$.flowId) != null && get(this.#workspace.$.
|
|
3955
|
+
const enabled = get(this.#workspace.$.flowId) != null && get(this.#workspace.$.draft) != null;
|
|
3978
3956
|
const catalog = state.data;
|
|
3979
3957
|
const definitions = catalog?.definitions.filter((item) => !query || [
|
|
3980
3958
|
catalog.display[item.key]?.displayName,
|
|
@@ -4070,18 +4048,16 @@ function inverseFlowChanges(content, operations) {
|
|
|
4070
4048
|
case "graph.node.create":
|
|
4071
4049
|
restore.push({
|
|
4072
4050
|
kind: "graph.node.delete",
|
|
4073
|
-
nodeId: operation.nodeId
|
|
4074
|
-
target: operation.target
|
|
4051
|
+
nodeId: operation.nodeId
|
|
4075
4052
|
});
|
|
4076
4053
|
break;
|
|
4077
4054
|
case "graph.node.delete": {
|
|
4078
|
-
const {
|
|
4079
|
-
const graph =
|
|
4080
|
-
const nextGraph =
|
|
4055
|
+
const { nodeId } = operation;
|
|
4056
|
+
const graph = current.document.graph;
|
|
4057
|
+
const nextGraph = after.document.graph;
|
|
4081
4058
|
restore.push({
|
|
4082
4059
|
kind: "graph.node.create",
|
|
4083
4060
|
nodeId,
|
|
4084
|
-
target,
|
|
4085
4061
|
node: graph.nodes[nodeId]
|
|
4086
4062
|
});
|
|
4087
4063
|
for (const [id, node] of Object.entries(nextGraph.nodes)) {
|
|
@@ -4089,7 +4065,6 @@ function inverseFlowChanges(content, operations) {
|
|
|
4089
4065
|
if (!("inputs" in node) || !("inputs" in previous)) continue;
|
|
4090
4066
|
for (const handle of /* @__PURE__ */ new Set([...Object.keys(previous.inputs), ...Object.keys(node.inputs)])) if (!dequal$1(node.inputs[handle], previous.inputs[handle])) restore.push({
|
|
4091
4067
|
kind: "graph.node.input.set",
|
|
4092
|
-
target,
|
|
4093
4068
|
nodeId: id,
|
|
4094
4069
|
handle,
|
|
4095
4070
|
before: node.inputs[handle],
|
|
@@ -4098,24 +4073,12 @@ function inverseFlowChanges(content, operations) {
|
|
|
4098
4073
|
}
|
|
4099
4074
|
for (const edge of nextGraph.edges) restore.push({
|
|
4100
4075
|
kind: "graph.edge.disconnect",
|
|
4101
|
-
target,
|
|
4102
4076
|
edge
|
|
4103
4077
|
});
|
|
4104
4078
|
for (const edge of graph.edges) restore.push({
|
|
4105
4079
|
kind: "graph.edge.connect",
|
|
4106
|
-
target,
|
|
4107
4080
|
edge
|
|
4108
4081
|
});
|
|
4109
|
-
if (target.kind == "subflow") {
|
|
4110
|
-
const { graph: _beforeGraph, ...definition } = current.document.subflows[target.id];
|
|
4111
|
-
const { graph: _afterGraph, ...before } = after.document.subflows[target.id];
|
|
4112
|
-
if (!dequal$1(before, definition)) restore.push({
|
|
4113
|
-
kind: "subflow.definition.set",
|
|
4114
|
-
subflowId: target.id,
|
|
4115
|
-
before,
|
|
4116
|
-
definition
|
|
4117
|
-
});
|
|
4118
|
-
}
|
|
4119
4082
|
break;
|
|
4120
4083
|
}
|
|
4121
4084
|
case "graph.edge.connect":
|
|
@@ -4125,17 +4088,14 @@ function inverseFlowChanges(content, operations) {
|
|
|
4125
4088
|
});
|
|
4126
4089
|
break;
|
|
4127
4090
|
case "graph.edge.disconnect": {
|
|
4128
|
-
const
|
|
4129
|
-
const
|
|
4130
|
-
const next = target.kind == "flow" ? after.document.graph : after.document.subflows[target.id].graph;
|
|
4091
|
+
const graph = current.document.graph;
|
|
4092
|
+
const next = after.document.graph;
|
|
4131
4093
|
restore.push(...next.edges.map((edge) => ({
|
|
4132
4094
|
kind: "graph.edge.disconnect",
|
|
4133
|
-
target,
|
|
4134
4095
|
edge
|
|
4135
4096
|
})));
|
|
4136
4097
|
restore.push(...graph.edges.map((edge) => ({
|
|
4137
4098
|
kind: "graph.edge.connect",
|
|
4138
|
-
target,
|
|
4139
4099
|
edge
|
|
4140
4100
|
})));
|
|
4141
4101
|
break;
|
|
@@ -4166,27 +4126,13 @@ function inverseFlowChanges(content, operations) {
|
|
|
4166
4126
|
binding: current.document.bindings[operation.bindingId]
|
|
4167
4127
|
});
|
|
4168
4128
|
break;
|
|
4169
|
-
case "task.create":
|
|
4170
|
-
restore.push({
|
|
4171
|
-
kind: "task.delete",
|
|
4172
|
-
taskId: operation.taskId
|
|
4173
|
-
});
|
|
4174
|
-
break;
|
|
4175
|
-
case "task.delete":
|
|
4176
|
-
restore.push({
|
|
4177
|
-
kind: "task.create",
|
|
4178
|
-
taskId: operation.taskId,
|
|
4179
|
-
task: current.document.tasks[operation.taskId]
|
|
4180
|
-
});
|
|
4181
|
-
break;
|
|
4182
4129
|
case "graph.node.input.set": {
|
|
4183
|
-
const beforeGraph =
|
|
4184
|
-
const afterGraph =
|
|
4130
|
+
const beforeGraph = current.document.graph;
|
|
4131
|
+
const afterGraph = after.document.graph;
|
|
4185
4132
|
const beforeNode = beforeGraph.nodes[operation.nodeId];
|
|
4186
4133
|
const afterNode = afterGraph.nodes[operation.nodeId];
|
|
4187
4134
|
if (beforeNode.kind === "condition" && afterNode.kind === "condition") restore.push({
|
|
4188
4135
|
kind: "graph.node.condition.set",
|
|
4189
|
-
target: operation.target,
|
|
4190
4136
|
nodeId: operation.nodeId,
|
|
4191
4137
|
before: {
|
|
4192
4138
|
cases: afterNode.cases,
|
|
@@ -4295,43 +4241,13 @@ function inverseFlowChanges(content, operations) {
|
|
|
4295
4241
|
value: operation.before
|
|
4296
4242
|
});
|
|
4297
4243
|
break;
|
|
4298
|
-
case "
|
|
4244
|
+
case "graph.node.task.set":
|
|
4299
4245
|
restore.push({
|
|
4300
4246
|
...operation,
|
|
4301
4247
|
before: operation.value,
|
|
4302
4248
|
value: operation.before
|
|
4303
4249
|
});
|
|
4304
4250
|
break;
|
|
4305
|
-
case "task.decision.set":
|
|
4306
|
-
case "task.openapi.set":
|
|
4307
|
-
case "task.agent.set":
|
|
4308
|
-
restore.push({
|
|
4309
|
-
...operation,
|
|
4310
|
-
before: operation.value,
|
|
4311
|
-
value: operation.before
|
|
4312
|
-
});
|
|
4313
|
-
break;
|
|
4314
|
-
case "task.llm.mode.set":
|
|
4315
|
-
restore.push({
|
|
4316
|
-
...operation,
|
|
4317
|
-
before: operation.value,
|
|
4318
|
-
value: operation.before
|
|
4319
|
-
});
|
|
4320
|
-
break;
|
|
4321
|
-
case "task.name.set":
|
|
4322
|
-
restore.push({
|
|
4323
|
-
...operation,
|
|
4324
|
-
before: operation.value,
|
|
4325
|
-
value: operation.before
|
|
4326
|
-
});
|
|
4327
|
-
break;
|
|
4328
|
-
case "subflow.definition.set":
|
|
4329
|
-
restore.push({
|
|
4330
|
-
...operation,
|
|
4331
|
-
before: operation.definition,
|
|
4332
|
-
definition: operation.before
|
|
4333
|
-
});
|
|
4334
|
-
break;
|
|
4335
4251
|
default: throw new Error(`Unsupported canvas history operation: ${operation.kind}`);
|
|
4336
4252
|
}
|
|
4337
4253
|
groups.push(restore);
|
|
@@ -4341,11 +4257,11 @@ function inverseFlowChanges(content, operations) {
|
|
|
4341
4257
|
}
|
|
4342
4258
|
//#endregion
|
|
4343
4259
|
//#region src/workbench/browser/runtime/editor/nodeClipboard.ts
|
|
4344
|
-
function copyNodes(revision,
|
|
4345
|
-
const nodes = revision.graph(
|
|
4260
|
+
function copyNodes(revision, nodeIds) {
|
|
4261
|
+
const nodes = revision.graph()?.nodes ?? {};
|
|
4346
4262
|
const copied = Object.fromEntries(nodeIds.flatMap((nodeId) => nodes[nodeId] == null ? [] : [[nodeId, nodes[nodeId]]]));
|
|
4347
4263
|
return {
|
|
4348
|
-
edges: (revision.graph(
|
|
4264
|
+
edges: (revision.graph()?.edges ?? []).filter((edge) => copied[edge.source] != null && copied[edge.target] != null),
|
|
4349
4265
|
bindings: Object.fromEntries(Object.values(copied).flatMap((node) => {
|
|
4350
4266
|
if (!("inputs" in node)) return [];
|
|
4351
4267
|
return Object.values(nodeInputMappings(node)).flatMap((mapping) => mapping.kind == "sources" ? mapping.sources.flatMap((source) => {
|
|
@@ -4355,22 +4271,17 @@ function copyNodes(revision, target, nodeIds) {
|
|
|
4355
4271
|
}) : []);
|
|
4356
4272
|
})),
|
|
4357
4273
|
modules: Object.fromEntries(Object.values(copied).flatMap((node) => {
|
|
4358
|
-
if (node.kind != "task" || node.task
|
|
4274
|
+
if (node.kind != "task" || !("moduleId" in node.task)) return [];
|
|
4359
4275
|
const module = revision.revision.content.modules[node.task.moduleId];
|
|
4360
4276
|
return module == null ? [] : [[node.task.moduleId, module]];
|
|
4361
4277
|
})),
|
|
4362
4278
|
nodes: copied
|
|
4363
4279
|
};
|
|
4364
4280
|
}
|
|
4365
|
-
function pasteNodes(revision,
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
sourceIds: []
|
|
4370
|
-
};
|
|
4371
|
-
const hasErrorTrigger = Object.values(revision.graph(target)?.nodes ?? {}).some((node) => node.kind === "error");
|
|
4372
|
-
const hasManualTrigger = Object.values(revision.graph(target)?.nodes ?? {}).some((node) => node.kind === "manual");
|
|
4373
|
-
const entries = Object.entries(clipboard.nodes).filter(([, node]) => (target.kind == "flow" || "inputs" in node) && (node.kind !== "manual" || !hasManualTrigger) && (node.kind !== "error" || !hasErrorTrigger) && (node.kind != "task" || node.task == null || clipboard.modules[node.task.moduleId] != null));
|
|
4281
|
+
function pasteNodes(revision, clipboard, identity) {
|
|
4282
|
+
const hasErrorTrigger = Object.values(revision.graph()?.nodes ?? {}).some((node) => node.kind === "error");
|
|
4283
|
+
const hasManualTrigger = Object.values(revision.graph()?.nodes ?? {}).some((node) => node.kind === "manual");
|
|
4284
|
+
const entries = Object.entries(clipboard.nodes).filter(([, node]) => (node.kind !== "manual" || !hasManualTrigger) && (node.kind !== "error" || !hasErrorTrigger) && (node.kind != "task" || !("moduleId" in node.task) || clipboard.modules[node.task.moduleId] != null));
|
|
4374
4285
|
const sourceIds = entries.map(([sourceId]) => sourceId);
|
|
4375
4286
|
const ids = new Map(sourceIds.map((sourceId) => [sourceId, identity()]));
|
|
4376
4287
|
const operations = [];
|
|
@@ -4400,8 +4311,7 @@ function pasteNodes(revision, target, clipboard, identity) {
|
|
|
4400
4311
|
operations.push({
|
|
4401
4312
|
kind: "graph.node.create",
|
|
4402
4313
|
node,
|
|
4403
|
-
nodeId
|
|
4404
|
-
target
|
|
4314
|
+
nodeId
|
|
4405
4315
|
});
|
|
4406
4316
|
continue;
|
|
4407
4317
|
}
|
|
@@ -4451,7 +4361,7 @@ function pasteNodes(revision, target, clipboard, identity) {
|
|
|
4451
4361
|
...source,
|
|
4452
4362
|
bindingId: bindingIds.get(source.bindingId) ?? source.bindingId
|
|
4453
4363
|
} : source);
|
|
4454
|
-
if (node.kind == "task" && node.task
|
|
4364
|
+
if (node.kind == "task" && "moduleId" in node.task) {
|
|
4455
4365
|
const moduleId = nodeId;
|
|
4456
4366
|
const module = clipboard.modules[node.task.moduleId];
|
|
4457
4367
|
operations.push({
|
|
@@ -4476,8 +4386,7 @@ function pasteNodes(revision, target, clipboard, identity) {
|
|
|
4476
4386
|
operations.push({
|
|
4477
4387
|
kind: "graph.node.create",
|
|
4478
4388
|
node: copy,
|
|
4479
|
-
nodeId
|
|
4480
|
-
target
|
|
4389
|
+
nodeId
|
|
4481
4390
|
});
|
|
4482
4391
|
}
|
|
4483
4392
|
for (const edge of clipboard.edges) {
|
|
@@ -4485,7 +4394,6 @@ function pasteNodes(revision, target, clipboard, identity) {
|
|
|
4485
4394
|
const destination = ids.get(edge.target);
|
|
4486
4395
|
if (source != null && destination != null) operations.push({
|
|
4487
4396
|
kind: "graph.edge.connect",
|
|
4488
|
-
target,
|
|
4489
4397
|
edge: {
|
|
4490
4398
|
...edge,
|
|
4491
4399
|
source,
|
|
@@ -4494,7 +4402,7 @@ function pasteNodes(revision, target, clipboard, identity) {
|
|
|
4494
4402
|
});
|
|
4495
4403
|
}
|
|
4496
4404
|
return {
|
|
4497
|
-
changes: nameCreatedNodes(revision,
|
|
4405
|
+
changes: nameCreatedNodes(revision, operations),
|
|
4498
4406
|
nodeIds: [...ids.values()],
|
|
4499
4407
|
sourceIds
|
|
4500
4408
|
};
|
|
@@ -4596,26 +4504,22 @@ function mergeChanges(before, after) {
|
|
|
4596
4504
|
const first = before[0];
|
|
4597
4505
|
const last = after[0];
|
|
4598
4506
|
if (first?.kind == "graph.node.field.set" && last?.kind == "graph.node.field.set") {
|
|
4599
|
-
if (first.nodeId != last.nodeId || first.field != last.field
|
|
4600
|
-
if (first.target.kind == "subflow" && (last.target.kind != "subflow" || first.target.id != last.target.id)) return;
|
|
4507
|
+
if (first.nodeId != last.nodeId || first.field != last.field) return;
|
|
4601
4508
|
return [{
|
|
4602
4509
|
before: first.before,
|
|
4603
4510
|
field: last.field,
|
|
4604
4511
|
kind: last.kind,
|
|
4605
4512
|
nodeId: last.nodeId,
|
|
4606
|
-
target: last.target,
|
|
4607
4513
|
value: last.value
|
|
4608
4514
|
}];
|
|
4609
4515
|
}
|
|
4610
4516
|
if (first?.kind == "graph.node.input.set" && last?.kind == "graph.node.input.set") {
|
|
4611
|
-
if (first.nodeId != last.nodeId || first.handle != last.handle
|
|
4612
|
-
if (first.target.kind == "subflow" && (last.target.kind != "subflow" || first.target.id != last.target.id)) return;
|
|
4517
|
+
if (first.nodeId != last.nodeId || first.handle != last.handle) return;
|
|
4613
4518
|
return [{
|
|
4614
4519
|
before: first.before,
|
|
4615
4520
|
handle: last.handle,
|
|
4616
4521
|
kind: last.kind,
|
|
4617
4522
|
nodeId: last.nodeId,
|
|
4618
|
-
target: last.target,
|
|
4619
4523
|
value: last.value
|
|
4620
4524
|
}];
|
|
4621
4525
|
}
|
|
@@ -5220,9 +5124,9 @@ function moduleEditorStatus(draft, editor) {
|
|
|
5220
5124
|
if (module == null) return "failed";
|
|
5221
5125
|
return editor.source == module.source ? "saved" : "dirty";
|
|
5222
5126
|
}
|
|
5223
|
-
function selectedModuleEditor(revision,
|
|
5224
|
-
if (revision == null ||
|
|
5225
|
-
const node = revision.node(
|
|
5127
|
+
function selectedModuleEditor(revision, nodeIds) {
|
|
5128
|
+
if (revision == null || nodeIds.length != 1) return;
|
|
5129
|
+
const node = revision.node(nodeIds[0]);
|
|
5226
5130
|
if (node?.kind != "task" || node.definition == null || !("moduleId" in node.definition) || node.module == null) return;
|
|
5227
5131
|
return {
|
|
5228
5132
|
moduleId: node.definition.moduleId,
|
|
@@ -5230,7 +5134,6 @@ function selectedModuleEditor(revision, target, nodeIds) {
|
|
|
5230
5134
|
};
|
|
5231
5135
|
}
|
|
5232
5136
|
var WorkspaceModel = class {
|
|
5233
|
-
#revisionContext;
|
|
5234
5137
|
#state = val(initialState);
|
|
5235
5138
|
#catalogValues;
|
|
5236
5139
|
constructor(i18n, flows) {
|
|
@@ -5253,28 +5156,23 @@ var WorkspaceModel = class {
|
|
|
5253
5156
|
const live = derive(this.#state, (state) => state.live);
|
|
5254
5157
|
const revision = derive(this.#state, (state) => state.draft == null ? void 0 : revisionView(state.draft));
|
|
5255
5158
|
const selectedNodeIds = derive(this.#state, (state) => state.selectedNodeIds);
|
|
5256
|
-
const target = derive(this.#state, (state) => state.target);
|
|
5257
5159
|
const workspaceLoadFailed = derive(this.#state, (state) => state.workspaceLoadFailed);
|
|
5258
5160
|
const workspaceLoadProblem = derive(this.#state, (state) => state.workspaceLoadProblem);
|
|
5259
5161
|
const workspaceLoading = derive(this.#state, (state) => state.workspaceLoading);
|
|
5260
5162
|
const workspaceRepairing = derive(this.#state, (state) => state.workspaceRepairing);
|
|
5261
|
-
this.#revisionContext = derive(this.#state, (state) => ({
|
|
5262
|
-
revision: state.draft == null ? void 0 : revisionView(state.draft),
|
|
5263
|
-
target: state.target
|
|
5264
|
-
}), { equal: (next, previous) => next.revision === previous.revision && next.target === previous.target });
|
|
5265
5163
|
const selection = derive(this.#state, (state) => {
|
|
5266
|
-
if (state.draft == null || state.
|
|
5267
|
-
return revisionView(state.draft).selection(state.
|
|
5164
|
+
if (state.draft == null || state.selectedNodeIds.length != 1) return;
|
|
5165
|
+
return revisionView(state.draft).selection(state.selectedNodeIds[0]);
|
|
5268
5166
|
});
|
|
5269
5167
|
this.$ = {
|
|
5270
5168
|
addNodeOptions: compute((get) => {
|
|
5271
|
-
const
|
|
5272
|
-
return deriveAddNodeOptions(currentRevision?.revision,
|
|
5169
|
+
const currentRevision = get(revision);
|
|
5170
|
+
return deriveAddNodeOptions(currentRevision?.revision, get(i18n.t$));
|
|
5273
5171
|
}),
|
|
5274
5172
|
busy,
|
|
5275
5173
|
checkLoading,
|
|
5276
5174
|
diagnosticFocus,
|
|
5277
|
-
diagnosticItems: derive(this.#state, (state) => diagnosticItems(state.draft == null ? void 0 : revisionView(state.draft), state.
|
|
5175
|
+
diagnosticItems: derive(this.#state, (state) => diagnosticItems(state.draft == null ? void 0 : revisionView(state.draft), state.diagnostics)),
|
|
5278
5176
|
diagnostics,
|
|
5279
5177
|
draft,
|
|
5280
5178
|
flow: compute((get) => {
|
|
@@ -5290,7 +5188,7 @@ var WorkspaceModel = class {
|
|
|
5290
5188
|
flowRefreshing: flows.$.refreshing,
|
|
5291
5189
|
flowTotal: flows.$.total,
|
|
5292
5190
|
flows: flows.$.flows,
|
|
5293
|
-
inspectorDiagnostics: derive(this.#state, (state) => deriveInspectorDiagnostics(state.draft == null ? void 0 : revisionView(state.draft), state.
|
|
5191
|
+
inspectorDiagnostics: derive(this.#state, (state) => deriveInspectorDiagnostics(state.draft == null ? void 0 : revisionView(state.draft), state.diagnostics, selection.value)),
|
|
5294
5192
|
live,
|
|
5295
5193
|
moduleEditor,
|
|
5296
5194
|
nodeFocus,
|
|
@@ -5299,14 +5197,6 @@ var WorkspaceModel = class {
|
|
|
5299
5197
|
selection,
|
|
5300
5198
|
selectedNodeIds,
|
|
5301
5199
|
status: derive(this.#state, status),
|
|
5302
|
-
target,
|
|
5303
|
-
targetFlow: compute((get) => get(target)?.kind == "flow" ? get(flows.$.flows).find((flow) => flow.flowId == get(flowId)) : void 0),
|
|
5304
|
-
targetName: derive(this.#state, (state) => {
|
|
5305
|
-
if (state.target == null) return;
|
|
5306
|
-
if (state.target.kind == "flow") return flows.flow(state.flowId ?? "")?.name;
|
|
5307
|
-
if (state.draft == null) return state.target.id;
|
|
5308
|
-
return revisionView(state.draft).subflow(state.target.id)?.name ?? state.target.id;
|
|
5309
|
-
}),
|
|
5310
5200
|
workspaceLoadFailed,
|
|
5311
5201
|
workspaceLoadProblem,
|
|
5312
5202
|
workspaceLoading,
|
|
@@ -5325,7 +5215,6 @@ var WorkspaceModel = class {
|
|
|
5325
5215
|
}
|
|
5326
5216
|
dispose() {
|
|
5327
5217
|
for (const value of Object.values(this.$)) if (!this.#catalogValues.has(value)) value.dispose();
|
|
5328
|
-
this.#revisionContext.dispose();
|
|
5329
5218
|
this.#state.dispose();
|
|
5330
5219
|
}
|
|
5331
5220
|
};
|
|
@@ -5346,10 +5235,6 @@ var deletionMessageKeys = {
|
|
|
5346
5235
|
conditionGroup: "history.deleted.conditionGroup",
|
|
5347
5236
|
webhookBody: "history.deleted.webhookBody"
|
|
5348
5237
|
};
|
|
5349
|
-
function reconcileTarget(revision, target) {
|
|
5350
|
-
if (target == null) return;
|
|
5351
|
-
return target.kind == "flow" || revision.subflow(target.id) != null ? target : { kind: "flow" };
|
|
5352
|
-
}
|
|
5353
5238
|
var WorkspaceStore = class {
|
|
5354
5239
|
#client;
|
|
5355
5240
|
#draftChanges;
|
|
@@ -5403,7 +5288,7 @@ var WorkspaceStore = class {
|
|
|
5403
5288
|
beforeChange: (manageBusy) => {
|
|
5404
5289
|
if (manageBusy) this.#set({ busy: "designer" });
|
|
5405
5290
|
},
|
|
5406
|
-
check: () => void this.#
|
|
5291
|
+
check: () => void this.#checkDraft(),
|
|
5407
5292
|
current: (context) => this.#isDraftChangeCurrent(context),
|
|
5408
5293
|
finishChanges: () => {
|
|
5409
5294
|
if (!this.#disposed && this.#model.value.busy == "designer") this.#set({ busy: void 0 });
|
|
@@ -5491,7 +5376,6 @@ var WorkspaceStore = class {
|
|
|
5491
5376
|
presentation: void 0,
|
|
5492
5377
|
flowId,
|
|
5493
5378
|
selectedNodeIds: [],
|
|
5494
|
-
target: flowId == null ? void 0 : { kind: "flow" },
|
|
5495
5379
|
workspaceLoadFailed: false,
|
|
5496
5380
|
workspaceLoadProblem: void 0,
|
|
5497
5381
|
workspaceLoading: flowId != null,
|
|
@@ -5527,7 +5411,6 @@ var WorkspaceStore = class {
|
|
|
5527
5411
|
draft,
|
|
5528
5412
|
live,
|
|
5529
5413
|
presentation,
|
|
5530
|
-
target: { kind: "flow" },
|
|
5531
5414
|
workspaceLoadFailed: false,
|
|
5532
5415
|
workspaceLoadProblem: void 0,
|
|
5533
5416
|
workspaceLoading: false
|
|
@@ -5591,27 +5474,12 @@ var WorkspaceStore = class {
|
|
|
5591
5474
|
if (current() && this.#model.value.flowId == flowId) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5592
5475
|
}
|
|
5593
5476
|
}
|
|
5594
|
-
selectTarget(target) {
|
|
5595
|
-
if (this.#history.applying) return false;
|
|
5596
|
-
if (!dequal$1(target, this.#model.value.target)) this.#history.clear();
|
|
5597
|
-
this.#modules.flush();
|
|
5598
|
-
this.#set({
|
|
5599
|
-
diagnosticFocus: void 0,
|
|
5600
|
-
diagnostics: void 0,
|
|
5601
|
-
moduleEditor: void 0,
|
|
5602
|
-
nodeFocus: void 0,
|
|
5603
|
-
selectedNodeIds: [],
|
|
5604
|
-
target
|
|
5605
|
-
});
|
|
5606
|
-
this.#checkTarget();
|
|
5607
|
-
return true;
|
|
5608
|
-
}
|
|
5609
5477
|
selectNodes(nodeIds) {
|
|
5610
5478
|
if (nodeIds.length == this.#model.value.selectedNodeIds.length && nodeIds.every((nodeId, index) => nodeId == this.#model.value.selectedNodeIds[index])) return true;
|
|
5611
5479
|
this.#modules.flush();
|
|
5612
5480
|
this.#set({
|
|
5613
5481
|
diagnosticFocus: void 0,
|
|
5614
|
-
moduleEditor: selectedModuleEditor(this.#model.value.draft == null ? void 0 : revisionView(this.#model.value.draft),
|
|
5482
|
+
moduleEditor: selectedModuleEditor(this.#model.value.draft == null ? void 0 : revisionView(this.#model.value.draft), nodeIds),
|
|
5615
5483
|
nodeFocus: void 0,
|
|
5616
5484
|
selectedNodeIds: nodeIds
|
|
5617
5485
|
});
|
|
@@ -5655,24 +5523,6 @@ var WorkspaceStore = class {
|
|
|
5655
5523
|
this.#set({ busy: void 0 });
|
|
5656
5524
|
}
|
|
5657
5525
|
}
|
|
5658
|
-
async createResource(name) {
|
|
5659
|
-
if (!await this.saveModuleEditor()) return false;
|
|
5660
|
-
if (this.#model.value.draft == null) return false;
|
|
5661
|
-
const id = this.#identity();
|
|
5662
|
-
this.#set({ busy: "resource" });
|
|
5663
|
-
const changed = await this.#changeDraft(createResource(id, name), false);
|
|
5664
|
-
this.#set({ busy: void 0 });
|
|
5665
|
-
if (changed == null) return false;
|
|
5666
|
-
this.selectTarget({
|
|
5667
|
-
id,
|
|
5668
|
-
kind: "subflow"
|
|
5669
|
-
});
|
|
5670
|
-
this.#setNotice({
|
|
5671
|
-
kind: "success",
|
|
5672
|
-
message: this.#i18n.t("notice.createdInDraft", { name })
|
|
5673
|
-
});
|
|
5674
|
-
return true;
|
|
5675
|
-
}
|
|
5676
5526
|
async renameFlow(flowId, name) {
|
|
5677
5527
|
const flow = this.#flows.flow(flowId);
|
|
5678
5528
|
const nextName = name.trim();
|
|
@@ -5697,12 +5547,11 @@ var WorkspaceStore = class {
|
|
|
5697
5547
|
async addNode(option, position, connection) {
|
|
5698
5548
|
if (!await this.saveModuleEditor()) return;
|
|
5699
5549
|
const draft = this.#model.value.draft;
|
|
5700
|
-
|
|
5701
|
-
if (draft == null || target == null) return;
|
|
5550
|
+
if (draft == null) return;
|
|
5702
5551
|
const nodeId = this.#identity();
|
|
5703
|
-
if (option.kind == "comment") return await this.#addComment(
|
|
5552
|
+
if (option.kind == "comment") return await this.#addComment(nodeId, position);
|
|
5704
5553
|
const revision = revisionView(draft);
|
|
5705
|
-
let intent = addNodeIntent(option, revision,
|
|
5554
|
+
let intent = addNodeIntent(option, revision, this.#i18n.t);
|
|
5706
5555
|
if (intent == null) return;
|
|
5707
5556
|
if (intent.kind == "provider-trigger" && intent.connectionId == null) {
|
|
5708
5557
|
try {
|
|
@@ -5715,17 +5564,17 @@ var WorkspaceStore = class {
|
|
|
5715
5564
|
} catch (error) {
|
|
5716
5565
|
if (!this.#disposed && this.#model.value.draft == draft) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5717
5566
|
}
|
|
5718
|
-
if (this.#disposed || this.#model.value.draft != draft
|
|
5567
|
+
if (this.#disposed || this.#model.value.draft != draft) return;
|
|
5719
5568
|
}
|
|
5720
5569
|
const edge = connection?.(nodeId);
|
|
5721
|
-
const nodeChanges = addNode(revision,
|
|
5570
|
+
const nodeChanges = addNode(revision, nodeId, intent);
|
|
5722
5571
|
if (nodeChanges == null) return;
|
|
5723
|
-
const changes = edge == null ? nodeChanges : [...nodeChanges, ...connect(applyFlowChanges(draft, nodeChanges).content,
|
|
5572
|
+
const changes = edge == null ? nodeChanges : [...nodeChanges, ...connect(applyFlowChanges(draft, nodeChanges).content, {
|
|
5724
5573
|
source: edge.source,
|
|
5725
5574
|
target: edge.target,
|
|
5726
5575
|
...edge.sourceHandle.startsWith("$branch:") ? { sourceHandle: edge.sourceHandle.slice(8) } : {}
|
|
5727
5576
|
})];
|
|
5728
|
-
if (!await this.#canvasChange("add", 1, changes, (value) => setNodePositions(value,
|
|
5577
|
+
if (!await this.#canvasChange("add", 1, changes, (value) => setNodePositions(value, { [nodeId]: position }), [nodeId])) return;
|
|
5729
5578
|
if (this.#disposed) return;
|
|
5730
5579
|
this.#set({ nodeFocus: {
|
|
5731
5580
|
nodeId,
|
|
@@ -5735,9 +5584,8 @@ var WorkspaceStore = class {
|
|
|
5735
5584
|
}
|
|
5736
5585
|
async connect(edge) {
|
|
5737
5586
|
const revision = this.$.revision.value;
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
const changes = connect(revision.revision.content, target, {
|
|
5587
|
+
if (revision == null) return;
|
|
5588
|
+
const changes = connect(revision.revision.content, {
|
|
5741
5589
|
source: edge.source,
|
|
5742
5590
|
target: edge.target,
|
|
5743
5591
|
...edge.sourceHandle.startsWith("$branch:") ? { sourceHandle: edge.sourceHandle.slice(8) } : {}
|
|
@@ -5746,9 +5594,8 @@ var WorkspaceStore = class {
|
|
|
5746
5594
|
}
|
|
5747
5595
|
async disconnect(edge) {
|
|
5748
5596
|
const revision = this.$.revision.value;
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
const changes = disconnect(revision.revision.content, target, {
|
|
5597
|
+
if (revision == null) return;
|
|
5598
|
+
const changes = disconnect(revision.revision.content, {
|
|
5752
5599
|
source: edge.source,
|
|
5753
5600
|
target: edge.target,
|
|
5754
5601
|
...edge.sourceHandle.startsWith("$branch:") ? { sourceHandle: edge.sourceHandle.slice(8) } : {}
|
|
@@ -5758,22 +5605,20 @@ var WorkspaceStore = class {
|
|
|
5758
5605
|
async deleteSelectedNodes() {
|
|
5759
5606
|
if (!await this.saveModuleEditor()) return;
|
|
5760
5607
|
const revision = this.$.revision.value;
|
|
5761
|
-
|
|
5762
|
-
if (revision == null || target == null || this.#model.value.selectedNodeIds.length == 0) return;
|
|
5608
|
+
if (revision == null || this.#model.value.selectedNodeIds.length == 0) return;
|
|
5763
5609
|
const selectedNodeIds = [...this.#model.value.selectedNodeIds];
|
|
5764
|
-
const comments = commentIds(this.#model.value.presentation?.value ?? {}
|
|
5610
|
+
const comments = commentIds(this.#model.value.presentation?.value ?? {});
|
|
5765
5611
|
const commentNodes = new Set(this.#model.value.selectedNodeIds.filter((nodeId) => comments.has(nodeId)));
|
|
5766
|
-
const changes = deleteSelection(revision,
|
|
5612
|
+
const changes = deleteSelection(revision, this.#model.value.selectedNodeIds);
|
|
5767
5613
|
await this.#canvasChange("delete", this.#model.value.selectedNodeIds.length, changes, (value) => {
|
|
5768
|
-
let next = commentNodes.size == 0 ? value : removeComments(value,
|
|
5769
|
-
for (const nodeId of selectedNodeIds) next = setNodeContentHidden(next,
|
|
5614
|
+
let next = commentNodes.size == 0 ? value : removeComments(value, commentNodes);
|
|
5615
|
+
for (const nodeId of selectedNodeIds) next = setNodeContentHidden(next, nodeId, false);
|
|
5770
5616
|
return next;
|
|
5771
5617
|
}, []);
|
|
5772
5618
|
}
|
|
5773
5619
|
copySelectedNodes() {
|
|
5774
5620
|
const revision = this.$.revision.value;
|
|
5775
|
-
|
|
5776
|
-
if (revision == null || target == null || this.#model.value.selectedNodeIds.length == 0) return;
|
|
5621
|
+
if (revision == null || this.#model.value.selectedNodeIds.length == 0) return;
|
|
5777
5622
|
const selected = new Set(this.#model.value.selectedNodeIds);
|
|
5778
5623
|
this.#clipboard = {
|
|
5779
5624
|
hiddenNodeIds: this.#designer().nodes.flatMap((node) => node.contentHidden && selected.has(node.id) ? [node.id] : []),
|
|
@@ -5783,16 +5628,15 @@ var WorkspaceStore = class {
|
|
|
5783
5628
|
sourceId: node.id,
|
|
5784
5629
|
title: node.title
|
|
5785
5630
|
}] : []),
|
|
5786
|
-
nodes: copyNodes(revision,
|
|
5631
|
+
nodes: copyNodes(revision, this.#model.value.selectedNodeIds)
|
|
5787
5632
|
};
|
|
5788
5633
|
}
|
|
5789
5634
|
async pasteNodes(sourcePositions, offset = PASTE_OFFSET) {
|
|
5790
5635
|
if (!await this.saveModuleEditor()) return;
|
|
5791
5636
|
const revision = this.$.revision.value;
|
|
5792
|
-
|
|
5793
|
-
if (revision == null || target == null || this.#clipboard == null) return;
|
|
5637
|
+
if (revision == null || this.#clipboard == null) return;
|
|
5794
5638
|
const hiddenNodeIds = new Set(this.#clipboard.hiddenNodeIds);
|
|
5795
|
-
const pasted = pasteNodes(revision,
|
|
5639
|
+
const pasted = pasteNodes(revision, this.#clipboard.nodes, this.#identity);
|
|
5796
5640
|
const comments = this.#clipboard.comments.map((comment) => ({
|
|
5797
5641
|
...comment,
|
|
5798
5642
|
nodeId: this.#identity()
|
|
@@ -5815,11 +5659,11 @@ var WorkspaceStore = class {
|
|
|
5815
5659
|
}];
|
|
5816
5660
|
}));
|
|
5817
5661
|
await this.#canvasChange("paste", added.size, pasted.changes, (value) => {
|
|
5818
|
-
let next = setNodePositions(value,
|
|
5819
|
-
for (const [index, sourceId] of pasted.sourceIds.entries()) if (hiddenNodeIds.has(sourceId)) next = setNodeContentHidden(next,
|
|
5662
|
+
let next = setNodePositions(value, positions);
|
|
5663
|
+
for (const [index, sourceId] of pasted.sourceIds.entries()) if (hiddenNodeIds.has(sourceId)) next = setNodeContentHidden(next, pasted.nodeIds[index], true);
|
|
5820
5664
|
for (const comment of comments) {
|
|
5821
|
-
if (hiddenNodeIds.has(comment.sourceId)) next = setNodeContentHidden(next,
|
|
5822
|
-
next = setComment(next,
|
|
5665
|
+
if (hiddenNodeIds.has(comment.sourceId)) next = setNodeContentHidden(next, comment.nodeId, true);
|
|
5666
|
+
next = setComment(next, comment.nodeId, {
|
|
5823
5667
|
content: comment.content,
|
|
5824
5668
|
position: {
|
|
5825
5669
|
x: comment.position.x + offset.x * step,
|
|
@@ -5836,7 +5680,7 @@ var WorkspaceStore = class {
|
|
|
5836
5680
|
await this.pasteNodes(positions, offset);
|
|
5837
5681
|
}
|
|
5838
5682
|
async saveErrorSources(nodeId, value) {
|
|
5839
|
-
const node = this.$.revision.value?.graph(
|
|
5683
|
+
const node = this.$.revision.value?.graph()?.nodes[nodeId];
|
|
5840
5684
|
if (node?.kind != "error" || dequal$1(node.sourceFlowIds ?? [], value)) return false;
|
|
5841
5685
|
return await this.#editDraft([{
|
|
5842
5686
|
kind: "graph.trigger.sources.set",
|
|
@@ -5847,50 +5691,43 @@ var WorkspaceStore = class {
|
|
|
5847
5691
|
}
|
|
5848
5692
|
async saveNodeSettings(nodeId, settings) {
|
|
5849
5693
|
const revision = this.$.revision.value;
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
const changes = updateNodeSettings(revision, target, nodeId, settings);
|
|
5694
|
+
if (revision == null) return false;
|
|
5695
|
+
const changes = updateNodeSettings(revision, nodeId, settings);
|
|
5853
5696
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5854
5697
|
}
|
|
5855
5698
|
async saveNodeDescription(nodeId, description) {
|
|
5856
5699
|
const revision = this.$.revision.value;
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
const changes = updateNodeDescription(revision, target, nodeId, description);
|
|
5700
|
+
if (revision == null) return false;
|
|
5701
|
+
const changes = updateNodeDescription(revision, nodeId, description);
|
|
5860
5702
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5861
5703
|
}
|
|
5862
5704
|
async saveNodeIcon(nodeId, icon) {
|
|
5863
5705
|
const revision = this.$.revision.value;
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
const changes = updateNodeIcon(revision, target, nodeId, icon);
|
|
5706
|
+
if (revision == null) return false;
|
|
5707
|
+
const changes = updateNodeIcon(revision, nodeId, icon);
|
|
5867
5708
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5868
5709
|
}
|
|
5869
5710
|
async saveNodeTitle(nodeId, title) {
|
|
5870
5711
|
const revision = this.$.revision.value;
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
const changes = updateNodeName(revision, target, nodeId, title);
|
|
5712
|
+
if (revision == null) return false;
|
|
5713
|
+
const changes = updateNodeName(revision, nodeId, title);
|
|
5874
5714
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5875
5715
|
}
|
|
5876
5716
|
async setInputValue(nodeId, handle, value, deletion) {
|
|
5877
5717
|
const revision = this.$.revision.value;
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
const changes = setInputValue(revision, target, nodeId, handle, value);
|
|
5718
|
+
if (revision == null) return false;
|
|
5719
|
+
const changes = setInputValue(revision, nodeId, handle, value);
|
|
5881
5720
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5882
5721
|
}
|
|
5883
5722
|
async resetInputs(nodeId, handles) {
|
|
5884
5723
|
const revision = this.$.revision.value;
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
return await this.#editDraft(resetInputValues(revision.revision.content, target, nodeId, handles)) != null;
|
|
5724
|
+
if (revision == null) return false;
|
|
5725
|
+
return await this.#editDraft(resetInputValues(revision.revision.content, nodeId, handles)) != null;
|
|
5888
5726
|
}
|
|
5889
5727
|
async resetTriggerConfig(triggerId, names) {
|
|
5890
5728
|
const revision = this.$.revision.value;
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
const trigger = revision.graph(target)?.nodes[triggerId];
|
|
5729
|
+
if (revision == null) return false;
|
|
5730
|
+
const trigger = revision.graph()?.nodes[triggerId];
|
|
5894
5731
|
if (trigger?.kind !== "poll" && trigger?.kind !== "integration") return false;
|
|
5895
5732
|
const changes = (names == null ? Object.entries(trigger.config) : names.flatMap((name) => Object.hasOwn(trigger.config, name) ? [[name, trigger.config[name]]] : [])).map(([name, before]) => ({
|
|
5896
5733
|
kind: "graph.trigger.config.set",
|
|
@@ -5903,53 +5740,46 @@ var WorkspaceStore = class {
|
|
|
5903
5740
|
}
|
|
5904
5741
|
async setInputSource(nodeId, handle, source) {
|
|
5905
5742
|
const revision = this.$.revision.value;
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
return await this.#editDraft(setInputSources(revision.revision.content, target, nodeId, handle, [{
|
|
5743
|
+
if (revision == null) return false;
|
|
5744
|
+
return await this.#editDraft(setInputSources(revision.revision.content, nodeId, handle, [{
|
|
5909
5745
|
kind: "node",
|
|
5910
5746
|
...source
|
|
5911
5747
|
}])) != null;
|
|
5912
5748
|
}
|
|
5913
5749
|
async setInputVariable(nodeId, handle, name) {
|
|
5914
5750
|
const revision = this.$.revision.value;
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
const changes = name == null ? setInputValue(revision, target, nodeId, handle, void 0) : setInputVariable(revision, target, nodeId, handle, name, this.#identity());
|
|
5751
|
+
if (revision == null) return false;
|
|
5752
|
+
const changes = name == null ? setInputValue(revision, nodeId, handle, void 0) : setInputVariable(revision, nodeId, handle, name, this.#identity());
|
|
5918
5753
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5919
5754
|
}
|
|
5920
5755
|
async saveCondition(nodeId, settings, deletion) {
|
|
5921
5756
|
const revision = this.$.revision.value;
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
const changes = updateCondition(revision, target, nodeId, settings);
|
|
5757
|
+
if (revision == null) return false;
|
|
5758
|
+
const changes = updateCondition(revision, nodeId, settings);
|
|
5925
5759
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5926
5760
|
}
|
|
5927
5761
|
async saveValue(nodeId, values, deletion) {
|
|
5928
5762
|
const revision = this.$.revision.value;
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
const changes = updateValue(revision, target, nodeId, values);
|
|
5763
|
+
if (revision == null) return false;
|
|
5764
|
+
const changes = updateValue(revision, nodeId, values);
|
|
5932
5765
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5933
5766
|
}
|
|
5934
5767
|
async saveResolution(nodeId, settings, deletion, values) {
|
|
5935
5768
|
const revision = this.$.revision.value;
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
const changes = updateResolution(revision, target, nodeId, settings, values);
|
|
5769
|
+
if (revision == null) return false;
|
|
5770
|
+
const changes = updateResolution(revision, nodeId, settings, values);
|
|
5939
5771
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5940
5772
|
}
|
|
5941
5773
|
async saveNodeContentHidden(nodeId, hidden) {
|
|
5942
|
-
const target = this.#model.value.target;
|
|
5943
5774
|
const node = this.#designer().nodes.find((candidate) => candidate.id == nodeId);
|
|
5944
|
-
if (
|
|
5945
|
-
await this.#canvasChange("edit", 1, [], (value) => setNodeContentHidden(value,
|
|
5775
|
+
if (node == null || node.kind == "condition") return;
|
|
5776
|
+
await this.#canvasChange("edit", 1, [], (value) => setNodeContentHidden(value, nodeId, hidden));
|
|
5946
5777
|
}
|
|
5947
5778
|
async saveComment(nodeId, comment) {
|
|
5948
|
-
|
|
5949
|
-
if (target == null) return;
|
|
5779
|
+
if (this.#model.value.draft == null) return;
|
|
5950
5780
|
const position = this.#designer().nodes.find((node) => node.id == nodeId)?.position;
|
|
5951
5781
|
if (position == null) return;
|
|
5952
|
-
await this.#canvasChange("edit", 1, [], (value) => setComment(value,
|
|
5782
|
+
await this.#canvasChange("edit", 1, [], (value) => setComment(value, nodeId, {
|
|
5953
5783
|
...comment,
|
|
5954
5784
|
position
|
|
5955
5785
|
}));
|
|
@@ -5959,36 +5789,32 @@ var WorkspaceStore = class {
|
|
|
5959
5789
|
}
|
|
5960
5790
|
async saveTaskSettings(nodeId, settings, deletion) {
|
|
5961
5791
|
const revision = this.$.revision.value;
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
const changes = updateTask(revision, target, nodeId, settings);
|
|
5792
|
+
if (revision == null) return false;
|
|
5793
|
+
const changes = updateTask(revision, nodeId, settings);
|
|
5965
5794
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5966
5795
|
}
|
|
5967
5796
|
async saveTaskPorts(nodeId, ports, deletion, values) {
|
|
5968
5797
|
const revision = this.$.revision.value;
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
const changes = updateTaskPorts(revision, target, nodeId, ports, values);
|
|
5798
|
+
if (revision == null) return false;
|
|
5799
|
+
const changes = updateTaskPorts(revision, nodeId, ports, values);
|
|
5972
5800
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5973
5801
|
}
|
|
5974
5802
|
async saveTaskAdditionalInputs(nodeId, inputs, deletion, values) {
|
|
5975
5803
|
const revision = this.$.revision.value;
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
const changes = updateTaskAdditionalInputs(revision, target, nodeId, inputs, values);
|
|
5804
|
+
if (revision == null) return false;
|
|
5805
|
+
const changes = updateTaskAdditionalInputs(revision, nodeId, inputs, values);
|
|
5979
5806
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5980
5807
|
}
|
|
5981
|
-
async setConnectorConnection(
|
|
5808
|
+
async setConnectorConnection(nodeId, connectionId) {
|
|
5982
5809
|
const revision = this.$.revision.value;
|
|
5983
5810
|
if (revision == null) return false;
|
|
5984
|
-
const changes = setConnectorConnection(revision.revision.content,
|
|
5811
|
+
const changes = setConnectorConnection(revision.revision.content, nodeId, connectionId);
|
|
5985
5812
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5986
5813
|
}
|
|
5987
5814
|
async setCodeActions(nodeId, capabilities) {
|
|
5988
5815
|
const revision = this.$.revision.value;
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
const changes = setCodeActions(revision.revision.content, target, nodeId, capabilities);
|
|
5816
|
+
if (revision == null) return false;
|
|
5817
|
+
const changes = setCodeActions(revision.revision.content, nodeId, capabilities);
|
|
5992
5818
|
return changes == null || await this.#editDraft(changes) != null;
|
|
5993
5819
|
}
|
|
5994
5820
|
get eventSourceClient() {
|
|
@@ -6001,19 +5827,18 @@ var WorkspaceStore = class {
|
|
|
6001
5827
|
}
|
|
6002
5828
|
async setTriggerEventSource(triggerId, source) {
|
|
6003
5829
|
const revision = this.$.revision.value;
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
const trigger = revision.graph(target)?.nodes[triggerId];
|
|
5830
|
+
if (revision == null) return false;
|
|
5831
|
+
const trigger = revision.graph()?.nodes[triggerId];
|
|
6007
5832
|
if (trigger?.kind != "integration" || trigger.definition.key != "feishu_app_bot.on_event" || source.provider != trigger.definition.provider) return false;
|
|
6008
|
-
const connectionChanges = setTriggerConnection(revision.revision.content,
|
|
5833
|
+
const connectionChanges = setTriggerConnection(revision.revision.content, triggerId, source.connectionId);
|
|
6009
5834
|
if (connectionChanges == null) return false;
|
|
6010
5835
|
const changed = inputValue(trigger.config.sourceId, void 0) != source.sourceId;
|
|
6011
5836
|
return await this.#editDraft([
|
|
6012
5837
|
...connectionChanges,
|
|
6013
|
-
...updateTriggerConfig(revision.revision.content,
|
|
6014
|
-
...changed ? updateTriggerConfig(revision.revision.content,
|
|
6015
|
-
...changed ? updateTriggerConfig(revision.revision.content,
|
|
6016
|
-
...changed ? updateTriggerConfig(revision.revision.content,
|
|
5838
|
+
...updateTriggerConfig(revision.revision.content, triggerId, "sourceId", source.sourceId) ?? [],
|
|
5839
|
+
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "eventTypes", void 0) ?? [] : [],
|
|
5840
|
+
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "resource", void 0) ?? [] : [],
|
|
5841
|
+
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "chatIds", void 0) ?? [] : []
|
|
6017
5842
|
]) != null;
|
|
6018
5843
|
}
|
|
6019
5844
|
async loadTriggerConfigOptions(triggerId, field, signal) {
|
|
@@ -6026,50 +5851,40 @@ var WorkspaceStore = class {
|
|
|
6026
5851
|
}
|
|
6027
5852
|
async saveTriggerConfig(triggerId, name, value) {
|
|
6028
5853
|
const revision = this.$.revision.value;
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
let changes = updateTriggerConfig(revision.revision.content, target, triggerId, name, value);
|
|
5854
|
+
if (revision == null) return false;
|
|
5855
|
+
let changes = updateTriggerConfig(revision.revision.content, triggerId, name, value);
|
|
6032
5856
|
if (changes == null) return false;
|
|
6033
|
-
const trigger = revision.graph(
|
|
5857
|
+
const trigger = revision.graph()?.nodes[triggerId];
|
|
6034
5858
|
if (changes.length > 0 && trigger?.kind == "integration" && trigger.definition.key == "feishu_app_bot.on_event" && name == "eventTypes") {
|
|
6035
5859
|
const events = Array.isArray(value) ? value.filter((item) => typeof item == "string") : [];
|
|
6036
|
-
if (!supportsFeishuChatFilter(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content,
|
|
5860
|
+
if (!supportsFeishuChatFilter(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content, triggerId, "chatIds", void 0) ?? []];
|
|
6037
5861
|
const resource = inputValue(trigger.config.resource, void 0);
|
|
6038
|
-
if (isJsonObject(resource) && resource.kind != feishuResourceKind(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content,
|
|
5862
|
+
if (isJsonObject(resource) && resource.kind != feishuResourceKind(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content, triggerId, "resource", void 0) ?? []];
|
|
6039
5863
|
}
|
|
6040
|
-
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,
|
|
5864
|
+
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;
|
|
6041
5865
|
return await this.#editDraft(changes) != null;
|
|
6042
5866
|
}
|
|
6043
5867
|
async saveTriggerSchedule(triggerId, schedule) {
|
|
6044
5868
|
const revision = this.$.revision.value;
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
const changes = updateTriggerSchedule(revision.revision.content, target, triggerId, schedule);
|
|
5869
|
+
if (revision == null) return false;
|
|
5870
|
+
const changes = updateTriggerSchedule(revision.revision.content, triggerId, schedule);
|
|
6048
5871
|
return changes != null && await this.#editDraft(changes) != null;
|
|
6049
5872
|
}
|
|
6050
5873
|
async saveWebhook(triggerId, settings, deletion) {
|
|
6051
5874
|
const revision = this.$.revision.value;
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
const changes = updateWebhook(revision, target, triggerId, settings);
|
|
5875
|
+
if (revision == null) return false;
|
|
5876
|
+
const changes = updateWebhook(revision, triggerId, settings);
|
|
6055
5877
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6056
5878
|
}
|
|
6057
5879
|
async setTriggerConnection(triggerId, connectionId) {
|
|
6058
5880
|
const revision = this.$.revision.value;
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
const changes = setTriggerConnection(revision.revision.content, target, triggerId, connectionId);
|
|
5881
|
+
if (revision == null) return false;
|
|
5882
|
+
const changes = setTriggerConnection(revision.revision.content, triggerId, connectionId);
|
|
6062
5883
|
if (changes == null) return false;
|
|
6063
|
-
const trigger = revision.graph(
|
|
6064
|
-
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,
|
|
5884
|
+
const trigger = revision.graph()?.nodes[triggerId];
|
|
5885
|
+
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;
|
|
6065
5886
|
return await this.#editDraft(changes) != null;
|
|
6066
5887
|
}
|
|
6067
|
-
async saveSubflowSettings(subflowId, settings) {
|
|
6068
|
-
const revision = this.$.revision.value;
|
|
6069
|
-
if (revision == null) return false;
|
|
6070
|
-
const changes = updateSubflow(revision, subflowId, settings);
|
|
6071
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
6072
|
-
}
|
|
6073
5888
|
updateModuleSource(source) {
|
|
6074
5889
|
const editor = this.#model.value.moduleEditor;
|
|
6075
5890
|
if (this.#history.applying || this.#history.failed || editor == null || editor.source == source) return;
|
|
@@ -6091,17 +5906,15 @@ var WorkspaceStore = class {
|
|
|
6091
5906
|
return this.#modules.saveModuleEditor();
|
|
6092
5907
|
}
|
|
6093
5908
|
async moveNodes(positions) {
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
await this.#canvasChange("move", Object.keys(positions).length, [], (value) => setNodePositions(value, target, positions));
|
|
5909
|
+
if (this.#model.value.draft == null) return;
|
|
5910
|
+
await this.#canvasChange("move", Object.keys(positions).length, [], (value) => setNodePositions(value, positions));
|
|
6097
5911
|
}
|
|
6098
5912
|
async moveViewport(viewport) {
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
await this.#changePresentation((value) => setFlowViewport(value, target, viewport), true);
|
|
5913
|
+
if (this.#model.value.draft == null) return;
|
|
5914
|
+
await this.#changePresentation((value) => setFlowViewport(value, viewport), true);
|
|
6102
5915
|
}
|
|
6103
5916
|
async check() {
|
|
6104
|
-
await this.#
|
|
5917
|
+
await this.#checkDraft();
|
|
6105
5918
|
}
|
|
6106
5919
|
async refreshFlows() {
|
|
6107
5920
|
await this.reloadFlows();
|
|
@@ -6111,9 +5924,8 @@ var WorkspaceStore = class {
|
|
|
6111
5924
|
}
|
|
6112
5925
|
locateNode(nodeId, { preserveSelection = false } = {}) {
|
|
6113
5926
|
const revision = this.$.revision.value;
|
|
6114
|
-
|
|
6115
|
-
if (revision == null
|
|
6116
|
-
if (revision.node(target, nodeId) == null && !commentIds(this.#model.value.presentation?.value ?? {}, target).has(nodeId)) return false;
|
|
5927
|
+
if (revision == null) return false;
|
|
5928
|
+
if (revision.node(nodeId) == null && !commentIds(this.#model.value.presentation?.value ?? {}).has(nodeId)) return false;
|
|
6117
5929
|
if (!preserveSelection && !this.selectNodes([nodeId])) return false;
|
|
6118
5930
|
this.#set({ nodeFocus: {
|
|
6119
5931
|
nodeId,
|
|
@@ -6130,13 +5942,13 @@ var WorkspaceStore = class {
|
|
|
6130
5942
|
} });
|
|
6131
5943
|
return true;
|
|
6132
5944
|
}
|
|
6133
|
-
async #addComment(
|
|
5945
|
+
async #addComment(nodeId, position) {
|
|
6134
5946
|
const number = Math.max(0, ...this.#designer().nodes.flatMap((node) => {
|
|
6135
5947
|
if (node.kind != "comment") return [];
|
|
6136
5948
|
const match = /#(\d+)$/.exec(node.title);
|
|
6137
5949
|
return match == null ? [] : [Number(match[1])];
|
|
6138
5950
|
}));
|
|
6139
|
-
if (!await this.#canvasChange("add", 1, [], (value) => setComment(value,
|
|
5951
|
+
if (!await this.#canvasChange("add", 1, [], (value) => setComment(value, nodeId, {
|
|
6140
5952
|
content: "",
|
|
6141
5953
|
position,
|
|
6142
5954
|
title: this.#i18n.t("addNode.commentName", { number: number + 1 })
|
|
@@ -6201,17 +6013,17 @@ var WorkspaceStore = class {
|
|
|
6201
6013
|
if (draft == null) return;
|
|
6202
6014
|
const repairs = repairNodeNames(draft.content);
|
|
6203
6015
|
if (repairs.length == 0) {
|
|
6204
|
-
this.#
|
|
6016
|
+
this.#checkDraft();
|
|
6205
6017
|
return;
|
|
6206
6018
|
}
|
|
6207
6019
|
if (await this.#changeDraft(repairs, false) != null || !current()) return;
|
|
6208
6020
|
if (this.#model.value.draft?.revisionId == draft.revisionId) break;
|
|
6209
6021
|
}
|
|
6210
|
-
if (current()) this.#
|
|
6022
|
+
if (current()) this.#checkDraft();
|
|
6211
6023
|
}
|
|
6212
6024
|
#applyDraft(draft, origin) {
|
|
6213
6025
|
const previousDraft = this.#model.value.draft;
|
|
6214
|
-
const { revision, selectedNodeIds
|
|
6026
|
+
const { revision, selectedNodeIds } = this.#reconcileRevision(draft);
|
|
6215
6027
|
const editor = this.#model.value.moduleEditor;
|
|
6216
6028
|
const keepEditor = editor != null && (origin == "external" || previousDraft != null) && moduleEditorStatus(previousDraft, editor) != "saved";
|
|
6217
6029
|
let moduleEditor;
|
|
@@ -6219,12 +6031,11 @@ var WorkspaceStore = class {
|
|
|
6219
6031
|
...editor,
|
|
6220
6032
|
phase: "failed"
|
|
6221
6033
|
} : editor;
|
|
6222
|
-
else moduleEditor = selectedModuleEditor(revision,
|
|
6034
|
+
else moduleEditor = selectedModuleEditor(revision, selectedNodeIds);
|
|
6223
6035
|
this.#set({
|
|
6224
6036
|
draft,
|
|
6225
6037
|
moduleEditor,
|
|
6226
|
-
selectedNodeIds
|
|
6227
|
-
target
|
|
6038
|
+
selectedNodeIds
|
|
6228
6039
|
});
|
|
6229
6040
|
return keepEditor;
|
|
6230
6041
|
}
|
|
@@ -6255,10 +6066,10 @@ var WorkspaceStore = class {
|
|
|
6255
6066
|
}
|
|
6256
6067
|
async #canvasChange(action, count, changes, update, selection = this.#model.value.selectedNodeIds, deletion) {
|
|
6257
6068
|
if (this.#disposed || this.#history.applying || this.#history.failed) return false;
|
|
6258
|
-
const { draft,
|
|
6259
|
-
if (draft == null ||
|
|
6069
|
+
const { draft, presentation, selectedNodeIds } = this.#model.value;
|
|
6070
|
+
if (draft == null || presentation == null) return false;
|
|
6260
6071
|
const next = update?.(presentation.value) ?? presentation.value;
|
|
6261
|
-
const presentationChange = canvasPresentationChange(presentation.value, next
|
|
6072
|
+
const presentationChange = canvasPresentationChange(presentation.value, next);
|
|
6262
6073
|
if (dequal$1(applyFlowChanges(draft, changes).content, draft.content) && presentationChange.nodeIds.length == 0) return true;
|
|
6263
6074
|
const generation = this.#history.generation;
|
|
6264
6075
|
const inverse = inverseFlowChanges(draft.content, changes);
|
|
@@ -6266,7 +6077,6 @@ var WorkspaceStore = class {
|
|
|
6266
6077
|
const entry = {
|
|
6267
6078
|
action,
|
|
6268
6079
|
count,
|
|
6269
|
-
target,
|
|
6270
6080
|
forward: changes,
|
|
6271
6081
|
inverse,
|
|
6272
6082
|
presentation: presentationChange,
|
|
@@ -6311,7 +6121,7 @@ var WorkspaceStore = class {
|
|
|
6311
6121
|
this.#history.applying = true;
|
|
6312
6122
|
this.#history.publish();
|
|
6313
6123
|
try {
|
|
6314
|
-
const [draft, presentation] = await Promise.all([this.#changeDraft(redo ? entry.forward : entry.inverse, true, "canvas"), this.#changePresentation((value) => restoreCanvasPresentation(value, entry.
|
|
6124
|
+
const [draft, presentation] = await Promise.all([this.#changeDraft(redo ? entry.forward : entry.inverse, true, "canvas"), this.#changePresentation((value) => restoreCanvasPresentation(value, entry.presentation, redo), true)]);
|
|
6315
6125
|
if (draft != null && presentation && generation == this.#history.generation) {
|
|
6316
6126
|
this.selectNodes(redo ? entry.afterSelection : entry.beforeSelection);
|
|
6317
6127
|
this.#history.complete(redo);
|
|
@@ -6347,7 +6157,7 @@ var WorkspaceStore = class {
|
|
|
6347
6157
|
kind: "error",
|
|
6348
6158
|
message: this.#i18n.t("history.resynced")
|
|
6349
6159
|
});
|
|
6350
|
-
this.#
|
|
6160
|
+
this.#checkDraft();
|
|
6351
6161
|
} catch {
|
|
6352
6162
|
if (current() && !this.#disposed) this.#setNotice({
|
|
6353
6163
|
kind: "error",
|
|
@@ -6361,13 +6171,12 @@ var WorkspaceStore = class {
|
|
|
6361
6171
|
});
|
|
6362
6172
|
return this.#historyRecovery;
|
|
6363
6173
|
}
|
|
6364
|
-
async #
|
|
6174
|
+
async #checkDraft() {
|
|
6365
6175
|
if (this.#disposed) return;
|
|
6366
6176
|
const flowId = this.#model.value.flowId;
|
|
6367
6177
|
const draft = this.#model.value.draft;
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
if (target == null) this.#set({
|
|
6178
|
+
if (flowId == null || draft == null) {
|
|
6179
|
+
if (this.#model.value.draft == null) this.#set({
|
|
6371
6180
|
checkLoading: false,
|
|
6372
6181
|
diagnostics: void 0
|
|
6373
6182
|
});
|
|
@@ -6437,7 +6246,7 @@ var WorkspaceStore = class {
|
|
|
6437
6246
|
kind: preserveModuleEditor ? "error" : "success",
|
|
6438
6247
|
message: this.#i18n.t(preserveModuleEditor ? "notice.moduleUpdated" : "notice.draftUpdated")
|
|
6439
6248
|
});
|
|
6440
|
-
this.#
|
|
6249
|
+
this.#checkDraft();
|
|
6441
6250
|
return true;
|
|
6442
6251
|
} catch (error) {
|
|
6443
6252
|
if (reportError && this.#isDraftChangeCurrent(context)) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
@@ -6446,15 +6255,13 @@ var WorkspaceStore = class {
|
|
|
6446
6255
|
}
|
|
6447
6256
|
#designer() {
|
|
6448
6257
|
const state = this.#model.value;
|
|
6449
|
-
return designerGraph(state.draft, state.
|
|
6258
|
+
return designerGraph(state.draft, state.presentation?.value, state.diagnostics?.diagnostics, {}, {}, this.#i18n.t);
|
|
6450
6259
|
}
|
|
6451
6260
|
#reconcileRevision(draft) {
|
|
6452
6261
|
const revision = revisionView(draft);
|
|
6453
|
-
const target = reconcileTarget(revision, this.#model.value.target);
|
|
6454
6262
|
return {
|
|
6455
6263
|
revision,
|
|
6456
|
-
selectedNodeIds: this.#model.value.selectedNodeIds.filter((nodeId) =>
|
|
6457
|
-
target
|
|
6264
|
+
selectedNodeIds: this.#model.value.selectedNodeIds.filter((nodeId) => revision.selection(nodeId) != null)
|
|
6458
6265
|
};
|
|
6459
6266
|
}
|
|
6460
6267
|
#isDraftChangeCurrent(context) {
|
|
@@ -6474,11 +6281,11 @@ var WorkspaceStore = class {
|
|
|
6474
6281
|
function indexNodes(designer) {
|
|
6475
6282
|
return new Map(designer.nodes.map((node) => [node.id, node]));
|
|
6476
6283
|
}
|
|
6477
|
-
function designerRevisionInputs(draft
|
|
6478
|
-
return draft == null
|
|
6284
|
+
function designerRevisionInputs(draft) {
|
|
6285
|
+
return draft == null ? [] : revisionView(draft).designerInputs();
|
|
6479
6286
|
}
|
|
6480
|
-
function indexRunEventNodes(draft,
|
|
6481
|
-
if (draft == null ||
|
|
6287
|
+
function indexRunEventNodes(draft, run, events, nodes) {
|
|
6288
|
+
if (draft == null || run?.revisionId != draft.revisionId || run.flowId != draft.flowId) return /* @__PURE__ */ new Map();
|
|
6482
6289
|
const scopeId = events.find((event) => event.kind == "run.started" && event.payload.flowId == draft.flowId)?.payload.scopeId;
|
|
6483
6290
|
if (typeof scopeId != "string") return /* @__PURE__ */ new Map();
|
|
6484
6291
|
return new Map(events.flatMap((event) => {
|
|
@@ -6572,15 +6379,14 @@ var WorkbenchStore = class {
|
|
|
6572
6379
|
valid: false
|
|
6573
6380
|
};
|
|
6574
6381
|
});
|
|
6575
|
-
|
|
6382
|
+
let designerCache;
|
|
6576
6383
|
let designerFlowId;
|
|
6577
6384
|
const designer = compute((get) => {
|
|
6578
6385
|
const draft = get(this.workspace.$.draft);
|
|
6579
6386
|
if (designerFlowId != draft?.flowId) {
|
|
6580
|
-
designerCache
|
|
6387
|
+
designerCache = void 0;
|
|
6581
6388
|
designerFlowId = draft?.flowId;
|
|
6582
6389
|
}
|
|
6583
|
-
const target = get(this.workspace.$.target);
|
|
6584
6390
|
const presentation = get(this.workspace.$.presentation)?.value;
|
|
6585
6391
|
const designerDiagnostics = get(diagnostics)?.diagnostics ?? get(this.connectors.$.diagnostics);
|
|
6586
6392
|
const providerEntries = draft == null ? void 0 : get(resourceData(this.workspace.catalogs.providers.get(draft.flowId, i18n.lang)));
|
|
@@ -6590,10 +6396,9 @@ var WorkbenchStore = class {
|
|
|
6590
6396
|
const t = get(i18n.t$);
|
|
6591
6397
|
const run = get(this.runs.$.run);
|
|
6592
6398
|
const events = get(this.runs.$.events);
|
|
6593
|
-
const key = target == null ? "" : target.kind == "flow" ? "flow" : `subflow:${target.id}`;
|
|
6594
6399
|
const inputs = [
|
|
6595
|
-
...designerRevisionInputs(draft
|
|
6596
|
-
presentation == null
|
|
6400
|
+
...designerRevisionInputs(draft),
|
|
6401
|
+
presentation == null ? void 0 : flowPresentation(presentation),
|
|
6597
6402
|
designerDiagnostics,
|
|
6598
6403
|
actions,
|
|
6599
6404
|
providerEntries,
|
|
@@ -6603,24 +6408,23 @@ var WorkbenchStore = class {
|
|
|
6603
6408
|
events,
|
|
6604
6409
|
...run == null ? [] : [draft?.revisionId]
|
|
6605
6410
|
];
|
|
6606
|
-
const cached = designerCache
|
|
6411
|
+
const cached = designerCache;
|
|
6607
6412
|
if (cached != null && cached.inputs.length == inputs.length && cached.inputs.every((input, index) => input === inputs[index])) return cached.graph;
|
|
6608
|
-
const graph = designerGraph(draft,
|
|
6609
|
-
designerCache
|
|
6413
|
+
const graph = designerGraph(draft, presentation, designerDiagnostics, actions, catalogs, t, run, events, providerCatalog);
|
|
6414
|
+
designerCache = {
|
|
6610
6415
|
graph,
|
|
6611
6416
|
inputs
|
|
6612
|
-
}
|
|
6417
|
+
};
|
|
6613
6418
|
return graph;
|
|
6614
6419
|
});
|
|
6615
6420
|
const designerNodeById = derive(designer, indexNodes);
|
|
6616
6421
|
this.$ = {
|
|
6617
6422
|
connectorSetupPending: compute((get) => {
|
|
6618
6423
|
const flowId = get(this.workspace.$.flowId);
|
|
6619
|
-
const target = get(this.workspace.$.target);
|
|
6620
6424
|
const selection = get(this.workspace.$.selection);
|
|
6621
6425
|
if (selection?.kind != "task" || selection.definition == null || !("executor" in selection.definition) || selection.definition.executor.kind != "connector") return false;
|
|
6622
6426
|
const actionId = selection.definition.executor.action;
|
|
6623
|
-
return get(this.#connectorSetups).some((setup) => setup.flowId == flowId &&
|
|
6427
|
+
return get(this.#connectorSetups).some((setup) => setup.flowId == flowId && setup.actionId == actionId && (setup.nodeId == null || setup.nodeId == selection.id));
|
|
6624
6428
|
}),
|
|
6625
6429
|
busy: compute((get) => {
|
|
6626
6430
|
const workspaceBusy = get(this.workspace.$.busy);
|
|
@@ -6633,15 +6437,14 @@ var WorkbenchStore = class {
|
|
|
6633
6437
|
}),
|
|
6634
6438
|
diagnosticItems: compute((get) => {
|
|
6635
6439
|
const revision = get(this.workspace.$.revision);
|
|
6636
|
-
|
|
6637
|
-
return presentTriggerDiagnostics(diagnosticItems(revision, target, get(diagnostics)), revision, target, get(this.triggers.catalog.state).data?.display, resolveUiLanguage([i18n.lang]), get(i18n.t$));
|
|
6440
|
+
return presentTriggerDiagnostics(diagnosticItems(revision, get(diagnostics)), revision, get(this.triggers.catalog.state).data?.display, resolveUiLanguage([i18n.lang]), get(i18n.t$));
|
|
6638
6441
|
}),
|
|
6639
6442
|
diagnostics,
|
|
6640
6443
|
designer,
|
|
6641
6444
|
designerNodeById,
|
|
6642
6445
|
sourceNodeIcons: derive(designer, (graph) => Object.fromEntries(graph.nodes.flatMap((node) => "icon" in node ? [[node.id, node.icon]] : [])), { equal: dequal }),
|
|
6643
6446
|
notice: this.#notice,
|
|
6644
|
-
runEventNodes: compute((get) => indexRunEventNodes(get(this.workspace.$.draft), get(this.
|
|
6447
|
+
runEventNodes: compute((get) => indexRunEventNodes(get(this.workspace.$.draft), get(this.runs.$.run), get(this.runs.$.events), get(designerNodeById))),
|
|
6645
6448
|
selectedDesignerNode: compute((get) => {
|
|
6646
6449
|
const selected = get(this.workspace.$.selectedNodeIds);
|
|
6647
6450
|
return selected.length == 1 ? get(designerNodeById).get(selected[0]) : void 0;
|
|
@@ -6770,7 +6573,6 @@ var WorkbenchStore = class {
|
|
|
6770
6573
|
return;
|
|
6771
6574
|
}
|
|
6772
6575
|
const flowId = this.workspace.$.flowId.value;
|
|
6773
|
-
const target = this.workspace.$.target.value;
|
|
6774
6576
|
if (option.kind == "connector") {
|
|
6775
6577
|
const { defaultConnection: _defaultConnection, ...metadata } = option.connector;
|
|
6776
6578
|
option = {
|
|
@@ -6778,9 +6580,8 @@ var WorkbenchStore = class {
|
|
|
6778
6580
|
connector: metadata
|
|
6779
6581
|
};
|
|
6780
6582
|
}
|
|
6781
|
-
const setup = option.kind == "connector" && flowId != null
|
|
6583
|
+
const setup = option.kind == "connector" && flowId != null ? {
|
|
6782
6584
|
flowId,
|
|
6783
|
-
target,
|
|
6784
6585
|
actionId: option.connector.actionId,
|
|
6785
6586
|
nodeId: void 0
|
|
6786
6587
|
} : void 0;
|
|
@@ -6792,7 +6593,7 @@ var WorkbenchStore = class {
|
|
|
6792
6593
|
if (nodeId != null && option.kind == "connector" && setup != null) {
|
|
6793
6594
|
setup.nodeId = nodeId;
|
|
6794
6595
|
this.#connectorSetups.set([...this.#connectorSetups.value]);
|
|
6795
|
-
this.#configureAddedConnector(setup.flowId,
|
|
6596
|
+
this.#configureAddedConnector(setup.flowId, nodeId, option.connector).finally(finishSetup);
|
|
6796
6597
|
finishSetup = void 0;
|
|
6797
6598
|
}
|
|
6798
6599
|
if (nodeId != null && option.kind == "trigger") this.triggers.refresh();
|
|
@@ -6804,17 +6605,17 @@ var WorkbenchStore = class {
|
|
|
6804
6605
|
finishSetup?.();
|
|
6805
6606
|
}
|
|
6806
6607
|
}
|
|
6807
|
-
async #configureAddedConnector(flowId,
|
|
6608
|
+
async #configureAddedConnector(flowId, nodeId, action) {
|
|
6808
6609
|
try {
|
|
6809
6610
|
if (this.#disposed || flowId != this.workspace.$.flowId.value) return;
|
|
6810
6611
|
const prepared = await this.prepareConnectorAction(action);
|
|
6811
6612
|
if (prepared == null || this.#disposed || flowId != this.workspace.$.flowId.value) return;
|
|
6812
|
-
const node = this.workspace.$.revision.value?.node(
|
|
6813
|
-
if (node?.kind != "task" || node.node.task
|
|
6814
|
-
const executor =
|
|
6613
|
+
const node = this.workspace.$.revision.value?.node(nodeId);
|
|
6614
|
+
if (node?.kind != "task" || "moduleId" in node.node.task) return;
|
|
6615
|
+
const executor = "executor" in node.node.task ? node.node.task.executor : void 0;
|
|
6815
6616
|
if (executor?.kind != "connector" || executor.action != action.actionId || executor.connectionId != null) return;
|
|
6816
6617
|
const connection = prepared.action.defaultConnection;
|
|
6817
|
-
if (connection != null) await this.workspace.setConnectorConnection(node.
|
|
6618
|
+
if (connection != null) await this.workspace.setConnectorConnection(node.id, connection.connectionId);
|
|
6818
6619
|
if (!this.#disposed && flowId == this.workspace.$.flowId.value) await this.connectors.refresh();
|
|
6819
6620
|
} catch (error) {
|
|
6820
6621
|
if (!this.#disposed && flowId == this.workspace.$.flowId.value) this.#notice.set(errorNotice(error, this.#i18n.t));
|
|
@@ -6891,7 +6692,7 @@ var WorkbenchStore = class {
|
|
|
6891
6692
|
async requestDraftRun(triggerId) {
|
|
6892
6693
|
const flowId = this.workspace.$.flowId.value;
|
|
6893
6694
|
if (!await this.workspace.saveDraft() || this.#disposed || flowId != this.workspace.$.flowId.value) return "unavailable";
|
|
6894
|
-
const flow = this.workspace.$.
|
|
6695
|
+
const flow = this.workspace.$.flow.value;
|
|
6895
6696
|
const draft = this.workspace.$.draft.value;
|
|
6896
6697
|
if (flow == null || draft == null) return "unavailable";
|
|
6897
6698
|
return await this.runRequests.requestDraft(flow, draft, triggerId);
|
|
@@ -6899,24 +6700,22 @@ var WorkbenchStore = class {
|
|
|
6899
6700
|
async editDraftRunInputs(triggerId) {
|
|
6900
6701
|
const flowId = this.workspace.$.flowId.value;
|
|
6901
6702
|
if (!await this.workspace.saveDraft() || this.#disposed || flowId != this.workspace.$.flowId.value) return "unavailable";
|
|
6902
|
-
const flow = this.workspace.$.
|
|
6703
|
+
const flow = this.workspace.$.flow.value;
|
|
6903
6704
|
const draft = this.workspace.$.draft.value;
|
|
6904
6705
|
if (flow == null || draft == null) return "unavailable";
|
|
6905
6706
|
return await this.runRequests.editDraft(flow, draft, triggerId);
|
|
6906
6707
|
}
|
|
6907
6708
|
async requestLiveRun() {
|
|
6908
|
-
const flow = this.workspace.$.
|
|
6709
|
+
const flow = this.workspace.$.flow.value;
|
|
6909
6710
|
if (flow == null) return "unavailable";
|
|
6910
6711
|
return await this.runRequests.requestLive(flow);
|
|
6911
6712
|
}
|
|
6912
6713
|
async #followExternalRun(client, event) {
|
|
6913
|
-
|
|
6914
|
-
if (this.#disposed || this.runRequests.$.submitting.value != null || target?.kind != "flow" || this.workspace.$.flowId.value != event.flowId) return;
|
|
6714
|
+
if (this.#disposed || this.runRequests.$.submitting.value != null || this.workspace.$.flowId.value != event.flowId) return;
|
|
6915
6715
|
const current = this.#externalRuns.begin();
|
|
6916
6716
|
try {
|
|
6917
6717
|
const run = await client.getRun(event.runId);
|
|
6918
|
-
|
|
6919
|
-
if (!current() || this.#disposed || latestTarget?.kind != "flow" || this.workspace.$.flowId.value != event.flowId || run.flowId != event.flowId || run.runId != event.runId) return;
|
|
6718
|
+
if (!current() || this.#disposed || this.workspace.$.flowId.value != event.flowId || run.flowId != event.flowId || run.runId != event.runId) return;
|
|
6920
6719
|
this.runs.followExternal(run);
|
|
6921
6720
|
} catch {
|
|
6922
6721
|
return;
|
|
@@ -6925,7 +6724,7 @@ var WorkbenchStore = class {
|
|
|
6925
6724
|
};
|
|
6926
6725
|
//#endregion
|
|
6927
6726
|
//#region src/workbench/browser/runtime/openFlowWorkbench.tsx
|
|
6928
|
-
var FlowWorkspace = lazy(() => import("./flowWorkspace-
|
|
6727
|
+
var FlowWorkspace = lazy(() => import("./flowWorkspace-Dg4mqfa6.js"));
|
|
6929
6728
|
function OpenFlowSessionGate({ action, description, error, onSubmit, onTokenChange, pending = false, title, token, tokenLabel }) {
|
|
6930
6729
|
const hasToken = token != null && tokenLabel != null && onTokenChange != null;
|
|
6931
6730
|
const tokenValue = token ?? "";
|