@oomol-lab/open-flow 0.1.0-beta.63 → 0.1.0-beta.65

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.
@@ -59,11 +59,30 @@ function dequal(foo, bar) {
59
59
  //#endregion
60
60
  //#region src/flow/common/edgeChanges.ts
61
61
  function connect(content, edge) {
62
- if (content.document.graph?.edges.some((candidate) => dequal(candidate, edge))) return [];
63
- return [{
62
+ const selected = content.document.graph;
63
+ if (selected?.edges.some((candidate) => dequal(candidate, edge))) return [];
64
+ const changes = [{
64
65
  edge,
65
66
  kind: "graph.edge.connect"
66
67
  }];
68
+ const source = selected.nodes[edge.source];
69
+ const target = selected.nodes[edge.target];
70
+ if (edge.sourceHandle == "pending" && (source?.kind == "approval" || source?.kind == "wait") && target?.kind == "task" && "executor" in target.task && target.task.executor.kind == "connector" && target.task.executor.action == "leina.send_notification" && (target.inputs.message == null || target.inputs.message.kind == "unset")) changes.push({
71
+ kind: "graph.node.input.set",
72
+ nodeId: edge.target,
73
+ handle: "message",
74
+ before: target.inputs.message,
75
+ value: {
76
+ kind: "sources",
77
+ sources: [{
78
+ kind: "node",
79
+ nodeId: edge.source,
80
+ output: "pending",
81
+ field: "message"
82
+ }]
83
+ }
84
+ });
85
+ return changes;
67
86
  }
68
87
  function disconnect(content, edge) {
69
88
  if (!content.document.graph?.edges.some((candidate) => dequal(candidate, edge))) return [];
@@ -1,3 +1,4 @@
1
+ import type { CanvasCommand } from '../common/canvas-commands.js';
1
2
  export type FlowCatalogEvent = {
2
3
  readonly kind: 'flows.changed';
3
4
  readonly version: 1;
@@ -7,6 +8,11 @@ export type FlowCatalogEvent = {
7
8
  readonly version: 1;
8
9
  };
9
10
  export type FlowChangeEvent = {
11
+ readonly kind: 'canvas.command';
12
+ readonly flowId: string;
13
+ readonly command: CanvasCommand;
14
+ readonly version: 1;
15
+ } | {
10
16
  readonly accessRevision: number;
11
17
  readonly flowId: string;
12
18
  readonly kind: 'access.changed';