duron 0.3.0-beta.1 → 0.3.0-beta.11

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 (80) hide show
  1. package/dist/action-job.d.ts +31 -0
  2. package/dist/action-job.d.ts.map +1 -1
  3. package/dist/action-job.js +68 -7
  4. package/dist/action-manager.d.ts +42 -0
  5. package/dist/action-manager.d.ts.map +1 -1
  6. package/dist/action-manager.js +61 -0
  7. package/dist/action.d.ts +144 -0
  8. package/dist/action.d.ts.map +1 -1
  9. package/dist/action.js +133 -2
  10. package/dist/adapters/adapter.d.ts +359 -0
  11. package/dist/adapters/adapter.d.ts.map +1 -1
  12. package/dist/adapters/adapter.js +208 -0
  13. package/dist/adapters/postgres/base.d.ts +166 -0
  14. package/dist/adapters/postgres/base.d.ts.map +1 -1
  15. package/dist/adapters/postgres/base.js +273 -19
  16. package/dist/adapters/postgres/pglite.d.ts +37 -0
  17. package/dist/adapters/postgres/pglite.d.ts.map +1 -1
  18. package/dist/adapters/postgres/pglite.js +38 -0
  19. package/dist/adapters/postgres/postgres.d.ts +35 -0
  20. package/dist/adapters/postgres/postgres.d.ts.map +1 -1
  21. package/dist/adapters/postgres/postgres.js +42 -0
  22. package/dist/adapters/postgres/schema.d.ts.map +1 -1
  23. package/dist/adapters/postgres/schema.js +14 -2
  24. package/dist/adapters/schemas.d.ts +9 -0
  25. package/dist/adapters/schemas.d.ts.map +1 -1
  26. package/dist/adapters/schemas.js +73 -1
  27. package/dist/client.d.ts +249 -1
  28. package/dist/client.d.ts.map +1 -1
  29. package/dist/client.js +413 -3
  30. package/dist/constants.js +6 -0
  31. package/dist/errors.d.ts +166 -9
  32. package/dist/errors.d.ts.map +1 -1
  33. package/dist/errors.js +189 -19
  34. package/dist/server.d.ts +44 -0
  35. package/dist/server.d.ts.map +1 -1
  36. package/dist/server.js +56 -0
  37. package/dist/step-manager.d.ts +84 -0
  38. package/dist/step-manager.d.ts.map +1 -1
  39. package/dist/step-manager.js +354 -14
  40. package/dist/telemetry/adapter.d.ts +344 -0
  41. package/dist/telemetry/adapter.d.ts.map +1 -1
  42. package/dist/telemetry/adapter.js +151 -0
  43. package/dist/telemetry/index.d.ts +1 -1
  44. package/dist/telemetry/index.d.ts.map +1 -1
  45. package/dist/telemetry/index.js +1 -0
  46. package/dist/telemetry/local.d.ts +50 -1
  47. package/dist/telemetry/local.d.ts.map +1 -1
  48. package/dist/telemetry/local.js +165 -0
  49. package/dist/telemetry/noop.d.ts +12 -1
  50. package/dist/telemetry/noop.d.ts.map +1 -1
  51. package/dist/telemetry/noop.js +70 -0
  52. package/dist/telemetry/opentelemetry.d.ts +25 -1
  53. package/dist/telemetry/opentelemetry.d.ts.map +1 -1
  54. package/dist/telemetry/opentelemetry.js +149 -0
  55. package/dist/utils/p-retry.d.ts +5 -0
  56. package/dist/utils/p-retry.d.ts.map +1 -1
  57. package/dist/utils/p-retry.js +8 -0
  58. package/dist/utils/wait-for-abort.d.ts +1 -0
  59. package/dist/utils/wait-for-abort.d.ts.map +1 -1
  60. package/dist/utils/wait-for-abort.js +1 -0
  61. package/migrations/postgres/{20251203223656_conscious_johnny_blaze → 20260119153838_flimsy_thor_girl}/migration.sql +29 -2
  62. package/migrations/postgres/{20260118202533_wealthy_mysterio → 20260119153838_flimsy_thor_girl}/snapshot.json +5 -5
  63. package/package.json +1 -1
  64. package/src/action-job.ts +14 -7
  65. package/src/action.ts +23 -13
  66. package/src/adapters/postgres/base.ts +45 -19
  67. package/src/adapters/postgres/schema.ts +5 -2
  68. package/src/adapters/schemas.ts +11 -1
  69. package/src/client.ts +187 -8
  70. package/src/errors.ts +141 -30
  71. package/src/step-manager.ts +171 -10
  72. package/src/telemetry/adapter.ts +174 -0
  73. package/src/telemetry/index.ts +3 -0
  74. package/src/telemetry/local.ts +93 -0
  75. package/src/telemetry/noop.ts +46 -0
  76. package/src/telemetry/opentelemetry.ts +145 -2
  77. package/migrations/postgres/20251203223656_conscious_johnny_blaze/snapshot.json +0 -941
  78. package/migrations/postgres/20260117231749_clumsy_penance/migration.sql +0 -3
  79. package/migrations/postgres/20260117231749_clumsy_penance/snapshot.json +0 -988
  80. package/migrations/postgres/20260118202533_wealthy_mysterio/migration.sql +0 -24
@@ -16,11 +16,42 @@ export interface ActionJobOptions<TAction extends Action<any, any, any>> {
16
16
  variables: Record<string, unknown>;
17
17
  logger: Logger;
18
18
  }
19
+ /**
20
+ * ActionJob represents a single job execution for an action.
21
+ * Manages the execution lifecycle, timeout handling, and cancellation.
22
+ *
23
+ * @template TAction - The action type being executed
24
+ */
19
25
  export declare class ActionJob<TAction extends Action<any, any, any>> {
20
26
  #private;
27
+ /**
28
+ * Create a new ActionJob instance.
29
+ *
30
+ * @param options - Configuration options for the action job
31
+ */
21
32
  constructor(options: ActionJobOptions<TAction>);
33
+ /**
34
+ * Execute the action job.
35
+ * Creates the action context, sets up timeout, executes the handler,
36
+ * validates output, and marks the job as completed or failed.
37
+ *
38
+ * @returns Promise resolving to the action result
39
+ * @throws ActionTimeoutError if the job times out
40
+ * @throws ActionCancelError if the job is cancelled
41
+ * @throws Error if the job fails or output validation fails
42
+ */
22
43
  execute(): Promise<any>;
44
+ /**
45
+ * Wait for the job execution to complete.
46
+ * Returns a promise that resolves when the job finishes (successfully or with error).
47
+ *
48
+ * @returns Promise that resolves when the job is done
49
+ */
23
50
  waitForDone(): Promise<void>;
51
+ /**
52
+ * Cancel the job execution.
53
+ * Clears the timeout and aborts the action handler.
54
+ */
24
55
  cancel(): void;
25
56
  }
26
57
  //# sourceMappingURL=action-job.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-job.d.ts","sourceRoot":"","sources":["../src/action-job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAGpD,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AC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;IACxF,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,gBAAgB,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,qBAAa,SAAS,CAAC,OAAO,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;;IAkB1D;;;;OAIG;gBACS,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;IA4B9C;;;;;;;;;OASG;IACG,OAAO;IA4Hb;;;;;OAKG;IACH,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;OAGG;IACH,MAAM;CAmBP"}
@@ -1,6 +1,12 @@
1
- import { ActionCancelError, ActionTimeoutError, isCancelError, StepTimeoutError, serializeError } from './errors.js';
1
+ import { ActionCancelError, ActionTimeoutError, isCancelError, isTimeoutError, serializeError } from './errors.js';
2
2
  import { StepManager } from './step-manager.js';
3
3
  import waitForAbort from './utils/wait-for-abort.js';
4
+ /**
5
+ * ActionJob represents a single job execution for an action.
6
+ * Manages the execution lifecycle, timeout handling, and cancellation.
7
+ *
8
+ * @template TAction - The action type being executed
9
+ */
4
10
  export class ActionJob {
5
11
  #job;
6
12
  #action;
@@ -14,6 +20,14 @@ export class ActionJob {
14
20
  #done;
15
21
  #resolve = null;
16
22
  #jobSpan = null;
23
+ // ============================================================================
24
+ // Constructor
25
+ // ============================================================================
26
+ /**
27
+ * Create a new ActionJob instance.
28
+ *
29
+ * @param options - Configuration options for the action job
30
+ */
17
31
  constructor(options) {
18
32
  this.#job = options.job;
19
33
  this.#action = options.action;
@@ -22,38 +36,58 @@ export class ActionJob {
22
36
  this.#variables = options.variables;
23
37
  this.#logger = options.logger;
24
38
  this.#abortController = new AbortController();
39
+ // Create StepManager for this job
25
40
  this.#stepManager = new StepManager({
26
41
  jobId: options.job.id,
27
42
  actionName: options.job.actionName,
28
43
  adapter: options.database,
29
44
  telemetry: options.telemetry,
30
45
  logger: options.logger,
31
- concurrencyLimit: options.action.concurrency,
46
+ concurrencyLimit: options.action.steps.concurrency,
32
47
  });
33
48
  this.#done = new Promise((resolve) => {
34
49
  this.#resolve = resolve;
35
50
  });
36
51
  }
52
+ // ============================================================================
53
+ // Public API Methods
54
+ // ============================================================================
55
+ /**
56
+ * Execute the action job.
57
+ * Creates the action context, sets up timeout, executes the handler,
58
+ * validates output, and marks the job as completed or failed.
59
+ *
60
+ * @returns Promise resolving to the action result
61
+ * @throws ActionTimeoutError if the job times out
62
+ * @throws ActionCancelError if the job is cancelled
63
+ * @throws Error if the job fails or output validation fails
64
+ */
37
65
  async execute() {
66
+ // Start job telemetry span
38
67
  this.#jobSpan = await this.#telemetry.startJobSpan({
39
68
  jobId: this.#job.id,
40
69
  actionName: this.#action.name,
41
70
  groupKey: this.#job.groupKey,
42
71
  input: this.#job.input,
43
72
  });
73
+ // Set the job span on the step manager
44
74
  this.#stepManager.setJobSpan(this.#jobSpan);
45
75
  try {
76
+ // Create a child logger for this job
46
77
  const jobLogger = this.#logger.child({
47
78
  jobId: this.#job.id,
48
79
  actionName: this.#action.name,
49
80
  });
81
+ // Create observe context for the action handler
50
82
  const observeContext = this.#telemetry.createObserveContext(this.#job.id, null, this.#jobSpan);
83
+ // Create action context with step manager
51
84
  const ctx = this.#stepManager.createActionContext(this.#job, this.#action, this.#variables, this.#abortController.signal, jobLogger, observeContext);
52
85
  this.#timeoutId = setTimeout(() => {
53
- const timeoutError = new ActionTimeoutError(this.#action.name, this.#job.timeoutMs);
86
+ const timeoutError = new ActionTimeoutError(this.#action.name, this.#job.id, this.#job.timeoutMs);
54
87
  this.#abortController.abort(timeoutError);
55
88
  }, this.#job.timeoutMs);
56
89
  this.#timeoutId?.unref?.();
90
+ // Execute handler with timeout - race between handler and abort signal
57
91
  const abortWaiter = waitForAbort(this.#abortController.signal);
58
92
  let result = null;
59
93
  await Promise.race([
@@ -69,37 +103,48 @@ export class ActionJob {
69
103
  }),
70
104
  abortWaiter.promise,
71
105
  ]);
106
+ // Validate output if schema is provided
72
107
  if (this.#action.output) {
73
108
  result = this.#action.output.parse(result, {
74
109
  error: () => 'Error parsing action output',
75
110
  reportInput: true,
76
111
  });
77
112
  }
113
+ // Complete job
78
114
  const completed = await this.#database.completeJob({ jobId: this.#job.id, output: result });
79
115
  if (!completed) {
80
116
  throw new Error('Job not completed');
81
117
  }
118
+ // Log action completion
82
119
  this.#logger.debug({ jobId: this.#job.id, actionName: this.#action.name }, '[ActionJob] Action finished executing');
120
+ // End job span successfully
83
121
  await this.#telemetry.endJobSpan(this.#jobSpan, { status: 'ok' });
84
122
  return result;
85
123
  }
86
124
  catch (error) {
125
+ // Abort all running steps when an error occurs
126
+ // This ensures cascading failure and stops any steps still running
127
+ if (!this.#abortController.signal.aborted) {
128
+ this.#abortController.abort(error);
129
+ }
130
+ // Wait for step manager to drain (all steps to settle)
131
+ await this.#stepManager.drain();
87
132
  if (isCancelError(error) ||
88
133
  (error instanceof Error && error.name === 'AbortError' && isCancelError(error.cause))) {
89
134
  this.#logger.warn({ jobId: this.#job.id, actionName: this.#action.name }, '[ActionJob] Job cancelled');
90
135
  await this.#database.cancelJob({ jobId: this.#job.id });
136
+ // End job span as cancelled
91
137
  if (this.#jobSpan) {
92
138
  await this.#telemetry.endJobSpan(this.#jobSpan, { status: 'cancelled' });
93
139
  }
94
140
  return;
95
141
  }
96
- const message = error instanceof ActionTimeoutError
142
+ const message = isTimeoutError(error)
97
143
  ? '[ActionJob] Job timed out'
98
- : error instanceof StepTimeoutError
99
- ? '[ActionJob] Step timed out'
100
- : '[ActionJob] Job failed';
144
+ : '[ActionJob] Job failed';
101
145
  this.#logger.error({ jobId: this.#job.id, actionName: this.#action.name }, message);
102
146
  await this.#database.failJob({ jobId: this.#job.id, error: serializeError(error) });
147
+ // End job span with error
103
148
  if (this.#jobSpan) {
104
149
  await this.#telemetry.endJobSpan(this.#jobSpan, { status: 'error', error });
105
150
  }
@@ -110,14 +155,30 @@ export class ActionJob {
110
155
  this.#resolve?.();
111
156
  }
112
157
  }
158
+ /**
159
+ * Wait for the job execution to complete.
160
+ * Returns a promise that resolves when the job finishes (successfully or with error).
161
+ *
162
+ * @returns Promise that resolves when the job is done
163
+ */
113
164
  waitForDone() {
114
165
  return this.#done;
115
166
  }
167
+ /**
168
+ * Cancel the job execution.
169
+ * Clears the timeout and aborts the action handler.
170
+ */
116
171
  cancel() {
117
172
  this.#clear();
118
173
  const cancelError = new ActionCancelError(this.#action.name, this.#job.id);
119
174
  this.#abortController.abort(cancelError);
120
175
  }
176
+ // ============================================================================
177
+ // Private Methods
178
+ // ============================================================================
179
+ /**
180
+ * Clear the timeout timer.
181
+ */
121
182
  #clear() {
122
183
  if (this.#timeoutId) {
123
184
  clearTimeout(this.#timeoutId);
@@ -10,14 +10,56 @@ export interface ActionManagerOptions<TAction extends Action<any, any, any>> {
10
10
  logger: Logger;
11
11
  concurrencyLimit: number;
12
12
  }
13
+ /**
14
+ * ActionManager manages the execution of jobs for a specific action.
15
+ * Uses a fastq queue to control concurrency and process jobs.
16
+ *
17
+ * @template TAction - The action type being managed
18
+ */
13
19
  export declare class ActionManager<TAction extends Action<any, any, any>> {
14
20
  #private;
21
+ /**
22
+ * Create a new ActionManager instance.
23
+ *
24
+ * @param options - Configuration options for the action manager
25
+ */
15
26
  constructor(options: ActionManagerOptions<TAction>);
27
+ /**
28
+ * Queue a job for execution.
29
+ *
30
+ * @param job - The job to queue
31
+ * @returns Promise that resolves when the job is queued
32
+ */
16
33
  push(job: Job): Promise<void>;
34
+ /**
35
+ * Cancel a specific job by ID.
36
+ *
37
+ * @param jobId - The ID of the job to cancel
38
+ * @returns If the manager has the job, it will be cancelled and true will be returned. Otherwise, false will be returned.
39
+ */
17
40
  cancelJob(jobId: string): boolean;
41
+ /**
42
+ * Cancel all active jobs.
43
+ */
18
44
  abortAll(): void;
45
+ /**
46
+ * Check if the queue is idle (no jobs being processed).
47
+ *
48
+ * @returns Promise resolving to `true` if idle, `false` otherwise
49
+ */
19
50
  idle(): Promise<boolean>;
51
+ /**
52
+ * Wait for the queue to drain (all jobs completed).
53
+ *
54
+ * @returns Promise that resolves when the queue is drained
55
+ */
20
56
  drain(): Promise<void>;
57
+ /**
58
+ * Stop the action manager.
59
+ * Aborts all active jobs and waits for the queue to drain.
60
+ *
61
+ * @returns Promise that resolves when the action manager is stopped
62
+ */
21
63
  stop(): Promise<void>;
22
64
  }
23
65
  //# sourceMappingURL=action-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-manager.d.ts","sourceRoot":"","sources":["../src/action-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,MAAM,WAAW,oBAAoB,CAAC,OAAO,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACzE,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,gBAAgB,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAQD,qBAAa,aAAa,CAAC,OAAO,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;;gBAoBlD,OAAO,EAAE,oBAAoB,CAAC,OAAO,CAAC;IA4B5C,IAAI,CAAC,GAAG,EAAE,GAAG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CAAC,OAAO,CAAC;IAI9B;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CA+C5B"}
@@ -1,5 +1,11 @@
1
1
  import fastq from 'fastq';
2
2
  import { ActionJob } from './action-job.js';
3
+ /**
4
+ * ActionManager manages the execution of jobs for a specific action.
5
+ * Uses a fastq queue to control concurrency and process jobs.
6
+ *
7
+ * @template TAction - The action type being managed
8
+ */
3
9
  export class ActionManager {
4
10
  #action;
5
11
  #database;
@@ -10,6 +16,14 @@ export class ActionManager {
10
16
  #concurrencyLimit;
11
17
  #activeJobs = new Map();
12
18
  #stopped = false;
19
+ // ============================================================================
20
+ // Constructor
21
+ // ============================================================================
22
+ /**
23
+ * Create a new ActionManager instance.
24
+ *
25
+ * @param options - Configuration options for the action manager
26
+ */
13
27
  constructor(options) {
14
28
  this.#action = options.action;
15
29
  this.#database = options.database;
@@ -17,6 +31,7 @@ export class ActionManager {
17
31
  this.#variables = options.variables;
18
32
  this.#logger = options.logger;
19
33
  this.#concurrencyLimit = options.concurrencyLimit;
34
+ // Create fastq queue with action concurrency limit
20
35
  this.#queue = fastq.promise(async (job) => {
21
36
  if (this.#stopped) {
22
37
  return;
@@ -24,9 +39,24 @@ export class ActionManager {
24
39
  await this.#executeJob(job);
25
40
  }, this.#concurrencyLimit);
26
41
  }
42
+ // ============================================================================
43
+ // Public API Methods
44
+ // ============================================================================
45
+ /**
46
+ * Queue a job for execution.
47
+ *
48
+ * @param job - The job to queue
49
+ * @returns Promise that resolves when the job is queued
50
+ */
27
51
  async push(job) {
28
52
  return this.#queue.push(job);
29
53
  }
54
+ /**
55
+ * Cancel a specific job by ID.
56
+ *
57
+ * @param jobId - The ID of the job to cancel
58
+ * @returns If the manager has the job, it will be cancelled and true will be returned. Otherwise, false will be returned.
59
+ */
30
60
  cancelJob(jobId) {
31
61
  const actionJob = this.#activeJobs.get(jobId);
32
62
  if (actionJob) {
@@ -35,17 +65,36 @@ export class ActionManager {
35
65
  }
36
66
  return false;
37
67
  }
68
+ /**
69
+ * Cancel all active jobs.
70
+ */
38
71
  abortAll() {
39
72
  for (const actionJob of this.#activeJobs.values()) {
40
73
  actionJob.cancel();
41
74
  }
42
75
  }
76
+ /**
77
+ * Check if the queue is idle (no jobs being processed).
78
+ *
79
+ * @returns Promise resolving to `true` if idle, `false` otherwise
80
+ */
43
81
  async idle() {
44
82
  return this.#queue.idle();
45
83
  }
84
+ /**
85
+ * Wait for the queue to drain (all jobs completed).
86
+ *
87
+ * @returns Promise that resolves when the queue is drained
88
+ */
46
89
  async drain() {
47
90
  return this.#queue.drain();
48
91
  }
92
+ /**
93
+ * Stop the action manager.
94
+ * Aborts all active jobs and waits for the queue to drain.
95
+ *
96
+ * @returns Promise that resolves when the action manager is stopped
97
+ */
49
98
  async stop() {
50
99
  if (this.#stopped) {
51
100
  return;
@@ -55,7 +104,16 @@ export class ActionManager {
55
104
  await this.#queue.killAndDrain();
56
105
  await Promise.all(Array.from(this.#activeJobs.values()).map((actionJob) => actionJob.waitForDone()));
57
106
  }
107
+ // ============================================================================
108
+ // Private Methods
109
+ // ============================================================================
110
+ /**
111
+ * Execute a job by creating an ActionJob and running it.
112
+ *
113
+ * @param job - The job to execute
114
+ */
58
115
  async #executeJob(job) {
116
+ // Create ActionJob for this job
59
117
  const actionJob = new ActionJob({
60
118
  job: {
61
119
  id: job.id,
@@ -72,9 +130,12 @@ export class ActionManager {
72
130
  });
73
131
  this.#activeJobs.set(job.id, actionJob);
74
132
  try {
133
+ // Execute the job - all error handling is done inside ActionJob.execute()
75
134
  await actionJob.execute();
76
135
  }
77
136
  finally {
137
+ // Always cleanup, even if the job failed or was cancelled
138
+ // Errors are already handled in ActionJob.execute() (logging, failing job, etc.)
78
139
  this.#activeJobs.delete(job.id);
79
140
  }
80
141
  }
package/dist/action.d.ts CHANGED
@@ -9,32 +9,132 @@ export interface ActionHandlerContext<TInput extends z.ZodObject, TVariables = R
9
9
  groupKey: string;
10
10
  var: TVariables;
11
11
  logger: Logger;
12
+ /**
13
+ * Observability context for recording metrics and span data.
14
+ * Allows recording custom metrics, span attributes, and events.
15
+ */
12
16
  observe: ObserveContext;
17
+ /**
18
+ * Execute an inline step within the action.
19
+ *
20
+ * @param name - The name of the step (must be unique within the job)
21
+ * @param cb - The step handler callback
22
+ * @param options - Optional step configuration
23
+ * @returns Promise resolving to the step result
24
+ */
13
25
  step: <TResult>(name: string, cb: (ctx: StepHandlerContext) => Promise<TResult>, options?: z.input<typeof StepOptionsSchema>) => Promise<TResult>;
26
+ /**
27
+ * Execute a reusable step definition created with createStep().
28
+ *
29
+ * @param stepDef - The step definition to execute
30
+ * @param input - The input data for the step (validated against the step's input schema)
31
+ * @param options - Optional step configuration overrides
32
+ * @returns Promise resolving to the step result
33
+ */
14
34
  run: <TStepInput extends z.ZodObject, TResult>(stepDef: StepDefinition<TStepInput, TResult, TVariables>, input: z.input<TStepInput>, options?: Partial<z.input<typeof StepOptionsSchema>>) => Promise<TResult>;
15
35
  }
16
36
  export interface StepHandlerContext {
37
+ /**
38
+ * The abort signal for this step.
39
+ * This signal will be aborted when:
40
+ * - The action is cancelled
41
+ * - The parent step times out
42
+ * - This step times out
43
+ */
17
44
  signal: AbortSignal;
45
+ /**
46
+ * The unique ID of this step.
47
+ */
18
48
  stepId: string;
49
+ /**
50
+ * The ID of the parent step, or null if this is a root step.
51
+ */
19
52
  parentStepId: string | null;
53
+ /**
54
+ * Observability context for recording metrics and span data.
55
+ * Allows recording custom metrics, span attributes, and events.
56
+ */
20
57
  observe: ObserveContext;
58
+ /**
59
+ * Create a nested child step.
60
+ * Child steps inherit the abort signal chain from their parent.
61
+ * All child steps MUST be awaited before the parent step returns.
62
+ *
63
+ * @param name - The name of the child step (must be unique within the job)
64
+ * @param cb - The step handler callback
65
+ * @param options - Optional step configuration
66
+ * @returns Promise resolving to the step result
67
+ */
21
68
  step: <TResult>(name: string, cb: (ctx: StepHandlerContext) => Promise<TResult>, options?: z.input<typeof StepOptionsSchema>) => Promise<TResult>;
69
+ /**
70
+ * Execute a reusable step definition created with createStep().
71
+ * Allows inline steps to call step definitions.
72
+ *
73
+ * @param stepDef - The step definition to execute
74
+ * @param input - The input data for the step (validated against the step's input schema)
75
+ * @param options - Optional step configuration overrides
76
+ * @returns Promise resolving to the step result
77
+ */
78
+ run: <TStepInput extends z.ZodObject, TResult>(stepDef: StepDefinition<TStepInput, TResult, any>, input: z.input<TStepInput>, options?: Partial<z.input<typeof StepOptionsSchema>>) => Promise<TResult>;
22
79
  }
80
+ /**
81
+ * Extended context for step definition handlers.
82
+ * Includes all StepHandlerContext properties plus action-level context.
83
+ */
23
84
  export interface StepDefinitionHandlerContext<TInput extends z.ZodObject, TVariables = Record<string, unknown>> extends StepHandlerContext {
85
+ /**
86
+ * The validated input for this step.
87
+ */
24
88
  input: z.infer<TInput>;
89
+ /**
90
+ * Variables shared across the action.
91
+ */
25
92
  var: TVariables;
93
+ /**
94
+ * Logger instance for this step.
95
+ */
26
96
  logger: Logger;
97
+ /**
98
+ * The job ID this step belongs to.
99
+ */
27
100
  jobId: string;
28
101
  }
102
+ /**
103
+ * A reusable step definition created with createStep().
104
+ * Can be executed within an action handler using ctx.run().
105
+ */
29
106
  export interface StepDefinition<TInput extends z.ZodObject, TResult, TVariables = Record<string, unknown>> {
107
+ /**
108
+ * The name of the step.
109
+ * Can be a static string or a function that generates the name from the input.
110
+ */
30
111
  name: string | ((ctx: {
31
112
  input: z.infer<TInput>;
32
113
  }) => string);
114
+ /**
115
+ * Zod schema for validating the step input.
116
+ */
33
117
  input?: TInput;
118
+ /**
119
+ * Retry configuration for this step.
120
+ */
34
121
  retry?: z.input<typeof RetryOptionsSchema>;
122
+ /**
123
+ * Timeout in milliseconds for this step.
124
+ */
35
125
  expire?: number;
126
+ /**
127
+ * Whether this step runs in parallel with siblings.
128
+ */
36
129
  parallel?: boolean;
130
+ /**
131
+ * The handler function that executes the step logic.
132
+ */
37
133
  handler: (ctx: StepDefinitionHandlerContext<TInput, TVariables>) => Promise<TResult>;
134
+ /**
135
+ * Internal marker to identify this as a step definition.
136
+ * @internal
137
+ */
38
138
  __stepDefinition: true;
39
139
  }
40
140
  export interface ConcurrencyHandlerContext<TInput extends z.ZodObject, TVariables = Record<string, unknown>> {
@@ -43,12 +143,18 @@ export interface ConcurrencyHandlerContext<TInput extends z.ZodObject, TVariable
43
143
  }
44
144
  export type ActionDefinition<TInput extends z.ZodObject, TOutput extends z.ZodObject, TVariables = Record<string, unknown>> = z.input<ReturnType<typeof createActionDefinitionSchema<TInput, TOutput, TVariables>>>;
45
145
  export type Action<TInput extends z.ZodObject, TOutput extends z.ZodObject, TVariables = Record<string, unknown>> = z.infer<ReturnType<typeof createActionDefinitionSchema<TInput, TOutput, TVariables>>>;
146
+ /**
147
+ * Retry configuration options for actions and steps.
148
+ */
46
149
  export declare const RetryOptionsSchema: z.ZodDefault<z.ZodObject<{
47
150
  limit: z.ZodDefault<z.ZodNumber>;
48
151
  factor: z.ZodDefault<z.ZodNumber>;
49
152
  minTimeout: z.ZodDefault<z.ZodNumber>;
50
153
  maxTimeout: z.ZodDefault<z.ZodNumber>;
51
154
  }, z.core.$strip>>;
155
+ /**
156
+ * Options for configuring a step within an action.
157
+ */
52
158
  export declare const StepOptionsSchema: z.ZodObject<{
53
159
  retry: z.ZodDefault<z.ZodObject<{
54
160
  limit: z.ZodDefault<z.ZodNumber>;
@@ -59,6 +165,14 @@ export declare const StepOptionsSchema: z.ZodObject<{
59
165
  expire: z.ZodDefault<z.ZodNumber>;
60
166
  parallel: z.ZodDefault<z.ZodBoolean>;
61
167
  }, z.core.$strip>;
168
+ /**
169
+ * Creates a Zod schema for validating action definitions.
170
+ *
171
+ * @template TInput - Zod schema for the action input
172
+ * @template TOutput - Zod schema for the action output
173
+ * @template TVariables - Type of variables available to the action
174
+ * @returns Zod schema for action definitions
175
+ */
62
176
  export declare function createActionDefinitionSchema<TInput extends z.ZodObject, TOutput extends z.ZodObject, TVariables = Record<string, unknown>>(): z.ZodPipe<z.ZodObject<{
63
177
  name: z.ZodString;
64
178
  version: z.ZodOptional<z.ZodString>;
@@ -151,6 +265,36 @@ export declare const defineAction: <TVariables = Record<string, unknown>>() => <
151
265
  concurrency?: ((ctx: ConcurrencyHandlerContext<TInput, TVariables>) => Promise<number>) | undefined;
152
266
  } | undefined;
153
267
  };
268
+ /**
269
+ * Input type for createStep() - the definition object before transformation.
270
+ */
154
271
  export type StepDefinitionInput<TInput extends z.ZodObject, TResult, TVariables = Record<string, unknown>> = Omit<StepDefinition<TInput, TResult, TVariables>, '__stepDefinition'>;
272
+ /**
273
+ * Creates a reusable step definition that can be executed within action handlers.
274
+ *
275
+ * @template TVariables - Type of variables available to the step handler
276
+ * @returns A curried function that accepts the step definition and returns a StepDefinition
277
+ *
278
+ * @example
279
+ * ```typescript
280
+ * const sendEmailStep = createStep<typeof variables>()({
281
+ * name: 'send-email',
282
+ * input: z.object({
283
+ * email: z.string().email(),
284
+ * body: z.string(),
285
+ * }),
286
+ * retry: { limit: 3 },
287
+ * expire: 60000,
288
+ * handler: async (ctx) => {
289
+ * // ctx.input is typed as { email: string, body: string }
290
+ * // ctx.var, ctx.logger, ctx.jobId are also available
291
+ * return { success: true }
292
+ * },
293
+ * })
294
+ *
295
+ * // In an action handler:
296
+ * const result = await ctx.run(sendEmailStep, { email: 'test@example.com', body: 'Hello' })
297
+ * ```
298
+ */
155
299
  export declare const createStep: <TVariables = Record<string, unknown>>() => <TInput extends z.ZodObject, TResult>(def: StepDefinitionInput<TInput, TResult, TVariables>) => StepDefinition<TInput, TResult, TVariables>;
156
300
  //# sourceMappingURL=action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,OA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