mysql2 3.4.0 → 3.4.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.
- package/index.d.ts +0 -224
- package/package.json +1 -1
- package/promise.d.ts +35 -180
- package/promise.js +19 -0
- package/typings/mysql/index.d.ts +24 -35
- package/typings/mysql/lib/Auth.d.ts +30 -0
- package/typings/mysql/lib/Connection.d.ts +71 -105
- package/typings/mysql/lib/Pool.d.ts +16 -114
- package/typings/mysql/lib/PoolCluster.d.ts +18 -1
- package/typings/mysql/lib/PoolConnection.d.ts +2 -0
- package/typings/mysql/lib/constants/CharsetToEncoding.d.ts +8 -0
- package/typings/mysql/lib/constants/Charsets.d.ts +326 -0
- package/typings/mysql/lib/constants/Types.d.ts +68 -0
- package/typings/mysql/lib/constants/index.d.ts +5 -0
- package/typings/mysql/lib/parsers/ParserCache.d.ts +4 -0
- package/typings/mysql/lib/parsers/index.d.ts +3 -0
- package/typings/mysql/lib/protocol/sequences/ExecutableBase.d.ts +72 -0
- package/typings/mysql/lib/protocol/sequences/Query.d.ts +2 -0
- package/typings/mysql/lib/protocol/sequences/QueryableBase.d.ts +72 -0
- package/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.d.ts +56 -0
- package/typings/mysql/lib/protocol/sequences/promise/QueryableBase.d.ts +56 -0
package/index.d.ts
CHANGED
|
@@ -1,225 +1 @@
|
|
|
1
|
-
import * as mysql from './typings/mysql/index.js';
|
|
2
|
-
import {
|
|
3
|
-
Connection as PromiseConnection,
|
|
4
|
-
Pool as PromisePool,
|
|
5
|
-
PoolConnection as PromisePoolConnection,
|
|
6
|
-
} from './promise.js';
|
|
7
|
-
|
|
8
1
|
export * from './typings/mysql/index.js';
|
|
9
|
-
|
|
10
|
-
export interface Connection extends mysql.Connection {
|
|
11
|
-
execute<
|
|
12
|
-
T extends
|
|
13
|
-
| mysql.RowDataPacket[][]
|
|
14
|
-
| mysql.RowDataPacket[]
|
|
15
|
-
| mysql.OkPacket
|
|
16
|
-
| mysql.OkPacket[]
|
|
17
|
-
| mysql.ResultSetHeader
|
|
18
|
-
>(
|
|
19
|
-
sql: string,
|
|
20
|
-
callback?: (
|
|
21
|
-
err: mysql.QueryError | null,
|
|
22
|
-
result: T,
|
|
23
|
-
fields: mysql.FieldPacket[]
|
|
24
|
-
) => any
|
|
25
|
-
): mysql.Query;
|
|
26
|
-
execute<
|
|
27
|
-
T extends
|
|
28
|
-
| mysql.RowDataPacket[][]
|
|
29
|
-
| mysql.RowDataPacket[]
|
|
30
|
-
| mysql.OkPacket
|
|
31
|
-
| mysql.OkPacket[]
|
|
32
|
-
| mysql.ResultSetHeader
|
|
33
|
-
>(
|
|
34
|
-
sql: string,
|
|
35
|
-
values: any | any[] | { [param: string]: any },
|
|
36
|
-
callback?: (
|
|
37
|
-
err: mysql.QueryError | null,
|
|
38
|
-
result: T,
|
|
39
|
-
fields: mysql.FieldPacket[]
|
|
40
|
-
) => any
|
|
41
|
-
): mysql.Query;
|
|
42
|
-
execute<
|
|
43
|
-
T extends
|
|
44
|
-
| mysql.RowDataPacket[][]
|
|
45
|
-
| mysql.RowDataPacket[]
|
|
46
|
-
| mysql.OkPacket
|
|
47
|
-
| mysql.OkPacket[]
|
|
48
|
-
| mysql.ResultSetHeader
|
|
49
|
-
>(
|
|
50
|
-
options: mysql.QueryOptions,
|
|
51
|
-
callback?: (
|
|
52
|
-
err: mysql.QueryError | null,
|
|
53
|
-
result: T,
|
|
54
|
-
fields?: mysql.FieldPacket[]
|
|
55
|
-
) => any
|
|
56
|
-
): mysql.Query;
|
|
57
|
-
execute<
|
|
58
|
-
T extends
|
|
59
|
-
| mysql.RowDataPacket[][]
|
|
60
|
-
| mysql.RowDataPacket[]
|
|
61
|
-
| mysql.OkPacket
|
|
62
|
-
| mysql.OkPacket[]
|
|
63
|
-
| mysql.ResultSetHeader
|
|
64
|
-
>(
|
|
65
|
-
options: mysql.QueryOptions,
|
|
66
|
-
values: any | any[] | { [param: string]: any },
|
|
67
|
-
callback?: (
|
|
68
|
-
err: mysql.QueryError | null,
|
|
69
|
-
result: T,
|
|
70
|
-
fields: mysql.FieldPacket[]
|
|
71
|
-
) => any
|
|
72
|
-
): mysql.Query;
|
|
73
|
-
ping(callback?: (err: mysql.QueryError | null) => any): void;
|
|
74
|
-
unprepare(sql: string): mysql.PrepareStatementInfo;
|
|
75
|
-
prepare(
|
|
76
|
-
sql: string,
|
|
77
|
-
callback?: (
|
|
78
|
-
err: mysql.QueryError | null,
|
|
79
|
-
statement: mysql.PrepareStatementInfo
|
|
80
|
-
) => any
|
|
81
|
-
): mysql.Prepare;
|
|
82
|
-
serverHandshake(args: any): any;
|
|
83
|
-
writeOk(args?: mysql.OkPacketParams): void;
|
|
84
|
-
writeError(args?: mysql.ErrorPacketParams): void;
|
|
85
|
-
writeEof(warnings?: number, statusFlags?: number): void;
|
|
86
|
-
writeTextResult(rows?: Array<any>, columns?: Array<any>): void;
|
|
87
|
-
writePacket(packet: any): void;
|
|
88
|
-
promise(promiseImpl?: PromiseConstructor): PromiseConnection;
|
|
89
|
-
sequenceId: number;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface PoolConnection extends mysql.PoolConnection {
|
|
93
|
-
promise(promiseImpl?: PromiseConstructor): PromisePool;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface Pool extends mysql.Connection {
|
|
97
|
-
execute<
|
|
98
|
-
T extends
|
|
99
|
-
| mysql.RowDataPacket[][]
|
|
100
|
-
| mysql.RowDataPacket[]
|
|
101
|
-
| mysql.OkPacket
|
|
102
|
-
| mysql.OkPacket[]
|
|
103
|
-
| mysql.ResultSetHeader
|
|
104
|
-
>(
|
|
105
|
-
sql: string,
|
|
106
|
-
callback?: (
|
|
107
|
-
err: mysql.QueryError | null,
|
|
108
|
-
result: T,
|
|
109
|
-
fields: mysql.FieldPacket[]
|
|
110
|
-
) => any
|
|
111
|
-
): mysql.Query;
|
|
112
|
-
execute<
|
|
113
|
-
T extends
|
|
114
|
-
| mysql.RowDataPacket[][]
|
|
115
|
-
| mysql.RowDataPacket[]
|
|
116
|
-
| mysql.OkPacket
|
|
117
|
-
| mysql.OkPacket[]
|
|
118
|
-
| mysql.ResultSetHeader
|
|
119
|
-
>(
|
|
120
|
-
sql: string,
|
|
121
|
-
values: any | any[] | { [param: string]: any },
|
|
122
|
-
callback?: (
|
|
123
|
-
err: mysql.QueryError | null,
|
|
124
|
-
result: T,
|
|
125
|
-
fields: mysql.FieldPacket[]
|
|
126
|
-
) => any
|
|
127
|
-
): mysql.Query;
|
|
128
|
-
execute<
|
|
129
|
-
T extends
|
|
130
|
-
| mysql.RowDataPacket[][]
|
|
131
|
-
| mysql.RowDataPacket[]
|
|
132
|
-
| mysql.OkPacket
|
|
133
|
-
| mysql.OkPacket[]
|
|
134
|
-
| mysql.ResultSetHeader
|
|
135
|
-
>(
|
|
136
|
-
options: mysql.QueryOptions,
|
|
137
|
-
callback?: (
|
|
138
|
-
err: mysql.QueryError | null,
|
|
139
|
-
result: T,
|
|
140
|
-
fields?: mysql.FieldPacket[]
|
|
141
|
-
) => any
|
|
142
|
-
): mysql.Query;
|
|
143
|
-
execute<
|
|
144
|
-
T extends
|
|
145
|
-
| mysql.RowDataPacket[][]
|
|
146
|
-
| mysql.RowDataPacket[]
|
|
147
|
-
| mysql.OkPacket
|
|
148
|
-
| mysql.OkPacket[]
|
|
149
|
-
| mysql.ResultSetHeader
|
|
150
|
-
>(
|
|
151
|
-
options: mysql.QueryOptions,
|
|
152
|
-
values: any | any[] | { [param: string]: any },
|
|
153
|
-
callback?: (
|
|
154
|
-
err: mysql.QueryError | null,
|
|
155
|
-
result: T,
|
|
156
|
-
fields: mysql.FieldPacket[]
|
|
157
|
-
) => any
|
|
158
|
-
): mysql.Query;
|
|
159
|
-
getConnection(
|
|
160
|
-
callback: (err: NodeJS.ErrnoException, connection: PoolConnection) => any
|
|
161
|
-
): void;
|
|
162
|
-
releaseConnection(connection: PoolConnection | PromisePoolConnection): void;
|
|
163
|
-
on(event: string, listener: (args: any[]) => void): this;
|
|
164
|
-
on(event: 'connection', listener: (connection: PoolConnection) => any): this;
|
|
165
|
-
on(event: 'acquire', listener: (connection: PoolConnection) => any): this;
|
|
166
|
-
on(event: 'release', listener: (connection: PoolConnection) => any): this;
|
|
167
|
-
on(event: 'enqueue', listener: () => any): this;
|
|
168
|
-
unprepare(sql: string): mysql.PrepareStatementInfo;
|
|
169
|
-
prepare(
|
|
170
|
-
sql: string,
|
|
171
|
-
callback?: (
|
|
172
|
-
err: mysql.QueryError | null,
|
|
173
|
-
statement: mysql.PrepareStatementInfo
|
|
174
|
-
) => any
|
|
175
|
-
): mysql.Prepare;
|
|
176
|
-
promise(promiseImpl?: PromiseConstructor): PromisePool;
|
|
177
|
-
config: mysql.PoolOptions;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export interface ConnectionOptions extends mysql.ConnectionOptions {
|
|
181
|
-
charsetNumber?: number;
|
|
182
|
-
compress?: boolean;
|
|
183
|
-
authSwitchHandler?: (data: any, callback: () => void) => any;
|
|
184
|
-
connectAttributes?: { [param: string]: any };
|
|
185
|
-
decimalNumbers?: boolean;
|
|
186
|
-
isServer?: boolean;
|
|
187
|
-
maxPreparedStatements?: number;
|
|
188
|
-
namedPlaceholders?: boolean;
|
|
189
|
-
nestTables?: boolean | string;
|
|
190
|
-
passwordSha1?: string;
|
|
191
|
-
pool?: any;
|
|
192
|
-
rowsAsArray?: boolean;
|
|
193
|
-
stream?: any;
|
|
194
|
-
uri?: string;
|
|
195
|
-
connectionLimit?: number;
|
|
196
|
-
maxIdle?: number;
|
|
197
|
-
idleTimeout?: number;
|
|
198
|
-
Promise?: any;
|
|
199
|
-
queueLimit?: number;
|
|
200
|
-
waitForConnections?: boolean;
|
|
201
|
-
authPlugins?: {
|
|
202
|
-
[key: string]: mysql.AuthPlugin;
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export interface ConnectionConfig extends ConnectionOptions {
|
|
207
|
-
mergeFlags(defaultFlags: string[], userFlags: string[] | string): number;
|
|
208
|
-
getDefaultFlags(options?: ConnectionOptions): string[];
|
|
209
|
-
getCharsetNumber(charset: string): number;
|
|
210
|
-
getSSLProfile(name: string): { ca: string[] };
|
|
211
|
-
parseUrl(url: string): {
|
|
212
|
-
host: string;
|
|
213
|
-
port: number;
|
|
214
|
-
database: string;
|
|
215
|
-
user: string;
|
|
216
|
-
password: string;
|
|
217
|
-
[key: string]: any;
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export interface PoolOptions extends mysql.PoolOptions, ConnectionOptions {}
|
|
222
|
-
|
|
223
|
-
export function createConnection(connectionUri: string): Connection;
|
|
224
|
-
export function createConnection(config: ConnectionOptions): Connection;
|
|
225
|
-
export function createPool(config: PoolOptions): Pool;
|
package/package.json
CHANGED
package/promise.d.ts
CHANGED
|
@@ -8,15 +8,23 @@ import {
|
|
|
8
8
|
QueryOptions,
|
|
9
9
|
ConnectionOptions,
|
|
10
10
|
PoolOptions,
|
|
11
|
+
PoolClusterOptions,
|
|
11
12
|
Pool as CorePool,
|
|
12
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';
|
|
13
16
|
|
|
14
17
|
export * from './index.js';
|
|
15
18
|
|
|
19
|
+
// Expose class interfaces
|
|
20
|
+
declare class QueryableAndExecutableBase extends QueryableBaseClass(
|
|
21
|
+
ExecutableBaseClass(EventEmitter)
|
|
22
|
+
) {}
|
|
23
|
+
|
|
16
24
|
export interface PreparedStatementInfo {
|
|
17
25
|
close(): Promise<void>;
|
|
18
26
|
execute(
|
|
19
|
-
|
|
27
|
+
paramaters: any | any[] | { [param: string]: any }
|
|
20
28
|
): Promise<
|
|
21
29
|
[
|
|
22
30
|
(
|
|
@@ -31,93 +39,7 @@ export interface PreparedStatementInfo {
|
|
|
31
39
|
>;
|
|
32
40
|
}
|
|
33
41
|
|
|
34
|
-
export interface Connection extends
|
|
35
|
-
query<
|
|
36
|
-
T extends
|
|
37
|
-
| RowDataPacket[][]
|
|
38
|
-
| RowDataPacket[]
|
|
39
|
-
| OkPacket
|
|
40
|
-
| OkPacket[]
|
|
41
|
-
| ResultSetHeader
|
|
42
|
-
>(
|
|
43
|
-
sql: string
|
|
44
|
-
): Promise<[T, FieldPacket[]]>;
|
|
45
|
-
query<
|
|
46
|
-
T extends
|
|
47
|
-
| RowDataPacket[][]
|
|
48
|
-
| RowDataPacket[]
|
|
49
|
-
| OkPacket
|
|
50
|
-
| OkPacket[]
|
|
51
|
-
| ResultSetHeader
|
|
52
|
-
>(
|
|
53
|
-
sql: string,
|
|
54
|
-
values: any | any[] | { [param: string]: any }
|
|
55
|
-
): Promise<[T, FieldPacket[]]>;
|
|
56
|
-
query<
|
|
57
|
-
T extends
|
|
58
|
-
| RowDataPacket[][]
|
|
59
|
-
| RowDataPacket[]
|
|
60
|
-
| OkPacket
|
|
61
|
-
| OkPacket[]
|
|
62
|
-
| ResultSetHeader
|
|
63
|
-
>(
|
|
64
|
-
options: QueryOptions
|
|
65
|
-
): Promise<[T, FieldPacket[]]>;
|
|
66
|
-
query<
|
|
67
|
-
T extends
|
|
68
|
-
| RowDataPacket[][]
|
|
69
|
-
| RowDataPacket[]
|
|
70
|
-
| OkPacket
|
|
71
|
-
| OkPacket[]
|
|
72
|
-
| ResultSetHeader
|
|
73
|
-
>(
|
|
74
|
-
options: QueryOptions,
|
|
75
|
-
values: any | any[] | { [param: string]: any }
|
|
76
|
-
): Promise<[T, FieldPacket[]]>;
|
|
77
|
-
|
|
78
|
-
execute<
|
|
79
|
-
T extends
|
|
80
|
-
| RowDataPacket[][]
|
|
81
|
-
| RowDataPacket[]
|
|
82
|
-
| OkPacket
|
|
83
|
-
| OkPacket[]
|
|
84
|
-
| ResultSetHeader
|
|
85
|
-
>(
|
|
86
|
-
sql: string
|
|
87
|
-
): Promise<[T, FieldPacket[]]>;
|
|
88
|
-
execute<
|
|
89
|
-
T extends
|
|
90
|
-
| RowDataPacket[][]
|
|
91
|
-
| RowDataPacket[]
|
|
92
|
-
| OkPacket
|
|
93
|
-
| OkPacket[]
|
|
94
|
-
| ResultSetHeader
|
|
95
|
-
>(
|
|
96
|
-
sql: string,
|
|
97
|
-
values: any | any[] | { [param: string]: any }
|
|
98
|
-
): Promise<[T, FieldPacket[]]>;
|
|
99
|
-
execute<
|
|
100
|
-
T extends
|
|
101
|
-
| RowDataPacket[][]
|
|
102
|
-
| RowDataPacket[]
|
|
103
|
-
| OkPacket
|
|
104
|
-
| OkPacket[]
|
|
105
|
-
| ResultSetHeader
|
|
106
|
-
>(
|
|
107
|
-
options: QueryOptions
|
|
108
|
-
): Promise<[T, FieldPacket[]]>;
|
|
109
|
-
execute<
|
|
110
|
-
T extends
|
|
111
|
-
| RowDataPacket[][]
|
|
112
|
-
| RowDataPacket[]
|
|
113
|
-
| OkPacket
|
|
114
|
-
| OkPacket[]
|
|
115
|
-
| ResultSetHeader
|
|
116
|
-
>(
|
|
117
|
-
options: QueryOptions,
|
|
118
|
-
values: any | any[] | { [param: string]: any }
|
|
119
|
-
): Promise<[T, FieldPacket[]]>;
|
|
120
|
-
|
|
42
|
+
export interface Connection extends QueryableAndExecutableBase {
|
|
121
43
|
config: ConnectionOptions;
|
|
122
44
|
|
|
123
45
|
threadId: number;
|
|
@@ -159,93 +81,7 @@ export interface PoolConnection extends Connection {
|
|
|
159
81
|
connection: Connection;
|
|
160
82
|
}
|
|
161
83
|
|
|
162
|
-
export interface Pool extends
|
|
163
|
-
query<
|
|
164
|
-
T extends
|
|
165
|
-
| RowDataPacket[][]
|
|
166
|
-
| RowDataPacket[]
|
|
167
|
-
| OkPacket
|
|
168
|
-
| OkPacket[]
|
|
169
|
-
| ResultSetHeader
|
|
170
|
-
>(
|
|
171
|
-
sql: string
|
|
172
|
-
): Promise<[T, FieldPacket[]]>;
|
|
173
|
-
query<
|
|
174
|
-
T extends
|
|
175
|
-
| RowDataPacket[][]
|
|
176
|
-
| RowDataPacket[]
|
|
177
|
-
| OkPacket
|
|
178
|
-
| OkPacket[]
|
|
179
|
-
| ResultSetHeader
|
|
180
|
-
>(
|
|
181
|
-
sql: string,
|
|
182
|
-
values: any | any[] | { [param: string]: any }
|
|
183
|
-
): Promise<[T, FieldPacket[]]>;
|
|
184
|
-
query<
|
|
185
|
-
T extends
|
|
186
|
-
| RowDataPacket[][]
|
|
187
|
-
| RowDataPacket[]
|
|
188
|
-
| OkPacket
|
|
189
|
-
| OkPacket[]
|
|
190
|
-
| ResultSetHeader
|
|
191
|
-
>(
|
|
192
|
-
options: QueryOptions
|
|
193
|
-
): Promise<[T, FieldPacket[]]>;
|
|
194
|
-
query<
|
|
195
|
-
T extends
|
|
196
|
-
| RowDataPacket[][]
|
|
197
|
-
| RowDataPacket[]
|
|
198
|
-
| OkPacket
|
|
199
|
-
| OkPacket[]
|
|
200
|
-
| ResultSetHeader
|
|
201
|
-
>(
|
|
202
|
-
options: QueryOptions,
|
|
203
|
-
values: any | any[] | { [param: string]: any }
|
|
204
|
-
): Promise<[T, FieldPacket[]]>;
|
|
205
|
-
|
|
206
|
-
execute<
|
|
207
|
-
T extends
|
|
208
|
-
| RowDataPacket[][]
|
|
209
|
-
| RowDataPacket[]
|
|
210
|
-
| OkPacket
|
|
211
|
-
| OkPacket[]
|
|
212
|
-
| ResultSetHeader
|
|
213
|
-
>(
|
|
214
|
-
sql: string
|
|
215
|
-
): Promise<[T, FieldPacket[]]>;
|
|
216
|
-
execute<
|
|
217
|
-
T extends
|
|
218
|
-
| RowDataPacket[][]
|
|
219
|
-
| RowDataPacket[]
|
|
220
|
-
| OkPacket
|
|
221
|
-
| OkPacket[]
|
|
222
|
-
| ResultSetHeader
|
|
223
|
-
>(
|
|
224
|
-
sql: string,
|
|
225
|
-
values: any | any[] | { [param: string]: any }
|
|
226
|
-
): Promise<[T, FieldPacket[]]>;
|
|
227
|
-
execute<
|
|
228
|
-
T extends
|
|
229
|
-
| RowDataPacket[][]
|
|
230
|
-
| RowDataPacket[]
|
|
231
|
-
| OkPacket
|
|
232
|
-
| OkPacket[]
|
|
233
|
-
| ResultSetHeader
|
|
234
|
-
>(
|
|
235
|
-
options: QueryOptions
|
|
236
|
-
): Promise<[T, FieldPacket[]]>;
|
|
237
|
-
execute<
|
|
238
|
-
T extends
|
|
239
|
-
| RowDataPacket[][]
|
|
240
|
-
| RowDataPacket[]
|
|
241
|
-
| OkPacket
|
|
242
|
-
| OkPacket[]
|
|
243
|
-
| ResultSetHeader
|
|
244
|
-
>(
|
|
245
|
-
options: QueryOptions,
|
|
246
|
-
values: any | any[] | { [param: string]: any }
|
|
247
|
-
): Promise<[T, FieldPacket[]]>;
|
|
248
|
-
|
|
84
|
+
export interface Pool extends Connection {
|
|
249
85
|
getConnection(): Promise<PoolConnection>;
|
|
250
86
|
|
|
251
87
|
releaseConnection(connection: PoolConnection): void;
|
|
@@ -257,14 +93,31 @@ export interface Pool extends EventEmitter, Connection {
|
|
|
257
93
|
|
|
258
94
|
end(): Promise<void>;
|
|
259
95
|
|
|
260
|
-
|
|
96
|
+
pool: CorePool;
|
|
97
|
+
}
|
|
261
98
|
|
|
262
|
-
|
|
263
|
-
|
|
99
|
+
export interface PoolNamespace extends QueryableAndExecutableBase {
|
|
100
|
+
getConnection(): Promise<PoolConnection>;
|
|
101
|
+
}
|
|
264
102
|
|
|
265
|
-
|
|
103
|
+
export interface PoolCluster extends EventEmitter {
|
|
104
|
+
config: PoolClusterOptions;
|
|
266
105
|
|
|
267
|
-
|
|
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: 'connection', listener: (connection: PoolConnection) => void): this;
|
|
268
121
|
}
|
|
269
122
|
|
|
270
123
|
export function createConnection(connectionUri: string): Promise<Connection>;
|
|
@@ -274,3 +127,5 @@ export function createConnection(
|
|
|
274
127
|
|
|
275
128
|
export function createPool(connectionUri: string): Pool;
|
|
276
129
|
export function createPool(config: PoolOptions): Pool;
|
|
130
|
+
|
|
131
|
+
export function createPoolCluster(config?: PoolClusterOptions): PoolCluster;
|
package/promise.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const core = require('./index.js');
|
|
4
4
|
const EventEmitter = require('events').EventEmitter;
|
|
5
|
+
const parserCache = require('./lib/parsers/parser_cache.js');
|
|
5
6
|
|
|
6
7
|
function makeDoneCb(resolve, reject, localErr) {
|
|
7
8
|
return function (err, rows, fields) {
|
|
@@ -563,3 +564,21 @@ exports.raw = core.raw;
|
|
|
563
564
|
exports.PromisePool = PromisePool;
|
|
564
565
|
exports.PromiseConnection = PromiseConnection;
|
|
565
566
|
exports.PromisePoolConnection = PromisePoolConnection;
|
|
567
|
+
|
|
568
|
+
exports.__defineGetter__('Types', () => require('./lib/constants/types.js'));
|
|
569
|
+
|
|
570
|
+
exports.__defineGetter__('Charsets', () =>
|
|
571
|
+
require('./lib/constants/charsets.js')
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
exports.__defineGetter__('CharsetToEncoding', () =>
|
|
575
|
+
require('./lib/constants/charset_encodings.js')
|
|
576
|
+
);
|
|
577
|
+
|
|
578
|
+
exports.setMaxParserCache = function(max) {
|
|
579
|
+
parserCache.setMaxCache(max);
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
exports.clearParserCache = function() {
|
|
583
|
+
parserCache.clearCache();
|
|
584
|
+
};
|
package/typings/mysql/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { RsaPublicKey, RsaPrivateKey, KeyLike } from 'crypto';
|
|
2
1
|
import { Pool as BasePool, PoolOptions } from './lib/Pool.js';
|
|
3
2
|
import {
|
|
4
3
|
Connection as BaseConnection,
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
import {
|
|
14
13
|
PoolCluster as BasePoolCluster,
|
|
15
14
|
PoolClusterOptions,
|
|
15
|
+
PoolNamespace,
|
|
16
16
|
} from './lib/PoolCluster.js';
|
|
17
17
|
import { PoolConnection as BasePoolConnection } from './lib/PoolConnection.js';
|
|
18
18
|
import {
|
|
@@ -20,61 +20,35 @@ import {
|
|
|
20
20
|
PrepareStatementInfo,
|
|
21
21
|
} from './lib/protocol/sequences/Prepare.js';
|
|
22
22
|
import { Server } from './lib/Server.js';
|
|
23
|
-
import { Connection as PromiseConnection } from '../../promise.js';
|
|
24
23
|
|
|
25
24
|
export {
|
|
26
25
|
ConnectionOptions,
|
|
27
26
|
SslOptions,
|
|
28
27
|
PoolOptions,
|
|
29
28
|
PoolClusterOptions,
|
|
29
|
+
PoolNamespace,
|
|
30
30
|
QueryOptions,
|
|
31
31
|
QueryError,
|
|
32
32
|
PrepareStatementInfo,
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
export * from './lib/protocol/packets/index.js';
|
|
36
|
+
export * from './lib/Auth.js';
|
|
37
|
+
export * from './lib/constants/index.js';
|
|
38
|
+
export * from './lib/parsers/index.js';
|
|
36
39
|
|
|
37
40
|
// Expose class interfaces
|
|
38
|
-
export interface Connection extends BaseConnection {
|
|
39
|
-
promise(promiseImpl?: PromiseConstructor): PromiseConnection;
|
|
40
|
-
}
|
|
41
|
+
export interface Connection extends BaseConnection {}
|
|
41
42
|
export interface Pool extends BasePool {}
|
|
42
43
|
export interface PoolConnection extends BasePoolConnection {}
|
|
43
44
|
export interface PoolCluster extends BasePoolCluster {}
|
|
44
45
|
export interface Query extends BaseQuery {}
|
|
45
46
|
export interface Prepare extends BasePrepare {}
|
|
46
47
|
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
command: string;
|
|
50
|
-
}) => (
|
|
51
|
-
pluginData: Buffer
|
|
52
|
-
) => Promise<string> | string | Buffer | Promise<Buffer> | null;
|
|
53
|
-
|
|
54
|
-
type AuthPluginDefinition<T> = (pluginOptions?: T) => AuthPlugin;
|
|
55
|
-
|
|
56
|
-
export const authPlugins: {
|
|
57
|
-
caching_sha2_password: AuthPluginDefinition<{
|
|
58
|
-
overrideIsSecure?: boolean;
|
|
59
|
-
serverPublicKey?: RsaPublicKey | RsaPrivateKey | KeyLike;
|
|
60
|
-
jonServerPublicKey?: (data: Buffer) => void;
|
|
61
|
-
}>;
|
|
62
|
-
mysql_clear_password: AuthPluginDefinition<{
|
|
63
|
-
password?: string;
|
|
64
|
-
}>;
|
|
65
|
-
mysql_native_password: AuthPluginDefinition<{
|
|
66
|
-
password?: string;
|
|
67
|
-
passwordSha1?: string;
|
|
68
|
-
}>;
|
|
69
|
-
sha256_password: AuthPluginDefinition<{
|
|
70
|
-
serverPublicKey?: RsaPublicKey | RsaPrivateKey | KeyLike;
|
|
71
|
-
joinServerPublicKey?: (data: Buffer) => void;
|
|
72
|
-
}>;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export function createConnection(connectionUri: string): Connection;
|
|
76
|
-
export function createConnection(config: ConnectionOptions): Connection;
|
|
48
|
+
export function createConnection(connectionUri: string): BaseConnection;
|
|
49
|
+
export function createConnection(config: ConnectionOptions): BaseConnection;
|
|
77
50
|
|
|
51
|
+
export function createPool(connectionUri: string): BasePool;
|
|
78
52
|
export function createPool(config: PoolOptions): BasePool;
|
|
79
53
|
|
|
80
54
|
export function createPoolCluster(config?: PoolClusterOptions): PoolCluster;
|
|
@@ -102,4 +76,19 @@ export function raw(sql: string): {
|
|
|
102
76
|
toSqlString: () => string;
|
|
103
77
|
};
|
|
104
78
|
|
|
79
|
+
export interface ConnectionConfig extends ConnectionOptions {
|
|
80
|
+
mergeFlags(defaultFlags: string[], userFlags: string[] | string): number;
|
|
81
|
+
getDefaultFlags(options?: ConnectionOptions): string[];
|
|
82
|
+
getCharsetNumber(charset: string): number;
|
|
83
|
+
getSSLProfile(name: string): { ca: string[] };
|
|
84
|
+
parseUrl(url: string): {
|
|
85
|
+
host: string;
|
|
86
|
+
port: number;
|
|
87
|
+
database: string;
|
|
88
|
+
user: string;
|
|
89
|
+
password: string;
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
105
94
|
export function createServer(handler: (conn: BaseConnection) => any): Server;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RsaPublicKey, RsaPrivateKey, KeyLike } from 'crypto';
|
|
2
|
+
import { Connection } from './Connection.js';
|
|
3
|
+
|
|
4
|
+
export type AuthPlugin = (pluginMetadata: {
|
|
5
|
+
connection: Connection;
|
|
6
|
+
command: string;
|
|
7
|
+
}) => (
|
|
8
|
+
pluginData: Buffer
|
|
9
|
+
) => Promise<string> | string | Buffer | Promise<Buffer> | null;
|
|
10
|
+
|
|
11
|
+
type AuthPluginDefinition<T> = (pluginOptions?: T) => AuthPlugin;
|
|
12
|
+
|
|
13
|
+
export const authPlugins: {
|
|
14
|
+
caching_sha2_password: AuthPluginDefinition<{
|
|
15
|
+
overrideIsSecure?: boolean;
|
|
16
|
+
serverPublicKey?: RsaPublicKey | RsaPrivateKey | KeyLike;
|
|
17
|
+
jonServerPublicKey?: (data: Buffer) => void;
|
|
18
|
+
}>;
|
|
19
|
+
mysql_clear_password: AuthPluginDefinition<{
|
|
20
|
+
password?: string;
|
|
21
|
+
}>;
|
|
22
|
+
mysql_native_password: AuthPluginDefinition<{
|
|
23
|
+
password?: string;
|
|
24
|
+
passwordSha1?: string;
|
|
25
|
+
}>;
|
|
26
|
+
sha256_password: AuthPluginDefinition<{
|
|
27
|
+
serverPublicKey?: RsaPublicKey | RsaPrivateKey | KeyLike;
|
|
28
|
+
joinServerPublicKey?: (data: Buffer) => void;
|
|
29
|
+
}>;
|
|
30
|
+
};
|