@oomol-lab/open-flow 0.1.0-beta.55 → 0.1.0-beta.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/browser/{createResourceDialog-4H5_lZ6s.js → createResourceDialog-Btjes3wD.js} +2 -2
- package/dist/browser/flow-authoring-edge.d.ts +3 -3
- package/dist/browser/flow-authoring-node.d.ts +26 -46
- package/dist/browser/flow-authoring.js +9155 -21002
- package/dist/browser/flow-change-schema.d.ts +1 -1
- package/dist/browser/flow-change.d.ts +14 -104
- package/dist/browser/flow-change.js +121 -296
- package/dist/browser/{flowChanges-ZzG-f9cg.js → flowChanges-BxutPLYO.js} +1494 -1830
- package/dist/browser/{flowWorkspace-ChpRaTMX.js → flowWorkspace-Dg4mqfa6.js} +118 -293
- package/dist/browser/{icons-CdAB9wyS.js → icons-p2A9zs8t.js} +126 -317
- package/dist/browser/lib-DrKav3HG.js +11403 -0
- package/dist/browser/preview.css +1 -1
- package/dist/browser/preview.js +9308 -9565
- package/dist/browser/ui-idTooltip.d.ts +11 -0
- package/dist/browser/ui.d.ts +5 -0
- package/dist/browser/ui.js +83 -1
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.js +210 -411
- package/dist/browser/{workbenchSelect-BRZN4ish.js → workbenchSelect-LRp_Xjeq.js} +1 -1
- package/dist/common/control-api-conformance.js +212 -245
- package/dist/common/control-api.d.ts +6 -6
- package/dist/common/control-api.js +216 -250
- package/dist/common/control-requests.js +468 -1476
- package/dist/common/decision.js +6325 -6369
- package/dist/common/flow-agent.d.ts +1 -1
- package/dist/common/flow-connectionUsage.d.ts +1 -2
- package/dist/common/flow-encoding.d.ts +2 -4
- package/dist/common/flow-encoding.js +119 -180
- package/dist/common/flow-graph.d.ts +10 -10
- package/dist/common/flow-semantics.d.ts +4 -9
- package/dist/common/flow-semantics.js +9024 -9230
- package/dist/common/flowInspection.d.ts +3 -21
- package/dist/common/integration-trigger.js +8642 -8686
- package/dist/common/mcp.d.ts +0 -1
- package/dist/common/mcp.js +117 -140
- package/dist/common/openapi.js +6325 -6369
- package/dist/common/poll-trigger.js +8642 -8686
- package/dist/common/run-events.js +0 -1
- package/dist/common/scheduler.d.ts +3 -9
- package/dist/common/scheduler.js +116 -207
- package/dist/common/webhook-trigger.js +6325 -6369
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/openapi/common/authBindings.ts
|
|
2
2
|
/** Never allow credentials to enter a Revision as literal node inputs. */
|
|
3
3
|
function assertOpenApiAuthBindings(document) {
|
|
4
|
-
for (const
|
|
5
|
-
if (node.kind != "task" || node.
|
|
6
|
-
for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") &&
|
|
4
|
+
for (const node of Object.values(document.graph.nodes)) {
|
|
5
|
+
if (node.kind != "task" || !("executor" in node.task) || node.task.executor.kind != "openapi") continue;
|
|
6
|
+
for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -2833,6 +2833,9 @@ function handlePipeResult(left, next, ctx) {
|
|
|
2833
2833
|
issues: left.issues
|
|
2834
2834
|
}, ctx);
|
|
2835
2835
|
}
|
|
2836
|
+
var $ZodPreprocess = /*@__PURE__*/ $constructor("$ZodPreprocess", (inst, def) => {
|
|
2837
|
+
$ZodPipe.init(inst, def);
|
|
2838
|
+
});
|
|
2836
2839
|
var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2837
2840
|
$ZodType.init(inst, def);
|
|
2838
2841
|
defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
@@ -5634,7 +5637,7 @@ var ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
|
|
|
5634
5637
|
inst.keyType = def.keyType;
|
|
5635
5638
|
inst.valueType = def.valueType;
|
|
5636
5639
|
});
|
|
5637
|
-
function record(keyType, valueType, params) {
|
|
5640
|
+
function record$1(keyType, valueType, params) {
|
|
5638
5641
|
if (!valueType || !valueType._zod) return new ZodRecord({
|
|
5639
5642
|
type: "record",
|
|
5640
5643
|
keyType: string(),
|
|
@@ -5843,6 +5846,10 @@ function pipe(in_, out) {
|
|
|
5843
5846
|
out
|
|
5844
5847
|
});
|
|
5845
5848
|
}
|
|
5849
|
+
var ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
|
|
5850
|
+
ZodPipe.init(inst, def);
|
|
5851
|
+
$ZodPreprocess.init(inst, def);
|
|
5852
|
+
});
|
|
5846
5853
|
var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
|
|
5847
5854
|
$ZodReadonly.init(inst, def);
|
|
5848
5855
|
ZodType.init(inst, def);
|
|
@@ -5886,11 +5893,18 @@ function json$1(params) {
|
|
|
5886
5893
|
boolean(),
|
|
5887
5894
|
_null(),
|
|
5888
5895
|
array(jsonSchema),
|
|
5889
|
-
record(string(), jsonSchema)
|
|
5896
|
+
record$1(string(), jsonSchema)
|
|
5890
5897
|
]);
|
|
5891
5898
|
});
|
|
5892
5899
|
return jsonSchema;
|
|
5893
5900
|
}
|
|
5901
|
+
function preprocess(fn, schema) {
|
|
5902
|
+
return new ZodPreprocess({
|
|
5903
|
+
type: "pipe",
|
|
5904
|
+
in: transform(fn),
|
|
5905
|
+
out: schema
|
|
5906
|
+
});
|
|
5907
|
+
}
|
|
5894
5908
|
//#endregion
|
|
5895
5909
|
//#region src/json-schema-subset/utils.ts
|
|
5896
5910
|
var nextId = 0;
|
|
@@ -8538,7 +8552,7 @@ var isObject = (x) => x !== null && typeof x === "object";
|
|
|
8538
8552
|
var isPlainObject = (x) => isObject(x) && !isArray(x);
|
|
8539
8553
|
var toPlainObject = (x) => isPlainObject(x) ? x : void 0;
|
|
8540
8554
|
//#endregion
|
|
8541
|
-
//#region src/
|
|
8555
|
+
//#region src/flow/common/schemaComparer.ts
|
|
8542
8556
|
function isStringLikeSchema(value) {
|
|
8543
8557
|
return toPlainObject(value)?.type === "string";
|
|
8544
8558
|
}
|
|
@@ -8769,7 +8783,7 @@ var webhookMethods = [
|
|
|
8769
8783
|
];
|
|
8770
8784
|
//#endregion
|
|
8771
8785
|
//#region src/flow/common/changeSchema.ts
|
|
8772
|
-
var currentFlowModelVersion =
|
|
8786
|
+
var currentFlowModelVersion = 6;
|
|
8773
8787
|
var text = string();
|
|
8774
8788
|
var json = json$1();
|
|
8775
8789
|
var strings = array(text);
|
|
@@ -8784,24 +8798,15 @@ var group = object({
|
|
|
8784
8798
|
collapsed: boolean().optional(),
|
|
8785
8799
|
group: text
|
|
8786
8800
|
});
|
|
8787
|
-
var
|
|
8801
|
+
var source = union([object({
|
|
8788
8802
|
kind: literal("node"),
|
|
8789
8803
|
nodeId: text,
|
|
8790
8804
|
output: text,
|
|
8791
8805
|
field: text.optional()
|
|
8792
|
-
})
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
});
|
|
8797
|
-
var source = union([
|
|
8798
|
-
nodeSource,
|
|
8799
|
-
flowSource,
|
|
8800
|
-
object({
|
|
8801
|
-
kind: literal("binding"),
|
|
8802
|
-
bindingId: text
|
|
8803
|
-
})
|
|
8804
|
-
]);
|
|
8806
|
+
}), object({
|
|
8807
|
+
kind: literal("binding"),
|
|
8808
|
+
bindingId: text
|
|
8809
|
+
})]);
|
|
8805
8810
|
var fixedInput = union([object({ kind: literal("unset") }), object({
|
|
8806
8811
|
kind: literal("value"),
|
|
8807
8812
|
value: json
|
|
@@ -8810,7 +8815,7 @@ var mapping = union([fixedInput, object({
|
|
|
8810
8815
|
kind: literal("sources"),
|
|
8811
8816
|
sources: array(source)
|
|
8812
8817
|
})]);
|
|
8813
|
-
var inputs = record(text, mapping);
|
|
8818
|
+
var inputs = record$1(text, mapping);
|
|
8814
8819
|
var ports = {
|
|
8815
8820
|
inputs: array(union([input, group])),
|
|
8816
8821
|
outputs: array(union([port, group]))
|
|
@@ -8938,9 +8943,11 @@ var managed = object({
|
|
|
8938
8943
|
inputs: array(input.extend({ source: agentInput }))
|
|
8939
8944
|
})),
|
|
8940
8945
|
notification: object({
|
|
8941
|
-
|
|
8946
|
+
action: text,
|
|
8947
|
+
connectionId: text.optional(),
|
|
8948
|
+
inputDefinitions: array(input),
|
|
8942
8949
|
messageHandle: text,
|
|
8943
|
-
inputs: record(text, agentValue)
|
|
8950
|
+
inputs: record$1(text, agentValue)
|
|
8944
8951
|
}).optional()
|
|
8945
8952
|
})
|
|
8946
8953
|
])
|
|
@@ -8995,7 +9002,7 @@ var webhookOptions = object({
|
|
|
8995
9002
|
allowedOrigins: strings.optional(),
|
|
8996
9003
|
noResponseBody: never().optional(),
|
|
8997
9004
|
responseData: text.optional(),
|
|
8998
|
-
responseHeaders: record(text, text).optional(),
|
|
9005
|
+
responseHeaders: record$1(text, text).optional(),
|
|
8999
9006
|
responseStatusCode: number().int().min(200).max(599).optional()
|
|
9000
9007
|
});
|
|
9001
9008
|
var webhook = {
|
|
@@ -9051,7 +9058,7 @@ var base = {
|
|
|
9051
9058
|
var node = union([
|
|
9052
9059
|
object({
|
|
9053
9060
|
...base,
|
|
9054
|
-
inputs: record(text, never()),
|
|
9061
|
+
inputs: record$1(text, never()),
|
|
9055
9062
|
kind: literal("condition"),
|
|
9056
9063
|
...condition
|
|
9057
9064
|
}),
|
|
@@ -9061,21 +9068,10 @@ var node = union([
|
|
|
9061
9068
|
kind: literal("value"),
|
|
9062
9069
|
values: array(input)
|
|
9063
9070
|
}),
|
|
9064
|
-
object({
|
|
9065
|
-
...base,
|
|
9066
|
-
kind: literal("subflow"),
|
|
9067
|
-
subflowId: text
|
|
9068
|
-
}),
|
|
9069
9071
|
object({
|
|
9070
9072
|
...base,
|
|
9071
9073
|
kind: literal("task"),
|
|
9072
|
-
task: inline,
|
|
9073
|
-
additionalInputs: array(input).optional()
|
|
9074
|
-
}),
|
|
9075
|
-
object({
|
|
9076
|
-
...base,
|
|
9077
|
-
kind: literal("task"),
|
|
9078
|
-
taskId: text,
|
|
9074
|
+
task: union([inline, managed]),
|
|
9079
9075
|
additionalInputs: array(input).optional()
|
|
9080
9076
|
}),
|
|
9081
9077
|
strictObject({
|
|
@@ -9111,7 +9107,7 @@ var node = union([
|
|
|
9111
9107
|
...trigger,
|
|
9112
9108
|
kind: literal("poll"),
|
|
9113
9109
|
connectionId: text.min(1).optional(),
|
|
9114
|
-
config: record(text, fixedInput),
|
|
9110
|
+
config: record$1(text, fixedInput),
|
|
9115
9111
|
definition: object({
|
|
9116
9112
|
...definition,
|
|
9117
9113
|
type: literal("poll")
|
|
@@ -9122,7 +9118,7 @@ var node = union([
|
|
|
9122
9118
|
...trigger,
|
|
9123
9119
|
kind: literal("integration"),
|
|
9124
9120
|
connectionId: text.min(1).optional(),
|
|
9125
|
-
config: record(text, fixedInput),
|
|
9121
|
+
config: record$1(text, fixedInput),
|
|
9126
9122
|
definition: object({
|
|
9127
9123
|
...definition,
|
|
9128
9124
|
type: literal("integration"),
|
|
@@ -9130,10 +9126,6 @@ var node = union([
|
|
|
9130
9126
|
})
|
|
9131
9127
|
})
|
|
9132
9128
|
]);
|
|
9133
|
-
var target = union([object({ kind: literal("flow") }), object({
|
|
9134
|
-
kind: literal("subflow"),
|
|
9135
|
-
id: text
|
|
9136
|
-
})]);
|
|
9137
9129
|
var edge = object({
|
|
9138
9130
|
source: text,
|
|
9139
9131
|
target: text,
|
|
@@ -9141,15 +9133,10 @@ var edge = object({
|
|
|
9141
9133
|
});
|
|
9142
9134
|
var at = {
|
|
9143
9135
|
nodeId: text,
|
|
9144
|
-
target
|
|
9136
|
+
target: never().optional()
|
|
9145
9137
|
};
|
|
9146
|
-
var subflow = object({
|
|
9147
|
-
name: text,
|
|
9148
|
-
inputs: array(input),
|
|
9149
|
-
outputs: array(port.extend({ sources: array(union([nodeSource, flowSource])) }))
|
|
9150
|
-
});
|
|
9151
9138
|
var graph = object({
|
|
9152
|
-
nodes: record(text, node),
|
|
9139
|
+
nodes: record$1(text, node),
|
|
9153
9140
|
edges: array(edge).default([])
|
|
9154
9141
|
});
|
|
9155
9142
|
var binding = object({
|
|
@@ -9161,24 +9148,35 @@ var module = object({
|
|
|
9161
9148
|
imports: strings,
|
|
9162
9149
|
source: text
|
|
9163
9150
|
});
|
|
9164
|
-
var document = object({
|
|
9165
|
-
bindings: record(text, binding),
|
|
9166
|
-
graph
|
|
9167
|
-
|
|
9168
|
-
tasks: record(text, managed)
|
|
9169
|
-
});
|
|
9151
|
+
var document = preprocess(rejectRetiredDefinitions, object({
|
|
9152
|
+
bindings: record$1(text, binding),
|
|
9153
|
+
graph
|
|
9154
|
+
}));
|
|
9170
9155
|
object({
|
|
9171
9156
|
modelVersion: union([
|
|
9172
9157
|
literal(2),
|
|
9173
9158
|
literal(4),
|
|
9174
|
-
literal(5)
|
|
9159
|
+
literal(5),
|
|
9160
|
+
literal(6)
|
|
9175
9161
|
]),
|
|
9176
9162
|
document,
|
|
9177
|
-
modules: record(text, module)
|
|
9163
|
+
modules: record$1(text, module)
|
|
9178
9164
|
}).extend({
|
|
9179
9165
|
kind: literal("open-flow-flow-revision"),
|
|
9180
9166
|
version: literal(1)
|
|
9181
9167
|
});
|
|
9168
|
+
function rejectRetiredDefinitions(value) {
|
|
9169
|
+
const candidate = record(value);
|
|
9170
|
+
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.");
|
|
9171
|
+
if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
|
|
9172
|
+
const subflows = candidate.subflows;
|
|
9173
|
+
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.");
|
|
9174
|
+
if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
|
|
9175
|
+
return value;
|
|
9176
|
+
}
|
|
9177
|
+
function record(value) {
|
|
9178
|
+
return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
|
|
9179
|
+
}
|
|
9182
9180
|
var shapes = {
|
|
9183
9181
|
"graph.trigger.sources.set": {
|
|
9184
9182
|
nodeId: text,
|
|
@@ -9196,12 +9194,12 @@ var shapes = {
|
|
|
9196
9194
|
value: text
|
|
9197
9195
|
},
|
|
9198
9196
|
"graph.edge.connect": {
|
|
9199
|
-
|
|
9200
|
-
|
|
9197
|
+
edge,
|
|
9198
|
+
target: never().optional()
|
|
9201
9199
|
},
|
|
9202
9200
|
"graph.edge.disconnect": {
|
|
9203
|
-
|
|
9204
|
-
|
|
9201
|
+
edge,
|
|
9202
|
+
target: never().optional()
|
|
9205
9203
|
},
|
|
9206
9204
|
"graph.node.create": {
|
|
9207
9205
|
...at,
|
|
@@ -9265,13 +9263,11 @@ var shapes = {
|
|
|
9265
9263
|
},
|
|
9266
9264
|
"graph.node.resolution.set": {
|
|
9267
9265
|
...at,
|
|
9268
|
-
target: object({ kind: literal("flow") }),
|
|
9269
9266
|
before: object(wait),
|
|
9270
9267
|
value: object(wait)
|
|
9271
9268
|
},
|
|
9272
9269
|
"graph.node.webhook.set": {
|
|
9273
9270
|
...at,
|
|
9274
|
-
target: object({ kind: literal("flow") }),
|
|
9275
9271
|
before: object(webhook),
|
|
9276
9272
|
value: object(webhook)
|
|
9277
9273
|
},
|
|
@@ -9318,50 +9314,10 @@ var shapes = {
|
|
|
9318
9314
|
imports: strings,
|
|
9319
9315
|
source: text
|
|
9320
9316
|
},
|
|
9321
|
-
"
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
"subflow.definition.set": {
|
|
9326
|
-
subflowId: text,
|
|
9327
|
-
before: subflow,
|
|
9328
|
-
definition: subflow
|
|
9329
|
-
},
|
|
9330
|
-
"subflow.delete": { subflowId: text },
|
|
9331
|
-
"task.create": {
|
|
9332
|
-
taskId: text,
|
|
9333
|
-
task: managed
|
|
9334
|
-
},
|
|
9335
|
-
"task.delete": { taskId: text },
|
|
9336
|
-
"task.connector.connection.set": {
|
|
9337
|
-
taskId: text,
|
|
9338
|
-
before: text.optional(),
|
|
9339
|
-
value: text.optional()
|
|
9340
|
-
},
|
|
9341
|
-
"task.decision.set": {
|
|
9342
|
-
taskId: text,
|
|
9343
|
-
before: managed,
|
|
9344
|
-
value: managed
|
|
9345
|
-
},
|
|
9346
|
-
"task.openapi.set": {
|
|
9347
|
-
taskId: text,
|
|
9348
|
-
before: managed,
|
|
9349
|
-
value: managed
|
|
9350
|
-
},
|
|
9351
|
-
"task.agent.set": {
|
|
9352
|
-
taskId: text,
|
|
9353
|
-
before: managed,
|
|
9354
|
-
value: managed
|
|
9355
|
-
},
|
|
9356
|
-
"task.llm.mode.set": {
|
|
9357
|
-
taskId: text,
|
|
9358
|
-
before: _enum(["chat", "json"]),
|
|
9359
|
-
value: _enum(["chat", "json"])
|
|
9360
|
-
},
|
|
9361
|
-
"task.name.set": {
|
|
9362
|
-
taskId: text,
|
|
9363
|
-
before: text,
|
|
9364
|
-
value: text
|
|
9317
|
+
"graph.node.task.set": {
|
|
9318
|
+
...at,
|
|
9319
|
+
before: union([inline, managed]),
|
|
9320
|
+
value: union([inline, managed])
|
|
9365
9321
|
}
|
|
9366
9322
|
};
|
|
9367
9323
|
var variants = new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object({
|
|
@@ -9629,30 +9585,6 @@ var FlowChangeError = class extends Error {
|
|
|
9629
9585
|
function invalid(message) {
|
|
9630
9586
|
throw new FlowChangeError(message);
|
|
9631
9587
|
}
|
|
9632
|
-
function selectedGraph(document, target) {
|
|
9633
|
-
if (target.kind == "flow") return document.graph;
|
|
9634
|
-
const subflow = document.subflows[target.id];
|
|
9635
|
-
if (subflow == null) invalid("The target Subflow does not exist.");
|
|
9636
|
-
return subflow.graph;
|
|
9637
|
-
}
|
|
9638
|
-
function replaceGraph(document, target, value) {
|
|
9639
|
-
if (target.kind == "flow") return {
|
|
9640
|
-
...document,
|
|
9641
|
-
graph: value
|
|
9642
|
-
};
|
|
9643
|
-
const subflow = document.subflows[target.id];
|
|
9644
|
-
if (subflow == null) invalid("The target Subflow does not exist.");
|
|
9645
|
-
return {
|
|
9646
|
-
...document,
|
|
9647
|
-
subflows: {
|
|
9648
|
-
...document.subflows,
|
|
9649
|
-
[target.id]: {
|
|
9650
|
-
...subflow,
|
|
9651
|
-
graph: value
|
|
9652
|
-
}
|
|
9653
|
-
}
|
|
9654
|
-
};
|
|
9655
|
-
}
|
|
9656
9588
|
function applyFlowChanges(content, operations) {
|
|
9657
9589
|
const document = { ...content.document };
|
|
9658
9590
|
const modules = { ...content.modules };
|
|
@@ -9704,29 +9636,29 @@ function applyFlowChanges(content, operations) {
|
|
|
9704
9636
|
break;
|
|
9705
9637
|
}
|
|
9706
9638
|
case "graph.edge.connect": {
|
|
9707
|
-
const graph =
|
|
9639
|
+
const graph = document.graph;
|
|
9708
9640
|
if (graph.nodes[operation.edge.source] == null) invalid("The source Node does not exist.");
|
|
9709
9641
|
const node = graph.nodes[operation.edge.target];
|
|
9710
9642
|
if (node == null || !("inputs" in node)) invalid("The target Node does not accept execution dependencies.");
|
|
9711
9643
|
if (graph.edges.some((edge) => dequal(edge, operation.edge))) invalid("The Nodes are already connected.");
|
|
9712
|
-
Object.assign(document,
|
|
9644
|
+
Object.assign(document, { graph: {
|
|
9713
9645
|
...graph,
|
|
9714
9646
|
edges: [...graph.edges, operation.edge]
|
|
9715
|
-
})
|
|
9647
|
+
} });
|
|
9716
9648
|
break;
|
|
9717
9649
|
}
|
|
9718
9650
|
case "graph.edge.disconnect": {
|
|
9719
|
-
const graph =
|
|
9651
|
+
const graph = document.graph;
|
|
9720
9652
|
const edges = graph.edges.filter((edge) => !dequal(edge, operation.edge));
|
|
9721
9653
|
if (edges.length == graph.edges.length) invalid("The Nodes are not connected.");
|
|
9722
|
-
Object.assign(document,
|
|
9654
|
+
Object.assign(document, { graph: {
|
|
9723
9655
|
...graph,
|
|
9724
9656
|
edges
|
|
9725
|
-
})
|
|
9657
|
+
} });
|
|
9726
9658
|
break;
|
|
9727
9659
|
}
|
|
9728
9660
|
case "graph.node.additional-inputs.set": {
|
|
9729
|
-
const graph =
|
|
9661
|
+
const graph = document.graph;
|
|
9730
9662
|
const node = graph.nodes[operation.nodeId];
|
|
9731
9663
|
if (node?.kind != "task") invalid("The Task Node does not exist.");
|
|
9732
9664
|
if (!dequal(node.additionalInputs, operation.before)) invalid("The Task Node inputs changed before this operation was applied.");
|
|
@@ -9735,17 +9667,17 @@ function applyFlowChanges(content, operations) {
|
|
|
9735
9667
|
...rest,
|
|
9736
9668
|
additionalInputs: operation.value
|
|
9737
9669
|
};
|
|
9738
|
-
Object.assign(document,
|
|
9670
|
+
Object.assign(document, { graph: {
|
|
9739
9671
|
...graph,
|
|
9740
9672
|
nodes: {
|
|
9741
9673
|
...graph.nodes,
|
|
9742
9674
|
[operation.nodeId]: updated
|
|
9743
9675
|
}
|
|
9744
|
-
})
|
|
9676
|
+
} });
|
|
9745
9677
|
break;
|
|
9746
9678
|
}
|
|
9747
9679
|
case "graph.node.condition.set": {
|
|
9748
|
-
const graph =
|
|
9680
|
+
const graph = document.graph;
|
|
9749
9681
|
const node = graph.nodes[operation.nodeId];
|
|
9750
9682
|
if (node?.kind != "condition") invalid("The Condition Node does not exist.");
|
|
9751
9683
|
if (!dequal(node.cases, operation.before.cases) || node.matchMode != operation.before.matchMode) invalid("The Condition Node changed before this operation was applied.");
|
|
@@ -9753,22 +9685,21 @@ function applyFlowChanges(content, operations) {
|
|
|
9753
9685
|
...node,
|
|
9754
9686
|
...operation.value
|
|
9755
9687
|
};
|
|
9756
|
-
Object.assign(document,
|
|
9688
|
+
Object.assign(document, { graph: {
|
|
9757
9689
|
...graph,
|
|
9758
9690
|
nodes: {
|
|
9759
9691
|
...graph.nodes,
|
|
9760
9692
|
[operation.nodeId]: updated
|
|
9761
9693
|
}
|
|
9762
|
-
})
|
|
9694
|
+
} });
|
|
9763
9695
|
break;
|
|
9764
9696
|
}
|
|
9765
9697
|
case "graph.node.create": {
|
|
9766
|
-
const graph =
|
|
9698
|
+
const graph = document.graph;
|
|
9767
9699
|
if (graph.nodes[operation.nodeId] != null) invalid("A Node with this ID already exists in the target graph.");
|
|
9768
|
-
if (operation.target.kind == "subflow" && !("inputs" in operation.node)) invalid("Trigger Nodes cannot be created inside a Subflow.");
|
|
9769
9700
|
if (operation.node.kind == "error" && Object.values(graph.nodes).some((node) => node.kind == "error")) invalid("A graph can contain only one Flow Error node.");
|
|
9770
9701
|
if (operation.node.kind == "manual" && Object.values(graph.nodes).some((node) => node.kind == "manual")) invalid("A graph can contain only one manual Trigger.");
|
|
9771
|
-
if (operation.node.kind == "task" && operation.node.task
|
|
9702
|
+
if (operation.node.kind == "task" && "moduleId" in operation.node.task && operation.node.task.capabilities !== void 0) decodeConnectorCapabilities(operation.node.task.capabilities);
|
|
9772
9703
|
if (operation.node.name == null) invalid("A Node name cannot be empty.");
|
|
9773
9704
|
const name = normalizeNodeName(operation.node.name);
|
|
9774
9705
|
const issue = nodeNameIssue(graph, operation.nodeId, name);
|
|
@@ -9778,29 +9709,29 @@ function applyFlowChanges(content, operations) {
|
|
|
9778
9709
|
...operation.node,
|
|
9779
9710
|
name
|
|
9780
9711
|
};
|
|
9781
|
-
Object.assign(document,
|
|
9712
|
+
Object.assign(document, { graph: {
|
|
9782
9713
|
...graph,
|
|
9783
9714
|
nodes: {
|
|
9784
9715
|
...graph.nodes,
|
|
9785
9716
|
[operation.nodeId]: node
|
|
9786
9717
|
}
|
|
9787
|
-
})
|
|
9718
|
+
} });
|
|
9788
9719
|
break;
|
|
9789
9720
|
}
|
|
9790
9721
|
case "graph.node.delete": {
|
|
9791
|
-
const graph =
|
|
9722
|
+
const graph = document.graph;
|
|
9792
9723
|
if (graph.nodes[operation.nodeId] == null) invalid("The Node does not exist in the target graph.");
|
|
9793
9724
|
const removed = /* @__PURE__ */ new Set([operation.nodeId]);
|
|
9794
9725
|
const nodes = Object.fromEntries(Object.entries(graph.nodes).filter(([nodeId]) => !removed.has(nodeId)));
|
|
9795
|
-
Object.assign(document,
|
|
9726
|
+
Object.assign(document, { graph: {
|
|
9796
9727
|
...graph,
|
|
9797
9728
|
edges: graph.edges.filter((edge) => !removed.has(edge.source) && !removed.has(edge.target)),
|
|
9798
9729
|
nodes
|
|
9799
|
-
})
|
|
9730
|
+
} });
|
|
9800
9731
|
break;
|
|
9801
9732
|
}
|
|
9802
9733
|
case "graph.node.field.set": {
|
|
9803
|
-
const graph =
|
|
9734
|
+
const graph = document.graph;
|
|
9804
9735
|
const node = graph.nodes[operation.nodeId];
|
|
9805
9736
|
if (node == null) invalid("The Node does not exist in the target graph.");
|
|
9806
9737
|
if (operation.field == "connectionId" && node.kind != "poll" && node.kind != "integration") invalid("Only provider Triggers select a node Connection.");
|
|
@@ -9815,24 +9746,24 @@ function applyFlowChanges(content, operations) {
|
|
|
9815
9746
|
Object.assign(updated, { name });
|
|
9816
9747
|
} else if (operation.value == null) Reflect.deleteProperty(updated, operation.field);
|
|
9817
9748
|
else Object.assign(updated, { [operation.field]: operation.value });
|
|
9818
|
-
Object.assign(document,
|
|
9749
|
+
Object.assign(document, { graph: {
|
|
9819
9750
|
...graph,
|
|
9820
9751
|
nodes: {
|
|
9821
9752
|
...graph.nodes,
|
|
9822
9753
|
[operation.nodeId]: updated
|
|
9823
9754
|
}
|
|
9824
|
-
})
|
|
9755
|
+
} });
|
|
9825
9756
|
break;
|
|
9826
9757
|
}
|
|
9827
9758
|
case "graph.node.input.set": {
|
|
9828
|
-
const graph =
|
|
9759
|
+
const graph = document.graph;
|
|
9829
9760
|
const node = graph.nodes[operation.nodeId];
|
|
9830
9761
|
if (node == null || !("inputs" in node)) invalid("The Node does not accept inputs.");
|
|
9831
9762
|
if (!dequal(nodeInputMappings(node)[operation.handle], operation.before)) invalid("The Node input changed before this operation was applied.");
|
|
9832
9763
|
const inputs = { ...node.inputs };
|
|
9833
9764
|
if (operation.value == null) delete inputs[operation.handle];
|
|
9834
9765
|
else inputs[operation.handle] = operation.value;
|
|
9835
|
-
Object.assign(document,
|
|
9766
|
+
Object.assign(document, { graph: {
|
|
9836
9767
|
...graph,
|
|
9837
9768
|
nodes: {
|
|
9838
9769
|
...graph.nodes,
|
|
@@ -9841,18 +9772,18 @@ function applyFlowChanges(content, operations) {
|
|
|
9841
9772
|
inputs
|
|
9842
9773
|
}
|
|
9843
9774
|
}
|
|
9844
|
-
})
|
|
9775
|
+
} });
|
|
9845
9776
|
break;
|
|
9846
9777
|
}
|
|
9847
9778
|
case "graph.node.task.capabilities.set": {
|
|
9848
|
-
const graph =
|
|
9779
|
+
const graph = document.graph;
|
|
9849
9780
|
const node = graph.nodes[operation.nodeId];
|
|
9850
|
-
if (node?.kind != "task" || node.task
|
|
9781
|
+
if (node?.kind != "task" || !("moduleId" in node.task)) invalid("The inline Task Node does not exist.");
|
|
9851
9782
|
if (!dequal(node.task.capabilities, operation.before)) invalid("The inline Task capabilities changed before this operation was applied.");
|
|
9852
9783
|
const task = { ...node.task };
|
|
9853
9784
|
if (operation.value === void 0) delete task.capabilities;
|
|
9854
9785
|
else task.capabilities = decodeConnectorCapabilities(operation.value);
|
|
9855
|
-
Object.assign(document,
|
|
9786
|
+
Object.assign(document, { graph: {
|
|
9856
9787
|
...graph,
|
|
9857
9788
|
nodes: {
|
|
9858
9789
|
...graph.nodes,
|
|
@@ -9861,13 +9792,13 @@ function applyFlowChanges(content, operations) {
|
|
|
9861
9792
|
task
|
|
9862
9793
|
}
|
|
9863
9794
|
}
|
|
9864
|
-
})
|
|
9795
|
+
} });
|
|
9865
9796
|
break;
|
|
9866
9797
|
}
|
|
9867
9798
|
case "graph.node.task.name.set": {
|
|
9868
|
-
const graph =
|
|
9799
|
+
const graph = document.graph;
|
|
9869
9800
|
const node = graph.nodes[operation.nodeId];
|
|
9870
|
-
if (node?.kind != "task" || node.task
|
|
9801
|
+
if (node?.kind != "task" || !("moduleId" in node.task)) invalid("The inline Task Node does not exist.");
|
|
9871
9802
|
if (node.task.name != operation.before) invalid("The inline Task name changed before this operation was applied.");
|
|
9872
9803
|
const updated = {
|
|
9873
9804
|
...node,
|
|
@@ -9876,19 +9807,19 @@ function applyFlowChanges(content, operations) {
|
|
|
9876
9807
|
name: operation.value
|
|
9877
9808
|
}
|
|
9878
9809
|
};
|
|
9879
|
-
Object.assign(document,
|
|
9810
|
+
Object.assign(document, { graph: {
|
|
9880
9811
|
...graph,
|
|
9881
9812
|
nodes: {
|
|
9882
9813
|
...graph.nodes,
|
|
9883
9814
|
[operation.nodeId]: updated
|
|
9884
9815
|
}
|
|
9885
|
-
})
|
|
9816
|
+
} });
|
|
9886
9817
|
break;
|
|
9887
9818
|
}
|
|
9888
9819
|
case "graph.node.task.ports.set": {
|
|
9889
|
-
const graph =
|
|
9820
|
+
const graph = document.graph;
|
|
9890
9821
|
const node = graph.nodes[operation.nodeId];
|
|
9891
|
-
if (node?.kind != "task" || node.task
|
|
9822
|
+
if (node?.kind != "task" || !("moduleId" in node.task)) invalid("The inline Task Node does not exist.");
|
|
9892
9823
|
if (!dequal({
|
|
9893
9824
|
inputs: node.task.inputs,
|
|
9894
9825
|
outputs: node.task.outputs
|
|
@@ -9901,21 +9832,21 @@ function applyFlowChanges(content, operations) {
|
|
|
9901
9832
|
outputs: operation.value.outputs
|
|
9902
9833
|
}
|
|
9903
9834
|
};
|
|
9904
|
-
Object.assign(document,
|
|
9835
|
+
Object.assign(document, { graph: {
|
|
9905
9836
|
...graph,
|
|
9906
9837
|
nodes: {
|
|
9907
9838
|
...graph.nodes,
|
|
9908
9839
|
[operation.nodeId]: updated
|
|
9909
9840
|
}
|
|
9910
|
-
})
|
|
9841
|
+
} });
|
|
9911
9842
|
break;
|
|
9912
9843
|
}
|
|
9913
9844
|
case "graph.node.values.set": {
|
|
9914
|
-
const graph =
|
|
9845
|
+
const graph = document.graph;
|
|
9915
9846
|
const node = graph.nodes[operation.nodeId];
|
|
9916
9847
|
if (node?.kind != "value") invalid("The Value Node does not exist.");
|
|
9917
9848
|
if (!dequal(node.values, operation.before)) invalid("The Value Node changed before this operation was applied.");
|
|
9918
|
-
Object.assign(document,
|
|
9849
|
+
Object.assign(document, { graph: {
|
|
9919
9850
|
...graph,
|
|
9920
9851
|
nodes: {
|
|
9921
9852
|
...graph.nodes,
|
|
@@ -9924,7 +9855,7 @@ function applyFlowChanges(content, operations) {
|
|
|
9924
9855
|
values: operation.value
|
|
9925
9856
|
}
|
|
9926
9857
|
}
|
|
9927
|
-
})
|
|
9858
|
+
} });
|
|
9928
9859
|
break;
|
|
9929
9860
|
}
|
|
9930
9861
|
case "graph.node.resolution.set": {
|
|
@@ -9948,7 +9879,7 @@ function applyFlowChanges(content, operations) {
|
|
|
9948
9879
|
break;
|
|
9949
9880
|
}
|
|
9950
9881
|
case "graph.node.webhook.set": {
|
|
9951
|
-
const graph =
|
|
9882
|
+
const graph = document.graph;
|
|
9952
9883
|
const node = graph.nodes[operation.nodeId];
|
|
9953
9884
|
if (node?.kind != "webhook") invalid("The Webhook Node does not exist.");
|
|
9954
9885
|
if (node.method != operation.before.method || !dequal(node.bodyFields, operation.before.bodyFields) || !dequal(node.options, operation.before.options)) invalid("The Webhook Node changed before this operation was applied.");
|
|
@@ -9961,13 +9892,13 @@ function applyFlowChanges(content, operations) {
|
|
|
9961
9892
|
...node,
|
|
9962
9893
|
...operation.value
|
|
9963
9894
|
};
|
|
9964
|
-
Object.assign(document,
|
|
9895
|
+
Object.assign(document, { graph: {
|
|
9965
9896
|
...graph,
|
|
9966
9897
|
nodes: {
|
|
9967
9898
|
...graph.nodes,
|
|
9968
9899
|
[operation.nodeId]: updated
|
|
9969
9900
|
}
|
|
9970
|
-
})
|
|
9901
|
+
} });
|
|
9971
9902
|
break;
|
|
9972
9903
|
}
|
|
9973
9904
|
case "graph.trigger.config.set": {
|
|
@@ -10040,134 +9971,28 @@ function applyFlowChanges(content, operations) {
|
|
|
10040
9971
|
};
|
|
10041
9972
|
break;
|
|
10042
9973
|
}
|
|
10043
|
-
case "
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
inputs: subflow.inputs,
|
|
10056
|
-
name: subflow.name,
|
|
10057
|
-
outputs: subflow.outputs
|
|
10058
|
-
}, operation.before)) invalid("The Subflow definition changed before this operation was applied.");
|
|
10059
|
-
document.subflows = {
|
|
10060
|
-
...document.subflows,
|
|
10061
|
-
[operation.subflowId]: {
|
|
10062
|
-
...operation.definition,
|
|
10063
|
-
graph: subflow.graph
|
|
10064
|
-
}
|
|
10065
|
-
};
|
|
10066
|
-
break;
|
|
10067
|
-
}
|
|
10068
|
-
case "subflow.delete": {
|
|
10069
|
-
if (document.subflows[operation.subflowId] == null) invalid("The Subflow does not exist.");
|
|
10070
|
-
const subflows = { ...document.subflows };
|
|
10071
|
-
delete subflows[operation.subflowId];
|
|
10072
|
-
document.subflows = subflows;
|
|
10073
|
-
break;
|
|
10074
|
-
}
|
|
10075
|
-
case "task.create":
|
|
10076
|
-
if (document.tasks[operation.taskId] != null) invalid("A Task with this ID already exists.");
|
|
10077
|
-
document.tasks = {
|
|
10078
|
-
...document.tasks,
|
|
10079
|
-
[operation.taskId]: operation.task
|
|
10080
|
-
};
|
|
10081
|
-
break;
|
|
10082
|
-
case "task.connector.connection.set": {
|
|
10083
|
-
const task = document.tasks[operation.taskId];
|
|
10084
|
-
if (task == null || !("executor" in task) || task.executor.kind != "connector") invalid("The Connector Task does not exist.");
|
|
10085
|
-
if (task.executor.connectionId != operation.before) invalid("The Connector Task connection changed before this operation was applied.");
|
|
10086
|
-
const { connectionId: _, ...executor } = task.executor;
|
|
10087
|
-
const next = operation.value == null ? executor : {
|
|
10088
|
-
...executor,
|
|
10089
|
-
connectionId: operation.value
|
|
10090
|
-
};
|
|
10091
|
-
document.tasks = {
|
|
10092
|
-
...document.tasks,
|
|
10093
|
-
[operation.taskId]: {
|
|
10094
|
-
...task,
|
|
10095
|
-
executor: next
|
|
10096
|
-
}
|
|
10097
|
-
};
|
|
10098
|
-
break;
|
|
10099
|
-
}
|
|
10100
|
-
case "task.delete": {
|
|
10101
|
-
if (document.tasks[operation.taskId] == null) invalid("The Task does not exist.");
|
|
10102
|
-
const tasks = { ...document.tasks };
|
|
10103
|
-
delete tasks[operation.taskId];
|
|
10104
|
-
document.tasks = tasks;
|
|
10105
|
-
break;
|
|
10106
|
-
}
|
|
10107
|
-
case "task.decision.set": {
|
|
10108
|
-
const task = document.tasks[operation.taskId];
|
|
10109
|
-
if (task?.executor.kind != "decision" || operation.value.executor.kind != "decision") invalid("The AI Decision Task does not exist.");
|
|
10110
|
-
if (!dequal(task, operation.before)) invalid("The AI Decision Task changed before this operation was applied.");
|
|
10111
|
-
document.tasks = {
|
|
10112
|
-
...document.tasks,
|
|
10113
|
-
[operation.taskId]: operation.value
|
|
10114
|
-
};
|
|
10115
|
-
break;
|
|
10116
|
-
}
|
|
10117
|
-
case "task.openapi.set": {
|
|
10118
|
-
const task = document.tasks[operation.taskId];
|
|
10119
|
-
if (task?.executor.kind != "openapi" || operation.value.executor.kind != "openapi") invalid("The OpenAPI Task does not exist.");
|
|
10120
|
-
if (!dequal(task, operation.before)) invalid("The OpenAPI Task changed before this operation was applied.");
|
|
10121
|
-
document.tasks = {
|
|
10122
|
-
...document.tasks,
|
|
10123
|
-
[operation.taskId]: operation.value
|
|
10124
|
-
};
|
|
10125
|
-
break;
|
|
10126
|
-
}
|
|
10127
|
-
case "task.agent.set": {
|
|
10128
|
-
const task = document.tasks[operation.taskId];
|
|
10129
|
-
if (task?.executor.kind != "agent" || operation.value.executor.kind != "agent") invalid("The Agent Task does not exist.");
|
|
10130
|
-
if (!dequal(task, operation.before)) invalid("The Agent Task changed before this operation was applied.");
|
|
10131
|
-
document.tasks = {
|
|
10132
|
-
...document.tasks,
|
|
10133
|
-
[operation.taskId]: operation.value
|
|
10134
|
-
};
|
|
10135
|
-
break;
|
|
10136
|
-
}
|
|
10137
|
-
case "task.llm.mode.set": {
|
|
10138
|
-
const task = document.tasks[operation.taskId];
|
|
10139
|
-
if (task == null || !("executor" in task) || task.executor.kind != "llm") invalid("The LLM Task does not exist.");
|
|
10140
|
-
if (task.executor.mode != operation.before) invalid("The LLM Task mode changed before this operation was applied.");
|
|
10141
|
-
document.tasks = {
|
|
10142
|
-
...document.tasks,
|
|
10143
|
-
[operation.taskId]: {
|
|
10144
|
-
...task,
|
|
10145
|
-
executor: {
|
|
10146
|
-
...task.executor,
|
|
10147
|
-
mode: operation.value
|
|
9974
|
+
case "graph.node.task.set": {
|
|
9975
|
+
const graph = document.graph;
|
|
9976
|
+
const node = graph.nodes[operation.nodeId];
|
|
9977
|
+
if (node?.kind != "task") invalid("The Task Node does not exist.");
|
|
9978
|
+
if (!dequal(node.task, operation.before)) invalid("The Task configuration changed before this operation was applied.");
|
|
9979
|
+
document.graph = {
|
|
9980
|
+
...graph,
|
|
9981
|
+
nodes: {
|
|
9982
|
+
...graph.nodes,
|
|
9983
|
+
[operation.nodeId]: {
|
|
9984
|
+
...node,
|
|
9985
|
+
task: operation.value
|
|
10148
9986
|
}
|
|
10149
9987
|
}
|
|
10150
9988
|
};
|
|
10151
9989
|
break;
|
|
10152
9990
|
}
|
|
10153
|
-
case "task.name.set": {
|
|
10154
|
-
const task = document.tasks[operation.taskId];
|
|
10155
|
-
if (task == null) invalid("The Task does not exist.");
|
|
10156
|
-
if (task.name != operation.before) invalid("The Task name changed before this operation was applied.");
|
|
10157
|
-
document.tasks = {
|
|
10158
|
-
...document.tasks,
|
|
10159
|
-
[operation.taskId]: {
|
|
10160
|
-
...task,
|
|
10161
|
-
name: operation.value
|
|
10162
|
-
}
|
|
10163
|
-
};
|
|
10164
|
-
break;
|
|
10165
|
-
}
|
|
10166
9991
|
}
|
|
10167
9992
|
assertOpenApiAuthBindings(document);
|
|
10168
9993
|
return {
|
|
10169
9994
|
document,
|
|
10170
|
-
modelVersion:
|
|
9995
|
+
modelVersion: 6,
|
|
10171
9996
|
modules
|
|
10172
9997
|
};
|
|
10173
9998
|
}
|