@nestjs-cls/transactional-adapter-mongodb 1.2.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.
@@ -0,0 +1,2 @@
1
+ export * from './lib/transactional-adapter-mongodb.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./lib/transactional-adapter-mongodb"), exports);
17
+ __exportStar(require("./lib/transactional-adapter-mongodb.js"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -21,3 +21,4 @@ class TransactionalAdapterMongoDB {
21
21
  }
22
22
  }
23
23
  exports.TransactionalAdapterMongoDB = TransactionalAdapterMongoDB;
24
+ //# sourceMappingURL=transactional-adapter-mongodb.js.map
@@ -0,0 +1,2 @@
1
+ export * from './lib/transactional-adapter-mongodb.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,20 @@
1
+ export class TransactionalAdapterMongoDB {
2
+ constructor(options) {
3
+ /** cannot proxy an `undefined` value */
4
+ this.supportsTransactionProxy = false;
5
+ this.connectionToken = options.mongoClientToken;
6
+ this.defaultTxOptions = options.defaultTxOptions;
7
+ }
8
+ optionsFactory(mongoClient) {
9
+ return {
10
+ wrapWithTransaction: async (options, fn, setTx) => {
11
+ return mongoClient.withSession(options.sessionOptions ?? {}, async (session) => session.withTransaction(() => {
12
+ setTx(session);
13
+ return fn();
14
+ }, options));
15
+ },
16
+ getFallbackInstance: () => undefined,
17
+ };
18
+ }
19
+ }
20
+ //# sourceMappingURL=transactional-adapter-mongodb.js.map
@@ -0,0 +1 @@
1
+ {"type":"module"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@nestjs-cls/transactional-adapter-mongodb",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "A mongodb adapter for @nestjs-cls/transactional",
5
5
  "author": "papooch",
6
6
  "license": "MIT",
7
7
  "engines": {
8
- "node": ">=18"
8
+ "node": ">=22"
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public"
@@ -31,41 +31,53 @@
31
31
  "aop",
32
32
  "mongodb"
33
33
  ],
34
- "main": "dist/src/index.js",
35
- "types": "dist/src/index.d.ts",
34
+ "main": "dist/cjs/index.js",
35
+ "module": "dist/esm/index.js",
36
+ "types": "dist/cjs/index.d.ts",
37
+ "exports": {
38
+ ".": {
39
+ "types": "./dist/cjs/index.d.ts",
40
+ "import": "./dist/esm/index.js",
41
+ "require": "./dist/cjs/index.js"
42
+ },
43
+ "./package.json": "./package.json"
44
+ },
36
45
  "files": [
37
- "dist/src/**/!(*.spec).d.ts",
38
- "dist/src/**/!(*.spec).js"
46
+ "dist/cjs/**/*.js",
47
+ "dist/cjs/**/*.d.ts",
48
+ "dist/esm/**/*.js",
49
+ "dist/esm/package.json"
39
50
  ],
40
51
  "scripts": {
41
52
  "prepack": "cp ../../../LICENSE ./LICENSE",
42
- "prebuild": "rimraf dist",
43
- "build": "tsc -p tsconfig.build.json",
53
+ "build": "rimraf dist && tsc -p tsconfig.build.json",
54
+ "build:esm": "tsc -p tsconfig.build.esm.json && echo '{\"type\":\"module\"}' > dist/esm/package.json",
55
+ "build:release": "yarn build && yarn build:esm",
44
56
  "test": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --experimental-vm-modules\" jest",
45
57
  "test:watch": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --experimental-vm-modules\" jest --watch",
46
58
  "test:cov": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --experimental-vm-modules\" jest --coverage"
47
59
  },
48
60
  "peerDependencies": {
49
- "@nestjs-cls/transactional": "^3.3.0",
61
+ "@nestjs-cls/transactional": "^4.0.0",
50
62
  "mongodb": ">= 6",
51
- "nestjs-cls": "^6.3.0"
63
+ "nestjs-cls": "^7.0.0"
52
64
  },
53
65
  "devDependencies": {
54
- "@nestjs/cli": "^12.0.0",
55
- "@nestjs/common": "^12.0.0",
56
- "@nestjs/core": "^12.0.0",
57
- "@nestjs/testing": "^12.0.0",
66
+ "@nestjs/cli": "^12.0.3",
67
+ "@nestjs/common": "^12.0.3",
68
+ "@nestjs/core": "^12.0.3",
69
+ "@nestjs/testing": "^12.0.3",
58
70
  "@types/jest": "^30.0.0",
59
- "@types/node": "^22.19.7",
60
- "jest": "^30.2.0",
61
- "mongodb": "^7.0.0",
62
- "mongodb-memory-server": "^11.0.1",
71
+ "@types/node": "^22.20.4",
72
+ "jest": "~30.4.2",
73
+ "mongodb": "^7.6.0",
74
+ "mongodb-memory-server": "^11.2.0",
63
75
  "reflect-metadata": "^0.2.2",
64
- "rimraf": "^6.1.2",
76
+ "rimraf": "^6.1.3",
65
77
  "rxjs": "^7.8.2",
66
- "sqlite3": "^5.1.7",
67
- "ts-jest": "^29.4.6",
68
- "ts-loader": "^9.5.4",
78
+ "sqlite3": "^6.0.1",
79
+ "ts-jest": "^29.4.12",
80
+ "ts-loader": "^9.6.2",
69
81
  "ts-node": "^10.9.2",
70
82
  "tsconfig-paths": "^4.2.0",
71
83
  "typescript": "5.9.3"
@@ -1,2 +0,0 @@
1
- export * from './lib/transactional-adapter-mongodb';
2
- //# sourceMappingURL=index.d.ts.map