@sonamu-kit/tasks 0.2.0 → 0.3.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.
Files changed (215) hide show
  1. package/.oxlintrc.json +3 -0
  2. package/AGENTS.md +21 -0
  3. package/dist/backend.d.ts +126 -107
  4. package/dist/backend.d.ts.map +1 -1
  5. package/dist/backend.js +4 -1
  6. package/dist/backend.js.map +1 -1
  7. package/dist/client.d.ts +145 -132
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +219 -213
  10. package/dist/client.js.map +1 -1
  11. package/dist/config.d.ts +15 -8
  12. package/dist/config.d.ts.map +1 -1
  13. package/dist/config.js +22 -17
  14. package/dist/config.js.map +1 -1
  15. package/dist/core/duration.d.ts +5 -4
  16. package/dist/core/duration.d.ts.map +1 -1
  17. package/dist/core/duration.js +54 -59
  18. package/dist/core/duration.js.map +1 -1
  19. package/dist/core/error.d.ts +10 -7
  20. package/dist/core/error.d.ts.map +1 -1
  21. package/dist/core/error.js +21 -21
  22. package/dist/core/error.js.map +1 -1
  23. package/dist/core/json.d.ts +8 -3
  24. package/dist/core/json.d.ts.map +1 -1
  25. package/dist/core/result.d.ts +10 -14
  26. package/dist/core/result.d.ts.map +1 -1
  27. package/dist/core/result.js +21 -16
  28. package/dist/core/result.js.map +1 -1
  29. package/dist/core/retry.d.ts +37 -31
  30. package/dist/core/retry.d.ts.map +1 -1
  31. package/dist/core/retry.js +44 -51
  32. package/dist/core/retry.js.map +1 -1
  33. package/dist/core/schema.d.ts +57 -53
  34. package/dist/core/schema.d.ts.map +1 -1
  35. package/dist/core/step.d.ts +28 -78
  36. package/dist/core/step.d.ts.map +1 -1
  37. package/dist/core/step.js +53 -63
  38. package/dist/core/step.js.map +1 -1
  39. package/dist/core/workflow.d.ts +33 -61
  40. package/dist/core/workflow.d.ts.map +1 -1
  41. package/dist/core/workflow.js +31 -41
  42. package/dist/core/workflow.js.map +1 -1
  43. package/dist/database/backend.d.ts +53 -46
  44. package/dist/database/backend.d.ts.map +1 -1
  45. package/dist/database/backend.js +544 -577
  46. package/dist/database/backend.js.map +1 -1
  47. package/dist/database/base.js +48 -25
  48. package/dist/database/base.js.map +1 -1
  49. package/dist/database/migrations/20251212000000_0_init.d.ts +10 -0
  50. package/dist/database/migrations/20251212000000_0_init.d.ts.map +1 -0
  51. package/dist/database/migrations/20251212000000_0_init.js +8 -4
  52. package/dist/database/migrations/20251212000000_0_init.js.map +1 -1
  53. package/dist/database/migrations/20251212000000_1_tables.d.ts +10 -0
  54. package/dist/database/migrations/20251212000000_1_tables.d.ts.map +1 -0
  55. package/dist/database/migrations/20251212000000_1_tables.js +81 -83
  56. package/dist/database/migrations/20251212000000_1_tables.js.map +1 -1
  57. package/dist/database/migrations/20251212000000_2_fk.d.ts +10 -0
  58. package/dist/database/migrations/20251212000000_2_fk.d.ts.map +1 -0
  59. package/dist/database/migrations/20251212000000_2_fk.js +20 -43
  60. package/dist/database/migrations/20251212000000_2_fk.js.map +1 -1
  61. package/dist/database/migrations/20251212000000_3_indexes.d.ts +10 -0
  62. package/dist/database/migrations/20251212000000_3_indexes.d.ts.map +1 -0
  63. package/dist/database/migrations/20251212000000_3_indexes.js +88 -102
  64. package/dist/database/migrations/20251212000000_3_indexes.js.map +1 -1
  65. package/dist/database/pubsub.d.ts +7 -16
  66. package/dist/database/pubsub.d.ts.map +1 -1
  67. package/dist/database/pubsub.js +75 -73
  68. package/dist/database/pubsub.js.map +1 -1
  69. package/dist/execution.d.ts +20 -59
  70. package/dist/execution.d.ts.map +1 -1
  71. package/dist/execution.js +175 -188
  72. package/dist/execution.js.map +1 -1
  73. package/dist/index.d.ts +5 -8
  74. package/dist/index.js +5 -5
  75. package/dist/internal.d.ts +12 -13
  76. package/dist/internal.js +4 -4
  77. package/dist/registry.d.ts +33 -27
  78. package/dist/registry.d.ts.map +1 -1
  79. package/dist/registry.js +58 -49
  80. package/dist/registry.js.map +1 -1
  81. package/dist/worker.d.ts +57 -50
  82. package/dist/worker.d.ts.map +1 -1
  83. package/dist/worker.js +194 -199
  84. package/dist/worker.js.map +1 -1
  85. package/dist/workflow.d.ts +26 -30
  86. package/dist/workflow.d.ts.map +1 -1
  87. package/dist/workflow.js +20 -15
  88. package/dist/workflow.js.map +1 -1
  89. package/nodemon.json +1 -1
  90. package/package.json +17 -19
  91. package/src/backend.ts +25 -9
  92. package/src/chaos.test.ts +3 -1
  93. package/src/client.test.ts +2 -0
  94. package/src/client.ts +30 -8
  95. package/src/config.test.ts +1 -0
  96. package/src/config.ts +3 -2
  97. package/src/core/duration.test.ts +2 -1
  98. package/src/core/duration.ts +1 -1
  99. package/src/core/error.test.ts +1 -0
  100. package/src/core/error.ts +1 -1
  101. package/src/core/result.test.ts +1 -0
  102. package/src/core/retry.test.ts +3 -2
  103. package/src/core/retry.ts +1 -1
  104. package/src/core/schema.ts +2 -2
  105. package/src/core/step.test.ts +2 -1
  106. package/src/core/step.ts +4 -3
  107. package/src/core/workflow.test.ts +2 -1
  108. package/src/core/workflow.ts +4 -3
  109. package/src/database/backend.test.ts +1 -0
  110. package/src/database/backend.testsuite.ts +44 -40
  111. package/src/database/backend.ts +207 -25
  112. package/src/database/base.test.ts +41 -0
  113. package/src/database/base.ts +51 -2
  114. package/src/database/migrations/20251212000000_0_init.ts +2 -1
  115. package/src/database/migrations/20251212000000_1_tables.ts +2 -1
  116. package/src/database/migrations/20251212000000_2_fk.ts +2 -1
  117. package/src/database/migrations/20251212000000_3_indexes.ts +2 -1
  118. package/src/database/pubsub.test.ts +6 -3
  119. package/src/database/pubsub.ts +55 -33
  120. package/src/execution.test.ts +2 -0
  121. package/src/execution.ts +49 -10
  122. package/src/internal.ts +15 -15
  123. package/src/practices/01-remote-workflow.ts +1 -0
  124. package/src/registry.test.ts +1 -0
  125. package/src/registry.ts +1 -1
  126. package/src/testing/connection.ts +3 -1
  127. package/src/worker.test.ts +2 -0
  128. package/src/worker.ts +30 -9
  129. package/src/workflow.test.ts +1 -0
  130. package/src/workflow.ts +3 -3
  131. package/templates/openworkflow.config.ts +2 -1
  132. package/tsdown.config.ts +31 -0
  133. package/.swcrc +0 -17
  134. package/dist/chaos.test.d.ts +0 -2
  135. package/dist/chaos.test.d.ts.map +0 -1
  136. package/dist/chaos.test.js +0 -92
  137. package/dist/chaos.test.js.map +0 -1
  138. package/dist/client.test.d.ts +0 -2
  139. package/dist/client.test.d.ts.map +0 -1
  140. package/dist/client.test.js +0 -340
  141. package/dist/client.test.js.map +0 -1
  142. package/dist/config.test.d.ts +0 -2
  143. package/dist/config.test.d.ts.map +0 -1
  144. package/dist/config.test.js +0 -24
  145. package/dist/config.test.js.map +0 -1
  146. package/dist/core/duration.test.d.ts +0 -2
  147. package/dist/core/duration.test.d.ts.map +0 -1
  148. package/dist/core/duration.test.js +0 -265
  149. package/dist/core/duration.test.js.map +0 -1
  150. package/dist/core/error.test.d.ts +0 -2
  151. package/dist/core/error.test.d.ts.map +0 -1
  152. package/dist/core/error.test.js +0 -63
  153. package/dist/core/error.test.js.map +0 -1
  154. package/dist/core/json.js +0 -3
  155. package/dist/core/json.js.map +0 -1
  156. package/dist/core/result.test.d.ts +0 -2
  157. package/dist/core/result.test.d.ts.map +0 -1
  158. package/dist/core/result.test.js +0 -19
  159. package/dist/core/result.test.js.map +0 -1
  160. package/dist/core/retry.test.d.ts +0 -2
  161. package/dist/core/retry.test.d.ts.map +0 -1
  162. package/dist/core/retry.test.js +0 -198
  163. package/dist/core/retry.test.js.map +0 -1
  164. package/dist/core/schema.js +0 -4
  165. package/dist/core/schema.js.map +0 -1
  166. package/dist/core/step.test.d.ts +0 -2
  167. package/dist/core/step.test.d.ts.map +0 -1
  168. package/dist/core/step.test.js +0 -356
  169. package/dist/core/step.test.js.map +0 -1
  170. package/dist/core/workflow.test.d.ts +0 -2
  171. package/dist/core/workflow.test.d.ts.map +0 -1
  172. package/dist/core/workflow.test.js +0 -172
  173. package/dist/core/workflow.test.js.map +0 -1
  174. package/dist/database/backend.test.d.ts +0 -2
  175. package/dist/database/backend.test.d.ts.map +0 -1
  176. package/dist/database/backend.test.js +0 -19
  177. package/dist/database/backend.test.js.map +0 -1
  178. package/dist/database/backend.testsuite.d.ts +0 -20
  179. package/dist/database/backend.testsuite.d.ts.map +0 -1
  180. package/dist/database/backend.testsuite.js +0 -1280
  181. package/dist/database/backend.testsuite.js.map +0 -1
  182. package/dist/database/base.d.ts +0 -12
  183. package/dist/database/base.d.ts.map +0 -1
  184. package/dist/database/pubsub.test.d.ts +0 -2
  185. package/dist/database/pubsub.test.d.ts.map +0 -1
  186. package/dist/database/pubsub.test.js +0 -86
  187. package/dist/database/pubsub.test.js.map +0 -1
  188. package/dist/execution.test.d.ts +0 -2
  189. package/dist/execution.test.d.ts.map +0 -1
  190. package/dist/execution.test.js +0 -662
  191. package/dist/execution.test.js.map +0 -1
  192. package/dist/index.d.ts.map +0 -1
  193. package/dist/index.js.map +0 -1
  194. package/dist/internal.d.ts.map +0 -1
  195. package/dist/internal.js.map +0 -1
  196. package/dist/practices/01-remote-workflow.d.ts +0 -2
  197. package/dist/practices/01-remote-workflow.d.ts.map +0 -1
  198. package/dist/practices/01-remote-workflow.js +0 -70
  199. package/dist/practices/01-remote-workflow.js.map +0 -1
  200. package/dist/registry.test.d.ts +0 -2
  201. package/dist/registry.test.d.ts.map +0 -1
  202. package/dist/registry.test.js +0 -95
  203. package/dist/registry.test.js.map +0 -1
  204. package/dist/testing/connection.d.ts +0 -7
  205. package/dist/testing/connection.d.ts.map +0 -1
  206. package/dist/testing/connection.js +0 -39
  207. package/dist/testing/connection.js.map +0 -1
  208. package/dist/worker.test.d.ts +0 -2
  209. package/dist/worker.test.d.ts.map +0 -1
  210. package/dist/worker.test.js +0 -1164
  211. package/dist/worker.test.js.map +0 -1
  212. package/dist/workflow.test.d.ts +0 -2
  213. package/dist/workflow.test.d.ts.map +0 -1
  214. package/dist/workflow.test.js +0 -73
  215. package/dist/workflow.test.js.map +0 -1
package/dist/client.d.ts CHANGED
@@ -1,99 +1,101 @@
1
- import type { Backend } from "./backend";
2
- import type { StandardSchemaV1 } from "./core/schema";
3
- import type { SchemaInput, SchemaOutput, WorkflowRun } from "./core/workflow";
4
- import type { WorkflowFunction } from "./execution";
5
- import { Worker } from "./worker";
6
- import { defineWorkflowSpec, type Workflow, type WorkflowSpec } from "./workflow";
1
+ import { StandardSchemaV1 } from "./core/schema.js";
2
+ import { SchemaInput, SchemaOutput, WorkflowRun } from "./core/workflow.js";
3
+ import { Backend } from "./backend.js";
4
+ import { WorkflowFunction } from "./execution.js";
5
+ import { Workflow, WorkflowSpec, defineWorkflowSpec } from "./workflow.js";
6
+ import { Worker } from "./worker.js";
7
+
8
+ //#region src/client.d.ts
7
9
  type WorkflowHandlerInput<TSchema, Input> = SchemaOutput<TSchema, Input>;
8
10
  type WorkflowRunInput<TSchema, Input> = SchemaInput<TSchema, Input>;
9
11
  /**
10
12
  * Options for the OpenWorkflow client.
11
13
  */
12
- export interface OpenWorkflowOptions {
13
- backend: Backend;
14
+ interface OpenWorkflowOptions {
15
+ backend: Backend;
14
16
  }
15
17
  /**
16
18
  * Client used to register workflows and start runs.
17
19
  */
18
- export declare class OpenWorkflow {
19
- private backend;
20
- private registry;
21
- constructor(options: OpenWorkflowOptions);
22
- /**
23
- * Create a new Worker with this client's backend and workflows.
24
- * @param options - Worker options
25
- * @param options.concurrency - Max concurrent workflow runs
26
- * @returns Worker instance
27
- */
28
- newWorker(options?: {
29
- concurrency?: number | undefined;
30
- usePubSub?: boolean;
31
- listenDelay?: number;
32
- }): Worker;
33
- /**
34
- * Provide the implementation for a declared workflow. This links the workflow
35
- * specification to its execution logic and registers it with this
36
- * OpenWorkflow instance for worker execution.
37
- * @param spec - Workflow spec
38
- * @param fn - Workflow implementation
39
- */
40
- implementWorkflow<Input, Output, RunInput = Input>(spec: WorkflowSpec<Input, Output, RunInput>, fn: WorkflowFunction<Input, Output>): void;
41
- /**
42
- * Run a workflow from its specification. This is the primary way to schedule
43
- * a workflow using only its WorkflowSpec.
44
- * @param spec - Workflow spec
45
- * @param input - Workflow input
46
- * @param options - Run options
47
- * @returns Handle for awaiting the result
48
- * @example
49
- * ```ts
50
- * const handle = await ow.runWorkflow(emailWorkflow, { to: 'user@example.com' });
51
- * const result = await handle.result();
52
- * ```
53
- */
54
- runWorkflow<Input, Output, RunInput = Input>(spec: WorkflowSpec<Input, Output, RunInput>, input?: RunInput, options?: WorkflowRunOptions): Promise<WorkflowRunHandle<Output>>;
55
- /**
56
- * Define and register a new workflow.
57
- *
58
- * This is a convenience method that combines `declareWorkflow` and
59
- * `implementWorkflow` into a single call. For better code splitting and to
60
- * separate declaration from implementation, consider using those methods
61
- * separately.
62
- * @param config - Workflow config
63
- * @param fn - Workflow implementation
64
- * @returns Runnable workflow
65
- * @example
66
- * ```ts
67
- * const workflow = ow.defineWorkflow(
68
- * { name: 'my-workflow' },
69
- * async ({ input, step }) => {
70
- * // workflow implementation
71
- * },
72
- * );
73
- * ```
74
- */
75
- defineWorkflow<Input, Output, TSchema extends StandardSchemaV1 | undefined = undefined>(spec: WorkflowSpec<WorkflowHandlerInput<TSchema, Input>, Output, WorkflowRunInput<TSchema, Input>>, fn: WorkflowFunction<WorkflowHandlerInput<TSchema, Input>, Output>): RunnableWorkflow<WorkflowHandlerInput<TSchema, Input>, Output, WorkflowRunInput<TSchema, Input>>;
76
- /**
77
- * Unregister a workflow from the registry.
78
- * @param name - The workflow name
79
- * @param version - The workflow version (null for unversioned)
80
- * @example
81
- * ```ts
82
- * ow.unregisterWorkflow("my-workflow", "v1");
83
- * ```
84
- */
85
- unregisterWorkflow(name: string, version: string | null): void;
86
- /**
87
- * Check if a workflow is registered in the registry.
88
- * @param name - The workflow name
89
- * @param version - The workflow version (null for unversioned)
90
- * @returns True if the workflow is registered, false otherwise
91
- * @example
92
- * ```ts
93
- * ow.isWorkflowRegistered("my-workflow", "v1");
94
- * ```
95
- */
96
- isWorkflowRegistered(name: string, version: string | null): boolean;
20
+ declare class OpenWorkflow {
21
+ private backend;
22
+ private registry;
23
+ constructor(options: OpenWorkflowOptions);
24
+ /**
25
+ * Create a new Worker with this client's backend and workflows.
26
+ * @param options - Worker options
27
+ * @param options.concurrency - Max concurrent workflow runs
28
+ * @returns Worker instance
29
+ */
30
+ newWorker(options?: {
31
+ concurrency?: number | undefined;
32
+ usePubSub?: boolean;
33
+ listenDelay?: number;
34
+ }): Worker;
35
+ /**
36
+ * Provide the implementation for a declared workflow. This links the workflow
37
+ * specification to its execution logic and registers it with this
38
+ * OpenWorkflow instance for worker execution.
39
+ * @param spec - Workflow spec
40
+ * @param fn - Workflow implementation
41
+ */
42
+ implementWorkflow<Input, Output, RunInput = Input>(spec: WorkflowSpec<Input, Output, RunInput>, fn: WorkflowFunction<Input, Output>): void;
43
+ /**
44
+ * Run a workflow from its specification. This is the primary way to schedule
45
+ * a workflow using only its WorkflowSpec.
46
+ * @param spec - Workflow spec
47
+ * @param input - Workflow input
48
+ * @param options - Run options
49
+ * @returns Handle for awaiting the result
50
+ * @example
51
+ * ```ts
52
+ * const handle = await ow.runWorkflow(emailWorkflow, { to: 'user@example.com' });
53
+ * const result = await handle.result();
54
+ * ```
55
+ */
56
+ runWorkflow<Input, Output, RunInput = Input>(spec: WorkflowSpec<Input, Output, RunInput>, input?: RunInput, options?: WorkflowRunOptions): Promise<WorkflowRunHandle<Output>>;
57
+ /**
58
+ * Define and register a new workflow.
59
+ *
60
+ * This is a convenience method that combines `declareWorkflow` and
61
+ * `implementWorkflow` into a single call. For better code splitting and to
62
+ * separate declaration from implementation, consider using those methods
63
+ * separately.
64
+ * @param config - Workflow config
65
+ * @param fn - Workflow implementation
66
+ * @returns Runnable workflow
67
+ * @example
68
+ * ```ts
69
+ * const workflow = ow.defineWorkflow(
70
+ * { name: 'my-workflow' },
71
+ * async ({ input, step }) => {
72
+ * // workflow implementation
73
+ * },
74
+ * );
75
+ * ```
76
+ */
77
+ defineWorkflow<Input, Output, TSchema extends StandardSchemaV1 | undefined = undefined>(spec: WorkflowSpec<WorkflowHandlerInput<TSchema, Input>, Output, WorkflowRunInput<TSchema, Input>>, fn: WorkflowFunction<WorkflowHandlerInput<TSchema, Input>, Output>): RunnableWorkflow<WorkflowHandlerInput<TSchema, Input>, Output, WorkflowRunInput<TSchema, Input>>;
78
+ /**
79
+ * Unregister a workflow from the registry.
80
+ * @param name - The workflow name
81
+ * @param version - The workflow version (null for unversioned)
82
+ * @example
83
+ * ```ts
84
+ * ow.unregisterWorkflow("my-workflow", "v1");
85
+ * ```
86
+ */
87
+ unregisterWorkflow(name: string, version: string | null): void;
88
+ /**
89
+ * Check if a workflow is registered in the registry.
90
+ * @param name - The workflow name
91
+ * @param version - The workflow version (null for unversioned)
92
+ * @returns True if the workflow is registered, false otherwise
93
+ * @example
94
+ * ```ts
95
+ * ow.isWorkflowRegistered("my-workflow", "v1");
96
+ * ```
97
+ */
98
+ isWorkflowRegistered(name: string, version: string | null): boolean;
97
99
  }
98
100
  /**
99
101
  * Declare a workflow without providing its implementation (which is provided
@@ -109,69 +111,80 @@ export declare class OpenWorkflow {
109
111
  * });
110
112
  * ```
111
113
  */
112
- export declare const declareWorkflow: typeof defineWorkflowSpec;
114
+ declare const declareWorkflow: typeof defineWorkflowSpec;
113
115
  /**
114
116
  * A fully defined workflow with its implementation. This class is returned by
115
117
  * `defineWorkflow` and provides the `.run()` method for scheduling workflow
116
118
  * runs.
117
119
  */
118
- export declare class RunnableWorkflow<Input, Output, RunInput = Input> {
119
- private readonly ow;
120
- readonly workflow: Workflow<Input, Output, RunInput>;
121
- constructor(ow: OpenWorkflow, workflow: Workflow<Input, Output, RunInput>);
122
- /**
123
- * Starts a new workflow run.
124
- * @param input - Workflow input
125
- * @param options - Run options
126
- * @returns Workflow run handle
127
- */
128
- run(input?: RunInput, options?: WorkflowRunOptions): Promise<WorkflowRunHandle<Output>>;
120
+ declare class RunnableWorkflow<Input, Output, RunInput = Input> {
121
+ private readonly ow;
122
+ readonly workflow: Workflow<Input, Output, RunInput>;
123
+ constructor(ow: OpenWorkflow, workflow: Workflow<Input, Output, RunInput>);
124
+ /**
125
+ * Starts a new workflow run.
126
+ * @param input - Workflow input
127
+ * @param options - Run options
128
+ * @returns Workflow run handle
129
+ */
130
+ run(input?: RunInput, options?: WorkflowRunOptions): Promise<WorkflowRunHandle<Output>>;
129
131
  }
130
132
  /**
131
133
  * Options for creating a new workflow run from a runnable workflow when calling
132
134
  * `workflow.run()`.
133
135
  */
134
- export interface WorkflowRunOptions {
135
- /**
136
- * Set a deadline for the workflow run. If the workflow exceeds this deadline,
137
- * it will be marked as failed.
138
- */
139
- deadlineAt?: Date;
140
- /**
141
- * Publish when the workflow run is created to the channel.
142
- * Default: true
143
- */
144
- publishToChannel?: boolean;
136
+ interface WorkflowRunOptions {
137
+ /**
138
+ * Set a deadline for the workflow run. If the workflow exceeds this deadline,
139
+ * it will be marked as failed.
140
+ */
141
+ deadlineAt?: Date;
142
+ /**
143
+ * Publish when the workflow run is created to the channel.
144
+ * Default: true
145
+ */
146
+ publishToChannel?: boolean;
145
147
  }
146
148
  /**
147
149
  * Options for WorkflowHandle.
148
150
  */
149
- export interface WorkflowHandleOptions {
150
- backend: Backend;
151
- workflowRun: WorkflowRun;
152
- resultPollIntervalMs: number;
153
- resultTimeoutMs: number;
151
+ interface WorkflowHandleOptions {
152
+ backend: Backend;
153
+ workflowRun: WorkflowRun;
154
+ resultPollIntervalMs: number;
155
+ resultTimeoutMs: number;
154
156
  }
155
157
  /**
156
158
  * Represents a started workflow run and provides methods to await its result.
157
159
  * Returned from `workflowDef.run()`.
158
160
  */
159
- export declare class WorkflowRunHandle<Output> {
160
- private backend;
161
- readonly workflowRun: WorkflowRun;
162
- private resultPollIntervalMs;
163
- private resultTimeoutMs;
164
- constructor(options: WorkflowHandleOptions);
165
- /**
166
- * Waits for the workflow run to complete and returns the result.
167
- * @returns Workflow output
168
- */
169
- result(): Promise<Output>;
170
- /**
171
- * Cancels the workflow run. Only workflows in pending, running, or sleeping
172
- * status can be canceled.
173
- */
174
- cancel(): Promise<void>;
161
+ declare class WorkflowRunHandle<Output> {
162
+ private backend;
163
+ readonly workflowRun: WorkflowRun;
164
+ private resultPollIntervalMs;
165
+ private resultTimeoutMs;
166
+ constructor(options: WorkflowHandleOptions);
167
+ /**
168
+ * Waits for the workflow run to complete and returns the result.
169
+ * @returns Workflow output
170
+ */
171
+ result(): Promise<Output>;
172
+ /**
173
+ * Cancels the workflow run. Only workflows in pending, running, sleeping,
174
+ * or paused status can be canceled.
175
+ */
176
+ cancel(): Promise<void>;
177
+ /**
178
+ * Pauses the workflow run. Only workflows in pending, running, or sleeping
179
+ * status can be paused.
180
+ */
181
+ pause(): Promise<void>;
182
+ /**
183
+ * Resumes a paused workflow run. Sets the status back to pending so that
184
+ * a worker can reclaim it.
185
+ */
186
+ resume(): Promise<void>;
175
187
  }
176
- export {};
188
+ //#endregion
189
+ export { OpenWorkflow, OpenWorkflowOptions, RunnableWorkflow, WorkflowHandleOptions, WorkflowRunHandle, WorkflowRunOptions, declareWorkflow };
177
190
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAsB,MAAM,UAAU,CAAC;AACtD,OAAO,EAAkB,kBAAkB,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAMlG,KAAK,oBAAoB,CAAC,OAAO,EAAE,KAAK,IAAI,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAGzE,KA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