lakutata 2.0.81 → 2.0.83
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/com/docker.cjs +1 -1
- package/com/docker.mjs +1 -1
- package/decorator/orm.cjs +84 -84
- package/decorator/orm.mjs +42 -128
- package/orm.cjs +873 -1410
- package/orm.mjs +708 -1458
- package/package.json +1 -1
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +230 -239
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +230 -239
- package/src/components/docker/ConnectionOptionsBuilder.cjs +1 -1
- package/src/components/docker/ConnectionOptionsBuilder.mjs +1 -1
- package/src/components/docker/Docker.cjs +4919 -4808
- package/src/components/docker/Docker.mjs +4939 -4828
- package/src/components/docker/lib/DockerContainer.cjs +1 -1
- package/src/components/docker/lib/DockerContainer.mjs +1 -1
- package/src/components/docker/lib/DockerContainerTTY.cjs +1 -1
- package/src/components/docker/lib/DockerContainerTTY.mjs +1 -1
- package/src/components/entrypoint/Entrypoint.cjs +1669 -2159
- package/src/components/entrypoint/Entrypoint.mjs +1629 -2119
- package/src/decorators/orm/AfterInsert.cjs +26 -4
- package/src/decorators/orm/AfterInsert.mjs +25 -5
- package/src/decorators/orm/AfterLoad.cjs +26 -4
- package/src/decorators/orm/AfterLoad.mjs +25 -5
- package/src/decorators/orm/AfterRecover.cjs +26 -4
- package/src/decorators/orm/AfterRecover.mjs +25 -5
- package/src/decorators/orm/AfterRemove.cjs +26 -4
- package/src/decorators/orm/AfterRemove.mjs +25 -5
- package/src/decorators/orm/AfterSoftRemove.cjs +26 -4
- package/src/decorators/orm/AfterSoftRemove.mjs +25 -5
- package/src/decorators/orm/AfterUpdate.cjs +26 -4
- package/src/decorators/orm/AfterUpdate.mjs +25 -5
- package/src/decorators/orm/BeforeInsert.cjs +26 -4
- package/src/decorators/orm/BeforeInsert.mjs +25 -5
- package/src/decorators/orm/BeforeRecover.cjs +26 -4
- package/src/decorators/orm/BeforeRecover.mjs +25 -5
- package/src/decorators/orm/BeforeRemove.cjs +26 -4
- package/src/decorators/orm/BeforeRemove.mjs +25 -5
- package/src/decorators/orm/BeforeSoftRemove.cjs +26 -4
- package/src/decorators/orm/BeforeSoftRemove.mjs +25 -5
- package/src/decorators/orm/BeforeUpdate.cjs +26 -4
- package/src/decorators/orm/BeforeUpdate.mjs +25 -5
- package/src/decorators/orm/Check.cjs +29 -4
- package/src/decorators/orm/Check.mjs +28 -5
- package/src/decorators/orm/ChildEntity.cjs +29 -4
- package/src/decorators/orm/ChildEntity.mjs +28 -5
- package/src/decorators/orm/Column.cjs +61 -4
- package/src/decorators/orm/Column.mjs +61 -6
- package/src/decorators/orm/CreateDateColumn.cjs +25 -4
- package/src/decorators/orm/CreateDateColumn.mjs +24 -5
- package/src/decorators/orm/DeleteDateColumn.cjs +25 -4
- package/src/decorators/orm/DeleteDateColumn.mjs +23 -4
- package/src/decorators/orm/Entity.cjs +35 -4
- package/src/decorators/orm/Entity.mjs +33 -4
- package/src/decorators/orm/EventSubscriber.cjs +22 -4
- package/src/decorators/orm/EventSubscriber.mjs +21 -5
- package/src/decorators/orm/Exclusion.cjs +29 -4
- package/src/decorators/orm/Exclusion.mjs +28 -5
- package/src/decorators/orm/Generated.cjs +24 -4
- package/src/decorators/orm/Generated.mjs +23 -5
- package/src/decorators/orm/Index.cjs +41 -4
- package/src/decorators/orm/Index.mjs +41 -6
- package/src/decorators/orm/JoinColumn.cjs +29 -4
- package/src/decorators/orm/JoinColumn.mjs +28 -5
- package/src/decorators/orm/JoinTable.cjs +30 -4
- package/src/decorators/orm/JoinTable.mjs +28 -4
- package/src/decorators/orm/ManyToMany.cjs +42 -4
- package/src/decorators/orm/ManyToMany.mjs +40 -4
- package/src/decorators/orm/ManyToOne.cjs +42 -4
- package/src/decorators/orm/ManyToOne.mjs +40 -4
- package/src/decorators/orm/ObjectIdColumn.cjs +28 -4
- package/src/decorators/orm/ObjectIdColumn.mjs +27 -5
- package/src/decorators/orm/OneToMany.cjs +34 -4
- package/src/decorators/orm/OneToMany.mjs +34 -6
- package/src/decorators/orm/OneToOne.cjs +42 -4
- package/src/decorators/orm/OneToOne.mjs +40 -4
- package/src/decorators/orm/PrimaryColumn.cjs +49 -4
- package/src/decorators/orm/PrimaryColumn.mjs +49 -6
- package/src/decorators/orm/PrimaryGeneratedColumn.cjs +54 -4
- package/src/decorators/orm/PrimaryGeneratedColumn.mjs +54 -6
- package/src/decorators/orm/RelationId.cjs +26 -4
- package/src/decorators/orm/RelationId.mjs +25 -5
- package/src/decorators/orm/TableInheritance.cjs +26 -4
- package/src/decorators/orm/TableInheritance.mjs +25 -5
- package/src/decorators/orm/Tree.cjs +24 -4
- package/src/decorators/orm/Tree.mjs +23 -5
- package/src/decorators/orm/TreeChildren.cjs +31 -4
- package/src/decorators/orm/TreeChildren.mjs +29 -4
- package/src/decorators/orm/TreeLevelColumn.cjs +25 -4
- package/src/decorators/orm/TreeLevelColumn.mjs +23 -4
- package/src/decorators/orm/TreeParent.cjs +31 -4
- package/src/decorators/orm/TreeParent.mjs +29 -4
- package/src/decorators/orm/Unique.cjs +44 -4
- package/src/decorators/orm/Unique.mjs +44 -6
- package/src/decorators/orm/UpdateDateColumn.cjs +25 -4
- package/src/decorators/orm/UpdateDateColumn.mjs +24 -5
- package/src/decorators/orm/VersionColumn.cjs +25 -4
- package/src/decorators/orm/VersionColumn.mjs +24 -5
- package/src/decorators/orm/ViewColumn.cjs +25 -4
- package/src/decorators/orm/ViewColumn.mjs +24 -5
- package/src/decorators/orm/ViewEntity.cjs +34 -4
- package/src/decorators/orm/ViewEntity.mjs +33 -5
- package/src/decorators/orm/VirtualColumn.cjs +42 -4
- package/src/decorators/orm/VirtualColumn.mjs +40 -4
- package/src/lib/base/EventEmitter.cjs +1193 -1200
- package/src/lib/base/EventEmitter.mjs +1194 -1201
- package/src/lib/base/internal/DataValidator.cjs +185 -174
- package/src/lib/base/internal/DataValidator.mjs +186 -175
- package/src/lib/base/internal/PatternManager.cjs +735 -740
- package/src/lib/base/internal/PatternManager.mjs +740 -745
- package/src/lib/core/Application.cjs +99 -112
- package/src/lib/core/Application.mjs +127 -140
- package/src/lib/helpers/IsHtml.cjs +13 -7
- package/src/lib/helpers/IsHtml.mjs +13 -7
- package/src/lib/helpers/IsXML.cjs +1016 -1158
- package/src/lib/helpers/IsXML.mjs +729 -871
- package/src/lib/helpers/ObjectHash.cjs +371 -378
- package/src/lib/helpers/ObjectHash.mjs +371 -378
- package/src/lib/helpers/RandomString.cjs +146 -167
- package/src/lib/helpers/RandomString.mjs +145 -166
- package/src/lib/helpers/URLBuilder.cjs +355 -355
- package/src/lib/helpers/URLBuilder.mjs +350 -350
- package/src/lib/ioc/ListModules.cjs +5237 -5160
- package/src/lib/ioc/ListModules.mjs +5252 -5175
- package/src/lib/validation/VLD.cjs +3903 -4080
- package/src/lib/validation/VLD.mjs +2793 -2970
- package/src/providers/migration/GenerateMigration.cjs +2 -2
- package/src/providers/migration/GenerateMigration.mjs +2 -2
- package/vendor/Package.112.cjs +38321 -38240
- package/vendor/Package.112.mjs +37720 -37579
- package/vendor/Package.16.cjs +7386 -7268
- package/vendor/Package.16.mjs +6706 -6588
- package/vendor/Package.18.cjs +48229 -20
- package/vendor/Package.18.mjs +48192 -24
- package/vendor/Package.2.cjs +5698 -5727
- package/vendor/Package.2.mjs +5707 -5736
- package/vendor/Package.4.cjs +874 -884
- package/vendor/Package.4.mjs +874 -884
- package/vendor/Package.5.cjs +11 -15
- package/vendor/Package.5.mjs +7 -11
- package/vendor/Package.6.cjs +511 -520
- package/vendor/Package.6.mjs +534 -543
- package/vendor/Package.62.cjs +87 -90
- package/vendor/Package.62.mjs +180 -183
- package/vendor/Package.65.cjs +1285 -1292
- package/vendor/Package.65.mjs +190 -197
- package/vendor/Package.68.cjs +111 -252
- package/vendor/Package.68.mjs +134 -268
- package/vendor/Package.9.cjs +118 -132
- package/vendor/Package.9.mjs +124 -138
- package/vendor/TypeDef.internal.3.d.ts +0 -14
- package/vendor/Package.19.cjs +0 -37
- package/vendor/Package.19.mjs +0 -35
- package/vendor/Package.20.cjs +0 -37
- package/vendor/Package.20.mjs +0 -35
- package/vendor/Package.21.cjs +0 -37
- package/vendor/Package.21.mjs +0 -35
- package/vendor/Package.22.cjs +0 -37
- package/vendor/Package.22.mjs +0 -35
- package/vendor/Package.23.cjs +0 -37
- package/vendor/Package.23.mjs +0 -35
- package/vendor/Package.24.cjs +0 -37
- package/vendor/Package.24.mjs +0 -35
- package/vendor/Package.25.cjs +0 -37
- package/vendor/Package.25.mjs +0 -35
- package/vendor/Package.26.cjs +0 -37
- package/vendor/Package.26.mjs +0 -35
- package/vendor/Package.27.cjs +0 -37
- package/vendor/Package.27.mjs +0 -35
- package/vendor/Package.28.cjs +0 -37
- package/vendor/Package.28.mjs +0 -35
- package/vendor/Package.29.cjs +0 -40
- package/vendor/Package.29.mjs +0 -38
- package/vendor/Package.30.cjs +0 -41
- package/vendor/Package.30.mjs +0 -39
- package/vendor/Package.31.cjs +0 -72
- package/vendor/Package.31.mjs +0 -70
- package/vendor/Package.32.cjs +0 -37
- package/vendor/Package.32.mjs +0 -35
- package/vendor/Package.33.cjs +0 -37
- package/vendor/Package.33.mjs +0 -35
- package/vendor/Package.34.cjs +0 -46
- package/vendor/Package.34.mjs +0 -44
- package/vendor/Package.35.cjs +0 -34
- package/vendor/Package.35.mjs +0 -32
- package/vendor/Package.36.cjs +0 -40
- package/vendor/Package.36.mjs +0 -38
- package/vendor/Package.37.cjs +0 -36
- package/vendor/Package.37.mjs +0 -34
- package/vendor/Package.38.cjs +0 -52
- package/vendor/Package.38.mjs +0 -50
- package/vendor/Package.39.cjs +0 -41
- package/vendor/Package.39.mjs +0 -39
- package/vendor/Package.40.cjs +0 -42
- package/vendor/Package.40.mjs +0 -40
- package/vendor/Package.41.cjs +0 -53
- package/vendor/Package.41.mjs +0 -51
- package/vendor/Package.42.cjs +0 -53
- package/vendor/Package.42.mjs +0 -51
- package/vendor/Package.43.cjs +0 -40
- package/vendor/Package.43.mjs +0 -38
- package/vendor/Package.44.cjs +0 -46
- package/vendor/Package.44.mjs +0 -44
- package/vendor/Package.45.cjs +0 -53
- package/vendor/Package.45.mjs +0 -51
- package/vendor/Package.46.cjs +0 -59
- package/vendor/Package.46.mjs +0 -57
- package/vendor/Package.47.cjs +0 -65
- package/vendor/Package.47.mjs +0 -63
- package/vendor/Package.48.cjs +0 -38
- package/vendor/Package.48.mjs +0 -36
- package/vendor/Package.49.cjs +0 -38
- package/vendor/Package.49.mjs +0 -36
- package/vendor/Package.50.cjs +0 -36
- package/vendor/Package.50.mjs +0 -34
- package/vendor/Package.51.cjs +0 -43
- package/vendor/Package.51.mjs +0 -41
- package/vendor/Package.52.cjs +0 -37
- package/vendor/Package.52.mjs +0 -35
- package/vendor/Package.53.cjs +0 -43
- package/vendor/Package.53.mjs +0 -41
- package/vendor/Package.54.cjs +0 -55
- package/vendor/Package.54.mjs +0 -53
- package/vendor/Package.55.cjs +0 -37
- package/vendor/Package.55.mjs +0 -35
- package/vendor/Package.56.cjs +0 -37
- package/vendor/Package.56.mjs +0 -35
- package/vendor/Package.57.cjs +0 -37
- package/vendor/Package.57.mjs +0 -35
- package/vendor/Package.58.cjs +0 -45
- package/vendor/Package.58.mjs +0 -43
- package/vendor/Package.59.cjs +0 -53
- package/vendor/Package.59.mjs +0 -51
- package/vendor/Package.60.cjs +0 -47649
- package/vendor/Package.60.mjs +0 -47606
|
@@ -312,269 +312,260 @@ function k() {
|
|
|
312
312
|
return g;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
recursive: true
|
|
365
|
-
});
|
|
366
|
-
this._lastExpire = this._separated.getLastExpire();
|
|
367
|
-
} else {
|
|
368
|
-
this._loadDataSync();
|
|
369
|
-
}
|
|
315
|
+
(function(e) {
|
|
316
|
+
"use strict";
|
|
317
|
+
Object.defineProperty(e, "__esModule", {
|
|
318
|
+
value: true
|
|
319
|
+
});
|
|
320
|
+
e.KeyvFile = e.defaultOpts = void 0;
|
|
321
|
+
const t = r;
|
|
322
|
+
const i = t.__importStar(o);
|
|
323
|
+
const c = t.__importStar(a);
|
|
324
|
+
const p = t.__importStar(n);
|
|
325
|
+
const u = t.__importDefault(l);
|
|
326
|
+
const d = h();
|
|
327
|
+
const f = t.__importDefault(s);
|
|
328
|
+
const y = v();
|
|
329
|
+
t.__exportStar(k(), e);
|
|
330
|
+
e.defaultOpts = {
|
|
331
|
+
deserialize: e => (0, d.defaultDeserialize)(e.toString()),
|
|
332
|
+
dialect: "redis",
|
|
333
|
+
expiredCheckDelay: 24 * 3600 * 1e3,
|
|
334
|
+
filename: `${i.tmpdir()}/keyv-file/default.json`,
|
|
335
|
+
serialize: d.defaultSerialize,
|
|
336
|
+
writeDelay: 100,
|
|
337
|
+
checkFileLock: false,
|
|
338
|
+
separatedFile: false
|
|
339
|
+
};
|
|
340
|
+
function m(e) {
|
|
341
|
+
return typeof e === "number";
|
|
342
|
+
}
|
|
343
|
+
class KeyvFile extends u.default {
|
|
344
|
+
ttlSupport=true;
|
|
345
|
+
namespace;
|
|
346
|
+
opts;
|
|
347
|
+
_data=new Map;
|
|
348
|
+
_lastExpire=0;
|
|
349
|
+
_separated;
|
|
350
|
+
constructor(t) {
|
|
351
|
+
super();
|
|
352
|
+
this.opts = Object.assign({}, e.defaultOpts, t);
|
|
353
|
+
this._separated = new y.SeparatedFileHelper(this.opts);
|
|
354
|
+
if (this.opts.checkFileLock) {
|
|
355
|
+
this.acquireFileLock();
|
|
356
|
+
}
|
|
357
|
+
if (this.opts.separatedFile) {
|
|
358
|
+
c.mkdirSync(this.opts.filename, {
|
|
359
|
+
recursive: true
|
|
360
|
+
});
|
|
361
|
+
this._lastExpire = this._separated.getLastExpire();
|
|
362
|
+
} else {
|
|
363
|
+
this._loadDataSync();
|
|
370
364
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
365
|
+
}
|
|
366
|
+
_loadDataSync() {
|
|
367
|
+
try {
|
|
368
|
+
const e = this.opts.deserialize(c.readFileSync(this.opts.filename));
|
|
369
|
+
if (!Array.isArray(e.cache)) {
|
|
370
|
+
const t = e.cache;
|
|
371
|
+
e.cache = [];
|
|
372
|
+
for (const r in t) {
|
|
373
|
+
if (t.hasOwnProperty(r)) {
|
|
374
|
+
e.cache.push([ r, t[r] ]);
|
|
381
375
|
}
|
|
382
376
|
}
|
|
383
|
-
this._data = new Map(e.cache);
|
|
384
|
-
this._lastExpire = e.lastExpire;
|
|
385
|
-
} catch (e) {
|
|
386
|
-
(0, y.handleIOError)(e);
|
|
387
|
-
this._data = new Map;
|
|
388
|
-
this._lastExpire = Date.now();
|
|
389
377
|
}
|
|
378
|
+
this._data = new Map(e.cache);
|
|
379
|
+
this._lastExpire = e.lastExpire;
|
|
380
|
+
} catch (e) {
|
|
381
|
+
(0, y.handleIOError)(e);
|
|
382
|
+
this._data = new Map;
|
|
383
|
+
this._lastExpire = Date.now();
|
|
390
384
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
return this.opts.filename + ".lock";
|
|
396
|
-
}
|
|
397
|
-
acquireFileLock() {
|
|
398
|
-
try {
|
|
399
|
-
let e = c.openSync(this._lockFile, "wx");
|
|
400
|
-
c.closeSync(e);
|
|
401
|
-
process.on("SIGINT", (() => {
|
|
402
|
-
this.releaseFileLock();
|
|
403
|
-
process.exit(0);
|
|
404
|
-
}));
|
|
405
|
-
process.on("exit", (() => {
|
|
406
|
-
this.releaseFileLock();
|
|
407
|
-
}));
|
|
408
|
-
} catch (e) {
|
|
409
|
-
console.error(`[keyv-file] There is another process using this file`);
|
|
410
|
-
throw e;
|
|
411
|
-
}
|
|
385
|
+
}
|
|
386
|
+
get _lockFile() {
|
|
387
|
+
if (this.opts.separatedFile) {
|
|
388
|
+
return this._separated.lockFile;
|
|
412
389
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
390
|
+
return this.opts.filename + ".lock";
|
|
391
|
+
}
|
|
392
|
+
acquireFileLock() {
|
|
393
|
+
try {
|
|
394
|
+
let e = c.openSync(this._lockFile, "wx");
|
|
395
|
+
c.closeSync(e);
|
|
396
|
+
process.on("SIGINT", (() => {
|
|
397
|
+
this.releaseFileLock();
|
|
398
|
+
process.exit(0);
|
|
399
|
+
}));
|
|
400
|
+
process.on("exit", (() => {
|
|
401
|
+
this.releaseFileLock();
|
|
402
|
+
}));
|
|
403
|
+
} catch (e) {
|
|
404
|
+
console.error(`[keyv-file] There is another process using this file`);
|
|
405
|
+
throw e;
|
|
419
406
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
407
|
+
}
|
|
408
|
+
releaseFileLock() {
|
|
409
|
+
try {
|
|
410
|
+
c.unlinkSync(this._lockFile);
|
|
411
|
+
} catch (e) {
|
|
412
|
+
(0, y.handleIOError)(e);
|
|
426
413
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
let t = void 0;
|
|
433
|
-
try {
|
|
434
|
-
const t = this._data.get(e);
|
|
435
|
-
return this._getWithExpire(e, t);
|
|
436
|
-
} catch (e) {
|
|
437
|
-
(0, y.handleIOError)(e);
|
|
438
|
-
}
|
|
439
|
-
return t;
|
|
414
|
+
}
|
|
415
|
+
async get(e) {
|
|
416
|
+
if (this.opts.separatedFile) {
|
|
417
|
+
let t = await this._separated.get(e);
|
|
418
|
+
return this._getWithExpire(e, t);
|
|
440
419
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
420
|
+
return this.getSync(e);
|
|
421
|
+
}
|
|
422
|
+
getSync(e) {
|
|
423
|
+
if (this.opts.separatedFile) {
|
|
424
|
+
let t = this._separated.getSync(e);
|
|
425
|
+
return this._getWithExpire(e, t);
|
|
446
426
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
value: t
|
|
454
|
-
};
|
|
455
|
-
this.clearExpire();
|
|
456
|
-
if (this.opts.separatedFile) {
|
|
457
|
-
return this._separated.set(e, t);
|
|
458
|
-
}
|
|
459
|
-
this._data.set(e, t);
|
|
460
|
-
return this.save();
|
|
427
|
+
let t = void 0;
|
|
428
|
+
try {
|
|
429
|
+
const t = this._data.get(e);
|
|
430
|
+
return this._getWithExpire(e, t);
|
|
431
|
+
} catch (e) {
|
|
432
|
+
(0, y.handleIOError)(e);
|
|
461
433
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
await this.save();
|
|
468
|
-
return t;
|
|
469
|
-
}
|
|
470
|
-
async deleteMany(e) {
|
|
471
|
-
if (this.opts.separatedFile) {
|
|
472
|
-
let t = await Promise.all(e.map((e => this.delete(e))));
|
|
473
|
-
return t.every((e => e));
|
|
474
|
-
}
|
|
475
|
-
let t = e.every((e => this._data.delete(e)));
|
|
476
|
-
await this.save();
|
|
477
|
-
return t;
|
|
478
|
-
}
|
|
479
|
-
async clear() {
|
|
480
|
-
if (this.opts.separatedFile) {
|
|
481
|
-
await this._separated.clear();
|
|
482
|
-
this._lastExpire = 0;
|
|
483
|
-
return true;
|
|
484
|
-
}
|
|
485
|
-
this._data = new Map;
|
|
486
|
-
this._lastExpire = Date.now();
|
|
487
|
-
return this.save();
|
|
434
|
+
return t;
|
|
435
|
+
}
|
|
436
|
+
async getMany(e) {
|
|
437
|
+
if (this.opts.separatedFile) {
|
|
438
|
+
return Promise.all(e.map((e => this.get(e))));
|
|
488
439
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
440
|
+
return e.map((e => this.getSync(e)));
|
|
441
|
+
}
|
|
442
|
+
async set(e, t, r) {
|
|
443
|
+
if (r === 0) {
|
|
444
|
+
r = undefined;
|
|
492
445
|
}
|
|
493
|
-
|
|
494
|
-
|
|
446
|
+
t = {
|
|
447
|
+
expire: m(r) ? Date.now() + r : undefined,
|
|
448
|
+
value: t
|
|
449
|
+
};
|
|
450
|
+
this.clearExpire();
|
|
451
|
+
if (this.opts.separatedFile) {
|
|
452
|
+
return this._separated.set(e, t);
|
|
495
453
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
return t.value;
|
|
454
|
+
this._data.set(e, t);
|
|
455
|
+
return this.save();
|
|
456
|
+
}
|
|
457
|
+
async delete(e) {
|
|
458
|
+
if (this.opts.separatedFile) {
|
|
459
|
+
return this._separated.delete(e);
|
|
505
460
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
for (const e of this._data.keys()) {
|
|
517
|
-
const t = this._data.get(e);
|
|
518
|
-
this._getWithExpire(e, t);
|
|
519
|
-
}
|
|
461
|
+
const t = this._data.delete(e);
|
|
462
|
+
await this.save();
|
|
463
|
+
return t;
|
|
464
|
+
}
|
|
465
|
+
async deleteMany(e) {
|
|
466
|
+
if (this.opts.separatedFile) {
|
|
467
|
+
let t = await Promise.all(e.map((e => this.delete(e))));
|
|
468
|
+
return t.every((e => e));
|
|
520
469
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
await p.mkdir(f.default.dirname(this.opts.filename), {
|
|
531
|
-
recursive: true
|
|
532
|
-
});
|
|
533
|
-
return p.writeFile(this.opts.filename, t);
|
|
470
|
+
let t = e.every((e => this._data.delete(e)));
|
|
471
|
+
await this.save();
|
|
472
|
+
return t;
|
|
473
|
+
}
|
|
474
|
+
async clear() {
|
|
475
|
+
if (this.opts.separatedFile) {
|
|
476
|
+
await this._separated.clear();
|
|
477
|
+
this._lastExpire = 0;
|
|
478
|
+
return true;
|
|
534
479
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
return
|
|
480
|
+
this._data = new Map;
|
|
481
|
+
this._lastExpire = Date.now();
|
|
482
|
+
return this.save();
|
|
483
|
+
}
|
|
484
|
+
async has(e) {
|
|
485
|
+
const t = await this.get(e);
|
|
486
|
+
return t !== undefined;
|
|
487
|
+
}
|
|
488
|
+
isExpired(e) {
|
|
489
|
+
return m(e.expire) && e.expire <= Date.now();
|
|
490
|
+
}
|
|
491
|
+
_getWithExpire(e, t) {
|
|
492
|
+
if (!t) {
|
|
493
|
+
return;
|
|
549
494
|
}
|
|
550
|
-
|
|
551
|
-
|
|
495
|
+
if (this.isExpired(t)) {
|
|
496
|
+
this.delete(e);
|
|
497
|
+
return;
|
|
552
498
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
499
|
+
return t.value;
|
|
500
|
+
}
|
|
501
|
+
clearExpire() {
|
|
502
|
+
const e = Date.now();
|
|
503
|
+
if (e - this._lastExpire <= this.opts.expiredCheckDelay) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
this._lastExpire = e;
|
|
507
|
+
if (this.opts.separatedFile) {
|
|
508
|
+
this._separated.clearExpire((e => this.get(e)));
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
for (const e of this._data.keys()) {
|
|
512
|
+
const t = this._data.get(e);
|
|
513
|
+
this._getWithExpire(e, t);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
async saveToDisk() {
|
|
517
|
+
const e = [];
|
|
518
|
+
for (const [t, r] of this._data) {
|
|
519
|
+
e.push([ t, r ]);
|
|
520
|
+
}
|
|
521
|
+
const t = this.opts.serialize({
|
|
522
|
+
cache: e,
|
|
523
|
+
lastExpire: this._lastExpire
|
|
524
|
+
});
|
|
525
|
+
await p.mkdir(f.default.dirname(this.opts.filename), {
|
|
526
|
+
recursive: true
|
|
527
|
+
});
|
|
528
|
+
return p.writeFile(this.opts.filename, t);
|
|
529
|
+
}
|
|
530
|
+
_savePromise;
|
|
531
|
+
save() {
|
|
532
|
+
this.clearExpire();
|
|
533
|
+
if (this._savePromise) {
|
|
534
|
+
return this._savePromise;
|
|
535
|
+
}
|
|
536
|
+
this._savePromise = new Promise(((e, t) => {
|
|
537
|
+
setTimeout((() => {
|
|
538
|
+
this.saveToDisk().then(e, t).finally((() => {
|
|
539
|
+
this._savePromise = void 0;
|
|
540
|
+
}));
|
|
541
|
+
}), this.opts.writeDelay);
|
|
542
|
+
}));
|
|
543
|
+
return this._savePromise;
|
|
544
|
+
}
|
|
545
|
+
disconnect() {
|
|
546
|
+
return Promise.resolve();
|
|
547
|
+
}
|
|
548
|
+
async* iterator(e) {
|
|
549
|
+
let t = this.opts.separatedFile ? await this._separated.entries() : this._data.entries();
|
|
550
|
+
for (const [r, i] of t) {
|
|
551
|
+
if (r === undefined || i === undefined) {
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
if (!e || r.includes(e)) {
|
|
555
|
+
yield [ r, i.value ];
|
|
562
556
|
}
|
|
563
557
|
}
|
|
564
558
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
var x = w();
|
|
559
|
+
}
|
|
560
|
+
e.KeyvFile = KeyvFile;
|
|
561
|
+
e.default = KeyvFile;
|
|
562
|
+
})(c);
|
|
572
563
|
|
|
573
|
-
const
|
|
564
|
+
const S = t(c);
|
|
574
565
|
|
|
575
|
-
async function
|
|
566
|
+
async function w(t) {
|
|
576
567
|
return new e({
|
|
577
|
-
store: new
|
|
568
|
+
store: new c.KeyvFile({
|
|
578
569
|
filename: t.filename,
|
|
579
570
|
expiredCheckDelay: t.expiredCheckDelay,
|
|
580
571
|
writeDelay: t.writeDelay
|
|
@@ -583,4 +574,4 @@ async function O(t) {
|
|
|
583
574
|
});
|
|
584
575
|
}
|
|
585
576
|
|
|
586
|
-
export {
|
|
577
|
+
export { w as CreateFileCacheAdapter };
|