openworkflow 0.4.1 → 0.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.
Files changed (193) hide show
  1. package/README.md +53 -48
  2. package/dist/backend-postgres/index.d.ts +44 -0
  3. package/dist/backend-postgres/index.d.ts.map +1 -0
  4. package/dist/backend-postgres/index.js +535 -0
  5. package/dist/backend-postgres/index.js.map +1 -0
  6. package/dist/backend-postgres/postgres.d.ts +42 -0
  7. package/dist/backend-postgres/postgres.d.ts.map +1 -0
  8. package/dist/backend-postgres/postgres.js +234 -0
  9. package/dist/backend-postgres/postgres.js.map +1 -0
  10. package/dist/backend-sqlite/index.d.ts +41 -1
  11. package/dist/backend-sqlite/index.d.ts.map +1 -1
  12. package/dist/backend-sqlite/index.js +654 -1
  13. package/dist/backend-sqlite/index.js.map +1 -1
  14. package/dist/backend-sqlite/sqlite.d.ts +18 -2
  15. package/dist/backend-sqlite/sqlite.d.ts.map +1 -1
  16. package/dist/backend-sqlite/sqlite.js +20 -2
  17. package/dist/backend-sqlite/sqlite.js.map +1 -1
  18. package/dist/{core/backend.d.ts → backend.d.ts} +7 -5
  19. package/dist/backend.d.ts.map +1 -0
  20. package/dist/backend.js.map +1 -0
  21. package/dist/bin/openworkflow.d.ts +3 -0
  22. package/dist/bin/openworkflow.d.ts.map +1 -0
  23. package/dist/bin/openworkflow.js +44 -0
  24. package/dist/bin/openworkflow.js.map +1 -0
  25. package/dist/client.d.ts +141 -0
  26. package/dist/client.d.ts.map +1 -0
  27. package/dist/{sdk/sdk.js → client.js} +44 -71
  28. package/dist/client.js.map +1 -0
  29. package/dist/config.d.ts +27 -21
  30. package/dist/config.d.ts.map +1 -1
  31. package/dist/config.js +44 -36
  32. package/dist/config.js.map +1 -1
  33. package/dist/core/duration.d.ts +4 -2
  34. package/dist/core/duration.d.ts.map +1 -1
  35. package/dist/core/duration.js +3 -1
  36. package/dist/core/duration.js.map +1 -1
  37. package/dist/core/error.d.ts +14 -0
  38. package/dist/core/error.d.ts.map +1 -0
  39. package/dist/core/error.js +18 -0
  40. package/dist/core/error.js.map +1 -0
  41. package/dist/core/result.d.ts +14 -4
  42. package/dist/core/result.d.ts.map +1 -1
  43. package/dist/core/result.js +10 -0
  44. package/dist/core/result.js.map +1 -1
  45. package/dist/core/retry.d.ts +0 -9
  46. package/dist/core/retry.d.ts.map +1 -1
  47. package/dist/core/retry.js +0 -14
  48. package/dist/core/retry.js.map +1 -1
  49. package/dist/core/step.d.ts +1 -32
  50. package/dist/core/step.d.ts.map +1 -1
  51. package/dist/core/step.js +0 -35
  52. package/dist/core/step.js.map +1 -1
  53. package/dist/core/workflow.d.ts +2 -47
  54. package/dist/core/workflow.d.ts.map +1 -1
  55. package/dist/core/workflow.js +0 -44
  56. package/dist/core/workflow.js.map +1 -1
  57. package/dist/{execution/execution.d.ts → execution.d.ts} +4 -26
  58. package/dist/execution.d.ts.map +1 -0
  59. package/dist/{execution/execution.js → execution.js} +4 -4
  60. package/dist/execution.js.map +1 -0
  61. package/dist/index.d.ts +6 -9
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +4 -4
  64. package/dist/index.js.map +1 -1
  65. package/dist/internal.d.ts +8 -0
  66. package/dist/internal.d.ts.map +1 -0
  67. package/dist/internal.js +5 -0
  68. package/dist/internal.js.map +1 -0
  69. package/dist/pg/backend.d.ts +42 -0
  70. package/dist/pg/backend.d.ts.map +1 -0
  71. package/dist/pg/backend.js +534 -0
  72. package/dist/pg/backend.js.map +1 -0
  73. package/dist/pg/index.d.ts +3 -0
  74. package/dist/pg/index.d.ts.map +1 -0
  75. package/dist/pg/index.js +3 -0
  76. package/dist/pg/index.js.map +1 -0
  77. package/dist/pg/postgres.d.ts +42 -0
  78. package/dist/pg/postgres.d.ts.map +1 -0
  79. package/dist/pg/postgres.js +234 -0
  80. package/dist/pg/postgres.js.map +1 -0
  81. package/dist/pg/scripts/db-migrate.d.ts +2 -0
  82. package/dist/pg/scripts/db-migrate.d.ts.map +1 -0
  83. package/dist/pg/scripts/db-migrate.js +5 -0
  84. package/dist/pg/scripts/db-migrate.js.map +1 -0
  85. package/dist/pg/scripts/db-reset.d.ts +2 -0
  86. package/dist/pg/scripts/db-reset.d.ts.map +1 -0
  87. package/dist/pg/scripts/db-reset.js +6 -0
  88. package/dist/pg/scripts/db-reset.js.map +1 -0
  89. package/dist/pg/scripts/squawk.d.ts +2 -0
  90. package/dist/pg/scripts/squawk.d.ts.map +1 -0
  91. package/dist/pg/scripts/squawk.js +17 -0
  92. package/dist/pg/scripts/squawk.js.map +1 -0
  93. package/dist/pg/vitest.global-setup.d.ts +3 -0
  94. package/dist/pg/vitest.global-setup.d.ts.map +1 -0
  95. package/dist/pg/vitest.global-setup.js +8 -0
  96. package/dist/pg/vitest.global-setup.js.map +1 -0
  97. package/dist/registry.d.ts +27 -0
  98. package/dist/registry.d.ts.map +1 -0
  99. package/dist/registry.js +49 -0
  100. package/dist/registry.js.map +1 -0
  101. package/dist/{backend-sqlite → sqlite}/backend.d.ts +6 -4
  102. package/dist/sqlite/backend.d.ts.map +1 -0
  103. package/dist/{backend-sqlite → sqlite}/backend.js +31 -5
  104. package/dist/sqlite/backend.js.map +1 -0
  105. package/dist/sqlite/index.d.ts +3 -0
  106. package/dist/sqlite/index.d.ts.map +1 -0
  107. package/dist/sqlite/index.js +3 -0
  108. package/dist/sqlite/index.js.map +1 -0
  109. package/dist/sqlite/sqlite.d.ts +61 -0
  110. package/dist/sqlite/sqlite.d.ts.map +1 -0
  111. package/dist/sqlite/sqlite.js +247 -0
  112. package/dist/sqlite/sqlite.js.map +1 -0
  113. package/dist/testing/backend.testsuite.d.ts +20 -0
  114. package/dist/testing/backend.testsuite.d.ts.map +1 -0
  115. package/dist/{core → testing}/backend.testsuite.js +186 -53
  116. package/dist/testing/backend.testsuite.js.map +1 -0
  117. package/dist/testing/index.d.ts +2 -0
  118. package/dist/testing/index.d.ts.map +1 -0
  119. package/dist/testing/index.js +2 -0
  120. package/dist/testing/index.js.map +1 -0
  121. package/dist/tsconfig.tsbuildinfo +1 -1
  122. package/dist/{worker/worker.d.ts → worker.d.ts} +11 -4
  123. package/dist/worker.d.ts.map +1 -0
  124. package/dist/{worker/worker.js → worker.js} +20 -10
  125. package/dist/worker.js.map +1 -0
  126. package/dist/workflow.d.ts +60 -0
  127. package/dist/workflow.d.ts.map +1 -0
  128. package/dist/workflow.js +49 -0
  129. package/dist/workflow.js.map +1 -0
  130. package/package.json +13 -3
  131. package/dist/backend-sqlite/backend.d.ts.map +0 -1
  132. package/dist/backend-sqlite/backend.js.map +0 -1
  133. package/dist/config/config.d.ts +0 -102
  134. package/dist/config/config.d.ts.map +0 -1
  135. package/dist/config/config.js +0 -29
  136. package/dist/config/config.js.map +0 -1
  137. package/dist/config/index.d.ts +0 -3
  138. package/dist/config/index.d.ts.map +0 -1
  139. package/dist/config/index.js +0 -2
  140. package/dist/config/index.js.map +0 -1
  141. package/dist/core/backend-test-suite.d.ts +0 -22
  142. package/dist/core/backend-test-suite.d.ts.map +0 -1
  143. package/dist/core/backend-test-suite.js +0 -960
  144. package/dist/core/backend-test-suite.js.map +0 -1
  145. package/dist/core/backend.d.ts.map +0 -1
  146. package/dist/core/backend.js.map +0 -1
  147. package/dist/core/backend.testsuite.d.ts +0 -21
  148. package/dist/core/backend.testsuite.d.ts.map +0 -1
  149. package/dist/core/backend.testsuite.js.map +0 -1
  150. package/dist/core/duration.test.d.ts +0 -2
  151. package/dist/core/duration.test.d.ts.map +0 -1
  152. package/dist/core/duration.test.js +0 -264
  153. package/dist/core/duration.test.js.map +0 -1
  154. package/dist/core/result.test.d.ts +0 -2
  155. package/dist/core/result.test.d.ts.map +0 -1
  156. package/dist/core/result.test.js +0 -11
  157. package/dist/core/result.test.js.map +0 -1
  158. package/dist/core/retry.test.d.ts +0 -2
  159. package/dist/core/retry.test.d.ts.map +0 -1
  160. package/dist/core/retry.test.js +0 -36
  161. package/dist/core/retry.test.js.map +0 -1
  162. package/dist/core/step.test.d.ts +0 -2
  163. package/dist/core/step.test.d.ts.map +0 -1
  164. package/dist/core/step.test.js +0 -340
  165. package/dist/core/step.test.js.map +0 -1
  166. package/dist/core/workflow.test.d.ts +0 -2
  167. package/dist/core/workflow.test.d.ts.map +0 -1
  168. package/dist/core/workflow.test.js +0 -216
  169. package/dist/core/workflow.test.js.map +0 -1
  170. package/dist/execution/execution.d.ts.map +0 -1
  171. package/dist/execution/execution.js.map +0 -1
  172. package/dist/execution/execution.test.d.ts +0 -2
  173. package/dist/execution/execution.test.d.ts.map +0 -1
  174. package/dist/execution/execution.test.js +0 -382
  175. package/dist/execution/execution.test.js.map +0 -1
  176. package/dist/global.d.ts +0 -62
  177. package/dist/global.d.ts.map +0 -1
  178. package/dist/global.js +0 -78
  179. package/dist/global.js.map +0 -1
  180. package/dist/sdk/sdk.d.ts +0 -182
  181. package/dist/sdk/sdk.d.ts.map +0 -1
  182. package/dist/sdk/sdk.js.map +0 -1
  183. package/dist/sdk/sdk.test.d.ts +0 -2
  184. package/dist/sdk/sdk.test.d.ts.map +0 -1
  185. package/dist/sdk/sdk.test.js +0 -195
  186. package/dist/sdk/sdk.test.js.map +0 -1
  187. package/dist/worker/worker.d.ts.map +0 -1
  188. package/dist/worker/worker.js.map +0 -1
  189. package/dist/worker/worker.test.d.ts +0 -2
  190. package/dist/worker/worker.test.d.ts.map +0 -1
  191. package/dist/worker/worker.test.js +0 -786
  192. package/dist/worker/worker.test.js.map +0 -1
  193. /package/dist/{core/backend.js → backend.js} +0 -0
package/dist/config.d.ts CHANGED
@@ -1,28 +1,34 @@
1
- import type { OpenWorkflow } from "./sdk/sdk.js";
2
- import type { WorkerOptions } from "./worker/worker.js";
1
+ import { Backend } from "./backend.js";
2
+ import { WorkerOptions } from "./worker.js";
3
+ export interface OpenWorkflowConfig {
4
+ backend: Backend;
5
+ worker?: WorkerConfig;
6
+ /**
7
+ * Directory or directories to scan for workflow files. All `.ts`, `.js`,
8
+ * `.mjs`, and `.cjs` files in these directories (recursively) will be loaded.
9
+ * Workflow files should export workflows created with `defineWorkflow()`.
10
+ * @example "./openworkflow"
11
+ * @example ["./openworkflow", "./src/openworkflow", "./workflows"]
12
+ */
13
+ dirs?: string | string[];
14
+ }
3
15
  export type WorkerConfig = Pick<WorkerOptions, "concurrency">;
4
16
  /**
5
- * Configuration object for OpenWorkflow.
6
- * This is the expected shape of the default export from openworkflow.config.ts
17
+ * Create a typed OpenWorkflow configuration.
18
+ * @param config - the config
19
+ * @returns the config
7
20
  */
8
- export interface OpenWorkflowConfig {
9
- ow: OpenWorkflow;
10
- worker?: WorkerConfig;
21
+ export declare function defineConfig(config: OpenWorkflowConfig): OpenWorkflowConfig;
22
+ interface LoadedConfig {
23
+ config: OpenWorkflowConfig;
24
+ configFile: string | undefined;
11
25
  }
12
26
  /**
13
- * Load OpenWorkflow configuration using c12.
14
- * This function searches for openworkflow.config.{ts,js,mjs,cjs} files
15
- * in the current working directory and returns the configuration.
16
- *
17
- * Note: This function requires Node.js and will only work in Node environments.
18
- * For non-Node environments (browser, edge), create OpenWorkflow instances manually.
19
- *
20
- * @param options - Optional configuration options
21
- * @param options.cwd - The directory to search for config files (defaults to process.cwd())
22
- * @returns The loaded configuration
23
- * @throws Error if config file is not found or invalid
27
+ * Load the OpenWorkflow config at openworkflow.config.{js,mjs,cjs}.
28
+ * @param rootDir - Optional root directory to search from (defaults to
29
+ * process.cwd())
30
+ * @returns The loaded configuration and metadata
24
31
  */
25
- export declare function loadConfig(options?: {
26
- cwd?: string;
27
- }): Promise<OpenWorkflowConfig>;
32
+ export declare function loadConfig(rootDir?: string): Promise<LoadedConfig>;
33
+ export {};
28
34
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,YAAY,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,OAAO,CAAC,EAAE;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAoC9B"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAE9D;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAE3E;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAKD;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAqCxE"}
package/dist/config.js CHANGED
@@ -1,41 +1,49 @@
1
+ import { existsSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { pathToFileURL } from "node:url";
1
4
  /**
2
- * Load OpenWorkflow configuration using c12.
3
- * This function searches for openworkflow.config.{ts,js,mjs,cjs} files
4
- * in the current working directory and returns the configuration.
5
- *
6
- * Note: This function requires Node.js and will only work in Node environments.
7
- * For non-Node environments (browser, edge), create OpenWorkflow instances manually.
8
- *
9
- * @param options - Optional configuration options
10
- * @param options.cwd - The directory to search for config files (defaults to process.cwd())
11
- * @returns The loaded configuration
12
- * @throws Error if config file is not found or invalid
5
+ * Create a typed OpenWorkflow configuration.
6
+ * @param config - the config
7
+ * @returns the config
13
8
  */
14
- export async function loadConfig(options) {
15
- // Dynamic import to avoid breaking non-Node environments
16
- // This is lazy-loaded only when actually calling loadConfig()
17
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
18
- const { loadConfig: c12LoadConfig } = await import("c12");
19
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
20
- const result = await c12LoadConfig({
21
- name: "openworkflow",
22
- ...(options?.cwd ? { cwd: options.cwd } : {}),
23
- });
24
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
25
- const config = result.config;
26
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
27
- const configFile = result.configFile;
28
- // Check if a config file was actually found and loaded
29
- // configFile will be a full path if found, or just the base name if not found
30
- const hasConfigFile = configFile?.includes("/") ?? false;
31
- // If no config file was found, throw a specific error
32
- if (!hasConfigFile) {
33
- throw new Error("OpenWorkflow config file not found. Expected: openworkflow.config.{ts,js,mjs,cjs}\nRun 'ow init' to create one.");
34
- }
35
- // If config file exists but doesn't have the required structure
36
- if (!config || typeof config !== "object" || !("ow" in config)) {
37
- throw new Error("Config missing 'ow' property. Add 'ow: new OpenWorkflow(...)' to your config export.");
38
- }
9
+ export function defineConfig(config) {
39
10
  return config;
40
11
  }
12
+ const CONFIG_NAME = "openworkflow.config";
13
+ const CONFIG_EXTENSIONS = ["js", "mjs", "cjs"];
14
+ /**
15
+ * Load the OpenWorkflow config at openworkflow.config.{js,mjs,cjs}.
16
+ * @param rootDir - Optional root directory to search from (defaults to
17
+ * process.cwd())
18
+ * @returns The loaded configuration and metadata
19
+ */
20
+ export async function loadConfig(rootDir) {
21
+ const cwd = rootDir ?? process.cwd();
22
+ for (const ext of CONFIG_EXTENSIONS) {
23
+ const fileName = `${CONFIG_NAME}.${ext}`;
24
+ const filePath = path.join(cwd, fileName);
25
+ if (existsSync(filePath)) {
26
+ try {
27
+ const fileUrl = pathToFileURL(filePath).href;
28
+ const mod = (await import(fileUrl));
29
+ const config = mod.default ??
30
+ mod;
31
+ return {
32
+ config,
33
+ configFile: filePath,
34
+ };
35
+ }
36
+ catch (error) {
37
+ throw new Error(`Failed to load config file ${filePath}: ${String(error)}`);
38
+ }
39
+ }
40
+ }
41
+ return {
42
+ // not great, but meant to match the c12 api since that is what was used in
43
+ // the initial implementation of loadConfig
44
+ // this can be easily refactored later
45
+ config: {},
46
+ configFile: undefined, // no config found
47
+ };
48
+ }
41
49
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAEhC;IACC,yDAAyD;IACzD,8DAA8D;IAC9D,mEAAmE;IACnE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;IAE1D,sGAAsG;IACtG,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;QACjC,IAAI,EAAE,cAAc;QACpB,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9C,CAAC,CAAC;IAEH,sEAAsE;IACtE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAwC,CAAC;IAC/D,sEAAsE;IACtE,MAAM,UAAU,GAAuB,MAAM,CAAC,UAAU,CAAC;IAEzD,uDAAuD;IACvD,8EAA8E;IAC9E,MAAM,aAAa,GAAG,UAAU,EAAE,QAAQ,CAA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C,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAEZ,CAAC;gBACvB,MAAM,MAAM,GACT,GAAwC,CAAC,OAAO;oBAChD,GAA0B,CAAC;gBAE9B,OAAO;oBACL,MAAM;oBACN,UAAU,EAAE,QAAQ;iBACrB,CAAC;YACJ,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CACb,8BAA8B,QAAQ,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAC3D,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,2EAA2E;QAC3E,2CAA2C;QAC3C,sCAAsC;QACtC,MAAM,EAAE,EAAmC;QAC3C,UAAU,EAAE,SAAS,EAAE,kBAAkB;KAC1C,CAAC;AACJ,CAAC"}
@@ -11,10 +11,12 @@ type Unit = Years | Months | Weeks | Days | Hours | Minutes | Seconds | Millisec
11
11
  type UnitAnyCase = Capitalize<Unit> | Uppercase<Unit> | Lowercase<Unit>;
12
12
  export type DurationString = `${number}` | `${number}${UnitAnyCase}` | `${number} ${UnitAnyCase}`;
13
13
  /**
14
- * Parse a duration string into milliseconds. Exmaples:
14
+ * Parse a duration string into milliseconds. Examples:
15
15
  * - short units: "1ms", "5s", "30m", "2h", "7d", "3w", "1y"
16
16
  * - long units: "1 millisecond", "5 seconds", "30 minutes", "2 hours", "7 days", "3 weeks", "1 year"
17
+ * @param str - Duration string
18
+ * @returns Milliseconds
17
19
  */
18
- export declare function parseDuration(str: DurationString): Result<number, Error>;
20
+ export declare function parseDuration(str: DurationString): Result<number>;
19
21
  export {};
20
22
  //# sourceMappingURL=duration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../core/duration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,KAA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D,KAAK,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;AACxC,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,GAAG,CAAC;AACpC,KAAK,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,GAAG,CAAC;AACjC,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,GAAG,CAAC;AACnD,KAAK,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,GAAG,CAAC;AAC3D,KAAK,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,GAAG,CAAC;AAC3D,KAAK,YAAY,GAAG,cAAc,GAAG,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;AAC7E,KAAK,IAAI,GACL,KAAK,GACL,MAAM,GACN,KAAK,GACL,IAAI,GACJ,KAAK,GACL,OAAO,GACP,OAAO,GACP,YAAY,CAAC;AACjB,KAAK,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AACxE,MAAM,MAAM,cAAc,GACtB,GAAG,MAAM,EAAE,GACX,GAAG,MAAM,GAAG,WAAW,EAAE,GACzB,GAAG,MAAM,IAAI,WAAW,EAAE,CAAC;AAE/B;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAiEjE"}
@@ -1,8 +1,10 @@
1
1
  import { ok, err } from "./result.js";
2
2
  /**
3
- * Parse a duration string into milliseconds. Exmaples:
3
+ * Parse a duration string into milliseconds. Examples:
4
4
  * - short units: "1ms", "5s", "30m", "2h", "7d", "3w", "1y"
5
5
  * - long units: "1 millisecond", "5 seconds", "30 minutes", "2 hours", "7 days", "3 weeks", "1 year"
6
+ * @param str - Duration string
7
+ * @returns Milliseconds
6
8
  */
7
9
  export function parseDuration(str) {
8
10
  if (typeof str !== "string") {
@@ -1 +1 @@
1
- {"version":3,"file":"duration.js","sourceRoot":"","sources":["../../core/duration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAyBtC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAAmB;IAC/C,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,GAAG,CACR,IAAI,SAAS,CACX,0DAA0D,GAAG,OAAO,GAAG,CACxE,CACF,CAAC;IACJ,CAAC;IAED,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,GAAG,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,KAAK,GAAG,qCAAqC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE9D,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,OAAO,GAAG,CAAC,IAAI,KAAK,CAAC,6BAA6B,GAAG,GAAG,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,IAAI,CAAC,CAAC,gCAAgC;IAE9E,MAAM,WAAW,GAA2B;QAC1C,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,EAAE,EAAE,CAAC;QACL,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,GAAG,EAAE,IAAI;QACT,IAAI,EAAE,IAAI;QACV,CAAC,EAAE,IAAI;QACP,MAAM,EAAE,EAAE,GAAG,IAAI;QACj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
2
+ export interface SerializedError {
3
+ name?: string;
4
+ message: string;
5
+ stack?: string;
6
+ [key: string]: JsonValue;
7
+ }
8
+ /**
9
+ * Serialize an error to a JSON-compatible format.
10
+ * @param error - The error to serialize (can be Error instance or any value)
11
+ * @returns A JSON-serializable error object
12
+ */
13
+ export declare function serializeError(error: unknown): SerializedError;
14
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../core/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAc9D"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Serialize an error to a JSON-compatible format.
3
+ * @param error - The error to serialize (can be Error instance or any value)
4
+ * @returns A JSON-serializable error object
5
+ */
6
+ export function serializeError(error) {
7
+ if (error instanceof Error) {
8
+ const { name, message, stack } = error;
9
+ if (stack) {
10
+ return { name, message, stack };
11
+ }
12
+ return { name, message };
13
+ }
14
+ return {
15
+ message: String(error),
16
+ };
17
+ }
18
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../core/error.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;QAEvC,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAClC,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC;KACvB,CAAC;AACJ,CAAC"}
@@ -1,12 +1,22 @@
1
- export type Result<T, E> = Ok<T> | Err<E>;
1
+ export type Result<T> = Ok<T> | Err;
2
2
  export interface Ok<T> {
3
3
  ok: true;
4
4
  value: T;
5
5
  }
6
- export interface Err<E> {
6
+ export interface Err {
7
7
  ok: false;
8
- error: E;
8
+ error: Error;
9
9
  }
10
+ /**
11
+ * Create an Ok result.
12
+ * @param value - Result value
13
+ * @returns Ok result
14
+ */
10
15
  export declare function ok<T>(value: T): Ok<T>;
11
- export declare function err<E>(error: E): Err<E>;
16
+ /**
17
+ * Create an Err result.
18
+ * @param error - Result error
19
+ * @returns Err result
20
+ */
21
+ export declare function err(error: Readonly<Error>): Err;
12
22
  //# sourceMappingURL=result.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../core/result.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAE1C,MAAM,WAAW,EAAE,CAAC,CAAC;IACnB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,GAAG,CAAC,CAAC;IACpB,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,CAAC,CAAC;CACV;AAED,wBAAgB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAErC;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAEvC"}
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../core/result.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AAEpC,MAAM,WAAW,EAAE,CAAC,CAAC;IACnB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAErC;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,CAE/C"}
@@ -1,6 +1,16 @@
1
+ /**
2
+ * Create an Ok result.
3
+ * @param value - Result value
4
+ * @returns Ok result
5
+ */
1
6
  export function ok(value) {
2
7
  return { ok: true, value };
3
8
  }
9
+ /**
10
+ * Create an Err result.
11
+ * @param error - Result error
12
+ * @returns Err result
13
+ */
4
14
  export function err(error) {
5
15
  return { ok: false, error };
6
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../../core/result.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,EAAE,CAAI,KAAQ;IAC5B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,GAAG,CAAI,KAAQ;IAC7B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../core/result.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,MAAM,UAAU,EAAE,CAAI,KAAQ;IAC5B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,KAAsB;IACxC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC"}
@@ -4,13 +4,4 @@ export declare const DEFAULT_RETRY_POLICY: {
4
4
  readonly maximumIntervalMs: number;
5
5
  readonly maximumAttempts: number;
6
6
  };
7
- export type RetryPolicy = typeof DEFAULT_RETRY_POLICY;
8
- /**
9
- * Calculate the next retry delay using exponential backoff.
10
- */
11
- export declare function calculateRetryDelayMs(attemptNumber: number): number;
12
- /**
13
- * Check if an operation should be retried based on the retry policy.
14
- */
15
- export declare function shouldRetry(retryPolicy: RetryPolicy, attemptNumber: number): boolean;
16
7
  //# sourceMappingURL=retry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../core/retry.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,OAAO,oBAAoB,CAAC;AAEtD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAQnE;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,MAAM,GACpB,OAAO,CAET"}
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../core/retry.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC"}
@@ -4,18 +4,4 @@ export const DEFAULT_RETRY_POLICY = {
4
4
  maximumIntervalMs: 100 * 1000, // 100s
5
5
  maximumAttempts: Infinity, // unlimited
6
6
  };
7
- /**
8
- * Calculate the next retry delay using exponential backoff.
9
- */
10
- export function calculateRetryDelayMs(attemptNumber) {
11
- const { initialIntervalMs, backoffCoefficient, maximumIntervalMs } = DEFAULT_RETRY_POLICY;
12
- const backoffMs = initialIntervalMs * Math.pow(backoffCoefficient, attemptNumber - 1);
13
- return Math.min(backoffMs, maximumIntervalMs);
14
- }
15
- /**
16
- * Check if an operation should be retried based on the retry policy.
17
- */
18
- export function shouldRetry(retryPolicy, attemptNumber) {
19
- return attemptNumber < retryPolicy.maximumAttempts;
20
- }
21
7
  //# sourceMappingURL=retry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../core/retry.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,iBAAiB,EAAE,IAAI,EAAE,KAAK;IAC9B,kBAAkB,EAAE,CAAC;IACrB,iBAAiB,EAAE,GAAG,GAAG,IAAI,EAAE,OAAO;IACtC,eAAe,EAAE,QAAQ,EAAE,YAAY;CAC/B,CAAC;AAIX;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,aAAqB;IACzD,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,GAChE,oBAAoB,CAAC;IAEvB,MAAM,SAAS,GACb,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,aAAa,GAAG,CAAC,CAAC,CAAC;IAEtE,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,WAAwB,EACxB,aAAqB;IAErB,OAAO,aAAa,GAAG,WAAW,CAAC,eAAe,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../core/retry.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,iBAAiB,EAAE,IAAI,EAAE,KAAK;IAC9B,kBAAkB,EAAE,CAAC;IACrB,iBAAiB,EAAE,GAAG,GAAG,IAAI,EAAE,OAAO;IACtC,eAAe,EAAE,QAAQ,EAAE,YAAY;CAC/B,CAAC"}
@@ -41,51 +41,23 @@ export interface StepAttempt {
41
41
  * Immutable cache for step attempts, keyed by step name.
42
42
  */
43
43
  export type StepAttemptCache = ReadonlyMap<string, StepAttempt>;
44
- /**
45
- * Serialized error format for JSON compatibility.
46
- */
47
- export interface SerializedError {
48
- message: string;
49
- name?: string;
50
- stack?: string | null;
51
- [key: string]: JsonValue;
52
- }
53
- /**
54
- * Serialize an error to a JSON-compatible format. Pure function that converts
55
- * any error into a SerializedError object.
56
- *
57
- * @param error - The error to serialize (can be Error instance or any value)
58
- * @returns A JSON-serializable error object
59
- */
60
- export declare function serializeError(error: unknown): SerializedError;
61
44
  /**
62
45
  * Create a step attempt cache from an array of attempts. Only includes
63
46
  * successful attempts (completed or succeeded status).
64
- *
65
47
  * @param attempts - Array of step attempts to cache
66
48
  * @returns An immutable map of step name to successful attempt
67
49
  */
68
50
  export declare function createStepAttemptCacheFromAttempts(attempts: readonly StepAttempt[]): StepAttemptCache;
69
51
  /**
70
52
  * Get a cached step attempt by name.
71
- *
72
53
  * @param cache - The step attempt cache
73
54
  * @param stepName - The name of the step to look up
74
55
  * @returns The cached attempt or undefined if not found
75
56
  */
76
57
  export declare function getCachedStepAttempt(cache: StepAttemptCache, stepName: string): StepAttempt | undefined;
77
- /**
78
- * Check if a step attempt is cached (has completed successfully).
79
- *
80
- * @param cache - The step attempt cache
81
- * @param stepName - The name of the step to check
82
- * @returns True if the step has a cached successful result
83
- */
84
- export declare function hasCompletedStep(cache: StepAttemptCache, stepName: string): boolean;
85
58
  /**
86
59
  * Add a step attempt to the cache (returns new cache, original unchanged). This
87
60
  * is an immutable operation.
88
- *
89
61
  * @param cache - The existing step attempt cache
90
62
  * @param attempt - The attempt to add
91
63
  * @returns A new cache with the attempt added
@@ -94,22 +66,19 @@ export declare function addToStepAttemptCache(cache: StepAttemptCache, attempt:
94
66
  /**
95
67
  * Convert a step function result to a JSON-compatible value. Undefined values
96
68
  * are converted to null for JSON serialization.
97
- *
98
69
  * @param result - The result from a step function
99
70
  * @returns A JSON-serializable value
100
71
  */
101
72
  export declare function normalizeStepOutput(result: unknown): JsonValue;
102
73
  /**
103
74
  * Calculate the resume time for a sleep step.
104
- *
105
75
  * @param duration - The duration string to sleep for
106
76
  * @param now - The current timestamp (defaults to Date.now())
107
77
  * @returns A Result containing the resume Date or an Error
108
78
  */
109
- export declare function calculateSleepResumeAt(duration: DurationString, now?: number): Result<Date, Error>;
79
+ export declare function calculateSleepResumeAt(duration: DurationString, now?: number): Result<Date>;
110
80
  /**
111
81
  * Create the context object for a sleep step attempt.
112
- *
113
82
  * @param resumeAt - The time when the sleep should resume
114
83
  * @returns The context object for the sleep step
115
84
  */
@@ -1 +1 @@
1
- {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../core/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,WAAW,GACX,WAAW,GACX,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,SAAS,GAAG,IAAI,CA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IAClC,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,SAAS,WAAW,EAAE,GAC/B,gBAAgB,CAUlB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,MAAM,GACf,WAAW,GAAG,SAAS,CAEzB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,GAC7B,gBAAgB,CAElB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,cAAc,EACxB,GAAG,GAAE,MAAmB,GACvB,MAAM,CAAC,IAAI,CAAC,CAQd;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG;IAC5D,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAKA"}
package/dist/core/step.js CHANGED
@@ -1,28 +1,8 @@
1
1
  import { parseDuration } from "./duration.js";
2
2
  import { err, ok } from "./result.js";
3
- /**
4
- * Serialize an error to a JSON-compatible format. Pure function that converts
5
- * any error into a SerializedError object.
6
- *
7
- * @param error - The error to serialize (can be Error instance or any value)
8
- * @returns A JSON-serializable error object
9
- */
10
- export function serializeError(error) {
11
- if (error instanceof Error) {
12
- return {
13
- name: error.name,
14
- message: error.message,
15
- stack: error.stack ?? null,
16
- };
17
- }
18
- return {
19
- message: String(error),
20
- };
21
- }
22
3
  /**
23
4
  * Create a step attempt cache from an array of attempts. Only includes
24
5
  * successful attempts (completed or succeeded status).
25
- *
26
6
  * @param attempts - Array of step attempts to cache
27
7
  * @returns An immutable map of step name to successful attempt
28
8
  */
@@ -33,7 +13,6 @@ export function createStepAttemptCacheFromAttempts(attempts) {
33
13
  }
34
14
  /**
35
15
  * Get a cached step attempt by name.
36
- *
37
16
  * @param cache - The step attempt cache
38
17
  * @param stepName - The name of the step to look up
39
18
  * @returns The cached attempt or undefined if not found
@@ -41,20 +20,9 @@ export function createStepAttemptCacheFromAttempts(attempts) {
41
20
  export function getCachedStepAttempt(cache, stepName) {
42
21
  return cache.get(stepName);
43
22
  }
44
- /**
45
- * Check if a step attempt is cached (has completed successfully).
46
- *
47
- * @param cache - The step attempt cache
48
- * @param stepName - The name of the step to check
49
- * @returns True if the step has a cached successful result
50
- */
51
- export function hasCompletedStep(cache, stepName) {
52
- return cache.has(stepName);
53
- }
54
23
  /**
55
24
  * Add a step attempt to the cache (returns new cache, original unchanged). This
56
25
  * is an immutable operation.
57
- *
58
26
  * @param cache - The existing step attempt cache
59
27
  * @param attempt - The attempt to add
60
28
  * @returns A new cache with the attempt added
@@ -65,7 +33,6 @@ export function addToStepAttemptCache(cache, attempt) {
65
33
  /**
66
34
  * Convert a step function result to a JSON-compatible value. Undefined values
67
35
  * are converted to null for JSON serialization.
68
- *
69
36
  * @param result - The result from a step function
70
37
  * @returns A JSON-serializable value
71
38
  */
@@ -74,7 +41,6 @@ export function normalizeStepOutput(result) {
74
41
  }
75
42
  /**
76
43
  * Calculate the resume time for a sleep step.
77
- *
78
44
  * @param duration - The duration string to sleep for
79
45
  * @param now - The current timestamp (defaults to Date.now())
80
46
  * @returns A Result containing the resume Date or an Error
@@ -88,7 +54,6 @@ export function calculateSleepResumeAt(duration, now = Date.now()) {
88
54
  }
89
55
  /**
90
56
  * Create the context object for a sleep step attempt.
91
- *
92
57
  * @param resumeAt - The time when the sleep should resume
93
58
  * @returns The context object for the sleep step
94
59
  */
@@ -1 +1 @@
1
- {"version":3,"file":"step.js","sourceRoot":"","sources":["../../core/step.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AA6DtC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI;SAC3B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC;KACvB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kCAAkC,CAChD,QAAgC;IAEhC,2DAA2D;IAC3D,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CACxC,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,MAAM,KAAK,WAAW,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW,CACnE,CAAC;IAEF,OAAO,IAAI,GAAG,CACZ,kBAAkB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CACjE,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAuB,EACvB,QAAgB;IAEhB,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAuB,EACvB,QAAgB;IAEhB,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ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ue } from "./json.js";
2
3
  import type { StandardSchemaV1 } from "./schema.js";
3
4
  /**
@@ -18,7 +19,7 @@ export interface WorkflowRun {
18
19
  context: JsonValue | null;
19
20
  input: JsonValue | null;
20
21
  output: JsonValue | null;
21
- error: JsonValue | null;
22
+ error: SerializedError | null;
22
23
  attempts: number;
23
24
  parentStepAttemptNamespaceId: string | null;
24
25
  parentStepAttemptId: string | null;
@@ -49,30 +50,9 @@ export type ValidationResult<T> = {
49
50
  success: false;
50
51
  error: string;
51
52
  };
52
- /**
53
- * Configuration options for a workflow definition.
54
- */
55
- export interface WorkflowConfig<TSchema extends StandardSchemaV1 | undefined = undefined> {
56
- /** The unique name of the workflow. */
57
- name: string;
58
- /** Optional version string for zero-downtime deployments. */
59
- version?: string;
60
- /** Optional schema for input validation (Standard Schema v1). */
61
- schema?: TSchema;
62
- }
63
- /**
64
- * Default configuration for result polling when awaiting workflow completion.
65
- */
66
- export declare const DEFAULT_WORKFLOW_RESULT_CONFIG: {
67
- /** Polling interval in milliseconds (1 second) */
68
- readonly pollIntervalMs: 1000;
69
- /** Timeout in milliseconds (5 minutes) */
70
- readonly timeoutMs: number;
71
- };
72
53
  /**
73
54
  * Validate input against a Standard Schema. Pure async function that validates
74
55
  * input and returns a ValidationResult.
75
- *
76
56
  * @param schema - The Standard Schema to validate against (or null/undefined
77
57
  * for no validation)
78
58
  * @param input - The input value to validate
@@ -80,29 +60,4 @@ export declare const DEFAULT_WORKFLOW_RESULT_CONFIG: {
80
60
  * message
81
61
  */
82
62
  export declare function validateInput<RunInput, Input>(schema: StandardSchemaV1<RunInput, Input> | null | undefined, input: RunInput | undefined): Promise<ValidationResult<Input>>;
83
- /**
84
- * Create a workflow configuration object with defaults applied.
85
- *
86
- * @param config - The user-provided workflow configuration
87
- * @returns A normalized workflow configuration
88
- */
89
- export declare function createWorkflowConfig<TSchema extends StandardSchemaV1 | undefined = undefined>(config: Readonly<WorkflowConfig<TSchema>>): Readonly<{
90
- name: string;
91
- version: string | null;
92
- schema: TSchema | null;
93
- }>;
94
- /**
95
- * Check if a workflow definition has a schema for validation.
96
- *
97
- * @param config - The workflow configuration
98
- * @returns True if the workflow has a schema configured
99
- */
100
- export declare function hasSchema<TSchema extends StandardSchemaV1 | undefined>(config: Readonly<WorkflowConfig<TSchema>>): boolean;
101
- /**
102
- * Check if a workflow run status represents a terminal state.
103
- *
104
- * @param status - The workflow run status
105
- * @returns True if the status is terminal (completed, failed, or canceled)
106
- */
107
- export declare function isTerminalStatus(status: string): status is "succeeded" | "completed" | "failed" | "canceled";
108
63
  //# sourceMappingURL=workflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../core/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,SAAS,GACT,UAAU,GACV,WAAW,GACX,WAAW,GACX,QAAQ,GACR,UAAU,CAAC;AAEf;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,mBAAmB,EAAE,MA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