@oomol-lab/open-flow 0.1.0-beta.55 → 0.1.0-beta.57
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-C23SBjYd.js} +2 -2
- package/dist/browser/flow-authoring-edge.d.ts +3 -3
- package/dist/browser/flow-authoring-node.d.ts +30 -46
- package/dist/browser/flow-authoring.js +9215 -21030
- package/dist/browser/flow-change-schema.d.ts +267 -1
- package/dist/browser/flow-change.d.ts +19 -104
- package/dist/browser/flow-change.js +154 -298
- package/dist/browser/{flowChanges-ZzG-f9cg.js → flowChanges-fBiAeTzR.js} +2347 -2216
- package/dist/browser/{flowWorkspace-ChpRaTMX.js → flowWorkspace-MqcEfg7T.js} +118 -293
- package/dist/browser/{icons-CdAB9wyS.js → icons-6oQ8Q9Wm.js} +4309 -4454
- package/dist/browser/lib-DrKav3HG.js +11403 -0
- package/dist/browser/preview.css +1 -1
- package/dist/browser/preview.js +9609 -9548
- 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 +227 -417
- package/dist/browser/{workbenchSelect-BRZN4ish.js → workbenchSelect-DpLbIr29.js} +1 -1
- package/dist/common/authoring.d.ts +207 -0
- package/dist/common/authoringSchema.d.ts +1293 -0
- package/dist/common/control-api-conformance.js +1060 -623
- package/dist/common/control-api-errors.d.ts +2 -1
- package/dist/common/control-api.d.ts +87 -6
- package/dist/common/control-api.js +1058 -705
- package/dist/common/control-requests.d.ts +128 -0
- package/dist/common/control-requests.js +2913 -1145
- package/dist/common/decision.js +6337 -6371
- 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 +131 -182
- package/dist/common/flow-graph.d.ts +10 -10
- package/dist/common/flow-semantics.d.ts +13 -9
- package/dist/common/flow-semantics.js +9051 -9232
- package/dist/common/flowInspection.d.ts +3 -21
- package/dist/common/integration-trigger.js +8653 -8687
- package/dist/common/lib-DrKav3HG.js +11403 -0
- package/dist/common/mcp.d.ts +120 -12
- package/dist/common/mcp.js +537 -188
- package/dist/common/openapi.js +6337 -6371
- package/dist/common/poll-trigger.js +8653 -8687
- package/dist/common/run-events.js +0 -1
- package/dist/common/scheduler.d.ts +3 -9
- package/dist/common/scheduler.js +128 -209
- package/dist/common/webhook-trigger.js +6337 -6371
- package/package.json +7 -1
- package/skills/open-flow/SKILL.md +32 -0
- package/skills/open-flow/references/flow-authoring.md +356 -0
- package/skills/open-flow/references/flow-n8n-conversion.md +196 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as RunStore, $t as EventSourcesPage, An as providerIconAppearance, At as followWorkbenchLink, B as CacheResource, Bn as invalidResponse, Cn as sampleErrorOutputs, Ct as setCodeActions, Dt as updateTriggerConfig, Et as setTriggerConnection, F as feishuResourceKind, Gn as controlErrorCode, Gt as InputGroupAddon, H as resourceData, Hn as record, I as supportsFeishuChatFilter, J as providerIcon, Jt as EmptyContent, Kt as InputGroupInput, L as combineSources, Lt as PopoverTitle, M as addNodeIntent, Mt as Popover, N as deriveAddNodeOptions, Nt as PopoverContent, On as connection, Ot as updateTriggerSchedule, Qt as EmptyTitle, Rt as PopoverTrigger, St as resetInputValues, Tn as isJsonObject, Tt as setInputSources, U as resourceValue, Un as string, Vn as jsonValue, W as designerGraph, Wn as ApiError, Wt as InputGroup, Xt as EmptyHeader, Yt as EmptyDescription, Zt as EmptyMedia, _ as updateValue, _n as randomId, _t as setComment, a as nameCreatedNodes, at as deriveInspectorDiagnostics, bn as decodeTriggerCatalog, bt as setNodePositions, c as updateCondition, d as updateNodeName, dt as connectionCatalog, f as updateNodeSettings, ft as canvasPresentationChange, g as updateTaskPorts, gn as WorkbenchClient, gt as restoreCanvasPresentation, h as updateTaskAdditionalInputs, hn as errorNotice, ht as removeComments, i as deleteSelection, it as Latest, jt as Switch, kn as connectorActionMetadata, kt as IdTooltip, l as updateNodeDescription, m as updateTask, mt as flowPresentation, nn as createI18n, nt as revisionView, o as setInputValue, ot as diagnosticItems, p as updateResolution, pt as commentIds, qn as IconThemeContext, qt as Empty, r as applyFlowChanges, rt as flowResourceReferences, s as setInputVariable, t as addNode, u as updateNodeIcon, ut as actionWithConnections, v as updateWebhook, vn as allConnectorConnectionsQuery, vt as setFlowViewport, wn as triggerOutputDefinitions, wt as setConnectorConnection, xt as repairNodeNames, yt as setNodeContentHidden, z as scopedValue, zn as inputValue } from "./flowChanges-fBiAeTzR.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 {
|
|
4
|
+
import { E as FieldLabel, H as applyFlowChanges$1, J as resourceNameIssue, Q as nodeInputMappings, S as Field, T as FieldGroup, V as FlowChangeError, Z as mapConditionSources, a as DialogDescription, at as dequal$1, bi as cn, c as DialogTitle, d as TooltipContent, i as DialogContent, n as Dialog, o as DialogFooter, or as Input, p as TooltipTrigger, r as DialogClose, s as DialogHeader, t as Icon, u as Tooltip, vi as Button, w as FieldError, x as Spinner } from "./icons-6oQ8Q9Wm.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-C23SBjYd.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,
|
|
@@ -4067,21 +4045,26 @@ function inverseFlowChanges(content, operations) {
|
|
|
4067
4045
|
const after = applyFlowChanges$1(current, [operation]);
|
|
4068
4046
|
const restore = [];
|
|
4069
4047
|
switch (operation.kind) {
|
|
4048
|
+
case "graph.node.replace":
|
|
4049
|
+
restore.push({
|
|
4050
|
+
...operation,
|
|
4051
|
+
before: after.document.graph.nodes[operation.nodeId],
|
|
4052
|
+
node: operation.before
|
|
4053
|
+
});
|
|
4054
|
+
break;
|
|
4070
4055
|
case "graph.node.create":
|
|
4071
4056
|
restore.push({
|
|
4072
4057
|
kind: "graph.node.delete",
|
|
4073
|
-
nodeId: operation.nodeId
|
|
4074
|
-
target: operation.target
|
|
4058
|
+
nodeId: operation.nodeId
|
|
4075
4059
|
});
|
|
4076
4060
|
break;
|
|
4077
4061
|
case "graph.node.delete": {
|
|
4078
|
-
const {
|
|
4079
|
-
const graph =
|
|
4080
|
-
const nextGraph =
|
|
4062
|
+
const { nodeId } = operation;
|
|
4063
|
+
const graph = current.document.graph;
|
|
4064
|
+
const nextGraph = after.document.graph;
|
|
4081
4065
|
restore.push({
|
|
4082
4066
|
kind: "graph.node.create",
|
|
4083
4067
|
nodeId,
|
|
4084
|
-
target,
|
|
4085
4068
|
node: graph.nodes[nodeId]
|
|
4086
4069
|
});
|
|
4087
4070
|
for (const [id, node] of Object.entries(nextGraph.nodes)) {
|
|
@@ -4089,7 +4072,6 @@ function inverseFlowChanges(content, operations) {
|
|
|
4089
4072
|
if (!("inputs" in node) || !("inputs" in previous)) continue;
|
|
4090
4073
|
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
4074
|
kind: "graph.node.input.set",
|
|
4092
|
-
target,
|
|
4093
4075
|
nodeId: id,
|
|
4094
4076
|
handle,
|
|
4095
4077
|
before: node.inputs[handle],
|
|
@@ -4098,24 +4080,12 @@ function inverseFlowChanges(content, operations) {
|
|
|
4098
4080
|
}
|
|
4099
4081
|
for (const edge of nextGraph.edges) restore.push({
|
|
4100
4082
|
kind: "graph.edge.disconnect",
|
|
4101
|
-
target,
|
|
4102
4083
|
edge
|
|
4103
4084
|
});
|
|
4104
4085
|
for (const edge of graph.edges) restore.push({
|
|
4105
4086
|
kind: "graph.edge.connect",
|
|
4106
|
-
target,
|
|
4107
4087
|
edge
|
|
4108
4088
|
});
|
|
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
4089
|
break;
|
|
4120
4090
|
}
|
|
4121
4091
|
case "graph.edge.connect":
|
|
@@ -4125,17 +4095,14 @@ function inverseFlowChanges(content, operations) {
|
|
|
4125
4095
|
});
|
|
4126
4096
|
break;
|
|
4127
4097
|
case "graph.edge.disconnect": {
|
|
4128
|
-
const
|
|
4129
|
-
const
|
|
4130
|
-
const next = target.kind == "flow" ? after.document.graph : after.document.subflows[target.id].graph;
|
|
4098
|
+
const graph = current.document.graph;
|
|
4099
|
+
const next = after.document.graph;
|
|
4131
4100
|
restore.push(...next.edges.map((edge) => ({
|
|
4132
4101
|
kind: "graph.edge.disconnect",
|
|
4133
|
-
target,
|
|
4134
4102
|
edge
|
|
4135
4103
|
})));
|
|
4136
4104
|
restore.push(...graph.edges.map((edge) => ({
|
|
4137
4105
|
kind: "graph.edge.connect",
|
|
4138
|
-
target,
|
|
4139
4106
|
edge
|
|
4140
4107
|
})));
|
|
4141
4108
|
break;
|
|
@@ -4166,27 +4133,13 @@ function inverseFlowChanges(content, operations) {
|
|
|
4166
4133
|
binding: current.document.bindings[operation.bindingId]
|
|
4167
4134
|
});
|
|
4168
4135
|
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
4136
|
case "graph.node.input.set": {
|
|
4183
|
-
const beforeGraph =
|
|
4184
|
-
const afterGraph =
|
|
4137
|
+
const beforeGraph = current.document.graph;
|
|
4138
|
+
const afterGraph = after.document.graph;
|
|
4185
4139
|
const beforeNode = beforeGraph.nodes[operation.nodeId];
|
|
4186
4140
|
const afterNode = afterGraph.nodes[operation.nodeId];
|
|
4187
4141
|
if (beforeNode.kind === "condition" && afterNode.kind === "condition") restore.push({
|
|
4188
4142
|
kind: "graph.node.condition.set",
|
|
4189
|
-
target: operation.target,
|
|
4190
4143
|
nodeId: operation.nodeId,
|
|
4191
4144
|
before: {
|
|
4192
4145
|
cases: afterNode.cases,
|
|
@@ -4295,43 +4248,13 @@ function inverseFlowChanges(content, operations) {
|
|
|
4295
4248
|
value: operation.before
|
|
4296
4249
|
});
|
|
4297
4250
|
break;
|
|
4298
|
-
case "
|
|
4251
|
+
case "graph.node.task.set":
|
|
4299
4252
|
restore.push({
|
|
4300
4253
|
...operation,
|
|
4301
4254
|
before: operation.value,
|
|
4302
4255
|
value: operation.before
|
|
4303
4256
|
});
|
|
4304
4257
|
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
4258
|
default: throw new Error(`Unsupported canvas history operation: ${operation.kind}`);
|
|
4336
4259
|
}
|
|
4337
4260
|
groups.push(restore);
|
|
@@ -4341,11 +4264,11 @@ function inverseFlowChanges(content, operations) {
|
|
|
4341
4264
|
}
|
|
4342
4265
|
//#endregion
|
|
4343
4266
|
//#region src/workbench/browser/runtime/editor/nodeClipboard.ts
|
|
4344
|
-
function copyNodes(revision,
|
|
4345
|
-
const nodes = revision.graph(
|
|
4267
|
+
function copyNodes(revision, nodeIds) {
|
|
4268
|
+
const nodes = revision.graph()?.nodes ?? {};
|
|
4346
4269
|
const copied = Object.fromEntries(nodeIds.flatMap((nodeId) => nodes[nodeId] == null ? [] : [[nodeId, nodes[nodeId]]]));
|
|
4347
4270
|
return {
|
|
4348
|
-
edges: (revision.graph(
|
|
4271
|
+
edges: (revision.graph()?.edges ?? []).filter((edge) => copied[edge.source] != null && copied[edge.target] != null),
|
|
4349
4272
|
bindings: Object.fromEntries(Object.values(copied).flatMap((node) => {
|
|
4350
4273
|
if (!("inputs" in node)) return [];
|
|
4351
4274
|
return Object.values(nodeInputMappings(node)).flatMap((mapping) => mapping.kind == "sources" ? mapping.sources.flatMap((source) => {
|
|
@@ -4355,22 +4278,17 @@ function copyNodes(revision, target, nodeIds) {
|
|
|
4355
4278
|
}) : []);
|
|
4356
4279
|
})),
|
|
4357
4280
|
modules: Object.fromEntries(Object.values(copied).flatMap((node) => {
|
|
4358
|
-
if (node.kind != "task" || node.task
|
|
4281
|
+
if (node.kind != "task" || !("moduleId" in node.task)) return [];
|
|
4359
4282
|
const module = revision.revision.content.modules[node.task.moduleId];
|
|
4360
4283
|
return module == null ? [] : [[node.task.moduleId, module]];
|
|
4361
4284
|
})),
|
|
4362
4285
|
nodes: copied
|
|
4363
4286
|
};
|
|
4364
4287
|
}
|
|
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));
|
|
4288
|
+
function pasteNodes(revision, clipboard, identity) {
|
|
4289
|
+
const hasErrorTrigger = Object.values(revision.graph()?.nodes ?? {}).some((node) => node.kind === "error");
|
|
4290
|
+
const hasManualTrigger = Object.values(revision.graph()?.nodes ?? {}).some((node) => node.kind === "manual");
|
|
4291
|
+
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
4292
|
const sourceIds = entries.map(([sourceId]) => sourceId);
|
|
4375
4293
|
const ids = new Map(sourceIds.map((sourceId) => [sourceId, identity()]));
|
|
4376
4294
|
const operations = [];
|
|
@@ -4400,8 +4318,7 @@ function pasteNodes(revision, target, clipboard, identity) {
|
|
|
4400
4318
|
operations.push({
|
|
4401
4319
|
kind: "graph.node.create",
|
|
4402
4320
|
node,
|
|
4403
|
-
nodeId
|
|
4404
|
-
target
|
|
4321
|
+
nodeId
|
|
4405
4322
|
});
|
|
4406
4323
|
continue;
|
|
4407
4324
|
}
|
|
@@ -4451,7 +4368,7 @@ function pasteNodes(revision, target, clipboard, identity) {
|
|
|
4451
4368
|
...source,
|
|
4452
4369
|
bindingId: bindingIds.get(source.bindingId) ?? source.bindingId
|
|
4453
4370
|
} : source);
|
|
4454
|
-
if (node.kind == "task" && node.task
|
|
4371
|
+
if (node.kind == "task" && "moduleId" in node.task) {
|
|
4455
4372
|
const moduleId = nodeId;
|
|
4456
4373
|
const module = clipboard.modules[node.task.moduleId];
|
|
4457
4374
|
operations.push({
|
|
@@ -4476,8 +4393,7 @@ function pasteNodes(revision, target, clipboard, identity) {
|
|
|
4476
4393
|
operations.push({
|
|
4477
4394
|
kind: "graph.node.create",
|
|
4478
4395
|
node: copy,
|
|
4479
|
-
nodeId
|
|
4480
|
-
target
|
|
4396
|
+
nodeId
|
|
4481
4397
|
});
|
|
4482
4398
|
}
|
|
4483
4399
|
for (const edge of clipboard.edges) {
|
|
@@ -4485,7 +4401,6 @@ function pasteNodes(revision, target, clipboard, identity) {
|
|
|
4485
4401
|
const destination = ids.get(edge.target);
|
|
4486
4402
|
if (source != null && destination != null) operations.push({
|
|
4487
4403
|
kind: "graph.edge.connect",
|
|
4488
|
-
target,
|
|
4489
4404
|
edge: {
|
|
4490
4405
|
...edge,
|
|
4491
4406
|
source,
|
|
@@ -4494,7 +4409,7 @@ function pasteNodes(revision, target, clipboard, identity) {
|
|
|
4494
4409
|
});
|
|
4495
4410
|
}
|
|
4496
4411
|
return {
|
|
4497
|
-
changes: nameCreatedNodes(revision,
|
|
4412
|
+
changes: nameCreatedNodes(revision, operations),
|
|
4498
4413
|
nodeIds: [...ids.values()],
|
|
4499
4414
|
sourceIds
|
|
4500
4415
|
};
|
|
@@ -4596,26 +4511,22 @@ function mergeChanges(before, after) {
|
|
|
4596
4511
|
const first = before[0];
|
|
4597
4512
|
const last = after[0];
|
|
4598
4513
|
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;
|
|
4514
|
+
if (first.nodeId != last.nodeId || first.field != last.field) return;
|
|
4601
4515
|
return [{
|
|
4602
4516
|
before: first.before,
|
|
4603
4517
|
field: last.field,
|
|
4604
4518
|
kind: last.kind,
|
|
4605
4519
|
nodeId: last.nodeId,
|
|
4606
|
-
target: last.target,
|
|
4607
4520
|
value: last.value
|
|
4608
4521
|
}];
|
|
4609
4522
|
}
|
|
4610
4523
|
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;
|
|
4524
|
+
if (first.nodeId != last.nodeId || first.handle != last.handle) return;
|
|
4613
4525
|
return [{
|
|
4614
4526
|
before: first.before,
|
|
4615
4527
|
handle: last.handle,
|
|
4616
4528
|
kind: last.kind,
|
|
4617
4529
|
nodeId: last.nodeId,
|
|
4618
|
-
target: last.target,
|
|
4619
4530
|
value: last.value
|
|
4620
4531
|
}];
|
|
4621
4532
|
}
|
|
@@ -4757,7 +4668,7 @@ var DraftChanges = class {
|
|
|
4757
4668
|
this.#pending = this.#pending.filter((candidate) => candidate !== pending);
|
|
4758
4669
|
this.#committed = committed;
|
|
4759
4670
|
this.#hooks.apply(this.project(committed));
|
|
4760
|
-
this.#hooks.headChanged(pending.flowId, committed.revisionId);
|
|
4671
|
+
this.#hooks.headChanged(pending.flowId, committed.revisionId, committed.content);
|
|
4761
4672
|
return committed;
|
|
4762
4673
|
}
|
|
4763
4674
|
#reject(pending) {
|
|
@@ -4960,10 +4871,14 @@ var FlowCatalog = class {
|
|
|
4960
4871
|
total: this.#state.value.total == null ? void 0 : this.#state.value.total - 1
|
|
4961
4872
|
});
|
|
4962
4873
|
}
|
|
4963
|
-
advanceHead(flowId, revisionId) {
|
|
4874
|
+
advanceHead(flowId, revisionId, content) {
|
|
4964
4875
|
this.#set({ flows: this.#state.value.flows.map((flow) => flow.flowId == flowId ? {
|
|
4965
4876
|
...flow,
|
|
4966
|
-
draftRevisionId: revisionId
|
|
4877
|
+
draftRevisionId: revisionId,
|
|
4878
|
+
resourceReferences: {
|
|
4879
|
+
...flow.resourceReferences,
|
|
4880
|
+
draft: flowResourceReferences(content)
|
|
4881
|
+
}
|
|
4967
4882
|
} : flow) });
|
|
4968
4883
|
}
|
|
4969
4884
|
#set(patch) {
|
|
@@ -5220,9 +5135,9 @@ function moduleEditorStatus(draft, editor) {
|
|
|
5220
5135
|
if (module == null) return "failed";
|
|
5221
5136
|
return editor.source == module.source ? "saved" : "dirty";
|
|
5222
5137
|
}
|
|
5223
|
-
function selectedModuleEditor(revision,
|
|
5224
|
-
if (revision == null ||
|
|
5225
|
-
const node = revision.node(
|
|
5138
|
+
function selectedModuleEditor(revision, nodeIds) {
|
|
5139
|
+
if (revision == null || nodeIds.length != 1) return;
|
|
5140
|
+
const node = revision.node(nodeIds[0]);
|
|
5226
5141
|
if (node?.kind != "task" || node.definition == null || !("moduleId" in node.definition) || node.module == null) return;
|
|
5227
5142
|
return {
|
|
5228
5143
|
moduleId: node.definition.moduleId,
|
|
@@ -5230,7 +5145,6 @@ function selectedModuleEditor(revision, target, nodeIds) {
|
|
|
5230
5145
|
};
|
|
5231
5146
|
}
|
|
5232
5147
|
var WorkspaceModel = class {
|
|
5233
|
-
#revisionContext;
|
|
5234
5148
|
#state = val(initialState);
|
|
5235
5149
|
#catalogValues;
|
|
5236
5150
|
constructor(i18n, flows) {
|
|
@@ -5253,28 +5167,23 @@ var WorkspaceModel = class {
|
|
|
5253
5167
|
const live = derive(this.#state, (state) => state.live);
|
|
5254
5168
|
const revision = derive(this.#state, (state) => state.draft == null ? void 0 : revisionView(state.draft));
|
|
5255
5169
|
const selectedNodeIds = derive(this.#state, (state) => state.selectedNodeIds);
|
|
5256
|
-
const target = derive(this.#state, (state) => state.target);
|
|
5257
5170
|
const workspaceLoadFailed = derive(this.#state, (state) => state.workspaceLoadFailed);
|
|
5258
5171
|
const workspaceLoadProblem = derive(this.#state, (state) => state.workspaceLoadProblem);
|
|
5259
5172
|
const workspaceLoading = derive(this.#state, (state) => state.workspaceLoading);
|
|
5260
5173
|
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
5174
|
const selection = derive(this.#state, (state) => {
|
|
5266
|
-
if (state.draft == null || state.
|
|
5267
|
-
return revisionView(state.draft).selection(state.
|
|
5175
|
+
if (state.draft == null || state.selectedNodeIds.length != 1) return;
|
|
5176
|
+
return revisionView(state.draft).selection(state.selectedNodeIds[0]);
|
|
5268
5177
|
});
|
|
5269
5178
|
this.$ = {
|
|
5270
5179
|
addNodeOptions: compute((get) => {
|
|
5271
|
-
const
|
|
5272
|
-
return deriveAddNodeOptions(currentRevision?.revision,
|
|
5180
|
+
const currentRevision = get(revision);
|
|
5181
|
+
return deriveAddNodeOptions(currentRevision?.revision, get(i18n.t$));
|
|
5273
5182
|
}),
|
|
5274
5183
|
busy,
|
|
5275
5184
|
checkLoading,
|
|
5276
5185
|
diagnosticFocus,
|
|
5277
|
-
diagnosticItems: derive(this.#state, (state) => diagnosticItems(state.draft == null ? void 0 : revisionView(state.draft), state.
|
|
5186
|
+
diagnosticItems: derive(this.#state, (state) => diagnosticItems(state.draft == null ? void 0 : revisionView(state.draft), state.diagnostics)),
|
|
5278
5187
|
diagnostics,
|
|
5279
5188
|
draft,
|
|
5280
5189
|
flow: compute((get) => {
|
|
@@ -5290,7 +5199,7 @@ var WorkspaceModel = class {
|
|
|
5290
5199
|
flowRefreshing: flows.$.refreshing,
|
|
5291
5200
|
flowTotal: flows.$.total,
|
|
5292
5201
|
flows: flows.$.flows,
|
|
5293
|
-
inspectorDiagnostics: derive(this.#state, (state) => deriveInspectorDiagnostics(state.draft == null ? void 0 : revisionView(state.draft), state.
|
|
5202
|
+
inspectorDiagnostics: derive(this.#state, (state) => deriveInspectorDiagnostics(state.draft == null ? void 0 : revisionView(state.draft), state.diagnostics, selection.value)),
|
|
5294
5203
|
live,
|
|
5295
5204
|
moduleEditor,
|
|
5296
5205
|
nodeFocus,
|
|
@@ -5299,14 +5208,6 @@ var WorkspaceModel = class {
|
|
|
5299
5208
|
selection,
|
|
5300
5209
|
selectedNodeIds,
|
|
5301
5210
|
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
5211
|
workspaceLoadFailed,
|
|
5311
5212
|
workspaceLoadProblem,
|
|
5312
5213
|
workspaceLoading,
|
|
@@ -5325,7 +5226,6 @@ var WorkspaceModel = class {
|
|
|
5325
5226
|
}
|
|
5326
5227
|
dispose() {
|
|
5327
5228
|
for (const value of Object.values(this.$)) if (!this.#catalogValues.has(value)) value.dispose();
|
|
5328
|
-
this.#revisionContext.dispose();
|
|
5329
5229
|
this.#state.dispose();
|
|
5330
5230
|
}
|
|
5331
5231
|
};
|
|
@@ -5346,10 +5246,6 @@ var deletionMessageKeys = {
|
|
|
5346
5246
|
conditionGroup: "history.deleted.conditionGroup",
|
|
5347
5247
|
webhookBody: "history.deleted.webhookBody"
|
|
5348
5248
|
};
|
|
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
5249
|
var WorkspaceStore = class {
|
|
5354
5250
|
#client;
|
|
5355
5251
|
#draftChanges;
|
|
@@ -5403,12 +5299,12 @@ var WorkspaceStore = class {
|
|
|
5403
5299
|
beforeChange: (manageBusy) => {
|
|
5404
5300
|
if (manageBusy) this.#set({ busy: "designer" });
|
|
5405
5301
|
},
|
|
5406
|
-
check: () => void this.#
|
|
5302
|
+
check: () => void this.#checkDraft(),
|
|
5407
5303
|
current: (context) => this.#isDraftChangeCurrent(context),
|
|
5408
5304
|
finishChanges: () => {
|
|
5409
5305
|
if (!this.#disposed && this.#model.value.busy == "designer") this.#set({ busy: void 0 });
|
|
5410
5306
|
},
|
|
5411
|
-
headChanged: (flowId, revisionId) => this.#flows.advanceHead(flowId, revisionId),
|
|
5307
|
+
headChanged: (flowId, revisionId, content) => this.#flows.advanceHead(flowId, revisionId, content),
|
|
5412
5308
|
recover: (context) => {
|
|
5413
5309
|
this.retryHistorySync();
|
|
5414
5310
|
return this.#syncDraftHead(context, true);
|
|
@@ -5491,7 +5387,6 @@ var WorkspaceStore = class {
|
|
|
5491
5387
|
presentation: void 0,
|
|
5492
5388
|
flowId,
|
|
5493
5389
|
selectedNodeIds: [],
|
|
5494
|
-
target: flowId == null ? void 0 : { kind: "flow" },
|
|
5495
5390
|
workspaceLoadFailed: false,
|
|
5496
5391
|
workspaceLoadProblem: void 0,
|
|
5497
5392
|
workspaceLoading: flowId != null,
|
|
@@ -5527,7 +5422,6 @@ var WorkspaceStore = class {
|
|
|
5527
5422
|
draft,
|
|
5528
5423
|
live,
|
|
5529
5424
|
presentation,
|
|
5530
|
-
target: { kind: "flow" },
|
|
5531
5425
|
workspaceLoadFailed: false,
|
|
5532
5426
|
workspaceLoadProblem: void 0,
|
|
5533
5427
|
workspaceLoading: false
|
|
@@ -5591,27 +5485,12 @@ var WorkspaceStore = class {
|
|
|
5591
5485
|
if (current() && this.#model.value.flowId == flowId) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5592
5486
|
}
|
|
5593
5487
|
}
|
|
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
5488
|
selectNodes(nodeIds) {
|
|
5610
5489
|
if (nodeIds.length == this.#model.value.selectedNodeIds.length && nodeIds.every((nodeId, index) => nodeId == this.#model.value.selectedNodeIds[index])) return true;
|
|
5611
5490
|
this.#modules.flush();
|
|
5612
5491
|
this.#set({
|
|
5613
5492
|
diagnosticFocus: void 0,
|
|
5614
|
-
moduleEditor: selectedModuleEditor(this.#model.value.draft == null ? void 0 : revisionView(this.#model.value.draft),
|
|
5493
|
+
moduleEditor: selectedModuleEditor(this.#model.value.draft == null ? void 0 : revisionView(this.#model.value.draft), nodeIds),
|
|
5615
5494
|
nodeFocus: void 0,
|
|
5616
5495
|
selectedNodeIds: nodeIds
|
|
5617
5496
|
});
|
|
@@ -5655,24 +5534,6 @@ var WorkspaceStore = class {
|
|
|
5655
5534
|
this.#set({ busy: void 0 });
|
|
5656
5535
|
}
|
|
5657
5536
|
}
|
|
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
5537
|
async renameFlow(flowId, name) {
|
|
5677
5538
|
const flow = this.#flows.flow(flowId);
|
|
5678
5539
|
const nextName = name.trim();
|
|
@@ -5697,12 +5558,11 @@ var WorkspaceStore = class {
|
|
|
5697
5558
|
async addNode(option, position, connection) {
|
|
5698
5559
|
if (!await this.saveModuleEditor()) return;
|
|
5699
5560
|
const draft = this.#model.value.draft;
|
|
5700
|
-
|
|
5701
|
-
if (draft == null || target == null) return;
|
|
5561
|
+
if (draft == null) return;
|
|
5702
5562
|
const nodeId = this.#identity();
|
|
5703
|
-
if (option.kind == "comment") return await this.#addComment(
|
|
5563
|
+
if (option.kind == "comment") return await this.#addComment(nodeId, position);
|
|
5704
5564
|
const revision = revisionView(draft);
|
|
5705
|
-
let intent = addNodeIntent(option, revision,
|
|
5565
|
+
let intent = addNodeIntent(option, revision, this.#i18n.t);
|
|
5706
5566
|
if (intent == null) return;
|
|
5707
5567
|
if (intent.kind == "provider-trigger" && intent.connectionId == null) {
|
|
5708
5568
|
try {
|
|
@@ -5715,17 +5575,17 @@ var WorkspaceStore = class {
|
|
|
5715
5575
|
} catch (error) {
|
|
5716
5576
|
if (!this.#disposed && this.#model.value.draft == draft) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5717
5577
|
}
|
|
5718
|
-
if (this.#disposed || this.#model.value.draft != draft
|
|
5578
|
+
if (this.#disposed || this.#model.value.draft != draft) return;
|
|
5719
5579
|
}
|
|
5720
5580
|
const edge = connection?.(nodeId);
|
|
5721
|
-
const nodeChanges = addNode(revision,
|
|
5581
|
+
const nodeChanges = addNode(revision, nodeId, intent);
|
|
5722
5582
|
if (nodeChanges == null) return;
|
|
5723
|
-
const changes = edge == null ? nodeChanges : [...nodeChanges, ...connect(applyFlowChanges(draft, nodeChanges).content,
|
|
5583
|
+
const changes = edge == null ? nodeChanges : [...nodeChanges, ...connect(applyFlowChanges(draft, nodeChanges).content, {
|
|
5724
5584
|
source: edge.source,
|
|
5725
5585
|
target: edge.target,
|
|
5726
5586
|
...edge.sourceHandle.startsWith("$branch:") ? { sourceHandle: edge.sourceHandle.slice(8) } : {}
|
|
5727
5587
|
})];
|
|
5728
|
-
if (!await this.#canvasChange("add", 1, changes, (value) => setNodePositions(value,
|
|
5588
|
+
if (!await this.#canvasChange("add", 1, changes, (value) => setNodePositions(value, { [nodeId]: position }), [nodeId])) return;
|
|
5729
5589
|
if (this.#disposed) return;
|
|
5730
5590
|
this.#set({ nodeFocus: {
|
|
5731
5591
|
nodeId,
|
|
@@ -5735,9 +5595,8 @@ var WorkspaceStore = class {
|
|
|
5735
5595
|
}
|
|
5736
5596
|
async connect(edge) {
|
|
5737
5597
|
const revision = this.$.revision.value;
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
const changes = connect(revision.revision.content, target, {
|
|
5598
|
+
if (revision == null) return;
|
|
5599
|
+
const changes = connect(revision.revision.content, {
|
|
5741
5600
|
source: edge.source,
|
|
5742
5601
|
target: edge.target,
|
|
5743
5602
|
...edge.sourceHandle.startsWith("$branch:") ? { sourceHandle: edge.sourceHandle.slice(8) } : {}
|
|
@@ -5746,9 +5605,8 @@ var WorkspaceStore = class {
|
|
|
5746
5605
|
}
|
|
5747
5606
|
async disconnect(edge) {
|
|
5748
5607
|
const revision = this.$.revision.value;
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
const changes = disconnect(revision.revision.content, target, {
|
|
5608
|
+
if (revision == null) return;
|
|
5609
|
+
const changes = disconnect(revision.revision.content, {
|
|
5752
5610
|
source: edge.source,
|
|
5753
5611
|
target: edge.target,
|
|
5754
5612
|
...edge.sourceHandle.startsWith("$branch:") ? { sourceHandle: edge.sourceHandle.slice(8) } : {}
|
|
@@ -5758,22 +5616,20 @@ var WorkspaceStore = class {
|
|
|
5758
5616
|
async deleteSelectedNodes() {
|
|
5759
5617
|
if (!await this.saveModuleEditor()) return;
|
|
5760
5618
|
const revision = this.$.revision.value;
|
|
5761
|
-
|
|
5762
|
-
if (revision == null || target == null || this.#model.value.selectedNodeIds.length == 0) return;
|
|
5619
|
+
if (revision == null || this.#model.value.selectedNodeIds.length == 0) return;
|
|
5763
5620
|
const selectedNodeIds = [...this.#model.value.selectedNodeIds];
|
|
5764
|
-
const comments = commentIds(this.#model.value.presentation?.value ?? {}
|
|
5621
|
+
const comments = commentIds(this.#model.value.presentation?.value ?? {});
|
|
5765
5622
|
const commentNodes = new Set(this.#model.value.selectedNodeIds.filter((nodeId) => comments.has(nodeId)));
|
|
5766
|
-
const changes = deleteSelection(revision,
|
|
5623
|
+
const changes = deleteSelection(revision, this.#model.value.selectedNodeIds);
|
|
5767
5624
|
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,
|
|
5625
|
+
let next = commentNodes.size == 0 ? value : removeComments(value, commentNodes);
|
|
5626
|
+
for (const nodeId of selectedNodeIds) next = setNodeContentHidden(next, nodeId, false);
|
|
5770
5627
|
return next;
|
|
5771
5628
|
}, []);
|
|
5772
5629
|
}
|
|
5773
5630
|
copySelectedNodes() {
|
|
5774
5631
|
const revision = this.$.revision.value;
|
|
5775
|
-
|
|
5776
|
-
if (revision == null || target == null || this.#model.value.selectedNodeIds.length == 0) return;
|
|
5632
|
+
if (revision == null || this.#model.value.selectedNodeIds.length == 0) return;
|
|
5777
5633
|
const selected = new Set(this.#model.value.selectedNodeIds);
|
|
5778
5634
|
this.#clipboard = {
|
|
5779
5635
|
hiddenNodeIds: this.#designer().nodes.flatMap((node) => node.contentHidden && selected.has(node.id) ? [node.id] : []),
|
|
@@ -5783,16 +5639,15 @@ var WorkspaceStore = class {
|
|
|
5783
5639
|
sourceId: node.id,
|
|
5784
5640
|
title: node.title
|
|
5785
5641
|
}] : []),
|
|
5786
|
-
nodes: copyNodes(revision,
|
|
5642
|
+
nodes: copyNodes(revision, this.#model.value.selectedNodeIds)
|
|
5787
5643
|
};
|
|
5788
5644
|
}
|
|
5789
5645
|
async pasteNodes(sourcePositions, offset = PASTE_OFFSET) {
|
|
5790
5646
|
if (!await this.saveModuleEditor()) return;
|
|
5791
5647
|
const revision = this.$.revision.value;
|
|
5792
|
-
|
|
5793
|
-
if (revision == null || target == null || this.#clipboard == null) return;
|
|
5648
|
+
if (revision == null || this.#clipboard == null) return;
|
|
5794
5649
|
const hiddenNodeIds = new Set(this.#clipboard.hiddenNodeIds);
|
|
5795
|
-
const pasted = pasteNodes(revision,
|
|
5650
|
+
const pasted = pasteNodes(revision, this.#clipboard.nodes, this.#identity);
|
|
5796
5651
|
const comments = this.#clipboard.comments.map((comment) => ({
|
|
5797
5652
|
...comment,
|
|
5798
5653
|
nodeId: this.#identity()
|
|
@@ -5815,11 +5670,11 @@ var WorkspaceStore = class {
|
|
|
5815
5670
|
}];
|
|
5816
5671
|
}));
|
|
5817
5672
|
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,
|
|
5673
|
+
let next = setNodePositions(value, positions);
|
|
5674
|
+
for (const [index, sourceId] of pasted.sourceIds.entries()) if (hiddenNodeIds.has(sourceId)) next = setNodeContentHidden(next, pasted.nodeIds[index], true);
|
|
5820
5675
|
for (const comment of comments) {
|
|
5821
|
-
if (hiddenNodeIds.has(comment.sourceId)) next = setNodeContentHidden(next,
|
|
5822
|
-
next = setComment(next,
|
|
5676
|
+
if (hiddenNodeIds.has(comment.sourceId)) next = setNodeContentHidden(next, comment.nodeId, true);
|
|
5677
|
+
next = setComment(next, comment.nodeId, {
|
|
5823
5678
|
content: comment.content,
|
|
5824
5679
|
position: {
|
|
5825
5680
|
x: comment.position.x + offset.x * step,
|
|
@@ -5836,7 +5691,7 @@ var WorkspaceStore = class {
|
|
|
5836
5691
|
await this.pasteNodes(positions, offset);
|
|
5837
5692
|
}
|
|
5838
5693
|
async saveErrorSources(nodeId, value) {
|
|
5839
|
-
const node = this.$.revision.value?.graph(
|
|
5694
|
+
const node = this.$.revision.value?.graph()?.nodes[nodeId];
|
|
5840
5695
|
if (node?.kind != "error" || dequal$1(node.sourceFlowIds ?? [], value)) return false;
|
|
5841
5696
|
return await this.#editDraft([{
|
|
5842
5697
|
kind: "graph.trigger.sources.set",
|
|
@@ -5847,50 +5702,43 @@ var WorkspaceStore = class {
|
|
|
5847
5702
|
}
|
|
5848
5703
|
async saveNodeSettings(nodeId, settings) {
|
|
5849
5704
|
const revision = this.$.revision.value;
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
const changes = updateNodeSettings(revision, target, nodeId, settings);
|
|
5705
|
+
if (revision == null) return false;
|
|
5706
|
+
const changes = updateNodeSettings(revision, nodeId, settings);
|
|
5853
5707
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5854
5708
|
}
|
|
5855
5709
|
async saveNodeDescription(nodeId, description) {
|
|
5856
5710
|
const revision = this.$.revision.value;
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
const changes = updateNodeDescription(revision, target, nodeId, description);
|
|
5711
|
+
if (revision == null) return false;
|
|
5712
|
+
const changes = updateNodeDescription(revision, nodeId, description);
|
|
5860
5713
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5861
5714
|
}
|
|
5862
5715
|
async saveNodeIcon(nodeId, icon) {
|
|
5863
5716
|
const revision = this.$.revision.value;
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
const changes = updateNodeIcon(revision, target, nodeId, icon);
|
|
5717
|
+
if (revision == null) return false;
|
|
5718
|
+
const changes = updateNodeIcon(revision, nodeId, icon);
|
|
5867
5719
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5868
5720
|
}
|
|
5869
5721
|
async saveNodeTitle(nodeId, title) {
|
|
5870
5722
|
const revision = this.$.revision.value;
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
const changes = updateNodeName(revision, target, nodeId, title);
|
|
5723
|
+
if (revision == null) return false;
|
|
5724
|
+
const changes = updateNodeName(revision, nodeId, title);
|
|
5874
5725
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5875
5726
|
}
|
|
5876
5727
|
async setInputValue(nodeId, handle, value, deletion) {
|
|
5877
5728
|
const revision = this.$.revision.value;
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
const changes = setInputValue(revision, target, nodeId, handle, value);
|
|
5729
|
+
if (revision == null) return false;
|
|
5730
|
+
const changes = setInputValue(revision, nodeId, handle, value);
|
|
5881
5731
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5882
5732
|
}
|
|
5883
5733
|
async resetInputs(nodeId, handles) {
|
|
5884
5734
|
const revision = this.$.revision.value;
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
return await this.#editDraft(resetInputValues(revision.revision.content, target, nodeId, handles)) != null;
|
|
5735
|
+
if (revision == null) return false;
|
|
5736
|
+
return await this.#editDraft(resetInputValues(revision.revision.content, nodeId, handles)) != null;
|
|
5888
5737
|
}
|
|
5889
5738
|
async resetTriggerConfig(triggerId, names) {
|
|
5890
5739
|
const revision = this.$.revision.value;
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
const trigger = revision.graph(target)?.nodes[triggerId];
|
|
5740
|
+
if (revision == null) return false;
|
|
5741
|
+
const trigger = revision.graph()?.nodes[triggerId];
|
|
5894
5742
|
if (trigger?.kind !== "poll" && trigger?.kind !== "integration") return false;
|
|
5895
5743
|
const changes = (names == null ? Object.entries(trigger.config) : names.flatMap((name) => Object.hasOwn(trigger.config, name) ? [[name, trigger.config[name]]] : [])).map(([name, before]) => ({
|
|
5896
5744
|
kind: "graph.trigger.config.set",
|
|
@@ -5903,53 +5751,46 @@ var WorkspaceStore = class {
|
|
|
5903
5751
|
}
|
|
5904
5752
|
async setInputSource(nodeId, handle, source) {
|
|
5905
5753
|
const revision = this.$.revision.value;
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
return await this.#editDraft(setInputSources(revision.revision.content, target, nodeId, handle, [{
|
|
5754
|
+
if (revision == null) return false;
|
|
5755
|
+
return await this.#editDraft(setInputSources(revision.revision.content, nodeId, handle, [{
|
|
5909
5756
|
kind: "node",
|
|
5910
5757
|
...source
|
|
5911
5758
|
}])) != null;
|
|
5912
5759
|
}
|
|
5913
5760
|
async setInputVariable(nodeId, handle, name) {
|
|
5914
5761
|
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());
|
|
5762
|
+
if (revision == null) return false;
|
|
5763
|
+
const changes = name == null ? setInputValue(revision, nodeId, handle, void 0) : setInputVariable(revision, nodeId, handle, name, this.#identity());
|
|
5918
5764
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5919
5765
|
}
|
|
5920
5766
|
async saveCondition(nodeId, settings, deletion) {
|
|
5921
5767
|
const revision = this.$.revision.value;
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
const changes = updateCondition(revision, target, nodeId, settings);
|
|
5768
|
+
if (revision == null) return false;
|
|
5769
|
+
const changes = updateCondition(revision, nodeId, settings);
|
|
5925
5770
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5926
5771
|
}
|
|
5927
5772
|
async saveValue(nodeId, values, deletion) {
|
|
5928
5773
|
const revision = this.$.revision.value;
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
const changes = updateValue(revision, target, nodeId, values);
|
|
5774
|
+
if (revision == null) return false;
|
|
5775
|
+
const changes = updateValue(revision, nodeId, values);
|
|
5932
5776
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5933
5777
|
}
|
|
5934
5778
|
async saveResolution(nodeId, settings, deletion, values) {
|
|
5935
5779
|
const revision = this.$.revision.value;
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
const changes = updateResolution(revision, target, nodeId, settings, values);
|
|
5780
|
+
if (revision == null) return false;
|
|
5781
|
+
const changes = updateResolution(revision, nodeId, settings, values);
|
|
5939
5782
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5940
5783
|
}
|
|
5941
5784
|
async saveNodeContentHidden(nodeId, hidden) {
|
|
5942
|
-
const target = this.#model.value.target;
|
|
5943
5785
|
const node = this.#designer().nodes.find((candidate) => candidate.id == nodeId);
|
|
5944
|
-
if (
|
|
5945
|
-
await this.#canvasChange("edit", 1, [], (value) => setNodeContentHidden(value,
|
|
5786
|
+
if (node == null || node.kind == "condition") return;
|
|
5787
|
+
await this.#canvasChange("edit", 1, [], (value) => setNodeContentHidden(value, nodeId, hidden));
|
|
5946
5788
|
}
|
|
5947
5789
|
async saveComment(nodeId, comment) {
|
|
5948
|
-
|
|
5949
|
-
if (target == null) return;
|
|
5790
|
+
if (this.#model.value.draft == null) return;
|
|
5950
5791
|
const position = this.#designer().nodes.find((node) => node.id == nodeId)?.position;
|
|
5951
5792
|
if (position == null) return;
|
|
5952
|
-
await this.#canvasChange("edit", 1, [], (value) => setComment(value,
|
|
5793
|
+
await this.#canvasChange("edit", 1, [], (value) => setComment(value, nodeId, {
|
|
5953
5794
|
...comment,
|
|
5954
5795
|
position
|
|
5955
5796
|
}));
|
|
@@ -5959,36 +5800,32 @@ var WorkspaceStore = class {
|
|
|
5959
5800
|
}
|
|
5960
5801
|
async saveTaskSettings(nodeId, settings, deletion) {
|
|
5961
5802
|
const revision = this.$.revision.value;
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
const changes = updateTask(revision, target, nodeId, settings);
|
|
5803
|
+
if (revision == null) return false;
|
|
5804
|
+
const changes = updateTask(revision, nodeId, settings);
|
|
5965
5805
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5966
5806
|
}
|
|
5967
5807
|
async saveTaskPorts(nodeId, ports, deletion, values) {
|
|
5968
5808
|
const revision = this.$.revision.value;
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
const changes = updateTaskPorts(revision, target, nodeId, ports, values);
|
|
5809
|
+
if (revision == null) return false;
|
|
5810
|
+
const changes = updateTaskPorts(revision, nodeId, ports, values);
|
|
5972
5811
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5973
5812
|
}
|
|
5974
5813
|
async saveTaskAdditionalInputs(nodeId, inputs, deletion, values) {
|
|
5975
5814
|
const revision = this.$.revision.value;
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
const changes = updateTaskAdditionalInputs(revision, target, nodeId, inputs, values);
|
|
5815
|
+
if (revision == null) return false;
|
|
5816
|
+
const changes = updateTaskAdditionalInputs(revision, nodeId, inputs, values);
|
|
5979
5817
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
5980
5818
|
}
|
|
5981
|
-
async setConnectorConnection(
|
|
5819
|
+
async setConnectorConnection(nodeId, connectionId) {
|
|
5982
5820
|
const revision = this.$.revision.value;
|
|
5983
5821
|
if (revision == null) return false;
|
|
5984
|
-
const changes = setConnectorConnection(revision.revision.content,
|
|
5822
|
+
const changes = setConnectorConnection(revision.revision.content, nodeId, connectionId);
|
|
5985
5823
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5986
5824
|
}
|
|
5987
5825
|
async setCodeActions(nodeId, capabilities) {
|
|
5988
5826
|
const revision = this.$.revision.value;
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
const changes = setCodeActions(revision.revision.content, target, nodeId, capabilities);
|
|
5827
|
+
if (revision == null) return false;
|
|
5828
|
+
const changes = setCodeActions(revision.revision.content, nodeId, capabilities);
|
|
5992
5829
|
return changes == null || await this.#editDraft(changes) != null;
|
|
5993
5830
|
}
|
|
5994
5831
|
get eventSourceClient() {
|
|
@@ -6001,19 +5838,18 @@ var WorkspaceStore = class {
|
|
|
6001
5838
|
}
|
|
6002
5839
|
async setTriggerEventSource(triggerId, source) {
|
|
6003
5840
|
const revision = this.$.revision.value;
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
const trigger = revision.graph(target)?.nodes[triggerId];
|
|
5841
|
+
if (revision == null) return false;
|
|
5842
|
+
const trigger = revision.graph()?.nodes[triggerId];
|
|
6007
5843
|
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,
|
|
5844
|
+
const connectionChanges = setTriggerConnection(revision.revision.content, triggerId, source.connectionId);
|
|
6009
5845
|
if (connectionChanges == null) return false;
|
|
6010
5846
|
const changed = inputValue(trigger.config.sourceId, void 0) != source.sourceId;
|
|
6011
5847
|
return await this.#editDraft([
|
|
6012
5848
|
...connectionChanges,
|
|
6013
|
-
...updateTriggerConfig(revision.revision.content,
|
|
6014
|
-
...changed ? updateTriggerConfig(revision.revision.content,
|
|
6015
|
-
...changed ? updateTriggerConfig(revision.revision.content,
|
|
6016
|
-
...changed ? updateTriggerConfig(revision.revision.content,
|
|
5849
|
+
...updateTriggerConfig(revision.revision.content, triggerId, "sourceId", source.sourceId) ?? [],
|
|
5850
|
+
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "eventTypes", void 0) ?? [] : [],
|
|
5851
|
+
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "resource", void 0) ?? [] : [],
|
|
5852
|
+
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "chatIds", void 0) ?? [] : []
|
|
6017
5853
|
]) != null;
|
|
6018
5854
|
}
|
|
6019
5855
|
async loadTriggerConfigOptions(triggerId, field, signal) {
|
|
@@ -6026,50 +5862,40 @@ var WorkspaceStore = class {
|
|
|
6026
5862
|
}
|
|
6027
5863
|
async saveTriggerConfig(triggerId, name, value) {
|
|
6028
5864
|
const revision = this.$.revision.value;
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
let changes = updateTriggerConfig(revision.revision.content, target, triggerId, name, value);
|
|
5865
|
+
if (revision == null) return false;
|
|
5866
|
+
let changes = updateTriggerConfig(revision.revision.content, triggerId, name, value);
|
|
6032
5867
|
if (changes == null) return false;
|
|
6033
|
-
const trigger = revision.graph(
|
|
5868
|
+
const trigger = revision.graph()?.nodes[triggerId];
|
|
6034
5869
|
if (changes.length > 0 && trigger?.kind == "integration" && trigger.definition.key == "feishu_app_bot.on_event" && name == "eventTypes") {
|
|
6035
5870
|
const events = Array.isArray(value) ? value.filter((item) => typeof item == "string") : [];
|
|
6036
|
-
if (!supportsFeishuChatFilter(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content,
|
|
5871
|
+
if (!supportsFeishuChatFilter(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content, triggerId, "chatIds", void 0) ?? []];
|
|
6037
5872
|
const resource = inputValue(trigger.config.resource, void 0);
|
|
6038
|
-
if (isJsonObject(resource) && resource.kind != feishuResourceKind(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content,
|
|
5873
|
+
if (isJsonObject(resource) && resource.kind != feishuResourceKind(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content, triggerId, "resource", void 0) ?? []];
|
|
6039
5874
|
}
|
|
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,
|
|
5875
|
+
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
5876
|
return await this.#editDraft(changes) != null;
|
|
6042
5877
|
}
|
|
6043
5878
|
async saveTriggerSchedule(triggerId, schedule) {
|
|
6044
5879
|
const revision = this.$.revision.value;
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
const changes = updateTriggerSchedule(revision.revision.content, target, triggerId, schedule);
|
|
5880
|
+
if (revision == null) return false;
|
|
5881
|
+
const changes = updateTriggerSchedule(revision.revision.content, triggerId, schedule);
|
|
6048
5882
|
return changes != null && await this.#editDraft(changes) != null;
|
|
6049
5883
|
}
|
|
6050
5884
|
async saveWebhook(triggerId, settings, deletion) {
|
|
6051
5885
|
const revision = this.$.revision.value;
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
const changes = updateWebhook(revision, target, triggerId, settings);
|
|
5886
|
+
if (revision == null) return false;
|
|
5887
|
+
const changes = updateWebhook(revision, triggerId, settings);
|
|
6055
5888
|
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6056
5889
|
}
|
|
6057
5890
|
async setTriggerConnection(triggerId, connectionId) {
|
|
6058
5891
|
const revision = this.$.revision.value;
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
const changes = setTriggerConnection(revision.revision.content, target, triggerId, connectionId);
|
|
5892
|
+
if (revision == null) return false;
|
|
5893
|
+
const changes = setTriggerConnection(revision.revision.content, triggerId, connectionId);
|
|
6062
5894
|
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,
|
|
5895
|
+
const trigger = revision.graph()?.nodes[triggerId];
|
|
5896
|
+
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
5897
|
return await this.#editDraft(changes) != null;
|
|
6066
5898
|
}
|
|
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
5899
|
updateModuleSource(source) {
|
|
6074
5900
|
const editor = this.#model.value.moduleEditor;
|
|
6075
5901
|
if (this.#history.applying || this.#history.failed || editor == null || editor.source == source) return;
|
|
@@ -6091,17 +5917,15 @@ var WorkspaceStore = class {
|
|
|
6091
5917
|
return this.#modules.saveModuleEditor();
|
|
6092
5918
|
}
|
|
6093
5919
|
async moveNodes(positions) {
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
await this.#canvasChange("move", Object.keys(positions).length, [], (value) => setNodePositions(value, target, positions));
|
|
5920
|
+
if (this.#model.value.draft == null) return;
|
|
5921
|
+
await this.#canvasChange("move", Object.keys(positions).length, [], (value) => setNodePositions(value, positions));
|
|
6097
5922
|
}
|
|
6098
5923
|
async moveViewport(viewport) {
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
await this.#changePresentation((value) => setFlowViewport(value, target, viewport), true);
|
|
5924
|
+
if (this.#model.value.draft == null) return;
|
|
5925
|
+
await this.#changePresentation((value) => setFlowViewport(value, viewport), true);
|
|
6102
5926
|
}
|
|
6103
5927
|
async check() {
|
|
6104
|
-
await this.#
|
|
5928
|
+
await this.#checkDraft();
|
|
6105
5929
|
}
|
|
6106
5930
|
async refreshFlows() {
|
|
6107
5931
|
await this.reloadFlows();
|
|
@@ -6111,9 +5935,8 @@ var WorkspaceStore = class {
|
|
|
6111
5935
|
}
|
|
6112
5936
|
locateNode(nodeId, { preserveSelection = false } = {}) {
|
|
6113
5937
|
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;
|
|
5938
|
+
if (revision == null) return false;
|
|
5939
|
+
if (revision.node(nodeId) == null && !commentIds(this.#model.value.presentation?.value ?? {}).has(nodeId)) return false;
|
|
6117
5940
|
if (!preserveSelection && !this.selectNodes([nodeId])) return false;
|
|
6118
5941
|
this.#set({ nodeFocus: {
|
|
6119
5942
|
nodeId,
|
|
@@ -6130,13 +5953,13 @@ var WorkspaceStore = class {
|
|
|
6130
5953
|
} });
|
|
6131
5954
|
return true;
|
|
6132
5955
|
}
|
|
6133
|
-
async #addComment(
|
|
5956
|
+
async #addComment(nodeId, position) {
|
|
6134
5957
|
const number = Math.max(0, ...this.#designer().nodes.flatMap((node) => {
|
|
6135
5958
|
if (node.kind != "comment") return [];
|
|
6136
5959
|
const match = /#(\d+)$/.exec(node.title);
|
|
6137
5960
|
return match == null ? [] : [Number(match[1])];
|
|
6138
5961
|
}));
|
|
6139
|
-
if (!await this.#canvasChange("add", 1, [], (value) => setComment(value,
|
|
5962
|
+
if (!await this.#canvasChange("add", 1, [], (value) => setComment(value, nodeId, {
|
|
6140
5963
|
content: "",
|
|
6141
5964
|
position,
|
|
6142
5965
|
title: this.#i18n.t("addNode.commentName", { number: number + 1 })
|
|
@@ -6201,17 +6024,17 @@ var WorkspaceStore = class {
|
|
|
6201
6024
|
if (draft == null) return;
|
|
6202
6025
|
const repairs = repairNodeNames(draft.content);
|
|
6203
6026
|
if (repairs.length == 0) {
|
|
6204
|
-
this.#
|
|
6027
|
+
this.#checkDraft();
|
|
6205
6028
|
return;
|
|
6206
6029
|
}
|
|
6207
6030
|
if (await this.#changeDraft(repairs, false) != null || !current()) return;
|
|
6208
6031
|
if (this.#model.value.draft?.revisionId == draft.revisionId) break;
|
|
6209
6032
|
}
|
|
6210
|
-
if (current()) this.#
|
|
6033
|
+
if (current()) this.#checkDraft();
|
|
6211
6034
|
}
|
|
6212
6035
|
#applyDraft(draft, origin) {
|
|
6213
6036
|
const previousDraft = this.#model.value.draft;
|
|
6214
|
-
const { revision, selectedNodeIds
|
|
6037
|
+
const { revision, selectedNodeIds } = this.#reconcileRevision(draft);
|
|
6215
6038
|
const editor = this.#model.value.moduleEditor;
|
|
6216
6039
|
const keepEditor = editor != null && (origin == "external" || previousDraft != null) && moduleEditorStatus(previousDraft, editor) != "saved";
|
|
6217
6040
|
let moduleEditor;
|
|
@@ -6219,12 +6042,11 @@ var WorkspaceStore = class {
|
|
|
6219
6042
|
...editor,
|
|
6220
6043
|
phase: "failed"
|
|
6221
6044
|
} : editor;
|
|
6222
|
-
else moduleEditor = selectedModuleEditor(revision,
|
|
6045
|
+
else moduleEditor = selectedModuleEditor(revision, selectedNodeIds);
|
|
6223
6046
|
this.#set({
|
|
6224
6047
|
draft,
|
|
6225
6048
|
moduleEditor,
|
|
6226
|
-
selectedNodeIds
|
|
6227
|
-
target
|
|
6049
|
+
selectedNodeIds
|
|
6228
6050
|
});
|
|
6229
6051
|
return keepEditor;
|
|
6230
6052
|
}
|
|
@@ -6255,10 +6077,10 @@ var WorkspaceStore = class {
|
|
|
6255
6077
|
}
|
|
6256
6078
|
async #canvasChange(action, count, changes, update, selection = this.#model.value.selectedNodeIds, deletion) {
|
|
6257
6079
|
if (this.#disposed || this.#history.applying || this.#history.failed) return false;
|
|
6258
|
-
const { draft,
|
|
6259
|
-
if (draft == null ||
|
|
6080
|
+
const { draft, presentation, selectedNodeIds } = this.#model.value;
|
|
6081
|
+
if (draft == null || presentation == null) return false;
|
|
6260
6082
|
const next = update?.(presentation.value) ?? presentation.value;
|
|
6261
|
-
const presentationChange = canvasPresentationChange(presentation.value, next
|
|
6083
|
+
const presentationChange = canvasPresentationChange(presentation.value, next);
|
|
6262
6084
|
if (dequal$1(applyFlowChanges(draft, changes).content, draft.content) && presentationChange.nodeIds.length == 0) return true;
|
|
6263
6085
|
const generation = this.#history.generation;
|
|
6264
6086
|
const inverse = inverseFlowChanges(draft.content, changes);
|
|
@@ -6266,7 +6088,6 @@ var WorkspaceStore = class {
|
|
|
6266
6088
|
const entry = {
|
|
6267
6089
|
action,
|
|
6268
6090
|
count,
|
|
6269
|
-
target,
|
|
6270
6091
|
forward: changes,
|
|
6271
6092
|
inverse,
|
|
6272
6093
|
presentation: presentationChange,
|
|
@@ -6311,7 +6132,7 @@ var WorkspaceStore = class {
|
|
|
6311
6132
|
this.#history.applying = true;
|
|
6312
6133
|
this.#history.publish();
|
|
6313
6134
|
try {
|
|
6314
|
-
const [draft, presentation] = await Promise.all([this.#changeDraft(redo ? entry.forward : entry.inverse, true, "canvas"), this.#changePresentation((value) => restoreCanvasPresentation(value, entry.
|
|
6135
|
+
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
6136
|
if (draft != null && presentation && generation == this.#history.generation) {
|
|
6316
6137
|
this.selectNodes(redo ? entry.afterSelection : entry.beforeSelection);
|
|
6317
6138
|
this.#history.complete(redo);
|
|
@@ -6341,13 +6162,13 @@ var WorkspaceStore = class {
|
|
|
6341
6162
|
this.#presentationChanges.reset(presentation);
|
|
6342
6163
|
this.#applyDraft(draft, "external");
|
|
6343
6164
|
this.#set({ presentation });
|
|
6344
|
-
this.#flows.advanceHead(flowId, draft.revisionId);
|
|
6165
|
+
this.#flows.advanceHead(flowId, draft.revisionId, draft.content);
|
|
6345
6166
|
this.#history.failed = false;
|
|
6346
6167
|
this.#setNotice({
|
|
6347
6168
|
kind: "error",
|
|
6348
6169
|
message: this.#i18n.t("history.resynced")
|
|
6349
6170
|
});
|
|
6350
|
-
this.#
|
|
6171
|
+
this.#checkDraft();
|
|
6351
6172
|
} catch {
|
|
6352
6173
|
if (current() && !this.#disposed) this.#setNotice({
|
|
6353
6174
|
kind: "error",
|
|
@@ -6361,13 +6182,12 @@ var WorkspaceStore = class {
|
|
|
6361
6182
|
});
|
|
6362
6183
|
return this.#historyRecovery;
|
|
6363
6184
|
}
|
|
6364
|
-
async #
|
|
6185
|
+
async #checkDraft() {
|
|
6365
6186
|
if (this.#disposed) return;
|
|
6366
6187
|
const flowId = this.#model.value.flowId;
|
|
6367
6188
|
const draft = this.#model.value.draft;
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
if (target == null) this.#set({
|
|
6189
|
+
if (flowId == null || draft == null) {
|
|
6190
|
+
if (this.#model.value.draft == null) this.#set({
|
|
6371
6191
|
checkLoading: false,
|
|
6372
6192
|
diagnostics: void 0
|
|
6373
6193
|
});
|
|
@@ -6432,12 +6252,12 @@ var WorkspaceStore = class {
|
|
|
6432
6252
|
});
|
|
6433
6253
|
const draft = this.#draftChanges.replaceCommitted(committed);
|
|
6434
6254
|
const preserveModuleEditor = this.#applyDraft(draft, "external");
|
|
6435
|
-
this.#flows.advanceHead(context.flowId, committed.revisionId);
|
|
6255
|
+
this.#flows.advanceHead(context.flowId, committed.revisionId, committed.content);
|
|
6436
6256
|
if (notifyUpdate) this.#setNotice({
|
|
6437
6257
|
kind: preserveModuleEditor ? "error" : "success",
|
|
6438
6258
|
message: this.#i18n.t(preserveModuleEditor ? "notice.moduleUpdated" : "notice.draftUpdated")
|
|
6439
6259
|
});
|
|
6440
|
-
this.#
|
|
6260
|
+
this.#checkDraft();
|
|
6441
6261
|
return true;
|
|
6442
6262
|
} catch (error) {
|
|
6443
6263
|
if (reportError && this.#isDraftChangeCurrent(context)) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
@@ -6446,15 +6266,13 @@ var WorkspaceStore = class {
|
|
|
6446
6266
|
}
|
|
6447
6267
|
#designer() {
|
|
6448
6268
|
const state = this.#model.value;
|
|
6449
|
-
return designerGraph(state.draft, state.
|
|
6269
|
+
return designerGraph(state.draft, state.presentation?.value, state.diagnostics?.diagnostics, {}, {}, this.#i18n.t);
|
|
6450
6270
|
}
|
|
6451
6271
|
#reconcileRevision(draft) {
|
|
6452
6272
|
const revision = revisionView(draft);
|
|
6453
|
-
const target = reconcileTarget(revision, this.#model.value.target);
|
|
6454
6273
|
return {
|
|
6455
6274
|
revision,
|
|
6456
|
-
selectedNodeIds: this.#model.value.selectedNodeIds.filter((nodeId) =>
|
|
6457
|
-
target
|
|
6275
|
+
selectedNodeIds: this.#model.value.selectedNodeIds.filter((nodeId) => revision.selection(nodeId) != null)
|
|
6458
6276
|
};
|
|
6459
6277
|
}
|
|
6460
6278
|
#isDraftChangeCurrent(context) {
|
|
@@ -6474,11 +6292,11 @@ var WorkspaceStore = class {
|
|
|
6474
6292
|
function indexNodes(designer) {
|
|
6475
6293
|
return new Map(designer.nodes.map((node) => [node.id, node]));
|
|
6476
6294
|
}
|
|
6477
|
-
function designerRevisionInputs(draft
|
|
6478
|
-
return draft == null
|
|
6295
|
+
function designerRevisionInputs(draft) {
|
|
6296
|
+
return draft == null ? [] : revisionView(draft).designerInputs();
|
|
6479
6297
|
}
|
|
6480
|
-
function indexRunEventNodes(draft,
|
|
6481
|
-
if (draft == null ||
|
|
6298
|
+
function indexRunEventNodes(draft, run, events, nodes) {
|
|
6299
|
+
if (draft == null || run?.revisionId != draft.revisionId || run.flowId != draft.flowId) return /* @__PURE__ */ new Map();
|
|
6482
6300
|
const scopeId = events.find((event) => event.kind == "run.started" && event.payload.flowId == draft.flowId)?.payload.scopeId;
|
|
6483
6301
|
if (typeof scopeId != "string") return /* @__PURE__ */ new Map();
|
|
6484
6302
|
return new Map(events.flatMap((event) => {
|
|
@@ -6572,15 +6390,14 @@ var WorkbenchStore = class {
|
|
|
6572
6390
|
valid: false
|
|
6573
6391
|
};
|
|
6574
6392
|
});
|
|
6575
|
-
|
|
6393
|
+
let designerCache;
|
|
6576
6394
|
let designerFlowId;
|
|
6577
6395
|
const designer = compute((get) => {
|
|
6578
6396
|
const draft = get(this.workspace.$.draft);
|
|
6579
6397
|
if (designerFlowId != draft?.flowId) {
|
|
6580
|
-
designerCache
|
|
6398
|
+
designerCache = void 0;
|
|
6581
6399
|
designerFlowId = draft?.flowId;
|
|
6582
6400
|
}
|
|
6583
|
-
const target = get(this.workspace.$.target);
|
|
6584
6401
|
const presentation = get(this.workspace.$.presentation)?.value;
|
|
6585
6402
|
const designerDiagnostics = get(diagnostics)?.diagnostics ?? get(this.connectors.$.diagnostics);
|
|
6586
6403
|
const providerEntries = draft == null ? void 0 : get(resourceData(this.workspace.catalogs.providers.get(draft.flowId, i18n.lang)));
|
|
@@ -6590,10 +6407,9 @@ var WorkbenchStore = class {
|
|
|
6590
6407
|
const t = get(i18n.t$);
|
|
6591
6408
|
const run = get(this.runs.$.run);
|
|
6592
6409
|
const events = get(this.runs.$.events);
|
|
6593
|
-
const key = target == null ? "" : target.kind == "flow" ? "flow" : `subflow:${target.id}`;
|
|
6594
6410
|
const inputs = [
|
|
6595
|
-
...designerRevisionInputs(draft
|
|
6596
|
-
presentation == null
|
|
6411
|
+
...designerRevisionInputs(draft),
|
|
6412
|
+
presentation == null ? void 0 : flowPresentation(presentation),
|
|
6597
6413
|
designerDiagnostics,
|
|
6598
6414
|
actions,
|
|
6599
6415
|
providerEntries,
|
|
@@ -6603,24 +6419,23 @@ var WorkbenchStore = class {
|
|
|
6603
6419
|
events,
|
|
6604
6420
|
...run == null ? [] : [draft?.revisionId]
|
|
6605
6421
|
];
|
|
6606
|
-
const cached = designerCache
|
|
6422
|
+
const cached = designerCache;
|
|
6607
6423
|
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
|
|
6424
|
+
const graph = designerGraph(draft, presentation, designerDiagnostics, actions, catalogs, t, run, events, providerCatalog);
|
|
6425
|
+
designerCache = {
|
|
6610
6426
|
graph,
|
|
6611
6427
|
inputs
|
|
6612
|
-
}
|
|
6428
|
+
};
|
|
6613
6429
|
return graph;
|
|
6614
6430
|
});
|
|
6615
6431
|
const designerNodeById = derive(designer, indexNodes);
|
|
6616
6432
|
this.$ = {
|
|
6617
6433
|
connectorSetupPending: compute((get) => {
|
|
6618
6434
|
const flowId = get(this.workspace.$.flowId);
|
|
6619
|
-
const target = get(this.workspace.$.target);
|
|
6620
6435
|
const selection = get(this.workspace.$.selection);
|
|
6621
6436
|
if (selection?.kind != "task" || selection.definition == null || !("executor" in selection.definition) || selection.definition.executor.kind != "connector") return false;
|
|
6622
6437
|
const actionId = selection.definition.executor.action;
|
|
6623
|
-
return get(this.#connectorSetups).some((setup) => setup.flowId == flowId &&
|
|
6438
|
+
return get(this.#connectorSetups).some((setup) => setup.flowId == flowId && setup.actionId == actionId && (setup.nodeId == null || setup.nodeId == selection.id));
|
|
6624
6439
|
}),
|
|
6625
6440
|
busy: compute((get) => {
|
|
6626
6441
|
const workspaceBusy = get(this.workspace.$.busy);
|
|
@@ -6633,15 +6448,14 @@ var WorkbenchStore = class {
|
|
|
6633
6448
|
}),
|
|
6634
6449
|
diagnosticItems: compute((get) => {
|
|
6635
6450
|
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$));
|
|
6451
|
+
return presentTriggerDiagnostics(diagnosticItems(revision, get(diagnostics)), revision, get(this.triggers.catalog.state).data?.display, resolveUiLanguage([i18n.lang]), get(i18n.t$));
|
|
6638
6452
|
}),
|
|
6639
6453
|
diagnostics,
|
|
6640
6454
|
designer,
|
|
6641
6455
|
designerNodeById,
|
|
6642
6456
|
sourceNodeIcons: derive(designer, (graph) => Object.fromEntries(graph.nodes.flatMap((node) => "icon" in node ? [[node.id, node.icon]] : [])), { equal: dequal }),
|
|
6643
6457
|
notice: this.#notice,
|
|
6644
|
-
runEventNodes: compute((get) => indexRunEventNodes(get(this.workspace.$.draft), get(this.
|
|
6458
|
+
runEventNodes: compute((get) => indexRunEventNodes(get(this.workspace.$.draft), get(this.runs.$.run), get(this.runs.$.events), get(designerNodeById))),
|
|
6645
6459
|
selectedDesignerNode: compute((get) => {
|
|
6646
6460
|
const selected = get(this.workspace.$.selectedNodeIds);
|
|
6647
6461
|
return selected.length == 1 ? get(designerNodeById).get(selected[0]) : void 0;
|
|
@@ -6770,7 +6584,6 @@ var WorkbenchStore = class {
|
|
|
6770
6584
|
return;
|
|
6771
6585
|
}
|
|
6772
6586
|
const flowId = this.workspace.$.flowId.value;
|
|
6773
|
-
const target = this.workspace.$.target.value;
|
|
6774
6587
|
if (option.kind == "connector") {
|
|
6775
6588
|
const { defaultConnection: _defaultConnection, ...metadata } = option.connector;
|
|
6776
6589
|
option = {
|
|
@@ -6778,9 +6591,8 @@ var WorkbenchStore = class {
|
|
|
6778
6591
|
connector: metadata
|
|
6779
6592
|
};
|
|
6780
6593
|
}
|
|
6781
|
-
const setup = option.kind == "connector" && flowId != null
|
|
6594
|
+
const setup = option.kind == "connector" && flowId != null ? {
|
|
6782
6595
|
flowId,
|
|
6783
|
-
target,
|
|
6784
6596
|
actionId: option.connector.actionId,
|
|
6785
6597
|
nodeId: void 0
|
|
6786
6598
|
} : void 0;
|
|
@@ -6792,7 +6604,7 @@ var WorkbenchStore = class {
|
|
|
6792
6604
|
if (nodeId != null && option.kind == "connector" && setup != null) {
|
|
6793
6605
|
setup.nodeId = nodeId;
|
|
6794
6606
|
this.#connectorSetups.set([...this.#connectorSetups.value]);
|
|
6795
|
-
this.#configureAddedConnector(setup.flowId,
|
|
6607
|
+
this.#configureAddedConnector(setup.flowId, nodeId, option.connector).finally(finishSetup);
|
|
6796
6608
|
finishSetup = void 0;
|
|
6797
6609
|
}
|
|
6798
6610
|
if (nodeId != null && option.kind == "trigger") this.triggers.refresh();
|
|
@@ -6804,17 +6616,17 @@ var WorkbenchStore = class {
|
|
|
6804
6616
|
finishSetup?.();
|
|
6805
6617
|
}
|
|
6806
6618
|
}
|
|
6807
|
-
async #configureAddedConnector(flowId,
|
|
6619
|
+
async #configureAddedConnector(flowId, nodeId, action) {
|
|
6808
6620
|
try {
|
|
6809
6621
|
if (this.#disposed || flowId != this.workspace.$.flowId.value) return;
|
|
6810
6622
|
const prepared = await this.prepareConnectorAction(action);
|
|
6811
6623
|
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 =
|
|
6624
|
+
const node = this.workspace.$.revision.value?.node(nodeId);
|
|
6625
|
+
if (node?.kind != "task" || "moduleId" in node.node.task) return;
|
|
6626
|
+
const executor = "executor" in node.node.task ? node.node.task.executor : void 0;
|
|
6815
6627
|
if (executor?.kind != "connector" || executor.action != action.actionId || executor.connectionId != null) return;
|
|
6816
6628
|
const connection = prepared.action.defaultConnection;
|
|
6817
|
-
if (connection != null) await this.workspace.setConnectorConnection(node.
|
|
6629
|
+
if (connection != null) await this.workspace.setConnectorConnection(node.id, connection.connectionId);
|
|
6818
6630
|
if (!this.#disposed && flowId == this.workspace.$.flowId.value) await this.connectors.refresh();
|
|
6819
6631
|
} catch (error) {
|
|
6820
6632
|
if (!this.#disposed && flowId == this.workspace.$.flowId.value) this.#notice.set(errorNotice(error, this.#i18n.t));
|
|
@@ -6891,7 +6703,7 @@ var WorkbenchStore = class {
|
|
|
6891
6703
|
async requestDraftRun(triggerId) {
|
|
6892
6704
|
const flowId = this.workspace.$.flowId.value;
|
|
6893
6705
|
if (!await this.workspace.saveDraft() || this.#disposed || flowId != this.workspace.$.flowId.value) return "unavailable";
|
|
6894
|
-
const flow = this.workspace.$.
|
|
6706
|
+
const flow = this.workspace.$.flow.value;
|
|
6895
6707
|
const draft = this.workspace.$.draft.value;
|
|
6896
6708
|
if (flow == null || draft == null) return "unavailable";
|
|
6897
6709
|
return await this.runRequests.requestDraft(flow, draft, triggerId);
|
|
@@ -6899,24 +6711,22 @@ var WorkbenchStore = class {
|
|
|
6899
6711
|
async editDraftRunInputs(triggerId) {
|
|
6900
6712
|
const flowId = this.workspace.$.flowId.value;
|
|
6901
6713
|
if (!await this.workspace.saveDraft() || this.#disposed || flowId != this.workspace.$.flowId.value) return "unavailable";
|
|
6902
|
-
const flow = this.workspace.$.
|
|
6714
|
+
const flow = this.workspace.$.flow.value;
|
|
6903
6715
|
const draft = this.workspace.$.draft.value;
|
|
6904
6716
|
if (flow == null || draft == null) return "unavailable";
|
|
6905
6717
|
return await this.runRequests.editDraft(flow, draft, triggerId);
|
|
6906
6718
|
}
|
|
6907
6719
|
async requestLiveRun() {
|
|
6908
|
-
const flow = this.workspace.$.
|
|
6720
|
+
const flow = this.workspace.$.flow.value;
|
|
6909
6721
|
if (flow == null) return "unavailable";
|
|
6910
6722
|
return await this.runRequests.requestLive(flow);
|
|
6911
6723
|
}
|
|
6912
6724
|
async #followExternalRun(client, event) {
|
|
6913
|
-
|
|
6914
|
-
if (this.#disposed || this.runRequests.$.submitting.value != null || target?.kind != "flow" || this.workspace.$.flowId.value != event.flowId) return;
|
|
6725
|
+
if (this.#disposed || this.runRequests.$.submitting.value != null || this.workspace.$.flowId.value != event.flowId) return;
|
|
6915
6726
|
const current = this.#externalRuns.begin();
|
|
6916
6727
|
try {
|
|
6917
6728
|
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;
|
|
6729
|
+
if (!current() || this.#disposed || this.workspace.$.flowId.value != event.flowId || run.flowId != event.flowId || run.runId != event.runId) return;
|
|
6920
6730
|
this.runs.followExternal(run);
|
|
6921
6731
|
} catch {
|
|
6922
6732
|
return;
|
|
@@ -6925,7 +6735,7 @@ var WorkbenchStore = class {
|
|
|
6925
6735
|
};
|
|
6926
6736
|
//#endregion
|
|
6927
6737
|
//#region src/workbench/browser/runtime/openFlowWorkbench.tsx
|
|
6928
|
-
var FlowWorkspace = lazy(() => import("./flowWorkspace-
|
|
6738
|
+
var FlowWorkspace = lazy(() => import("./flowWorkspace-MqcEfg7T.js"));
|
|
6929
6739
|
function OpenFlowSessionGate({ action, description, error, onSubmit, onTokenChange, pending = false, title, token, tokenLabel }) {
|
|
6930
6740
|
const hasToken = token != null && tokenLabel != null && onTokenChange != null;
|
|
6931
6741
|
const tokenValue = token ?? "";
|