mind-client-js 0.20.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.
package/js/index.js ADDED
@@ -0,0 +1,811 @@
1
+ /*###############################################################
2
+ # #
3
+ # Copyright (c) 2025-2026 DnaSoft BV and/or its subsidiaries. #
4
+ # All rights reserved. #
5
+ # #
6
+ # This source code contains the intellectual property #
7
+ # of its copyright holder(s), and is made available #
8
+ # under a license. If you do not know the terms of #
9
+ # the license, please stop and do not read further. #
10
+ # #
11
+ ###############################################################*/
12
+
13
+ const net = require('net')
14
+ const tls = require('tls')
15
+ const EventEmitter = require('node:events');
16
+
17
+ const nsProcess = require('./namespaces/process')
18
+ const nsServer = require('./namespaces/server')
19
+ const nsFs = require('./namespaces/fs')
20
+ const nsRESP3 = require('./namespaces/RESP3')
21
+ const nsDb = require('./namespaces/db')
22
+ const nsDbms = require('./namespaces/dbms')
23
+ const nsSession = require('./namespaces/session')
24
+ const nsStaticPool = require('./namespaces/_staticPool')
25
+ const staticPool = require('./static-pool')
26
+ const dynamicPool = require('./dynamic-pool')
27
+ const login = require('./login')
28
+
29
+ const utils = require('./utils')
30
+ const errors = require("./errors");
31
+
32
+ const requiredMind = '0.31.0' // required server version
33
+
34
+ module.exports = {
35
+ session: class mind extends EventEmitter {
36
+ // ********************************
37
+ // public methods and properties
38
+ // ********************************
39
+ connected = false // true if connected
40
+ loggedIn = false // true if logged in
41
+ useTls = false // true if tls is used
42
+ #socket = null // socket object
43
+ hTimer = null // connect timeout timer
44
+
45
+ requiresMind = requiredMind // required server version
46
+
47
+ // namespaces
48
+ server = new nsServer
49
+ process = new nsProcess
50
+ fs = new nsFs
51
+ RESP3 = new nsRESP3
52
+ db = new nsDb
53
+ dbms = new nsDbms
54
+ session = new nsSession
55
+ _staticPool = new nsStaticPool
56
+
57
+ connect = (host, port, username, password, options = {}) => {
58
+ const that = this
59
+
60
+ return new Promise(function (resolve, reject) {
61
+ // perform validation
62
+ if (typeof host !== 'string' || host === '') {
63
+ reject(new Error(errors.HOST_MUST_BE_STRING + 'host must be a string'));
64
+
65
+ return
66
+ }
67
+
68
+ if (typeof port !== 'number') {
69
+ reject(new Error(errors.PARAM_NOT_NUMBER + 'port must be a number'));
70
+
71
+ return
72
+ }
73
+
74
+ if (typeof username !== 'string' || username === '') {
75
+ reject(new Error(errors.PARAM_NOT_STRING + 'username must be a string'));
76
+
77
+ return
78
+ }
79
+
80
+ if (typeof password !== 'string' || password === '') {
81
+ reject(new Error(errors.PARAM_NOT_STRING + 'password must be a string'));
82
+
83
+ return
84
+ }
85
+
86
+ const err = utils.validateConnectOptions(options)
87
+ if (err !== '') {
88
+ reject(new Error(err))
89
+
90
+ return
91
+ }
92
+
93
+ let hTimer = that.hTimer
94
+ if ((options.connectTimeout && options.connectTimeout === 0) || options.connectTimeout === undefined) {
95
+ hTimer = that.hTimer = null
96
+
97
+ } else {
98
+ hTimer = that.hTimer = setTimeout(function () {
99
+ that.#socket.destroy()
100
+
101
+ reject(new Error(errors.TIMEOUT_OCCURRED + 'timeout while trying to connect...'))
102
+
103
+ }, options.connectTimeout || 5000)
104
+ }
105
+ // TLS or plain
106
+ if (options && options.useTls && options && options.useTls === true) {
107
+ that.userTls = true
108
+ try {
109
+ that.#socket = tls.connect(port, host, {rejectUnauthorized: (options && options.tlsRejectSelfSigned === false) ? false : true});
110
+ that.#socket.once('secureConnect', function () {
111
+ // on connected
112
+ socketInit(that, that.#socket, that.#writePacket, that.#readPacket, resolve, reject, username, password, options)
113
+ });
114
+ that.#socket.on('error', function (err) {
115
+ // on error
116
+ reject(err)
117
+ });
118
+ } catch (err) {
119
+ reject(err)
120
+
121
+ return
122
+ }
123
+
124
+ } else {
125
+ if ((!options.protocol) || (options && options.protocol === 'tcp')) {
126
+ // TCP
127
+ try {
128
+ that.#socket = net.createConnection(port, host, async () => {
129
+ socketInit(that, that.#socket, that.#writePacket, that.#readPacket, resolve, reject, username, password, options)
130
+ })
131
+ that.#socket.on('error', function (err) {
132
+ // on error
133
+ reject(err)
134
+ });
135
+
136
+ } catch (err) {
137
+ reject(err)
138
+
139
+ return
140
+ }
141
+
142
+ } else {
143
+ // UDS
144
+ try {
145
+ that.#socket = net.createConnection(host, async () => {
146
+ socketInit(that, that.#socket, that.#writePacket, that.#readPacket, resolve, reject, username, password, options)
147
+ })
148
+ that.#socket.on('error', function (err) {
149
+ // on error
150
+ reject(err)
151
+ });
152
+
153
+ } catch (err) {
154
+ reject(err)
155
+
156
+ return
157
+ }
158
+ }
159
+ }
160
+
161
+ const socketInit = async function (that, lSocket, lWriter, lReader, resolve, reject, username, password, options) {
162
+ that.connected = true
163
+
164
+ if (hTimer !== null) clearTimeout(hTimer)
165
+
166
+ // mount event handler and route it to the event emitter
167
+ lSocket
168
+ .on('end', () => {
169
+ if (hTimer !== null) clearTimeout(hTimer)
170
+
171
+ that.disconnect()
172
+
173
+ that.emit('disconnect')
174
+ })
175
+ // mount event handler and route it to the event emitter
176
+ .on('error', err => {
177
+ if (hTimer !== null) clearTimeout(hTimer)
178
+
179
+ that.emit('socketError', err)
180
+ })
181
+
182
+ // force utf-8 encoding
183
+ lSocket.setEncoding('utf8')
184
+
185
+ // sends out the app name, if present
186
+ const appString = '+appName:' + (options.uApi && options.uApi.appName ? options.uApi.appName : '') + '\n'
187
+ lWriter(appString)
188
+
189
+ // perform the login
190
+ try {
191
+ await login(that, lWriter, lReader, resolve, reject, username, password, options)
192
+
193
+ that.loggedIn = true
194
+
195
+ } catch (err) {
196
+ that.connected = false
197
+ that.loggedIn = false
198
+
199
+ that.disconnect()
200
+ }
201
+ }
202
+
203
+ Object.defineProperties(that, {
204
+ hTimer: {
205
+ enumerable: false,
206
+ configurable: true
207
+ },
208
+ })
209
+ })
210
+ }
211
+
212
+ disconnect = () => {
213
+ const guid = this.session.GUID
214
+
215
+ if (this.#socket) {
216
+ if (this.hTimer !== null) clearTimeout(this.hTimer)
217
+ this.#socket.destroy()
218
+ }
219
+ this.connected = false
220
+ this.loggedIn = false
221
+
222
+ this.server = new nsServer
223
+ this.process = new nsProcess
224
+ this.fs = new nsFs
225
+ this.RESP3 = new nsRESP3
226
+ this.db = new nsDb
227
+ this.dbms = new nsDbms
228
+ this.session = new nsSession
229
+ this._staticPool = new nsStaticPool
230
+
231
+ this.session.GUID = guid
232
+ }
233
+
234
+ #writePacket = (msg) => {
235
+ const that = this
236
+
237
+ let total_sent = 0;
238
+ while (total_sent < msg.length) {
239
+ const msg_sliced = msg.slice(total_sent, msg.length);
240
+ const sentOk = that.#socket.write(msg_sliced);
241
+
242
+ if (!sentOk) throw new Error(errors.SOCKET_DISCONNECTED + 'RuntimeError: socket connection broken');
243
+
244
+ total_sent = total_sent + msg_sliced.length;
245
+ }
246
+ }
247
+
248
+ #readPacket = (callback) => {
249
+ const commandTerminator = '\x03\r\n\x03\r\n'
250
+ let buff = ''
251
+ const that = this
252
+
253
+ this.#socket.on('data', function (data) {
254
+ buff += data.toString()
255
+
256
+ // wait for packet terminator
257
+ if (buff.slice(-6) === commandTerminator) {
258
+ that.#socket.removeAllListeners('data')
259
+ callback(buff.slice(0, -6))
260
+ }
261
+ })
262
+ }
263
+ },
264
+
265
+ // ********************************
266
+ // static pool
267
+ // ********************************
268
+ staticPool: class StaticPool extends EventEmitter {
269
+ size = 0 // size (in sessions)
270
+ extension = 0 // extension size (in sessions)
271
+ extensionInUse = 0 // how many extension sessions are currently in use
272
+ sessions = [] // sessions array
273
+ host = '' // credentials to connect extensions
274
+ port = 0 // credentials to connect extensions
275
+ username = '' // credentials to connect extensions
276
+ password = '' // credentials to connect extensions
277
+ options = {} // credentials to connect extensions
278
+ timerTick = false // internal timer
279
+ guid = '' // the guid for the pool
280
+ stats = {
281
+ sessionsCreatedOk: 0, // how many sessions were created
282
+ sessionsCreatedInError: 0, // how many session got error on creation
283
+ sessionsPeak: 0, // the maximum number of sessions used in the pool
284
+ sessionsDone: 0, // the number of sessions that were terminated with done()
285
+
286
+ extendsCreatedOk: 0, // how many extends got created
287
+ extendsCreatedInError: 0, // how many extends got error on creation
288
+ extendsRemoved: 0, // how many extends got removed
289
+ extendsPeak: 0, // the maximum number of extensions used in the pool
290
+ extendsDone: 0, // the number of extended sessions that were terminated with done()
291
+
292
+ noMoreSlotsHits: 0, // how many times no more slots were available and the getSession() had to wait
293
+ noMoreSlotsHitsResolved: 0, // how many sessions got successfully released when pool is fully busy
294
+ timeoutExpired: 0, // how many times a timeout expired while getting a session
295
+ remoteDisconnects: 0, // how many sessions got remotely disconnected
296
+ }
297
+
298
+ devOps = {
299
+ session: {},
300
+ sessionInUse: false,
301
+ _getDevOpsSession: function (timeout = 0) {
302
+ return staticPool.devOps._getDevOpsSession(this, timeout)
303
+ },
304
+
305
+ getServerStats: async function () {
306
+ return await staticPool.devOps.getServerStats(this)
307
+ },
308
+
309
+ setLogLevel: async function (logLevel) {
310
+ return await staticPool.devOps.setLogLevel(this, logLevel)
311
+ },
312
+
313
+ setDumpRequest: async function (value) {
314
+ return await staticPool.devOps.setDumpRequest(this, value)
315
+ },
316
+
317
+ setDumpResponse: async function (value) {
318
+ return await staticPool.devOps.setDumpResponse(this, value)
319
+ },
320
+
321
+ setStats: async function (value) {
322
+ return await staticPool.devOps.setStats(this, value)
323
+ },
324
+
325
+ setErrorDump: async function (value) {
326
+ return await staticPool.devOps.setErrorDump(this, value)
327
+ },
328
+
329
+ setIdleTimeout: async function (timeout) {
330
+ return await staticPool.devOps.setIdleTimeout(this, timeout)
331
+ },
332
+
333
+ resetSettings: async function () {
334
+ return await staticPool.devOps.resetSettings(this)
335
+ },
336
+
337
+ resetServerStats: async function () {
338
+ return await staticPool.devOps.resetServerStats(this)
339
+ }
340
+ }
341
+
342
+ constructor(size, extension = 0) {
343
+ super();
344
+ if (typeof size === 'undefined') {
345
+ throw new Error(errors.PARAM_MISSING + 'Missing pool size')
346
+ }
347
+
348
+ if (typeof size !== 'number') {
349
+ throw new Error(errors.PARAM_NOT_NUMBER + 'Pool size must be a number')
350
+ }
351
+
352
+ if (extension && typeof extension !== 'number') {
353
+ throw new Error(errors.PARAM_NOT_NUMBER + 'Pool extension must be a number')
354
+ }
355
+
356
+ if (size < 2) {
357
+ throw new Error('Pool size must be at least 2')
358
+ }
359
+
360
+ if (extension && extension < 1) {
361
+ throw new Error('Pool extension must be at least 1')
362
+ }
363
+
364
+ this.size = size
365
+ this.extension = extension
366
+
367
+ Object.defineProperties(this, {
368
+ size: {
369
+ enumerable: false,
370
+ configurable: true
371
+ },
372
+ extension: {
373
+ enumerable: false,
374
+ configurable: true
375
+ },
376
+ extensionInUse: {
377
+ enumerable: false,
378
+ configurable: true
379
+ },
380
+ sessions: {
381
+ enumerable: false,
382
+ configurable: true
383
+ },
384
+ waitQueue: {
385
+ enumerable: false,
386
+ configurable: true
387
+ },
388
+ host: {
389
+ enumerable: false,
390
+ configurable: true
391
+ },
392
+ port: {
393
+ enumerable: false,
394
+ configurable: true
395
+ },
396
+ username: {
397
+ enumerable: false,
398
+ configurable: true
399
+ },
400
+ password: {
401
+ enumerable: false,
402
+ configurable: true
403
+ },
404
+ options: {
405
+ enumerable: false,
406
+ configurable: true
407
+ },
408
+ timerTick: {
409
+ enumerable: false,
410
+ configurable: true
411
+ },
412
+ stats: {
413
+ enumerable: false,
414
+ configurable: true
415
+ },
416
+ hidePropsInObject: {
417
+ enumerable: false,
418
+ configurable: true
419
+ }
420
+ })
421
+
422
+ Object.defineProperties(this.devOps, {
423
+ _getDevOpsSession: {
424
+ enumerable: false,
425
+ configurable: true
426
+ },
427
+
428
+ sessionInUse: {
429
+ enumerable: false,
430
+ configurable: true
431
+ },
432
+
433
+ session: {
434
+ enumerable: false,
435
+ configurable: true
436
+ },
437
+
438
+ ERROR_DUMP_NONE: {
439
+ value: 0,
440
+ enumerable: true,
441
+ configurable: true,
442
+ writable: false
443
+ },
444
+
445
+ ERROR_DUMP_BRIEF: {
446
+ value: 1,
447
+ enumerable: true,
448
+ configurable: true,
449
+ writable: false
450
+ },
451
+
452
+ ERROR_DUMP_FULL: {
453
+ value: 2,
454
+ enumerable: true,
455
+ configurable: true,
456
+ writable: false
457
+ },
458
+
459
+ STATS_NONE: {
460
+ value: 0,
461
+ enumerable: true,
462
+ configurable: true,
463
+ writable: false
464
+ },
465
+
466
+ STATS_GRAND_TOTALS: {
467
+ value: 1,
468
+ enumerable: true,
469
+ configurable: true,
470
+ writable: false
471
+ },
472
+
473
+ STATS_DETAILS: {
474
+ value: 2,
475
+ enumerable: true,
476
+ configurable: true,
477
+ writable: false
478
+ },
479
+
480
+ DUMP_REQUEST_OFF: {
481
+ value: 0,
482
+ enumerable: true,
483
+ configurable: true,
484
+ writable: false
485
+ },
486
+
487
+ DUMP_REQUEST_ON: {
488
+ value: 1,
489
+ enumerable: true,
490
+ configurable: true,
491
+ writable: false
492
+ },
493
+
494
+ DUMP_RESPONSE_OFF: {
495
+ value: 0,
496
+ enumerable: true,
497
+ configurable: true,
498
+ writable: false
499
+ },
500
+
501
+ DUMP_RESPONSE_ON: {
502
+ value: 1,
503
+ enumerable: true,
504
+ configurable: true,
505
+ writable: false
506
+ },
507
+
508
+ LOG_LEVEL_NONE: {
509
+ value: 0,
510
+ enumerable: true,
511
+ configurable: true,
512
+ writable: false
513
+ },
514
+
515
+ LOG_LEVEL_SESSIONS: {
516
+ value: 1,
517
+ enumerable: true,
518
+ configurable: true,
519
+ writable: false
520
+ },
521
+
522
+ LOG_LEVEL_COMMANDS: {
523
+ value: 2,
524
+ enumerable: true,
525
+ configurable: true,
526
+ writable: false
527
+ },
528
+
529
+ LOG_LEVEL_TIMINGS: {
530
+ value: 3,
531
+ enumerable: true,
532
+ configurable: true,
533
+ writable: false
534
+ },
535
+
536
+ })
537
+ }
538
+
539
+ create = async function (host, port, username, password, options = {}) {
540
+ return new Promise(async (resolve, reject) => {
541
+ try {
542
+ await staticPool.create(this, module, host, port, username, password, options)
543
+
544
+ resolve()
545
+
546
+ } catch (err) {
547
+ reject(err)
548
+ }
549
+
550
+ })
551
+ }
552
+
553
+ destroy = function () {
554
+ staticPool.destroy(this)
555
+ }
556
+
557
+ rundown = async function () {
558
+ await staticPool.rundown(this)
559
+ }
560
+
561
+ getSession = async function (timeout = 0) {
562
+ return await staticPool.getSession(this, module, timeout)
563
+ }
564
+
565
+ getStatus = function (formatNumbers = false) {
566
+ return staticPool.getStatus(this, formatNumbers)
567
+ }
568
+
569
+ resetStatus = function () {
570
+ staticPool.resetStatus(this)
571
+ }
572
+
573
+ changeSize = async function (newSize) {
574
+ return await staticPool.changeSize(this, module, newSize)
575
+ }
576
+
577
+ changeExtension = function (newSize) {
578
+ return staticPool.changeExtension(this, newSize)
579
+ }
580
+
581
+ // ******************
582
+ // hide internal props in object to programmers
583
+ // ******************
584
+ hidePropsInObject = function (obj) {
585
+ Object.defineProperties(obj.session, {
586
+ _staticPool: {
587
+ enumerable: false,
588
+ configurable: true
589
+ },
590
+ that: {
591
+ enumerable: false,
592
+ configurable: true
593
+ },
594
+ ix: {
595
+ enumerable: false,
596
+ configurable: true
597
+ },
598
+ poolSlot: {
599
+ enumerable: false,
600
+ configurable: true
601
+ },
602
+ hTimer: {
603
+ enumerable: false,
604
+ configurable: true
605
+ },
606
+ })
607
+ }
608
+ },
609
+
610
+ // ********************************
611
+ // dynamic pool
612
+ // ********************************
613
+ dynamicPool: class DynamicPool {
614
+ constructor(params = {}, maxSize = 0) {
615
+ // validate login params
616
+ // host, port, username, password, options = {},
617
+
618
+ if (typeof params !== 'object' || Array.isArray(params) === true) {
619
+ throw new Error(errors.PARAM_NOT_OBJECT + 'params is not an object')
620
+ }
621
+
622
+ if (params === null) {
623
+ throw new Error(errors.PARAM_NOT_OBJECT + 'params is not an object')
624
+ }
625
+
626
+ if (Object.keys(params).length === 0) {
627
+ throw new Error(errors.PARAM_IS_EMPTY + 'params is empty')
628
+ }
629
+
630
+ if (params.host === undefined) {
631
+ throw new Error(errors.PARAM_MISSING + 'Missing params.host')
632
+ }
633
+
634
+ if (typeof params.host !== 'string') {
635
+ throw new Error(errors.PARAM_NOT_STRING + 'params.host must be a string')
636
+ }
637
+
638
+ if (params.host === '') {
639
+ throw new Error(errors.STRING_IS_EMPTY + 'params.host can not be an empty string')
640
+ }
641
+
642
+ if (params.port === undefined) {
643
+ throw new Error(errors.PARAM_MISSING + 'Missing params.port')
644
+ }
645
+
646
+ if (typeof params.port !== 'number') {
647
+ throw new Error(errors.PARAM_NOT_NUMBER + 'params.port must be a number')
648
+ }
649
+
650
+ if (params.host < 0) {
651
+ throw new Error(errors.PARAM_NOT_GREATER_THAN_ZERO + 'params.port must be a positive number')
652
+ }
653
+
654
+ if (params.username === undefined) {
655
+ throw new Error(errors.PARAM_MISSING + 'Missing params.username')
656
+ }
657
+
658
+ if (typeof params.username !== 'string') {
659
+ throw new Error(errors.PARAM_NOT_STRING + 'params.username must be a string')
660
+ }
661
+
662
+ if (params.username === '') {
663
+ throw new Error(errors.STRING_IS_EMPTY + 'params.username can not be an empty string')
664
+ }
665
+
666
+ if (params.password === undefined) {
667
+ throw new Error(errors.PARAM_MISSING + 'Missing params.password')
668
+ }
669
+
670
+ if (typeof params.password !== 'string') {
671
+ throw new Error(errors.PARAM_NOT_STRING + 'params.password must be a string')
672
+ }
673
+
674
+ if (params.password === '') {
675
+ throw new Error(errors.STRING_IS_EMPTY + 'params.password can not be an empty string')
676
+ }
677
+
678
+ if (params.options && typeof params.options !== 'object') {
679
+ throw new Error(errors.PARAM_NOT_OBJECT + 'params.options must be an object')
680
+ }
681
+
682
+ if (typeof maxSize !== 'number') {
683
+ throw new Error(errors.PARAM_NOT_NUMBER + 'Pool maximum size must be a number')
684
+ }
685
+
686
+ if (maxSize < 0) {
687
+ throw new Error(errors.PARAM_NOT_ZERO_OR_GREATER + 'Pool maximum size must be equal or greater than 0')
688
+ }
689
+
690
+ this.host = params.host
691
+ this.port = params.port
692
+ this.username = params.username
693
+ this.password = params.password
694
+ this.options = params.options
695
+ this.maxSize = maxSize
696
+
697
+ Object.defineProperties(this, {
698
+ maxSize: {
699
+ enumerable: false,
700
+ configurable: true
701
+ },
702
+ sessions: {
703
+ enumerable: false,
704
+ configurable: true
705
+ },
706
+ host: {
707
+ enumerable: false,
708
+ configurable: true
709
+ },
710
+ port: {
711
+ enumerable: false,
712
+ configurable: true
713
+ },
714
+ username: {
715
+ enumerable: false,
716
+ configurable: true
717
+ },
718
+ password: {
719
+ enumerable: false,
720
+ configurable: true
721
+ },
722
+ options: {
723
+ enumerable: false,
724
+ configurable: true
725
+ },
726
+ })
727
+ }
728
+
729
+ maxSize = 0
730
+ sessions = {}
731
+ host = ''
732
+ port = 0
733
+ username = ''
734
+ password = ''
735
+ options = {}
736
+
737
+ stats = {
738
+ inUseError: 0, // how many times no more slots were available and the getSession() had to wait
739
+ remoteDisconnects: 0, // how many sessions got remotely disconnected
740
+ }
741
+
742
+
743
+ config = {
744
+ shrink: function () {
745
+
746
+ },
747
+ expand: function () {
748
+
749
+ },
750
+ changeExtension: function () {
751
+
752
+ },
753
+ currentSettings: function () {
754
+
755
+ },
756
+ server: {
757
+ getCurrentSettings: function () {
758
+
759
+ },
760
+ changeLogLevel: function () {
761
+
762
+ },
763
+ changeLogDumpRequest: function () {
764
+
765
+ },
766
+ changeLogDumpResponse: function () {
767
+
768
+ },
769
+ changeStatsMode: function () {
770
+
771
+ },
772
+ changeErrorDump: function () {
773
+
774
+ }
775
+ }
776
+ }
777
+
778
+ createNewSession = async function (timeout = 0) {
779
+ return await dynamicPool.createNewSession(this, module, timeout)
780
+ }
781
+
782
+ getSessionByGUID = async function (GUID, timeout = 1000) {
783
+ return await dynamicPool.getSessionByGUID(this, module, GUID, timeout)
784
+ }
785
+
786
+ terminateSession = async function (GUID) {
787
+ await dynamicPool.terminateSession(this, GUID)
788
+ }
789
+
790
+ terminatePool = async function () {
791
+ await dynamicPool.terminatePool(this)
792
+ }
793
+
794
+ getStatus = async function () {
795
+ return await dynamicPool.getStatus(this)
796
+ }
797
+
798
+ verifyConnection = async function () {
799
+ return new Promise(async (resolve, reject) => {
800
+ try {
801
+ await dynamicPool.verifyConnection(this, module)
802
+
803
+ resolve()
804
+
805
+ } catch (err) {
806
+ reject(err)
807
+ }
808
+ })
809
+ }
810
+ }
811
+ }