flowcraft 2.3.1 → 2.5.0
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.
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/analysis.d.ts +9 -2
- package/dist/analysis.js +1 -1
- package/dist/chunk-27STBUGG.js +44 -0
- package/dist/chunk-27STBUGG.js.map +1 -0
- package/dist/{chunk-QNYXQKFW.js → chunk-2ISKDTSN.js} +3 -3
- package/dist/{chunk-QNYXQKFW.js.map → chunk-2ISKDTSN.js.map} +1 -1
- package/dist/{chunk-CD4FUZOJ.js → chunk-5BOUGXZO.js} +25 -11
- package/dist/chunk-5BOUGXZO.js.map +1 -0
- package/dist/{chunk-ZNL7ZXPR.js → chunk-5XPW6YEP.js} +76 -32
- package/dist/chunk-5XPW6YEP.js.map +1 -0
- package/dist/{chunk-BN4MV36K.js → chunk-6MGLU3UU.js} +3 -3
- package/dist/{chunk-BN4MV36K.js.map → chunk-6MGLU3UU.js.map} +1 -1
- package/dist/{chunk-C4HYIJI3.js → chunk-7FIOROIR.js} +19 -11
- package/dist/chunk-7FIOROIR.js.map +1 -0
- package/dist/{chunk-G5BGBPFP.js → chunk-FBPY44WL.js} +3 -3
- package/dist/{chunk-G5BGBPFP.js.map → chunk-FBPY44WL.js.map} +1 -1
- package/dist/chunk-HNHM3FDK.js +52 -0
- package/dist/chunk-HNHM3FDK.js.map +1 -0
- package/dist/chunk-I53JB2KW.js +26 -0
- package/dist/chunk-I53JB2KW.js.map +1 -0
- package/dist/chunk-IDTYHLDQ.js +16 -0
- package/dist/chunk-IDTYHLDQ.js.map +1 -0
- package/dist/{chunk-EUJWJWFA.js → chunk-IKOTX22J.js} +3 -3
- package/dist/{chunk-EUJWJWFA.js.map → chunk-IKOTX22J.js.map} +1 -1
- package/dist/{chunk-XNRIM27H.js → chunk-JLDHCI2O.js} +5 -5
- package/dist/{chunk-XNRIM27H.js.map → chunk-JLDHCI2O.js.map} +1 -1
- package/dist/chunk-LM4ACVHL.js +73 -0
- package/dist/chunk-LM4ACVHL.js.map +1 -0
- package/dist/{chunk-FRKO3WX4.js → chunk-N4NLAIEN.js} +3 -3
- package/dist/{chunk-FRKO3WX4.js.map → chunk-N4NLAIEN.js.map} +1 -1
- package/dist/{chunk-HKX7WQLS.js → chunk-OPRR4TAO.js} +43 -11
- package/dist/chunk-OPRR4TAO.js.map +1 -0
- package/dist/{chunk-MCGK3FXQ.js → chunk-SEI4Z3MO.js} +3 -3
- package/dist/{chunk-MCGK3FXQ.js.map → chunk-SEI4Z3MO.js.map} +1 -1
- package/dist/{chunk-MKNZBKSR.js → chunk-UXIASXSG.js} +7 -7
- package/dist/chunk-UXIASXSG.js.map +1 -0
- package/dist/chunk-XDI4TJHA.js +95 -0
- package/dist/chunk-XDI4TJHA.js.map +1 -0
- package/dist/{chunk-33NO4PUJ.js → chunk-XTW36KQZ.js} +3 -3
- package/dist/{chunk-33NO4PUJ.js.map → chunk-XTW36KQZ.js.map} +1 -1
- package/dist/{chunk-233SESC2.js → chunk-ZLW4QOTS.js} +74 -3
- package/dist/chunk-ZLW4QOTS.js.map +1 -0
- package/dist/container-factory.d.ts +1 -1
- package/dist/container-factory.js +5 -5
- package/dist/context.d.ts +21 -2
- package/dist/context.js +1 -1
- package/dist/error-mapper.d.ts +15 -0
- package/dist/error-mapper.js +4 -0
- package/dist/error-mapper.js.map +1 -0
- package/dist/evaluator.d.ts +1 -1
- package/dist/flow.d.ts +14 -5
- package/dist/flow.js +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +20 -16
- package/dist/linter.d.ts +1 -1
- package/dist/linter.js +2 -2
- package/dist/logger.d.ts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/nodes/batch-gather.d.ts +1 -1
- package/dist/nodes/batch-scatter.d.ts +1 -1
- package/dist/nodes/sleep.d.ts +9 -0
- package/dist/nodes/sleep.js +4 -0
- package/dist/nodes/sleep.js.map +1 -0
- package/dist/nodes/subflow.d.ts +1 -1
- package/dist/nodes/subflow.js +6 -6
- package/dist/nodes/wait.d.ts +1 -1
- package/dist/nodes/wait.js +1 -1
- package/dist/nodes/webhook.d.ts +13 -0
- package/dist/nodes/webhook.js +4 -0
- package/dist/nodes/webhook.js.map +1 -0
- package/dist/runtime/adapter.d.ts +14 -1
- package/dist/runtime/adapter.js +15 -12
- package/dist/runtime/execution-context.d.ts +1 -1
- package/dist/runtime/execution-context.js +3 -3
- package/dist/runtime/executors.d.ts +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +15 -12
- package/dist/runtime/node-executor-factory.d.ts +1 -1
- package/dist/runtime/orchestrator.d.ts +1 -1
- package/dist/runtime/orchestrator.js +4 -4
- package/dist/runtime/orchestrators/step-by-step.d.ts +1 -1
- package/dist/runtime/orchestrators/utils.d.ts +1 -1
- package/dist/runtime/runtime.d.ts +1 -1
- package/dist/runtime/runtime.js +14 -11
- package/dist/runtime/scheduler.d.ts +3 -0
- package/dist/runtime/scheduler.js +3 -0
- package/dist/runtime/scheduler.js.map +1 -0
- package/dist/runtime/state.d.ts +1 -1
- package/dist/runtime/state.js +2 -2
- package/dist/runtime/traverser.d.ts +1 -1
- package/dist/runtime/traverser.js +2 -2
- package/dist/runtime/types.d.ts +1 -1
- package/dist/runtime/workflow-logic-handler.d.ts +1 -1
- package/dist/runtime/workflow-logic-handler.js +2 -2
- package/dist/sanitizer.d.ts +1 -1
- package/dist/sdk.d.ts +29 -0
- package/dist/sdk.js +20 -0
- package/dist/sdk.js.map +1 -0
- package/dist/serializer.d.ts +1 -1
- package/dist/testing/event-logger.d.ts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +18 -15
- package/dist/testing/run-with-trace.d.ts +1 -1
- package/dist/testing/run-with-trace.js +16 -13
- package/dist/testing/stepper.d.ts +1 -1
- package/dist/testing/stepper.js +6 -6
- package/dist/{types-ezHUBdpL.d.ts → types-B-Drn84R.d.ts} +62 -3
- package/dist/types.d.ts +1 -1
- package/package.json +59 -55
- package/dist/chunk-233SESC2.js.map +0 -1
- package/dist/chunk-C4HYIJI3.js.map +0 -1
- package/dist/chunk-CD3Q4N6V.js +0 -13
- package/dist/chunk-CD3Q4N6V.js.map +0 -1
- package/dist/chunk-CD4FUZOJ.js.map +0 -1
- package/dist/chunk-HKX7WQLS.js.map +0 -1
- package/dist/chunk-MKNZBKSR.js.map +0 -1
- package/dist/chunk-R3HQXIEL.js +0 -49
- package/dist/chunk-R3HQXIEL.js.map +0 -1
- package/dist/chunk-ZNL7ZXPR.js.map +0 -1
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { e as ExecutionServices, I as IOrchestrator, f as IRuntime, N as NodeExecutionResult, b as NodeExecutor, d as NodeExecutorFactory } from '../types-
|
|
1
|
+
export { e as ExecutionServices, I as IOrchestrator, f as IRuntime, N as NodeExecutionResult, b as NodeExecutor, d as NodeExecutorFactory } from '../types-B-Drn84R.js';
|
|
2
2
|
import '../errors.js';
|
|
3
3
|
import '../container.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { x as IEvaluator, A as IEventBus, h as WorkflowBlueprint, m as NodeResult, s as ContextImplementation, j as NodeDefinition, k as EdgeDefinition } from '../types-B-Drn84R.js';
|
|
2
2
|
import '../errors.js';
|
|
3
3
|
import '../container.js';
|
|
4
4
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { WorkflowLogicHandler } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { WorkflowLogicHandler } from '../chunk-SEI4Z3MO.js';
|
|
2
|
+
import '../chunk-XDI4TJHA.js';
|
|
3
3
|
import '../chunk-BCRWXTWX.js';
|
|
4
4
|
//# sourceMappingURL=workflow-logic-handler.js.map
|
|
5
5
|
//# sourceMappingURL=workflow-logic-handler.js.map
|
package/dist/sanitizer.d.ts
CHANGED
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface Webhook<T = any> {
|
|
2
|
+
/** The unique public URL to which the external system should send its POST request. */
|
|
3
|
+
url: string;
|
|
4
|
+
/** A unique event name which can be used to trigger the webhook */
|
|
5
|
+
event: string;
|
|
6
|
+
/** A promise-like object that resolves with the webhook's request details when it is invoked. */
|
|
7
|
+
request: Promise<{
|
|
8
|
+
json: () => Promise<T>;
|
|
9
|
+
text: () => Promise<string>;
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Pauses workflow execution for a specified duration.
|
|
15
|
+
* Must be used with `await` inside a compiled `@flow` function.
|
|
16
|
+
*/
|
|
17
|
+
declare function sleep(_duration: number | string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Pauses a workflow until an external event is received.
|
|
20
|
+
* Must be used with `await` inside a compiled `@flow` function.
|
|
21
|
+
*/
|
|
22
|
+
declare function waitForEvent<T = any>(_eventName: string): Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a durable, single-use webhook endpoint.
|
|
25
|
+
* Must be used with `await` inside a compiled `@flow` function.
|
|
26
|
+
*/
|
|
27
|
+
declare function createWebhook<T = any>(): Promise<Webhook<T>>;
|
|
28
|
+
|
|
29
|
+
export { type Webhook, createWebhook, sleep, waitForEvent };
|
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/sdk.ts
|
|
2
|
+
function sleep(_duration) {
|
|
3
|
+
console.warn(`'sleep' should only be used inside a compiled @flow function.`);
|
|
4
|
+
return new Promise(() => {
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
function waitForEvent(_eventName) {
|
|
8
|
+
console.warn(`'waitForEvent' should only be used inside a compiled @flow function.`);
|
|
9
|
+
return new Promise(() => {
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function createWebhook() {
|
|
13
|
+
console.warn(`'createWebhook' should only be used inside a compiled @flow function.`);
|
|
14
|
+
return new Promise(() => {
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { createWebhook, sleep, waitForEvent };
|
|
19
|
+
//# sourceMappingURL=sdk.js.map
|
|
20
|
+
//# sourceMappingURL=sdk.js.map
|
package/dist/sdk.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk.ts"],"names":[],"mappings":";AAiBO,SAAS,MAAM,SAAA,EAA2C;AAChE,EAAA,OAAA,CAAQ,KAAK,CAAA,6DAAA,CAA+D,CAAA;AAC5E,EAAA,OAAO,IAAI,QAAQ,MAAM;AAAA,EAAC,CAAC,CAAA;AAC5B;AAMO,SAAS,aAAsB,UAAA,EAAgC;AACrE,EAAA,OAAA,CAAQ,KAAK,CAAA,oEAAA,CAAsE,CAAA;AACnF,EAAA,OAAO,IAAI,QAAQ,MAAM;AAAA,EAAC,CAAC,CAAA;AAC5B;AAMO,SAAS,aAAA,GAA8C;AAC7D,EAAA,OAAA,CAAQ,KAAK,CAAA,qEAAA,CAAuE,CAAA;AACpF,EAAA,OAAO,IAAI,QAAQ,MAAM;AAAA,EAAC,CAAC,CAAA;AAC5B","file":"sdk.js","sourcesContent":["export interface Webhook<T = any> {\n\t/** The unique public URL to which the external system should send its POST request. */\n\turl: string\n\t/** A unique event name which can be used to trigger the webhook */\n\tevent: string\n\t/** A promise-like object that resolves with the webhook's request details when it is invoked. */\n\trequest: Promise<{\n\t\tjson: () => Promise<T>\n\t\ttext: () => Promise<string>\n\t\theaders: Record<string, string>\n\t}>\n}\n\n/**\n * Pauses workflow execution for a specified duration.\n * Must be used with `await` inside a compiled `@flow` function.\n */\nexport function sleep(_duration: number | string): Promise<void> {\n\tconsole.warn(`'sleep' should only be used inside a compiled @flow function.`)\n\treturn new Promise(() => {}) // intentionally never resolves\n}\n\n/**\n * Pauses a workflow until an external event is received.\n * Must be used with `await` inside a compiled `@flow` function.\n */\nexport function waitForEvent<T = any>(_eventName: string): Promise<T> {\n\tconsole.warn(`'waitForEvent' should only be used inside a compiled @flow function.`)\n\treturn new Promise(() => {}) // intentionally never resolves\n}\n\n/**\n * Creates a durable, single-use webhook endpoint.\n * Must be used with `await` inside a compiled `@flow` function.\n */\nexport function createWebhook<T = any>(): Promise<Webhook<T>> {\n\tconsole.warn(`'createWebhook' should only be used inside a compiled @flow function.`)\n\treturn new Promise(() => {}) // intentionally never resolves\n}\n"]}
|
package/dist/serializer.d.ts
CHANGED
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { InMemoryEventLogger } from './event-logger.js';
|
|
2
2
|
export { runWithTrace } from './run-with-trace.js';
|
|
3
3
|
export { IWorkflowStepper, createStepper } from './stepper.js';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-B-Drn84R.js';
|
|
5
5
|
import '../errors.js';
|
|
6
6
|
import '../container.js';
|
package/dist/testing/index.js
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
export { runWithTrace } from '../chunk-
|
|
2
|
-
export { createStepper } from '../chunk-XNRIM27H.js';
|
|
3
|
-
import '../chunk-G53CSLBF.js';
|
|
1
|
+
export { runWithTrace } from '../chunk-6MGLU3UU.js';
|
|
4
2
|
export { InMemoryEventLogger } from '../chunk-MUYLRTSR.js';
|
|
3
|
+
export { createStepper } from '../chunk-JLDHCI2O.js';
|
|
4
|
+
import '../chunk-G53CSLBF.js';
|
|
5
5
|
import '../chunk-NVJ3ZO3P.js';
|
|
6
6
|
import '../chunk-NVLZFLYM.js';
|
|
7
|
-
import '../chunk-
|
|
8
|
-
import '../chunk-
|
|
9
|
-
import '../chunk-
|
|
10
|
-
import '../chunk-MKNZBKSR.js';
|
|
11
|
-
import '../chunk-G5BGBPFP.js';
|
|
12
|
-
import '../chunk-CD3Q4N6V.js';
|
|
7
|
+
import '../chunk-5XPW6YEP.js';
|
|
8
|
+
import '../chunk-OPRR4TAO.js';
|
|
9
|
+
import '../chunk-SEI4Z3MO.js';
|
|
13
10
|
import '../chunk-DL7KVYZF.js';
|
|
14
11
|
import '../chunk-ONH7PIJZ.js';
|
|
15
|
-
import '../chunk-
|
|
12
|
+
import '../chunk-LM4ACVHL.js';
|
|
16
13
|
import '../chunk-BC4G7OM6.js';
|
|
17
14
|
import '../chunk-RM677CNU.js';
|
|
18
|
-
import '../chunk-
|
|
19
|
-
import '../chunk-
|
|
15
|
+
import '../chunk-HNHM3FDK.js';
|
|
16
|
+
import '../chunk-UXIASXSG.js';
|
|
17
|
+
import '../chunk-FBPY44WL.js';
|
|
18
|
+
import '../chunk-IDTYHLDQ.js';
|
|
19
|
+
import '../chunk-I53JB2KW.js';
|
|
20
|
+
import '../chunk-DSYAC4WB.js';
|
|
21
|
+
import '../chunk-ZLW4QOTS.js';
|
|
22
|
+
import '../chunk-XTW36KQZ.js';
|
|
20
23
|
import '../chunk-HAZ26F3P.js';
|
|
21
|
-
import '../chunk-
|
|
22
|
-
import '../chunk-
|
|
24
|
+
import '../chunk-N4NLAIEN.js';
|
|
25
|
+
import '../chunk-5BOUGXZO.js';
|
|
23
26
|
import '../chunk-4PELJWF7.js';
|
|
24
27
|
import '../chunk-CYHZ2YVH.js';
|
|
25
28
|
import '../chunk-WWGFIYKW.js';
|
|
26
|
-
import '../chunk-
|
|
29
|
+
import '../chunk-XDI4TJHA.js';
|
|
27
30
|
import '../chunk-BCRWXTWX.js';
|
|
28
31
|
import '../chunk-PH2IYZHV.js';
|
|
29
32
|
import '../chunk-LNK7LZER.js';
|
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
export { runWithTrace } from '../chunk-
|
|
1
|
+
export { runWithTrace } from '../chunk-6MGLU3UU.js';
|
|
2
2
|
import '../chunk-MUYLRTSR.js';
|
|
3
3
|
import '../chunk-NVJ3ZO3P.js';
|
|
4
4
|
import '../chunk-NVLZFLYM.js';
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
7
|
-
import '../chunk-
|
|
8
|
-
import '../chunk-MKNZBKSR.js';
|
|
9
|
-
import '../chunk-G5BGBPFP.js';
|
|
10
|
-
import '../chunk-CD3Q4N6V.js';
|
|
5
|
+
import '../chunk-5XPW6YEP.js';
|
|
6
|
+
import '../chunk-OPRR4TAO.js';
|
|
7
|
+
import '../chunk-SEI4Z3MO.js';
|
|
11
8
|
import '../chunk-DL7KVYZF.js';
|
|
12
9
|
import '../chunk-ONH7PIJZ.js';
|
|
13
|
-
import '../chunk-
|
|
10
|
+
import '../chunk-LM4ACVHL.js';
|
|
14
11
|
import '../chunk-BC4G7OM6.js';
|
|
15
12
|
import '../chunk-RM677CNU.js';
|
|
16
|
-
import '../chunk-
|
|
17
|
-
import '../chunk-
|
|
13
|
+
import '../chunk-HNHM3FDK.js';
|
|
14
|
+
import '../chunk-UXIASXSG.js';
|
|
15
|
+
import '../chunk-FBPY44WL.js';
|
|
16
|
+
import '../chunk-IDTYHLDQ.js';
|
|
17
|
+
import '../chunk-I53JB2KW.js';
|
|
18
|
+
import '../chunk-DSYAC4WB.js';
|
|
19
|
+
import '../chunk-ZLW4QOTS.js';
|
|
20
|
+
import '../chunk-XTW36KQZ.js';
|
|
18
21
|
import '../chunk-HAZ26F3P.js';
|
|
19
|
-
import '../chunk-
|
|
20
|
-
import '../chunk-
|
|
22
|
+
import '../chunk-N4NLAIEN.js';
|
|
23
|
+
import '../chunk-5BOUGXZO.js';
|
|
21
24
|
import '../chunk-4PELJWF7.js';
|
|
22
25
|
import '../chunk-CYHZ2YVH.js';
|
|
23
26
|
import '../chunk-WWGFIYKW.js';
|
|
24
|
-
import '../chunk-
|
|
27
|
+
import '../chunk-XDI4TJHA.js';
|
|
25
28
|
import '../chunk-BCRWXTWX.js';
|
|
26
29
|
import '../chunk-PH2IYZHV.js';
|
|
27
30
|
import '../chunk-LNK7LZER.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as WorkflowState, G as GraphTraverser,
|
|
1
|
+
import { W as WorkflowState, G as GraphTraverser, K as WorkflowResult, c as FlowRuntime, h as WorkflowBlueprint, o as NodeFunction, p as NodeClass } from '../types-B-Drn84R.js';
|
|
2
2
|
import '../errors.js';
|
|
3
3
|
import '../container.js';
|
|
4
4
|
|
package/dist/testing/stepper.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { createStepper } from '../chunk-
|
|
1
|
+
export { createStepper } from '../chunk-JLDHCI2O.js';
|
|
2
2
|
import '../chunk-G53CSLBF.js';
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-FBPY44WL.js';
|
|
4
|
+
import '../chunk-ZLW4QOTS.js';
|
|
5
5
|
import '../chunk-HAZ26F3P.js';
|
|
6
|
-
import '../chunk-
|
|
7
|
-
import '../chunk-
|
|
8
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-N4NLAIEN.js';
|
|
7
|
+
import '../chunk-5BOUGXZO.js';
|
|
8
|
+
import '../chunk-XDI4TJHA.js';
|
|
9
9
|
import '../chunk-BCRWXTWX.js';
|
|
10
10
|
//# sourceMappingURL=stepper.js.map
|
|
11
11
|
//# sourceMappingURL=stepper.js.map
|
|
@@ -50,6 +50,27 @@ declare abstract class BaseNode<TContext extends Record<string, any> = Record<st
|
|
|
50
50
|
recover(_error: Error, _context: NodeContext<TContext, TDependencies, TInput>): Promise<void>;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
interface AwaitingWorkflow {
|
|
54
|
+
executionId: string;
|
|
55
|
+
blueprintId: string;
|
|
56
|
+
serializedContext: string;
|
|
57
|
+
awaitingNodeId: string;
|
|
58
|
+
wakeUpAt: string;
|
|
59
|
+
}
|
|
60
|
+
declare class WorkflowScheduler {
|
|
61
|
+
private runtime;
|
|
62
|
+
private activeWorkflows;
|
|
63
|
+
private intervalId?;
|
|
64
|
+
private checkIntervalMs;
|
|
65
|
+
constructor(runtime: FlowRuntime<any, any>, checkIntervalMs?: number);
|
|
66
|
+
start(): void;
|
|
67
|
+
stop(): void;
|
|
68
|
+
registerAwaitingWorkflow(executionId: string, blueprintId: string, serializedContext: string, awaitingNodeId: string, wakeUpAt: string): void;
|
|
69
|
+
unregisterWorkflow(executionId: string): void;
|
|
70
|
+
private checkAndResumeWorkflows;
|
|
71
|
+
getActiveWorkflows(): AwaitingWorkflow[];
|
|
72
|
+
}
|
|
73
|
+
|
|
53
74
|
declare class WorkflowState<TContext extends Record<string, any>> {
|
|
54
75
|
private _completedNodes;
|
|
55
76
|
private errors;
|
|
@@ -57,6 +78,7 @@ declare class WorkflowState<TContext extends Record<string, any>> {
|
|
|
57
78
|
private context;
|
|
58
79
|
private _isAwaiting;
|
|
59
80
|
private _awaitingNodeIds;
|
|
81
|
+
private _awaitingDetails;
|
|
60
82
|
constructor(initialData: Partial<TContext>);
|
|
61
83
|
addCompletedNode(nodeId: string, output: any): Promise<void>;
|
|
62
84
|
addError(nodeId: string, error: Error): void;
|
|
@@ -66,9 +88,10 @@ declare class WorkflowState<TContext extends Record<string, any>> {
|
|
|
66
88
|
getCompletedNodes(): Set<string>;
|
|
67
89
|
getErrors(): WorkflowError[];
|
|
68
90
|
getAnyFallbackExecuted(): boolean;
|
|
69
|
-
markAsAwaiting(nodeId: string): void
|
|
91
|
+
markAsAwaiting(nodeId: string, details?: any): Promise<void>;
|
|
70
92
|
isAwaiting(): boolean;
|
|
71
93
|
getAwaitingNodeIds(): string[];
|
|
94
|
+
getAwaitingDetails(nodeId: string): any;
|
|
72
95
|
clearAwaiting(nodeId?: string): void;
|
|
73
96
|
getStatus(isTraversalComplete?: boolean): WorkflowResult['status'];
|
|
74
97
|
toResult(serializer: ISerializer): Promise<WorkflowResult<TContext>>;
|
|
@@ -197,6 +220,8 @@ declare class FlowRuntime<TContext extends Record<string, any>, TDependencies ex
|
|
|
197
220
|
options: RuntimeOptions<TDependencies>;
|
|
198
221
|
private readonly logicHandler;
|
|
199
222
|
private readonly executorFactory;
|
|
223
|
+
scheduler: WorkflowScheduler;
|
|
224
|
+
getBlueprint(id: string): WorkflowBlueprint | undefined;
|
|
200
225
|
constructor(container: DIContainer, options?: RuntimeOptions<TDependencies>);
|
|
201
226
|
constructor(options: RuntimeOptions<TDependencies>);
|
|
202
227
|
private _setupExecutionContext;
|
|
@@ -206,6 +231,8 @@ declare class FlowRuntime<TContext extends Record<string, any>, TDependencies ex
|
|
|
206
231
|
signal?: AbortSignal;
|
|
207
232
|
concurrency?: number;
|
|
208
233
|
}): Promise<WorkflowResult<TContext>>;
|
|
234
|
+
startScheduler(): void;
|
|
235
|
+
stopScheduler(): void;
|
|
209
236
|
private _setupResumedExecutionContext;
|
|
210
237
|
resume(blueprint: WorkflowBlueprint, serializedContext: string, resumeData: {
|
|
211
238
|
output?: any;
|
|
@@ -260,12 +287,26 @@ declare class ExecutionContext<TContext extends Record<string, any>, TDependenci
|
|
|
260
287
|
createForSubflow(subBlueprint: WorkflowBlueprint, initialSubState: Partial<TContext>): ExecutionContext<TContext, TDependencies>;
|
|
261
288
|
}
|
|
262
289
|
|
|
290
|
+
/** Source location information for debugging and visualization. */
|
|
291
|
+
interface SourceLocation {
|
|
292
|
+
file: string;
|
|
293
|
+
line: number;
|
|
294
|
+
column: number;
|
|
295
|
+
}
|
|
296
|
+
/** Metadata associated with a workflow blueprint. */
|
|
297
|
+
interface WorkflowBlueprintMetadata {
|
|
298
|
+
/** Optional version identifier for the blueprint. Used in distributed systems to ensure version compatibility. */
|
|
299
|
+
version?: string;
|
|
300
|
+
/** Entry points for cycles in the workflow graph. */
|
|
301
|
+
cycleEntryPoints?: string[];
|
|
302
|
+
[key: string]: any;
|
|
303
|
+
}
|
|
263
304
|
/** The central, serializable representation of a workflow. */
|
|
264
305
|
interface WorkflowBlueprint {
|
|
265
306
|
id: string;
|
|
266
307
|
nodes: NodeDefinition[];
|
|
267
308
|
edges: EdgeDefinition[];
|
|
268
|
-
metadata?:
|
|
309
|
+
metadata?: WorkflowBlueprintMetadata;
|
|
269
310
|
}
|
|
270
311
|
/** Defines a single step in the workflow. */
|
|
271
312
|
interface NodeDefinition {
|
|
@@ -278,6 +319,8 @@ interface NodeDefinition {
|
|
|
278
319
|
inputs?: string | Record<string, string>;
|
|
279
320
|
/** Configuration for retries, timeouts, etc. */
|
|
280
321
|
config?: NodeConfig;
|
|
322
|
+
/** Source location for debugging and visualization. */
|
|
323
|
+
_sourceLocation?: SourceLocation;
|
|
281
324
|
}
|
|
282
325
|
/** Defines the connection and data flow between two nodes. */
|
|
283
326
|
interface EdgeDefinition {
|
|
@@ -289,6 +332,8 @@ interface EdgeDefinition {
|
|
|
289
332
|
condition?: string;
|
|
290
333
|
/** A string expression to transform the data before passing it to the target node. */
|
|
291
334
|
transform?: string;
|
|
335
|
+
/** Source location for debugging and visualization. */
|
|
336
|
+
_sourceLocation?: SourceLocation;
|
|
292
337
|
}
|
|
293
338
|
/** Configuration for a node's resiliency and behavior. */
|
|
294
339
|
interface NodeConfig {
|
|
@@ -364,7 +409,21 @@ interface IAsyncContext<TContext extends Record<string, any> = Record<string, an
|
|
|
364
409
|
delete<K extends keyof TContext>(key: K): Promise<boolean>;
|
|
365
410
|
delete(key: string): Promise<boolean>;
|
|
366
411
|
toJSON: () => Promise<Record<string, any>>;
|
|
412
|
+
/**
|
|
413
|
+
* Applies a batch of patch operations atomically.
|
|
414
|
+
* More efficient than individual set/delete calls for bulk updates.
|
|
415
|
+
*/
|
|
416
|
+
patch(operations: PatchOperation[]): Promise<void>;
|
|
367
417
|
}
|
|
418
|
+
/** Represents a single patch operation for delta-based state updates. */
|
|
419
|
+
type PatchOperation = {
|
|
420
|
+
op: 'set';
|
|
421
|
+
key: string;
|
|
422
|
+
value: any;
|
|
423
|
+
} | {
|
|
424
|
+
op: 'delete';
|
|
425
|
+
key: string;
|
|
426
|
+
};
|
|
368
427
|
/** Generic for any set of dependencies. */
|
|
369
428
|
interface RuntimeDependencies {
|
|
370
429
|
[key: string]: any;
|
|
@@ -561,4 +620,4 @@ interface UIGraph {
|
|
|
561
620
|
}>;
|
|
562
621
|
}
|
|
563
622
|
|
|
564
|
-
export { type
|
|
623
|
+
export { type IEventBus as A, BaseNode as B, ClassNodeExecutor as C, type ISerializer as D, type ExecutionStrategy as E, FunctionNodeExecutor as F, GraphTraverser as G, type WorkflowError as H, type IOrchestrator as I, type WorkflowStatus as J, type WorkflowResult as K, ExecutionContext as L, type Middleware as M, type NodeExecutionResult as N, type AwaitingWorkflow as O, type PatchOperation as P, WorkflowScheduler as Q, type ReadyNode as R, type SourceLocation as S, type UIGraph as U, WorkflowState as W, type NodeExecutorConfig as a, NodeExecutor as b, FlowRuntime as c, type NodeExecutorFactory as d, type ExecutionServices as e, type IRuntime as f, type WorkflowBlueprintMetadata as g, type WorkflowBlueprint as h, isNodeClass as i, type NodeDefinition as j, type EdgeDefinition as k, type NodeConfig as l, type NodeResult as m, type NodeContext as n, type NodeFunction as o, type NodeClass as p, type NodeImplementation as q, type NodeRegistry as r, type ContextImplementation as s, type ISyncContext as t, type IAsyncContext as u, type RuntimeDependencies as v, type RuntimeOptions as w, type IEvaluator as x, type ILogger as y, type FlowcraftEvent as z };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import './errors.js';
|
|
2
|
-
export {
|
|
2
|
+
export { s as ContextImplementation, k as EdgeDefinition, z as FlowcraftEvent, u as IAsyncContext, x as IEvaluator, A as IEventBus, y as ILogger, D as ISerializer, t as ISyncContext, M as Middleware, p as NodeClass, l as NodeConfig, n as NodeContext, j as NodeDefinition, o as NodeFunction, q as NodeImplementation, r as NodeRegistry, m as NodeResult, P as PatchOperation, v as RuntimeDependencies, w as RuntimeOptions, S as SourceLocation, U as UIGraph, h as WorkflowBlueprint, g as WorkflowBlueprintMetadata, H as WorkflowError, K as WorkflowResult, J as WorkflowStatus } from './types-B-Drn84R.js';
|
|
3
3
|
import './container.js';
|
package/package.json
CHANGED
|
@@ -1,56 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
2
|
+
"name": "flowcraft",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.5.0",
|
|
5
|
+
"description": "A lightweight workflow framework",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://flowcraft.js.org",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/gorango/flowcraft.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/gorango/flowcraft/issues",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"agentic-workflows",
|
|
15
|
+
"ai-agent",
|
|
16
|
+
"background-jobs",
|
|
17
|
+
"dag",
|
|
18
|
+
"data-pipelines",
|
|
19
|
+
"declarative-workflows",
|
|
20
|
+
"distributed-systems",
|
|
21
|
+
"etl",
|
|
22
|
+
"llm-orchestration",
|
|
23
|
+
"orchestration",
|
|
24
|
+
"rag",
|
|
25
|
+
"state-machine",
|
|
26
|
+
"workflow-engine"
|
|
27
|
+
],
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./sdk": {
|
|
34
|
+
"types": "./dist/sdk.d.ts",
|
|
35
|
+
"import": "./dist/sdk.js"
|
|
36
|
+
},
|
|
37
|
+
"./testing": {
|
|
38
|
+
"types": "./dist/testing/index.d.ts",
|
|
39
|
+
"import": "./dist/testing/index.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^24.9.2",
|
|
47
|
+
"@vitest/coverage-v8": "4.0.4",
|
|
48
|
+
"tsup": "^8.5.0",
|
|
49
|
+
"typescript": "^5.9.3",
|
|
50
|
+
"vitest": "^4.0.4"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"dev": "tsup --watch",
|
|
54
|
+
"build": "tsup",
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"test": "vitest run",
|
|
57
|
+
"test:watch": "vitest",
|
|
58
|
+
"test:coverage": "vitest run --coverage"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/analysis.ts"],"names":[],"mappings":";AA+BO,SAAS,eAAe,SAAA,EAAsC;AACpE,EAAA,MAAM,SAAiB,EAAC;AACxB,EAAA,IAAI,CAAC,aAAa,CAAC,SAAA,CAAU,SAAS,SAAA,CAAU,KAAA,CAAM,WAAW,CAAA,EAAG;AACnE,IAAA,OAAO,MAAA;AAAA,EACR;AAEA,EAAA,MAAM,aAAa,SAAA,CAAU,KAAA,CAAM,IAAI,CAAC,IAAA,KAAS,KAAK,EAAE,CAAA;AACxD,EAAA,MAAM,GAAA,uBAAU,GAAA,EAAsB;AACtC,EAAA,KAAA,MAAW,MAAM,UAAA,EAAY;AAC5B,I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,EAAA,MAAM,SAAA,GAAY,UAAU,KAAA,CAAM,MAAA;AAClC,EAAA,MAAM,SAAA,GAAY,SAAA,CAAU,KAAA,EAAO,MAAA,IAAU,CAAA;AAE7C,EAAA,MAAM,iBAAA,uBAAwB,GAAA,EAAY;AAC1C,EAAA,KAAA,MAAW,IAAA,IAAQ,SAAA,CAAU,KAAA,IAAS,EAAC,EAAG;AACzC,IAAA,iBAAA,CAAkB,GAAA,CAAI,KAAK,MAAM,CAAA;AAAA,EAClC;AAEA,EAAA,MAAM,eAAe,SAAA,CAAU,KAAA,CAAM,GAAA,CAAI,CAAC,SAAS,IAAA,CAAK,EAAE,CAAA,CAAE,MAAA,CAAO,CAAC,MAAA,KAAW,CAAC,iBAAA,CAAkB,GAAA,CAAI,MAAM,CAAC,CAAA;AAE7G,EAAA,MAAM,iBAAA,uBAAwB,GAAA,EAAY;AAC1C,EAAA,KAAA,MAAW,IAAA,IAAQ,SAAA,CAAU,KAAA,IAAS,EAAC,EAAG;AACzC,IAAA,iBAAA,CAAkB,GAAA,CAAI,KAAK,MAAM,CAAA;AAAA,EAClC;AAEA,EAAA,MAAM,kBAAkB,SAAA,CAAU,KAAA,CAAM,GAAA,CAAI,CAAC,SAAS,IAAA,CAAK,EAAE,CAAA,CAAE,MAAA,CAAO,CAAC,MAAA,KAAW,CAAC,iBAAA,CAAkB,GAAA,CAAI,MAAM,CAAC,CAAA;AAEhH,EAAA,OAAO;AAAA,IACN,MAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA,EAAO,OAAO,MAAA,KAAW;AAAA,GAC1B;AACD","file":"chunk-233SESC2.js","sourcesContent":["import type { WorkflowBlueprint } from './types'\n\n/**\n * A list of cycles found in the graph. Each cycle is an array of node IDs.\n */\nexport type Cycles = string[][]\n\n/**\n * Analysis result for a workflow blueprint\n */\nexport interface BlueprintAnalysis {\n\t/** Cycles found in the graph */\n\tcycles: Cycles\n\t/** Node IDs that have no incoming edges (start nodes) */\n\tstartNodeIds: string[]\n\t/** Node IDs that have no outgoing edges (terminal nodes) */\n\tterminalNodeIds: string[]\n\t/** Total number of nodes */\n\tnodeCount: number\n\t/** Total number of edges */\n\tedgeCount: number\n\t/** Whether the graph is a valid DAG (no cycles) */\n\tisDag: boolean\n}\n\n/**\n * Analyzes a workflow blueprint to detect cycles using an iterative DFS algorithm.\n * This avoids stack overflow issues for deep graphs compared to the recursive version.\n * @param blueprint The WorkflowBlueprint object containing nodes and edges.\n * @returns An array of cycles found. Each cycle is represented as an array of node IDs.\n */\nexport function checkForCycles(blueprint: WorkflowBlueprint): Cycles {\n\tconst cycles: Cycles = []\n\tif (!blueprint || !blueprint.nodes || blueprint.nodes.length === 0) {\n\t\treturn cycles\n\t}\n\n\tconst allNodeIds = blueprint.nodes.map((node) => node.id)\n\tconst adj = new Map<string, string[]>()\n\tfor (const id of allNodeIds) {\n\t\tadj.set(id, [])\n\t}\n\tfor (const edge of blueprint.edges) {\n\t\tadj.get(edge.source)?.push(edge.target)\n\t}\n\n\t// 0 = not visited, 1 = visiting, 2 = visited\n\tconst state = new Map<string, number>()\n\tfor (const id of allNodeIds) {\n\t\tstate.set(id, 0)\n\t}\n\n\tfor (const startNode of allNodeIds) {\n\t\tif (state.get(startNode) !== 0) continue\n\n\t\tconst stack: { node: string; path: string[] }[] = [{ node: startNode, path: [] }]\n\t\tconst pathSet = new Set<string>()\n\n\t\twhile (stack.length > 0) {\n\t\t\tconst { node, path } = stack[stack.length - 1]\n\n\t\t\tif (state.get(node) === 0) {\n\t\t\t\t// first visit\n\t\t\t\tstate.set(node, 1) // visiting\n\t\t\t\tpathSet.add(node)\n\t\t\t\tpath.push(node)\n\t\t\t}\n\n\t\t\tconst neighbors = adj.get(node) || []\n\t\t\tlet foundUnvisited = false\n\n\t\t\tfor (const neighbor of neighbors) {\n\t\t\t\tif (state.get(neighbor) === 1) {\n\t\t\t\t\t// back edge, cycle found\n\t\t\t\t\tconst cycleStartIndex = path.indexOf(neighbor)\n\t\t\t\t\tconst cycle = path.slice(cycleStartIndex)\n\t\t\t\t\tcycles.push([...cycle, neighbor])\n\t\t\t\t} else if (state.get(neighbor) === 0) {\n\t\t\t\t\t// unvisited neighbor\n\t\t\t\t\tstack.push({ node: neighbor, path: [...path] })\n\t\t\t\t\tfoundUnvisited = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!foundUnvisited) {\n\t\t\t\t// all neighbors visited\n\t\t\t\tstate.set(node, 2) // visited\n\t\t\t\tstack.pop()\n\t\t\t\tpathSet.delete(node)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn cycles\n}\n\n/**\n * Generates Mermaid diagram syntax from a WorkflowBlueprint\n * @param blueprint The WorkflowBlueprint object containing nodes and edges\n * @returns Mermaid syntax string for the flowchart\n */\nexport function generateMermaid(blueprint: WorkflowBlueprint): string {\n\tif (!blueprint || !blueprint.nodes || blueprint.nodes.length === 0) {\n\t\treturn 'flowchart TD\\n empty[Empty Blueprint]'\n\t}\n\n\tlet mermaid = 'flowchart TD\\n'\n\n\tfor (const node of blueprint.nodes) {\n\t\t// Using backticks and characters like <br/> for newlines in Mermaid labels\n\t\tconst paramsString = node.params ? `<br/>params: ${JSON.stringify(node.params)}` : ''\n\t\tconst nodeLabel = `${node.id}${paramsString}`\n\t\tmermaid += ` ${node.id}[\"${nodeLabel}\"]\\n`\n\t}\n\n\tfor (const edge of blueprint.edges || []) {\n\t\tconst labelParts: string[] = []\n\n\t\tif (edge.action) {\n\t\t\tlabelParts.push(edge.action)\n\t\t}\n\t\tif (edge.condition) {\n\t\t\tlabelParts.push(edge.condition)\n\t\t}\n\t\tif (edge.transform) {\n\t\t\tlabelParts.push(edge.transform)\n\t\t}\n\n\t\tif (labelParts.length > 0) {\n\t\t\tconst edgeLabel = labelParts.join(' | ')\n\t\t\tmermaid += ` ${edge.source} -- \"${edgeLabel}\" --> ${edge.target}\\n`\n\t\t} else {\n\t\t\tmermaid += ` ${edge.source} --> ${edge.target}\\n`\n\t\t}\n\t}\n\n\treturn mermaid\n}\n\n/**\n * Analyzes a workflow blueprint and returns comprehensive analysis\n * @param blueprint The WorkflowBlueprint object containing nodes and edges\n * @returns Analysis result with cycles, start nodes, terminal nodes, and other metrics\n */\nexport function analyzeBlueprint(blueprint: WorkflowBlueprint): BlueprintAnalysis {\n\tif (!blueprint || !blueprint.nodes || blueprint.nodes.length === 0) {\n\t\treturn {\n\t\t\tcycles: [],\n\t\t\tstartNodeIds: [],\n\t\t\tterminalNodeIds: [],\n\t\t\tnodeCount: 0,\n\t\t\tedgeCount: 0,\n\t\t\tisDag: true,\n\t\t}\n\t}\n\n\tconst cycles = checkForCycles(blueprint)\n\tconst nodeCount = blueprint.nodes.length\n\tconst edgeCount = blueprint.edges?.length || 0\n\n\tconst nodesWithIncoming = new Set<string>()\n\tfor (const edge of blueprint.edges || []) {\n\t\tnodesWithIncoming.add(edge.target)\n\t}\n\n\tconst startNodeIds = blueprint.nodes.map((node) => node.id).filter((nodeId) => !nodesWithIncoming.has(nodeId))\n\n\tconst nodesWithOutgoing = new Set<string>()\n\tfor (const edge of blueprint.edges || []) {\n\t\tnodesWithOutgoing.add(edge.source)\n\t}\n\n\tconst terminalNodeIds = blueprint.nodes.map((node) => node.id).filter((nodeId) => !nodesWithOutgoing.has(nodeId))\n\n\treturn {\n\t\tcycles,\n\t\tstartNodeIds,\n\t\tterminalNodeIds,\n\t\tnodeCount,\n\t\tedgeCount,\n\t\tisDag: cycles.length === 0,\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flow.ts"],"names":[],"mappings":";;;AAMA,IAAI,WAAA,GAAc,CAAA;AAClB,SAAS,cAAc,EAAA,EAAwF;AAC9G,EAAA,MAAM,MAAA,GAAS,GAAG,QAAA,EAAS;AAC3B,EAAA,IAAI,IAAA,GAAO,CAAA;AACX,EAAA,KAAA,IAAS,CAAA,GAAI,C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AAA,KAAW,IAAA,CAAK;AAAA,SAClF;AACA,QAAA,IAAI,CAAC,YAAA,EAAc;AAClB,UAAA,OAAA,CAAQ,KAAK,IAAI,CAAA;AAAA,QAClB;AAAA,MACD;AAAA,IACD;AAEA,IAAA,OAAO,EAAE,KAAA,EAAO,OAAA,EAAS,KAAA,EAAO,OAAA,EAAQ;AAAA,EACzC;AACD;AAKO,SAAS,WAGd,EAAA,EAA2C;AAC5C,EAAA,OAAO,IAAI,KAAK,EAAE,CAAA;AACnB","file":"chunk-C4HYIJI3.js","sourcesContent":["import { isNodeClass } from './node'\nimport type { EdgeDefinition, NodeClass, NodeDefinition, NodeFunction, UIGraph, WorkflowBlueprint } from './types'\n\n/**\n * Generates a deterministic hash for a function based on its source code and a unique counter.\n */\nlet hashCounter = 0\nfunction _hashFunction(fn: NodeFunction<any, any, any, any, any> | NodeClass<any, any, any, any, any>): string {\n\tconst source = fn.toString()\n\tlet hash = 0\n\tfor (let i = 0; i < source.length; i++) {\n\t\tconst char = source.charCodeAt(i)\n\t\thash = (hash << 5) - hash + char\n\t\thash = hash & hash // Convert to 32-bit integer\n\t}\n\t// Add counter to ensure uniqueness even for identical functions\n\treturn (Math.abs(hash) + hashCounter++).toString(16)\n}\n\n/**\n * A fluent API for programmatically constructing a WorkflowBlueprint.\n */\nexport class Flow<\n\tTContext extends Record<string, any> = Record<string, any>,\n\tTDependencies extends Record<string, any> = Record<string, any>,\n> {\n\tprivate blueprint: Partial<WorkflowBlueprint>\n\tprivate functionRegistry: Map<string, NodeFunction | NodeClass>\n\tprivate loopControllerIds: Map<string, string>\n\tprivate loopDefinitions: Array<{\n\t\tid: string\n\t\tstartNodeId: string\n\t\tendNodeId: string\n\t\tcondition: string\n\t}>\n\tprivate batchDefinitions: Array<{\n\t\tid: string\n\t\tscatterId: string\n\t\tgatherId: string\n\t}>\n\tprivate cycleEntryPoints: Map<string, string>\n\n\tconstructor(id: string) {\n\t\tthis.blueprint = { id, nodes: [], edges: [] }\n\t\tthis.functionRegistry = new Map()\n\t\tthis.loopControllerIds = new Map()\n\t\tthis.loopDefinitions = []\n\t\tthis.batchDefinitions = []\n\t\tthis.cycleEntryPoints = new Map()\n\t}\n\n\tnode<TInput = any, TOutput = any, TAction extends string = string>(\n\t\tid: string,\n\t\timplementation:\n\t\t\t| NodeFunction<TContext, TDependencies, TInput, TOutput, TAction>\n\t\t\t| NodeClass<TContext, TDependencies, TInput, TOutput, TAction>,\n\t\toptions?: Omit<NodeDefinition, 'id' | 'uses'>,\n\t): this {\n\t\tlet usesKey: string\n\n\t\tif (isNodeClass(implementation)) {\n\t\t\tusesKey =\n\t\t\t\timplementation.name && implementation.name !== 'BaseNode'\n\t\t\t\t\t? implementation.name\n\t\t\t\t\t: `class_${_hashFunction(implementation)}`\n\t\t\tthis.functionRegistry.set(usesKey, implementation)\n\t\t} else {\n\t\t\tusesKey = `fn_${_hashFunction(implementation)}`\n\t\t\tthis.functionRegistry.set(usesKey, implementation as unknown as NodeFunction)\n\t\t}\n\n\t\tconst nodeDef: NodeDefinition = { id, uses: usesKey, ...options }\n\t\tthis.blueprint.nodes?.push(nodeDef)\n\t\treturn this\n\t}\n\n\tedge(source: string, target: string, options?: Omit<EdgeDefinition, 'source' | 'target'>): this {\n\t\tconst edgeDef: EdgeDefinition = { source, target, ...options }\n\t\tthis.blueprint.edges?.push(edgeDef)\n\t\treturn this\n\t}\n\n\t/**\n\t * Creates a batch processing pattern.\n\t * It takes an input array, runs a worker node on each item in parallel, and gathers the results.\n\t * This method augments the Flow's TContext with a new key for the output array.\n\t *\n\t * @param id The base ID for this batch operation.\n\t * @param worker The node implementation to run on each item.\n\t * @param options Configuration for the batch operation.\n\t * @returns The Flow instance with an updated context type for chaining.\n\t */\n\tbatch<TWorkerInput, TWorkerOutput, TWorkerAction extends string, TOutputKey extends string>(\n\t\tid: string,\n\t\tworker:\n\t\t\t| NodeFunction<TContext, TDependencies, TWorkerInput, TWorkerOutput, TWorkerAction>\n\t\t\t| NodeClass<TContext, TDependencies, TWorkerInput, TWorkerOutput, TWorkerAction>,\n\t\toptions: {\n\t\t\t/** The key in the context that holds the input array for the batch. */\n\t\t\tinputKey: keyof TContext\n\t\t\t/** The key in the context where the array of results will be stored. */\n\t\t\toutputKey: TOutputKey\n\t\t\t/** The number of items to process in each chunk to limit memory usage. */\n\t\t\tchunkSize?: number\n\t\t},\n\t): Flow<TContext & { [K in TOutputKey]: TWorkerOutput[] }, TDependencies> {\n\t\tconst { inputKey, outputKey } = options\n\t\tconst scatterId = `${id}_scatter`\n\t\tconst gatherId = `${id}_gather`\n\n\t\tthis.batchDefinitions.push({ id, scatterId, gatherId })\n\n\t\t// register worker implementation under a unique key.\n\t\tlet workerUsesKey: string\n\t\tif (isNodeClass(worker)) {\n\t\t\tworkerUsesKey =\n\t\t\t\tworker.name && worker.name !== 'BaseNode' ? worker.name : `class_batch_worker_${_hashFunction(worker)}`\n\t\t\tthis.functionRegistry.set(workerUsesKey, worker)\n\t\t} else {\n\t\t\tworkerUsesKey = `fn_batch_worker_${_hashFunction(worker)}`\n\t\t\tthis.functionRegistry.set(workerUsesKey, worker as unknown as NodeFunction)\n\t\t}\n\n\t\t// scatter node: takes an array and dynamically schedules worker nodes\n\t\tthis.blueprint.nodes?.push({\n\t\t\tid: scatterId,\n\t\t\tuses: 'batch-scatter', // built-in\n\t\t\tinputs: inputKey as string,\n\t\t\tparams: { workerUsesKey, outputKey: outputKey as string, gatherNodeId: gatherId, chunkSize: options.chunkSize },\n\t\t})\n\n\t\t// gather node: waits for all workers to finish and collects the results\n\t\tthis.blueprint.nodes?.push({\n\t\t\tid: gatherId,\n\t\t\tuses: 'batch-gather', // built-in\n\t\t\tparams: { outputKey, gatherNodeId: gatherId },\n\t\t\tconfig: { joinStrategy: 'all' }, // important: must wait for all scattered jobs\n\t\t})\n\n\t\t// edge to connect scatter and gather nodes, orchestrator will manage dynamic workers\n\t\tthis.edge(scatterId, gatherId)\n\n\t\treturn this as unknown as Flow<TContext & { [K in TOutputKey]: TWorkerOutput[] }, TDependencies>\n\t}\n\n\t/**\n\t * Creates a wait node that pauses workflow execution for external input.\n\t * @param id A unique identifier for the wait node.\n\t * @param options Optional configuration for the wait node.\n\t */\n\twait(id: string, options?: Omit<NodeDefinition, 'id' | 'uses'>): this {\n\t\tconst nodeDef: NodeDefinition = { id, uses: 'wait', ...options }\n\t\tthis.blueprint.nodes?.push(nodeDef)\n\t\treturn this\n\t}\n\n\t/**\n\t * Creates a loop pattern in the workflow graph.\n\t * @param id A unique identifier for the loop construct.\n\t * @param options Defines the start, end, and continuation condition of the loop.\n\t * @param options.startNodeId The ID of the first node inside the loop body.\n\t * @param options.endNodeId The ID of the last node inside the loop body.\n\t * @param options.condition An expression that, if true, causes the loop to run again.\n\t */\n\tloop(\n\t\tid: string,\n\t\toptions: {\n\t\t\t/** The ID of the first node inside the loop body. */\n\t\t\tstartNodeId: string\n\t\t\t/** The ID of the last node inside the loop body. */\n\t\t\tendNodeId: string\n\t\t\t/** An expression that, if true, causes the loop to run again. */\n\t\t\tcondition: string\n\t\t},\n\t): this {\n\t\tconst { startNodeId, endNodeId, condition } = options\n\t\tconst controllerId = `${id}-loop`\n\n\t\tthis.loopControllerIds.set(id, controllerId)\n\n\t\tthis.loopDefinitions.push({ id, startNodeId, endNodeId, condition })\n\n\t\t// controller node: evaluates the loop condition\n\t\tthis.blueprint.nodes?.push({\n\t\t\tid: controllerId,\n\t\t\tuses: 'loop-controller', // built-in\n\t\t\tparams: { condition },\n\t\t\tconfig: { joinStrategy: 'any' }, // to allow re-execution on each loop iteration\n\t\t})\n\n\t\tthis.edge(endNodeId, controllerId)\n\n\t\tthis.edge(controllerId, startNodeId, {\n\t\t\taction: 'continue',\n\t\t\ttransform: `context.${endNodeId}`, // pass the end node's value to the start node\n\t\t})\n\n\t\treturn this\n\t}\n\n\tgetLoopControllerId(id: string): string {\n\t\tconst controllerId = this.loopControllerIds.get(id)\n\t\tif (!controllerId) {\n\t\t\tthrow new Error(`Loop with id '${id}' not found. Ensure you have defined it using the .loop() method.`)\n\t\t}\n\t\treturn controllerId\n\t}\n\n\t/**\n\t * Sets the preferred entry point for a cycle in non-DAG workflows.\n\t * This helps remove ambiguity when the runtime needs to choose a starting node for cycles.\n\t * @param nodeId The ID of the node to use as the entry point for cycles containing this node.\n\t */\n\tsetCycleEntryPoint(nodeId: string): this {\n\t\tthis.cycleEntryPoints.set(nodeId, nodeId)\n\t\treturn this\n\t}\n\n\ttoBlueprint(): WorkflowBlueprint {\n\t\tif (!this.blueprint.nodes || this.blueprint.nodes.length === 0) {\n\t\t\tthrow new Error('Cannot build a blueprint with no nodes.')\n\t\t}\n\n\t\tconst finalEdges: EdgeDefinition[] = []\n\t\tconst processedOriginalEdges = new Set<EdgeDefinition>()\n\t\tconst allOriginalEdges = this.blueprint.edges || []\n\n\t\t// loop edge re-wiring\n\t\tfor (const loopDef of this.loopDefinitions) {\n\t\t\tconst controllerId = this.getLoopControllerId(loopDef.id)\n\t\t\tconst edgesToRewire = allOriginalEdges.filter((e) => e.source === loopDef.endNodeId && e.target !== controllerId)\n\t\t\tfor (const edge of edgesToRewire) {\n\t\t\t\tfinalEdges.push({ ...edge, source: controllerId, action: edge.action || 'break' })\n\t\t\t\tprocessedOriginalEdges.add(edge)\n\t\t\t}\n\t\t}\n\n\t\t// batch edge re-wiring\n\t\tfor (const batchDef of this.batchDefinitions) {\n\t\t\tconst incomingEdges = allOriginalEdges.filter((e) => e.target === batchDef.id)\n\t\t\tfor (const edge of incomingEdges) {\n\t\t\t\tfinalEdges.push({ ...edge, target: batchDef.scatterId })\n\t\t\t\tprocessedOriginalEdges.add(edge)\n\t\t\t}\n\n\t\t\tconst outgoingEdges = allOriginalEdges.filter((e) => e.source === batchDef.id)\n\t\t\tfor (const edge of outgoingEdges) {\n\t\t\t\tfinalEdges.push({ ...edge, source: batchDef.gatherId })\n\t\t\t\tprocessedOriginalEdges.add(edge)\n\t\t\t}\n\t\t}\n\n\t\t// all remaining edges\n\t\tfor (const edge of allOriginalEdges) {\n\t\t\tif (!processedOriginalEdges.has(edge)) {\n\t\t\t\tfinalEdges.push(edge)\n\t\t\t}\n\t\t}\n\t\tthis.blueprint.edges = finalEdges\n\n\t\tfor (const loopDef of this.loopDefinitions) {\n\t\t\tconst startNode = this.blueprint.nodes?.find((n) => n.id === loopDef.startNodeId)\n\t\t\tconst endNode = this.blueprint.nodes?.find((n) => n.id === loopDef.endNodeId)\n\n\t\t\tif (!startNode) {\n\t\t\t\tthrow new Error(`Loop '${loopDef.id}' references non-existent start node '${loopDef.startNodeId}'.`)\n\t\t\t}\n\t\t\tif (!endNode) {\n\t\t\t\tthrow new Error(`Loop '${loopDef.id}' references non-existent end node '${loopDef.endNodeId}'.`)\n\t\t\t}\n\n\t\t\tstartNode.config = { ...startNode.config, joinStrategy: 'any' }\n\t\t\tendNode.config = { ...endNode.config, joinStrategy: 'any' }\n\t\t}\n\n\t\tif (this.cycleEntryPoints.size > 0) {\n\t\t\tthis.blueprint.metadata = {\n\t\t\t\t...this.blueprint.metadata,\n\t\t\t\tcycleEntryPoints: Array.from(this.cycleEntryPoints.keys()),\n\t\t\t}\n\t\t}\n\n\t\treturn this.blueprint as WorkflowBlueprint\n\t}\n\n\tgetFunctionRegistry() {\n\t\treturn this.functionRegistry\n\t}\n\n\ttoGraphRepresentation(): UIGraph {\n\t\tconst blueprint = this.toBlueprint()\n\t\tconst uiNodes: UIGraph['nodes'] = []\n\t\tconst uiEdges: UIGraph['edges'] = []\n\n\t\tconst ignoredNodeIds = new Set<string>()\n\n\t\t// replace loop-controllers with direct, cyclical edges\n\t\tfor (const loopDef of this.loopDefinitions) {\n\t\t\tconst controllerId = this.loopControllerIds.get(loopDef.id)\n\t\t\tif (!controllerId) continue\n\n\t\t\tignoredNodeIds.add(controllerId)\n\n\t\t\t// direct edge from the end of loop to start\n\t\t\tuiEdges.push({\n\t\t\t\tsource: loopDef.endNodeId,\n\t\t\t\ttarget: loopDef.startNodeId,\n\t\t\t\tdata: {\n\t\t\t\t\tisLoopback: true,\n\t\t\t\t\tcondition: loopDef.condition,\n\t\t\t\t\tlabel: `continue if: ${loopDef.condition}`,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// re-wire any 'break' edges\n\t\t\tconst breakEdges = blueprint.edges.filter((edge) => edge.source === controllerId && edge.action === 'break')\n\t\t\tfor (const breakEdge of breakEdges) {\n\t\t\t\tuiEdges.push({\n\t\t\t\t\t...breakEdge,\n\t\t\t\t\tsource: loopDef.endNodeId,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// replace scatter/gather pairs with a single representative \"worker\" node\n\t\tconst scatterNodes = blueprint.nodes.filter((n) => n.uses === 'batch-scatter')\n\t\tfor (const scatterNode of scatterNodes) {\n\t\t\tconst gatherNodeId = scatterNode.params?.gatherNodeId\n\t\t\tif (!gatherNodeId) continue\n\n\t\t\tignoredNodeIds.add(scatterNode.id)\n\t\t\tignoredNodeIds.add(gatherNodeId)\n\n\t\t\t// single node to represent parallel work\n\t\t\tconst batchId = scatterNode.id.replace('_scatter', '')\n\t\t\tconst gatherNode = blueprint.nodes.find((n) => n.id === gatherNodeId)\n\n\t\t\tuiNodes.push({\n\t\t\t\tid: batchId,\n\t\t\t\tuses: scatterNode.params?.workerUsesKey,\n\t\t\t\ttype: 'batch-worker',\n\t\t\t\tdata: {\n\t\t\t\t\tlabel: `Batch: ${batchId}`,\n\t\t\t\t\tisBatchPlaceholder: true,\n\t\t\t\t\tworkerUsesKey: scatterNode.params?.workerUsesKey,\n\t\t\t\t\tinputKey: scatterNode.inputs,\n\t\t\t\t\toutputKey: gatherNode?.params?.outputKey,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// re-wire incoming edges\n\t\t\tconst incomingEdges = blueprint.edges.filter((e) => e.target === scatterNode.id)\n\t\t\tfor (const edge of incomingEdges) {\n\t\t\t\tuiEdges.push({ ...edge, target: batchId })\n\t\t\t}\n\n\t\t\t// re-wire outgoing edges\n\t\t\tconst outgoingEdges = blueprint.edges.filter((e) => e.source === gatherNodeId)\n\t\t\tfor (const edge of outgoingEdges) {\n\t\t\t\tuiEdges.push({ ...edge, source: batchId })\n\t\t\t}\n\t\t}\n\n\t\tfor (const node of blueprint.nodes) {\n\t\t\tif (!ignoredNodeIds.has(node.id)) {\n\t\t\t\tuiNodes.push(node)\n\t\t\t}\n\t\t}\n\n\t\tfor (const edge of blueprint.edges) {\n\t\t\tif (!ignoredNodeIds.has(edge.source) && !ignoredNodeIds.has(edge.target)) {\n\t\t\t\tconst alreadyAdded = uiEdges.some(\n\t\t\t\t\t(e) => e.source === edge.source && e.target === edge.target && e.action === edge.action,\n\t\t\t\t)\n\t\t\t\tif (!alreadyAdded) {\n\t\t\t\t\tuiEdges.push(edge)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { nodes: uiNodes, edges: uiEdges }\n\t}\n}\n\n/**\n * Helper function to create a new Flow builder instance.\n */\nexport function createFlow<\n\tTContext extends Record<string, any> = Record<string, any>,\n\tTDependencies extends Record<string, any> = Record<string, any>,\n>(id: string): Flow<TContext, TDependencies> {\n\treturn new Flow(id)\n}\n"]}
|
package/dist/chunk-CD3Q4N6V.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BaseNode } from './chunk-LNK7LZER.js';
|
|
2
|
-
|
|
3
|
-
// src/nodes/wait.ts
|
|
4
|
-
var WaitNode = class extends BaseNode {
|
|
5
|
-
async exec(_prepResult, context) {
|
|
6
|
-
context.dependencies.workflowState.markAsAwaiting(this.nodeId ?? "");
|
|
7
|
-
return { output: void 0 };
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { WaitNode };
|
|
12
|
-
//# sourceMappingURL=chunk-CD3Q4N6V.js.map
|
|
13
|
-
//# sourceMappingURL=chunk-CD3Q4N6V.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/nodes/wait.ts"],"names":[],"mappings":";;;AAGO,IAAM,QAAA,GAAN,cAAuB,QAAA,CAAS;AAAA,EACtC,MAAM,IAAA,CACL,WAAA,EACA,OAAA,EACqC;AACrC,IAAA,OAAA,CAAQ,YAAA,CAAa,aAAA,CAAc,cAAA,CAAe,IAAA,CAAK,UAAU,EAAE,CAAA;AACnE,IAAA,OAAO,EAAE,QAAQ,MAAA,EAAU;AAAA,EAC5B;AACD","file":"chunk-CD3Q4N6V.js","sourcesContent":["import { BaseNode } from '../node'\nimport type { NodeContext, NodeResult } from '../types'\n\nexport class WaitNode extends BaseNode {\n\tasync exec(\n\t\t_prepResult: any,\n\t\tcontext: NodeContext<Record<string, any>, any, any>,\n\t): Promise<Omit<NodeResult, 'error'>> {\n\t\tcontext.dependencies.workflowState.markAsAwaiting(this.nodeId ?? '')\n\t\treturn { output: undefined }\n\t}\n}\n"]}
|