@oomol-lab/open-flow 0.1.0-beta.64 → 0.1.0-beta.66
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/{createResourceDialog-BAJXbzNH.js → createResourceDialog-C-Si_cYs.js} +2 -2
- package/dist/browser/flow-authoring-node.d.ts +12 -3
- package/dist/browser/flow-authoring.js +135 -21
- package/dist/browser/flow-change-schema.d.ts +3 -1
- package/dist/browser/flow-change.d.ts +15 -3
- package/dist/browser/flow-change.js +111 -16
- package/dist/browser/{flowChanges-BAMkSaKF.js → flowChanges-T4_R5p1f.js} +3031 -2124
- package/dist/browser/{flowRunInputEditorStore-B2Rw4VsT.js → flowRunInputEditorStore-DJqmR6Qh.js} +3 -2
- package/dist/browser/{flowWorkspace-DxLc1Ybv.js → flowWorkspace-C0J5C0oM.js} +754 -163
- package/dist/browser/{icons-Db2Jb2iX.js → icons-BD3m0RQq.js} +4484 -4370
- package/dist/browser/preview.css +160 -64
- package/dist/browser/preview.js +6487 -5232
- package/dist/browser/ui.css +93 -3
- package/dist/browser/ui.js +8 -5
- package/dist/browser/workbench.css +160 -64
- package/dist/browser/workbench.js +175 -59
- package/dist/browser/{workbenchSelect-C-jf6NIM.js → workbenchSelect-B-PFpF_Q.js} +1 -1
- package/dist/command/index.js +49 -49
- package/dist/common/authoring.d.ts +7 -5
- package/dist/common/authoringExamples.d.ts +3 -3
- package/dist/common/authoringFields.d.ts +20 -0
- package/dist/common/authoringSchema.d.ts +404 -15
- package/dist/common/connectorDecoders.d.ts +2 -1
- package/dist/common/control-api-conformance.js +403 -137
- package/dist/common/control-api.d.ts +70 -7
- package/dist/common/control-api.js +3587 -3428
- package/dist/common/control-requests.d.ts +10 -3
- package/dist/common/control-requests.js +463 -48
- package/dist/common/decision.js +28 -3
- package/dist/common/flow-encoding.d.ts +4 -2
- package/dist/common/flow-encoding.js +144 -10
- package/dist/common/flow-graph.d.ts +1 -1
- package/dist/common/flow-semantics.d.ts +12 -2
- package/dist/common/flow-semantics.js +152 -33
- package/dist/common/integration-trigger.js +28 -3
- package/dist/common/liveDetails.d.ts +26 -11
- package/dist/common/mcp.d.ts +6 -3
- package/dist/common/mcp.js +3541 -3403
- package/dist/common/openapi.js +28 -3
- package/dist/common/poll-trigger.js +28 -3
- package/dist/common/run-events.d.ts +2 -0
- package/dist/common/run-events.js +9 -3
- package/dist/common/scheduler.d.ts +11 -1
- package/dist/common/scheduler.js +216 -48
- package/dist/common/trigger-contract.d.ts +2 -0
- package/dist/common/webhook-trigger.js +28 -3
- package/dist/common/workflow.d.ts +93 -0
- package/dist/common/workflow.js +10491 -0
- package/package.json +5 -1
- package/skills/open-flow/references/flow-authoring.md +26 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as useTranslate } from "./dist-BFmpkX4P.js";
|
|
2
|
-
import { C as FieldDescription, E as FieldLabel, S as Field, T as FieldGroup, a as DialogDescription, c as DialogTitle,
|
|
3
|
-
import { t as WorkbenchSelect } from "./workbenchSelect-
|
|
2
|
+
import { C as FieldDescription, E as FieldLabel, S as Field, T as FieldGroup, a as DialogDescription, c as DialogTitle, fr as Input, i as DialogContent, n as Dialog, o as DialogFooter, r as DialogClose, s as DialogHeader, t as Icon, w as FieldError, wi as Button, x as Spinner } from "./icons-BD3m0RQq.js";
|
|
3
|
+
import { t as WorkbenchSelect } from "./workbenchSelect-B-PFpF_Q.js";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/workbench/browser/runtime/shell/createResourceDialog.tsx
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DecisionQuestion } from '../common/decision.js';
|
|
2
|
-
import type { ChangeOperation, CodeModule, ConnectorCapability, GraphNode, InputMapping, InputValues, InputPort, JsonValue, PortDefinition, RevisionContent, TaskDefinition, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookOptions } from './flow-change.js';
|
|
2
|
+
import type { ChangeOperation, CodeModule, ConnectorCapability, Group, GraphNode, InputMapping, InputValues, InputPort, JsonValue, Port, PortDefinition, RevisionContent, TaskDefinition, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookOptions } from './flow-change.js';
|
|
3
3
|
export declare const defaultCodeTaskPorts: Pick<Extract<TaskDefinition, {
|
|
4
4
|
readonly moduleId: string;
|
|
5
5
|
}>, 'inputs' | 'outputs' | 'capabilities'>;
|
|
@@ -14,13 +14,17 @@ export interface LlmTaskOptions {
|
|
|
14
14
|
}
|
|
15
15
|
export type LlmInputHandle = 'input' | 'messages' | 'model' | 'template';
|
|
16
16
|
export declare function defaultNodeName(_content: RevisionContent, node: GraphNode): string;
|
|
17
|
-
export declare function repairNodeNames(content: RevisionContent
|
|
17
|
+
export declare function repairNodeNames(content: RevisionContent, defaults?: {
|
|
18
|
+
readonly start?: string;
|
|
19
|
+
}): readonly ChangeOperation[];
|
|
18
20
|
interface TriggerSettingsBase {
|
|
19
21
|
readonly description?: string;
|
|
20
22
|
readonly name: string;
|
|
21
23
|
}
|
|
22
24
|
export type TriggerSettings = (TriggerSettingsBase & {
|
|
23
25
|
readonly kind: 'manual';
|
|
26
|
+
}) | (TriggerSettingsBase & {
|
|
27
|
+
readonly kind: 'start';
|
|
24
28
|
}) | (TriggerSettingsBase & {
|
|
25
29
|
readonly kind: 'error';
|
|
26
30
|
}) | (TriggerSettingsBase & {
|
|
@@ -69,7 +73,7 @@ export declare function createValue(nodeId: string, name: string, values?: reado
|
|
|
69
73
|
export declare function createWait(nodeId: string, name: string): readonly ChangeOperation[];
|
|
70
74
|
export declare function createApproval(nodeId: string, name: string): readonly ChangeOperation[];
|
|
71
75
|
export declare function createBuiltinTrigger(nodeId: string, node: Extract<TriggerNode, {
|
|
72
|
-
readonly kind: 'error' | 'cron' | 'manual' | 'webhook';
|
|
76
|
+
readonly kind: 'error' | 'cron' | 'manual' | 'start' | 'webhook';
|
|
73
77
|
}>): readonly ChangeOperation[];
|
|
74
78
|
export declare function createProviderTrigger(nodeId: string, definition: TriggerKeySnapshot, options: {
|
|
75
79
|
readonly config: Readonly<Record<string, JsonValue>>;
|
|
@@ -89,6 +93,8 @@ export declare function setInputSources(content: RevisionContent, nodeId: string
|
|
|
89
93
|
export declare function setInputVariable(content: RevisionContent, nodeId: string, handle: string, name: string, bindingId: string): readonly ChangeOperation[] | undefined;
|
|
90
94
|
export declare function cleanVariableBindings(content: RevisionContent, operations: readonly ChangeOperation[]): readonly ChangeOperation[];
|
|
91
95
|
export declare function setConnectorConnection(content: RevisionContent, nodeId: string, connectionId: string | undefined): readonly ChangeOperation[] | undefined;
|
|
96
|
+
/** Edit the workflow input contract and preserve references on a single-field rename. */
|
|
97
|
+
export declare function updateStartInputDefs(content: RevisionContent, nodeId: string, value: readonly Port[]): readonly ChangeOperation[];
|
|
92
98
|
export declare function updateTrigger(content: RevisionContent, nodeId: string, settings: TriggerSettings): readonly ChangeOperation[] | undefined;
|
|
93
99
|
export declare function updateTriggerConfig(content: RevisionContent, nodeId: string, name: string, value: JsonValue | undefined): readonly ChangeOperation[] | undefined;
|
|
94
100
|
export declare function updateTriggerSchedule(content: RevisionContent, nodeId: string, schedule: readonly TriggerSchedule[]): readonly ChangeOperation[] | undefined;
|
|
@@ -97,4 +103,7 @@ export declare function setCodeActions(content: RevisionContent, nodeId: string,
|
|
|
97
103
|
export declare function createDecisionTask(identity: {
|
|
98
104
|
readonly nodeId: string;
|
|
99
105
|
}, name?: string, questions?: readonly DecisionQuestion[]): readonly ChangeOperation[];
|
|
106
|
+
/** Edit an Outputs node's definitions and mappings as one undoable change. */
|
|
107
|
+
export declare function updateOutputsDefs(content: RevisionContent, nodeId: string, value: readonly Port[], outputMappings?: Readonly<Record<string, InputMapping>>): readonly ChangeOperation[];
|
|
108
|
+
export declare function renameFlowOutputSources(content: RevisionContent, nodeIds: ReadonlySet<string>, previous: readonly (Port | Group)[], next: readonly (Port | Group)[]): readonly ChangeOperation[];
|
|
100
109
|
export {};
|
|
@@ -59,11 +59,30 @@ function dequal(foo, bar) {
|
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region src/flow/common/edgeChanges.ts
|
|
61
61
|
function connect(content, edge) {
|
|
62
|
-
|
|
63
|
-
return [
|
|
62
|
+
const selected = content.document.graph;
|
|
63
|
+
if (selected?.edges.some((candidate) => dequal(candidate, edge))) return [];
|
|
64
|
+
const changes = [{
|
|
64
65
|
edge,
|
|
65
66
|
kind: "graph.edge.connect"
|
|
66
67
|
}];
|
|
68
|
+
const source = selected.nodes[edge.source];
|
|
69
|
+
const target = selected.nodes[edge.target];
|
|
70
|
+
if (edge.sourceHandle == "pending" && (source?.kind == "approval" || source?.kind == "wait") && target?.kind == "task" && "executor" in target.task && target.task.executor.kind == "connector" && target.task.executor.action == "leina.send_notification" && (target.inputs.message == null || target.inputs.message.kind == "unset")) changes.push({
|
|
71
|
+
kind: "graph.node.input.set",
|
|
72
|
+
nodeId: edge.target,
|
|
73
|
+
handle: "message",
|
|
74
|
+
before: target.inputs.message,
|
|
75
|
+
value: {
|
|
76
|
+
kind: "sources",
|
|
77
|
+
sources: [{
|
|
78
|
+
kind: "node",
|
|
79
|
+
nodeId: edge.source,
|
|
80
|
+
output: "pending",
|
|
81
|
+
field: "message"
|
|
82
|
+
}]
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return changes;
|
|
67
86
|
}
|
|
68
87
|
function disconnect(content, edge) {
|
|
69
88
|
if (!content.document.graph?.edges.some((candidate) => dequal(candidate, edge))) return [];
|
|
@@ -5803,6 +5822,10 @@ function preprocess(fn, schema) {
|
|
|
5803
5822
|
out: schema
|
|
5804
5823
|
});
|
|
5805
5824
|
}
|
|
5825
|
+
function checkJsonDepth(value, depth = 0) {
|
|
5826
|
+
if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
|
|
5827
|
+
if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
|
|
5828
|
+
}
|
|
5806
5829
|
//#endregion
|
|
5807
5830
|
//#region src/flow/common/triggerScheduleSchema.ts
|
|
5808
5831
|
var triggerScheduleSchema = array(union([object({
|
|
@@ -5838,6 +5861,7 @@ var port = object({
|
|
|
5838
5861
|
nullable: boolean(),
|
|
5839
5862
|
handle: text
|
|
5840
5863
|
});
|
|
5864
|
+
var workflowInputDefs = array(port.strict());
|
|
5841
5865
|
var input = port.extend({ value: json.optional() });
|
|
5842
5866
|
var group = object({
|
|
5843
5867
|
collapsed: boolean().optional(),
|
|
@@ -5995,6 +6019,11 @@ var managedFields = object({
|
|
|
5995
6019
|
messageHandle: text,
|
|
5996
6020
|
inputs: record$1(text, agentValue)
|
|
5997
6021
|
}).optional()
|
|
6022
|
+
}),
|
|
6023
|
+
strictObject({
|
|
6024
|
+
kind: literal("workflow"),
|
|
6025
|
+
flowId: text,
|
|
6026
|
+
revisionId: text
|
|
5998
6027
|
})
|
|
5999
6028
|
])
|
|
6000
6029
|
});
|
|
@@ -6103,6 +6132,12 @@ var base = {
|
|
|
6103
6132
|
timeoutMs: number().optional()
|
|
6104
6133
|
};
|
|
6105
6134
|
var node = union([
|
|
6135
|
+
strictObject({
|
|
6136
|
+
...base,
|
|
6137
|
+
kind: literal("outputs"),
|
|
6138
|
+
outputDefs: array(port.strict()),
|
|
6139
|
+
outputMappings: inputs
|
|
6140
|
+
}).omit({ inputs: true }),
|
|
6106
6141
|
object({
|
|
6107
6142
|
...base,
|
|
6108
6143
|
inputs: record$1(text, never()),
|
|
@@ -6135,6 +6170,11 @@ var node = union([
|
|
|
6135
6170
|
...trigger,
|
|
6136
6171
|
kind: literal("manual")
|
|
6137
6172
|
}),
|
|
6173
|
+
strictObject({
|
|
6174
|
+
...trigger,
|
|
6175
|
+
kind: literal("start"),
|
|
6176
|
+
inputDefs: workflowInputDefs
|
|
6177
|
+
}),
|
|
6138
6178
|
strictObject({
|
|
6139
6179
|
...trigger,
|
|
6140
6180
|
kind: literal("error"),
|
|
@@ -6199,35 +6239,51 @@ var module = object({
|
|
|
6199
6239
|
imports: strings,
|
|
6200
6240
|
source: text
|
|
6201
6241
|
});
|
|
6202
|
-
var document = preprocess(
|
|
6242
|
+
var document = preprocess(normalizeDocument, object({
|
|
6203
6243
|
bindings: record$1(text, binding),
|
|
6204
6244
|
graph
|
|
6205
6245
|
}));
|
|
6206
|
-
object({
|
|
6246
|
+
var revision = object({
|
|
6207
6247
|
modelVersion: union([
|
|
6208
6248
|
literal(2),
|
|
6209
6249
|
literal(4),
|
|
6210
6250
|
literal(5),
|
|
6211
|
-
literal(6)
|
|
6251
|
+
literal(6),
|
|
6252
|
+
literal(7),
|
|
6253
|
+
literal(8)
|
|
6212
6254
|
]),
|
|
6213
6255
|
document,
|
|
6214
6256
|
modules: record$1(text, module)
|
|
6215
|
-
})
|
|
6257
|
+
});
|
|
6258
|
+
revision.extend({
|
|
6216
6259
|
kind: literal("open-flow-flow-revision"),
|
|
6217
6260
|
version: literal(1)
|
|
6218
6261
|
});
|
|
6219
|
-
function
|
|
6262
|
+
function normalizeDocument(value) {
|
|
6220
6263
|
const candidate = record(value);
|
|
6221
6264
|
if (candidate.tasks !== void 0 && (candidate.tasks === null || typeof candidate.tasks !== "object" || Array.isArray(candidate.tasks) || Object.keys(candidate.tasks).length > 0)) throw new TypeError("Independent Task definitions are no longer supported.");
|
|
6222
6265
|
if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
|
|
6223
6266
|
const subflows = candidate.subflows;
|
|
6224
6267
|
if (subflows !== void 0 && (subflows === null || typeof subflows !== "object" || Array.isArray(subflows) || Object.keys(subflows).length > 0)) throw new TypeError("Subflows are no longer supported.");
|
|
6225
6268
|
if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
|
|
6269
|
+
if ([
|
|
6270
|
+
"inputDefs",
|
|
6271
|
+
"outputDefs",
|
|
6272
|
+
"outputMappings"
|
|
6273
|
+
].some((field) => Object.hasOwn(candidate, field))) throw new TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");
|
|
6274
|
+
if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind == "start" && Object.hasOwn(record(candidateNode), "parameters"))) throw new TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");
|
|
6226
6275
|
return value;
|
|
6227
6276
|
}
|
|
6228
6277
|
function record(value) {
|
|
6229
6278
|
return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
|
|
6230
6279
|
}
|
|
6280
|
+
function decodeRevisionContent(value) {
|
|
6281
|
+
checkJsonDepth(value);
|
|
6282
|
+
const content = revision.parse(value);
|
|
6283
|
+
checkModelVersion(content);
|
|
6284
|
+
assertOpenApiAuthBindings(content.document);
|
|
6285
|
+
return content;
|
|
6286
|
+
}
|
|
6231
6287
|
var shapes = {
|
|
6232
6288
|
"graph.trigger.sources.set": {
|
|
6233
6289
|
nodeId: text,
|
|
@@ -6380,6 +6436,12 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
|
|
|
6380
6436
|
kind: literal(kind),
|
|
6381
6437
|
...shape
|
|
6382
6438
|
})])).values()])).min(1);
|
|
6439
|
+
function checkModelVersion(content) {
|
|
6440
|
+
if (content.modelVersion < 8 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "outputs")) throw new TypeError("Workflow outputs require Flow model version 8.");
|
|
6441
|
+
if (content.modelVersion < 7 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "start")) throw new TypeError("Start Triggers require Flow model version 7.");
|
|
6442
|
+
if (content.modelVersion < 6 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task)) throw new TypeError("Node-owned managed Tasks require Flow model version 6.");
|
|
6443
|
+
if (content.modelVersion < 5 && Object.values(content.document.graph.nodes).some((itemNode) => itemNode.kind == "error")) throw new TypeError("Error workflows require Flow model version 5.");
|
|
6444
|
+
}
|
|
6383
6445
|
//#endregion
|
|
6384
6446
|
//#region src/flow/common/condition.ts
|
|
6385
6447
|
var unaryOperator = (operator) => operator.startsWith("is");
|
|
@@ -6399,6 +6461,7 @@ function conditionOperands(node) {
|
|
|
6399
6461
|
}] : []])));
|
|
6400
6462
|
}
|
|
6401
6463
|
function nodeInputMappings(node) {
|
|
6464
|
+
if (node.kind == "outputs") return node.outputMappings;
|
|
6402
6465
|
if (node.kind != "condition") return "inputs" in node ? node.inputs : {};
|
|
6403
6466
|
return Object.fromEntries(conditionOperands(node).flatMap(({ handle, operand }) => operand.kind == "source" ? [[handle, {
|
|
6404
6467
|
kind: "sources",
|
|
@@ -6550,6 +6613,40 @@ function decodeConnectorCapabilities(value) {
|
|
|
6550
6613
|
};
|
|
6551
6614
|
});
|
|
6552
6615
|
}
|
|
6616
|
+
function isTriggerNode(node) {
|
|
6617
|
+
return [
|
|
6618
|
+
"manual",
|
|
6619
|
+
"start",
|
|
6620
|
+
"error",
|
|
6621
|
+
"webhook",
|
|
6622
|
+
"cron",
|
|
6623
|
+
"poll",
|
|
6624
|
+
"integration"
|
|
6625
|
+
].includes(node.kind);
|
|
6626
|
+
}
|
|
6627
|
+
function upgradeDecodedRevisionContent(content) {
|
|
6628
|
+
const graph = content.document.graph;
|
|
6629
|
+
const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
|
|
6630
|
+
if (!hasManual && content.modelVersion == 8) return content;
|
|
6631
|
+
return {
|
|
6632
|
+
...content,
|
|
6633
|
+
modelVersion: 8,
|
|
6634
|
+
document: {
|
|
6635
|
+
...content.document,
|
|
6636
|
+
graph: hasManual ? {
|
|
6637
|
+
...graph,
|
|
6638
|
+
nodes: Object.fromEntries(Object.entries(graph.nodes).map(([id, node]) => [id, upgradeManualTrigger(node)]))
|
|
6639
|
+
} : graph
|
|
6640
|
+
}
|
|
6641
|
+
};
|
|
6642
|
+
}
|
|
6643
|
+
function upgradeManualTrigger(node) {
|
|
6644
|
+
return node.kind == "manual" ? {
|
|
6645
|
+
...node,
|
|
6646
|
+
kind: "start",
|
|
6647
|
+
inputDefs: []
|
|
6648
|
+
} : node;
|
|
6649
|
+
}
|
|
6553
6650
|
function normalizeNodeName(value) {
|
|
6554
6651
|
return value.trim().normalize("NFC");
|
|
6555
6652
|
}
|
|
@@ -6568,8 +6665,9 @@ function invalid(message) {
|
|
|
6568
6665
|
throw new FlowChangeError(message);
|
|
6569
6666
|
}
|
|
6570
6667
|
function applyFlowChanges(content, operations) {
|
|
6571
|
-
const
|
|
6572
|
-
const
|
|
6668
|
+
const source = content.modelVersion != 8 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
|
|
6669
|
+
const document = { ...source.document };
|
|
6670
|
+
const modules = { ...source.modules };
|
|
6573
6671
|
for (const operation of operations) switch (operation.kind) {
|
|
6574
6672
|
case "graph.trigger.sources.set": {
|
|
6575
6673
|
const graph = document.graph;
|
|
@@ -6620,8 +6718,9 @@ function applyFlowChanges(content, operations) {
|
|
|
6620
6718
|
case "graph.edge.connect": {
|
|
6621
6719
|
const graph = document.graph;
|
|
6622
6720
|
if (graph.nodes[operation.edge.source] == null) invalid("The source Node does not exist.");
|
|
6721
|
+
if (graph.nodes[operation.edge.source]?.kind == "outputs") invalid("Outputs cannot have downstream execution edges.");
|
|
6623
6722
|
const node = graph.nodes[operation.edge.target];
|
|
6624
|
-
if (node == null ||
|
|
6723
|
+
if (node == null || isTriggerNode(node)) invalid("The target Node does not accept execution dependencies.");
|
|
6625
6724
|
if (graph.edges.some((edge) => dequal(edge, operation.edge))) invalid("The Nodes are already connected.");
|
|
6626
6725
|
Object.assign(document, { graph: {
|
|
6627
6726
|
...graph,
|
|
@@ -6701,9 +6800,10 @@ function applyFlowChanges(content, operations) {
|
|
|
6701
6800
|
const graph = document.graph;
|
|
6702
6801
|
if (graph.nodes[operation.nodeId] != null) invalid("A Node with this ID already exists in the target graph.");
|
|
6703
6802
|
if (operation.node.kind == "error" && Object.values(graph.nodes).some((node) => node.kind == "error")) invalid("A graph can contain only one Flow Error node.");
|
|
6704
|
-
if (operation.node.kind == "manual" && Object.values(graph.nodes).some((node) => node.kind == "manual")) invalid("A graph can contain only one
|
|
6803
|
+
if ((operation.node.kind == "manual" || operation.node.kind == "start") && Object.values(graph.nodes).some((node) => node.kind == "manual" || node.kind == "start")) invalid("A graph can contain only one Start Trigger.");
|
|
6705
6804
|
if (operation.node.kind == "task" && "moduleId" in operation.node.task && operation.node.task.capabilities !== void 0) decodeConnectorCapabilities(operation.node.task.capabilities);
|
|
6706
6805
|
if (operation.node.name == null) invalid("A Node name cannot be empty.");
|
|
6806
|
+
if (operation.node.kind == "outputs" && Object.values(graph.nodes).some((node) => node.kind == "outputs")) invalid("A graph can contain only one Outputs node.");
|
|
6707
6807
|
const name = normalizeNodeName(operation.node.name);
|
|
6708
6808
|
const issue = nodeNameIssue(graph, operation.nodeId, name);
|
|
6709
6809
|
if (issue == "empty") invalid("A Node name cannot be empty.");
|
|
@@ -6761,11 +6861,24 @@ function applyFlowChanges(content, operations) {
|
|
|
6761
6861
|
case "graph.node.input.set": {
|
|
6762
6862
|
const graph = document.graph;
|
|
6763
6863
|
const node = graph.nodes[operation.nodeId];
|
|
6764
|
-
if (node == null ||
|
|
6864
|
+
if (node == null || isTriggerNode(node)) invalid("The Node does not accept inputs.");
|
|
6765
6865
|
if (!dequal(nodeInputMappings(node)[operation.handle], operation.before)) invalid("The Node input changed before this operation was applied.");
|
|
6766
|
-
const inputs = { ...node
|
|
6866
|
+
const inputs = { ...nodeInputMappings(node) };
|
|
6767
6867
|
if (operation.value == null) delete inputs[operation.handle];
|
|
6768
6868
|
else inputs[operation.handle] = operation.value;
|
|
6869
|
+
if (node.kind == "outputs") {
|
|
6870
|
+
document.graph = {
|
|
6871
|
+
...graph,
|
|
6872
|
+
nodes: {
|
|
6873
|
+
...graph.nodes,
|
|
6874
|
+
[operation.nodeId]: {
|
|
6875
|
+
...node,
|
|
6876
|
+
outputMappings: inputs
|
|
6877
|
+
}
|
|
6878
|
+
}
|
|
6879
|
+
};
|
|
6880
|
+
break;
|
|
6881
|
+
}
|
|
6769
6882
|
Object.assign(document, { graph: {
|
|
6770
6883
|
...graph,
|
|
6771
6884
|
nodes: {
|
|
@@ -6993,11 +7106,11 @@ function applyFlowChanges(content, operations) {
|
|
|
6993
7106
|
}
|
|
6994
7107
|
}
|
|
6995
7108
|
assertOpenApiAuthBindings(document);
|
|
6996
|
-
return {
|
|
7109
|
+
return upgradeDecodedRevisionContent({
|
|
6997
7110
|
document,
|
|
6998
|
-
modelVersion:
|
|
7111
|
+
modelVersion: 8,
|
|
6999
7112
|
modules
|
|
7000
|
-
};
|
|
7113
|
+
});
|
|
7001
7114
|
}
|
|
7002
7115
|
//#endregion
|
|
7003
7116
|
//#region src/json-schema-subset/utils.ts
|
|
@@ -10117,7 +10230,7 @@ function deleteNodes(content, nodeIds) {
|
|
|
10117
10230
|
}
|
|
10118
10231
|
function updateSettings(content, nodeId, settings) {
|
|
10119
10232
|
const node = content.document.graph?.nodes[nodeId];
|
|
10120
|
-
if (node == null ||
|
|
10233
|
+
if (node == null || isTriggerNode(node)) return;
|
|
10121
10234
|
const operations = [];
|
|
10122
10235
|
if (node.name != settings.name) operations.push({
|
|
10123
10236
|
before: node.name,
|
|
@@ -10144,7 +10257,7 @@ function updateSettings(content, nodeId, settings) {
|
|
|
10144
10257
|
}
|
|
10145
10258
|
function setInputValues(content, nodeId, values) {
|
|
10146
10259
|
const node = content.document.graph?.nodes[nodeId];
|
|
10147
|
-
if (node == null ||
|
|
10260
|
+
if (node == null || isTriggerNode(node)) return;
|
|
10148
10261
|
const operations = [];
|
|
10149
10262
|
for (const [handle, value] of Object.entries(values)) {
|
|
10150
10263
|
const before = nodeInputMappings(node)[handle];
|
|
@@ -10162,7 +10275,7 @@ function setInputValues(content, nodeId, values) {
|
|
|
10162
10275
|
}
|
|
10163
10276
|
function setInputSources(content, nodeId, handle, sources) {
|
|
10164
10277
|
const node = content.document.graph?.nodes[nodeId];
|
|
10165
|
-
if (node == null ||
|
|
10278
|
+
if (node == null || isTriggerNode(node)) return [];
|
|
10166
10279
|
return cleanVariableBindings(content, [{
|
|
10167
10280
|
kind: "graph.node.input.set",
|
|
10168
10281
|
nodeId,
|
|
@@ -10176,7 +10289,7 @@ function setInputSources(content, nodeId, handle, sources) {
|
|
|
10176
10289
|
}
|
|
10177
10290
|
function setInputVariable(content, nodeId, handle, name, bindingId) {
|
|
10178
10291
|
const node = content.document.graph?.nodes[nodeId];
|
|
10179
|
-
if (node == null ||
|
|
10292
|
+
if (node == null || isTriggerNode(node)) return;
|
|
10180
10293
|
const mapping = nodeInputMappings(node)[handle];
|
|
10181
10294
|
const currentId = mapping?.kind == "sources" && mapping.sources.length == 1 && mapping.sources[0]?.kind == "binding" ? mapping.sources[0].bindingId : void 0;
|
|
10182
10295
|
const current = currentId == null ? void 0 : content.document.bindings[currentId];
|
|
@@ -10226,7 +10339,7 @@ function bindingReferences(document) {
|
|
|
10226
10339
|
references.set(bindingId, (references.get(bindingId) ?? 0) + 1);
|
|
10227
10340
|
};
|
|
10228
10341
|
for (const node of Object.values(document.graph.nodes)) {
|
|
10229
|
-
if (
|
|
10342
|
+
if (isTriggerNode(node)) continue;
|
|
10230
10343
|
const inputs = Object.values(nodeInputMappings(node));
|
|
10231
10344
|
for (const mapping of inputs) {
|
|
10232
10345
|
if (mapping.kind != "sources") continue;
|
|
@@ -10274,6 +10387,7 @@ function updateTrigger(content, nodeId, settings) {
|
|
|
10274
10387
|
value: settings.description
|
|
10275
10388
|
});
|
|
10276
10389
|
switch (settings.kind) {
|
|
10390
|
+
case "start":
|
|
10277
10391
|
case "error":
|
|
10278
10392
|
case "manual":
|
|
10279
10393
|
if (trigger.kind != settings.kind) return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeOperation, FlowDocument, JsonValue, RevisionContent } from './flow-change.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
export declare const currentFlowModelVersion =
|
|
3
|
+
export declare const currentFlowModelVersion = 8;
|
|
4
4
|
/** Configuration schemas shared by the node authoring boundary. */
|
|
5
5
|
export declare const authoringDefinitionSchemas: {
|
|
6
6
|
input: z.ZodObject<{
|
|
@@ -267,6 +267,8 @@ export declare const authoringDefinitionSchemas: {
|
|
|
267
267
|
}, z.core.$strip>>;
|
|
268
268
|
}, z.core.$strict>;
|
|
269
269
|
};
|
|
270
|
+
/** Explicit storage upgrade only. Normal reads and authoring still reject retired fields. */
|
|
271
|
+
export declare function upgradeWorkflowInterfaceDocument(value: unknown): unknown;
|
|
270
272
|
/** Best-effort recovery for a parseable Revision envelope. Invalid collection entries are discarded. */
|
|
271
273
|
export declare function repairRevisionEnvelope(value: unknown): RevisionContent;
|
|
272
274
|
export declare function decodeFlowDocument(value: unknown): FlowDocument;
|
|
@@ -108,7 +108,7 @@ export interface ConditionNode extends GraphNodeBase {
|
|
|
108
108
|
readonly matchMode: 'first' | 'all';
|
|
109
109
|
readonly kind: 'condition';
|
|
110
110
|
}
|
|
111
|
-
export type ManagedTaskExecutor = import('../common/decision.js').DecisionExecutor | import('../common/openapi.js').OpenApiExecutor | {
|
|
111
|
+
export type ManagedTaskExecutor = import('../common/workflow.js').WorkflowExecutor | import('../common/decision.js').DecisionExecutor | import('../common/openapi.js').OpenApiExecutor | {
|
|
112
112
|
readonly kind: 'connector';
|
|
113
113
|
readonly action: string;
|
|
114
114
|
readonly connectionId?: string;
|
|
@@ -257,6 +257,9 @@ interface TriggerNodeBase {
|
|
|
257
257
|
}
|
|
258
258
|
export type TriggerNode = (TriggerNodeBase & {
|
|
259
259
|
readonly kind: 'manual';
|
|
260
|
+
}) | (TriggerNodeBase & {
|
|
261
|
+
readonly kind: 'start';
|
|
262
|
+
readonly inputDefs: readonly Port[];
|
|
260
263
|
}) | (TriggerNodeBase & {
|
|
261
264
|
readonly kind: 'error';
|
|
262
265
|
readonly sourceFlowIds?: readonly string[];
|
|
@@ -284,7 +287,13 @@ export type TriggerNode = (TriggerNodeBase & {
|
|
|
284
287
|
};
|
|
285
288
|
readonly kind: 'integration';
|
|
286
289
|
});
|
|
287
|
-
export
|
|
290
|
+
export interface OutputsNode extends Omit<GraphNodeBase, 'inputs'> {
|
|
291
|
+
readonly kind: 'outputs';
|
|
292
|
+
readonly outputDefs: readonly Port[];
|
|
293
|
+
readonly outputMappings: Readonly<Record<string, InputMapping>>;
|
|
294
|
+
}
|
|
295
|
+
export declare function isTriggerNode(node: GraphNode): node is TriggerNode;
|
|
296
|
+
export type GraphNode = OutputsNode | ApprovalNode | ConditionNode | TaskNode | TriggerNode | ValueNode | WaitNode;
|
|
288
297
|
export interface FlowDocument {
|
|
289
298
|
readonly bindings: Readonly<Record<string, {
|
|
290
299
|
readonly kind: 'variable';
|
|
@@ -299,7 +308,7 @@ export interface CodeModule {
|
|
|
299
308
|
}
|
|
300
309
|
export interface RevisionContent {
|
|
301
310
|
readonly document: FlowDocument;
|
|
302
|
-
readonly modelVersion: 2 | 4 | 5 | typeof currentFlowModelVersion;
|
|
311
|
+
readonly modelVersion: 2 | 4 | 5 | 6 | 7 | typeof currentFlowModelVersion;
|
|
303
312
|
readonly modules: Readonly<Record<string, CodeModule>>;
|
|
304
313
|
}
|
|
305
314
|
export interface GraphEdge {
|
|
@@ -307,6 +316,9 @@ export interface GraphEdge {
|
|
|
307
316
|
readonly sourceHandle?: string;
|
|
308
317
|
readonly target: string;
|
|
309
318
|
}
|
|
319
|
+
/** Lossless upgrade of readable content. Historical content and its encoding stay unchanged. */
|
|
320
|
+
export declare function upgradeRevisionContent(content: RevisionContent): RevisionContent;
|
|
321
|
+
export declare function upgradeManualTrigger(node: GraphNode): GraphNode;
|
|
310
322
|
export declare function normalizeNodeName(value: string): string;
|
|
311
323
|
export declare function nextNodeName(value: string, names: Iterable<string>): string;
|
|
312
324
|
export declare function nodeNameIssue(graph: Graph, nodeId: string, value: string): 'duplicate' | 'empty' | undefined;
|