@tachybase/module-multi-app 1.6.0 → 1.6.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.
Files changed (105) hide show
  1. package/README.md +34 -34
  2. package/README.zh-CN.md +34 -34
  3. package/client.d.ts +1 -1
  4. package/client.js +1 -1
  5. package/dist/externalVersion.js +5 -5
  6. package/dist/locale/en-US.json +48 -48
  7. package/dist/locale/es-ES.json +9 -9
  8. package/dist/locale/ko_KR.json +11 -11
  9. package/dist/locale/pt-BR.json +9 -9
  10. package/dist/locale/zh-CN.json +58 -58
  11. package/dist/node_modules/mariadb/callback.js +43 -8
  12. package/dist/node_modules/mariadb/check-node.js +30 -0
  13. package/dist/node_modules/mariadb/lib/cluster-callback.js +84 -0
  14. package/dist/node_modules/mariadb/lib/cluster.js +446 -0
  15. package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +576 -177
  16. package/dist/node_modules/mariadb/lib/cmd/change-user.js +54 -44
  17. package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +3 -2
  18. package/dist/node_modules/mariadb/lib/cmd/class/prepare-cache-wrapper.js +46 -0
  19. package/dist/node_modules/mariadb/lib/cmd/class/prepare-result-packet.js +141 -0
  20. package/dist/node_modules/mariadb/lib/cmd/class/prepare-wrapper.js +70 -0
  21. package/dist/node_modules/mariadb/lib/cmd/close-prepare.js +38 -0
  22. package/dist/node_modules/mariadb/lib/cmd/column-definition.js +145 -47
  23. package/dist/node_modules/mariadb/lib/cmd/command.js +41 -75
  24. package/dist/node_modules/mariadb/lib/cmd/decoder/binary-decoder.js +282 -0
  25. package/dist/node_modules/mariadb/lib/cmd/decoder/text-decoder.js +210 -0
  26. package/dist/node_modules/mariadb/lib/cmd/{common-binary-cmd.js → encoder/binary-encoder.js} +34 -77
  27. package/dist/node_modules/mariadb/lib/cmd/encoder/text-encoder.js +311 -0
  28. package/dist/node_modules/mariadb/lib/cmd/execute-stream.js +61 -0
  29. package/dist/node_modules/mariadb/lib/cmd/execute.js +338 -0
  30. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +25 -62
  31. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +39 -6
  32. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +48 -16
  33. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/handshake.js +198 -0
  34. package/dist/node_modules/mariadb/lib/cmd/handshake/{initial-handshake.js → auth/initial-handshake.js} +10 -8
  35. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +22 -9
  36. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +9 -4
  37. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/parsec-auth.js +115 -0
  38. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +12 -5
  39. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +44 -33
  40. package/dist/node_modules/mariadb/lib/cmd/handshake/authentication.js +335 -0
  41. package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +20 -19
  42. package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +6 -3
  43. package/dist/node_modules/mariadb/lib/cmd/parser.js +861 -0
  44. package/dist/node_modules/mariadb/lib/cmd/ping.js +17 -18
  45. package/dist/node_modules/mariadb/lib/cmd/prepare.js +170 -0
  46. package/dist/node_modules/mariadb/lib/cmd/query.js +281 -144
  47. package/dist/node_modules/mariadb/lib/cmd/quit.js +9 -6
  48. package/dist/node_modules/mariadb/lib/cmd/reset.js +15 -19
  49. package/dist/node_modules/mariadb/lib/cmd/stream.js +21 -6
  50. package/dist/node_modules/mariadb/lib/config/cluster-options.js +23 -0
  51. package/dist/node_modules/mariadb/lib/config/connection-options.js +196 -132
  52. package/dist/node_modules/mariadb/lib/config/pool-options.js +27 -19
  53. package/dist/node_modules/mariadb/lib/connection-callback.js +492 -120
  54. package/dist/node_modules/mariadb/lib/connection-promise.js +372 -0
  55. package/dist/node_modules/mariadb/lib/connection.js +1739 -1016
  56. package/dist/node_modules/mariadb/lib/const/capabilities.js +36 -30
  57. package/dist/node_modules/mariadb/lib/const/collations.js +972 -36
  58. package/dist/node_modules/mariadb/lib/const/connection_status.js +3 -0
  59. package/dist/node_modules/mariadb/lib/const/error-code.js +35 -11
  60. package/dist/node_modules/mariadb/lib/const/field-detail.js +3 -0
  61. package/dist/node_modules/mariadb/lib/const/field-type.js +7 -4
  62. package/dist/node_modules/mariadb/lib/const/server-status.js +4 -1
  63. package/dist/node_modules/mariadb/lib/const/state-change.js +3 -0
  64. package/dist/node_modules/mariadb/lib/filtered-cluster-callback.js +136 -0
  65. package/dist/node_modules/mariadb/lib/filtered-cluster.js +118 -0
  66. package/dist/node_modules/mariadb/lib/io/compression-input-stream.js +14 -13
  67. package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +21 -18
  68. package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +75 -64
  69. package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +13 -9
  70. package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +12 -10
  71. package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +402 -134
  72. package/dist/node_modules/mariadb/lib/io/packet.js +287 -202
  73. package/dist/node_modules/mariadb/lib/lru-prepare-cache.js +84 -0
  74. package/dist/node_modules/mariadb/lib/misc/connection-information.js +15 -32
  75. package/dist/node_modules/mariadb/lib/misc/errors.js +68 -25
  76. package/dist/node_modules/mariadb/lib/misc/parse.js +207 -711
  77. package/dist/node_modules/mariadb/lib/misc/utils.js +34 -62
  78. package/dist/node_modules/mariadb/lib/pool-callback.js +213 -174
  79. package/dist/node_modules/mariadb/lib/pool-promise.js +228 -94
  80. package/dist/node_modules/mariadb/lib/pool.js +951 -0
  81. package/dist/node_modules/mariadb/package.json +1 -1
  82. package/dist/node_modules/mariadb/promise.js +1 -34
  83. package/dist/node_modules/mariadb/types/callback.d.ts +207 -0
  84. package/dist/node_modules/mariadb/types/index.d.ts +94 -674
  85. package/dist/node_modules/mariadb/types/share.d.ts +804 -0
  86. package/dist/node_modules/qs/package.json +1 -1
  87. package/dist/server/actions/apps.js +2 -2
  88. package/dist/server/app-lifecycle.d.ts +1 -1
  89. package/dist/server/app-lifecycle.js +4 -4
  90. package/dist/server/models/application.d.ts +1 -1
  91. package/package.json +7 -7
  92. package/server.d.ts +2 -2
  93. package/server.js +1 -1
  94. package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +0 -372
  95. package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +0 -427
  96. package/dist/node_modules/mariadb/lib/cmd/handshake/client-handshake-response.js +0 -126
  97. package/dist/node_modules/mariadb/lib/cmd/handshake/handshake.js +0 -292
  98. package/dist/node_modules/mariadb/lib/cmd/resultset.js +0 -607
  99. package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +0 -19
  100. package/dist/node_modules/mariadb/lib/filtered-pool-cluster.js +0 -81
  101. package/dist/node_modules/mariadb/lib/io/bulk-packet.js +0 -590
  102. package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +0 -481
  103. package/dist/node_modules/mariadb/lib/pool-base.js +0 -611
  104. package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +0 -66
  105. package/dist/node_modules/mariadb/lib/pool-cluster.js +0 -407
@@ -0,0 +1,804 @@
1
+ import { Geometry } from 'geojson';
2
+ import { Duplex, Readable } from 'stream';
3
+ import { SecureContextOptions } from 'tls';
4
+
5
+ export type TypeCastResult = boolean | number | string | symbol | null | Date | Geometry | Buffer;
6
+ export type TypeCastNextFunction = () => TypeCastResult;
7
+ export type TypeCastFunction = (field: FieldInfo, next: TypeCastNextFunction) => TypeCastResult;
8
+ export function StreamCallback(err?: Error, stream?: Duplex): void;
9
+
10
+ export interface LoggerConfig {
11
+ network?: (msg: string) => void;
12
+ query?: (msg: string) => void;
13
+ error?: (err: Error) => void;
14
+ warning?: (msg: string) => void;
15
+ }
16
+
17
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
+ export function defaultOptions(connectionUri?: string | ConnectionConfig): any;
19
+ /* eslint-enable @typescript-eslint/no-explicit-any */
20
+
21
+ export interface FieldInfo {
22
+ collation: Collation;
23
+ columnLength: number;
24
+ columnType: TypeNumbers;
25
+ scale: number;
26
+ type: Types;
27
+ flags: Flags;
28
+ db(): string;
29
+ schema(): string; // Alias for db()
30
+ table(): string;
31
+ orgTable(): string;
32
+ name(): string;
33
+ orgName(): string;
34
+
35
+ // Note that you may only call *one* of these functions
36
+ // when decoding a column via the typeCast callback.
37
+ // Calling additional functions will give you incorrect results.
38
+ string(): string | null;
39
+ buffer(): Buffer | null;
40
+ float(): number | null;
41
+ int(): number | null;
42
+ long(): number | null;
43
+ decimal(): number | null;
44
+ date(): Date | null;
45
+ geometry(): Geometry | null;
46
+ }
47
+
48
+ export interface ImportFileConfig extends ConnectionConfig {
49
+ /**
50
+ * SQL file path to import
51
+ */
52
+ file: string;
53
+ }
54
+
55
+ export interface PoolConfig extends ConnectionConfig {
56
+ /**
57
+ * The milliseconds before a timeout occurs during the connection acquisition. This is slightly different from
58
+ * connectTimeout, because acquiring a pool connection does not always involve making a connection.
59
+ * (Default: 10 seconds)
60
+ */
61
+ acquireTimeout?: number;
62
+
63
+ /**
64
+ * The maximum number of connections to create at once. (Default: 10)
65
+ */
66
+ connectionLimit?: number;
67
+
68
+ /**
69
+ * Indicate idle time after which a pool connection is released.
70
+ * The Value must be lower than
71
+ * [@@wait_timeout](https://mariadb.com/kb/en/library/server-system-variables/#wait_timeout).
72
+ * In seconds (0 means never release)
73
+ * Default: 1800 (= 30 minutes)
74
+ */
75
+ idleTimeout?: number;
76
+
77
+ /**
78
+ * Timeout after which pool give up creating new connection.
79
+ */
80
+ initializationTimeout?: number;
81
+
82
+ /**
83
+ * When asking a connection to pool, the pool will validate the connection state.
84
+ * "minDelayValidation" permits disabling this validation if the connection has been borrowed recently avoiding
85
+ * useless verifications in case of frequent reuse of connections.
86
+ * 0 means validation is done each time the connection is asked. (in ms)
87
+ * Default: 500 (in millisecond)
88
+ */
89
+ minDelayValidation?: number;
90
+
91
+ /**
92
+ * Permit setting a minimum amount of connection in pool.
93
+ * **Recommendation is to use fixed pool, so not setting this value**
94
+ */
95
+ minimumIdle?: number;
96
+
97
+ /**
98
+ * Use COM_STMT_RESET when releasing a connection to pool.
99
+ * Default: true
100
+ */
101
+ resetAfterUse?: boolean;
102
+
103
+ /**
104
+ * No rollback or reset when releasing a connection to pool.
105
+ * Default: false
106
+ */
107
+ noControlAfterUse?: boolean;
108
+
109
+ /**
110
+ * Permit indicating a timeout to log connection borrowed from pool.
111
+ * When a connection is borrowed from the pool and this timeout is reached,
112
+ * a message will be logged to the console indicating a possible connection leak.
113
+ * Another message will tell if the possible logged leak has been released.
114
+ * A value of 0 (default) meaning Leak detection is disabled
115
+ */
116
+ leakDetectionTimeout?: number;
117
+ }
118
+
119
+ export interface PoolClusterConfig {
120
+ /**
121
+ * If true, PoolCluster will attempt to reconnect when the connection fails. (Default: true)
122
+ */
123
+ canRetry?: boolean;
124
+
125
+ /**
126
+ * If connection fails, node's errorCount increases. When errorCount is greater than removeNodeErrorCount,
127
+ * remove a node in the PoolCluster. (Default: 5)
128
+ */
129
+ removeNodeErrorCount?: number;
130
+
131
+ /**
132
+ * If connection fails, specifies the number of milliseconds before another connection attempt will be made.
133
+ * If set to 0, then the node will be removed instead and never re-used. (Default: 0)
134
+ */
135
+ restoreNodeTimeout?: number;
136
+
137
+ /**
138
+ * The default selector. (Default: RR)
139
+ * RR: Select one alternately. (Round-Robin)
140
+ * RANDOM: Select the node by random function.
141
+ * ORDER: Select the first node available unconditionally.
142
+ */
143
+ defaultSelector?: string;
144
+ }
145
+
146
+ export interface ServerVersion {
147
+ /**
148
+ * Raw string that database server send to connector.
149
+ * example : "10.4.3-MariaDB-1:10.4.3+maria~bionic-log"
150
+ */
151
+ readonly raw: string;
152
+
153
+ /**
154
+ * indicate if server is a MariaDB or a MySQL server
155
+ */
156
+ readonly mariaDb: boolean;
157
+
158
+ /**
159
+ * Server major version.
160
+ * Example for raw version "10.4.3-MariaDB" is 10
161
+ */
162
+ readonly major: number;
163
+
164
+ /**
165
+ * Server major version.
166
+ * Example for raw version "10.4.3-MariaDB" is 4
167
+ */
168
+ readonly minor: number;
169
+
170
+ /**
171
+ * Server major version.
172
+ * Example for raw version "10.4.3-MariaDB" is 3
173
+ */
174
+ readonly patch: number;
175
+ }
176
+ export interface SqlImportOptions {
177
+ /**
178
+ * file path of sql file
179
+ */
180
+ file: string;
181
+
182
+ /**
183
+ * Name of the database to use to import sql file.
184
+ * If not set, current database is used.
185
+ */
186
+ database?: string;
187
+ }
188
+ export interface ConnectionInfo {
189
+ /**
190
+ * Server connection identifier value
191
+ */
192
+ readonly threadId: number | null;
193
+
194
+ /**
195
+ * connection status flag
196
+ * see https://mariadb.com/kb/en/library/ok_packet/#server-status-flag
197
+ */
198
+ readonly status: number;
199
+
200
+ /**
201
+ * Server version information
202
+ */
203
+ serverVersion: ServerVersion;
204
+
205
+ /**
206
+ * connection collation
207
+ */
208
+ collation: null;
209
+
210
+ /**
211
+ * Server capabilities
212
+ * see https://mariadb.com/kb/en/library/connection/#capabilities
213
+ */
214
+ readonly serverCapabilities: number;
215
+
216
+ /**
217
+ * Indicate when connected if server is a MariaDB or MySQL one
218
+ */
219
+ isMariaDB(): boolean;
220
+
221
+ /**
222
+ * return true if server version > to indicate version
223
+ * @param major server major version
224
+ * @param minor server minor version
225
+ * @param patch server patch version
226
+ */
227
+ hasMinVersion(major: number, minor: number, patch: number): boolean;
228
+ }
229
+
230
+ export interface UserConnectionConfig {
231
+ /**
232
+ * Name of the database to use for this connection
233
+ */
234
+ database?: string;
235
+
236
+ /**
237
+ * When enabled, sends information during connection to server
238
+ * - client name
239
+ * - version
240
+ * - operating system
241
+ * - Node.js version
242
+ *
243
+ * If JSON is set, add JSON key/value to those values.
244
+ *
245
+ * When Performance Schema is enabled, server can display client information on each connection.
246
+ */
247
+ /* eslint-disable @typescript-eslint/no-explicit-any */
248
+ connectAttributes?: any;
249
+ /* eslint-enable @typescript-eslint/no-explicit-any */
250
+
251
+ /**
252
+ * Protocol character set used with the server.
253
+ * Connection collation will be the default collation associated with charset.
254
+ * It's mainly used for micro-optimizations. The default is often sufficient.
255
+ * example 'UTF8MB4', 'CP1250'.
256
+ * (default 'UTF8MB4')
257
+ */
258
+ charset?: string;
259
+
260
+ /**
261
+ * Permit to defined collation used for connection.
262
+ * This will defined the charset encoding used for exchanges with database and defines the order used when
263
+ * comparing strings. It's mainly used for micro-optimizations
264
+ * (Default: 'UTF8MB4_UNICODE_CI')
265
+ */
266
+ collation?: string;
267
+
268
+ /**
269
+ * The MySQL user to authenticate as
270
+ */
271
+ user?: string;
272
+
273
+ /**
274
+ * The password of that MySQL user
275
+ */
276
+ password?: string;
277
+ }
278
+
279
+ export interface UpsertResult {
280
+ affectedRows: number;
281
+ insertId: number | bigint;
282
+ warningStatus: number;
283
+ }
284
+
285
+ export interface SqlError extends Error {
286
+ /**
287
+ * Either a MySQL server error (e.g. 'ER_ACCESS_DENIED_ERROR'),
288
+ * a node.js error (e.g. 'ECONNREFUSED') or an internal error
289
+ * (e.g. 'PROTOCOL_CONNECTION_LOST').
290
+ */
291
+ code: string | null;
292
+
293
+ /**
294
+ * original error message value
295
+ * @deprecated since 3.2.0 prefer using sqlMessage for compatibility with other drivers.
296
+ */
297
+ text: string | null;
298
+
299
+ /**
300
+ * original error message value
301
+ */
302
+ sqlMessage: string | null;
303
+
304
+ /**
305
+ * The sql command associate
306
+ */
307
+ sql: string | null;
308
+
309
+ /**
310
+ * The error number for the error code
311
+ */
312
+ errno: number;
313
+
314
+ /**
315
+ * The sql state
316
+ */
317
+ sqlState?: string | null;
318
+
319
+ /**
320
+ * Boolean, indicating if this error is terminal to the connection object.
321
+ */
322
+ fatal: boolean;
323
+ }
324
+
325
+ interface SqlErrorConstructor extends ErrorConstructor {
326
+ new (
327
+ msg: string,
328
+ sql?: string,
329
+ fatal?: boolean,
330
+ info?: { threadId?: number },
331
+ sqlState?: string | null,
332
+ errno?: number,
333
+ additionalStack?: string,
334
+ addHeader?: boolean,
335
+ cause?: unknown
336
+ ): SqlError;
337
+ readonly prototype: SqlError;
338
+ }
339
+
340
+ declare const SqlError: SqlErrorConstructor;
341
+
342
+ export const enum TypeNumbers {
343
+ DECIMAL = 0,
344
+ TINY = 1,
345
+ SHORT = 2,
346
+ LONG = 3,
347
+ FLOAT = 4,
348
+ DOUBLE = 5,
349
+ NULL = 6,
350
+ TIMESTAMP = 7,
351
+ BIGINT = 8,
352
+ INT24 = 9,
353
+ DATE = 10,
354
+ TIME = 11,
355
+ DATETIME = 12,
356
+ YEAR = 13,
357
+ NEWDATE = 14,
358
+ VARCHAR = 15,
359
+ BIT = 16,
360
+ TIMESTAMP2 = 17,
361
+ DATETIME2 = 18,
362
+ TIME2 = 19,
363
+ JSON = 245, //only for MySQ,
364
+ NEWDECIMAL = 246,
365
+ ENUM = 247,
366
+ SET = 248,
367
+ TINY_BLOB = 249,
368
+ MEDIUM_BLOB = 250,
369
+ LONG_BLOB = 251,
370
+ BLOB = 252,
371
+ VAR_STRING = 253,
372
+ STRING = 254,
373
+ GEOMETRY = 255
374
+ }
375
+
376
+ export const enum Flags {
377
+ //field cannot be null
378
+ NOT_NULL = 1,
379
+ //field is a primary key
380
+ PRIMARY_KEY = 2,
381
+ // the field is unique
382
+ UNIQUE_KEY = 4,
383
+ //field is in a multiple key
384
+ MULTIPLE_KEY = 8,
385
+ //is this field a Blob?
386
+ BLOB = 1 << 4,
387
+ // is this field unsigned?
388
+ UNSIGNED = 1 << 5,
389
+ //is this field a zerofill?
390
+ ZEROFILL_FLAG = 1 << 6,
391
+ //whether this field has a binary collation
392
+ BINARY_COLLATION = 1 << 7,
393
+ //Field is an enumeration
394
+ ENUM = 1 << 8,
395
+ //field auto-increment
396
+ AUTO_INCREMENT = 1 << 9,
397
+ //field is a timestamp value
398
+ TIMESTAMP = 1 << 10,
399
+ //field is a SET
400
+ SET = 1 << 11,
401
+ //field doesn't have default value
402
+ NO_DEFAULT_VALUE_FLAG = 1 << 12,
403
+ //field is set to NOW on UPDATE
404
+ ON_UPDATE_NOW_FLAG = 1 << 13,
405
+ //field is num
406
+ NUM_FLAG = 1 << 14
407
+ }
408
+
409
+ export const enum Types {
410
+ DECIMAL = 'DECIMAL',
411
+ TINY = 'TINY',
412
+ SHORT = 'SHORT',
413
+ LONG = 'LONG',
414
+ FLOAT = 'FLOAT',
415
+ DOUBLE = 'DOUBLE',
416
+ NULL = 'NULL',
417
+ TIMESTAMP = 'TIMESTAMP',
418
+ BIGINT = 'BIGINT',
419
+ INT24 = 'INT24',
420
+ DATE = 'DATE',
421
+ TIME = 'TIME',
422
+ DATETIME = 'DATETIME',
423
+ YEAR = 'YEAR',
424
+ NEWDATE = 'NEWDATE',
425
+ VARCHAR = 'VARCHAR',
426
+ BIT = 'BIT',
427
+ TIMESTAMP2 = 'TIMESTAMP2',
428
+ DATETIME2 = 'DATETIME2',
429
+ TIME2 = 'TIME2',
430
+ JSON = 'JSON',
431
+ NEWDECIMAL = 'NEWDECIMAL',
432
+ ENUM = 'ENUM',
433
+ SET = 'SET',
434
+ TINY_BLOB = 'TINY_BLOB',
435
+ MEDIUM_BLOB = 'MEDIUM_BLOB',
436
+ LONG_BLOB = 'LONG_BLOB',
437
+ BLOB = 'BLOB',
438
+ VAR_STRING = 'VAR_STRING',
439
+ STRING = 'STRING',
440
+ GEOMETRY = 'GEOMETRY'
441
+ }
442
+
443
+ export interface Collation {
444
+ index: number;
445
+ name: string;
446
+ encoding: string;
447
+ maxLength: number;
448
+ fromEncoding(encoding: string): Collation;
449
+ fromIndex(index: number): Collation;
450
+ fromName(name: string): Collation;
451
+ }
452
+
453
+ export interface QueryConfig {
454
+ /**
455
+ * Presents result-sets by table to avoid results with colliding fields.
456
+ * See the query() description for more information.
457
+ */
458
+ nestTables?: boolean | string;
459
+
460
+ /**
461
+ * Allows casting result types.
462
+ */
463
+ typeCast?: TypeCastFunction;
464
+
465
+ /**
466
+ * Return result-sets as array, rather than a JSON object. This is a faster way to get results
467
+ */
468
+ rowsAsArray?: boolean;
469
+
470
+ /**
471
+ * Compatibility option, causes Promise to return an array object,
472
+ * `[rows, metadata]` rather than the rows as JSON objects with a `meta` property.
473
+ * Default to false.
474
+ */
475
+ metaAsArray?: boolean;
476
+
477
+ /**
478
+ * force returning insertId as Number in place of BigInt
479
+ */
480
+ insertIdAsNumber?: boolean;
481
+
482
+ /**
483
+ * Whether to retrieve dates as strings or as Date objects.
484
+ */
485
+ dateStrings?: boolean;
486
+
487
+ /**
488
+ * Forces use of the indicated timezone, rather than the current Node.js timezone.
489
+ * Possible values are Z for UTC, local or ±HH:MM format
490
+ */
491
+ timezone?: string;
492
+
493
+ /**
494
+ * Allows the use of named placeholders.
495
+ */
496
+ namedPlaceholders?: boolean;
497
+
498
+ /**
499
+ * Compatibility option to permit setting multiple value by a JSON object to replace one question mark.
500
+ * key values will replace the question mark with format like key1=val,key2='val2'.
501
+ * Since it doesn't respect the usual prepared statement format that one value is for one question mark,
502
+ * this can lead to incomprehension, even if badly use to possible injection.
503
+ */
504
+ permitSetMultiParamEntries?: boolean;
505
+
506
+ /**
507
+ * disabled bulk command in batch.
508
+ */
509
+ bulk?: boolean;
510
+
511
+ /**
512
+ * Sends queries one by one without waiting on the results of the previous entry.
513
+ * (Default: true)
514
+ */
515
+ pipelining?: boolean;
516
+
517
+ /**
518
+ * Force server version check by explicitly using SELECT VERSION(), not relying on server initial handshake
519
+ * information
520
+ */
521
+ forceVersionCheck?: boolean;
522
+
523
+ /**
524
+ * Allows the use of LOAD DATA INFILE statements.
525
+ * Loading data from a file from the client may be a security issue, as a man-in-the-middle proxy server can change
526
+ * the actual file the server loads. Being able to execute a query on the client gives you access to files on
527
+ * the client.
528
+ * (Default: false)
529
+ */
530
+ permitLocalInfile?: boolean;
531
+
532
+ /**
533
+ * Allows timeout for command execution.
534
+ */
535
+ timeout?: number;
536
+
537
+ /**
538
+ * indicate if JSON fields for MariaDB server 10.5.2+ results in JSON format (or String if disabled)
539
+ */
540
+ autoJsonMap?: boolean;
541
+
542
+ /**
543
+ * Indicate if array are included in parenthesis. This option permit compatibility with version < 2.5
544
+ */
545
+ arrayParenthesis?: boolean;
546
+
547
+ /**
548
+ * indicate to throw an exception if result-set will not contain some data due to having duplicate identifier
549
+ * (Default: true)
550
+ */
551
+ checkDuplicate?: boolean;
552
+
553
+ /**
554
+ * force returning decimal values as Number in place of String
555
+ *
556
+ * Default: false;
557
+ */
558
+ decimalAsNumber?: boolean;
559
+
560
+ /**
561
+ * Force returning BIGINT data as Number in place of BigInt.
562
+ *
563
+ * Default: false;
564
+ */
565
+ bigIntAsNumber?: boolean;
566
+
567
+ /**
568
+ * @deprecated big numbers (BIGINT and DECIMAL columns) will result as string when not in safe number range.
569
+ * now replaced by decimalAsNumber, bigIntAsNumber and checkNumberRange options
570
+ */
571
+ supportBigNumbers?: boolean;
572
+
573
+ /**
574
+ * @deprecated when used with supportBigNumbers, big numbers (BIGINT and DECIMAL columns) will always result as string
575
+ * even if in safe number range.
576
+ * now replaced by decimalAsNumber, bigIntAsNumber and checkNumberRange options
577
+ */
578
+ bigNumberStrings?: boolean;
579
+
580
+ /**
581
+ * Throw if conversion to Number is not safe.
582
+ *
583
+ * Default: false;
584
+ */
585
+ checkNumberRange?: boolean;
586
+
587
+ /**
588
+ * Configure logger
589
+ */
590
+ logger?: LoggerConfig;
591
+
592
+ /**
593
+ * Permit to defined function to call for LOAD LOCAL command, for extra verification like path restriction.
594
+ * @param filepath
595
+ */
596
+ infileStreamFactory?: (filepath: string) => Readable;
597
+ }
598
+
599
+ export interface QueryOptions extends QueryConfig {
600
+ /**
601
+ * SQL command to execute
602
+ */
603
+ sql: string;
604
+ }
605
+
606
+ export interface ConnectionConfig extends UserConnectionConfig, Omit<QueryConfig, 'timeout'> {
607
+ /**
608
+ * The hostname of the database you are connecting to. (Default: localhost)
609
+ */
610
+ host?: string;
611
+
612
+ /**
613
+ * The port number to connect to. (Default: 3306)
614
+ */
615
+ port?: number;
616
+
617
+ /**
618
+ * The path to an unix domain socket to connect to. When used host and port are ignored
619
+ */
620
+ socketPath?: string;
621
+
622
+ /**
623
+ * The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 1000)
624
+ */
625
+ connectTimeout?: number;
626
+
627
+ /**
628
+ * Socket timeout in milliseconds after the connection is established
629
+ */
630
+ socketTimeout?: number;
631
+
632
+ /**
633
+ * Allows timeout for command execution.
634
+ */
635
+ queryTimeout?: number;
636
+
637
+ /**
638
+ * This will print all incoming and outgoing packets on stdout.
639
+ * (Default: false)
640
+ */
641
+ debug?: boolean;
642
+
643
+ /**
644
+ * This will print all incoming and outgoing compressed packets on stdout.
645
+ * (Default: false)
646
+ */
647
+ debugCompress?: boolean;
648
+
649
+ /**
650
+ * When debugging, maximum packet length to write to console.
651
+ * (Default: 256)
652
+ */
653
+ debugLen?: number;
654
+
655
+ /**
656
+ * indicate if parameters must be logged by query logger
657
+ * (Default: false)
658
+ */
659
+ logParam?: boolean;
660
+
661
+ /**
662
+ * Adds the stack trace at the time of query creation to the error stack trace, making it easier to identify the
663
+ * part of the code that issued the query.
664
+ * Note: This feature is disabled by default due to the performance cost of stack creation.
665
+ * Only turn it on when you need to debug issues.
666
+ * (Default: false)
667
+ */
668
+ trace?: boolean;
669
+
670
+ /**
671
+ * Allow multiple mysql statements per query. Be careful with this, it exposes you to SQL injection attacks.
672
+ * (Default: false)
673
+ */
674
+ multipleStatements?: boolean;
675
+
676
+ /**
677
+ * object with ssl parameters or a boolean to enable ssl without setting any other ssl option.
678
+ * see
679
+ * https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/master/documentation/connection-options.md#ssl
680
+ * for more information
681
+ */
682
+ ssl?: boolean | (SecureContextOptions & { rejectUnauthorized?: boolean });
683
+
684
+ /**
685
+ * Compress exchanges using gzip.
686
+ * This can give you better performance when accessing a database in a different location.
687
+ * (Default: false)
688
+ */
689
+ compress?: boolean;
690
+
691
+ /**
692
+ * Debug option: permit to save last exchanged packet.
693
+ * Error messages will display those last exchanged packet.
694
+ *
695
+ * (Default: false)
696
+ */
697
+ logPackets?: boolean;
698
+
699
+ /**
700
+ * Force server version check by explicitly using SELECT VERSION(), not relying on server initial packet.
701
+ * (Default: false)
702
+ */
703
+ forceVersionCheck?: boolean;
704
+
705
+ /**
706
+ * When enabled, the update number corresponds to update rows.
707
+ * When disabled, it indicates the real rows changed.
708
+ */
709
+ foundRows?: boolean;
710
+
711
+ /**
712
+ * When a connection is established, permit executing commands before using connection
713
+ */
714
+ initSql?: string | string[];
715
+
716
+ /**
717
+ * Permit setting session variables when connecting.
718
+ * Example: sessionVariables:{'idle_transaction_timeout':10000}
719
+ */
720
+ /* eslint-disable @typescript-eslint/no-explicit-any */
721
+ sessionVariables?: any;
722
+ /* eslint-enable @typescript-eslint/no-explicit-any */
723
+
724
+ /**
725
+ * permit to indicate server global variable max_allowed_packet value to ensure efficient batching.
726
+ * default is 4Mb. see batch documentation
727
+ */
728
+ maxAllowedPacket?: number;
729
+
730
+ /**
731
+ * permit enabling socket keeping alive, setting delay. 0 means aren't enabled.
732
+ * Keep in mind that this don't reset server
733
+ * [@@wait_timeout](https://mariadb.com/kb/en/library/server-system-variables/#wait_timeout)
734
+ * (use pool option idleTimeout for that).
735
+ * in ms
736
+ * (Default: 0)
737
+ */
738
+ keepAliveDelay?: number;
739
+
740
+ /**
741
+ * Indicate path/content to MySQL server RSA public key.
742
+ * use requires Node.js v11.6+
743
+ */
744
+ rsaPublicKey?: string;
745
+
746
+ /**
747
+ * Indicate path/content to MySQL server caching RSA public key.
748
+ * use requires Node.js v11.6+
749
+ */
750
+ cachingRsaPublicKey?: string;
751
+
752
+ /**
753
+ * Indicate that if `rsaPublicKey` or `cachingRsaPublicKey` public key are not provided, if client can ask server
754
+ * to send public key.
755
+ * default: false
756
+ */
757
+ allowPublicKeyRetrieval?: boolean;
758
+
759
+ /**
760
+ * force returning insertId as Number in place of BigInt
761
+ *
762
+ * Default: false;
763
+ */
764
+ insertIdAsNumber?: boolean;
765
+
766
+ /**
767
+ * Indicate prepare cache size when using a prepared statement
768
+ *
769
+ * default to 256.
770
+ */
771
+ prepareCacheLength?: number;
772
+
773
+ /**
774
+ * Permit setting stream.
775
+ *
776
+ * @param err error is any error occurs during stream creation
777
+ * @param stream if wanting to set a special stream (Standard socket will be created if not set)
778
+ */
779
+ stream?: (callback?: typeof StreamCallback) => void;
780
+
781
+ /**
782
+ * make result-set metadata property enumerable.
783
+ * Default to false.
784
+ */
785
+ metaEnumerable?: boolean;
786
+
787
+ /**
788
+ * Compatibility option, causes Promise to return an array object,
789
+ * `[rows, metadata]` rather than the rows as JSON objects with a `meta` property.
790
+ * Default to false.
791
+ */
792
+ metaAsArray?: boolean;
793
+
794
+ /**
795
+ * Return result-sets as array, rather than a JSON object. This is a faster way to get results
796
+ */
797
+ rowsAsArray?: boolean;
798
+
799
+ /**
800
+ * Permit to defined function calling for LOAD LOCAL command, for extra verification like path restriction.
801
+ * @param filepath
802
+ */
803
+ infileStreamFactory?: (filepath: string) => Readable;
804
+ }