@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
@@ -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;