@nestjs-transactional/cqrs 1.0.0-alpha.5 → 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 +155 -410
- package/dist/decorators/integration-events-handler.decorator.d.ts +2 -2
- package/dist/decorators/integration-events-handler.decorator.js +9 -14
- package/dist/decorators/integration-events-handler.decorator.js.map +1 -1
- package/dist/decorators/transactional-events-handler.decorator.d.ts +4 -4
- package/dist/decorators/transactional-events-handler.decorator.js +12 -17
- package/dist/decorators/transactional-events-handler.decorator.js.map +1 -1
- package/dist/event-dispatcher/event-dispatcher.d.ts +4 -4
- package/dist/event-dispatcher/event-dispatcher.js +18 -22
- package/dist/event-dispatcher/event-dispatcher.js.map +1 -1
- package/dist/event-publisher/hybrid-event-publisher.d.ts +2 -2
- package/dist/event-publisher/hybrid-event-publisher.js +10 -13
- package/dist/event-publisher/hybrid-event-publisher.js.map +1 -1
- package/dist/event-publisher/transactional-event-publisher-adapter.d.ts +15 -5
- package/dist/event-publisher/transactional-event-publisher-adapter.js +20 -12
- package/dist/event-publisher/transactional-event-publisher-adapter.js.map +1 -1
- package/dist/event-publisher/transactional-event-publisher.d.ts +1 -1
- package/dist/event-publisher/transactional-event-publisher.js +6 -9
- package/dist/event-publisher/transactional-event-publisher.js.map +1 -1
- package/dist/handlers/bootstrap.d.ts +1 -1
- package/dist/handlers/bootstrap.js +6 -9
- package/dist/handlers/bootstrap.js.map +1 -1
- package/dist/handlers/handler-wrapper.js +16 -19
- package/dist/handlers/handler-wrapper.js.map +1 -1
- package/dist/handlers/integration-events-handler-scanner.d.ts +2 -2
- package/dist/handlers/integration-events-handler-scanner.js +19 -22
- package/dist/handlers/integration-events-handler-scanner.js.map +1 -1
- package/dist/handlers/listener-scanner.d.ts +1 -1
- package/dist/handlers/listener-scanner.js +11 -14
- package/dist/handlers/listener-scanner.js.map +1 -1
- package/dist/handlers/outbox-listener-registrar.d.ts +3 -3
- package/dist/handlers/outbox-listener-registrar.js +2 -5
- package/dist/handlers/outbox-listener-registrar.js.map +1 -1
- package/dist/index.d.ts +15 -15
- package/dist/index.js +13 -36
- package/dist/index.js.map +1 -1
- package/dist/interfaces/integration-event-handler.interface.js +1 -2
- package/dist/interfaces/transactional-event-handler.interface.js +1 -2
- package/dist/module/cqrs-transactional.module.d.ts +66 -8
- package/dist/module/cqrs-transactional.module.js +120 -68
- package/dist/module/cqrs-transactional.module.js.map +1 -1
- package/dist/types/transactional-listener.types.js +2 -5
- package/dist/types/transactional-listener.types.js.map +1 -1
- package/package.json +27 -16
|
@@ -1,31 +1,40 @@
|
|
|
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);
|
|
5
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const handler_wrapper_1 = require("../handlers/handler-wrapper");
|
|
21
|
-
const integration_events_handler_scanner_1 = require("../handlers/integration-events-handler-scanner");
|
|
22
|
-
const listener_scanner_1 = require("../handlers/listener-scanner");
|
|
7
|
+
import { Module, } from '@nestjs/common';
|
|
8
|
+
import { DiscoveryModule, DiscoveryService } from '@nestjs/core';
|
|
9
|
+
import { CqrsModule, EventBus, EventPublisher } from '@nestjs/cqrs';
|
|
10
|
+
import { TransactionManager } from '@nestjs-transactional/core';
|
|
11
|
+
import { TransactionalEventDispatcher } from '../event-dispatcher/event-dispatcher.js';
|
|
12
|
+
import { HybridEventPublisher } from '../event-publisher/hybrid-event-publisher.js';
|
|
13
|
+
import { TransactionalEventPublisherAdapter } from '../event-publisher/transactional-event-publisher-adapter.js';
|
|
14
|
+
import { TransactionalEventPublisher } from '../event-publisher/transactional-event-publisher.js';
|
|
15
|
+
import { CqrsTransactionalBootstrap } from '../handlers/bootstrap.js';
|
|
16
|
+
import { CqrsHandlerWrapper } from '../handlers/handler-wrapper.js';
|
|
17
|
+
import { IntegrationEventsHandlerScanner } from '../handlers/integration-events-handler-scanner.js';
|
|
18
|
+
import { TransactionalListenerScanner } from '../handlers/listener-scanner.js';
|
|
23
19
|
/**
|
|
24
20
|
* DI token for the resolved {@link CqrsTransactionalOptions} object.
|
|
25
21
|
* Consumers normally do not inject this directly — it is used by the
|
|
26
22
|
* module's internal factory to pass options to {@link CqrsHandlerWrapper}.
|
|
27
23
|
*/
|
|
28
|
-
|
|
24
|
+
export const CQRS_TRANSACTIONAL_OPTIONS = 'CQRS_TRANSACTIONAL_OPTIONS';
|
|
25
|
+
/**
|
|
26
|
+
* Single source of truth for the option defaults, so `forRoot` and
|
|
27
|
+
* `forRootAsync` cannot drift apart.
|
|
28
|
+
*/
|
|
29
|
+
function resolveWrapperOptions(options) {
|
|
30
|
+
return {
|
|
31
|
+
wrapCommandHandlers: options.wrapCommandHandlers ?? true,
|
|
32
|
+
wrapQueryHandlers: options.wrapQueryHandlers ?? true,
|
|
33
|
+
wrapEventHandlers: options.wrapEventHandlers ?? true,
|
|
34
|
+
defaultQueryOptions: options.defaultQueryOptions ?? { readOnly: true },
|
|
35
|
+
defaultCommandOptions: options.defaultCommandOptions,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
29
38
|
/**
|
|
30
39
|
* NestJS module that wires the `@nestjs-transactional/cqrs` runtime:
|
|
31
40
|
*
|
|
@@ -45,23 +54,30 @@ exports.CQRS_TRANSACTIONAL_OPTIONS = 'CQRS_TRANSACTIONAL_OPTIONS';
|
|
|
45
54
|
* dispatcher.
|
|
46
55
|
*
|
|
47
56
|
* Pair with `TransactionalModule.forRoot({ isGlobal: true })` at the
|
|
48
|
-
* application root. For TypeORM-backed applications,
|
|
49
|
-
*
|
|
57
|
+
* application root. For TypeORM-backed applications, register one
|
|
58
|
+
* adapter per DataSource with `TypeOrmTransactionalModule.forRoot(...)`
|
|
59
|
+
* (ADR-019 — one call per dataSource, not one per feature module).
|
|
60
|
+
*
|
|
61
|
+
* Do NOT import `@nestjs/cqrs`'s `CqrsModule` alongside this module
|
|
62
|
+
* (convention #6): this module imports `CqrsModule` internally and
|
|
63
|
+
* overrides the `EventPublisher` DI token, so a second import in the
|
|
64
|
+
* consumer shadows the override and aggregate events silently bypass
|
|
65
|
+
* the dispatcher.
|
|
50
66
|
*
|
|
51
67
|
* @example
|
|
52
68
|
* ```ts
|
|
53
69
|
* @Module({
|
|
54
70
|
* imports: [
|
|
55
71
|
* TransactionalModule.forRoot({ isGlobal: true }),
|
|
56
|
-
* TypeOrmTransactionalModule.
|
|
57
|
-
* CqrsModule
|
|
72
|
+
* TypeOrmTransactionalModule.forRoot({ isDefault: true }),
|
|
73
|
+
* // No `CqrsModule` here — see the note above.
|
|
58
74
|
* CqrsTransactionalModule.forRoot(),
|
|
59
75
|
* ],
|
|
60
76
|
* })
|
|
61
77
|
* export class AppModule {}
|
|
62
78
|
* ```
|
|
63
79
|
*
|
|
64
|
-
* **Multi-dataSource setups
|
|
80
|
+
* **Multi-dataSource setups**: the cqrs runtime is
|
|
65
81
|
* dataSource-agnostic by design. There is exactly one
|
|
66
82
|
* `CqrsTransactionalModule.forRoot()` per application regardless of
|
|
67
83
|
* how many dataSources are configured — multi-DS routing emerges
|
|
@@ -82,56 +98,92 @@ exports.CQRS_TRANSACTIONAL_OPTIONS = 'CQRS_TRANSACTIONAL_OPTIONS';
|
|
|
82
98
|
* cross-dataSource transactions). For cross-DS event handling
|
|
83
99
|
* prefer the outbox path — see `docs/known-limitations.md`.
|
|
84
100
|
*/
|
|
85
|
-
let CqrsTransactionalModule =
|
|
101
|
+
let CqrsTransactionalModule = class CqrsTransactionalModule {
|
|
86
102
|
static forRoot(options = {}) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
useTransactionalEventPublisher: options.useTransactionalEventPublisher ?? true,
|
|
92
|
-
defaultQueryOptions: options.defaultQueryOptions ?? { readOnly: true },
|
|
93
|
-
defaultCommandOptions: options.defaultCommandOptions,
|
|
94
|
-
};
|
|
95
|
-
const providers = [
|
|
96
|
-
{
|
|
97
|
-
provide: exports.CQRS_TRANSACTIONAL_OPTIONS,
|
|
98
|
-
useValue: resolved,
|
|
99
|
-
},
|
|
100
|
-
event_dispatcher_1.TransactionalEventDispatcher,
|
|
101
|
-
listener_scanner_1.TransactionalListenerScanner,
|
|
102
|
-
integration_events_handler_scanner_1.IntegrationEventsHandlerScanner,
|
|
103
|
-
{
|
|
104
|
-
provide: handler_wrapper_1.CqrsHandlerWrapper,
|
|
105
|
-
useFactory: (discovery, manager, opts) => new handler_wrapper_1.CqrsHandlerWrapper(discovery, manager, opts),
|
|
106
|
-
inject: [core_1.DiscoveryService, core_2.TransactionManager, exports.CQRS_TRANSACTIONAL_OPTIONS],
|
|
103
|
+
return buildModule({
|
|
104
|
+
optionsProvider: {
|
|
105
|
+
provide: CQRS_TRANSACTIONAL_OPTIONS,
|
|
106
|
+
useValue: resolveWrapperOptions(options),
|
|
107
107
|
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
108
|
+
useTransactionalEventPublisher: options.useTransactionalEventPublisher ?? true,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Asynchronous registration. Resolves the wrapper options through a
|
|
113
|
+
* NestJS-style async factory before binding
|
|
114
|
+
* {@link CqrsHandlerWrapper}.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* CqrsTransactionalModule.forRootAsync({
|
|
119
|
+
* imports: [ConfigModule],
|
|
120
|
+
* inject: [ConfigService],
|
|
121
|
+
* useFactory: (cfg: ConfigService) => ({
|
|
122
|
+
* wrapQueryHandlers: cfg.get('WRAP_QUERIES') !== 'false',
|
|
123
|
+
* defaultCommandOptions: { isolation: cfg.get('TX_ISOLATION') },
|
|
124
|
+
* }),
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
static forRootAsync(options) {
|
|
129
|
+
const optionsProvider = {
|
|
130
|
+
provide: CQRS_TRANSACTIONAL_OPTIONS,
|
|
131
|
+
useFactory: async (...args) => resolveWrapperOptions(await options.useFactory(...args)),
|
|
132
|
+
inject: options.inject ? [...options.inject] : undefined,
|
|
130
133
|
};
|
|
134
|
+
return buildModule({
|
|
135
|
+
optionsProvider,
|
|
136
|
+
useTransactionalEventPublisher: options.useTransactionalEventPublisher ?? true,
|
|
137
|
+
imports: options.imports,
|
|
138
|
+
});
|
|
131
139
|
}
|
|
132
140
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
(0, common_1.Module)({})
|
|
141
|
+
CqrsTransactionalModule = __decorate([
|
|
142
|
+
Module({})
|
|
136
143
|
], CqrsTransactionalModule);
|
|
144
|
+
export { CqrsTransactionalModule };
|
|
145
|
+
/**
|
|
146
|
+
* Shared module shape for both registration paths. The only difference
|
|
147
|
+
* between them is how {@link CQRS_TRANSACTIONAL_OPTIONS} is provided —
|
|
148
|
+
* everything downstream injects that token, so the provider matrix is
|
|
149
|
+
* identical.
|
|
150
|
+
*/
|
|
151
|
+
function buildModule(args) {
|
|
152
|
+
const providers = [
|
|
153
|
+
args.optionsProvider,
|
|
154
|
+
TransactionalEventDispatcher,
|
|
155
|
+
TransactionalListenerScanner,
|
|
156
|
+
IntegrationEventsHandlerScanner,
|
|
157
|
+
{
|
|
158
|
+
provide: CqrsHandlerWrapper,
|
|
159
|
+
useFactory: (discovery, manager, opts) => new CqrsHandlerWrapper(discovery, manager, opts),
|
|
160
|
+
inject: [DiscoveryService, TransactionManager, CQRS_TRANSACTIONAL_OPTIONS],
|
|
161
|
+
},
|
|
162
|
+
CqrsTransactionalBootstrap,
|
|
163
|
+
];
|
|
164
|
+
// NOT named `exports`: in the CommonJS output that shadows the
|
|
165
|
+
// module-level `exports` object, and the TDZ of the local const
|
|
166
|
+
// breaks every earlier `exports.X = ...` assignment in this file.
|
|
167
|
+
const exportTokens = [TransactionalEventDispatcher];
|
|
168
|
+
if (args.useTransactionalEventPublisher) {
|
|
169
|
+
// Keep TransactionalEventPublisher as a standalone provider for
|
|
170
|
+
// consumers that want the in-memory-only strategy. The adapter
|
|
171
|
+
// itself now routes through HybridEventPublisher, which picks
|
|
172
|
+
// up the optional outbox scheduler via @Optional injection.
|
|
173
|
+
providers.push(TransactionalEventPublisher);
|
|
174
|
+
providers.push(HybridEventPublisher);
|
|
175
|
+
providers.push({
|
|
176
|
+
provide: EventPublisher,
|
|
177
|
+
useFactory: (strategy, eventBus) => new TransactionalEventPublisherAdapter(strategy, eventBus),
|
|
178
|
+
inject: [HybridEventPublisher, EventBus],
|
|
179
|
+
});
|
|
180
|
+
exportTokens.push(TransactionalEventPublisher, HybridEventPublisher, EventPublisher);
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
module: CqrsTransactionalModule,
|
|
184
|
+
imports: [DiscoveryModule, CqrsModule, ...(args.imports ?? [])],
|
|
185
|
+
providers,
|
|
186
|
+
exports: exportTokens,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
137
189
|
//# sourceMappingURL=cqrs-transactional.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cqrs-transactional.module.js","sourceRoot":"","sources":["../../src/module/cqrs-transactional.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cqrs-transactional.module.js","sourceRoot":"","sources":["../../src/module/cqrs-transactional.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAIL,MAAM,GAGP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,kCAAkC,EAAE,MAAM,6DAA6D,CAAC;AACjH,OAAO,EAAE,2BAA2B,EAAE,MAAM,qDAAqD,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAA8B,MAAM,gCAAgC,CAAC;AAChG,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AACpG,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,4BAA4B,CAAC;AAsEvE;;;GAGG;AACH,SAAS,qBAAqB,CAAC,OAA8B;IAC3D,OAAO;QACL,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAAI,IAAI;QACxD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,IAAI;QACpD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,IAAI;QACpD,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAA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Transaction lifecycle phase at which a `@TransactionalEventsHandler`
|
|
6
3
|
* runs. Mirrors Spring's `TransactionPhase` — see the package README
|
|
@@ -15,11 +12,11 @@ exports.TransactionPhase = void 0;
|
|
|
15
12
|
* - {@link AFTER_COMPLETION}: handler runs on any completion (commit
|
|
16
13
|
* or rollback).
|
|
17
14
|
*/
|
|
18
|
-
var TransactionPhase;
|
|
15
|
+
export var TransactionPhase;
|
|
19
16
|
(function (TransactionPhase) {
|
|
20
17
|
TransactionPhase["BEFORE_COMMIT"] = "BEFORE_COMMIT";
|
|
21
18
|
TransactionPhase["AFTER_COMMIT"] = "AFTER_COMMIT";
|
|
22
19
|
TransactionPhase["AFTER_ROLLBACK"] = "AFTER_ROLLBACK";
|
|
23
20
|
TransactionPhase["AFTER_COMPLETION"] = "AFTER_COMPLETION";
|
|
24
|
-
})(TransactionPhase || (
|
|
21
|
+
})(TransactionPhase || (TransactionPhase = {}));
|
|
25
22
|
//# sourceMappingURL=transactional-listener.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactional-listener.types.js","sourceRoot":"","sources":["../../src/types/transactional-listener.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transactional-listener.types.js","sourceRoot":"","sources":["../../src/types/transactional-listener.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mDAA+B,CAAA;IAC/B,iDAA6B,CAAA;IAC7B,qDAAiC,CAAA;IACjC,yDAAqC,CAAA;AACvC,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs-transactional/cqrs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "@nestjs/cqrs integration for @nestjs-transactional/core — transactional event listeners with phases, handler wrapping, AggregateRoot integration",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
6
8
|
"author": "Igor Golovanov",
|
|
7
9
|
"repository": {
|
|
8
10
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/igorgolovanov/nestjs-transactional.git",
|
|
11
|
+
"url": "git+https://github.com/igorgolovanov/nestjs-transactional.git",
|
|
10
12
|
"directory": "packages/cqrs"
|
|
11
13
|
},
|
|
12
14
|
"bugs": {
|
|
@@ -24,7 +26,7 @@
|
|
|
24
26
|
"after-commit"
|
|
25
27
|
],
|
|
26
28
|
"engines": {
|
|
27
|
-
"node": ">=22.
|
|
29
|
+
"node": ">=22.13.0"
|
|
28
30
|
},
|
|
29
31
|
"main": "dist/index.js",
|
|
30
32
|
"types": "dist/index.d.ts",
|
|
@@ -42,33 +44,42 @@
|
|
|
42
44
|
},
|
|
43
45
|
"publishConfig": {
|
|
44
46
|
"access": "public",
|
|
45
|
-
"tag": "alpha",
|
|
46
47
|
"provenance": true
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
|
-
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
50
|
-
"@nestjs/core": "^10.0.0 || ^11.0.0",
|
|
51
|
-
"@nestjs/cqrs": "^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/cqrs": "^11.0.0 || ^12.0.0",
|
|
52
53
|
"reflect-metadata": "^0.1.13 || ^0.2.0",
|
|
53
54
|
"rxjs": "^7.0.0",
|
|
54
|
-
"@nestjs-transactional/core": "^
|
|
55
|
+
"@nestjs-transactional/core": "^2.0.0"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@nestjs/
|
|
58
|
+
"@jest/globals": "^30.4.2",
|
|
59
|
+
"@nestjs/common": "^11.2.3",
|
|
60
|
+
"@nestjs/core": "^11.2.3",
|
|
59
61
|
"@nestjs/cqrs": "^11.0.0",
|
|
62
|
+
"@nestjs/testing": "^11.2.3",
|
|
63
|
+
"@nestjs/typeorm": "^11.0.3",
|
|
64
|
+
"@types/jest": "^30.0.0",
|
|
65
|
+
"@types/node": "^22.20.1",
|
|
60
66
|
"reflect-metadata": "^0.2.2",
|
|
61
67
|
"rxjs": "^7.8.1",
|
|
62
|
-
"
|
|
63
|
-
"@nestjs-transactional/
|
|
68
|
+
"typeorm": "^1.1.0",
|
|
69
|
+
"@nestjs-transactional/typeorm": "2.0.0",
|
|
70
|
+
"@nestjs-transactional/outbox": "2.0.0",
|
|
71
|
+
"@nestjs-transactional/core": "2.0.0"
|
|
64
72
|
},
|
|
65
73
|
"scripts": {
|
|
66
74
|
"build": "tsc -p tsconfig.build.json",
|
|
67
75
|
"clean": "rimraf dist *.tsbuildinfo coverage",
|
|
68
|
-
"test": "jest",
|
|
69
|
-
"test:watch": "jest --watch",
|
|
70
|
-
"test:cov": "jest --coverage",
|
|
76
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
77
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch",
|
|
78
|
+
"test:cov": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
|
71
79
|
"type-check": "tsc --noEmit",
|
|
72
|
-
"lint": "eslint
|
|
80
|
+
"lint": "eslint .",
|
|
81
|
+
"api:check": "api-extractor run",
|
|
82
|
+
"api:update": "api-extractor run --local",
|
|
83
|
+
"publish:check": "publint && attw --pack . --profile esm-only"
|
|
73
84
|
}
|
|
74
85
|
}
|