@usehelical/workflows 0.0.1-alpha.4 → 0.0.1-alpha.6
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/index.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import { W as
|
|
2
|
-
|
|
3
|
-
interface Run<TReturn = unknown> {
|
|
4
|
-
id: string;
|
|
5
|
-
status: () => Promise<WorkflowStatus>;
|
|
6
|
-
result: () => Promise<TReturn>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
type RunWorkflowOptions = {
|
|
10
|
-
timeout?: number;
|
|
11
|
-
deadline?: number;
|
|
12
|
-
};
|
|
1
|
+
import { W as WorkflowEntry, Q as QueueEntry, R as RunWorkflowOptions, a as Run, M as MessageDefinition, S as StateDefinition } from './state-DmLPhezR.js';
|
|
13
2
|
|
|
14
3
|
type QueueWorkflowOptions = {
|
|
15
4
|
timeout?: number;
|
|
@@ -24,7 +13,7 @@ type CreateInstanceOptions = {
|
|
|
24
13
|
connectionString: string;
|
|
25
14
|
};
|
|
26
15
|
type CreateInstanceParams = {
|
|
27
|
-
workflows: Record<string, WorkflowEntry
|
|
16
|
+
workflows: Record<string, WorkflowEntry<any, any>>;
|
|
28
17
|
queues?: Record<string, QueueEntry>;
|
|
29
18
|
options: CreateInstanceOptions;
|
|
30
19
|
};
|
|
@@ -34,6 +34,17 @@ declare function defineWorkflow<TArgs extends unknown[], TReturn>(fn: WorkflowFu
|
|
|
34
34
|
}): () => WorkflowDefinition<TArgs, TReturn>;
|
|
35
35
|
type WorkflowEntry<TArgs extends unknown[] = unknown[], TReturn = unknown> = () => WorkflowDefinition<TArgs, TReturn>;
|
|
36
36
|
|
|
37
|
+
interface Run<TReturn = unknown> {
|
|
38
|
+
id: string;
|
|
39
|
+
status: () => Promise<WorkflowStatus>;
|
|
40
|
+
result: () => Promise<TReturn>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type RunWorkflowOptions = {
|
|
44
|
+
timeout?: number;
|
|
45
|
+
deadline?: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
37
48
|
type MessageDefinition<T> = {
|
|
38
49
|
name: string;
|
|
39
50
|
data?: T;
|
|
@@ -46,4 +57,4 @@ interface StateDefinition<T> {
|
|
|
46
57
|
}
|
|
47
58
|
declare function defineState<T>(name: string): StateDefinition<T>;
|
|
48
59
|
|
|
49
|
-
export { type MessageDefinition as M, type QueueEntry as Q, type StateDefinition as S,
|
|
60
|
+
export { type MessageDefinition as M, type QueueEntry as Q, type RunWorkflowOptions as R, type StateDefinition as S, type WorkflowEntry as W, type Run as a, type QueueDefinition as b, type QueueOptions as c, type QueueRateLimit as d, type WorkflowDefinition as e, type WorkflowFunction as f, WorkflowStatus as g, defineMessage as h, defineQueue as i, defineState as j, defineWorkflow as k };
|
package/dist/workflows.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as StateDefinition, M as MessageDefinition } from './state-
|
|
2
|
-
export { b as QueueDefinition, Q as QueueEntry, c as QueueOptions, d as QueueRateLimit, e as WorkflowDefinition,
|
|
1
|
+
import { S as StateDefinition, M as MessageDefinition, W as WorkflowEntry, R as RunWorkflowOptions, a as Run } from './state-DmLPhezR.js';
|
|
2
|
+
export { b as QueueDefinition, Q as QueueEntry, c as QueueOptions, d as QueueRateLimit, e as WorkflowDefinition, f as WorkflowFunction, g as WorkflowStatus, h as defineMessage, i as defineQueue, j as defineState, k as defineWorkflow } from './state-DmLPhezR.js';
|
|
3
3
|
|
|
4
4
|
type RetryConfig = {
|
|
5
5
|
maxRetries?: number;
|
|
@@ -20,7 +20,7 @@ declare function defineStep<TArgs extends unknown[], TReturn>(fn: StepFunction<T
|
|
|
20
20
|
declare function runStep<TArgs extends unknown[], TReturn>(step: StepDefinition<TArgs, TReturn>): Promise<TReturn | (TReturn extends void ? void : TReturn)>;
|
|
21
21
|
declare function executeStepWithRetries<TArgs extends unknown[], TReturn>(stepName: string, fn: StepFunction<TArgs, TReturn>, args: TArgs, retryConfig: RetryConfig): Promise<TReturn>;
|
|
22
22
|
|
|
23
|
-
declare function setState<T = unknown>(state: StateDefinition<T> | string, value: T): Promise<void
|
|
23
|
+
declare function setState<T = unknown>(state: StateDefinition<T> | string, value: T): Promise<void>;
|
|
24
24
|
|
|
25
25
|
declare function receiveMessage<T>(message: MessageDefinition<T> | string): Promise<T>;
|
|
26
26
|
|
|
@@ -40,4 +40,11 @@ declare function getAbortSignal(): AbortSignal;
|
|
|
40
40
|
|
|
41
41
|
declare function getRunId(): string;
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
declare function sleep(ms: number): Promise<void>;
|
|
44
|
+
declare function cancellableSleep(ms: number, signal?: AbortSignal): Promise<void>;
|
|
45
|
+
|
|
46
|
+
declare function randomUUID(): Promise<string | undefined>;
|
|
47
|
+
|
|
48
|
+
declare function runWorkflow<TArgs extends unknown[], TReturn>(wf: WorkflowEntry<TArgs, TReturn> | string, args?: TArgs, options?: RunWorkflowOptions): Promise<Run<TReturn>>;
|
|
49
|
+
|
|
50
|
+
export { MessageDefinition, type RetryConfig, StateDefinition, type StepDefinition, type StepFunction, WorkflowEntry, cancellableSleep, defineStep, executeStepWithRetries, getAbortSignal, getRunId, getStepId, randomUUID, receiveMessage, runStep, runWorkflow, setState, sleep };
|