@usehelical/workflows 0.0.1-alpha.3 → 0.0.1-alpha.4
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/dist/workflows.d.ts +26 -2
- package/dist/workflows.js +1 -0
- package/package.json +2 -1
package/dist/workflows.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { S as StateDefinition, M as MessageDefinition } from './state-CmpqDrnz.js';
|
|
2
|
+
export { b as QueueDefinition, Q as QueueEntry, c as QueueOptions, d as QueueRateLimit, e as WorkflowDefinition, a as WorkflowEntry, f as WorkflowFunction, W as WorkflowStatus, g as defineMessage, h as defineQueue, i as defineState, j as defineWorkflow } from './state-CmpqDrnz.js';
|
|
2
3
|
|
|
3
4
|
type RetryConfig = {
|
|
4
5
|
maxRetries?: number;
|
|
@@ -16,4 +17,27 @@ type StepDefinition<TArgs extends unknown[], TReturn> = {
|
|
|
16
17
|
};
|
|
17
18
|
declare function defineStep<TArgs extends unknown[], TReturn>(fn: StepFunction<TArgs, TReturn>, options?: StepOptions): (...args: TArgs) => StepDefinition<TArgs, TReturn>;
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
declare function runStep<TArgs extends unknown[], TReturn>(step: StepDefinition<TArgs, TReturn>): Promise<TReturn | (TReturn extends void ? void : TReturn)>;
|
|
21
|
+
declare function executeStepWithRetries<TArgs extends unknown[], TReturn>(stepName: string, fn: StepFunction<TArgs, TReturn>, args: TArgs, retryConfig: RetryConfig): Promise<TReturn>;
|
|
22
|
+
|
|
23
|
+
declare function setState<T = unknown>(state: StateDefinition<T> | string, value: T): Promise<void | (T extends void ? void : T)>;
|
|
24
|
+
|
|
25
|
+
declare function receiveMessage<T>(message: MessageDefinition<T> | string): Promise<T>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Generates a stable, unique step ID based on the current run ID and sequence ID.
|
|
29
|
+
* This ID is deterministic and will remain the same across retries, making it
|
|
30
|
+
* suitable for use as an idempotency key with third-party systems.
|
|
31
|
+
*
|
|
32
|
+
* The step ID is a SHA-256 hash of the run ID and sequence ID, formatted as a
|
|
33
|
+
* hex string for easy use with external APIs.
|
|
34
|
+
*
|
|
35
|
+
* @returns A unique, stable identifier for the current step execution
|
|
36
|
+
*/
|
|
37
|
+
declare function getStepId(): string;
|
|
38
|
+
|
|
39
|
+
declare function getAbortSignal(): AbortSignal;
|
|
40
|
+
|
|
41
|
+
declare function getRunId(): string;
|
|
42
|
+
|
|
43
|
+
export { MessageDefinition, type RetryConfig, StateDefinition, type StepDefinition, type StepFunction, defineStep, executeStepWithRetries, getAbortSignal, getRunId, getStepId, receiveMessage, runStep, setState };
|
package/dist/workflows.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usehelical/workflows",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.4",
|
|
4
4
|
"description": "simple typesage durable workflows without magic",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@electric-sql/pglite": "^0.3.15",
|
|
42
42
|
"@eslint/js": "^9.39.2",
|
|
43
|
+
"@types/node": "^25.2.0",
|
|
43
44
|
"@types/pg": "^8.16.0",
|
|
44
45
|
"@vitest/coverage-v8": "^4.0.18",
|
|
45
46
|
"eslint": "^9.39.2",
|