@oomol-lab/open-flow 0.1.0-alpha.5 → 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 (37) hide show
  1. package/dist/browser/{addNodeOptions-B6tOfd2Y.js → addNodeOptions-C4wix0_u.js} +957 -1377
  2. package/dist/browser/{createLucideIcon-BlEx4FzJ.js → createLucideIcon-ggJB9CTC.js} +6 -37
  3. package/dist/browser/{createResourceDialog-CrBp3E8P.js → createResourceDialog-CESUCxOM.js} +2 -2
  4. package/dist/browser/{field-Daq9Lk-Y.js → field-CIrv7Rez.js} +1 -1
  5. package/dist/browser/{project-authoring-edge.d.ts → flow-authoring-edge.d.ts} +1 -1
  6. package/dist/browser/{project-authoring-module.d.ts → flow-authoring-module.d.ts} +1 -1
  7. package/dist/browser/{project-authoring-node.d.ts → flow-authoring-node.d.ts} +6 -12
  8. package/dist/browser/flow-authoring.d.ts +3 -0
  9. package/dist/browser/{project-authoring.js → flow-authoring.js} +43 -68
  10. package/dist/browser/{project-change.d.ts → flow-change.d.ts} +11 -26
  11. package/dist/browser/{project-change.js → flow-change.js} +8 -39
  12. package/dist/browser/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
  13. package/dist/browser/{flowWorkspace-CylW6hge.js → flowWorkspace-Bo0bz1Uz.js} +6351 -6516
  14. package/dist/browser/workbench-contract.d.ts +4 -4
  15. package/dist/browser/workbench.css +1 -1
  16. package/dist/browser/workbench.d.ts +1 -1
  17. package/dist/browser/workbench.js +896 -1051
  18. package/dist/common/control-api-conformance.js +136 -360
  19. package/dist/common/control-api-errors.d.ts +16 -24
  20. package/dist/common/control-api.d.ts +38 -67
  21. package/dist/common/control-api.js +135 -188
  22. package/dist/common/cron-trigger.d.ts +1 -1
  23. package/dist/common/{project-encoding.d.ts → flow-encoding.d.ts} +3 -3
  24. package/dist/common/{project-encoding.js → flow-encoding.js} +3 -6
  25. package/dist/common/{project-notifications.d.ts → flow-notifications.d.ts} +6 -3
  26. package/dist/common/{project-semantics.d.ts → flow-semantics.d.ts} +9 -12
  27. package/dist/common/{project-semantics.js → flow-semantics.js} +100 -110
  28. package/dist/common/integration-trigger.d.ts +1 -1
  29. package/dist/common/poll-trigger.d.ts +1 -1
  30. package/dist/common/runtime-contract.d.ts +1 -1
  31. package/dist/common/scheduler.d.ts +3 -2
  32. package/dist/common/scheduler.js +4 -4
  33. package/dist/common/webhook-trigger.d.ts +1 -1
  34. package/dist/common/webhook-trigger.js +1 -1
  35. package/package.json +13 -13
  36. package/dist/browser/project-authoring-flow.d.ts +0 -4
  37. package/dist/browser/project-authoring.d.ts +0 -4
@@ -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;
@@ -7862,7 +7862,7 @@ function An(e) {
7862
7862
  return e == "open-flow-engine/v1" ? kn : void 0;
7863
7863
  }
7864
7864
  //#endregion
7865
- //#region src/project/common/encoding.ts
7865
+ //#region src/flow/common/encoding.ts
7866
7866
  var jn = new TextEncoder();
7867
7867
  function Mn(e) {
7868
7868
  if (e == null || typeof e == "boolean" || typeof e == "string" || typeof e == "number") return JSON.stringify(e);
@@ -8075,59 +8075,53 @@ function Jn(e) {
8075
8075
  };
8076
8076
  }
8077
8077
  //#endregion
8078
- //#region src/project/common/semantics.ts
8078
+ //#region src/flow/common/semantics.ts
8079
8079
  function Yn(e) {
8080
8080
  return Object.keys(e).toSorted().map((t) => [t, e[t]]);
8081
8081
  }
8082
- async function Xn(e, t) {
8083
- let n = e.document.flows[t];
8084
- if (n == null) return;
8085
- let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
8086
- function c(e) {
8087
- 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);
8088
8086
  }
8089
- function l(t) {
8090
- if (a.has(t)) return;
8091
- a.add(t);
8087
+ function s(t) {
8088
+ if (r.has(t)) return;
8089
+ r.add(t);
8092
8090
  let n = e.modules[t];
8093
- 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);
8094
8092
  }
8095
- function u(e) {
8096
- 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));
8097
8095
  }
8098
- function d(e) {
8099
- 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) {
8100
8098
  case "condition": break;
8101
8099
  case "subflow":
8102
- f(t.subflowId);
8100
+ u(t.subflowId);
8103
8101
  break;
8104
8102
  case "task":
8105
- t.task == null ? s.add(t.taskId) : l(t.task.moduleId);
8103
+ t.task == null ? a.add(t.taskId) : s(t.task.moduleId);
8106
8104
  break;
8107
8105
  case "value": break;
8108
8106
  case "poll":
8109
- case "integration": c(t.bindingId);
8107
+ case "integration": o(t.bindingId);
8110
8108
  }
8111
8109
  }
8112
- function f(t) {
8113
- if (o.has(t)) return;
8114
- o.add(t);
8110
+ function u(t) {
8111
+ if (i.has(t)) return;
8112
+ i.add(t);
8115
8113
  let n = e.document.subflows[t];
8116
- n != null && d(n.graph);
8114
+ n != null && l(n.graph);
8117
8115
  }
8118
- d(n.graph);
8119
- let p = Nn({
8120
- bindings: Object.fromEntries([...r].toSorted().map((t) => [t, e.document.bindings[t] ?? null])),
8121
- flow: {
8122
- graph: Vn(n.graph),
8123
- id: t,
8124
- name: n.name
8125
- },
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),
8126
8120
  kind: "open-flow-semantic-closure",
8127
8121
  modelVersion: e.modelVersion,
8128
- modules: Object.fromEntries([...a].toSorted().map((t) => [t, e.modules[t] == null ? null : Jn(e.modules[t])])),
8129
- tasks: Object.fromEntries([...s].toSorted().map((t) => [t, e.document.tasks[t] == null ? null : Hn(e.document.tasks[t])])),
8130
- 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) => {
8131
8125
  let n = e.document.subflows[t];
8132
8126
  return n == null ? [t, null] : [t, {
8133
8127
  graph: Vn(n.graph),
@@ -8140,13 +8134,13 @@ async function Xn(e, t) {
8140
8134
  });
8141
8135
  return {
8142
8136
  dependencies: {
8143
- bindings: r,
8144
- inputBindings: i,
8145
- modules: a,
8146
- subflows: o,
8147
- tasks: s
8137
+ bindings: t,
8138
+ inputBindings: n,
8139
+ modules: r,
8140
+ subflows: i,
8141
+ tasks: a
8148
8142
  },
8149
- digest: await Pn(p)
8143
+ digest: await Pn(d)
8150
8144
  };
8151
8145
  }
8152
8146
  function Zn(e) {
@@ -8473,44 +8467,43 @@ function dr(e, t, n, r, i, a) {
8473
8467
  }
8474
8468
  ur(e, i, a);
8475
8469
  }
8476
- function fr(e, t, n) {
8477
- let r = /* @__PURE__ */ new Set(), i = [];
8478
- function a(t, o) {
8479
- 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)) {
8480
8474
  if (c.kind != "subflow" || e.subflows[c.subflowId] == null) continue;
8481
- let t = i.indexOf(c.subflowId);
8482
- if (t >= 0) {
8483
- 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`));
8484
8478
  continue;
8485
8479
  }
8486
- 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());
8487
8481
  }
8488
8482
  }
8489
- a(e.flows[t].graph, `/document/flows/${t}/graph`);
8483
+ i(e.graph, "/document/graph");
8490
8484
  }
8491
- function pr(e, t, n) {
8492
- let r = [], i = e.document.flows[t];
8493
- dr(i.graph, e.document, void 0, !0, `/document/flows/${t}/graph`, r);
8494
- for (let t of [...n.dependencies.subflows].toSorted()) {
8495
- let n = e.document.subflows[t];
8496
- if (n == null) continue;
8497
- let i = `/document/subflows/${t}`, a = new Set(Object.keys(n.inputs));
8498
- dr(n.graph, e.document, a, !1, `${i}/graph`, r);
8499
- 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);
8500
- }
8501
- return fr(e.document, t, r), r;
8502
- }
8503
- function mr(e, t, n) {
8504
- if (typeof n != "object" || !n || Array.isArray(n)) return "invalid";
8505
- let r = e.document.flows[t]?.graph;
8506
- if (r == null) return "flow-not-found";
8507
- for (let [t, i] of Object.entries(n)) {
8508
- let n = r.nodes[t];
8509
- if (n == null || !("inputs" in n) || typeof i != "object" || !i || Array.isArray(i)) return "invalid";
8510
- 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);
8511
8504
  for (let e of Object.keys(i)) {
8512
- let t = a[e];
8513
- 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";
8514
8507
  }
8515
8508
  }
8516
8509
  return "valid";
@@ -8596,45 +8589,44 @@ function hr(e, t, n) {
8596
8589
  function gr(e, t, n) {
8597
8590
  return hr(e, t, n).diagnostics.toSorted(nr);
8598
8591
  }
8599
- async function _r(e, t, n) {
8600
- if (e.document.flows[t] == null) return;
8601
- let r = await Xn(e, t), i = hr(e, [...r.dependencies.modules], n);
8602
- i.diagnostics.push(...pr(e, t, r));
8603
- 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) => {
8604
8596
  let n = e.document.subflows[t];
8605
8597
  return n == null ? [] : [[`/document/subflows/${t}/graph`, n.graph]];
8606
- })], o = /* @__PURE__ */ new Set();
8607
- for (let [t, n] of a) for (let [r, a] of Object.entries(n.nodes)) if (a.kind == "task" && a.task != null) {
8608
- 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({
8609
8601
  code: "task.module-missing",
8610
8602
  column: 0,
8611
8603
  line: 1,
8612
- message: `Inline Task "${r}" references missing CodeModule "${a.task.moduleId}".`,
8613
- path: `${t}/nodes/${r}/task/moduleId`
8614
- }) : !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({
8615
8607
  code: "task.missing-entry",
8616
8608
  column: 0,
8617
8609
  line: 1,
8618
- message: `CodeModule "${a.task.moduleId}" used by an Inline Task must export a default function.`,
8619
- 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`
8620
8612
  }));
8621
- 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({
8622
8614
  code: "task.capability-incomplete",
8623
8615
  column: 0,
8624
8616
  line: 1,
8625
- message: `Inline Task "${r}" has an incomplete Connector Capability.`,
8626
- 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}`
8627
8619
  });
8628
8620
  }
8629
- for (let t of [...r.dependencies.tasks].toSorted()) {
8621
+ for (let t of [...n.dependencies.tasks].toSorted()) {
8630
8622
  let n = e.document.tasks[t];
8631
- 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({
8632
8624
  code: "task.connector-incomplete",
8633
8625
  column: 0,
8634
8626
  line: 1,
8635
8627
  message: `Connector Task "${t}" requires an action.`,
8636
8628
  path: `/document/tasks/${t}/executor`
8637
- }), n.executor.kind == "connector" && n.executor.connectionId == null && i.diagnostics.push({
8629
+ }), n.executor.kind == "connector" && n.executor.connectionId == null && r.diagnostics.push({
8638
8630
  code: "task.connector-connection-required",
8639
8631
  column: 0,
8640
8632
  line: 1,
@@ -8642,35 +8634,33 @@ async function _r(e, t, n) {
8642
8634
  path: `/document/tasks/${t}/executor/connectionId`
8643
8635
  }));
8644
8636
  }
8645
- let s = i.diagnostics.toSorted(nr);
8637
+ let o = r.diagnostics.toSorted(nr);
8646
8638
  return {
8647
- closure: r,
8648
- diagnostics: s,
8649
- valid: s.length == 0
8639
+ closure: n,
8640
+ diagnostics: o,
8641
+ valid: o.length == 0
8650
8642
  };
8651
8643
  }
8652
- async function vr(e, t, n) {
8653
- let r = An(n);
8654
- if (r == null) return { kind: "engine-unsupported" };
8655
- let i = await _r(e, t, r);
8656
- if (i == null) return { kind: "flow-not-found" };
8657
- 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 {
8658
8649
  kind: "flow-invalid",
8659
- validation: i
8650
+ validation: r
8660
8651
  };
8661
- let { closure: a } = i;
8652
+ let { closure: i } = r;
8662
8653
  return {
8663
8654
  flow: {
8664
- closureDigest: a.digest,
8665
- engineContract: n,
8666
- flow: e.document.flows[t],
8667
- flowId: t,
8668
- modules: Object.fromEntries([...a.dependencies.modules].toSorted().map((t) => [t, e.modules[t]])),
8669
- subflows: Object.fromEntries([...a.dependencies.subflows].toSorted().map((t) => [t, e.document.subflows[t]])),
8670
- 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]]))
8671
8661
  },
8672
8662
  kind: "prepared",
8673
- validation: i
8663
+ validation: r
8674
8664
  };
8675
8665
  }
8676
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,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
- 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,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>;
@@ -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.5",
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",
@@ -1,4 +0,0 @@
1
- import type { ChangeOperation } from './project-change.js';
2
- export declare function createFlow(flowId: string, name: string): readonly ChangeOperation[];
3
- export declare function renameFlow(flowId: string, name: string): readonly ChangeOperation[];
4
- export declare function deleteFlow(flowId: string): readonly ChangeOperation[];
@@ -1,4 +0,0 @@
1
- export { connect, disconnect } from './project-authoring-edge.js';
2
- export { createFlow, deleteFlow, renameFlow } from './project-authoring-flow.js';
3
- export { imports as moduleImports, rename as renameModule, replaceSource as replaceModuleSource } from './project-authoring-module.js';
4
- export { createBuiltinTrigger, createCodeTask, createCondition, createLlmTask, createManagedTask, createProviderTrigger, createValue, deleteNodes, setConnectorConnection, setInputValues, setTriggerConnection, updateSettings, updateTrigger, } from './project-authoring-node.js';