@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
@@ -1,8 +1,11 @@
1
+ // SPDX-License-Identifier: LGPL-2.1-or-later
2
+ // Copyright (c) 2015-2025 MariaDB Corporation Ab
3
+
1
4
  'use strict';
2
5
 
3
6
  const PacketNodeEncoded = require('./packet-node-encoded');
4
7
  const PacketIconvEncoded = require('./packet-node-iconv');
5
-
8
+ const Collations = require('../const/collations');
6
9
  const Utils = require('../misc/utils');
7
10
 
8
11
  /**
@@ -25,63 +28,39 @@ class PacketInputStream {
25
28
 
26
29
  this.parts = null;
27
30
  this.partsTotalLen = 0;
28
- this.changeEncoding(this.opts.collation);
29
- this.changeDebug(this.opts.logPackets, this.opts.debug);
31
+ this.changeEncoding(this.opts.collation ? this.opts.collation : Collations.fromIndex(224));
32
+ this.changeDebug(this.opts.debug);
30
33
  this.opts.on('collation', this.changeEncoding.bind(this));
31
34
  this.opts.on('debug', this.changeDebug.bind(this));
32
35
  }
33
36
 
34
37
  changeEncoding(collation) {
35
38
  this.encoding = collation.charset;
36
- this.packetConstructor = Buffer.isEncoding(this.encoding)
37
- ? PacketNodeEncoded
38
- : PacketIconvEncoded;
39
+ this.packet = Buffer.isEncoding(this.encoding)
40
+ ? new PacketNodeEncoded(this.encoding)
41
+ : new PacketIconvEncoded(this.encoding);
39
42
  }
40
43
 
41
- changeDebug(logPackets, debug) {
42
- this.logPackets = logPackets;
43
- this.debug = debug;
44
- this.receivePacket =
45
- this.logPackets || this.debug ? this.receivePacketDebug : this.receivePacketBasic;
44
+ changeDebug(debug) {
45
+ this.receivePacket = debug ? this.receivePacketDebug : this.receivePacketBasic;
46
46
  }
47
47
 
48
48
  receivePacketDebug(packet) {
49
49
  let cmd = this.currentCmd();
50
-
50
+ this.header[0] = this.packetLen;
51
+ this.header[1] = this.packetLen >> 8;
52
+ this.header[2] = this.packetLen >> 16;
53
+ this.header[3] = this.sequenceNo;
51
54
  if (packet) {
52
- const packetStr = Utils.log(this.opts, packet.buf, packet.pos, packet.end, this.header);
53
- if (this.opts.logPackets) {
54
- this.info.addPacket(
55
- '<== conn:' +
56
- (this.info.threadId ? this.info.threadId : -1) +
57
- ' ' +
58
- (cmd
59
- ? cmd.onPacketReceive
60
- ? cmd.constructor.name + '.' + cmd.onPacketReceive.name
61
- : cmd.constructor.name
62
- : 'no command') +
63
- ' (' +
64
- packet.pos +
65
- ',' +
66
- packet.end +
67
- '))\n' +
68
- packetStr
69
- );
70
- }
71
- if (this.opts.debug) {
72
- console.log(
73
- '<== conn:%d %s (%d,%d)\n%s',
74
- this.info.threadId ? this.info.threadId : -1,
55
+ this.opts.logger.network(
56
+ `<== conn:${this.info.threadId ? this.info.threadId : -1} ${
75
57
  cmd
76
58
  ? cmd.onPacketReceive
77
59
  ? cmd.constructor.name + '.' + cmd.onPacketReceive.name
78
60
  : cmd.constructor.name
79
- : 'no command',
80
- packet.pos,
81
- packet.end,
82
- packetStr
83
- );
84
- }
61
+ : 'no command'
62
+ } (${packet.pos},${packet.end})\n${Utils.log(this.opts, packet.buf, packet.pos, packet.end, this.header)}`
63
+ );
85
64
  }
86
65
 
87
66
  if (!cmd) {
@@ -89,9 +68,11 @@ class PacketInputStream {
89
68
  return;
90
69
  }
91
70
 
92
- cmd.sequenceNo = this.header[3];
71
+ cmd.sequenceNo = this.sequenceNo;
93
72
  cmd.onPacketReceive(packet, this.out, this.opts, this.info);
94
- if (!cmd.onPacketReceive) this.receiveQueue.shift();
73
+ if (!cmd.onPacketReceive) {
74
+ this.receiveQueue.shift();
75
+ }
95
76
  }
96
77
 
97
78
  receivePacketBasic(packet) {
@@ -100,7 +81,7 @@ class PacketInputStream {
100
81
  this.unexpectedPacket(packet);
101
82
  return;
102
83
  }
103
- cmd.sequenceNo = this.header[3];
84
+ cmd.sequenceNo = this.sequenceNo;
104
85
  cmd.onPacketReceive(packet, this.out, this.opts, this.info);
105
86
  if (!cmd.onPacketReceive) this.receiveQueue.shift();
106
87
  }
@@ -129,13 +110,9 @@ class PacketInputStream {
129
110
  if (this.remainingLen) {
130
111
  length = this.remainingLen;
131
112
  } else if (this.headerLen === 0 && chunkLen - pos >= 4) {
132
- this.header[0] = chunk[pos];
133
- this.header[1] = chunk[pos + 1];
134
- this.header[2] = chunk[pos + 2];
135
- this.header[3] = chunk[pos + 3];
113
+ this.packetLen = chunk[pos] + (chunk[pos + 1] << 8) + (chunk[pos + 2] << 16);
114
+ this.sequenceNo = chunk[pos + 3];
136
115
  pos += 4;
137
- this.headerLen = 4;
138
- this.packetLen = this.header[0] + (this.header[1] << 8) + (this.header[2] << 16);
139
116
  length = this.packetLen;
140
117
  } else {
141
118
  length = null;
@@ -143,6 +120,7 @@ class PacketInputStream {
143
120
  this.header[this.headerLen++] = chunk[pos++];
144
121
  if (this.headerLen === 4) {
145
122
  this.packetLen = this.header[0] + (this.header[1] << 8) + (this.header[2] << 16);
123
+ this.sequenceNo = this.header[3];
146
124
  length = this.packetLen;
147
125
  break;
148
126
  }
@@ -151,30 +129,55 @@ class PacketInputStream {
151
129
 
152
130
  if (length) {
153
131
  if (chunkLen - pos >= length) {
154
- const buf = chunk.slice(pos, pos + length);
155
132
  pos += length;
156
- if (this.parts) {
157
- this.parts.push(buf);
133
+ if (!this.parts) {
134
+ if (this.packetLen < 0xffffff) {
135
+ this.receivePacket(this.packet.update(chunk, pos - length, pos));
136
+ // fast path, knowing there is no parts
137
+ // loop can be simplified until reaching the end of the packet.
138
+ while (pos + 4 < chunkLen) {
139
+ this.packetLen = chunk[pos] + (chunk[pos + 1] << 8) + (chunk[pos + 2] << 16);
140
+ this.sequenceNo = chunk[pos + 3];
141
+ pos += 4;
142
+ if (chunkLen - pos >= this.packetLen) {
143
+ pos += this.packetLen;
144
+ if (this.packetLen < 0xffffff) {
145
+ this.receivePacket(this.packet.update(chunk, pos - this.packetLen, pos));
146
+ } else {
147
+ this.parts = [chunk.subarray(pos - this.packetLen, pos)];
148
+ this.partsTotalLen = this.packetLen;
149
+ break;
150
+ }
151
+ } else {
152
+ const buf = chunk.subarray(pos, chunkLen);
153
+ if (!this.parts) {
154
+ this.parts = [buf];
155
+ this.partsTotalLen = chunkLen - pos;
156
+ } else {
157
+ this.parts.push(buf);
158
+ this.partsTotalLen += chunkLen - pos;
159
+ }
160
+ this.remainingLen = this.packetLen - (chunkLen - pos);
161
+ return;
162
+ }
163
+ }
164
+ } else {
165
+ this.parts = [chunk.subarray(pos - length, pos)];
166
+ this.partsTotalLen = length;
167
+ }
168
+ } else {
169
+ this.parts.push(chunk.subarray(pos - length, pos));
158
170
  this.partsTotalLen += length;
159
171
 
160
172
  if (this.packetLen < 0xffffff) {
161
173
  let buf = Buffer.concat(this.parts, this.partsTotalLen);
162
174
  this.parts = null;
163
- const packet = new this.packetConstructor(buf, 0, this.partsTotalLen, this.encoding);
164
- this.receivePacket(packet);
165
- }
166
- } else {
167
- if (this.packetLen < 0xffffff) {
168
- const packet = new this.packetConstructor(buf, 0, length, this.encoding);
169
- this.receivePacket(packet);
170
- } else {
171
- this.parts = [buf];
172
- this.partsTotalLen = length;
175
+ this.receivePacket(this.packet.update(buf, 0, this.partsTotalLen));
173
176
  }
174
177
  }
175
178
  this.resetHeader();
176
179
  } else {
177
- const buf = chunk.slice(pos, chunkLen);
180
+ const buf = chunk.subarray(pos, chunkLen);
178
181
  if (!this.parts) {
179
182
  this.parts = [buf];
180
183
  this.partsTotalLen = chunkLen - pos;
@@ -185,6 +188,14 @@ class PacketInputStream {
185
188
  this.remainingLen = length - (chunkLen - pos);
186
189
  return;
187
190
  }
191
+ } else if (length === 0 && this.parts) {
192
+ // ending empty packet
193
+ this.parts.push(chunk.subarray(pos - length, pos));
194
+ this.partsTotalLen += length;
195
+ let buf = Buffer.concat(this.parts, this.partsTotalLen);
196
+ this.parts = null;
197
+ this.receivePacket(this.packet.update(buf, 0, this.partsTotalLen));
198
+ this.resetHeader();
188
199
  }
189
200
  } while (pos < chunkLen);
190
201
  }
@@ -1,14 +1,19 @@
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 Packet = require('./packet');
4
7
 
5
8
  class PacketNodeEncoded extends Packet {
6
- constructor(buf, pos, end, encoding) {
7
- super(buf, pos, end);
8
- this.encoding = encoding;
9
+ constructor(encoding) {
10
+ super();
11
+ // using undefined for utf8 permit to avoid node.js searching
12
+ // for charset, using directly utf8 default one.
13
+ this.encoding = encoding === 'utf8' ? undefined : encoding;
9
14
  }
10
15
 
11
- readStringLength() {
16
+ readStringLengthEncoded() {
12
17
  const len = this.readUnsignedLength();
13
18
  if (len === null) return null;
14
19
 
@@ -16,14 +21,13 @@ class PacketNodeEncoded extends Packet {
16
21
  return this.buf.toString(this.encoding, this.pos - len, this.pos);
17
22
  }
18
23
 
19
- readString(beg, len) {
20
- return this.buf.toString(this.encoding, beg, beg + len);
24
+ static readString(encoding, buf, beg, len) {
25
+ return buf.toString(encoding, beg, beg + len);
21
26
  }
22
27
 
23
- subPacketLengthEncoded() {
24
- const len = this.readUnsignedLength();
28
+ subPacketLengthEncoded(len) {
25
29
  this.skip(len);
26
- return new PacketNodeEncoded(this.buf, this.pos - len, this.pos, this.encoding);
30
+ return new PacketNodeEncoded(this.encoding).update(this.buf, this.pos - len, this.pos);
27
31
  }
28
32
 
29
33
  readStringRemaining() {
@@ -1,34 +1,36 @@
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 Packet = require('./packet');
4
7
  const Iconv = require('iconv-lite');
5
8
 
6
9
  class PacketIconvEncoded extends Packet {
7
- constructor(buf, pos, end, encoding) {
8
- super(buf, pos, end);
10
+ constructor(encoding) {
11
+ super();
9
12
  this.encoding = encoding;
10
13
  }
11
14
 
12
- readStringLength() {
15
+ readStringLengthEncoded() {
13
16
  const len = this.readUnsignedLength();
14
17
  if (len === null) return null;
15
18
 
16
19
  this.pos += len;
17
- return Iconv.decode(this.buf.slice(this.pos - len, this.pos), this.encoding);
20
+ return Iconv.decode(this.buf.subarray(this.pos - len, this.pos), this.encoding);
18
21
  }
19
22
 
20
- readString(beg, len) {
21
- return Iconv.decode(this.buf.slice(beg, beg + len), this.encoding);
23
+ static readString(encoding, buf, beg, len) {
24
+ return Iconv.decode(buf.subarray(beg, beg + len), encoding);
22
25
  }
23
26
 
24
- subPacketLengthEncoded() {
25
- const len = this.readUnsignedLength();
27
+ subPacketLengthEncoded(len) {
26
28
  this.skip(len);
27
- return new PacketIconvEncoded(this.buf, this.pos - len, this.pos, this.encoding);
29
+ return new PacketIconvEncoded(this.encoding).update(this.buf, this.pos - len, this.pos);
28
30
  }
29
31
 
30
32
  readStringRemaining() {
31
- const str = Iconv.decode(this.buf.slice(this.pos, this.end), this.encoding);
33
+ const str = Iconv.decode(this.buf.subarray(this.pos, this.end), this.encoding);
32
34
  this.pos = this.end;
33
35
  return str;
34
36
  }