@nestjs-transactional/outbox-typeorm 1.1.0 → 2.0.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 +16 -2
- package/dist/entity/event-publication-archive.entity.js +18 -21
- package/dist/entity/event-publication-archive.entity.js.map +1 -1
- package/dist/entity/event-publication.entity.js +20 -23
- package/dist/entity/event-publication.entity.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +8 -24
- package/dist/index.js.map +1 -1
- package/dist/migrations/1700000000000-create-event-publication.js +4 -8
- package/dist/migrations/1700000000000-create-event-publication.js.map +1 -1
- package/dist/module/outbox-typeorm.module.d.ts +1 -1
- package/dist/module/outbox-typeorm.module.js +17 -22
- package/dist/module/outbox-typeorm.module.js.map +1 -1
- package/dist/repository/typeorm-event-publication.repository.js +43 -46
- package/dist/repository/typeorm-event-publication.repository.js.map +1 -1
- package/dist/schema/event-publication-schema.js +22 -27
- package/dist/schema/event-publication-schema.js.map +1 -1
- package/dist/schema/schema-initialization-options.js +2 -5
- package/dist/schema/schema-initialization-options.js.map +1 -1
- package/dist/schema/schema-initializer.d.ts +1 -1
- package/dist/schema/schema-initializer.js +11 -14
- package/dist/schema/schema-initializer.js.map +1 -1
- package/package.json +19 -18
package/README.md
CHANGED
|
@@ -25,6 +25,20 @@ pnpm add @nestjs-transactional/outbox-typeorm \
|
|
|
25
25
|
@nestjs-transactional/core
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
## Module format
|
|
29
|
+
|
|
30
|
+
This package ships **ESM only**, matching NestJS 12, which is ESM-only
|
|
31
|
+
across its own packages. There is no CommonJS build.
|
|
32
|
+
|
|
33
|
+
A CommonJS application still works: Node loads ESM from `require()`
|
|
34
|
+
since 22.12.0, which is why `engines.node` is `>=22.13.0`. What does not
|
|
35
|
+
follow Node here is tooling with its own module loader — Jest above all,
|
|
36
|
+
which needs `NODE_OPTIONS=--experimental-vm-modules` and a few config
|
|
37
|
+
settings. The 19 example applications in the repository all run their
|
|
38
|
+
suites that way and can be copied from.
|
|
39
|
+
|
|
40
|
+
Reasoning and measurements: [ADR-022](https://github.com/igorgolovanov/nestjs-transactional/blob/main/docs/adr/022-esm-only-packaging.md).
|
|
41
|
+
|
|
28
42
|
## Quick start
|
|
29
43
|
|
|
30
44
|
Register the two entities on your `DataSource`, then wire four modules
|
|
@@ -142,8 +156,8 @@ when wiring that dataSource's `OutboxModule`
|
|
|
142
156
|
| --- | --- |
|
|
143
157
|
| Node.js | `>=22.13.0` |
|
|
144
158
|
| `typeorm` | `^0.3.0 \|\| ^1.0.0` |
|
|
145
|
-
| `@nestjs/typeorm` | `^10.0.0 \|\| ^11.0.0` |
|
|
146
|
-
| `@nestjs/common` / `@nestjs/core` | `^10.0.0 \|\| ^11.0.0` |
|
|
159
|
+
| `@nestjs/typeorm` | `^10.0.0 \|\| ^11.0.0 \|\| ^12.0.0` |
|
|
160
|
+
| `@nestjs/common` / `@nestjs/core` | `^10.0.0 \|\| ^11.0.0 \|\| ^12.0.0` |
|
|
147
161
|
| `reflect-metadata` | `^0.1.13 \|\| ^0.2.0` |
|
|
148
162
|
| `rxjs` | `^7.0.0` |
|
|
149
163
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8,10 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const outbox_1 = require("@nestjs-transactional/outbox");
|
|
14
|
-
const typeorm_1 = require("typeorm");
|
|
10
|
+
import { PublicationStatus } from '@nestjs-transactional/outbox';
|
|
11
|
+
import { Column, Entity, Index, PrimaryColumn } from 'typeorm';
|
|
15
12
|
/**
|
|
16
13
|
* Archive table for event publications that have been completed and
|
|
17
14
|
* moved out of the hot queue — used by the `ARCHIVE` completion mode.
|
|
@@ -34,51 +31,51 @@ let EventPublicationArchiveEntity = class EventPublicationArchiveEntity {
|
|
|
34
31
|
completionAttempts;
|
|
35
32
|
failureReason;
|
|
36
33
|
};
|
|
37
|
-
exports.EventPublicationArchiveEntity = EventPublicationArchiveEntity;
|
|
38
34
|
__decorate([
|
|
39
|
-
|
|
35
|
+
PrimaryColumn('uuid'),
|
|
40
36
|
__metadata("design:type", String)
|
|
41
37
|
], EventPublicationArchiveEntity.prototype, "id", void 0);
|
|
42
38
|
__decorate([
|
|
43
|
-
|
|
39
|
+
Column({ name: 'listener_id', length: 512 }),
|
|
44
40
|
__metadata("design:type", String)
|
|
45
41
|
], EventPublicationArchiveEntity.prototype, "listenerId", void 0);
|
|
46
42
|
__decorate([
|
|
47
|
-
|
|
43
|
+
Column({ name: 'event_type', length: 256 }),
|
|
48
44
|
__metadata("design:type", String)
|
|
49
45
|
], EventPublicationArchiveEntity.prototype, "eventType", void 0);
|
|
50
46
|
__decorate([
|
|
51
|
-
|
|
47
|
+
Column({ name: 'serialized_event', type: 'text' }),
|
|
52
48
|
__metadata("design:type", String)
|
|
53
49
|
], EventPublicationArchiveEntity.prototype, "serializedEvent", void 0);
|
|
54
50
|
__decorate([
|
|
55
|
-
|
|
51
|
+
Column({ name: 'publication_date', type: 'timestamptz' }),
|
|
56
52
|
__metadata("design:type", Date)
|
|
57
53
|
], EventPublicationArchiveEntity.prototype, "publicationDate", void 0);
|
|
58
54
|
__decorate([
|
|
59
|
-
|
|
55
|
+
Column({ type: 'varchar', length: 32 }),
|
|
60
56
|
__metadata("design:type", String)
|
|
61
57
|
], EventPublicationArchiveEntity.prototype, "status", void 0);
|
|
62
58
|
__decorate([
|
|
63
|
-
|
|
59
|
+
Column({ name: 'completion_date', type: 'timestamptz' }),
|
|
64
60
|
__metadata("design:type", Date)
|
|
65
61
|
], EventPublicationArchiveEntity.prototype, "completionDate", void 0);
|
|
66
62
|
__decorate([
|
|
67
|
-
|
|
63
|
+
Column({ name: 'last_resubmission_date', type: 'timestamptz', nullable: true }),
|
|
68
64
|
__metadata("design:type", Object)
|
|
69
65
|
], EventPublicationArchiveEntity.prototype, "lastResubmissionDate", void 0);
|
|
70
66
|
__decorate([
|
|
71
|
-
|
|
67
|
+
Column({ name: 'completion_attempts', type: 'int' }),
|
|
72
68
|
__metadata("design:type", Number)
|
|
73
69
|
], EventPublicationArchiveEntity.prototype, "completionAttempts", void 0);
|
|
74
70
|
__decorate([
|
|
75
|
-
|
|
71
|
+
Column({ name: 'failure_reason', type: 'text', nullable: true }),
|
|
76
72
|
__metadata("design:type", Object)
|
|
77
73
|
], EventPublicationArchiveEntity.prototype, "failureReason", void 0);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
EventPublicationArchiveEntity = __decorate([
|
|
75
|
+
Entity('event_publication_archive'),
|
|
76
|
+
Index(['completionDate']),
|
|
77
|
+
Index(['listenerId']),
|
|
78
|
+
Index(['eventType'])
|
|
83
79
|
], EventPublicationArchiveEntity);
|
|
80
|
+
export { EventPublicationArchiveEntity };
|
|
84
81
|
//# sourceMappingURL=event-publication-archive.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-publication-archive.entity.js","sourceRoot":"","sources":["../../src/entity/event-publication-archive.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-publication-archive.entity.js","sourceRoot":"","sources":["../../src/entity/event-publication-archive.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACj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AE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oEACnC;AA7BnB,6BAA6B;IAJzC,MAAM,CAAC,2BAA2B,CAAC;IACnC,KAAK,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACzB,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC;IACrB,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC;GACR,6BAA6B,CA8BzC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8,10 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const outbox_1 = require("@nestjs-transactional/outbox");
|
|
14
|
-
const typeorm_1 = require("typeorm");
|
|
10
|
+
import { PublicationStatus } from '@nestjs-transactional/outbox';
|
|
11
|
+
import { Column, Entity, Index, PrimaryColumn } from 'typeorm';
|
|
15
12
|
/**
|
|
16
13
|
* Hot-queue TypeORM entity backing the Event Publication Registry.
|
|
17
14
|
*
|
|
@@ -43,56 +40,56 @@ let EventPublicationEntity = class EventPublicationEntity {
|
|
|
43
40
|
completionAttempts;
|
|
44
41
|
failureReason;
|
|
45
42
|
};
|
|
46
|
-
exports.EventPublicationEntity = EventPublicationEntity;
|
|
47
43
|
__decorate([
|
|
48
|
-
|
|
44
|
+
PrimaryColumn('uuid'),
|
|
49
45
|
__metadata("design:type", String)
|
|
50
46
|
], EventPublicationEntity.prototype, "id", void 0);
|
|
51
47
|
__decorate([
|
|
52
|
-
|
|
48
|
+
Column({ name: 'listener_id', length: 512 }),
|
|
53
49
|
__metadata("design:type", String)
|
|
54
50
|
], EventPublicationEntity.prototype, "listenerId", void 0);
|
|
55
51
|
__decorate([
|
|
56
|
-
|
|
52
|
+
Column({ name: 'event_type', length: 256 }),
|
|
57
53
|
__metadata("design:type", String)
|
|
58
54
|
], EventPublicationEntity.prototype, "eventType", void 0);
|
|
59
55
|
__decorate([
|
|
60
|
-
|
|
56
|
+
Column({ name: 'serialized_event', type: 'text' }),
|
|
61
57
|
__metadata("design:type", String)
|
|
62
58
|
], EventPublicationEntity.prototype, "serializedEvent", void 0);
|
|
63
59
|
__decorate([
|
|
64
|
-
|
|
60
|
+
Column({ name: 'publication_date', type: 'timestamptz' }),
|
|
65
61
|
__metadata("design:type", Date)
|
|
66
62
|
], EventPublicationEntity.prototype, "publicationDate", void 0);
|
|
67
63
|
__decorate([
|
|
68
|
-
|
|
64
|
+
Column({
|
|
69
65
|
type: 'varchar',
|
|
70
66
|
length: 32,
|
|
71
|
-
default:
|
|
67
|
+
default: PublicationStatus.PUBLISHED,
|
|
72
68
|
}),
|
|
73
69
|
__metadata("design:type", String)
|
|
74
70
|
], EventPublicationEntity.prototype, "status", void 0);
|
|
75
71
|
__decorate([
|
|
76
|
-
|
|
72
|
+
Column({ name: 'completion_date', type: 'timestamptz', nullable: true }),
|
|
77
73
|
__metadata("design:type", Object)
|
|
78
74
|
], EventPublicationEntity.prototype, "completionDate", void 0);
|
|
79
75
|
__decorate([
|
|
80
|
-
|
|
76
|
+
Column({ name: 'last_resubmission_date', type: 'timestamptz', nullable: true }),
|
|
81
77
|
__metadata("design:type", Object)
|
|
82
78
|
], EventPublicationEntity.prototype, "lastResubmissionDate", void 0);
|
|
83
79
|
__decorate([
|
|
84
|
-
|
|
80
|
+
Column({ name: 'completion_attempts', type: 'int', default: 0 }),
|
|
85
81
|
__metadata("design:type", Number)
|
|
86
82
|
], EventPublicationEntity.prototype, "completionAttempts", void 0);
|
|
87
83
|
__decorate([
|
|
88
|
-
|
|
84
|
+
Column({ name: 'failure_reason', type: 'text', nullable: true }),
|
|
89
85
|
__metadata("design:type", Object)
|
|
90
86
|
], EventPublicationEntity.prototype, "failureReason", void 0);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
EventPublicationEntity = __decorate([
|
|
88
|
+
Entity('event_publication'),
|
|
89
|
+
Index(['status', 'publicationDate']),
|
|
90
|
+
Index(['status', 'listenerId']),
|
|
91
|
+
Index(['eventType']),
|
|
92
|
+
Index(['completionDate'])
|
|
97
93
|
], EventPublicationEntity);
|
|
94
|
+
export { EventPublicationEntity };
|
|
98
95
|
//# sourceMappingURL=event-publication.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-publication.entity.js","sourceRoot":"","sources":["../../src/entity/event-publication.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-publication.entity.js","sourceRoot":"","sources":["../../src/entity/event-publication.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AAMI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAEjC,EAAE,CAAU;IAGZ,UAAU,CAAU;IAGpB,SAAS,CAAU;IAGnB,eAAe,CAAU;IAGzB,eAAe,CAAQ;IAOvB,MAAM,CAAqB;IAG3B,cAAc,CAAe;IAG7B,oBAAoB,CAAe;IAGnC,kBAAkB,CAAU;IAG5B,aAAa,CAAiB;CAC/B,CAAA;AAhCC;IADC,aAAa,CAAC,MAAM,CAAC;;kDACV;AAGZ;I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AC,CAAC;GACb,sBAAsB,CAkClC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from './entity/event-publication.entity';
|
|
2
|
-
export * from './entity/event-publication-archive.entity';
|
|
3
|
-
export * from './repository/typeorm-event-publication.repository';
|
|
4
|
-
export * from './schema/event-publication-schema';
|
|
5
|
-
export * from './schema/schema-initialization-options';
|
|
6
|
-
export * from './schema/schema-initializer';
|
|
7
|
-
export * from './migrations/1700000000000-create-event-publication';
|
|
8
|
-
export * from './module/outbox-typeorm.module';
|
|
1
|
+
export * from './entity/event-publication.entity.js';
|
|
2
|
+
export * from './entity/event-publication-archive.entity.js';
|
|
3
|
+
export * from './repository/typeorm-event-publication.repository.js';
|
|
4
|
+
export * from './schema/event-publication-schema.js';
|
|
5
|
+
export * from './schema/schema-initialization-options.js';
|
|
6
|
+
export * from './schema/schema-initializer.js';
|
|
7
|
+
export * from './migrations/1700000000000-create-event-publication.js';
|
|
8
|
+
export * from './module/outbox-typeorm.module.js';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./entity/event-publication.entity"), exports);
|
|
18
|
-
__exportStar(require("./entity/event-publication-archive.entity"), exports);
|
|
19
|
-
__exportStar(require("./repository/typeorm-event-publication.repository"), exports);
|
|
20
|
-
__exportStar(require("./schema/event-publication-schema"), exports);
|
|
21
|
-
__exportStar(require("./schema/schema-initialization-options"), exports);
|
|
22
|
-
__exportStar(require("./schema/schema-initializer"), exports);
|
|
23
|
-
__exportStar(require("./migrations/1700000000000-create-event-publication"), exports);
|
|
24
|
-
__exportStar(require("./module/outbox-typeorm.module"), exports);
|
|
1
|
+
export * from './entity/event-publication.entity.js';
|
|
2
|
+
export * from './entity/event-publication-archive.entity.js';
|
|
3
|
+
export * from './repository/typeorm-event-publication.repository.js';
|
|
4
|
+
export * from './schema/event-publication-schema.js';
|
|
5
|
+
export * from './schema/schema-initialization-options.js';
|
|
6
|
+
export * from './schema/schema-initializer.js';
|
|
7
|
+
export * from './migrations/1700000000000-create-event-publication.js';
|
|
8
|
+
export * from './module/outbox-typeorm.module.js';
|
|
25
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,sDAAsD,CAAC;AACrE,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wDAAwD,CAAC;AACvE,cAAc,mCAAmC,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CreateEventPublication1700000000000 = void 0;
|
|
4
|
-
const event_publication_schema_1 = require("../schema/event-publication-schema");
|
|
1
|
+
import { applyEventPublicationSchema, revertEventPublicationSchema, } from '../schema/event-publication-schema.js';
|
|
5
2
|
/**
|
|
6
3
|
* Initial schema for the Event Publication Registry. Creates both the
|
|
7
4
|
* hot queue (`event_publication`) and the archive table
|
|
@@ -14,13 +11,12 @@ const event_publication_schema_1 = require("../schema/event-publication-schema")
|
|
|
14
11
|
* file into their own migrations directory and rename it to match
|
|
15
12
|
* their migration timestamp convention.
|
|
16
13
|
*/
|
|
17
|
-
class CreateEventPublication1700000000000 {
|
|
14
|
+
export class CreateEventPublication1700000000000 {
|
|
18
15
|
async up(queryRunner) {
|
|
19
|
-
await
|
|
16
|
+
await applyEventPublicationSchema(queryRunner);
|
|
20
17
|
}
|
|
21
18
|
async down(queryRunner) {
|
|
22
|
-
await
|
|
19
|
+
await revertEventPublicationSchema(queryRunner);
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
|
-
exports.CreateEventPublication1700000000000 = CreateEventPublication1700000000000;
|
|
26
22
|
//# sourceMappingURL=1700000000000-create-event-publication.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1700000000000-create-event-publication.js","sourceRoot":"","sources":["../../src/migrations/1700000000000-create-event-publication.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"1700000000000-create-event-publication.js","sourceRoot":"","sources":["../../src/migrations/1700000000000-create-event-publication.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,uCAAuC,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,mCAAmC;IAC9C,KAAK,CAAC,EAAE,CAAC,WAAwB;QAC/B,MAAM,2BAA2B,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,WAAwB;QACjC,MAAM,4BAA4B,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DynamicModule, type InjectionToken, type ModuleMetadata, type Provider } from '@nestjs/common';
|
|
2
|
-
import { type SchemaInitializationOptions } from '../schema/schema-initialization-options';
|
|
2
|
+
import { type SchemaInitializationOptions } from '../schema/schema-initialization-options.js';
|
|
3
3
|
/**
|
|
4
4
|
* Options accepted by {@link OutboxTypeOrmModule.forRoot}.
|
|
5
5
|
*
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -6,16 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
6
|
};
|
|
8
7
|
var OutboxTypeOrmModule_1;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const outbox_1 = require("@nestjs-transactional/outbox");
|
|
16
|
-
const typeorm_event_publication_repository_1 = require("../repository/typeorm-event-publication.repository");
|
|
17
|
-
const schema_initialization_options_1 = require("../schema/schema-initialization-options");
|
|
18
|
-
const schema_initializer_1 = require("../schema/schema-initializer");
|
|
8
|
+
import { Module, } from '@nestjs/common';
|
|
9
|
+
import { getDataSourceToken } from '@nestjs/typeorm';
|
|
10
|
+
import { EVENT_PUBLICATION_REPOSITORY } from '@nestjs-transactional/outbox';
|
|
11
|
+
import { TypeOrmEventPublicationRepository } from '../repository/typeorm-event-publication.repository.js';
|
|
12
|
+
import { DEFAULT_SCHEMA_INITIALIZATION_OPTIONS, } from '../schema/schema-initialization-options.js';
|
|
13
|
+
import { SchemaInitializer } from '../schema/schema-initializer.js';
|
|
19
14
|
/**
|
|
20
15
|
* Private per-dataSource token under which {@link OutboxTypeOrmModule}
|
|
21
16
|
* registers the `TypeOrmEventPublicationRepository` instance for a
|
|
@@ -24,7 +19,7 @@ const schema_initializer_1 = require("../schema/schema-initializer");
|
|
|
24
19
|
* which the user feeds into `OutboxModule.forRoot({ repository })` (one
|
|
25
20
|
* `forRoot` call per dataSource — ADR-019 multi-forRoot pattern).
|
|
26
21
|
*/
|
|
27
|
-
function getTypeOrmRepositoryProviderToken(dataSourceName) {
|
|
22
|
+
export function getTypeOrmRepositoryProviderToken(dataSourceName) {
|
|
28
23
|
return `OUTBOX_TYPEORM_REPOSITORY_${dataSourceName}`;
|
|
29
24
|
}
|
|
30
25
|
/**
|
|
@@ -158,7 +153,7 @@ let OutboxTypeOrmModule = class OutboxTypeOrmModule {
|
|
|
158
153
|
const providers = buildPerDataSourceProviders(dataSourceName, {
|
|
159
154
|
schemaInitializationProvider: {
|
|
160
155
|
provide: getOutboxTypeOrmSchemaOptionsToken(dataSourceName),
|
|
161
|
-
useValue: options.schemaInitialization ??
|
|
156
|
+
useValue: options.schemaInitialization ?? DEFAULT_SCHEMA_INITIALIZATION_OPTIONS,
|
|
162
157
|
},
|
|
163
158
|
});
|
|
164
159
|
return {
|
|
@@ -198,7 +193,7 @@ let OutboxTypeOrmModule = class OutboxTypeOrmModule {
|
|
|
198
193
|
};
|
|
199
194
|
const schemaOptionsProvider = {
|
|
200
195
|
provide: getOutboxTypeOrmSchemaOptionsToken(dataSourceName),
|
|
201
|
-
useFactory: (resolved) => resolved.schemaInitialization ??
|
|
196
|
+
useFactory: (resolved) => resolved.schemaInitialization ?? DEFAULT_SCHEMA_INITIALIZATION_OPTIONS,
|
|
202
197
|
inject: [asyncOptionsToken],
|
|
203
198
|
};
|
|
204
199
|
const providers = [
|
|
@@ -216,10 +211,10 @@ let OutboxTypeOrmModule = class OutboxTypeOrmModule {
|
|
|
216
211
|
};
|
|
217
212
|
}
|
|
218
213
|
};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
(0, common_1.Module)({})
|
|
214
|
+
OutboxTypeOrmModule = OutboxTypeOrmModule_1 = __decorate([
|
|
215
|
+
Module({})
|
|
222
216
|
], OutboxTypeOrmModule);
|
|
217
|
+
export { OutboxTypeOrmModule };
|
|
223
218
|
/**
|
|
224
219
|
* Common per-dataSource provider construction shared between
|
|
225
220
|
* `forRoot` (sync schema-options provider) and `forRootAsync`
|
|
@@ -230,20 +225,20 @@ exports.OutboxTypeOrmModule = OutboxTypeOrmModule = OutboxTypeOrmModule_1 = __de
|
|
|
230
225
|
* passed in.
|
|
231
226
|
*/
|
|
232
227
|
function buildPerDataSourceProviders(dataSourceName, args) {
|
|
233
|
-
const dataSourceToken =
|
|
228
|
+
const dataSourceToken = getDataSourceToken(dataSourceName);
|
|
234
229
|
const repositoryToken = getTypeOrmRepositoryProviderToken(dataSourceName);
|
|
235
230
|
const schemaInitializerToken = getOutboxTypeOrmSchemaInitializerToken(dataSourceName);
|
|
236
231
|
const schemaOptionsToken = getOutboxTypeOrmSchemaOptionsToken(dataSourceName);
|
|
237
232
|
return [
|
|
238
233
|
{
|
|
239
234
|
provide: repositoryToken,
|
|
240
|
-
useFactory: (ds) => new
|
|
235
|
+
useFactory: (ds) => new TypeOrmEventPublicationRepository(ds, dataSourceName),
|
|
241
236
|
inject: [dataSourceToken],
|
|
242
237
|
},
|
|
243
238
|
args.schemaInitializationProvider,
|
|
244
239
|
{
|
|
245
240
|
provide: schemaInitializerToken,
|
|
246
|
-
useFactory: (ds, opts) => new
|
|
241
|
+
useFactory: (ds, opts) => new SchemaInitializer(ds, opts),
|
|
247
242
|
inject: [dataSourceToken, schemaOptionsToken],
|
|
248
243
|
},
|
|
249
244
|
];
|
|
@@ -326,9 +321,9 @@ function buildPerDataSourceExports(dataSourceName) {
|
|
|
326
321
|
* `useExisting` clause, which resolves to the private per-DS token
|
|
327
322
|
* registered by `forRoot`.
|
|
328
323
|
*/
|
|
329
|
-
function typeOrmEventPublicationRepositoryProvider(dataSourceName = 'default') {
|
|
324
|
+
export function typeOrmEventPublicationRepositoryProvider(dataSourceName = 'default') {
|
|
330
325
|
return {
|
|
331
|
-
provide:
|
|
326
|
+
provide: EVENT_PUBLICATION_REPOSITORY,
|
|
332
327
|
useExisting: getTypeOrmRepositoryProviderToken(dataSourceName),
|
|
333
328
|
};
|
|
334
329
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outbox-typeorm.module.js","sourceRoot":"","sources":["../../src/module/outbox-typeorm.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"outbox-typeorm.module.js","sourceRoot":"","sources":["../../src/module/outbox-typeorm.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAIL,MAAM,GAGP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAG5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,uDAAuD,CAAC;AAC1G,OAAO,EACL,qCAAqC,GAEtC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AA6EpE;;;;;;;GAOG;AACH,MAAM,UAAU,iCAAiC,CAAC,cAAsB;IACtE,OAAO,6BAA6B,cAAc,EAAE,CAAC;AACvD,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,sCAAsC,CAAC,cAAsB;IACpE,OAAO,qCAAqC,cAAc,EAAE,CAAC;AAC/D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,kCAAkC,CAAC,cAAsB;IAChE,OAAO,iCAAiC,cAAc,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,mBAAmB,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,MAAM,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;AAElG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;;IAC9B;;;;;;OAMG;IACK,MAAM,CAAC,YAAY,GAAG,CAAC,CAAC;I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QACjD,sCAAsC,CAAC,cAAc,CAAC;QACtD,kCAAkC,CAAC,cAAc,CAAC;KACnD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,MAAM,UAAU,yCAAyC,CAAC,cAAc,GAAG,SAAS;IAClF,OAAO;QACL,OAAO,EAAE,4BAA4B;QACrC,WAAW,EAAE,iCAAiC,CAAC,cAAc,CAAC;KAC/D,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8,15 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const event_publication_archive_entity_1 = require("../entity/event-publication-archive.entity");
|
|
19
|
-
const event_publication_entity_1 = require("../entity/event-publication.entity");
|
|
10
|
+
import { randomUUID } from 'node:crypto';
|
|
11
|
+
import { Injectable } from '@nestjs/common';
|
|
12
|
+
import { PublicationNotFoundError, PublicationStatus, } from '@nestjs-transactional/outbox';
|
|
13
|
+
import { getCurrentEntityManager } from '@nestjs-transactional/typeorm';
|
|
14
|
+
import { In, LessThan, LessThanOrEqual, Not, } from 'typeorm';
|
|
15
|
+
import { EventPublicationArchiveEntity } from '../entity/event-publication-archive.entity.js';
|
|
16
|
+
import { EventPublicationEntity } from '../entity/event-publication.entity.js';
|
|
20
17
|
/**
|
|
21
18
|
* TypeORM-backed implementation of
|
|
22
19
|
* {@link EventPublicationRepository}. Reads and writes go through the
|
|
@@ -54,28 +51,28 @@ let TypeOrmEventPublicationRepository = class TypeOrmEventPublicationRepository
|
|
|
54
51
|
this.dataSourceName = dataSourceName;
|
|
55
52
|
}
|
|
56
53
|
get em() {
|
|
57
|
-
return
|
|
54
|
+
return getCurrentEntityManager(this.dataSourceName, this.dataSource);
|
|
58
55
|
}
|
|
59
56
|
async createAll(inputs) {
|
|
60
57
|
const entities = inputs.map((input) => {
|
|
61
|
-
const entity = new
|
|
62
|
-
entity.id =
|
|
58
|
+
const entity = new EventPublicationEntity();
|
|
59
|
+
entity.id = randomUUID();
|
|
63
60
|
entity.listenerId = input.listenerId;
|
|
64
61
|
entity.eventType = input.eventType;
|
|
65
62
|
entity.serializedEvent = input.serializedEvent;
|
|
66
63
|
entity.publicationDate = input.publicationDate ?? new Date();
|
|
67
|
-
entity.status =
|
|
64
|
+
entity.status = PublicationStatus.PUBLISHED;
|
|
68
65
|
entity.completionDate = null;
|
|
69
66
|
entity.lastResubmissionDate = null;
|
|
70
67
|
entity.completionAttempts = 0;
|
|
71
68
|
entity.failureReason = null;
|
|
72
69
|
return entity;
|
|
73
70
|
});
|
|
74
|
-
await this.em.save(
|
|
71
|
+
await this.em.save(EventPublicationEntity, entities);
|
|
75
72
|
return entities.map(toDomain);
|
|
76
73
|
}
|
|
77
74
|
async findById(id) {
|
|
78
|
-
const entity = await this.em.findOne(
|
|
75
|
+
const entity = await this.em.findOne(EventPublicationEntity, { where: { id } });
|
|
79
76
|
return entity ? toDomain(entity) : null;
|
|
80
77
|
}
|
|
81
78
|
async updateStatus(id, status, options = {}) {
|
|
@@ -84,7 +81,7 @@ let TypeOrmEventPublicationRepository = class TypeOrmEventPublicationRepository
|
|
|
84
81
|
// atomically without a separate `em.increment()` call.
|
|
85
82
|
await this.em
|
|
86
83
|
.createQueryBuilder()
|
|
87
|
-
.update(
|
|
84
|
+
.update(EventPublicationEntity)
|
|
88
85
|
.set({
|
|
89
86
|
status,
|
|
90
87
|
...(options.completionDate !== undefined ? { completionDate: options.completionDate } : {}),
|
|
@@ -105,23 +102,23 @@ let TypeOrmEventPublicationRepository = class TypeOrmEventPublicationRepository
|
|
|
105
102
|
// tells us whether we won the race — losers get 0 and back off.
|
|
106
103
|
const result = await this.em
|
|
107
104
|
.createQueryBuilder()
|
|
108
|
-
.update(
|
|
105
|
+
.update(EventPublicationEntity)
|
|
109
106
|
.set({
|
|
110
|
-
status:
|
|
107
|
+
status: PublicationStatus.PROCESSING,
|
|
111
108
|
completionAttempts: () => 'completion_attempts + 1',
|
|
112
109
|
})
|
|
113
110
|
.where('id = :id AND status IN (:...statuses)', {
|
|
114
111
|
id,
|
|
115
|
-
statuses: [
|
|
112
|
+
statuses: [PublicationStatus.PUBLISHED, PublicationStatus.RESUBMITTED],
|
|
116
113
|
})
|
|
117
114
|
.execute();
|
|
118
115
|
return (result.affected ?? 0) > 0;
|
|
119
116
|
}
|
|
120
117
|
async findReadyForProcessing(limit) {
|
|
121
118
|
const entities = await this.em
|
|
122
|
-
.createQueryBuilder(
|
|
119
|
+
.createQueryBuilder(EventPublicationEntity, 'p')
|
|
123
120
|
.where('p.status IN (:...statuses)', {
|
|
124
|
-
statuses: [
|
|
121
|
+
statuses: [PublicationStatus.PUBLISHED, PublicationStatus.RESUBMITTED],
|
|
125
122
|
})
|
|
126
123
|
.orderBy('p.publication_date', 'ASC')
|
|
127
124
|
.limit(limit)
|
|
@@ -132,22 +129,22 @@ let TypeOrmEventPublicationRepository = class TypeOrmEventPublicationRepository
|
|
|
132
129
|
if (statuses.length === 0) {
|
|
133
130
|
return [];
|
|
134
131
|
}
|
|
135
|
-
const entities = await this.em.find(
|
|
132
|
+
const entities = await this.em.find(EventPublicationEntity, {
|
|
136
133
|
where: {
|
|
137
|
-
status:
|
|
138
|
-
publicationDate:
|
|
134
|
+
status: In(statuses),
|
|
135
|
+
publicationDate: LessThan(beforeDate),
|
|
139
136
|
},
|
|
140
137
|
});
|
|
141
138
|
return entities.map(toDomain);
|
|
142
139
|
}
|
|
143
140
|
async findCompleted(options) {
|
|
144
141
|
const where = {
|
|
145
|
-
status:
|
|
142
|
+
status: PublicationStatus.COMPLETED,
|
|
146
143
|
};
|
|
147
144
|
if (options?.olderThan !== undefined) {
|
|
148
|
-
where.completionDate =
|
|
145
|
+
where.completionDate = LessThan(options.olderThan);
|
|
149
146
|
}
|
|
150
|
-
const entities = await this.em.find(
|
|
147
|
+
const entities = await this.em.find(EventPublicationEntity, {
|
|
151
148
|
where,
|
|
152
149
|
...(options?.limit !== undefined ? { take: options.limit } : {}),
|
|
153
150
|
// Oldest first, per the SPI contract: `limit` turns the order into
|
|
@@ -158,32 +155,32 @@ let TypeOrmEventPublicationRepository = class TypeOrmEventPublicationRepository
|
|
|
158
155
|
return entities.map(toDomain);
|
|
159
156
|
}
|
|
160
157
|
async findIncomplete() {
|
|
161
|
-
const entities = await this.em.find(
|
|
162
|
-
where: { status:
|
|
158
|
+
const entities = await this.em.find(EventPublicationEntity, {
|
|
159
|
+
where: { status: Not(PublicationStatus.COMPLETED) },
|
|
163
160
|
});
|
|
164
161
|
return entities.map(toDomain);
|
|
165
162
|
}
|
|
166
163
|
async findFailed(options) {
|
|
167
164
|
const where = {
|
|
168
|
-
status:
|
|
165
|
+
status: PublicationStatus.FAILED,
|
|
169
166
|
};
|
|
170
167
|
if (options?.minAge !== undefined) {
|
|
171
|
-
where.publicationDate =
|
|
168
|
+
where.publicationDate = LessThan(new Date(Date.now() - options.minAge));
|
|
172
169
|
}
|
|
173
170
|
if (options?.maxAttempts !== undefined) {
|
|
174
|
-
where.completionAttempts =
|
|
171
|
+
where.completionAttempts = LessThanOrEqual(options.maxAttempts);
|
|
175
172
|
}
|
|
176
|
-
const entities = await this.em.find(
|
|
173
|
+
const entities = await this.em.find(EventPublicationEntity, { where });
|
|
177
174
|
return entities.map(toDomain);
|
|
178
175
|
}
|
|
179
176
|
async deleteCompleted(olderThan) {
|
|
180
177
|
const where = {
|
|
181
|
-
status:
|
|
178
|
+
status: PublicationStatus.COMPLETED,
|
|
182
179
|
};
|
|
183
180
|
if (olderThan !== undefined) {
|
|
184
|
-
where.completionDate =
|
|
181
|
+
where.completionDate = LessThan(olderThan);
|
|
185
182
|
}
|
|
186
|
-
const result = await this.em.delete(
|
|
183
|
+
const result = await this.em.delete(EventPublicationEntity, where);
|
|
187
184
|
return result.affected ?? 0;
|
|
188
185
|
}
|
|
189
186
|
async archiveCompleted(id) {
|
|
@@ -194,11 +191,11 @@ let TypeOrmEventPublicationRepository = class TypeOrmEventPublicationRepository
|
|
|
194
191
|
// transaction, TypeORM executes both statements autocommit; the
|
|
195
192
|
// window of inconsistency is the round-trip between the two
|
|
196
193
|
// statements, which is acceptable for an archive operation.
|
|
197
|
-
const entity = await this.em.findOne(
|
|
194
|
+
const entity = await this.em.findOne(EventPublicationEntity, { where: { id } });
|
|
198
195
|
if (entity === null) {
|
|
199
|
-
throw new
|
|
196
|
+
throw new PublicationNotFoundError(id);
|
|
200
197
|
}
|
|
201
|
-
const archive = new
|
|
198
|
+
const archive = new EventPublicationArchiveEntity();
|
|
202
199
|
archive.id = entity.id;
|
|
203
200
|
archive.listenerId = entity.listenerId;
|
|
204
201
|
archive.eventType = entity.eventType;
|
|
@@ -209,18 +206,18 @@ let TypeOrmEventPublicationRepository = class TypeOrmEventPublicationRepository
|
|
|
209
206
|
archive.lastResubmissionDate = entity.lastResubmissionDate;
|
|
210
207
|
archive.completionAttempts = entity.completionAttempts;
|
|
211
208
|
archive.failureReason = entity.failureReason;
|
|
212
|
-
await this.em.save(
|
|
213
|
-
await this.em.delete(
|
|
209
|
+
await this.em.save(EventPublicationArchiveEntity, archive);
|
|
210
|
+
await this.em.delete(EventPublicationEntity, { id });
|
|
214
211
|
}
|
|
215
212
|
async delete(id) {
|
|
216
|
-
await this.em.delete(
|
|
213
|
+
await this.em.delete(EventPublicationEntity, { id });
|
|
217
214
|
}
|
|
218
215
|
};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
(0, common_1.Injectable)(),
|
|
216
|
+
TypeOrmEventPublicationRepository = __decorate([
|
|
217
|
+
Injectable(),
|
|
222
218
|
__metadata("design:paramtypes", [Function, Object])
|
|
223
219
|
], TypeOrmEventPublicationRepository);
|
|
220
|
+
export { TypeOrmEventPublicationRepository };
|
|
224
221
|
function toDomain(entity) {
|
|
225
222
|
return {
|
|
226
223
|
id: entity.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeorm-event-publication.repository.js","sourceRoot":"","sources":["../../src/repository/typeorm-event-publication.repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typeorm-event-publication.repository.js","sourceRoot":"","sources":["../../src/repository/typeorm-event-publication.repository.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAOlB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EACL,EAAE,EACF,QAAQ,EACR,eAAe,EACf,GAAG,GAIJ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEI,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IAEzB;IACA;IAFnB,YACmB,UAAsB,EACtB,iBAAiB,SAAS;QAD1B,eAAU,GAAV,UAAU,CAAY;QACtB,mBAAc,GAAd,cAAc,CAAY;IAC1C,CAAC;IAEJ,IAA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
-
exports.EVENT_PUBLICATION_ARCHIVE_TABLE = exports.EVENT_PUBLICATION_TABLE = void 0;
|
|
4
|
-
exports.applyEventPublicationSchema = applyEventPublicationSchema;
|
|
5
|
-
exports.revertEventPublicationSchema = revertEventPublicationSchema;
|
|
6
|
-
const outbox_1 = require("@nestjs-transactional/outbox");
|
|
7
|
-
const typeorm_1 = require("typeorm");
|
|
1
|
+
import { PublicationStatus } from '@nestjs-transactional/outbox';
|
|
2
|
+
import { Table, TableIndex } from 'typeorm';
|
|
8
3
|
/**
|
|
9
4
|
* Canonical table name for the hot queue. Exposed so downstream tools
|
|
10
5
|
* (e.g. custom queries, observability) can avoid hardcoding the string.
|
|
11
6
|
*/
|
|
12
|
-
|
|
7
|
+
export const EVENT_PUBLICATION_TABLE = 'event_publication';
|
|
13
8
|
/**
|
|
14
9
|
* Canonical table name for the archive trail. Used only by the
|
|
15
10
|
* `ARCHIVE` completion mode.
|
|
16
11
|
*/
|
|
17
|
-
|
|
12
|
+
export const EVENT_PUBLICATION_ARCHIVE_TABLE = 'event_publication_archive';
|
|
18
13
|
function buildHotTable() {
|
|
19
|
-
return new
|
|
20
|
-
name:
|
|
14
|
+
return new Table({
|
|
15
|
+
name: EVENT_PUBLICATION_TABLE,
|
|
21
16
|
columns: [
|
|
22
17
|
{ name: 'id', type: 'uuid', isPrimary: true },
|
|
23
18
|
{ name: 'listener_id', type: 'varchar', length: '512', isNullable: false },
|
|
@@ -28,7 +23,7 @@ function buildHotTable() {
|
|
|
28
23
|
name: 'status',
|
|
29
24
|
type: 'varchar',
|
|
30
25
|
length: '32',
|
|
31
|
-
default: `'${
|
|
26
|
+
default: `'${PublicationStatus.PUBLISHED}'`,
|
|
32
27
|
isNullable: false,
|
|
33
28
|
},
|
|
34
29
|
{ name: 'completion_date', type: 'timestamptz', isNullable: true },
|
|
@@ -39,8 +34,8 @@ function buildHotTable() {
|
|
|
39
34
|
});
|
|
40
35
|
}
|
|
41
36
|
function buildArchiveTable() {
|
|
42
|
-
return new
|
|
43
|
-
name:
|
|
37
|
+
return new Table({
|
|
38
|
+
name: EVENT_PUBLICATION_ARCHIVE_TABLE,
|
|
44
39
|
columns: [
|
|
45
40
|
{ name: 'id', type: 'uuid', isPrimary: true },
|
|
46
41
|
{ name: 'listener_id', type: 'varchar', length: '512', isNullable: false },
|
|
@@ -57,19 +52,19 @@ function buildArchiveTable() {
|
|
|
57
52
|
}
|
|
58
53
|
function buildHotIndexes() {
|
|
59
54
|
return [
|
|
60
|
-
new
|
|
55
|
+
new TableIndex({
|
|
61
56
|
name: 'idx_event_publication_status_date',
|
|
62
57
|
columnNames: ['status', 'publication_date'],
|
|
63
58
|
}),
|
|
64
|
-
new
|
|
59
|
+
new TableIndex({
|
|
65
60
|
name: 'idx_event_publication_status_listener',
|
|
66
61
|
columnNames: ['status', 'listener_id'],
|
|
67
62
|
}),
|
|
68
|
-
new
|
|
63
|
+
new TableIndex({
|
|
69
64
|
name: 'idx_event_publication_event_type',
|
|
70
65
|
columnNames: ['event_type'],
|
|
71
66
|
}),
|
|
72
|
-
new
|
|
67
|
+
new TableIndex({
|
|
73
68
|
name: 'idx_event_publication_completion_date',
|
|
74
69
|
columnNames: ['completion_date'],
|
|
75
70
|
}),
|
|
@@ -77,15 +72,15 @@ function buildHotIndexes() {
|
|
|
77
72
|
}
|
|
78
73
|
function buildArchiveIndexes() {
|
|
79
74
|
return [
|
|
80
|
-
new
|
|
75
|
+
new TableIndex({
|
|
81
76
|
name: 'idx_event_publication_archive_completion_date',
|
|
82
77
|
columnNames: ['completion_date'],
|
|
83
78
|
}),
|
|
84
|
-
new
|
|
79
|
+
new TableIndex({
|
|
85
80
|
name: 'idx_event_publication_archive_listener',
|
|
86
81
|
columnNames: ['listener_id'],
|
|
87
82
|
}),
|
|
88
|
-
new
|
|
83
|
+
new TableIndex({
|
|
89
84
|
name: 'idx_event_publication_archive_event_type',
|
|
90
85
|
columnNames: ['event_type'],
|
|
91
86
|
}),
|
|
@@ -101,14 +96,14 @@ function buildArchiveIndexes() {
|
|
|
101
96
|
* responsible for checking existence and skipping this call when
|
|
102
97
|
* needed.
|
|
103
98
|
*/
|
|
104
|
-
async function applyEventPublicationSchema(qr) {
|
|
99
|
+
export async function applyEventPublicationSchema(qr) {
|
|
105
100
|
await qr.createTable(buildHotTable());
|
|
106
101
|
for (const index of buildHotIndexes()) {
|
|
107
|
-
await qr.createIndex(
|
|
102
|
+
await qr.createIndex(EVENT_PUBLICATION_TABLE, index);
|
|
108
103
|
}
|
|
109
104
|
await qr.createTable(buildArchiveTable());
|
|
110
105
|
for (const index of buildArchiveIndexes()) {
|
|
111
|
-
await qr.createIndex(
|
|
106
|
+
await qr.createIndex(EVENT_PUBLICATION_ARCHIVE_TABLE, index);
|
|
112
107
|
}
|
|
113
108
|
}
|
|
114
109
|
/**
|
|
@@ -117,8 +112,8 @@ async function applyEventPublicationSchema(qr) {
|
|
|
117
112
|
* drops are tolerant — `dropTable(..., true)` adds `IF EXISTS`, so
|
|
118
113
|
* running `down()` on a partially-applied schema still succeeds.
|
|
119
114
|
*/
|
|
120
|
-
async function revertEventPublicationSchema(qr) {
|
|
121
|
-
await qr.dropTable(
|
|
122
|
-
await qr.dropTable(
|
|
115
|
+
export async function revertEventPublicationSchema(qr) {
|
|
116
|
+
await qr.dropTable(EVENT_PUBLICATION_ARCHIVE_TABLE, true);
|
|
117
|
+
await qr.dropTable(EVENT_PUBLICATION_TABLE, true);
|
|
123
118
|
}
|
|
124
119
|
//# sourceMappingURL=event-publication-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-publication-schema.js","sourceRoot":"","sources":["../../src/schema/event-publication-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-publication-schema.js","sourceRoot":"","sources":["../../src/schema/event-publication-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAoB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AU,4BAA4B,CAAC,EAAe;IAChE,MAAM,EAAE,CAAC,SAAS,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;IAC1D,MAAM,EAAE,CAAC,SAAS,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_SCHEMA_INITIALIZATION_OPTIONS = exports.SCHEMA_INITIALIZATION_OPTIONS = void 0;
|
|
4
1
|
/** DI token for {@link SchemaInitializationOptions}. */
|
|
5
|
-
|
|
2
|
+
export const SCHEMA_INITIALIZATION_OPTIONS = Symbol('SCHEMA_INITIALIZATION_OPTIONS');
|
|
6
3
|
/** Safe defaults — auto-init off, migrations preferred. */
|
|
7
|
-
|
|
4
|
+
export const DEFAULT_SCHEMA_INITIALIZATION_OPTIONS = {
|
|
8
5
|
enabled: false,
|
|
9
6
|
};
|
|
10
7
|
//# sourceMappingURL=schema-initialization-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-initialization-options.js","sourceRoot":"","sources":["../../src/schema/schema-initialization-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema-initialization-options.js","sourceRoot":"","sources":["../../src/schema/schema-initialization-options.ts"],"names":[],"mappings":"AAoBA,wDAAwD;AACxD,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,+BAA+B,CAAC,CAAC;AAErF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,qCAAqC,GAAgC;IAChF,OAAO,EAAE,KAAK;CACf,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type OnApplicationBootstrap } from '@nestjs/common';
|
|
2
2
|
import type { DataSource } from 'typeorm';
|
|
3
|
-
import type { SchemaInitializationOptions } from './schema-initialization-options';
|
|
3
|
+
import type { SchemaInitializationOptions } from './schema-initialization-options.js';
|
|
4
4
|
/**
|
|
5
5
|
* Development-time helper that creates the `event_publication` schema
|
|
6
6
|
* at application bootstrap, so developers can spin up a fresh app
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,10 +8,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
10
|
var SchemaInitializer_1;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
|
-
const event_publication_schema_1 = require("./event-publication-schema");
|
|
11
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
12
|
+
import { EVENT_PUBLICATION_TABLE, applyEventPublicationSchema, } from './event-publication-schema.js';
|
|
16
13
|
/**
|
|
17
14
|
* Development-time helper that creates the `event_publication` schema
|
|
18
15
|
* at application bootstrap, so developers can spin up a fresh app
|
|
@@ -29,7 +26,7 @@ const event_publication_schema_1 = require("./event-publication-schema");
|
|
|
29
26
|
let SchemaInitializer = SchemaInitializer_1 = class SchemaInitializer {
|
|
30
27
|
dataSource;
|
|
31
28
|
options;
|
|
32
|
-
logger = new
|
|
29
|
+
logger = new Logger(SchemaInitializer_1.name);
|
|
33
30
|
constructor(dataSource, options) {
|
|
34
31
|
this.dataSource = dataSource;
|
|
35
32
|
this.options = options;
|
|
@@ -39,15 +36,15 @@ let SchemaInitializer = SchemaInitializer_1 = class SchemaInitializer {
|
|
|
39
36
|
return;
|
|
40
37
|
}
|
|
41
38
|
if (await this.hotTableExists()) {
|
|
42
|
-
this.logger.debug(`Table '${
|
|
39
|
+
this.logger.debug(`Table '${EVENT_PUBLICATION_TABLE}' already exists — skipping auto schema init`);
|
|
43
40
|
return;
|
|
44
41
|
}
|
|
45
|
-
this.logger.log(`Initialising '${
|
|
42
|
+
this.logger.log(`Initialising '${EVENT_PUBLICATION_TABLE}' schema (development auto-init)`);
|
|
46
43
|
const queryRunner = this.dataSource.createQueryRunner();
|
|
47
44
|
try {
|
|
48
45
|
await queryRunner.connect();
|
|
49
|
-
await
|
|
50
|
-
this.logger.log(`'${
|
|
46
|
+
await applyEventPublicationSchema(queryRunner);
|
|
47
|
+
this.logger.log(`'${EVENT_PUBLICATION_TABLE}' schema initialised`);
|
|
51
48
|
}
|
|
52
49
|
finally {
|
|
53
50
|
await queryRunner.release();
|
|
@@ -60,13 +57,13 @@ let SchemaInitializer = SchemaInitializer_1 = class SchemaInitializer {
|
|
|
60
57
|
* it exists.
|
|
61
58
|
*/
|
|
62
59
|
async hotTableExists() {
|
|
63
|
-
const rows = await this.dataSource.query(`SELECT to_regclass($1)::text AS exists`, [
|
|
60
|
+
const rows = await this.dataSource.query(`SELECT to_regclass($1)::text AS exists`, [EVENT_PUBLICATION_TABLE]);
|
|
64
61
|
return rows[0]?.exists != null;
|
|
65
62
|
}
|
|
66
63
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
(0, common_1.Injectable)(),
|
|
64
|
+
SchemaInitializer = SchemaInitializer_1 = __decorate([
|
|
65
|
+
Injectable(),
|
|
70
66
|
__metadata("design:paramtypes", [Function, Object])
|
|
71
67
|
], SchemaInitializer);
|
|
68
|
+
export { SchemaInitializer };
|
|
72
69
|
//# sourceMappingURL=schema-initializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-initializer.js","sourceRoot":"","sources":["../../src/schema/schema-initializer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema-initializer.js","sourceRoot":"","sources":["../../src/schema/schema-initializer.ts"],"names":[],"mappings":";;;;;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;QACF,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,IAAI,CAAC;IACjC,CAAC;CACF,CAAA;AA7CY,iBAAiB;IAD7B,UAAU,EAAE;;GACA,iBAAiB,CA6C7B"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs-transactional/outbox-typeorm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "TypeORM persistence backend for @nestjs-transactional/outbox — event_publication table, FOR UPDATE SKIP LOCKED worker safety",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"type": "
|
|
6
|
+
"type": "module",
|
|
7
7
|
"sideEffects": [
|
|
8
8
|
"./dist/entity/*.js"
|
|
9
9
|
],
|
|
@@ -47,17 +47,18 @@
|
|
|
47
47
|
"provenance": true
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
51
|
-
"@nestjs/core": "^10.0.0 || ^11.0.0",
|
|
52
|
-
"@nestjs/typeorm": "^10.0.0 || ^11.0.0",
|
|
50
|
+
"@nestjs/common": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
51
|
+
"@nestjs/core": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
52
|
+
"@nestjs/typeorm": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
53
53
|
"reflect-metadata": "^0.1.13 || ^0.2.0",
|
|
54
54
|
"rxjs": "^7.0.0",
|
|
55
55
|
"typeorm": "^0.3.0 || ^1.0.0",
|
|
56
|
-
"@nestjs-transactional/core": "^
|
|
57
|
-
"@nestjs-transactional/outbox": "^
|
|
58
|
-
"@nestjs-transactional/typeorm": "^
|
|
56
|
+
"@nestjs-transactional/core": "^2.0.0",
|
|
57
|
+
"@nestjs-transactional/outbox": "^2.0.0",
|
|
58
|
+
"@nestjs-transactional/typeorm": "^2.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
+
"@jest/globals": "^30.4.2",
|
|
61
62
|
"@nestjs/common": "^11.2.3",
|
|
62
63
|
"@nestjs/core": "^11.2.3",
|
|
63
64
|
"@nestjs/cqrs": "^11.0.0",
|
|
@@ -66,29 +67,29 @@
|
|
|
66
67
|
"@testcontainers/postgresql": "^12.1.0",
|
|
67
68
|
"@types/jest": "^30.0.0",
|
|
68
69
|
"@types/node": "^22.20.1",
|
|
69
|
-
"jest": "^30.
|
|
70
|
+
"jest": "^30.5.1",
|
|
70
71
|
"reflect-metadata": "^0.2.2",
|
|
71
72
|
"rxjs": "^7.8.1",
|
|
72
73
|
"testcontainers": "^12.1.0",
|
|
73
74
|
"ts-jest": "^29.4.12",
|
|
74
75
|
"typeorm": "^1.1.0",
|
|
75
76
|
"typescript": "^6.0.3",
|
|
76
|
-
"@nestjs-transactional/core": "
|
|
77
|
-
"@nestjs-transactional/
|
|
78
|
-
"@nestjs-transactional/
|
|
79
|
-
"@nestjs-transactional/typeorm": "
|
|
77
|
+
"@nestjs-transactional/core": "2.0.0",
|
|
78
|
+
"@nestjs-transactional/cqrs": "2.0.0",
|
|
79
|
+
"@nestjs-transactional/outbox": "2.0.0",
|
|
80
|
+
"@nestjs-transactional/typeorm": "2.0.0"
|
|
80
81
|
},
|
|
81
82
|
"scripts": {
|
|
82
83
|
"build": "tsc -p tsconfig.build.json",
|
|
83
84
|
"clean": "rimraf dist *.tsbuildinfo coverage",
|
|
84
|
-
"test": "jest",
|
|
85
|
-
"test:watch": "jest --watch",
|
|
86
|
-
"test:cov": "jest --config jest.coverage.config.
|
|
87
|
-
"test:integration": "jest --config jest.integration.config.
|
|
85
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
86
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch",
|
|
87
|
+
"test:cov": "NODE_OPTIONS=--experimental-vm-modules jest --config jest.coverage.config.cjs --coverage",
|
|
88
|
+
"test:integration": "NODE_OPTIONS=--experimental-vm-modules jest --config jest.integration.config.cjs",
|
|
88
89
|
"type-check": "tsc --noEmit",
|
|
89
90
|
"lint": "eslint .",
|
|
90
91
|
"api:check": "api-extractor run",
|
|
91
92
|
"api:update": "api-extractor run --local",
|
|
92
|
-
"publish:check": "publint && attw --pack ."
|
|
93
|
+
"publish:check": "publint && attw --pack . --profile esm-only"
|
|
93
94
|
}
|
|
94
95
|
}
|