@oomol-lab/open-flow 0.1.0-alpha.10 → 0.1.0-alpha.13

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.
Files changed (43) hide show
  1. package/README.md +5 -1
  2. package/dist/browser/addNodeOptions-JRHMwVOl.js +9597 -0
  3. package/dist/browser/{change-Cu6pQIit.js → change-BATEvjif.js} +2 -2
  4. package/dist/browser/createResourceDialog-CWD62rU0.js +467 -0
  5. package/dist/browser/{esm-CvAs_mAS.js → esm-C04lx1pd.js} +1 -1
  6. package/dist/browser/flow-authoring-node.d.ts +2 -0
  7. package/dist/browser/flow-authoring.d.ts +1 -1
  8. package/dist/browser/flow-authoring.js +387 -126
  9. package/dist/browser/flow-change.d.ts +9 -4
  10. package/dist/browser/flow-change.js +49 -46
  11. package/dist/browser/{flowRunInputEditorStore-DXOyyY7o.js → flowRunInputEditorStore-BUwR9Vbp.js} +1615 -882
  12. package/dist/browser/{flowWorkspace-X_T_DcQf.js → flowWorkspace-_qaqIyDi.js} +18174 -16631
  13. package/dist/browser/languages-DgJehE1g.js +62 -0
  14. package/dist/browser/lib-C5Ipyfps.js +7856 -0
  15. package/dist/browser/main-DmjVyuWr.js +76 -0
  16. package/dist/browser/{markdownContent-BI-2PmDX.js → markdownContent-CX77lBFM.js} +4795 -4787
  17. package/dist/browser/theme.css +63 -0
  18. package/dist/browser/theme.css.d.ts +1 -0
  19. package/dist/browser/typeScriptSession-D5neIpug.js +2560 -0
  20. package/dist/browser/{createLucideIcon-COMgwa_u.js → useOpenInteractionType-CRgOHg5M.js} +2484 -2254
  21. package/dist/browser/workbench-contract.d.ts +2 -1
  22. package/dist/browser/workbench.css +1 -1
  23. package/dist/browser/workbench.d.ts +16 -1
  24. package/dist/browser/workbench.js +1492 -1307
  25. package/dist/common/control-api-conformance.js +39 -0
  26. package/dist/common/control-api-errors.d.ts +12 -0
  27. package/dist/common/control-api.d.ts +13 -0
  28. package/dist/common/control-api.js +120 -73
  29. package/dist/common/flow-encoding.d.ts +2 -2
  30. package/dist/common/flow-encoding.js +4 -1
  31. package/dist/common/flow-semantics.d.ts +2 -0
  32. package/dist/common/flow-semantics.js +869 -838
  33. package/dist/common/licenses.md +1 -25
  34. package/dist/common/localization.d.ts +21 -0
  35. package/dist/common/localization.js +62 -0
  36. package/dist/common/scheduler.d.ts +1 -0
  37. package/dist/common/scheduler.js +64 -50
  38. package/package.json +9 -1
  39. package/dist/browser/addNodeOptions-BwrMvPQC.js +0 -5230
  40. package/dist/browser/assets/typeScriptWorker-CaA4llbX.js +0 -59850
  41. package/dist/browser/createResourceDialog-YgMLylQz.js +0 -467
  42. package/dist/browser/field-BrEG-7ap.js +0 -312
  43. package/dist/browser/typeScriptSession-Dagu_tRs.js +0 -2549
@@ -4,6 +4,7 @@ export type JsonValue = null | boolean | number | string | readonly JsonValue[]
4
4
  export declare const resourceNameMaxLength = 80;
5
5
  export type ResourceNameIssue = 'controlCharacter' | 'empty' | 'specialCharacter' | 'tooLong';
6
6
  export declare function resourceNameIssue(value: string): ResourceNameIssue | undefined;
7
+ export declare function validVariableName(value: string): boolean;
7
8
  export interface PortDefinition {
8
9
  readonly description?: string;
9
10
  readonly jsonSchema: JsonValue;
@@ -18,7 +19,11 @@ export interface Port extends PortDefinition {
18
19
  export interface InputPort extends InputPortDefinition {
19
20
  readonly handle: string;
20
21
  }
21
- export declare function portsByHandle<Value extends Port>(ports: readonly Value[]): Readonly<Record<string, Value>>;
22
+ export interface Group {
23
+ readonly collapsed?: boolean;
24
+ readonly group: string;
25
+ }
26
+ export declare function portsByHandle<Value extends Port>(ports: readonly (Value | Group)[]): Readonly<Record<string, Value>>;
22
27
  export interface NodeSource {
23
28
  readonly kind: 'node';
24
29
  readonly nodeId: string;
@@ -89,9 +94,9 @@ export interface ConnectorCapability {
89
94
  readonly kind: 'connector';
90
95
  }
91
96
  interface TaskDefinitionBase {
92
- readonly inputs: readonly InputPort[];
97
+ readonly inputs: readonly (InputPort | Group)[];
93
98
  readonly name: string;
94
- readonly outputs: readonly Port[];
99
+ readonly outputs: readonly (Port | Group)[];
95
100
  }
96
101
  export interface InlineTaskDefinition extends TaskDefinitionBase {
97
102
  readonly capabilities?: readonly ConnectorCapability[];
@@ -190,7 +195,7 @@ export type TriggerNode = (TriggerNodeBase & {
190
195
  export type GraphNode = ConditionNode | SubflowNode | TaskNode | TriggerNode | ValueNode;
191
196
  export interface FlowDocument {
192
197
  readonly bindings: Readonly<Record<string, {
193
- readonly kind: 'connection' | 'secret';
198
+ readonly kind: 'connection' | 'variable';
194
199
  readonly target: string;
195
200
  }>>;
196
201
  readonly graph: Graph;
@@ -11,24 +11,27 @@ function t(e) {
11
11
  if (!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(t)) return "specialCharacter";
12
12
  }
13
13
  function n(e) {
14
- return Object.fromEntries(e.map((e) => [e.handle, e]));
14
+ return e.length <= 256 && /^[A-Za-z_][A-Za-z0-9_]*$/.test(e) && e.slice(0, 3).toUpperCase() != "OO_";
15
15
  }
16
- var r = class extends Error {};
17
- function i() {
18
- throw new r();
16
+ function r(e) {
17
+ return Object.fromEntries(e.flatMap((e) => "handle" in e ? [[e.handle, e]] : []));
19
18
  }
20
- function a(e, t) {
19
+ var i = class extends Error {};
20
+ function a() {
21
+ throw new i();
22
+ }
23
+ function o(e, t) {
21
24
  if (t.kind == "flow") return e.graph;
22
25
  let n = e.subflows[t.id];
23
- return n ?? i(), n.graph;
26
+ return n ?? a(), n.graph;
24
27
  }
25
- function o(e, t, n) {
28
+ function s(e, t, n) {
26
29
  if (t.kind == "flow") return {
27
30
  ...e,
28
31
  graph: n
29
32
  };
30
33
  let r = e.subflows[t.id];
31
- return r ?? i(), {
34
+ return r ?? a(), {
32
35
  ...e,
33
36
  subflows: {
34
37
  ...e.subflows,
@@ -39,7 +42,7 @@ function o(e, t, n) {
39
42
  }
40
43
  };
41
44
  }
42
- function s(e, t) {
45
+ function c(e, t) {
43
46
  if (!("inputs" in e)) return e;
44
47
  let n = { ...e.inputs };
45
48
  for (let [e, r] of Object.entries(n)) {
@@ -55,38 +58,38 @@ function s(e, t) {
55
58
  inputs: n
56
59
  };
57
60
  }
58
- function c(e, t) {
61
+ function l(e, t) {
59
62
  let n = { ...e.document }, r = { ...e.modules };
60
63
  for (let e of t) switch (e.kind) {
61
64
  case "binding.create":
62
- n.bindings[e.bindingId] != null && i(), n.bindings = {
65
+ n.bindings[e.bindingId] != null && a(), n.bindings = {
63
66
  ...n.bindings,
64
67
  [e.bindingId]: e.binding
65
68
  };
66
69
  break;
67
70
  case "binding.replace":
68
- n.bindings[e.bindingId] ?? i(), n.bindings = {
71
+ n.bindings[e.bindingId] ?? a(), n.bindings = {
69
72
  ...n.bindings,
70
73
  [e.bindingId]: e.binding
71
74
  };
72
75
  break;
73
76
  case "binding.delete": {
74
- n.bindings[e.bindingId] ?? i();
77
+ n.bindings[e.bindingId] ?? a();
75
78
  let t = { ...n.bindings };
76
79
  delete t[e.bindingId], n.bindings = t;
77
80
  break;
78
81
  }
79
82
  case "graph.edge.connect": {
80
- let t = a(n, e.target);
81
- t.nodes[e.edge.source] ?? i();
83
+ let t = o(n, e.target);
84
+ t.nodes[e.edge.source] ?? a();
82
85
  let r = t.nodes[e.edge.target];
83
- (r == null || !("inputs" in r)) && i();
84
- let s = r.inputs[e.edge.targetHandle], c = {
86
+ (r == null || !("inputs" in r)) && a();
87
+ let i = r.inputs[e.edge.targetHandle], c = {
85
88
  kind: "node",
86
89
  nodeId: e.edge.source,
87
90
  output: e.edge.sourceHandle
88
- }, l = s?.kind == "sources" ? s.sources : [];
89
- l.some((e) => e.kind == "node" && e.nodeId == c.nodeId && e.output == c.output) && i();
91
+ }, l = i?.kind == "sources" ? i.sources.filter((e) => e.kind != "binding" || n.bindings[e.bindingId]?.kind != "variable") : [];
92
+ l.some((e) => e.kind == "node" && e.nodeId == c.nodeId && e.output == c.output) && a();
90
93
  let u = {
91
94
  ...r,
92
95
  inputs: {
@@ -97,24 +100,24 @@ function c(e, t) {
97
100
  }
98
101
  }
99
102
  };
100
- Object.assign(n, o(n, e.target, { nodes: {
103
+ Object.assign(n, s(n, e.target, { nodes: {
101
104
  ...t.nodes,
102
105
  [e.edge.target]: u
103
106
  } }));
104
107
  break;
105
108
  }
106
109
  case "graph.edge.disconnect": {
107
- let t = a(n, e.target), r = t.nodes[e.edge.target];
108
- (r == null || !("inputs" in r)) && i();
109
- let s = r.inputs[e.edge.targetHandle];
110
- s?.kind != "sources" && i();
111
- let c = s.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
112
- c.length == s.sources.length && i();
110
+ let t = o(n, e.target), r = t.nodes[e.edge.target];
111
+ (r == null || !("inputs" in r)) && a();
112
+ let i = r.inputs[e.edge.targetHandle];
113
+ i?.kind != "sources" && a();
114
+ let c = i.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
115
+ c.length == i.sources.length && a();
113
116
  let l = { ...r.inputs };
114
117
  c.length == 0 ? delete l[e.edge.targetHandle] : l[e.edge.targetHandle] = {
115
118
  kind: "sources",
116
119
  sources: c
117
- }, Object.assign(n, o(n, e.target, { nodes: {
120
+ }, Object.assign(n, s(n, e.target, { nodes: {
118
121
  ...t.nodes,
119
122
  [e.edge.target]: {
120
123
  ...r,
@@ -124,18 +127,18 @@ function c(e, t) {
124
127
  break;
125
128
  }
126
129
  case "graph.node.create": {
127
- let t = a(n, e.target);
128
- (t.nodes[e.nodeId] != null || e.target.kind == "subflow" && !("inputs" in e.node)) && i(), Object.assign(n, o(n, e.target, { nodes: {
130
+ let t = o(n, e.target);
131
+ (t.nodes[e.nodeId] != null || e.target.kind == "subflow" && !("inputs" in e.node)) && a(), Object.assign(n, s(n, e.target, { nodes: {
129
132
  ...t.nodes,
130
133
  [e.nodeId]: e.node
131
134
  } }));
132
135
  break;
133
136
  }
134
137
  case "graph.node.delete": {
135
- let t = a(n, e.target);
136
- t.nodes[e.nodeId] ?? i();
137
- let r = /* @__PURE__ */ new Set([e.nodeId]), c = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => r.has(e) ? [] : [[e, s(t, r)]]));
138
- if (Object.assign(n, o(n, e.target, { nodes: c })), e.target.kind == "subflow") {
138
+ let t = o(n, e.target);
139
+ t.nodes[e.nodeId] ?? a();
140
+ let r = /* @__PURE__ */ new Set([e.nodeId]), i = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => r.has(e) ? [] : [[e, c(t, r)]]));
141
+ if (Object.assign(n, s(n, e.target, { nodes: i })), e.target.kind == "subflow") {
139
142
  let t = n.subflows[e.target.id], i = t.outputs.map((e) => ({
140
143
  ...e,
141
144
  sources: e.sources.filter((e) => e.kind != "node" || !r.has(e.nodeId))
@@ -151,22 +154,22 @@ function c(e, t) {
151
154
  break;
152
155
  }
153
156
  case "graph.node.replace": {
154
- let t = a(n, e.target);
155
- (t.nodes[e.nodeId] == null || e.target.kind == "subflow" && !("inputs" in e.node)) && i(), Object.assign(n, o(n, e.target, { nodes: {
157
+ let t = o(n, e.target);
158
+ (t.nodes[e.nodeId] == null || e.target.kind == "subflow" && !("inputs" in e.node)) && a(), Object.assign(n, s(n, e.target, { nodes: {
156
159
  ...t.nodes,
157
160
  [e.nodeId]: e.node
158
161
  } }));
159
162
  break;
160
163
  }
161
164
  case "module.create":
162
- r[e.moduleId] != null && i(), r[e.moduleId] = e.module;
165
+ r[e.moduleId] != null && a(), r[e.moduleId] = e.module;
163
166
  break;
164
167
  case "module.delete":
165
- r[e.moduleId] ?? i(), delete r[e.moduleId];
168
+ r[e.moduleId] ?? a(), delete r[e.moduleId];
166
169
  break;
167
170
  case "module.rename": {
168
171
  let t = r[e.moduleId];
169
- t ?? i(), r[e.moduleId] = {
172
+ t ?? a(), r[e.moduleId] = {
170
173
  ...t,
171
174
  name: e.name
172
175
  };
@@ -174,7 +177,7 @@ function c(e, t) {
174
177
  }
175
178
  case "module.source.replace": {
176
179
  let t = r[e.moduleId];
177
- t ?? i(), r[e.moduleId] = {
180
+ t ?? a(), r[e.moduleId] = {
178
181
  ...t,
179
182
  imports: e.imports,
180
183
  source: e.source
@@ -182,14 +185,14 @@ function c(e, t) {
182
185
  break;
183
186
  }
184
187
  case "subflow.create":
185
- n.subflows[e.subflowId] != null && i(), n.subflows = {
188
+ n.subflows[e.subflowId] != null && a(), n.subflows = {
186
189
  ...n.subflows,
187
190
  [e.subflowId]: e.subflow
188
191
  };
189
192
  break;
190
193
  case "subflow.definition.replace": {
191
194
  let t = n.subflows[e.subflowId];
192
- t ?? i(), n.subflows = {
195
+ t ?? a(), n.subflows = {
193
196
  ...n.subflows,
194
197
  [e.subflowId]: {
195
198
  ...e.definition,
@@ -199,24 +202,24 @@ function c(e, t) {
199
202
  break;
200
203
  }
201
204
  case "subflow.delete": {
202
- n.subflows[e.subflowId] ?? i();
205
+ n.subflows[e.subflowId] ?? a();
203
206
  let t = { ...n.subflows };
204
207
  delete t[e.subflowId], n.subflows = t;
205
208
  break;
206
209
  }
207
210
  case "task.create":
208
- n.tasks[e.taskId] != null && i(), n.tasks = {
211
+ n.tasks[e.taskId] != null && a(), n.tasks = {
209
212
  ...n.tasks,
210
213
  [e.taskId]: e.task
211
214
  };
212
215
  break;
213
216
  case "task.delete": {
214
- n.tasks[e.taskId] ?? i();
217
+ n.tasks[e.taskId] ?? a();
215
218
  let t = { ...n.tasks };
216
219
  delete t[e.taskId], n.tasks = t;
217
220
  break;
218
221
  }
219
- case "task.replace": n.tasks[e.taskId] ?? i(), n.tasks = {
222
+ case "task.replace": n.tasks[e.taskId] ?? a(), n.tasks = {
220
223
  ...n.tasks,
221
224
  [e.taskId]: e.task
222
225
  };
@@ -228,4 +231,4 @@ function c(e, t) {
228
231
  };
229
232
  }
230
233
  //#endregion
231
- export { r as FlowChangeError, c as applyFlowChanges, n as portsByHandle, t as resourceNameIssue, e as resourceNameMaxLength };
234
+ export { i as FlowChangeError, l as applyFlowChanges, r as portsByHandle, t as resourceNameIssue, e as resourceNameMaxLength, n as validVariableName };