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.
Files changed (234) hide show
  1. package/com/docker.cjs +1 -1
  2. package/com/docker.mjs +1 -1
  3. package/decorator/orm.cjs +84 -84
  4. package/decorator/orm.mjs +42 -128
  5. package/orm.cjs +873 -1410
  6. package/orm.mjs +708 -1458
  7. package/package.json +1 -1
  8. package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +230 -239
  9. package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +230 -239
  10. package/src/components/docker/ConnectionOptionsBuilder.cjs +1 -1
  11. package/src/components/docker/ConnectionOptionsBuilder.mjs +1 -1
  12. package/src/components/docker/Docker.cjs +4919 -4808
  13. package/src/components/docker/Docker.mjs +4939 -4828
  14. package/src/components/docker/lib/DockerContainer.cjs +1 -1
  15. package/src/components/docker/lib/DockerContainer.mjs +1 -1
  16. package/src/components/docker/lib/DockerContainerTTY.cjs +1 -1
  17. package/src/components/docker/lib/DockerContainerTTY.mjs +1 -1
  18. package/src/components/entrypoint/Entrypoint.cjs +1669 -2159
  19. package/src/components/entrypoint/Entrypoint.mjs +1629 -2119
  20. package/src/decorators/orm/AfterInsert.cjs +26 -4
  21. package/src/decorators/orm/AfterInsert.mjs +25 -5
  22. package/src/decorators/orm/AfterLoad.cjs +26 -4
  23. package/src/decorators/orm/AfterLoad.mjs +25 -5
  24. package/src/decorators/orm/AfterRecover.cjs +26 -4
  25. package/src/decorators/orm/AfterRecover.mjs +25 -5
  26. package/src/decorators/orm/AfterRemove.cjs +26 -4
  27. package/src/decorators/orm/AfterRemove.mjs +25 -5
  28. package/src/decorators/orm/AfterSoftRemove.cjs +26 -4
  29. package/src/decorators/orm/AfterSoftRemove.mjs +25 -5
  30. package/src/decorators/orm/AfterUpdate.cjs +26 -4
  31. package/src/decorators/orm/AfterUpdate.mjs +25 -5
  32. package/src/decorators/orm/BeforeInsert.cjs +26 -4
  33. package/src/decorators/orm/BeforeInsert.mjs +25 -5
  34. package/src/decorators/orm/BeforeRecover.cjs +26 -4
  35. package/src/decorators/orm/BeforeRecover.mjs +25 -5
  36. package/src/decorators/orm/BeforeRemove.cjs +26 -4
  37. package/src/decorators/orm/BeforeRemove.mjs +25 -5
  38. package/src/decorators/orm/BeforeSoftRemove.cjs +26 -4
  39. package/src/decorators/orm/BeforeSoftRemove.mjs +25 -5
  40. package/src/decorators/orm/BeforeUpdate.cjs +26 -4
  41. package/src/decorators/orm/BeforeUpdate.mjs +25 -5
  42. package/src/decorators/orm/Check.cjs +29 -4
  43. package/src/decorators/orm/Check.mjs +28 -5
  44. package/src/decorators/orm/ChildEntity.cjs +29 -4
  45. package/src/decorators/orm/ChildEntity.mjs +28 -5
  46. package/src/decorators/orm/Column.cjs +61 -4
  47. package/src/decorators/orm/Column.mjs +61 -6
  48. package/src/decorators/orm/CreateDateColumn.cjs +25 -4
  49. package/src/decorators/orm/CreateDateColumn.mjs +24 -5
  50. package/src/decorators/orm/DeleteDateColumn.cjs +25 -4
  51. package/src/decorators/orm/DeleteDateColumn.mjs +23 -4
  52. package/src/decorators/orm/Entity.cjs +35 -4
  53. package/src/decorators/orm/Entity.mjs +33 -4
  54. package/src/decorators/orm/EventSubscriber.cjs +22 -4
  55. package/src/decorators/orm/EventSubscriber.mjs +21 -5
  56. package/src/decorators/orm/Exclusion.cjs +29 -4
  57. package/src/decorators/orm/Exclusion.mjs +28 -5
  58. package/src/decorators/orm/Generated.cjs +24 -4
  59. package/src/decorators/orm/Generated.mjs +23 -5
  60. package/src/decorators/orm/Index.cjs +41 -4
  61. package/src/decorators/orm/Index.mjs +41 -6
  62. package/src/decorators/orm/JoinColumn.cjs +29 -4
  63. package/src/decorators/orm/JoinColumn.mjs +28 -5
  64. package/src/decorators/orm/JoinTable.cjs +30 -4
  65. package/src/decorators/orm/JoinTable.mjs +28 -4
  66. package/src/decorators/orm/ManyToMany.cjs +42 -4
  67. package/src/decorators/orm/ManyToMany.mjs +40 -4
  68. package/src/decorators/orm/ManyToOne.cjs +42 -4
  69. package/src/decorators/orm/ManyToOne.mjs +40 -4
  70. package/src/decorators/orm/ObjectIdColumn.cjs +28 -4
  71. package/src/decorators/orm/ObjectIdColumn.mjs +27 -5
  72. package/src/decorators/orm/OneToMany.cjs +34 -4
  73. package/src/decorators/orm/OneToMany.mjs +34 -6
  74. package/src/decorators/orm/OneToOne.cjs +42 -4
  75. package/src/decorators/orm/OneToOne.mjs +40 -4
  76. package/src/decorators/orm/PrimaryColumn.cjs +49 -4
  77. package/src/decorators/orm/PrimaryColumn.mjs +49 -6
  78. package/src/decorators/orm/PrimaryGeneratedColumn.cjs +54 -4
  79. package/src/decorators/orm/PrimaryGeneratedColumn.mjs +54 -6
  80. package/src/decorators/orm/RelationId.cjs +26 -4
  81. package/src/decorators/orm/RelationId.mjs +25 -5
  82. package/src/decorators/orm/TableInheritance.cjs +26 -4
  83. package/src/decorators/orm/TableInheritance.mjs +25 -5
  84. package/src/decorators/orm/Tree.cjs +24 -4
  85. package/src/decorators/orm/Tree.mjs +23 -5
  86. package/src/decorators/orm/TreeChildren.cjs +31 -4
  87. package/src/decorators/orm/TreeChildren.mjs +29 -4
  88. package/src/decorators/orm/TreeLevelColumn.cjs +25 -4
  89. package/src/decorators/orm/TreeLevelColumn.mjs +23 -4
  90. package/src/decorators/orm/TreeParent.cjs +31 -4
  91. package/src/decorators/orm/TreeParent.mjs +29 -4
  92. package/src/decorators/orm/Unique.cjs +44 -4
  93. package/src/decorators/orm/Unique.mjs +44 -6
  94. package/src/decorators/orm/UpdateDateColumn.cjs +25 -4
  95. package/src/decorators/orm/UpdateDateColumn.mjs +24 -5
  96. package/src/decorators/orm/VersionColumn.cjs +25 -4
  97. package/src/decorators/orm/VersionColumn.mjs +24 -5
  98. package/src/decorators/orm/ViewColumn.cjs +25 -4
  99. package/src/decorators/orm/ViewColumn.mjs +24 -5
  100. package/src/decorators/orm/ViewEntity.cjs +34 -4
  101. package/src/decorators/orm/ViewEntity.mjs +33 -5
  102. package/src/decorators/orm/VirtualColumn.cjs +42 -4
  103. package/src/decorators/orm/VirtualColumn.mjs +40 -4
  104. package/src/lib/base/EventEmitter.cjs +1193 -1200
  105. package/src/lib/base/EventEmitter.mjs +1194 -1201
  106. package/src/lib/base/internal/DataValidator.cjs +185 -174
  107. package/src/lib/base/internal/DataValidator.mjs +186 -175
  108. package/src/lib/base/internal/PatternManager.cjs +735 -740
  109. package/src/lib/base/internal/PatternManager.mjs +740 -745
  110. package/src/lib/core/Application.cjs +99 -112
  111. package/src/lib/core/Application.mjs +127 -140
  112. package/src/lib/helpers/IsHtml.cjs +13 -7
  113. package/src/lib/helpers/IsHtml.mjs +13 -7
  114. package/src/lib/helpers/IsXML.cjs +1016 -1158
  115. package/src/lib/helpers/IsXML.mjs +729 -871
  116. package/src/lib/helpers/ObjectHash.cjs +371 -378
  117. package/src/lib/helpers/ObjectHash.mjs +371 -378
  118. package/src/lib/helpers/RandomString.cjs +146 -167
  119. package/src/lib/helpers/RandomString.mjs +145 -166
  120. package/src/lib/helpers/URLBuilder.cjs +355 -355
  121. package/src/lib/helpers/URLBuilder.mjs +350 -350
  122. package/src/lib/ioc/ListModules.cjs +5237 -5160
  123. package/src/lib/ioc/ListModules.mjs +5252 -5175
  124. package/src/lib/validation/VLD.cjs +3903 -4080
  125. package/src/lib/validation/VLD.mjs +2793 -2970
  126. package/src/providers/migration/GenerateMigration.cjs +2 -2
  127. package/src/providers/migration/GenerateMigration.mjs +2 -2
  128. package/vendor/Package.112.cjs +38321 -38240
  129. package/vendor/Package.112.mjs +37720 -37579
  130. package/vendor/Package.16.cjs +7386 -7268
  131. package/vendor/Package.16.mjs +6706 -6588
  132. package/vendor/Package.18.cjs +48229 -20
  133. package/vendor/Package.18.mjs +48192 -24
  134. package/vendor/Package.2.cjs +5698 -5727
  135. package/vendor/Package.2.mjs +5707 -5736
  136. package/vendor/Package.4.cjs +874 -884
  137. package/vendor/Package.4.mjs +874 -884
  138. package/vendor/Package.5.cjs +11 -15
  139. package/vendor/Package.5.mjs +7 -11
  140. package/vendor/Package.6.cjs +511 -520
  141. package/vendor/Package.6.mjs +534 -543
  142. package/vendor/Package.62.cjs +87 -90
  143. package/vendor/Package.62.mjs +180 -183
  144. package/vendor/Package.65.cjs +1285 -1292
  145. package/vendor/Package.65.mjs +190 -197
  146. package/vendor/Package.68.cjs +111 -252
  147. package/vendor/Package.68.mjs +134 -268
  148. package/vendor/Package.9.cjs +118 -132
  149. package/vendor/Package.9.mjs +124 -138
  150. package/vendor/TypeDef.internal.3.d.ts +0 -14
  151. package/vendor/Package.19.cjs +0 -37
  152. package/vendor/Package.19.mjs +0 -35
  153. package/vendor/Package.20.cjs +0 -37
  154. package/vendor/Package.20.mjs +0 -35
  155. package/vendor/Package.21.cjs +0 -37
  156. package/vendor/Package.21.mjs +0 -35
  157. package/vendor/Package.22.cjs +0 -37
  158. package/vendor/Package.22.mjs +0 -35
  159. package/vendor/Package.23.cjs +0 -37
  160. package/vendor/Package.23.mjs +0 -35
  161. package/vendor/Package.24.cjs +0 -37
  162. package/vendor/Package.24.mjs +0 -35
  163. package/vendor/Package.25.cjs +0 -37
  164. package/vendor/Package.25.mjs +0 -35
  165. package/vendor/Package.26.cjs +0 -37
  166. package/vendor/Package.26.mjs +0 -35
  167. package/vendor/Package.27.cjs +0 -37
  168. package/vendor/Package.27.mjs +0 -35
  169. package/vendor/Package.28.cjs +0 -37
  170. package/vendor/Package.28.mjs +0 -35
  171. package/vendor/Package.29.cjs +0 -40
  172. package/vendor/Package.29.mjs +0 -38
  173. package/vendor/Package.30.cjs +0 -41
  174. package/vendor/Package.30.mjs +0 -39
  175. package/vendor/Package.31.cjs +0 -72
  176. package/vendor/Package.31.mjs +0 -70
  177. package/vendor/Package.32.cjs +0 -37
  178. package/vendor/Package.32.mjs +0 -35
  179. package/vendor/Package.33.cjs +0 -37
  180. package/vendor/Package.33.mjs +0 -35
  181. package/vendor/Package.34.cjs +0 -46
  182. package/vendor/Package.34.mjs +0 -44
  183. package/vendor/Package.35.cjs +0 -34
  184. package/vendor/Package.35.mjs +0 -32
  185. package/vendor/Package.36.cjs +0 -40
  186. package/vendor/Package.36.mjs +0 -38
  187. package/vendor/Package.37.cjs +0 -36
  188. package/vendor/Package.37.mjs +0 -34
  189. package/vendor/Package.38.cjs +0 -52
  190. package/vendor/Package.38.mjs +0 -50
  191. package/vendor/Package.39.cjs +0 -41
  192. package/vendor/Package.39.mjs +0 -39
  193. package/vendor/Package.40.cjs +0 -42
  194. package/vendor/Package.40.mjs +0 -40
  195. package/vendor/Package.41.cjs +0 -53
  196. package/vendor/Package.41.mjs +0 -51
  197. package/vendor/Package.42.cjs +0 -53
  198. package/vendor/Package.42.mjs +0 -51
  199. package/vendor/Package.43.cjs +0 -40
  200. package/vendor/Package.43.mjs +0 -38
  201. package/vendor/Package.44.cjs +0 -46
  202. package/vendor/Package.44.mjs +0 -44
  203. package/vendor/Package.45.cjs +0 -53
  204. package/vendor/Package.45.mjs +0 -51
  205. package/vendor/Package.46.cjs +0 -59
  206. package/vendor/Package.46.mjs +0 -57
  207. package/vendor/Package.47.cjs +0 -65
  208. package/vendor/Package.47.mjs +0 -63
  209. package/vendor/Package.48.cjs +0 -38
  210. package/vendor/Package.48.mjs +0 -36
  211. package/vendor/Package.49.cjs +0 -38
  212. package/vendor/Package.49.mjs +0 -36
  213. package/vendor/Package.50.cjs +0 -36
  214. package/vendor/Package.50.mjs +0 -34
  215. package/vendor/Package.51.cjs +0 -43
  216. package/vendor/Package.51.mjs +0 -41
  217. package/vendor/Package.52.cjs +0 -37
  218. package/vendor/Package.52.mjs +0 -35
  219. package/vendor/Package.53.cjs +0 -43
  220. package/vendor/Package.53.mjs +0 -41
  221. package/vendor/Package.54.cjs +0 -55
  222. package/vendor/Package.54.mjs +0 -53
  223. package/vendor/Package.55.cjs +0 -37
  224. package/vendor/Package.55.mjs +0 -35
  225. package/vendor/Package.56.cjs +0 -37
  226. package/vendor/Package.56.mjs +0 -35
  227. package/vendor/Package.57.cjs +0 -37
  228. package/vendor/Package.57.mjs +0 -35
  229. package/vendor/Package.58.cjs +0 -45
  230. package/vendor/Package.58.mjs +0 -43
  231. package/vendor/Package.59.cjs +0 -53
  232. package/vendor/Package.59.mjs +0 -51
  233. package/vendor/Package.60.cjs +0 -47649
  234. package/vendor/Package.60.mjs +0 -47606
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lakutata",
3
- "version": "2.0.81",
3
+ "version": "2.0.83",
4
4
  "description": "An IoC-based universal application framework.",
5
5
  "exports": {
6
6
  ".": {
@@ -334,269 +334,260 @@ function D() {
334
334
  return O;
335
335
  }
336
336
 
337
- var b;
338
-
339
- function j() {
340
- if (b) return _;
341
- b = 1;
342
- (function(e) {
343
- "use strict";
344
- Object.defineProperty(e, "__esModule", {
345
- value: true
346
- });
347
- e.KeyvFile = e.defaultOpts = void 0;
348
- const t = r.require$$0;
349
- const i = t.__importStar(f.default);
350
- const s = t.__importStar(p.default);
351
- const a = t.__importStar(h.default);
352
- const n = t.__importDefault(y.default);
353
- const o = m();
354
- const l = t.__importDefault(d.default);
355
- const c = E();
356
- t.__exportStar(D(), e);
357
- e.defaultOpts = {
358
- deserialize: e => (0, o.defaultDeserialize)(e.toString()),
359
- dialect: "redis",
360
- expiredCheckDelay: 24 * 3600 * 1e3,
361
- filename: `${i.tmpdir()}/keyv-file/default.json`,
362
- serialize: o.defaultSerialize,
363
- writeDelay: 100,
364
- checkFileLock: false,
365
- separatedFile: false
366
- };
367
- function u(e) {
368
- return typeof e === "number";
369
- }
370
- class KeyvFile extends n.default {
371
- ttlSupport=true;
372
- namespace;
373
- opts;
374
- _data=new Map;
375
- _lastExpire=0;
376
- _separated;
377
- constructor(t) {
378
- super();
379
- this.opts = Object.assign({}, e.defaultOpts, t);
380
- this._separated = new c.SeparatedFileHelper(this.opts);
381
- if (this.opts.checkFileLock) {
382
- this.acquireFileLock();
383
- }
384
- if (this.opts.separatedFile) {
385
- s.mkdirSync(this.opts.filename, {
386
- recursive: true
387
- });
388
- this._lastExpire = this._separated.getLastExpire();
389
- } else {
390
- this._loadDataSync();
391
- }
337
+ (function(e) {
338
+ "use strict";
339
+ Object.defineProperty(e, "__esModule", {
340
+ value: true
341
+ });
342
+ e.KeyvFile = e.defaultOpts = void 0;
343
+ const t = r.require$$0;
344
+ const i = t.__importStar(f.default);
345
+ const s = t.__importStar(p.default);
346
+ const a = t.__importStar(h.default);
347
+ const n = t.__importDefault(y.default);
348
+ const o = m();
349
+ const l = t.__importDefault(d.default);
350
+ const c = E();
351
+ t.__exportStar(D(), e);
352
+ e.defaultOpts = {
353
+ deserialize: e => (0, o.defaultDeserialize)(e.toString()),
354
+ dialect: "redis",
355
+ expiredCheckDelay: 24 * 3600 * 1e3,
356
+ filename: `${i.tmpdir()}/keyv-file/default.json`,
357
+ serialize: o.defaultSerialize,
358
+ writeDelay: 100,
359
+ checkFileLock: false,
360
+ separatedFile: false
361
+ };
362
+ function u(e) {
363
+ return typeof e === "number";
364
+ }
365
+ class KeyvFile extends n.default {
366
+ ttlSupport=true;
367
+ namespace;
368
+ opts;
369
+ _data=new Map;
370
+ _lastExpire=0;
371
+ _separated;
372
+ constructor(t) {
373
+ super();
374
+ this.opts = Object.assign({}, e.defaultOpts, t);
375
+ this._separated = new c.SeparatedFileHelper(this.opts);
376
+ if (this.opts.checkFileLock) {
377
+ this.acquireFileLock();
378
+ }
379
+ if (this.opts.separatedFile) {
380
+ s.mkdirSync(this.opts.filename, {
381
+ recursive: true
382
+ });
383
+ this._lastExpire = this._separated.getLastExpire();
384
+ } else {
385
+ this._loadDataSync();
392
386
  }
393
- _loadDataSync() {
394
- try {
395
- const e = this.opts.deserialize(s.readFileSync(this.opts.filename));
396
- if (!Array.isArray(e.cache)) {
397
- const t = e.cache;
398
- e.cache = [];
399
- for (const r in t) {
400
- if (t.hasOwnProperty(r)) {
401
- e.cache.push([ r, t[r] ]);
402
- }
387
+ }
388
+ _loadDataSync() {
389
+ try {
390
+ const e = this.opts.deserialize(s.readFileSync(this.opts.filename));
391
+ if (!Array.isArray(e.cache)) {
392
+ const t = e.cache;
393
+ e.cache = [];
394
+ for (const r in t) {
395
+ if (t.hasOwnProperty(r)) {
396
+ e.cache.push([ r, t[r] ]);
403
397
  }
404
398
  }
405
- this._data = new Map(e.cache);
406
- this._lastExpire = e.lastExpire;
407
- } catch (e) {
408
- (0, c.handleIOError)(e);
409
- this._data = new Map;
410
- this._lastExpire = Date.now();
411
399
  }
400
+ this._data = new Map(e.cache);
401
+ this._lastExpire = e.lastExpire;
402
+ } catch (e) {
403
+ (0, c.handleIOError)(e);
404
+ this._data = new Map;
405
+ this._lastExpire = Date.now();
412
406
  }
413
- get _lockFile() {
414
- if (this.opts.separatedFile) {
415
- return this._separated.lockFile;
416
- }
417
- return this.opts.filename + ".lock";
418
- }
419
- acquireFileLock() {
420
- try {
421
- let e = s.openSync(this._lockFile, "wx");
422
- s.closeSync(e);
423
- process.on("SIGINT", (() => {
424
- this.releaseFileLock();
425
- process.exit(0);
426
- }));
427
- process.on("exit", (() => {
428
- this.releaseFileLock();
429
- }));
430
- } catch (e) {
431
- console.error(`[keyv-file] There is another process using this file`);
432
- throw e;
433
- }
407
+ }
408
+ get _lockFile() {
409
+ if (this.opts.separatedFile) {
410
+ return this._separated.lockFile;
434
411
  }
435
- releaseFileLock() {
436
- try {
437
- s.unlinkSync(this._lockFile);
438
- } catch (e) {
439
- (0, c.handleIOError)(e);
440
- }
412
+ return this.opts.filename + ".lock";
413
+ }
414
+ acquireFileLock() {
415
+ try {
416
+ let e = s.openSync(this._lockFile, "wx");
417
+ s.closeSync(e);
418
+ process.on("SIGINT", (() => {
419
+ this.releaseFileLock();
420
+ process.exit(0);
421
+ }));
422
+ process.on("exit", (() => {
423
+ this.releaseFileLock();
424
+ }));
425
+ } catch (e) {
426
+ console.error(`[keyv-file] There is another process using this file`);
427
+ throw e;
441
428
  }
442
- async get(e) {
443
- if (this.opts.separatedFile) {
444
- let t = await this._separated.get(e);
445
- return this._getWithExpire(e, t);
446
- }
447
- return this.getSync(e);
429
+ }
430
+ releaseFileLock() {
431
+ try {
432
+ s.unlinkSync(this._lockFile);
433
+ } catch (e) {
434
+ (0, c.handleIOError)(e);
448
435
  }
449
- getSync(e) {
450
- if (this.opts.separatedFile) {
451
- let t = this._separated.getSync(e);
452
- return this._getWithExpire(e, t);
453
- }
454
- let t = void 0;
455
- try {
456
- const t = this._data.get(e);
457
- return this._getWithExpire(e, t);
458
- } catch (e) {
459
- (0, c.handleIOError)(e);
460
- }
461
- return t;
436
+ }
437
+ async get(e) {
438
+ if (this.opts.separatedFile) {
439
+ let t = await this._separated.get(e);
440
+ return this._getWithExpire(e, t);
462
441
  }
463
- async getMany(e) {
464
- if (this.opts.separatedFile) {
465
- return Promise.all(e.map((e => this.get(e))));
466
- }
467
- return e.map((e => this.getSync(e)));
442
+ return this.getSync(e);
443
+ }
444
+ getSync(e) {
445
+ if (this.opts.separatedFile) {
446
+ let t = this._separated.getSync(e);
447
+ return this._getWithExpire(e, t);
468
448
  }
469
- async set(e, t, r) {
470
- if (r === 0) {
471
- r = undefined;
472
- }
473
- t = {
474
- expire: u(r) ? Date.now() + r : undefined,
475
- value: t
476
- };
477
- this.clearExpire();
478
- if (this.opts.separatedFile) {
479
- return this._separated.set(e, t);
480
- }
481
- this._data.set(e, t);
482
- return this.save();
449
+ let t = void 0;
450
+ try {
451
+ const t = this._data.get(e);
452
+ return this._getWithExpire(e, t);
453
+ } catch (e) {
454
+ (0, c.handleIOError)(e);
483
455
  }
484
- async delete(e) {
485
- if (this.opts.separatedFile) {
486
- return this._separated.delete(e);
487
- }
488
- const t = this._data.delete(e);
489
- await this.save();
490
- return t;
491
- }
492
- async deleteMany(e) {
493
- if (this.opts.separatedFile) {
494
- let t = await Promise.all(e.map((e => this.delete(e))));
495
- return t.every((e => e));
496
- }
497
- let t = e.every((e => this._data.delete(e)));
498
- await this.save();
499
- return t;
500
- }
501
- async clear() {
502
- if (this.opts.separatedFile) {
503
- await this._separated.clear();
504
- this._lastExpire = 0;
505
- return true;
506
- }
507
- this._data = new Map;
508
- this._lastExpire = Date.now();
509
- return this.save();
456
+ return t;
457
+ }
458
+ async getMany(e) {
459
+ if (this.opts.separatedFile) {
460
+ return Promise.all(e.map((e => this.get(e))));
510
461
  }
511
- async has(e) {
512
- const t = await this.get(e);
513
- return t !== undefined;
462
+ return e.map((e => this.getSync(e)));
463
+ }
464
+ async set(e, t, r) {
465
+ if (r === 0) {
466
+ r = undefined;
514
467
  }
515
- isExpired(e) {
516
- return u(e.expire) && e.expire <= Date.now();
468
+ t = {
469
+ expire: u(r) ? Date.now() + r : undefined,
470
+ value: t
471
+ };
472
+ this.clearExpire();
473
+ if (this.opts.separatedFile) {
474
+ return this._separated.set(e, t);
517
475
  }
518
- _getWithExpire(e, t) {
519
- if (!t) {
520
- return;
521
- }
522
- if (this.isExpired(t)) {
523
- this.delete(e);
524
- return;
525
- }
526
- return t.value;
476
+ this._data.set(e, t);
477
+ return this.save();
478
+ }
479
+ async delete(e) {
480
+ if (this.opts.separatedFile) {
481
+ return this._separated.delete(e);
527
482
  }
528
- clearExpire() {
529
- const e = Date.now();
530
- if (e - this._lastExpire <= this.opts.expiredCheckDelay) {
531
- return;
532
- }
533
- this._lastExpire = e;
534
- if (this.opts.separatedFile) {
535
- this._separated.clearExpire((e => this.get(e)));
536
- return;
537
- }
538
- for (const e of this._data.keys()) {
539
- const t = this._data.get(e);
540
- this._getWithExpire(e, t);
541
- }
483
+ const t = this._data.delete(e);
484
+ await this.save();
485
+ return t;
486
+ }
487
+ async deleteMany(e) {
488
+ if (this.opts.separatedFile) {
489
+ let t = await Promise.all(e.map((e => this.delete(e))));
490
+ return t.every((e => e));
542
491
  }
543
- async saveToDisk() {
544
- const e = [];
545
- for (const [t, r] of this._data) {
546
- e.push([ t, r ]);
547
- }
548
- const t = this.opts.serialize({
549
- cache: e,
550
- lastExpire: this._lastExpire
551
- });
552
- await a.mkdir(l.default.dirname(this.opts.filename), {
553
- recursive: true
554
- });
555
- return a.writeFile(this.opts.filename, t);
492
+ let t = e.every((e => this._data.delete(e)));
493
+ await this.save();
494
+ return t;
495
+ }
496
+ async clear() {
497
+ if (this.opts.separatedFile) {
498
+ await this._separated.clear();
499
+ this._lastExpire = 0;
500
+ return true;
556
501
  }
557
- _savePromise;
558
- save() {
559
- this.clearExpire();
560
- if (this._savePromise) {
561
- return this._savePromise;
562
- }
563
- this._savePromise = new Promise(((e, t) => {
564
- setTimeout((() => {
565
- this.saveToDisk().then(e, t).finally((() => {
566
- this._savePromise = void 0;
567
- }));
568
- }), this.opts.writeDelay);
569
- }));
570
- return this._savePromise;
502
+ this._data = new Map;
503
+ this._lastExpire = Date.now();
504
+ return this.save();
505
+ }
506
+ async has(e) {
507
+ const t = await this.get(e);
508
+ return t !== undefined;
509
+ }
510
+ isExpired(e) {
511
+ return u(e.expire) && e.expire <= Date.now();
512
+ }
513
+ _getWithExpire(e, t) {
514
+ if (!t) {
515
+ return;
571
516
  }
572
- disconnect() {
573
- return Promise.resolve();
517
+ if (this.isExpired(t)) {
518
+ this.delete(e);
519
+ return;
574
520
  }
575
- async* iterator(e) {
576
- let t = this.opts.separatedFile ? await this._separated.entries() : this._data.entries();
577
- for (const [r, i] of t) {
578
- if (r === undefined || i === undefined) {
579
- continue;
580
- }
581
- if (!e || r.includes(e)) {
582
- yield [ r, i.value ];
583
- }
521
+ return t.value;
522
+ }
523
+ clearExpire() {
524
+ const e = Date.now();
525
+ if (e - this._lastExpire <= this.opts.expiredCheckDelay) {
526
+ return;
527
+ }
528
+ this._lastExpire = e;
529
+ if (this.opts.separatedFile) {
530
+ this._separated.clearExpire((e => this.get(e)));
531
+ return;
532
+ }
533
+ for (const e of this._data.keys()) {
534
+ const t = this._data.get(e);
535
+ this._getWithExpire(e, t);
536
+ }
537
+ }
538
+ async saveToDisk() {
539
+ const e = [];
540
+ for (const [t, r] of this._data) {
541
+ e.push([ t, r ]);
542
+ }
543
+ const t = this.opts.serialize({
544
+ cache: e,
545
+ lastExpire: this._lastExpire
546
+ });
547
+ await a.mkdir(l.default.dirname(this.opts.filename), {
548
+ recursive: true
549
+ });
550
+ return a.writeFile(this.opts.filename, t);
551
+ }
552
+ _savePromise;
553
+ save() {
554
+ this.clearExpire();
555
+ if (this._savePromise) {
556
+ return this._savePromise;
557
+ }
558
+ this._savePromise = new Promise(((e, t) => {
559
+ setTimeout((() => {
560
+ this.saveToDisk().then(e, t).finally((() => {
561
+ this._savePromise = void 0;
562
+ }));
563
+ }), this.opts.writeDelay);
564
+ }));
565
+ return this._savePromise;
566
+ }
567
+ disconnect() {
568
+ return Promise.resolve();
569
+ }
570
+ async* iterator(e) {
571
+ let t = this.opts.separatedFile ? await this._separated.entries() : this._data.entries();
572
+ for (const [r, i] of t) {
573
+ if (r === undefined || i === undefined) {
574
+ continue;
575
+ }
576
+ if (!e || r.includes(e)) {
577
+ yield [ r, i.value ];
584
578
  }
585
579
  }
586
580
  }
587
- e.KeyvFile = KeyvFile;
588
- e.default = KeyvFile;
589
- })(_);
590
- return _;
591
- }
592
-
593
- var q = j();
581
+ }
582
+ e.KeyvFile = KeyvFile;
583
+ e.default = KeyvFile;
584
+ })(_);
594
585
 
595
- const z = t.getDefaultExportFromCjs(q);
586
+ const b = t.getDefaultExportFromCjs(_);
596
587
 
597
- async function M(t) {
588
+ async function j(t) {
598
589
  return new e.index_default({
599
- store: new q.KeyvFile({
590
+ store: new _.KeyvFile({
600
591
  filename: t.filename,
601
592
  expiredCheckDelay: t.expiredCheckDelay,
602
593
  writeDelay: t.writeDelay
@@ -605,4 +596,4 @@ async function M(t) {
605
596
  });
606
597
  }
607
598
 
608
- exports.CreateFileCacheAdapter = M;
599
+ exports.CreateFileCacheAdapter = j;