ueberdb2 5.0.1 → 5.0.3
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/index.js +299 -1399
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
/**
|
|
35
35
|
* Cache with Least Recently Used eviction policy.
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
class LRU {
|
|
38
38
|
/**
|
|
39
39
|
* @param evictable Optional predicate that dictates whether it is permissable to evict the entry
|
|
40
40
|
* if it is old and the cache is over capacity. The predicate is passed two arguments (key,
|
|
@@ -95,7 +95,7 @@ let LRU$2=class LRU {
|
|
|
95
95
|
this._cache.delete(k);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
}
|
|
98
|
+
}
|
|
99
99
|
// Same as Promise but with a `done` property set to a Node-style callback that resolves/rejects the
|
|
100
100
|
// Promise.
|
|
101
101
|
class SelfContainedPromise extends Promise {
|
|
@@ -155,7 +155,7 @@ const Database$1 = class Database {
|
|
|
155
155
|
// the write to the underlying database returns. If the value has been written this is null.
|
|
156
156
|
// - writingInProgress: Boolean that if true indicates that the value has been sent to the
|
|
157
157
|
// underlying database and we are awaiting commit.
|
|
158
|
-
this.buffer = new LRU
|
|
158
|
+
this.buffer = new LRU(this.settings.cache, (k, v) => !v.dirty && !v.writingInProgress);
|
|
159
159
|
// Either null if flushing is currently allowed, or a Promise that will resolve when it is OK to
|
|
160
160
|
// start flushing. The Promise has a `count` property that tracks the number of operations that
|
|
161
161
|
// are currently preventing flush() from running.
|
|
@@ -40442,7 +40442,7 @@ var parse$h = function (str, opts) {
|
|
|
40442
40442
|
var parse$g = parse$h;
|
|
40443
40443
|
var formats$1 = formats$4;
|
|
40444
40444
|
|
|
40445
|
-
var lib$
|
|
40445
|
+
var lib$a = {
|
|
40446
40446
|
formats: formats$1,
|
|
40447
40447
|
parse: parse$g,
|
|
40448
40448
|
stringify: stringify$2
|
|
@@ -59656,7 +59656,7 @@ var multipart$1 = MultiPartFactory;(function (module, exports) {
|
|
|
59656
59656
|
const http = http$5;
|
|
59657
59657
|
const https = require$$2$2;
|
|
59658
59658
|
const assert = require$$0$i;
|
|
59659
|
-
const querystring = lib$
|
|
59659
|
+
const querystring = lib$a;
|
|
59660
59660
|
const axios = axios_1;
|
|
59661
59661
|
const stream = require$$0$b;
|
|
59662
59662
|
const pkg = require$$7$2;
|
|
@@ -61297,11 +61297,11 @@ class Dirty extends events_1$5.EventEmitter {
|
|
|
61297
61297
|
this._writeStream.uncork();
|
|
61298
61298
|
}
|
|
61299
61299
|
}
|
|
61300
|
-
dirty.default = Dirty;var __importDefault$
|
|
61300
|
+
dirty.default = Dirty;var __importDefault$6 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
61301
61301
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
61302
61302
|
};
|
|
61303
61303
|
Object.defineProperty(dirty$1, "__esModule", { value: true });
|
|
61304
|
-
const dirty_1 = __importDefault$
|
|
61304
|
+
const dirty_1 = __importDefault$6(dirty);
|
|
61305
61305
|
var _default$1 = dirty$1.default = dirty_1.default;/**
|
|
61306
61306
|
* 2011 Peter 'Pita' Martischka
|
|
61307
61307
|
*
|
|
@@ -67748,7 +67748,7 @@ function __importStar$3(mod) {
|
|
|
67748
67748
|
return result;
|
|
67749
67749
|
}
|
|
67750
67750
|
|
|
67751
|
-
function __importDefault$
|
|
67751
|
+
function __importDefault$5(mod) {
|
|
67752
67752
|
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
67753
67753
|
}
|
|
67754
67754
|
|
|
@@ -67839,13 +67839,13 @@ var _tslib = {
|
|
|
67839
67839
|
__asyncValues: __asyncValues,
|
|
67840
67840
|
__makeTemplateObject: __makeTemplateObject,
|
|
67841
67841
|
__importStar: __importStar$3,
|
|
67842
|
-
__importDefault: __importDefault$
|
|
67842
|
+
__importDefault: __importDefault$5,
|
|
67843
67843
|
__classPrivateFieldGet: __classPrivateFieldGet$8,
|
|
67844
67844
|
__classPrivateFieldSet: __classPrivateFieldSet$8,
|
|
67845
67845
|
__classPrivateFieldIn: __classPrivateFieldIn,
|
|
67846
67846
|
__addDisposableResource: __addDisposableResource,
|
|
67847
67847
|
__disposeResources: __disposeResources,
|
|
67848
|
-
};var _tslib$1=/*#__PURE__*/Object.freeze({__proto__:null,__addDisposableResource:__addDisposableResource,get __assign(){return __assign},__asyncDelegator:__asyncDelegator,__asyncGenerator:__asyncGenerator,__asyncValues:__asyncValues,__await:__await,__awaiter:__awaiter,__classPrivateFieldGet:__classPrivateFieldGet$8,__classPrivateFieldIn:__classPrivateFieldIn,__classPrivateFieldSet:__classPrivateFieldSet$8,__createBinding:__createBinding$3,__decorate:__decorate,__disposeResources:__disposeResources,__esDecorate:__esDecorate,__exportStar:__exportStar,__extends:__extends,__generator:__generator,__importDefault:__importDefault$
|
|
67848
|
+
};var _tslib$1=/*#__PURE__*/Object.freeze({__proto__:null,__addDisposableResource:__addDisposableResource,get __assign(){return __assign},__asyncDelegator:__asyncDelegator,__asyncGenerator:__asyncGenerator,__asyncValues:__asyncValues,__await:__await,__awaiter:__awaiter,__classPrivateFieldGet:__classPrivateFieldGet$8,__classPrivateFieldIn:__classPrivateFieldIn,__classPrivateFieldSet:__classPrivateFieldSet$8,__createBinding:__createBinding$3,__decorate:__decorate,__disposeResources:__disposeResources,__esDecorate:__esDecorate,__exportStar:__exportStar,__extends:__extends,__generator:__generator,__importDefault:__importDefault$5,__importStar:__importStar$3,__makeTemplateObject:__makeTemplateObject,__metadata:__metadata,__param:__param,__propKey:__propKey,__read:__read,__rest:__rest,__runInitializers:__runInitializers,__setFunctionName:__setFunctionName,__spread:__spread,__spreadArray:__spreadArray,__spreadArrays:__spreadArrays,__values:__values,default:_tslib});var require$$0$4 = /*@__PURE__*/getAugmentedNamespace(_tslib$1);var Serializer$4 = {};var secureJsonParse = {exports: {}};var hasRequiredSecureJsonParse;
|
|
67849
67849
|
|
|
67850
67850
|
function requireSecureJsonParse () {
|
|
67851
67851
|
if (hasRequiredSecureJsonParse) return secureJsonParse.exports;
|
|
@@ -110178,7 +110178,7 @@ class Elasticsearch_db extends AbstractDatabase {
|
|
|
110178
110178
|
set(key, value, cb) {
|
|
110179
110179
|
this.emit('set', key, value, cb);
|
|
110180
110180
|
}
|
|
110181
|
-
}var lib$
|
|
110181
|
+
}var lib$9 = {};var admin = {};var bson$2 = {};var bson$1 = {};function isAnyArrayBuffer(value) {
|
|
110182
110182
|
return ['[object ArrayBuffer]', '[object SharedArrayBuffer]'].includes(Object.prototype.toString.call(value));
|
|
110183
110183
|
}
|
|
110184
110184
|
function isUint8Array(value) {
|
|
@@ -114592,7 +114592,7 @@ bson$1.serialize = serialize$2;
|
|
|
114592
114592
|
bson$1.serializeWithBufferAndIndex = serializeWithBufferAndIndex;
|
|
114593
114593
|
bson$1.setInternalBufferSize = setInternalBufferSize;(function (exports) {
|
|
114594
114594
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
114595
|
-
exports.resolveBSONOptions = exports.pluckBSONSerializeOptions = exports.toUTF8 = exports.getBigInt64LE = exports.getFloat64LE = exports.getInt32LE = exports.parseToElementsToArray = exports.UUID = exports.Timestamp = exports.serialize = exports.ObjectId = exports.MinKey = exports.MaxKey = exports.Long = exports.Int32 = exports.EJSON = exports.Double = exports.deserialize = exports.Decimal128 = exports.DBRef = exports.Code = exports.calculateObjectSize = exports.BSONType = exports.BSONSymbol = exports.BSONRegExp = exports.BSONError = exports.BSON = exports.Binary = void 0;
|
|
114595
|
+
exports.parseUtf8ValidationOption = exports.resolveBSONOptions = exports.pluckBSONSerializeOptions = exports.toUTF8 = exports.getBigInt64LE = exports.getFloat64LE = exports.getInt32LE = exports.parseToElementsToArray = exports.UUID = exports.Timestamp = exports.serialize = exports.ObjectId = exports.MinKey = exports.MaxKey = exports.Long = exports.Int32 = exports.EJSON = exports.Double = exports.deserialize = exports.Decimal128 = exports.DBRef = exports.Code = exports.calculateObjectSize = exports.BSONType = exports.BSONSymbol = exports.BSONRegExp = exports.BSONError = exports.BSON = exports.Binary = void 0;
|
|
114596
114596
|
const bson_1 = bson$1;
|
|
114597
114597
|
var bson_2 = bson$1;
|
|
114598
114598
|
Object.defineProperty(exports, "Binary", { enumerable: true, get: function () { return bson_2.Binary; } });
|
|
@@ -114663,6 +114663,15 @@ bson$1.setInternalBufferSize = setInternalBufferSize;(function (exports) {
|
|
|
114663
114663
|
};
|
|
114664
114664
|
}
|
|
114665
114665
|
exports.resolveBSONOptions = resolveBSONOptions;
|
|
114666
|
+
/** @internal */
|
|
114667
|
+
function parseUtf8ValidationOption(options) {
|
|
114668
|
+
const enableUtf8Validation = options?.enableUtf8Validation;
|
|
114669
|
+
if (enableUtf8Validation === false) {
|
|
114670
|
+
return { utf8: false };
|
|
114671
|
+
}
|
|
114672
|
+
return { utf8: { writeErrors: false } };
|
|
114673
|
+
}
|
|
114674
|
+
exports.parseUtf8ValidationOption = parseUtf8ValidationOption;
|
|
114666
114675
|
|
|
114667
114676
|
} (bson$2));var execute_operation = {};var error$4 = {};(function (exports) {
|
|
114668
114677
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -116840,7 +116849,7 @@ class OnDemandDocument {
|
|
|
116840
116849
|
* @param options - BSON deserialization options
|
|
116841
116850
|
*/
|
|
116842
116851
|
toObject(options) {
|
|
116843
|
-
return bson_1$e.
|
|
116852
|
+
return (0, bson_1$e.deserialize)(this.bson, {
|
|
116844
116853
|
...options,
|
|
116845
116854
|
index: this.offset,
|
|
116846
116855
|
allowObjectSmallerThanBufferSize: true
|
|
@@ -116924,7 +116933,8 @@ function requireResponses () {
|
|
|
116924
116933
|
return (this.get('recoveryToken', bson_1.BSONType.object)?.toObject({
|
|
116925
116934
|
promoteValues: false,
|
|
116926
116935
|
promoteLongs: false,
|
|
116927
|
-
promoteBuffers: false
|
|
116936
|
+
promoteBuffers: false,
|
|
116937
|
+
validation: { utf8: true }
|
|
116928
116938
|
}) ?? null);
|
|
116929
116939
|
}
|
|
116930
116940
|
/**
|
|
@@ -116969,17 +116979,10 @@ function requireResponses () {
|
|
|
116969
116979
|
toObject(options) {
|
|
116970
116980
|
const exactBSONOptions = {
|
|
116971
116981
|
...(0, bson_1.pluckBSONSerializeOptions)(options ?? {}),
|
|
116972
|
-
validation:
|
|
116982
|
+
validation: (0, bson_1.parseUtf8ValidationOption)(options)
|
|
116973
116983
|
};
|
|
116974
116984
|
return super.toObject(exactBSONOptions);
|
|
116975
116985
|
}
|
|
116976
|
-
parseBsonSerializationOptions(options) {
|
|
116977
|
-
const enableUtf8Validation = options?.enableUtf8Validation;
|
|
116978
|
-
if (enableUtf8Validation === false) {
|
|
116979
|
-
return { utf8: false };
|
|
116980
|
-
}
|
|
116981
|
-
return { utf8: { writeErrors: false } };
|
|
116982
|
-
}
|
|
116983
116986
|
}
|
|
116984
116987
|
// {ok:1}
|
|
116985
116988
|
MongoDBResponse.empty = new MongoDBResponse(new Uint8Array([13, 0, 0, 0, 16, 111, 107, 0, 1, 0, 0, 0, 0]));
|
|
@@ -117048,7 +117051,8 @@ function requireResponses () {
|
|
|
117048
117051
|
return (this.cursor.get('postBatchResumeToken', bson_1.BSONType.object)?.toObject({
|
|
117049
117052
|
promoteValues: false,
|
|
117050
117053
|
promoteLongs: false,
|
|
117051
|
-
promoteBuffers: false
|
|
117054
|
+
promoteBuffers: false,
|
|
117055
|
+
validation: { utf8: true }
|
|
117052
117056
|
}) ?? null);
|
|
117053
117057
|
}
|
|
117054
117058
|
shift(options) {
|
|
@@ -122900,6 +122904,12 @@ sessions.updateSessionFromResponse = updateSessionFromResponse;(function (export
|
|
|
122900
122904
|
else {
|
|
122901
122905
|
this.cursorSession = this.cursorClient.startSession({ owner: this, explicit: false });
|
|
122902
122906
|
}
|
|
122907
|
+
this.deserializationOptions = {
|
|
122908
|
+
...this.cursorOptions,
|
|
122909
|
+
validation: {
|
|
122910
|
+
utf8: options?.enableUtf8Validation === false ? false : true
|
|
122911
|
+
}
|
|
122912
|
+
};
|
|
122903
122913
|
}
|
|
122904
122914
|
/**
|
|
122905
122915
|
* The cursor has no id until it receives a response from the initial cursor creating command.
|
|
@@ -122964,7 +122974,7 @@ sessions.updateSessionFromResponse = updateSessionFromResponse;(function (export
|
|
|
122964
122974
|
const bufferedDocs = [];
|
|
122965
122975
|
const documentsToRead = Math.min(number ?? this.documents?.length ?? 0, this.documents?.length ?? 0);
|
|
122966
122976
|
for (let count = 0; count < documentsToRead; count++) {
|
|
122967
|
-
const document = this.documents?.shift(this.
|
|
122977
|
+
const document = this.documents?.shift(this.deserializationOptions);
|
|
122968
122978
|
if (document != null) {
|
|
122969
122979
|
bufferedDocs.push(document);
|
|
122970
122980
|
}
|
|
@@ -123049,7 +123059,7 @@ sessions.updateSessionFromResponse = updateSessionFromResponse;(function (export
|
|
|
123049
123059
|
throw new error_1.MongoCursorExhaustedError();
|
|
123050
123060
|
}
|
|
123051
123061
|
do {
|
|
123052
|
-
const doc = this.documents?.shift(this.
|
|
123062
|
+
const doc = this.documents?.shift(this.deserializationOptions);
|
|
123053
123063
|
if (doc != null) {
|
|
123054
123064
|
if (this.transform != null)
|
|
123055
123065
|
return await this.transformDocument(doc);
|
|
@@ -123066,14 +123076,14 @@ sessions.updateSessionFromResponse = updateSessionFromResponse;(function (export
|
|
|
123066
123076
|
if (this.cursorId === bson_1.Long.ZERO) {
|
|
123067
123077
|
throw new error_1.MongoCursorExhaustedError();
|
|
123068
123078
|
}
|
|
123069
|
-
let doc = this.documents?.shift(this.
|
|
123079
|
+
let doc = this.documents?.shift(this.deserializationOptions);
|
|
123070
123080
|
if (doc != null) {
|
|
123071
123081
|
if (this.transform != null)
|
|
123072
123082
|
return await this.transformDocument(doc);
|
|
123073
123083
|
return doc;
|
|
123074
123084
|
}
|
|
123075
123085
|
await this.fetchBatch();
|
|
123076
|
-
doc = this.documents?.shift(this.
|
|
123086
|
+
doc = this.documents?.shift(this.deserializationOptions);
|
|
123077
123087
|
if (doc != null) {
|
|
123078
123088
|
if (this.transform != null)
|
|
123079
123089
|
return await this.transformDocument(doc);
|
|
@@ -123558,7 +123568,7 @@ class AggregationCursor extends abstract_cursor_1$4.AbstractCursor {
|
|
|
123558
123568
|
...this.aggregateOptions,
|
|
123559
123569
|
...this.cursorOptions,
|
|
123560
123570
|
explain: verbosity ?? true
|
|
123561
|
-
}))).shift(this.
|
|
123571
|
+
}))).shift(this.deserializationOptions);
|
|
123562
123572
|
}
|
|
123563
123573
|
addStage(stage) {
|
|
123564
123574
|
this.throwIfInitialized();
|
|
@@ -124037,7 +124047,7 @@ class FindCursor extends abstract_cursor_1$3.AbstractCursor {
|
|
|
124037
124047
|
...this.findOptions,
|
|
124038
124048
|
...this.cursorOptions,
|
|
124039
124049
|
explain: verbosity ?? true
|
|
124040
|
-
}))).shift(this.
|
|
124050
|
+
}))).shift(this.deserializationOptions);
|
|
124041
124051
|
}
|
|
124042
124052
|
/** Set the cursor query */
|
|
124043
124053
|
filter(filter) {
|
|
@@ -127058,7 +127068,7 @@ auth_provider.AuthProvider = AuthProvider;(function (exports) {
|
|
|
127058
127068
|
}
|
|
127059
127069
|
exports.MongoCredentials = MongoCredentials;
|
|
127060
127070
|
|
|
127061
|
-
} (mongo_credentials));var connection_string = {};var lib$
|
|
127071
|
+
} (mongo_credentials));var connection_string = {};var lib$8 = {};var whatwgUrl = {};var webidl2jsWrapper = {};var URL$5 = {};var lib$7 = {};(function (exports) {
|
|
127062
127072
|
|
|
127063
127073
|
function makeException(ErrorType, message, options) {
|
|
127064
127074
|
if (options.globals) {
|
|
@@ -127508,7 +127518,7 @@ auth_provider.AuthProvider = AuthProvider;(function (exports) {
|
|
|
127508
127518
|
};
|
|
127509
127519
|
|
|
127510
127520
|
exports.DOMTimeStamp = exports["unsigned long long"];
|
|
127511
|
-
} (lib$
|
|
127521
|
+
} (lib$7));var utils$a = {exports: {}};(function (module, exports) {
|
|
127512
127522
|
|
|
127513
127523
|
// Returns "Type(value) is Object" in ES terminology.
|
|
127514
127524
|
function isObject(value) {
|
|
@@ -177665,7 +177675,7 @@ function requireUrlencoded () {
|
|
|
177665
177675
|
serializeUrlencoded
|
|
177666
177676
|
};
|
|
177667
177677
|
return urlencoded;
|
|
177668
|
-
}var URLSearchParams$3 = {};var _Function = {};const conversions = lib$
|
|
177678
|
+
}var URLSearchParams$3 = {};var _Function = {};const conversions = lib$7;
|
|
177669
177679
|
const utils$9 = utilsExports$1;
|
|
177670
177680
|
|
|
177671
177681
|
_Function.convert = (globalObject, value, { context = "The provided value" } = {}) => {
|
|
@@ -177850,7 +177860,7 @@ function requireURLSearchParamsImpl () {
|
|
|
177850
177860
|
return URLSearchParamsImpl;
|
|
177851
177861
|
}(function (exports) {
|
|
177852
177862
|
|
|
177853
|
-
const conversions = lib$
|
|
177863
|
+
const conversions = lib$7;
|
|
177854
177864
|
const utils = utilsExports$1;
|
|
177855
177865
|
|
|
177856
177866
|
const Function = _Function;
|
|
@@ -178606,7 +178616,7 @@ function requireURLImpl () {
|
|
|
178606
178616
|
return URLImpl;
|
|
178607
178617
|
}(function (exports) {
|
|
178608
178618
|
|
|
178609
|
-
const conversions = lib$
|
|
178619
|
+
const conversions = lib$7;
|
|
178610
178620
|
const utils = utilsExports$1;
|
|
178611
178621
|
|
|
178612
178622
|
const implSymbol = utils.implSymbol;
|
|
@@ -179197,7 +179207,7 @@ function requireRedact () {
|
|
|
179197
179207
|
}var hasRequiredLib$3;
|
|
179198
179208
|
|
|
179199
179209
|
function requireLib$3 () {
|
|
179200
|
-
if (hasRequiredLib$3) return lib$
|
|
179210
|
+
if (hasRequiredLib$3) return lib$8;
|
|
179201
179211
|
hasRequiredLib$3 = 1;
|
|
179202
179212
|
(function (exports) {
|
|
179203
179213
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -179411,10 +179421,10 @@ function requireLib$3 () {
|
|
|
179411
179421
|
exports.CommaAndColonSeparatedRecord = CommaAndColonSeparatedRecord;
|
|
179412
179422
|
exports.default = ConnectionString;
|
|
179413
179423
|
|
|
179414
|
-
} (lib$
|
|
179415
|
-
return lib$
|
|
179424
|
+
} (lib$8));
|
|
179425
|
+
return lib$8;
|
|
179416
179426
|
}var client_metadata = {};var name$5 = "mongodb";
|
|
179417
|
-
var version$6 = "6.8.
|
|
179427
|
+
var version$6 = "6.8.1";
|
|
179418
179428
|
var description$2 = "The official MongoDB driver for Node.js";
|
|
179419
179429
|
var main$3 = "lib/index.js";
|
|
179420
179430
|
var files$2 = [
|
|
@@ -187456,12 +187466,12 @@ function alloc (n) {
|
|
|
187456
187466
|
|
|
187457
187467
|
function powerOfTwo (x) {
|
|
187458
187468
|
return !(x & (x - 1))
|
|
187459
|
-
}var __importDefault$
|
|
187469
|
+
}var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
187460
187470
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
187461
187471
|
};
|
|
187462
187472
|
Object.defineProperty(memoryCodePoints, "__esModule", { value: true });
|
|
187463
187473
|
memoryCodePoints.createMemoryCodePoints = void 0;
|
|
187464
|
-
const sparse_bitfield_1 = __importDefault$
|
|
187474
|
+
const sparse_bitfield_1 = __importDefault$4(sparseBitfield);
|
|
187465
187475
|
function createMemoryCodePoints(data) {
|
|
187466
187476
|
let offset = 0;
|
|
187467
187477
|
function read() {
|
|
@@ -187489,12 +187499,12 @@ function createMemoryCodePoints(data) {
|
|
|
187489
187499
|
memoryCodePoints.createMemoryCodePoints = createMemoryCodePoints;var codePointsData = {};Object.defineProperty(codePointsData, "__esModule", { value: true });
|
|
187490
187500
|
const zlib_1 = require$$0$e;
|
|
187491
187501
|
codePointsData.default = (0, zlib_1.gunzipSync)(Buffer.from('H4sIAAAAAAACA+3dTYgcaRkA4LemO9Mhxm0FITnE9Cwr4jHgwgZ22B6YywqCJ0HQg5CL4sGTuOjCtGSF4CkHEW856MlTQHD3EJnWkU0Owh5VxE3LHlYQdNxd2U6mU59UV/d09fw4M2EySSXPAzNdP1/9fX/99bzVNZEN4jisRDulVFnQmLxm1aXF9Id/2/xMxNJ4XZlg576yuYlGt9gupV6xoFf8jhu9YvulVrFlp5XSx+lfvYhORGPXvqIRWSxERKtIm8bKFd10WNfKDS5Fo9jJWrq2+M2IlW+8uHgl/+BsROfPF4v5L7148Ur68Sha6dqZpYiVVy8tvLCWXo80Sf/lS89dGX2wHGvpzoXVn75/YWH5wmqe8uika82ViJXTy83Ve2k5Urozm38wm4/ls6t5uT6yfsTSJ7J3T0VKt8c5ExEXI8aFkH729c3eT+7EC6ca8cVULZUiYacX0R5PNWNxlh9L1y90q5kyzrpyy+9WcvOV6URntqw7La9sNVstXyczWVaWYbaaTYqzOHpr7pyiNT3/YzKuT63Z/FqKZlFTiuXtFM2vVOtIq7jiyKJbWZaOWD0euz0yoV2Z7kY0xq2x0YhfzVpmM5px9nTEH7JZ0ot5u39p0ma75Z472/s/H+2yr2inYyuq7fMvJivH2rM72N/Z3lyL31F2b1ya1P0zn816k2KP6JU9UzseucdQH5YqVeH/lFajSN2udg+TLJ9rksNxlvV2lki19rXKI43TPLejFu4ov7k3nMbhyhfY3Xb37f8BAGCf0eMTOH5szf154KmnNgKcnLb+Fzi2AfXktbN7fJelwTAiO/W5uQ2KINXRYu+znqo/WTAdLadURHmy3qciazd3bra4T3w16/f7t7Ms9U5gfJu10955sx1r3vmhBAAAAAAAgId20J1iZbDowNvIjuH427Gr5l/eiC+8OplZON8sVjx/qr9y+Pj+YRItT+NqAM+kkZs3AAAAAID6yfx1FwCAI97/dCh1/ub6SA0AAAAAAAAAgNoT/wcAAAAAAACA+hP/BwAAAAAAAID6E/8HAAAAAAAAgPoT/wcAAAAAAACA+hP/BwAAAAAAAID6E/8HAAAAAAAAgPoT/wcAAAAAAACA+hP/BwAAAAAAAID6E/8HAAAAAAAAgPoT/wcAAAAAAACA+hutp5SiQpYAAAAAAAAAQO2MIpZiT804flnAE2fhwjOeAZXr76kOAAAAAAAA8FjNf4N/l0NE3U/vuVQskLpSd4/Yh2xu9xTu0tFeeNYsLI2f/VMdNxTzj6Je9E/+6pp6Nn3awW3A54goe4Bss6v+PGsjQGMAAAAAAOBp5XEgwH6e7J7rwEQHRb/XvAMAAAAAAAA8yzoDeQDwVGjIAgAAAAAAAACoPfF/AAAAAAAAAKg/8X8AAAAAAAAAqD/xfwAAAAAAAACoP/F/AAAAAAAAAKg/8X8AAAAAAAAAqD/xfwAAAAAAAACoP/F/AAAAAAAAAKg/8X8AAAAAAAAAqD/xfwAAAAAAAACoP/F/AAAAAAAAAKg/8X8AAAAAAAAAqL/GSkSkClkCAAAAAAAAALXTSAAAAAAAAABA3Y1kAQAAAAAAAADUX8RSXZ9dsHC9+M8Fg2Ex/em1lAZpEBGttcrVjZqLEa+k0XpKw9mG4zWx4ukPUMhkAQAAAAAAABzBqbSe3//rXOS9HxGdo4TqR2XkutCdBu+LaPZw/lBbO7cbHnh2C7N7AIo4evEznllqLqWUp/LnYOtpM2bnOH66wI1+9GO4sOuISwv/TOlumu56FDv3NZhc4mR9v7zYIrafr40j/Cccvj9Xns3t3mu99E7qxUv3bqS0/ouNH/08++RGemfQ+nsx/5uNXsQPGulynPvv3ZTW37zd+1ovrqaYpP/122X6Xpx779Z3zr/3YOPKW1lkaRDf31pPaf3j/msRsVGkL+d/f+/m4sJsPm1cfSsr16e8m9Ldj/KsnyIuR3nXw83Is3EhxLd/2V773ks3m/cj/THKUummdP9qKhIOImuOU0Xjwb3y+oqt735rpTetVbF9n8R4x9crRfO77TKqVOZpDclv5bfK18lMnk+q0K18UpxF/RrGXE0Zxtqx3tWSj+vxbL4XaasfKb0dRbtLW73JsfPGg177H+OmGKlfvS1msllt7JEJm9XOJqXR+Fkfo1H66uy5H1v3Xx5+uJmGLw9jro2u7Loj4PnuR6+f+e3d261+eazNhzrL7X83MohoHpS4PddV8ki1it61//pw1g7z6p1U/26Nm2llST57B5rUvuG0XqSU/rPd7jYrqWcbd+beJQ77BgPMDwn37/8BAGCf0eMTOH4cPlufv9VGgJOzqf8Fjm1APXkd7B7f5dF57GPMaWy/MTvjvNvtXj6h8W2+GXvnzXaseeeHEgAAAAAAAB7aQXeKlcGiadBoEOeLb2dtpGOL2MyOtf391a3P/zD96c3JzIP3t4oV797vrh8+vn+YRL5bBuj/AQAAAABqJvfHXQAAHkX82zfXAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACeAgkAAAAAAAAAqLuRLAAAAAAAAACA2hv9D1iu/VAYaAYA', 'base64'));
|
|
187492
|
-
var __importDefault$
|
|
187502
|
+
var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
187493
187503
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
187494
187504
|
};
|
|
187495
|
-
const index_1$1 = __importDefault$
|
|
187505
|
+
const index_1$1 = __importDefault$3(dist$b);
|
|
187496
187506
|
const memory_code_points_1 = memoryCodePoints;
|
|
187497
|
-
const code_points_data_1 = __importDefault$
|
|
187507
|
+
const code_points_data_1 = __importDefault$3(codePointsData);
|
|
187498
187508
|
const codePoints = (0, memory_code_points_1.createMemoryCodePoints)(code_points_data_1.default);
|
|
187499
187509
|
function saslprep(input, opts) {
|
|
187500
187510
|
return (0, index_1$1.default)(codePoints, input, opts);
|
|
@@ -190939,7 +190949,7 @@ client_encryption.ClientEncryption = ClientEncryption;(function (exports) {
|
|
|
190939
190949
|
var mongo_client_auth_providers_1 = mongo_client_auth_providers;
|
|
190940
190950
|
Object.defineProperty(exports, "MongoClientAuthProviders", { enumerable: true, get: function () { return mongo_client_auth_providers_1.MongoClientAuthProviders; } });
|
|
190941
190951
|
|
|
190942
|
-
} (lib$
|
|
190952
|
+
} (lib$9));/**
|
|
190943
190953
|
* 2020 Sylchauf
|
|
190944
190954
|
*
|
|
190945
190955
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -190984,7 +190994,7 @@ class Mongodb_db extends AbstractDatabase {
|
|
|
190984
190994
|
}, 10000);
|
|
190985
190995
|
}
|
|
190986
190996
|
init(callback) {
|
|
190987
|
-
lib$
|
|
190997
|
+
lib$9.MongoClient.connect(this.settings.url).then((v) => {
|
|
190988
190998
|
this.client = v;
|
|
190989
190999
|
this.database = v.db(this.settings.database);
|
|
190990
191000
|
this.schedulePing();
|
|
@@ -197010,7 +197020,7 @@ var index = {
|
|
|
197010
197020
|
wrapSync: asyncify,
|
|
197011
197021
|
during: whilst$1,
|
|
197012
197022
|
doDuring: doWhilst$1
|
|
197013
|
-
};var tedious$1 = {exports: {}};var base = {exports: {}};var lib$
|
|
197023
|
+
};var tedious$1 = {exports: {}};var base = {exports: {}};var lib$6 = {};var connectionString = {};Object.defineProperty(connectionString, "__esModule", { value: true });
|
|
197014
197024
|
var CollectionMode;
|
|
197015
197025
|
(function (CollectionMode) {
|
|
197016
197026
|
CollectionMode[CollectionMode["key"] = 0] = "key";
|
|
@@ -197507,7 +197517,7 @@ builder.buildConnectionString = buildConnectionString;(function (exports) {
|
|
|
197507
197517
|
exports.parseSqlConnectionString = sql_connection_string_1.default;
|
|
197508
197518
|
__exportStar(builder, exports);
|
|
197509
197519
|
|
|
197510
|
-
} (lib$
|
|
197520
|
+
} (lib$6));var tarn$1 = {exports: {}};var Pool$3 = {};var PendingOperation$1 = {};var TimeoutError$3 = {};Object.defineProperty(TimeoutError$3, "__esModule", { value: true });
|
|
197511
197521
|
let TimeoutError$2=class TimeoutError extends Error {
|
|
197512
197522
|
};
|
|
197513
197523
|
TimeoutError$3.TimeoutError = TimeoutError$2;var utils$8 = {};var PromiseInspection$1 = {};Object.defineProperty(PromiseInspection$1, "__esModule", { value: true });
|
|
@@ -199066,7 +199076,7 @@ var error$2 = {
|
|
|
199066
199076
|
TransactionError: TransactionError$3
|
|
199067
199077
|
};const { EventEmitter: EventEmitter$a } = require$$0$j;
|
|
199068
199078
|
const debug$c = srcExports('mssql:base');
|
|
199069
|
-
const { parseSqlConnectionString } = lib$
|
|
199079
|
+
const { parseSqlConnectionString } = lib$6;
|
|
199070
199080
|
const tarn = tarnExports;
|
|
199071
199081
|
const { IDS: IDS$6 } = utils$7;
|
|
199072
199082
|
const ConnectionError$3 = connectionError;
|
|
@@ -204889,12 +204899,12 @@ helpers$4.req = req;(function (exports) {
|
|
|
204889
204899
|
}
|
|
204890
204900
|
exports.Agent = Agent;
|
|
204891
204901
|
|
|
204892
|
-
} (dist$9));var parseProxyResponse$1 = {};var __importDefault$
|
|
204902
|
+
} (dist$9));var parseProxyResponse$1 = {};var __importDefault$2 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
204893
204903
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
204894
204904
|
};
|
|
204895
204905
|
Object.defineProperty(parseProxyResponse$1, "__esModule", { value: true });
|
|
204896
204906
|
parseProxyResponse$1.parseProxyResponse = void 0;
|
|
204897
|
-
const debug_1$3 = __importDefault$
|
|
204907
|
+
const debug_1$3 = __importDefault$2(srcExports);
|
|
204898
204908
|
const debug$8 = (0, debug_1$3.default)('https-proxy-agent:parse-proxy-response');
|
|
204899
204909
|
function parseProxyResponse(socket) {
|
|
204900
204910
|
return new Promise((resolve, reject) => {
|
|
@@ -205010,15 +205020,15 @@ var __importStar$1 = (commonjsGlobal && commonjsGlobal.__importStar) || function
|
|
|
205010
205020
|
__setModuleDefault$1(result, mod);
|
|
205011
205021
|
return result;
|
|
205012
205022
|
};
|
|
205013
|
-
var __importDefault$
|
|
205023
|
+
var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
205014
205024
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
205015
205025
|
};
|
|
205016
205026
|
Object.defineProperty(dist$a, "__esModule", { value: true });
|
|
205017
205027
|
var HttpsProxyAgent_1 = dist$a.HttpsProxyAgent = void 0;
|
|
205018
205028
|
const net$5 = __importStar$1(require$$0$7);
|
|
205019
205029
|
const tls$3 = __importStar$1(require$$1$2);
|
|
205020
|
-
const assert_1 = __importDefault$
|
|
205021
|
-
const debug_1$2 = __importDefault$
|
|
205030
|
+
const assert_1 = __importDefault$1(require$$0$i);
|
|
205031
|
+
const debug_1$2 = __importDefault$1(srcExports);
|
|
205022
205032
|
const agent_base_1$1 = dist$9;
|
|
205023
205033
|
const url_1$2 = require$$0$f;
|
|
205024
205034
|
const parse_proxy_response_1 = parseProxyResponse$1;
|
|
@@ -205182,14 +205192,14 @@ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (
|
|
|
205182
205192
|
__setModuleDefault(result, mod);
|
|
205183
205193
|
return result;
|
|
205184
205194
|
};
|
|
205185
|
-
var __importDefault
|
|
205195
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
205186
205196
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
205187
205197
|
};
|
|
205188
205198
|
Object.defineProperty(dist$8, "__esModule", { value: true });
|
|
205189
205199
|
var HttpProxyAgent_1 = dist$8.HttpProxyAgent = void 0;
|
|
205190
205200
|
const net$4 = __importStar(require$$0$7);
|
|
205191
205201
|
const tls$2 = __importStar(require$$1$2);
|
|
205192
|
-
const debug_1$1 = __importDefault
|
|
205202
|
+
const debug_1$1 = __importDefault(srcExports);
|
|
205193
205203
|
const events_1$2 = require$$0$8;
|
|
205194
205204
|
const agent_base_1 = dist$9;
|
|
205195
205205
|
const url_1$1 = require$$0$f;
|
|
@@ -219010,7 +219020,7 @@ const coerce$2 = (version, options) => {
|
|
|
219010
219020
|
|
|
219011
219021
|
return parse$7(`${major}.${minor}.${patch}${prerelease}${build}`, options)
|
|
219012
219022
|
};
|
|
219013
|
-
var coerce_1 = coerce$2;
|
|
219023
|
+
var coerce_1 = coerce$2;class LRUCache {
|
|
219014
219024
|
constructor () {
|
|
219015
219025
|
this.max = 1000;
|
|
219016
219026
|
this.map = new Map();
|
|
@@ -219047,9 +219057,9 @@ var coerce_1 = coerce$2;let LRUCache$1=class LRUCache {
|
|
|
219047
219057
|
|
|
219048
219058
|
return this
|
|
219049
219059
|
}
|
|
219050
|
-
}
|
|
219060
|
+
}
|
|
219051
219061
|
|
|
219052
|
-
var lrucache = LRUCache
|
|
219062
|
+
var lrucache = LRUCache;var range;
|
|
219053
219063
|
var hasRequiredRange;
|
|
219054
219064
|
|
|
219055
219065
|
function requireRange () {
|
|
@@ -251775,7 +251785,7 @@ var bigintExports = bigint.exports;var image = {exports: {}};(function (module,
|
|
|
251775
251785
|
|
|
251776
251786
|
} (image, image.exports));
|
|
251777
251787
|
|
|
251778
|
-
var imageExports = image.exports;var text = {exports: {}};var lib$
|
|
251788
|
+
var imageExports = image.exports;var text = {exports: {}};var lib$5 = {exports: {}};/* eslint-disable node/no-deprecated-api */
|
|
251779
251789
|
|
|
251780
251790
|
var buffer$1 = require$$0$k;
|
|
251781
251791
|
var Buffer$1 = buffer$1.Buffer;
|
|
@@ -263010,9 +263020,9 @@ function requireStreams () {
|
|
|
263010
263020
|
throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.");
|
|
263011
263021
|
};
|
|
263012
263022
|
}
|
|
263013
|
-
} (lib$
|
|
263023
|
+
} (lib$5));
|
|
263014
263024
|
|
|
263015
|
-
var libExports$2 = lib$
|
|
263025
|
+
var libExports$2 = lib$5.exports;(function (module, exports) {
|
|
263016
263026
|
|
|
263017
263027
|
Object.defineProperty(exports, "__esModule", {
|
|
263018
263028
|
value: true
|
|
@@ -273948,1341 +273958,230 @@ Denque.prototype._nextPowerOf2 = function _nextPowerOf2(num) {
|
|
|
273948
273958
|
return Math.max(nextPow2, 4);
|
|
273949
273959
|
};
|
|
273950
273960
|
|
|
273951
|
-
var denque = Denque;var
|
|
273952
|
-
|
|
273953
|
-
|
|
273954
|
-
|
|
273955
|
-
|
|
273956
|
-
|
|
273957
|
-
|
|
273958
|
-
|
|
273959
|
-
|
|
273960
|
-
|
|
273961
|
-
const
|
|
273962
|
-
const
|
|
273963
|
-
|
|
273964
|
-
|
|
273965
|
-
|
|
273966
|
-
|
|
273967
|
-
|
|
273968
|
-
|
|
273969
|
-
const
|
|
273970
|
-
const
|
|
273971
|
-
|
|
273972
|
-
|
|
273973
|
-
|
|
273974
|
-
|
|
273975
|
-
|
|
273976
|
-
|
|
273977
|
-
|
|
273978
|
-
|
|
273979
|
-
|
|
273980
|
-
|
|
273981
|
-
? null
|
|
273982
|
-
: max <= Math.pow(2, 8)
|
|
273983
|
-
? Uint8Array
|
|
273984
|
-
: max <= Math.pow(2, 16)
|
|
273985
|
-
? Uint16Array
|
|
273986
|
-
: max <= Math.pow(2, 32)
|
|
273987
|
-
? Uint32Array
|
|
273988
|
-
: max <= Number.MAX_SAFE_INTEGER
|
|
273989
|
-
? ZeroArray
|
|
273990
|
-
: null;
|
|
273991
|
-
/* c8 ignore stop */
|
|
273992
|
-
class ZeroArray extends Array {
|
|
273993
|
-
constructor(size) {
|
|
273994
|
-
super(size);
|
|
273995
|
-
this.fill(0);
|
|
273996
|
-
}
|
|
273997
|
-
}
|
|
273998
|
-
class Stack {
|
|
273999
|
-
heap;
|
|
274000
|
-
length;
|
|
274001
|
-
// private constructor
|
|
274002
|
-
static #constructing = false;
|
|
274003
|
-
static create(max) {
|
|
274004
|
-
const HeapCls = getUintArray(max);
|
|
274005
|
-
if (!HeapCls)
|
|
274006
|
-
return [];
|
|
274007
|
-
Stack.#constructing = true;
|
|
274008
|
-
const s = new Stack(max, HeapCls);
|
|
274009
|
-
Stack.#constructing = false;
|
|
274010
|
-
return s;
|
|
274011
|
-
}
|
|
274012
|
-
constructor(max, HeapCls) {
|
|
274013
|
-
/* c8 ignore start */
|
|
274014
|
-
if (!Stack.#constructing) {
|
|
274015
|
-
throw new TypeError('instantiate Stack using Stack.create(n)');
|
|
274016
|
-
}
|
|
274017
|
-
/* c8 ignore stop */
|
|
274018
|
-
this.heap = new HeapCls(max);
|
|
274019
|
-
this.length = 0;
|
|
274020
|
-
}
|
|
274021
|
-
push(n) {
|
|
274022
|
-
this.heap[this.length++] = n;
|
|
274023
|
-
}
|
|
274024
|
-
pop() {
|
|
274025
|
-
return this.heap[--this.length];
|
|
274026
|
-
}
|
|
274027
|
-
}
|
|
274028
|
-
/**
|
|
274029
|
-
* Default export, the thing you're using this module to get.
|
|
274030
|
-
*
|
|
274031
|
-
* All properties from the options object (with the exception of
|
|
274032
|
-
* {@link OptionsBase.max} and {@link OptionsBase.maxSize}) are added as
|
|
274033
|
-
* normal public members. (`max` and `maxBase` are read-only getters.)
|
|
274034
|
-
* Changing any of these will alter the defaults for subsequent method calls,
|
|
274035
|
-
* but is otherwise safe.
|
|
274036
|
-
*/
|
|
274037
|
-
class LRUCache {
|
|
274038
|
-
// properties coming in from the options of these, only max and maxSize
|
|
274039
|
-
// really *need* to be protected. The rest can be modified, as they just
|
|
274040
|
-
// set defaults for various methods.
|
|
274041
|
-
#max;
|
|
274042
|
-
#maxSize;
|
|
274043
|
-
#dispose;
|
|
274044
|
-
#disposeAfter;
|
|
274045
|
-
#fetchMethod;
|
|
274046
|
-
/**
|
|
274047
|
-
* {@link LRUCache.OptionsBase.ttl}
|
|
274048
|
-
*/
|
|
274049
|
-
ttl;
|
|
274050
|
-
/**
|
|
274051
|
-
* {@link LRUCache.OptionsBase.ttlResolution}
|
|
274052
|
-
*/
|
|
274053
|
-
ttlResolution;
|
|
274054
|
-
/**
|
|
274055
|
-
* {@link LRUCache.OptionsBase.ttlAutopurge}
|
|
274056
|
-
*/
|
|
274057
|
-
ttlAutopurge;
|
|
274058
|
-
/**
|
|
274059
|
-
* {@link LRUCache.OptionsBase.updateAgeOnGet}
|
|
274060
|
-
*/
|
|
274061
|
-
updateAgeOnGet;
|
|
274062
|
-
/**
|
|
274063
|
-
* {@link LRUCache.OptionsBase.updateAgeOnHas}
|
|
274064
|
-
*/
|
|
274065
|
-
updateAgeOnHas;
|
|
274066
|
-
/**
|
|
274067
|
-
* {@link LRUCache.OptionsBase.allowStale}
|
|
274068
|
-
*/
|
|
274069
|
-
allowStale;
|
|
274070
|
-
/**
|
|
274071
|
-
* {@link LRUCache.OptionsBase.noDisposeOnSet}
|
|
274072
|
-
*/
|
|
274073
|
-
noDisposeOnSet;
|
|
274074
|
-
/**
|
|
274075
|
-
* {@link LRUCache.OptionsBase.noUpdateTTL}
|
|
274076
|
-
*/
|
|
274077
|
-
noUpdateTTL;
|
|
274078
|
-
/**
|
|
274079
|
-
* {@link LRUCache.OptionsBase.maxEntrySize}
|
|
274080
|
-
*/
|
|
274081
|
-
maxEntrySize;
|
|
274082
|
-
/**
|
|
274083
|
-
* {@link LRUCache.OptionsBase.sizeCalculation}
|
|
274084
|
-
*/
|
|
274085
|
-
sizeCalculation;
|
|
274086
|
-
/**
|
|
274087
|
-
* {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
|
|
274088
|
-
*/
|
|
274089
|
-
noDeleteOnFetchRejection;
|
|
274090
|
-
/**
|
|
274091
|
-
* {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
|
|
274092
|
-
*/
|
|
274093
|
-
noDeleteOnStaleGet;
|
|
274094
|
-
/**
|
|
274095
|
-
* {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
|
|
274096
|
-
*/
|
|
274097
|
-
allowStaleOnFetchAbort;
|
|
274098
|
-
/**
|
|
274099
|
-
* {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
|
|
274100
|
-
*/
|
|
274101
|
-
allowStaleOnFetchRejection;
|
|
274102
|
-
/**
|
|
274103
|
-
* {@link LRUCache.OptionsBase.ignoreFetchAbort}
|
|
274104
|
-
*/
|
|
274105
|
-
ignoreFetchAbort;
|
|
274106
|
-
// computed properties
|
|
274107
|
-
#size;
|
|
274108
|
-
#calculatedSize;
|
|
274109
|
-
#keyMap;
|
|
274110
|
-
#keyList;
|
|
274111
|
-
#valList;
|
|
274112
|
-
#next;
|
|
274113
|
-
#prev;
|
|
274114
|
-
#head;
|
|
274115
|
-
#tail;
|
|
274116
|
-
#free;
|
|
274117
|
-
#disposed;
|
|
274118
|
-
#sizes;
|
|
274119
|
-
#starts;
|
|
274120
|
-
#ttls;
|
|
274121
|
-
#hasDispose;
|
|
274122
|
-
#hasFetchMethod;
|
|
274123
|
-
#hasDisposeAfter;
|
|
274124
|
-
/**
|
|
274125
|
-
* Do not call this method unless you need to inspect the
|
|
274126
|
-
* inner workings of the cache. If anything returned by this
|
|
274127
|
-
* object is modified in any way, strange breakage may occur.
|
|
274128
|
-
*
|
|
274129
|
-
* These fields are private for a reason!
|
|
274130
|
-
*
|
|
274131
|
-
* @internal
|
|
274132
|
-
*/
|
|
274133
|
-
static unsafeExposeInternals(c) {
|
|
274134
|
-
return {
|
|
274135
|
-
// properties
|
|
274136
|
-
starts: c.#starts,
|
|
274137
|
-
ttls: c.#ttls,
|
|
274138
|
-
sizes: c.#sizes,
|
|
274139
|
-
keyMap: c.#keyMap,
|
|
274140
|
-
keyList: c.#keyList,
|
|
274141
|
-
valList: c.#valList,
|
|
274142
|
-
next: c.#next,
|
|
274143
|
-
prev: c.#prev,
|
|
274144
|
-
get head() {
|
|
274145
|
-
return c.#head;
|
|
274146
|
-
},
|
|
274147
|
-
get tail() {
|
|
274148
|
-
return c.#tail;
|
|
274149
|
-
},
|
|
274150
|
-
free: c.#free,
|
|
274151
|
-
// methods
|
|
274152
|
-
isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
|
|
274153
|
-
backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
|
|
274154
|
-
moveToTail: (index) => c.#moveToTail(index),
|
|
274155
|
-
indexes: (options) => c.#indexes(options),
|
|
274156
|
-
rindexes: (options) => c.#rindexes(options),
|
|
274157
|
-
isStale: (index) => c.#isStale(index),
|
|
274158
|
-
};
|
|
274159
|
-
}
|
|
274160
|
-
// Protected read-only members
|
|
274161
|
-
/**
|
|
274162
|
-
* {@link LRUCache.OptionsBase.max} (read-only)
|
|
274163
|
-
*/
|
|
274164
|
-
get max() {
|
|
274165
|
-
return this.#max;
|
|
274166
|
-
}
|
|
274167
|
-
/**
|
|
274168
|
-
* {@link LRUCache.OptionsBase.maxSize} (read-only)
|
|
274169
|
-
*/
|
|
274170
|
-
get maxSize() {
|
|
274171
|
-
return this.#maxSize;
|
|
274172
|
-
}
|
|
274173
|
-
/**
|
|
274174
|
-
* The total computed size of items in the cache (read-only)
|
|
274175
|
-
*/
|
|
274176
|
-
get calculatedSize() {
|
|
274177
|
-
return this.#calculatedSize;
|
|
274178
|
-
}
|
|
274179
|
-
/**
|
|
274180
|
-
* The number of items stored in the cache (read-only)
|
|
274181
|
-
*/
|
|
274182
|
-
get size() {
|
|
274183
|
-
return this.#size;
|
|
274184
|
-
}
|
|
274185
|
-
/**
|
|
274186
|
-
* {@link LRUCache.OptionsBase.fetchMethod} (read-only)
|
|
274187
|
-
*/
|
|
274188
|
-
get fetchMethod() {
|
|
274189
|
-
return this.#fetchMethod;
|
|
274190
|
-
}
|
|
274191
|
-
/**
|
|
274192
|
-
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
|
274193
|
-
*/
|
|
274194
|
-
get dispose() {
|
|
274195
|
-
return this.#dispose;
|
|
274196
|
-
}
|
|
274197
|
-
/**
|
|
274198
|
-
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
274199
|
-
*/
|
|
274200
|
-
get disposeAfter() {
|
|
274201
|
-
return this.#disposeAfter;
|
|
274202
|
-
}
|
|
274203
|
-
constructor(options) {
|
|
274204
|
-
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, } = options;
|
|
274205
|
-
if (max !== 0 && !isPosInt(max)) {
|
|
274206
|
-
throw new TypeError('max option must be a nonnegative integer');
|
|
274207
|
-
}
|
|
274208
|
-
const UintArray = max ? getUintArray(max) : Array;
|
|
274209
|
-
if (!UintArray) {
|
|
274210
|
-
throw new Error('invalid max value: ' + max);
|
|
274211
|
-
}
|
|
274212
|
-
this.#max = max;
|
|
274213
|
-
this.#maxSize = maxSize;
|
|
274214
|
-
this.maxEntrySize = maxEntrySize || this.#maxSize;
|
|
274215
|
-
this.sizeCalculation = sizeCalculation;
|
|
274216
|
-
if (this.sizeCalculation) {
|
|
274217
|
-
if (!this.#maxSize && !this.maxEntrySize) {
|
|
274218
|
-
throw new TypeError('cannot set sizeCalculation without setting maxSize or maxEntrySize');
|
|
274219
|
-
}
|
|
274220
|
-
if (typeof this.sizeCalculation !== 'function') {
|
|
274221
|
-
throw new TypeError('sizeCalculation set to non-function');
|
|
274222
|
-
}
|
|
274223
|
-
}
|
|
274224
|
-
if (fetchMethod !== undefined &&
|
|
274225
|
-
typeof fetchMethod !== 'function') {
|
|
274226
|
-
throw new TypeError('fetchMethod must be a function if specified');
|
|
274227
|
-
}
|
|
274228
|
-
this.#fetchMethod = fetchMethod;
|
|
274229
|
-
this.#hasFetchMethod = !!fetchMethod;
|
|
274230
|
-
this.#keyMap = new Map();
|
|
274231
|
-
this.#keyList = new Array(max).fill(undefined);
|
|
274232
|
-
this.#valList = new Array(max).fill(undefined);
|
|
274233
|
-
this.#next = new UintArray(max);
|
|
274234
|
-
this.#prev = new UintArray(max);
|
|
274235
|
-
this.#head = 0;
|
|
274236
|
-
this.#tail = 0;
|
|
274237
|
-
this.#free = Stack.create(max);
|
|
274238
|
-
this.#size = 0;
|
|
274239
|
-
this.#calculatedSize = 0;
|
|
274240
|
-
if (typeof dispose === 'function') {
|
|
274241
|
-
this.#dispose = dispose;
|
|
274242
|
-
}
|
|
274243
|
-
if (typeof disposeAfter === 'function') {
|
|
274244
|
-
this.#disposeAfter = disposeAfter;
|
|
274245
|
-
this.#disposed = [];
|
|
274246
|
-
}
|
|
274247
|
-
else {
|
|
274248
|
-
this.#disposeAfter = undefined;
|
|
274249
|
-
this.#disposed = undefined;
|
|
274250
|
-
}
|
|
274251
|
-
this.#hasDispose = !!this.#dispose;
|
|
274252
|
-
this.#hasDisposeAfter = !!this.#disposeAfter;
|
|
274253
|
-
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
274254
|
-
this.noUpdateTTL = !!noUpdateTTL;
|
|
274255
|
-
this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
|
|
274256
|
-
this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
|
|
274257
|
-
this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
|
|
274258
|
-
this.ignoreFetchAbort = !!ignoreFetchAbort;
|
|
274259
|
-
// NB: maxEntrySize is set to maxSize if it's set
|
|
274260
|
-
if (this.maxEntrySize !== 0) {
|
|
274261
|
-
if (this.#maxSize !== 0) {
|
|
274262
|
-
if (!isPosInt(this.#maxSize)) {
|
|
274263
|
-
throw new TypeError('maxSize must be a positive integer if specified');
|
|
274264
|
-
}
|
|
274265
|
-
}
|
|
274266
|
-
if (!isPosInt(this.maxEntrySize)) {
|
|
274267
|
-
throw new TypeError('maxEntrySize must be a positive integer if specified');
|
|
274268
|
-
}
|
|
274269
|
-
this.#initializeSizeTracking();
|
|
274270
|
-
}
|
|
274271
|
-
this.allowStale = !!allowStale;
|
|
274272
|
-
this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
|
|
274273
|
-
this.updateAgeOnGet = !!updateAgeOnGet;
|
|
274274
|
-
this.updateAgeOnHas = !!updateAgeOnHas;
|
|
274275
|
-
this.ttlResolution =
|
|
274276
|
-
isPosInt(ttlResolution) || ttlResolution === 0
|
|
274277
|
-
? ttlResolution
|
|
274278
|
-
: 1;
|
|
274279
|
-
this.ttlAutopurge = !!ttlAutopurge;
|
|
274280
|
-
this.ttl = ttl || 0;
|
|
274281
|
-
if (this.ttl) {
|
|
274282
|
-
if (!isPosInt(this.ttl)) {
|
|
274283
|
-
throw new TypeError('ttl must be a positive integer if specified');
|
|
274284
|
-
}
|
|
274285
|
-
this.#initializeTTLTracking();
|
|
274286
|
-
}
|
|
274287
|
-
// do not allow completely unbounded caches
|
|
274288
|
-
if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
|
|
274289
|
-
throw new TypeError('At least one of max, maxSize, or ttl is required');
|
|
274290
|
-
}
|
|
274291
|
-
if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
|
|
274292
|
-
const code = 'LRU_CACHE_UNBOUNDED';
|
|
274293
|
-
if (shouldWarn(code)) {
|
|
274294
|
-
warned.add(code);
|
|
274295
|
-
const msg = 'TTL caching without ttlAutopurge, max, or maxSize can ' +
|
|
274296
|
-
'result in unbounded memory consumption.';
|
|
274297
|
-
emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache);
|
|
274298
|
-
}
|
|
274299
|
-
}
|
|
274300
|
-
}
|
|
274301
|
-
/**
|
|
274302
|
-
* Return the remaining TTL time for a given entry key
|
|
274303
|
-
*/
|
|
274304
|
-
getRemainingTTL(key) {
|
|
274305
|
-
return this.#keyMap.has(key) ? Infinity : 0;
|
|
274306
|
-
}
|
|
274307
|
-
#initializeTTLTracking() {
|
|
274308
|
-
const ttls = new ZeroArray(this.#max);
|
|
274309
|
-
const starts = new ZeroArray(this.#max);
|
|
274310
|
-
this.#ttls = ttls;
|
|
274311
|
-
this.#starts = starts;
|
|
274312
|
-
this.#setItemTTL = (index, ttl, start = perf.now()) => {
|
|
274313
|
-
starts[index] = ttl !== 0 ? start : 0;
|
|
274314
|
-
ttls[index] = ttl;
|
|
274315
|
-
if (ttl !== 0 && this.ttlAutopurge) {
|
|
274316
|
-
const t = setTimeout(() => {
|
|
274317
|
-
if (this.#isStale(index)) {
|
|
274318
|
-
this.delete(this.#keyList[index]);
|
|
274319
|
-
}
|
|
274320
|
-
}, ttl + 1);
|
|
274321
|
-
// unref() not supported on all platforms
|
|
274322
|
-
/* c8 ignore start */
|
|
274323
|
-
if (t.unref) {
|
|
274324
|
-
t.unref();
|
|
274325
|
-
}
|
|
274326
|
-
/* c8 ignore stop */
|
|
274327
|
-
}
|
|
274328
|
-
};
|
|
274329
|
-
this.#updateItemAge = index => {
|
|
274330
|
-
starts[index] = ttls[index] !== 0 ? perf.now() : 0;
|
|
274331
|
-
};
|
|
274332
|
-
this.#statusTTL = (status, index) => {
|
|
274333
|
-
if (ttls[index]) {
|
|
274334
|
-
const ttl = ttls[index];
|
|
274335
|
-
const start = starts[index];
|
|
274336
|
-
status.ttl = ttl;
|
|
274337
|
-
status.start = start;
|
|
274338
|
-
status.now = cachedNow || getNow();
|
|
274339
|
-
status.remainingTTL = status.now + ttl - start;
|
|
274340
|
-
}
|
|
274341
|
-
};
|
|
274342
|
-
// debounce calls to perf.now() to 1s so we're not hitting
|
|
274343
|
-
// that costly call repeatedly.
|
|
274344
|
-
let cachedNow = 0;
|
|
274345
|
-
const getNow = () => {
|
|
274346
|
-
const n = perf.now();
|
|
274347
|
-
if (this.ttlResolution > 0) {
|
|
274348
|
-
cachedNow = n;
|
|
274349
|
-
const t = setTimeout(() => (cachedNow = 0), this.ttlResolution);
|
|
274350
|
-
// not available on all platforms
|
|
274351
|
-
/* c8 ignore start */
|
|
274352
|
-
if (t.unref) {
|
|
274353
|
-
t.unref();
|
|
274354
|
-
}
|
|
274355
|
-
/* c8 ignore stop */
|
|
274356
|
-
}
|
|
274357
|
-
return n;
|
|
274358
|
-
};
|
|
274359
|
-
this.getRemainingTTL = key => {
|
|
274360
|
-
const index = this.#keyMap.get(key);
|
|
274361
|
-
if (index === undefined) {
|
|
274362
|
-
return 0;
|
|
274363
|
-
}
|
|
274364
|
-
return ttls[index] === 0 || starts[index] === 0
|
|
274365
|
-
? Infinity
|
|
274366
|
-
: starts[index] + ttls[index] - (cachedNow || getNow());
|
|
274367
|
-
};
|
|
274368
|
-
this.#isStale = index => {
|
|
274369
|
-
return (ttls[index] !== 0 &&
|
|
274370
|
-
starts[index] !== 0 &&
|
|
274371
|
-
(cachedNow || getNow()) - starts[index] > ttls[index]);
|
|
274372
|
-
};
|
|
274373
|
-
}
|
|
274374
|
-
// conditionally set private methods related to TTL
|
|
274375
|
-
#updateItemAge = () => { };
|
|
274376
|
-
#statusTTL = () => { };
|
|
274377
|
-
#setItemTTL = () => { };
|
|
274378
|
-
/* c8 ignore stop */
|
|
274379
|
-
#isStale = () => false;
|
|
274380
|
-
#initializeSizeTracking() {
|
|
274381
|
-
const sizes = new ZeroArray(this.#max);
|
|
274382
|
-
this.#calculatedSize = 0;
|
|
274383
|
-
this.#sizes = sizes;
|
|
274384
|
-
this.#removeItemSize = index => {
|
|
274385
|
-
this.#calculatedSize -= sizes[index];
|
|
274386
|
-
sizes[index] = 0;
|
|
274387
|
-
};
|
|
274388
|
-
this.#requireSize = (k, v, size, sizeCalculation) => {
|
|
274389
|
-
// provisionally accept background fetches.
|
|
274390
|
-
// actual value size will be checked when they return.
|
|
274391
|
-
if (this.#isBackgroundFetch(v)) {
|
|
274392
|
-
return 0;
|
|
274393
|
-
}
|
|
274394
|
-
if (!isPosInt(size)) {
|
|
274395
|
-
if (sizeCalculation) {
|
|
274396
|
-
if (typeof sizeCalculation !== 'function') {
|
|
274397
|
-
throw new TypeError('sizeCalculation must be a function');
|
|
274398
|
-
}
|
|
274399
|
-
size = sizeCalculation(v, k);
|
|
274400
|
-
if (!isPosInt(size)) {
|
|
274401
|
-
throw new TypeError('sizeCalculation return invalid (expect positive integer)');
|
|
274402
|
-
}
|
|
274403
|
-
}
|
|
274404
|
-
else {
|
|
274405
|
-
throw new TypeError('invalid size value (must be positive integer). ' +
|
|
274406
|
-
'When maxSize or maxEntrySize is used, sizeCalculation ' +
|
|
274407
|
-
'or size must be set.');
|
|
274408
|
-
}
|
|
274409
|
-
}
|
|
274410
|
-
return size;
|
|
274411
|
-
};
|
|
274412
|
-
this.#addItemSize = (index, size, status) => {
|
|
274413
|
-
sizes[index] = size;
|
|
274414
|
-
if (this.#maxSize) {
|
|
274415
|
-
const maxSize = this.#maxSize - sizes[index];
|
|
274416
|
-
while (this.#calculatedSize > maxSize) {
|
|
274417
|
-
this.#evict(true);
|
|
274418
|
-
}
|
|
274419
|
-
}
|
|
274420
|
-
this.#calculatedSize += sizes[index];
|
|
274421
|
-
if (status) {
|
|
274422
|
-
status.entrySize = size;
|
|
274423
|
-
status.totalCalculatedSize = this.#calculatedSize;
|
|
274424
|
-
}
|
|
274425
|
-
};
|
|
274426
|
-
}
|
|
274427
|
-
#removeItemSize = _i => { };
|
|
274428
|
-
#addItemSize = (_i, _s, _st) => { };
|
|
274429
|
-
#requireSize = (_k, _v, size, sizeCalculation) => {
|
|
274430
|
-
if (size || sizeCalculation) {
|
|
274431
|
-
throw new TypeError('cannot set size without setting maxSize or maxEntrySize on cache');
|
|
274432
|
-
}
|
|
274433
|
-
return 0;
|
|
273961
|
+
var denque = Denque;var lib$4 = {};Object.defineProperty(lib$4, "__esModule", { value: true });
|
|
273962
|
+
lib$4.createLRU = void 0;
|
|
273963
|
+
const createLRU$2 = (options) => {
|
|
273964
|
+
let { max, onEviction } = options;
|
|
273965
|
+
if (!(Number.isInteger(max) && max > 0))
|
|
273966
|
+
throw new TypeError('`max` must be a positive integer');
|
|
273967
|
+
let size = 0;
|
|
273968
|
+
let head = 0;
|
|
273969
|
+
let tail = 0;
|
|
273970
|
+
let free = [];
|
|
273971
|
+
const keyMap = new Map();
|
|
273972
|
+
const keyList = new Array(max).fill(undefined);
|
|
273973
|
+
const valList = new Array(max).fill(undefined);
|
|
273974
|
+
const next = new Array(max).fill(0);
|
|
273975
|
+
const prev = new Array(max).fill(0);
|
|
273976
|
+
const setTail = (index, type) => {
|
|
273977
|
+
if (index === tail)
|
|
273978
|
+
return;
|
|
273979
|
+
const nextIndex = next[index];
|
|
273980
|
+
const prevIndex = prev[index];
|
|
273981
|
+
if (index === head)
|
|
273982
|
+
head = nextIndex;
|
|
273983
|
+
else if (type === 'get' || prevIndex !== 0)
|
|
273984
|
+
next[prevIndex] = nextIndex;
|
|
273985
|
+
if (nextIndex !== 0)
|
|
273986
|
+
prev[nextIndex] = prevIndex;
|
|
273987
|
+
next[tail] = index;
|
|
273988
|
+
prev[index] = tail;
|
|
273989
|
+
next[index] = 0;
|
|
273990
|
+
tail = index;
|
|
274434
273991
|
};
|
|
274435
|
-
|
|
274436
|
-
|
|
274437
|
-
|
|
274438
|
-
|
|
274439
|
-
|
|
274440
|
-
|
|
274441
|
-
|
|
274442
|
-
|
|
274443
|
-
|
|
274444
|
-
|
|
274445
|
-
|
|
274446
|
-
|
|
274447
|
-
|
|
274448
|
-
|
|
274449
|
-
|
|
274450
|
-
|
|
274451
|
-
|
|
274452
|
-
|
|
274453
|
-
|
|
274454
|
-
|
|
274455
|
-
|
|
274456
|
-
|
|
274457
|
-
|
|
274458
|
-
|
|
274459
|
-
|
|
274460
|
-
|
|
274461
|
-
|
|
274462
|
-
if (i === this.#tail) {
|
|
274463
|
-
break;
|
|
274464
|
-
}
|
|
274465
|
-
else {
|
|
274466
|
-
i = this.#next[i];
|
|
274467
|
-
}
|
|
274468
|
-
}
|
|
274469
|
-
}
|
|
274470
|
-
}
|
|
274471
|
-
#isValidIndex(index) {
|
|
274472
|
-
return (index !== undefined &&
|
|
274473
|
-
this.#keyMap.get(this.#keyList[index]) === index);
|
|
274474
|
-
}
|
|
274475
|
-
/**
|
|
274476
|
-
* Return a generator yielding `[key, value]` pairs,
|
|
274477
|
-
* in order from most recently used to least recently used.
|
|
274478
|
-
*/
|
|
274479
|
-
*entries() {
|
|
274480
|
-
for (const i of this.#indexes()) {
|
|
274481
|
-
if (this.#valList[i] !== undefined &&
|
|
274482
|
-
this.#keyList[i] !== undefined &&
|
|
274483
|
-
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
274484
|
-
yield [this.#keyList[i], this.#valList[i]];
|
|
274485
|
-
}
|
|
274486
|
-
}
|
|
274487
|
-
}
|
|
274488
|
-
/**
|
|
274489
|
-
* Inverse order version of {@link LRUCache.entries}
|
|
274490
|
-
*
|
|
274491
|
-
* Return a generator yielding `[key, value]` pairs,
|
|
274492
|
-
* in order from least recently used to most recently used.
|
|
274493
|
-
*/
|
|
274494
|
-
*rentries() {
|
|
274495
|
-
for (const i of this.#rindexes()) {
|
|
274496
|
-
if (this.#valList[i] !== undefined &&
|
|
274497
|
-
this.#keyList[i] !== undefined &&
|
|
274498
|
-
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
274499
|
-
yield [this.#keyList[i], this.#valList[i]];
|
|
274500
|
-
}
|
|
274501
|
-
}
|
|
274502
|
-
}
|
|
274503
|
-
/**
|
|
274504
|
-
* Return a generator yielding the keys in the cache,
|
|
274505
|
-
* in order from most recently used to least recently used.
|
|
274506
|
-
*/
|
|
274507
|
-
*keys() {
|
|
274508
|
-
for (const i of this.#indexes()) {
|
|
274509
|
-
const k = this.#keyList[i];
|
|
274510
|
-
if (k !== undefined &&
|
|
274511
|
-
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
274512
|
-
yield k;
|
|
274513
|
-
}
|
|
274514
|
-
}
|
|
274515
|
-
}
|
|
274516
|
-
/**
|
|
274517
|
-
* Inverse order version of {@link LRUCache.keys}
|
|
274518
|
-
*
|
|
274519
|
-
* Return a generator yielding the keys in the cache,
|
|
274520
|
-
* in order from least recently used to most recently used.
|
|
274521
|
-
*/
|
|
274522
|
-
*rkeys() {
|
|
274523
|
-
for (const i of this.#rindexes()) {
|
|
274524
|
-
const k = this.#keyList[i];
|
|
274525
|
-
if (k !== undefined &&
|
|
274526
|
-
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
274527
|
-
yield k;
|
|
274528
|
-
}
|
|
274529
|
-
}
|
|
274530
|
-
}
|
|
274531
|
-
/**
|
|
274532
|
-
* Return a generator yielding the values in the cache,
|
|
274533
|
-
* in order from most recently used to least recently used.
|
|
274534
|
-
*/
|
|
274535
|
-
*values() {
|
|
274536
|
-
for (const i of this.#indexes()) {
|
|
274537
|
-
const v = this.#valList[i];
|
|
274538
|
-
if (v !== undefined &&
|
|
274539
|
-
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
274540
|
-
yield this.#valList[i];
|
|
274541
|
-
}
|
|
274542
|
-
}
|
|
274543
|
-
}
|
|
274544
|
-
/**
|
|
274545
|
-
* Inverse order version of {@link LRUCache.values}
|
|
274546
|
-
*
|
|
274547
|
-
* Return a generator yielding the values in the cache,
|
|
274548
|
-
* in order from least recently used to most recently used.
|
|
274549
|
-
*/
|
|
274550
|
-
*rvalues() {
|
|
274551
|
-
for (const i of this.#rindexes()) {
|
|
274552
|
-
const v = this.#valList[i];
|
|
274553
|
-
if (v !== undefined &&
|
|
274554
|
-
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
274555
|
-
yield this.#valList[i];
|
|
274556
|
-
}
|
|
274557
|
-
}
|
|
274558
|
-
}
|
|
274559
|
-
/**
|
|
274560
|
-
* Iterating over the cache itself yields the same results as
|
|
274561
|
-
* {@link LRUCache.entries}
|
|
274562
|
-
*/
|
|
274563
|
-
[Symbol.iterator]() {
|
|
274564
|
-
return this.entries();
|
|
274565
|
-
}
|
|
274566
|
-
/**
|
|
274567
|
-
* Find a value for which the supplied fn method returns a truthy value,
|
|
274568
|
-
* similar to Array.find(). fn is called as fn(value, key, cache).
|
|
274569
|
-
*/
|
|
274570
|
-
find(fn, getOptions = {}) {
|
|
274571
|
-
for (const i of this.#indexes()) {
|
|
274572
|
-
const v = this.#valList[i];
|
|
274573
|
-
const value = this.#isBackgroundFetch(v)
|
|
274574
|
-
? v.__staleWhileFetching
|
|
274575
|
-
: v;
|
|
274576
|
-
if (value === undefined)
|
|
274577
|
-
continue;
|
|
274578
|
-
if (fn(value, this.#keyList[i], this)) {
|
|
274579
|
-
return this.get(this.#keyList[i], getOptions);
|
|
274580
|
-
}
|
|
274581
|
-
}
|
|
274582
|
-
}
|
|
274583
|
-
/**
|
|
274584
|
-
* Call the supplied function on each item in the cache, in order from
|
|
274585
|
-
* most recently used to least recently used. fn is called as
|
|
274586
|
-
* fn(value, key, cache). Does not update age or recenty of use.
|
|
274587
|
-
* Does not iterate over stale values.
|
|
274588
|
-
*/
|
|
274589
|
-
forEach(fn, thisp = this) {
|
|
274590
|
-
for (const i of this.#indexes()) {
|
|
274591
|
-
const v = this.#valList[i];
|
|
274592
|
-
const value = this.#isBackgroundFetch(v)
|
|
274593
|
-
? v.__staleWhileFetching
|
|
274594
|
-
: v;
|
|
274595
|
-
if (value === undefined)
|
|
274596
|
-
continue;
|
|
274597
|
-
fn.call(thisp, value, this.#keyList[i], this);
|
|
274598
|
-
}
|
|
274599
|
-
}
|
|
274600
|
-
/**
|
|
274601
|
-
* The same as {@link LRUCache.forEach} but items are iterated over in
|
|
274602
|
-
* reverse order. (ie, less recently used items are iterated over first.)
|
|
274603
|
-
*/
|
|
274604
|
-
rforEach(fn, thisp = this) {
|
|
274605
|
-
for (const i of this.#rindexes()) {
|
|
274606
|
-
const v = this.#valList[i];
|
|
274607
|
-
const value = this.#isBackgroundFetch(v)
|
|
274608
|
-
? v.__staleWhileFetching
|
|
274609
|
-
: v;
|
|
274610
|
-
if (value === undefined)
|
|
274611
|
-
continue;
|
|
274612
|
-
fn.call(thisp, value, this.#keyList[i], this);
|
|
274613
|
-
}
|
|
274614
|
-
}
|
|
274615
|
-
/**
|
|
274616
|
-
* Delete any stale entries. Returns true if anything was removed,
|
|
274617
|
-
* false otherwise.
|
|
274618
|
-
*/
|
|
274619
|
-
purgeStale() {
|
|
274620
|
-
let deleted = false;
|
|
274621
|
-
for (const i of this.#rindexes({ allowStale: true })) {
|
|
274622
|
-
if (this.#isStale(i)) {
|
|
274623
|
-
this.delete(this.#keyList[i]);
|
|
274624
|
-
deleted = true;
|
|
274625
|
-
}
|
|
274626
|
-
}
|
|
274627
|
-
return deleted;
|
|
274628
|
-
}
|
|
274629
|
-
/**
|
|
274630
|
-
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
274631
|
-
* passed to cache.load()
|
|
274632
|
-
*/
|
|
274633
|
-
dump() {
|
|
274634
|
-
const arr = [];
|
|
274635
|
-
for (const i of this.#indexes({ allowStale: true })) {
|
|
274636
|
-
const key = this.#keyList[i];
|
|
274637
|
-
const v = this.#valList[i];
|
|
274638
|
-
const value = this.#isBackgroundFetch(v)
|
|
274639
|
-
? v.__staleWhileFetching
|
|
274640
|
-
: v;
|
|
274641
|
-
if (value === undefined || key === undefined)
|
|
274642
|
-
continue;
|
|
274643
|
-
const entry = { value };
|
|
274644
|
-
if (this.#ttls && this.#starts) {
|
|
274645
|
-
entry.ttl = this.#ttls[i];
|
|
274646
|
-
// always dump the start relative to a portable timestamp
|
|
274647
|
-
// it's ok for this to be a bit slow, it's a rare operation.
|
|
274648
|
-
const age = perf.now() - this.#starts[i];
|
|
274649
|
-
entry.start = Math.floor(Date.now() - age);
|
|
274650
|
-
}
|
|
274651
|
-
if (this.#sizes) {
|
|
274652
|
-
entry.size = this.#sizes[i];
|
|
274653
|
-
}
|
|
274654
|
-
arr.unshift([key, entry]);
|
|
274655
|
-
}
|
|
274656
|
-
return arr;
|
|
274657
|
-
}
|
|
274658
|
-
/**
|
|
274659
|
-
* Reset the cache and load in the items in entries in the order listed.
|
|
274660
|
-
* Note that the shape of the resulting cache may be different if the
|
|
274661
|
-
* same options are not used in both caches.
|
|
274662
|
-
*/
|
|
274663
|
-
load(arr) {
|
|
274664
|
-
this.clear();
|
|
274665
|
-
for (const [key, entry] of arr) {
|
|
274666
|
-
if (entry.start) {
|
|
274667
|
-
// entry.start is a portable timestamp, but we may be using
|
|
274668
|
-
// node's performance.now(), so calculate the offset, so that
|
|
274669
|
-
// we get the intended remaining TTL, no matter how long it's
|
|
274670
|
-
// been on ice.
|
|
274671
|
-
//
|
|
274672
|
-
// it's ok for this to be a bit slow, it's a rare operation.
|
|
274673
|
-
const age = Date.now() - entry.start;
|
|
274674
|
-
entry.start = perf.now() - age;
|
|
274675
|
-
}
|
|
274676
|
-
this.set(key, entry.value, entry);
|
|
274677
|
-
}
|
|
274678
|
-
}
|
|
274679
|
-
/**
|
|
274680
|
-
* Add a value to the cache.
|
|
274681
|
-
*/
|
|
274682
|
-
set(k, v, setOptions = {}) {
|
|
274683
|
-
const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status, } = setOptions;
|
|
274684
|
-
let { noUpdateTTL = this.noUpdateTTL } = setOptions;
|
|
274685
|
-
const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
|
|
274686
|
-
// if the item doesn't fit, don't do anything
|
|
274687
|
-
// NB: maxEntrySize set to maxSize by default
|
|
274688
|
-
if (this.maxEntrySize && size > this.maxEntrySize) {
|
|
274689
|
-
if (status) {
|
|
274690
|
-
status.set = 'miss';
|
|
274691
|
-
status.maxEntrySizeExceeded = true;
|
|
274692
|
-
}
|
|
274693
|
-
// have to delete, in case something is there already.
|
|
274694
|
-
this.delete(k);
|
|
274695
|
-
return this;
|
|
274696
|
-
}
|
|
274697
|
-
let index = this.#size === 0 ? undefined : this.#keyMap.get(k);
|
|
274698
|
-
if (index === undefined) {
|
|
274699
|
-
// addition
|
|
274700
|
-
index = (this.#size === 0
|
|
274701
|
-
? this.#tail
|
|
274702
|
-
: this.#free.length !== 0
|
|
274703
|
-
? this.#free.pop()
|
|
274704
|
-
: this.#size === this.#max
|
|
274705
|
-
? this.#evict(false)
|
|
274706
|
-
: this.#size);
|
|
274707
|
-
this.#keyList[index] = k;
|
|
274708
|
-
this.#valList[index] = v;
|
|
274709
|
-
this.#keyMap.set(k, index);
|
|
274710
|
-
this.#next[this.#tail] = index;
|
|
274711
|
-
this.#prev[index] = this.#tail;
|
|
274712
|
-
this.#tail = index;
|
|
274713
|
-
this.#size++;
|
|
274714
|
-
this.#addItemSize(index, size, status);
|
|
274715
|
-
if (status)
|
|
274716
|
-
status.set = 'add';
|
|
274717
|
-
noUpdateTTL = false;
|
|
274718
|
-
}
|
|
274719
|
-
else {
|
|
274720
|
-
// update
|
|
274721
|
-
this.#moveToTail(index);
|
|
274722
|
-
const oldVal = this.#valList[index];
|
|
274723
|
-
if (v !== oldVal) {
|
|
274724
|
-
if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
|
|
274725
|
-
oldVal.__abortController.abort(new Error('replaced'));
|
|
274726
|
-
}
|
|
274727
|
-
else if (!noDisposeOnSet) {
|
|
274728
|
-
if (this.#hasDispose) {
|
|
274729
|
-
this.#dispose?.(oldVal, k, 'set');
|
|
274730
|
-
}
|
|
274731
|
-
if (this.#hasDisposeAfter) {
|
|
274732
|
-
this.#disposed?.push([oldVal, k, 'set']);
|
|
274733
|
-
}
|
|
274734
|
-
}
|
|
274735
|
-
this.#removeItemSize(index);
|
|
274736
|
-
this.#addItemSize(index, size, status);
|
|
274737
|
-
this.#valList[index] = v;
|
|
274738
|
-
if (status) {
|
|
274739
|
-
status.set = 'replace';
|
|
274740
|
-
const oldValue = oldVal && this.#isBackgroundFetch(oldVal)
|
|
274741
|
-
? oldVal.__staleWhileFetching
|
|
274742
|
-
: oldVal;
|
|
274743
|
-
if (oldValue !== undefined)
|
|
274744
|
-
status.oldValue = oldValue;
|
|
274745
|
-
}
|
|
274746
|
-
}
|
|
274747
|
-
else if (status) {
|
|
274748
|
-
status.set = 'update';
|
|
274749
|
-
}
|
|
274750
|
-
}
|
|
274751
|
-
if (ttl !== 0 && !this.#ttls) {
|
|
274752
|
-
this.#initializeTTLTracking();
|
|
274753
|
-
}
|
|
274754
|
-
if (this.#ttls) {
|
|
274755
|
-
if (!noUpdateTTL) {
|
|
274756
|
-
this.#setItemTTL(index, ttl, start);
|
|
274757
|
-
}
|
|
274758
|
-
if (status)
|
|
274759
|
-
this.#statusTTL(status, index);
|
|
274760
|
-
}
|
|
274761
|
-
if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
|
|
274762
|
-
const dt = this.#disposed;
|
|
274763
|
-
let task;
|
|
274764
|
-
while ((task = dt?.shift())) {
|
|
274765
|
-
this.#disposeAfter?.(...task);
|
|
273992
|
+
const _evict = () => {
|
|
273993
|
+
const evictHead = head;
|
|
273994
|
+
const key = keyList[evictHead];
|
|
273995
|
+
onEviction === null || onEviction === void 0 ? void 0 : onEviction(key, valList[evictHead]);
|
|
273996
|
+
keyMap.delete(key);
|
|
273997
|
+
keyList[evictHead] = undefined;
|
|
273998
|
+
valList[evictHead] = undefined;
|
|
273999
|
+
head = next[evictHead];
|
|
274000
|
+
if (head !== 0)
|
|
274001
|
+
prev[head] = 0;
|
|
274002
|
+
size--;
|
|
274003
|
+
if (size === 0)
|
|
274004
|
+
head = tail = 0;
|
|
274005
|
+
free.push(evictHead);
|
|
274006
|
+
return evictHead;
|
|
274007
|
+
};
|
|
274008
|
+
return {
|
|
274009
|
+
/** Adds a key-value pair to the cache. Updates the value if the key already exists. */
|
|
274010
|
+
set(key, value) {
|
|
274011
|
+
if (key === undefined)
|
|
274012
|
+
return;
|
|
274013
|
+
let index = keyMap.get(key);
|
|
274014
|
+
if (index === undefined) {
|
|
274015
|
+
index = size === max ? _evict() : free.length > 0 ? free.pop() : size;
|
|
274016
|
+
keyMap.set(key, index);
|
|
274017
|
+
keyList[index] = key;
|
|
274018
|
+
size++;
|
|
274766
274019
|
}
|
|
274767
|
-
|
|
274768
|
-
|
|
274769
|
-
|
|
274770
|
-
|
|
274771
|
-
|
|
274772
|
-
|
|
274773
|
-
|
|
274774
|
-
|
|
274775
|
-
|
|
274776
|
-
|
|
274777
|
-
|
|
274778
|
-
|
|
274779
|
-
|
|
274780
|
-
|
|
274781
|
-
|
|
274782
|
-
|
|
274783
|
-
|
|
274784
|
-
|
|
274785
|
-
|
|
274786
|
-
|
|
274020
|
+
else
|
|
274021
|
+
onEviction === null || onEviction === void 0 ? void 0 : onEviction(key, valList[index]);
|
|
274022
|
+
valList[index] = value;
|
|
274023
|
+
if (size === 1)
|
|
274024
|
+
head = tail = index;
|
|
274025
|
+
else
|
|
274026
|
+
setTail(index, 'set');
|
|
274027
|
+
},
|
|
274028
|
+
/** Retrieves the value for a given key and moves the key to the most recent position. */
|
|
274029
|
+
get(key) {
|
|
274030
|
+
const index = keyMap.get(key);
|
|
274031
|
+
if (index === undefined)
|
|
274032
|
+
return;
|
|
274033
|
+
if (index !== tail)
|
|
274034
|
+
setTail(index, 'get');
|
|
274035
|
+
return valList[index];
|
|
274036
|
+
},
|
|
274037
|
+
/** Retrieves the value for a given key without changing its position. */
|
|
274038
|
+
peek: (key) => {
|
|
274039
|
+
const index = keyMap.get(key);
|
|
274040
|
+
return index !== undefined ? valList[index] : undefined;
|
|
274041
|
+
},
|
|
274042
|
+
/** Checks if a key exists in the cache. */
|
|
274043
|
+
has: (key) => keyMap.has(key),
|
|
274044
|
+
/** Iterates over all keys in the cache, from most recent to least recent. */
|
|
274045
|
+
*keys() {
|
|
274046
|
+
let current = tail;
|
|
274047
|
+
for (let i = 0; i < size; i++) {
|
|
274048
|
+
yield keyList[current];
|
|
274049
|
+
current = prev[current];
|
|
274787
274050
|
}
|
|
274788
|
-
}
|
|
274789
|
-
|
|
274790
|
-
|
|
274791
|
-
|
|
274792
|
-
|
|
274793
|
-
|
|
274794
|
-
|
|
274795
|
-
}
|
|
274051
|
+
},
|
|
274052
|
+
/** Iterates over all values in the cache, from most recent to least recent. */
|
|
274053
|
+
*values() {
|
|
274054
|
+
let current = tail;
|
|
274055
|
+
for (let i = 0; i < size; i++) {
|
|
274056
|
+
yield valList[current];
|
|
274057
|
+
current = prev[current];
|
|
274796
274058
|
}
|
|
274797
|
-
}
|
|
274798
|
-
|
|
274799
|
-
|
|
274800
|
-
|
|
274801
|
-
|
|
274802
|
-
|
|
274803
|
-
|
|
274804
|
-
v.__abortController.abort(new Error('evicted'));
|
|
274805
|
-
}
|
|
274806
|
-
else if (this.#hasDispose || this.#hasDisposeAfter) {
|
|
274807
|
-
if (this.#hasDispose) {
|
|
274808
|
-
this.#dispose?.(v, k, 'evict');
|
|
274059
|
+
},
|
|
274060
|
+
/** Iterates over `[key, value]` pairs in the cache, from most recent to least recent. */
|
|
274061
|
+
*entries() {
|
|
274062
|
+
let current = tail;
|
|
274063
|
+
for (let i = 0; i < size; i++) {
|
|
274064
|
+
yield [keyList[current], valList[current]];
|
|
274065
|
+
current = prev[current];
|
|
274809
274066
|
}
|
|
274810
|
-
|
|
274811
|
-
|
|
274067
|
+
},
|
|
274068
|
+
/** Iterates over each value-key pair in the cache, from most recent to least recent. */
|
|
274069
|
+
forEach: (callback) => {
|
|
274070
|
+
let current = tail;
|
|
274071
|
+
for (let i = 0; i < size; i++) {
|
|
274072
|
+
const key = keyList[current];
|
|
274073
|
+
const value = valList[current];
|
|
274074
|
+
callback(value, key);
|
|
274075
|
+
current = prev[current];
|
|
274812
274076
|
}
|
|
274813
|
-
}
|
|
274814
|
-
|
|
274815
|
-
|
|
274816
|
-
|
|
274817
|
-
|
|
274818
|
-
this.#valList[head] = undefined;
|
|
274819
|
-
this.#free.push(head);
|
|
274820
|
-
}
|
|
274821
|
-
if (this.#size === 1) {
|
|
274822
|
-
this.#head = this.#tail = 0;
|
|
274823
|
-
this.#free.length = 0;
|
|
274824
|
-
}
|
|
274825
|
-
else {
|
|
274826
|
-
this.#head = this.#next[head];
|
|
274827
|
-
}
|
|
274828
|
-
this.#keyMap.delete(k);
|
|
274829
|
-
this.#size--;
|
|
274830
|
-
return head;
|
|
274831
|
-
}
|
|
274832
|
-
/**
|
|
274833
|
-
* Check if a key is in the cache, without updating the recency of use.
|
|
274834
|
-
* Will return false if the item is stale, even though it is technically
|
|
274835
|
-
* in the cache.
|
|
274836
|
-
*
|
|
274837
|
-
* Will not update item age unless
|
|
274838
|
-
* {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
|
|
274839
|
-
*/
|
|
274840
|
-
has(k, hasOptions = {}) {
|
|
274841
|
-
const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
|
|
274842
|
-
const index = this.#keyMap.get(k);
|
|
274843
|
-
if (index !== undefined) {
|
|
274844
|
-
const v = this.#valList[index];
|
|
274845
|
-
if (this.#isBackgroundFetch(v) &&
|
|
274846
|
-
v.__staleWhileFetching === undefined) {
|
|
274077
|
+
},
|
|
274078
|
+
/** Deletes a key-value pair from the cache. */
|
|
274079
|
+
delete(key) {
|
|
274080
|
+
const index = keyMap.get(key);
|
|
274081
|
+
if (index === undefined)
|
|
274847
274082
|
return false;
|
|
274083
|
+
onEviction === null || onEviction === void 0 ? void 0 : onEviction(key, valList[index]);
|
|
274084
|
+
keyMap.delete(key);
|
|
274085
|
+
free.push(index);
|
|
274086
|
+
keyList[index] = undefined;
|
|
274087
|
+
valList[index] = undefined;
|
|
274088
|
+
const prevIndex = prev[index];
|
|
274089
|
+
const nextIndex = next[index];
|
|
274090
|
+
if (prevIndex !== 0)
|
|
274091
|
+
next[prevIndex] = nextIndex;
|
|
274092
|
+
if (nextIndex !== 0)
|
|
274093
|
+
prev[nextIndex] = prevIndex;
|
|
274094
|
+
if (index === head)
|
|
274095
|
+
head = nextIndex;
|
|
274096
|
+
if (index === tail)
|
|
274097
|
+
tail = prevIndex;
|
|
274098
|
+
size--;
|
|
274099
|
+
return true;
|
|
274100
|
+
},
|
|
274101
|
+
/** Evicts the oldest item or the specified number of the oldest items from the cache. */
|
|
274102
|
+
evict: (number) => {
|
|
274103
|
+
let toPrune = Math.min(number, size);
|
|
274104
|
+
while (toPrune > 0) {
|
|
274105
|
+
_evict();
|
|
274106
|
+
toPrune--;
|
|
274848
274107
|
}
|
|
274849
|
-
|
|
274850
|
-
|
|
274851
|
-
|
|
274852
|
-
|
|
274853
|
-
|
|
274854
|
-
|
|
274855
|
-
|
|
274856
|
-
|
|
274857
|
-
|
|
274858
|
-
|
|
274859
|
-
|
|
274860
|
-
|
|
274861
|
-
|
|
274862
|
-
|
|
274863
|
-
|
|
274864
|
-
|
|
274865
|
-
|
|
274866
|
-
|
|
274867
|
-
|
|
274868
|
-
|
|
274869
|
-
|
|
274870
|
-
|
|
274871
|
-
|
|
274872
|
-
|
|
274873
|
-
|
|
274874
|
-
|
|
274875
|
-
|
|
274876
|
-
|
|
274877
|
-
|
|
274878
|
-
|
|
274879
|
-
|
|
274880
|
-
|
|
274881
|
-
|
|
274882
|
-
|
|
274883
|
-
|
|
274884
|
-
}
|
|
274885
|
-
}
|
|
274886
|
-
#backgroundFetch(k, index, options, context) {
|
|
274887
|
-
const v = index === undefined ? undefined : this.#valList[index];
|
|
274888
|
-
if (this.#isBackgroundFetch(v)) {
|
|
274889
|
-
return v;
|
|
274890
|
-
}
|
|
274891
|
-
const ac = new AbortController();
|
|
274892
|
-
const { signal } = options;
|
|
274893
|
-
// when/if our AC signals, then stop listening to theirs.
|
|
274894
|
-
signal?.addEventListener('abort', () => ac.abort(signal.reason), {
|
|
274895
|
-
signal: ac.signal,
|
|
274896
|
-
});
|
|
274897
|
-
const fetchOpts = {
|
|
274898
|
-
signal: ac.signal,
|
|
274899
|
-
options,
|
|
274900
|
-
context,
|
|
274901
|
-
};
|
|
274902
|
-
const cb = (v, updateCache = false) => {
|
|
274903
|
-
const { aborted } = ac.signal;
|
|
274904
|
-
const ignoreAbort = options.ignoreFetchAbort && v !== undefined;
|
|
274905
|
-
if (options.status) {
|
|
274906
|
-
if (aborted && !updateCache) {
|
|
274907
|
-
options.status.fetchAborted = true;
|
|
274908
|
-
options.status.fetchError = ac.signal.reason;
|
|
274909
|
-
if (ignoreAbort)
|
|
274910
|
-
options.status.fetchAbortIgnored = true;
|
|
274911
|
-
}
|
|
274912
|
-
else {
|
|
274913
|
-
options.status.fetchResolved = true;
|
|
274914
|
-
}
|
|
274915
|
-
}
|
|
274916
|
-
if (aborted && !ignoreAbort && !updateCache) {
|
|
274917
|
-
return fetchFail(ac.signal.reason);
|
|
274918
|
-
}
|
|
274919
|
-
// either we didn't abort, and are still here, or we did, and ignored
|
|
274920
|
-
const bf = p;
|
|
274921
|
-
if (this.#valList[index] === p) {
|
|
274922
|
-
if (v === undefined) {
|
|
274923
|
-
if (bf.__staleWhileFetching) {
|
|
274924
|
-
this.#valList[index] = bf.__staleWhileFetching;
|
|
274925
|
-
}
|
|
274926
|
-
else {
|
|
274927
|
-
this.delete(k);
|
|
274928
|
-
}
|
|
274929
|
-
}
|
|
274930
|
-
else {
|
|
274931
|
-
if (options.status)
|
|
274932
|
-
options.status.fetchUpdated = true;
|
|
274933
|
-
this.set(k, v, fetchOpts.options);
|
|
274934
|
-
}
|
|
274935
|
-
}
|
|
274936
|
-
return v;
|
|
274937
|
-
};
|
|
274938
|
-
const eb = (er) => {
|
|
274939
|
-
if (options.status) {
|
|
274940
|
-
options.status.fetchRejected = true;
|
|
274941
|
-
options.status.fetchError = er;
|
|
274942
|
-
}
|
|
274943
|
-
return fetchFail(er);
|
|
274944
|
-
};
|
|
274945
|
-
const fetchFail = (er) => {
|
|
274946
|
-
const { aborted } = ac.signal;
|
|
274947
|
-
const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
|
|
274948
|
-
const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
|
|
274949
|
-
const noDelete = allowStale || options.noDeleteOnFetchRejection;
|
|
274950
|
-
const bf = p;
|
|
274951
|
-
if (this.#valList[index] === p) {
|
|
274952
|
-
// if we allow stale on fetch rejections, then we need to ensure that
|
|
274953
|
-
// the stale value is not removed from the cache when the fetch fails.
|
|
274954
|
-
const del = !noDelete || bf.__staleWhileFetching === undefined;
|
|
274955
|
-
if (del) {
|
|
274956
|
-
this.delete(k);
|
|
274957
|
-
}
|
|
274958
|
-
else if (!allowStaleAborted) {
|
|
274959
|
-
// still replace the *promise* with the stale value,
|
|
274960
|
-
// since we are done with the promise at this point.
|
|
274961
|
-
// leave it untouched if we're still waiting for an
|
|
274962
|
-
// aborted background fetch that hasn't yet returned.
|
|
274963
|
-
this.#valList[index] = bf.__staleWhileFetching;
|
|
274964
|
-
}
|
|
274965
|
-
}
|
|
274966
|
-
if (allowStale) {
|
|
274967
|
-
if (options.status && bf.__staleWhileFetching !== undefined) {
|
|
274968
|
-
options.status.returnedStale = true;
|
|
274969
|
-
}
|
|
274970
|
-
return bf.__staleWhileFetching;
|
|
274971
|
-
}
|
|
274972
|
-
else if (bf.__returned === bf) {
|
|
274973
|
-
throw er;
|
|
274974
|
-
}
|
|
274975
|
-
};
|
|
274976
|
-
const pcall = (res, rej) => {
|
|
274977
|
-
const fmp = this.#fetchMethod?.(k, v, fetchOpts);
|
|
274978
|
-
if (fmp && fmp instanceof Promise) {
|
|
274979
|
-
fmp.then(v => res(v), rej);
|
|
274980
|
-
}
|
|
274981
|
-
// ignored, we go until we finish, regardless.
|
|
274982
|
-
// defer check until we are actually aborting,
|
|
274983
|
-
// so fetchMethod can override.
|
|
274984
|
-
ac.signal.addEventListener('abort', () => {
|
|
274985
|
-
if (!options.ignoreFetchAbort ||
|
|
274986
|
-
options.allowStaleOnFetchAbort) {
|
|
274987
|
-
res();
|
|
274988
|
-
// when it eventually resolves, update the cache.
|
|
274989
|
-
if (options.allowStaleOnFetchAbort) {
|
|
274990
|
-
res = v => cb(v, true);
|
|
274991
|
-
}
|
|
274992
|
-
}
|
|
274993
|
-
});
|
|
274994
|
-
};
|
|
274995
|
-
if (options.status)
|
|
274996
|
-
options.status.fetchDispatched = true;
|
|
274997
|
-
const p = new Promise(pcall).then(cb, eb);
|
|
274998
|
-
const bf = Object.assign(p, {
|
|
274999
|
-
__abortController: ac,
|
|
275000
|
-
__staleWhileFetching: v,
|
|
275001
|
-
__returned: undefined,
|
|
275002
|
-
});
|
|
275003
|
-
if (index === undefined) {
|
|
275004
|
-
// internal, don't expose status.
|
|
275005
|
-
this.set(k, bf, { ...fetchOpts.options, status: undefined });
|
|
275006
|
-
index = this.#keyMap.get(k);
|
|
275007
|
-
}
|
|
275008
|
-
else {
|
|
275009
|
-
this.#valList[index] = bf;
|
|
275010
|
-
}
|
|
275011
|
-
return bf;
|
|
275012
|
-
}
|
|
275013
|
-
#isBackgroundFetch(p) {
|
|
275014
|
-
if (!this.#hasFetchMethod)
|
|
275015
|
-
return false;
|
|
275016
|
-
const b = p;
|
|
275017
|
-
return (!!b &&
|
|
275018
|
-
b instanceof Promise &&
|
|
275019
|
-
b.hasOwnProperty('__staleWhileFetching') &&
|
|
275020
|
-
b.__abortController instanceof AbortController);
|
|
275021
|
-
}
|
|
275022
|
-
async fetch(k, fetchOptions = {}) {
|
|
275023
|
-
const {
|
|
275024
|
-
// get options
|
|
275025
|
-
allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet,
|
|
275026
|
-
// set options
|
|
275027
|
-
ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL,
|
|
275028
|
-
// fetch exclusive options
|
|
275029
|
-
noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal, } = fetchOptions;
|
|
275030
|
-
if (!this.#hasFetchMethod) {
|
|
275031
|
-
if (status)
|
|
275032
|
-
status.fetch = 'get';
|
|
275033
|
-
return this.get(k, {
|
|
275034
|
-
allowStale,
|
|
275035
|
-
updateAgeOnGet,
|
|
275036
|
-
noDeleteOnStaleGet,
|
|
275037
|
-
status,
|
|
275038
|
-
});
|
|
275039
|
-
}
|
|
275040
|
-
const options = {
|
|
275041
|
-
allowStale,
|
|
275042
|
-
updateAgeOnGet,
|
|
275043
|
-
noDeleteOnStaleGet,
|
|
275044
|
-
ttl,
|
|
275045
|
-
noDisposeOnSet,
|
|
275046
|
-
size,
|
|
275047
|
-
sizeCalculation,
|
|
275048
|
-
noUpdateTTL,
|
|
275049
|
-
noDeleteOnFetchRejection,
|
|
275050
|
-
allowStaleOnFetchRejection,
|
|
275051
|
-
allowStaleOnFetchAbort,
|
|
275052
|
-
ignoreFetchAbort,
|
|
275053
|
-
status,
|
|
275054
|
-
signal,
|
|
275055
|
-
};
|
|
275056
|
-
let index = this.#keyMap.get(k);
|
|
275057
|
-
if (index === undefined) {
|
|
275058
|
-
if (status)
|
|
275059
|
-
status.fetch = 'miss';
|
|
275060
|
-
const p = this.#backgroundFetch(k, index, options, context);
|
|
275061
|
-
return (p.__returned = p);
|
|
275062
|
-
}
|
|
275063
|
-
else {
|
|
275064
|
-
// in cache, maybe already fetching
|
|
275065
|
-
const v = this.#valList[index];
|
|
275066
|
-
if (this.#isBackgroundFetch(v)) {
|
|
275067
|
-
const stale = allowStale && v.__staleWhileFetching !== undefined;
|
|
275068
|
-
if (status) {
|
|
275069
|
-
status.fetch = 'inflight';
|
|
275070
|
-
if (stale)
|
|
275071
|
-
status.returnedStale = true;
|
|
275072
|
-
}
|
|
275073
|
-
return stale ? v.__staleWhileFetching : (v.__returned = v);
|
|
275074
|
-
}
|
|
275075
|
-
// if we force a refresh, that means do NOT serve the cached value,
|
|
275076
|
-
// unless we are already in the process of refreshing the cache.
|
|
275077
|
-
const isStale = this.#isStale(index);
|
|
275078
|
-
if (!forceRefresh && !isStale) {
|
|
275079
|
-
if (status)
|
|
275080
|
-
status.fetch = 'hit';
|
|
275081
|
-
this.#moveToTail(index);
|
|
275082
|
-
if (updateAgeOnGet) {
|
|
275083
|
-
this.#updateItemAge(index);
|
|
275084
|
-
}
|
|
275085
|
-
if (status)
|
|
275086
|
-
this.#statusTTL(status, index);
|
|
275087
|
-
return v;
|
|
275088
|
-
}
|
|
275089
|
-
// ok, it is stale or a forced refresh, and not already fetching.
|
|
275090
|
-
// refresh the cache.
|
|
275091
|
-
const p = this.#backgroundFetch(k, index, options, context);
|
|
275092
|
-
const hasStale = p.__staleWhileFetching !== undefined;
|
|
275093
|
-
const staleVal = hasStale && allowStale;
|
|
275094
|
-
if (status) {
|
|
275095
|
-
status.fetch = isStale ? 'stale' : 'refresh';
|
|
275096
|
-
if (staleVal && isStale)
|
|
275097
|
-
status.returnedStale = true;
|
|
275098
|
-
}
|
|
275099
|
-
return staleVal ? p.__staleWhileFetching : (p.__returned = p);
|
|
275100
|
-
}
|
|
275101
|
-
}
|
|
275102
|
-
/**
|
|
275103
|
-
* Return a value from the cache. Will update the recency of the cache
|
|
275104
|
-
* entry found.
|
|
275105
|
-
*
|
|
275106
|
-
* If the key is not found, get() will return `undefined`.
|
|
275107
|
-
*/
|
|
275108
|
-
get(k, getOptions = {}) {
|
|
275109
|
-
const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status, } = getOptions;
|
|
275110
|
-
const index = this.#keyMap.get(k);
|
|
275111
|
-
if (index !== undefined) {
|
|
275112
|
-
const value = this.#valList[index];
|
|
275113
|
-
const fetching = this.#isBackgroundFetch(value);
|
|
275114
|
-
if (status)
|
|
275115
|
-
this.#statusTTL(status, index);
|
|
275116
|
-
if (this.#isStale(index)) {
|
|
275117
|
-
if (status)
|
|
275118
|
-
status.get = 'stale';
|
|
275119
|
-
// delete only if not an in-flight background fetch
|
|
275120
|
-
if (!fetching) {
|
|
275121
|
-
if (!noDeleteOnStaleGet) {
|
|
275122
|
-
this.delete(k);
|
|
275123
|
-
}
|
|
275124
|
-
if (status && allowStale)
|
|
275125
|
-
status.returnedStale = true;
|
|
275126
|
-
return allowStale ? value : undefined;
|
|
275127
|
-
}
|
|
275128
|
-
else {
|
|
275129
|
-
if (status &&
|
|
275130
|
-
allowStale &&
|
|
275131
|
-
value.__staleWhileFetching !== undefined) {
|
|
275132
|
-
status.returnedStale = true;
|
|
275133
|
-
}
|
|
275134
|
-
return allowStale ? value.__staleWhileFetching : undefined;
|
|
275135
|
-
}
|
|
275136
|
-
}
|
|
275137
|
-
else {
|
|
275138
|
-
if (status)
|
|
275139
|
-
status.get = 'hit';
|
|
275140
|
-
// if we're currently fetching it, we don't actually have it yet
|
|
275141
|
-
// it's not stale, which means this isn't a staleWhileRefetching.
|
|
275142
|
-
// If it's not stale, and fetching, AND has a __staleWhileFetching
|
|
275143
|
-
// value, then that means the user fetched with {forceRefresh:true},
|
|
275144
|
-
// so it's safe to return that value.
|
|
275145
|
-
if (fetching) {
|
|
275146
|
-
return value.__staleWhileFetching;
|
|
275147
|
-
}
|
|
275148
|
-
this.#moveToTail(index);
|
|
275149
|
-
if (updateAgeOnGet) {
|
|
275150
|
-
this.#updateItemAge(index);
|
|
275151
|
-
}
|
|
275152
|
-
return value;
|
|
275153
|
-
}
|
|
275154
|
-
}
|
|
275155
|
-
else if (status) {
|
|
275156
|
-
status.get = 'miss';
|
|
275157
|
-
}
|
|
275158
|
-
}
|
|
275159
|
-
#connect(p, n) {
|
|
275160
|
-
this.#prev[n] = p;
|
|
275161
|
-
this.#next[p] = n;
|
|
275162
|
-
}
|
|
275163
|
-
#moveToTail(index) {
|
|
275164
|
-
// if tail already, nothing to do
|
|
275165
|
-
// if head, move head to next[index]
|
|
275166
|
-
// else
|
|
275167
|
-
// move next[prev[index]] to next[index] (head has no prev)
|
|
275168
|
-
// move prev[next[index]] to prev[index]
|
|
275169
|
-
// prev[index] = tail
|
|
275170
|
-
// next[tail] = index
|
|
275171
|
-
// tail = index
|
|
275172
|
-
if (index !== this.#tail) {
|
|
275173
|
-
if (index === this.#head) {
|
|
275174
|
-
this.#head = this.#next[index];
|
|
275175
|
-
}
|
|
275176
|
-
else {
|
|
275177
|
-
this.#connect(this.#prev[index], this.#next[index]);
|
|
275178
|
-
}
|
|
275179
|
-
this.#connect(this.#tail, index);
|
|
275180
|
-
this.#tail = index;
|
|
275181
|
-
}
|
|
275182
|
-
}
|
|
275183
|
-
/**
|
|
275184
|
-
* Deletes a key out of the cache.
|
|
275185
|
-
* Returns true if the key was deleted, false otherwise.
|
|
275186
|
-
*/
|
|
275187
|
-
delete(k) {
|
|
275188
|
-
let deleted = false;
|
|
275189
|
-
if (this.#size !== 0) {
|
|
275190
|
-
const index = this.#keyMap.get(k);
|
|
275191
|
-
if (index !== undefined) {
|
|
275192
|
-
deleted = true;
|
|
275193
|
-
if (this.#size === 1) {
|
|
275194
|
-
this.clear();
|
|
274108
|
+
},
|
|
274109
|
+
/** Clears all key-value pairs from the cache. */
|
|
274110
|
+
clear() {
|
|
274111
|
+
for (const index of keyMap.values())
|
|
274112
|
+
onEviction === null || onEviction === void 0 ? void 0 : onEviction(keyList[index], valList[index]);
|
|
274113
|
+
keyMap.clear();
|
|
274114
|
+
keyList.fill(undefined);
|
|
274115
|
+
valList.fill(undefined);
|
|
274116
|
+
free = [];
|
|
274117
|
+
size = 0;
|
|
274118
|
+
head = tail = 0;
|
|
274119
|
+
},
|
|
274120
|
+
/** Resizes the cache to a new maximum size, evicting items if necessary. */
|
|
274121
|
+
resize: (newMax) => {
|
|
274122
|
+
if (!(Number.isInteger(newMax) && newMax > 0))
|
|
274123
|
+
throw new TypeError('`max` must be a positive integer');
|
|
274124
|
+
if (newMax === max)
|
|
274125
|
+
return;
|
|
274126
|
+
if (newMax < max) {
|
|
274127
|
+
let current = tail;
|
|
274128
|
+
const preserve = Math.min(size, newMax);
|
|
274129
|
+
const remove = size - preserve;
|
|
274130
|
+
const newKeyList = new Array(newMax);
|
|
274131
|
+
const newValList = new Array(newMax);
|
|
274132
|
+
const newNext = new Array(newMax);
|
|
274133
|
+
const newPrev = new Array(newMax);
|
|
274134
|
+
for (let i = 1; i <= remove; i++)
|
|
274135
|
+
onEviction === null || onEviction === void 0 ? void 0 : onEviction(keyList[i], valList[i]);
|
|
274136
|
+
for (let i = preserve - 1; i >= 0; i--) {
|
|
274137
|
+
newKeyList[i] = keyList[current];
|
|
274138
|
+
newValList[i] = valList[current];
|
|
274139
|
+
newNext[i] = i + 1;
|
|
274140
|
+
newPrev[i] = i - 1;
|
|
274141
|
+
keyMap.set(newKeyList[i], i);
|
|
274142
|
+
current = prev[current];
|
|
275195
274143
|
}
|
|
275196
|
-
|
|
275197
|
-
|
|
275198
|
-
|
|
275199
|
-
|
|
275200
|
-
|
|
275201
|
-
|
|
275202
|
-
|
|
275203
|
-
|
|
275204
|
-
|
|
275205
|
-
|
|
275206
|
-
|
|
275207
|
-
|
|
275208
|
-
}
|
|
275209
|
-
}
|
|
275210
|
-
this.#keyMap.delete(k);
|
|
275211
|
-
this.#keyList[index] = undefined;
|
|
275212
|
-
this.#valList[index] = undefined;
|
|
275213
|
-
if (index === this.#tail) {
|
|
275214
|
-
this.#tail = this.#prev[index];
|
|
275215
|
-
}
|
|
275216
|
-
else if (index === this.#head) {
|
|
275217
|
-
this.#head = this.#next[index];
|
|
275218
|
-
}
|
|
275219
|
-
else {
|
|
275220
|
-
this.#next[this.#prev[index]] = this.#next[index];
|
|
275221
|
-
this.#prev[this.#next[index]] = this.#prev[index];
|
|
275222
|
-
}
|
|
275223
|
-
this.#size--;
|
|
275224
|
-
this.#free.push(index);
|
|
274144
|
+
head = 0;
|
|
274145
|
+
tail = preserve - 1;
|
|
274146
|
+
size = preserve;
|
|
274147
|
+
keyList.length = newMax;
|
|
274148
|
+
valList.length = newMax;
|
|
274149
|
+
next.length = newMax;
|
|
274150
|
+
prev.length = newMax;
|
|
274151
|
+
for (let i = 0; i < preserve; i++) {
|
|
274152
|
+
keyList[i] = newKeyList[i];
|
|
274153
|
+
valList[i] = newValList[i];
|
|
274154
|
+
next[i] = newNext[i];
|
|
274155
|
+
prev[i] = newPrev[i];
|
|
275225
274156
|
}
|
|
275226
|
-
|
|
275227
|
-
|
|
275228
|
-
|
|
275229
|
-
const dt = this.#disposed;
|
|
275230
|
-
let task;
|
|
275231
|
-
while ((task = dt?.shift())) {
|
|
275232
|
-
this.#disposeAfter?.(...task);
|
|
275233
|
-
}
|
|
275234
|
-
}
|
|
275235
|
-
return deleted;
|
|
275236
|
-
}
|
|
275237
|
-
/**
|
|
275238
|
-
* Clear the cache entirely, throwing away all values.
|
|
275239
|
-
*/
|
|
275240
|
-
clear() {
|
|
275241
|
-
for (const index of this.#rindexes({ allowStale: true })) {
|
|
275242
|
-
const v = this.#valList[index];
|
|
275243
|
-
if (this.#isBackgroundFetch(v)) {
|
|
275244
|
-
v.__abortController.abort(new Error('deleted'));
|
|
274157
|
+
free = [];
|
|
274158
|
+
for (let i = preserve; i < newMax; i++)
|
|
274159
|
+
free.push(i);
|
|
275245
274160
|
}
|
|
275246
274161
|
else {
|
|
275247
|
-
const
|
|
275248
|
-
|
|
275249
|
-
|
|
275250
|
-
|
|
275251
|
-
|
|
275252
|
-
this.#disposed?.push([v, k, 'delete']);
|
|
275253
|
-
}
|
|
274162
|
+
const fill = newMax - max;
|
|
274163
|
+
keyList.push(...new Array(fill).fill(undefined));
|
|
274164
|
+
valList.push(...new Array(fill).fill(undefined));
|
|
274165
|
+
next.push(...new Array(fill).fill(0));
|
|
274166
|
+
prev.push(...new Array(fill).fill(0));
|
|
275254
274167
|
}
|
|
275255
|
-
|
|
275256
|
-
|
|
275257
|
-
|
|
275258
|
-
|
|
275259
|
-
|
|
275260
|
-
|
|
275261
|
-
|
|
275262
|
-
|
|
275263
|
-
|
|
275264
|
-
|
|
275265
|
-
|
|
275266
|
-
|
|
275267
|
-
|
|
275268
|
-
|
|
275269
|
-
|
|
275270
|
-
this.#size = 0;
|
|
275271
|
-
if (this.#hasDisposeAfter && this.#disposed) {
|
|
275272
|
-
const dt = this.#disposed;
|
|
275273
|
-
let task;
|
|
275274
|
-
while ((task = dt?.shift())) {
|
|
275275
|
-
this.#disposeAfter?.(...task);
|
|
275276
|
-
}
|
|
275277
|
-
}
|
|
275278
|
-
}
|
|
275279
|
-
}
|
|
275280
|
-
cjs.LRUCache = LRUCache;
|
|
275281
|
-
cjs.default = LRUCache;var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
275282
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
274168
|
+
max = newMax;
|
|
274169
|
+
},
|
|
274170
|
+
/** Returns the maximum number of items that can be stored in the cache. */
|
|
274171
|
+
get max() {
|
|
274172
|
+
return max;
|
|
274173
|
+
},
|
|
274174
|
+
/** Returns the number of items currently stored in the cache. */
|
|
274175
|
+
get size() {
|
|
274176
|
+
return size;
|
|
274177
|
+
},
|
|
274178
|
+
/** Returns the number of currently available slots in the cache before reaching the maximum size. */
|
|
274179
|
+
get available() {
|
|
274180
|
+
return max - size;
|
|
274181
|
+
},
|
|
274182
|
+
};
|
|
275283
274183
|
};
|
|
275284
|
-
|
|
275285
|
-
var indexCjs = Object.assign(index_js_1.default, { default: index_js_1.default, LRUCache: index_js_1.default });var errors$5 = {};(function (exports) {
|
|
274184
|
+
lib$4.createLRU = createLRU$2;var errors$5 = {};(function (exports) {
|
|
275286
274185
|
|
|
275287
274186
|
// originally copied from https://raw.githubusercontent.com/mysqljs/mysql/7770ee5bb13260c56a160b91fe480d9165dbeeba/lib/protocol/constants/errors.js
|
|
275288
274187
|
// (c) node-mysql authors
|
|
@@ -279246,9 +278145,9 @@ var indexCjs = Object.assign(index_js_1.default, { default: index_js_1.default,
|
|
|
279246
278145
|
exports[4161] = 'ER_INSTALL_COMPONENT_SET_UNUSED_VALUE';
|
|
279247
278146
|
exports[4162] = 'ER_WARN_DEPRECATED_USER_DEFINED_COLLATIONS';
|
|
279248
278147
|
} (errors$5));var string$1 = {};const Iconv = libExports$2;
|
|
279249
|
-
const
|
|
278148
|
+
const { createLRU: createLRU$1 } = lib$4;
|
|
279250
278149
|
|
|
279251
|
-
const decoderCache =
|
|
278150
|
+
const decoderCache = createLRU$1({
|
|
279252
278151
|
max: 500,
|
|
279253
278152
|
});
|
|
279254
278153
|
|
|
@@ -284298,9 +283197,9 @@ var genfun = function() {
|
|
|
284298
283197
|
};
|
|
284299
283198
|
|
|
284300
283199
|
genfun.formats = formats;
|
|
284301
|
-
var generateFunction = genfun;const
|
|
283200
|
+
var generateFunction = genfun;const { createLRU } = lib$4;
|
|
284302
283201
|
|
|
284303
|
-
|
|
283202
|
+
const parserCache$2 = createLRU({
|
|
284304
283203
|
max: 15000,
|
|
284305
283204
|
});
|
|
284306
283205
|
|
|
@@ -284349,7 +283248,7 @@ function getParser(type, fields, options, config, compiler) {
|
|
|
284349
283248
|
}
|
|
284350
283249
|
|
|
284351
283250
|
function setMaxCache(max) {
|
|
284352
|
-
parserCache$2
|
|
283251
|
+
parserCache$2.resize(max);
|
|
284353
283252
|
}
|
|
284354
283253
|
|
|
284355
283254
|
function clearCache() {
|
|
@@ -285767,7 +284666,7 @@ var commands$7 = {
|
|
|
285767
284666
|
ChangeUser,
|
|
285768
284667
|
Quit
|
|
285769
284668
|
};var name$1 = "mysql2";
|
|
285770
|
-
var version$2 = "3.11.
|
|
284669
|
+
var version$2 = "3.11.3";
|
|
285771
284670
|
var description = "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS";
|
|
285772
284671
|
var main$1 = "index.js";
|
|
285773
284672
|
var typings = "typings/mysql/index";
|
|
@@ -285824,13 +284723,13 @@ var dependencies$1 = {
|
|
|
285824
284723
|
"generate-function": "^2.3.1",
|
|
285825
284724
|
"iconv-lite": "^0.6.3",
|
|
285826
284725
|
long: "^5.2.1",
|
|
285827
|
-
"lru
|
|
284726
|
+
"lru.min": "^1.0.0",
|
|
285828
284727
|
"named-placeholders": "^1.1.3",
|
|
285829
284728
|
"seq-queue": "^0.0.5",
|
|
285830
284729
|
sqlstring: "^2.3.2"
|
|
285831
284730
|
};
|
|
285832
284731
|
var devDependencies$1 = {
|
|
285833
|
-
"@types/node": "^
|
|
284732
|
+
"@types/node": "^22.0.0",
|
|
285834
284733
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
285835
284734
|
"@typescript-eslint/parser": "^5.42.1",
|
|
285836
284735
|
"assert-diff": "^3.0.2",
|
|
@@ -289650,10 +288549,10 @@ function requirePromise () {
|
|
|
289650
288549
|
inheritEvents(poolCluster, this, ['warn', 'remove']);
|
|
289651
288550
|
}
|
|
289652
288551
|
|
|
289653
|
-
getConnection() {
|
|
288552
|
+
getConnection(pattern, selector) {
|
|
289654
288553
|
const corePoolCluster = this.poolCluster;
|
|
289655
288554
|
return new this.Promise((resolve, reject) => {
|
|
289656
|
-
corePoolCluster.getConnection((err, coreConnection) => {
|
|
288555
|
+
corePoolCluster.getConnection(pattern, selector, (err, coreConnection) => {
|
|
289657
288556
|
if (err) {
|
|
289658
288557
|
reject(err);
|
|
289659
288558
|
} else {
|
|
@@ -291214,7 +290113,7 @@ function requireConnection () {
|
|
|
291214
290113
|
const Readable = require$$0$b.Readable;
|
|
291215
290114
|
const Queue = denque;
|
|
291216
290115
|
const SqlString = sqlstring;
|
|
291217
|
-
const
|
|
290116
|
+
const { createLRU } = lib$4;
|
|
291218
290117
|
|
|
291219
290118
|
const PacketParser = packet_parser;
|
|
291220
290119
|
const Packets = packetsExports;
|
|
@@ -291267,9 +290166,9 @@ function requireConnection () {
|
|
|
291267
290166
|
this._command = null;
|
|
291268
290167
|
this._paused = false;
|
|
291269
290168
|
this._paused_packets = new Queue();
|
|
291270
|
-
this._statements =
|
|
290169
|
+
this._statements = createLRU({
|
|
291271
290170
|
max: this.config.maxPreparedStatements,
|
|
291272
|
-
|
|
290171
|
+
onEviction: function(_, statement) {
|
|
291273
290172
|
statement.close();
|
|
291274
290173
|
}
|
|
291275
290174
|
});
|
|
@@ -291603,7 +290502,7 @@ function requireConnection () {
|
|
|
291603
290502
|
err.code = code || 'PROTOCOL_ERROR';
|
|
291604
290503
|
this.emit('error', err);
|
|
291605
290504
|
}
|
|
291606
|
-
|
|
290505
|
+
|
|
291607
290506
|
get fatalError() {
|
|
291608
290507
|
return this._fatalError;
|
|
291609
290508
|
}
|
|
@@ -292421,9 +291320,10 @@ function requirePool () {
|
|
|
292421
291320
|
this._removeIdleTimeoutConnectionsTimer = setTimeout(() => {
|
|
292422
291321
|
try {
|
|
292423
291322
|
while (
|
|
292424
|
-
this._freeConnections.length > this.config.maxIdle
|
|
292425
|
-
|
|
292426
|
-
this.
|
|
291323
|
+
this._freeConnections.length > this.config.maxIdle ||
|
|
291324
|
+
(this._freeConnections.length > 0 &&
|
|
291325
|
+
Date.now() - this._freeConnections.get(0).lastActiveTime >
|
|
291326
|
+
this.config.idleTimeout)
|
|
292427
291327
|
) {
|
|
292428
291328
|
this._freeConnections.get(0).destroy();
|
|
292429
291329
|
}
|