@nestjs-transactional/core 1.0.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 +14 -0
- package/dist/bootstrap/transactional-methods.bootstrap.d.ts +2 -2
- package/dist/bootstrap/transactional-methods.bootstrap.js +19 -22
- package/dist/bootstrap/transactional-methods.bootstrap.js.map +1 -1
- package/dist/context/transaction-context-view.d.ts +1 -1
- package/dist/context/transaction-context-view.js +3 -7
- package/dist/context/transaction-context-view.js.map +1 -1
- package/dist/context/transaction.context.d.ts +2 -2
- package/dist/context/transaction.context.js +5 -9
- package/dist/context/transaction.context.js.map +1 -1
- package/dist/decorators/inject-decorators.js +6 -12
- package/dist/decorators/inject-decorators.js.map +1 -1
- package/dist/decorators/transactional.decorator.d.ts +1 -1
- package/dist/decorators/transactional.decorator.js +10 -17
- package/dist/decorators/transactional.decorator.js.map +1 -1
- package/dist/index.d.ts +18 -18
- package/dist/index.js +18 -34
- package/dist/index.js.map +1 -1
- package/dist/interceptor/transactional.interceptor.d.ts +1 -1
- package/dist/interceptor/transactional.interceptor.js +12 -15
- package/dist/interceptor/transactional.interceptor.js.map +1 -1
- package/dist/internal/markers.js +1 -4
- package/dist/internal/markers.js.map +1 -1
- package/dist/manager/adapter.registry.d.ts +1 -1
- package/dist/manager/adapter.registry.js +12 -15
- package/dist/manager/adapter.registry.js.map +1 -1
- package/dist/manager/transaction.manager.d.ts +3 -3
- package/dist/manager/transaction.manager.js +38 -41
- package/dist/manager/transaction.manager.js.map +1 -1
- package/dist/module/transactional.module.d.ts +2 -2
- package/dist/module/transactional.module.js +43 -46
- package/dist/module/transactional.module.js.map +1 -1
- package/dist/observability/transaction-observer.d.ts +1 -1
- package/dist/observability/transaction-observer.js +1 -4
- package/dist/observability/transaction-observer.js.map +1 -1
- package/dist/testing/in-memory.adapter.d.ts +3 -3
- package/dist/testing/in-memory.adapter.js +4 -8
- package/dist/testing/in-memory.adapter.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +1 -17
- package/dist/testing/index.js.map +1 -1
- package/dist/tokens/constants.js +1 -4
- package/dist/tokens/constants.js.map +1 -1
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/index.js +2 -10
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/token-utils.js +5 -11
- package/dist/tokens/token-utils.js.map +1 -1
- package/dist/types/domain-event.js +1 -2
- package/dist/types/errors.js +4 -11
- package/dist/types/errors.js.map +1 -1
- package/dist/types/isolation.js +1 -2
- package/dist/types/propagation.js +2 -5
- package/dist/types/propagation.js.map +1 -1
- package/dist/types/transaction-adapter.d.ts +2 -2
- package/dist/types/transaction-adapter.js +1 -2
- package/dist/types/transaction-handle.js +1 -2
- package/dist/types/transaction-options.d.ts +2 -2
- package/dist/types/transaction-options.js +1 -2
- package/package.json +18 -15
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InMemoryTransactionAdapter = void 0;
|
|
4
|
-
const node_crypto_1 = require("node:crypto");
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
5
2
|
/**
|
|
6
3
|
* Adapter implementation intended for unit tests. Keeps the whole transaction
|
|
7
4
|
* lifecycle in memory and exposes observation arrays (committed, rolled back,
|
|
@@ -13,7 +10,7 @@ const node_crypto_1 = require("node:crypto");
|
|
|
13
10
|
* Exported through `@nestjs-transactional/core/testing`, never through the
|
|
14
11
|
* main entry point.
|
|
15
12
|
*/
|
|
16
|
-
class InMemoryTransactionAdapter {
|
|
13
|
+
export class InMemoryTransactionAdapter {
|
|
17
14
|
name = 'in-memory';
|
|
18
15
|
/**
|
|
19
16
|
* dataSource name this adapter is bound to (DD-021). Defaults to
|
|
@@ -31,7 +28,7 @@ class InMemoryTransactionAdapter {
|
|
|
31
28
|
savepointsRolledBack = [];
|
|
32
29
|
async runInTransaction(options, fn) {
|
|
33
30
|
const handle = {
|
|
34
|
-
id:
|
|
31
|
+
id: randomUUID(),
|
|
35
32
|
adapterName: this.name,
|
|
36
33
|
operations: [],
|
|
37
34
|
};
|
|
@@ -55,7 +52,7 @@ class InMemoryTransactionAdapter {
|
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
54
|
async runInSavepoint(parent, fn) {
|
|
58
|
-
const savepointId =
|
|
55
|
+
const savepointId = randomUUID();
|
|
59
56
|
this.savepointsCreated.push({ parentId: parent.id, savepointId });
|
|
60
57
|
try {
|
|
61
58
|
const result = await fn(parent);
|
|
@@ -79,5 +76,4 @@ class InMemoryTransactionAdapter {
|
|
|
79
76
|
this.savepointsRolledBack = [];
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
|
-
exports.InMemoryTransactionAdapter = InMemoryTransactionAdapter;
|
|
83
79
|
//# sourceMappingURL=in-memory.adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.adapter.js","sourceRoot":"","sources":["../../src/testing/in-memory.adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"in-memory.adapter.js","sourceRoot":"","sources":["../../src/testing/in-memory.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAwCzC;;;;;;;;;;GAUG;AACH,MAAM,OAAO,0BAA0B;IAC5B,IAAI,GAAG,WAAW,CAAC;IAE5B;;;;OAIG;IACM,cAAc,CAAS;IAEhC,YAAY,cAAc,GAAG,SAAS;QACpC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,qBAAqB,GAAmC,EAAE,CAAC;IAC3D,sBAAsB,GAAoC,EAAE,CAAC;IAC7D,iBAAiB,GAA8B,EAAE,CAAC;IAClD,kBAAkB,GAA8B,EAAE,CAAC;IACnD,oBAAoB,GAAwC,EAAE,CAAC;IAE/D,KAAK,CAAC,gBAAgB,CACpB,OAA2B,EAC3B,EAAqD;QAErD,MAAM,MAAM,GAA8B;YACxC,EAAE,EAAE,UAAU,EAAE;YAChB,WAAW,EAAE,IAAI,CAAC,IAAI;YACtB,UAAU,EAAE,EAAE;SACf,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC;gBAC9B,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,OAAO;aACR,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;gBAC/B,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,OAAO;gBACP,KAAK;aACN,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,MAAiC,EACjC,EAAqD;QAErD,MAAM,WAAW,GAAG,UAAU,EAAE,CAAC;QACjC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QAElE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;YACnE,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;YAC5E,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,sBAAsB,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,oBAAoB,GAAG,EAAE,CAAC;IACjC,CAAC;CACF"}
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './in-memory.adapter';
|
|
1
|
+
export * from './in-memory.adapter.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/testing/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
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("./in-memory.adapter"), exports);
|
|
1
|
+
export * from './in-memory.adapter.js';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
package/dist/tokens/constants.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_DATA_SOURCE_NAME = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Default dataSource name used when none is specified to a token
|
|
6
3
|
* utility or inject decorator. Single-adapter consumers never need to
|
|
@@ -13,5 +10,5 @@ exports.DEFAULT_DATA_SOURCE_NAME = void 0;
|
|
|
13
10
|
* documents why this fixed name was chosen over alternatives like
|
|
14
11
|
* `'main'` or `'primary'`.
|
|
15
12
|
*/
|
|
16
|
-
|
|
13
|
+
export const DEFAULT_DATA_SOURCE_NAME = 'default';
|
|
17
14
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/tokens/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/tokens/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAC"}
|
package/dist/tokens/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { DEFAULT_DATA_SOURCE_NAME } from './constants';
|
|
2
|
-
export { getTransactionContextRegistryToken, getTransactionContextToken, getTransactionManagerToken, getTransactionalAdapterToken, } from './token-utils';
|
|
1
|
+
export { DEFAULT_DATA_SOURCE_NAME } from './constants.js';
|
|
2
|
+
export { getTransactionContextRegistryToken, getTransactionContextToken, getTransactionManagerToken, getTransactionalAdapterToken, } from './token-utils.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/tokens/index.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getTransactionalAdapterToken = exports.getTransactionManagerToken = exports.getTransactionContextToken = exports.getTransactionContextRegistryToken = exports.DEFAULT_DATA_SOURCE_NAME = void 0;
|
|
4
|
-
var constants_1 = require("./constants");
|
|
5
|
-
Object.defineProperty(exports, "DEFAULT_DATA_SOURCE_NAME", { enumerable: true, get: function () { return constants_1.DEFAULT_DATA_SOURCE_NAME; } });
|
|
6
|
-
var token_utils_1 = require("./token-utils");
|
|
7
|
-
Object.defineProperty(exports, "getTransactionContextRegistryToken", { enumerable: true, get: function () { return token_utils_1.getTransactionContextRegistryToken; } });
|
|
8
|
-
Object.defineProperty(exports, "getTransactionContextToken", { enumerable: true, get: function () { return token_utils_1.getTransactionContextToken; } });
|
|
9
|
-
Object.defineProperty(exports, "getTransactionManagerToken", { enumerable: true, get: function () { return token_utils_1.getTransactionManagerToken; } });
|
|
10
|
-
Object.defineProperty(exports, "getTransactionalAdapterToken", { enumerable: true, get: function () { return token_utils_1.getTransactionalAdapterToken; } });
|
|
1
|
+
export { DEFAULT_DATA_SOURCE_NAME } from './constants.js';
|
|
2
|
+
export { getTransactionContextRegistryToken, getTransactionContextToken, getTransactionManagerToken, getTransactionalAdapterToken, } from './token-utils.js';
|
|
11
3
|
//# sourceMappingURL=index.js.map
|
package/dist/tokens/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,kCAAkC,EAClC,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTransactionManagerToken = getTransactionManagerToken;
|
|
4
|
-
exports.getTransactionContextToken = getTransactionContextToken;
|
|
5
|
-
exports.getTransactionalAdapterToken = getTransactionalAdapterToken;
|
|
6
|
-
exports.getTransactionContextRegistryToken = getTransactionContextRegistryToken;
|
|
7
|
-
const constants_1 = require("./constants");
|
|
1
|
+
import { DEFAULT_DATA_SOURCE_NAME } from './constants.js';
|
|
8
2
|
/**
|
|
9
3
|
* Token utilities derive deterministic DI token strings from a
|
|
10
4
|
* dataSource name. They are the foundation of the multi-adapter
|
|
@@ -35,7 +29,7 @@ const constants_1 = require("./constants");
|
|
|
35
29
|
* private readonly txManager: TransactionManager;
|
|
36
30
|
* ```
|
|
37
31
|
*/
|
|
38
|
-
function getTransactionManagerToken(dataSource =
|
|
32
|
+
export function getTransactionManagerToken(dataSource = DEFAULT_DATA_SOURCE_NAME) {
|
|
39
33
|
return `${dataSource}TransactionManager`;
|
|
40
34
|
}
|
|
41
35
|
/**
|
|
@@ -44,7 +38,7 @@ function getTransactionManagerToken(dataSource = constants_1.DEFAULT_DATA_SOURCE
|
|
|
44
38
|
* DD-023 — so cross-dataSource calls do not silently enrol into a
|
|
45
39
|
* sibling transaction.
|
|
46
40
|
*/
|
|
47
|
-
function getTransactionContextToken(dataSource =
|
|
41
|
+
export function getTransactionContextToken(dataSource = DEFAULT_DATA_SOURCE_NAME) {
|
|
48
42
|
return `${dataSource}TransactionContext`;
|
|
49
43
|
}
|
|
50
44
|
/**
|
|
@@ -52,7 +46,7 @@ function getTransactionContextToken(dataSource = constants_1.DEFAULT_DATA_SOURCE
|
|
|
52
46
|
* the concrete adapter (TypeORM, Prisma, ...) bound to the named
|
|
53
47
|
* dataSource. See DD-021.
|
|
54
48
|
*/
|
|
55
|
-
function getTransactionalAdapterToken(dataSource =
|
|
49
|
+
export function getTransactionalAdapterToken(dataSource = DEFAULT_DATA_SOURCE_NAME) {
|
|
56
50
|
return `${dataSource}TransactionalAdapter`;
|
|
57
51
|
}
|
|
58
52
|
/**
|
|
@@ -61,7 +55,7 @@ function getTransactionalAdapterToken(dataSource = constants_1.DEFAULT_DATA_SOUR
|
|
|
61
55
|
* `TransactionContext` instances. Not parameterised by dataSource:
|
|
62
56
|
* exactly one registry per process serves all adapters.
|
|
63
57
|
*/
|
|
64
|
-
function getTransactionContextRegistryToken() {
|
|
58
|
+
export function getTransactionContextRegistryToken() {
|
|
65
59
|
return 'TransactionContextRegistry';
|
|
66
60
|
}
|
|
67
61
|
//# sourceMappingURL=token-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-utils.js","sourceRoot":"","sources":["../../src/tokens/token-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"token-utils.js","sourceRoot":"","sources":["../../src/tokens/token-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B,CAAC,aAAqB,wBAAwB;IACtF,OAAO,GAAG,UAAU,oBAAoB,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,aAAqB,wBAAwB;IACtF,OAAO,GAAG,UAAU,oBAAoB,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,aAAqB,wBAAwB;IAE7C,OAAO,GAAG,UAAU,sBAAsB,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kCAAkC;IAChD,OAAO,4BAA4B,CAAC;AACtC,CAAC"}
|
package/dist/types/errors.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OutboxWriteError = exports.TransactionAdapterNotFoundError = exports.IllegalTransactionStateError = exports.TransactionError = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Base class for all errors thrown by `@nestjs-transactional` packages.
|
|
6
3
|
* Every subclass carries a stable {@link code} suitable for structured
|
|
@@ -10,23 +7,21 @@ exports.OutboxWriteError = exports.TransactionAdapterNotFoundError = exports.Ill
|
|
|
10
7
|
* so that stack traces identify the concrete error type rather than
|
|
11
8
|
* generic `Error`.
|
|
12
9
|
*/
|
|
13
|
-
class TransactionError extends Error {
|
|
10
|
+
export class TransactionError extends Error {
|
|
14
11
|
constructor(message) {
|
|
15
12
|
super(message);
|
|
16
13
|
this.name = new.target.name;
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.TransactionError = TransactionError;
|
|
20
16
|
/**
|
|
21
17
|
* Thrown when the current async context's transactional state does not
|
|
22
18
|
* satisfy the requested `PropagationMode`. Examples: `NEVER` invoked
|
|
23
19
|
* inside an active transaction; `MANDATORY` invoked outside of one; an
|
|
24
20
|
* adapter that does not support savepoints asked to run `NESTED`.
|
|
25
21
|
*/
|
|
26
|
-
class IllegalTransactionStateError extends TransactionError {
|
|
22
|
+
export class IllegalTransactionStateError extends TransactionError {
|
|
27
23
|
code = 'ILLEGAL_TRANSACTION_STATE';
|
|
28
24
|
}
|
|
29
|
-
exports.IllegalTransactionStateError = IllegalTransactionStateError;
|
|
30
25
|
/**
|
|
31
26
|
* Thrown when `TransactionManager.run` is asked to use an adapter
|
|
32
27
|
* (identified by type name + instance name) that was never registered
|
|
@@ -35,7 +30,7 @@ exports.IllegalTransactionStateError = IllegalTransactionStateError;
|
|
|
35
30
|
* The message lists both identifiers and points at the likely missing
|
|
36
31
|
* module registration so the fix is obvious from the stack trace.
|
|
37
32
|
*/
|
|
38
|
-
class TransactionAdapterNotFoundError extends TransactionError {
|
|
33
|
+
export class TransactionAdapterNotFoundError extends TransactionError {
|
|
39
34
|
code = 'TRANSACTION_ADAPTER_NOT_FOUND';
|
|
40
35
|
adapterName;
|
|
41
36
|
instanceName;
|
|
@@ -47,15 +42,13 @@ class TransactionAdapterNotFoundError extends TransactionError {
|
|
|
47
42
|
this.instanceName = instanceName;
|
|
48
43
|
}
|
|
49
44
|
}
|
|
50
|
-
exports.TransactionAdapterNotFoundError = TransactionAdapterNotFoundError;
|
|
51
45
|
/**
|
|
52
46
|
* Thrown when an outbox producer fails to persist an event inside a
|
|
53
47
|
* transaction. Wrapping the underlying error lets callers distinguish
|
|
54
48
|
* outbox-write failures from business-logic errors when deciding on
|
|
55
49
|
* retry policy.
|
|
56
50
|
*/
|
|
57
|
-
class OutboxWriteError extends TransactionError {
|
|
51
|
+
export class OutboxWriteError extends TransactionError {
|
|
58
52
|
code = 'OUTBOX_WRITE_ERROR';
|
|
59
53
|
}
|
|
60
|
-
exports.OutboxWriteError = OutboxWriteError;
|
|
61
54
|
//# sourceMappingURL=errors.js.map
|
package/dist/types/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,KAAK;IAOlD,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;IAC9B,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,4BAA6B,SAAQ,gBAAgB;IACvD,IAAI,GAAG,2BAA2B,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,+BAAgC,SAAQ,gBAAgB;IAC1D,IAAI,GAAG,+BAA+B,CAAC;IAEvC,WAAW,CAAS;IACpB,YAAY,CAAS;IAE9B,YAAY,WAAmB,EAAE,YAAoB;QACnD,KAAK,CACH,kCAAkC,WAAW,IAAI,YAAY,IAAI;YAC/D,iEAAiE;YACjE,iDAAiD,CACpD,CAAC;QACF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,gBAAiB,SAAQ,gBAAgB;IAC3C,IAAI,GAAG,oBAAoB,CAAC;CACtC"}
|
package/dist/types/isolation.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PropagationMode = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Transaction propagation mode — how `@Transactional` behaves when invoked
|
|
6
3
|
* in the presence (or absence) of an already-active transaction.
|
|
@@ -10,7 +7,7 @@ exports.PropagationMode = void 0;
|
|
|
10
7
|
*
|
|
11
8
|
* @see https://docs.spring.io/spring-framework/reference/data-access/transaction/declarative/tx-propagation.html
|
|
12
9
|
*/
|
|
13
|
-
var PropagationMode;
|
|
10
|
+
export var PropagationMode;
|
|
14
11
|
(function (PropagationMode) {
|
|
15
12
|
/**
|
|
16
13
|
* Join the current transaction if one exists; otherwise start a new one.
|
|
@@ -63,5 +60,5 @@ var PropagationMode;
|
|
|
63
60
|
* caller must already be inside an active transaction.
|
|
64
61
|
*/
|
|
65
62
|
PropagationMode["MANDATORY"] = "MANDATORY";
|
|
66
|
-
})(PropagationMode || (
|
|
63
|
+
})(PropagationMode || (PropagationMode = {}));
|
|
67
64
|
//# sourceMappingURL=propagation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../src/types/propagation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../src/types/propagation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,eA0DX;AA1DD,WAAY,eAAe;IACzB;;;;OAIG;IACH,wCAAqB,CAAA;IAErB;;;;;;;;OAQG;IACH,gDAA6B,CAAA;IAE7B;;;;;;;;;OASG;IACH,oCAAiB,CAAA;IAEjB;;;;;OAKG;IACH,wCAAqB,CAAA;IAErB;;;OAGG;IACH,kDAA+B,CAAA;IAE/B;;;;OAIG;IACH,kCAAe,CAAA;IAEf;;;;OAIG;IACH,0CAAuB,CAAA;AACzB,CAAC,EA1DW,eAAe,KAAf,eAAe,QA0D1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TransactionHandle } from './transaction-handle';
|
|
2
|
-
import type { TransactionOptions } from './transaction-options';
|
|
1
|
+
import type { TransactionHandle } from './transaction-handle.js';
|
|
2
|
+
import type { TransactionOptions } from './transaction-options.js';
|
|
3
3
|
/**
|
|
4
4
|
* Port for ORM-specific transaction execution. Core defines this interface;
|
|
5
5
|
* each ORM integration package (for example
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Type } from '@nestjs/common';
|
|
2
|
-
import type { IsolationLevel } from './isolation';
|
|
3
|
-
import type { PropagationMode } from './propagation';
|
|
2
|
+
import type { IsolationLevel } from './isolation.js';
|
|
3
|
+
import type { PropagationMode } from './propagation.js';
|
|
4
4
|
/**
|
|
5
5
|
* Options passed by the core runtime down into an adapter's
|
|
6
6
|
* `runInTransaction`. They describe the per-transaction runtime parameters
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs-transactional/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Declarative transaction management for NestJS — core primitives (AsyncLocalStorage context, TransactionManager, @Transactional decorator, adapter port)",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"type": "
|
|
6
|
+
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"author": "Igor Golovanov",
|
|
9
9
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"declarative"
|
|
25
25
|
],
|
|
26
26
|
"engines": {
|
|
27
|
-
"node": ">=22.
|
|
27
|
+
"node": ">=22.13.0"
|
|
28
28
|
},
|
|
29
29
|
"main": "dist/index.js",
|
|
30
30
|
"types": "dist/index.d.ts",
|
|
@@ -56,17 +56,20 @@
|
|
|
56
56
|
"provenance": true
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
60
|
-
"@nestjs/core": "^10.0.0 || ^11.0.0",
|
|
59
|
+
"@nestjs/common": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
60
|
+
"@nestjs/core": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
61
61
|
"reflect-metadata": "^0.1.13 || ^0.2.0",
|
|
62
62
|
"rxjs": "^7.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@
|
|
66
|
-
"@nestjs/
|
|
67
|
-
"@nestjs/
|
|
68
|
-
"@nestjs/
|
|
69
|
-
"@
|
|
65
|
+
"@jest/globals": "^30.4.2",
|
|
66
|
+
"@nestjs/common": "^11.2.3",
|
|
67
|
+
"@nestjs/core": "^11.2.3",
|
|
68
|
+
"@nestjs/platform-express": "^11.2.3",
|
|
69
|
+
"@nestjs/testing": "^11.2.3",
|
|
70
|
+
"@types/jest": "^30.0.0",
|
|
71
|
+
"@types/node": "^22.20.1",
|
|
72
|
+
"@types/supertest": "^7.2.1",
|
|
70
73
|
"reflect-metadata": "^0.2.2",
|
|
71
74
|
"rxjs": "^7.8.1",
|
|
72
75
|
"supertest": "^7.0.0"
|
|
@@ -74,13 +77,13 @@
|
|
|
74
77
|
"scripts": {
|
|
75
78
|
"build": "tsc -p tsconfig.build.json",
|
|
76
79
|
"clean": "rimraf dist *.tsbuildinfo coverage",
|
|
77
|
-
"test": "jest",
|
|
78
|
-
"test:watch": "jest --watch",
|
|
79
|
-
"test:cov": "jest --coverage",
|
|
80
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
81
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch",
|
|
82
|
+
"test:cov": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
|
80
83
|
"type-check": "tsc --noEmit",
|
|
81
|
-
"lint": "eslint
|
|
84
|
+
"lint": "eslint .",
|
|
82
85
|
"api:check": "api-extractor run && api-extractor run -c api-extractor.testing.json",
|
|
83
86
|
"api:update": "api-extractor run --local && api-extractor run --local -c api-extractor.testing.json",
|
|
84
|
-
"publish:check": "publint && attw --pack ."
|
|
87
|
+
"publish:check": "publint && attw --pack . --profile esm-only"
|
|
85
88
|
}
|
|
86
89
|
}
|