@tachybase/module-multi-app 0.23.8
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/.turbo/turbo-build.log +14 -0
- package/README.md +34 -0
- package/README.zh-CN.md +34 -0
- package/client.d.ts +1 -0
- package/client.js +1 -0
- package/dist/client/AppManager.d.ts +2 -0
- package/dist/client/AppNameInput.d.ts +2 -0
- package/dist/client/MultiAppBlockInitializer.d.ts +2 -0
- package/dist/client/MultiAppManagerProvider.d.ts +2 -0
- package/dist/client/MultiAppManagerProvider.style.d.ts +5 -0
- package/dist/client/Settings.d.ts +2 -0
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.js +1 -0
- package/dist/client/settings/schemas/applications.d.ts +13 -0
- package/dist/client/utils.d.ts +4 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +27 -0
- package/dist/externalVersion.js +16 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +27 -0
- package/dist/locale/es-ES.json +9 -0
- package/dist/locale/ko_KR.json +11 -0
- package/dist/locale/pt-BR.json +9 -0
- package/dist/locale/zh-CN.json +27 -0
- package/dist/node_modules/mariadb/LICENSE +502 -0
- package/dist/node_modules/mariadb/callback.js +41 -0
- package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +278 -0
- package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +372 -0
- package/dist/node_modules/mariadb/lib/cmd/change-user.js +149 -0
- package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +17 -0
- package/dist/node_modules/mariadb/lib/cmd/column-definition.js +102 -0
- package/dist/node_modules/mariadb/lib/cmd/command.js +168 -0
- package/dist/node_modules/mariadb/lib/cmd/common-binary-cmd.js +327 -0
- package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +427 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +168 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +23 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +761 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +55 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +58 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +19 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +142 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +74 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/client-handshake-response.js +126 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/handshake.js +292 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/initial-handshake.js +74 -0
- package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +29 -0
- package/dist/node_modules/mariadb/lib/cmd/ping.js +52 -0
- package/dist/node_modules/mariadb/lib/cmd/query.js +255 -0
- package/dist/node_modules/mariadb/lib/cmd/quit.js +28 -0
- package/dist/node_modules/mariadb/lib/cmd/reset.js +54 -0
- package/dist/node_modules/mariadb/lib/cmd/resultset.js +607 -0
- package/dist/node_modules/mariadb/lib/cmd/stream.js +45 -0
- package/dist/node_modules/mariadb/lib/config/connection-options.js +258 -0
- package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +19 -0
- package/dist/node_modules/mariadb/lib/config/pool-options.js +47 -0
- package/dist/node_modules/mariadb/lib/connection-callback.js +160 -0
- package/dist/node_modules/mariadb/lib/connection.js +1460 -0
- package/dist/node_modules/mariadb/lib/const/capabilities.js +64 -0
- package/dist/node_modules/mariadb/lib/const/collations.js +473 -0
- package/dist/node_modules/mariadb/lib/const/connection_status.js +13 -0
- package/dist/node_modules/mariadb/lib/const/error-code.js +1282 -0
- package/dist/node_modules/mariadb/lib/const/field-detail.js +35 -0
- package/dist/node_modules/mariadb/lib/const/field-type.js +71 -0
- package/dist/node_modules/mariadb/lib/const/server-status.js +30 -0
- package/dist/node_modules/mariadb/lib/const/state-change.js +12 -0
- package/dist/node_modules/mariadb/lib/filtered-pool-cluster.js +81 -0
- package/dist/node_modules/mariadb/lib/io/bulk-packet.js +590 -0
- package/dist/node_modules/mariadb/lib/io/compression-input-stream.js +141 -0
- package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +171 -0
- package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +193 -0
- package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +36 -0
- package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +37 -0
- package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +502 -0
- package/dist/node_modules/mariadb/lib/io/packet.js +515 -0
- package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +481 -0
- package/dist/node_modules/mariadb/lib/misc/connection-information.js +96 -0
- package/dist/node_modules/mariadb/lib/misc/errors.js +123 -0
- package/dist/node_modules/mariadb/lib/misc/parse.js +1033 -0
- package/dist/node_modules/mariadb/lib/misc/utils.js +298 -0
- package/dist/node_modules/mariadb/lib/pool-base.js +611 -0
- package/dist/node_modules/mariadb/lib/pool-callback.js +202 -0
- package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +66 -0
- package/dist/node_modules/mariadb/lib/pool-cluster.js +407 -0
- package/dist/node_modules/mariadb/lib/pool-promise.js +108 -0
- package/dist/node_modules/mariadb/package.json +1 -0
- package/dist/node_modules/mariadb/promise.js +34 -0
- package/dist/node_modules/mariadb/types/index.d.ts +870 -0
- package/dist/server/actions/apps.d.ts +5 -0
- package/dist/server/actions/apps.js +117 -0
- package/dist/server/app-lifecycle.d.ts +8 -0
- package/dist/server/app-lifecycle.js +99 -0
- package/dist/server/app-start-env.d.ts +2 -0
- package/dist/server/app-start-env.js +105 -0
- package/dist/server/collections/applications.d.ts +2 -0
- package/dist/server/collections/applications.js +82 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +29 -0
- package/dist/server/middlewares/app-selector.d.ts +1 -0
- package/dist/server/middlewares/app-selector.js +47 -0
- package/dist/server/middlewares/index.d.ts +2 -0
- package/dist/server/middlewares/index.js +23 -0
- package/dist/server/middlewares/inject-app-list.d.ts +1 -0
- package/dist/server/middlewares/inject-app-list.js +48 -0
- package/dist/server/migrations/20240820153000-add-apps-tmpl.d.ts +6 -0
- package/dist/server/migrations/20240820153000-add-apps-tmpl.js +47 -0
- package/dist/server/migrations/20241126124904-add-createdBy.d.ts +6 -0
- package/dist/server/migrations/20241126124904-add-createdBy.js +41 -0
- package/dist/server/models/application.d.ts +10 -0
- package/dist/server/models/application.js +57 -0
- package/dist/server/server.d.ts +19 -0
- package/dist/server/server.js +246 -0
- package/dist/swagger/index.d.ts +197 -0
- package/dist/swagger/index.js +227 -0
- package/package.json +38 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const Long = require('long');
|
|
3
|
+
const hexArray = '0123456789ABCDEF'.split('');
|
|
4
|
+
const Errors = require('../misc/errors');
|
|
5
|
+
const CommonText = require('../cmd/common-text-cmd');
|
|
6
|
+
const Iconv = require('iconv-lite');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Write bytes/hexadecimal value of a byte array to a string.
|
|
10
|
+
* String output example :
|
|
11
|
+
* 38 00 00 00 03 63 72 65 61 74 65 20 74 61 62 6C 8....create tabl
|
|
12
|
+
* 65 20 42 6C 6F 62 54 65 73 74 63 6C 6F 62 74 65 e BlobTestclobte
|
|
13
|
+
* 73 74 32 20 28 73 74 72 6D 20 74 65 78 74 29 20 st2 (strm text)
|
|
14
|
+
* 43 48 41 52 53 45 54 20 75 74 66 38 CHARSET utf8
|
|
15
|
+
*/
|
|
16
|
+
module.exports.log = function (opts, buf, off, end, header) {
|
|
17
|
+
let out = [];
|
|
18
|
+
if (!buf) return '';
|
|
19
|
+
if (off === undefined || off === null) off = 0;
|
|
20
|
+
if (end === undefined || end === null) end = buf.length;
|
|
21
|
+
let asciiValue = new Array(16);
|
|
22
|
+
asciiValue[8] = ' ';
|
|
23
|
+
|
|
24
|
+
let useHeader = header !== undefined;
|
|
25
|
+
let offset = off || 0;
|
|
26
|
+
const maxLgh = Math.min(useHeader ? opts.debugLen - header.length : opts.debugLen, end - offset);
|
|
27
|
+
const isLimited = end - offset > maxLgh;
|
|
28
|
+
let byteValue;
|
|
29
|
+
let posHexa = 0;
|
|
30
|
+
let pos = 0;
|
|
31
|
+
|
|
32
|
+
out.push(
|
|
33
|
+
'+--------------------------------------------------+\n' +
|
|
34
|
+
'| 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n' +
|
|
35
|
+
'+--------------------------------------------------+------------------+\n'
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (useHeader) {
|
|
39
|
+
while (pos < header.length) {
|
|
40
|
+
if (posHexa === 0) out.push('| ');
|
|
41
|
+
byteValue = header[pos++] & 0xff;
|
|
42
|
+
out.push(hexArray[byteValue >>> 4], hexArray[byteValue & 0x0f], ' ');
|
|
43
|
+
asciiValue[posHexa++] =
|
|
44
|
+
byteValue > 31 && byteValue < 127 ? String.fromCharCode(byteValue) : '.';
|
|
45
|
+
if (posHexa === 8) out.push(' ');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
pos = offset;
|
|
50
|
+
while (pos < maxLgh + offset) {
|
|
51
|
+
if (posHexa === 0) out.push('| ');
|
|
52
|
+
byteValue = buf[pos] & 0xff;
|
|
53
|
+
|
|
54
|
+
out.push(hexArray[byteValue >>> 4], hexArray[byteValue & 0x0f], ' ');
|
|
55
|
+
|
|
56
|
+
asciiValue[posHexa++] =
|
|
57
|
+
byteValue > 31 && byteValue < 127 ? String.fromCharCode(byteValue) : '.';
|
|
58
|
+
|
|
59
|
+
if (posHexa === 8) out.push(' ');
|
|
60
|
+
if (posHexa === 16) {
|
|
61
|
+
out.push('| ', asciiValue.join(''), ' |\n');
|
|
62
|
+
posHexa = 0;
|
|
63
|
+
}
|
|
64
|
+
pos++;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let remaining = posHexa;
|
|
68
|
+
if (remaining > 0) {
|
|
69
|
+
if (remaining < 8) {
|
|
70
|
+
for (; remaining < 8; remaining++) {
|
|
71
|
+
out.push(' ');
|
|
72
|
+
asciiValue[posHexa++] = ' ';
|
|
73
|
+
}
|
|
74
|
+
out.push(' ');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
for (; remaining < 16; remaining++) {
|
|
78
|
+
out.push(' ');
|
|
79
|
+
asciiValue[posHexa++] = ' ';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
out.push('| ', asciiValue.join(''), isLimited ? ' |...\n' : ' |\n');
|
|
83
|
+
} else if (isLimited) {
|
|
84
|
+
out[out.length - 1] = ' |...\n';
|
|
85
|
+
}
|
|
86
|
+
out.push('+--------------------------------------------------+------------------+\n');
|
|
87
|
+
return out.join('');
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
module.exports.escapeId = (opts, info, value) => {
|
|
91
|
+
if (!value || value === '') {
|
|
92
|
+
throw Errors.createError(
|
|
93
|
+
'Cannot escape empty ID value',
|
|
94
|
+
null,
|
|
95
|
+
false,
|
|
96
|
+
info,
|
|
97
|
+
'0A000',
|
|
98
|
+
Errors.ER_NULL_ESCAPEID
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
if (value.includes('\u0000')) {
|
|
102
|
+
throw Errors.createError(
|
|
103
|
+
'Cannot escape ID with null character (u0000)',
|
|
104
|
+
null,
|
|
105
|
+
false,
|
|
106
|
+
info,
|
|
107
|
+
'0A000',
|
|
108
|
+
Errors.ER_NULL_CHAR_ESCAPEID
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// always return escaped value, event when there is no special characters
|
|
113
|
+
// to permit working with reserved words
|
|
114
|
+
if (value.match(/^`.+`$/g)) {
|
|
115
|
+
// already escaped
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
return '`' + value.replace(/`/g, '``') + '`';
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const escapeParameters = (opts, info, value) => {
|
|
122
|
+
if (value === undefined || value === null) return 'NULL';
|
|
123
|
+
|
|
124
|
+
switch (typeof value) {
|
|
125
|
+
case 'boolean':
|
|
126
|
+
return value ? 'true' : 'false';
|
|
127
|
+
case 'bigint':
|
|
128
|
+
case 'number':
|
|
129
|
+
return '' + value;
|
|
130
|
+
case 'object':
|
|
131
|
+
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
132
|
+
return opts.tz
|
|
133
|
+
? opts.tz === 'Etc/UTC'
|
|
134
|
+
? CommonText.getUtcDate(value, opts)
|
|
135
|
+
: CommonText.getTimezoneDate(value, opts)
|
|
136
|
+
: CommonText.getLocalDate(value, opts);
|
|
137
|
+
} else if (Buffer.isBuffer(value)) {
|
|
138
|
+
let stValue;
|
|
139
|
+
if (Buffer.isEncoding(opts.collation.charset)) {
|
|
140
|
+
stValue = value.toString(opts.collation.charset, 0, value.length);
|
|
141
|
+
} else {
|
|
142
|
+
stValue = Iconv.decode(value, opts.collation.charset);
|
|
143
|
+
}
|
|
144
|
+
return "_binary'" + escapeString(stValue) + "'";
|
|
145
|
+
} else if (typeof value.toSqlString === 'function') {
|
|
146
|
+
return "'" + escapeString(String(value.toSqlString())) + "'";
|
|
147
|
+
} else if (Long.isLong(value)) {
|
|
148
|
+
return value.toString();
|
|
149
|
+
} else if (Array.isArray(value)) {
|
|
150
|
+
let out = opts.arrayParenthesis ? '(' : '';
|
|
151
|
+
for (let i = 0; i < value.length; i++) {
|
|
152
|
+
if (i !== 0) out += ',';
|
|
153
|
+
out += escapeParameters(opts, info, value[i]);
|
|
154
|
+
}
|
|
155
|
+
if (opts.arrayParenthesis) out += ')';
|
|
156
|
+
return out;
|
|
157
|
+
} else {
|
|
158
|
+
if (
|
|
159
|
+
value.type != null &&
|
|
160
|
+
[
|
|
161
|
+
'Point',
|
|
162
|
+
'LineString',
|
|
163
|
+
'Polygon',
|
|
164
|
+
'MultiPoint',
|
|
165
|
+
'MultiLineString',
|
|
166
|
+
'MultiPolygon',
|
|
167
|
+
'GeometryCollection'
|
|
168
|
+
].includes(value.type)
|
|
169
|
+
) {
|
|
170
|
+
//GeoJSON format.
|
|
171
|
+
let prefix =
|
|
172
|
+
info &&
|
|
173
|
+
((info.isMariaDB() && info.hasMinVersion(10, 1, 4)) ||
|
|
174
|
+
(!info.isMariaDB() && info.hasMinVersion(5, 7, 6)))
|
|
175
|
+
? 'ST_'
|
|
176
|
+
: '';
|
|
177
|
+
switch (value.type) {
|
|
178
|
+
case 'Point':
|
|
179
|
+
return (
|
|
180
|
+
prefix +
|
|
181
|
+
"PointFromText('POINT(" +
|
|
182
|
+
CommonText.geoPointToString(value.coordinates) +
|
|
183
|
+
")')"
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
case 'LineString':
|
|
187
|
+
return (
|
|
188
|
+
prefix +
|
|
189
|
+
"LineFromText('LINESTRING(" +
|
|
190
|
+
CommonText.geoArrayPointToString(value.coordinates) +
|
|
191
|
+
")')"
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
case 'Polygon':
|
|
195
|
+
return (
|
|
196
|
+
prefix +
|
|
197
|
+
"PolygonFromText('POLYGON(" +
|
|
198
|
+
CommonText.geoMultiArrayPointToString(value.coordinates) +
|
|
199
|
+
")')"
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
case 'MultiPoint':
|
|
203
|
+
return (
|
|
204
|
+
prefix +
|
|
205
|
+
"MULTIPOINTFROMTEXT('MULTIPOINT(" +
|
|
206
|
+
CommonText.geoArrayPointToString(value.coordinates) +
|
|
207
|
+
")')"
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
case 'MultiLineString':
|
|
211
|
+
return (
|
|
212
|
+
prefix +
|
|
213
|
+
"MLineFromText('MULTILINESTRING(" +
|
|
214
|
+
CommonText.geoMultiArrayPointToString(value.coordinates) +
|
|
215
|
+
")')"
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
case 'MultiPolygon':
|
|
219
|
+
return (
|
|
220
|
+
prefix +
|
|
221
|
+
"MPolyFromText('MULTIPOLYGON(" +
|
|
222
|
+
CommonText.geoMultiPolygonToString(value.coordinates) +
|
|
223
|
+
")')"
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
case 'GeometryCollection':
|
|
227
|
+
return (
|
|
228
|
+
prefix +
|
|
229
|
+
"GeomCollFromText('GEOMETRYCOLLECTION(" +
|
|
230
|
+
CommonText.geometricCollectionToString(value.geometries) +
|
|
231
|
+
")')"
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
if (opts.permitSetMultiParamEntries) {
|
|
236
|
+
let out = '';
|
|
237
|
+
let first = true;
|
|
238
|
+
for (let key in value) {
|
|
239
|
+
const val = value[key];
|
|
240
|
+
if (typeof val === 'function') continue;
|
|
241
|
+
if (first) {
|
|
242
|
+
first = false;
|
|
243
|
+
} else {
|
|
244
|
+
out += ',';
|
|
245
|
+
}
|
|
246
|
+
out += '`' + key + '`=';
|
|
247
|
+
out += this.escape(opts, info, val);
|
|
248
|
+
}
|
|
249
|
+
if (out === '') return "'" + escapeString(JSON.stringify(value)) + "'";
|
|
250
|
+
return out;
|
|
251
|
+
} else {
|
|
252
|
+
return "'" + escapeString(JSON.stringify(value)) + "'";
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
default:
|
|
257
|
+
return "'" + escapeString(value) + "'";
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
// see https://mariadb.com/kb/en/library/string-literals/
|
|
262
|
+
const LITTERAL_ESCAPE = {
|
|
263
|
+
'\u0000': '\\0',
|
|
264
|
+
"'": "\\'",
|
|
265
|
+
'"': '\\"',
|
|
266
|
+
'\b': '\\b',
|
|
267
|
+
'\n': '\\n',
|
|
268
|
+
'\r': '\\r',
|
|
269
|
+
'\t': '\\t',
|
|
270
|
+
'\u001A': '\\Z',
|
|
271
|
+
'\\': '\\\\'
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const escapeString = (val) => {
|
|
275
|
+
const pattern = /[\u0000'"\b\n\r\t\u001A\\]/g;
|
|
276
|
+
|
|
277
|
+
let offset = 0;
|
|
278
|
+
let escaped = '';
|
|
279
|
+
let match;
|
|
280
|
+
|
|
281
|
+
while ((match = pattern.exec(val))) {
|
|
282
|
+
escaped += val.substring(offset, match.index);
|
|
283
|
+
escaped += LITTERAL_ESCAPE[match[0]];
|
|
284
|
+
offset = pattern.lastIndex;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (offset === 0) {
|
|
288
|
+
return val;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (offset < val.length) {
|
|
292
|
+
escaped += val.substring(offset);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return escaped;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
module.exports.escape = escapeParameters;
|