@oomol-lab/open-flow 0.1.0-beta.50 → 0.1.0-beta.51

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 (33) hide show
  1. package/dist/browser/{createResourceDialog-CSltk-qY.js → createResourceDialog-BDtXpRSt.js} +1 -1
  2. package/dist/browser/flow-authoring-node.d.ts +3 -1
  3. package/dist/browser/flow-authoring.js +39 -3
  4. package/dist/browser/flow-change-schema.d.ts +1 -1
  5. package/dist/browser/flow-change.d.ts +9 -1
  6. package/dist/browser/flow-change.js +38 -3
  7. package/dist/browser/{flowChanges-DbYrpHnS.js → flowChanges-BWSXSnMX.js} +431 -27
  8. package/dist/browser/{flowWorkspace-CjwpbVBR.js → flowWorkspace-DBaq2Eks.js} +459 -190
  9. package/dist/browser/preview.css +20 -0
  10. package/dist/browser/preview.js +556 -21
  11. package/dist/browser/ui.css +20 -0
  12. package/dist/browser/ui.js +4 -3
  13. package/dist/browser/workbench-contract.d.ts +1 -0
  14. package/dist/browser/workbench.css +20 -0
  15. package/dist/browser/workbench.js +133 -22
  16. package/dist/browser/{workbenchSelect-oVujN2z6.js → workbenchSelect-C9kwcUmN.js} +47 -6
  17. package/dist/common/authoringExamples.d.ts +3 -2
  18. package/dist/common/control-api-conformance.js +82 -10
  19. package/dist/common/control-api.d.ts +34 -5
  20. package/dist/common/control-api.js +147 -10
  21. package/dist/common/control-requests.js +23 -1
  22. package/dist/common/flow-encoding.js +30 -5
  23. package/dist/common/flow-semantics.js +87 -2
  24. package/dist/common/integration-trigger.js +16 -1
  25. package/dist/common/mcp.js +82 -10
  26. package/dist/common/poll-trigger.js +16 -1
  27. package/dist/common/provider-triggers.js +16 -1
  28. package/dist/common/run-events.js +25 -1
  29. package/dist/common/scheduler.d.ts +3 -0
  30. package/dist/common/scheduler.js +91 -5
  31. package/dist/common/trigger-contract.d.ts +2 -0
  32. package/dist/common/webhook-trigger.js +16 -1
  33. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { i as useTranslate } from "./main-BPABKzwN.js";
2
- import { C as FieldDescription, E as FieldLabel, Fr as Button, Mn as Input, S as Field, T as FieldGroup, a as DialogContent, c as DialogHeader, i as DialogClose, l as DialogTitle, n as Icon, r as Dialog, s as DialogFooter, t as WorkbenchSelect, w as FieldError, x as Spinner } from "./workbenchSelect-oVujN2z6.js";
2
+ import { C as FieldDescription, E as FieldLabel, Fr as Button, Mn as Input, S as Field, T as FieldGroup, a as DialogContent, c as DialogHeader, i as DialogClose, l as DialogTitle, n as Icon, r as Dialog, s as DialogFooter, t as WorkbenchSelect, w as FieldError, x as Spinner } from "./workbenchSelect-C9kwcUmN.js";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/workbench/browser/runtime/shell/createResourceDialog.tsx
@@ -17,6 +17,8 @@ interface TriggerSettingsBase {
17
17
  }
18
18
  export type TriggerSettings = (TriggerSettingsBase & {
19
19
  readonly kind: 'manual';
20
+ }) | (TriggerSettingsBase & {
21
+ readonly kind: 'error';
20
22
  }) | (TriggerSettingsBase & {
21
23
  readonly bodyFields: Extract<TriggerNode, {
22
24
  readonly kind: 'webhook';
@@ -71,7 +73,7 @@ export declare function createApproval(target: Extract<GraphTarget, {
71
73
  export declare function createBuiltinTrigger(target: Extract<GraphTarget, {
72
74
  readonly kind: 'flow';
73
75
  }>, nodeId: string, node: Extract<TriggerNode, {
74
- readonly kind: 'cron' | 'manual' | 'webhook';
76
+ readonly kind: 'error' | 'cron' | 'manual' | 'webhook';
75
77
  }>): readonly ChangeOperation[];
76
78
  export declare function createProviderTrigger(target: Extract<GraphTarget, {
77
79
  readonly kind: 'flow';
@@ -5963,6 +5963,7 @@ var endpoint = object({
5963
5963
  ])),
5964
5964
  successStatus: number()
5965
5965
  });
5966
+ var sourceFlowIds = array(text.min(1)).refine((ids) => new Set(ids).size === ids.length, "Duplicate source Flow ID.");
5966
5967
  var trigger = {
5967
5968
  name: text,
5968
5969
  description: text.optional(),
@@ -6020,6 +6021,11 @@ var node = union([
6020
6021
  ...trigger,
6021
6022
  kind: literal("manual")
6022
6023
  }),
6024
+ strictObject({
6025
+ ...trigger,
6026
+ kind: literal("error"),
6027
+ sourceFlowIds: sourceFlowIds.optional()
6028
+ }),
6023
6029
  object({
6024
6030
  ...trigger,
6025
6031
  kind: literal("webhook"),
@@ -6091,7 +6097,11 @@ var document = object({
6091
6097
  tasks: record(text, managed)
6092
6098
  });
6093
6099
  object({
6094
- modelVersion: union([literal(2), literal(4)]),
6100
+ modelVersion: union([
6101
+ literal(2),
6102
+ literal(4),
6103
+ literal(5)
6104
+ ]),
6095
6105
  document,
6096
6106
  modules: record(text, module)
6097
6107
  }).extend({
@@ -6099,6 +6109,11 @@ object({
6099
6109
  version: literal(1)
6100
6110
  });
6101
6111
  var shapes = {
6112
+ "graph.trigger.sources.set": {
6113
+ nodeId: text,
6114
+ before: sourceFlowIds.optional(),
6115
+ value: sourceFlowIds.optional()
6116
+ },
6102
6117
  "binding.create": {
6103
6118
  bindingId: text,
6104
6119
  binding
@@ -6487,6 +6502,25 @@ function applyFlowChanges(content, operations) {
6487
6502
  const document = { ...content.document };
6488
6503
  const modules = { ...content.modules };
6489
6504
  for (const operation of operations) switch (operation.kind) {
6505
+ case "graph.trigger.sources.set": {
6506
+ const graph = document.graph;
6507
+ const node = graph.nodes[operation.nodeId];
6508
+ if (node?.kind != "error") invalid("The Error Trigger does not exist.");
6509
+ if (!dequal(node.sourceFlowIds, operation.before)) invalid("The Error Trigger sources changed before this operation was applied.");
6510
+ const { sourceFlowIds: _, ...base } = node;
6511
+ const updated = operation.value == null ? base : {
6512
+ ...base,
6513
+ sourceFlowIds: operation.value
6514
+ };
6515
+ document.graph = {
6516
+ ...graph,
6517
+ nodes: {
6518
+ ...graph.nodes,
6519
+ [operation.nodeId]: updated
6520
+ }
6521
+ };
6522
+ break;
6523
+ }
6490
6524
  case "binding.create":
6491
6525
  if (document.bindings[operation.bindingId] != null) invalid("A Binding with this ID already exists.");
6492
6526
  document.bindings = {
@@ -6577,6 +6611,7 @@ function applyFlowChanges(content, operations) {
6577
6611
  const graph = selectedGraph(document, operation.target);
6578
6612
  if (graph.nodes[operation.nodeId] != null) invalid("A Node with this ID already exists in the target graph.");
6579
6613
  if (operation.target.kind == "subflow" && !("inputs" in operation.node)) invalid("Trigger Nodes cannot be created inside a Subflow.");
6614
+ if (operation.node.kind == "error" && Object.values(graph.nodes).some((node) => node.kind == "error")) invalid("A graph can contain only one Error Trigger.");
6580
6615
  if (operation.node.kind == "manual" && Object.values(graph.nodes).some((node) => node.kind == "manual")) invalid("A graph can contain only one manual Trigger.");
6581
6616
  if (operation.node.kind == "task" && operation.node.task?.capabilities !== void 0) decodeConnectorCapabilities(operation.node.task.capabilities);
6582
6617
  if (operation.node.name == null) invalid("A Node name cannot be empty.");
@@ -6956,7 +6991,7 @@ function applyFlowChanges(content, operations) {
6956
6991
  }
6957
6992
  return {
6958
6993
  document,
6959
- modelVersion: 4,
6994
+ modelVersion: 5,
6960
6995
  modules
6961
6996
  };
6962
6997
  }
@@ -21760,8 +21795,9 @@ function updateTrigger(content, target, nodeId, settings) {
21760
21795
  value: settings.description
21761
21796
  });
21762
21797
  switch (settings.kind) {
21798
+ case "error":
21763
21799
  case "manual":
21764
- if (trigger.kind != "manual") return;
21800
+ if (trigger.kind != settings.kind) return;
21765
21801
  break;
21766
21802
  case "webhook": {
21767
21803
  if (trigger.kind != "webhook") return;
@@ -1,5 +1,5 @@
1
1
  import type { ChangeOperation, FlowDocument, JsonValue, RevisionContent } from './flow-change.js';
2
- export declare const currentFlowModelVersion = 4;
2
+ export declare const currentFlowModelVersion = 5;
3
3
  /** Best-effort recovery for a parseable Revision envelope. Invalid collection entries are discarded. */
4
4
  export declare function repairRevisionEnvelope(value: unknown): RevisionContent;
5
5
  export declare function decodeFlowDocument(value: unknown): FlowDocument;
@@ -271,6 +271,9 @@ interface TriggerNodeBase {
271
271
  }
272
272
  export type TriggerNode = (TriggerNodeBase & {
273
273
  readonly kind: 'manual';
274
+ }) | (TriggerNodeBase & {
275
+ readonly kind: 'error';
276
+ readonly sourceFlowIds?: readonly string[];
274
277
  }) | (TriggerNodeBase & {
275
278
  readonly bodyFields: readonly WebhookBodyField[];
276
279
  readonly kind: 'webhook';
@@ -317,7 +320,7 @@ export interface CodeModule {
317
320
  }
318
321
  export interface RevisionContent {
319
322
  readonly document: FlowDocument;
320
- readonly modelVersion: 2 | typeof currentFlowModelVersion;
323
+ readonly modelVersion: 2 | 4 | typeof currentFlowModelVersion;
321
324
  readonly modules: Readonly<Record<string, CodeModule>>;
322
325
  }
323
326
  export type GraphTarget = {
@@ -340,6 +343,11 @@ export type ChangeOperation = {
340
343
  readonly nodeId: string;
341
344
  readonly target: GraphTarget;
342
345
  readonly value?: readonly ConnectorCapability[];
346
+ } | {
347
+ readonly kind: 'graph.trigger.sources.set';
348
+ readonly nodeId: string;
349
+ readonly before?: readonly string[];
350
+ readonly value?: readonly string[];
343
351
  } | {
344
352
  readonly binding: FlowDocument['bindings'][string];
345
353
  readonly bindingId: string;
@@ -5838,7 +5838,7 @@ var webhookMethods = [
5838
5838
  ];
5839
5839
  //#endregion
5840
5840
  //#region src/flow/common/changeSchema.ts
5841
- var currentFlowModelVersion = 4;
5841
+ var currentFlowModelVersion = 5;
5842
5842
  var text = string();
5843
5843
  var json = json$1();
5844
5844
  var strings = array(text);
@@ -6055,6 +6055,7 @@ var endpoint = object({
6055
6055
  ])),
6056
6056
  successStatus: number()
6057
6057
  });
6058
+ var sourceFlowIds = array(text.min(1)).refine((ids) => new Set(ids).size === ids.length, "Duplicate source Flow ID.");
6058
6059
  var trigger = {
6059
6060
  name: text,
6060
6061
  description: text.optional(),
@@ -6112,6 +6113,11 @@ var node = union([
6112
6113
  ...trigger,
6113
6114
  kind: literal("manual")
6114
6115
  }),
6116
+ strictObject({
6117
+ ...trigger,
6118
+ kind: literal("error"),
6119
+ sourceFlowIds: sourceFlowIds.optional()
6120
+ }),
6115
6121
  object({
6116
6122
  ...trigger,
6117
6123
  kind: literal("webhook"),
@@ -6183,7 +6189,11 @@ var document = object({
6183
6189
  tasks: record(text, managed)
6184
6190
  });
6185
6191
  object({
6186
- modelVersion: union([literal(2), literal(4)]),
6192
+ modelVersion: union([
6193
+ literal(2),
6194
+ literal(4),
6195
+ literal(5)
6196
+ ]),
6187
6197
  document,
6188
6198
  modules: record(text, module)
6189
6199
  }).extend({
@@ -6191,6 +6201,11 @@ object({
6191
6201
  version: literal(1)
6192
6202
  });
6193
6203
  var shapes = {
6204
+ "graph.trigger.sources.set": {
6205
+ nodeId: text,
6206
+ before: sourceFlowIds.optional(),
6207
+ value: sourceFlowIds.optional()
6208
+ },
6194
6209
  "binding.create": {
6195
6210
  bindingId: text,
6196
6211
  binding
@@ -6653,6 +6668,25 @@ function applyFlowChanges(content, operations) {
6653
6668
  const document = { ...content.document };
6654
6669
  const modules = { ...content.modules };
6655
6670
  for (const operation of operations) switch (operation.kind) {
6671
+ case "graph.trigger.sources.set": {
6672
+ const graph = document.graph;
6673
+ const node = graph.nodes[operation.nodeId];
6674
+ if (node?.kind != "error") invalid("The Error Trigger does not exist.");
6675
+ if (!dequal(node.sourceFlowIds, operation.before)) invalid("The Error Trigger sources changed before this operation was applied.");
6676
+ const { sourceFlowIds: _, ...base } = node;
6677
+ const updated = operation.value == null ? base : {
6678
+ ...base,
6679
+ sourceFlowIds: operation.value
6680
+ };
6681
+ document.graph = {
6682
+ ...graph,
6683
+ nodes: {
6684
+ ...graph.nodes,
6685
+ [operation.nodeId]: updated
6686
+ }
6687
+ };
6688
+ break;
6689
+ }
6656
6690
  case "binding.create":
6657
6691
  if (document.bindings[operation.bindingId] != null) invalid("A Binding with this ID already exists.");
6658
6692
  document.bindings = {
@@ -6743,6 +6777,7 @@ function applyFlowChanges(content, operations) {
6743
6777
  const graph = selectedGraph(document, operation.target);
6744
6778
  if (graph.nodes[operation.nodeId] != null) invalid("A Node with this ID already exists in the target graph.");
6745
6779
  if (operation.target.kind == "subflow" && !("inputs" in operation.node)) invalid("Trigger Nodes cannot be created inside a Subflow.");
6780
+ if (operation.node.kind == "error" && Object.values(graph.nodes).some((node) => node.kind == "error")) invalid("A graph can contain only one Error Trigger.");
6746
6781
  if (operation.node.kind == "manual" && Object.values(graph.nodes).some((node) => node.kind == "manual")) invalid("A graph can contain only one manual Trigger.");
6747
6782
  if (operation.node.kind == "task" && operation.node.task?.capabilities !== void 0) decodeConnectorCapabilities(operation.node.task.capabilities);
6748
6783
  if (operation.node.name == null) invalid("A Node name cannot be empty.");
@@ -7122,7 +7157,7 @@ function applyFlowChanges(content, operations) {
7122
7157
  }
7123
7158
  return {
7124
7159
  document,
7125
- modelVersion: 4,
7160
+ modelVersion: 5,
7126
7161
  modules
7127
7162
  };
7128
7163
  }