duron 0.3.0-beta.8 → 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.
- package/dist/action-job.d.ts +33 -2
- package/dist/action-job.d.ts.map +1 -1
- package/dist/action-job.js +93 -26
- package/dist/action-manager.d.ts +44 -2
- package/dist/action-manager.d.ts.map +1 -1
- package/dist/action-manager.js +64 -3
- package/dist/action.d.ts +388 -7
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +44 -23
- package/dist/adapters/adapter.d.ts +365 -8
- package/dist/adapters/adapter.d.ts.map +1 -1
- package/dist/adapters/adapter.js +221 -15
- package/dist/adapters/postgres/base.d.ts +184 -6
- package/dist/adapters/postgres/base.d.ts.map +1 -1
- package/dist/adapters/postgres/base.js +436 -75
- package/dist/adapters/postgres/pglite.d.ts +37 -0
- package/dist/adapters/postgres/pglite.d.ts.map +1 -1
- package/dist/adapters/postgres/pglite.js +38 -0
- package/dist/adapters/postgres/postgres.d.ts +35 -0
- package/dist/adapters/postgres/postgres.d.ts.map +1 -1
- package/dist/adapters/postgres/postgres.js +42 -0
- package/dist/adapters/postgres/schema.d.ts +150 -37
- package/dist/adapters/postgres/schema.d.ts.map +1 -1
- package/dist/adapters/postgres/schema.default.d.ts +151 -38
- package/dist/adapters/postgres/schema.default.d.ts.map +1 -1
- package/dist/adapters/postgres/schema.default.js +2 -2
- package/dist/adapters/postgres/schema.js +60 -23
- package/dist/adapters/schemas.d.ts +124 -80
- package/dist/adapters/schemas.d.ts.map +1 -1
- package/dist/adapters/schemas.js +139 -26
- package/dist/client.d.ts +426 -22
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +370 -20
- package/dist/constants.js +6 -0
- package/dist/errors.d.ts +166 -9
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +189 -19
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/server.d.ts +99 -37
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +84 -25
- package/dist/step-manager.d.ts +111 -4
- package/dist/step-manager.d.ts.map +1 -1
- package/dist/step-manager.js +411 -75
- package/dist/telemetry/index.d.ts +1 -4
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +2 -4
- package/dist/telemetry/local-span-exporter.d.ts +56 -0
- package/dist/telemetry/local-span-exporter.d.ts.map +1 -0
- package/dist/telemetry/local-span-exporter.js +118 -0
- package/dist/utils/p-retry.d.ts +5 -0
- package/dist/utils/p-retry.d.ts.map +1 -1
- package/dist/utils/p-retry.js +8 -0
- package/dist/utils/wait-for-abort.d.ts +1 -0
- package/dist/utils/wait-for-abort.d.ts.map +1 -1
- package/dist/utils/wait-for-abort.js +1 -0
- package/migrations/postgres/{20260119153838_flimsy_thor_girl → 20260121160012_normal_bloodstrike}/migration.sql +32 -20
- package/migrations/postgres/{20260119153838_flimsy_thor_girl → 20260121160012_normal_bloodstrike}/snapshot.json +241 -66
- package/package.json +42 -26
- package/src/action-job.ts +43 -32
- package/src/action-manager.ts +5 -5
- package/src/action.ts +317 -149
- package/src/adapters/adapter.ts +54 -54
- package/src/adapters/postgres/base.ts +266 -86
- package/src/adapters/postgres/schema.default.ts +2 -2
- package/src/adapters/postgres/schema.ts +52 -24
- package/src/adapters/schemas.ts +91 -36
- package/src/client.ts +322 -68
- package/src/errors.ts +141 -30
- package/src/index.ts +2 -0
- package/src/server.ts +39 -37
- package/src/step-manager.ts +254 -91
- package/src/telemetry/index.ts +2 -20
- package/src/telemetry/local-span-exporter.ts +148 -0
- package/dist/telemetry/adapter.d.ts +0 -107
- package/dist/telemetry/adapter.d.ts.map +0 -1
- package/dist/telemetry/adapter.js +0 -134
- package/dist/telemetry/local.d.ts +0 -22
- package/dist/telemetry/local.d.ts.map +0 -1
- package/dist/telemetry/local.js +0 -243
- package/dist/telemetry/noop.d.ts +0 -17
- package/dist/telemetry/noop.d.ts.map +0 -1
- package/dist/telemetry/noop.js +0 -66
- package/dist/telemetry/opentelemetry.d.ts +0 -25
- package/dist/telemetry/opentelemetry.d.ts.map +0 -1
- package/dist/telemetry/opentelemetry.js +0 -312
- package/src/telemetry/adapter.ts +0 -642
- package/src/telemetry/local.ts +0 -429
- package/src/telemetry/noop.ts +0 -141
- package/src/telemetry/opentelemetry.ts +0 -453
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import type { Logger } from 'pino';
|
|
3
3
|
import { type JobStatus, type StepStatus } from '../constants.js';
|
|
4
|
-
import type { CancelJobOptions, CancelJobStepOptions, CompleteJobOptions, CompleteJobStepOptions, CreateJobOptions, CreateOrRecoverJobStepOptions, CreateOrRecoverJobStepResult, DelayJobStepOptions, DeleteJobOptions, DeleteJobsOptions,
|
|
5
|
-
export type { ActionStats, CancelJobOptions, CancelJobStepOptions, CompleteJobOptions, CompleteJobStepOptions, CreateJobOptions, CreateOrRecoverJobStepOptions, CreateOrRecoverJobStepResult, DelayJobStepOptions, DeleteJobOptions, DeleteJobsOptions,
|
|
4
|
+
import type { CancelJobOptions, CancelJobStepOptions, CompleteJobOptions, CompleteJobStepOptions, CreateJobOptions, CreateOrRecoverJobStepOptions, CreateOrRecoverJobStepResult, DelayJobStepOptions, DeleteJobOptions, DeleteJobsOptions, DeleteSpansOptions, FailJobOptions, FailJobStepOptions, FetchOptions, GetActionsResult, GetJobStepsOptions, GetJobStepsResult, GetJobsOptions, GetJobsResult, GetSpansOptions, GetSpansResult, InsertSpanOptions, Job, JobStatusResult, JobStep, JobStepStatusResult, RecoverJobsOptions, RetryJobOptions, TimeTravelJobOptions } from './schemas.js';
|
|
5
|
+
export type { ActionStats, CancelJobOptions, CancelJobStepOptions, CompleteJobOptions, CompleteJobStepOptions, CreateJobOptions, CreateOrRecoverJobStepOptions, CreateOrRecoverJobStepResult, DelayJobStepOptions, DeleteJobOptions, DeleteJobsOptions, DeleteSpansOptions, FailJobOptions, FailJobStepOptions, FetchOptions, GetActionsResult, GetJobStepsOptions, GetJobStepsResult, GetJobsOptions, GetJobsResult, GetSpansOptions, GetSpansResult, InsertSpanOptions, Job, JobFilters, JobSort, JobSortField, JobStatusResult, JobStep, JobStepStatusResult, RecoverJobsOptions, RetryJobOptions, SortOrder, Span, SpanEvent, SpanFilters, SpanKind, SpanSort, SpanSortField, SpanStatusCode, TimeTravelJobOptions, } from './schemas.js';
|
|
6
6
|
export interface AdapterEvents {
|
|
7
7
|
'job-status-changed': [
|
|
8
8
|
{
|
|
@@ -35,66 +35,423 @@ export interface AdapterEvents {
|
|
|
35
35
|
}
|
|
36
36
|
];
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Abstract base class for database adapters.
|
|
40
|
+
* All adapters must extend this class and implement its abstract methods.
|
|
41
|
+
*/
|
|
38
42
|
export declare abstract class Adapter extends EventEmitter<AdapterEvents> {
|
|
39
43
|
#private;
|
|
44
|
+
/**
|
|
45
|
+
* Start the adapter.
|
|
46
|
+
* Performs any necessary initialization, such as running migrations or setting up listeners.
|
|
47
|
+
*
|
|
48
|
+
* @returns Promise resolving to `true` if started successfully, `false` otherwise
|
|
49
|
+
*/
|
|
40
50
|
start(): Promise<boolean>;
|
|
51
|
+
/**
|
|
52
|
+
* Stop the adapter.
|
|
53
|
+
* Performs cleanup, such as closing database connections.
|
|
54
|
+
*
|
|
55
|
+
* @returns Promise resolving to `true` if stopped successfully, `false` otherwise
|
|
56
|
+
*/
|
|
41
57
|
stop(): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Set the unique identifier for this adapter instance.
|
|
60
|
+
* Used for multi-process coordination and job ownership.
|
|
61
|
+
*
|
|
62
|
+
* @param id - The unique identifier for this adapter instance
|
|
63
|
+
*/
|
|
42
64
|
setId(id: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Set the logger instance for this adapter.
|
|
67
|
+
*
|
|
68
|
+
* @param logger - The logger instance to use for logging
|
|
69
|
+
*/
|
|
43
70
|
setLogger(logger: Logger): void;
|
|
71
|
+
/**
|
|
72
|
+
* Get the unique identifier for this adapter instance.
|
|
73
|
+
*
|
|
74
|
+
* @returns The unique identifier for this adapter instance
|
|
75
|
+
*/
|
|
44
76
|
get id(): string;
|
|
77
|
+
/**
|
|
78
|
+
* Get the logger instance for this adapter.
|
|
79
|
+
*
|
|
80
|
+
* @returns The logger instance, or `null` if not set
|
|
81
|
+
*/
|
|
45
82
|
get logger(): Logger | null;
|
|
83
|
+
/**
|
|
84
|
+
* Create a new job in the database.
|
|
85
|
+
*
|
|
86
|
+
* @returns Promise resolving to the job ID, or `null` if creation failed
|
|
87
|
+
*/
|
|
46
88
|
createJob(options: CreateJobOptions): Promise<string | null>;
|
|
89
|
+
/**
|
|
90
|
+
* Mark a job as completed.
|
|
91
|
+
*
|
|
92
|
+
* @returns Promise resolving to `true` if completed, `false` otherwise
|
|
93
|
+
*/
|
|
47
94
|
completeJob(options: CompleteJobOptions): Promise<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Mark a job as failed.
|
|
97
|
+
*
|
|
98
|
+
* @returns Promise resolving to `true` if failed, `false` otherwise
|
|
99
|
+
*/
|
|
48
100
|
failJob(options: FailJobOptions): Promise<boolean>;
|
|
101
|
+
/**
|
|
102
|
+
* Cancel a job.
|
|
103
|
+
*
|
|
104
|
+
* @returns Promise resolving to `true` if cancelled, `false` otherwise
|
|
105
|
+
*/
|
|
49
106
|
cancelJob(options: CancelJobOptions): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* Retry a failed job by creating a copy of it with status 'created' and cleared output/error.
|
|
109
|
+
*
|
|
110
|
+
* @returns Promise resolving to the job ID, or `null` if creation failed
|
|
111
|
+
*/
|
|
50
112
|
retryJob(options: RetryJobOptions): Promise<string | null>;
|
|
113
|
+
/**
|
|
114
|
+
* Time travel a job to restart from a specific step.
|
|
115
|
+
* The job must be in completed, failed, or cancelled status.
|
|
116
|
+
* Resets the job and ancestor steps to active status, deletes subsequent steps,
|
|
117
|
+
* and preserves completed parallel siblings.
|
|
118
|
+
*
|
|
119
|
+
* @returns Promise resolving to `true` if time travel succeeded, `false` otherwise
|
|
120
|
+
*/
|
|
51
121
|
timeTravelJob(options: TimeTravelJobOptions): Promise<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* Delete a job by its ID.
|
|
124
|
+
* Active jobs cannot be deleted.
|
|
125
|
+
*
|
|
126
|
+
* @returns Promise resolving to `true` if deleted, `false` otherwise
|
|
127
|
+
*/
|
|
52
128
|
deleteJob(options: DeleteJobOptions): Promise<boolean>;
|
|
129
|
+
/**
|
|
130
|
+
* Delete multiple jobs using the same filters as getJobs.
|
|
131
|
+
* Active jobs cannot be deleted and will be excluded from deletion.
|
|
132
|
+
*
|
|
133
|
+
* @returns Promise resolving to the number of jobs deleted
|
|
134
|
+
*/
|
|
53
135
|
deleteJobs(options?: DeleteJobsOptions): Promise<number>;
|
|
136
|
+
/**
|
|
137
|
+
* Fetch jobs from the database respecting concurrency limits per group.
|
|
138
|
+
*
|
|
139
|
+
* @returns Promise resolving to an array of fetched jobs
|
|
140
|
+
*/
|
|
54
141
|
fetch(options: FetchOptions): Promise<Job[]>;
|
|
142
|
+
/**
|
|
143
|
+
* Recover stuck jobs (jobs that were active but the process that owned them is no longer running).
|
|
144
|
+
*
|
|
145
|
+
* @returns Promise resolving to the number of jobs recovered
|
|
146
|
+
*/
|
|
55
147
|
recoverJobs(options: RecoverJobsOptions): Promise<number>;
|
|
148
|
+
/**
|
|
149
|
+
* Create or recover a job step by creating or resetting a step record in the database.
|
|
150
|
+
*
|
|
151
|
+
* @returns Promise resolving to the step, or `null` if creation failed
|
|
152
|
+
*/
|
|
56
153
|
createOrRecoverJobStep(options: CreateOrRecoverJobStepOptions): Promise<CreateOrRecoverJobStepResult | null>;
|
|
154
|
+
/**
|
|
155
|
+
* Mark a job step as completed.
|
|
156
|
+
*
|
|
157
|
+
* @returns Promise resolving to `true` if completed, `false` otherwise
|
|
158
|
+
*/
|
|
57
159
|
completeJobStep(options: CompleteJobStepOptions): Promise<boolean>;
|
|
160
|
+
/**
|
|
161
|
+
* Mark a job step as failed.
|
|
162
|
+
*
|
|
163
|
+
* @returns Promise resolving to `true` if failed, `false` otherwise
|
|
164
|
+
*/
|
|
58
165
|
failJobStep(options: FailJobStepOptions): Promise<boolean>;
|
|
166
|
+
/**
|
|
167
|
+
* Delay a job step.
|
|
168
|
+
*
|
|
169
|
+
* @returns Promise resolving to `true` if delayed, `false` otherwise
|
|
170
|
+
*/
|
|
59
171
|
delayJobStep(options: DelayJobStepOptions): Promise<boolean>;
|
|
172
|
+
/**
|
|
173
|
+
* Cancel a job step.
|
|
174
|
+
*
|
|
175
|
+
* @returns Promise resolving to `true` if cancelled, `false` otherwise
|
|
176
|
+
*/
|
|
60
177
|
cancelJobStep(options: CancelJobStepOptions): Promise<boolean>;
|
|
178
|
+
/**
|
|
179
|
+
* Internal method to create a new job in the database.
|
|
180
|
+
*
|
|
181
|
+
* @param options - Validated job creation options
|
|
182
|
+
* @returns Promise resolving to the job ID, or `null` if creation failed
|
|
183
|
+
*/
|
|
61
184
|
protected abstract _createJob(options: CreateJobOptions): Promise<string | null>;
|
|
185
|
+
/**
|
|
186
|
+
* Internal method to mark a job as completed.
|
|
187
|
+
*
|
|
188
|
+
* @param options - Validated job completion options
|
|
189
|
+
* @returns Promise resolving to `true` if completed, `false` otherwise
|
|
190
|
+
*/
|
|
62
191
|
protected abstract _completeJob(options: CompleteJobOptions): Promise<boolean>;
|
|
192
|
+
/**
|
|
193
|
+
* Internal method to mark a job as failed.
|
|
194
|
+
*
|
|
195
|
+
* @param options - Validated job failure options
|
|
196
|
+
* @returns Promise resolving to `true` if failed, `false` otherwise
|
|
197
|
+
*/
|
|
63
198
|
protected abstract _failJob(options: FailJobOptions): Promise<boolean>;
|
|
199
|
+
/**
|
|
200
|
+
* Internal method to cancel a job.
|
|
201
|
+
*
|
|
202
|
+
* @param options - Validated job cancellation options
|
|
203
|
+
* @returns Promise resolving to `true` if cancelled, `false` otherwise
|
|
204
|
+
*/
|
|
64
205
|
protected abstract _cancelJob(options: CancelJobOptions): Promise<boolean>;
|
|
206
|
+
/**
|
|
207
|
+
* Internal method to retry a failed job by creating a copy of it with status 'created' and cleared output/error.
|
|
208
|
+
*
|
|
209
|
+
* @param options - Validated job retry options
|
|
210
|
+
* @returns Promise resolving to the job ID, or `null` if creation failed
|
|
211
|
+
*/
|
|
65
212
|
protected abstract _retryJob(options: RetryJobOptions): Promise<string | null>;
|
|
213
|
+
/**
|
|
214
|
+
* Internal method to time travel a job to restart from a specific step.
|
|
215
|
+
* The job must be in completed, failed, or cancelled status.
|
|
216
|
+
* Resets the job and ancestor steps to active status, deletes subsequent steps,
|
|
217
|
+
* and preserves completed parallel siblings.
|
|
218
|
+
*
|
|
219
|
+
* @param options - Validated time travel options
|
|
220
|
+
* @returns Promise resolving to `true` if time travel succeeded, `false` otherwise
|
|
221
|
+
*/
|
|
66
222
|
protected abstract _timeTravelJob(options: TimeTravelJobOptions): Promise<boolean>;
|
|
223
|
+
/**
|
|
224
|
+
* Internal method to delete a job by its ID.
|
|
225
|
+
* Active jobs cannot be deleted.
|
|
226
|
+
*
|
|
227
|
+
* @param options - Validated job deletion options
|
|
228
|
+
* @returns Promise resolving to `true` if deleted, `false` otherwise
|
|
229
|
+
*/
|
|
67
230
|
protected abstract _deleteJob(options: DeleteJobOptions): Promise<boolean>;
|
|
231
|
+
/**
|
|
232
|
+
* Internal method to delete multiple jobs using the same filters as getJobs.
|
|
233
|
+
* Active jobs cannot be deleted and will be excluded from deletion.
|
|
234
|
+
*
|
|
235
|
+
* @param options - Validated deletion options (same as GetJobsOptions)
|
|
236
|
+
* @returns Promise resolving to the number of jobs deleted
|
|
237
|
+
*/
|
|
68
238
|
protected abstract _deleteJobs(options?: DeleteJobsOptions): Promise<number>;
|
|
239
|
+
/**
|
|
240
|
+
* Internal method to fetch jobs from the database respecting concurrency limits per group.
|
|
241
|
+
*
|
|
242
|
+
* @param options - Validated fetch options
|
|
243
|
+
* @returns Promise resolving to an array of fetched jobs
|
|
244
|
+
*/
|
|
69
245
|
protected abstract _fetch(options: FetchOptions): Promise<Job[]>;
|
|
246
|
+
/**
|
|
247
|
+
* Internal method to recover stuck jobs (jobs that were active but the process that owned them is no longer running).
|
|
248
|
+
*
|
|
249
|
+
* @param options - Validated recovery options
|
|
250
|
+
* @returns Promise resolving to the number of jobs recovered
|
|
251
|
+
*/
|
|
70
252
|
protected abstract _recoverJobs(options: RecoverJobsOptions): Promise<number>;
|
|
253
|
+
/**
|
|
254
|
+
* Internal method to create or recover a job step by creating or resetting a step record in the database.
|
|
255
|
+
*
|
|
256
|
+
* @param options - Validated step creation options
|
|
257
|
+
* @returns Promise resolving to the step, or `null` if creation failed
|
|
258
|
+
*/
|
|
71
259
|
protected abstract _createOrRecoverJobStep(options: CreateOrRecoverJobStepOptions): Promise<CreateOrRecoverJobStepResult | null>;
|
|
260
|
+
/**
|
|
261
|
+
* Internal method to mark a job step as completed.
|
|
262
|
+
*
|
|
263
|
+
* @param options - Validated step completion options
|
|
264
|
+
* @returns Promise resolving to `true` if completed, `false` otherwise
|
|
265
|
+
*/
|
|
72
266
|
protected abstract _completeJobStep(options: CompleteJobStepOptions): Promise<boolean>;
|
|
267
|
+
/**
|
|
268
|
+
* Internal method to mark a job step as failed.
|
|
269
|
+
*
|
|
270
|
+
* @param options - Validated step failure options
|
|
271
|
+
* @returns Promise resolving to `true` if failed, `false` otherwise
|
|
272
|
+
*/
|
|
73
273
|
protected abstract _failJobStep(options: FailJobStepOptions): Promise<boolean>;
|
|
274
|
+
/**
|
|
275
|
+
* Internal method to delay a job step.
|
|
276
|
+
*
|
|
277
|
+
* @param options - Validated step delay options
|
|
278
|
+
* @returns Promise resolving to `true` if delayed, `false` otherwise
|
|
279
|
+
*/
|
|
74
280
|
protected abstract _delayJobStep(options: DelayJobStepOptions): Promise<boolean>;
|
|
281
|
+
/**
|
|
282
|
+
* Internal method to cancel a job step.
|
|
283
|
+
*
|
|
284
|
+
* @param options - Validated step cancellation options
|
|
285
|
+
* @returns Promise resolving to `true` if cancelled, `false` otherwise
|
|
286
|
+
*/
|
|
75
287
|
protected abstract _cancelJobStep(options: CancelJobStepOptions): Promise<boolean>;
|
|
288
|
+
/**
|
|
289
|
+
* Get a job by its ID. Does not include step information.
|
|
290
|
+
*
|
|
291
|
+
* @param jobId - The ID of the job to retrieve
|
|
292
|
+
* @returns Promise resolving to the job, or `null` if not found
|
|
293
|
+
*/
|
|
76
294
|
getJobById(jobId: string): Promise<Job | null>;
|
|
295
|
+
/**
|
|
296
|
+
* Get steps for a job with pagination and fuzzy search.
|
|
297
|
+
* Steps are always ordered by created_at ASC.
|
|
298
|
+
* Steps do not include output data.
|
|
299
|
+
*
|
|
300
|
+
* @param options - Query options including jobId, pagination, and search
|
|
301
|
+
* @returns Promise resolving to steps result with pagination info
|
|
302
|
+
*/
|
|
77
303
|
getJobSteps(options: GetJobStepsOptions): Promise<GetJobStepsResult>;
|
|
304
|
+
/**
|
|
305
|
+
* Get jobs with pagination, filtering, and sorting.
|
|
306
|
+
* Does not include step information or job output.
|
|
307
|
+
*
|
|
308
|
+
* @param options - Query options including pagination, filters, and sort
|
|
309
|
+
* @returns Promise resolving to jobs result with pagination info
|
|
310
|
+
*/
|
|
78
311
|
getJobs(options?: GetJobsOptions): Promise<GetJobsResult>;
|
|
312
|
+
/**
|
|
313
|
+
* Get a step by its ID with all information.
|
|
314
|
+
*
|
|
315
|
+
* @param stepId - The ID of the step to retrieve
|
|
316
|
+
* @returns Promise resolving to the step, or `null` if not found
|
|
317
|
+
*/
|
|
79
318
|
getJobStepById(stepId: string): Promise<JobStep | null>;
|
|
319
|
+
/**
|
|
320
|
+
* Get job status and updatedAt timestamp.
|
|
321
|
+
*
|
|
322
|
+
* @param jobId - The ID of the job
|
|
323
|
+
* @returns Promise resolving to job status result, or `null` if not found
|
|
324
|
+
*/
|
|
80
325
|
getJobStatus(jobId: string): Promise<JobStatusResult | null>;
|
|
326
|
+
/**
|
|
327
|
+
* Get job step status and updatedAt timestamp.
|
|
328
|
+
*
|
|
329
|
+
* @param stepId - The ID of the step
|
|
330
|
+
* @returns Promise resolving to step status result, or `null` if not found
|
|
331
|
+
*/
|
|
81
332
|
getJobStepStatus(stepId: string): Promise<JobStepStatusResult | null>;
|
|
333
|
+
/**
|
|
334
|
+
* Get action statistics including counts and last job created date.
|
|
335
|
+
*
|
|
336
|
+
* @returns Promise resolving to action statistics
|
|
337
|
+
*/
|
|
82
338
|
getActions(): Promise<GetActionsResult>;
|
|
339
|
+
/**
|
|
340
|
+
* Internal method to get a job by its ID. Does not include step information.
|
|
341
|
+
*
|
|
342
|
+
* @param jobId - The validated ID of the job to retrieve
|
|
343
|
+
* @returns Promise resolving to the job, or `null` if not found
|
|
344
|
+
*/
|
|
83
345
|
protected abstract _getJobById(jobId: string): Promise<Job | null>;
|
|
346
|
+
/**
|
|
347
|
+
* Internal method to get steps for a job with pagination and fuzzy search.
|
|
348
|
+
* Steps are always ordered by created_at ASC.
|
|
349
|
+
* Steps do not include output data.
|
|
350
|
+
*
|
|
351
|
+
* @param options - Validated query options including jobId, pagination, and search
|
|
352
|
+
* @returns Promise resolving to steps result with pagination info
|
|
353
|
+
*/
|
|
84
354
|
protected abstract _getJobSteps(options: GetJobStepsOptions): Promise<GetJobStepsResult>;
|
|
355
|
+
/**
|
|
356
|
+
* Internal method to get jobs with pagination, filtering, and sorting.
|
|
357
|
+
* Does not include step information or job output.
|
|
358
|
+
*
|
|
359
|
+
* @param options - Validated query options including pagination, filters, and sort
|
|
360
|
+
* @returns Promise resolving to jobs result with pagination info
|
|
361
|
+
*/
|
|
85
362
|
protected abstract _getJobs(options?: GetJobsOptions): Promise<GetJobsResult>;
|
|
363
|
+
/**
|
|
364
|
+
* Internal method to get a step by its ID with all information.
|
|
365
|
+
*
|
|
366
|
+
* @param stepId - The validated ID of the step to retrieve
|
|
367
|
+
* @returns Promise resolving to the step, or `null` if not found
|
|
368
|
+
*/
|
|
86
369
|
protected abstract _getJobStepById(stepId: string): Promise<JobStep | null>;
|
|
370
|
+
/**
|
|
371
|
+
* Internal method to get job status and updatedAt timestamp.
|
|
372
|
+
*
|
|
373
|
+
* @param jobId - The validated ID of the job
|
|
374
|
+
* @returns Promise resolving to job status result, or `null` if not found
|
|
375
|
+
*/
|
|
87
376
|
protected abstract _getJobStatus(jobId: string): Promise<JobStatusResult | null>;
|
|
377
|
+
/**
|
|
378
|
+
* Internal method to get job step status and updatedAt timestamp.
|
|
379
|
+
*
|
|
380
|
+
* @param stepId - The validated ID of the step
|
|
381
|
+
* @returns Promise resolving to step status result, or `null` if not found
|
|
382
|
+
*/
|
|
88
383
|
protected abstract _getJobStepStatus(stepId: string): Promise<JobStepStatusResult | null>;
|
|
384
|
+
/**
|
|
385
|
+
* Internal method to get action statistics including counts and last job created date.
|
|
386
|
+
*
|
|
387
|
+
* @returns Promise resolving to action statistics
|
|
388
|
+
*/
|
|
89
389
|
protected abstract _getActions(): Promise<GetActionsResult>;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
390
|
+
/**
|
|
391
|
+
* Insert multiple span records in a single batch operation.
|
|
392
|
+
* Used by LocalSpanExporter to store spans from the OpenTelemetry SDK.
|
|
393
|
+
*
|
|
394
|
+
* @param spans - Array of span data to insert
|
|
395
|
+
* @returns Promise resolving to the number of spans inserted
|
|
396
|
+
*/
|
|
397
|
+
insertSpans(spans: InsertSpanOptions[]): Promise<number>;
|
|
398
|
+
/**
|
|
399
|
+
* Get spans for a job or step.
|
|
400
|
+
*
|
|
401
|
+
* @param options - Query options including jobId/stepId, filters, and sort
|
|
402
|
+
* @returns Promise resolving to spans result
|
|
403
|
+
*/
|
|
404
|
+
getSpans(options: GetSpansOptions): Promise<GetSpansResult>;
|
|
405
|
+
/**
|
|
406
|
+
* Delete all spans for a job.
|
|
407
|
+
*
|
|
408
|
+
* @param options - Options containing the jobId
|
|
409
|
+
* @returns Promise resolving to the number of spans deleted
|
|
410
|
+
*/
|
|
411
|
+
deleteSpans(options: DeleteSpansOptions): Promise<number>;
|
|
412
|
+
/**
|
|
413
|
+
* Internal method to insert multiple span records in a single batch.
|
|
414
|
+
*
|
|
415
|
+
* @param spans - Array of validated span data
|
|
416
|
+
* @returns Promise resolving to the number of spans inserted
|
|
417
|
+
*/
|
|
418
|
+
protected abstract _insertSpans(spans: InsertSpanOptions[]): Promise<number>;
|
|
419
|
+
/**
|
|
420
|
+
* Internal method to get spans for a job or step.
|
|
421
|
+
*
|
|
422
|
+
* @param options - Validated query options
|
|
423
|
+
* @returns Promise resolving to spans result
|
|
424
|
+
*/
|
|
425
|
+
protected abstract _getSpans(options: GetSpansOptions): Promise<GetSpansResult>;
|
|
426
|
+
/**
|
|
427
|
+
* Internal method to delete all spans for a job.
|
|
428
|
+
*
|
|
429
|
+
* @param options - Validated options containing the jobId
|
|
430
|
+
* @returns Promise resolving to the number of spans deleted
|
|
431
|
+
*/
|
|
432
|
+
protected abstract _deleteSpans(options: DeleteSpansOptions): Promise<number>;
|
|
433
|
+
/**
|
|
434
|
+
* Start the adapter.
|
|
435
|
+
* Performs any necessary initialization, such as running migrations or setting up listeners.
|
|
436
|
+
*
|
|
437
|
+
* @returns Promise resolving to `void`
|
|
438
|
+
*/
|
|
96
439
|
protected abstract _start(): Promise<void>;
|
|
440
|
+
/**
|
|
441
|
+
* Stop the adapter.
|
|
442
|
+
* Performs cleanup, such as closing database connections.
|
|
443
|
+
*
|
|
444
|
+
* @returns Promise resolving to `void`
|
|
445
|
+
*/
|
|
97
446
|
protected abstract _stop(): Promise<void>;
|
|
447
|
+
/**
|
|
448
|
+
* Send a notification event.
|
|
449
|
+
* This is adapter-specific (e.g., PostgreSQL NOTIFY).
|
|
450
|
+
*
|
|
451
|
+
* @param event - The event name
|
|
452
|
+
* @param data - The data to send
|
|
453
|
+
* @returns Promise resolving to `void`
|
|
454
|
+
*/
|
|
98
455
|
protected abstract _notify(event: string, data: any): Promise<void>;
|
|
99
456
|
}
|
|
100
457
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAGlC,OAAO,EAIL,KAAK,SAAS,EAId,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,6BAA6B,EAC7B,4BAA4B,EAC5B,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAGlC,OAAO,EAIL,KAAK,SAAS,EAId,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,6BAA6B,EAC7B,4BAA4B,EAC5B,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,GAAG,EACH,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACrB,MAAM,cAAc,CAAA;AAsCrB,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,oBAAoB,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