@nestjs-cls/transactional-adapter-pg-promise 1.5.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-pg-promise.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-pg-promise"), exports);
17
+ __exportStar(require("./lib/transactional-adapter-pg-promise.js"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -23,3 +23,4 @@ class TransactionalAdapterPgPromise {
23
23
  }
24
24
  }
25
25
  exports.TransactionalAdapterPgPromise = TransactionalAdapterPgPromise;
26
+ //# sourceMappingURL=transactional-adapter-pg-promise.js.map
@@ -0,0 +1,2 @@
1
+ export * from './lib/transactional-adapter-pg-promise.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,22 @@
1
+ export class TransactionalAdapterPgPromise {
2
+ constructor(options) {
3
+ this.optionsFactory = (pgPromiseDbInstance) => ({
4
+ wrapWithTransaction: async (options, fn, setClient) => {
5
+ return pgPromiseDbInstance.tx(options, (tx) => {
6
+ setClient(tx);
7
+ return fn();
8
+ });
9
+ },
10
+ wrapWithNestedTransaction: async (options, fn, setClient, client) => {
11
+ return client.tx(options, (tx) => {
12
+ setClient(tx);
13
+ return fn();
14
+ });
15
+ },
16
+ getFallbackInstance: () => pgPromiseDbInstance,
17
+ });
18
+ this.connectionToken = options.dbInstanceToken;
19
+ this.defaultTxOptions = options.defaultTxOptions;
20
+ }
21
+ }
22
+ //# sourceMappingURL=transactional-adapter-pg-promise.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-pg-promise",
3
- "version": "1.5.0",
3
+ "version": "2.0.0",
4
4
  "description": "A pg-promise adapter for @nestjs-cls/transactional",
5
5
  "author": "Sam Artuso <samuele.a@gmail.com>",
6
6
  "license": "MIT",
7
7
  "engines": {
8
- "node": ">=18"
8
+ "node": ">=22"
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public"
@@ -26,39 +26,51 @@
26
26
  "request context",
27
27
  "async context"
28
28
  ],
29
- "main": "dist/src/index.js",
30
- "types": "dist/src/index.d.ts",
29
+ "main": "dist/cjs/index.js",
30
+ "module": "dist/esm/index.js",
31
+ "types": "dist/cjs/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/cjs/index.d.ts",
35
+ "import": "./dist/esm/index.js",
36
+ "require": "./dist/cjs/index.js"
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
31
40
  "files": [
32
- "dist/src/**/!(*.spec).d.ts",
33
- "dist/src/**/!(*.spec).js"
41
+ "dist/cjs/**/*.js",
42
+ "dist/cjs/**/*.d.ts",
43
+ "dist/esm/**/*.js",
44
+ "dist/esm/package.json"
34
45
  ],
35
46
  "scripts": {
36
47
  "prepack": "cp ../../../LICENSE ./LICENSE",
37
- "prebuild": "rimraf dist",
38
- "build": "tsc -p tsconfig.build.json",
48
+ "build": "rimraf dist && tsc -p tsconfig.build.json",
49
+ "build:esm": "tsc -p tsconfig.build.esm.json && echo '{\"type\":\"module\"}' > dist/esm/package.json",
50
+ "build:release": "yarn build && yarn build:esm",
39
51
  "test": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --experimental-vm-modules\" jest",
40
52
  "test:watch": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --experimental-vm-modules\" jest --watch",
41
53
  "test:cov": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --experimental-vm-modules\" jest --coverage"
42
54
  },
43
55
  "peerDependencies": {
44
- "@nestjs-cls/transactional": "^3.3.0",
45
- "nestjs-cls": "^6.3.0",
56
+ "@nestjs-cls/transactional": "^4.0.0",
57
+ "nestjs-cls": "^7.0.0",
46
58
  "pg-promise": ">= 11"
47
59
  },
48
60
  "devDependencies": {
49
- "@nestjs/cli": "^12.0.0",
50
- "@nestjs/common": "^12.0.0",
51
- "@nestjs/core": "^12.0.0",
52
- "@nestjs/testing": "^12.0.0",
61
+ "@nestjs/cli": "^12.0.3",
62
+ "@nestjs/common": "^12.0.3",
63
+ "@nestjs/core": "^12.0.3",
64
+ "@nestjs/testing": "^12.0.3",
53
65
  "@types/jest": "^30.0.0",
54
- "@types/node": "^22.19.7",
55
- "jest": "^30.2.0",
56
- "pg-promise": "^12.3.0",
66
+ "@types/node": "^22.20.4",
67
+ "jest": "~30.4.2",
68
+ "pg-promise": "^12.7.1",
57
69
  "reflect-metadata": "^0.2.2",
58
- "rimraf": "^6.1.2",
70
+ "rimraf": "^6.1.3",
59
71
  "rxjs": "^7.8.2",
60
- "ts-jest": "^29.4.6",
61
- "ts-loader": "^9.5.4",
72
+ "ts-jest": "^29.4.12",
73
+ "ts-loader": "^9.6.2",
62
74
  "ts-node": "^10.9.2",
63
75
  "tsconfig-paths": "^4.2.0",
64
76
  "typescript": "5.9.3"
@@ -1,2 +0,0 @@
1
- export * from './lib/transactional-adapter-pg-promise';
2
- //# sourceMappingURL=index.d.ts.map