@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/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@sonamu-kit/tasks",
3
- "version": "0.2.0",
4
- "type": "module",
3
+ "version": "0.3.0",
5
4
  "description": "Sonamu Task - Simple & Distributed Task Queue",
5
+ "author": "CartaNova <dev@cartanova.ai>",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/cartanova-ai/sonamu.git"
9
+ },
10
+ "type": "module",
6
11
  "main": "./dist/index.js",
7
12
  "exports": {
8
13
  ".": {
@@ -16,12 +21,8 @@
16
21
  "development": "./src/internal.ts"
17
22
  }
18
23
  },
19
- "author": "CartaNova <dev@cartanova.ai>",
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/cartanova-ai/sonamu.git"
23
- },
24
24
  "dependencies": {
25
+ "c12": "^3.3.2",
25
26
  "date-fns": "^4.1.0",
26
27
  "date-fns-tz": "^3.2.0",
27
28
  "inflection": "^3.0.2",
@@ -30,33 +31,30 @@
30
31
  "pg": "^8.16.3",
31
32
  "rou3": "^0.7.10",
32
33
  "uuid": "^13.0.0",
33
- "zod": "^4.1.12",
34
- "c12": "^3.3.2"
34
+ "zod": "^4.3.6"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/inflection": "^2.0.0",
38
- "@biomejs/biome": "^2.3.10",
39
- "@swc/cli": "^0.7.8",
40
- "@swc/core": "^1.13.5",
41
38
  "@types/node": "25.0.7",
42
39
  "nodemon": "^3.1.10",
40
+ "tsdown": "^0.12.5",
43
41
  "tsx": "^4.20.6",
44
- "typescript": "^5.9.3",
45
- "vitest": "^4.0.10"
42
+ "typescript": "^6.0.0",
43
+ "vitest": "^4.1.2"
46
44
  },
47
45
  "peerDependencies": {
48
- "knex": "^3.1.0",
49
- "@logtape/logtape": "2.0.0"
46
+ "@logtape/logtape": "2.0.0",
47
+ "knex": "^3.1.0"
50
48
  },
51
49
  "optionalDependencies": {
52
50
  "pg-native": "^3.5.2"
53
51
  },
54
52
  "scripts": {
55
53
  "dev": "nodemon exec",
56
- "build": "swc src --config-file .swcrc -d dist --strip-leading-paths && tsc --emitDeclarationOnly",
57
- "check": "tsc --noEmit && biome format --write ./src/**/*.ts",
54
+ "build": "tsdown",
55
+ "check": "tsc --noEmit && oxlint src && oxfmt --check src",
58
56
  "check:type": "tsc --noEmit",
59
- "check:format": "biome format --write ./src/**/*.ts",
57
+ "check:format": "oxfmt src",
60
58
  "pretest": "tsx scripts/migrate.ts",
61
59
  "test": "vitest run",
62
60
  "test:watch": "vitest watch --standalone",
package/src/backend.ts CHANGED
@@ -1,9 +1,9 @@
1
- import type { SerializedError } from "./core/error";
2
- import type { JsonValue } from "./core/json";
3
- import type { SerializableRetryPolicy } from "./core/retry";
4
- import type { StepAttempt, StepAttemptContext, StepKind } from "./core/step";
5
- import type { WorkflowRun } from "./core/workflow";
6
- import type { OnSubscribed } from "./database/pubsub";
1
+ import { type SerializedError } from "./core/error";
2
+ import { type JsonValue } from "./core/json";
3
+ import { type SerializableRetryPolicy } from "./core/retry";
4
+ import { type StepAttempt, type StepAttemptContext, type StepKind } from "./core/step";
5
+ import { type WorkflowRun } from "./core/workflow";
6
+ import { type OnSubscribed } from "./database/pubsub";
7
7
 
8
8
  export const DEFAULT_NAMESPACE_ID = "default";
9
9
 
@@ -27,6 +27,8 @@ export interface Backend {
27
27
  completeWorkflowRun(params: Readonly<CompleteWorkflowRunParams>): Promise<WorkflowRun>;
28
28
  failWorkflowRun(params: Readonly<FailWorkflowRunParams>): Promise<WorkflowRun>;
29
29
  cancelWorkflowRun(params: Readonly<CancelWorkflowRunParams>): Promise<WorkflowRun>;
30
+ pauseWorkflowRun(params: Readonly<PauseWorkflowRunParams>): Promise<WorkflowRun>;
31
+ resumeWorkflowRun(params: Readonly<ResumeWorkflowRunParams>): Promise<WorkflowRun>;
30
32
 
31
33
  // Step Attempts
32
34
  createStepAttempt(params: Readonly<CreateStepAttemptParams>): Promise<StepAttempt>;
@@ -34,8 +36,8 @@ export interface Backend {
34
36
  listStepAttempts(
35
37
  params: Readonly<ListStepAttemptsParams>,
36
38
  ): Promise<PaginatedResponse<StepAttempt>>;
37
- completeStepAttempt(params: Readonly<CompleteStepAttemptParams>): Promise<StepAttempt>;
38
- failStepAttempt(params: Readonly<FailStepAttemptParams>): Promise<StepAttempt>;
39
+ completeStepAttempt(params: Readonly<CompleteStepAttemptParams>): Promise<StepAttempt | null>;
40
+ failStepAttempt(params: Readonly<FailStepAttemptParams>): Promise<StepAttempt | null>;
39
41
  }
40
42
 
41
43
  export interface CreateWorkflowRunParams {
@@ -54,7 +56,12 @@ export interface GetWorkflowRunParams {
54
56
  workflowRunId: string;
55
57
  }
56
58
 
57
- export type ListWorkflowRunsParams = PaginationOptions;
59
+ export interface ListWorkflowRunsParams extends PaginationOptions {
60
+ status?: string[];
61
+ workflowName?: string;
62
+ createdAfter?: Date;
63
+ createdBefore?: Date;
64
+ }
58
65
 
59
66
  export interface ClaimWorkflowRunParams {
60
67
  workerId: string;
@@ -91,6 +98,14 @@ export interface CancelWorkflowRunParams {
91
98
  workflowRunId: string;
92
99
  }
93
100
 
101
+ export interface PauseWorkflowRunParams {
102
+ workflowRunId: string;
103
+ }
104
+
105
+ export interface ResumeWorkflowRunParams {
106
+ workflowRunId: string;
107
+ }
108
+
94
109
  export interface CreateStepAttemptParams {
95
110
  workflowRunId: string;
96
111
  workerId: string;
@@ -126,6 +141,7 @@ export interface PaginationOptions {
126
141
  limit?: number;
127
142
  after?: string;
128
143
  before?: string;
144
+ order?: "asc" | "desc";
129
145
  }
130
146
 
131
147
  export interface PaginatedResponse<T> {
package/src/chaos.test.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { randomInt } from "node:crypto";
2
+
2
3
  import { describe, expect, test } from "vitest";
4
+
3
5
  import { OpenWorkflow } from "./client";
4
6
  import { createBackend } from "./testing/connection";
5
- import type { Worker } from "./worker";
7
+ import { type Worker } from "./worker";
6
8
 
7
9
  const TOTAL_STEPS = 50;
8
10
  const WORKER_COUNT = 3;
@@ -1,6 +1,8 @@
1
1
  import { randomUUID } from "node:crypto";
2
+
2
3
  import { afterEach, beforeEach, describe, expect, test } from "vitest";
3
4
  import { z } from "zod";
5
+
4
6
  import { BackendPostgres } from ".";
5
7
  import { declareWorkflow, OpenWorkflow } from "./client";
6
8
  import { KNEX_GLOBAL_CONFIG } from "./testing/connection";
package/src/client.ts CHANGED
@@ -1,12 +1,14 @@
1
- import type { Backend } from "./backend";
1
+ import { type Backend } from "./backend";
2
2
  import { serializeRetryPolicy } from "./core/retry";
3
- import type { StandardSchemaV1 } from "./core/schema";
4
- import type { SchemaInput, SchemaOutput, WorkflowRun } from "./core/workflow";
3
+ import { type StandardSchemaV1 } from "./core/schema";
4
+ import { type SchemaInput, type SchemaOutput, type WorkflowRun } from "./core/workflow";
5
5
  import { validateInput } from "./core/workflow";
6
- import type { WorkflowFunction } from "./execution";
6
+ import { type WorkflowFunction } from "./execution";
7
7
  import { WorkflowRegistry } from "./registry";
8
- import { Worker, type WorkerOptions } from "./worker";
9
- import { defineWorkflow, defineWorkflowSpec, type Workflow, type WorkflowSpec } from "./workflow";
8
+ import { Worker } from "./worker";
9
+ import { type WorkerOptions } from "./worker";
10
+ import { defineWorkflow, defineWorkflowSpec } from "./workflow";
11
+ import { type Workflow, type WorkflowSpec } from "./workflow";
10
12
 
11
13
  const DEFAULT_RESULT_POLL_INTERVAL_MS = 1000; // 1s
12
14
  const DEFAULT_RESULT_TIMEOUT_MS = 5 * 60 * 1000; // 5m
@@ -321,12 +323,32 @@ export class WorkflowRunHandle<Output> {
321
323
  }
322
324
 
323
325
  /**
324
- * Cancels the workflow run. Only workflows in pending, running, or sleeping
325
- * status can be canceled.
326
+ * Cancels the workflow run. Only workflows in pending, running, sleeping,
327
+ * or paused status can be canceled.
326
328
  */
327
329
  async cancel(): Promise<void> {
328
330
  await this.backend.cancelWorkflowRun({
329
331
  workflowRunId: this.workflowRun.id,
330
332
  });
331
333
  }
334
+
335
+ /**
336
+ * Pauses the workflow run. Only workflows in pending, running, or sleeping
337
+ * status can be paused.
338
+ */
339
+ async pause(): Promise<void> {
340
+ await this.backend.pauseWorkflowRun({
341
+ workflowRunId: this.workflowRun.id,
342
+ });
343
+ }
344
+
345
+ /**
346
+ * Resumes a paused workflow run. Sets the status back to pending so that
347
+ * a worker can reclaim it.
348
+ */
349
+ async resume(): Promise<void> {
350
+ await this.backend.resumeWorkflowRun({
351
+ workflowRunId: this.workflowRun.id,
352
+ });
353
+ }
332
354
  }
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, test } from "vitest";
2
+
2
3
  import { defineConfig } from "./config";
3
4
  import { createBackend } from "./testing/connection";
4
5
 
package/src/config.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { loadConfig as loadC12Config } from "c12";
2
- import type { Backend } from "./backend";
3
- import type { WorkerOptions } from "./worker";
2
+
3
+ import { type Backend } from "./backend";
4
+ import { type WorkerOptions } from "./worker";
4
5
 
5
6
  export interface OpenWorkflowConfig {
6
7
  backend: Backend;
@@ -1,5 +1,6 @@
1
1
  import { describe, expect, test } from "vitest";
2
- import type { DurationString } from "./duration";
2
+
3
+ import { type DurationString } from "./duration";
3
4
  import { parseDuration } from "./duration";
4
5
  import { err, ok } from "./result";
5
6
 
@@ -1,4 +1,4 @@
1
- import type { Result } from "./result";
1
+ import { type Result } from "./result";
2
2
  import { err, ok } from "./result";
3
3
 
4
4
  type Years = "years" | "year" | "yrs" | "yr" | "y";
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, test } from "vitest";
2
+
2
3
  import { serializeError } from "./error";
3
4
 
4
5
  describe("serializeError", () => {
package/src/core/error.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { JsonValue } from "./json";
1
+ import { type JsonValue } from "./json";
2
2
 
3
3
  export type SerializedError = {
4
4
  name?: string;
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, test } from "vitest";
2
+
2
3
  import { err, ok } from "./result";
3
4
 
4
5
  describe("Result helpers", () => {
@@ -1,6 +1,7 @@
1
1
  import { describe, expect, test } from "vitest";
2
- import type { SerializedError } from "./error";
3
- import type { DynamicRetryPolicy, StaticRetryPolicy } from "./retry";
2
+
3
+ import { type SerializedError } from "./error";
4
+ import { type DynamicRetryPolicy, type StaticRetryPolicy } from "./retry";
4
5
  import {
5
6
  calculateRetryDelayMs,
6
7
  DEFAULT_RETRY_POLICY,
package/src/core/retry.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { SerializedError } from "./error";
1
+ import { type SerializedError } from "./error";
2
2
 
3
3
  export interface RetryDecision {
4
4
  shouldRetry: boolean;
@@ -68,7 +68,7 @@ export declare namespace StandardSchemaV1 {
68
68
  Schema["~standard"]["types"]
69
69
  >["output"];
70
70
 
71
- // eslint-disable-next-line unicorn/require-module-specifiers
72
- // biome-ignore lint/complexity/noUselessEmptyExport: needed for granular visibility control of TS namespace
71
+ // needed for granular visibility control of TS namespace
72
+ // oxlint-disable-next-line
73
73
  export {};
74
74
  }
@@ -1,6 +1,7 @@
1
1
  import { describe, expect, test } from "vitest";
2
+
2
3
  import { ok } from "./result";
3
- import type { StepAttempt, StepAttemptCache } from "./step";
4
+ import { type StepAttempt, type StepAttemptCache } from "./step";
4
5
  import {
5
6
  addToStepAttemptCache,
6
7
  calculateSleepResumeAt,
package/src/core/step.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { DurationString } from "./duration";
1
+ import { type DurationString } from "./duration";
2
2
  import { parseDuration } from "./duration";
3
- import type { JsonValue } from "./json";
4
- import type { Result } from "./result";
3
+ import { type JsonValue } from "./json";
4
+ import { type Result } from "./result";
5
5
  import { err, ok } from "./result";
6
6
 
7
7
  /**
@@ -14,6 +14,7 @@ export type StepKind = "function" | "sleep";
14
14
  */
15
15
  export type StepAttemptStatus =
16
16
  | "running"
17
+ | "paused"
17
18
  | "succeeded" // deprecated in favor of 'completed'
18
19
  | "completed"
19
20
  | "failed";
@@ -1,5 +1,6 @@
1
1
  import { describe, expect, test } from "vitest";
2
- import type { StandardSchemaV1 } from "./schema";
2
+
3
+ import { type StandardSchemaV1 } from "./schema";
3
4
  import { DEFAULT_WORKFLOW_RESULT_CONFIG, isTerminalStatus, validateInput } from "./workflow";
4
5
 
5
6
  describe("validateInput", () => {
@@ -1,6 +1,6 @@
1
- import type { SerializedError } from "./error";
2
- import type { JsonValue } from "./json";
3
- import type { StandardSchemaV1 } from "./schema";
1
+ import { type SerializedError } from "./error";
2
+ import { type JsonValue } from "./json";
3
+ import { type StandardSchemaV1 } from "./schema";
4
4
 
5
5
  /**
6
6
  * Status of a workflow run through its lifecycle.
@@ -9,6 +9,7 @@ export type WorkflowRunStatus =
9
9
  | "pending"
10
10
  | "running"
11
11
  | "sleeping"
12
+ | "paused"
12
13
  | "succeeded" // deprecated in favor of 'completed'
13
14
  | "completed"
14
15
  | "failed"
@@ -1,4 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
+
2
3
  import { KNEX_GLOBAL_CONFIG } from "../testing/connection";
3
4
  import { BackendPostgres } from "./backend";
4
5
  import { testBackend } from "./backend.testsuite";