@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.
- package/README.md +34 -34
- package/README.zh-CN.md +34 -34
- package/client.d.ts +1 -1
- package/client.js +1 -1
- package/dist/externalVersion.js +5 -5
- package/dist/locale/en-US.json +48 -48
- package/dist/locale/es-ES.json +9 -9
- package/dist/locale/ko_KR.json +11 -11
- package/dist/locale/pt-BR.json +9 -9
- package/dist/locale/zh-CN.json +58 -58
- package/dist/node_modules/mariadb/callback.js +43 -8
- package/dist/node_modules/mariadb/check-node.js +30 -0
- package/dist/node_modules/mariadb/lib/cluster-callback.js +84 -0
- package/dist/node_modules/mariadb/lib/cluster.js +446 -0
- package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +576 -177
- package/dist/node_modules/mariadb/lib/cmd/change-user.js +54 -44
- package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +3 -2
- package/dist/node_modules/mariadb/lib/cmd/class/prepare-cache-wrapper.js +46 -0
- package/dist/node_modules/mariadb/lib/cmd/class/prepare-result-packet.js +141 -0
- package/dist/node_modules/mariadb/lib/cmd/class/prepare-wrapper.js +70 -0
- package/dist/node_modules/mariadb/lib/cmd/close-prepare.js +38 -0
- package/dist/node_modules/mariadb/lib/cmd/column-definition.js +145 -47
- package/dist/node_modules/mariadb/lib/cmd/command.js +41 -75
- package/dist/node_modules/mariadb/lib/cmd/decoder/binary-decoder.js +282 -0
- package/dist/node_modules/mariadb/lib/cmd/decoder/text-decoder.js +210 -0
- package/dist/node_modules/mariadb/lib/cmd/{common-binary-cmd.js → encoder/binary-encoder.js} +34 -77
- package/dist/node_modules/mariadb/lib/cmd/encoder/text-encoder.js +311 -0
- package/dist/node_modules/mariadb/lib/cmd/execute-stream.js +61 -0
- package/dist/node_modules/mariadb/lib/cmd/execute.js +338 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +25 -62
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +39 -6
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +48 -16
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/handshake.js +198 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/{initial-handshake.js → auth/initial-handshake.js} +10 -8
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +22 -9
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +9 -4
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/parsec-auth.js +115 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +12 -5
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +44 -33
- package/dist/node_modules/mariadb/lib/cmd/handshake/authentication.js +335 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +20 -19
- package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +6 -3
- package/dist/node_modules/mariadb/lib/cmd/parser.js +861 -0
- package/dist/node_modules/mariadb/lib/cmd/ping.js +17 -18
- package/dist/node_modules/mariadb/lib/cmd/prepare.js +170 -0
- package/dist/node_modules/mariadb/lib/cmd/query.js +281 -144
- package/dist/node_modules/mariadb/lib/cmd/quit.js +9 -6
- package/dist/node_modules/mariadb/lib/cmd/reset.js +15 -19
- package/dist/node_modules/mariadb/lib/cmd/stream.js +21 -6
- package/dist/node_modules/mariadb/lib/config/cluster-options.js +23 -0
- package/dist/node_modules/mariadb/lib/config/connection-options.js +196 -132
- package/dist/node_modules/mariadb/lib/config/pool-options.js +27 -19
- package/dist/node_modules/mariadb/lib/connection-callback.js +492 -120
- package/dist/node_modules/mariadb/lib/connection-promise.js +372 -0
- package/dist/node_modules/mariadb/lib/connection.js +1739 -1016
- package/dist/node_modules/mariadb/lib/const/capabilities.js +36 -30
- package/dist/node_modules/mariadb/lib/const/collations.js +972 -36
- package/dist/node_modules/mariadb/lib/const/connection_status.js +3 -0
- package/dist/node_modules/mariadb/lib/const/error-code.js +35 -11
- package/dist/node_modules/mariadb/lib/const/field-detail.js +3 -0
- package/dist/node_modules/mariadb/lib/const/field-type.js +7 -4
- package/dist/node_modules/mariadb/lib/const/server-status.js +4 -1
- package/dist/node_modules/mariadb/lib/const/state-change.js +3 -0
- package/dist/node_modules/mariadb/lib/filtered-cluster-callback.js +136 -0
- package/dist/node_modules/mariadb/lib/filtered-cluster.js +118 -0
- package/dist/node_modules/mariadb/lib/io/compression-input-stream.js +14 -13
- package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +21 -18
- package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +75 -64
- package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +13 -9
- package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +12 -10
- package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +402 -134
- package/dist/node_modules/mariadb/lib/io/packet.js +287 -202
- package/dist/node_modules/mariadb/lib/lru-prepare-cache.js +84 -0
- package/dist/node_modules/mariadb/lib/misc/connection-information.js +15 -32
- package/dist/node_modules/mariadb/lib/misc/errors.js +68 -25
- package/dist/node_modules/mariadb/lib/misc/parse.js +207 -711
- package/dist/node_modules/mariadb/lib/misc/utils.js +34 -62
- package/dist/node_modules/mariadb/lib/pool-callback.js +213 -174
- package/dist/node_modules/mariadb/lib/pool-promise.js +228 -94
- package/dist/node_modules/mariadb/lib/pool.js +951 -0
- package/dist/node_modules/mariadb/package.json +1 -1
- package/dist/node_modules/mariadb/promise.js +1 -34
- package/dist/node_modules/mariadb/types/callback.d.ts +207 -0
- package/dist/node_modules/mariadb/types/index.d.ts +94 -674
- package/dist/node_modules/mariadb/types/share.d.ts +804 -0
- package/dist/node_modules/qs/package.json +1 -1
- package/dist/server/actions/apps.js +2 -2
- package/dist/server/app-lifecycle.d.ts +1 -1
- package/dist/server/app-lifecycle.js +4 -4
- package/dist/server/models/application.d.ts +1 -1
- package/package.json +7 -7
- package/server.d.ts +2 -2
- package/server.js +1 -1
- package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +0 -372
- package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +0 -427
- package/dist/node_modules/mariadb/lib/cmd/handshake/client-handshake-response.js +0 -126
- package/dist/node_modules/mariadb/lib/cmd/handshake/handshake.js +0 -292
- package/dist/node_modules/mariadb/lib/cmd/resultset.js +0 -607
- package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +0 -19
- package/dist/node_modules/mariadb/lib/filtered-pool-cluster.js +0 -81
- package/dist/node_modules/mariadb/lib/io/bulk-packet.js +0 -590
- package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +0 -481
- package/dist/node_modules/mariadb/lib/pool-base.js +0 -611
- package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +0 -66
- package/dist/node_modules/mariadb/lib/pool-cluster.js +0 -407
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
2
|
+
// Copyright (c) 2015-2024 MariaDB Corporation Ab
|
|
3
|
+
|
|
4
|
+
'use strict';
|
|
5
|
+
const LRU = require('lru-cache');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* LRU prepare cache for storing prepared SQL statements
|
|
9
|
+
*
|
|
10
|
+
* This class provides caching functionality for prepared statements
|
|
11
|
+
* using a Least Recently Used (LRU) cache strategy.
|
|
12
|
+
*/
|
|
13
|
+
class LruPrepareCache {
|
|
14
|
+
#lruCache;
|
|
15
|
+
#info;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new LRU prepare cache
|
|
19
|
+
*
|
|
20
|
+
* @param {Object} info - Database connection information
|
|
21
|
+
* @param {number} prepareCacheLength - Maximum number of prepared statements to cache
|
|
22
|
+
*/
|
|
23
|
+
constructor(info, prepareCacheLength) {
|
|
24
|
+
if (!Number.isInteger(prepareCacheLength) || prepareCacheLength <= 0) {
|
|
25
|
+
throw new TypeError('prepareCacheLength must be a positive integer');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
this.#info = info;
|
|
29
|
+
this.#lruCache = new LRU.LRUCache({
|
|
30
|
+
max: prepareCacheLength,
|
|
31
|
+
dispose: (value, key) => value.unCache()
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Gets a cached prepared statement
|
|
37
|
+
*
|
|
38
|
+
* @param {string} sql - SQL statement to retrieve
|
|
39
|
+
* @returns {Object|null} Cached prepared statement or null if not found
|
|
40
|
+
*/
|
|
41
|
+
get(sql) {
|
|
42
|
+
const key = this.#info.database + '|' + sql;
|
|
43
|
+
const cachedItem = this.#lruCache.get(key);
|
|
44
|
+
if (cachedItem) {
|
|
45
|
+
return cachedItem.incrementUse();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Adds a prepared statement to the cache
|
|
53
|
+
*
|
|
54
|
+
* @param {string} sql - SQL statement
|
|
55
|
+
* @param {Object} cache - Prepared statement object
|
|
56
|
+
* @returns {void}
|
|
57
|
+
*/
|
|
58
|
+
set(sql, cache) {
|
|
59
|
+
const key = this.#info.database + '|' + sql;
|
|
60
|
+
this.#lruCache.set(key, cache);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Provides a string representation of the cache contents
|
|
65
|
+
*
|
|
66
|
+
* @returns {string} String representation of cache
|
|
67
|
+
*/
|
|
68
|
+
toString() {
|
|
69
|
+
const keys = [...this.#lruCache.keys()];
|
|
70
|
+
const keyStr = keys.length ? keys.map((key) => `[${key}]`).join(',') : '';
|
|
71
|
+
return `info{cache:${keyStr}}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Clears all cached prepared statements
|
|
76
|
+
*
|
|
77
|
+
* @returns {void}
|
|
78
|
+
*/
|
|
79
|
+
reset() {
|
|
80
|
+
this.#lruCache.clear();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = LruPrepareCache;
|
|
@@ -1,43 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const _addPacket = function (msg) {
|
|
5
|
-
this.lastPackets.push(msg);
|
|
6
|
-
while (this.lastPackets.size() > 32) this.lastPackets.shift();
|
|
7
|
-
};
|
|
1
|
+
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
2
|
+
// Copyright (c) 2015-2024 MariaDB Corporation Ab
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
let output = '';
|
|
11
|
-
let packet;
|
|
12
|
-
while ((packet = this.lastPackets.shift())) {
|
|
13
|
-
output += '\n' + packet;
|
|
14
|
-
}
|
|
15
|
-
return output;
|
|
16
|
-
};
|
|
4
|
+
'use strict';
|
|
17
5
|
|
|
18
6
|
class ConnectionInformation {
|
|
19
|
-
|
|
7
|
+
#redirectFct;
|
|
8
|
+
constructor(opts, redirectFct) {
|
|
20
9
|
this.threadId = -1;
|
|
21
10
|
this.status = null;
|
|
22
11
|
this.serverVersion = null;
|
|
23
12
|
this.serverCapabilities = null;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
getLastPackets() {
|
|
29
|
-
return '';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
enableLogPacket() {
|
|
33
|
-
this.lastPackets = new Queue();
|
|
34
|
-
this.addPacket = _addPacket.bind(this);
|
|
35
|
-
this.getLastPackets = _getLastPackets.bind(this);
|
|
13
|
+
this.database = opts.database;
|
|
14
|
+
this.port = opts.port;
|
|
15
|
+
this.#redirectFct = redirectFct;
|
|
16
|
+
this.redirectRequest = null;
|
|
36
17
|
}
|
|
37
18
|
|
|
38
19
|
hasMinVersion(major, minor, patch) {
|
|
39
|
-
if (!this.serverVersion)
|
|
40
|
-
throw new Error('cannot know if server version until connection is established');
|
|
20
|
+
if (!this.serverVersion) throw new Error('cannot know if server version until connection is established');
|
|
41
21
|
|
|
42
22
|
if (!major) throw new Error('a major version must be set');
|
|
43
23
|
|
|
@@ -52,9 +32,12 @@ class ConnectionInformation {
|
|
|
52
32
|
);
|
|
53
33
|
}
|
|
54
34
|
|
|
35
|
+
redirect(value, resolve) {
|
|
36
|
+
return this.#redirectFct(value, resolve);
|
|
37
|
+
}
|
|
38
|
+
|
|
55
39
|
isMariaDB() {
|
|
56
|
-
if (!this.serverVersion)
|
|
57
|
-
throw new Error('cannot know if server is MariaDB until connection is established');
|
|
40
|
+
if (!this.serverVersion) throw new Error('cannot know if server is MariaDB until connection is established');
|
|
58
41
|
return this.serverVersion.mariaDb;
|
|
59
42
|
}
|
|
60
43
|
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
2
|
+
// Copyright (c) 2015-2025 MariaDB Corporation Ab
|
|
3
|
+
|
|
1
4
|
'use strict';
|
|
2
5
|
const ErrorCodes = require('../const/error-code');
|
|
3
6
|
|
|
4
7
|
class SqlError extends Error {
|
|
5
|
-
constructor(msg, sql, fatal, info, sqlState, errno, additionalStack, addHeader) {
|
|
8
|
+
constructor(msg, sql, fatal, info, sqlState, errno, additionalStack, addHeader = undefined, cause) {
|
|
6
9
|
super(
|
|
7
|
-
(addHeader
|
|
8
|
-
?
|
|
9
|
-
(info ? (info.threadId ? info.threadId : -1) : -1) +
|
|
10
|
-
', no: ' +
|
|
11
|
-
(errno ? errno : -1) +
|
|
12
|
-
', SQLState: ' +
|
|
13
|
-
(sqlState ? sqlState : 'HY000') +
|
|
14
|
-
') '
|
|
10
|
+
(addHeader !== false
|
|
11
|
+
? `(conn:${info && info.threadId ? info.threadId : -1}, no: ${errno ? errno : -1}, SQLState: ${sqlState}) `
|
|
15
12
|
: '') +
|
|
16
13
|
msg +
|
|
17
|
-
(sql ? '\nsql: ' + sql : '')
|
|
14
|
+
(sql ? '\nsql: ' + sql : ''),
|
|
15
|
+
cause
|
|
18
16
|
);
|
|
19
|
-
this.
|
|
17
|
+
this.name = 'SqlError';
|
|
18
|
+
this.sqlMessage = msg;
|
|
20
19
|
this.sql = sql;
|
|
21
20
|
this.fatal = fatal;
|
|
22
21
|
this.errno = errno;
|
|
@@ -29,36 +28,66 @@ class SqlError extends Error {
|
|
|
29
28
|
}
|
|
30
29
|
if (additionalStack) {
|
|
31
30
|
//adding caller stack, removing initial "Error:\n"
|
|
32
|
-
this.stack +=
|
|
33
|
-
'\n From event:\n' + additionalStack.substring(additionalStack.indexOf('\n') + 1);
|
|
31
|
+
this.stack += '\n From event:\n' + additionalStack.substring(additionalStack.indexOf('\n') + 1);
|
|
34
32
|
}
|
|
35
33
|
}
|
|
34
|
+
|
|
35
|
+
get text() {
|
|
36
|
+
return this.sqlMessage;
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
41
|
* Error factory, so error get connection information.
|
|
40
42
|
*
|
|
41
43
|
* @param msg current error message
|
|
44
|
+
* @param errno error number
|
|
45
|
+
* @param info connection information
|
|
46
|
+
* @param sqlState sql state
|
|
42
47
|
* @param sql sql command
|
|
43
48
|
* @param fatal is error fatal
|
|
49
|
+
* @param additionalStack additional stack trace to see
|
|
50
|
+
* @param addHeader add connection information
|
|
51
|
+
* @param cause add cause
|
|
52
|
+
* @returns {Error} the error
|
|
53
|
+
*/
|
|
54
|
+
module.exports.createError = function (
|
|
55
|
+
msg,
|
|
56
|
+
errno,
|
|
57
|
+
info = null,
|
|
58
|
+
sqlState = 'HY000',
|
|
59
|
+
sql = null,
|
|
60
|
+
fatal = false,
|
|
61
|
+
additionalStack = undefined,
|
|
62
|
+
addHeader = undefined,
|
|
63
|
+
cause = undefined
|
|
64
|
+
) {
|
|
65
|
+
if (cause) return new SqlError(msg, sql, fatal, info, sqlState, errno, additionalStack, addHeader, { cause: cause });
|
|
66
|
+
return new SqlError(msg, sql, fatal, info, sqlState, errno, additionalStack, addHeader, cause);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Fatal error factory, so error get connection information.
|
|
71
|
+
*
|
|
72
|
+
* @param msg current error message
|
|
73
|
+
* @param errno error number
|
|
44
74
|
* @param info connection information
|
|
45
75
|
* @param sqlState sql state
|
|
46
|
-
* @param
|
|
76
|
+
* @param sql sql command
|
|
47
77
|
* @param additionalStack additional stack trace to see
|
|
48
78
|
* @param addHeader add connection information
|
|
49
79
|
* @returns {Error} the error
|
|
50
80
|
*/
|
|
51
|
-
module.exports.
|
|
81
|
+
module.exports.createFatalError = function (
|
|
52
82
|
msg,
|
|
53
|
-
sql,
|
|
54
|
-
fatal,
|
|
55
|
-
info,
|
|
56
|
-
sqlState,
|
|
57
83
|
errno,
|
|
58
|
-
|
|
59
|
-
|
|
84
|
+
info = null,
|
|
85
|
+
sqlState = '08S01',
|
|
86
|
+
sql = null,
|
|
87
|
+
additionalStack = undefined,
|
|
88
|
+
addHeader = undefined
|
|
60
89
|
) {
|
|
61
|
-
return new SqlError(msg, sql,
|
|
90
|
+
return new SqlError(msg, sql, true, info, sqlState, errno, additionalStack, addHeader);
|
|
62
91
|
};
|
|
63
92
|
|
|
64
93
|
/********************************************************************************
|
|
@@ -66,7 +95,6 @@ module.exports.createError = function (
|
|
|
66
95
|
********************************************************************************/
|
|
67
96
|
|
|
68
97
|
module.exports.ER_CONNECTION_ALREADY_CLOSED = 45001;
|
|
69
|
-
module.exports.ER_ALREADY_CONNECTING = 45002;
|
|
70
98
|
module.exports.ER_MYSQL_CHANGE_USER_BUG = 45003;
|
|
71
99
|
module.exports.ER_CMD_NOT_EXECUTED_DESTROYED = 45004;
|
|
72
100
|
module.exports.ER_NULL_CHAR_ESCAPEID = 45005;
|
|
@@ -104,12 +132,27 @@ module.exports.ER_CLOSING_POOL = 45037;
|
|
|
104
132
|
module.exports.ER_TIMEOUT_NOT_SUPPORTED = 45038;
|
|
105
133
|
module.exports.ER_INITIAL_TIMEOUT_ERROR = 45039;
|
|
106
134
|
module.exports.ER_DUPLICATE_FIELD = 45040;
|
|
107
|
-
module.exports.ER_CLIENT_OPTION_INCOMPATIBILITY = 45041;
|
|
108
135
|
module.exports.ER_PING_TIMEOUT = 45042;
|
|
109
136
|
module.exports.ER_BAD_PARAMETER_VALUE = 45043;
|
|
110
137
|
module.exports.ER_CANNOT_RETRIEVE_RSA_KEY = 45044;
|
|
111
138
|
module.exports.ER_MINIMUM_NODE_VERSION_REQUIRED = 45045;
|
|
112
|
-
module.exports.
|
|
139
|
+
module.exports.ER_MAX_ALLOWED_PACKET = 45046;
|
|
140
|
+
module.exports.ER_NOT_SUPPORTED_AUTH_PLUGIN = 45047;
|
|
141
|
+
module.exports.ER_COMPRESSION_NOT_SUPPORTED = 45048;
|
|
142
|
+
module.exports.ER_UNDEFINED_SQL = 45049;
|
|
143
|
+
module.exports.ER_PARSING_PRECISION = 45050;
|
|
144
|
+
module.exports.ER_PREPARE_CLOSED = 45051;
|
|
145
|
+
module.exports.ER_MISSING_SQL_PARAMETER = 45052;
|
|
146
|
+
module.exports.ER_MISSING_SQL_FILE = 45053;
|
|
147
|
+
module.exports.ER_SQL_FILE_ERROR = 45054;
|
|
148
|
+
module.exports.ER_MISSING_DATABASE_PARAMETER = 45055;
|
|
149
|
+
module.exports.ER_SELF_SIGNED = 45056;
|
|
150
|
+
module.exports.ER_SELF_SIGNED_NO_PWD = 45057;
|
|
151
|
+
module.exports.ER_PRIVATE_FIELDS_USE = 45058;
|
|
152
|
+
module.exports.ER_TLS_IDENTITY_ERROR = 45059;
|
|
153
|
+
module.exports.ER_POOL_NOT_INITIALIZED = 45060;
|
|
154
|
+
module.exports.ER_POOL_NO_CONNECTION = 45061;
|
|
155
|
+
module.exports.ER_SELF_SIGNED_BAD_PLUGIN = 45062;
|
|
113
156
|
|
|
114
157
|
const keys = Object.keys(module.exports);
|
|
115
158
|
const errByNo = {};
|