@sqb/connect 4.5.1 → 4.5.2

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.
@@ -52,7 +52,10 @@ class SqbClient extends (0, strict_typed_events_1.TypedEventEmitterClass)(strict
52
52
  const poolFactory = {
53
53
  create: () => adapter.connect(cfg),
54
54
  destroy: instance => instance.close(),
55
- reset: instance => instance.reset(),
55
+ reset: async (instance) => {
56
+ await this.emitAsyncSerial('connection-return').catch();
57
+ return instance.reset();
58
+ },
56
59
  validate: instance => instance.test()
57
60
  };
58
61
  this._pool = (0, lightning_pool_1.createPool)(poolFactory, poolOptions);
@@ -12,6 +12,7 @@ interface SqbClientEvents {
12
12
  close: () => void;
13
13
  acquire: (connection: SqbConnection) => Promise<void>;
14
14
  terminate: () => void;
15
+ 'connection-return': () => Promise<void>;
15
16
  }
16
17
  declare const SqbClient_base: Type<import("strict-typed-events").TypedEventEmitter<any, SqbClientEvents, SqbClientEvents>>;
17
18
  export declare class SqbClient extends SqbClient_base {
@@ -48,7 +48,10 @@ export class SqbClient extends TypedEventEmitterClass(AsyncEventEmitter) {
48
48
  const poolFactory = {
49
49
  create: () => adapter.connect(cfg),
50
50
  destroy: instance => instance.close(),
51
- reset: instance => instance.reset(),
51
+ reset: async (instance) => {
52
+ await this.emitAsyncSerial('connection-return').catch();
53
+ return instance.reset();
54
+ },
52
55
  validate: instance => instance.test()
53
56
  };
54
57
  this._pool = createPool(poolFactory, poolOptions);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sqb/connect",
3
3
  "description": "Multi-dialect database connection framework written with TypeScript",
4
- "version": "4.5.1",
4
+ "version": "4.5.2",
5
5
  "author": "Panates",
6
6
  "contributors": [
7
7
  "Eray Hanoglu <e.hanoglu@panates.com>",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "debug": "^4.3.4",
33
- "lightning-pool": "^3.1.4",
33
+ "lightning-pool": "^4.0.0",
34
34
  "lodash": "^4.17.21",
35
35
  "putil-isplainobject": "^1.1.4",
36
36
  "putil-merge": "^3.8.0",
@@ -86,4 +86,4 @@
86
86
  "sqlite",
87
87
  "mysql"
88
88
  ]
89
- }
89
+ }