sqlite-executor 4.0.2 → 4.0.4
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/cjs/core/pipelineEngine.d.cts +2 -0
- package/dist/cjs/core/process.d.cts +16 -1
- package/dist/cjs/core/taskWorker.d.cts +6 -0
- package/dist/cjs/index.cjs +248 -116
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/core/pipelineEngine.d.mts +2 -0
- package/dist/esm/core/process.d.mts +16 -1
- package/dist/esm/core/taskWorker.d.mts +6 -0
- package/dist/esm/index.mjs +248 -116
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -135,7 +135,7 @@ function normalizeSQL(sql) {
|
|
|
135
135
|
if (void 0 !== cached) return cached;
|
|
136
136
|
var len = sql.length;
|
|
137
137
|
var needed = len + 1;
|
|
138
|
-
if (_normBuf.length < needed) _normBuf = new Uint16Array(
|
|
138
|
+
if (_normBuf.length < needed) _normBuf = new Uint16Array(needed);
|
|
139
139
|
var outCodes = _normBuf;
|
|
140
140
|
var writePos = 0;
|
|
141
141
|
var pendingSpace = false;
|
|
@@ -241,6 +241,7 @@ function createJsonValueParser(onValue) {
|
|
|
241
241
|
nesting: 0,
|
|
242
242
|
inString: false,
|
|
243
243
|
escaped: false,
|
|
244
|
+
_consumed: 0,
|
|
244
245
|
feed: function(chunk) {
|
|
245
246
|
this.buffer += chunk;
|
|
246
247
|
var consumeUntil = 0;
|
|
@@ -272,6 +273,11 @@ function createJsonValueParser(onValue) {
|
|
|
272
273
|
if (code === CHAR_CLOSE_BRACKET || code === CHAR_CLOSE_BRACE) {
|
|
273
274
|
this.nesting--;
|
|
274
275
|
if (0 === this.nesting) {
|
|
276
|
+
if (index === this.start + 1) {
|
|
277
|
+
this.start = -1;
|
|
278
|
+
consumeUntil = index + 1;
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
275
281
|
var raw = this.buffer.slice(this.start, index + 1);
|
|
276
282
|
this.start = -1;
|
|
277
283
|
onValue(raw);
|
|
@@ -280,12 +286,18 @@ function createJsonValueParser(onValue) {
|
|
|
280
286
|
}
|
|
281
287
|
}
|
|
282
288
|
if (consumeUntil > 0) {
|
|
283
|
-
this.
|
|
284
|
-
this.readPos =
|
|
289
|
+
this._consumed = consumeUntil;
|
|
290
|
+
this.readPos = this._consumed;
|
|
291
|
+
if (this._consumed > 65536) {
|
|
292
|
+
this.buffer = this.buffer.slice(this._consumed);
|
|
293
|
+
this.readPos = 0;
|
|
294
|
+
this._consumed = 0;
|
|
295
|
+
}
|
|
285
296
|
} else this.readPos = this.buffer.length;
|
|
286
297
|
},
|
|
287
298
|
reset: function() {
|
|
288
299
|
this.buffer = "";
|
|
300
|
+
this._consumed = 0;
|
|
289
301
|
this.start = -1;
|
|
290
302
|
this.readPos = 0;
|
|
291
303
|
this.nesting = 0;
|
|
@@ -305,6 +317,7 @@ function createRowStreamParser(onRow) {
|
|
|
305
317
|
elementEnd: -1,
|
|
306
318
|
nesting: 0,
|
|
307
319
|
readPos: 0,
|
|
320
|
+
_consumed: 0,
|
|
308
321
|
feed: function(chunk) {
|
|
309
322
|
if (this.finished) return chunk;
|
|
310
323
|
this.buffer += chunk;
|
|
@@ -371,24 +384,38 @@ function createRowStreamParser(onRow) {
|
|
|
371
384
|
var delimiter = this.buffer.charCodeAt(lookAhead);
|
|
372
385
|
if (delimiter === CHAR_COMMA || delimiter === CHAR_CLOSE_BRACKET) {
|
|
373
386
|
onRow(this.buffer.slice(this.elementStart, this.elementEnd));
|
|
374
|
-
this.
|
|
387
|
+
this._consumed = lookAhead + 1;
|
|
375
388
|
this.elementStart = -1;
|
|
376
389
|
this.elementEnd = -1;
|
|
377
390
|
this.nesting = 0;
|
|
378
391
|
if (delimiter === CHAR_CLOSE_BRACKET) {
|
|
379
392
|
this.finished = true;
|
|
380
|
-
var tail = this.buffer;
|
|
393
|
+
var tail = this.buffer.slice(this._consumed);
|
|
381
394
|
this.buffer = "";
|
|
395
|
+
this._consumed = 0;
|
|
382
396
|
this.readPos = 0;
|
|
383
397
|
return tail;
|
|
384
398
|
}
|
|
385
|
-
index =
|
|
399
|
+
index = this._consumed;
|
|
400
|
+
if (this._consumed > 65536) {
|
|
401
|
+
this.buffer = this.buffer.slice(this._consumed);
|
|
402
|
+
index = 0;
|
|
403
|
+
this._consumed = 0;
|
|
404
|
+
}
|
|
386
405
|
continue;
|
|
387
406
|
}
|
|
388
407
|
}
|
|
389
408
|
}
|
|
390
409
|
index++;
|
|
391
410
|
}
|
|
411
|
+
if (this._consumed > 0) {
|
|
412
|
+
if (-1 !== this.elementStart) {
|
|
413
|
+
this.elementStart -= this._consumed;
|
|
414
|
+
if (-1 !== this.elementEnd) this.elementEnd -= this._consumed;
|
|
415
|
+
}
|
|
416
|
+
this.buffer = this.buffer.slice(this._consumed);
|
|
417
|
+
this._consumed = 0;
|
|
418
|
+
}
|
|
392
419
|
if (this.elementStart > 0) {
|
|
393
420
|
this.buffer = this.buffer.slice(this.elementStart);
|
|
394
421
|
if (-1 !== this.elementEnd) this.elementEnd -= this.elementStart;
|
|
@@ -399,6 +426,7 @@ function createRowStreamParser(onRow) {
|
|
|
399
426
|
},
|
|
400
427
|
reset: function() {
|
|
401
428
|
this.buffer = "";
|
|
429
|
+
this._consumed = 0;
|
|
402
430
|
this.started = false;
|
|
403
431
|
this.finished = false;
|
|
404
432
|
this.inString = false;
|
|
@@ -427,6 +455,22 @@ function stream_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
|
427
455
|
descriptor.value = value;
|
|
428
456
|
}
|
|
429
457
|
}
|
|
458
|
+
function _class_apply_descriptor_update(receiver, descriptor) {
|
|
459
|
+
if (descriptor.set) {
|
|
460
|
+
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
461
|
+
if (!("__destrWrapper" in descriptor)) descriptor.__destrWrapper = {
|
|
462
|
+
set value (v){
|
|
463
|
+
descriptor.set.call(receiver, v);
|
|
464
|
+
},
|
|
465
|
+
get value () {
|
|
466
|
+
return descriptor.get.call(receiver);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
return descriptor.__destrWrapper;
|
|
470
|
+
}
|
|
471
|
+
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
472
|
+
return descriptor;
|
|
473
|
+
}
|
|
430
474
|
function stream_class_call_check(instance, Constructor) {
|
|
431
475
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
432
476
|
}
|
|
@@ -447,6 +491,10 @@ function stream_class_private_field_set(receiver, privateMap, value) {
|
|
|
447
491
|
stream_class_apply_descriptor_set(receiver, descriptor, value);
|
|
448
492
|
return value;
|
|
449
493
|
}
|
|
494
|
+
function _class_private_field_update(receiver, privateMap) {
|
|
495
|
+
var descriptor = stream_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
496
|
+
return _class_apply_descriptor_update(receiver, descriptor);
|
|
497
|
+
}
|
|
450
498
|
function stream_defineProperties(target, props) {
|
|
451
499
|
for(var i = 0; i < props.length; i++){
|
|
452
500
|
var descriptor = props[i];
|
|
@@ -483,7 +531,7 @@ function setupStreamParser(task) {
|
|
|
483
531
|
return parser;
|
|
484
532
|
}
|
|
485
533
|
_computedKey = Symbol.asyncIterator;
|
|
486
|
-
var _buffer = /*#__PURE__*/ new WeakMap(), _done = /*#__PURE__*/ new WeakMap(), _error = /*#__PURE__*/ new WeakMap(), _pending = /*#__PURE__*/ new WeakMap();
|
|
534
|
+
var _buffer = /*#__PURE__*/ new WeakMap(), _index = /*#__PURE__*/ new WeakMap(), _done = /*#__PURE__*/ new WeakMap(), _error = /*#__PURE__*/ new WeakMap(), _pending = /*#__PURE__*/ new WeakMap();
|
|
487
535
|
var _computedKey1 = _computedKey;
|
|
488
536
|
var stream_AsyncRowBuffer = /*#__PURE__*/ function() {
|
|
489
537
|
"use strict";
|
|
@@ -493,6 +541,10 @@ var stream_AsyncRowBuffer = /*#__PURE__*/ function() {
|
|
|
493
541
|
writable: true,
|
|
494
542
|
value: []
|
|
495
543
|
});
|
|
544
|
+
stream_class_private_field_init(this, _index, {
|
|
545
|
+
writable: true,
|
|
546
|
+
value: 0
|
|
547
|
+
});
|
|
496
548
|
stream_class_private_field_init(this, _done, {
|
|
497
549
|
writable: true,
|
|
498
550
|
value: false
|
|
@@ -510,6 +562,7 @@ var stream_AsyncRowBuffer = /*#__PURE__*/ function() {
|
|
|
510
562
|
{
|
|
511
563
|
key: "push",
|
|
512
564
|
value: function(row) {
|
|
565
|
+
if (stream_class_private_field_get(this, _done) || stream_class_private_field_get(this, _error)) return;
|
|
513
566
|
if (stream_class_private_field_get(this, _pending)) {
|
|
514
567
|
var resolve = stream_class_private_field_get(this, _pending).resolve;
|
|
515
568
|
stream_class_private_field_set(this, _pending, null);
|
|
@@ -549,8 +602,8 @@ var stream_AsyncRowBuffer = /*#__PURE__*/ function() {
|
|
|
549
602
|
key: "next",
|
|
550
603
|
value: function() {
|
|
551
604
|
var _this = this;
|
|
552
|
-
if (stream_class_private_field_get(this, _buffer).length
|
|
553
|
-
value: stream_class_private_field_get(this, _buffer)
|
|
605
|
+
if (stream_class_private_field_get(this, _index) < stream_class_private_field_get(this, _buffer).length) return Promise.resolve({
|
|
606
|
+
value: stream_class_private_field_get(this, _buffer)[_class_private_field_update(this, _index).value++],
|
|
554
607
|
done: false
|
|
555
608
|
});
|
|
556
609
|
if (stream_class_private_field_get(this, _done)) return Promise.resolve({
|
|
@@ -570,6 +623,8 @@ var stream_AsyncRowBuffer = /*#__PURE__*/ function() {
|
|
|
570
623
|
key: "return",
|
|
571
624
|
value: function() {
|
|
572
625
|
stream_class_private_field_set(this, _done, true);
|
|
626
|
+
stream_class_private_field_set(this, _buffer, []);
|
|
627
|
+
stream_class_private_field_set(this, _index, 0);
|
|
573
628
|
if (stream_class_private_field_get(this, _pending)) {
|
|
574
629
|
var resolve = stream_class_private_field_get(this, _pending).resolve;
|
|
575
630
|
stream_class_private_field_set(this, _pending, null);
|
|
@@ -920,11 +975,11 @@ function _ts_generator(thisArg, body) {
|
|
|
920
975
|
}
|
|
921
976
|
}
|
|
922
977
|
var GRACEFUL_SHUTDOWN_TIMEOUT = 5000;
|
|
923
|
-
var _binary = /*#__PURE__*/ new WeakMap(), _database = /*#__PURE__*/ new WeakMap(), _proc = /*#__PURE__*/ new WeakMap(), _initMode = /*#__PURE__*/ new WeakMap(), _draining = /*#__PURE__*/ new WeakMap();
|
|
978
|
+
var _binary = /*#__PURE__*/ new WeakMap(), _database = /*#__PURE__*/ new WeakMap(), _proc = /*#__PURE__*/ new WeakMap(), _initMode = /*#__PURE__*/ new WeakMap(), _draining = /*#__PURE__*/ new WeakMap(), _onDrain = /*#__PURE__*/ new WeakMap();
|
|
924
979
|
var process_ProcessManager = /*#__PURE__*/ function() {
|
|
925
980
|
"use strict";
|
|
926
981
|
function ProcessManager() {
|
|
927
|
-
var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, binary = _ref.binary, database = _ref.database, _ref_initMode = _ref.initMode, initMode = void 0 === _ref_initMode ? "wal" : _ref_initMode;
|
|
982
|
+
var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, binary = _ref.binary, database = _ref.database, _ref_initMode = _ref.initMode, initMode = void 0 === _ref_initMode ? "wal" : _ref_initMode, onDrain = _ref.onDrain;
|
|
928
983
|
process_class_call_check(this, ProcessManager);
|
|
929
984
|
process_class_private_field_init(this, _binary, {
|
|
930
985
|
writable: true,
|
|
@@ -946,12 +1001,29 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
946
1001
|
writable: true,
|
|
947
1002
|
value: false
|
|
948
1003
|
});
|
|
1004
|
+
process_class_private_field_init(this, _onDrain, {
|
|
1005
|
+
writable: true,
|
|
1006
|
+
value: void 0
|
|
1007
|
+
});
|
|
949
1008
|
var _which;
|
|
950
1009
|
process_class_private_field_set(this, _binary, null != (_which = which(binary)) ? _which : binary);
|
|
951
1010
|
process_class_private_field_set(this, _database, database);
|
|
952
1011
|
process_class_private_field_set(this, _initMode, initMode);
|
|
1012
|
+
process_class_private_field_set(this, _onDrain, null != onDrain ? onDrain : function() {});
|
|
953
1013
|
}
|
|
954
1014
|
process_create_class(ProcessManager, [
|
|
1015
|
+
{
|
|
1016
|
+
key: "draining",
|
|
1017
|
+
get: function() {
|
|
1018
|
+
return process_class_private_field_get(this, _draining);
|
|
1019
|
+
}
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
key: "setOnDrainCallback",
|
|
1023
|
+
value: function(fn) {
|
|
1024
|
+
process_class_private_field_set(this, _onDrain, fn);
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
955
1027
|
{
|
|
956
1028
|
key: "binary",
|
|
957
1029
|
get: function() {
|
|
@@ -997,10 +1069,12 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
997
1069
|
var _$_class_private_field_get;
|
|
998
1070
|
var stream = null == (_$_class_private_field_get = process_class_private_field_get(this, _proc)) ? void 0 : _$_class_private_field_get.stdin;
|
|
999
1071
|
if (!stream) return;
|
|
1000
|
-
if (
|
|
1072
|
+
if (process_class_private_field_get(this, _draining)) return;
|
|
1073
|
+
if (!stream.write(data)) {
|
|
1001
1074
|
process_class_private_field_set(this, _draining, true);
|
|
1002
1075
|
stream.once("drain", function() {
|
|
1003
1076
|
process_class_private_field_set(_this, _draining, false);
|
|
1077
|
+
process_class_private_field_get(_this, _onDrain).call(_this);
|
|
1004
1078
|
});
|
|
1005
1079
|
}
|
|
1006
1080
|
}
|
|
@@ -1019,7 +1093,7 @@ var process_ProcessManager = /*#__PURE__*/ function() {
|
|
|
1019
1093
|
2
|
|
1020
1094
|
];
|
|
1021
1095
|
timer = setTimeout(function() {
|
|
1022
|
-
|
|
1096
|
+
proc.kill();
|
|
1023
1097
|
}, GRACEFUL_SHUTDOWN_TIMEOUT);
|
|
1024
1098
|
_state.label = 1;
|
|
1025
1099
|
case 1:
|
|
@@ -1083,13 +1157,14 @@ var _counter = 0;
|
|
|
1083
1157
|
var _PREFIX = "__executor_end__";
|
|
1084
1158
|
var _PID36 = process.pid.toString(36);
|
|
1085
1159
|
function generateToken() {
|
|
1086
|
-
|
|
1160
|
+
_counter = _counter + 1 >>> 0;
|
|
1161
|
+
return "".concat(_PREFIX).concat(_counter.toString(36), "_").concat(_PID36);
|
|
1087
1162
|
}
|
|
1088
1163
|
function escape_type_of(obj) {
|
|
1089
1164
|
return obj && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1090
1165
|
}
|
|
1091
1166
|
function escapeValue(value) {
|
|
1092
|
-
if ("string" == typeof value) return "'".concat(value.replace(/'/g, "''"), "'");
|
|
1167
|
+
if ("string" == typeof value) return value.includes("'") ? "'".concat(value.replace(/'/g, "''"), "'") : "'".concat(value, "'");
|
|
1093
1168
|
if (null == value) return "NULL";
|
|
1094
1169
|
if ("number" == typeof value || (void 0 === value ? "undefined" : escape_type_of(value)) === "bigint") return String(value);
|
|
1095
1170
|
if ("boolean" == typeof value) return value ? "TRUE" : "FALSE";
|
|
@@ -1263,7 +1338,7 @@ function queue_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
|
1263
1338
|
descriptor.value = value;
|
|
1264
1339
|
}
|
|
1265
1340
|
}
|
|
1266
|
-
function
|
|
1341
|
+
function queue_class_apply_descriptor_update(receiver, descriptor) {
|
|
1267
1342
|
if (descriptor.set) {
|
|
1268
1343
|
if (!descriptor.get) throw new TypeError("attempted to read set only private field");
|
|
1269
1344
|
if (!("__destrWrapper" in descriptor)) descriptor.__destrWrapper = {
|
|
@@ -1299,9 +1374,9 @@ function queue_class_private_field_set(receiver, privateMap, value) {
|
|
|
1299
1374
|
queue_class_apply_descriptor_set(receiver, descriptor, value);
|
|
1300
1375
|
return value;
|
|
1301
1376
|
}
|
|
1302
|
-
function
|
|
1377
|
+
function queue_class_private_field_update(receiver, privateMap) {
|
|
1303
1378
|
var descriptor = queue_class_extract_field_descriptor(receiver, privateMap, "update");
|
|
1304
|
-
return
|
|
1379
|
+
return queue_class_apply_descriptor_update(receiver, descriptor);
|
|
1305
1380
|
}
|
|
1306
1381
|
function _class_private_method_get(receiver, privateSet, fn) {
|
|
1307
1382
|
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
@@ -1456,7 +1531,7 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1456
1531
|
if (queue_class_private_field_get(this, _size) === queue_class_private_field_get(this, _items).length) _class_private_method_get(this, _grow, grow).call(this);
|
|
1457
1532
|
queue_class_private_field_get(this, _items)[queue_class_private_field_get(this, _tail)] = value;
|
|
1458
1533
|
queue_class_private_field_set(this, _tail, queue_class_private_field_get(this, _tail) + 1 & queue_class_private_field_get(this, _mask));
|
|
1459
|
-
|
|
1534
|
+
queue_class_private_field_update(this, _size).value++;
|
|
1460
1535
|
}
|
|
1461
1536
|
},
|
|
1462
1537
|
{
|
|
@@ -1466,7 +1541,7 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1466
1541
|
var value = queue_class_private_field_get(this, _items)[queue_class_private_field_get(this, _head)];
|
|
1467
1542
|
queue_class_private_field_get(this, _items)[queue_class_private_field_get(this, _head)] = void 0;
|
|
1468
1543
|
queue_class_private_field_set(this, _head, queue_class_private_field_get(this, _head) + 1 & queue_class_private_field_get(this, _mask));
|
|
1469
|
-
|
|
1544
|
+
queue_class_private_field_update(this, _size).value--;
|
|
1470
1545
|
return value;
|
|
1471
1546
|
}
|
|
1472
1547
|
},
|
|
@@ -1493,7 +1568,7 @@ var queue_Queue = /*#__PURE__*/ function() {
|
|
|
1493
1568
|
}
|
|
1494
1569
|
queue_class_private_field_set(this, _tail, queue_class_private_field_get(this, _tail) - 1 & queue_class_private_field_get(this, _mask));
|
|
1495
1570
|
queue_class_private_field_get(this, _items)[queue_class_private_field_get(this, _tail)] = void 0;
|
|
1496
|
-
|
|
1571
|
+
queue_class_private_field_update(this, _size).value--;
|
|
1497
1572
|
return true;
|
|
1498
1573
|
}
|
|
1499
1574
|
}
|
|
@@ -1712,6 +1787,9 @@ function buildBatchPayload(batch) {
|
|
|
1712
1787
|
}
|
|
1713
1788
|
return parts1.join("");
|
|
1714
1789
|
}
|
|
1790
|
+
function isSentinelRaw(raw, token) {
|
|
1791
|
+
return raw === '[{"'.concat(TOKEN_COLUMN, '":"').concat(token, '"}]');
|
|
1792
|
+
}
|
|
1715
1793
|
function isSentinelRow(value, token) {
|
|
1716
1794
|
var _value_;
|
|
1717
1795
|
return Array.isArray(value) && 1 === value.length && (null == (_value_ = value[0]) ? void 0 : _value_[TOKEN_COLUMN]) === token;
|
|
@@ -1774,6 +1852,8 @@ function processStreamRows(task, parsed) {
|
|
|
1774
1852
|
}
|
|
1775
1853
|
function settleTask(task, error, value, metrics) {
|
|
1776
1854
|
var _ref = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {}, _ref_resetRowParser = _ref.resetRowParser, resetRowParser = void 0 === _ref_resetRowParser ? false : _ref_resetRowParser;
|
|
1855
|
+
if (task.settled) return;
|
|
1856
|
+
task.settled = true;
|
|
1777
1857
|
clearTimeout(task.timer);
|
|
1778
1858
|
if (resetRowParser) {
|
|
1779
1859
|
var _task_rowParser_reset, _task_rowParser;
|
|
@@ -1788,6 +1868,46 @@ function settleTask(task, error, value, metrics) {
|
|
|
1788
1868
|
null == metrics || metrics.incrementTasksSuccess(duration);
|
|
1789
1869
|
task.resolve(value);
|
|
1790
1870
|
}
|
|
1871
|
+
function finalizePendingTasks(tasks, settle, pumpQueue) {
|
|
1872
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1873
|
+
try {
|
|
1874
|
+
for(var _iterator = tasks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1875
|
+
var task = _step.value;
|
|
1876
|
+
if (task.stderrText) {
|
|
1877
|
+
settle(task, new Error(task.stderrText.trim()), void 0);
|
|
1878
|
+
continue;
|
|
1879
|
+
}
|
|
1880
|
+
if (task.consumerError) {
|
|
1881
|
+
settle(task, task.consumerError, void 0);
|
|
1882
|
+
continue;
|
|
1883
|
+
}
|
|
1884
|
+
if ("query" === task.kind) {
|
|
1885
|
+
settle(task, null, task.rows);
|
|
1886
|
+
continue;
|
|
1887
|
+
}
|
|
1888
|
+
settle(task, null, void 0);
|
|
1889
|
+
}
|
|
1890
|
+
} catch (err) {
|
|
1891
|
+
_didIteratorError = true;
|
|
1892
|
+
_iteratorError = err;
|
|
1893
|
+
} finally{
|
|
1894
|
+
try {
|
|
1895
|
+
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
1896
|
+
} finally{
|
|
1897
|
+
if (_didIteratorError) throw _iteratorError;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
tasks.clear();
|
|
1901
|
+
pumpQueue();
|
|
1902
|
+
}
|
|
1903
|
+
function prepareTaskTimeout(task, metrics) {
|
|
1904
|
+
if (task.settled) return null;
|
|
1905
|
+
task.timedout = true;
|
|
1906
|
+
clearTimeout(task.timer);
|
|
1907
|
+
task.timer = null;
|
|
1908
|
+
null == metrics || metrics.incrementTasksTimeout();
|
|
1909
|
+
return createTimeoutError(task.timeout, task.sql);
|
|
1910
|
+
}
|
|
1791
1911
|
function taskWorker_array_like_to_array(arr, len) {
|
|
1792
1912
|
if (null == len || len > arr.length) len = arr.length;
|
|
1793
1913
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -1941,7 +2061,10 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
1941
2061
|
taskWorker_class_private_field_set(this, _processManager, new process_ProcessManager({
|
|
1942
2062
|
binary: binary,
|
|
1943
2063
|
database: database,
|
|
1944
|
-
initMode: initMode
|
|
2064
|
+
initMode: initMode,
|
|
2065
|
+
onDrain: function() {
|
|
2066
|
+
return taskWorker_class_private_method_get(_this, _pumpQueue, taskWorker_pumpQueue).call(_this);
|
|
2067
|
+
}
|
|
1945
2068
|
}));
|
|
1946
2069
|
taskWorker_class_private_field_set(this, _valueParser, createJsonValueParser(function(raw) {
|
|
1947
2070
|
return taskWorker_class_private_method_get(_this, _handleParsedValue, handleParsedValue).call(_this, raw);
|
|
@@ -1983,13 +2106,20 @@ var taskWorker_TaskWorker = /*#__PURE__*/ function() {
|
|
|
1983
2106
|
onRow: null != (_config_onRow = config.onRow) ? _config_onRow : null,
|
|
1984
2107
|
consumerError: null,
|
|
1985
2108
|
stderrText: "",
|
|
2109
|
+
settled: false,
|
|
1986
2110
|
errorScheduled: false,
|
|
1987
2111
|
timer: null,
|
|
1988
2112
|
startTime: 0
|
|
1989
2113
|
};
|
|
1990
2114
|
null == (_$_class_private_field_get = taskWorker_class_private_field_get(this, _metrics)) || _$_class_private_field_get.incrementTasksTotal(config.kind);
|
|
1991
2115
|
taskWorker_class_private_field_get(this, _pendingQueue).enqueue(task);
|
|
1992
|
-
taskWorker_class_private_method_get(this, _pumpQueue,
|
|
2116
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2117
|
+
}
|
|
2118
|
+
},
|
|
2119
|
+
{
|
|
2120
|
+
key: "_process",
|
|
2121
|
+
get: function() {
|
|
2122
|
+
return taskWorker_class_private_field_get(this, _processManager).process;
|
|
1993
2123
|
}
|
|
1994
2124
|
},
|
|
1995
2125
|
{
|
|
@@ -2023,9 +2153,10 @@ function startProcess() {
|
|
|
2023
2153
|
taskWorker_class_private_method_get(_this, _rejectAll, taskWorker_rejectAll).call(_this, err);
|
|
2024
2154
|
});
|
|
2025
2155
|
}
|
|
2026
|
-
function
|
|
2156
|
+
function taskWorker_pumpQueue() {
|
|
2027
2157
|
var _this = this;
|
|
2028
2158
|
var _$_class_private_field_get;
|
|
2159
|
+
if (taskWorker_class_private_field_get(this, _processManager).draining) return;
|
|
2029
2160
|
if (taskWorker_class_private_field_get(this, _inflightTasks).length >= taskWorker_class_private_field_get(this, _maxInflight)) return;
|
|
2030
2161
|
var batch = [];
|
|
2031
2162
|
while(batch.length < taskWorker_class_private_field_get(this, _batchSize) && !taskWorker_class_private_field_get(this, _pendingQueue).isEmpty() && taskWorker_class_private_field_get(this, _inflightTasks).length + batch.length < taskWorker_class_private_field_get(this, _maxInflight)){
|
|
@@ -2064,6 +2195,26 @@ function pumpQueue() {
|
|
|
2064
2195
|
function handleParsedValue(raw) {
|
|
2065
2196
|
var task = taskWorker_class_private_field_get(this, _inflightTasks)[0];
|
|
2066
2197
|
if (!task) return;
|
|
2198
|
+
if (isSentinelRaw(raw, task.token)) {
|
|
2199
|
+
clearTimeout(task.timer);
|
|
2200
|
+
taskWorker_class_private_field_get(this, _inflightTasks).shift();
|
|
2201
|
+
if (task.timedout) return void taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2202
|
+
if (task.stderrText) {
|
|
2203
|
+
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, new Error(task.stderrText.trim()), void 0);
|
|
2204
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2205
|
+
return;
|
|
2206
|
+
}
|
|
2207
|
+
if (task.consumerError) {
|
|
2208
|
+
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, task.consumerError, void 0);
|
|
2209
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2210
|
+
return;
|
|
2211
|
+
}
|
|
2212
|
+
taskWorker_class_private_field_get(this, _pendingFinalizeTasks).add(task);
|
|
2213
|
+
taskWorker_class_private_method_get(this, _scheduleFinalizeCheck, scheduleFinalizeCheck).call(this);
|
|
2214
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2217
|
+
if ("[]" === raw) return;
|
|
2067
2218
|
var parsed;
|
|
2068
2219
|
try {
|
|
2069
2220
|
parsed = JSON.parse(raw);
|
|
@@ -2074,19 +2225,20 @@ function handleParsedValue(raw) {
|
|
|
2074
2225
|
if (isSentinelRow(parsed, task.token)) {
|
|
2075
2226
|
clearTimeout(task.timer);
|
|
2076
2227
|
taskWorker_class_private_field_get(this, _inflightTasks).shift();
|
|
2228
|
+
if (task.timedout) return void taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2077
2229
|
if (task.stderrText) {
|
|
2078
2230
|
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, new Error(task.stderrText.trim()), void 0);
|
|
2079
|
-
taskWorker_class_private_method_get(this, _pumpQueue,
|
|
2231
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2080
2232
|
return;
|
|
2081
2233
|
}
|
|
2082
2234
|
if (task.consumerError) {
|
|
2083
2235
|
taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, task.consumerError, void 0);
|
|
2084
|
-
taskWorker_class_private_method_get(this, _pumpQueue,
|
|
2236
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2085
2237
|
return;
|
|
2086
2238
|
}
|
|
2087
2239
|
taskWorker_class_private_field_get(this, _pendingFinalizeTasks).add(task);
|
|
2088
2240
|
taskWorker_class_private_method_get(this, _scheduleFinalizeCheck, scheduleFinalizeCheck).call(this);
|
|
2089
|
-
taskWorker_class_private_method_get(this, _pumpQueue,
|
|
2241
|
+
taskWorker_class_private_method_get(this, _pumpQueue, taskWorker_pumpQueue).call(this);
|
|
2090
2242
|
return;
|
|
2091
2243
|
}
|
|
2092
2244
|
if ("query" === task.kind) return void collectQueryRows(task, parsed);
|
|
@@ -2098,36 +2250,11 @@ function scheduleFinalizeCheck() {
|
|
|
2098
2250
|
taskWorker_class_private_field_set(this, _scheduledFinalize, true);
|
|
2099
2251
|
setImmediate(function() {
|
|
2100
2252
|
taskWorker_class_private_field_set(_this, _scheduledFinalize, false);
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, task, new Error(task.stderrText.trim()), void 0);
|
|
2107
|
-
continue;
|
|
2108
|
-
}
|
|
2109
|
-
if (task.consumerError) {
|
|
2110
|
-
taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, task, task.consumerError, void 0);
|
|
2111
|
-
continue;
|
|
2112
|
-
}
|
|
2113
|
-
if ("query" === task.kind) {
|
|
2114
|
-
taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, task, null, task.rows);
|
|
2115
|
-
continue;
|
|
2116
|
-
}
|
|
2117
|
-
taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, task, null, void 0);
|
|
2118
|
-
}
|
|
2119
|
-
} catch (err) {
|
|
2120
|
-
_didIteratorError = true;
|
|
2121
|
-
_iteratorError = err;
|
|
2122
|
-
} finally{
|
|
2123
|
-
try {
|
|
2124
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
2125
|
-
} finally{
|
|
2126
|
-
if (_didIteratorError) throw _iteratorError;
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
taskWorker_class_private_field_get(_this, _pendingFinalizeTasks).clear();
|
|
2130
|
-
taskWorker_class_private_method_get(_this, _pumpQueue, pumpQueue).call(_this);
|
|
2253
|
+
finalizePendingTasks(taskWorker_class_private_field_get(_this, _pendingFinalizeTasks), function(t, e, v1) {
|
|
2254
|
+
return taskWorker_class_private_method_get(_this, _settleTask, settleTask1).call(_this, t, e, v1);
|
|
2255
|
+
}, function() {
|
|
2256
|
+
return taskWorker_class_private_method_get(_this, _pumpQueue, taskWorker_pumpQueue).call(_this);
|
|
2257
|
+
});
|
|
2131
2258
|
});
|
|
2132
2259
|
}
|
|
2133
2260
|
function taskWorker_handleStderrChunk(chunk) {
|
|
@@ -2141,10 +2268,8 @@ function taskWorker_handleStderrChunk(chunk) {
|
|
|
2141
2268
|
task.stderrText += String(chunk);
|
|
2142
2269
|
}
|
|
2143
2270
|
function handleTaskTimeout(task) {
|
|
2144
|
-
var
|
|
2145
|
-
if (
|
|
2146
|
-
null == (_$_class_private_field_get = taskWorker_class_private_field_get(this, _metrics)) || _$_class_private_field_get.incrementTasksTimeout();
|
|
2147
|
-
taskWorker_class_private_method_get(this, _rejectAll, taskWorker_rejectAll).call(this, createTimeoutError(task.timeout, task.sql));
|
|
2271
|
+
var error = prepareTaskTimeout(task, taskWorker_class_private_field_get(this, _metrics));
|
|
2272
|
+
if (error) taskWorker_class_private_method_get(this, _settleTask, settleTask1).call(this, task, error, void 0);
|
|
2148
2273
|
}
|
|
2149
2274
|
function settleTask1(task, error, value) {
|
|
2150
2275
|
settleTask(task, error, value, taskWorker_class_private_field_get(this, _metrics));
|
|
@@ -2198,21 +2323,12 @@ function readerPool_class_apply_descriptor_get(receiver, descriptor) {
|
|
|
2198
2323
|
if (descriptor.get) return descriptor.get.call(receiver);
|
|
2199
2324
|
return descriptor.value;
|
|
2200
2325
|
}
|
|
2201
|
-
function
|
|
2202
|
-
if (descriptor.set)
|
|
2203
|
-
|
|
2204
|
-
if (!("
|
|
2205
|
-
|
|
2206
|
-
descriptor.set.call(receiver, v);
|
|
2207
|
-
},
|
|
2208
|
-
get value () {
|
|
2209
|
-
return descriptor.get.call(receiver);
|
|
2210
|
-
}
|
|
2211
|
-
};
|
|
2212
|
-
return descriptor.__destrWrapper;
|
|
2326
|
+
function readerPool_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
2327
|
+
if (descriptor.set) descriptor.set.call(receiver, value);
|
|
2328
|
+
else {
|
|
2329
|
+
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
2330
|
+
descriptor.value = value;
|
|
2213
2331
|
}
|
|
2214
|
-
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
2215
|
-
return descriptor;
|
|
2216
2332
|
}
|
|
2217
2333
|
function readerPool_class_call_check(instance, Constructor) {
|
|
2218
2334
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
@@ -2229,9 +2345,10 @@ function readerPool_class_private_field_init(obj, privateMap, value) {
|
|
|
2229
2345
|
readerPool_check_private_redeclaration(obj, privateMap);
|
|
2230
2346
|
privateMap.set(obj, value);
|
|
2231
2347
|
}
|
|
2232
|
-
function
|
|
2233
|
-
var descriptor = readerPool_class_extract_field_descriptor(receiver, privateMap, "
|
|
2234
|
-
|
|
2348
|
+
function readerPool_class_private_field_set(receiver, privateMap, value) {
|
|
2349
|
+
var descriptor = readerPool_class_extract_field_descriptor(receiver, privateMap, "set");
|
|
2350
|
+
readerPool_class_apply_descriptor_set(receiver, descriptor, value);
|
|
2351
|
+
return value;
|
|
2235
2352
|
}
|
|
2236
2353
|
function readerPool_defineProperties(target, props) {
|
|
2237
2354
|
for(var i = 0; i < props.length; i++){
|
|
@@ -2261,6 +2378,7 @@ var readerPool_ReaderPool = /*#__PURE__*/ function() {
|
|
|
2261
2378
|
writable: true,
|
|
2262
2379
|
value: 0
|
|
2263
2380
|
});
|
|
2381
|
+
if (poolSize < 1) throw new RangeError("poolSize must be >= 1");
|
|
2264
2382
|
for(var i = 0; i < poolSize; i++){
|
|
2265
2383
|
var worker = new taskWorker_TaskWorker({
|
|
2266
2384
|
binary: binary,
|
|
@@ -2293,10 +2411,16 @@ var readerPool_ReaderPool = /*#__PURE__*/ function() {
|
|
|
2293
2411
|
key: "enqueue",
|
|
2294
2412
|
value: function(task) {
|
|
2295
2413
|
var worker = readerPool_class_private_field_get(this, _workers)[readerPool_class_private_field_get(this, _rrIndex) % readerPool_class_private_field_get(this, _workers).length];
|
|
2296
|
-
|
|
2414
|
+
readerPool_class_private_field_set(this, _rrIndex, readerPool_class_private_field_get(this, _rrIndex) + 1 >>> 0);
|
|
2297
2415
|
worker.enqueue(task);
|
|
2298
2416
|
}
|
|
2299
2417
|
},
|
|
2418
|
+
{
|
|
2419
|
+
key: "_workers",
|
|
2420
|
+
get: function() {
|
|
2421
|
+
return readerPool_class_private_field_get(this, _workers);
|
|
2422
|
+
}
|
|
2423
|
+
},
|
|
2300
2424
|
{
|
|
2301
2425
|
key: "kill",
|
|
2302
2426
|
value: function() {
|
|
@@ -2909,7 +3033,7 @@ function pipelineEngine_unsupported_iterable_to_array(o, minLen) {
|
|
|
2909
3033
|
if ("Map" === n || "Set" === n) return Array.from(n);
|
|
2910
3034
|
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return pipelineEngine_array_like_to_array(o, minLen);
|
|
2911
3035
|
}
|
|
2912
|
-
var _queue = /*#__PURE__*/ new WeakMap(), pipelineEngine_inflightTasks = /*#__PURE__*/ new WeakMap(), pipelineEngine_pendingFinalizeTasks = /*#__PURE__*/ new WeakMap(), pipelineEngine_scheduledFinalize = /*#__PURE__*/ new WeakMap(), _sharedValueParser = /*#__PURE__*/ new WeakMap(), pipelineEngine_processManager = /*#__PURE__*/ new WeakMap(), pipelineEngine_metrics = /*#__PURE__*/ new WeakMap(), pipelineEngine_statementTimeout = /*#__PURE__*/ new WeakMap(), pipelineEngine_logger = /*#__PURE__*/ new WeakMap(), pipelineEngine_batchSize = /*#__PURE__*/ new WeakMap(), pipelineEngine_maxInflight = /*#__PURE__*/ new WeakMap(), _onTaskTimeout = /*#__PURE__*/ new WeakMap(), _active = /*#__PURE__*/ new WeakMap(), core_pipelineEngine_pumpQueue = /*#__PURE__*/ new WeakSet(), pipelineEngine_handleParsedValue = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_scheduleFinalizeCheck = /*#__PURE__*/ new WeakSet(), pipelineEngine_settleTask = /*#__PURE__*/ new WeakSet();
|
|
3036
|
+
var _queue = /*#__PURE__*/ new WeakMap(), pipelineEngine_inflightTasks = /*#__PURE__*/ new WeakMap(), pipelineEngine_pendingFinalizeTasks = /*#__PURE__*/ new WeakMap(), pipelineEngine_scheduledFinalize = /*#__PURE__*/ new WeakMap(), _sharedValueParser = /*#__PURE__*/ new WeakMap(), pipelineEngine_processManager = /*#__PURE__*/ new WeakMap(), pipelineEngine_metrics = /*#__PURE__*/ new WeakMap(), pipelineEngine_statementTimeout = /*#__PURE__*/ new WeakMap(), pipelineEngine_logger = /*#__PURE__*/ new WeakMap(), pipelineEngine_batchSize = /*#__PURE__*/ new WeakMap(), pipelineEngine_maxInflight = /*#__PURE__*/ new WeakMap(), _onTaskTimeout = /*#__PURE__*/ new WeakMap(), _active = /*#__PURE__*/ new WeakMap(), core_pipelineEngine_pumpQueue = /*#__PURE__*/ new WeakSet(), pipelineEngine_handleParsedValue = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_scheduleFinalizeCheck = /*#__PURE__*/ new WeakSet(), core_pipelineEngine_handleTaskTimeout = /*#__PURE__*/ new WeakSet(), pipelineEngine_settleTask = /*#__PURE__*/ new WeakSet();
|
|
2913
3037
|
var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
2914
3038
|
"use strict";
|
|
2915
3039
|
function PipelineEngine(processManager, param) {
|
|
@@ -2919,6 +3043,7 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
2919
3043
|
pipelineEngine_class_private_method_init(this, core_pipelineEngine_pumpQueue);
|
|
2920
3044
|
pipelineEngine_class_private_method_init(this, pipelineEngine_handleParsedValue);
|
|
2921
3045
|
pipelineEngine_class_private_method_init(this, core_pipelineEngine_scheduleFinalizeCheck);
|
|
3046
|
+
pipelineEngine_class_private_method_init(this, core_pipelineEngine_handleTaskTimeout);
|
|
2922
3047
|
pipelineEngine_class_private_method_init(this, pipelineEngine_settleTask);
|
|
2923
3048
|
pipelineEngine_class_private_field_init(this, _queue, {
|
|
2924
3049
|
writable: true,
|
|
@@ -2982,6 +3107,9 @@ var pipelineEngine_PipelineEngine = /*#__PURE__*/ function() {
|
|
|
2982
3107
|
pipelineEngine_class_private_field_set(this, _sharedValueParser, createJsonValueParser(function(raw) {
|
|
2983
3108
|
return pipelineEngine_class_private_method_get(_this, pipelineEngine_handleParsedValue, core_pipelineEngine_handleParsedValue).call(_this, raw);
|
|
2984
3109
|
}));
|
|
3110
|
+
pipelineEngine_class_private_field_get(this, pipelineEngine_processManager).setOnDrainCallback(function() {
|
|
3111
|
+
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(_this);
|
|
3112
|
+
});
|
|
2985
3113
|
}
|
|
2986
3114
|
pipelineEngine_create_class(PipelineEngine, [
|
|
2987
3115
|
{
|
|
@@ -3114,6 +3242,7 @@ function pipelineEngine_pumpQueue() {
|
|
|
3114
3242
|
var _this = this;
|
|
3115
3243
|
var _$_class_private_field_get;
|
|
3116
3244
|
if (!pipelineEngine_class_private_field_get(this, _active)) return;
|
|
3245
|
+
if (pipelineEngine_class_private_field_get(this, pipelineEngine_processManager).draining) return;
|
|
3117
3246
|
if (pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).length >= pipelineEngine_class_private_field_get(this, pipelineEngine_maxInflight)) return;
|
|
3118
3247
|
var batch = [];
|
|
3119
3248
|
while(batch.length < pipelineEngine_class_private_field_get(this, pipelineEngine_batchSize) && !pipelineEngine_class_private_field_get(this, _queue).isEmpty() && pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).length + batch.length < pipelineEngine_class_private_field_get(this, pipelineEngine_maxInflight)){
|
|
@@ -3131,8 +3260,7 @@ function pipelineEngine_pumpQueue() {
|
|
|
3131
3260
|
var task = _step.value;
|
|
3132
3261
|
task.startTime = now;
|
|
3133
3262
|
task.timer = setTimeout(function() {
|
|
3134
|
-
|
|
3135
|
-
pipelineEngine_class_private_field_get(_this, _onTaskTimeout).call(_this, task);
|
|
3263
|
+
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_handleTaskTimeout, pipelineEngine_handleTaskTimeout).call(_this, task);
|
|
3136
3264
|
}, task.timeout);
|
|
3137
3265
|
};
|
|
3138
3266
|
for(var _iterator = batch[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
@@ -3152,6 +3280,21 @@ function pipelineEngine_pumpQueue() {
|
|
|
3152
3280
|
function core_pipelineEngine_handleParsedValue(raw) {
|
|
3153
3281
|
var task = pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks)[0];
|
|
3154
3282
|
if (!task) return;
|
|
3283
|
+
if (isSentinelRaw(raw, task.token)) {
|
|
3284
|
+
clearTimeout(task.timer);
|
|
3285
|
+
pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).shift();
|
|
3286
|
+
if (task.timedout) return void pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3287
|
+
if (task.consumerError) {
|
|
3288
|
+
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, task.consumerError, void 0);
|
|
3289
|
+
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3290
|
+
return;
|
|
3291
|
+
}
|
|
3292
|
+
pipelineEngine_class_private_field_get(this, pipelineEngine_pendingFinalizeTasks).add(task);
|
|
3293
|
+
pipelineEngine_class_private_method_get(this, core_pipelineEngine_scheduleFinalizeCheck, pipelineEngine_scheduleFinalizeCheck).call(this);
|
|
3294
|
+
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3295
|
+
return;
|
|
3296
|
+
}
|
|
3297
|
+
if ("[]" === raw) return;
|
|
3155
3298
|
var parsed;
|
|
3156
3299
|
try {
|
|
3157
3300
|
parsed = JSON.parse(raw);
|
|
@@ -3162,6 +3305,7 @@ function core_pipelineEngine_handleParsedValue(raw) {
|
|
|
3162
3305
|
if (isSentinelRow(parsed, task.token)) {
|
|
3163
3306
|
clearTimeout(task.timer);
|
|
3164
3307
|
pipelineEngine_class_private_field_get(this, pipelineEngine_inflightTasks).shift();
|
|
3308
|
+
if (task.timedout) return void pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3165
3309
|
if (task.consumerError) {
|
|
3166
3310
|
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, task.consumerError, void 0);
|
|
3167
3311
|
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
@@ -3172,6 +3316,7 @@ function core_pipelineEngine_handleParsedValue(raw) {
|
|
|
3172
3316
|
pipelineEngine_class_private_method_get(this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(this);
|
|
3173
3317
|
return;
|
|
3174
3318
|
}
|
|
3319
|
+
if (task.timedout) return;
|
|
3175
3320
|
if ("query" === task.kind) return void collectQueryRows(task, parsed);
|
|
3176
3321
|
if ("stream" === task.kind) processStreamRows(task, parsed);
|
|
3177
3322
|
}
|
|
@@ -3181,37 +3326,21 @@ function pipelineEngine_scheduleFinalizeCheck() {
|
|
|
3181
3326
|
pipelineEngine_class_private_field_set(this, pipelineEngine_scheduledFinalize, true);
|
|
3182
3327
|
setImmediate(function() {
|
|
3183
3328
|
pipelineEngine_class_private_field_set(_this, pipelineEngine_scheduledFinalize, false);
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, task, new Error(task.stderrText.trim()), void 0);
|
|
3190
|
-
continue;
|
|
3191
|
-
}
|
|
3192
|
-
if (task.consumerError) {
|
|
3193
|
-
pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, task, task.consumerError, void 0);
|
|
3194
|
-
continue;
|
|
3195
|
-
}
|
|
3196
|
-
if ("query" === task.kind) {
|
|
3197
|
-
pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, task, null, task.rows);
|
|
3198
|
-
continue;
|
|
3199
|
-
}
|
|
3200
|
-
pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, task, null, void 0);
|
|
3201
|
-
}
|
|
3202
|
-
} catch (err) {
|
|
3203
|
-
_didIteratorError = true;
|
|
3204
|
-
_iteratorError = err;
|
|
3205
|
-
} finally{
|
|
3206
|
-
try {
|
|
3207
|
-
if (!_iteratorNormalCompletion && null != _iterator["return"]) _iterator["return"]();
|
|
3208
|
-
} finally{
|
|
3209
|
-
if (_didIteratorError) throw _iteratorError;
|
|
3210
|
-
}
|
|
3211
|
-
}
|
|
3212
|
-
pipelineEngine_class_private_field_get(_this, pipelineEngine_pendingFinalizeTasks).clear();
|
|
3329
|
+
finalizePendingTasks(pipelineEngine_class_private_field_get(_this, pipelineEngine_pendingFinalizeTasks), function(t, e, v1) {
|
|
3330
|
+
return pipelineEngine_class_private_method_get(_this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(_this, t, e, v1);
|
|
3331
|
+
}, function() {
|
|
3332
|
+
return pipelineEngine_class_private_method_get(_this, core_pipelineEngine_pumpQueue, pipelineEngine_pumpQueue).call(_this);
|
|
3333
|
+
});
|
|
3213
3334
|
});
|
|
3214
3335
|
}
|
|
3336
|
+
function pipelineEngine_handleTaskTimeout(task) {
|
|
3337
|
+
var _this, _this1;
|
|
3338
|
+
var error = prepareTaskTimeout(task, pipelineEngine_class_private_field_get(this, pipelineEngine_metrics));
|
|
3339
|
+
if (error) {
|
|
3340
|
+
pipelineEngine_class_private_method_get(this, pipelineEngine_settleTask, pipelineEngine_settleTask1).call(this, task, error, void 0);
|
|
3341
|
+
null == (_this = pipelineEngine_class_private_field_get(_this1 = this, _onTaskTimeout)) || _this.call(_this1, task);
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3215
3344
|
function pipelineEngine_settleTask1(task, error, value) {
|
|
3216
3345
|
settleTask(task, error, value, pipelineEngine_class_private_field_get(this, pipelineEngine_metrics), {
|
|
3217
3346
|
resetRowParser: true
|
|
@@ -3439,7 +3568,6 @@ var _computedKey2 = executor_computedKey;
|
|
|
3439
3568
|
var executor_SQLiteExecutor = /*#__PURE__*/ function() {
|
|
3440
3569
|
"use strict";
|
|
3441
3570
|
function SQLiteExecutor() {
|
|
3442
|
-
var _this = this;
|
|
3443
3571
|
var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, _ref_binary = _ref.binary, binary = void 0 === _ref_binary ? "sqlite3" : _ref_binary, _ref_database = _ref.database, database = void 0 === _ref_database ? ":memory:" : _ref_database, logger = _ref.logger, _ref_statementTimeout = _ref.statementTimeout, statementTimeout = void 0 === _ref_statementTimeout ? DEFAULT_STATEMENT_TIMEOUT : _ref_statementTimeout, _ref_autoRestart = _ref.autoRestart, autoRestart = void 0 === _ref_autoRestart ? true : _ref_autoRestart, _ref_poolSize = _ref.poolSize, poolSize = void 0 === _ref_poolSize ? 0 : _ref_poolSize, metrics = _ref.metrics;
|
|
3444
3572
|
executor_class_call_check(this, SQLiteExecutor);
|
|
3445
3573
|
executor_class_private_method_init(this, _normalizeTimeout);
|
|
@@ -3519,10 +3647,7 @@ var executor_SQLiteExecutor = /*#__PURE__*/ function() {
|
|
|
3519
3647
|
metrics: executor_class_private_field_get(this, executor_metrics),
|
|
3520
3648
|
statementTimeout: executor_class_private_field_get(this, executor_statementTimeout),
|
|
3521
3649
|
logger: executor_class_private_field_get(this, executor_logger),
|
|
3522
|
-
onTaskTimeout: function(
|
|
3523
|
-
executor_class_private_field_get(_this, executor_metrics).incrementTasksTimeout();
|
|
3524
|
-
executor_class_private_method_get(_this, _handleProcessFailure, handleProcessFailure).call(_this, createTimeoutError(task.timeout, task.sql));
|
|
3525
|
-
}
|
|
3650
|
+
onTaskTimeout: function() {}
|
|
3526
3651
|
}));
|
|
3527
3652
|
executor_class_private_method_get(this, executor_startProcess, core_executor_startProcess).call(this);
|
|
3528
3653
|
if (poolSize > 0 && ":memory:" !== database) executor_class_private_field_set(this, _readerPool, new readerPool_ReaderPool({
|
|
@@ -3549,6 +3674,12 @@ var executor_SQLiteExecutor = /*#__PURE__*/ function() {
|
|
|
3549
3674
|
return executor_class_private_field_get(this, _readerPool);
|
|
3550
3675
|
}
|
|
3551
3676
|
},
|
|
3677
|
+
{
|
|
3678
|
+
key: "_process",
|
|
3679
|
+
get: function() {
|
|
3680
|
+
return executor_class_private_field_get(this, executor_proc);
|
|
3681
|
+
}
|
|
3682
|
+
},
|
|
3552
3683
|
{
|
|
3553
3684
|
key: "metrics",
|
|
3554
3685
|
get: function() {
|
|
@@ -3838,6 +3969,7 @@ function enqueueWriter(kind, sql, timeout, token, onRow, scopeId) {
|
|
|
3838
3969
|
reject: reject,
|
|
3839
3970
|
consumerError: null,
|
|
3840
3971
|
stderrText: "",
|
|
3972
|
+
settled: false,
|
|
3841
3973
|
timer: null,
|
|
3842
3974
|
startTime: 0,
|
|
3843
3975
|
rowParser: null
|