duron 0.3.0-beta.10 → 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.
- package/dist/action-job.d.ts +31 -0
- package/dist/action-job.d.ts.map +1 -1
- package/dist/action-job.js +59 -0
- package/dist/action-manager.d.ts +42 -0
- package/dist/action-manager.d.ts.map +1 -1
- package/dist/action-manager.js +61 -0
- package/dist/action.d.ts +143 -0
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +131 -0
- package/dist/adapters/adapter.d.ts +359 -0
- package/dist/adapters/adapter.d.ts.map +1 -1
- package/dist/adapters/adapter.js +208 -0
- package/dist/adapters/postgres/base.d.ts +166 -0
- package/dist/adapters/postgres/base.d.ts.map +1 -1
- package/dist/adapters/postgres/base.js +268 -17
- 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.js +11 -1
- package/dist/adapters/schemas.d.ts +9 -0
- package/dist/adapters/schemas.d.ts.map +1 -1
- package/dist/adapters/schemas.js +73 -1
- package/dist/client.d.ts +224 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +311 -1
- package/dist/constants.js +6 -0
- package/dist/errors.d.ts +119 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +111 -0
- package/dist/server.d.ts +44 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +56 -0
- package/dist/step-manager.d.ts +83 -0
- package/dist/step-manager.d.ts.map +1 -1
- package/dist/step-manager.js +237 -5
- package/dist/telemetry/adapter.d.ts +322 -0
- package/dist/telemetry/adapter.d.ts.map +1 -1
- package/dist/telemetry/adapter.js +145 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/local.d.ts +48 -0
- package/dist/telemetry/local.d.ts.map +1 -1
- package/dist/telemetry/local.js +102 -0
- package/dist/telemetry/noop.d.ts +10 -0
- package/dist/telemetry/noop.d.ts.map +1 -1
- package/dist/telemetry/noop.js +43 -0
- package/dist/telemetry/opentelemetry.d.ts +23 -0
- package/dist/telemetry/opentelemetry.d.ts.map +1 -1
- package/dist/telemetry/opentelemetry.js +39 -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/package.json +1 -1
- package/src/adapters/postgres/base.ts +40 -17
- package/src/adapters/schemas.ts +11 -1
|
@@ -2,7 +2,19 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { drizzle } from 'drizzle-orm/pglite';
|
|
3
3
|
import { migrate } from 'drizzle-orm/pglite/migrator';
|
|
4
4
|
import { PostgresBaseAdapter } from './base.js';
|
|
5
|
+
/**
|
|
6
|
+
* PGLite adapter implementation for Duron.
|
|
7
|
+
* Extends PostgresAdapter to work with PGLite (in-memory PostgreSQL).
|
|
8
|
+
*
|
|
9
|
+
* @template Options - The adapter options type
|
|
10
|
+
*/
|
|
5
11
|
export class PGLiteAdapter extends PostgresBaseAdapter {
|
|
12
|
+
/**
|
|
13
|
+
* Start the adapter.
|
|
14
|
+
* Runs migrations if enabled and sets up database listeners.
|
|
15
|
+
*
|
|
16
|
+
* @returns Promise resolving to `true` if started successfully, `false` otherwise
|
|
17
|
+
*/
|
|
6
18
|
async _start() {
|
|
7
19
|
if (this.migrateOnStart) {
|
|
8
20
|
await migrate(this.db, {
|
|
@@ -16,11 +28,23 @@ export class PGLiteAdapter extends PostgresBaseAdapter {
|
|
|
16
28
|
async _stop() {
|
|
17
29
|
await this.db?.$client.close();
|
|
18
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Map database query results to the expected format.
|
|
33
|
+
* PGLite returns results in a `rows` property, so we extract that.
|
|
34
|
+
*
|
|
35
|
+
* @param result - The raw database query result
|
|
36
|
+
* @returns The mapped result (result.rows)
|
|
37
|
+
*/
|
|
19
38
|
_map(result) {
|
|
20
39
|
return result.rows;
|
|
21
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Initialize the PGLite database connection.
|
|
43
|
+
* Creates a new Drizzle instance without connection options.
|
|
44
|
+
*/
|
|
22
45
|
_initDb() {
|
|
23
46
|
let connection = ':memory:';
|
|
47
|
+
// it means that the user is using a file path, so we need to use the file path
|
|
24
48
|
if (typeof this.connection === 'string' && !this.connection.startsWith('postgres://')) {
|
|
25
49
|
connection = this.connection;
|
|
26
50
|
}
|
|
@@ -31,9 +55,23 @@ export class PGLiteAdapter extends PostgresBaseAdapter {
|
|
|
31
55
|
this.db = drizzle(connection);
|
|
32
56
|
}
|
|
33
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Send a PGLite notification.
|
|
60
|
+
*
|
|
61
|
+
* @param event - The event name
|
|
62
|
+
* @param data - The data to send
|
|
63
|
+
* @returns Promise resolving to `void`
|
|
64
|
+
*/
|
|
34
65
|
async _notify(event, data) {
|
|
35
66
|
await this.db?.$client.query(`NOTIFY "${this.schema}.${event}", '${JSON.stringify(data)}'`);
|
|
36
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Listen for PGLite notifications.
|
|
70
|
+
*
|
|
71
|
+
* @param event - The event name to listen for
|
|
72
|
+
* @param callback - Callback function to handle notifications
|
|
73
|
+
* @returns Promise resolving to an object with an `unlisten` function
|
|
74
|
+
*/
|
|
37
75
|
async _listen(event, callback) {
|
|
38
76
|
const unlisten = await this.db?.$client.listen(`"${this.schema}.${event}"`, (payload) => {
|
|
39
77
|
callback(payload);
|
|
@@ -5,11 +5,46 @@ import type createSchema from './schema.js';
|
|
|
5
5
|
type Schema = ReturnType<typeof createSchema>;
|
|
6
6
|
export type { Job, JobStep } from '../adapter.js';
|
|
7
7
|
export type DB = ReturnType<typeof drizzle<Schema>>;
|
|
8
|
+
/**
|
|
9
|
+
* PostgreSQL adapter implementation for Duron.
|
|
10
|
+
* Uses Drizzle ORM to interact with PostgreSQL database.
|
|
11
|
+
*
|
|
12
|
+
* @template Options - The adapter options type
|
|
13
|
+
*/
|
|
8
14
|
export declare class PostgresAdapter extends PostgresBaseAdapter<DB, PostgresOptions<any> | string> {
|
|
15
|
+
/**
|
|
16
|
+
* Initialize the database connection and Drizzle instance.
|
|
17
|
+
*/
|
|
9
18
|
protected _initDb(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Start the adapter.
|
|
21
|
+
* Runs migrations if enabled and sets up database listeners.
|
|
22
|
+
*
|
|
23
|
+
* @returns Promise resolving to `true` if started successfully, `false` otherwise
|
|
24
|
+
*/
|
|
10
25
|
protected _start(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Stop the adapter.
|
|
28
|
+
* Closes the database connection.
|
|
29
|
+
*
|
|
30
|
+
* @returns Promise resolving to `true` if stopped successfully, `false` otherwise
|
|
31
|
+
*/
|
|
11
32
|
protected _stop(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Send a PostgreSQL notification.
|
|
35
|
+
*
|
|
36
|
+
* @param event - The event name
|
|
37
|
+
* @param data - The data to send
|
|
38
|
+
* @returns Promise resolving to `void`
|
|
39
|
+
*/
|
|
12
40
|
protected _notify(event: string, data: any): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Listen for PostgreSQL notifications.
|
|
43
|
+
*
|
|
44
|
+
* @param event - The event name to listen for
|
|
45
|
+
* @param callback - Callback function to handle notifications
|
|
46
|
+
* @returns Promise resolving to an object with an `unlisten` function
|
|
47
|
+
*/
|
|
13
48
|
protected _listen(event: string, callback: (payload: string) => void): Promise<{
|
|
14
49
|
unlisten: () => void;
|
|
15
50
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../../src/adapters/postgres/postgres.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1D,OAAO,EAAE,KAAK,cAAc,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,KAAK,YAAY,MAAM,aAAa,CAAA;AAE3C,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA;AAG7C,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAMjD,MAAM,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../../src/adapters/postgres/postgres.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1D,OAAO,EAAE,KAAK,cAAc,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,KAAK,YAAY,MAAM,aAAa,CAAA;AAE3C,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA;AAG7C,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAMjD,MAAM,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;AAEnD;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,mBAAmB,CAAC,EAAE,EAAE,eAAe,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IACzF;;OAEG;cACgB,OAAO;IAwB1B;;;;;OAKG;cACsB,MAAM;IAW/B;;;;;OAKG;cACsB,KAAK;IAU9B;;;;;;OAMG;cACsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAOzE;;;;;;OAMG;cACsB,OAAO,CAC9B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAClC,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;CAKrC;AAED,eAAO,MAAM,eAAe,GAAI,SAAS,cAAc,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,oBAErF,CAAA"}
|
|
@@ -3,8 +3,18 @@ import { drizzle } from 'drizzle-orm/postgres-js';
|
|
|
3
3
|
import { migrate } from 'drizzle-orm/postgres-js/migrator';
|
|
4
4
|
import { PostgresBaseAdapter } from './base.js';
|
|
5
5
|
const noop = () => {
|
|
6
|
+
// do nothing
|
|
6
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* PostgreSQL adapter implementation for Duron.
|
|
10
|
+
* Uses Drizzle ORM to interact with PostgreSQL database.
|
|
11
|
+
*
|
|
12
|
+
* @template Options - The adapter options type
|
|
13
|
+
*/
|
|
7
14
|
export class PostgresAdapter extends PostgresBaseAdapter {
|
|
15
|
+
/**
|
|
16
|
+
* Initialize the database connection and Drizzle instance.
|
|
17
|
+
*/
|
|
8
18
|
_initDb() {
|
|
9
19
|
const postgresConnection = typeof this.connection === 'string'
|
|
10
20
|
? {
|
|
@@ -22,6 +32,15 @@ export class PostgresAdapter extends PostgresBaseAdapter {
|
|
|
22
32
|
schema: this.tables,
|
|
23
33
|
});
|
|
24
34
|
}
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Lifecycle Methods
|
|
37
|
+
// ============================================================================
|
|
38
|
+
/**
|
|
39
|
+
* Start the adapter.
|
|
40
|
+
* Runs migrations if enabled and sets up database listeners.
|
|
41
|
+
*
|
|
42
|
+
* @returns Promise resolving to `true` if started successfully, `false` otherwise
|
|
43
|
+
*/
|
|
25
44
|
async _start() {
|
|
26
45
|
if (this.migrateOnStart) {
|
|
27
46
|
await migrate(this.db, {
|
|
@@ -32,17 +51,40 @@ export class PostgresAdapter extends PostgresBaseAdapter {
|
|
|
32
51
|
}
|
|
33
52
|
await super._start();
|
|
34
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Stop the adapter.
|
|
56
|
+
* Closes the database connection.
|
|
57
|
+
*
|
|
58
|
+
* @returns Promise resolving to `true` if stopped successfully, `false` otherwise
|
|
59
|
+
*/
|
|
35
60
|
async _stop() {
|
|
36
61
|
await this.db.$client.end({
|
|
37
62
|
timeout: 5_000,
|
|
38
63
|
});
|
|
39
64
|
}
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// Protected Methods
|
|
67
|
+
// ============================================================================
|
|
68
|
+
/**
|
|
69
|
+
* Send a PostgreSQL notification.
|
|
70
|
+
*
|
|
71
|
+
* @param event - The event name
|
|
72
|
+
* @param data - The data to send
|
|
73
|
+
* @returns Promise resolving to `void`
|
|
74
|
+
*/
|
|
40
75
|
async _notify(event, data) {
|
|
41
76
|
this.logger?.debug({ event, data }, `[PostgresAdapter] Notify ${event}`);
|
|
42
77
|
await this.db.$client.notify(`${this.schema}.${event}`, JSON.stringify(data)).catch((err) => {
|
|
43
78
|
this.logger?.error({ err, data }, `[PostgresAdapter] Failed to notify ${event}`);
|
|
44
79
|
});
|
|
45
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Listen for PostgreSQL notifications.
|
|
83
|
+
*
|
|
84
|
+
* @param event - The event name to listen for
|
|
85
|
+
* @param callback - Callback function to handle notifications
|
|
86
|
+
* @returns Promise resolving to an object with an `unlisten` function
|
|
87
|
+
*/
|
|
46
88
|
async _listen(event, callback) {
|
|
47
89
|
return await this.db.$client.listen(`${this.schema}.${event}`, (payload) => {
|
|
48
90
|
callback(payload);
|
|
@@ -26,6 +26,7 @@ export default function createSchema(schemaName) {
|
|
|
26
26
|
toISOString: () => sql `now()`,
|
|
27
27
|
})),
|
|
28
28
|
}, (table) => [
|
|
29
|
+
// Single column indexes
|
|
29
30
|
index('idx_jobs_action_name').on(table.action_name),
|
|
30
31
|
index('idx_jobs_status').on(table.status),
|
|
31
32
|
index('idx_jobs_group_key').on(table.group_key),
|
|
@@ -35,8 +36,10 @@ export default function createSchema(schemaName) {
|
|
|
35
36
|
index('idx_jobs_client_id').on(table.client_id),
|
|
36
37
|
index('idx_jobs_checksum').on(table.checksum),
|
|
37
38
|
index('idx_jobs_concurrency_limit').on(table.concurrency_limit),
|
|
39
|
+
// Composite indexes
|
|
38
40
|
index('idx_jobs_action_status').on(table.action_name, table.status),
|
|
39
41
|
index('idx_jobs_action_group').on(table.action_name, table.group_key),
|
|
42
|
+
// GIN indexes for full-text search
|
|
40
43
|
index('idx_jobs_input_fts').using('gin', sql `to_tsvector('english', ${table.input}::text)`),
|
|
41
44
|
index('idx_jobs_output_fts').using('gin', sql `to_tsvector('english', ${table.output}::text)`),
|
|
42
45
|
check('jobs_status_check', sql `${table.status} IN ${sql.raw(`(${JOB_STATUSES.map((s) => `'${s}'`).join(',')})`)}`),
|
|
@@ -47,7 +50,7 @@ export default function createSchema(schemaName) {
|
|
|
47
50
|
.notNull()
|
|
48
51
|
.references(() => jobsTable.id, { onDelete: 'cascade' }),
|
|
49
52
|
parent_step_id: uuid('parent_step_id'),
|
|
50
|
-
parallel: boolean('branch').notNull().default(false),
|
|
53
|
+
parallel: boolean('branch').notNull().default(false), // DB column is 'branch', TypeScript uses 'parallel'
|
|
51
54
|
name: text('name').notNull(),
|
|
52
55
|
status: text('status').$type().notNull().default(STEP_STATUS_ACTIVE),
|
|
53
56
|
output: jsonb('output'),
|
|
@@ -71,14 +74,18 @@ export default function createSchema(schemaName) {
|
|
|
71
74
|
toISOString: () => sql `now()`,
|
|
72
75
|
})),
|
|
73
76
|
}, (table) => [
|
|
77
|
+
// Single column indexes
|
|
74
78
|
index('idx_job_steps_job_id').on(table.job_id),
|
|
75
79
|
index('idx_job_steps_status').on(table.status),
|
|
76
80
|
index('idx_job_steps_name').on(table.name),
|
|
77
81
|
index('idx_job_steps_expires_at').on(table.expires_at),
|
|
78
82
|
index('idx_job_steps_parent_step_id').on(table.parent_step_id),
|
|
83
|
+
// Composite indexes
|
|
79
84
|
index('idx_job_steps_job_status').on(table.job_id, table.status),
|
|
80
85
|
index('idx_job_steps_job_name').on(table.job_id, table.name),
|
|
81
86
|
index('idx_job_steps_output_fts').using('gin', sql `to_tsvector('english', ${table.output}::text)`),
|
|
87
|
+
// Unique constraint - step name is unique within a parent (name + parentStepId)
|
|
88
|
+
// nullsNotDistinct ensures NULL parent_step_id values are treated as equal for uniqueness
|
|
82
89
|
unique('unique_job_step_name_parent')
|
|
83
90
|
.on(table.job_id, table.name, table.parent_step_id)
|
|
84
91
|
.nullsNotDistinct(),
|
|
@@ -97,14 +104,17 @@ export default function createSchema(schemaName) {
|
|
|
97
104
|
timestamp: timestamp('timestamp', { withTimezone: true }).notNull().defaultNow(),
|
|
98
105
|
created_at: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
99
106
|
}, (table) => [
|
|
107
|
+
// Single column indexes
|
|
100
108
|
index('idx_metrics_job_id').on(table.job_id),
|
|
101
109
|
index('idx_metrics_step_id').on(table.step_id),
|
|
102
110
|
index('idx_metrics_name').on(table.name),
|
|
103
111
|
index('idx_metrics_type').on(table.type),
|
|
104
112
|
index('idx_metrics_timestamp').on(table.timestamp),
|
|
113
|
+
// Composite indexes
|
|
105
114
|
index('idx_metrics_job_step').on(table.job_id, table.step_id),
|
|
106
115
|
index('idx_metrics_job_name').on(table.job_id, table.name),
|
|
107
116
|
index('idx_metrics_job_type').on(table.job_id, table.type),
|
|
117
|
+
// GIN index for JSONB attributes filtering
|
|
108
118
|
index('idx_metrics_attributes').using('gin', table.attributes),
|
|
109
119
|
check('metrics_type_check', sql `${table.type} IN ('metric', 'span_event', 'span_attribute')`),
|
|
110
120
|
]);
|
|
@@ -40,6 +40,7 @@ export declare const JobSchema: z.ZodObject<{
|
|
|
40
40
|
updatedAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<Date, number>>]>;
|
|
41
41
|
concurrencyLimit: z.ZodCoercedNumber<unknown>;
|
|
42
42
|
clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
|
+
durationMs: z.ZodDefault<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
43
44
|
}, z.core.$strip>;
|
|
44
45
|
export declare const JobStepSchema: z.ZodObject<{
|
|
45
46
|
id: z.ZodString;
|
|
@@ -119,6 +120,7 @@ export declare const JobSortFieldSchema: z.ZodEnum<{
|
|
|
119
120
|
expiresAt: "expiresAt";
|
|
120
121
|
startedAt: "startedAt";
|
|
121
122
|
finishedAt: "finishedAt";
|
|
123
|
+
duration: "duration";
|
|
122
124
|
}>;
|
|
123
125
|
export declare const JobSortSchema: z.ZodObject<{
|
|
124
126
|
field: z.ZodEnum<{
|
|
@@ -128,6 +130,7 @@ export declare const JobSortSchema: z.ZodObject<{
|
|
|
128
130
|
expiresAt: "expiresAt";
|
|
129
131
|
startedAt: "startedAt";
|
|
130
132
|
finishedAt: "finishedAt";
|
|
133
|
+
duration: "duration";
|
|
131
134
|
}>;
|
|
132
135
|
order: z.ZodEnum<{
|
|
133
136
|
asc: "asc";
|
|
@@ -195,6 +198,7 @@ export declare const GetJobsOptionsSchema: z.ZodObject<{
|
|
|
195
198
|
expiresAt: "expiresAt";
|
|
196
199
|
startedAt: "startedAt";
|
|
197
200
|
finishedAt: "finishedAt";
|
|
201
|
+
duration: "duration";
|
|
198
202
|
}>;
|
|
199
203
|
order: z.ZodEnum<{
|
|
200
204
|
asc: "asc";
|
|
@@ -208,6 +212,7 @@ export declare const GetJobsOptionsSchema: z.ZodObject<{
|
|
|
208
212
|
expiresAt: "expiresAt";
|
|
209
213
|
startedAt: "startedAt";
|
|
210
214
|
finishedAt: "finishedAt";
|
|
215
|
+
duration: "duration";
|
|
211
216
|
}>;
|
|
212
217
|
order: z.ZodEnum<{
|
|
213
218
|
asc: "asc";
|
|
@@ -289,6 +294,7 @@ export declare const DeleteJobsOptionsSchema: z.ZodOptional<z.ZodObject<{
|
|
|
289
294
|
expiresAt: "expiresAt";
|
|
290
295
|
startedAt: "startedAt";
|
|
291
296
|
finishedAt: "finishedAt";
|
|
297
|
+
duration: "duration";
|
|
292
298
|
}>;
|
|
293
299
|
order: z.ZodEnum<{
|
|
294
300
|
asc: "asc";
|
|
@@ -302,6 +308,7 @@ export declare const DeleteJobsOptionsSchema: z.ZodOptional<z.ZodObject<{
|
|
|
302
308
|
expiresAt: "expiresAt";
|
|
303
309
|
startedAt: "startedAt";
|
|
304
310
|
finishedAt: "finishedAt";
|
|
311
|
+
duration: "duration";
|
|
305
312
|
}>;
|
|
306
313
|
order: z.ZodEnum<{
|
|
307
314
|
asc: "asc";
|
|
@@ -377,6 +384,7 @@ export declare const JobsArrayResultSchema: z.ZodArray<z.ZodObject<{
|
|
|
377
384
|
updatedAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<Date, number>>]>;
|
|
378
385
|
concurrencyLimit: z.ZodCoercedNumber<unknown>;
|
|
379
386
|
clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
387
|
+
durationMs: z.ZodDefault<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
380
388
|
}, z.core.$strip>>;
|
|
381
389
|
export declare const CreateOrRecoverJobStepResultNullableSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
382
390
|
id: z.ZodString;
|
|
@@ -416,6 +424,7 @@ export declare const GetJobsResultSchema: z.ZodObject<{
|
|
|
416
424
|
updatedAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<Date, number>>]>;
|
|
417
425
|
concurrencyLimit: z.ZodCoercedNumber<unknown>;
|
|
418
426
|
clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
427
|
+
durationMs: z.ZodDefault<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
419
428
|
}, z.core.$strip>>;
|
|
420
429
|
total: z.ZodNumber;
|
|
421
430
|
page: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/adapters/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,eAAO,MAAM,eAAe;;;;;;EAAuB,CAAA;AACnD,eAAO,MAAM,gBAAgB;;;;;EAAwB,CAAA;AAYrD,eAAO,MAAM,uBAAuB;;;;;iBAKlC,CAAA;AAMF,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/adapters/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,eAAO,MAAM,eAAe;;;;;;EAAuB,CAAA;AACnD,eAAO,MAAM,gBAAgB;;;;;EAAwB,CAAA;AAYrD,eAAO,MAAM,uBAAuB;;;;;iBAKlC,CAAA;AAMF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;iBAkBpB,CAAA;AAMF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsBxB,CAAA;AAGF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAuC,CAAA;AAM9E,eAAO,MAAM,eAAe;;;EAA0B,CAAA;AAEtD,eAAO,MAAM,kBAAkB;;;;;;;;EAQ7B,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;iBAGxB,CAAA;AAEF,eAAO,MAAM,gBAA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AM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAC3E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACrE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA"}
|
package/dist/adapters/schemas.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { JOB_STATUSES, STEP_STATUSES } from '../constants.js';
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Status Enums
|
|
5
|
+
// ============================================================================
|
|
3
6
|
export const JobStatusSchema = z.enum(JOB_STATUSES);
|
|
4
7
|
export const StepStatusSchema = z.enum(STEP_STATUSES);
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Date Schema
|
|
10
|
+
// ============================================================================
|
|
5
11
|
const DateSchema = z.union([
|
|
6
12
|
z.date(),
|
|
7
13
|
z.string().transform((str) => new Date(str)),
|
|
@@ -13,6 +19,9 @@ export const SerializableErrorSchema = z.object({
|
|
|
13
19
|
cause: z.any().optional(),
|
|
14
20
|
stack: z.string().optional(),
|
|
15
21
|
});
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Job Schema
|
|
24
|
+
// ============================================================================
|
|
16
25
|
export const JobSchema = z.object({
|
|
17
26
|
id: z.string(),
|
|
18
27
|
actionName: z.string(),
|
|
@@ -29,7 +38,12 @@ export const JobSchema = z.object({
|
|
|
29
38
|
updatedAt: DateSchema,
|
|
30
39
|
concurrencyLimit: z.coerce.number(),
|
|
31
40
|
clientId: z.string().nullable().optional(),
|
|
41
|
+
/** Duration in milliseconds (finishedAt - startedAt). Null if job hasn't finished. */
|
|
42
|
+
durationMs: z.coerce.number().nullable().default(null),
|
|
32
43
|
});
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// JobStep Schema
|
|
46
|
+
// ============================================================================
|
|
33
47
|
export const JobStepSchema = z.object({
|
|
34
48
|
id: z.string(),
|
|
35
49
|
jobId: z.string(),
|
|
@@ -50,9 +64,21 @@ export const JobStepSchema = z.object({
|
|
|
50
64
|
createdAt: DateSchema,
|
|
51
65
|
updatedAt: DateSchema,
|
|
52
66
|
});
|
|
67
|
+
// JobStep without output (for getJobSteps)
|
|
53
68
|
export const JobStepWithoutOutputSchema = JobStepSchema.omit({ output: true });
|
|
69
|
+
// ============================================================================
|
|
70
|
+
// Query Option Schemas
|
|
71
|
+
// ============================================================================
|
|
54
72
|
export const SortOrderSchema = z.enum(['asc', 'desc']);
|
|
55
|
-
export const JobSortFieldSchema = z.enum([
|
|
73
|
+
export const JobSortFieldSchema = z.enum([
|
|
74
|
+
'createdAt',
|
|
75
|
+
'startedAt',
|
|
76
|
+
'finishedAt',
|
|
77
|
+
'status',
|
|
78
|
+
'actionName',
|
|
79
|
+
'expiresAt',
|
|
80
|
+
'duration',
|
|
81
|
+
]);
|
|
56
82
|
export const JobSortSchema = z.object({
|
|
57
83
|
field: JobSortFieldSchema,
|
|
58
84
|
order: SortOrderSchema,
|
|
@@ -81,66 +107,105 @@ export const GetJobStepsOptionsSchema = z.object({
|
|
|
81
107
|
search: z.string().optional(),
|
|
82
108
|
updatedAfter: DateSchema.optional(),
|
|
83
109
|
});
|
|
110
|
+
// ============================================================================
|
|
111
|
+
// Job Option Schemas
|
|
112
|
+
// ============================================================================
|
|
84
113
|
export const CreateJobOptionsSchema = z.object({
|
|
114
|
+
/** The queue name (action name) */
|
|
85
115
|
queue: z.string(),
|
|
116
|
+
/** The group key for concurrency control */
|
|
86
117
|
groupKey: z.string(),
|
|
118
|
+
/** The checksum of the action */
|
|
87
119
|
checksum: z.string(),
|
|
120
|
+
/** The job input data */
|
|
88
121
|
input: z.any(),
|
|
122
|
+
/** Timeout in milliseconds for the job */
|
|
89
123
|
timeoutMs: z.number(),
|
|
124
|
+
/** The concurrency limit for this job's group */
|
|
90
125
|
concurrencyLimit: z.number(),
|
|
91
126
|
});
|
|
92
127
|
export const RecoverJobsOptionsSchema = z.object({
|
|
128
|
+
/** The action checksums to recover jobs for */
|
|
93
129
|
checksums: z.array(z.string()),
|
|
130
|
+
/** Whether to ping other processes before recovering their jobs */
|
|
94
131
|
multiProcessMode: z.boolean().optional(),
|
|
132
|
+
/** Timeout in milliseconds to wait for process ping responses */
|
|
95
133
|
processTimeout: z.number().optional(),
|
|
96
134
|
});
|
|
97
135
|
export const FetchOptionsSchema = z.object({
|
|
136
|
+
/** Maximum number of jobs to fetch in this batch */
|
|
98
137
|
batch: z.number(),
|
|
99
138
|
});
|
|
100
139
|
export const CompleteJobOptionsSchema = z.object({
|
|
140
|
+
/** The ID of the job to complete */
|
|
101
141
|
jobId: z.string(),
|
|
142
|
+
/** The job output data */
|
|
102
143
|
output: z.any(),
|
|
103
144
|
});
|
|
104
145
|
export const FailJobOptionsSchema = z.object({
|
|
146
|
+
/** The ID of the job to fail */
|
|
105
147
|
jobId: z.string(),
|
|
148
|
+
/** The error data */
|
|
106
149
|
error: z.any(),
|
|
107
150
|
});
|
|
108
151
|
export const CancelJobOptionsSchema = z.object({
|
|
152
|
+
/** The ID of the job to cancel */
|
|
109
153
|
jobId: z.string(),
|
|
110
154
|
});
|
|
111
155
|
export const RetryJobOptionsSchema = z.object({
|
|
156
|
+
/** The ID of the job to retry */
|
|
112
157
|
jobId: z.string(),
|
|
113
158
|
});
|
|
114
159
|
export const DeleteJobOptionsSchema = z.object({
|
|
160
|
+
/** The ID of the job to delete */
|
|
115
161
|
jobId: z.string(),
|
|
116
162
|
});
|
|
117
163
|
export const DeleteJobsOptionsSchema = GetJobsOptionsSchema.optional();
|
|
118
164
|
export const TimeTravelJobOptionsSchema = z.object({
|
|
165
|
+
/** The ID of the job to time travel */
|
|
119
166
|
jobId: z.string(),
|
|
167
|
+
/** The ID of the step to restart from */
|
|
120
168
|
stepId: z.string(),
|
|
121
169
|
});
|
|
170
|
+
// ============================================================================
|
|
171
|
+
// Step Option Schemas
|
|
172
|
+
// ============================================================================
|
|
122
173
|
export const CreateOrRecoverJobStepOptionsSchema = z.object({
|
|
174
|
+
/** The ID of the job this step belongs to */
|
|
123
175
|
jobId: z.string(),
|
|
176
|
+
/** The ID of the parent step (null for root steps) */
|
|
124
177
|
parentStepId: z.string().nullable().default(null),
|
|
178
|
+
/** Whether this step runs in parallel (independent from siblings during time travel) */
|
|
125
179
|
parallel: z.boolean().default(false),
|
|
180
|
+
/** The name of the step */
|
|
126
181
|
name: z.string(),
|
|
182
|
+
/** Timeout in milliseconds for the step */
|
|
127
183
|
timeoutMs: z.number(),
|
|
184
|
+
/** Maximum number of retries for the step */
|
|
128
185
|
retriesLimit: z.number(),
|
|
129
186
|
});
|
|
130
187
|
export const CompleteJobStepOptionsSchema = z.object({
|
|
188
|
+
/** The ID of the step to complete */
|
|
131
189
|
stepId: z.string(),
|
|
190
|
+
/** The step output data */
|
|
132
191
|
output: z.any(),
|
|
133
192
|
});
|
|
134
193
|
export const FailJobStepOptionsSchema = z.object({
|
|
194
|
+
/** The ID of the step to fail */
|
|
135
195
|
stepId: z.string(),
|
|
196
|
+
/** The error data */
|
|
136
197
|
error: z.any(),
|
|
137
198
|
});
|
|
138
199
|
export const DelayJobStepOptionsSchema = z.object({
|
|
200
|
+
/** The ID of the step to delay */
|
|
139
201
|
stepId: z.string(),
|
|
202
|
+
/** The delay in milliseconds */
|
|
140
203
|
delayMs: z.number(),
|
|
204
|
+
/** The error data */
|
|
141
205
|
error: z.any(),
|
|
142
206
|
});
|
|
143
207
|
export const CancelJobStepOptionsSchema = z.object({
|
|
208
|
+
/** The ID of the step to cancel */
|
|
144
209
|
stepId: z.string(),
|
|
145
210
|
});
|
|
146
211
|
export const CreateOrRecoverJobStepResultSchema = z.object({
|
|
@@ -153,6 +218,10 @@ export const CreateOrRecoverJobStepResultSchema = z.object({
|
|
|
153
218
|
output: z.any().nullable(),
|
|
154
219
|
isNew: z.boolean(),
|
|
155
220
|
});
|
|
221
|
+
// ============================================================================
|
|
222
|
+
// Response Schemas
|
|
223
|
+
// ============================================================================
|
|
224
|
+
// Simple response schemas
|
|
156
225
|
export const JobIdResultSchema = z.union([z.string(), z.null()]);
|
|
157
226
|
export const BooleanResultSchema = z.boolean();
|
|
158
227
|
export const NumberResultSchema = z.number();
|
|
@@ -187,6 +256,9 @@ export const JobStepStatusResultSchema = z.object({
|
|
|
187
256
|
status: StepStatusSchema,
|
|
188
257
|
updatedAt: DateSchema,
|
|
189
258
|
});
|
|
259
|
+
// ============================================================================
|
|
260
|
+
// Metrics Schemas
|
|
261
|
+
// ============================================================================
|
|
190
262
|
export const MetricTypeSchema = z.enum(['metric', 'span_event', 'span_attribute']);
|
|
191
263
|
export const MetricSchema = z.object({
|
|
192
264
|
id: z.string(),
|