@oomol-lab/open-flow 0.1.0-alpha.0 → 0.1.0-alpha.10
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/addNodeOptions-BwrMvPQC.js +5230 -0
- package/dist/browser/assets/typeScriptWorker-CaA4llbX.js +59850 -0
- package/dist/browser/carbon-DMCVsjHo.js +53 -0
- package/dist/browser/{project-change.js → change-Cu6pQIit.js} +15 -45
- package/dist/browser/createLucideIcon-COMgwa_u.js +5317 -0
- package/dist/browser/createResourceDialog-YgMLylQz.js +467 -0
- package/dist/browser/{dist-o4dBuwiG.js → dist-3Mj8q8Pr.js} +28 -28
- package/dist/browser/{dist-CIq6ue3I.js → dist-BKuSVKCC.js} +1115 -1103
- package/dist/browser/{dist-DL0SDskM.js → dist-BMqL-qR5.js} +473 -906
- package/dist/browser/{dist-CLZJNoWB.js → dist-BN4ZCyOB.js} +10 -10
- package/dist/browser/{dist-zyY--HOV.js → dist-BpopSHwP.js} +3 -3
- package/dist/browser/dist-C46JByB-.js +252 -0
- package/dist/browser/{dist-BbyiRq3c.js → dist-CJpzJrLM.js} +294 -284
- package/dist/browser/{dist-Djd02JSy.js → dist-CPuF50D9.js} +198 -198
- package/dist/browser/{dist-CvcmLAMW.js → dist-CUSrALSX.js} +115 -115
- package/dist/browser/dist-CeSZ2xSM.js +444 -0
- package/dist/browser/{dist-7oZK9QXZ.js → dist-DMi8_lU3.js} +5 -5
- package/dist/browser/{dist-B9OV3YTx.js → dist-DUzA0Ukh.js} +22 -22
- package/dist/browser/{dist-aWSZx4q1.js → dist-DWADUsVB.js} +75 -75
- package/dist/browser/{dist-BLk5M0uK.js → dist-Mecbzdl2.js} +3 -3
- package/dist/browser/{esm-DXw7EADW.js → esm-CvAs_mAS.js} +14 -24
- package/dist/browser/field-BrEG-7ap.js +312 -0
- package/dist/browser/flow-authoring-edge.d.ts +3 -0
- package/dist/browser/flow-authoring-module.d.ts +4 -0
- package/dist/browser/flow-authoring-node.d.ts +84 -0
- package/dist/browser/flow-authoring.d.ts +4 -0
- package/dist/browser/flow-authoring.js +522 -0
- package/dist/browser/{project-change.d.ts → flow-change.d.ts} +27 -36
- package/dist/browser/flow-change.js +231 -0
- package/dist/browser/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
- package/dist/browser/flowRunInputEditorStore-DXOyyY7o.js +8219 -0
- package/dist/browser/flowWorkspace-X_T_DcQf.js +46003 -0
- package/dist/browser/{lib-S4ccuMeT.js → lib-GrGxYjsJ.js} +3 -5
- package/dist/browser/licenses.md +620 -12
- package/dist/browser/{markdownContent-ZZFfSRqO.js → markdownContent-BI-2PmDX.js} +4071 -4035
- package/dist/browser/typeScriptSession-Dagu_tRs.js +2549 -0
- package/dist/browser/workbench-contract.d.ts +4 -5
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.d.ts +2 -1
- package/dist/browser/workbench.js +3920 -2138
- package/dist/common/connector-action.d.ts +6 -0
- package/dist/common/connector-action.js +38 -30
- package/dist/common/control-api-conformance.js +223 -359
- package/dist/common/control-api-errors.d.ts +20 -24
- package/dist/common/control-api.d.ts +44 -73
- package/dist/common/control-api.js +150 -203
- package/dist/common/cron-trigger.d.ts +1 -1
- package/dist/common/cron-trigger.js +1 -1
- package/dist/common/flow-encoding.d.ts +11 -0
- package/dist/common/{project-encoding.js → flow-encoding.js} +14 -13
- package/dist/common/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
- package/dist/common/{project-semantics.d.ts → flow-semantics.d.ts} +9 -12
- package/dist/common/{project-semantics.js → flow-semantics.js} +594 -597
- package/dist/common/integration-trigger.d.ts +2 -1
- package/dist/common/integration-trigger.js +1 -1
- package/dist/common/poll-trigger.d.ts +1 -1
- package/dist/common/provider-triggers.js +1057 -948
- package/dist/common/run-lifecycle.js +1 -1
- package/dist/common/runtime-contract.d.ts +1 -1
- package/dist/common/runtime-contract.js +1 -1
- package/dist/common/scheduler.d.ts +7 -7
- package/dist/common/scheduler.js +237 -232
- package/dist/common/webhook-trigger.d.ts +1 -1
- package/dist/common/webhook-trigger.js +35 -1
- package/package.json +20 -10
- package/dist/browser/addNodeOptions-DqoIueCR.js +0 -33746
- package/dist/browser/carbon-nMY84Amv.js +0 -53
- package/dist/browser/composite-7VwgfnXx.js +0 -6088
- package/dist/browser/createResourceDialog-ByuJWdSL.js +0 -439
- package/dist/browser/dist-n-z5HtaO.js +0 -4
- package/dist/browser/flowWorkspace-DwVMpcar.js +0 -22092
- package/dist/common/project-encoding.d.ts +0 -11
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { ChangeOperation, CodeModule, GraphTarget, JsonValue, PortDefinition, RevisionContent, TaskDefinition, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookOptions } from './flow-change.js';
|
|
2
|
+
export interface Settings {
|
|
3
|
+
readonly concurrency: number;
|
|
4
|
+
readonly name?: string;
|
|
5
|
+
readonly timeoutMs?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface LlmTaskOptions {
|
|
8
|
+
readonly inputs?: Readonly<Partial<Record<LlmInputHandle, JsonValue>>>;
|
|
9
|
+
readonly output?: PortDefinition;
|
|
10
|
+
}
|
|
11
|
+
export type LlmInputHandle = 'input' | 'messages' | 'model' | 'template';
|
|
12
|
+
interface TriggerSettingsBase {
|
|
13
|
+
readonly description?: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
}
|
|
16
|
+
export type TriggerSettings = (TriggerSettingsBase & {
|
|
17
|
+
readonly inputs: Extract<TriggerNode, {
|
|
18
|
+
readonly kind: 'webhook';
|
|
19
|
+
}>['inputsDef'];
|
|
20
|
+
readonly kind: 'webhook';
|
|
21
|
+
readonly options: WebhookOptions;
|
|
22
|
+
}) | (TriggerSettingsBase & {
|
|
23
|
+
readonly kind: 'cron';
|
|
24
|
+
readonly schedule: readonly TriggerSchedule[];
|
|
25
|
+
}) | (TriggerSettingsBase & {
|
|
26
|
+
readonly config: Readonly<Record<string, JsonValue>>;
|
|
27
|
+
readonly kind: 'poll';
|
|
28
|
+
readonly schedule: readonly TriggerSchedule[];
|
|
29
|
+
}) | (TriggerSettingsBase & {
|
|
30
|
+
readonly config: Readonly<Record<string, JsonValue>>;
|
|
31
|
+
readonly kind: 'integration';
|
|
32
|
+
});
|
|
33
|
+
export declare function createCodeTask(target: GraphTarget, identity: {
|
|
34
|
+
readonly moduleId: string;
|
|
35
|
+
readonly nodeId: string;
|
|
36
|
+
}, name: string, module?: Pick<CodeModule, 'imports' | 'source'> | undefined, ports?: Pick<Extract<TaskDefinition, {
|
|
37
|
+
readonly moduleId: string;
|
|
38
|
+
}>, 'inputs' | 'outputs'>): readonly ChangeOperation[];
|
|
39
|
+
export declare function createManagedTask(target: GraphTarget, identity: {
|
|
40
|
+
readonly nodeId: string;
|
|
41
|
+
readonly taskId: string;
|
|
42
|
+
}, task: Extract<TaskDefinition, {
|
|
43
|
+
readonly executor: unknown;
|
|
44
|
+
}>): readonly ChangeOperation[];
|
|
45
|
+
export declare function createLlmTask(target: GraphTarget, identity: {
|
|
46
|
+
readonly nodeId: string;
|
|
47
|
+
readonly taskId: string;
|
|
48
|
+
}, name: string, mode: 'chat' | 'json', outputDescription: string, options?: LlmTaskOptions): readonly ChangeOperation[];
|
|
49
|
+
export declare function createCondition(target: GraphTarget, nodeId: string, name: string): readonly ChangeOperation[];
|
|
50
|
+
export declare function createValue(target: GraphTarget, nodeId: string, name: string): readonly ChangeOperation[];
|
|
51
|
+
export declare function createBuiltinTrigger(target: Extract<GraphTarget, {
|
|
52
|
+
readonly kind: 'flow';
|
|
53
|
+
}>, nodeId: string, node: Extract<TriggerNode, {
|
|
54
|
+
readonly kind: 'cron' | 'webhook';
|
|
55
|
+
}>): readonly ChangeOperation[];
|
|
56
|
+
export declare function createProviderTrigger(target: Extract<GraphTarget, {
|
|
57
|
+
readonly kind: 'flow';
|
|
58
|
+
}>, identity: {
|
|
59
|
+
readonly bindingId: string;
|
|
60
|
+
readonly nodeId: string;
|
|
61
|
+
}, definition: TriggerKeySnapshot, options: {
|
|
62
|
+
readonly config: Readonly<Record<string, JsonValue>>;
|
|
63
|
+
readonly connectionId: string;
|
|
64
|
+
readonly name?: string;
|
|
65
|
+
readonly schedule?: readonly TriggerSchedule[];
|
|
66
|
+
}): readonly ChangeOperation[];
|
|
67
|
+
export declare function deleteNodes(content: RevisionContent, target: GraphTarget, nodeIds: readonly string[]): readonly ChangeOperation[];
|
|
68
|
+
export declare function updateSettings(content: RevisionContent, target: GraphTarget, nodeId: string, settings: Settings): readonly ChangeOperation[] | undefined;
|
|
69
|
+
export declare function setInputValue(content: RevisionContent, target: GraphTarget, nodeId: string, handle: string, value: JsonValue | undefined): readonly ChangeOperation[] | undefined;
|
|
70
|
+
export declare function setInputValues(content: RevisionContent, target: GraphTarget, nodeId: string, values: Readonly<Record<string, JsonValue | undefined>>): readonly ChangeOperation[] | undefined;
|
|
71
|
+
export declare function setConnectorConnection(content: RevisionContent, taskId: string, connectionId: string): readonly ChangeOperation[] | undefined;
|
|
72
|
+
export declare function updateTrigger(content: RevisionContent, target: {
|
|
73
|
+
readonly kind: 'flow';
|
|
74
|
+
}, nodeId: string, settings: TriggerSettings): readonly ChangeOperation[] | undefined;
|
|
75
|
+
export declare function updateTriggerConfig(content: RevisionContent, target: {
|
|
76
|
+
readonly kind: 'flow';
|
|
77
|
+
}, nodeId: string, name: string, value: JsonValue | undefined): readonly ChangeOperation[] | undefined;
|
|
78
|
+
export declare function updateTriggerSchedule(content: RevisionContent, target: {
|
|
79
|
+
readonly kind: 'flow';
|
|
80
|
+
}, nodeId: string, schedule: readonly TriggerSchedule[]): readonly ChangeOperation[] | undefined;
|
|
81
|
+
export declare function setTriggerConnection(content: RevisionContent, _target: {
|
|
82
|
+
readonly kind: 'flow';
|
|
83
|
+
}, nodeId: string, connectionId: string): readonly ChangeOperation[] | undefined;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const createAuthoringId: (size?: number) => string;
|
|
2
|
+
export { connect, disconnect } from './flow-authoring-edge.js';
|
|
3
|
+
export { imports as moduleImports, rename as renameModule, replaceSource as replaceModuleSource } from './flow-authoring-module.js';
|
|
4
|
+
export { createBuiltinTrigger, createCodeTask, createCondition, createLlmTask, createManagedTask, createProviderTrigger, createValue, deleteNodes, setConnectorConnection, setInputValues, setTriggerConnection, updateSettings, updateTrigger, } from './flow-authoring-node.js';
|
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
//#region ../../node_modules/.bun/nanoid@6.0.1/node_modules/nanoid/index.browser.js
|
|
2
|
+
var e = (e) => crypto.getRandomValues(new Uint8Array(e)), t = (e, t, n) => {
|
|
3
|
+
let r = 256 - 256 % e.length;
|
|
4
|
+
if (r === 256) {
|
|
5
|
+
let r = e.length - 1;
|
|
6
|
+
return (i = t) => {
|
|
7
|
+
if (!i) return "";
|
|
8
|
+
let a = "";
|
|
9
|
+
for (;;) {
|
|
10
|
+
let t = n(i), o = i;
|
|
11
|
+
for (; o--;) if (a += e[t[o] & r], a.length >= i) return a;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
let i = Math.ceil(409.6 * t / r);
|
|
16
|
+
return (a = t) => {
|
|
17
|
+
if (!a) return "";
|
|
18
|
+
let o = "";
|
|
19
|
+
for (;;) {
|
|
20
|
+
let t = n(i), s = i;
|
|
21
|
+
for (; s--;) if (t[s] < r && (o += e[t[s] % e.length], o.length >= a)) return o;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, n = (n, r = 21) => t(n, r | 0, e);
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/flow/common/edgeChanges.ts
|
|
27
|
+
function r(e, t, n) {
|
|
28
|
+
let r = {
|
|
29
|
+
source: n.source,
|
|
30
|
+
sourceHandle: n.sourceHandle,
|
|
31
|
+
target: n.target,
|
|
32
|
+
targetHandle: n.targetHandle
|
|
33
|
+
}, i = a(e, t)?.nodes[n.target], o = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
|
|
34
|
+
return o?.kind == "sources" && o.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
|
|
35
|
+
edge: r,
|
|
36
|
+
kind: "graph.edge.connect",
|
|
37
|
+
target: t
|
|
38
|
+
}];
|
|
39
|
+
}
|
|
40
|
+
function i(e, t, n) {
|
|
41
|
+
let r = {
|
|
42
|
+
source: n.source,
|
|
43
|
+
sourceHandle: n.sourceHandle,
|
|
44
|
+
target: n.target,
|
|
45
|
+
targetHandle: n.targetHandle
|
|
46
|
+
}, i = a(e, t)?.nodes[n.target], o = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
|
|
47
|
+
return o?.kind != "sources" || !o.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
|
|
48
|
+
edge: r,
|
|
49
|
+
kind: "graph.edge.disconnect",
|
|
50
|
+
target: t
|
|
51
|
+
}];
|
|
52
|
+
}
|
|
53
|
+
function a(e, t) {
|
|
54
|
+
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/flow/common/moduleChanges.ts
|
|
58
|
+
async function o(e) {
|
|
59
|
+
try {
|
|
60
|
+
let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
|
|
61
|
+
errorRecovery: !0,
|
|
62
|
+
sourceType: "module"
|
|
63
|
+
}).program, r = /* @__PURE__ */ new Set();
|
|
64
|
+
for (let e of n.body) {
|
|
65
|
+
if (e.type != "ImportDeclaration") continue;
|
|
66
|
+
let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
|
|
67
|
+
t?.[1] != null && r.add(t[1]);
|
|
68
|
+
}
|
|
69
|
+
return [...r].toSorted();
|
|
70
|
+
} catch {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function s(e, t, n) {
|
|
75
|
+
return [{
|
|
76
|
+
imports: n,
|
|
77
|
+
kind: "module.source.replace",
|
|
78
|
+
moduleId: e,
|
|
79
|
+
source: t
|
|
80
|
+
}];
|
|
81
|
+
}
|
|
82
|
+
function c(e, t) {
|
|
83
|
+
return [{
|
|
84
|
+
kind: "module.rename",
|
|
85
|
+
moduleId: e,
|
|
86
|
+
name: t
|
|
87
|
+
}];
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/manifest/common/meta/block/generateTyping.ts
|
|
91
|
+
var l = "//#region generated meta", u = "//#endregion";
|
|
92
|
+
function d(e, t) {
|
|
93
|
+
let n = e.indexOf(l);
|
|
94
|
+
if (n < 0) return e;
|
|
95
|
+
let r = e.indexOf(`\n${u}`, n);
|
|
96
|
+
if (r < 0) return e;
|
|
97
|
+
let i = e.indexOf("\n", r + 1);
|
|
98
|
+
return i < 0 && (i = e.length), `${e.slice(0, n)}${l}\n${t}${u}${e.slice(i)}`;
|
|
99
|
+
}
|
|
100
|
+
function f(e, t, n) {
|
|
101
|
+
return e === "typescript" ? _(t, n) + "\n" : v(t, n) + "\n";
|
|
102
|
+
}
|
|
103
|
+
var p = /* @__PURE__ */ new Set(["color", "text"]), m = (e) => e.includes(" | ") ? `(${e})` : e;
|
|
104
|
+
function h(e) {
|
|
105
|
+
return !e || typeof e != "object" ? !1 : e.contentMediaType === "oomol/artifact" ? !0 : Array.isArray(e.anyOf) ? e.anyOf.some(h) : e.type === "object" ? Object.values(e.properties || {}).some(h) : e.type === "array" && h(e.items);
|
|
106
|
+
}
|
|
107
|
+
function g(e, t) {
|
|
108
|
+
return [...e, ...t].some((e) => h(e.json_schema));
|
|
109
|
+
}
|
|
110
|
+
function _(e = [], t = []) {
|
|
111
|
+
let n = ["type Inputs = {"];
|
|
112
|
+
for (let t of e) n.push(` ${t.handle}: ${y(t.json_schema, t.nullable)};`);
|
|
113
|
+
n.push("};"), n.push("type Outputs = {");
|
|
114
|
+
for (let e of t) n.push(` ${e.handle}: ${y(e.json_schema, e.nullable)};`);
|
|
115
|
+
return n.push("};"), g(e, t) && n.unshift("import type { ArtifactRef } from '@oomol-lab/open-flow'", ""), n.join("\n");
|
|
116
|
+
}
|
|
117
|
+
function v(e = [], t = []) {
|
|
118
|
+
let n = ["@typedef {{"];
|
|
119
|
+
for (let t of e) n.push(` ${t.handle}: ${y(t.json_schema, t.nullable)};`);
|
|
120
|
+
n.push("}} Inputs;"), n.push("@typedef {{");
|
|
121
|
+
for (let e of t) n.push(` ${e.handle}: ${y(e.json_schema, e.nullable)};`);
|
|
122
|
+
n.push("}} Outputs;"), g(e, t) && n.unshift("@import { ArtifactRef } from \"@oomol-lab/open-flow\"");
|
|
123
|
+
let r = n.map((e) => ` * ${e}`);
|
|
124
|
+
return r.unshift("/**"), r.push(" */"), r.join("\n");
|
|
125
|
+
}
|
|
126
|
+
function y(e, t) {
|
|
127
|
+
if (!e) return "any";
|
|
128
|
+
switch (e.contentMediaType) {
|
|
129
|
+
case "oomol/secret": return t ? "string | null" : "string";
|
|
130
|
+
case "oomol/bin": return t ? "Uint8Array | null" : "Uint8Array";
|
|
131
|
+
case "oomol/var": return "any";
|
|
132
|
+
case "oomol/artifact": return t ? "ArtifactRef | null" : "ArtifactRef";
|
|
133
|
+
}
|
|
134
|
+
if (p.has(e["ui:widget"])) return t ? "string | null" : "string";
|
|
135
|
+
if (Array.isArray(e.anyOf)) return b((t ? e.anyOf.concat({ type: "null" }) : e.anyOf).map((e) => m(y(e, !1)))) || "any";
|
|
136
|
+
if (Array.isArray(e.enum)) return b((t ? e.enum.concat(null) : e.enum).map((e) => JSON.stringify(e))) || "any";
|
|
137
|
+
switch (e.type) {
|
|
138
|
+
case "null": return "null";
|
|
139
|
+
case "boolean": return t ? "boolean | null" : "boolean";
|
|
140
|
+
case "integer":
|
|
141
|
+
case "number": return t ? "number | null" : "number";
|
|
142
|
+
case "string": return t ? "string | null" : "string";
|
|
143
|
+
case "object": {
|
|
144
|
+
let n = Object.keys(e.properties || {});
|
|
145
|
+
if (n.length === 0) return "Record<string, any>";
|
|
146
|
+
let r = Array.isArray(e?.required) ? new Set(e.required) : void 0, i = `{ ${n.map((t) => `${t}${r && !r.has(t) ? "?" : ""}: ${y(e.properties[t], !1)}`).join("; ")} }`;
|
|
147
|
+
return t ? `${i} | null` : i;
|
|
148
|
+
}
|
|
149
|
+
case "array":
|
|
150
|
+
if (e.uniqueItems && Array.isArray(e.items?.enum)) {
|
|
151
|
+
let n = `${m(y(e.items, !1))}[]`;
|
|
152
|
+
return t ? `${n} | null` : n;
|
|
153
|
+
}
|
|
154
|
+
{
|
|
155
|
+
let n = `${m(y(e.items, !1))}[]`;
|
|
156
|
+
return t ? `${n} | null` : n;
|
|
157
|
+
}
|
|
158
|
+
default: return "any";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function b(e) {
|
|
162
|
+
let t = Array.from(new Set(e.filter((e) => !!e)));
|
|
163
|
+
return t.length === 0 || t.includes("any") ? "any" : t.join(" | ");
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/flow/common/nodeChanges.ts
|
|
167
|
+
var x = "//#region generated meta\n/**\n * @typedef {{}} Inputs\n * @typedef {{}} Outputs\n */\n//#endregion\n\n/**\n * @import { TaskContext } from \"@oomol-lab/open-flow\"\n * @param {Inputs} input\n * @param {TaskContext<Outputs>} context\n * @returns {Promise<Partial<Outputs> | undefined | void>}\n */\nexport default async function (input, context) {\n return { result: input.value }\n}\n";
|
|
168
|
+
function S(e, t, n, r = void 0, i = {
|
|
169
|
+
inputs: [{
|
|
170
|
+
handle: "value",
|
|
171
|
+
jsonSchema: {},
|
|
172
|
+
nullable: !0,
|
|
173
|
+
value: null
|
|
174
|
+
}],
|
|
175
|
+
outputs: [{
|
|
176
|
+
handle: "result",
|
|
177
|
+
jsonSchema: {},
|
|
178
|
+
nullable: !0
|
|
179
|
+
}]
|
|
180
|
+
}) {
|
|
181
|
+
return [{
|
|
182
|
+
kind: "module.create",
|
|
183
|
+
module: {
|
|
184
|
+
...r ?? {
|
|
185
|
+
imports: [],
|
|
186
|
+
source: d(x, f("javascript", i.inputs.map((e) => ({
|
|
187
|
+
handle: e.handle,
|
|
188
|
+
json_schema: e.jsonSchema,
|
|
189
|
+
nullable: e.nullable
|
|
190
|
+
})), i.outputs.map((e) => ({
|
|
191
|
+
handle: e.handle,
|
|
192
|
+
json_schema: e.jsonSchema,
|
|
193
|
+
nullable: e.nullable
|
|
194
|
+
}))))
|
|
195
|
+
},
|
|
196
|
+
name: n
|
|
197
|
+
},
|
|
198
|
+
moduleId: t.moduleId
|
|
199
|
+
}, {
|
|
200
|
+
kind: "graph.node.create",
|
|
201
|
+
node: {
|
|
202
|
+
concurrency: 1,
|
|
203
|
+
inputs: I(i.inputs),
|
|
204
|
+
kind: "task",
|
|
205
|
+
name: n,
|
|
206
|
+
task: {
|
|
207
|
+
inputs: i.inputs,
|
|
208
|
+
moduleId: t.moduleId,
|
|
209
|
+
name: n,
|
|
210
|
+
outputs: i.outputs
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
nodeId: t.nodeId,
|
|
214
|
+
target: e
|
|
215
|
+
}];
|
|
216
|
+
}
|
|
217
|
+
function C(e, t, n) {
|
|
218
|
+
return [{
|
|
219
|
+
kind: "task.create",
|
|
220
|
+
task: n,
|
|
221
|
+
taskId: t.taskId
|
|
222
|
+
}, {
|
|
223
|
+
kind: "graph.node.create",
|
|
224
|
+
node: {
|
|
225
|
+
concurrency: 1,
|
|
226
|
+
inputs: I(n.inputs),
|
|
227
|
+
kind: "task",
|
|
228
|
+
name: n.name,
|
|
229
|
+
taskId: t.taskId
|
|
230
|
+
},
|
|
231
|
+
nodeId: t.nodeId,
|
|
232
|
+
target: e
|
|
233
|
+
}];
|
|
234
|
+
}
|
|
235
|
+
function w(e, t, n, r, i, a = {}) {
|
|
236
|
+
let o = a.inputs ?? {};
|
|
237
|
+
return C(e, t, {
|
|
238
|
+
executor: {
|
|
239
|
+
kind: "llm",
|
|
240
|
+
mode: r
|
|
241
|
+
},
|
|
242
|
+
inputs: [
|
|
243
|
+
{
|
|
244
|
+
handle: "messages",
|
|
245
|
+
jsonSchema: {
|
|
246
|
+
items: { type: "object" },
|
|
247
|
+
type: "array"
|
|
248
|
+
},
|
|
249
|
+
nullable: !0,
|
|
250
|
+
value: L(o, "messages", null)
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
handle: "input",
|
|
254
|
+
jsonSchema: { type: "string" },
|
|
255
|
+
nullable: !1,
|
|
256
|
+
value: L(o, "input", "Alex")
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
handle: "template",
|
|
260
|
+
jsonSchema: {
|
|
261
|
+
items: { type: "object" },
|
|
262
|
+
minItems: 1,
|
|
263
|
+
type: "array"
|
|
264
|
+
},
|
|
265
|
+
nullable: !1,
|
|
266
|
+
value: L(o, "template", [{
|
|
267
|
+
content: "Hello, I'm {{input}}",
|
|
268
|
+
role: "user"
|
|
269
|
+
}])
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
handle: "model",
|
|
273
|
+
jsonSchema: { type: "object" },
|
|
274
|
+
nullable: !1,
|
|
275
|
+
value: L(o, "model", { model: "deepseek-v4-flash" })
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
name: n,
|
|
279
|
+
outputs: [{
|
|
280
|
+
...a.output,
|
|
281
|
+
description: a.output?.description ?? i,
|
|
282
|
+
handle: "output",
|
|
283
|
+
jsonSchema: a.output?.jsonSchema ?? (r == "chat" ? { type: "string" } : {}),
|
|
284
|
+
nullable: a.output?.nullable ?? !1
|
|
285
|
+
}]
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function T(e, t, n) {
|
|
289
|
+
return [{
|
|
290
|
+
kind: "graph.node.create",
|
|
291
|
+
node: {
|
|
292
|
+
cases: [{
|
|
293
|
+
expressions: [{
|
|
294
|
+
input: "value",
|
|
295
|
+
operator: "isTrue"
|
|
296
|
+
}],
|
|
297
|
+
output: "true",
|
|
298
|
+
relation: "all"
|
|
299
|
+
}],
|
|
300
|
+
concurrency: 1,
|
|
301
|
+
defaultOutput: "false",
|
|
302
|
+
input: {
|
|
303
|
+
handle: "value",
|
|
304
|
+
jsonSchema: {},
|
|
305
|
+
nullable: !0,
|
|
306
|
+
value: null
|
|
307
|
+
},
|
|
308
|
+
inputs: { value: {
|
|
309
|
+
kind: "value",
|
|
310
|
+
value: null
|
|
311
|
+
} },
|
|
312
|
+
kind: "condition",
|
|
313
|
+
name: n
|
|
314
|
+
},
|
|
315
|
+
nodeId: t,
|
|
316
|
+
target: e
|
|
317
|
+
}];
|
|
318
|
+
}
|
|
319
|
+
function E(e, t, n) {
|
|
320
|
+
return [{
|
|
321
|
+
kind: "graph.node.create",
|
|
322
|
+
node: {
|
|
323
|
+
concurrency: 1,
|
|
324
|
+
inputs: {},
|
|
325
|
+
kind: "value",
|
|
326
|
+
name: n,
|
|
327
|
+
values: [{
|
|
328
|
+
handle: "value",
|
|
329
|
+
jsonSchema: {},
|
|
330
|
+
nullable: !0,
|
|
331
|
+
value: null
|
|
332
|
+
}]
|
|
333
|
+
},
|
|
334
|
+
nodeId: t,
|
|
335
|
+
target: e
|
|
336
|
+
}];
|
|
337
|
+
}
|
|
338
|
+
function D(e, t, n) {
|
|
339
|
+
return [{
|
|
340
|
+
kind: "graph.node.create",
|
|
341
|
+
node: n,
|
|
342
|
+
nodeId: t,
|
|
343
|
+
target: e
|
|
344
|
+
}];
|
|
345
|
+
}
|
|
346
|
+
function O(e, t, n, r) {
|
|
347
|
+
let i = r.name ?? n.displayName, a = n.type == "poll" ? {
|
|
348
|
+
bindingId: t.bindingId,
|
|
349
|
+
config: r.config,
|
|
350
|
+
definition: n,
|
|
351
|
+
kind: "poll",
|
|
352
|
+
name: i,
|
|
353
|
+
pollTimes: r.schedule ?? [{
|
|
354
|
+
type: "every",
|
|
355
|
+
unit: "minute",
|
|
356
|
+
value: 5
|
|
357
|
+
}]
|
|
358
|
+
} : {
|
|
359
|
+
bindingId: t.bindingId,
|
|
360
|
+
config: r.config,
|
|
361
|
+
definition: n,
|
|
362
|
+
kind: "integration",
|
|
363
|
+
name: i
|
|
364
|
+
};
|
|
365
|
+
return [{
|
|
366
|
+
binding: {
|
|
367
|
+
kind: "connection",
|
|
368
|
+
target: r.connectionId
|
|
369
|
+
},
|
|
370
|
+
bindingId: t.bindingId,
|
|
371
|
+
kind: "binding.create"
|
|
372
|
+
}, {
|
|
373
|
+
kind: "graph.node.create",
|
|
374
|
+
node: a,
|
|
375
|
+
nodeId: t.nodeId,
|
|
376
|
+
target: e
|
|
377
|
+
}];
|
|
378
|
+
}
|
|
379
|
+
function k(e, t, n) {
|
|
380
|
+
let r = F(e, t)?.nodes;
|
|
381
|
+
if (r == null) return [];
|
|
382
|
+
let i = new Set(n), a = n.flatMap((e) => {
|
|
383
|
+
let n = r[e];
|
|
384
|
+
return n == null ? [] : [{
|
|
385
|
+
kind: "graph.node.delete",
|
|
386
|
+
nodeId: e,
|
|
387
|
+
target: t
|
|
388
|
+
}, ...n.kind == "task" && n.task != null ? [{
|
|
389
|
+
kind: "module.delete",
|
|
390
|
+
moduleId: n.task.moduleId
|
|
391
|
+
}] : []];
|
|
392
|
+
});
|
|
393
|
+
if (t.kind == "subflow") return a;
|
|
394
|
+
let o = new Set(n.flatMap((e) => {
|
|
395
|
+
let t = r[e];
|
|
396
|
+
return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
|
|
397
|
+
}));
|
|
398
|
+
for (let t of o) Object.entries(e.document.graph.nodes).some(([e, n]) => !i.has(e) && (n.kind == "poll" || n.kind == "integration") && n.bindingId == t) || a.push({
|
|
399
|
+
bindingId: t,
|
|
400
|
+
kind: "binding.delete"
|
|
401
|
+
});
|
|
402
|
+
return a;
|
|
403
|
+
}
|
|
404
|
+
function A(e, t, n, r) {
|
|
405
|
+
let i = F(e, t)?.nodes[n];
|
|
406
|
+
if (i == null || !("inputs" in i)) return;
|
|
407
|
+
let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
|
|
408
|
+
return R(t, n, {
|
|
409
|
+
...c,
|
|
410
|
+
...r
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
function j(e, t, n, r) {
|
|
414
|
+
let i = F(e, t)?.nodes[n];
|
|
415
|
+
if (i == null || !("inputs" in i)) return;
|
|
416
|
+
let a = { ...i.inputs };
|
|
417
|
+
for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
|
|
418
|
+
kind: "value",
|
|
419
|
+
value: t
|
|
420
|
+
};
|
|
421
|
+
return R(t, n, {
|
|
422
|
+
...i,
|
|
423
|
+
inputs: a
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
function M(e, t, n) {
|
|
427
|
+
let r = e.document.tasks[t];
|
|
428
|
+
if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
|
|
429
|
+
kind: "task.replace",
|
|
430
|
+
task: {
|
|
431
|
+
...r,
|
|
432
|
+
executor: {
|
|
433
|
+
...r.executor,
|
|
434
|
+
connectionId: n
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
taskId: t
|
|
438
|
+
}];
|
|
439
|
+
}
|
|
440
|
+
function N(e, t, n, r) {
|
|
441
|
+
let i = e.document.graph.nodes[n];
|
|
442
|
+
if (i == null) return;
|
|
443
|
+
let a = {
|
|
444
|
+
...r.description == null ? {} : { description: r.description },
|
|
445
|
+
icon: i.icon,
|
|
446
|
+
name: r.name
|
|
447
|
+
}, o;
|
|
448
|
+
switch (r.kind) {
|
|
449
|
+
case "webhook":
|
|
450
|
+
if (i.kind != "webhook") return;
|
|
451
|
+
o = Object.keys(r.options).length == 0 ? {
|
|
452
|
+
...a,
|
|
453
|
+
inputsDef: r.inputs,
|
|
454
|
+
kind: "webhook"
|
|
455
|
+
} : {
|
|
456
|
+
...a,
|
|
457
|
+
inputsDef: r.inputs,
|
|
458
|
+
kind: "webhook",
|
|
459
|
+
options: r.options
|
|
460
|
+
};
|
|
461
|
+
break;
|
|
462
|
+
case "cron":
|
|
463
|
+
if (i.kind != "cron") return;
|
|
464
|
+
o = {
|
|
465
|
+
...a,
|
|
466
|
+
cronTimes: r.schedule,
|
|
467
|
+
kind: "cron"
|
|
468
|
+
};
|
|
469
|
+
break;
|
|
470
|
+
case "poll":
|
|
471
|
+
if (i.kind != "poll") return;
|
|
472
|
+
o = {
|
|
473
|
+
...i,
|
|
474
|
+
...a,
|
|
475
|
+
config: r.config,
|
|
476
|
+
pollTimes: r.schedule
|
|
477
|
+
};
|
|
478
|
+
break;
|
|
479
|
+
case "integration":
|
|
480
|
+
if (i.kind != "integration") return;
|
|
481
|
+
o = {
|
|
482
|
+
...i,
|
|
483
|
+
...a,
|
|
484
|
+
config: r.config
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
return R(t, n, o);
|
|
488
|
+
}
|
|
489
|
+
function P(e, t, n, r) {
|
|
490
|
+
let i = e.document.graph.nodes[n];
|
|
491
|
+
if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
|
|
492
|
+
binding: {
|
|
493
|
+
kind: "connection",
|
|
494
|
+
target: r
|
|
495
|
+
},
|
|
496
|
+
bindingId: i.bindingId,
|
|
497
|
+
kind: "binding.replace"
|
|
498
|
+
}];
|
|
499
|
+
}
|
|
500
|
+
function F(e, t) {
|
|
501
|
+
return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
|
|
502
|
+
}
|
|
503
|
+
function I(e) {
|
|
504
|
+
return Object.fromEntries(e.flatMap((e) => Object.hasOwn(e, "value") ? [[e.handle, {
|
|
505
|
+
kind: "value",
|
|
506
|
+
value: e.value
|
|
507
|
+
}]] : []));
|
|
508
|
+
}
|
|
509
|
+
function L(e, t, n) {
|
|
510
|
+
return e != null && Object.hasOwn(e, t) ? e[t] : n;
|
|
511
|
+
}
|
|
512
|
+
function R(e, t, n) {
|
|
513
|
+
return [{
|
|
514
|
+
kind: "graph.node.replace",
|
|
515
|
+
node: n,
|
|
516
|
+
nodeId: t,
|
|
517
|
+
target: e
|
|
518
|
+
}];
|
|
519
|
+
}
|
|
520
|
+
var z = n("23456789abcdefghjkmnpqrstuvwxyz", 10);
|
|
521
|
+
//#endregion
|
|
522
|
+
export { r as connect, z as createAuthoringId, D as createBuiltinTrigger, S as createCodeTask, T as createCondition, w as createLlmTask, C as createManagedTask, O as createProviderTrigger, E as createValue, k as deleteNodes, i as disconnect, o as moduleImports, c as renameModule, s as replaceModuleSource, M as setConnectorConnection, j as setInputValues, P as setTriggerConnection, A as updateSettings, N as updateTrigger };
|