@nocobase/plugin-multi-app-manager 2.0.0-beta.8 → 2.0.0
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/dist/client/{db3a142b120d6553.js → 00b71fff3c8c7167.js} +1 -1
- package/dist/client/Migrate.d.ts +10 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +7 -7
- package/dist/locale/en-US.json +3 -2
- package/dist/locale/zh-CN.json +3 -2
- package/dist/node_modules/p-queue/dist/index.d.ts +101 -0
- package/dist/node_modules/p-queue/dist/index.js +1 -0
- package/dist/node_modules/p-queue/dist/lower-bound.d.ts +1 -0
- package/dist/node_modules/p-queue/dist/lower-bound.js +21 -0
- package/dist/node_modules/p-queue/dist/options.d.ts +64 -0
- package/dist/node_modules/p-queue/dist/options.js +2 -0
- package/dist/node_modules/p-queue/dist/priority-queue.d.ts +12 -0
- package/dist/node_modules/p-queue/dist/priority-queue.js +32 -0
- package/dist/node_modules/p-queue/dist/queue.d.ts +7 -0
- package/dist/node_modules/p-queue/dist/queue.js +2 -0
- package/dist/node_modules/p-queue/license +9 -0
- package/dist/node_modules/p-queue/node_modules/eventemitter3/index.d.ts +134 -0
- package/dist/node_modules/p-queue/node_modules/eventemitter3/index.js +336 -0
- package/dist/node_modules/p-queue/node_modules/eventemitter3/package.json +56 -0
- package/dist/node_modules/p-queue/node_modules/eventemitter3/umd/eventemitter3.js +340 -0
- package/dist/node_modules/p-queue/node_modules/eventemitter3/umd/eventemitter3.min.js +1 -0
- package/dist/node_modules/p-queue/package.json +1 -0
- package/dist/server/adapters/legacy-adapter.d.ts +43 -0
- package/dist/server/adapters/legacy-adapter.js +207 -0
- package/dist/server/server.d.ts +4 -6
- package/dist/server/server.js +38 -191
- package/package.json +2 -2
- package/dist/node_modules/mariadb/LICENSE +0 -502
- package/dist/node_modules/mariadb/callback.js +0 -41
- package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +0 -278
- package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +0 -372
- package/dist/node_modules/mariadb/lib/cmd/change-user.js +0 -149
- package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +0 -17
- package/dist/node_modules/mariadb/lib/cmd/column-definition.js +0 -102
- package/dist/node_modules/mariadb/lib/cmd/command.js +0 -168
- package/dist/node_modules/mariadb/lib/cmd/common-binary-cmd.js +0 -327
- package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +0 -427
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +0 -168
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +0 -23
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +0 -761
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +0 -55
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +0 -58
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +0 -19
- package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +0 -142
- package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +0 -74
- 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/handshake/initial-handshake.js +0 -74
- package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +0 -29
- package/dist/node_modules/mariadb/lib/cmd/ping.js +0 -52
- package/dist/node_modules/mariadb/lib/cmd/query.js +0 -255
- package/dist/node_modules/mariadb/lib/cmd/quit.js +0 -28
- package/dist/node_modules/mariadb/lib/cmd/reset.js +0 -54
- package/dist/node_modules/mariadb/lib/cmd/resultset.js +0 -607
- package/dist/node_modules/mariadb/lib/cmd/stream.js +0 -45
- package/dist/node_modules/mariadb/lib/config/connection-options.js +0 -258
- package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +0 -19
- package/dist/node_modules/mariadb/lib/config/pool-options.js +0 -47
- package/dist/node_modules/mariadb/lib/connection-callback.js +0 -160
- package/dist/node_modules/mariadb/lib/connection.js +0 -1460
- package/dist/node_modules/mariadb/lib/const/capabilities.js +0 -64
- package/dist/node_modules/mariadb/lib/const/collations.js +0 -473
- package/dist/node_modules/mariadb/lib/const/connection_status.js +0 -13
- package/dist/node_modules/mariadb/lib/const/error-code.js +0 -1282
- package/dist/node_modules/mariadb/lib/const/field-detail.js +0 -35
- package/dist/node_modules/mariadb/lib/const/field-type.js +0 -71
- package/dist/node_modules/mariadb/lib/const/server-status.js +0 -30
- package/dist/node_modules/mariadb/lib/const/state-change.js +0 -12
- 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/compression-input-stream.js +0 -141
- package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +0 -171
- package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +0 -193
- package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +0 -36
- package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +0 -37
- package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +0 -502
- package/dist/node_modules/mariadb/lib/io/packet.js +0 -515
- package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +0 -481
- package/dist/node_modules/mariadb/lib/misc/connection-information.js +0 -96
- package/dist/node_modules/mariadb/lib/misc/errors.js +0 -123
- package/dist/node_modules/mariadb/lib/misc/parse.js +0 -1033
- package/dist/node_modules/mariadb/lib/misc/utils.js +0 -298
- package/dist/node_modules/mariadb/lib/pool-base.js +0 -611
- package/dist/node_modules/mariadb/lib/pool-callback.js +0 -202
- package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +0 -66
- package/dist/node_modules/mariadb/lib/pool-cluster.js +0 -407
- package/dist/node_modules/mariadb/lib/pool-promise.js +0 -108
- package/dist/node_modules/mariadb/node_modules/@types/node/assert/strict.d.ts +0 -8
- package/dist/node_modules/mariadb/node_modules/@types/node/assert.d.ts +0 -912
- package/dist/node_modules/mariadb/node_modules/@types/node/async_hooks.d.ts +0 -501
- package/dist/node_modules/mariadb/node_modules/@types/node/buffer.d.ts +0 -2232
- package/dist/node_modules/mariadb/node_modules/@types/node/child_process.d.ts +0 -1366
- package/dist/node_modules/mariadb/node_modules/@types/node/cluster.d.ts +0 -414
- package/dist/node_modules/mariadb/node_modules/@types/node/console.d.ts +0 -412
- package/dist/node_modules/mariadb/node_modules/@types/node/constants.d.ts +0 -18
- package/dist/node_modules/mariadb/node_modules/@types/node/crypto.d.ts +0 -3338
- package/dist/node_modules/mariadb/node_modules/@types/node/dgram.d.ts +0 -545
- package/dist/node_modules/mariadb/node_modules/@types/node/diagnostics_channel.d.ts +0 -152
- package/dist/node_modules/mariadb/node_modules/@types/node/dns/promises.d.ts +0 -370
- package/dist/node_modules/mariadb/node_modules/@types/node/dns.d.ts +0 -659
- package/dist/node_modules/mariadb/node_modules/@types/node/domain.d.ts +0 -169
- package/dist/node_modules/mariadb/node_modules/@types/node/events.d.ts +0 -651
- package/dist/node_modules/mariadb/node_modules/@types/node/fs/promises.d.ts +0 -1091
- package/dist/node_modules/mariadb/node_modules/@types/node/fs.d.ts +0 -3869
- package/dist/node_modules/mariadb/node_modules/@types/node/globals.d.ts +0 -294
- package/dist/node_modules/mariadb/node_modules/@types/node/globals.global.d.ts +0 -1
- package/dist/node_modules/mariadb/node_modules/@types/node/http.d.ts +0 -1396
- package/dist/node_modules/mariadb/node_modules/@types/node/http2.d.ts +0 -2101
- package/dist/node_modules/mariadb/node_modules/@types/node/https.d.ts +0 -391
- package/dist/node_modules/mariadb/node_modules/@types/node/index.d.ts +0 -129
- package/dist/node_modules/mariadb/node_modules/@types/node/inspector.d.ts +0 -2744
- package/dist/node_modules/mariadb/node_modules/@types/node/module.d.ts +0 -114
- package/dist/node_modules/mariadb/node_modules/@types/node/net.d.ts +0 -791
- package/dist/node_modules/mariadb/node_modules/@types/node/os.d.ts +0 -455
- package/dist/node_modules/mariadb/node_modules/@types/node/package.json +0 -220
- package/dist/node_modules/mariadb/node_modules/@types/node/path.d.ts +0 -180
- package/dist/node_modules/mariadb/node_modules/@types/node/perf_hooks.d.ts +0 -557
- package/dist/node_modules/mariadb/node_modules/@types/node/process.d.ts +0 -1481
- package/dist/node_modules/mariadb/node_modules/@types/node/punycode.d.ts +0 -117
- package/dist/node_modules/mariadb/node_modules/@types/node/querystring.d.ts +0 -131
- package/dist/node_modules/mariadb/node_modules/@types/node/readline.d.ts +0 -650
- package/dist/node_modules/mariadb/node_modules/@types/node/repl.d.ts +0 -424
- package/dist/node_modules/mariadb/node_modules/@types/node/stream/consumers.d.ts +0 -24
- package/dist/node_modules/mariadb/node_modules/@types/node/stream/promises.d.ts +0 -42
- package/dist/node_modules/mariadb/node_modules/@types/node/stream/web.d.ts +0 -330
- package/dist/node_modules/mariadb/node_modules/@types/node/stream.d.ts +0 -1249
- package/dist/node_modules/mariadb/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/dist/node_modules/mariadb/node_modules/@types/node/timers/promises.d.ts +0 -68
- package/dist/node_modules/mariadb/node_modules/@types/node/timers.d.ts +0 -94
- package/dist/node_modules/mariadb/node_modules/@types/node/tls.d.ts +0 -1020
- package/dist/node_modules/mariadb/node_modules/@types/node/trace_events.d.ts +0 -161
- package/dist/node_modules/mariadb/node_modules/@types/node/tty.d.ts +0 -204
- package/dist/node_modules/mariadb/node_modules/@types/node/url.d.ts +0 -891
- package/dist/node_modules/mariadb/node_modules/@types/node/util.d.ts +0 -1594
- package/dist/node_modules/mariadb/node_modules/@types/node/v8.d.ts +0 -378
- package/dist/node_modules/mariadb/node_modules/@types/node/vm.d.ts +0 -507
- package/dist/node_modules/mariadb/node_modules/@types/node/wasi.d.ts +0 -158
- package/dist/node_modules/mariadb/node_modules/@types/node/worker_threads.d.ts +0 -649
- package/dist/node_modules/mariadb/node_modules/@types/node/zlib.d.ts +0 -517
- package/dist/node_modules/mariadb/package.json +0 -1
- package/dist/node_modules/mariadb/promise.js +0 -34
- package/dist/node_modules/mariadb/types/index.d.ts +0 -870
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const Query = require('./query');
|
|
4
|
-
const { Readable } = require('stream');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Protocol COM_QUERY with streaming events.
|
|
8
|
-
* see : https://mariadb.com/kb/en/library/com_query/
|
|
9
|
-
*/
|
|
10
|
-
class Stream extends Query {
|
|
11
|
-
constructor(cmdOpts, connOpts, sql, values, socket) {
|
|
12
|
-
super(
|
|
13
|
-
() => {},
|
|
14
|
-
() => {},
|
|
15
|
-
cmdOpts,
|
|
16
|
-
connOpts,
|
|
17
|
-
sql,
|
|
18
|
-
values
|
|
19
|
-
);
|
|
20
|
-
this.socket = socket;
|
|
21
|
-
this.inStream = new Readable({
|
|
22
|
-
objectMode: true,
|
|
23
|
-
read: () => {}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
this.on('fields', function (meta) {
|
|
27
|
-
this.inStream.emit('fields', meta);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
this.on('error', function (err) {
|
|
31
|
-
this.inStream.emit('error', err);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
this.on('end', function (err) {
|
|
35
|
-
if (err) this.inStream.emit('error', err);
|
|
36
|
-
this.inStream.push(null);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
handleNewRows(row) {
|
|
41
|
-
this.inStream.push(row);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
module.exports = Stream;
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const Collations = require('../const/collations.js');
|
|
4
|
-
const urlFormat = /mariadb:\/\/(([^/@:]+)?(:([^/]+))?@)?(([^/:]+)(:([0-9]+))?)\/([^?]+)(\?(.*))?$/;
|
|
5
|
-
const moment = require('moment-timezone');
|
|
6
|
-
const Errors = require('../misc/errors');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Default option similar to mysql driver.
|
|
10
|
-
* known differences
|
|
11
|
-
* - no queryFormat option. Permitting client to parse is a security risk. Best is to give SQL + parameters
|
|
12
|
-
* Only possible Objects are :
|
|
13
|
-
* - Buffer
|
|
14
|
-
* - Date
|
|
15
|
-
* - Object that implement toSqlString function
|
|
16
|
-
* - JSON object
|
|
17
|
-
* + rowsAsArray (in mysql2) permit to have rows by index, not by name. Avoiding to parsing metadata string => faster
|
|
18
|
-
*/
|
|
19
|
-
class ConnectionOptions {
|
|
20
|
-
constructor(opts) {
|
|
21
|
-
if (typeof opts === 'string') {
|
|
22
|
-
opts = ConnectionOptions.parse(opts);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!opts) opts = {};
|
|
26
|
-
this.host = opts.host || 'localhost';
|
|
27
|
-
this.port = opts.port || 3306;
|
|
28
|
-
this.user = opts.user || process.env.USERNAME;
|
|
29
|
-
this.password = opts.password;
|
|
30
|
-
this.database = opts.database;
|
|
31
|
-
if (opts.charset && typeof opts.charset === 'string') {
|
|
32
|
-
this.collation = Collations.fromCharset(opts.charset.toLowerCase());
|
|
33
|
-
if (this.collation === undefined) {
|
|
34
|
-
this.collation = Collations.fromName(opts.charset.toUpperCase());
|
|
35
|
-
if (this.collation !== undefined) {
|
|
36
|
-
console.log(
|
|
37
|
-
"warning: please use option 'collation' " +
|
|
38
|
-
"in replacement of 'charset' when using a collation name ('" +
|
|
39
|
-
opts.charset +
|
|
40
|
-
"')\n" +
|
|
41
|
-
"(collation looks like 'UTF8MB4_UNICODE_CI', charset like 'utf8')."
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (this.collation === undefined)
|
|
46
|
-
throw new RangeError("Unknown charset '" + opts.charset + "'");
|
|
47
|
-
} else if (opts.collation && typeof opts.collation === 'string') {
|
|
48
|
-
this.collation = Collations.fromName(opts.collation.toUpperCase());
|
|
49
|
-
if (this.collation === undefined)
|
|
50
|
-
throw new RangeError("Unknown collation '" + opts.collation + "'");
|
|
51
|
-
} else {
|
|
52
|
-
this.collation = Collations.fromIndex(opts.charsetNumber) || Collations.fromIndex(224); //UTF8MB4_UNICODE_CI;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// connection options
|
|
56
|
-
this.initSql = opts.initSql;
|
|
57
|
-
this.connectTimeout = opts.connectTimeout === undefined ? 1000 : opts.connectTimeout;
|
|
58
|
-
this.connectAttributes = opts.connectAttributes || false;
|
|
59
|
-
this.compress = opts.compress || false;
|
|
60
|
-
this.rsaPublicKey = opts.rsaPublicKey;
|
|
61
|
-
this.cachingRsaPublicKey = opts.cachingRsaPublicKey;
|
|
62
|
-
this.allowPublicKeyRetrieval = opts.allowPublicKeyRetrieval || false;
|
|
63
|
-
this.forceVersionCheck = opts.forceVersionCheck || false;
|
|
64
|
-
this.maxAllowedPacket = opts.maxAllowedPacket;
|
|
65
|
-
this.permitConnectionWhenExpired = opts.permitConnectionWhenExpired || false;
|
|
66
|
-
this.pipelining = opts.pipelining;
|
|
67
|
-
this.timezone = opts.timezone || 'local';
|
|
68
|
-
this.socketPath = opts.socketPath;
|
|
69
|
-
this.sessionVariables = opts.sessionVariables;
|
|
70
|
-
this.ssl = opts.ssl;
|
|
71
|
-
if (opts.ssl) {
|
|
72
|
-
if (typeof opts.ssl !== 'boolean' && typeof opts.ssl !== 'string') {
|
|
73
|
-
this.ssl.rejectUnauthorized = opts.ssl.rejectUnauthorized !== false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// socket
|
|
78
|
-
this.queryTimeout = opts.queryTimeout === undefined ? 0 : opts.queryTimeout;
|
|
79
|
-
this.socketTimeout = opts.socketTimeout === undefined ? 0 : opts.socketTimeout;
|
|
80
|
-
this.keepAliveDelay = opts.keepAliveDelay === undefined ? 0 : opts.keepAliveDelay;
|
|
81
|
-
|
|
82
|
-
// log
|
|
83
|
-
this.debug = opts.debug || false;
|
|
84
|
-
this.debugCompress = opts.debugCompress || false;
|
|
85
|
-
this.debugLen = opts.debugLen || 256;
|
|
86
|
-
this.logPackets = opts.logPackets || false;
|
|
87
|
-
this.trace = opts.trace || false;
|
|
88
|
-
|
|
89
|
-
// result-set
|
|
90
|
-
this.checkDuplicate = opts.checkDuplicate === undefined ? true : opts.checkDuplicate;
|
|
91
|
-
this.dateStrings = opts.dateStrings || false;
|
|
92
|
-
this.foundRows = opts.foundRows === undefined || opts.foundRows;
|
|
93
|
-
this.metaAsArray = opts.metaAsArray || false;
|
|
94
|
-
this.multipleStatements = opts.multipleStatements || false;
|
|
95
|
-
this.namedPlaceholders = opts.namedPlaceholders || false;
|
|
96
|
-
this.nestTables = opts.nestTables;
|
|
97
|
-
this.autoJsonMap = opts.autoJsonMap === undefined ? true : opts.autoJsonMap;
|
|
98
|
-
this.arrayParenthesis = opts.arrayParenthesis || false;
|
|
99
|
-
this.permitSetMultiParamEntries = opts.permitSetMultiParamEntries || false;
|
|
100
|
-
this.rowsAsArray = opts.rowsAsArray || false;
|
|
101
|
-
this.supportBigNumbers = opts.supportBigNumbers || false;
|
|
102
|
-
this.supportBigInt = opts.supportBigInt || false;
|
|
103
|
-
this.skipSetTimezone = opts.skipSetTimezone || false;
|
|
104
|
-
this.typeCast = opts.typeCast;
|
|
105
|
-
if (this.typeCast !== undefined && typeof this.typeCast !== 'function') {
|
|
106
|
-
this.typeCast = undefined;
|
|
107
|
-
}
|
|
108
|
-
this.bigNumberStrings = opts.bigNumberStrings || false;
|
|
109
|
-
this.bulk = opts.bulk === undefined || opts.bulk;
|
|
110
|
-
|
|
111
|
-
// coherence check
|
|
112
|
-
if (opts.pipelining === undefined) {
|
|
113
|
-
this.permitLocalInfile = opts.permitLocalInfile || false;
|
|
114
|
-
this.pipelining = !this.permitLocalInfile;
|
|
115
|
-
} else {
|
|
116
|
-
this.pipelining = opts.pipelining;
|
|
117
|
-
if (opts.permitLocalInfile === true && this.pipelining) {
|
|
118
|
-
throw new Error(
|
|
119
|
-
'enabling options `permitLocalInfile` and `pipelining` is not possible, options are incompatible.'
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
this.permitLocalInfile = this.pipelining ? false : opts.permitLocalInfile || false;
|
|
123
|
-
}
|
|
124
|
-
if (this.maxAllowedPacket && !Number.isInteger(this.maxAllowedPacket)) {
|
|
125
|
-
throw new RangeError(
|
|
126
|
-
"maxAllowedPacket must be an integer. was '" + this.maxAllowedPacket + "'"
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
if (this.timezone && this.timezone !== 'local' && this.timezone !== 'auto') {
|
|
130
|
-
let tzName = this.timezone;
|
|
131
|
-
if (this.timezone === 'Z') {
|
|
132
|
-
tzName = 'Etc/UTC';
|
|
133
|
-
} else {
|
|
134
|
-
const matched = this.timezone.match(/([+\-\s])(\d\d):?(\d\d)?/);
|
|
135
|
-
if (matched) {
|
|
136
|
-
const hour = (matched[1] === '-' ? 1 : -1) * Number.parseInt(matched[2], 10);
|
|
137
|
-
const minutes = matched.length > 2 && matched[3] ? Number.parseInt(matched[3], 10) : 0;
|
|
138
|
-
if (minutes > 0) {
|
|
139
|
-
throw new RangeError(
|
|
140
|
-
"timezone format incompatible with IANA standard timezone format was '" +
|
|
141
|
-
this.timezone +
|
|
142
|
-
"'"
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
if (hour == 0) {
|
|
146
|
-
tzName = 'Etc/UTC';
|
|
147
|
-
} else {
|
|
148
|
-
tzName = 'Etc/GMT' + (matched[1] === '-' ? '+' : '') + hour;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
this._localTz = moment.tz.guess();
|
|
153
|
-
if (tzName === this._localTz) {
|
|
154
|
-
this.tz = null;
|
|
155
|
-
} else {
|
|
156
|
-
this.tz = tzName;
|
|
157
|
-
if (!moment.tz.zone(tzName)) {
|
|
158
|
-
throw Errors.createError(
|
|
159
|
-
"Unknown IANA timezone '" + tzName + "'.",
|
|
160
|
-
null,
|
|
161
|
-
true,
|
|
162
|
-
null,
|
|
163
|
-
'08S01',
|
|
164
|
-
Errors.ER_WRONG_IANA_TIMEZONE
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* When parsing from String, correcting type.
|
|
173
|
-
*
|
|
174
|
-
* @param opts options
|
|
175
|
-
* @return {opts}
|
|
176
|
-
*/
|
|
177
|
-
static parseOptionDataType(opts) {
|
|
178
|
-
if (opts.bigNumberStrings) opts.bigNumberStrings = opts.bigNumberStrings == 'true';
|
|
179
|
-
if (opts.bulk) opts.bulk = opts.bulk == 'true';
|
|
180
|
-
if (opts.rsaPublicKey) opts.rsaPublicKey = opts.rsaPublicKey;
|
|
181
|
-
if (opts.cachingRsaPublicKey) opts.cachingRsaPublicKey = opts.cachingRsaPublicKey;
|
|
182
|
-
if (opts.logPackets) opts.logPackets = opts.logPackets == 'true';
|
|
183
|
-
if (opts.allowPublicKeyRetrieval)
|
|
184
|
-
opts.allowPublicKeyRetrieval = opts.allowPublicKeyRetrieval == 'true';
|
|
185
|
-
|
|
186
|
-
if (opts.charsetNumber && !isNaN(Number.parseInt(opts.charsetNumber))) {
|
|
187
|
-
opts.charsetNumber = Number.parseInt(opts.charsetNumber);
|
|
188
|
-
}
|
|
189
|
-
if (opts.compress) opts.compress = opts.compress == 'true';
|
|
190
|
-
if (opts.connectAttributes) opts.connectAttributes = JSON.parse(opts.connectAttributes);
|
|
191
|
-
if (opts.connectTimeout) opts.connectTimeout = parseInt(opts.connectTimeout);
|
|
192
|
-
if (opts.keepAliveDelay) opts.keepAliveDelay = parseInt(opts.keepAliveDelay);
|
|
193
|
-
if (opts.socketTimeout) opts.socketTimeout = parseInt(opts.socketTimeout);
|
|
194
|
-
if (opts.dateStrings) opts.dateStrings = opts.dateStrings == 'true';
|
|
195
|
-
if (opts.debug) opts.debug = opts.debug == 'true';
|
|
196
|
-
if (opts.autoJsonMap) opts.autoJsonMap = opts.autoJsonMap == 'true';
|
|
197
|
-
if (opts.arrayParenthesis) opts.arrayParenthesis = opts.arrayParenthesis == 'true';
|
|
198
|
-
if (opts.skipSetTimezone) opts.skipSetTimezone = opts.skipSetTimezone == 'true';
|
|
199
|
-
|
|
200
|
-
if (opts.checkDuplicate) opts.checkDuplicate = opts.checkDuplicate == 'true';
|
|
201
|
-
if (opts.debugCompress) opts.debugCompress = opts.debugCompress == 'true';
|
|
202
|
-
if (opts.debugLen) opts.debugLen = parseInt(opts.debugLen);
|
|
203
|
-
if (opts.queryTimeout) opts.queryTimeout = parseInt(opts.queryTimeout);
|
|
204
|
-
if (opts.foundRows) opts.foundRows = opts.foundRows == 'true';
|
|
205
|
-
if (opts.maxAllowedPacket && !isNaN(Number.parseInt(opts.maxAllowedPacket)))
|
|
206
|
-
opts.maxAllowedPacket = parseInt(opts.maxAllowedPacket);
|
|
207
|
-
if (opts.metaAsArray) opts.metaAsArray = opts.metaAsArray == 'true';
|
|
208
|
-
if (opts.multipleStatements) opts.multipleStatements = opts.multipleStatements == 'true';
|
|
209
|
-
if (opts.namedPlaceholders) opts.namedPlaceholders = opts.namedPlaceholders == 'true';
|
|
210
|
-
if (opts.nestTables) opts.nestTables = opts.nestTables == 'true';
|
|
211
|
-
if (opts.permitSetMultiParamEntries)
|
|
212
|
-
opts.permitSetMultiParamEntries = opts.permitSetMultiParamEntries == 'true';
|
|
213
|
-
if (opts.pipelining) opts.pipelining = opts.pipelining == 'true';
|
|
214
|
-
if (opts.forceVersionCheck) opts.forceVersionCheck = opts.forceVersionCheck == 'true';
|
|
215
|
-
if (opts.rowsAsArray) opts.rowsAsArray = opts.rowsAsArray == 'true';
|
|
216
|
-
if (opts.supportBigNumbers) opts.supportBigNumbers = opts.supportBigNumbers == 'true';
|
|
217
|
-
if (opts.supportBigInt) opts.supportBigInt = opts.supportBigInt == 'true';
|
|
218
|
-
if (opts.trace) opts.trace = opts.trace == 'true';
|
|
219
|
-
if (opts.ssl && (opts.ssl == 'true' || opts.ssl == 'false')) opts.ssl = opts.ssl == 'true';
|
|
220
|
-
return opts;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
static parse(opts) {
|
|
224
|
-
const matchResults = opts.match(urlFormat);
|
|
225
|
-
|
|
226
|
-
if (!matchResults) {
|
|
227
|
-
throw new Error(
|
|
228
|
-
"error parsing connection string '" +
|
|
229
|
-
opts +
|
|
230
|
-
"'. format must be 'mariadb://[<user>[:<password>]@]<host>[:<port>]/[<db>[?<opt1>=<value1>[&<opt2>=<value2>]]]'"
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
const options = {
|
|
234
|
-
user: matchResults[2] ? decodeURIComponent(matchResults[2]) : undefined,
|
|
235
|
-
password: matchResults[4] ? decodeURIComponent(matchResults[4]) : undefined,
|
|
236
|
-
host: matchResults[6] ? decodeURIComponent(matchResults[6]) : matchResults[6],
|
|
237
|
-
port: matchResults[8] ? parseInt(matchResults[8]) : undefined,
|
|
238
|
-
database: matchResults[9] ? decodeURIComponent(matchResults[9]) : matchResults[9]
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
const variousOptsString = matchResults[11];
|
|
242
|
-
if (variousOptsString) {
|
|
243
|
-
const keyVals = variousOptsString.split('&');
|
|
244
|
-
keyVals.forEach(function (keyVal) {
|
|
245
|
-
const equalIdx = keyVal.indexOf('=');
|
|
246
|
-
if (equalIdx !== 1) {
|
|
247
|
-
let val = keyVal.substring(equalIdx + 1);
|
|
248
|
-
val = val ? decodeURIComponent(val) : undefined;
|
|
249
|
-
options[keyVal.substring(0, equalIdx)] = val;
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return this.parseOptionDataType(options);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
module.exports = ConnectionOptions;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
class PoolClusterOptions {
|
|
4
|
-
constructor(opts) {
|
|
5
|
-
if (opts) {
|
|
6
|
-
this.canRetry = opts.canRetry === undefined ? true : opts.canRetry;
|
|
7
|
-
this.removeNodeErrorCount = opts.removeNodeErrorCount || 5;
|
|
8
|
-
this.restoreNodeTimeout = opts.restoreNodeTimeout || 1000;
|
|
9
|
-
this.defaultSelector = opts.defaultSelector || 'RR';
|
|
10
|
-
} else {
|
|
11
|
-
this.canRetry = true;
|
|
12
|
-
this.removeNodeErrorCount = 5;
|
|
13
|
-
this.restoreNodeTimeout = 1000;
|
|
14
|
-
this.defaultSelector = 'RR';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = PoolClusterOptions;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
let ConnOptions = require('./connection-options');
|
|
4
|
-
|
|
5
|
-
class PoolOptions {
|
|
6
|
-
constructor(opts) {
|
|
7
|
-
if (typeof opts === 'string') {
|
|
8
|
-
opts = ConnOptions.parse(opts);
|
|
9
|
-
|
|
10
|
-
//set data type
|
|
11
|
-
if (opts.acquireTimeout) opts.acquireTimeout = parseInt(opts.acquireTimeout);
|
|
12
|
-
if (opts.connectionLimit) opts.connectionLimit = parseInt(opts.connectionLimit);
|
|
13
|
-
if (opts.idleTimeout) opts.idleTimeout = parseInt(opts.idleTimeout);
|
|
14
|
-
if (opts.leakDetectionTimeout)
|
|
15
|
-
opts.leakDetectionTimeout = parseInt(opts.leakDetectionTimeout);
|
|
16
|
-
if (opts.initializationTimeout)
|
|
17
|
-
opts.initializationTimeout = parseInt(opts.initializationTimeout);
|
|
18
|
-
if (opts.minDelayValidation) opts.minDelayValidation = parseInt(opts.minDelayValidation);
|
|
19
|
-
if (opts.minimumIdle) opts.minimumIdle = parseInt(opts.minimumIdle);
|
|
20
|
-
if (opts.noControlAfterUse) opts.noControlAfterUse = opts.noControlAfterUse == 'true';
|
|
21
|
-
if (opts.resetAfterUse) opts.resetAfterUse = opts.resetAfterUse == 'true';
|
|
22
|
-
if (opts.pingTimeout) opts.pingTimeout = parseInt(opts.pingTimeout);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
this.acquireTimeout = opts.acquireTimeout === undefined ? 10000 : opts.acquireTimeout;
|
|
26
|
-
this.connectionLimit = opts.connectionLimit === undefined ? 10 : opts.connectionLimit;
|
|
27
|
-
this.idleTimeout = opts.idleTimeout || 1800;
|
|
28
|
-
this.leakDetectionTimeout = opts.leakDetectionTimeout || 0;
|
|
29
|
-
this.initializationTimeout =
|
|
30
|
-
opts.initializationTimeout === undefined ? 30000 : opts.initializationTimeout;
|
|
31
|
-
this.minDelayValidation = opts.minDelayValidation === undefined ? 500 : opts.minDelayValidation;
|
|
32
|
-
this.minimumIdle =
|
|
33
|
-
opts.minimumIdle === undefined
|
|
34
|
-
? this.connectionLimit
|
|
35
|
-
: Math.min(opts.minimumIdle, this.connectionLimit);
|
|
36
|
-
this.noControlAfterUse = opts.noControlAfterUse || false;
|
|
37
|
-
this.resetAfterUse = opts.resetAfterUse === undefined ? true : opts.resetAfterUse;
|
|
38
|
-
this.pingTimeout = opts.pingTimeout || 250;
|
|
39
|
-
this.connOptions = new ConnOptions(opts);
|
|
40
|
-
|
|
41
|
-
if (this.acquireTimeout > 0 && this.connOptions.connectTimeout > this.acquireTimeout) {
|
|
42
|
-
this.connOptions.connectTimeout = this.acquireTimeout;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
module.exports = PoolOptions;
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const Connection = require('./connection');
|
|
4
|
-
const util = require('util');
|
|
5
|
-
const Errors = require('./misc/errors');
|
|
6
|
-
const { Status } = require('./const/connection_status');
|
|
7
|
-
|
|
8
|
-
function ConnectionCallback(options) {
|
|
9
|
-
Connection.call(this, options);
|
|
10
|
-
|
|
11
|
-
let connecting = 1;
|
|
12
|
-
const connectPromise = this.connect.bind(this);
|
|
13
|
-
const changeUserPromise = this.changeUser.bind(this);
|
|
14
|
-
const queryPromise = this.query.bind(this);
|
|
15
|
-
const endPromise = this.end.bind(this);
|
|
16
|
-
const pingPromise = this.ping.bind(this);
|
|
17
|
-
const resetPromise = this.reset.bind(this);
|
|
18
|
-
const commitPromise = this.commit.bind(this);
|
|
19
|
-
const rollbackPromise = this.rollback.bind(this);
|
|
20
|
-
|
|
21
|
-
const emptySuccess = (rows) => {};
|
|
22
|
-
const emptyError = (err) => {};
|
|
23
|
-
|
|
24
|
-
//*****************************************************************
|
|
25
|
-
// internal equivalent with callback of promised functions
|
|
26
|
-
//*****************************************************************
|
|
27
|
-
|
|
28
|
-
const _commitCallback = (callback) => {
|
|
29
|
-
commitPromise()
|
|
30
|
-
.then(() => {
|
|
31
|
-
if (callback) callback(null, null, null);
|
|
32
|
-
})
|
|
33
|
-
.catch(callback || emptyError);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const _rollbackCallback = (callback) => {
|
|
37
|
-
rollbackPromise()
|
|
38
|
-
.then(() => {
|
|
39
|
-
if (callback) callback(null, null, null);
|
|
40
|
-
})
|
|
41
|
-
.catch(callback || emptyError);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const _pingCallback = (timeout, callback) => {
|
|
45
|
-
let _timeout, _cb;
|
|
46
|
-
if (typeof timeout === 'function') {
|
|
47
|
-
_cb = timeout;
|
|
48
|
-
_timeout = undefined;
|
|
49
|
-
} else {
|
|
50
|
-
_timeout = timeout;
|
|
51
|
-
_cb = callback;
|
|
52
|
-
}
|
|
53
|
-
pingPromise(_timeout)
|
|
54
|
-
.then(_cb || emptySuccess)
|
|
55
|
-
.catch(_cb || emptyError);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const _resetCallback = (callback) => {
|
|
59
|
-
resetPromise()
|
|
60
|
-
.then(callback || emptySuccess)
|
|
61
|
-
.catch(callback || emptyError);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const _beginTransactionCallback = (callback) => {
|
|
65
|
-
queryPromise('START TRANSACTION')
|
|
66
|
-
.then(() => {
|
|
67
|
-
if (callback) callback(null, null, null);
|
|
68
|
-
})
|
|
69
|
-
.catch(callback || emptyError);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const _endCallback = (callback) => {
|
|
73
|
-
endPromise()
|
|
74
|
-
.then(callback || emptySuccess)
|
|
75
|
-
.catch(callback || emptyError);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const _connectCallback = function (callback) {
|
|
79
|
-
if (!callback) {
|
|
80
|
-
throw new Errors.createError(
|
|
81
|
-
'missing callback parameter',
|
|
82
|
-
null,
|
|
83
|
-
false,
|
|
84
|
-
this.info,
|
|
85
|
-
'HY000',
|
|
86
|
-
Errors.ER_MISSING_PARAMETER
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (connecting === 1) {
|
|
91
|
-
this.on('connect', callback);
|
|
92
|
-
} else {
|
|
93
|
-
switch (this._status()) {
|
|
94
|
-
case Status.CLOSING:
|
|
95
|
-
case Status.CLOSED:
|
|
96
|
-
callback(
|
|
97
|
-
Errors.createError(
|
|
98
|
-
'Connection closed',
|
|
99
|
-
null,
|
|
100
|
-
true,
|
|
101
|
-
this.info,
|
|
102
|
-
'08S01',
|
|
103
|
-
Errors.ER_CONNECTION_ALREADY_CLOSED
|
|
104
|
-
)
|
|
105
|
-
);
|
|
106
|
-
break;
|
|
107
|
-
|
|
108
|
-
default:
|
|
109
|
-
callback();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const _changeUserCallback = (options, callback) => {
|
|
115
|
-
let _options, _cb;
|
|
116
|
-
if (typeof options === 'function') {
|
|
117
|
-
_cb = options;
|
|
118
|
-
_options = undefined;
|
|
119
|
-
} else {
|
|
120
|
-
_options = options;
|
|
121
|
-
_cb = callback;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
changeUserPromise(_options)
|
|
125
|
-
.then(() => {
|
|
126
|
-
if (_cb) _cb(null, null, null);
|
|
127
|
-
})
|
|
128
|
-
.catch(_cb || emptyError);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
//*****************************************************************
|
|
132
|
-
// replacing public promise function with callback equivalent
|
|
133
|
-
//*****************************************************************
|
|
134
|
-
|
|
135
|
-
this.commit = _commitCallback;
|
|
136
|
-
this.rollback = _rollbackCallback;
|
|
137
|
-
this.ping = _pingCallback;
|
|
138
|
-
this.reset = _resetCallback;
|
|
139
|
-
this.end = _endCallback;
|
|
140
|
-
this.connect = _connectCallback;
|
|
141
|
-
this.changeUser = _changeUserCallback;
|
|
142
|
-
this.query = this._queryCallback;
|
|
143
|
-
this.batch = this._batchCallback;
|
|
144
|
-
this.beginTransaction = _beginTransactionCallback;
|
|
145
|
-
|
|
146
|
-
const self = this;
|
|
147
|
-
connectPromise()
|
|
148
|
-
.then(() => {
|
|
149
|
-
connecting = 0;
|
|
150
|
-
self.emit('connect');
|
|
151
|
-
})
|
|
152
|
-
.catch((err) => {
|
|
153
|
-
connecting = 0;
|
|
154
|
-
self.emit('connect', err);
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
util.inherits(ConnectionCallback, Connection);
|
|
159
|
-
|
|
160
|
-
module.exports = ConnectionCallback;
|