@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,3 +1,4 @@
1
+ import * as Cause from "effect/Cause";
1
2
  import * as Clock from "effect/Clock";
2
3
  import * as Effect from "effect/Effect";
3
4
  import * as FiberSet from "effect/FiberSet";
@@ -6747,6 +6748,7 @@ var endpoint = object({
6747
6748
  ])),
6748
6749
  successStatus: number()
6749
6750
  });
6751
+ var sourceFlowIds = array(text.min(1)).refine((ids) => new Set(ids).size === ids.length, "Duplicate source Flow ID.");
6750
6752
  var trigger = {
6751
6753
  name: text,
6752
6754
  description: text.optional(),
@@ -6804,6 +6806,11 @@ var node = union([
6804
6806
  ...trigger,
6805
6807
  kind: literal("manual")
6806
6808
  }),
6809
+ strictObject({
6810
+ ...trigger,
6811
+ kind: literal("error"),
6812
+ sourceFlowIds: sourceFlowIds.optional()
6813
+ }),
6807
6814
  object({
6808
6815
  ...trigger,
6809
6816
  kind: literal("webhook"),
@@ -6875,7 +6882,11 @@ var document = object({
6875
6882
  tasks: record(text, managed)
6876
6883
  });
6877
6884
  object({
6878
- modelVersion: union([literal(2), literal(4)]),
6885
+ modelVersion: union([
6886
+ literal(2),
6887
+ literal(4),
6888
+ literal(5)
6889
+ ]),
6879
6890
  document,
6880
6891
  modules: record(text, module)
6881
6892
  }).extend({
@@ -6883,6 +6894,11 @@ object({
6883
6894
  version: literal(1)
6884
6895
  });
6885
6896
  var shapes = {
6897
+ "graph.trigger.sources.set": {
6898
+ nodeId: text,
6899
+ before: sourceFlowIds.optional(),
6900
+ value: sourceFlowIds.optional()
6901
+ },
6886
6902
  "binding.create": {
6887
6903
  bindingId: text,
6888
6904
  binding
@@ -10201,6 +10217,67 @@ function isJsonObject(value) {
10201
10217
  }
10202
10218
  //#endregion
10203
10219
  //#region src/trigger/common/contract.ts
10220
+ var errorOutputs = [
10221
+ {
10222
+ handle: "workflow",
10223
+ nullable: false,
10224
+ jsonSchema: {
10225
+ type: "object",
10226
+ additionalProperties: false,
10227
+ required: [
10228
+ "flowId",
10229
+ "name",
10230
+ "revisionId",
10231
+ "publicationId"
10232
+ ],
10233
+ properties: {
10234
+ flowId: { type: "string" },
10235
+ name: { type: "string" },
10236
+ revisionId: { type: "string" },
10237
+ publicationId: { type: ["string", "null"] }
10238
+ }
10239
+ }
10240
+ },
10241
+ {
10242
+ handle: "execution",
10243
+ nullable: false,
10244
+ jsonSchema: {
10245
+ type: "object",
10246
+ additionalProperties: false,
10247
+ required: [
10248
+ "runId",
10249
+ "status",
10250
+ "startedAt",
10251
+ "finishedAt"
10252
+ ],
10253
+ properties: {
10254
+ runId: { type: "string" },
10255
+ status: { enum: ["failed", "indeterminate"] },
10256
+ startedAt: { type: ["string", "null"] },
10257
+ finishedAt: { type: "string" }
10258
+ }
10259
+ }
10260
+ },
10261
+ {
10262
+ handle: "error",
10263
+ nullable: false,
10264
+ jsonSchema: {
10265
+ type: "object",
10266
+ additionalProperties: false,
10267
+ required: ["code", "message"],
10268
+ properties: {
10269
+ code: { type: "string" },
10270
+ message: { type: "string" },
10271
+ nodeId: { type: "string" },
10272
+ jobId: { type: "string" },
10273
+ path: {
10274
+ type: "array",
10275
+ items: { type: "string" }
10276
+ }
10277
+ }
10278
+ }
10279
+ }
10280
+ ];
10204
10281
  var webhookOutputs = [
10205
10282
  {
10206
10283
  handle: "headers",
@@ -10245,6 +10322,7 @@ var cronOutputs = [{
10245
10322
  }];
10246
10323
  function triggerOutputDefinitions(trigger) {
10247
10324
  switch (trigger.kind) {
10325
+ case "error": return errorOutputs;
10248
10326
  case "manual": return [];
10249
10327
  case "cron": return cronOutputs;
10250
10328
  case "poll":
@@ -10316,6 +10394,7 @@ function nodeOutputPorts(document, node) {
10316
10394
  case "cron":
10317
10395
  case "integration":
10318
10396
  case "poll":
10397
+ case "error":
10319
10398
  case "manual":
10320
10399
  case "webhook": return triggerOutputPorts(node);
10321
10400
  }
@@ -10863,14 +10942,19 @@ function runGraph(context, target, runId, inputs, parent, launchInputs = {}, tri
10863
10942
  return createWait(nodeId, jobId, result.value);
10864
10943
  };
10865
10944
  const observe = (nodeId, jobId, effect) => effect.pipe(Effect.catchDefect((error) => Effect.fail(error instanceof Error ? error : new Error(String(error)))), Effect.tapError((error) => Effect.gen(function* () {
10866
- if (firstCause == null) firstFailure ??= error;
10867
- yield* context.emit({
10945
+ const failure = {
10868
10946
  ...nodeFailure(error, context.projectFailure),
10869
10947
  jobId,
10870
10948
  nodeId,
10871
10949
  runId,
10872
10950
  type: "node.failed"
10873
- }).pipe(Effect.ignore);
10951
+ };
10952
+ if (!context.failures.has(error)) context.failures.set(error, failure);
10953
+ if (firstCause == null) {
10954
+ firstFailure = error;
10955
+ firstCause = Cause.fail(error);
10956
+ }
10957
+ yield* context.emit(failure).pipe(Effect.ignore);
10874
10958
  })), Effect.tapCause((cause) => Effect.sync(() => {
10875
10959
  firstCause ??= cause;
10876
10960
  })));
@@ -10960,7 +11044,8 @@ function runGraph(context, target, runId, inputs, parent, launchInputs = {}, tri
10960
11044
  yield* context.emit({
10961
11045
  message: firstFailure?.message ?? "Execution failed.",
10962
11046
  runId,
10963
- type: "run.failed"
11047
+ type: "run.failed",
11048
+ ...firstFailure == null ? {} : { failure: context.failures.get(firstFailure) }
10964
11049
  }).pipe(Effect.ignore);
10965
11050
  return yield* Effect.failCause(firstCause);
10966
11051
  }
@@ -11052,6 +11137,7 @@ function runFlow(prepared, options) {
11052
11137
  const triggerNode = options.trigger == null ? void 0 : prepared.graph.nodes[options.trigger.nodeId];
11053
11138
  if (options.trigger != null && (triggerNode == null || "inputs" in triggerNode)) return yield* Effect.fail(/* @__PURE__ */ new Error(`Node "${options.trigger.nodeId}" is not a TriggerNode in Flow "${options.flowId}".`));
11054
11139
  return yield* runGraph({
11140
+ failures: /* @__PURE__ */ new WeakMap(),
11055
11141
  counts: Object.fromEntries(Object.entries(checkpoint?.counts ?? {}).map(([scope, counts]) => [scope, { ...counts }])),
11056
11142
  bindingValues: checkpoint?.bindingValues ?? options.bindingValues ?? {},
11057
11143
  createId: options.createId,
@@ -1,6 +1,8 @@
1
1
  import type { JsonValue, Port, PortDefinition, TriggerNode } from '../browser/flow-change.js';
2
2
  import { webhookMethods, webhookSupportsBody } from '../browser/webhook-method.js';
3
3
  export { webhookMethods, webhookSupportsBody };
4
+ export declare const errorOutputs: readonly Port[];
5
+ export declare const sampleErrorOutputs: Readonly<Record<string, JsonValue>>;
4
6
  export declare const webhookOutputs: readonly Port[];
5
7
  export declare function triggerOutputDefinitions(trigger: TriggerNode): readonly Port[];
6
8
  export declare function triggerOutputPorts(trigger: TriggerNode): Readonly<Record<string, PortDefinition>>;
@@ -8601,6 +8601,7 @@ var endpoint = object({
8601
8601
  ])),
8602
8602
  successStatus: number()
8603
8603
  });
8604
+ var sourceFlowIds = array(text.min(1)).refine((ids) => new Set(ids).size === ids.length, "Duplicate source Flow ID.");
8604
8605
  var trigger = {
8605
8606
  name: text,
8606
8607
  description: text.optional(),
@@ -8658,6 +8659,11 @@ var node = union([
8658
8659
  ...trigger,
8659
8660
  kind: literal("manual")
8660
8661
  }),
8662
+ strictObject({
8663
+ ...trigger,
8664
+ kind: literal("error"),
8665
+ sourceFlowIds: sourceFlowIds.optional()
8666
+ }),
8661
8667
  object({
8662
8668
  ...trigger,
8663
8669
  kind: literal("webhook"),
@@ -8729,7 +8735,11 @@ var document = object({
8729
8735
  tasks: record(text, managed)
8730
8736
  });
8731
8737
  object({
8732
- modelVersion: union([literal(2), literal(4)]),
8738
+ modelVersion: union([
8739
+ literal(2),
8740
+ literal(4),
8741
+ literal(5)
8742
+ ]),
8733
8743
  document,
8734
8744
  modules: record(text, module)
8735
8745
  }).extend({
@@ -8737,6 +8747,11 @@ object({
8737
8747
  version: literal(1)
8738
8748
  });
8739
8749
  var shapes = {
8750
+ "graph.trigger.sources.set": {
8751
+ nodeId: text,
8752
+ before: sourceFlowIds.optional(),
8753
+ value: sourceFlowIds.optional()
8754
+ },
8740
8755
  "binding.create": {
8741
8756
  bindingId: text,
8742
8757
  binding
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oomol-lab/open-flow",
3
- "version": "0.1.0-beta.50",
3
+ "version": "0.1.0-beta.51",
4
4
  "description": "TypeScript contracts and Browser runtime for Open Flow.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {