oceanbase 0.0.1

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.
Files changed (124) hide show
  1. package/License +19 -0
  2. package/README.md +250 -0
  3. package/index.d.ts +1 -0
  4. package/index.js +77 -0
  5. package/lib/auth_41.js +95 -0
  6. package/lib/auth_plugins/caching_sha2_password.js +108 -0
  7. package/lib/auth_plugins/caching_sha2_password.md +18 -0
  8. package/lib/auth_plugins/index.js +8 -0
  9. package/lib/auth_plugins/mysql_clear_password.js +17 -0
  10. package/lib/auth_plugins/mysql_native_password.js +34 -0
  11. package/lib/auth_plugins/sha256_password.js +68 -0
  12. package/lib/base/connection.js +978 -0
  13. package/lib/base/pool.js +237 -0
  14. package/lib/base/pool_connection.js +70 -0
  15. package/lib/commands/auth_switch.js +111 -0
  16. package/lib/commands/binlog_dump.js +109 -0
  17. package/lib/commands/change_user.js +68 -0
  18. package/lib/commands/client_handshake.js +241 -0
  19. package/lib/commands/close_statement.js +18 -0
  20. package/lib/commands/command.js +54 -0
  21. package/lib/commands/execute.js +112 -0
  22. package/lib/commands/index.js +27 -0
  23. package/lib/commands/ping.js +36 -0
  24. package/lib/commands/prepare.js +143 -0
  25. package/lib/commands/query.js +366 -0
  26. package/lib/commands/quit.js +29 -0
  27. package/lib/commands/register_slave.js +27 -0
  28. package/lib/commands/server_handshake.js +203 -0
  29. package/lib/compressed_protocol.js +127 -0
  30. package/lib/connection.js +12 -0
  31. package/lib/connection_config.js +326 -0
  32. package/lib/constants/charset_encodings.js +316 -0
  33. package/lib/constants/charsets.js +317 -0
  34. package/lib/constants/client.js +40 -0
  35. package/lib/constants/commands.js +36 -0
  36. package/lib/constants/cursor.js +8 -0
  37. package/lib/constants/encoding_charset.js +50 -0
  38. package/lib/constants/errors.js +3973 -0
  39. package/lib/constants/field_flags.js +20 -0
  40. package/lib/constants/server_status.js +44 -0
  41. package/lib/constants/session_track.js +11 -0
  42. package/lib/constants/ssl_profiles.js +11 -0
  43. package/lib/constants/types.js +64 -0
  44. package/lib/create_connection.js +10 -0
  45. package/lib/create_pool.js +10 -0
  46. package/lib/create_pool_cluster.js +9 -0
  47. package/lib/helpers.js +86 -0
  48. package/lib/packet_parser.js +195 -0
  49. package/lib/packets/auth_next_factor.js +35 -0
  50. package/lib/packets/auth_switch_request.js +38 -0
  51. package/lib/packets/auth_switch_request_more_data.js +33 -0
  52. package/lib/packets/auth_switch_response.js +30 -0
  53. package/lib/packets/binary_row.js +95 -0
  54. package/lib/packets/binlog_dump.js +33 -0
  55. package/lib/packets/binlog_query_statusvars.js +115 -0
  56. package/lib/packets/change_user.js +97 -0
  57. package/lib/packets/close_statement.js +21 -0
  58. package/lib/packets/column_definition.js +291 -0
  59. package/lib/packets/execute.js +214 -0
  60. package/lib/packets/handshake.js +112 -0
  61. package/lib/packets/handshake_response.js +144 -0
  62. package/lib/packets/index.js +152 -0
  63. package/lib/packets/packet.js +931 -0
  64. package/lib/packets/prepare_statement.js +27 -0
  65. package/lib/packets/prepared_statement_header.js +16 -0
  66. package/lib/packets/query.js +27 -0
  67. package/lib/packets/register_slave.js +46 -0
  68. package/lib/packets/resultset_header.js +124 -0
  69. package/lib/packets/ssl_request.js +25 -0
  70. package/lib/packets/text_row.js +47 -0
  71. package/lib/parsers/binary_parser.js +235 -0
  72. package/lib/parsers/parser_cache.js +68 -0
  73. package/lib/parsers/static_binary_parser.js +213 -0
  74. package/lib/parsers/static_text_parser.js +152 -0
  75. package/lib/parsers/string.js +50 -0
  76. package/lib/parsers/text_parser.js +214 -0
  77. package/lib/pool.js +12 -0
  78. package/lib/pool_cluster.js +369 -0
  79. package/lib/pool_config.js +30 -0
  80. package/lib/pool_connection.js +12 -0
  81. package/lib/promise/connection.js +222 -0
  82. package/lib/promise/inherit_events.js +27 -0
  83. package/lib/promise/make_done_cb.js +19 -0
  84. package/lib/promise/pool.js +112 -0
  85. package/lib/promise/pool_cluster.js +54 -0
  86. package/lib/promise/pool_connection.js +19 -0
  87. package/lib/promise/prepared_statement_info.js +32 -0
  88. package/lib/results_stream.js +38 -0
  89. package/lib/server.js +37 -0
  90. package/package.json +80 -0
  91. package/promise.d.ts +131 -0
  92. package/promise.js +202 -0
  93. package/typings/mysql/LICENSE.txt +15 -0
  94. package/typings/mysql/index.d.ts +95 -0
  95. package/typings/mysql/info.txt +1 -0
  96. package/typings/mysql/lib/Auth.d.ts +30 -0
  97. package/typings/mysql/lib/Connection.d.ts +453 -0
  98. package/typings/mysql/lib/Pool.d.ts +69 -0
  99. package/typings/mysql/lib/PoolCluster.d.ts +90 -0
  100. package/typings/mysql/lib/PoolConnection.d.ts +10 -0
  101. package/typings/mysql/lib/Server.d.ts +11 -0
  102. package/typings/mysql/lib/constants/CharsetToEncoding.d.ts +8 -0
  103. package/typings/mysql/lib/constants/Charsets.d.ts +326 -0
  104. package/typings/mysql/lib/constants/Types.d.ts +70 -0
  105. package/typings/mysql/lib/constants/index.d.ts +5 -0
  106. package/typings/mysql/lib/parsers/ParserCache.d.ts +4 -0
  107. package/typings/mysql/lib/parsers/index.d.ts +18 -0
  108. package/typings/mysql/lib/parsers/typeCast.d.ts +54 -0
  109. package/typings/mysql/lib/protocol/packets/Field.d.ts +10 -0
  110. package/typings/mysql/lib/protocol/packets/FieldPacket.d.ts +27 -0
  111. package/typings/mysql/lib/protocol/packets/OkPacket.d.ts +23 -0
  112. package/typings/mysql/lib/protocol/packets/ProcedurePacket.d.ts +13 -0
  113. package/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts +18 -0
  114. package/typings/mysql/lib/protocol/packets/RowDataPacket.d.ts +9 -0
  115. package/typings/mysql/lib/protocol/packets/index.d.ts +28 -0
  116. package/typings/mysql/lib/protocol/packets/params/ErrorPacketParams.d.ts +6 -0
  117. package/typings/mysql/lib/protocol/packets/params/OkPacketParams.d.ts +9 -0
  118. package/typings/mysql/lib/protocol/sequences/ExecutableBase.d.ts +40 -0
  119. package/typings/mysql/lib/protocol/sequences/Prepare.d.ts +65 -0
  120. package/typings/mysql/lib/protocol/sequences/Query.d.ts +170 -0
  121. package/typings/mysql/lib/protocol/sequences/QueryableBase.d.ts +40 -0
  122. package/typings/mysql/lib/protocol/sequences/Sequence.d.ts +5 -0
  123. package/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.d.ts +21 -0
  124. package/typings/mysql/lib/protocol/sequences/promise/QueryableBase.d.ts +21 -0
@@ -0,0 +1,112 @@
1
+ 'use strict';
2
+
3
+ const EventEmitter = require('events').EventEmitter;
4
+ const makeDoneCb = require('./make_done_cb.js');
5
+ const PromisePoolConnection = require('./pool_connection.js');
6
+ const inheritEvents = require('./inherit_events.js');
7
+ const BasePool = require('../base/pool.js');
8
+
9
+ class PromisePool extends EventEmitter {
10
+ constructor(pool, thePromise) {
11
+ super();
12
+ this.pool = pool;
13
+ this.Promise = thePromise || Promise;
14
+ inheritEvents(pool, this, ['acquire', 'connection', 'enqueue', 'release']);
15
+ }
16
+
17
+ getConnection() {
18
+ const corePool = this.pool;
19
+ return new this.Promise((resolve, reject) => {
20
+ corePool.getConnection((err, coreConnection) => {
21
+ if (err) {
22
+ reject(err);
23
+ } else {
24
+ resolve(new PromisePoolConnection(coreConnection, this.Promise));
25
+ }
26
+ });
27
+ });
28
+ }
29
+
30
+ releaseConnection(connection) {
31
+ if (connection instanceof PromisePoolConnection) connection.release();
32
+ }
33
+
34
+ query(sql, args) {
35
+ const corePool = this.pool;
36
+ const localErr = new Error();
37
+ if (typeof args === 'function') {
38
+ throw new Error(
39
+ 'Callback function is not available with promise clients.'
40
+ );
41
+ }
42
+ return new this.Promise((resolve, reject) => {
43
+ const done = makeDoneCb(resolve, reject, localErr);
44
+ if (args !== undefined) {
45
+ corePool.query(sql, args, done);
46
+ } else {
47
+ corePool.query(sql, done);
48
+ }
49
+ });
50
+ }
51
+
52
+ execute(sql, args) {
53
+ const corePool = this.pool;
54
+ const localErr = new Error();
55
+ if (typeof args === 'function') {
56
+ throw new Error(
57
+ 'Callback function is not available with promise clients.'
58
+ );
59
+ }
60
+ return new this.Promise((resolve, reject) => {
61
+ const done = makeDoneCb(resolve, reject, localErr);
62
+ if (args) {
63
+ corePool.execute(sql, args, done);
64
+ } else {
65
+ corePool.execute(sql, done);
66
+ }
67
+ });
68
+ }
69
+
70
+ end() {
71
+ const corePool = this.pool;
72
+ const localErr = new Error();
73
+ return new this.Promise((resolve, reject) => {
74
+ corePool.end((err) => {
75
+ if (err) {
76
+ localErr.message = err.message;
77
+ localErr.code = err.code;
78
+ localErr.errno = err.errno;
79
+ localErr.sqlState = err.sqlState;
80
+ localErr.sqlMessage = err.sqlMessage;
81
+ reject(localErr);
82
+ } else {
83
+ resolve();
84
+ }
85
+ });
86
+ });
87
+ }
88
+ }
89
+
90
+ (function (functionsToWrap) {
91
+ for (let i = 0; functionsToWrap && i < functionsToWrap.length; i++) {
92
+ const func = functionsToWrap[i];
93
+
94
+ if (
95
+ typeof BasePool.prototype[func] === 'function' &&
96
+ PromisePool.prototype[func] === undefined
97
+ ) {
98
+ PromisePool.prototype[func] = (function factory(funcName) {
99
+ return function () {
100
+ return BasePool.prototype[funcName].apply(this.pool, arguments);
101
+ };
102
+ })(func);
103
+ }
104
+ }
105
+ })([
106
+ // synchronous functions
107
+ 'escape',
108
+ 'escapeId',
109
+ 'format',
110
+ ]);
111
+
112
+ module.exports = PromisePool;
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ const PromisePoolConnection = require('./pool_connection');
4
+ const makeDoneCb = require('./make_done_cb');
5
+
6
+ class PromisePoolNamespace {
7
+ constructor(poolNamespace, thePromise) {
8
+ this.poolNamespace = poolNamespace;
9
+ this.Promise = thePromise || Promise;
10
+ }
11
+
12
+ getConnection() {
13
+ const corePoolNamespace = this.poolNamespace;
14
+ return new this.Promise((resolve, reject) => {
15
+ corePoolNamespace.getConnection((err, coreConnection) => {
16
+ if (err) {
17
+ reject(err);
18
+ } else {
19
+ resolve(new PromisePoolConnection(coreConnection, this.Promise));
20
+ }
21
+ });
22
+ });
23
+ }
24
+
25
+ query(sql, values) {
26
+ const corePoolNamespace = this.poolNamespace;
27
+ const localErr = new Error();
28
+ if (typeof values === 'function') {
29
+ throw new Error(
30
+ 'Callback function is not available with promise clients.'
31
+ );
32
+ }
33
+ return new this.Promise((resolve, reject) => {
34
+ const done = makeDoneCb(resolve, reject, localErr);
35
+ corePoolNamespace.query(sql, values, done);
36
+ });
37
+ }
38
+
39
+ execute(sql, values) {
40
+ const corePoolNamespace = this.poolNamespace;
41
+ const localErr = new Error();
42
+ if (typeof values === 'function') {
43
+ throw new Error(
44
+ 'Callback function is not available with promise clients.'
45
+ );
46
+ }
47
+ return new this.Promise((resolve, reject) => {
48
+ const done = makeDoneCb(resolve, reject, localErr);
49
+ corePoolNamespace.execute(sql, values, done);
50
+ });
51
+ }
52
+ }
53
+
54
+ module.exports = PromisePoolNamespace;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const PromiseConnection = require('./connection.js');
4
+ const BasePoolConnection = require('../base/pool_connection.js');
5
+
6
+ class PromisePoolConnection extends PromiseConnection {
7
+ constructor(connection, promiseImpl) {
8
+ super(connection, promiseImpl);
9
+ }
10
+
11
+ destroy() {
12
+ return BasePoolConnection.prototype.destroy.apply(
13
+ this.connection,
14
+ arguments
15
+ );
16
+ }
17
+ }
18
+
19
+ module.exports = PromisePoolConnection;
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ const makeDoneCb = require('./make_done_cb.js');
4
+
5
+ class PromisePreparedStatementInfo {
6
+ constructor(statement, promiseImpl) {
7
+ this.statement = statement;
8
+ this.Promise = promiseImpl;
9
+ }
10
+
11
+ execute(parameters) {
12
+ const s = this.statement;
13
+ const localErr = new Error();
14
+ return new this.Promise((resolve, reject) => {
15
+ const done = makeDoneCb(resolve, reject, localErr);
16
+ if (parameters) {
17
+ s.execute(parameters, done);
18
+ } else {
19
+ s.execute(done);
20
+ }
21
+ });
22
+ }
23
+
24
+ close() {
25
+ return new this.Promise((resolve) => {
26
+ this.statement.close();
27
+ resolve();
28
+ });
29
+ }
30
+ }
31
+
32
+ module.exports = PromisePreparedStatementInfo;
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ const Readable = require('stream').Readable;
4
+
5
+ // copy-paste from https://github.com/mysqljs/mysql/blob/master/lib/protocol/sequences/Query.js
6
+ module.exports = function (command, connectionStream) {
7
+ command.stream = function (options) {
8
+ let stream;
9
+
10
+ options = options || {};
11
+ options.objectMode = true;
12
+ (stream = new Readable(options)),
13
+ (stream._read = function () {
14
+ connectionStream.resume();
15
+ });
16
+
17
+ this.on('result', (row, i) => {
18
+ if (!stream.push(row)) {
19
+ connectionStream.pause();
20
+ }
21
+ stream.emit('result', row, i); // replicate old emitter
22
+ });
23
+
24
+ this.on('error', (err) => {
25
+ stream.emit('error', err); // Pass on any errors
26
+ });
27
+
28
+ this.on('end', () => {
29
+ stream.push(null); // pushing null, indicating EOF
30
+ });
31
+
32
+ this.on('fields', (fields, i) => {
33
+ stream.emit('fields', fields, i); // replicate old emitter
34
+ });
35
+
36
+ return stream;
37
+ };
38
+ };
package/lib/server.js ADDED
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ const net = require('net');
4
+ const EventEmitter = require('events').EventEmitter;
5
+
6
+ const Connection = require('./connection');
7
+ const ConnectionConfig = require('./connection_config');
8
+
9
+ // TODO: inherit Server from net.Server
10
+ class Server extends EventEmitter {
11
+ constructor() {
12
+ super();
13
+ this.connections = [];
14
+ this._server = net.createServer(this._handleConnection.bind(this));
15
+ }
16
+
17
+ _handleConnection(socket) {
18
+ const connectionConfig = new ConnectionConfig({
19
+ stream: socket,
20
+ isServer: true,
21
+ });
22
+ const connection = new Connection({ config: connectionConfig });
23
+ this.emit('connection', connection);
24
+ }
25
+
26
+ listen(port) {
27
+ this._port = port;
28
+ this._server.listen.apply(this._server, arguments);
29
+ return this;
30
+ }
31
+
32
+ close(cb) {
33
+ this._server.close(cb);
34
+ }
35
+ }
36
+
37
+ module.exports = Server;
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "oceanbase",
3
+ "version": "0.0.1",
4
+ "description": "fast oceanbase driver. Implements core protocol, prepared statements, ssl and compression in native JS",
5
+ "main": "index.js",
6
+ "typings": "typings/mysql/index",
7
+ "type": "commonjs",
8
+ "scripts": {
9
+ "lint": "eslint . && prettier --check .",
10
+ "lint:fix": "eslint . --fix && prettier --write .",
11
+ "test": "poku -d -r=verbose --sequential test/esm test/unit test/integration",
12
+ "test:bun": "bun poku -d --sequential test/esm test/unit test/integration",
13
+ "test:deno": "deno run --allow-read --allow-env --allow-run npm:poku -d --sequential --denoAllow=\"read,env,net,sys\" test/esm test/unit test/integration",
14
+ "test:tsc-build": "cd \"test/tsc-build\" && npx tsc -p \"tsconfig.json\"",
15
+ "coverage-test": "c8 npm run test",
16
+ "benchmark": "node ./benchmarks/benchmark.js",
17
+ "wait-port": "wait-on"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/sidorares/node-mysql2.git"
22
+ },
23
+ "homepage": "https://sidorares.github.io/node-mysql2/docs",
24
+ "keywords": [
25
+ "mysql",
26
+ "client",
27
+ "server"
28
+ ],
29
+ "files": [
30
+ "lib",
31
+ "typings/mysql",
32
+ "index.js",
33
+ "index.d.ts",
34
+ "promise.js",
35
+ "promise.d.ts"
36
+ ],
37
+ "exports": {
38
+ ".": "./index.js",
39
+ "./package.json": "./package.json",
40
+ "./promise": "./promise.js",
41
+ "./promise.js": "./promise.js"
42
+ },
43
+ "engines": {
44
+ "node": ">= 8.0"
45
+ },
46
+ "author": "Andrey Sidorov <andrey.sidorov@gmail.com>",
47
+ "license": "MIT",
48
+ "dependencies": {
49
+ "aws-ssl-profiles": "^1.1.1",
50
+ "denque": "^2.1.0",
51
+ "generate-function": "^2.3.1",
52
+ "iconv-lite": "^0.7.0",
53
+ "long": "^5.2.1",
54
+ "lru.min": "^1.0.0",
55
+ "named-placeholders": "^1.1.3",
56
+ "seq-queue": "^0.0.5",
57
+ "sqlstring": "^2.3.2"
58
+ },
59
+ "devDependencies": {
60
+ "@eslint/eslintrc": "^3.3.0",
61
+ "@eslint/js": "^9.21.0",
62
+ "@eslint/markdown": "^7.0.0",
63
+ "@types/node": "^25.0.2",
64
+ "@typescript-eslint/eslint-plugin": "^8.26.0",
65
+ "@typescript-eslint/parser": "^8.26.0",
66
+ "assert-diff": "^3.0.2",
67
+ "benchmark": "^2.1.4",
68
+ "c8": "^10.1.1",
69
+ "error-stack-parser": "^2.0.3",
70
+ "eslint-config-prettier": "^10.0.2",
71
+ "eslint-plugin-async-await": "^0.0.0",
72
+ "eslint-plugin-markdown": "^5.1.0",
73
+ "eslint-plugin-prettier": "^5.2.3",
74
+ "globals": "^16.0.0",
75
+ "poku": "^3.0.0",
76
+ "portfinder": "^1.0.28",
77
+ "prettier": "^3.0.0",
78
+ "typescript": "^5.0.2"
79
+ }
80
+ }
package/promise.d.ts ADDED
@@ -0,0 +1,131 @@
1
+ import { EventEmitter } from 'events';
2
+
3
+ import {
4
+ RowDataPacket,
5
+ OkPacket,
6
+ ResultSetHeader,
7
+ FieldPacket,
8
+ QueryOptions,
9
+ ConnectionOptions,
10
+ PoolOptions,
11
+ PoolClusterOptions,
12
+ Pool as CorePool,
13
+ } from './index.js';
14
+ import { ExecutableBase as ExecutableBaseClass } from './typings/mysql/lib/protocol/sequences/promise/ExecutableBase.js';
15
+ import { QueryableBase as QueryableBaseClass } from './typings/mysql/lib/protocol/sequences/promise/QueryableBase.js';
16
+
17
+ export * from './index.js';
18
+
19
+ // Expose class interfaces
20
+ declare class QueryableAndExecutableBase extends QueryableBaseClass(
21
+ ExecutableBaseClass(EventEmitter)
22
+ ) {}
23
+
24
+ export interface PreparedStatementInfo {
25
+ close(): Promise<void>;
26
+ execute(
27
+ parameters: any | any[] | { [param: string]: any }
28
+ ): Promise<
29
+ [
30
+ (
31
+ | RowDataPacket[][]
32
+ | RowDataPacket[]
33
+ | OkPacket
34
+ | OkPacket[]
35
+ | ResultSetHeader
36
+ ),
37
+ FieldPacket[],
38
+ ]
39
+ >;
40
+ }
41
+
42
+ export interface Connection extends QueryableAndExecutableBase {
43
+ config: ConnectionOptions;
44
+
45
+ threadId: number;
46
+
47
+ connect(): Promise<void>;
48
+
49
+ ping(): Promise<void>;
50
+
51
+ beginTransaction(): Promise<void>;
52
+
53
+ commit(): Promise<void>;
54
+
55
+ rollback(): Promise<void>;
56
+
57
+ changeUser(options: ConnectionOptions): Promise<void>;
58
+
59
+ prepare(options: string | QueryOptions): Promise<PreparedStatementInfo>;
60
+
61
+ unprepare(sql: string | QueryOptions): void;
62
+
63
+ end(options?: any): Promise<void>;
64
+
65
+ destroy(): void;
66
+
67
+ pause(): void;
68
+
69
+ resume(): void;
70
+
71
+ escape(value: any): string;
72
+
73
+ escapeId(value: string): string;
74
+ escapeId(values: string[]): string;
75
+
76
+ format(sql: string, values?: any | any[] | { [param: string]: any }): string;
77
+ }
78
+
79
+ export interface PoolConnection extends Connection {
80
+ release(): void;
81
+ connection: Connection;
82
+ }
83
+
84
+ export interface Pool extends Connection {
85
+ getConnection(): Promise<PoolConnection>;
86
+
87
+ releaseConnection(connection: PoolConnection): void;
88
+
89
+ on(event: 'connection', listener: (connection: PoolConnection) => any): this;
90
+ on(event: 'acquire', listener: (connection: PoolConnection) => any): this;
91
+ on(event: 'release', listener: (connection: PoolConnection) => any): this;
92
+ on(event: 'enqueue', listener: () => any): this;
93
+
94
+ end(): Promise<void>;
95
+
96
+ pool: CorePool;
97
+ }
98
+
99
+ export interface PoolNamespace extends QueryableAndExecutableBase {
100
+ getConnection(): Promise<PoolConnection>;
101
+ }
102
+
103
+ export interface PoolCluster extends EventEmitter {
104
+ config: PoolClusterOptions;
105
+
106
+ add(config: PoolOptions): void;
107
+ add(group: string, connectionUri: string): void;
108
+ add(group: string, config: PoolOptions): void;
109
+
110
+ end(): Promise<void>;
111
+
112
+ getConnection(): Promise<PoolConnection>;
113
+ getConnection(group: string): Promise<PoolConnection>;
114
+ getConnection(group: string, selector: string): Promise<PoolConnection>;
115
+
116
+ of(pattern: string, selector?: string): PoolNamespace;
117
+
118
+ on(event: string, listener: (...args: any[]) => void): this;
119
+ on(event: 'remove', listener: (nodeId: number) => void): this;
120
+ on(event: 'warn', listener: (err: Error) => void): this;
121
+ }
122
+
123
+ export function createConnection(connectionUri: string): Promise<Connection>;
124
+ export function createConnection(
125
+ config: ConnectionOptions
126
+ ): Promise<Connection>;
127
+
128
+ export function createPool(connectionUri: string): Pool;
129
+ export function createPool(config: PoolOptions): Pool;
130
+
131
+ export function createPoolCluster(config?: PoolClusterOptions): PoolCluster;