@ddd-ts-kit/drizzle 0.10.0 → 0.11.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/README.md +25 -1
- package/dist/postgres/jobs/drizzle-job-store.d.ts +32 -0
- package/dist/postgres/jobs/drizzle-job-store.d.ts.map +1 -0
- package/dist/postgres/jobs/drizzle-job-store.js +175 -0
- package/dist/postgres/jobs/drizzle-job-store.js.map +1 -0
- package/dist/postgres/jobs/jobs-table.d.ts +327 -0
- package/dist/postgres/jobs/jobs-table.d.ts.map +1 -0
- package/dist/postgres/jobs/jobs-table.js +40 -0
- package/dist/postgres/jobs/jobs-table.js.map +1 -0
- package/dist/postgres/processes/drizzle-process-store.d.ts +20 -0
- package/dist/postgres/processes/drizzle-process-store.d.ts.map +1 -0
- package/dist/postgres/processes/drizzle-process-store.js +56 -0
- package/dist/postgres/processes/drizzle-process-store.js.map +1 -0
- package/dist/postgres/processes/processes-table.d.ts +131 -0
- package/dist/postgres/processes/processes-table.d.ts.map +1 -0
- package/dist/postgres/processes/processes-table.js +16 -0
- package/dist/postgres/processes/processes-table.js.map +1 -0
- package/dist/postgres.d.ts +4 -0
- package/dist/postgres.d.ts.map +1 -1
- package/dist/postgres.js +4 -0
- package/dist/postgres.js.map +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -523,10 +523,34 @@ side by side, whatever their streams. PostgreSQL only. The stores are the ones o
|
|
|
523
523
|
(`PostgresEventStore` and its companions), held to `eventStoreContract` here; how an
|
|
524
524
|
event-sourced aggregate uses them: the README of `@ddd-ts-kit/kernel`, section "Event sourcing".
|
|
525
525
|
|
|
526
|
+
## Background jobs
|
|
527
|
+
|
|
528
|
+
`DrizzleJobStore` is the `JobStore` of `@ddd-ts-kit/scheduling`: the background jobs of a
|
|
529
|
+
context in `jobsTable('scheduling')`, which the schema files of drizzle-kit include so that a
|
|
530
|
+
migration creates it. `add` runs on the executor of the context, inside the transaction of the
|
|
531
|
+
command that enqueues; claims select the due rows `FOR UPDATE SKIP LOCKED` and lease them.
|
|
532
|
+
|
|
533
|
+
```ts
|
|
534
|
+
export const schedulingJobs = jobsTable('scheduling');
|
|
535
|
+
|
|
536
|
+
kernelModule({ unitOfWork, jobStore: new DrizzleJobStore(unitOfWork, schedulingJobs) });
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
It passes `jobStoreContract`, its unit of work suite included, on PGlite and, in the integration
|
|
540
|
+
job of CI, on PostgreSQL behind a pool of five connections, where concurrent claims race for
|
|
541
|
+
real. What the jobs
|
|
542
|
+
guarantee: [Background jobs](../../docs/concepts/background-jobs.md).
|
|
543
|
+
|
|
544
|
+
## Process managers
|
|
545
|
+
|
|
546
|
+
`DrizzleProcessStore` is the `ProcessStore` of the kernel, on `processesTable(schema)`: a first
|
|
547
|
+
save inserts, a next one updates at the previous version, and a save that changes no row throws
|
|
548
|
+
`ConcurrencyError`, in the transaction of the step. It passes `processStoreContract`.
|
|
549
|
+
|
|
526
550
|
## Testing an adapter
|
|
527
551
|
|
|
528
552
|
The unit of work of this package passes `unitOfWorkContract`, and its stores
|
|
529
|
-
`outboxStoreContract` and `
|
|
553
|
+
`outboxStoreContract`, `processedEventStoreContract` and `jobStoreContract`, of `@ddd-ts-kit/testing/contracts` on
|
|
530
554
|
PGlite (PostgreSQL in process, no container). Hold your repositories to `repositoryContract`
|
|
531
555
|
the same way, next to their in-memory fake.
|
|
532
556
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type TablesRelationalConfig } from 'drizzle-orm';
|
|
2
|
+
import type { PgQueryResultHKT } from 'drizzle-orm/pg-core';
|
|
3
|
+
import type { EnqueuedJob, QueuedJob } from '@ddd-ts-kit/kernel';
|
|
4
|
+
import { type ClaimedJob, type ClaimRequest, type JobFailure, type JobLease, type JobStore, type JobStoreStats, type JobUpdate, type NewJob } from '@ddd-ts-kit/scheduling';
|
|
5
|
+
import type { DrizzleContext } from '../unit-of-work/drizzle-context.js';
|
|
6
|
+
import { type JobsTable } from './jobs-table.js';
|
|
7
|
+
/**
|
|
8
|
+
* The background jobs in PostgreSQL. `add` runs on the executor of the context: inside a unit of
|
|
9
|
+
* work, the job is written by the transaction of the command and shares its fate. Claims take
|
|
10
|
+
* due rows `FOR UPDATE SKIP LOCKED` in a short transaction of their own.
|
|
11
|
+
*/
|
|
12
|
+
export declare class DrizzleJobStore<Q extends PgQueryResultHKT, F extends Record<string, unknown>, S extends TablesRelationalConfig> implements JobStore {
|
|
13
|
+
private readonly context;
|
|
14
|
+
private readonly jobs;
|
|
15
|
+
constructor(context: DrizzleContext<Q, F, S>, table?: JobsTable);
|
|
16
|
+
add(job: NewJob): Promise<EnqueuedJob>;
|
|
17
|
+
claim({ queue, limit, now, leaseMs }: ClaimRequest): Promise<ClaimedJob[]>;
|
|
18
|
+
heartbeat(lease: JobLease, leaseUntil: Date): Promise<boolean>;
|
|
19
|
+
update(lease: JobLease, update: JobUpdate, leaseUntil: Date): Promise<boolean>;
|
|
20
|
+
complete(lease: JobLease, at: Date): Promise<boolean>;
|
|
21
|
+
fail(lease: JobLease, { errorCode, retryAt, at }: JobFailure): Promise<boolean>;
|
|
22
|
+
release(lease: JobLease, runAt: Date): Promise<boolean>;
|
|
23
|
+
cancel(id: string, at: Date): Promise<boolean>;
|
|
24
|
+
find(id: string): Promise<QueuedJob | undefined>;
|
|
25
|
+
retryDead(ids: readonly string[], now: Date): Promise<number>;
|
|
26
|
+
purgeFinished(before: Date): Promise<number>;
|
|
27
|
+
stats(queue: string): Promise<JobStoreStats>;
|
|
28
|
+
private isDue;
|
|
29
|
+
/** Changes the row only while this attempt holds it. */
|
|
30
|
+
private holding;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=drizzle-job-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drizzle-job-store.d.ts","sourceRoot":"","sources":["../../../src/postgres/jobs/drizzle-job-store.ts"],"names":[],"mappings":"AAAA,OAAO,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,CAAC,CAM7E;IAED,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAEpD;IAED,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAO9E;IAED,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAOtD;IAEK,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAWnD;IAEK,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAIrD;IAEK,SAAS,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAelE;IAEK,aAAa,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAUjD;IAEK,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAejD;IAED,OAAO,CAAC,KAAK;IASb,wDAAwD;YAC1C,OAAO;CAYtB"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { and, eq, inArray, lt, lte, or, sql } from 'drizzle-orm';
|
|
2
|
+
import { tenantKeyOf, } from '@ddd-ts-kit/scheduling';
|
|
3
|
+
import { jobsTable } from './jobs-table.js';
|
|
4
|
+
/**
|
|
5
|
+
* The background jobs in PostgreSQL. `add` runs on the executor of the context: inside a unit of
|
|
6
|
+
* work, the job is written by the transaction of the command and shares its fate. Claims take
|
|
7
|
+
* due rows `FOR UPDATE SKIP LOCKED` in a short transaction of their own.
|
|
8
|
+
*/
|
|
9
|
+
export class DrizzleJobStore {
|
|
10
|
+
context;
|
|
11
|
+
jobs;
|
|
12
|
+
constructor(context, table) {
|
|
13
|
+
this.context = context;
|
|
14
|
+
this.jobs = table ?? jobsTable();
|
|
15
|
+
}
|
|
16
|
+
async add(job) {
|
|
17
|
+
const { jobs } = this;
|
|
18
|
+
const executor = this.context.executor();
|
|
19
|
+
const tenantId = tenantKeyOf(job.enqueuedBy);
|
|
20
|
+
const inserted = await executor
|
|
21
|
+
.insert(jobs)
|
|
22
|
+
.values({ ...job, tenantId, idempotencyKey: job.idempotencyKey ?? null, subject: job.subject ?? null })
|
|
23
|
+
.onConflictDoNothing({ target: [jobs.name, jobs.tenantId, jobs.idempotencyKey] })
|
|
24
|
+
.returning({ id: jobs.id });
|
|
25
|
+
if (inserted.length === 1 || job.idempotencyKey === undefined) {
|
|
26
|
+
return { id: job.id, duplicate: false };
|
|
27
|
+
}
|
|
28
|
+
const [kept] = await executor
|
|
29
|
+
.select({ id: jobs.id })
|
|
30
|
+
.from(jobs)
|
|
31
|
+
.where(and(eq(jobs.name, job.name), eq(jobs.tenantId, tenantId), eq(jobs.idempotencyKey, job.idempotencyKey)));
|
|
32
|
+
return { id: kept?.id ?? job.id, duplicate: true };
|
|
33
|
+
}
|
|
34
|
+
claim({ queue, limit, now, leaseMs }) {
|
|
35
|
+
const { jobs } = this;
|
|
36
|
+
return this.context.executor().transaction(async (transaction) => {
|
|
37
|
+
const due = await transaction
|
|
38
|
+
.select({ id: jobs.id })
|
|
39
|
+
.from(jobs)
|
|
40
|
+
.where(and(eq(jobs.queue, queue), this.isDue(now)))
|
|
41
|
+
.orderBy(jobs.runAt, jobs.sequence)
|
|
42
|
+
.limit(Math.max(0, limit))
|
|
43
|
+
.for('update', { skipLocked: true });
|
|
44
|
+
if (due.length === 0) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
const claimed = await transaction
|
|
48
|
+
.update(jobs)
|
|
49
|
+
.set({ status: 'running', attempts: sql `${jobs.attempts} + 1`, leaseUntil: new Date(now.getTime() + leaseMs) })
|
|
50
|
+
.where(inArray(jobs.id, due.map(({ id }) => id)))
|
|
51
|
+
.returning();
|
|
52
|
+
// RETURNING gives no order guarantee: restore the one of the claim.
|
|
53
|
+
return due.flatMap(({ id }) => claimed.filter((row) => row.id === id)).map(claimedOf);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
heartbeat(lease, leaseUntil) {
|
|
57
|
+
return this.holding(lease, { leaseUntil });
|
|
58
|
+
}
|
|
59
|
+
update(lease, update, leaseUntil) {
|
|
60
|
+
return this.holding(lease, {
|
|
61
|
+
leaseUntil,
|
|
62
|
+
...(update.progress === undefined ? {} : { progress: update.progress }),
|
|
63
|
+
...('checkpoint' in update ? { checkpoint: update.checkpoint ?? null } : {}),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
complete(lease, at) {
|
|
67
|
+
return this.holding(lease, { status: 'succeeded', finishedAt: at, leaseUntil: null });
|
|
68
|
+
}
|
|
69
|
+
fail(lease, { errorCode, retryAt, at }) {
|
|
70
|
+
const next = retryAt === null
|
|
71
|
+
? { status: 'dead', finishedAt: at, leaseUntil: null }
|
|
72
|
+
: { status: 'waiting', runAt: retryAt, leaseUntil: null };
|
|
73
|
+
return this.holding(lease, { ...next, lastErrorCode: errorCode });
|
|
74
|
+
}
|
|
75
|
+
release(lease, runAt) {
|
|
76
|
+
return this.holding(lease, {
|
|
77
|
+
status: 'waiting',
|
|
78
|
+
runAt,
|
|
79
|
+
leaseUntil: null,
|
|
80
|
+
attempts: sql `${this.jobs.attempts} - 1`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
async cancel(id, at) {
|
|
84
|
+
const { jobs } = this;
|
|
85
|
+
const cancelled = await this.context
|
|
86
|
+
.executor()
|
|
87
|
+
.update(jobs)
|
|
88
|
+
.set({ status: 'cancelled', finishedAt: at, leaseUntil: null })
|
|
89
|
+
.where(and(eq(jobs.id, id), inArray(jobs.status, ['waiting', 'running'])))
|
|
90
|
+
.returning({ id: jobs.id });
|
|
91
|
+
return cancelled.length === 1;
|
|
92
|
+
}
|
|
93
|
+
async find(id) {
|
|
94
|
+
const [row] = await this.context.executor().select().from(this.jobs).where(eq(this.jobs.id, id));
|
|
95
|
+
return row === undefined ? undefined : queuedOf(row);
|
|
96
|
+
}
|
|
97
|
+
async retryDead(ids, now) {
|
|
98
|
+
if (ids.length === 0) {
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
const { jobs } = this;
|
|
102
|
+
const revived = await this.context
|
|
103
|
+
.executor()
|
|
104
|
+
.update(jobs)
|
|
105
|
+
.set({ status: 'waiting', attempts: 0, runAt: now, finishedAt: null })
|
|
106
|
+
.where(and(inArray(jobs.id, [...ids]), eq(jobs.status, 'dead')))
|
|
107
|
+
.returning({ id: jobs.id });
|
|
108
|
+
return revived.length;
|
|
109
|
+
}
|
|
110
|
+
async purgeFinished(before) {
|
|
111
|
+
const { jobs } = this;
|
|
112
|
+
const purged = await this.context
|
|
113
|
+
.executor()
|
|
114
|
+
.delete(jobs)
|
|
115
|
+
.where(and(inArray(jobs.status, ['succeeded', 'cancelled']), lt(jobs.finishedAt, before)))
|
|
116
|
+
.returning({ id: jobs.id });
|
|
117
|
+
return purged.length;
|
|
118
|
+
}
|
|
119
|
+
async stats(queue) {
|
|
120
|
+
const { status } = this.jobs;
|
|
121
|
+
// count() is a bigint, which some drivers return as a string.
|
|
122
|
+
const counted = await this.context
|
|
123
|
+
.executor()
|
|
124
|
+
.select({ status, count: sql `count(*)`.mapWith(Number) })
|
|
125
|
+
.from(this.jobs)
|
|
126
|
+
.where(eq(this.jobs.queue, queue))
|
|
127
|
+
.groupBy(status);
|
|
128
|
+
const of = (wanted) => counted.filter((row) => row.status === wanted).reduce((sum, row) => sum + row.count, 0);
|
|
129
|
+
return { waiting: of('waiting'), running: of('running'), dead: of('dead') };
|
|
130
|
+
}
|
|
131
|
+
isDue(now) {
|
|
132
|
+
const { jobs } = this;
|
|
133
|
+
return or(and(eq(jobs.status, 'waiting'), lte(jobs.runAt, now)), and(eq(jobs.status, 'running'), lte(jobs.leaseUntil, now)));
|
|
134
|
+
}
|
|
135
|
+
/** Changes the row only while this attempt holds it. */
|
|
136
|
+
async holding(lease, change) {
|
|
137
|
+
const { jobs } = this;
|
|
138
|
+
const changed = await this.context
|
|
139
|
+
.executor()
|
|
140
|
+
.update(jobs)
|
|
141
|
+
.set(change)
|
|
142
|
+
.where(and(eq(jobs.id, lease.id), eq(jobs.status, 'running'), eq(jobs.attempts, lease.attempt)))
|
|
143
|
+
.returning({ id: jobs.id });
|
|
144
|
+
return changed.length === 1;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function claimedOf(row) {
|
|
148
|
+
return {
|
|
149
|
+
id: row.id,
|
|
150
|
+
name: row.name,
|
|
151
|
+
queue: row.queue,
|
|
152
|
+
payload: row.payload,
|
|
153
|
+
enqueuedBy: row.enqueuedBy,
|
|
154
|
+
enqueuedAt: row.enqueuedAt,
|
|
155
|
+
attempt: row.attempts,
|
|
156
|
+
...(row.checkpoint === null ? {} : { checkpoint: row.checkpoint }),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function queuedOf(row) {
|
|
160
|
+
return {
|
|
161
|
+
id: row.id,
|
|
162
|
+
name: row.name,
|
|
163
|
+
queue: row.queue,
|
|
164
|
+
status: row.status,
|
|
165
|
+
attempts: row.attempts,
|
|
166
|
+
enqueuedAt: row.enqueuedAt,
|
|
167
|
+
runAt: row.runAt,
|
|
168
|
+
...(row.tenantId === '' ? {} : { tenantId: row.tenantId }),
|
|
169
|
+
...(row.subject === null ? {} : { subject: row.subject }),
|
|
170
|
+
...(row.progress === null ? {} : { progress: row.progress }),
|
|
171
|
+
...(row.lastErrorCode === null ? {} : { lastErrorCode: row.lastErrorCode }),
|
|
172
|
+
...(row.finishedAt === null ? {} : { finishedAt: row.finishedAt }),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=drizzle-job-store.js.map
|
|
@@ -0,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C,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC5D,GAAG,CAAC,GAAG,CAAC,aAAa,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,aAAa,EAAE,CAAC;QAC3E,GAAG,CAAC,GAAG,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;KACnE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import type { EnqueuedBy, JobProgress, QueuedJobStatus } from '@ddd-ts-kit/kernel';
|
|
2
|
+
export type JobsTable = ReturnType<typeof jobsTable>;
|
|
3
|
+
/**
|
|
4
|
+
* The table of the background jobs, to include in the schema files drizzle-kit reads so that
|
|
5
|
+
* it is created by the migrations of the project. In the schema of a context, the jobs of that
|
|
6
|
+
* context travel with it when it is extracted as a service.
|
|
7
|
+
*/
|
|
8
|
+
export declare function jobsTable(schemaName?: string): import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
9
|
+
name: "background_jobs";
|
|
10
|
+
schema: string | undefined;
|
|
11
|
+
columns: {
|
|
12
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
13
|
+
name: "id";
|
|
14
|
+
tableName: "background_jobs";
|
|
15
|
+
dataType: "string";
|
|
16
|
+
columnType: "PgText";
|
|
17
|
+
data: string;
|
|
18
|
+
driverParam: string;
|
|
19
|
+
notNull: true;
|
|
20
|
+
hasDefault: false;
|
|
21
|
+
isPrimaryKey: true;
|
|
22
|
+
isAutoincrement: false;
|
|
23
|
+
hasRuntimeDefault: false;
|
|
24
|
+
enumValues: [string, ...string[]];
|
|
25
|
+
baseColumn: never;
|
|
26
|
+
identity: undefined;
|
|
27
|
+
generated: undefined;
|
|
28
|
+
}, {}, {}>;
|
|
29
|
+
sequence: import("drizzle-orm/pg-core").PgColumn<{
|
|
30
|
+
name: "sequence";
|
|
31
|
+
tableName: "background_jobs";
|
|
32
|
+
dataType: "number";
|
|
33
|
+
columnType: "PgBigInt53";
|
|
34
|
+
data: number;
|
|
35
|
+
driverParam: string | number;
|
|
36
|
+
notNull: true;
|
|
37
|
+
hasDefault: true;
|
|
38
|
+
isPrimaryKey: false;
|
|
39
|
+
isAutoincrement: false;
|
|
40
|
+
hasRuntimeDefault: false;
|
|
41
|
+
enumValues: undefined;
|
|
42
|
+
baseColumn: never;
|
|
43
|
+
identity: "always";
|
|
44
|
+
generated: undefined;
|
|
45
|
+
}, {}, {}>;
|
|
46
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
47
|
+
name: "name";
|
|
48
|
+
tableName: "background_jobs";
|
|
49
|
+
dataType: "string";
|
|
50
|
+
columnType: "PgText";
|
|
51
|
+
data: string;
|
|
52
|
+
driverParam: string;
|
|
53
|
+
notNull: true;
|
|
54
|
+
hasDefault: false;
|
|
55
|
+
isPrimaryKey: false;
|
|
56
|
+
isAutoincrement: false;
|
|
57
|
+
hasRuntimeDefault: false;
|
|
58
|
+
enumValues: [string, ...string[]];
|
|
59
|
+
baseColumn: never;
|
|
60
|
+
identity: undefined;
|
|
61
|
+
generated: undefined;
|
|
62
|
+
}, {}, {}>;
|
|
63
|
+
queue: import("drizzle-orm/pg-core").PgColumn<{
|
|
64
|
+
name: "queue";
|
|
65
|
+
tableName: "background_jobs";
|
|
66
|
+
dataType: "string";
|
|
67
|
+
columnType: "PgText";
|
|
68
|
+
data: string;
|
|
69
|
+
driverParam: string;
|
|
70
|
+
notNull: true;
|
|
71
|
+
hasDefault: false;
|
|
72
|
+
isPrimaryKey: false;
|
|
73
|
+
isAutoincrement: false;
|
|
74
|
+
hasRuntimeDefault: false;
|
|
75
|
+
enumValues: [string, ...string[]];
|
|
76
|
+
baseColumn: never;
|
|
77
|
+
identity: undefined;
|
|
78
|
+
generated: undefined;
|
|
79
|
+
}, {}, {}>;
|
|
80
|
+
payload: import("drizzle-orm/pg-core").PgColumn<{
|
|
81
|
+
name: "payload";
|
|
82
|
+
tableName: "background_jobs";
|
|
83
|
+
dataType: "json";
|
|
84
|
+
columnType: "PgJsonb";
|
|
85
|
+
data: unknown;
|
|
86
|
+
driverParam: unknown;
|
|
87
|
+
notNull: false;
|
|
88
|
+
hasDefault: false;
|
|
89
|
+
isPrimaryKey: false;
|
|
90
|
+
isAutoincrement: false;
|
|
91
|
+
hasRuntimeDefault: false;
|
|
92
|
+
enumValues: undefined;
|
|
93
|
+
baseColumn: never;
|
|
94
|
+
identity: undefined;
|
|
95
|
+
generated: undefined;
|
|
96
|
+
}, {}, {}>;
|
|
97
|
+
enqueuedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
98
|
+
name: "enqueued_by";
|
|
99
|
+
tableName: "background_jobs";
|
|
100
|
+
dataType: "json";
|
|
101
|
+
columnType: "PgJsonb";
|
|
102
|
+
data: EnqueuedBy;
|
|
103
|
+
driverParam: unknown;
|
|
104
|
+
notNull: true;
|
|
105
|
+
hasDefault: false;
|
|
106
|
+
isPrimaryKey: false;
|
|
107
|
+
isAutoincrement: false;
|
|
108
|
+
hasRuntimeDefault: false;
|
|
109
|
+
enumValues: undefined;
|
|
110
|
+
baseColumn: never;
|
|
111
|
+
identity: undefined;
|
|
112
|
+
generated: undefined;
|
|
113
|
+
}, {}, {
|
|
114
|
+
$type: EnqueuedBy;
|
|
115
|
+
}>;
|
|
116
|
+
idempotencyKey: import("drizzle-orm/pg-core").PgColumn<{
|
|
117
|
+
name: "idempotency_key";
|
|
118
|
+
tableName: "background_jobs";
|
|
119
|
+
dataType: "string";
|
|
120
|
+
columnType: "PgText";
|
|
121
|
+
data: string;
|
|
122
|
+
driverParam: string;
|
|
123
|
+
notNull: false;
|
|
124
|
+
hasDefault: false;
|
|
125
|
+
isPrimaryKey: false;
|
|
126
|
+
isAutoincrement: false;
|
|
127
|
+
hasRuntimeDefault: false;
|
|
128
|
+
enumValues: [string, ...string[]];
|
|
129
|
+
baseColumn: never;
|
|
130
|
+
identity: undefined;
|
|
131
|
+
generated: undefined;
|
|
132
|
+
}, {}, {}>;
|
|
133
|
+
tenantId: import("drizzle-orm/pg-core").PgColumn<{
|
|
134
|
+
name: "tenant_id";
|
|
135
|
+
tableName: "background_jobs";
|
|
136
|
+
dataType: "string";
|
|
137
|
+
columnType: "PgText";
|
|
138
|
+
data: string;
|
|
139
|
+
driverParam: string;
|
|
140
|
+
notNull: true;
|
|
141
|
+
hasDefault: true;
|
|
142
|
+
isPrimaryKey: false;
|
|
143
|
+
isAutoincrement: false;
|
|
144
|
+
hasRuntimeDefault: false;
|
|
145
|
+
enumValues: [string, ...string[]];
|
|
146
|
+
baseColumn: never;
|
|
147
|
+
identity: undefined;
|
|
148
|
+
generated: undefined;
|
|
149
|
+
}, {}, {}>;
|
|
150
|
+
subject: import("drizzle-orm/pg-core").PgColumn<{
|
|
151
|
+
name: "subject";
|
|
152
|
+
tableName: "background_jobs";
|
|
153
|
+
dataType: "string";
|
|
154
|
+
columnType: "PgText";
|
|
155
|
+
data: string;
|
|
156
|
+
driverParam: string;
|
|
157
|
+
notNull: false;
|
|
158
|
+
hasDefault: false;
|
|
159
|
+
isPrimaryKey: false;
|
|
160
|
+
isAutoincrement: false;
|
|
161
|
+
hasRuntimeDefault: false;
|
|
162
|
+
enumValues: [string, ...string[]];
|
|
163
|
+
baseColumn: never;
|
|
164
|
+
identity: undefined;
|
|
165
|
+
generated: undefined;
|
|
166
|
+
}, {}, {}>;
|
|
167
|
+
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
168
|
+
name: "status";
|
|
169
|
+
tableName: "background_jobs";
|
|
170
|
+
dataType: "string";
|
|
171
|
+
columnType: "PgText";
|
|
172
|
+
data: QueuedJobStatus;
|
|
173
|
+
driverParam: string;
|
|
174
|
+
notNull: true;
|
|
175
|
+
hasDefault: true;
|
|
176
|
+
isPrimaryKey: false;
|
|
177
|
+
isAutoincrement: false;
|
|
178
|
+
hasRuntimeDefault: false;
|
|
179
|
+
enumValues: [string, ...string[]];
|
|
180
|
+
baseColumn: never;
|
|
181
|
+
identity: undefined;
|
|
182
|
+
generated: undefined;
|
|
183
|
+
}, {}, {
|
|
184
|
+
$type: QueuedJobStatus;
|
|
185
|
+
}>;
|
|
186
|
+
attempts: import("drizzle-orm/pg-core").PgColumn<{
|
|
187
|
+
name: "attempts";
|
|
188
|
+
tableName: "background_jobs";
|
|
189
|
+
dataType: "number";
|
|
190
|
+
columnType: "PgInteger";
|
|
191
|
+
data: number;
|
|
192
|
+
driverParam: string | number;
|
|
193
|
+
notNull: true;
|
|
194
|
+
hasDefault: true;
|
|
195
|
+
isPrimaryKey: false;
|
|
196
|
+
isAutoincrement: false;
|
|
197
|
+
hasRuntimeDefault: false;
|
|
198
|
+
enumValues: undefined;
|
|
199
|
+
baseColumn: never;
|
|
200
|
+
identity: undefined;
|
|
201
|
+
generated: undefined;
|
|
202
|
+
}, {}, {}>;
|
|
203
|
+
runAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
204
|
+
name: string;
|
|
205
|
+
tableName: "background_jobs";
|
|
206
|
+
dataType: "date";
|
|
207
|
+
columnType: "PgTimestamp";
|
|
208
|
+
data: Date;
|
|
209
|
+
driverParam: string;
|
|
210
|
+
notNull: true;
|
|
211
|
+
hasDefault: false;
|
|
212
|
+
isPrimaryKey: false;
|
|
213
|
+
isAutoincrement: false;
|
|
214
|
+
hasRuntimeDefault: false;
|
|
215
|
+
enumValues: undefined;
|
|
216
|
+
baseColumn: never;
|
|
217
|
+
identity: undefined;
|
|
218
|
+
generated: undefined;
|
|
219
|
+
}, {}, {}>;
|
|
220
|
+
leaseUntil: import("drizzle-orm/pg-core").PgColumn<{
|
|
221
|
+
name: string;
|
|
222
|
+
tableName: "background_jobs";
|
|
223
|
+
dataType: "date";
|
|
224
|
+
columnType: "PgTimestamp";
|
|
225
|
+
data: Date;
|
|
226
|
+
driverParam: string;
|
|
227
|
+
notNull: false;
|
|
228
|
+
hasDefault: false;
|
|
229
|
+
isPrimaryKey: false;
|
|
230
|
+
isAutoincrement: false;
|
|
231
|
+
hasRuntimeDefault: false;
|
|
232
|
+
enumValues: undefined;
|
|
233
|
+
baseColumn: never;
|
|
234
|
+
identity: undefined;
|
|
235
|
+
generated: undefined;
|
|
236
|
+
}, {}, {}>;
|
|
237
|
+
progress: import("drizzle-orm/pg-core").PgColumn<{
|
|
238
|
+
name: "progress";
|
|
239
|
+
tableName: "background_jobs";
|
|
240
|
+
dataType: "json";
|
|
241
|
+
columnType: "PgJsonb";
|
|
242
|
+
data: JobProgress;
|
|
243
|
+
driverParam: unknown;
|
|
244
|
+
notNull: false;
|
|
245
|
+
hasDefault: false;
|
|
246
|
+
isPrimaryKey: false;
|
|
247
|
+
isAutoincrement: false;
|
|
248
|
+
hasRuntimeDefault: false;
|
|
249
|
+
enumValues: undefined;
|
|
250
|
+
baseColumn: never;
|
|
251
|
+
identity: undefined;
|
|
252
|
+
generated: undefined;
|
|
253
|
+
}, {}, {
|
|
254
|
+
$type: JobProgress;
|
|
255
|
+
}>;
|
|
256
|
+
checkpoint: import("drizzle-orm/pg-core").PgColumn<{
|
|
257
|
+
name: "checkpoint";
|
|
258
|
+
tableName: "background_jobs";
|
|
259
|
+
dataType: "json";
|
|
260
|
+
columnType: "PgJsonb";
|
|
261
|
+
data: unknown;
|
|
262
|
+
driverParam: unknown;
|
|
263
|
+
notNull: false;
|
|
264
|
+
hasDefault: false;
|
|
265
|
+
isPrimaryKey: false;
|
|
266
|
+
isAutoincrement: false;
|
|
267
|
+
hasRuntimeDefault: false;
|
|
268
|
+
enumValues: undefined;
|
|
269
|
+
baseColumn: never;
|
|
270
|
+
identity: undefined;
|
|
271
|
+
generated: undefined;
|
|
272
|
+
}, {}, {}>;
|
|
273
|
+
lastErrorCode: import("drizzle-orm/pg-core").PgColumn<{
|
|
274
|
+
name: "last_error_code";
|
|
275
|
+
tableName: "background_jobs";
|
|
276
|
+
dataType: "string";
|
|
277
|
+
columnType: "PgText";
|
|
278
|
+
data: string;
|
|
279
|
+
driverParam: string;
|
|
280
|
+
notNull: false;
|
|
281
|
+
hasDefault: false;
|
|
282
|
+
isPrimaryKey: false;
|
|
283
|
+
isAutoincrement: false;
|
|
284
|
+
hasRuntimeDefault: false;
|
|
285
|
+
enumValues: [string, ...string[]];
|
|
286
|
+
baseColumn: never;
|
|
287
|
+
identity: undefined;
|
|
288
|
+
generated: undefined;
|
|
289
|
+
}, {}, {}>;
|
|
290
|
+
enqueuedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
291
|
+
name: string;
|
|
292
|
+
tableName: "background_jobs";
|
|
293
|
+
dataType: "date";
|
|
294
|
+
columnType: "PgTimestamp";
|
|
295
|
+
data: Date;
|
|
296
|
+
driverParam: string;
|
|
297
|
+
notNull: true;
|
|
298
|
+
hasDefault: false;
|
|
299
|
+
isPrimaryKey: false;
|
|
300
|
+
isAutoincrement: false;
|
|
301
|
+
hasRuntimeDefault: false;
|
|
302
|
+
enumValues: undefined;
|
|
303
|
+
baseColumn: never;
|
|
304
|
+
identity: undefined;
|
|
305
|
+
generated: undefined;
|
|
306
|
+
}, {}, {}>;
|
|
307
|
+
finishedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
308
|
+
name: string;
|
|
309
|
+
tableName: "background_jobs";
|
|
310
|
+
dataType: "date";
|
|
311
|
+
columnType: "PgTimestamp";
|
|
312
|
+
data: Date;
|
|
313
|
+
driverParam: string;
|
|
314
|
+
notNull: false;
|
|
315
|
+
hasDefault: false;
|
|
316
|
+
isPrimaryKey: false;
|
|
317
|
+
isAutoincrement: false;
|
|
318
|
+
hasRuntimeDefault: false;
|
|
319
|
+
enumValues: undefined;
|
|
320
|
+
baseColumn: never;
|
|
321
|
+
identity: undefined;
|
|
322
|
+
generated: undefined;
|
|
323
|
+
}, {}, {}>;
|
|
324
|
+
};
|
|
325
|
+
dialect: 'pg';
|
|
326
|
+
}>;
|
|
327
|
+
//# sourceMappingURL=jobs-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-table.d.ts","sourceRoot":"","sources":["../../../src/postgres/jobs/jobs-table.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAInF,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiC5C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { sql } from 'drizzle-orm';
|
|
2
|
+
import { bigint, index, integer, jsonb, text, uniqueIndex } from 'drizzle-orm/pg-core';
|
|
3
|
+
import { instant } from '../columns/instant.js';
|
|
4
|
+
import { tableIn } from '../schema/table-in.js';
|
|
5
|
+
/**
|
|
6
|
+
* The table of the background jobs, to include in the schema files drizzle-kit reads so that
|
|
7
|
+
* it is created by the migrations of the project. In the schema of a context, the jobs of that
|
|
8
|
+
* context travel with it when it is extracted as a service.
|
|
9
|
+
*/
|
|
10
|
+
export function jobsTable(schemaName) {
|
|
11
|
+
return tableIn(schemaName)('background_jobs', {
|
|
12
|
+
id: text('id').primaryKey(),
|
|
13
|
+
/** Insertion order, the tie-breaker of the claim. */
|
|
14
|
+
sequence: bigint('sequence', { mode: 'number' }).generatedAlwaysAsIdentity(),
|
|
15
|
+
name: text('name').notNull(),
|
|
16
|
+
queue: text('queue').notNull(),
|
|
17
|
+
payload: jsonb('payload'),
|
|
18
|
+
enqueuedBy: jsonb('enqueued_by').$type().notNull(),
|
|
19
|
+
idempotencyKey: text('idempotency_key'),
|
|
20
|
+
/** The empty text outside any tenant: a null would make every such key distinct. */
|
|
21
|
+
tenantId: text('tenant_id').notNull().default(''),
|
|
22
|
+
subject: text('subject'),
|
|
23
|
+
status: text('status').$type().notNull().default('waiting'),
|
|
24
|
+
attempts: integer('attempts').notNull().default(0),
|
|
25
|
+
runAt: instant('run_at').notNull(),
|
|
26
|
+
leaseUntil: instant('lease_until'),
|
|
27
|
+
progress: jsonb('progress').$type(),
|
|
28
|
+
checkpoint: jsonb('checkpoint'),
|
|
29
|
+
lastErrorCode: text('last_error_code'),
|
|
30
|
+
enqueuedAt: instant('enqueued_at').notNull(),
|
|
31
|
+
finishedAt: instant('finished_at'),
|
|
32
|
+
}, (table) => [
|
|
33
|
+
uniqueIndex('background_jobs_idempotency_key').on(table.name, table.tenantId, table.idempotencyKey),
|
|
34
|
+
// Partial: a claim only ever looks at what is waiting or running, and finished jobs dominate.
|
|
35
|
+
index('background_jobs_due_idx')
|
|
36
|
+
.on(table.queue, table.runAt, table.sequence)
|
|
37
|
+
.where(sql `${table.status} in ('waiting', 'running')`),
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=jobs-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-table.js","sourceRoot":"","sources":["../../../src/postgres/jobs/jobs-table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;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AAC;QAC/B,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC;QACtC,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE;QAC5C,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC;KACnC,EACD,CAAC,KAAK,EAAE,EAAE,CAAC;QACT,WAAW,CAAC,iCAAiC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC;QACnG,8FAA8F;QAC9F,KAAK,CAAC,yBAAyB,CAAC;aAC7B,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC;aAC5C,KAAK,CAAC,GAAG,CAAA,GAAG,KAAK,CAAC,MAAM,4BAA4B,CAAC;KACzD,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type TablesRelationalConfig } from 'drizzle-orm';
|
|
2
|
+
import type { PgQueryResultHKT } from 'drizzle-orm/pg-core';
|
|
3
|
+
import { type ProcessStore, type StoredProcess } from '@ddd-ts-kit/kernel';
|
|
4
|
+
import type { DrizzleContext } from '../unit-of-work/drizzle-context.js';
|
|
5
|
+
import { type ProcessesTable } from './processes-table.js';
|
|
6
|
+
/**
|
|
7
|
+
* The instances of the process managers in PostgreSQL, on the executor of the context: a first
|
|
8
|
+
* save inserts, ignoring a row a concurrent first save wrote; a next one updates the row at the
|
|
9
|
+
* previous version; a save that changes no row is refused with `ConcurrencyError`.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DrizzleProcessStore<Q extends PgQueryResultHKT, F extends Record<string, unknown>, S extends TablesRelationalConfig> implements ProcessStore {
|
|
12
|
+
private readonly context;
|
|
13
|
+
private readonly processes;
|
|
14
|
+
constructor(context: DrizzleContext<Q, F, S>, table?: ProcessesTable);
|
|
15
|
+
load(name: string, id: string): Promise<StoredProcess | undefined>;
|
|
16
|
+
save(process: StoredProcess): Promise<void>;
|
|
17
|
+
private insert;
|
|
18
|
+
private update;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=drizzle-process-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drizzle-process-store.d.ts","sourceRoot":"","sources":["../../../src/postgres/processes/drizzle-process-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAoB,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3E;;;;GAIG;AACH,qBAAa,mBAAmB,CAC9B,CAAC,SAAS,gBAAgB,EAC1B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,CAAC,SAAS,sBAAsB,CAChC,YAAW,YAAY;IAKrB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAE3C,YACmB,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACjD,KAAK,CAAC,EAAE,cAAc,EAGvB;IAEK,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAevE;IAEK,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAMhD;YAEa,MAAM;YAWN,MAAM;CAYrB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { and, eq } from 'drizzle-orm';
|
|
2
|
+
import { ConcurrencyError } from '@ddd-ts-kit/kernel';
|
|
3
|
+
import { processesTable } from './processes-table.js';
|
|
4
|
+
/**
|
|
5
|
+
* The instances of the process managers in PostgreSQL, on the executor of the context: a first
|
|
6
|
+
* save inserts, ignoring a row a concurrent first save wrote; a next one updates the row at the
|
|
7
|
+
* previous version; a save that changes no row is refused with `ConcurrencyError`.
|
|
8
|
+
*/
|
|
9
|
+
export class DrizzleProcessStore {
|
|
10
|
+
context;
|
|
11
|
+
processes;
|
|
12
|
+
constructor(context, table) {
|
|
13
|
+
this.context = context;
|
|
14
|
+
this.processes = table ?? processesTable();
|
|
15
|
+
}
|
|
16
|
+
async load(name, id) {
|
|
17
|
+
const { processes } = this;
|
|
18
|
+
const [row] = await this.context
|
|
19
|
+
.executor()
|
|
20
|
+
.select({
|
|
21
|
+
state: processes.state,
|
|
22
|
+
version: processes.version,
|
|
23
|
+
ended: processes.ended,
|
|
24
|
+
timeouts: processes.timeouts,
|
|
25
|
+
})
|
|
26
|
+
.from(processes)
|
|
27
|
+
.where(and(eq(processes.name, name), eq(processes.id, id)));
|
|
28
|
+
return row === undefined ? undefined : { name, id, ...row, timeouts: { ...row.timeouts } };
|
|
29
|
+
}
|
|
30
|
+
async save(process) {
|
|
31
|
+
const written = process.version === 1 ? await this.insert(process) : await this.update(process);
|
|
32
|
+
if (written !== 1) {
|
|
33
|
+
throw new ConcurrencyError(`${process.name}:${process.id}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async insert({ name, id, state, version, ended, timeouts }) {
|
|
37
|
+
const inserted = await this.context
|
|
38
|
+
.executor()
|
|
39
|
+
.insert(this.processes)
|
|
40
|
+
.values({ name, id, state, version, ended, timeouts })
|
|
41
|
+
.onConflictDoNothing()
|
|
42
|
+
.returning({ id: this.processes.id });
|
|
43
|
+
return inserted.length;
|
|
44
|
+
}
|
|
45
|
+
async update({ name, id, state, version, ended, timeouts }) {
|
|
46
|
+
const { processes } = this;
|
|
47
|
+
const updated = await this.context
|
|
48
|
+
.executor()
|
|
49
|
+
.update(processes)
|
|
50
|
+
.set({ state, version, ended, timeouts, updatedAt: new Date() })
|
|
51
|
+
.where(and(eq(processes.name, name), eq(processes.id, id), eq(processes.version, version - 1)))
|
|
52
|
+
.returning({ id: processes.id });
|
|
53
|
+
return updated.length;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=drizzle-process-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drizzle-process-store.js","sourceRoot":"","sources":["../../../src/postgres/processes/drizzle-process-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAA+B,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAyC,MAAM,oBAAoB,CAAC;AAE7F,OAAO,EAAE,cAAc,EAAuB,MAAM,sBAAsB,CAAC;AAE3E;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IASX,OAAO;IAHT,SAAS,CAAiB;IAE3C,YACmB,OAAgC,EACjD,KAAsB;uBADL,OAAO;QAGxB,IAAI,CAAC,SAAS,GAAG,KAAK,IAAI,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,EAAU;QACjC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAE3B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO;aAC7B,QAAQ,EAAE;aACV,MAAM,CAAC;YACN,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,QAAQ,EAAE,SAAS,CAAC,QAAQ;SAC7B,CAAC;aACD,IAAI,CAAC,SAAS,CAAC;aACf,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC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,CAAC;QAE3B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO;aAC/B,QAAQ,EAAE;aACV,MAAM,CAAC,SAAS,CAAC;aACjB,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;aAC/D,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;aAC9F,SAAS,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;QAEnC,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export type ProcessesTable = ReturnType<typeof processesTable>;
|
|
2
|
+
/** The instances of the process managers of a context, to include in the schema files drizzle-kit reads. */
|
|
3
|
+
export declare function processesTable(schemaName?: string): import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
|
+
name: "process_instances";
|
|
5
|
+
schema: string | undefined;
|
|
6
|
+
columns: {
|
|
7
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
8
|
+
name: "name";
|
|
9
|
+
tableName: "process_instances";
|
|
10
|
+
dataType: "string";
|
|
11
|
+
columnType: "PgText";
|
|
12
|
+
data: string;
|
|
13
|
+
driverParam: string;
|
|
14
|
+
notNull: true;
|
|
15
|
+
hasDefault: false;
|
|
16
|
+
isPrimaryKey: false;
|
|
17
|
+
isAutoincrement: false;
|
|
18
|
+
hasRuntimeDefault: false;
|
|
19
|
+
enumValues: [string, ...string[]];
|
|
20
|
+
baseColumn: never;
|
|
21
|
+
identity: undefined;
|
|
22
|
+
generated: undefined;
|
|
23
|
+
}, {}, {}>;
|
|
24
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
25
|
+
name: "id";
|
|
26
|
+
tableName: "process_instances";
|
|
27
|
+
dataType: "string";
|
|
28
|
+
columnType: "PgText";
|
|
29
|
+
data: string;
|
|
30
|
+
driverParam: string;
|
|
31
|
+
notNull: true;
|
|
32
|
+
hasDefault: false;
|
|
33
|
+
isPrimaryKey: false;
|
|
34
|
+
isAutoincrement: false;
|
|
35
|
+
hasRuntimeDefault: false;
|
|
36
|
+
enumValues: [string, ...string[]];
|
|
37
|
+
baseColumn: never;
|
|
38
|
+
identity: undefined;
|
|
39
|
+
generated: undefined;
|
|
40
|
+
}, {}, {}>;
|
|
41
|
+
state: import("drizzle-orm/pg-core").PgColumn<{
|
|
42
|
+
name: "state";
|
|
43
|
+
tableName: "process_instances";
|
|
44
|
+
dataType: "json";
|
|
45
|
+
columnType: "PgJsonb";
|
|
46
|
+
data: unknown;
|
|
47
|
+
driverParam: unknown;
|
|
48
|
+
notNull: false;
|
|
49
|
+
hasDefault: false;
|
|
50
|
+
isPrimaryKey: false;
|
|
51
|
+
isAutoincrement: false;
|
|
52
|
+
hasRuntimeDefault: false;
|
|
53
|
+
enumValues: undefined;
|
|
54
|
+
baseColumn: never;
|
|
55
|
+
identity: undefined;
|
|
56
|
+
generated: undefined;
|
|
57
|
+
}, {}, {}>;
|
|
58
|
+
version: import("drizzle-orm/pg-core").PgColumn<{
|
|
59
|
+
name: "version";
|
|
60
|
+
tableName: "process_instances";
|
|
61
|
+
dataType: "number";
|
|
62
|
+
columnType: "PgInteger";
|
|
63
|
+
data: number;
|
|
64
|
+
driverParam: string | number;
|
|
65
|
+
notNull: true;
|
|
66
|
+
hasDefault: false;
|
|
67
|
+
isPrimaryKey: false;
|
|
68
|
+
isAutoincrement: false;
|
|
69
|
+
hasRuntimeDefault: false;
|
|
70
|
+
enumValues: undefined;
|
|
71
|
+
baseColumn: never;
|
|
72
|
+
identity: undefined;
|
|
73
|
+
generated: undefined;
|
|
74
|
+
}, {}, {}>;
|
|
75
|
+
ended: import("drizzle-orm/pg-core").PgColumn<{
|
|
76
|
+
name: "ended";
|
|
77
|
+
tableName: "process_instances";
|
|
78
|
+
dataType: "boolean";
|
|
79
|
+
columnType: "PgBoolean";
|
|
80
|
+
data: boolean;
|
|
81
|
+
driverParam: boolean;
|
|
82
|
+
notNull: true;
|
|
83
|
+
hasDefault: true;
|
|
84
|
+
isPrimaryKey: false;
|
|
85
|
+
isAutoincrement: false;
|
|
86
|
+
hasRuntimeDefault: false;
|
|
87
|
+
enumValues: undefined;
|
|
88
|
+
baseColumn: never;
|
|
89
|
+
identity: undefined;
|
|
90
|
+
generated: undefined;
|
|
91
|
+
}, {}, {}>;
|
|
92
|
+
timeouts: import("drizzle-orm/pg-core").PgColumn<{
|
|
93
|
+
name: "timeouts";
|
|
94
|
+
tableName: "process_instances";
|
|
95
|
+
dataType: "json";
|
|
96
|
+
columnType: "PgJsonb";
|
|
97
|
+
data: Record<string, string>;
|
|
98
|
+
driverParam: unknown;
|
|
99
|
+
notNull: true;
|
|
100
|
+
hasDefault: false;
|
|
101
|
+
isPrimaryKey: false;
|
|
102
|
+
isAutoincrement: false;
|
|
103
|
+
hasRuntimeDefault: false;
|
|
104
|
+
enumValues: undefined;
|
|
105
|
+
baseColumn: never;
|
|
106
|
+
identity: undefined;
|
|
107
|
+
generated: undefined;
|
|
108
|
+
}, {}, {
|
|
109
|
+
$type: Record<string, string>;
|
|
110
|
+
}>;
|
|
111
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
112
|
+
name: string;
|
|
113
|
+
tableName: "process_instances";
|
|
114
|
+
dataType: "date";
|
|
115
|
+
columnType: "PgTimestamp";
|
|
116
|
+
data: Date;
|
|
117
|
+
driverParam: string;
|
|
118
|
+
notNull: true;
|
|
119
|
+
hasDefault: true;
|
|
120
|
+
isPrimaryKey: false;
|
|
121
|
+
isAutoincrement: false;
|
|
122
|
+
hasRuntimeDefault: false;
|
|
123
|
+
enumValues: undefined;
|
|
124
|
+
baseColumn: never;
|
|
125
|
+
identity: undefined;
|
|
126
|
+
generated: undefined;
|
|
127
|
+
}, {}, {}>;
|
|
128
|
+
};
|
|
129
|
+
dialect: 'pg';
|
|
130
|
+
}>;
|
|
131
|
+
//# sourceMappingURL=processes-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processes-table.d.ts","sourceRoot":"","sources":["../../../src/postgres/processes/processes-table.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAE/D,4GAA4G;AAC5G,wBAAgB,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAcjD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { boolean, integer, jsonb, primaryKey, text } from 'drizzle-orm/pg-core';
|
|
2
|
+
import { instant } from '../columns/instant.js';
|
|
3
|
+
import { tableIn } from '../schema/table-in.js';
|
|
4
|
+
/** The instances of the process managers of a context, to include in the schema files drizzle-kit reads. */
|
|
5
|
+
export function processesTable(schemaName) {
|
|
6
|
+
return tableIn(schemaName)('process_instances', {
|
|
7
|
+
name: text('name').notNull(),
|
|
8
|
+
id: text('id').notNull(),
|
|
9
|
+
state: jsonb('state'),
|
|
10
|
+
version: integer('version').notNull(),
|
|
11
|
+
ended: boolean('ended').notNull().default(false),
|
|
12
|
+
timeouts: jsonb('timeouts').$type().notNull(),
|
|
13
|
+
updatedAt: instant('updated_at').notNull().defaultNow(),
|
|
14
|
+
}, (table) => [primaryKey({ columns: [table.name, table.id] })]);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=processes-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processes-table.js","sourceRoot":"","sources":["../../../src/postgres/processes/processes-table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIhD,4GAA4G;AAC5G,MAAM,UAAU,cAAc,CAAC,UAAmB;IAChD,OAAO,OAAO,CAAC,UAAU,CAAC,CACxB,mBAAmB,EACnB;QACE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;QAC5B,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE;QACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;QACrB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE;QACrC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QAChD,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAA0B,CAAC,OAAO,EAAE;QACrE,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;KACxD,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAC7D,CAAC;AACJ,CAAC"}
|
package/dist/postgres.d.ts
CHANGED
|
@@ -24,4 +24,8 @@ export * from './postgres/tenancy/own-tenant-condition.js';
|
|
|
24
24
|
export * from './postgres/tenancy/tenant-policies.js';
|
|
25
25
|
export * from './postgres/tenancy/force-row-level-security.js';
|
|
26
26
|
export * from './postgres/tenancy/tenant-session.js';
|
|
27
|
+
export * from './postgres/jobs/jobs-table.js';
|
|
28
|
+
export * from './postgres/jobs/drizzle-job-store.js';
|
|
29
|
+
export * from './postgres/processes/processes-table.js';
|
|
30
|
+
export * from './postgres/processes/drizzle-process-store.js';
|
|
27
31
|
//# sourceMappingURL=postgres.d.ts.map
|
package/dist/postgres.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wDAAwD,CAAC;AACvE,cAAc,qCAAqC,CAAC;AACpD,cAAc,4DAA4D,CAAC;AAC3E,cAAc,iDAAiD,CAAC;AAChE,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oDAAoD,CAAC;AACnE,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qDAAqD,CAAC;AACpE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mDAAmD,CAAC;AAClE,cAAc,mDAAmD,CAAC;AAClE,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uCAAuC,CAAC;AACtD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wDAAwD,CAAC;AACvE,cAAc,qCAAqC,CAAC;AACpD,cAAc,4DAA4D,CAAC;AAC3E,cAAc,iDAAiD,CAAC;AAChE,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oDAAoD,CAAC;AACnE,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qDAAqD,CAAC;AACpE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mDAAmD,CAAC;AAClE,cAAc,mDAAmD,CAAC;AAClE,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uCAAuC,CAAC;AACtD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC"}
|
package/dist/postgres.js
CHANGED
|
@@ -24,4 +24,8 @@ export * from './postgres/tenancy/own-tenant-condition.js';
|
|
|
24
24
|
export * from './postgres/tenancy/tenant-policies.js';
|
|
25
25
|
export * from './postgres/tenancy/force-row-level-security.js';
|
|
26
26
|
export * from './postgres/tenancy/tenant-session.js';
|
|
27
|
+
export * from './postgres/jobs/jobs-table.js';
|
|
28
|
+
export * from './postgres/jobs/drizzle-job-store.js';
|
|
29
|
+
export * from './postgres/processes/processes-table.js';
|
|
30
|
+
export * from './postgres/processes/drizzle-process-store.js';
|
|
27
31
|
//# sourceMappingURL=postgres.js.map
|
package/dist/postgres.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.js","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,GAEb,MAAM,oBAAoB,CAAC;AAC5B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wDAAwD,CAAC;AACvE,cAAc,qCAAqC,CAAC;AACpD,cAAc,4DAA4D,CAAC;AAC3E,cAAc,iDAAiD,CAAC;AAChE,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oDAAoD,CAAC;AACnE,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qDAAqD,CAAC;AACpE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mDAAmD,CAAC;AAClE,cAAc,mDAAmD,CAAC;AAClE,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uCAAuC,CAAC;AACtD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"postgres.js","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,GAEb,MAAM,oBAAoB,CAAC;AAC5B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wDAAwD,CAAC;AACvE,cAAc,qCAAqC,CAAC;AACpD,cAAc,4DAA4D,CAAC;AAC3E,cAAc,iDAAiD,CAAC;AAChE,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oDAAoD,CAAC;AACnE,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qDAAqD,CAAC;AACpE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mDAAmD,CAAC;AAClE,cAAc,mDAAmD,CAAC;AAClE,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uCAAuC,CAAC;AACtD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/drizzle",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Drizzle adapters for the kernel ports on PostgreSQL: unit of work, transactional outbox store, processed-event store, event store, one schema per context.",
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"description": "Drizzle adapters for the kernel ports on PostgreSQL: unit of work, transactional outbox store, processed-event store, event store, background job store, process store, one schema per context.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,8 +26,9 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ddd-ts-kit/kernel": "0.
|
|
30
|
-
"@ddd-ts-kit/events": "0.
|
|
29
|
+
"@ddd-ts-kit/kernel": "0.11.0",
|
|
30
|
+
"@ddd-ts-kit/events": "0.11.0",
|
|
31
|
+
"@ddd-ts-kit/scheduling": "0.11.0"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
34
|
"drizzle-orm": ">=0.40.0"
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"drizzle-orm": "latest",
|
|
37
38
|
"@electric-sql/pglite": "0.5.9",
|
|
38
|
-
"@ddd-ts-kit/testing": "0.
|
|
39
|
+
"@ddd-ts-kit/testing": "0.11.0",
|
|
39
40
|
"pg": "^8.23.1",
|
|
40
41
|
"@types/pg": "^8.23.1"
|
|
41
42
|
}
|