@tachybase/module-multi-app 1.5.1 → 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
@@ -1,30 +1,34 @@
1
+ // SPDX-License-Identifier: LGPL-2.1-or-later
2
+ // Copyright (c) 2015-2024 MariaDB Corporation Ab
3
+
1
4
  'use strict';
2
5
 
3
6
  const Command = require('./command');
4
- const Errors = require('../misc/errors');
7
+ const ServerStatus = require('../const/server-status');
8
+
9
+ const PING_COMMAND = new Uint8Array([1, 0, 0, 0, 0x0e]);
5
10
 
6
11
  /**
7
12
  * send a COM_PING: permits sending a packet containing one byte to check that the connection is active.
8
13
  * see https://mariadb.com/kb/en/library/com_ping/
9
14
  */
10
15
  class Ping extends Command {
11
- constructor(resolve, reject) {
12
- super(resolve, reject);
16
+ constructor(cmdParam, resolve, reject) {
17
+ super(cmdParam, resolve, reject);
13
18
  }
14
19
 
15
20
  start(out, opts, info) {
16
- out.startPacket(this);
17
- out.writeInt8(0x0e);
18
- out.flushBuffer(true);
19
- this.emit('send_end');
21
+ if (opts.logger.query) opts.logger.query('PING');
20
22
  this.onPacketReceive = this.readPingResponsePacket;
23
+ out.fastFlush(this, PING_COMMAND);
24
+ this.emit('send_end');
21
25
  }
22
26
 
23
27
  /**
24
28
  * Read ping response packet.
25
29
  * packet can be :
26
30
  * - an ERR_Packet
27
- * - a OK_Packet
31
+ * - an OK_Packet
28
32
  *
29
33
  * @param packet query response
30
34
  * @param out output writer
@@ -32,20 +36,15 @@ class Ping extends Command {
32
36
  * @param info connection info
33
37
  */
34
38
  readPingResponsePacket(packet, out, opts, info) {
35
- if (packet.peek() !== 0x00) {
36
- return this.throwNewError(
37
- 'unexpected packet',
38
- false,
39
- info,
40
- '42000',
41
- Errors.ER_PING_BAD_PACKET
42
- );
43
- }
44
39
  packet.skip(1); //skip header
45
40
  packet.skipLengthCodedNumber(); //affected rows
46
41
  packet.skipLengthCodedNumber(); //insert ids
47
42
  info.status = packet.readUInt16();
48
- this.successEnd(null);
43
+ if (info.redirectRequest && (info.status & ServerStatus.STATUS_IN_TRANS) === 0) {
44
+ info.redirect(info.redirectRequest, this.successEnd.bind(this, null));
45
+ } else {
46
+ this.successEnd(null);
47
+ }
49
48
  }
50
49
  }
51
50
 
@@ -0,0 +1,170 @@
1
+ // SPDX-License-Identifier: LGPL-2.1-or-later
2
+ // Copyright (c) 2015-2024 MariaDB Corporation Ab
3
+
4
+ 'use strict';
5
+ const Parser = require('./parser');
6
+ const Parse = require('../misc/parse');
7
+ const BinaryEncoder = require('./encoder/binary-encoder');
8
+ const PrepareCacheWrapper = require('./class/prepare-cache-wrapper');
9
+ const PrepareResult = require('./class/prepare-result-packet');
10
+ const ServerStatus = require('../const/server-status');
11
+ const Errors = require('../misc/errors');
12
+ const ColumnDefinition = require('./column-definition');
13
+
14
+ /**
15
+ * send a COM_STMT_PREPARE: permits sending a prepare packet
16
+ * see https://mariadb.com/kb/en/com_stmt_prepare/
17
+ */
18
+ class Prepare extends Parser {
19
+ constructor(resolve, reject, connOpts, cmdParam, conn) {
20
+ super(resolve, reject, connOpts, cmdParam);
21
+ this.encoder = new BinaryEncoder(this.opts);
22
+ this.binary = true;
23
+ this.conn = conn;
24
+ this.executeCommand = cmdParam.executeCommand;
25
+ }
26
+
27
+ /**
28
+ * Send COM_STMT_PREPARE
29
+ *
30
+ * @param out output writer
31
+ * @param opts connection options
32
+ * @param info connection information
33
+ */
34
+ start(out, opts, info) {
35
+ // check in cache if enabled
36
+ if (this.conn.prepareCache) {
37
+ let cachedPrepare = this.conn.prepareCache.get(this.sql);
38
+ if (cachedPrepare) {
39
+ this.emit('send_end');
40
+ return this.successEnd(cachedPrepare);
41
+ }
42
+ }
43
+ if (opts.logger.query) opts.logger.query(`PREPARE: ${this.sql}`);
44
+ this.onPacketReceive = this.readPrepareResultPacket;
45
+
46
+ if (this.opts.namedPlaceholders) {
47
+ const res = Parse.searchPlaceholder(this.sql);
48
+ this.sql = res.sql;
49
+ this.placeHolderIndex = res.placeHolderIndex;
50
+ }
51
+
52
+ out.startPacket(this);
53
+ out.writeInt8(0x16);
54
+ out.writeString(this.sql);
55
+ out.flush();
56
+ this.emit('send_end');
57
+ }
58
+
59
+ successPrepare(info, opts) {
60
+ let prepare = new PrepareResult(
61
+ this.statementId,
62
+ this.parameterCount,
63
+ this._columns,
64
+ info.database,
65
+ this.sql,
66
+ this.placeHolderIndex,
67
+ this.conn
68
+ );
69
+
70
+ if (this.conn.prepareCache) {
71
+ let cached = new PrepareCacheWrapper(prepare);
72
+ this.conn.prepareCache.set(this.sql, cached);
73
+ const cachedWrappedPrepared = cached.incrementUse();
74
+ if (this.executeCommand) this.executeCommand.prepare = cachedWrappedPrepared;
75
+ return this.successEnd(cachedWrappedPrepared);
76
+ }
77
+ if (this.executeCommand) this.executeCommand.prepare = prepare;
78
+ this.successEnd(prepare);
79
+ }
80
+
81
+ /**
82
+ * Read COM_STMT_PREPARE response Packet.
83
+ * see https://mariadb.com/kb/en/library/com_stmt_prepare/#com_stmt_prepare-response
84
+ *
85
+ * @param packet COM_STMT_PREPARE_OK packet
86
+ * @param opts connection options
87
+ * @param info connection information
88
+ * @param out output writer
89
+ * @returns {*} null or {Result.readResponsePacket} in case of multi-result-set
90
+ */
91
+ readPrepareResultPacket(packet, out, opts, info) {
92
+ switch (packet.peek()) {
93
+ //*********************************************************************************************************
94
+ //* PREPARE response
95
+ //*********************************************************************************************************
96
+ case 0x00:
97
+ packet.skip(1); //skip header
98
+ this.statementId = packet.readInt32();
99
+ this.columnNo = packet.readUInt16();
100
+ this.parameterCount = packet.readUInt16();
101
+ this._parameterNo = this.parameterCount;
102
+ this._columns = [];
103
+ if (this._parameterNo > 0) return (this.onPacketReceive = this.skipPrepareParameterPacket);
104
+ if (this.columnNo > 0) return (this.onPacketReceive = this.readPrepareColumnsPacket);
105
+ return this.successPrepare(info, opts);
106
+
107
+ //*********************************************************************************************************
108
+ //* ERROR response
109
+ //*********************************************************************************************************
110
+ case 0xff:
111
+ const err = packet.readError(info, this.displaySql(), this.stack);
112
+ //force in transaction status, since query will have created a transaction if autocommit is off
113
+ //goal is to avoid unnecessary COMMIT/ROLLBACK.
114
+ info.status |= ServerStatus.STATUS_IN_TRANS;
115
+ this.onPacketReceive = this.readResponsePacket;
116
+ return this.throwError(err, info);
117
+
118
+ //*********************************************************************************************************
119
+ //* Unexpected response
120
+ //*********************************************************************************************************
121
+ default:
122
+ info.status |= ServerStatus.STATUS_IN_TRANS;
123
+ this.onPacketReceive = this.readResponsePacket;
124
+ return this.throwError(Errors.ER_UNEXPECTED_PACKET, info);
125
+ }
126
+ }
127
+
128
+ readPrepareColumnsPacket(packet, out, opts, info) {
129
+ this.columnNo--;
130
+ this._columns.push(new ColumnDefinition(packet, info, opts.rowsAsArray));
131
+ if (this.columnNo === 0) {
132
+ if (info.eofDeprecated) {
133
+ return this.successPrepare(info, opts);
134
+ }
135
+ this.onPacketReceive = this.skipEofPacket;
136
+ }
137
+ }
138
+
139
+ skipEofPacket(packet, out, opts, info) {
140
+ if (this.columnNo > 0) return (this.onPacketReceive = this.readPrepareColumnsPacket);
141
+ this.successPrepare(info, opts);
142
+ }
143
+
144
+ skipPrepareParameterPacket(packet, out, opts, info) {
145
+ this._parameterNo--;
146
+ if (this._parameterNo === 0) {
147
+ if (info.eofDeprecated) {
148
+ if (this.columnNo > 0) return (this.onPacketReceive = this.readPrepareColumnsPacket);
149
+ return this.successPrepare(info, opts);
150
+ }
151
+ this.onPacketReceive = this.skipEofPacket;
152
+ }
153
+ }
154
+
155
+ /**
156
+ * Display current SQL with parameters (truncated if too big)
157
+ *
158
+ * @returns {string}
159
+ */
160
+ displaySql() {
161
+ if (this.opts) {
162
+ if (this.sql.length > this.opts.debugLen) {
163
+ return this.sql.substring(0, this.opts.debugLen) + '...';
164
+ }
165
+ }
166
+ return this.sql;
167
+ }
168
+ }
169
+
170
+ module.exports = Prepare;