@oomol-lab/open-flow 0.1.0-alpha.0

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 (133) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +47 -0
  3. package/README.md +18 -0
  4. package/dist/browser/_virtual_open-flow-twemoji-DJwKsM_w.js +5067 -0
  5. package/dist/browser/addNodeOptions-DqoIueCR.js +33746 -0
  6. package/dist/browser/assets/font-00b26ac825e20950.woff2 +0 -0
  7. package/dist/browser/assets/font-036d4e95149b69ff.woff2 +0 -0
  8. package/dist/browser/assets/font-07d8e303ce4fc12b.ttf +0 -0
  9. package/dist/browser/assets/font-08ce98e51b04d589.ttf +0 -0
  10. package/dist/browser/assets/font-0cdd387c9590a1a9.woff2 +0 -0
  11. package/dist/browser/assets/font-0d85ae7cc30f2379.ttf +0 -0
  12. package/dist/browser/assets/font-0f60d1b897938ec9.woff2 +0 -0
  13. package/dist/browser/assets/font-11e4dc8a6471ff6d.woff +0 -0
  14. package/dist/browser/assets/font-138ac28d1663b303.ttf +0 -0
  15. package/dist/browser/assets/font-1ae6bd7475590e97.woff +0 -0
  16. package/dist/browser/assets/font-1c67f068fea8bb09.ttf +0 -0
  17. package/dist/browser/assets/font-1e6f9579e90e2cac.ttf +0 -0
  18. package/dist/browser/assets/font-1ece03f79f95277d.ttf +0 -0
  19. package/dist/browser/assets/font-2014c523c3210bcc.woff +0 -0
  20. package/dist/browser/assets/font-30da91e84c893f87.woff +0 -0
  21. package/dist/browser/assets/font-3398dd02302557a7.woff +0 -0
  22. package/dist/browser/assets/font-3931dd81faed86ba.ttf +0 -0
  23. package/dist/browser/assets/font-500e04d54f0d5166.ttf +0 -0
  24. package/dist/browser/assets/font-51814d270d06ff02.woff2 +0 -0
  25. package/dist/browser/assets/font-5d53e70ad607c235.woff2 +0 -0
  26. package/dist/browser/assets/font-5e28753be717dac9.woff +0 -0
  27. package/dist/browser/assets/font-68534840bcfdd2bf.ttf +0 -0
  28. package/dist/browser/assets/font-68e8c73ef42afd3c.woff2 +0 -0
  29. package/dist/browser/assets/font-6ab6b62e9b62dae2.woff +0 -0
  30. package/dist/browser/assets/font-6b47c40166b6dbe2.woff2 +0 -0
  31. package/dist/browser/assets/font-70ee1f64a20f2048.ttf +0 -0
  32. package/dist/browser/assets/font-71d517d67827787c.woff2 +0 -0
  33. package/dist/browser/assets/font-73d591271b160496.woff2 +0 -0
  34. package/dist/browser/assets/font-74444efd593c005e.woff2 +0 -0
  35. package/dist/browser/assets/font-7af58c5ec8f132a2.woff2 +0 -0
  36. package/dist/browser/assets/font-850c0af5c2238497.woff +0 -0
  37. package/dist/browser/assets/font-8a8d244581371912.woff +0 -0
  38. package/dist/browser/assets/font-9163df9c7122432e.ttf +0 -0
  39. package/dist/browser/assets/font-91ee67500cc0129a.woff +0 -0
  40. package/dist/browser/assets/font-95b6d2f1a50173bf.ttf +0 -0
  41. package/dist/browser/assets/font-97479ca6cce906ab.woff2 +0 -0
  42. package/dist/browser/assets/font-99cd42a3c072d918.woff2 +0 -0
  43. package/dist/browser/assets/font-99f9c6750b489c94.woff +0 -0
  44. package/dist/browser/assets/font-9be7ceb88004ab8a.woff +0 -0
  45. package/dist/browser/assets/font-a4af7d414440a1c1.woff2 +0 -0
  46. package/dist/browser/assets/font-a6b2099fb555c60e.ttf +0 -0
  47. package/dist/browser/assets/font-a6f7ec0d846ac7ad.woff +0 -0
  48. package/dist/browser/assets/font-c2342cd8b869e017.woff2 +0 -0
  49. package/dist/browser/assets/font-c6368d87e8a1a3a5.woff +0 -0
  50. package/dist/browser/assets/font-c647367d1dd4e162.ttf +0 -0
  51. package/dist/browser/assets/font-c76c5d696297d51b.woff +0 -0
  52. package/dist/browser/assets/font-c943cc986384f59e.woff +0 -0
  53. package/dist/browser/assets/font-d0332f52868370fd.ttf +0 -0
  54. package/dist/browser/assets/font-d04c54219f9eaec6.woff2 +0 -0
  55. package/dist/browser/assets/font-d96cdf2b3bdd4d64.woff +0 -0
  56. package/dist/browser/assets/font-dc47344dbb6cb5b6.woff2 +0 -0
  57. package/dist/browser/assets/font-de7701e42cf1f4cf.woff2 +0 -0
  58. package/dist/browser/assets/font-e14fed02b1aba7ce.woff +0 -0
  59. package/dist/browser/assets/font-e99ae51144bf1232.woff2 +0 -0
  60. package/dist/browser/assets/font-ece03cfd83e22c21.woff +0 -0
  61. package/dist/browser/assets/font-ed0b74372feefcbb.ttf +0 -0
  62. package/dist/browser/assets/font-f01f3e87d9c6a61c.ttf +0 -0
  63. package/dist/browser/assets/font-f1d6ef86f3b11a52.woff +0 -0
  64. package/dist/browser/assets/font-f36ea897e19f4a2e.ttf +0 -0
  65. package/dist/browser/assets/font-f9377ab0271cda59.ttf +0 -0
  66. package/dist/browser/carbon-nMY84Amv.js +53 -0
  67. package/dist/browser/composite-7VwgfnXx.js +6088 -0
  68. package/dist/browser/createResourceDialog-ByuJWdSL.js +439 -0
  69. package/dist/browser/dist-7oZK9QXZ.js +50088 -0
  70. package/dist/browser/dist-B9OV3YTx.js +881 -0
  71. package/dist/browser/dist-BLk5M0uK.js +1816 -0
  72. package/dist/browser/dist-BbyiRq3c.js +3285 -0
  73. package/dist/browser/dist-CIq6ue3I.js +6646 -0
  74. package/dist/browser/dist-CLZJNoWB.js +89 -0
  75. package/dist/browser/dist-CvcmLAMW.js +1620 -0
  76. package/dist/browser/dist-DL0SDskM.js +2327 -0
  77. package/dist/browser/dist-Djd02JSy.js +1247 -0
  78. package/dist/browser/dist-aWSZx4q1.js +850 -0
  79. package/dist/browser/dist-n-z5HtaO.js +4 -0
  80. package/dist/browser/dist-o4dBuwiG.js +320 -0
  81. package/dist/browser/dist-zyY--HOV.js +1543 -0
  82. package/dist/browser/esm-DXw7EADW.js +218 -0
  83. package/dist/browser/favicon.svg +7 -0
  84. package/dist/browser/flowWorkspace-DwVMpcar.js +22092 -0
  85. package/dist/browser/lib-S4ccuMeT.js +7857 -0
  86. package/dist/browser/licenses.md +4973 -0
  87. package/dist/browser/markdownContent-ZZFfSRqO.js +44545 -0
  88. package/dist/browser/project-change.d.ts +311 -0
  89. package/dist/browser/project-change.js +259 -0
  90. package/dist/browser/project-notifications.d.ts +12 -0
  91. package/dist/browser/rolldown-runtime-CEFd7nDs.js +30 -0
  92. package/dist/browser/workbench-contract.d.ts +28 -0
  93. package/dist/browser/workbench.css +2 -0
  94. package/dist/browser/workbench.css.d.ts +1 -0
  95. package/dist/browser/workbench.d.ts +14 -0
  96. package/dist/browser/workbench.js +3364 -0
  97. package/dist/common/connector-action.d.ts +20 -0
  98. package/dist/common/connector-action.js +106 -0
  99. package/dist/common/connector-proxy.d.ts +14 -0
  100. package/dist/common/connector-proxy.js +0 -0
  101. package/dist/common/control-api-conformance.d.ts +13 -0
  102. package/dist/common/control-api-conformance.js +518 -0
  103. package/dist/common/control-api-errors.d.ts +121 -0
  104. package/dist/common/control-api.d.ts +349 -0
  105. package/dist/common/control-api.js +884 -0
  106. package/dist/common/cron-trigger.d.ts +21 -0
  107. package/dist/common/cron-trigger.js +834 -0
  108. package/dist/common/engine-contract.d.ts +7 -0
  109. package/dist/common/favicon.svg +7 -0
  110. package/dist/common/integration-trigger.d.ts +111 -0
  111. package/dist/common/integration-trigger.js +290 -0
  112. package/dist/common/licenses.md +27 -0
  113. package/dist/common/poll-trigger.d.ts +69 -0
  114. package/dist/common/poll-trigger.js +155 -0
  115. package/dist/common/project-encoding.d.ts +11 -0
  116. package/dist/common/project-encoding.js +242 -0
  117. package/dist/common/project-notifications.d.ts +12 -0
  118. package/dist/common/project-semantics.d.ts +55 -0
  119. package/dist/common/project-semantics.js +8687 -0
  120. package/dist/common/provider-triggers.d.ts +6 -0
  121. package/dist/common/provider-triggers.js +4614 -0
  122. package/dist/common/run-events.d.ts +9 -0
  123. package/dist/common/run-events.js +192 -0
  124. package/dist/common/run-lifecycle.d.ts +69 -0
  125. package/dist/common/run-lifecycle.js +169 -0
  126. package/dist/common/runtime-contract.d.ts +53 -0
  127. package/dist/common/runtime-contract.js +151 -0
  128. package/dist/common/scheduler.d.ts +99 -0
  129. package/dist/common/scheduler.js +379 -0
  130. package/dist/common/webhook-trigger.d.ts +22 -0
  131. package/dist/common/webhook-trigger.js +270 -0
  132. package/dist/index.d.ts +66 -0
  133. package/package.json +102 -0
@@ -0,0 +1,311 @@
1
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
2
+ readonly [key: string]: JsonValue;
3
+ };
4
+ export declare const resourceNameMaxLength = 80;
5
+ export type ResourceNameIssue = 'controlCharacter' | 'empty' | 'specialCharacter' | 'tooLong';
6
+ export declare function resourceNameIssue(value: string): ResourceNameIssue | undefined;
7
+ export interface PortDefinition {
8
+ readonly description?: string;
9
+ readonly jsonSchema: JsonValue;
10
+ readonly nullable: boolean;
11
+ }
12
+ export interface InputPortDefinition extends PortDefinition {
13
+ readonly value?: JsonValue;
14
+ }
15
+ export interface NodeSource {
16
+ readonly kind: 'node';
17
+ readonly nodeId: string;
18
+ readonly output: string;
19
+ }
20
+ export interface FlowSource {
21
+ readonly input: string;
22
+ readonly kind: 'flow';
23
+ }
24
+ export interface BindingSource {
25
+ readonly bindingId: string;
26
+ readonly kind: 'binding';
27
+ }
28
+ export type InputMapping = {
29
+ readonly kind: 'sources';
30
+ readonly sources: readonly (BindingSource | FlowSource | NodeSource)[];
31
+ } | {
32
+ readonly kind: 'value';
33
+ readonly value: JsonValue;
34
+ };
35
+ export interface OutputMapping {
36
+ readonly sources: readonly (FlowSource | NodeSource)[];
37
+ }
38
+ interface GraphNodeBase {
39
+ readonly concurrency: number;
40
+ readonly description?: string;
41
+ readonly inputs: Readonly<Record<string, InputMapping>>;
42
+ readonly name?: string;
43
+ readonly timeoutMs?: number;
44
+ }
45
+ export interface SubflowNode extends GraphNodeBase {
46
+ readonly kind: 'subflow';
47
+ readonly subflowId: string;
48
+ }
49
+ export interface ValueNode extends GraphNodeBase {
50
+ readonly kind: 'value';
51
+ readonly values: Readonly<Record<string, InputPortDefinition>>;
52
+ }
53
+ export type ConditionOperator = '!=' | '<' | '<=' | '==' | '>' | '>=' | 'contains' | 'endsWith' | 'hasKey' | 'hasValue' | 'isEmpty' | 'isFalse' | 'isNotEmpty' | 'isNotNull' | 'isNull' | 'isTrue' | 'notContains' | 'notHasKey' | 'notHasValue' | 'startsWith';
54
+ export interface ConditionExpression {
55
+ readonly input: string;
56
+ readonly operator: ConditionOperator;
57
+ readonly value?: JsonValue;
58
+ }
59
+ export interface ConditionCase {
60
+ readonly expressions: readonly ConditionExpression[];
61
+ readonly output: string;
62
+ readonly relation: 'all' | 'any';
63
+ }
64
+ export interface ConditionNode extends GraphNodeBase {
65
+ readonly cases: readonly ConditionCase[];
66
+ readonly defaultOutput?: string;
67
+ readonly input: InputPortDefinition & {
68
+ readonly handle: string;
69
+ };
70
+ readonly kind: 'condition';
71
+ }
72
+ export type ManagedTaskExecutor = {
73
+ readonly kind: 'connector';
74
+ readonly action: string;
75
+ readonly connectionId?: string;
76
+ } | {
77
+ readonly kind: 'llm';
78
+ readonly mode: 'chat' | 'json';
79
+ };
80
+ export interface ConnectorCapability {
81
+ readonly action: string;
82
+ readonly connectionId: string;
83
+ readonly kind: 'connector';
84
+ }
85
+ interface TaskDefinitionBase {
86
+ readonly inputs: Readonly<Record<string, InputPortDefinition>>;
87
+ readonly name: string;
88
+ readonly outputs: Readonly<Record<string, PortDefinition>>;
89
+ }
90
+ export interface InlineTaskDefinition extends TaskDefinitionBase {
91
+ readonly capabilities?: readonly ConnectorCapability[];
92
+ readonly moduleId: string;
93
+ }
94
+ export interface ManagedTaskDefinition extends TaskDefinitionBase {
95
+ readonly executor: ManagedTaskExecutor;
96
+ }
97
+ export type TaskDefinition = InlineTaskDefinition | ManagedTaskDefinition;
98
+ export type TaskNode = GraphNodeBase & {
99
+ readonly kind: 'task';
100
+ } & ({
101
+ readonly task: InlineTaskDefinition;
102
+ readonly taskId?: never;
103
+ } | {
104
+ readonly task?: never;
105
+ readonly taskId: string;
106
+ });
107
+ export interface Graph {
108
+ readonly nodes: Readonly<Record<string, GraphNode>>;
109
+ }
110
+ export type TriggerSchedule = {
111
+ readonly expression: string;
112
+ readonly timezone: string;
113
+ readonly type: 'cron';
114
+ } | {
115
+ readonly type: 'every';
116
+ readonly unit: 'day' | 'hour' | 'minute' | 'month' | 'week';
117
+ readonly value: number;
118
+ };
119
+ interface TriggerKeySnapshotBase {
120
+ readonly configSchema: JsonValue;
121
+ readonly definitionVersion: number;
122
+ readonly description: string;
123
+ readonly displayName: string;
124
+ readonly key: string;
125
+ readonly name: string;
126
+ readonly payloadSchema: JsonValue;
127
+ readonly provider: string;
128
+ }
129
+ export type IntegrationEndpointMethod = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT';
130
+ export type IntegrationBodyFormat = 'form' | 'json' | 'multipart' | 'text';
131
+ export interface IntegrationEndpointDeclaration {
132
+ readonly body: {
133
+ readonly allowArray: boolean;
134
+ readonly allowEmpty: boolean;
135
+ readonly formats: readonly IntegrationBodyFormat[];
136
+ };
137
+ readonly methods: readonly IntegrationEndpointMethod[];
138
+ readonly successStatus: number;
139
+ }
140
+ export type TriggerKeySnapshot = (TriggerKeySnapshotBase & {
141
+ readonly type: 'poll';
142
+ }) | (TriggerKeySnapshotBase & {
143
+ readonly endpoint: IntegrationEndpointDeclaration;
144
+ readonly type: 'integration';
145
+ });
146
+ export interface WebhookInputDefinition extends InputPortDefinition {
147
+ readonly handle: string;
148
+ }
149
+ export interface WebhookOptions {
150
+ readonly allowedMethods?: readonly string[];
151
+ readonly allowedOrigins?: readonly string[];
152
+ readonly noResponseBody?: boolean;
153
+ readonly responseData?: string;
154
+ readonly responseHeaders?: Readonly<Record<string, string>>;
155
+ readonly responseStatusCode?: number;
156
+ }
157
+ interface TriggerNodeBase {
158
+ readonly description?: string;
159
+ readonly name: string;
160
+ }
161
+ export type TriggerNode = (TriggerNodeBase & {
162
+ readonly inputsDef: readonly WebhookInputDefinition[];
163
+ readonly kind: 'webhook';
164
+ readonly options?: WebhookOptions;
165
+ }) | (TriggerNodeBase & {
166
+ readonly cronTimes: readonly TriggerSchedule[];
167
+ readonly kind: 'cron';
168
+ }) | (TriggerNodeBase & {
169
+ readonly bindingId: string;
170
+ readonly config: Readonly<Record<string, JsonValue>>;
171
+ readonly definition: TriggerKeySnapshot & {
172
+ readonly type: 'poll';
173
+ };
174
+ readonly kind: 'poll';
175
+ readonly pollTimes: readonly TriggerSchedule[];
176
+ }) | (TriggerNodeBase & {
177
+ readonly bindingId: string;
178
+ readonly config: Readonly<Record<string, JsonValue>>;
179
+ readonly definition: TriggerKeySnapshot & {
180
+ readonly type: 'integration';
181
+ };
182
+ readonly kind: 'integration';
183
+ });
184
+ export type GraphNode = ConditionNode | SubflowNode | TaskNode | TriggerNode | ValueNode;
185
+ export interface ProjectDocument {
186
+ readonly bindings: Readonly<Record<string, {
187
+ readonly kind: 'connection' | 'secret';
188
+ readonly target: string;
189
+ }>>;
190
+ readonly flows: Readonly<Record<string, {
191
+ readonly graph: Graph;
192
+ readonly name: string;
193
+ }>>;
194
+ readonly subflows: Readonly<Record<string, {
195
+ readonly graph: Graph;
196
+ readonly inputs: Readonly<Record<string, InputPortDefinition>>;
197
+ readonly name: string;
198
+ readonly outputs: Readonly<Record<string, OutputMapping & PortDefinition>>;
199
+ }>>;
200
+ readonly tasks: Readonly<Record<string, ManagedTaskDefinition>>;
201
+ }
202
+ export interface CodeModule {
203
+ readonly imports: readonly string[];
204
+ readonly name: string;
205
+ readonly source: string;
206
+ }
207
+ export interface RevisionContent {
208
+ readonly document: ProjectDocument;
209
+ readonly modelVersion: 1;
210
+ readonly modules: Readonly<Record<string, CodeModule>>;
211
+ }
212
+ export type GraphTarget = {
213
+ readonly id: string;
214
+ readonly kind: 'flow';
215
+ } | {
216
+ readonly id: string;
217
+ readonly kind: 'subflow';
218
+ };
219
+ export interface GraphEdge {
220
+ readonly source: string;
221
+ readonly sourceHandle: string;
222
+ readonly target: string;
223
+ readonly targetHandle: string;
224
+ }
225
+ export type ChangeOperation = {
226
+ readonly binding: ProjectDocument['bindings'][string];
227
+ readonly bindingId: string;
228
+ readonly kind: 'binding.create';
229
+ } | {
230
+ readonly binding: ProjectDocument['bindings'][string];
231
+ readonly bindingId: string;
232
+ readonly kind: 'binding.replace';
233
+ } | {
234
+ readonly bindingId: string;
235
+ readonly kind: 'binding.delete';
236
+ } | {
237
+ readonly flow: ProjectDocument['flows'][string];
238
+ readonly flowId: string;
239
+ readonly kind: 'flow.create';
240
+ } | {
241
+ readonly flowId: string;
242
+ readonly kind: 'flow.delete';
243
+ } | {
244
+ readonly flowId: string;
245
+ readonly kind: 'flow.rename';
246
+ readonly name: string;
247
+ } | {
248
+ readonly kind: 'graph.edge.connect';
249
+ readonly edge: GraphEdge;
250
+ readonly target: GraphTarget;
251
+ } | {
252
+ readonly kind: 'graph.edge.disconnect';
253
+ readonly edge: GraphEdge;
254
+ readonly target: GraphTarget;
255
+ } | {
256
+ readonly kind: 'graph.node.create';
257
+ readonly node: GraphNode;
258
+ readonly nodeId: string;
259
+ readonly target: GraphTarget;
260
+ } | {
261
+ readonly kind: 'graph.node.delete';
262
+ readonly nodeId: string;
263
+ readonly target: GraphTarget;
264
+ } | {
265
+ readonly kind: 'graph.node.replace';
266
+ readonly node: GraphNode;
267
+ readonly nodeId: string;
268
+ readonly target: GraphTarget;
269
+ } | {
270
+ readonly kind: 'module.create';
271
+ readonly module: CodeModule;
272
+ readonly moduleId: string;
273
+ } | {
274
+ readonly kind: 'module.delete';
275
+ readonly moduleId: string;
276
+ } | {
277
+ readonly kind: 'module.rename';
278
+ readonly moduleId: string;
279
+ readonly name: string;
280
+ } | {
281
+ readonly imports: readonly string[];
282
+ readonly kind: 'module.source.replace';
283
+ readonly moduleId: string;
284
+ readonly source: string;
285
+ } | {
286
+ readonly kind: 'subflow.create';
287
+ readonly subflow: ProjectDocument['subflows'][string];
288
+ readonly subflowId: string;
289
+ } | {
290
+ readonly definition: Omit<ProjectDocument['subflows'][string], 'graph'>;
291
+ readonly kind: 'subflow.definition.replace';
292
+ readonly subflowId: string;
293
+ } | {
294
+ readonly kind: 'subflow.delete';
295
+ readonly subflowId: string;
296
+ } | {
297
+ readonly kind: 'task.create';
298
+ readonly task: ProjectDocument['tasks'][string];
299
+ readonly taskId: string;
300
+ } | {
301
+ readonly kind: 'task.delete';
302
+ readonly taskId: string;
303
+ } | {
304
+ readonly kind: 'task.replace';
305
+ readonly task: ProjectDocument['tasks'][string];
306
+ readonly taskId: string;
307
+ };
308
+ export declare class ProjectChangeError extends Error {
309
+ }
310
+ export declare function applyProjectChanges(content: RevisionContent, operations: readonly ChangeOperation[]): RevisionContent;
311
+ export {};
@@ -0,0 +1,259 @@
1
+ //#region src/project/common/change.ts
2
+ var e = 80;
3
+ function t(e) {
4
+ let t = e.trim();
5
+ if (t.length == 0) return "empty";
6
+ if (t.length > 80) return "tooLong";
7
+ for (let e of t) {
8
+ let t = e.charCodeAt(0);
9
+ if (t <= 31 || t >= 127 && t <= 159) return "controlCharacter";
10
+ }
11
+ if (!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(t)) return "specialCharacter";
12
+ }
13
+ var n = class extends Error {};
14
+ function r() {
15
+ throw new n();
16
+ }
17
+ function i(e, t) {
18
+ let n = t.kind == "flow" ? e.flows[t.id] : e.subflows[t.id];
19
+ return n ?? r(), n.graph;
20
+ }
21
+ function a(e, t, n) {
22
+ if (t.kind == "flow") {
23
+ let i = e.flows[t.id];
24
+ return i ?? r(), {
25
+ ...e,
26
+ flows: {
27
+ ...e.flows,
28
+ [t.id]: {
29
+ ...i,
30
+ graph: n
31
+ }
32
+ }
33
+ };
34
+ }
35
+ let i = e.subflows[t.id];
36
+ return i ?? r(), {
37
+ ...e,
38
+ subflows: {
39
+ ...e.subflows,
40
+ [t.id]: {
41
+ ...i,
42
+ graph: n
43
+ }
44
+ }
45
+ };
46
+ }
47
+ function o(e, t) {
48
+ if (!("inputs" in e)) return e;
49
+ let n = { ...e.inputs };
50
+ for (let [e, r] of Object.entries(n)) {
51
+ if (r.kind != "sources") continue;
52
+ let i = r.sources.filter((e) => e.kind != "node" || !t.has(e.nodeId));
53
+ i.length == 0 ? delete n[e] : n[e] = {
54
+ kind: "sources",
55
+ sources: i
56
+ };
57
+ }
58
+ return {
59
+ ...e,
60
+ inputs: n
61
+ };
62
+ }
63
+ function s(e, t) {
64
+ let n = { ...e.document }, s = { ...e.modules };
65
+ for (let e of t) switch (e.kind) {
66
+ case "binding.create":
67
+ n.bindings[e.bindingId] != null && r(), n.bindings = {
68
+ ...n.bindings,
69
+ [e.bindingId]: e.binding
70
+ };
71
+ break;
72
+ case "binding.replace":
73
+ n.bindings[e.bindingId] ?? r(), n.bindings = {
74
+ ...n.bindings,
75
+ [e.bindingId]: e.binding
76
+ };
77
+ break;
78
+ case "binding.delete": {
79
+ n.bindings[e.bindingId] ?? r();
80
+ let t = { ...n.bindings };
81
+ delete t[e.bindingId], n.bindings = t;
82
+ break;
83
+ }
84
+ case "flow.create":
85
+ n.flows[e.flowId] != null && r(), n.flows = {
86
+ ...n.flows,
87
+ [e.flowId]: e.flow
88
+ };
89
+ break;
90
+ case "flow.delete": {
91
+ n.flows[e.flowId] ?? r();
92
+ let t = { ...n.flows };
93
+ delete t[e.flowId], n.flows = t;
94
+ break;
95
+ }
96
+ case "flow.rename": {
97
+ let t = n.flows[e.flowId];
98
+ t ?? r(), n.flows = {
99
+ ...n.flows,
100
+ [e.flowId]: {
101
+ ...t,
102
+ name: e.name
103
+ }
104
+ };
105
+ break;
106
+ }
107
+ case "graph.edge.connect": {
108
+ let t = i(n, e.target);
109
+ t.nodes[e.edge.source] ?? r();
110
+ let o = t.nodes[e.edge.target];
111
+ (o == null || !("inputs" in o)) && r();
112
+ let s = o.inputs[e.edge.targetHandle], c = {
113
+ kind: "node",
114
+ nodeId: e.edge.source,
115
+ output: e.edge.sourceHandle
116
+ }, l = s?.kind == "sources" ? s.sources : [];
117
+ l.some((e) => e.kind == "node" && e.nodeId == c.nodeId && e.output == c.output) && r();
118
+ let u = {
119
+ ...o,
120
+ inputs: {
121
+ ...o.inputs,
122
+ [e.edge.targetHandle]: {
123
+ kind: "sources",
124
+ sources: [...l, c]
125
+ }
126
+ }
127
+ };
128
+ Object.assign(n, a(n, e.target, { nodes: {
129
+ ...t.nodes,
130
+ [e.edge.target]: u
131
+ } }));
132
+ break;
133
+ }
134
+ case "graph.edge.disconnect": {
135
+ let t = i(n, e.target), o = t.nodes[e.edge.target];
136
+ (o == null || !("inputs" in o)) && r();
137
+ let s = o.inputs[e.edge.targetHandle];
138
+ s?.kind != "sources" && r();
139
+ let c = s.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
140
+ c.length == s.sources.length && r();
141
+ let l = { ...o.inputs };
142
+ c.length == 0 ? delete l[e.edge.targetHandle] : l[e.edge.targetHandle] = {
143
+ kind: "sources",
144
+ sources: c
145
+ }, Object.assign(n, a(n, e.target, { nodes: {
146
+ ...t.nodes,
147
+ [e.edge.target]: {
148
+ ...o,
149
+ inputs: l
150
+ }
151
+ } }));
152
+ break;
153
+ }
154
+ case "graph.node.create": {
155
+ let t = i(n, e.target);
156
+ (t.nodes[e.nodeId] != null || e.target.kind == "subflow" && !("inputs" in e.node)) && r(), Object.assign(n, a(n, e.target, { nodes: {
157
+ ...t.nodes,
158
+ [e.nodeId]: e.node
159
+ } }));
160
+ break;
161
+ }
162
+ case "graph.node.delete": {
163
+ let t = i(n, e.target);
164
+ t.nodes[e.nodeId] ?? r();
165
+ let s = /* @__PURE__ */ new Set([e.nodeId]), c = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => s.has(e) ? [] : [[e, o(t, s)]]));
166
+ if (Object.assign(n, a(n, e.target, { nodes: c })), e.target.kind == "subflow") {
167
+ let t = n.subflows[e.target.id], r = Object.fromEntries(Object.entries(t.outputs).map(([e, t]) => [e, {
168
+ ...t,
169
+ sources: t.sources.filter((e) => e.kind != "node" || !s.has(e.nodeId))
170
+ }]));
171
+ n.subflows = {
172
+ ...n.subflows,
173
+ [e.target.id]: {
174
+ ...t,
175
+ outputs: r
176
+ }
177
+ };
178
+ }
179
+ break;
180
+ }
181
+ case "graph.node.replace": {
182
+ let t = i(n, e.target);
183
+ (t.nodes[e.nodeId] == null || e.target.kind == "subflow" && !("inputs" in e.node)) && r(), Object.assign(n, a(n, e.target, { nodes: {
184
+ ...t.nodes,
185
+ [e.nodeId]: e.node
186
+ } }));
187
+ break;
188
+ }
189
+ case "module.create":
190
+ s[e.moduleId] != null && r(), s[e.moduleId] = e.module;
191
+ break;
192
+ case "module.delete":
193
+ s[e.moduleId] ?? r(), delete s[e.moduleId];
194
+ break;
195
+ case "module.rename": {
196
+ let t = s[e.moduleId];
197
+ t ?? r(), s[e.moduleId] = {
198
+ ...t,
199
+ name: e.name
200
+ };
201
+ break;
202
+ }
203
+ case "module.source.replace": {
204
+ let t = s[e.moduleId];
205
+ t ?? r(), s[e.moduleId] = {
206
+ ...t,
207
+ imports: e.imports,
208
+ source: e.source
209
+ };
210
+ break;
211
+ }
212
+ case "subflow.create":
213
+ n.subflows[e.subflowId] != null && r(), n.subflows = {
214
+ ...n.subflows,
215
+ [e.subflowId]: e.subflow
216
+ };
217
+ break;
218
+ case "subflow.definition.replace": {
219
+ let t = n.subflows[e.subflowId];
220
+ t ?? r(), n.subflows = {
221
+ ...n.subflows,
222
+ [e.subflowId]: {
223
+ ...e.definition,
224
+ graph: t.graph
225
+ }
226
+ };
227
+ break;
228
+ }
229
+ case "subflow.delete": {
230
+ n.subflows[e.subflowId] ?? r();
231
+ let t = { ...n.subflows };
232
+ delete t[e.subflowId], n.subflows = t;
233
+ break;
234
+ }
235
+ case "task.create":
236
+ n.tasks[e.taskId] != null && r(), n.tasks = {
237
+ ...n.tasks,
238
+ [e.taskId]: e.task
239
+ };
240
+ break;
241
+ case "task.delete": {
242
+ n.tasks[e.taskId] ?? r();
243
+ let t = { ...n.tasks };
244
+ delete t[e.taskId], n.tasks = t;
245
+ break;
246
+ }
247
+ case "task.replace": n.tasks[e.taskId] ?? r(), n.tasks = {
248
+ ...n.tasks,
249
+ [e.taskId]: e.task
250
+ };
251
+ }
252
+ return {
253
+ document: n,
254
+ modelVersion: e.modelVersion,
255
+ modules: s
256
+ };
257
+ }
258
+ //#endregion
259
+ export { n as ProjectChangeError, s as applyProjectChanges, t as resourceNameIssue, e as resourceNameMaxLength };
@@ -0,0 +1,12 @@
1
+ export type ProjectChangeEvent = {
2
+ readonly kind: 'draft.changed';
3
+ readonly projectId: string;
4
+ readonly revisionId: string;
5
+ readonly version: 1;
6
+ } | {
7
+ readonly flowId: string;
8
+ readonly kind: 'run.created';
9
+ readonly projectId: string;
10
+ readonly runId: string;
11
+ readonly version: 1;
12
+ };
@@ -0,0 +1,30 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t, n) => () => {
3
+ if (n) throw n[0];
4
+ try {
5
+ return e && (t = e(e = 0)), t;
6
+ } catch (e) {
7
+ throw n = [e], e;
8
+ }
9
+ }, s = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), c = (e, n) => {
10
+ let r = {};
11
+ for (var i in e) t(r, i, {
12
+ get: e[i],
13
+ enumerable: !0
14
+ });
15
+ return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
16
+ }, l = (e, i, o, s) => {
17
+ if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
18
+ get: ((e) => i[e]).bind(null, d),
19
+ enumerable: !(s = n(i, d)) || s.enumerable
20
+ });
21
+ return e;
22
+ }, u = (n, r, o) => (o = n == null ? {} : e(i(n)), l(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
23
+ value: n,
24
+ enumerable: !0
25
+ }) : o, n)), d = (e) => a.call(e, "module.exports") ? e["module.exports"] : l(t({}, "__esModule", { value: !0 }), e), f = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
26
+ if (typeof require < "u") return require.apply(this, arguments);
27
+ throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
28
+ });
29
+ //#endregion
30
+ export { d as a, f as i, o as n, u as o, c as r, s as t };
@@ -0,0 +1,28 @@
1
+ import type { ProjectChangeEvent } from './project-notifications.js';
2
+ export type { ProjectChangeEvent } from './project-notifications.js';
3
+ export type WorkbenchLanguage = 'en' | 'zh-CN';
4
+ export type WorkbenchTheme = 'dark' | 'light';
5
+ export type WorkbenchView = 'design' | 'publications' | 'runs';
6
+ export interface WorkbenchNotification {
7
+ readonly kind: 'error' | 'success';
8
+ readonly message: string;
9
+ }
10
+ export interface WorkbenchHost {
11
+ readonly returnUrl: string;
12
+ notify(notification: WorkbenchNotification | undefined): void;
13
+ openExternalPage(resolveUrl: () => Promise<string>): Promise<boolean>;
14
+ request(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
15
+ subscribeProject(projectId: string, listener: (event?: ProjectChangeEvent) => void): () => void;
16
+ }
17
+ export interface WorkbenchLocation {
18
+ readonly flowId?: string;
19
+ readonly projectId?: string;
20
+ readonly view: WorkbenchView;
21
+ }
22
+ export interface WorkbenchNavigationOptions {
23
+ readonly replace: boolean;
24
+ }
25
+ export interface WorkbenchPreferences {
26
+ getItem(key: string): string | null;
27
+ setItem(key: string, value: string): void;
28
+ }