@tachybase/module-multi-app 1.6.0 → 1.6.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 (94) hide show
  1. package/dist/externalVersion.js +5 -5
  2. package/dist/node_modules/mariadb/callback.js +43 -8
  3. package/dist/node_modules/mariadb/check-node.js +30 -0
  4. package/dist/node_modules/mariadb/lib/cluster-callback.js +84 -0
  5. package/dist/node_modules/mariadb/lib/cluster.js +446 -0
  6. package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +576 -177
  7. package/dist/node_modules/mariadb/lib/cmd/change-user.js +54 -44
  8. package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +3 -2
  9. package/dist/node_modules/mariadb/lib/cmd/class/prepare-cache-wrapper.js +46 -0
  10. package/dist/node_modules/mariadb/lib/cmd/class/prepare-result-packet.js +141 -0
  11. package/dist/node_modules/mariadb/lib/cmd/class/prepare-wrapper.js +70 -0
  12. package/dist/node_modules/mariadb/lib/cmd/close-prepare.js +38 -0
  13. package/dist/node_modules/mariadb/lib/cmd/column-definition.js +145 -47
  14. package/dist/node_modules/mariadb/lib/cmd/command.js +41 -75
  15. package/dist/node_modules/mariadb/lib/cmd/decoder/binary-decoder.js +282 -0
  16. package/dist/node_modules/mariadb/lib/cmd/decoder/text-decoder.js +210 -0
  17. package/dist/node_modules/mariadb/lib/cmd/{common-binary-cmd.js → encoder/binary-encoder.js} +34 -77
  18. package/dist/node_modules/mariadb/lib/cmd/encoder/text-encoder.js +311 -0
  19. package/dist/node_modules/mariadb/lib/cmd/execute-stream.js +61 -0
  20. package/dist/node_modules/mariadb/lib/cmd/execute.js +338 -0
  21. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +25 -62
  22. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +39 -6
  23. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +48 -16
  24. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/handshake.js +198 -0
  25. package/dist/node_modules/mariadb/lib/cmd/handshake/{initial-handshake.js → auth/initial-handshake.js} +10 -8
  26. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +22 -9
  27. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +9 -4
  28. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/parsec-auth.js +115 -0
  29. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +12 -5
  30. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +44 -33
  31. package/dist/node_modules/mariadb/lib/cmd/handshake/authentication.js +335 -0
  32. package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +20 -19
  33. package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +6 -3
  34. package/dist/node_modules/mariadb/lib/cmd/parser.js +861 -0
  35. package/dist/node_modules/mariadb/lib/cmd/ping.js +17 -18
  36. package/dist/node_modules/mariadb/lib/cmd/prepare.js +170 -0
  37. package/dist/node_modules/mariadb/lib/cmd/query.js +281 -144
  38. package/dist/node_modules/mariadb/lib/cmd/quit.js +9 -6
  39. package/dist/node_modules/mariadb/lib/cmd/reset.js +15 -19
  40. package/dist/node_modules/mariadb/lib/cmd/stream.js +21 -6
  41. package/dist/node_modules/mariadb/lib/config/cluster-options.js +23 -0
  42. package/dist/node_modules/mariadb/lib/config/connection-options.js +196 -132
  43. package/dist/node_modules/mariadb/lib/config/pool-options.js +27 -19
  44. package/dist/node_modules/mariadb/lib/connection-callback.js +492 -120
  45. package/dist/node_modules/mariadb/lib/connection-promise.js +372 -0
  46. package/dist/node_modules/mariadb/lib/connection.js +1739 -1016
  47. package/dist/node_modules/mariadb/lib/const/capabilities.js +36 -30
  48. package/dist/node_modules/mariadb/lib/const/collations.js +972 -36
  49. package/dist/node_modules/mariadb/lib/const/connection_status.js +3 -0
  50. package/dist/node_modules/mariadb/lib/const/error-code.js +35 -11
  51. package/dist/node_modules/mariadb/lib/const/field-detail.js +3 -0
  52. package/dist/node_modules/mariadb/lib/const/field-type.js +7 -4
  53. package/dist/node_modules/mariadb/lib/const/server-status.js +4 -1
  54. package/dist/node_modules/mariadb/lib/const/state-change.js +3 -0
  55. package/dist/node_modules/mariadb/lib/filtered-cluster-callback.js +136 -0
  56. package/dist/node_modules/mariadb/lib/filtered-cluster.js +118 -0
  57. package/dist/node_modules/mariadb/lib/io/compression-input-stream.js +14 -13
  58. package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +21 -18
  59. package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +75 -64
  60. package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +13 -9
  61. package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +12 -10
  62. package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +402 -134
  63. package/dist/node_modules/mariadb/lib/io/packet.js +287 -202
  64. package/dist/node_modules/mariadb/lib/lru-prepare-cache.js +84 -0
  65. package/dist/node_modules/mariadb/lib/misc/connection-information.js +15 -32
  66. package/dist/node_modules/mariadb/lib/misc/errors.js +68 -25
  67. package/dist/node_modules/mariadb/lib/misc/parse.js +207 -711
  68. package/dist/node_modules/mariadb/lib/misc/utils.js +34 -62
  69. package/dist/node_modules/mariadb/lib/pool-callback.js +213 -174
  70. package/dist/node_modules/mariadb/lib/pool-promise.js +228 -94
  71. package/dist/node_modules/mariadb/lib/pool.js +951 -0
  72. package/dist/node_modules/mariadb/package.json +1 -1
  73. package/dist/node_modules/mariadb/promise.js +1 -34
  74. package/dist/node_modules/mariadb/types/callback.d.ts +207 -0
  75. package/dist/node_modules/mariadb/types/index.d.ts +94 -674
  76. package/dist/node_modules/mariadb/types/share.d.ts +804 -0
  77. package/dist/node_modules/qs/package.json +1 -1
  78. package/dist/server/actions/apps.js +2 -2
  79. package/dist/server/app-lifecycle.d.ts +1 -1
  80. package/dist/server/app-lifecycle.js +4 -4
  81. package/dist/server/models/application.d.ts +1 -1
  82. package/package.json +7 -7
  83. package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +0 -372
  84. package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +0 -427
  85. package/dist/node_modules/mariadb/lib/cmd/handshake/client-handshake-response.js +0 -126
  86. package/dist/node_modules/mariadb/lib/cmd/handshake/handshake.js +0 -292
  87. package/dist/node_modules/mariadb/lib/cmd/resultset.js +0 -607
  88. package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +0 -19
  89. package/dist/node_modules/mariadb/lib/filtered-pool-cluster.js +0 -81
  90. package/dist/node_modules/mariadb/lib/io/bulk-packet.js +0 -590
  91. package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +0 -481
  92. package/dist/node_modules/mariadb/lib/pool-base.js +0 -611
  93. package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +0 -66
  94. package/dist/node_modules/mariadb/lib/pool-cluster.js +0 -407
@@ -0,0 +1,372 @@
1
+ // SPDX-License-Identifier: LGPL-2.1-or-later
2
+ // Copyright (c) 2015-2025 MariaDB Corporation Ab
3
+
4
+ 'use strict';
5
+
6
+ const Stream = require('./cmd/stream');
7
+ const Errors = require('./misc/errors');
8
+
9
+ /**
10
+ * New Connection instance.
11
+ *
12
+ * @param options connection options
13
+ * @returns Connection instance
14
+ * @constructor
15
+ * @fires Connection#connect
16
+ * @fires Connection#end
17
+ * @fires Connection#error
18
+ *
19
+ */
20
+ class ConnectionPromise {
21
+ #conn;
22
+ #capture;
23
+
24
+ constructor(conn) {
25
+ this.#conn = conn;
26
+ this.#capture = conn.opts.trace ? Error.captureStackTrace : () => {};
27
+ }
28
+
29
+ get threadId() {
30
+ return this.#conn.threadId;
31
+ }
32
+
33
+ get info() {
34
+ return this.#conn.info;
35
+ }
36
+
37
+ get prepareCache() {
38
+ return this.#conn.prepareCache;
39
+ }
40
+
41
+ /**
42
+ * Permit to change user during connection.
43
+ * All user variables will be reset, Prepare commands will be released.
44
+ * !!! mysql has a bug when CONNECT_ATTRS capability is set, that is default !!!!
45
+ *
46
+ * @param options connection options
47
+ * @returns {Promise} promise
48
+ */
49
+ changeUser(options) {
50
+ const param = { opts: options };
51
+ this.#capture(param);
52
+ return new Promise(this.#conn.changeUser.bind(this.#conn, param));
53
+ }
54
+
55
+ /**
56
+ * Start transaction
57
+ *
58
+ * @returns {Promise} promise
59
+ */
60
+ beginTransaction() {
61
+ const param = { sql: 'START TRANSACTION' };
62
+ this.#capture(param);
63
+ return new Promise(this.#conn.query.bind(this.#conn, param));
64
+ }
65
+
66
+ /**
67
+ * Commit a transaction.
68
+ *
69
+ * @returns {Promise} command if commit was needed only
70
+ */
71
+ commit() {
72
+ const param = { sql: 'COMMIT' };
73
+ this.#capture(param);
74
+ return new Promise(this.#conn.changeTransaction.bind(this.#conn, param));
75
+ }
76
+
77
+ /**
78
+ * Roll back a transaction.
79
+ *
80
+ * @returns {Promise} promise
81
+ */
82
+ rollback() {
83
+ const param = { sql: 'ROLLBACK' };
84
+ this.#capture(param);
85
+ return new Promise(this.#conn.changeTransaction.bind(this.#conn, param));
86
+ }
87
+
88
+ /**
89
+ * Execute query using text protocol.
90
+ *
91
+ * @param sql sql parameter Object can be used to supersede default option.
92
+ * Object must then have sql property.
93
+ * @param values object / array of placeholder values (not mandatory)
94
+ * @returns {Promise} promise
95
+ */
96
+ query(sql, values) {
97
+ const cmdParam = paramSetter(sql, values);
98
+ this.#capture(cmdParam);
99
+ return new Promise(this.#conn.query.bind(this.#conn, cmdParam));
100
+ }
101
+
102
+ /**
103
+ * Execute a query returning a Readable Object that will emit columns/data/end/error events
104
+ * to permit streaming big result-set
105
+ *
106
+ * @param sql sql parameter Object can be used to supersede the default option.
107
+ * Object must then have `sql` property.
108
+ * @param values object / array of placeholder values (not mandatory)
109
+ * @returns {Readable}
110
+ */
111
+ queryStream(sql, values) {
112
+ const cmdParam = paramSetter(sql, values);
113
+ this.#capture(cmdParam);
114
+ const cmd = new Stream(cmdParam, this.#conn.opts, this.#conn.socket);
115
+ if (this.#conn.opts.logger.error) cmd.on('error', this.#conn.opts.logger.error);
116
+ this.#conn.addCommand(cmd, true);
117
+ return cmd.inStream;
118
+ }
119
+
120
+ static _PARAM_DEF(sql, values) {
121
+ if (typeof sql === 'object') {
122
+ return { sql: sql.sql, values: sql.values ? sql.values : values, opts: sql };
123
+ } else return { sql: sql, values: values };
124
+ }
125
+
126
+ execute(sql, values) {
127
+ const cmdParam = paramSetter(sql, values);
128
+ this.#capture(cmdParam);
129
+ return new Promise(this.#conn.prepareExecute.bind(this.#conn, cmdParam));
130
+ }
131
+
132
+ static _EXECUTE_CMD(conn, cmdParam) {
133
+ return conn.prepareExecute(cmdParam);
134
+ }
135
+
136
+ prepare(sql) {
137
+ let param;
138
+ if (typeof sql === 'object') {
139
+ param = { sql: sql.sql, opts: sql };
140
+ } else {
141
+ param = { sql: sql };
142
+ }
143
+ this.#capture(param);
144
+ return new Promise(this.#conn.prepare.bind(this.#conn, param));
145
+ }
146
+
147
+ /**
148
+ * Execute batch using text protocol.
149
+ *
150
+ * @param sql sql parameter Object can be used to supersede default option.
151
+ * Object must then have sql property.
152
+ * @param values object / array of placeholder values
153
+ * @returns {Promise} promise
154
+ */
155
+ batch(sql, values) {
156
+ const cmdParam = paramSetter(sql, values);
157
+ this.#capture(cmdParam);
158
+ return new Promise(this.#conn.batch.bind(this.#conn, cmdParam));
159
+ }
160
+
161
+ /**
162
+ * Import sql file.
163
+ *
164
+ * @param opts JSON array with 2 possible fields: file and database
165
+ */
166
+ importFile(opts) {
167
+ if (!opts || !opts.file) {
168
+ return Promise.reject(
169
+ Errors.createError(
170
+ 'SQL file parameter is mandatory',
171
+ Errors.ER_MISSING_SQL_PARAMETER,
172
+ this.#conn.info,
173
+ 'HY000',
174
+ null,
175
+ false,
176
+ null
177
+ )
178
+ );
179
+ }
180
+ return new Promise(this.#conn.importFile.bind(this.#conn, { file: opts.file, database: opts.database }));
181
+ }
182
+
183
+ /**
184
+ * Send an empty MySQL packet to ensure connection is active, and reset @@wait_timeout
185
+ * @param timeout (optional) timeout value in ms. If reached, throw error and close connection
186
+ * @returns {Promise} promise
187
+ */
188
+ ping(timeout) {
189
+ const cmdParam = {
190
+ opts: { timeout: timeout }
191
+ };
192
+ this.#capture(cmdParam);
193
+ return new Promise(this.#conn.ping.bind(this.#conn, cmdParam));
194
+ }
195
+
196
+ /**
197
+ * Send a reset command that will
198
+ * - rollback any open transaction
199
+ * - reset transaction isolation level
200
+ * - reset session variables
201
+ * - delete user variables
202
+ * - remove temporary tables
203
+ * - remove all PREPARE statement
204
+ *
205
+ * @returns {Promise} promise
206
+ */
207
+ reset() {
208
+ const cmdParam = {};
209
+ this.#capture(cmdParam);
210
+ return new Promise(this.#conn.reset.bind(this.#conn, cmdParam));
211
+ }
212
+
213
+ /**
214
+ * Indicates the state of the connection as the driver knows it
215
+ * @returns {boolean}
216
+ */
217
+ isValid() {
218
+ return this.#conn.isValid();
219
+ }
220
+
221
+ /**
222
+ * Terminate connection gracefully.
223
+ *
224
+ * @returns {Promise} promise
225
+ */
226
+ end() {
227
+ const cmdParam = {};
228
+ this.#capture(cmdParam);
229
+ return new Promise(this.#conn.end.bind(this.#conn, cmdParam));
230
+ }
231
+
232
+ /**
233
+ * Alias for destroy.
234
+ */
235
+ close() {
236
+ this.destroy();
237
+ }
238
+
239
+ /**
240
+ * Force connection termination by closing the underlying socket and killing server process if any.
241
+ */
242
+ destroy() {
243
+ this.#conn.destroy();
244
+ }
245
+
246
+ pause() {
247
+ this.#conn.pause();
248
+ }
249
+
250
+ resume() {
251
+ this.#conn.resume();
252
+ }
253
+
254
+ format(sql, values) {
255
+ this.#conn.format(sql, values);
256
+ }
257
+
258
+ /**
259
+ * return current connected server version information.
260
+ *
261
+ * @returns {*}
262
+ */
263
+ serverVersion() {
264
+ return this.#conn.serverVersion();
265
+ }
266
+
267
+ /**
268
+ * Change option "debug" during connection.
269
+ * @param val debug value
270
+ */
271
+ debug(val) {
272
+ return this.#conn.debug(val);
273
+ }
274
+
275
+ debugCompress(val) {
276
+ return this.#conn.debugCompress(val);
277
+ }
278
+
279
+ escape(val) {
280
+ return this.#conn.escape(val);
281
+ }
282
+
283
+ escapeId(val) {
284
+ return this.#conn.escapeId(val);
285
+ }
286
+
287
+ //*****************************************************************
288
+ // EventEmitter proxy methods
289
+ //*****************************************************************
290
+
291
+ on(eventName, listener) {
292
+ this.#conn.on.call(this.#conn, eventName, listener);
293
+ return this;
294
+ }
295
+
296
+ off(eventName, listener) {
297
+ this.#conn.off.call(this.#conn, eventName, listener);
298
+ return this;
299
+ }
300
+
301
+ once(eventName, listener) {
302
+ this.#conn.once.call(this.#conn, eventName, listener);
303
+ return this;
304
+ }
305
+
306
+ listeners(eventName) {
307
+ return this.#conn.listeners.call(this.#conn, eventName);
308
+ }
309
+
310
+ addListener(eventName, listener) {
311
+ this.#conn.addListener.call(this.#conn, eventName, listener);
312
+ return this;
313
+ }
314
+
315
+ eventNames() {
316
+ return this.#conn.eventNames.call(this.#conn);
317
+ }
318
+
319
+ getMaxListeners() {
320
+ return this.#conn.getMaxListeners.call(this.#conn);
321
+ }
322
+
323
+ listenerCount(eventName, listener) {
324
+ return this.#conn.listenerCount.call(this.#conn, eventName, listener);
325
+ }
326
+
327
+ prependListener(eventName, listener) {
328
+ this.#conn.prependListener.call(this.#conn, eventName, listener);
329
+ return this;
330
+ }
331
+
332
+ prependOnceListener(eventName, listener) {
333
+ this.#conn.prependOnceListener.call(this.#conn, eventName, listener);
334
+ return this;
335
+ }
336
+
337
+ removeAllListeners(eventName, listener) {
338
+ this.#conn.removeAllListeners.call(this.#conn, eventName, listener);
339
+ return this;
340
+ }
341
+
342
+ removeListener(eventName, listener) {
343
+ this.#conn.removeListener.call(this.#conn, eventName, listener);
344
+ return this;
345
+ }
346
+
347
+ setMaxListeners(n) {
348
+ this.#conn.setMaxListeners.call(this.#conn, n);
349
+ return this;
350
+ }
351
+
352
+ rawListeners(eventName) {
353
+ return this.#conn.rawListeners.call(this.#conn, eventName);
354
+ }
355
+
356
+ //*****************************************************************
357
+ // internal public testing methods
358
+ //*****************************************************************
359
+
360
+ get __tests() {
361
+ return this.#conn.__tests;
362
+ }
363
+ }
364
+
365
+ const paramSetter = function (sql, values) {
366
+ if (typeof sql === 'object') {
367
+ return { sql: sql.sql, values: sql.values ? sql.values : values, opts: sql };
368
+ } else return { sql: sql, values: values };
369
+ };
370
+
371
+ module.exports = ConnectionPromise;
372
+ module.exports.paramSetter = paramSetter;