@nathapp/nestjs-data 3.0.2 → 3.0.4

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @nathapp/nestjs-data@3.0.2 build
2
+ > @nathapp/nestjs-data@3.0.4 build
3
3
  > rimraf dist && tsc -p tsconfig.json
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @nathapp/nestjs-data
2
2
 
3
+ ## 3.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - a48beb2: transaction manager symbol bug fix
8
+
9
+ ## 3.0.3
10
+
11
+ ### Patch Changes
12
+
13
+ - cb97b64: fix typeorm and transactionManager issue
14
+
3
15
  ## 3.0.2
4
16
 
5
17
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TRANSACTION_MANAGER = void 0;
4
- exports.TRANSACTION_MANAGER = Symbol('TRANSACTION_MANAGER');
4
+ exports.TRANSACTION_MANAGER = Symbol.for('TRANSACTION_MANAGER');
5
5
  //# sourceMappingURL=tokens.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../lib/constant/tokens.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../lib/constant/tokens.ts"],"names":[],"mappings":";;;AAgCa,QAAA,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC"}
@@ -1 +1,33 @@
1
- export const TRANSACTION_MANAGER = Symbol('TRANSACTION_MANAGER');
1
+ /**
2
+ * Global DI token for ITransactionManager.
3
+ *
4
+ * Uses Symbol.for (not Symbol) so the token is identical across all
5
+ * JavaScript realms, bundles, and duplicate package installations.
6
+ * This prevents UnknownDependenciesException when the consuming app
7
+ * and @nathapp/nestjs-prisma / @nathapp/nestjs-typeorm resolve
8
+ * @nathapp/nestjs-data from different node_modules paths or bundles.
9
+ *
10
+ * --------------------------------------------------------------------------
11
+ * IMPORTANT — Single-DB vs Multi-DB usage
12
+ * --------------------------------------------------------------------------
13
+ *
14
+ * **Single-DB apps (recommended):**
15
+ * @Inject(TRANSACTION_MANAGER) private readonly tx: ITransactionManager
16
+ *
17
+ * This works because the default connection registers TRANSACTION_MANAGER
18
+ * as an alias to the default transaction manager automatically.
19
+ *
20
+ * **Multi-DB apps (MUST use named tokens):**
21
+ * // CORRECT — explicit per-connection token
22
+ * @Inject(getPrismaTransactionManagerToken('dbA')) private readonly txA: ITransactionManager
23
+ * @Inject(getTypeOrmTransactionManagerToken('analytics')) private readonly txAnalytics: ITransactionManager
24
+ *
25
+ * // WRONG — TRANSACTION_MANAGER is only an alias for the DEFAULT connection.
26
+ * // Named connections do NOT register this global token.
27
+ * @Inject(TRANSACTION_MANAGER) private readonly tx: ITransactionManager // ❌ only resolves default!
28
+ *
29
+ * If you inject TRANSACTION_MANAGER in a multi-DB app, you silently get the
30
+ * default connection's tx manager. Writes to other databases will NOT be
31
+ * covered by the transaction. Use named tokens for every non-default connection.
32
+ */
33
+ export const TRANSACTION_MANAGER = Symbol.for('TRANSACTION_MANAGER');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nestjs-data",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "ORM-agnostic data access abstractions for NestJS",
5
5
  "scripts": {
6
6
  "clean": "rimraf dist/ .turbo/",