@depup/mysql2 3.23.2-depup.0 → 3.23.3-depup.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/README.md +3 -9
- package/changes.json +3 -8
- package/lib/base/connection.js +22 -16
- package/lib/base/pool.js +24 -3
- package/lib/commands/binlog_dump.js +2 -1
- package/lib/commands/query.js +6 -2
- package/lib/compressed_protocol.js +0 -3
- package/lib/packets/encode_parameter.js +0 -2
- package/lib/packets/resultset_header.js +0 -1
- package/lib/ring_queue.js +353 -0
- package/package.json +17 -31
- package/typings/mysql/lib/Tracing.d.ts +4 -8
package/README.md
CHANGED
|
@@ -13,16 +13,10 @@ npm install @depup/mysql2
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [mysql2](https://www.npmjs.com/package/mysql2) @ 3.23.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [mysql2](https://www.npmjs.com/package/mysql2) @ 3.23.3 |
|
|
17
|
+
| Processed | 2026-08-10 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
|
-
| Deps updated |
|
|
20
|
-
|
|
21
|
-
## Dependency Changes
|
|
22
|
-
|
|
23
|
-
| Dependency | From | To |
|
|
24
|
-
|------------|------|-----|
|
|
25
|
-
| iconv-lite | ^0.7.2 | ^0.7.3 |
|
|
19
|
+
| Deps updated | 0 |
|
|
26
20
|
|
|
27
21
|
---
|
|
28
22
|
|
package/changes.json
CHANGED
package/lib/base/connection.js
CHANGED
|
@@ -20,7 +20,7 @@ const Tls = require('tls');
|
|
|
20
20
|
const Timers = require('timers');
|
|
21
21
|
const EventEmitter = require('events').EventEmitter;
|
|
22
22
|
const Readable = require('stream').Readable;
|
|
23
|
-
const Queue = require('
|
|
23
|
+
const Queue = require('../ring_queue.js');
|
|
24
24
|
const SqlString = require('sql-escaper');
|
|
25
25
|
const { createLRU } = require('lru.min');
|
|
26
26
|
const PacketParser = require('../packet_parser.js');
|
|
@@ -104,7 +104,8 @@ class BaseConnection extends EventEmitter {
|
|
|
104
104
|
this.handlePacket(p);
|
|
105
105
|
});
|
|
106
106
|
this.stream.on('data', (data) => {
|
|
107
|
-
|
|
107
|
+
// Server-side connections do not run ClientHandshake.
|
|
108
|
+
if (this.connectTimeout && this.config.isServer) {
|
|
108
109
|
Timers.clearTimeout(this.connectTimeout);
|
|
109
110
|
this.connectTimeout = null;
|
|
110
111
|
}
|
|
@@ -133,6 +134,10 @@ class BaseConnection extends EventEmitter {
|
|
|
133
134
|
if (!this.config.isServer) {
|
|
134
135
|
handshakeCommand = new Commands.ClientHandshake(this.config.clientFlags);
|
|
135
136
|
handshakeCommand.on('end', () => {
|
|
137
|
+
if (this.connectTimeout) {
|
|
138
|
+
Timers.clearTimeout(this.connectTimeout);
|
|
139
|
+
this.connectTimeout = null;
|
|
140
|
+
}
|
|
136
141
|
// this happens when handshake finishes early either because there was
|
|
137
142
|
// some fatal error or the server sent an error packet instead of
|
|
138
143
|
// an hello packet (for example, 'Too many connections' error)
|
|
@@ -160,7 +165,6 @@ class BaseConnection extends EventEmitter {
|
|
|
160
165
|
connectChannel,
|
|
161
166
|
() =>
|
|
162
167
|
new Promise((resolve, reject) => {
|
|
163
|
-
/* eslint-disable prefer-const */
|
|
164
168
|
let onConnect, onError;
|
|
165
169
|
onConnect = (param) => {
|
|
166
170
|
this.removeListener('error', onError);
|
|
@@ -170,7 +174,6 @@ class BaseConnection extends EventEmitter {
|
|
|
170
174
|
this.removeListener('connect', onConnect);
|
|
171
175
|
reject(err);
|
|
172
176
|
};
|
|
173
|
-
/* eslint-enable prefer-const */
|
|
174
177
|
this.once('connect', onConnect);
|
|
175
178
|
this.once('error', onError);
|
|
176
179
|
}),
|
|
@@ -271,13 +274,11 @@ class BaseConnection extends EventEmitter {
|
|
|
271
274
|
// connection handshake is special because we allow it to be implicit
|
|
272
275
|
// if error happened during handshake, but there are others commands in queue
|
|
273
276
|
// then bubble error to other commands and not to connection
|
|
274
|
-
} else if (
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
)
|
|
280
|
-
) {
|
|
277
|
+
} else if (!(
|
|
278
|
+
this._command &&
|
|
279
|
+
this._command.constructor === Commands.ClientHandshake &&
|
|
280
|
+
this._commands.length > 0
|
|
281
|
+
)) {
|
|
281
282
|
bubbleErrorToConnection = true;
|
|
282
283
|
}
|
|
283
284
|
while ((command = this._commands.shift())) {
|
|
@@ -583,7 +584,7 @@ class BaseConnection extends EventEmitter {
|
|
|
583
584
|
return cmd;
|
|
584
585
|
}
|
|
585
586
|
|
|
586
|
-
format(sql, values) {
|
|
587
|
+
format(sql, values, namedPlaceholders) {
|
|
587
588
|
if (typeof this.config.queryFormat === 'function') {
|
|
588
589
|
return this.config.queryFormat.call(
|
|
589
590
|
this,
|
|
@@ -596,6 +597,9 @@ class BaseConnection extends EventEmitter {
|
|
|
596
597
|
sql: sql,
|
|
597
598
|
values: values,
|
|
598
599
|
};
|
|
600
|
+
if (typeof namedPlaceholders !== 'undefined') {
|
|
601
|
+
opts.namedPlaceholders = namedPlaceholders;
|
|
602
|
+
}
|
|
599
603
|
this._resolveNamedPlaceholders(opts);
|
|
600
604
|
return SqlString.format(
|
|
601
605
|
opts.sql,
|
|
@@ -619,7 +623,10 @@ class BaseConnection extends EventEmitter {
|
|
|
619
623
|
|
|
620
624
|
_resolveNamedPlaceholders(options) {
|
|
621
625
|
let unnamed;
|
|
622
|
-
if (
|
|
626
|
+
if (typeof options.namedPlaceholders === 'undefined') {
|
|
627
|
+
options.namedPlaceholders = this.config.namedPlaceholders;
|
|
628
|
+
}
|
|
629
|
+
if (options.namedPlaceholders) {
|
|
623
630
|
if (Array.isArray(options.values)) {
|
|
624
631
|
// if an array is provided as the values, assume the conversion is not necessary.
|
|
625
632
|
// this allows the usage of unnamed placeholders even if the namedPlaceholders flag is enabled.
|
|
@@ -644,7 +651,8 @@ class BaseConnection extends EventEmitter {
|
|
|
644
651
|
this._resolveNamedPlaceholders(cmdQuery);
|
|
645
652
|
const rawSql = this.format(
|
|
646
653
|
cmdQuery.sql,
|
|
647
|
-
cmdQuery.values !== undefined ? cmdQuery.values : []
|
|
654
|
+
cmdQuery.values !== undefined ? cmdQuery.values : [],
|
|
655
|
+
cmdQuery.namedPlaceholders
|
|
648
656
|
);
|
|
649
657
|
cmdQuery.sql = rawSql;
|
|
650
658
|
|
|
@@ -997,7 +1005,6 @@ class BaseConnection extends EventEmitter {
|
|
|
997
1005
|
return cb(null, this);
|
|
998
1006
|
}
|
|
999
1007
|
|
|
1000
|
-
/* eslint-disable prefer-const */
|
|
1001
1008
|
let onError, onConnect;
|
|
1002
1009
|
|
|
1003
1010
|
onError = (param) => {
|
|
@@ -1009,7 +1016,6 @@ class BaseConnection extends EventEmitter {
|
|
|
1009
1016
|
this.removeListener('error', onError);
|
|
1010
1017
|
cb(null, param);
|
|
1011
1018
|
};
|
|
1012
|
-
/* eslint-enable prefer-const */
|
|
1013
1019
|
|
|
1014
1020
|
this.once('error', onError);
|
|
1015
1021
|
this.once('connect', onConnect);
|
package/lib/base/pool.js
CHANGED
|
@@ -4,7 +4,7 @@ const process = require('process');
|
|
|
4
4
|
const SqlString = require('sql-escaper');
|
|
5
5
|
const EventEmitter = require('events').EventEmitter;
|
|
6
6
|
const PoolConnection = require('../pool_connection.js');
|
|
7
|
-
const Queue = require('
|
|
7
|
+
const Queue = require('../ring_queue.js');
|
|
8
8
|
const BaseConnection = require('./connection.js');
|
|
9
9
|
const Errors = require('../constants/errors.js');
|
|
10
10
|
const {
|
|
@@ -53,6 +53,23 @@ class BasePool extends EventEmitter {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Creates a per-connection copy of the pool connection config.
|
|
58
|
+
*
|
|
59
|
+
* Commands like `changeUser` mutate `connection.config` in place. Sharing a
|
|
60
|
+
* single config object between every pooled connection made those mutations
|
|
61
|
+
* leak into connections created later. The prototype is preserved so the
|
|
62
|
+
* copy is still a `ConnectionConfig`.
|
|
63
|
+
*/
|
|
64
|
+
_createConnectionConfig() {
|
|
65
|
+
const { connectionConfig } = this.config;
|
|
66
|
+
|
|
67
|
+
return Object.create(
|
|
68
|
+
Object.getPrototypeOf(connectionConfig),
|
|
69
|
+
Object.getOwnPropertyDescriptors(connectionConfig)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
56
73
|
getConnection(cb) {
|
|
57
74
|
const _getConnection = (cb) => {
|
|
58
75
|
if (this._closed) {
|
|
@@ -72,7 +89,7 @@ class BasePool extends EventEmitter {
|
|
|
72
89
|
this._allConnections.length < this.config.connectionLimit
|
|
73
90
|
) {
|
|
74
91
|
connection = new PoolConnection(this, {
|
|
75
|
-
config: this.
|
|
92
|
+
config: this._createConnectionConfig(),
|
|
76
93
|
});
|
|
77
94
|
this._allConnections.push(connection);
|
|
78
95
|
return connection.connect((err) => {
|
|
@@ -254,7 +271,11 @@ class BasePool extends EventEmitter {
|
|
|
254
271
|
});
|
|
255
272
|
} catch (e) {
|
|
256
273
|
conn.release();
|
|
257
|
-
|
|
274
|
+
if (typeof cmdQuery.onResult === 'function') {
|
|
275
|
+
cmdQuery.onResult(e);
|
|
276
|
+
} else {
|
|
277
|
+
cmdQuery.emit('error', e);
|
|
278
|
+
}
|
|
258
279
|
}
|
|
259
280
|
});
|
|
260
281
|
return cmdQuery;
|
|
@@ -68,7 +68,8 @@ class RotateEvent {
|
|
|
68
68
|
class FormatDescriptionEvent {
|
|
69
69
|
constructor(packet) {
|
|
70
70
|
this.binlogVersion = packet.readInt16();
|
|
71
|
-
|
|
71
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: the server version string is NUL-terminated
|
|
72
|
+
this.serverVersion = packet.readString(50).replace(/\u0000.*/, '');
|
|
72
73
|
this.createTimestamp = packet.readInt32();
|
|
73
74
|
this.eventHeaderLength = packet.readInt8(); // should be 19
|
|
74
75
|
this.eventsLength = packet.readBuffer();
|
package/lib/commands/query.js
CHANGED
|
@@ -20,7 +20,12 @@ class Query extends Command {
|
|
|
20
20
|
this.sql = options.sql;
|
|
21
21
|
this.values = options.values;
|
|
22
22
|
this._queryOptions = options;
|
|
23
|
-
this.namedPlaceholders =
|
|
23
|
+
this.namedPlaceholders = Object.prototype.hasOwnProperty.call(
|
|
24
|
+
options,
|
|
25
|
+
'namedPlaceholders'
|
|
26
|
+
)
|
|
27
|
+
? options.namedPlaceholders
|
|
28
|
+
: undefined;
|
|
24
29
|
this.onResult = callback;
|
|
25
30
|
this.timeout = options.timeout;
|
|
26
31
|
this.queryTimeout = null;
|
|
@@ -44,7 +49,6 @@ class Query extends Command {
|
|
|
44
49
|
throw new Error(err);
|
|
45
50
|
}
|
|
46
51
|
|
|
47
|
-
/* eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }] */
|
|
48
52
|
start(_packet, connection) {
|
|
49
53
|
if (connection.config.debug) {
|
|
50
54
|
console.log(' Sending query command: %s', this.sql);
|
|
@@ -33,7 +33,6 @@ class Queue {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function handleCompressedPacket(packet) {
|
|
36
|
-
// eslint-disable-next-line consistent-this, no-invalid-this
|
|
37
36
|
const connection = this;
|
|
38
37
|
const deflatedLength = packet.readInt24();
|
|
39
38
|
const body = packet.readBuffer();
|
|
@@ -71,7 +70,6 @@ function writeCompressed(buffer) {
|
|
|
71
70
|
if (buffer.length > MAX_COMPRESSED_LENGTH) {
|
|
72
71
|
for (start = 0; start < buffer.length; start += MAX_COMPRESSED_LENGTH) {
|
|
73
72
|
writeCompressed.call(
|
|
74
|
-
// eslint-disable-next-line no-invalid-this
|
|
75
73
|
this,
|
|
76
74
|
buffer.slice(start, start + MAX_COMPRESSED_LENGTH)
|
|
77
75
|
);
|
|
@@ -79,7 +77,6 @@ function writeCompressed(buffer) {
|
|
|
79
77
|
return;
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
// eslint-disable-next-line no-invalid-this, consistent-this
|
|
83
80
|
const connection = this;
|
|
84
81
|
|
|
85
82
|
let packetLen = buffer.length;
|
|
@@ -15,7 +15,6 @@ function toParameter(value, encoding, timezone, jsonAsString) {
|
|
|
15
15
|
let type = Types.VAR_STRING;
|
|
16
16
|
let length;
|
|
17
17
|
let writer = function (value) {
|
|
18
|
-
// eslint-disable-next-line no-invalid-this
|
|
19
18
|
return Packet.prototype.writeLengthCodedString.call(this, value, encoding);
|
|
20
19
|
};
|
|
21
20
|
if (value !== null) {
|
|
@@ -41,7 +40,6 @@ function toParameter(value, encoding, timezone, jsonAsString) {
|
|
|
41
40
|
type = Types.DATETIME;
|
|
42
41
|
length = 12;
|
|
43
42
|
writer = function (value) {
|
|
44
|
-
// eslint-disable-next-line no-invalid-this
|
|
45
43
|
return Packet.prototype.writeDate.call(this, value, timezone);
|
|
46
44
|
};
|
|
47
45
|
} else if (isJSON(value)) {
|
|
@@ -80,7 +80,6 @@ class ResultSetHeader {
|
|
|
80
80
|
packet.readLengthCodedString(encoding);
|
|
81
81
|
} else if (type === sessionInfoTypes.STATE_GTIDS) {
|
|
82
82
|
// TODO: find if the first length coded string means anything. Usually comes as empty
|
|
83
|
-
// eslint-disable-next-line no-unused-vars
|
|
84
83
|
const _unknownString = packet.readLengthCodedString(encoding);
|
|
85
84
|
const gtid = packet.readLengthCodedString(encoding);
|
|
86
85
|
stateChanges.gtids = gtid.split(',');
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simplified abstraction adapted from denque (https://github.com/invertase/denque/tree/539105bb57854e997dd469221cdc52a0ad80e0a2)
|
|
3
|
+
* License: Apache-2.0 (https://github.com/invertase/denque/blob/master/LICENSE)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const MIN_SHRINK_TAIL = 10000;
|
|
9
|
+
|
|
10
|
+
class RingQueue {
|
|
11
|
+
constructor() {
|
|
12
|
+
this._list = new Array(4);
|
|
13
|
+
this._mask = 3;
|
|
14
|
+
this._head = 0;
|
|
15
|
+
this._tail = 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get length() {
|
|
19
|
+
return (this._tail - this._head) & this._mask;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
size() {
|
|
23
|
+
return this.length;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
isEmpty() {
|
|
27
|
+
return this._head === this._tail;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
push(item) {
|
|
31
|
+
// biome-ignore lint/correctness/noUndeclaredVariables: arguments distinguishes push() from push(undefined)
|
|
32
|
+
if (arguments.length === 0) {
|
|
33
|
+
return this.length;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
this._list[this._tail] = item;
|
|
37
|
+
this._tail = (this._tail + 1) & this._mask;
|
|
38
|
+
|
|
39
|
+
if (this._tail === this._head) {
|
|
40
|
+
this._grow();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return this.length;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
unshift(item) {
|
|
47
|
+
// biome-ignore lint/correctness/noUndeclaredVariables: arguments distinguishes unshift() from unshift(undefined)
|
|
48
|
+
if (arguments.length === 0) {
|
|
49
|
+
return this.length;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this._head = (this._head - 1) & this._mask;
|
|
53
|
+
this._list[this._head] = item;
|
|
54
|
+
|
|
55
|
+
if (this._tail === this._head) {
|
|
56
|
+
this._grow();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return this.length;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
shift() {
|
|
63
|
+
const head = this._head;
|
|
64
|
+
|
|
65
|
+
if (head === this._tail) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const item = this._list[head];
|
|
70
|
+
this._list[head] = undefined;
|
|
71
|
+
this._head = (head + 1) & this._mask;
|
|
72
|
+
|
|
73
|
+
if (
|
|
74
|
+
head < 2 &&
|
|
75
|
+
this._tail > MIN_SHRINK_TAIL &&
|
|
76
|
+
this._tail <= this._list.length >>> 2
|
|
77
|
+
) {
|
|
78
|
+
this._shrink();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return item;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
pop() {
|
|
85
|
+
const tail = this._tail;
|
|
86
|
+
|
|
87
|
+
if (tail === this._head) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const capacity = this._list.length;
|
|
92
|
+
this._tail = (tail - 1) & this._mask;
|
|
93
|
+
|
|
94
|
+
const item = this._list[this._tail];
|
|
95
|
+
this._list[this._tail] = undefined;
|
|
96
|
+
|
|
97
|
+
if (this._head < 2 && tail > MIN_SHRINK_TAIL && tail <= capacity >>> 2) {
|
|
98
|
+
this._shrink();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return item;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
peekAt(index) {
|
|
105
|
+
if (index !== (index | 0)) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (index >= 0) {
|
|
110
|
+
if (index >= this.length) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return this._list[(this._head + index) & this._mask];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const size = this.length;
|
|
118
|
+
|
|
119
|
+
if (index < -size) {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return this._list[(this._head + index + size) & this._mask];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
get(index) {
|
|
127
|
+
return this.peekAt(index);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
peek() {
|
|
131
|
+
if (this._head === this._tail) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return this._list[this._head];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
peekFront() {
|
|
139
|
+
return this.peek();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
peekBack() {
|
|
143
|
+
return this.peekAt(-1);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
removeOne(index) {
|
|
147
|
+
if (index !== (index | 0)) {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const size = this.length;
|
|
152
|
+
|
|
153
|
+
if (index >= size || index < -size) {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (index < 0) {
|
|
158
|
+
index += size;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const mask = this._mask;
|
|
162
|
+
let slot = (this._head + index) & mask;
|
|
163
|
+
const item = this._list[slot];
|
|
164
|
+
const isCloserToHead = index < size / 2;
|
|
165
|
+
|
|
166
|
+
if (isCloserToHead) {
|
|
167
|
+
for (let moves = index; moves > 0; moves--) {
|
|
168
|
+
const previous = (slot - 1) & mask;
|
|
169
|
+
this._list[slot] = this._list[previous];
|
|
170
|
+
slot = previous;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
this._list[slot] = undefined;
|
|
174
|
+
this._head = (this._head + 1) & mask;
|
|
175
|
+
} else {
|
|
176
|
+
for (let moves = size - 1 - index; moves > 0; moves--) {
|
|
177
|
+
const next = (slot + 1) & mask;
|
|
178
|
+
this._list[slot] = this._list[next];
|
|
179
|
+
slot = next;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
this._list[slot] = undefined;
|
|
183
|
+
this._tail = (this._tail - 1) & mask;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return item;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
remove(index, count) {
|
|
190
|
+
if (index !== (index | 0)) {
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (this._head === this._tail) {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const size = this.length;
|
|
199
|
+
|
|
200
|
+
if (index >= size || index < -size || count < 1) {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (index < 0) {
|
|
205
|
+
index += size;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (count === 1 || !count) {
|
|
209
|
+
return [this.removeOne(index)];
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (count !== (count | 0)) {
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (index + count > size) {
|
|
217
|
+
count = size - index;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const items = this.toArray();
|
|
221
|
+
const removed = items.splice(index, count);
|
|
222
|
+
this._rebuild(items);
|
|
223
|
+
|
|
224
|
+
return removed;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
splice(index, count, ...newItems) {
|
|
228
|
+
if (index !== (index | 0)) {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const size = this.length;
|
|
233
|
+
|
|
234
|
+
if (index < 0) {
|
|
235
|
+
index += size;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (index > size) {
|
|
239
|
+
return undefined;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (newItems.length === 0) {
|
|
243
|
+
return this.remove(index, count);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (index < 0) {
|
|
247
|
+
return undefined;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const removalCount = count === undefined ? 1 : count;
|
|
251
|
+
|
|
252
|
+
if (removalCount !== (removalCount | 0) || removalCount < 0) {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const items = this.toArray();
|
|
257
|
+
let removed;
|
|
258
|
+
|
|
259
|
+
if (removalCount === 0) {
|
|
260
|
+
removed = [];
|
|
261
|
+
items.splice(index, 0, ...newItems);
|
|
262
|
+
} else if (index >= size) {
|
|
263
|
+
removed = undefined;
|
|
264
|
+
items.splice(index, 0, ...newItems);
|
|
265
|
+
} else {
|
|
266
|
+
removed = items.splice(index, removalCount, ...newItems);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
this._rebuild(items);
|
|
270
|
+
|
|
271
|
+
return removed;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
clear() {
|
|
275
|
+
this._list = new Array(this._list.length);
|
|
276
|
+
this._head = 0;
|
|
277
|
+
this._tail = 0;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
toArray() {
|
|
281
|
+
const head = this._head;
|
|
282
|
+
const tail = this._tail;
|
|
283
|
+
|
|
284
|
+
if (head <= tail) {
|
|
285
|
+
return this._list.slice(head, tail);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const capacity = this._list.length;
|
|
289
|
+
const items = new Array(this.length);
|
|
290
|
+
let count = 0;
|
|
291
|
+
|
|
292
|
+
for (let slot = head; slot < capacity; slot++) {
|
|
293
|
+
items[count++] = this._list[slot];
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
for (let slot = 0; slot < tail; slot++) {
|
|
297
|
+
items[count++] = this._list[slot];
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return items;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
_grow() {
|
|
304
|
+
const list = this._list;
|
|
305
|
+
const capacity = list.length;
|
|
306
|
+
|
|
307
|
+
if (this._head === 0) {
|
|
308
|
+
this._tail = capacity;
|
|
309
|
+
list.length = capacity << 1;
|
|
310
|
+
} else {
|
|
311
|
+
const grown = new Array(capacity << 1);
|
|
312
|
+
let count = 0;
|
|
313
|
+
|
|
314
|
+
for (let slot = this._head; slot < capacity; slot++) {
|
|
315
|
+
grown[count++] = list[slot];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
for (let slot = 0; slot < this._tail; slot++) {
|
|
319
|
+
grown[count++] = list[slot];
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
this._list = grown;
|
|
323
|
+
this._head = 0;
|
|
324
|
+
this._tail = capacity;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
this._mask = (this._mask << 1) | 1;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
_shrink() {
|
|
331
|
+
this._list.length >>>= 1;
|
|
332
|
+
this._mask >>>= 1;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
_rebuild(items) {
|
|
336
|
+
let capacity = this._list.length;
|
|
337
|
+
|
|
338
|
+
while (items.length >= capacity) {
|
|
339
|
+
capacity <<= 1;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
this._list = new Array(capacity);
|
|
343
|
+
this._mask = capacity - 1;
|
|
344
|
+
this._head = 0;
|
|
345
|
+
this._tail = items.length;
|
|
346
|
+
|
|
347
|
+
for (let i = 0; i < items.length; i++) {
|
|
348
|
+
this._list[i] = items[i];
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
module.exports = RingQueue;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/mysql2",
|
|
3
|
-
"version": "3.23.
|
|
3
|
+
"version": "3.23.3-depup.0",
|
|
4
4
|
"description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS (with updated dependencies)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "typings/mysql/index",
|
|
7
7
|
"type": "commonjs",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"lint": "
|
|
10
|
-
"lint:fix": "
|
|
9
|
+
"lint": "biome lint --error-on-warnings && prettier --check .",
|
|
10
|
+
"lint:fix": "biome lint --write . && prettier --write .",
|
|
11
11
|
"test": "poku",
|
|
12
12
|
"test:bun": "bun poku",
|
|
13
13
|
"test:deno": "deno run -A npm:poku",
|
|
@@ -62,7 +62,6 @@
|
|
|
62
62
|
"license": "MIT",
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"aws-ssl-profiles": "^1.1.2",
|
|
65
|
-
"denque": "^2.1.0",
|
|
66
65
|
"generate-function": "^2.3.1",
|
|
67
66
|
"iconv-lite": "^0.7.3",
|
|
68
67
|
"long": "^5.3.2",
|
|
@@ -74,43 +73,30 @@
|
|
|
74
73
|
"@types/node": ">= 8"
|
|
75
74
|
},
|
|
76
75
|
"devDependencies": {
|
|
77
|
-
"@
|
|
78
|
-
"@eslint/js": "^9.39.2",
|
|
79
|
-
"@eslint/markdown": "^8.0.1",
|
|
76
|
+
"@biomejs/biome": "^2.5.7",
|
|
80
77
|
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
81
|
-
"@pokujs/multi-suite": "^1.0.
|
|
82
|
-
"@rollup/plugin-commonjs": "^29.0.
|
|
78
|
+
"@pokujs/multi-suite": "^1.0.2",
|
|
79
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
83
80
|
"@rollup/plugin-json": "^6.1.0",
|
|
84
81
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
85
|
-
"@types/node": "^26.
|
|
86
|
-
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
87
|
-
"@typescript-eslint/parser": "^8.56.0",
|
|
82
|
+
"@types/node": "^26.2.0",
|
|
88
83
|
"assert-diff": "^3.0.4",
|
|
89
84
|
"benchmark": "^2.1.4",
|
|
90
|
-
"c8": "^
|
|
85
|
+
"c8": "^12.0.0",
|
|
91
86
|
"error-stack-parser": "^2.1.4",
|
|
92
|
-
"
|
|
93
|
-
"eslint-plugin-async-await": "^0.0.0",
|
|
94
|
-
"eslint-plugin-prettier": "^5.5.5",
|
|
95
|
-
"globals": "^17.3.0",
|
|
96
|
-
"poku": "^4.1.0",
|
|
87
|
+
"poku": "^4.5.0",
|
|
97
88
|
"portfinder": "^1.0.38",
|
|
98
|
-
"prettier": "^3.
|
|
99
|
-
"rollup": "^4.
|
|
100
|
-
"tsx": "^4.
|
|
101
|
-
"typescript": "^
|
|
89
|
+
"prettier": "^3.9.6",
|
|
90
|
+
"rollup": "^4.62.4",
|
|
91
|
+
"tsx": "^4.23.11",
|
|
92
|
+
"typescript": "^7.0.2"
|
|
102
93
|
},
|
|
103
94
|
"depup": {
|
|
104
|
-
"changes": {
|
|
105
|
-
|
|
106
|
-
"from": "^0.7.2",
|
|
107
|
-
"to": "^0.7.3"
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
"depsUpdated": 1,
|
|
95
|
+
"changes": {},
|
|
96
|
+
"depsUpdated": 0,
|
|
111
97
|
"originalPackage": "mysql2",
|
|
112
|
-
"originalVersion": "3.23.
|
|
113
|
-
"processedAt": "2026-
|
|
98
|
+
"originalVersion": "3.23.3",
|
|
99
|
+
"processedAt": "2026-08-10T08:33:41.780Z",
|
|
114
100
|
"smokeTest": "passed"
|
|
115
101
|
}
|
|
116
102
|
}
|
|
@@ -52,17 +52,13 @@ export declare function tracePromise<T extends object, R>(
|
|
|
52
52
|
): Promise<R>;
|
|
53
53
|
|
|
54
54
|
export declare const queryChannel:
|
|
55
|
-
|
|
56
|
-
| undefined;
|
|
55
|
+
TracingChannel<QueryTraceContext> | undefined;
|
|
57
56
|
export declare const executeChannel:
|
|
58
|
-
|
|
59
|
-
| undefined;
|
|
57
|
+
TracingChannel<ExecuteTraceContext> | undefined;
|
|
60
58
|
export declare const connectChannel:
|
|
61
|
-
|
|
62
|
-
| undefined;
|
|
59
|
+
TracingChannel<ConnectTraceContext> | undefined;
|
|
63
60
|
export declare const poolConnectChannel:
|
|
64
|
-
|
|
65
|
-
| undefined;
|
|
61
|
+
TracingChannel<PoolConnectTraceContext> | undefined;
|
|
66
62
|
|
|
67
63
|
export declare function getServerContext(config: {
|
|
68
64
|
socketPath?: string;
|