@sqb/connect 4.5.2 → 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.
package/cjs/client/sqb-client.js
CHANGED
|
@@ -52,10 +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: async (instance) =>
|
|
56
|
-
await this.emitAsyncSerial('connection-return').catch();
|
|
57
|
-
return instance.reset();
|
|
58
|
-
},
|
|
55
|
+
reset: async (instance) => instance.reset(),
|
|
59
56
|
validate: instance => instance.test()
|
|
60
57
|
};
|
|
61
58
|
this._pool = (0, lightning_pool_1.createPool)(poolFactory, poolOptions);
|
|
@@ -107,6 +104,7 @@ class SqbClient extends (0, strict_typed_events_1.TypedEventEmitterClass)(strict
|
|
|
107
104
|
await this.emitAsyncSerial('acquire', connection);
|
|
108
105
|
connection.on('execute', (request) => this.emit('execute', request));
|
|
109
106
|
connection.on('error', (error) => this.emit('error', error));
|
|
107
|
+
connection.on('close', () => this.emitAsyncSerial('connection-return', connection));
|
|
110
108
|
return connection;
|
|
111
109
|
}
|
|
112
110
|
/**
|
|
@@ -12,7 +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
|
+
'connection-return': (connection: SqbConnection) => Promise<void>;
|
|
16
16
|
}
|
|
17
17
|
declare const SqbClient_base: Type<import("strict-typed-events").TypedEventEmitter<any, SqbClientEvents, SqbClientEvents>>;
|
|
18
18
|
export declare class SqbClient extends SqbClient_base {
|
package/esm/client/sqb-client.js
CHANGED
|
@@ -48,10 +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: async (instance) =>
|
|
52
|
-
await this.emitAsyncSerial('connection-return').catch();
|
|
53
|
-
return instance.reset();
|
|
54
|
-
},
|
|
51
|
+
reset: async (instance) => instance.reset(),
|
|
55
52
|
validate: instance => instance.test()
|
|
56
53
|
};
|
|
57
54
|
this._pool = createPool(poolFactory, poolOptions);
|
|
@@ -103,6 +100,7 @@ export class SqbClient extends TypedEventEmitterClass(AsyncEventEmitter) {
|
|
|
103
100
|
await this.emitAsyncSerial('acquire', connection);
|
|
104
101
|
connection.on('execute', (request) => this.emit('execute', request));
|
|
105
102
|
connection.on('error', (error) => this.emit('error', error));
|
|
103
|
+
connection.on('close', () => this.emitAsyncSerial('connection-return', connection));
|
|
106
104
|
return connection;
|
|
107
105
|
}
|
|
108
106
|
/**
|
package/package.json
CHANGED