@oomol-lab/open-flow 0.1.0-beta.67 → 0.1.0-beta.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/ContentIcon-Sx9bywU-.js +11861 -0
- package/dist/browser/FlowCanvas-CXpaeurx.js +22721 -0
- package/dist/browser/{createResourceDialog-BQVD8Rqb.js → createResourceDialog-BKmimKA_.js} +3 -2
- package/dist/browser/dialog-ZmfcwuMS.js +8785 -0
- package/dist/browser/exportSvg-D4CqCcx2.js +659 -0
- package/dist/browser/{flowChanges-VB9Y4iy7.js → flowChanges-B5tZMcGr.js} +2123 -13934
- package/dist/browser/{flowRunInputEditorStore-DJqmR6Qh.js → flowRunInputEditorStore-ys1-w9GW.js} +2 -1
- package/dist/browser/{flowWorkspace-C1hlTnZq.js → flowWorkspace-zFBFtZPo.js} +575 -23179
- package/dist/browser/languages-gYzoQqCi.js +68 -0
- package/dist/browser/licenses.md +24 -0
- package/dist/browser/preview.css +4 -0
- package/dist/browser/preview.js +1749 -1739
- package/dist/browser/{dialog-CS2Vt2if.js → tooltip-CJjYs_2I.js} +710 -9472
- package/dist/browser/ui.css +4 -0
- package/dist/browser/{value-BADHeZ9I.js → value-BbFQZZ_V.js} +1 -68
- package/dist/browser/workbench.css +2825 -2821
- package/dist/browser/workbench.js +369 -311
- package/dist/browser/{workbenchSelect-CpXhjUou.js → workbenchSelect-CChdgugI.js} +2 -1
- package/dist/command/index.js +17 -17
- package/dist/common/control-api-conformance.js +26 -3
- package/dist/common/control-api.d.ts +8 -1
- package/dist/common/control-api.js +26 -3
- package/dist/common/mcp.js +26 -3
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as DropdownMenuContent, N as DropdownMenuTrigger, T as DropdownMenuItem, d as PopoverContent, g as PopoverTrigger, h as PopoverTitle, it as providerIconAppearance, k as DropdownMenuSeparator, st as IconThemeContext, u as Popover, x as DropdownMenu } from "./ContentIcon-Sx9bywU-.js";
|
|
2
2
|
import { a as derive, i as compute, l as val } from "./dist-bO8nvHFH.js";
|
|
3
3
|
import { c as useLang, l as useTranslate, o as I18nProvider, u as useVal } from "./dist-BFmpkX4P.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { gr as cn, i as TooltipTrigger, mr as Button, n as TooltipContent, t as Tooltip } from "./tooltip-CJjYs_2I.js";
|
|
5
|
+
import { $ as dequal$1, A as upgradeRevisionContent, C as isTriggerNode, F as nodeInputMappings, O as resourceNameIssue, P as mapConditionSources, a as DialogFooter, b as FlowChangeError, d as Field, h as FieldLabel, i as DialogDescription, k as upgradeManualTrigger, l as Icon, m as FieldGroup, o as DialogHeader, p as FieldError, r as DialogContent, s as DialogTitle, t as Dialog, u as Spinner, x as applyFlowChanges, yt as Input } from "./dialog-ZmfcwuMS.js";
|
|
6
|
+
import { $ as providerIcon, An as string, At as WorkflowExportMenuItem, Bt as EmptyMedia, Cn as workflowCandidate, Ct as resetInputValues, Dn as invalidResponse, Dt as setServiceConnections, Et as setInputSources, Ft as InputGroupInput, Ht as Badge, It as Empty, J as connectorActionPorts, K as resourceData, Kt as createI18n, Lt as EmptyContent, Mn as controlErrorCode, Mt as followWorkbenchLink, Nt as InputGroup, On as jsonValue, Ot as updateStartInputDefs, Pt as InputGroupAddon, Qt as allConnectorConnectionsQuery, R as addNodeIntent, Rt as EmptyDescription, S as updateWebhook, St as repairNodeNames, Tt as setConnectorConnection, U as scopedValue, Ut as EventSourcesPage, V as combineSources, Vt as EmptyTitle, W as CacheResource, Xt as WorkbenchClient, Y as designerGraph, Yt as errorNotice, Zt as randomId, _ as updateTask, _t as restoreCanvasPresentation, a as nameCreatedNodes, an as triggerOutputDefinitions, at as Latest, b as updateTriggerConfig, bt as setNodeContentHidden, c as setTriggerConnection, cn as connectorActionMetadata, d as updateNodeDescription, dn as workflowFileName, dt as actionWithConnections, en as decodeTriggerCatalog, et as RunStore, f as updateNodeIcon, fn as workflowNameFromFile, ft as connectionCatalog, g as updateResolution, gt as removeComments, h as updateOutputPorts, ht as flowPresentation, i as deleteSelection, in as sampleErrorOutputs, it as flowResourceReferences, jn as ApiError, jt as IdTooltip, kn as record, kt as updateTriggerSchedule, l as setTriggerEventSource, ln as encodeWorkflowFile, m as updateNodeSettings, mt as commentIds, o as setInputValue, ot as deriveInspectorDiagnostics, p as updateNodeName, pt as canvasPresentationChange, q as resourceValue, r as applyFlowChanges$1, rn as normalizeTriggerOutputs, rt as revisionView, s as setInputVariable, sn as connection, st as diagnosticItems, t as addNode, u as updateCondition, un as parseWorkflowFile, v as updateTaskAdditionalInputs, vt as setComment, wt as setCodeActions, x as updateValue, xt as setNodePositions, y as updateTaskPorts, yt as setFlowViewport, z as deriveAddNodeOptions, zt as EmptyHeader } from "./flowChanges-B5tZMcGr.js";
|
|
7
|
+
import { a as uiLanguages, i as uiLanguageNames, n as isUiLanguage, r as resolveUiLanguage, t as importedWorkflowName } from "./languages-gYzoQqCi.js";
|
|
6
8
|
import { Suspense, forwardRef, lazy, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
7
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
10
|
import * as Cause from "effect/Cause";
|
|
@@ -514,7 +516,7 @@ function FlowDeletionDialog({ flow, workspace, container, busy, finalFocus, onCl
|
|
|
514
516
|
}
|
|
515
517
|
//#endregion
|
|
516
518
|
//#region src/workbench/browser/runtime/shell/resourceBrowser.tsx
|
|
517
|
-
var CreateResourceDialog = lazy(() => import("./createResourceDialog-
|
|
519
|
+
var CreateResourceDialog = lazy(() => import("./createResourceDialog-BKmimKA_.js"));
|
|
518
520
|
var flowIdTooltipAlignOffset = 44;
|
|
519
521
|
var renamePopoverAlignOffset = -12;
|
|
520
522
|
function compactFlowId(flowId) {
|
|
@@ -1873,7 +1875,7 @@ function inputSignature(spec) {
|
|
|
1873
1875
|
}
|
|
1874
1876
|
async function inputEditor(spec, language, values) {
|
|
1875
1877
|
if (spec == null) return void 0;
|
|
1876
|
-
const { FlowRunInputEditorStore } = await import("./flowRunInputEditorStore-
|
|
1878
|
+
const { FlowRunInputEditorStore } = await import("./flowRunInputEditorStore-ys1-w9GW.js").then((n) => n.t);
|
|
1877
1879
|
const editor = new FlowRunInputEditorStore(spec.definitions, language, { allowOmittedNullable: spec.allowOmittedNullable });
|
|
1878
1880
|
const initial = values ?? spec.samples;
|
|
1879
1881
|
if (initial != null) editor.replaceValues(Object.fromEntries(spec.definitions.flatMap(({ handle }) => Object.hasOwn(initial, handle) ? [[handle, initial[handle]]] : [])));
|
|
@@ -4011,7 +4013,7 @@ var ConnectorStore = class {
|
|
|
4011
4013
|
}
|
|
4012
4014
|
}
|
|
4013
4015
|
async setConnection(nodeId, connectionId) {
|
|
4014
|
-
return await this.#workspace.setConnectorConnection(nodeId, connectionId);
|
|
4016
|
+
return await this.#workspace.nodes.setConnectorConnection(nodeId, connectionId);
|
|
4015
4017
|
}
|
|
4016
4018
|
async refreshAfterAuthorization() {
|
|
4017
4019
|
if (this.#disposed || this.#authorization == null) return;
|
|
@@ -4055,7 +4057,7 @@ var ConnectorStore = class {
|
|
|
4055
4057
|
const connection = created.length == 1 ? created[0] : catalog.preferred;
|
|
4056
4058
|
const selected = this.#workspace.$.revision.value?.node(target.nodeId);
|
|
4057
4059
|
const task = selected?.kind == "task" ? selected.definition : void 0;
|
|
4058
|
-
if (connection != null && this.#workspace.$.selectedNodeIds.value.includes(target.nodeId) && task != null && "executor" in task && task.executor.kind == "connector" && task.executor.connectionId == null) await this.#workspace.setConnectorConnection(target.nodeId, connection.connectionId);
|
|
4060
|
+
if (connection != null && this.#workspace.$.selectedNodeIds.value.includes(target.nodeId) && task != null && "executor" in task && task.executor.kind == "connector" && task.executor.connectionId == null) await this.#workspace.nodes.setConnectorConnection(target.nodeId, connection.connectionId);
|
|
4059
4061
|
}
|
|
4060
4062
|
#remember(source, ids) {
|
|
4061
4063
|
if (ids.some((id) => !source.value.includes(id))) source.set([.../* @__PURE__ */ new Set([...source.value, ...ids])]);
|
|
@@ -4328,7 +4330,7 @@ var TriggerStore = class {
|
|
|
4328
4330
|
}
|
|
4329
4331
|
}
|
|
4330
4332
|
async setConnection(triggerId, connectionId) {
|
|
4331
|
-
return await this.#workspace.setTriggerConnection(triggerId, connectionId);
|
|
4333
|
+
return await this.#workspace.nodes.setTriggerConnection(triggerId, connectionId);
|
|
4332
4334
|
}
|
|
4333
4335
|
async refreshAfterAuthorization() {
|
|
4334
4336
|
if (this.#disposed) return;
|
|
@@ -4363,7 +4365,7 @@ function inverseFlowChanges(content, operations) {
|
|
|
4363
4365
|
before: upgradeManualTrigger(requested.before),
|
|
4364
4366
|
node: upgradeManualTrigger(requested.node)
|
|
4365
4367
|
} : requested;
|
|
4366
|
-
const after = applyFlowChanges
|
|
4368
|
+
const after = applyFlowChanges(current, [operation]);
|
|
4367
4369
|
const restore = [];
|
|
4368
4370
|
switch (operation.kind) {
|
|
4369
4371
|
case "graph.node.replace":
|
|
@@ -4746,6 +4748,77 @@ function pasteNodes(revision, clipboard, identity) {
|
|
|
4746
4748
|
};
|
|
4747
4749
|
}
|
|
4748
4750
|
//#endregion
|
|
4751
|
+
//#region src/workbench/browser/runtime/editor/canvasClipboard.ts
|
|
4752
|
+
var CanvasClipboard = class {
|
|
4753
|
+
#value;
|
|
4754
|
+
constructor(identity, t) {
|
|
4755
|
+
this.identity = identity;
|
|
4756
|
+
this.t = t;
|
|
4757
|
+
}
|
|
4758
|
+
copy(revision, graph, nodeIds) {
|
|
4759
|
+
const selected = new Set(nodeIds);
|
|
4760
|
+
this.#value = {
|
|
4761
|
+
hiddenNodeIds: graph.nodes.flatMap((node) => node.contentHidden && selected.has(node.id) ? [node.id] : []),
|
|
4762
|
+
comments: graph.nodes.flatMap((node) => node.kind == "comment" && selected.has(node.id) ? [{
|
|
4763
|
+
content: node.content,
|
|
4764
|
+
position: node.position,
|
|
4765
|
+
sourceId: node.id,
|
|
4766
|
+
title: node.title
|
|
4767
|
+
}] : []),
|
|
4768
|
+
nodes: copyNodes(revision, nodeIds)
|
|
4769
|
+
};
|
|
4770
|
+
}
|
|
4771
|
+
paste(revision, graph, sourcePositions, offset = {
|
|
4772
|
+
x: 40,
|
|
4773
|
+
y: 40
|
|
4774
|
+
}) {
|
|
4775
|
+
if (this.#value == null) return;
|
|
4776
|
+
const hiddenNodeIds = new Set(this.#value.hiddenNodeIds);
|
|
4777
|
+
const pasted = pasteNodes(revision, this.#value.nodes, this.identity);
|
|
4778
|
+
const comments = this.#value.comments.map((comment) => ({
|
|
4779
|
+
...comment,
|
|
4780
|
+
nodeId: this.identity()
|
|
4781
|
+
}));
|
|
4782
|
+
if (pasted.nodeIds.length == 0 && comments.length == 0) return;
|
|
4783
|
+
const designerNodes = new Map(graph.nodes.map((node) => [node.id, node]));
|
|
4784
|
+
const added = /* @__PURE__ */ new Set([...pasted.nodeIds, ...comments.map((comment) => comment.nodeId)]);
|
|
4785
|
+
const occupied = new Set([...designerNodes].filter(([nodeId]) => !added.has(nodeId)).map(([, node]) => `${node.position.x}\0${node.position.y}`));
|
|
4786
|
+
const sources = [...pasted.sourceIds.map((sourceId) => sourcePositions?.[sourceId] ?? designerNodes.get(sourceId)?.position ?? {
|
|
4787
|
+
x: 80,
|
|
4788
|
+
y: 80
|
|
4789
|
+
}), ...comments.map((comment) => comment.position)];
|
|
4790
|
+
let step = 1;
|
|
4791
|
+
if (offset.x != 0 || offset.y != 0) while (sources.some((source) => occupied.has(`${source.x + offset.x * step}\0${source.y + offset.y * step}`))) step += 1;
|
|
4792
|
+
const positions = Object.fromEntries(pasted.sourceIds.map((sourceId, index) => {
|
|
4793
|
+
const source = sourcePositions?.[sourceId] ?? designerNodes.get(sourceId)?.position;
|
|
4794
|
+
return [pasted.nodeIds[index], {
|
|
4795
|
+
x: (source?.x ?? 80) + offset.x * step,
|
|
4796
|
+
y: (source?.y ?? 80) + offset.y * step
|
|
4797
|
+
}];
|
|
4798
|
+
}));
|
|
4799
|
+
return {
|
|
4800
|
+
changes: pasted.changes,
|
|
4801
|
+
nodeIds: [...pasted.nodeIds, ...comments.map((comment) => comment.nodeId)],
|
|
4802
|
+
update: (value) => {
|
|
4803
|
+
let next = setNodePositions(value, positions);
|
|
4804
|
+
for (const [index, sourceId] of pasted.sourceIds.entries()) if (hiddenNodeIds.has(sourceId)) next = setNodeContentHidden(next, pasted.nodeIds[index], true);
|
|
4805
|
+
for (const comment of comments) {
|
|
4806
|
+
if (hiddenNodeIds.has(comment.sourceId)) next = setNodeContentHidden(next, comment.nodeId, true);
|
|
4807
|
+
next = setComment(next, comment.nodeId, {
|
|
4808
|
+
content: comment.content,
|
|
4809
|
+
position: {
|
|
4810
|
+
x: comment.position.x + offset.x * step,
|
|
4811
|
+
y: comment.position.y + offset.y * step
|
|
4812
|
+
},
|
|
4813
|
+
title: this.t("addNode.commentCopy", { title: comment.title })
|
|
4814
|
+
});
|
|
4815
|
+
}
|
|
4816
|
+
return next;
|
|
4817
|
+
}
|
|
4818
|
+
};
|
|
4819
|
+
}
|
|
4820
|
+
};
|
|
4821
|
+
//#endregion
|
|
4749
4822
|
//#region src/workbench/browser/runtime/stores/canvasHistory.ts
|
|
4750
4823
|
var CanvasHistory = class {
|
|
4751
4824
|
constructor() {
|
|
@@ -4896,7 +4969,7 @@ var DraftChanges = class {
|
|
|
4896
4969
|
let projected = draft;
|
|
4897
4970
|
const pending = [];
|
|
4898
4971
|
for (const change of this.#pending) try {
|
|
4899
|
-
projected = applyFlowChanges(projected, change.changes);
|
|
4972
|
+
projected = applyFlowChanges$1(projected, change.changes);
|
|
4900
4973
|
pending.push(change);
|
|
4901
4974
|
} catch (error) {
|
|
4902
4975
|
if (!(error instanceof FlowChangeError)) throw error;
|
|
@@ -4906,7 +4979,7 @@ var DraftChanges = class {
|
|
|
4906
4979
|
return projected;
|
|
4907
4980
|
}
|
|
4908
4981
|
project(draft) {
|
|
4909
|
-
return this.#pending.reduce((current, pending) => applyFlowChanges(current, pending.changes), draft);
|
|
4982
|
+
return this.#pending.reduce((current, pending) => applyFlowChanges$1(current, pending.changes), draft);
|
|
4910
4983
|
}
|
|
4911
4984
|
async settled() {
|
|
4912
4985
|
await this.#queue;
|
|
@@ -4994,7 +5067,7 @@ var DraftChanges = class {
|
|
|
4994
5067
|
#applyCommitted(pending, base, change) {
|
|
4995
5068
|
const committed = {
|
|
4996
5069
|
...change.revision,
|
|
4997
|
-
content: applyFlowChanges(base, pending.changes).content
|
|
5070
|
+
content: applyFlowChanges$1(base, pending.changes).content
|
|
4998
5071
|
};
|
|
4999
5072
|
this.#pending = this.#pending.filter((candidate) => candidate !== pending);
|
|
5000
5073
|
this.#committed = committed;
|
|
@@ -5176,6 +5249,61 @@ var FlowCatalog = class {
|
|
|
5176
5249
|
this.#pending.delete(flow.flowId);
|
|
5177
5250
|
}
|
|
5178
5251
|
}
|
|
5252
|
+
create(name, create) {
|
|
5253
|
+
return this.#create(async () => create == null ? this.#client.createFlow(name) : this.#client.getFlow(await create(name)));
|
|
5254
|
+
}
|
|
5255
|
+
import(file, name, key, importer) {
|
|
5256
|
+
return this.#create(async () => importer == null ? this.#client.importFlow(file, {
|
|
5257
|
+
name,
|
|
5258
|
+
idempotencyKey: key
|
|
5259
|
+
}) : this.#client.getFlow(await importer(file, name, key)));
|
|
5260
|
+
}
|
|
5261
|
+
async #create(create) {
|
|
5262
|
+
try {
|
|
5263
|
+
const created = await create();
|
|
5264
|
+
if (this.#disposed) return;
|
|
5265
|
+
this.#insert(created);
|
|
5266
|
+
return created;
|
|
5267
|
+
} catch (error) {
|
|
5268
|
+
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
async delete(flowId) {
|
|
5272
|
+
const flow = this.flow(flowId);
|
|
5273
|
+
if (flow == null || flow.status == "retiring") return false;
|
|
5274
|
+
try {
|
|
5275
|
+
await this.#client.deleteFlow(flowId);
|
|
5276
|
+
if (this.#disposed) return false;
|
|
5277
|
+
this.#remove(flowId);
|
|
5278
|
+
this.#setNotice({
|
|
5279
|
+
kind: "success",
|
|
5280
|
+
message: this.#i18n.t("notice.flowDeleteAccepted", { name: flow.name })
|
|
5281
|
+
});
|
|
5282
|
+
return true;
|
|
5283
|
+
} catch (error) {
|
|
5284
|
+
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5285
|
+
return false;
|
|
5286
|
+
}
|
|
5287
|
+
}
|
|
5288
|
+
async rename(flowId, name) {
|
|
5289
|
+
const flow = this.flow(flowId);
|
|
5290
|
+
const nextName = name.trim();
|
|
5291
|
+
if (flow == null || nextName.length == 0) return false;
|
|
5292
|
+
if (flow.name == nextName) return true;
|
|
5293
|
+
try {
|
|
5294
|
+
const changed = await this.#client.renameFlow(flowId, nextName);
|
|
5295
|
+
if (this.#disposed) return false;
|
|
5296
|
+
this.include(changed);
|
|
5297
|
+
this.#setNotice({
|
|
5298
|
+
kind: "success",
|
|
5299
|
+
message: this.#i18n.t("notice.flowRenamed", { name: nextName })
|
|
5300
|
+
});
|
|
5301
|
+
return true;
|
|
5302
|
+
} catch (error) {
|
|
5303
|
+
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5304
|
+
return false;
|
|
5305
|
+
}
|
|
5306
|
+
}
|
|
5179
5307
|
include(flow) {
|
|
5180
5308
|
const index = this.#state.value.flows.findIndex((candidate) => candidate.flowId == flow.flowId);
|
|
5181
5309
|
if (index < 0) {
|
|
@@ -5188,14 +5316,14 @@ var FlowCatalog = class {
|
|
|
5188
5316
|
...referenceCount == null ? {} : { referenceCount }
|
|
5189
5317
|
}) });
|
|
5190
5318
|
}
|
|
5191
|
-
insert(flow) {
|
|
5319
|
+
#insert(flow) {
|
|
5192
5320
|
if (this.#state.value.flows.some((candidate) => candidate.flowId == flow.flowId)) return;
|
|
5193
5321
|
this.#set({
|
|
5194
5322
|
flows: [...this.#state.value.flows, flow],
|
|
5195
5323
|
total: this.#state.value.total == null ? void 0 : this.#state.value.total + 1
|
|
5196
5324
|
});
|
|
5197
5325
|
}
|
|
5198
|
-
remove(flowId) {
|
|
5326
|
+
#remove(flowId) {
|
|
5199
5327
|
this.#set({
|
|
5200
5328
|
flows: this.#state.value.flows.filter((flow) => flow.flowId != flowId),
|
|
5201
5329
|
total: this.#state.value.total == null ? void 0 : this.#state.value.total - 1
|
|
@@ -5354,6 +5482,183 @@ var ModuleEditorSession = class {
|
|
|
5354
5482
|
}
|
|
5355
5483
|
};
|
|
5356
5484
|
//#endregion
|
|
5485
|
+
//#region src/workbench/browser/runtime/stores/nodeEdits.ts
|
|
5486
|
+
var NodeEdits = class {
|
|
5487
|
+
constructor(revision, save, identity) {
|
|
5488
|
+
this.revision = revision;
|
|
5489
|
+
this.save = save;
|
|
5490
|
+
this.identity = identity;
|
|
5491
|
+
}
|
|
5492
|
+
async saveErrorSources(nodeId, value) {
|
|
5493
|
+
const node = this.revision.value?.graph()?.nodes[nodeId];
|
|
5494
|
+
if (node?.kind != "error" || dequal$1(node.sourceFlowIds ?? [], value)) return false;
|
|
5495
|
+
return await this.save([{
|
|
5496
|
+
kind: "graph.trigger.sources.set",
|
|
5497
|
+
nodeId,
|
|
5498
|
+
before: node.sourceFlowIds,
|
|
5499
|
+
value: value.length == 0 ? void 0 : value
|
|
5500
|
+
}]);
|
|
5501
|
+
}
|
|
5502
|
+
async saveNodeSettings(nodeId, settings) {
|
|
5503
|
+
const revision = this.revision.value;
|
|
5504
|
+
if (revision == null) return false;
|
|
5505
|
+
const changes = updateNodeSettings(revision, nodeId, settings);
|
|
5506
|
+
return changes != null && await this.save(changes);
|
|
5507
|
+
}
|
|
5508
|
+
async saveNodeDescription(nodeId, description) {
|
|
5509
|
+
const revision = this.revision.value;
|
|
5510
|
+
if (revision == null) return false;
|
|
5511
|
+
const changes = updateNodeDescription(revision, nodeId, description);
|
|
5512
|
+
return changes != null && await this.save(changes);
|
|
5513
|
+
}
|
|
5514
|
+
async saveNodeIcon(nodeId, icon) {
|
|
5515
|
+
const revision = this.revision.value;
|
|
5516
|
+
if (revision == null) return false;
|
|
5517
|
+
const changes = updateNodeIcon(revision, nodeId, icon);
|
|
5518
|
+
return changes != null && await this.save(changes);
|
|
5519
|
+
}
|
|
5520
|
+
async saveNodeTitle(nodeId, title) {
|
|
5521
|
+
const revision = this.revision.value;
|
|
5522
|
+
if (revision == null) return false;
|
|
5523
|
+
const changes = updateNodeName(revision, nodeId, title);
|
|
5524
|
+
return changes != null && await this.save(changes);
|
|
5525
|
+
}
|
|
5526
|
+
async setInputValue(nodeId, handle, value, deletion) {
|
|
5527
|
+
const revision = this.revision.value;
|
|
5528
|
+
if (revision == null) return false;
|
|
5529
|
+
const changes = setInputValue(revision, nodeId, handle, value);
|
|
5530
|
+
return changes != null && await this.save(changes, deletion);
|
|
5531
|
+
}
|
|
5532
|
+
async resetInputs(nodeId, handles) {
|
|
5533
|
+
const revision = this.revision.value;
|
|
5534
|
+
if (revision == null) return false;
|
|
5535
|
+
return await this.save(resetInputValues(revision.revision.content, nodeId, handles));
|
|
5536
|
+
}
|
|
5537
|
+
async saveOutputsDefs(nodeId, definitions, deletion, values) {
|
|
5538
|
+
const revision = this.revision.value;
|
|
5539
|
+
if (revision == null || revision.graph().nodes[nodeId]?.kind != "outputs") return false;
|
|
5540
|
+
return await this.save(updateOutputPorts(revision, nodeId, definitions, values), deletion);
|
|
5541
|
+
}
|
|
5542
|
+
async saveStartInputDefs(nodeId, inputDefs, deletion) {
|
|
5543
|
+
const revision = this.revision.value;
|
|
5544
|
+
if (revision == null || revision.graph().nodes[nodeId]?.kind != "start") return false;
|
|
5545
|
+
const changes = updateStartInputDefs(revision.revision.content, nodeId, inputDefs);
|
|
5546
|
+
return await this.save(changes, deletion);
|
|
5547
|
+
}
|
|
5548
|
+
async resetTriggerConfig(triggerId, names) {
|
|
5549
|
+
const revision = this.revision.value;
|
|
5550
|
+
if (revision == null) return false;
|
|
5551
|
+
const trigger = revision.graph()?.nodes[triggerId];
|
|
5552
|
+
if (trigger?.kind !== "poll" && trigger?.kind !== "integration") return false;
|
|
5553
|
+
const changes = (names == null ? Object.entries(trigger.config) : names.flatMap((name) => Object.hasOwn(trigger.config, name) ? [[name, trigger.config[name]]] : [])).map(([name, before]) => ({
|
|
5554
|
+
kind: "graph.trigger.config.set",
|
|
5555
|
+
nodeId: triggerId,
|
|
5556
|
+
name,
|
|
5557
|
+
before,
|
|
5558
|
+
value: void 0
|
|
5559
|
+
}));
|
|
5560
|
+
return await this.save(changes);
|
|
5561
|
+
}
|
|
5562
|
+
async setInputSource(nodeId, handle, source) {
|
|
5563
|
+
const revision = this.revision.value;
|
|
5564
|
+
if (revision == null) return false;
|
|
5565
|
+
return await this.save(setInputSources(revision.revision.content, nodeId, handle, [{
|
|
5566
|
+
kind: "node",
|
|
5567
|
+
...source
|
|
5568
|
+
}]));
|
|
5569
|
+
}
|
|
5570
|
+
async setInputVariable(nodeId, handle, name) {
|
|
5571
|
+
const revision = this.revision.value;
|
|
5572
|
+
if (revision == null) return false;
|
|
5573
|
+
const changes = name == null ? setInputValue(revision, nodeId, handle, void 0) : setInputVariable(revision, nodeId, handle, name, this.identity());
|
|
5574
|
+
return changes != null && await this.save(changes);
|
|
5575
|
+
}
|
|
5576
|
+
async saveCondition(nodeId, settings, deletion) {
|
|
5577
|
+
const revision = this.revision.value;
|
|
5578
|
+
if (revision == null) return false;
|
|
5579
|
+
const changes = updateCondition(revision, nodeId, settings);
|
|
5580
|
+
return changes != null && await this.save(changes, deletion);
|
|
5581
|
+
}
|
|
5582
|
+
async saveValue(nodeId, values, deletion) {
|
|
5583
|
+
const revision = this.revision.value;
|
|
5584
|
+
if (revision == null) return false;
|
|
5585
|
+
const changes = updateValue(revision, nodeId, values);
|
|
5586
|
+
return changes != null && await this.save(changes, deletion);
|
|
5587
|
+
}
|
|
5588
|
+
async saveResolution(nodeId, settings, deletion, values) {
|
|
5589
|
+
const revision = this.revision.value;
|
|
5590
|
+
if (revision == null) return false;
|
|
5591
|
+
const changes = updateResolution(revision, nodeId, settings, values);
|
|
5592
|
+
return changes != null && await this.save(changes, deletion);
|
|
5593
|
+
}
|
|
5594
|
+
async saveTaskSettings(nodeId, settings, deletion) {
|
|
5595
|
+
const revision = this.revision.value;
|
|
5596
|
+
if (revision == null) return false;
|
|
5597
|
+
const changes = updateTask(revision, nodeId, settings);
|
|
5598
|
+
return changes != null && await this.save(changes, deletion);
|
|
5599
|
+
}
|
|
5600
|
+
async saveTaskPorts(nodeId, ports, deletion, values) {
|
|
5601
|
+
const revision = this.revision.value;
|
|
5602
|
+
if (revision == null) return false;
|
|
5603
|
+
const changes = updateTaskPorts(revision, nodeId, ports, values);
|
|
5604
|
+
return changes != null && await this.save(changes, deletion);
|
|
5605
|
+
}
|
|
5606
|
+
async saveTaskAdditionalInputs(nodeId, inputs, deletion, values) {
|
|
5607
|
+
const revision = this.revision.value;
|
|
5608
|
+
if (revision == null) return false;
|
|
5609
|
+
const changes = updateTaskAdditionalInputs(revision, nodeId, inputs, values);
|
|
5610
|
+
return changes != null && await this.save(changes, deletion);
|
|
5611
|
+
}
|
|
5612
|
+
async setConnectorConnection(nodeId, connectionId) {
|
|
5613
|
+
const revision = this.revision.value;
|
|
5614
|
+
if (revision == null) return false;
|
|
5615
|
+
const changes = setConnectorConnection(revision.revision.content, nodeId, connectionId);
|
|
5616
|
+
return changes != null && await this.save(changes);
|
|
5617
|
+
}
|
|
5618
|
+
async setServiceConnections(providerId, connectionId, previousConnectionId) {
|
|
5619
|
+
const revision = this.revision.value;
|
|
5620
|
+
if (revision == null) return false;
|
|
5621
|
+
const changes = setServiceConnections(revision.revision.content, providerId, connectionId, previousConnectionId);
|
|
5622
|
+
return changes.length == 0 || await this.save(changes);
|
|
5623
|
+
}
|
|
5624
|
+
async setCodeActions(nodeId, capabilities) {
|
|
5625
|
+
const revision = this.revision.value;
|
|
5626
|
+
if (revision == null) return false;
|
|
5627
|
+
const changes = setCodeActions(revision.revision.content, nodeId, capabilities);
|
|
5628
|
+
return changes == null || await this.save(changes);
|
|
5629
|
+
}
|
|
5630
|
+
async setTriggerEventSource(triggerId, source) {
|
|
5631
|
+
const revision = this.revision.value;
|
|
5632
|
+
if (revision == null) return false;
|
|
5633
|
+
const changes = setTriggerEventSource(revision, triggerId, source);
|
|
5634
|
+
return changes != null && await this.save(changes);
|
|
5635
|
+
}
|
|
5636
|
+
async saveTriggerConfig(triggerId, name, value) {
|
|
5637
|
+
const revision = this.revision.value;
|
|
5638
|
+
if (revision == null) return false;
|
|
5639
|
+
const changes = updateTriggerConfig(revision, triggerId, name, value);
|
|
5640
|
+
return changes != null && await this.save(changes);
|
|
5641
|
+
}
|
|
5642
|
+
async saveTriggerSchedule(triggerId, schedule) {
|
|
5643
|
+
const revision = this.revision.value;
|
|
5644
|
+
if (revision == null) return false;
|
|
5645
|
+
const changes = updateTriggerSchedule(revision.revision.content, triggerId, schedule);
|
|
5646
|
+
return changes != null && await this.save(changes);
|
|
5647
|
+
}
|
|
5648
|
+
async saveWebhook(triggerId, settings, deletion) {
|
|
5649
|
+
const revision = this.revision.value;
|
|
5650
|
+
if (revision == null) return false;
|
|
5651
|
+
const changes = updateWebhook(revision, triggerId, settings);
|
|
5652
|
+
return changes != null && await this.save(changes, deletion);
|
|
5653
|
+
}
|
|
5654
|
+
async setTriggerConnection(triggerId, connectionId) {
|
|
5655
|
+
const revision = this.revision.value;
|
|
5656
|
+
if (revision == null) return false;
|
|
5657
|
+
const changes = setTriggerConnection(revision, triggerId, connectionId);
|
|
5658
|
+
return changes != null && await this.save(changes);
|
|
5659
|
+
}
|
|
5660
|
+
};
|
|
5661
|
+
//#endregion
|
|
5357
5662
|
//#region src/workbench/browser/runtime/stores/presentationChanges.ts
|
|
5358
5663
|
var PresentationChanges = class {
|
|
5359
5664
|
#client;
|
|
@@ -5572,10 +5877,6 @@ var WorkspaceModel = class {
|
|
|
5572
5877
|
};
|
|
5573
5878
|
//#endregion
|
|
5574
5879
|
//#region src/workbench/browser/runtime/stores/workspaceStore.ts
|
|
5575
|
-
var PASTE_OFFSET = {
|
|
5576
|
-
x: 40,
|
|
5577
|
-
y: 40
|
|
5578
|
-
};
|
|
5579
5880
|
var deletionMessageKeys = {
|
|
5580
5881
|
field: "history.deleted.field",
|
|
5581
5882
|
group: "history.deleted.group",
|
|
@@ -5641,6 +5942,7 @@ var WorkspaceStore = class {
|
|
|
5641
5942
|
this.#client = client;
|
|
5642
5943
|
this.#setNotice = setNotice;
|
|
5643
5944
|
this.#identity = identity;
|
|
5945
|
+
this.#clipboard = new CanvasClipboard(identity, i18n.t);
|
|
5644
5946
|
this.#i18n = i18n;
|
|
5645
5947
|
this.#runChanged = runChanged;
|
|
5646
5948
|
this.#flows = new FlowCatalog(client, setNotice, i18n);
|
|
@@ -5664,6 +5966,7 @@ var WorkspaceStore = class {
|
|
|
5664
5966
|
});
|
|
5665
5967
|
this.#presentationChanges = new PresentationChanges(client, setNotice, (presentation) => this.#set({ presentation }), i18n);
|
|
5666
5968
|
this.$ = this.#model.$;
|
|
5969
|
+
this.nodes = new NodeEdits(this.$.revision, async (changes, deletion) => await this.#canvasChange("edit", 1, changes, void 0, void 0, deletion) && this.#model.value.draft != null, identity);
|
|
5667
5970
|
}
|
|
5668
5971
|
dispose() {
|
|
5669
5972
|
this.catalogs.dispose();
|
|
@@ -5749,13 +6052,14 @@ var WorkspaceStore = class {
|
|
|
5749
6052
|
try {
|
|
5750
6053
|
let invalidated = false;
|
|
5751
6054
|
let pendingRevision;
|
|
5752
|
-
const
|
|
6055
|
+
const changed = (revisionId) => {
|
|
5753
6056
|
if (!current()) return;
|
|
5754
6057
|
if (this.#draftChanges.committed == null) {
|
|
5755
6058
|
invalidated = true;
|
|
5756
6059
|
pendingRevision = revisionId;
|
|
5757
6060
|
} else if (revisionId != this.#draftChanges.committed.revisionId) this.#refreshDraft(revisionId);
|
|
5758
|
-
}
|
|
6061
|
+
};
|
|
6062
|
+
const subscription = this.#client.watchFlow(flowId, changed, (event) => {
|
|
5759
6063
|
if (current()) this.#runChanged(event);
|
|
5760
6064
|
}, (accessRevision) => {
|
|
5761
6065
|
if (current()) {
|
|
@@ -5766,8 +6070,18 @@ var WorkspaceStore = class {
|
|
|
5766
6070
|
if (current() && !this.#model.value.workspaceLoading) for (const execute of this.#canvasCommandListeners) execute(command);
|
|
5767
6071
|
});
|
|
5768
6072
|
this.#stopFlowWatch = subscription.stop;
|
|
5769
|
-
|
|
6073
|
+
let reading = false;
|
|
6074
|
+
subscription.ready.then(() => {
|
|
6075
|
+
if (reading) changed();
|
|
6076
|
+
}, (error) => {
|
|
6077
|
+
if (!current()) return;
|
|
6078
|
+
subscription.stop();
|
|
6079
|
+
this.#stopFlowWatch = void 0;
|
|
6080
|
+
this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
6081
|
+
});
|
|
6082
|
+
await Promise.resolve();
|
|
5770
6083
|
if (!current()) return false;
|
|
6084
|
+
reading = true;
|
|
5771
6085
|
let editor = await this.#client.getEditor(flowId);
|
|
5772
6086
|
for (let attempt = 0; current() && Object.values(revisionView(editor.draft).graph().nodes).some((node) => node.kind == "manual"); attempt += 1) {
|
|
5773
6087
|
if (attempt >= 3) throw new ApiError(409, controlErrorCode.flowRevisionConflict, "The Draft changed while upgrading its Start node.");
|
|
@@ -5890,24 +6204,16 @@ var WorkspaceStore = class {
|
|
|
5890
6204
|
}
|
|
5891
6205
|
}
|
|
5892
6206
|
createFlow(name, create) {
|
|
5893
|
-
return this.#createFlow(
|
|
6207
|
+
return this.#createFlow(() => this.#flows.create(name, create));
|
|
5894
6208
|
}
|
|
5895
6209
|
importFlow(file, name, key, importer) {
|
|
5896
|
-
return this.#createFlow(
|
|
5897
|
-
name,
|
|
5898
|
-
idempotencyKey: key
|
|
5899
|
-
}) : this.#client.getFlow(await importer(file, name, key)));
|
|
6210
|
+
return this.#createFlow(() => this.#flows.import(file, name, key, importer));
|
|
5900
6211
|
}
|
|
5901
6212
|
async #createFlow(create) {
|
|
5902
6213
|
if (!await this.saveModuleEditor()) return;
|
|
5903
6214
|
this.#set({ busy: "flow" });
|
|
5904
6215
|
try {
|
|
5905
|
-
|
|
5906
|
-
if (this.#disposed) return;
|
|
5907
|
-
this.#flows.insert(created);
|
|
5908
|
-
return created;
|
|
5909
|
-
} catch (error) {
|
|
5910
|
-
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
6216
|
+
return await create();
|
|
5911
6217
|
} finally {
|
|
5912
6218
|
this.#set({ busy: void 0 });
|
|
5913
6219
|
}
|
|
@@ -5924,45 +6230,20 @@ var WorkspaceStore = class {
|
|
|
5924
6230
|
}
|
|
5925
6231
|
async deleteFlow(flowId) {
|
|
5926
6232
|
if (!await this.saveModuleEditor()) return false;
|
|
5927
|
-
const flow = this.#flows.flow(flowId);
|
|
5928
|
-
if (flow == null || flow.status == "retiring") return false;
|
|
5929
6233
|
this.#set({ busy: "flow" });
|
|
5930
6234
|
try {
|
|
5931
|
-
await this.#
|
|
5932
|
-
if (this.#disposed) return false;
|
|
5933
|
-
this.#flows.remove(flowId);
|
|
5934
|
-
this.#setNotice({
|
|
5935
|
-
kind: "success",
|
|
5936
|
-
message: this.#i18n.t("notice.flowDeleteAccepted", { name: flow.name })
|
|
5937
|
-
});
|
|
5938
|
-
return true;
|
|
5939
|
-
} catch (error) {
|
|
5940
|
-
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
5941
|
-
return false;
|
|
6235
|
+
return await this.#flows.delete(flowId);
|
|
5942
6236
|
} finally {
|
|
5943
6237
|
this.#set({ busy: void 0 });
|
|
5944
6238
|
}
|
|
5945
6239
|
}
|
|
5946
6240
|
async renameFlow(flowId, name) {
|
|
5947
|
-
const flow = this.#flows.flow(flowId);
|
|
5948
|
-
const nextName = name.trim();
|
|
5949
|
-
if (flow == null || nextName.length == 0) return false;
|
|
5950
|
-
if (flow.name == nextName) return true;
|
|
5951
6241
|
this.#set({ busy: "flow" });
|
|
5952
|
-
let changed;
|
|
5953
6242
|
try {
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
if (!this.#disposed) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
6243
|
+
return await this.#flows.rename(flowId, name);
|
|
6244
|
+
} finally {
|
|
6245
|
+
this.#set({ busy: void 0 });
|
|
5958
6246
|
}
|
|
5959
|
-
this.#set({ busy: void 0 });
|
|
5960
|
-
if (changed == null) return false;
|
|
5961
|
-
this.#setNotice({
|
|
5962
|
-
kind: "success",
|
|
5963
|
-
message: this.#i18n.t("notice.flowRenamed", { name: nextName })
|
|
5964
|
-
});
|
|
5965
|
-
return true;
|
|
5966
6247
|
}
|
|
5967
6248
|
async addNode(option, position, connection) {
|
|
5968
6249
|
if (!await this.saveModuleEditor()) return;
|
|
@@ -5989,7 +6270,7 @@ var WorkspaceStore = class {
|
|
|
5989
6270
|
const edge = connection?.(nodeId);
|
|
5990
6271
|
const nodeChanges = addNode(revision, nodeId, intent);
|
|
5991
6272
|
if (nodeChanges == null) return;
|
|
5992
|
-
const changes = edge == null ? nodeChanges : [...nodeChanges, ...connect(applyFlowChanges(draft, nodeChanges).content, {
|
|
6273
|
+
const changes = edge == null ? nodeChanges : [...nodeChanges, ...connect(applyFlowChanges$1(draft, nodeChanges).content, {
|
|
5993
6274
|
source: edge.source,
|
|
5994
6275
|
target: edge.target,
|
|
5995
6276
|
...edge.sourceHandle.startsWith("$branch:") ? { sourceHandle: edge.sourceHandle.slice(8) } : {}
|
|
@@ -6039,168 +6320,19 @@ var WorkspaceStore = class {
|
|
|
6039
6320
|
copySelectedNodes() {
|
|
6040
6321
|
const revision = this.$.revision.value;
|
|
6041
6322
|
if (revision == null || this.#model.value.selectedNodeIds.length == 0) return;
|
|
6042
|
-
|
|
6043
|
-
this.#clipboard = {
|
|
6044
|
-
hiddenNodeIds: this.#designer().nodes.flatMap((node) => node.contentHidden && selected.has(node.id) ? [node.id] : []),
|
|
6045
|
-
comments: this.#designer().nodes.flatMap((node) => node.kind == "comment" && selected.has(node.id) ? [{
|
|
6046
|
-
content: node.content,
|
|
6047
|
-
position: node.position,
|
|
6048
|
-
sourceId: node.id,
|
|
6049
|
-
title: node.title
|
|
6050
|
-
}] : []),
|
|
6051
|
-
nodes: copyNodes(revision, this.#model.value.selectedNodeIds)
|
|
6052
|
-
};
|
|
6323
|
+
this.#clipboard.copy(revision, this.#designer(), this.#model.value.selectedNodeIds);
|
|
6053
6324
|
}
|
|
6054
|
-
async pasteNodes(sourcePositions, offset
|
|
6325
|
+
async pasteNodes(sourcePositions, offset) {
|
|
6055
6326
|
if (!await this.saveModuleEditor()) return;
|
|
6056
6327
|
const revision = this.$.revision.value;
|
|
6057
|
-
if (revision == null
|
|
6058
|
-
const
|
|
6059
|
-
|
|
6060
|
-
const comments = this.#clipboard.comments.map((comment) => ({
|
|
6061
|
-
...comment,
|
|
6062
|
-
nodeId: this.#identity()
|
|
6063
|
-
}));
|
|
6064
|
-
if (pasted.nodeIds.length == 0 && comments.length == 0) return;
|
|
6065
|
-
const designerNodes = new Map(this.#designer().nodes.map((node) => [node.id, node]));
|
|
6066
|
-
const added = /* @__PURE__ */ new Set([...pasted.nodeIds, ...comments.map((comment) => comment.nodeId)]);
|
|
6067
|
-
const occupied = new Set([...designerNodes].filter(([nodeId]) => !added.has(nodeId)).map(([, node]) => `${node.position.x}\0${node.position.y}`));
|
|
6068
|
-
const sources = [...pasted.sourceIds.map((sourceId) => sourcePositions?.[sourceId] ?? designerNodes.get(sourceId)?.position ?? {
|
|
6069
|
-
x: 80,
|
|
6070
|
-
y: 80
|
|
6071
|
-
}), ...comments.map((comment) => comment.position)];
|
|
6072
|
-
let step = 1;
|
|
6073
|
-
if (offset.x != 0 || offset.y != 0) while (sources.some((source) => occupied.has(`${source.x + offset.x * step}\0${source.y + offset.y * step}`))) step += 1;
|
|
6074
|
-
const positions = Object.fromEntries(pasted.sourceIds.map((sourceId, index) => {
|
|
6075
|
-
const source = sourcePositions?.[sourceId] ?? designerNodes.get(sourceId)?.position;
|
|
6076
|
-
return [pasted.nodeIds[index], {
|
|
6077
|
-
x: (source?.x ?? 80) + offset.x * step,
|
|
6078
|
-
y: (source?.y ?? 80) + offset.y * step
|
|
6079
|
-
}];
|
|
6080
|
-
}));
|
|
6081
|
-
await this.#canvasChange("paste", added.size, pasted.changes, (value) => {
|
|
6082
|
-
let next = setNodePositions(value, positions);
|
|
6083
|
-
for (const [index, sourceId] of pasted.sourceIds.entries()) if (hiddenNodeIds.has(sourceId)) next = setNodeContentHidden(next, pasted.nodeIds[index], true);
|
|
6084
|
-
for (const comment of comments) {
|
|
6085
|
-
if (hiddenNodeIds.has(comment.sourceId)) next = setNodeContentHidden(next, comment.nodeId, true);
|
|
6086
|
-
next = setComment(next, comment.nodeId, {
|
|
6087
|
-
content: comment.content,
|
|
6088
|
-
position: {
|
|
6089
|
-
x: comment.position.x + offset.x * step,
|
|
6090
|
-
y: comment.position.y + offset.y * step
|
|
6091
|
-
},
|
|
6092
|
-
title: this.#i18n.t("addNode.commentCopy", { title: comment.title })
|
|
6093
|
-
});
|
|
6094
|
-
}
|
|
6095
|
-
return next;
|
|
6096
|
-
}, [...pasted.nodeIds, ...comments.map((comment) => comment.nodeId)]);
|
|
6328
|
+
if (revision == null) return;
|
|
6329
|
+
const pasted = this.#clipboard.paste(revision, this.#designer(), sourcePositions, offset);
|
|
6330
|
+
if (pasted != null) await this.#canvasChange("paste", pasted.nodeIds.length, pasted.changes, pasted.update, pasted.nodeIds);
|
|
6097
6331
|
}
|
|
6098
6332
|
async duplicateSelectedNodes(positions, offset) {
|
|
6099
6333
|
this.copySelectedNodes();
|
|
6100
6334
|
await this.pasteNodes(positions, offset);
|
|
6101
6335
|
}
|
|
6102
|
-
async saveErrorSources(nodeId, value) {
|
|
6103
|
-
const node = this.$.revision.value?.graph()?.nodes[nodeId];
|
|
6104
|
-
if (node?.kind != "error" || dequal$1(node.sourceFlowIds ?? [], value)) return false;
|
|
6105
|
-
return await this.#editDraft([{
|
|
6106
|
-
kind: "graph.trigger.sources.set",
|
|
6107
|
-
nodeId,
|
|
6108
|
-
before: node.sourceFlowIds,
|
|
6109
|
-
value: value.length == 0 ? void 0 : value
|
|
6110
|
-
}]) != null;
|
|
6111
|
-
}
|
|
6112
|
-
async saveNodeSettings(nodeId, settings) {
|
|
6113
|
-
const revision = this.$.revision.value;
|
|
6114
|
-
if (revision == null) return false;
|
|
6115
|
-
const changes = updateNodeSettings(revision, nodeId, settings);
|
|
6116
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
6117
|
-
}
|
|
6118
|
-
async saveNodeDescription(nodeId, description) {
|
|
6119
|
-
const revision = this.$.revision.value;
|
|
6120
|
-
if (revision == null) return false;
|
|
6121
|
-
const changes = updateNodeDescription(revision, nodeId, description);
|
|
6122
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
6123
|
-
}
|
|
6124
|
-
async saveNodeIcon(nodeId, icon) {
|
|
6125
|
-
const revision = this.$.revision.value;
|
|
6126
|
-
if (revision == null) return false;
|
|
6127
|
-
const changes = updateNodeIcon(revision, nodeId, icon);
|
|
6128
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
6129
|
-
}
|
|
6130
|
-
async saveNodeTitle(nodeId, title) {
|
|
6131
|
-
const revision = this.$.revision.value;
|
|
6132
|
-
if (revision == null) return false;
|
|
6133
|
-
const changes = updateNodeName(revision, nodeId, title);
|
|
6134
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
6135
|
-
}
|
|
6136
|
-
async setInputValue(nodeId, handle, value, deletion) {
|
|
6137
|
-
const revision = this.$.revision.value;
|
|
6138
|
-
if (revision == null) return false;
|
|
6139
|
-
const changes = setInputValue(revision, nodeId, handle, value);
|
|
6140
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6141
|
-
}
|
|
6142
|
-
async resetInputs(nodeId, handles) {
|
|
6143
|
-
const revision = this.$.revision.value;
|
|
6144
|
-
if (revision == null) return false;
|
|
6145
|
-
return await this.#editDraft(resetInputValues(revision.revision.content, nodeId, handles)) != null;
|
|
6146
|
-
}
|
|
6147
|
-
async saveOutputsDefs(nodeId, definitions, deletion, values) {
|
|
6148
|
-
const revision = this.$.revision.value;
|
|
6149
|
-
if (revision == null || revision.graph().nodes[nodeId]?.kind != "outputs") return false;
|
|
6150
|
-
return await this.#editDraft(updateOutputPorts(revision, nodeId, definitions, values), deletion) != null;
|
|
6151
|
-
}
|
|
6152
|
-
async saveStartInputDefs(nodeId, inputDefs, deletion) {
|
|
6153
|
-
const revision = this.$.revision.value;
|
|
6154
|
-
if (revision == null || revision.graph().nodes[nodeId]?.kind != "start") return false;
|
|
6155
|
-
const changes = updateStartInputDefs(revision.revision.content, nodeId, inputDefs);
|
|
6156
|
-
return await this.#editDraft(changes, deletion) != null;
|
|
6157
|
-
}
|
|
6158
|
-
async resetTriggerConfig(triggerId, names) {
|
|
6159
|
-
const revision = this.$.revision.value;
|
|
6160
|
-
if (revision == null) return false;
|
|
6161
|
-
const trigger = revision.graph()?.nodes[triggerId];
|
|
6162
|
-
if (trigger?.kind !== "poll" && trigger?.kind !== "integration") return false;
|
|
6163
|
-
const changes = (names == null ? Object.entries(trigger.config) : names.flatMap((name) => Object.hasOwn(trigger.config, name) ? [[name, trigger.config[name]]] : [])).map(([name, before]) => ({
|
|
6164
|
-
kind: "graph.trigger.config.set",
|
|
6165
|
-
nodeId: triggerId,
|
|
6166
|
-
name,
|
|
6167
|
-
before,
|
|
6168
|
-
value: void 0
|
|
6169
|
-
}));
|
|
6170
|
-
return await this.#editDraft(changes) != null;
|
|
6171
|
-
}
|
|
6172
|
-
async setInputSource(nodeId, handle, source) {
|
|
6173
|
-
const revision = this.$.revision.value;
|
|
6174
|
-
if (revision == null) return false;
|
|
6175
|
-
return await this.#editDraft(setInputSources(revision.revision.content, nodeId, handle, [{
|
|
6176
|
-
kind: "node",
|
|
6177
|
-
...source
|
|
6178
|
-
}])) != null;
|
|
6179
|
-
}
|
|
6180
|
-
async setInputVariable(nodeId, handle, name) {
|
|
6181
|
-
const revision = this.$.revision.value;
|
|
6182
|
-
if (revision == null) return false;
|
|
6183
|
-
const changes = name == null ? setInputValue(revision, nodeId, handle, void 0) : setInputVariable(revision, nodeId, handle, name, this.#identity());
|
|
6184
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
6185
|
-
}
|
|
6186
|
-
async saveCondition(nodeId, settings, deletion) {
|
|
6187
|
-
const revision = this.$.revision.value;
|
|
6188
|
-
if (revision == null) return false;
|
|
6189
|
-
const changes = updateCondition(revision, nodeId, settings);
|
|
6190
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6191
|
-
}
|
|
6192
|
-
async saveValue(nodeId, values, deletion) {
|
|
6193
|
-
const revision = this.$.revision.value;
|
|
6194
|
-
if (revision == null) return false;
|
|
6195
|
-
const changes = updateValue(revision, nodeId, values);
|
|
6196
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6197
|
-
}
|
|
6198
|
-
async saveResolution(nodeId, settings, deletion, values) {
|
|
6199
|
-
const revision = this.$.revision.value;
|
|
6200
|
-
if (revision == null) return false;
|
|
6201
|
-
const changes = updateResolution(revision, nodeId, settings, values);
|
|
6202
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6203
|
-
}
|
|
6204
6336
|
async saveNodeContentHidden(nodeId, hidden) {
|
|
6205
6337
|
const node = this.#designer().nodes.find((candidate) => candidate.id == nodeId);
|
|
6206
6338
|
if (node == null || node.kind == "condition") return;
|
|
@@ -6237,42 +6369,6 @@ var WorkspaceStore = class {
|
|
|
6237
6369
|
loadOpenApiDocument(url, signal) {
|
|
6238
6370
|
return this.#client.loadOpenApiDocument(url, signal);
|
|
6239
6371
|
}
|
|
6240
|
-
async saveTaskSettings(nodeId, settings, deletion) {
|
|
6241
|
-
const revision = this.$.revision.value;
|
|
6242
|
-
if (revision == null) return false;
|
|
6243
|
-
const changes = updateTask(revision, nodeId, settings);
|
|
6244
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6245
|
-
}
|
|
6246
|
-
async saveTaskPorts(nodeId, ports, deletion, values) {
|
|
6247
|
-
const revision = this.$.revision.value;
|
|
6248
|
-
if (revision == null) return false;
|
|
6249
|
-
const changes = updateTaskPorts(revision, nodeId, ports, values);
|
|
6250
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6251
|
-
}
|
|
6252
|
-
async saveTaskAdditionalInputs(nodeId, inputs, deletion, values) {
|
|
6253
|
-
const revision = this.$.revision.value;
|
|
6254
|
-
if (revision == null) return false;
|
|
6255
|
-
const changes = updateTaskAdditionalInputs(revision, nodeId, inputs, values);
|
|
6256
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6257
|
-
}
|
|
6258
|
-
async setConnectorConnection(nodeId, connectionId) {
|
|
6259
|
-
const revision = this.$.revision.value;
|
|
6260
|
-
if (revision == null) return false;
|
|
6261
|
-
const changes = setConnectorConnection(revision.revision.content, nodeId, connectionId);
|
|
6262
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
6263
|
-
}
|
|
6264
|
-
async setServiceConnections(providerId, connectionId, previousConnectionId) {
|
|
6265
|
-
const revision = this.$.revision.value;
|
|
6266
|
-
if (revision == null) return false;
|
|
6267
|
-
const changes = setServiceConnections(revision.revision.content, providerId, connectionId, previousConnectionId);
|
|
6268
|
-
return changes.length == 0 || await this.#editDraft(changes) != null;
|
|
6269
|
-
}
|
|
6270
|
-
async setCodeActions(nodeId, capabilities) {
|
|
6271
|
-
const revision = this.$.revision.value;
|
|
6272
|
-
if (revision == null) return false;
|
|
6273
|
-
const changes = setCodeActions(revision.revision.content, nodeId, capabilities);
|
|
6274
|
-
return changes == null || await this.#editDraft(changes) != null;
|
|
6275
|
-
}
|
|
6276
6372
|
get eventSourceClient() {
|
|
6277
6373
|
return this.#client;
|
|
6278
6374
|
}
|
|
@@ -6281,22 +6377,6 @@ var WorkspaceStore = class {
|
|
|
6281
6377
|
if (flowId == null) throw new Error("No Flow selected");
|
|
6282
6378
|
return await this.#client.listEventSources(flowId, signal);
|
|
6283
6379
|
}
|
|
6284
|
-
async setTriggerEventSource(triggerId, source) {
|
|
6285
|
-
const revision = this.$.revision.value;
|
|
6286
|
-
if (revision == null) return false;
|
|
6287
|
-
const trigger = revision.graph()?.nodes[triggerId];
|
|
6288
|
-
if (trigger?.kind != "integration" || trigger.definition.key != "feishu_app_bot.on_event" || source.provider != trigger.definition.provider) return false;
|
|
6289
|
-
const connectionChanges = setTriggerConnection(revision.revision.content, triggerId, source.connectionId);
|
|
6290
|
-
if (connectionChanges == null) return false;
|
|
6291
|
-
const changed = inputValue(trigger.config.sourceId, void 0) != source.sourceId;
|
|
6292
|
-
return await this.#editDraft([
|
|
6293
|
-
...connectionChanges,
|
|
6294
|
-
...updateTriggerConfig(revision.revision.content, triggerId, "sourceId", source.sourceId) ?? [],
|
|
6295
|
-
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "eventTypes", void 0) ?? [] : [],
|
|
6296
|
-
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "resource", void 0) ?? [] : [],
|
|
6297
|
-
...changed ? updateTriggerConfig(revision.revision.content, triggerId, "chatIds", void 0) ?? [] : []
|
|
6298
|
-
]) != null;
|
|
6299
|
-
}
|
|
6300
6380
|
async loadTriggerConfigOptions(triggerId, field, signal) {
|
|
6301
6381
|
const flowId = this.#model.value.flowId;
|
|
6302
6382
|
const current = this.#draftSession.capture();
|
|
@@ -6305,42 +6385,6 @@ var WorkspaceStore = class {
|
|
|
6305
6385
|
if (this.#disposed || !current() || flowId == null) throw new DOMException("Draft changed", "AbortError");
|
|
6306
6386
|
return await this.#client.listTriggerConfigOptions(flowId, triggerId, field, signal);
|
|
6307
6387
|
}
|
|
6308
|
-
async saveTriggerConfig(triggerId, name, value) {
|
|
6309
|
-
const revision = this.$.revision.value;
|
|
6310
|
-
if (revision == null) return false;
|
|
6311
|
-
let changes = updateTriggerConfig(revision.revision.content, triggerId, name, value);
|
|
6312
|
-
if (changes == null) return false;
|
|
6313
|
-
const trigger = revision.graph()?.nodes[triggerId];
|
|
6314
|
-
if (changes.length > 0 && trigger?.kind == "integration" && trigger.definition.key == "feishu_app_bot.on_event" && name == "eventTypes") {
|
|
6315
|
-
const events = Array.isArray(value) ? value.filter((item) => typeof item == "string") : [];
|
|
6316
|
-
if (!supportsFeishuChatFilter(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content, triggerId, "chatIds", void 0) ?? []];
|
|
6317
|
-
const resource = inputValue(trigger.config.resource, void 0);
|
|
6318
|
-
if (isJsonObject(resource) && resource.kind != feishuResourceKind(events)) changes = [...changes, ...updateTriggerConfig(revision.revision.content, triggerId, "resource", void 0) ?? []];
|
|
6319
|
-
}
|
|
6320
|
-
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;
|
|
6321
|
-
return await this.#editDraft(changes) != null;
|
|
6322
|
-
}
|
|
6323
|
-
async saveTriggerSchedule(triggerId, schedule) {
|
|
6324
|
-
const revision = this.$.revision.value;
|
|
6325
|
-
if (revision == null) return false;
|
|
6326
|
-
const changes = updateTriggerSchedule(revision.revision.content, triggerId, schedule);
|
|
6327
|
-
return changes != null && await this.#editDraft(changes) != null;
|
|
6328
|
-
}
|
|
6329
|
-
async saveWebhook(triggerId, settings, deletion) {
|
|
6330
|
-
const revision = this.$.revision.value;
|
|
6331
|
-
if (revision == null) return false;
|
|
6332
|
-
const changes = updateWebhook(revision, triggerId, settings);
|
|
6333
|
-
return changes != null && await this.#editDraft(changes, deletion) != null;
|
|
6334
|
-
}
|
|
6335
|
-
async setTriggerConnection(triggerId, connectionId) {
|
|
6336
|
-
const revision = this.$.revision.value;
|
|
6337
|
-
if (revision == null) return false;
|
|
6338
|
-
const changes = setTriggerConnection(revision.revision.content, triggerId, connectionId);
|
|
6339
|
-
if (changes == null) return false;
|
|
6340
|
-
const trigger = revision.graph()?.nodes[triggerId];
|
|
6341
|
-
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;
|
|
6342
|
-
return await this.#editDraft(changes) != null;
|
|
6343
|
-
}
|
|
6344
6388
|
updateModuleSource(source) {
|
|
6345
6389
|
const editor = this.#model.value.moduleEditor;
|
|
6346
6390
|
if (this.#history.applying || this.#history.failed || editor == null || editor.source == source) return;
|
|
@@ -6411,9 +6455,6 @@ var WorkspaceStore = class {
|
|
|
6411
6455
|
}), [nodeId]) || this.#disposed) return;
|
|
6412
6456
|
return nodeId;
|
|
6413
6457
|
}
|
|
6414
|
-
async #editDraft(changes, deletion) {
|
|
6415
|
-
return await this.#canvasChange("edit", 1, changes, void 0, void 0, deletion) ? this.#model.value.draft : void 0;
|
|
6416
|
-
}
|
|
6417
6458
|
#notifyDeletion(deletion, entry) {
|
|
6418
6459
|
this.#setNotice({
|
|
6419
6460
|
kind: "success",
|
|
@@ -6432,7 +6473,7 @@ var WorkspaceStore = class {
|
|
|
6432
6473
|
const flowId = this.#model.value.flowId;
|
|
6433
6474
|
const draft = this.#model.value.draft;
|
|
6434
6475
|
if (flowId == null || draft == null) return;
|
|
6435
|
-
if (changes.length == 0 || dequal$1(applyFlowChanges(draft, changes).content, draft.content)) return draft;
|
|
6476
|
+
if (changes.length == 0 || dequal$1(applyFlowChanges$1(draft, changes).content, draft.content)) return draft;
|
|
6436
6477
|
const cleared = historyMode == "clear" && this.#history.clear();
|
|
6437
6478
|
const current = this.#draftSession.capture();
|
|
6438
6479
|
this.#history.pending++;
|
|
@@ -6526,7 +6567,7 @@ var WorkspaceStore = class {
|
|
|
6526
6567
|
if (draft == null || presentation == null) return false;
|
|
6527
6568
|
const next = update?.(presentation.value) ?? presentation.value;
|
|
6528
6569
|
const presentationChange = canvasPresentationChange(presentation.value, next);
|
|
6529
|
-
if (dequal$1(applyFlowChanges(draft, changes).content, draft.content) && presentationChange.nodeIds.length == 0) return true;
|
|
6570
|
+
if (dequal$1(applyFlowChanges$1(draft, changes).content, draft.content) && presentationChange.nodeIds.length == 0) return true;
|
|
6530
6571
|
const generation = this.#history.generation;
|
|
6531
6572
|
const inverse = inverseFlowChanges(draft.content, changes);
|
|
6532
6573
|
this.#history.pending++;
|
|
@@ -6943,6 +6984,23 @@ var WorkbenchStore = class {
|
|
|
6943
6984
|
dismissNotice() {
|
|
6944
6985
|
if (!this.#disposed) this.#notice.set(void 0);
|
|
6945
6986
|
}
|
|
6987
|
+
async exportSvg(language, options) {
|
|
6988
|
+
const model = this.$.designer.value;
|
|
6989
|
+
const title = this.workspace.$.flow.value?.name ?? this.workspace.$.flowId.value ?? "Workflow";
|
|
6990
|
+
try {
|
|
6991
|
+
const { downloadFlowSvg } = await import("./exportSvg-D4CqCcx2.js");
|
|
6992
|
+
await downloadFlowSvg(model, title, language, options);
|
|
6993
|
+
if (!this.#disposed) this.#notice.set({
|
|
6994
|
+
kind: "success",
|
|
6995
|
+
message: this.#i18n.t("resource.exportSvgComplete")
|
|
6996
|
+
});
|
|
6997
|
+
} catch {
|
|
6998
|
+
if (!this.#disposed) this.#notice.set({
|
|
6999
|
+
kind: "error",
|
|
7000
|
+
message: this.#i18n.t("resource.exportSvgFailed")
|
|
7001
|
+
});
|
|
7002
|
+
}
|
|
7003
|
+
}
|
|
6946
7004
|
invalidateVariableNames() {
|
|
6947
7005
|
this.#variableNamesStale = true;
|
|
6948
7006
|
}
|
|
@@ -7075,7 +7133,7 @@ var WorkbenchStore = class {
|
|
|
7075
7133
|
const executor = "executor" in node.node.task ? node.node.task.executor : void 0;
|
|
7076
7134
|
if (executor?.kind != "connector" || executor.action != action.actionId || executor.connectionId != null) return;
|
|
7077
7135
|
const connection = prepared.action.defaultConnection;
|
|
7078
|
-
if (connection != null) await this.workspace.setConnectorConnection(node.id, connection.connectionId);
|
|
7136
|
+
if (connection != null) await this.workspace.nodes.setConnectorConnection(node.id, connection.connectionId);
|
|
7079
7137
|
if (!this.#disposed && flowId == this.workspace.$.flowId.value) await this.connectors.refresh();
|
|
7080
7138
|
} catch (error) {
|
|
7081
7139
|
if (!this.#disposed && flowId == this.workspace.$.flowId.value) this.#notice.set(errorNotice(error, this.#i18n.t));
|
|
@@ -7184,7 +7242,7 @@ var WorkbenchStore = class {
|
|
|
7184
7242
|
};
|
|
7185
7243
|
//#endregion
|
|
7186
7244
|
//#region src/workbench/browser/runtime/openFlowWorkbench.tsx
|
|
7187
|
-
var FlowWorkspace = lazy(() => import("./flowWorkspace-
|
|
7245
|
+
var FlowWorkspace = lazy(() => import("./flowWorkspace-zFBFtZPo.js"));
|
|
7188
7246
|
function OpenFlowSessionGate({ action, description, error, onSubmit, onTokenChange, pending = false, title, token, tokenLabel }) {
|
|
7189
7247
|
const hasToken = token != null && tokenLabel != null && onTokenChange != null;
|
|
7190
7248
|
const tokenValue = token ?? "";
|