@sqb/connect 4.5.1 → 4.5.3

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,7 @@ 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) => instance.reset(),
56
56
  validate: instance => instance.test()
57
57
  };
58
58
  this._pool = (0, lightning_pool_1.createPool)(poolFactory, poolOptions);
@@ -104,6 +104,7 @@ class SqbClient extends (0, strict_typed_events_1.TypedEventEmitterClass)(strict
104
104
  await this.emitAsyncSerial('acquire', connection);
105
105
  connection.on('execute', (request) => this.emit('execute', request));
106
106
  connection.on('error', (error) => this.emit('error', error));
107
+ connection.on('close', () => this.emitAsyncSerial('connection-return', connection));
107
108
  return connection;
108
109
  }
109
110
  /**
@@ -12,6 +12,7 @@ interface SqbClientEvents {
12
12
  close: () => void;
13
13
  acquire: (connection: SqbConnection) => Promise<void>;
14
14
  terminate: () => void;
15
+ 'connection-return': (connection: SqbConnection) => 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,7 @@ 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) => instance.reset(),
52
52
  validate: instance => instance.test()
53
53
  };
54
54
  this._pool = createPool(poolFactory, poolOptions);
@@ -100,6 +100,7 @@ export class SqbClient extends TypedEventEmitterClass(AsyncEventEmitter) {
100
100
  await this.emitAsyncSerial('acquire', connection);
101
101
  connection.on('execute', (request) => this.emit('execute', request));
102
102
  connection.on('error', (error) => this.emit('error', error));
103
+ connection.on('close', () => this.emitAsyncSerial('connection-return', connection));
103
104
  return connection;
104
105
  }
105
106
  /**
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.3",
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
+ }