@oomol-lab/open-flow 0.1.0-alpha.4 → 0.1.0-alpha.6

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 (62) hide show
  1. package/dist/browser/{addNodeOptions-CGyTkP99.js → addNodeOptions-C4wix0_u.js} +1008 -1428
  2. package/dist/browser/carbon-DMCVsjHo.js +53 -0
  3. package/dist/browser/{createLucideIcon-MmUpJrIU.js → createLucideIcon-ggJB9CTC.js} +86 -117
  4. package/dist/browser/{createResourceDialog-CIVfStiE.js → createResourceDialog-CESUCxOM.js} +12 -12
  5. package/dist/browser/{dist-BbyiRq3c.js → dist-B0Q2Mn0n.js} +117 -107
  6. package/dist/browser/{dist-B9OV3YTx.js → dist-Bc9TvHYl.js} +7 -7
  7. package/dist/browser/{dist-0lWKriL5.js → dist-C46JByB-.js} +1 -1
  8. package/dist/browser/{dist-CvcmLAMW.js → dist-CUkceEvN.js} +4 -4
  9. package/dist/browser/{dist-zyY--HOV.js → dist-CVtP-E2c.js} +2 -2
  10. package/dist/browser/{dist-CLZJNoWB.js → dist-D5mdziGP.js} +4 -4
  11. package/dist/browser/{dist-7oZK9QXZ.js → dist-DMi8_lU3.js} +5 -5
  12. package/dist/browser/{dist-DL0SDskM.js → dist-DQVavPcf.js} +9 -8
  13. package/dist/browser/{dist-aWSZx4q1.js → dist-DWzdGVm9.js} +2 -2
  14. package/dist/browser/{dist-Djd02JSy.js → dist-DXgEYMFx.js} +4 -4
  15. package/dist/browser/{dist-o4dBuwiG.js → dist-DhsGR_K3.js} +4 -4
  16. package/dist/browser/{dist-BLk5M0uK.js → dist-Mecbzdl2.js} +3 -3
  17. package/dist/browser/{dist-CIq6ue3I.js → dist-n9WmBm5w.js} +1115 -1103
  18. package/dist/browser/{esm-DXw7EADW.js → esm-CoE5_2w7.js} +5 -5
  19. package/dist/browser/{field-runIpvMd.js → field-CIrv7Rez.js} +6 -6
  20. package/dist/browser/{project-authoring-edge.d.ts → flow-authoring-edge.d.ts} +1 -1
  21. package/dist/browser/{project-authoring-module.d.ts → flow-authoring-module.d.ts} +1 -1
  22. package/dist/browser/{project-authoring-node.d.ts → flow-authoring-node.d.ts} +6 -12
  23. package/dist/browser/flow-authoring.d.ts +3 -0
  24. package/dist/browser/{project-authoring.js → flow-authoring.js} +44 -69
  25. package/dist/browser/{project-change.d.ts → flow-change.d.ts} +11 -26
  26. package/dist/browser/{project-change.js → flow-change.js} +8 -39
  27. package/dist/browser/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
  28. package/dist/browser/{flowRunInputEditorStore-B49C0ZmK.js → flowRunInputEditorStore-DXOyyY7o.js} +850 -675
  29. package/dist/browser/{flowWorkspace-CGsEHe2F.js → flowWorkspace-Bo0bz1Uz.js} +7040 -6875
  30. package/dist/browser/{lib-S4ccuMeT.js → lib-GrGxYjsJ.js} +3 -5
  31. package/dist/browser/licenses.md +11 -11
  32. package/dist/browser/{markdownContent-BvYiwIwR.js → markdownContent-ColGUxHy.js} +4046 -4018
  33. package/dist/browser/workbench-contract.d.ts +4 -4
  34. package/dist/browser/workbench.css +1 -1
  35. package/dist/browser/workbench.d.ts +1 -1
  36. package/dist/browser/workbench.js +898 -1053
  37. package/dist/common/connector-action.js +1 -1
  38. package/dist/common/control-api-conformance.js +137 -361
  39. package/dist/common/control-api-errors.d.ts +16 -24
  40. package/dist/common/control-api.d.ts +38 -67
  41. package/dist/common/control-api.js +135 -188
  42. package/dist/common/cron-trigger.d.ts +1 -1
  43. package/dist/common/cron-trigger.js +1 -1
  44. package/dist/common/{project-encoding.d.ts → flow-encoding.d.ts} +3 -3
  45. package/dist/common/{project-encoding.js → flow-encoding.js} +3 -6
  46. package/dist/common/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
  47. package/dist/common/{project-semantics.d.ts → flow-semantics.d.ts} +9 -12
  48. package/dist/common/{project-semantics.js → flow-semantics.js} +103 -115
  49. package/dist/common/integration-trigger.d.ts +1 -1
  50. package/dist/common/integration-trigger.js +1 -1
  51. package/dist/common/poll-trigger.d.ts +1 -1
  52. package/dist/common/run-lifecycle.js +1 -1
  53. package/dist/common/runtime-contract.d.ts +1 -1
  54. package/dist/common/runtime-contract.js +1 -1
  55. package/dist/common/scheduler.d.ts +3 -2
  56. package/dist/common/scheduler.js +4 -4
  57. package/dist/common/webhook-trigger.d.ts +1 -1
  58. package/dist/common/webhook-trigger.js +2 -2
  59. package/package.json +13 -13
  60. package/dist/browser/carbon-nMY84Amv.js +0 -53
  61. package/dist/browser/project-authoring-flow.d.ts +0 -4
  62. package/dist/browser/project-authoring.d.ts +0 -4
@@ -1,11 +1,11 @@
1
- import type { CodeModule, Graph, InputPortDefinition, JsonValue, OutputMapping, PortDefinition, ProjectDocument, RevisionContent } from '@oomol-lab/open-flow/project-change';
1
+ import type { CodeModule, FlowDocument, Graph, InputPortDefinition, JsonValue, OutputMapping, PortDefinition, RevisionContent } from '@oomol-lab/open-flow/flow-change';
2
2
  export declare const maxJsonDepth = 64;
3
3
  export declare function canonicalJsonBytes(value: JsonValue): Uint8Array;
4
4
  export declare function digestBytes(bytes: Uint8Array): Promise<string>;
5
5
  export declare function canonicalPorts(value: Readonly<Record<string, InputPortDefinition | PortDefinition>>): JsonValue;
6
6
  export declare function canonicalOutputs(value: Readonly<Record<string, OutputMapping & PortDefinition>>): JsonValue;
7
7
  export declare function canonicalGraph(value: Graph): JsonValue;
8
- export declare function canonicalTask(task: ProjectDocument['tasks'][string]): JsonValue;
9
- export declare function canonicalDocument(document: ProjectDocument): JsonValue;
8
+ export declare function canonicalTask(task: FlowDocument['tasks'][string]): JsonValue;
9
+ export declare function canonicalDocument(document: FlowDocument): JsonValue;
10
10
  export declare function canonicalModule(module: CodeModule): JsonValue;
11
11
  export declare function encodeRevision(content: RevisionContent): Uint8Array;
@@ -1,4 +1,4 @@
1
- //#region src/project/common/encoding.ts
1
+ //#region src/flow/common/encoding.ts
2
2
  var e = new TextEncoder(), t = 64;
3
3
  function n(e) {
4
4
  if (e == null || typeof e == "boolean" || typeof e == "string" || typeof e == "number") return JSON.stringify(e);
@@ -206,10 +206,7 @@ function v(e) {
206
206
  function y(e) {
207
207
  return {
208
208
  bindings: Object.fromEntries(a(e.bindings)),
209
- flows: Object.fromEntries(a(e.flows).map(([e, t]) => [e, {
210
- graph: f(t.graph),
211
- name: t.name
212
- }])),
209
+ graph: f(e.graph),
213
210
  subflows: Object.fromEntries(a(e.subflows).map(([e, t]) => [e, {
214
211
  graph: f(t.graph),
215
212
  inputs: s(t.inputs),
@@ -229,7 +226,7 @@ function b(e) {
229
226
  function x(e) {
230
227
  return {
231
228
  document: y(e.document),
232
- kind: "open-flow-project-revision",
229
+ kind: "open-flow-flow-revision",
233
230
  modelVersion: e.modelVersion,
234
231
  modules: Object.fromEntries(a(e.modules).map(([e, t]) => [e, b(t)])),
235
232
  version: 1
@@ -1,12 +1,15 @@
1
- export type ProjectChangeEvent = {
1
+ export interface FlowCatalogEvent {
2
+ readonly kind: 'flows.changed';
3
+ readonly version: 1;
4
+ }
5
+ export type FlowChangeEvent = {
2
6
  readonly kind: 'draft.changed';
3
- readonly projectId: string;
7
+ readonly flowId: string;
4
8
  readonly revisionId: string;
5
9
  readonly version: 1;
6
10
  } | {
7
11
  readonly flowId: string;
8
12
  readonly kind: 'run.created';
9
- readonly projectId: string;
10
13
  readonly runId: string;
11
14
  readonly version: 1;
12
15
  };
@@ -1,4 +1,4 @@
1
- import type { JsonValue, ProjectDocument, RevisionContent, TriggerNode } from '@oomol-lab/open-flow/project-change';
1
+ import type { FlowDocument, Graph, JsonValue, RevisionContent, TriggerNode } from '@oomol-lab/open-flow/flow-change';
2
2
  import type { EngineContract } from './engine-contract.js';
3
3
  import type { RuntimeProgram } from './runtime-contract.js';
4
4
  export interface SemanticClosure {
@@ -11,7 +11,7 @@ export interface SemanticClosure {
11
11
  };
12
12
  readonly digest: string;
13
13
  }
14
- export declare function flowClosure(content: RevisionContent, flowId: string): Promise<SemanticClosure | undefined>;
14
+ export declare function flowClosure(content: RevisionContent): Promise<SemanticClosure>;
15
15
  export interface Diagnostic {
16
16
  readonly code: string;
17
17
  readonly column: number;
@@ -26,30 +26,27 @@ export interface FlowValidation {
26
26
  }
27
27
  export declare function triggerPayloadSchema(trigger: TriggerNode): JsonValue;
28
28
  export declare function matchesSchema(value: JsonValue, schema: JsonValue): boolean;
29
- export type FlowInputsValidation = 'flow-not-found' | 'invalid' | 'valid';
30
- export declare function validateFlowInputs(revision: RevisionContent, flowId: string, value: unknown): FlowInputsValidation;
29
+ export type FlowInputsValidation = 'invalid' | 'valid';
30
+ export declare function validateFlowInputs(revision: RevisionContent, value: unknown): FlowInputsValidation;
31
31
  export declare function validateModules(revision: RevisionContent, moduleIds: readonly string[], engine: EngineContract): readonly Diagnostic[];
32
- export declare function validateFlow(revision: RevisionContent, flowId: string, engine: EngineContract): Promise<FlowValidation | undefined>;
32
+ export declare function validateFlow(revision: RevisionContent, engine: EngineContract): Promise<FlowValidation>;
33
33
  export interface PreparedFlow {
34
34
  readonly closureDigest: string;
35
35
  readonly engineContract: string;
36
- readonly flow: ProjectDocument['flows'][string];
37
- readonly flowId: string;
36
+ readonly graph: Graph;
38
37
  readonly modules: RevisionContent['modules'];
39
- readonly subflows: ProjectDocument['subflows'];
40
- readonly tasks: ProjectDocument['tasks'];
38
+ readonly subflows: FlowDocument['subflows'];
39
+ readonly tasks: FlowDocument['tasks'];
41
40
  }
42
41
  export type PrepareFlowResult = {
43
42
  readonly kind: 'engine-unsupported';
44
43
  } | {
45
44
  readonly kind: 'flow-invalid';
46
45
  readonly validation: FlowValidation;
47
- } | {
48
- readonly kind: 'flow-not-found';
49
46
  } | {
50
47
  readonly flow: PreparedFlow;
51
48
  readonly kind: 'prepared';
52
49
  readonly validation: FlowValidation;
53
50
  };
54
- export declare function prepareFlow(revision: RevisionContent, flowId: string, engineContract: string): Promise<PrepareFlowResult>;
51
+ export declare function prepareFlow(revision: RevisionContent, engineContract: string): Promise<PrepareFlowResult>;
55
52
  export declare function createRuntimeProgram(prepared: PreparedFlow, entryModuleId: string, engineDigest: string): RuntimeProgram | undefined;
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/@babel/parser/lib/index.js
1
+ //#region ../../node_modules/.bun/@babel+parser@8.0.4/node_modules/@babel/parser/lib/index.js
2
2
  var e = class {
3
3
  constructor(e, t, n) {
4
4
  this.line = void 0, this.column = void 0, n !== void 0 && (this.index = void 0), this.line = e, this.column = t, n !== void 0 && (this.index = n);
@@ -1348,8 +1348,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
1348
1348
  } finally {
1349
1349
  this.state.context = t;
1350
1350
  }
1351
- }
1352
- return e();
1351
+ } else return e();
1353
1352
  }
1354
1353
  flowParseTypeParameterInstantiationInExpression() {
1355
1354
  if (this.reScan_lt() === 43) return this.flowParseTypeParameterInstantiation();
@@ -6695,8 +6694,7 @@ var ln = (e) => class extends e {
6695
6694
  } finally {
6696
6695
  this.state.context = t;
6697
6696
  }
6698
- }
6699
- return e();
6697
+ } else return e();
6700
6698
  }
6701
6699
  tsInType(e) {
6702
6700
  let t = this.state.inType;
@@ -7864,7 +7862,7 @@ function An(e) {
7864
7862
  return e == "open-flow-engine/v1" ? kn : void 0;
7865
7863
  }
7866
7864
  //#endregion
7867
- //#region src/project/common/encoding.ts
7865
+ //#region src/flow/common/encoding.ts
7868
7866
  var jn = new TextEncoder();
7869
7867
  function Mn(e) {
7870
7868
  if (e == null || typeof e == "boolean" || typeof e == "string" || typeof e == "number") return JSON.stringify(e);
@@ -8077,59 +8075,53 @@ function Jn(e) {
8077
8075
  };
8078
8076
  }
8079
8077
  //#endregion
8080
- //#region src/project/common/semantics.ts
8078
+ //#region src/flow/common/semantics.ts
8081
8079
  function Yn(e) {
8082
8080
  return Object.keys(e).toSorted().map((t) => [t, e[t]]);
8083
8081
  }
8084
- async function Xn(e, t) {
8085
- let n = e.document.flows[t];
8086
- if (n == null) return;
8087
- let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
8088
- function c(e) {
8089
- r.add(e);
8082
+ async function Xn(e) {
8083
+ let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
8084
+ function o(e) {
8085
+ t.add(e);
8090
8086
  }
8091
- function l(t) {
8092
- if (a.has(t)) return;
8093
- a.add(t);
8087
+ function s(t) {
8088
+ if (r.has(t)) return;
8089
+ r.add(t);
8094
8090
  let n = e.modules[t];
8095
- if (n != null) for (let e of n.imports.toSorted()) l(e);
8091
+ if (n != null) for (let e of n.imports.toSorted()) s(e);
8096
8092
  }
8097
- function u(e) {
8098
- for (let t of Object.values(e)) if (t.kind == "sources") for (let e of t.sources) e.kind == "binding" && (i.add(e.bindingId), c(e.bindingId));
8093
+ function c(e) {
8094
+ for (let t of Object.values(e)) if (t.kind == "sources") for (let e of t.sources) e.kind == "binding" && (n.add(e.bindingId), o(e.bindingId));
8099
8095
  }
8100
- function d(e) {
8101
- for (let [, t] of Yn(e.nodes)) switch ("inputs" in t && u(t.inputs), t.kind) {
8096
+ function l(e) {
8097
+ for (let [, t] of Yn(e.nodes)) switch ("inputs" in t && c(t.inputs), t.kind) {
8102
8098
  case "condition": break;
8103
8099
  case "subflow":
8104
- f(t.subflowId);
8100
+ u(t.subflowId);
8105
8101
  break;
8106
8102
  case "task":
8107
- t.task == null ? s.add(t.taskId) : l(t.task.moduleId);
8103
+ t.task == null ? a.add(t.taskId) : s(t.task.moduleId);
8108
8104
  break;
8109
8105
  case "value": break;
8110
8106
  case "poll":
8111
- case "integration": c(t.bindingId);
8107
+ case "integration": o(t.bindingId);
8112
8108
  }
8113
8109
  }
8114
- function f(t) {
8115
- if (o.has(t)) return;
8116
- o.add(t);
8110
+ function u(t) {
8111
+ if (i.has(t)) return;
8112
+ i.add(t);
8117
8113
  let n = e.document.subflows[t];
8118
- n != null && d(n.graph);
8114
+ n != null && l(n.graph);
8119
8115
  }
8120
- d(n.graph);
8121
- let p = Nn({
8122
- bindings: Object.fromEntries([...r].toSorted().map((t) => [t, e.document.bindings[t] ?? null])),
8123
- flow: {
8124
- graph: Vn(n.graph),
8125
- id: t,
8126
- name: n.name
8127
- },
8116
+ l(e.document.graph);
8117
+ let d = Nn({
8118
+ bindings: Object.fromEntries([...t].toSorted().map((t) => [t, e.document.bindings[t] ?? null])),
8119
+ graph: Vn(e.document.graph),
8128
8120
  kind: "open-flow-semantic-closure",
8129
8121
  modelVersion: e.modelVersion,
8130
- modules: Object.fromEntries([...a].toSorted().map((t) => [t, e.modules[t] == null ? null : Jn(e.modules[t])])),
8131
- tasks: Object.fromEntries([...s].toSorted().map((t) => [t, e.document.tasks[t] == null ? null : Hn(e.document.tasks[t])])),
8132
- subflows: Object.fromEntries([...o].toSorted().map((t) => {
8122
+ modules: Object.fromEntries([...r].toSorted().map((t) => [t, e.modules[t] == null ? null : Jn(e.modules[t])])),
8123
+ tasks: Object.fromEntries([...a].toSorted().map((t) => [t, e.document.tasks[t] == null ? null : Hn(e.document.tasks[t])])),
8124
+ subflows: Object.fromEntries([...i].toSorted().map((t) => {
8133
8125
  let n = e.document.subflows[t];
8134
8126
  return n == null ? [t, null] : [t, {
8135
8127
  graph: Vn(n.graph),
@@ -8142,13 +8134,13 @@ async function Xn(e, t) {
8142
8134
  });
8143
8135
  return {
8144
8136
  dependencies: {
8145
- bindings: r,
8146
- inputBindings: i,
8147
- modules: a,
8148
- subflows: o,
8149
- tasks: s
8137
+ bindings: t,
8138
+ inputBindings: n,
8139
+ modules: r,
8140
+ subflows: i,
8141
+ tasks: a
8150
8142
  },
8151
- digest: await Pn(p)
8143
+ digest: await Pn(d)
8152
8144
  };
8153
8145
  }
8154
8146
  function Zn(e) {
@@ -8475,44 +8467,43 @@ function dr(e, t, n, r, i, a) {
8475
8467
  }
8476
8468
  ur(e, i, a);
8477
8469
  }
8478
- function fr(e, t, n) {
8479
- let r = /* @__PURE__ */ new Set(), i = [];
8480
- function a(t, o) {
8481
- for (let [s, c] of Object.entries(t.nodes)) {
8470
+ function fr(e, t) {
8471
+ let n = /* @__PURE__ */ new Set(), r = [];
8472
+ function i(a, o) {
8473
+ for (let [s, c] of Object.entries(a.nodes)) {
8482
8474
  if (c.kind != "subflow" || e.subflows[c.subflowId] == null) continue;
8483
- let t = i.indexOf(c.subflowId);
8484
- if (t >= 0) {
8485
- n.push(Y("subflow.cycle", `Subflow cycle is not executable: ${[...i.slice(t), c.subflowId].join(" -> ")}.`, `${o}/nodes/${s}/subflowId`));
8475
+ let a = r.indexOf(c.subflowId);
8476
+ if (a >= 0) {
8477
+ t.push(Y("subflow.cycle", `Subflow cycle is not executable: ${[...r.slice(a), c.subflowId].join(" -> ")}.`, `${o}/nodes/${s}/subflowId`));
8486
8478
  continue;
8487
8479
  }
8488
- r.has(c.subflowId) || (r.add(c.subflowId), i.push(c.subflowId), a(e.subflows[c.subflowId].graph, `/document/subflows/${c.subflowId}/graph`), i.pop());
8480
+ n.has(c.subflowId) || (n.add(c.subflowId), r.push(c.subflowId), i(e.subflows[c.subflowId].graph, `/document/subflows/${c.subflowId}/graph`), r.pop());
8489
8481
  }
8490
8482
  }
8491
- a(e.flows[t].graph, `/document/flows/${t}/graph`);
8483
+ i(e.graph, "/document/graph");
8492
8484
  }
8493
- function pr(e, t, n) {
8494
- let r = [], i = e.document.flows[t];
8495
- dr(i.graph, e.document, void 0, !0, `/document/flows/${t}/graph`, r);
8496
- for (let t of [...n.dependencies.subflows].toSorted()) {
8497
- let n = e.document.subflows[t];
8498
- if (n == null) continue;
8499
- let i = `/document/subflows/${t}`, a = new Set(Object.keys(n.inputs));
8500
- dr(n.graph, e.document, a, !1, `${i}/graph`, r);
8501
- for (let [t, o] of Object.entries(n.outputs)) for (let s of o.sources) cr(s, n.graph, e.document, a, void 0, `${i}/outputs/${t}/sources`, r);
8502
- }
8503
- return fr(e.document, t, r), r;
8504
- }
8505
- function mr(e, t, n) {
8506
- if (typeof n != "object" || !n || Array.isArray(n)) return "invalid";
8507
- let r = e.document.flows[t]?.graph;
8508
- if (r == null) return "flow-not-found";
8509
- for (let [t, i] of Object.entries(n)) {
8510
- let n = r.nodes[t];
8511
- if (n == null || !("inputs" in n) || typeof i != "object" || !i || Array.isArray(i)) return "invalid";
8512
- let a = or(e.document, n);
8485
+ function pr(e, t) {
8486
+ let n = [];
8487
+ dr(e.document.graph, e.document, void 0, !0, "/document/graph", n);
8488
+ for (let r of [...t.dependencies.subflows].toSorted()) {
8489
+ let t = e.document.subflows[r];
8490
+ if (t == null) continue;
8491
+ let i = `/document/subflows/${r}`, a = new Set(Object.keys(t.inputs));
8492
+ dr(t.graph, e.document, a, !1, `${i}/graph`, n);
8493
+ for (let [r, o] of Object.entries(t.outputs)) for (let s of o.sources) cr(s, t.graph, e.document, a, void 0, `${i}/outputs/${r}/sources`, n);
8494
+ }
8495
+ return fr(e.document, n), n;
8496
+ }
8497
+ function mr(e, t) {
8498
+ if (typeof t != "object" || !t || Array.isArray(t)) return "invalid";
8499
+ let n = e.document.graph;
8500
+ for (let [r, i] of Object.entries(t)) {
8501
+ let t = n.nodes[r];
8502
+ if (t == null || !("inputs" in t) || typeof i != "object" || !i || Array.isArray(i)) return "invalid";
8503
+ let a = or(e.document, t);
8513
8504
  for (let e of Object.keys(i)) {
8514
- let t = a[e];
8515
- if (t == null || n.inputs[e] != null || Object.hasOwn(t, "value")) return "invalid";
8505
+ let n = a[e];
8506
+ if (n == null || t.inputs[e] != null || Object.hasOwn(n, "value")) return "invalid";
8516
8507
  }
8517
8508
  }
8518
8509
  return "valid";
@@ -8598,45 +8589,44 @@ function hr(e, t, n) {
8598
8589
  function gr(e, t, n) {
8599
8590
  return hr(e, t, n).diagnostics.toSorted(nr);
8600
8591
  }
8601
- async function _r(e, t, n) {
8602
- if (e.document.flows[t] == null) return;
8603
- let r = await Xn(e, t), i = hr(e, [...r.dependencies.modules], n);
8604
- i.diagnostics.push(...pr(e, t, r));
8605
- let a = [[`/document/flows/${t}/graph`, e.document.flows[t].graph], ...[...r.dependencies.subflows].toSorted().flatMap((t) => {
8592
+ async function _r(e, t) {
8593
+ let n = await Xn(e), r = hr(e, [...n.dependencies.modules], t);
8594
+ r.diagnostics.push(...pr(e, n));
8595
+ let i = [["/document/graph", e.document.graph], ...[...n.dependencies.subflows].toSorted().flatMap((t) => {
8606
8596
  let n = e.document.subflows[t];
8607
8597
  return n == null ? [] : [[`/document/subflows/${t}/graph`, n.graph]];
8608
- })], o = /* @__PURE__ */ new Set();
8609
- for (let [t, n] of a) for (let [r, a] of Object.entries(n.nodes)) if (a.kind == "task" && a.task != null) {
8610
- e.modules[a.task.moduleId] == null ? i.diagnostics.push({
8598
+ })], a = /* @__PURE__ */ new Set();
8599
+ for (let [t, n] of i) for (let [i, o] of Object.entries(n.nodes)) if (o.kind == "task" && o.task != null) {
8600
+ e.modules[o.task.moduleId] == null ? r.diagnostics.push({
8611
8601
  code: "task.module-missing",
8612
8602
  column: 0,
8613
8603
  line: 1,
8614
- message: `Inline Task "${r}" references missing CodeModule "${a.task.moduleId}".`,
8615
- path: `${t}/nodes/${r}/task/moduleId`
8616
- }) : !i.analysis.get(a.task.moduleId)?.exports.has("default") && !o.has(a.task.moduleId) && (o.add(a.task.moduleId), i.diagnostics.push({
8604
+ message: `Inline Task "${i}" references missing CodeModule "${o.task.moduleId}".`,
8605
+ path: `${t}/nodes/${i}/task/moduleId`
8606
+ }) : !r.analysis.get(o.task.moduleId)?.exports.has("default") && !a.has(o.task.moduleId) && (a.add(o.task.moduleId), r.diagnostics.push({
8617
8607
  code: "task.missing-entry",
8618
8608
  column: 0,
8619
8609
  line: 1,
8620
- message: `CodeModule "${a.task.moduleId}" used by an Inline Task must export a default function.`,
8621
- path: `/modules/${a.task.moduleId}/source`
8610
+ message: `CodeModule "${o.task.moduleId}" used by an Inline Task must export a default function.`,
8611
+ path: `/modules/${o.task.moduleId}/source`
8622
8612
  }));
8623
- for (let [e, n] of (a.task.capabilities ?? []).entries()) n.action.length > 0 && n.connectionId.length > 0 || i.diagnostics.push({
8613
+ for (let [e, n] of (o.task.capabilities ?? []).entries()) n.action.length > 0 && n.connectionId.length > 0 || r.diagnostics.push({
8624
8614
  code: "task.capability-incomplete",
8625
8615
  column: 0,
8626
8616
  line: 1,
8627
- message: `Inline Task "${r}" has an incomplete Connector Capability.`,
8628
- path: `${t}/nodes/${r}/task/capabilities/${e}`
8617
+ message: `Inline Task "${i}" has an incomplete Connector Capability.`,
8618
+ path: `${t}/nodes/${i}/task/capabilities/${e}`
8629
8619
  });
8630
8620
  }
8631
- for (let t of [...r.dependencies.tasks].toSorted()) {
8621
+ for (let t of [...n.dependencies.tasks].toSorted()) {
8632
8622
  let n = e.document.tasks[t];
8633
- n != null && (n.executor.kind == "connector" && n.executor.action.length == 0 && i.diagnostics.push({
8623
+ n != null && (n.executor.kind == "connector" && n.executor.action.length == 0 && r.diagnostics.push({
8634
8624
  code: "task.connector-incomplete",
8635
8625
  column: 0,
8636
8626
  line: 1,
8637
8627
  message: `Connector Task "${t}" requires an action.`,
8638
8628
  path: `/document/tasks/${t}/executor`
8639
- }), n.executor.kind == "connector" && n.executor.connectionId == null && i.diagnostics.push({
8629
+ }), n.executor.kind == "connector" && n.executor.connectionId == null && r.diagnostics.push({
8640
8630
  code: "task.connector-connection-required",
8641
8631
  column: 0,
8642
8632
  line: 1,
@@ -8644,35 +8634,33 @@ async function _r(e, t, n) {
8644
8634
  path: `/document/tasks/${t}/executor/connectionId`
8645
8635
  }));
8646
8636
  }
8647
- let s = i.diagnostics.toSorted(nr);
8637
+ let o = r.diagnostics.toSorted(nr);
8648
8638
  return {
8649
- closure: r,
8650
- diagnostics: s,
8651
- valid: s.length == 0
8639
+ closure: n,
8640
+ diagnostics: o,
8641
+ valid: o.length == 0
8652
8642
  };
8653
8643
  }
8654
- async function vr(e, t, n) {
8655
- let r = An(n);
8656
- if (r == null) return { kind: "engine-unsupported" };
8657
- let i = await _r(e, t, r);
8658
- if (i == null) return { kind: "flow-not-found" };
8659
- if (!i.valid) return {
8644
+ async function vr(e, t) {
8645
+ let n = An(t);
8646
+ if (n == null) return { kind: "engine-unsupported" };
8647
+ let r = await _r(e, n);
8648
+ if (!r.valid) return {
8660
8649
  kind: "flow-invalid",
8661
- validation: i
8650
+ validation: r
8662
8651
  };
8663
- let { closure: a } = i;
8652
+ let { closure: i } = r;
8664
8653
  return {
8665
8654
  flow: {
8666
- closureDigest: a.digest,
8667
- engineContract: n,
8668
- flow: e.document.flows[t],
8669
- flowId: t,
8670
- modules: Object.fromEntries([...a.dependencies.modules].toSorted().map((t) => [t, e.modules[t]])),
8671
- subflows: Object.fromEntries([...a.dependencies.subflows].toSorted().map((t) => [t, e.document.subflows[t]])),
8672
- tasks: Object.fromEntries([...a.dependencies.tasks].toSorted().map((t) => [t, e.document.tasks[t]]))
8655
+ closureDigest: i.digest,
8656
+ engineContract: t,
8657
+ graph: e.document.graph,
8658
+ modules: Object.fromEntries([...i.dependencies.modules].toSorted().map((t) => [t, e.modules[t]])),
8659
+ subflows: Object.fromEntries([...i.dependencies.subflows].toSorted().map((t) => [t, e.document.subflows[t]])),
8660
+ tasks: Object.fromEntries([...i.dependencies.tasks].toSorted().map((t) => [t, e.document.tasks[t]]))
8673
8661
  },
8674
8662
  kind: "prepared",
8675
- validation: i
8663
+ validation: r
8676
8664
  };
8677
8665
  }
8678
8666
  function yr(e, t, n) {
@@ -1,5 +1,5 @@
1
1
  import type { ConnectorProxy } from './connector-proxy.js';
2
- import type { IntegrationEndpointMethod, JsonValue, TriggerKeySnapshot } from '../browser/project-change.js';
2
+ import type { IntegrationEndpointMethod, JsonValue, TriggerKeySnapshot } from '../browser/flow-change.js';
3
3
  export declare const maximumIntegrationBodyBytes: number;
4
4
  export declare const maximumIntegrationDeliveryPages = 5;
5
5
  export type IntegrationReceiveResult = {
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/dequal/lite/index.mjs
1
+ //#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
2
2
  var e = Object.prototype.hasOwnProperty;
3
3
  function t(n, r) {
4
4
  var i, a;
@@ -1,5 +1,5 @@
1
1
  import type { ConnectorProxy } from './connector-proxy.js';
2
- import type { JsonValue, TriggerKeySnapshot, TriggerSchedule } from '../browser/project-change.js';
2
+ import type { JsonValue, TriggerKeySnapshot, TriggerSchedule } from '../browser/flow-change.js';
3
3
  export declare const maximumPollCheckpointBytes: number;
4
4
  export declare const maximumPollDedupeKeyBytes = 1024;
5
5
  export declare const maximumPollEventsPerPage = 100;
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/dequal/lite/index.mjs
1
+ //#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
2
2
  var e = Object.prototype.hasOwnProperty;
3
3
  function t(n, r) {
4
4
  var i, a;
@@ -1,4 +1,4 @@
1
- import type { CodeModule, JsonValue } from '../browser/project-change.js';
1
+ import type { CodeModule, JsonValue } from '../browser/flow-change.js';
2
2
  export { currentEngineContract, findEngineContract, type EngineContract } from './engine-contract.js';
3
3
  export type RuntimeModule = Pick<CodeModule, 'imports' | 'source'>;
4
4
  export interface RuntimeProgram {
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/dequal/lite/index.mjs
1
+ //#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
2
2
  var e = Object.prototype.hasOwnProperty;
3
3
  function t(n, r) {
4
4
  var i, a;
@@ -1,5 +1,5 @@
1
- import type { ConnectorCapability, JsonValue } from '../browser/project-change.js';
2
- import type { PreparedFlow } from './project-semantics.js';
1
+ import type { ConnectorCapability, JsonValue } from '../browser/flow-change.js';
2
+ import type { PreparedFlow } from './flow-semantics.js';
3
3
  export type SchedulerEvent = {
4
4
  readonly flowId: string;
5
5
  readonly parentJobId?: string;
@@ -88,6 +88,7 @@ export interface SchedulerFailure {
88
88
  export interface FlowRunOptions {
89
89
  readonly createId: () => string;
90
90
  readonly emit?: (event: SchedulerEvent) => void | Promise<void>;
91
+ readonly flowId: string;
91
92
  readonly inputs?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
92
93
  readonly invokeTask: (invocation: TaskInvocation) => Promise<unknown>;
93
94
  readonly projectFailure?: (error: unknown) => SchedulerFailure;
@@ -356,8 +356,8 @@ async function h(t, n, u, p, g, v, y = {}, b, x) {
356
356
  }), W;
357
357
  }
358
358
  async function g(e, t) {
359
- let n = async (e) => await t.emit?.(e), r = t.signal ?? new AbortController().signal, i = t.trigger == null ? void 0 : e.flow.graph.nodes[t.trigger.nodeId];
360
- if (t.trigger != null && (i == null || "inputs" in i)) throw Error(`Node "${t.trigger.nodeId}" is not a TriggerNode in Flow "${e.flowId}".`);
359
+ let n = async (e) => await t.emit?.(e), r = t.signal ?? new AbortController().signal, i = t.trigger == null ? void 0 : e.graph.nodes[t.trigger.nodeId];
360
+ if (t.trigger != null && (i == null || "inputs" in i)) throw Error(`Node "${t.trigger.nodeId}" is not a TriggerNode in Flow "${t.flowId}".`);
361
361
  return await h({
362
362
  createId: t.createId,
363
363
  emit: n,
@@ -365,8 +365,8 @@ async function g(e, t) {
365
365
  prepared: e,
366
366
  projectFailure: t.projectFailure
367
367
  }, {
368
- flowId: e.flowId,
369
- graph: _(e.flow.graph),
368
+ flowId: t.flowId,
369
+ graph: _(e.graph),
370
370
  inputs: {},
371
371
  kind: "flow",
372
372
  outputs: {}
@@ -1,4 +1,4 @@
1
- import type { JsonValue, WebhookInputDefinition, WebhookOptions } from '../browser/project-change.js';
1
+ import type { JsonValue, WebhookInputDefinition, WebhookOptions } from '../browser/flow-change.js';
2
2
  export declare const maximumWebhookBodyBytes: number;
3
3
  export declare function webhookEndpointId(url: URL): string | undefined;
4
4
  export declare function webhookOccurrenceId(endpointId: string, runtimeVersion: number, key: string | null): Promise<string | undefined>;
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/dequal/lite/index.mjs
1
+ //#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
2
2
  var e = Object.prototype.hasOwnProperty;
3
3
  function t(n, r) {
4
4
  var i, a;
@@ -159,7 +159,7 @@ var u = [], d = [{
159
159
  }
160
160
  }
161
161
  },
162
- name: "prevents Project responses from becoming executable or controlling deployment headers",
162
+ name: "prevents Flow responses from becoming executable or controlling deployment headers",
163
163
  async verify(e) {
164
164
  await c(await l(e), {
165
165
  body: "<script>globalThis.compromised = true<\/script>",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oomol-lab/open-flow",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.6",
4
4
  "description": "TypeScript contracts and Browser runtime for Open Flow.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -45,21 +45,21 @@
45
45
  "types": "./dist/common/provider-triggers.d.ts",
46
46
  "import": "./dist/common/provider-triggers.js"
47
47
  },
48
- "./project-authoring": {
49
- "types": "./dist/browser/project-authoring.d.ts",
50
- "import": "./dist/browser/project-authoring.js"
48
+ "./flow-authoring": {
49
+ "types": "./dist/browser/flow-authoring.d.ts",
50
+ "import": "./dist/browser/flow-authoring.js"
51
51
  },
52
- "./project-change": {
53
- "types": "./dist/browser/project-change.d.ts",
54
- "import": "./dist/browser/project-change.js"
52
+ "./flow-change": {
53
+ "types": "./dist/browser/flow-change.d.ts",
54
+ "import": "./dist/browser/flow-change.js"
55
55
  },
56
- "./project-encoding": {
57
- "types": "./dist/common/project-encoding.d.ts",
58
- "import": "./dist/common/project-encoding.js"
56
+ "./flow-encoding": {
57
+ "types": "./dist/common/flow-encoding.d.ts",
58
+ "import": "./dist/common/flow-encoding.js"
59
59
  },
60
- "./project-semantics": {
61
- "types": "./dist/common/project-semantics.d.ts",
62
- "import": "./dist/common/project-semantics.js"
60
+ "./flow-semantics": {
61
+ "types": "./dist/common/flow-semantics.d.ts",
62
+ "import": "./dist/common/flow-semantics.js"
63
63
  },
64
64
  "./run-lifecycle": {
65
65
  "types": "./dist/common/run-lifecycle.d.ts",