@nestjs-transactional/core 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.
Files changed (60) hide show
  1. package/README.md +131 -178
  2. package/dist/bootstrap/transactional-methods.bootstrap.d.ts +2 -2
  3. package/dist/bootstrap/transactional-methods.bootstrap.js +19 -22
  4. package/dist/bootstrap/transactional-methods.bootstrap.js.map +1 -1
  5. package/dist/context/transaction-context-view.d.ts +1 -1
  6. package/dist/context/transaction-context-view.js +3 -7
  7. package/dist/context/transaction-context-view.js.map +1 -1
  8. package/dist/context/transaction.context.d.ts +3 -3
  9. package/dist/context/transaction.context.js +6 -10
  10. package/dist/context/transaction.context.js.map +1 -1
  11. package/dist/decorators/inject-decorators.js +6 -12
  12. package/dist/decorators/inject-decorators.js.map +1 -1
  13. package/dist/decorators/transactional.decorator.d.ts +6 -1
  14. package/dist/decorators/transactional.decorator.js +15 -17
  15. package/dist/decorators/transactional.decorator.js.map +1 -1
  16. package/dist/index.d.ts +18 -18
  17. package/dist/index.js +18 -34
  18. package/dist/index.js.map +1 -1
  19. package/dist/interceptor/transactional.interceptor.d.ts +1 -1
  20. package/dist/interceptor/transactional.interceptor.js +12 -15
  21. package/dist/interceptor/transactional.interceptor.js.map +1 -1
  22. package/dist/internal/markers.js +1 -4
  23. package/dist/internal/markers.js.map +1 -1
  24. package/dist/manager/adapter.registry.d.ts +1 -1
  25. package/dist/manager/adapter.registry.js +12 -15
  26. package/dist/manager/adapter.registry.js.map +1 -1
  27. package/dist/manager/transaction.manager.d.ts +3 -3
  28. package/dist/manager/transaction.manager.js +38 -41
  29. package/dist/manager/transaction.manager.js.map +1 -1
  30. package/dist/module/transactional.module.d.ts +5 -5
  31. package/dist/module/transactional.module.js +48 -54
  32. package/dist/module/transactional.module.js.map +1 -1
  33. package/dist/observability/transaction-observer.d.ts +1 -1
  34. package/dist/observability/transaction-observer.js +1 -4
  35. package/dist/observability/transaction-observer.js.map +1 -1
  36. package/dist/testing/in-memory.adapter.d.ts +3 -3
  37. package/dist/testing/in-memory.adapter.js +4 -8
  38. package/dist/testing/in-memory.adapter.js.map +1 -1
  39. package/dist/testing/index.d.ts +1 -1
  40. package/dist/testing/index.js +1 -17
  41. package/dist/testing/index.js.map +1 -1
  42. package/dist/tokens/constants.js +1 -4
  43. package/dist/tokens/constants.js.map +1 -1
  44. package/dist/tokens/index.d.ts +2 -2
  45. package/dist/tokens/index.js +2 -10
  46. package/dist/tokens/index.js.map +1 -1
  47. package/dist/tokens/token-utils.js +5 -11
  48. package/dist/tokens/token-utils.js.map +1 -1
  49. package/dist/types/domain-event.js +1 -2
  50. package/dist/types/errors.js +4 -11
  51. package/dist/types/errors.js.map +1 -1
  52. package/dist/types/isolation.js +1 -2
  53. package/dist/types/propagation.js +2 -5
  54. package/dist/types/propagation.js.map +1 -1
  55. package/dist/types/transaction-adapter.d.ts +2 -2
  56. package/dist/types/transaction-adapter.js +1 -2
  57. package/dist/types/transaction-handle.js +1 -2
  58. package/dist/types/transaction-options.d.ts +32 -9
  59. package/dist/types/transaction-options.js +1 -2
  60. package/package.json +29 -15
@@ -1,18 +1,2 @@
1
- "use strict";
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":";;;;;;;;;;;;;;;;AAAA,sDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -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
- exports.DEFAULT_DATA_SOURCE_NAME = 'default';
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":";;;AAAA;;;;;;;;;;;GAWG;AACU,QAAA,wBAAwB,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/tokens/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAC"}
@@ -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
@@ -1,11 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":";;;AAAA,yCAAuD;AAA9C,qHAAA,wBAAwB,OAAA;AACjC,6CAKuB;AAJrB,iIAAA,kCAAkC,OAAA;AAClC,yHAAA,0BAA0B,OAAA;AAC1B,yHAAA,0BAA0B,OAAA;AAC1B,2HAAA,4BAA4B,OAAA"}
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
- "use strict";
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 = constants_1.DEFAULT_DATA_SOURCE_NAME) {
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 = constants_1.DEFAULT_DATA_SOURCE_NAME) {
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 = constants_1.DEFAULT_DATA_SOURCE_NAME) {
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":";;AAiCA,gEAIC;AAQD,gEAIC;AAOD,oEAIC;AAQD,gFAEC;AAtED,2CAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;GAQG;AACH,SAAgB,0BAA0B,CACxC,aAAqB,oCAAwB;IAE7C,OAAO,GAAG,UAAU,oBAAoB,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,0BAA0B,CACxC,aAAqB,oCAAwB;IAE7C,OAAO,GAAG,UAAU,oBAAoB,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,SAAgB,4BAA4B,CAC1C,aAAqB,oCAAwB;IAE7C,OAAO,GAAG,UAAU,sBAAsB,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kCAAkC;IAChD,OAAO,4BAA4B,CAAC;AACtC,CAAC"}
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"}
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=domain-event.js.map
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,MAAsB,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;AAXD,4CAWC;AAED;;;;;GAKG;AACH,MAAa,4BAA6B,SAAQ,gBAAgB;IACvD,IAAI,GAAG,2BAA2B,CAAC;CAC7C;AAFD,oEAEC;AAED;;;;;;;GAOG;AACH,MAAa,+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;AAfD,0EAeC;AAED;;;;;GAKG;AACH,MAAa,gBAAiB,SAAQ,gBAAgB;IAC3C,IAAI,GAAG,oBAAoB,CAAC;CACtC;AAFD,4CAEC"}
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"}
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=isolation.js.map
@@ -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 || (exports.PropagationMode = 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":";;;AAAA;;;;;;;;GAQG;AACH,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,+BAAf,eAAe,QA0D1B"}
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,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=transaction-adapter.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=transaction-handle.js.map
@@ -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
@@ -16,16 +16,39 @@ export interface TransactionOptions {
16
16
  */
17
17
  readonly isolation?: IsolationLevel;
18
18
  /**
19
- * Hint that the transaction will only issue reads. Adapters may use this
20
- * to route to a read replica or to issue `SET TRANSACTION READ ONLY`.
21
- * It is a hint, not an enforcement writes may still be attempted and
22
- * may be rejected by the database.
19
+ * Hint that the transaction will only issue reads. A hint by design,
20
+ * matching Spring's semantics: adapters honour it where the underlying
21
+ * database allows, and ignore it where it cannot be expressed
22
+ * (DD-027).
23
+ *
24
+ * `TypeOrmTransactionAdapter` issues `SET TRANSACTION READ ONLY` on
25
+ * Postgres-family dialects (`postgres`, `cockroachdb`,
26
+ * `aurora-postgres`), so a write inside the transaction is refused by
27
+ * the database. On every other dialect it is a silent no-op — notably
28
+ * MySQL, where the access mode can only be set as
29
+ * `START TRANSACTION READ ONLY` and TypeORM does not expose that
30
+ * moment.
31
+ *
32
+ * Only applies when the adapter actually starts the transaction: a
33
+ * `REQUIRED` call joining an existing read-write transaction cannot
34
+ * make it read-only after the fact.
23
35
  */
24
36
  readonly readOnly?: boolean;
25
37
  /**
26
- * Transaction timeout in milliseconds. If the adapter supports
27
- * transaction-level timeouts (e.g. `statement_timeout` on Postgres),
28
- * exceeding this triggers a rollback. Omit for no timeout.
38
+ * Budget for the whole transaction, in milliseconds. Omit for no
39
+ * timeout.
40
+ *
41
+ * NOT IMPLEMENTED by `TypeOrmTransactionAdapter`, and deliberately not
42
+ * approximated (DD-027). TypeORM exposes no transaction-level timeout,
43
+ * and the nearest dialect feature — Postgres' `statement_timeout` —
44
+ * bounds each statement rather than the transaction, so
45
+ * `timeout: 5000` on a method issuing four queries would allow twenty
46
+ * seconds, not five. A wrong meaning under a familiar name is worse
47
+ * than a documented gap.
48
+ *
49
+ * The option stays in the surface as the extension point for adapters
50
+ * whose driver has a real transaction budget: Prisma's `$transaction`
51
+ * accepts exactly this.
29
52
  */
30
53
  readonly timeout?: number;
31
54
  }
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=transaction-options.js.map
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@nestjs-transactional/core",
3
- "version": "1.0.0-alpha.5",
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": "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/core"
11
13
  },
12
14
  "bugs": {
@@ -22,7 +24,7 @@
22
24
  "declarative"
23
25
  ],
24
26
  "engines": {
25
- "node": ">=22.11.0"
27
+ "node": ">=22.13.0"
26
28
  },
27
29
  "main": "dist/index.js",
28
30
  "types": "dist/index.d.ts",
@@ -42,23 +44,32 @@
42
44
  "default": "./dist/testing/index.js"
43
45
  }
44
46
  },
47
+ "typesVersions": {
48
+ "*": {
49
+ "testing": [
50
+ "./dist/testing/index.d.ts"
51
+ ]
52
+ }
53
+ },
45
54
  "publishConfig": {
46
55
  "access": "public",
47
- "tag": "alpha",
48
56
  "provenance": true
49
57
  },
50
58
  "peerDependencies": {
51
- "@nestjs/common": "^10.0.0 || ^11.0.0",
52
- "@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",
53
61
  "reflect-metadata": "^0.1.13 || ^0.2.0",
54
62
  "rxjs": "^7.0.0"
55
63
  },
56
64
  "devDependencies": {
57
- "@nestjs/common": "^11.0.0",
58
- "@nestjs/core": "^11.0.0",
59
- "@nestjs/platform-express": "^11.0.0",
60
- "@nestjs/testing": "^11.0.0",
61
- "@types/supertest": "^6.0.2",
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",
62
73
  "reflect-metadata": "^0.2.2",
63
74
  "rxjs": "^7.8.1",
64
75
  "supertest": "^7.0.0"
@@ -66,10 +77,13 @@
66
77
  "scripts": {
67
78
  "build": "tsc -p tsconfig.build.json",
68
79
  "clean": "rimraf dist *.tsbuildinfo coverage",
69
- "test": "jest",
70
- "test:watch": "jest --watch",
71
- "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",
72
83
  "type-check": "tsc --noEmit",
73
- "lint": "eslint \"src/**/*.ts\""
84
+ "lint": "eslint .",
85
+ "api:check": "api-extractor run && api-extractor run -c api-extractor.testing.json",
86
+ "api:update": "api-extractor run --local && api-extractor run --local -c api-extractor.testing.json",
87
+ "publish:check": "publint && attw --pack . --profile esm-only"
74
88
  }
75
89
  }