limited-cache 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +17 -4
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/dist/{index.cjs → cjs/index.cjs} +22 -7
  5. package/dist/cjs/index.d.cts +92 -0
  6. package/dist/{core → esm/core}/LimitedCache.d.ts +1 -1
  7. package/dist/esm/core/LimitedCache.d.ts.map +1 -0
  8. package/dist/{core → esm/core}/LimitedCache.js +1 -1
  9. package/dist/esm/core/LimitedCache.js.map +1 -0
  10. package/dist/{core → esm/core}/LimitedCacheObject.d.ts +1 -1
  11. package/dist/esm/core/LimitedCacheObject.d.ts.map +1 -0
  12. package/dist/{core → esm/core}/LimitedCacheObject.js +2 -2
  13. package/dist/esm/core/LimitedCacheObject.js.map +1 -0
  14. package/dist/esm/core/builtIns.d.ts.map +1 -0
  15. package/dist/esm/core/builtIns.js.map +1 -0
  16. package/dist/{core → esm/core}/defaultOptions.d.ts +1 -1
  17. package/dist/esm/core/defaultOptions.d.ts.map +1 -0
  18. package/dist/esm/core/defaultOptions.js.map +1 -0
  19. package/dist/esm/core/limitedCacheUtil.d.ts +13 -0
  20. package/dist/esm/core/limitedCacheUtil.d.ts.map +1 -0
  21. package/dist/{core → esm/core}/limitedCacheUtil.js +1 -1
  22. package/dist/esm/core/limitedCacheUtil.js.map +1 -0
  23. package/dist/{core → esm/core}/lowLevelFunctions.d.ts +1 -1
  24. package/dist/esm/core/lowLevelFunctions.d.ts.map +1 -0
  25. package/dist/{core → esm/core}/lowLevelFunctions.js +2 -2
  26. package/dist/esm/core/lowLevelFunctions.js.map +1 -0
  27. package/dist/esm/index.d.ts +7 -0
  28. package/dist/esm/index.d.ts.map +1 -0
  29. package/dist/esm/index.js +7 -0
  30. package/dist/esm/index.js.map +1 -0
  31. package/dist/esm/types.d.ts.map +1 -0
  32. package/dist/esm/types.js.map +1 -0
  33. package/legacy-types/ts3.5/dist/esm/core/LimitedCache.d.ts +4 -0
  34. package/legacy-types/ts3.5/dist/esm/core/LimitedCacheObject.d.ts +5 -0
  35. package/legacy-types/ts3.5/dist/esm/core/builtIns.d.ts +12 -0
  36. package/legacy-types/ts3.5/dist/esm/core/defaultOptions.d.ts +6 -0
  37. package/legacy-types/ts3.5/dist/esm/core/limitedCacheUtil.d.ts +13 -0
  38. package/legacy-types/ts3.5/dist/esm/core/lowLevelFunctions.d.ts +14 -0
  39. package/legacy-types/ts3.5/dist/esm/index.d.ts +7 -0
  40. package/legacy-types/ts3.5/dist/esm/types.d.ts +61 -0
  41. package/legacy-types/ts4.0/dist/esm/core/LimitedCache.d.ts +4 -0
  42. package/legacy-types/ts4.0/dist/esm/core/LimitedCacheObject.d.ts +5 -0
  43. package/legacy-types/ts4.0/dist/esm/core/builtIns.d.ts +12 -0
  44. package/legacy-types/ts4.0/dist/esm/core/defaultOptions.d.ts +6 -0
  45. package/legacy-types/ts4.0/dist/esm/core/limitedCacheUtil.d.ts +13 -0
  46. package/legacy-types/ts4.0/dist/esm/core/lowLevelFunctions.d.ts +14 -0
  47. package/legacy-types/ts4.0/dist/esm/index.d.ts +7 -0
  48. package/legacy-types/ts4.0/dist/esm/types.d.ts +61 -0
  49. package/legacy-types/ts4.5/dist/esm/core/LimitedCache.d.ts +4 -0
  50. package/legacy-types/ts4.5/dist/esm/core/LimitedCacheObject.d.ts +5 -0
  51. package/legacy-types/ts4.5/dist/esm/core/builtIns.d.ts +12 -0
  52. package/legacy-types/ts4.5/dist/esm/core/defaultOptions.d.ts +6 -0
  53. package/legacy-types/ts4.5/dist/esm/core/limitedCacheUtil.d.ts +13 -0
  54. package/legacy-types/ts4.5/dist/esm/core/lowLevelFunctions.d.ts +14 -0
  55. package/legacy-types/ts4.5/dist/esm/index.d.ts +7 -0
  56. package/legacy-types/ts4.5/dist/esm/types.d.ts +61 -0
  57. package/package.json +40 -38
  58. package/src/__tests__/LimitedCache.test.ts +3 -3
  59. package/src/__tests__/LimitedCacheObject.test.ts +3 -3
  60. package/src/__tests__/lowLevelFunctions.test.ts +3 -3
  61. package/src/__tests__/scenarios/keys.test.ts +1 -1
  62. package/src/__tests__/scenarios/maxCacheSize.test.ts +1 -1
  63. package/src/__tests__/scenarios/maxCacheTime.test.ts +1 -1
  64. package/src/__tests__/scenarios/values.test.ts +1 -1
  65. package/src/__tests__/typeChecks/LimitedCacheObjectTypes.test.ts +1 -1
  66. package/src/__tests__/typeChecks/LimitedCacheTypes.test.ts +1 -1
  67. package/src/__tests__/typeChecks/lowLevelFunctionsTypes.test.ts +1 -1
  68. package/src/core/LimitedCache.ts +2 -2
  69. package/src/core/LimitedCacheObject.ts +3 -3
  70. package/src/core/defaultOptions.ts +1 -1
  71. package/src/core/limitedCacheUtil.ts +1 -1
  72. package/src/core/lowLevelFunctions.ts +3 -3
  73. package/src/index.ts +6 -6
  74. package/dist/core/LimitedCache.d.ts.map +0 -1
  75. package/dist/core/LimitedCache.js.map +0 -1
  76. package/dist/core/LimitedCacheObject.d.ts.map +0 -1
  77. package/dist/core/LimitedCacheObject.js.map +0 -1
  78. package/dist/core/builtIns.d.ts.map +0 -1
  79. package/dist/core/builtIns.js.map +0 -1
  80. package/dist/core/defaultOptions.d.ts.map +0 -1
  81. package/dist/core/defaultOptions.js.map +0 -1
  82. package/dist/core/limitedCacheUtil.d.ts +0 -13
  83. package/dist/core/limitedCacheUtil.d.ts.map +0 -1
  84. package/dist/core/limitedCacheUtil.js.map +0 -1
  85. package/dist/core/lowLevelFunctions.d.ts.map +0 -1
  86. package/dist/core/lowLevelFunctions.js.map +0 -1
  87. package/dist/index.d.ts +0 -7
  88. package/dist/index.d.ts.map +0 -1
  89. package/dist/index.js +0 -7
  90. package/dist/index.js.map +0 -1
  91. package/dist/types.d.ts.map +0 -1
  92. package/dist/types.js.map +0 -1
  93. /package/dist/{core → esm/core}/builtIns.d.ts +0 -0
  94. /package/dist/{core → esm/core}/builtIns.js +0 -0
  95. /package/dist/{core → esm/core}/defaultOptions.js +0 -0
  96. /package/dist/{types.d.ts → esm/types.d.ts} +0 -0
  97. /package/dist/{types.js → esm/types.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,12 +1,25 @@
1
1
  # Changelog
2
2
 
3
- ## 2.1.0
3
+ ## 2.2.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - Update and modernize package build ([#56](https://github.com/spautz/package-template/issues/56)) ([5f210a6](https://github.com/spautz/package-template/commit/5f210a6a5f77cdffe73f004ea4574f4e791e5029))
8
- - Add NPM provenance via Github actions ([#56](https://github.com/spautz/package-template/issues/56)) ([5f210a6](https://github.com/spautz/package-template/commit/5f210a6a5f77cdffe73f004ea4574f4e791e5029))
9
- - Confirm support for Node 20 ([#56](https://github.com/spautz/package-template/issues/56)) ([5f210a6](https://github.com/spautz/package-template/commit/5f210a6a5f77cdffe73f004ea4574f4e791e5029))
7
+ - Update devDependencies and build system. No functional changes expected from this ([#68](https://github.com/spautz/limited-cache/issues/68)) ([05da16b](https://github.com/spautz/limited-cache/commit/05da16b9b97eb413b186334141b255ee4a03b687))
8
+ - Add support for bundler moduleResolution ([#68](https://github.com/spautz/limited-cache/issues/68)) ([05da16b](https://github.com/spautz/limited-cache/commit/05da16b9b97eb413b186334141b255ee4a03b687))
9
+
10
+ ## 2.1.1
11
+
12
+ ### Patch Changes
13
+
14
+ - Add .js extensions to imports, to satisfy nodenext moduleResolution ([#60](https://github.com/spautz/limited-cache/issues/60)) ([2f2f679](https://github.com/spautz/limited-cache/commit/2f2f67995be0ef737e2ef191dd5180b735054fe0))
15
+
16
+ ## [2.1.0](https://github.com/spautz/limited-cache/compare/v2.0.0...v2.1.0) (2023-04-30)
17
+
18
+ ### Minor Changes
19
+
20
+ - Update and modernize package build ([#56](https://github.com/spautz/limited-cache/issues/56)) ([5f210a6](https://github.com/spautz/limited-cache/commit/5f210a6a5f77cdffe73f004ea4574f4e791e5029))
21
+ - Add NPM provenance via Github actions ([#56](https://github.com/spautz/limited-cache/issues/56)) ([5f210a6](https://github.com/spautz/limited-cache/commit/5f210a6a5f77cdffe73f004ea4574f4e791e5029))
22
+ - Confirm support for Node 20 ([#56](https://github.com/spautz/limited-cache/issues/56)) ([5f210a6](https://github.com/spautz/limited-cache/commit/5f210a6a5f77cdffe73f004ea4574f4e791e5029))
10
23
 
11
24
  ## [2.0.0](https://github.com/spautz/limited-cache/compare/v1.1.1...v2.0.0) (2021-10-23)
12
25
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Steven Pautz
3
+ Copyright (c) 2019 Steven Pautz
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -6,7 +6,7 @@ A minimal JS cache. Like using an object to store keys and values, except it won
6
6
  [![build status](https://github.com/spautz/limited-cache/workflows/CI/badge.svg)](https://github.com/spautz/limited-cache/actions)
7
7
  [![test coverage](https://img.shields.io/coveralls/github/spautz/limited-cache/main.svg)](https://coveralls.io/github/spautz/limited-cache?branch=main)
8
8
  [![dependencies status](https://img.shields.io/librariesio/release/npm/limited-cache.svg)](https://libraries.io/github/spautz/limited-cache)
9
- [![gzip size](https://img.badgesize.io/https://unpkg.com/limited-cache@latest/dist/index.cjs?compression=gzip)](https://bundlephobia.com/result?p=limited-cache)
9
+ [![gzip size](https://img.shields.io/bundlephobia/minzip/limited-cache.svg)](https://bundlephobia.com/package/limited-cache@latest)
10
10
 
11
11
  ## Motivation
12
12
 
@@ -1,8 +1,25 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6
23
  var __export = (target, all) => {
7
24
  for (var name in all)
8
25
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -101,7 +118,7 @@ var lowLevelInit = (optionsOrCacheMeta) => {
101
118
  upgradeCacheMeta(existingCacheMeta);
102
119
  return existingCacheMeta;
103
120
  }
104
- const fullOptions = normalizeOptions({ ...defaultOptions, ...optionsOrCacheMeta });
121
+ const fullOptions = normalizeOptions(__spreadValues(__spreadValues({}, defaultOptions), optionsOrCacheMeta));
105
122
  const newCacheMeta = lowLevelReset({
106
123
  limitedCacheMetaVersion: CURRENT_META_VERSION,
107
124
  options: fullOptions
@@ -240,10 +257,9 @@ var lowLevelSet = (cacheMeta, cacheKey, item) => {
240
257
  const now = dateNow();
241
258
  const isNew = !keyInfo[cacheKey];
242
259
  if (cacheMeta.cache[cacheKey] !== item) {
243
- cacheMeta.cache = {
244
- ...cacheMeta.cache,
260
+ cacheMeta.cache = __spreadProps(__spreadValues({}, cacheMeta.cache), {
245
261
  [cacheKey]: item
246
- };
262
+ });
247
263
  }
248
264
  keyInfo[cacheKey] = [now, 0];
249
265
  if (isNew) {
@@ -266,10 +282,9 @@ var lowLevelRemove = (cacheMeta, cacheKey) => {
266
282
  const { cache, keyInfo } = cacheMeta;
267
283
  if (keyInfo[cacheKey]) {
268
284
  if (cache[cacheKey] !== void 0) {
269
- cacheMeta.cache = {
270
- ...cache,
285
+ cacheMeta.cache = __spreadProps(__spreadValues({}, cache), {
271
286
  [cacheKey]: void 0
272
- };
287
+ });
273
288
  }
274
289
  keyInfo[cacheKey] = void 0;
275
290
  }
@@ -0,0 +1,92 @@
1
+ type DefaultItemType = any;
2
+ interface LimitedCacheOptionsFull {
3
+ /** Items will be removed to keep the cache within the maxCacheSize limit */
4
+ maxCacheSize: number;
5
+ /** Items will be removed and never returned if they were set more than maxCacheTime milliseconds ago */
6
+ maxCacheTime: number;
7
+ /** (dev only) A warning will be emitted if an item rotates out of the cache before this many milliseconds have passed, to indicate the size is too small */
8
+ warnIfItemPurgedBeforeTime: number;
9
+ /** (private) Internal cleanup of old keys will be performed after this many operations */
10
+ opLimit: number;
11
+ /** (private) Internal optimization to adjust how much searching will be done to find expired items, to avoid being O(n) */
12
+ scanLimit: number;
13
+ }
14
+ type LimitedCacheOptions = Partial<LimitedCacheOptionsFull> | null;
15
+ type LimitedCacheOptionsReadonly = Readonly<LimitedCacheOptionsFull>;
16
+ interface LimitedCacheInstance<ItemType = DefaultItemType> {
17
+ /** Return the requested item, if it has not expired */
18
+ get: (cacheKey: string) => ItemType | undefined;
19
+ /** Return all non-expired items */
20
+ getAll: () => Record<string, ItemType>;
21
+ /** Indicate whether or not the requested item is present and has not expired */
22
+ has: (cacheKey: string) => boolean;
23
+ /** Add the item to the cache, or update its timestamp if it already exists */
24
+ set: (cacheKey: string, item: ItemType) => ItemType;
25
+ /** Remove the requested item from the cache, if necessary */
26
+ remove: (cacheKey: string) => true;
27
+ /** Remove all items and all timestamps from the cache */
28
+ reset: () => LimitedCacheMeta<ItemType>;
29
+ /** Return a serializable representation of the cache internals, suitable for long-term storage */
30
+ getCacheMeta: () => LimitedCacheMeta<ItemType>;
31
+ /** Return the cache's current values for all options */
32
+ getOptions: () => LimitedCacheOptionsFull;
33
+ /** Update one or more of the cache's options */
34
+ setOptions: (newOptions: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
35
+ /** Reduces cache size by cleaning up old keys and expired items */
36
+ doMaintenance: () => LimitedCacheMeta<ItemType>;
37
+ }
38
+ interface LimitedCacheObjectInstance<ItemType = DefaultItemType> {
39
+ [key: string]: ItemType;
40
+ }
41
+ /**
42
+ * A serializable representation of the cache internals, suitable for long-term storage
43
+ */
44
+ interface LimitedCacheMeta<ItemType = DefaultItemType> {
45
+ /** Schema version: old versions will be upgraded if possible, or a warning will be emitted if not */
46
+ limitedCacheMetaVersion: number;
47
+ /** Options to control cache size, time, and behavior */
48
+ options: LimitedCacheOptionsReadonly;
49
+ /** The values in the cache, stored by key. Will include old keys not yet garbage collected */
50
+ cache: Record<string, ItemType | undefined>;
51
+ /** List of keys that have been set, in chronological order. Used to find cache items most likely to be expired */
52
+ keyList: Array<string>;
53
+ /** The [setTime, expirationTime] for each key that has been set. Removed on unset. */
54
+ keyInfo: Record<string, [number, number] | undefined>;
55
+ /** Number of operations remaining until internal cleanup of old keys is performed. Based on options.opLimit */
56
+ opsLeft: number;
57
+ }
58
+
59
+ declare const CURRENT_META_VERSION = 2;
60
+ declare const MAXIMUM_CACHE_TIME: number;
61
+ declare const defaultOptions: LimitedCacheOptionsReadonly;
62
+
63
+ declare const LimitedCache: <ItemType = any>(options?: LimitedCacheOptions) => LimitedCacheInstance<ItemType>;
64
+
65
+ declare const LimitedCacheObject: <ItemType = any>(options?: LimitedCacheOptions) => LimitedCacheObjectInstance<ItemType>;
66
+ declare const getCacheMetaFromObject: (instance: LimitedCacheObjectInstance) => LimitedCacheMeta;
67
+
68
+ declare const limitedCacheUtil: {
69
+ init: <ItemType = any>(optionsOrCacheMeta?: LimitedCacheOptions | LimitedCacheMeta<ItemType> | undefined) => LimitedCacheMeta<ItemType>;
70
+ get: <ItemType_1 = any>(cacheMeta: LimitedCacheMeta<ItemType_1>, cacheKey: string) => ItemType_1 | undefined;
71
+ getAll: <ItemType_2 = any>(cacheMeta: LimitedCacheMeta<ItemType_2>) => Record<string, ItemType_2>;
72
+ has: <ItemType_3 = any>(cacheMeta: LimitedCacheMeta<ItemType_3>, cacheKey: string) => boolean;
73
+ set: <ItemType_4 = any>(cacheMeta: LimitedCacheMeta<ItemType_4>, cacheKey: string, item: ItemType_4) => LimitedCacheMeta<ItemType_4>;
74
+ remove: <ItemType_5 = any>(cacheMeta: LimitedCacheMeta<ItemType_5>, cacheKey: string) => LimitedCacheMeta<ItemType_5>;
75
+ reset: <ItemType_6 = any>(cacheMeta: LimitedCacheMeta<ItemType_6>) => LimitedCacheMeta<ItemType_6>;
76
+ doMaintenance: <ItemType_7 = any>(cacheMeta: LimitedCacheMeta<ItemType_7>) => LimitedCacheMeta<ItemType_7>;
77
+ setOptions: <ItemType_8 = any>(cacheMeta: LimitedCacheMeta<ItemType_8>, options: LimitedCacheOptions) => Readonly<LimitedCacheOptionsFull>;
78
+ };
79
+
80
+ declare const isCacheMeta: (cacheMeta: LimitedCacheMeta) => boolean;
81
+ declare const upgradeCacheMeta: (cacheMeta: LimitedCacheMeta) => void;
82
+ declare const lowLevelSetOptions: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, options: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
83
+ declare const lowLevelInit: <ItemType = any>(optionsOrCacheMeta?: LimitedCacheOptions | LimitedCacheMeta<ItemType> | undefined) => LimitedCacheMeta<ItemType>;
84
+ declare const lowLevelDoMaintenance: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => LimitedCacheMeta<ItemType>;
85
+ declare const lowLevelHas: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => boolean;
86
+ declare const lowLevelGetOne: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => ItemType | undefined;
87
+ declare const lowLevelGetAll: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => Record<string, ItemType>;
88
+ declare const lowLevelSet: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string, item: ItemType) => LimitedCacheMeta<ItemType>;
89
+ declare const lowLevelRemove: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => LimitedCacheMeta<ItemType>;
90
+ declare const lowLevelReset: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => LimitedCacheMeta<ItemType>;
91
+
92
+ export { CURRENT_META_VERSION, type DefaultItemType, LimitedCache, type LimitedCacheInstance, type LimitedCacheMeta, LimitedCacheObject, type LimitedCacheObjectInstance, type LimitedCacheOptions, type LimitedCacheOptionsFull, type LimitedCacheOptionsReadonly, MAXIMUM_CACHE_TIME, defaultOptions, getCacheMetaFromObject, isCacheMeta, limitedCacheUtil, lowLevelDoMaintenance, lowLevelGetAll, lowLevelGetOne, lowLevelHas, lowLevelInit, lowLevelRemove, lowLevelReset, lowLevelSet, lowLevelSetOptions, upgradeCacheMeta };
@@ -1,4 +1,4 @@
1
- import { LimitedCacheOptions, LimitedCacheInstance } from '../types';
1
+ import { LimitedCacheOptions, LimitedCacheInstance } from '../types.js';
2
2
  declare const LimitedCache: <ItemType = any>(options?: LimitedCacheOptions) => LimitedCacheInstance<ItemType>;
3
3
  export { LimitedCache };
4
4
  //# sourceMappingURL=LimitedCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LimitedCache.d.ts","sourceRoot":"","sources":["../../../src/core/LimitedCache.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,mBAAmB,EAEnB,oBAAoB,EAGrB,MAAM,aAAa,CAAC;AAUrB,QAAA,MAAM,YAAY,6BACN,mBAAmB,mCAsB9B,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, lowLevelReset, lowLevelSetOptions, lowLevelDoMaintenance, } from './lowLevelFunctions';
1
+ import { lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, lowLevelReset, lowLevelSetOptions, lowLevelDoMaintenance, } from './lowLevelFunctions.js';
2
2
  // Most public functions just call a low-level function directly, passing the cacheMeta.
3
3
  // Doing this via a helper function makes the typeChecks easier, and minifies better.
4
4
  const bindFunctionToCacheMeta = (
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LimitedCache.js","sourceRoot":"","sources":["../../../src/core/LimitedCache.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAShC,wFAAwF;AACxF,qFAAqF;AACrF,MAAM,uBAAuB,GAAG;AAC9B,8DAA8D;AAC9D,EAAqE,EACrE,SAAqC,EACrC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAE9B,MAAM,YAAY,GAAG,CACnB,OAA6B,EACG,EAAE;IAClC,MAAM,SAAS,GAAG,YAAY,CAAW,OAAO,CAAC,CAAC;IAElD,OAAO;QACL,GAAG,EAAE,uBAAuB,CAAW,cAAc,EAAE,SAAS,CAAC;QACjE,MAAM,EAAE,uBAAuB,CAAW,cAAc,EAAE,SAAS,CAAC;QACpE,GAAG,EAAE,uBAAuB,CAAW,WAAW,EAAE,SAAS,CAAC;QAC9D,GAAG,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAY,EAAE;YAChC,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YACvC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,EAAE,CAAC,QAAQ,EAAQ,EAAE;YACzB,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,EAAE,uBAAuB,CAAW,aAAa,EAAE,SAAS,CAAC;QAClE,YAAY,EAAE,GAA+B,EAAE,CAAC,SAAS;QACzD,UAAU,EAAE,GAAgC,EAAE,CAAC,SAAS,CAAC,OAAO;QAChE,UAAU,EAAE,uBAAuB,CAAW,kBAAkB,EAAE,SAAS,CAAC;QAC5E,aAAa,EAAE,uBAAuB,CAAW,qBAAqB,EAAE,SAAS,CAAC;KACnF,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { LimitedCacheOptions, LimitedCacheObjectInstance, LimitedCacheMeta } from '../types';
1
+ import { LimitedCacheOptions, LimitedCacheObjectInstance, LimitedCacheMeta } from '../types.js';
2
2
  declare const LimitedCacheObject: <ItemType = any>(options?: LimitedCacheOptions) => LimitedCacheObjectInstance<ItemType>;
3
3
  declare const getCacheMetaFromObject: (instance: LimitedCacheObjectInstance) => LimitedCacheMeta;
4
4
  export { LimitedCacheObject, getCacheMetaFromObject };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LimitedCacheObject.d.ts","sourceRoot":"","sources":["../../../src/core/LimitedCacheObject.ts"],"names":[],"mappings":"AASA,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,gBAAgB,EAEjB,MAAM,aAAa,CAAC;AA4CrB,QAAA,MAAM,kBAAkB,6BACZ,mBAAmB,yCAO9B,CAAC;AAEF,QAAA,MAAM,sBAAsB,aAAc,0BAA0B,KAAG,gBAEtE,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
- import { hasOwnProperty } from './builtIns';
2
- import { lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, } from './lowLevelFunctions';
1
+ import { hasOwnProperty } from './builtIns.js';
2
+ import { lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, } from './lowLevelFunctions.js';
3
3
  // The `any` here doesn't escape out anywhere: it's overridden by the constructor below
4
4
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
5
  const proxyHandler = {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LimitedCacheObject.js","sourceRoot":"","sources":["../../../src/core/LimitedCacheObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,wBAAwB,CAAC;AAQhC,uFAAuF;AACvF,8DAA8D;AAC9D,MAAM,YAAY,GAAkD;IAClE,GAAG,EAAE,CAAC,SAA2B,EAAE,QAAgB,EAAE,EAAE;QACrD,IAAI,QAAQ,KAAK,gBAAgB,EAAE,CAAC;YAClC,OAAO,cAAc,CAAC;QACxB,CAAC;QACD,OAAO,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACD,wBAAwB,EAAE,CAAC,SAA2B,EAAE,QAAgB,EAAE,EAAE;QAC1E,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACnD,MAAM,SAAS,GAAG,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAEtD,IAAI,SAAS,EAAE,CAAC;YACd,OAAO;gBACL,YAAY,EAAE,IAAI;gBAClB,UAAU,EAAE,SAAS;gBACrB,KAAK,EAAE,SAAS;gBAChB,QAAQ,EAAE,IAAI;aACf,CAAC;QACJ,CAAC;QACD,OAAO;IACT,CAAC;IACD,GAAG,EAAE,WAAW;IAChB,8DAA8D;IAC9D,GAAG,EAAE,CAAC,SAA2B,EAAE,QAAgB,EAAE,IAAS,EAAO,EAAE;QACrE,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,cAAc,EAAE,CAAC,SAA2B,EAAE,QAAgB,EAAQ,EAAE;QACtE,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,EAAE,CAAC,SAA2B,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;CACjF,CAAC;AAEF;;;GAGG;AACH,MAAM,oBAAoB,GAAG,IAAI,OAAO,EAAE,CAAC;AAE3C,MAAM,kBAAkB,GAAG,CACzB,OAA6B,EACS,EAAE;IACxC,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,kBAAkB,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAE9D,oBAAoB,CAAC,GAAG,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;IACxD,OAAO,kBAAkB,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,QAAoC,EAAoB,EAAE;IACxF,OAAO,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtIns.d.ts","sourceRoot":"","sources":["../../../src/core/builtIns.ts"],"names":[],"mappings":"AACA,QAAA,MACU,YAAY;;;GACZ,YAAY;;;;;GACP,cAAc,6BACnB,CAAC;AACX,QAAA,MAAM,OAAO,cAAW,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtIns.js","sourceRoot":"","sources":["../../../src/core/builtIns.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,MAAM,EACJ,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,EAAE,cAAc,EAAE,GAC9B,GAAG,MAAM,CAAC;AACX,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { LimitedCacheOptionsReadonly } from '../types';
1
+ import { LimitedCacheOptionsReadonly } from '../types.js';
2
2
  declare const CURRENT_META_VERSION = 2;
3
3
  declare const MAXIMUM_CACHE_TIME: number;
4
4
  declare const defaultOptions: LimitedCacheOptionsReadonly;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultOptions.d.ts","sourceRoot":"","sources":["../../../src/core/defaultOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAA,MAAM,oBAAoB,IAAI,CAAC;AAC/B,QAAA,MAAM,kBAAkB,QAAqB,CAAC;AAE9C,QAAA,MAAM,cAAc,EAAE,2BASrB,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultOptions.js","sourceRoot":"","sources":["../../../src/core/defaultOptions.ts"],"names":[],"mappings":"AAEA,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,kBAAkB,GAAG,GAAG,GAAG,KAAK,GAAG,IAAI,CAAC;AAE9C,MAAM,cAAc,GAAgC;IAClD,SAAS;IACT,YAAY,EAAE,GAAG;IACjB,YAAY,EAAE,KAAK,GAAG,IAAI;IAC1B,mBAAmB;IACnB,0BAA0B,EAAE,IAAI;IAChC,UAAU;IACV,OAAO,EAAE,GAAG;IACZ,SAAS,EAAE,EAAE;CACd,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,13 @@
1
+ declare const limitedCacheUtil: {
2
+ init: <ItemType = any>(optionsOrCacheMeta?: import("../types.js").LimitedCacheOptions | import("../types.js").LimitedCacheMeta<ItemType> | undefined) => import("../types.js").LimitedCacheMeta<ItemType>;
3
+ get: <ItemType_1 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_1>, cacheKey: string) => ItemType_1 | undefined;
4
+ getAll: <ItemType_2 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_2>) => Record<string, ItemType_2>;
5
+ has: <ItemType_3 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_3>, cacheKey: string) => boolean;
6
+ set: <ItemType_4 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_4>, cacheKey: string, item: ItemType_4) => import("../types.js").LimitedCacheMeta<ItemType_4>;
7
+ remove: <ItemType_5 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_5>, cacheKey: string) => import("../types.js").LimitedCacheMeta<ItemType_5>;
8
+ reset: <ItemType_6 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_6>) => import("../types.js").LimitedCacheMeta<ItemType_6>;
9
+ doMaintenance: <ItemType_7 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_7>) => import("../types.js").LimitedCacheMeta<ItemType_7>;
10
+ setOptions: <ItemType_8 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_8>, options: import("../types.js").LimitedCacheOptions) => Readonly<import("../types.js").LimitedCacheOptionsFull>;
11
+ };
12
+ export { limitedCacheUtil };
13
+ //# sourceMappingURL=limitedCacheUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limitedCacheUtil.d.ts","sourceRoot":"","sources":["../../../src/core/limitedCacheUtil.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,gBAAgB;;;;;;;;;;CAUrB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelInit, lowLevelDoMaintenance, lowLevelRemove, lowLevelReset, lowLevelSet, lowLevelSetOptions, } from './lowLevelFunctions';
1
+ import { lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelInit, lowLevelDoMaintenance, lowLevelRemove, lowLevelReset, lowLevelSet, lowLevelSetOptions, } from './lowLevelFunctions.js';
2
2
  const limitedCacheUtil = {
3
3
  init: lowLevelInit,
4
4
  get: lowLevelGetOne,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limitedCacheUtil.js","sourceRoot":"","sources":["../../../src/core/limitedCacheUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,WAAW,EACX,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,cAAc;IACnB,MAAM,EAAE,cAAc;IACtB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IAChB,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE,aAAa;IACpB,aAAa,EAAE,qBAAqB;IACpC,UAAU,EAAE,kBAAkB;CAC/B,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { LimitedCacheOptions, LimitedCacheOptionsReadonly, LimitedCacheMeta } from '../types';
1
+ import { LimitedCacheOptions, LimitedCacheOptionsReadonly, LimitedCacheMeta } from '../types.js';
2
2
  declare const isCacheMeta: (cacheMeta: LimitedCacheMeta) => boolean;
3
3
  declare const upgradeCacheMeta: (cacheMeta: LimitedCacheMeta) => void;
4
4
  declare const lowLevelSetOptions: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, options: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lowLevelFunctions.d.ts","sourceRoot":"","sources":["../../../src/core/lowLevelFunctions.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,EAGjB,MAAM,aAAa,CAAC;AAqBrB,QAAA,MAAM,WAAW,cAAe,gBAAgB,KAAG,OAElD,CAAC;AAEF,QAAA,MAAM,gBAAgB,cAAe,gBAAgB,KAAG,IAWvD,CAAC;AAEF,QAAA,MAAM,kBAAkB,mEAEb,mBAAmB,KAC3B,2BAGF,CAAC;AAEF,QAAA,MAAM,YAAY,mIAkBjB,CAAC;AA0BF,QAAA,MAAM,qBAAqB,uFA+B1B,CAAC;AA4FF,QAAA,MAAM,WAAW,oEAEL,MAAM,KACf,OAWF,CAAC;AAEF,QAAA,MAAM,cAAc,oEAER,MAAM,yBAOjB,CAAC;AAEF,QAAA,MAAM,cAAc,qFAQnB,CAAC;AAEF,QAAA,MAAM,WAAW,oEAEL,MAAM,+CA+CjB,CAAC;AAEF,QAAA,MAAM,cAAc,oEAER,MAAM,+BAgBjB,CAAC;AAEF,QAAA,MAAM,aAAa,uFAUlB,CAAC;AAEF,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,kBAAkB,GACnB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { objectAssign, objectCreate, dateNow, hasOwnProperty } from './builtIns';
2
- import { CURRENT_META_VERSION, MAXIMUM_CACHE_TIME, defaultOptions } from './defaultOptions';
1
+ import { objectAssign, objectCreate, dateNow, hasOwnProperty } from './builtIns.js';
2
+ import { CURRENT_META_VERSION, MAXIMUM_CACHE_TIME, defaultOptions } from './defaultOptions.js';
3
3
  /* Initialization and options */
4
4
  const positiveNumberOrZero = (value) => Math.max(value, 0) || 0;
5
5
  const normalizeOptions = (cacheMetaOptions) => {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lowLevelFunctions.js","sourceRoot":"","sources":["../../../src/core/lowLevelFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,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AC,EAAE,CAAC;QACtB,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,CAAC;YAClC,SAAS,CAAC,KAAK,GAAG;gBAChB,GAAG,KAAK;gBACR,CAAC,QAAQ,CAAC,EAAE,SAAS;aACtB,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAChC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CACpB,SAAqC,EACT,EAAE;IAC9B,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC5B,OAAO,YAAY,CAAC,SAAS,EAAE;QAC7B,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC;QAC3B,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,OAAO;KACnC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,kBAAkB,GACnB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './core/defaultOptions.js';
2
+ export * from './core/LimitedCache.js';
3
+ export * from './core/LimitedCacheObject.js';
4
+ export * from './core/limitedCacheUtil.js';
5
+ export * from './core/lowLevelFunctions.js';
6
+ export * from './types.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './core/defaultOptions.js';
2
+ export * from './core/LimitedCache.js';
3
+ export * from './core/LimitedCacheObject.js';
4
+ export * from './core/limitedCacheUtil.js';
5
+ export * from './core/lowLevelFunctions.js';
6
+ export * from './types.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC;AAElC,MAAM,WAAW,uBAAuB;IACtC,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,wGAAwG;IACxG,YAAY,EAAE,MAAM,CAAC;IAErB,4JAA4J;IAC5J,0BAA0B,EAAE,MAAM,CAAC;IACnC,0FAA0F;IAC1F,OAAO,EAAE,MAAM,CAAC;IAChB,2HAA2H;IAC3H,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC;AAC1E,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC,uBAAuB,CAAC,CAAC;AAE5E,MAAM,WAAW,oBAAoB,CAAC,QAAQ,GAAG,eAAe;IAC9D,uDAAuD;IACvD,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,CAAC;IAChD,mCAAmC;IACnC,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvC,gFAAgF;IAChF,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IACnC,8EAA8E;I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acheInstance } from '../types.js';
2
+ declare const LimitedCache: <ItemType = any>(options?: LimitedCacheOptions) => LimitedCacheInstance<ItemType>;
3
+ export { LimitedCache };
4
+ //# sourceMappingURL=LimitedCache.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { LimitedCacheOptions, LimitedCacheObjectInstance, LimitedCacheMeta } from '../types.js';
2
+ declare const LimitedCacheObject: <ItemType = any>(options?: LimitedCacheOptions) => LimitedCacheObjectInstance<ItemType>;
3
+ declare const getCacheMetaFromObject: (instance: LimitedCacheObjectInstance) => LimitedCacheMeta;
4
+ export { LimitedCacheObject, getCacheMetaFromObject };
5
+ //# sourceMappingURL=LimitedCacheObject.d.ts.map
@@ -0,0 +1,12 @@
1
+ declare const objectCreate: {
2
+ (o: object | null): any;
3
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
4
+ }, objectAssign: {
5
+ <T extends {}, U>(target: T, source: U): T & U;
6
+ <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
7
+ <T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
8
+ (target: object, ...sources: any[]): any;
9
+ }, hasOwnProperty: (v: PropertyKey) => boolean;
10
+ declare const dateNow: () => number;
11
+ export { objectAssign, objectCreate, dateNow, hasOwnProperty };
12
+ //# sourceMappingURL=builtIns.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { LimitedCacheOptionsReadonly } from '../types.js';
2
+ declare const CURRENT_META_VERSION = 2;
3
+ declare const MAXIMUM_CACHE_TIME: number;
4
+ declare const defaultOptions: LimitedCacheOptionsReadonly;
5
+ export { CURRENT_META_VERSION, MAXIMUM_CACHE_TIME, defaultOptions };
6
+ //# sourceMappingURL=defaultOptions.d.ts.map
@@ -0,0 +1,13 @@
1
+ declare const limitedCacheUtil: {
2
+ init: <ItemType = any>(optionsOrCacheMeta?: import("../types.js").LimitedCacheOptions | import("../types.js").LimitedCacheMeta<ItemType> | undefined) => import("../types.js").LimitedCacheMeta<ItemType>;
3
+ get: <ItemType_1 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_1>, cacheKey: string) => ItemType_1 | undefined;
4
+ getAll: <ItemType_2 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_2>) => Record<string, ItemType_2>;
5
+ has: <ItemType_3 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_3>, cacheKey: string) => boolean;
6
+ set: <ItemType_4 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_4>, cacheKey: string, item: ItemType_4) => import("../types.js").LimitedCacheMeta<ItemType_4>;
7
+ remove: <ItemType_5 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_5>, cacheKey: string) => import("../types.js").LimitedCacheMeta<ItemType_5>;
8
+ reset: <ItemType_6 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_6>) => import("../types.js").LimitedCacheMeta<ItemType_6>;
9
+ doMaintenance: <ItemType_7 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_7>) => import("../types.js").LimitedCacheMeta<ItemType_7>;
10
+ setOptions: <ItemType_8 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_8>, options: import("../types.js").LimitedCacheOptions) => Readonly<import("../types.js").LimitedCacheOptionsFull>;
11
+ };
12
+ export { limitedCacheUtil };
13
+ //# sourceMappingURL=limitedCacheUtil.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { LimitedCacheOptions, LimitedCacheOptionsReadonly, LimitedCacheMeta } from '../types.js';
2
+ declare const isCacheMeta: (cacheMeta: LimitedCacheMeta) => boolean;
3
+ declare const upgradeCacheMeta: (cacheMeta: LimitedCacheMeta) => void;
4
+ declare const lowLevelSetOptions: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, options: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
5
+ declare const lowLevelInit: <ItemType = any>(optionsOrCacheMeta?: LimitedCacheOptions | LimitedCacheMeta<ItemType> | undefined) => LimitedCacheMeta<ItemType>;
6
+ declare const lowLevelDoMaintenance: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => LimitedCacheMeta<ItemType>;
7
+ declare const lowLevelHas: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => boolean;
8
+ declare const lowLevelGetOne: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => ItemType | undefined;
9
+ declare const lowLevelGetAll: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => Record<string, ItemType>;
10
+ declare const lowLevelSet: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string, item: ItemType) => LimitedCacheMeta<ItemType>;
11
+ declare const lowLevelRemove: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => LimitedCacheMeta<ItemType>;
12
+ declare const lowLevelReset: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => LimitedCacheMeta<ItemType>;
13
+ export { isCacheMeta, upgradeCacheMeta, lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, lowLevelReset, lowLevelDoMaintenance, lowLevelSetOptions, };
14
+ //# sourceMappingURL=lowLevelFunctions.d.ts.map
@@ -0,0 +1,7 @@
1
+ export * from './core/defaultOptions.js';
2
+ export * from './core/LimitedCache.js';
3
+ export * from './core/LimitedCacheObject.js';
4
+ export * from './core/limitedCacheUtil.js';
5
+ export * from './core/lowLevelFunctions.js';
6
+ export * from './types.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,61 @@
1
+ export type DefaultItemType = any;
2
+ export interface LimitedCacheOptionsFull {
3
+ /** Items will be removed to keep the cache within the maxCacheSize limit */
4
+ maxCacheSize: number;
5
+ /** Items will be removed and never returned if they were set more than maxCacheTime milliseconds ago */
6
+ maxCacheTime: number;
7
+ /** (dev only) A warning will be emitted if an item rotates out of the cache before this many milliseconds have passed, to indicate the size is too small */
8
+ warnIfItemPurgedBeforeTime: number;
9
+ /** (private) Internal cleanup of old keys will be performed after this many operations */
10
+ opLimit: number;
11
+ /** (private) Internal optimization to adjust how much searching will be done to find expired items, to avoid being O(n) */
12
+ scanLimit: number;
13
+ }
14
+ export type LimitedCacheOptions = Partial<LimitedCacheOptionsFull> | null;
15
+ export type LimitedCacheOptionsReadonly = Readonly<LimitedCacheOptionsFull>;
16
+ export interface LimitedCacheInstance<ItemType = DefaultItemType> {
17
+ /** Return the requested item, if it has not expired */
18
+ get: (cacheKey: string) => ItemType | undefined;
19
+ /** Return all non-expired items */
20
+ getAll: () => Record<string, ItemType>;
21
+ /** Indicate whether or not the requested item is present and has not expired */
22
+ has: (cacheKey: string) => boolean;
23
+ /** Add the item to the cache, or update its timestamp if it already exists */
24
+ set: (cacheKey: string, item: ItemType) => ItemType;
25
+ /** Remove the requested item from the cache, if necessary */
26
+ remove: (cacheKey: string) => true;
27
+ /** Remove all items and all timestamps from the cache */
28
+ reset: () => LimitedCacheMeta<ItemType>;
29
+ /** Return a serializable representation of the cache internals, suitable for long-term storage */
30
+ getCacheMeta: () => LimitedCacheMeta<ItemType>;
31
+ /** Return the cache's current values for all options */
32
+ getOptions: () => LimitedCacheOptionsFull;
33
+ /** Update one or more of the cache's options */
34
+ setOptions: (newOptions: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
35
+ /** Reduces cache size by cleaning up old keys and expired items */
36
+ doMaintenance: () => LimitedCacheMeta<ItemType>;
37
+ }
38
+ export interface LimitedCacheObjectInstance<ItemType = DefaultItemType> {
39
+ [key: string]: ItemType;
40
+ }
41
+ /**
42
+ * A serializable representation of the cache internals, suitable for long-term storage
43
+ */
44
+ export interface LimitedCacheMeta<ItemType = DefaultItemType> {
45
+ /** Schema version: old versions will be upgraded if possible, or a warning will be emitted if not */
46
+ limitedCacheMetaVersion: number;
47
+ /** Options to control cache size, time, and behavior */
48
+ options: LimitedCacheOptionsReadonly;
49
+ /** The values in the cache, stored by key. Will include old keys not yet garbage collected */
50
+ cache: Record<string, ItemType | undefined>;
51
+ /** List of keys that have been set, in chronological order. Used to find cache items most likely to be expired */
52
+ keyList: Array<string>;
53
+ /** The [setTime, expirationTime] for each key that has been set. Removed on unset. */
54
+ keyInfo: Record<string, [
55
+ number,
56
+ number
57
+ ] | undefined>;
58
+ /** Number of operations remaining until internal cleanup of old keys is performed. Based on options.opLimit */
59
+ opsLeft: number;
60
+ }
61
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { LimitedCacheOptions, LimitedCacheInstance } from '../types.js';
2
+ declare const LimitedCache: <ItemType = any>(options?: LimitedCacheOptions) => LimitedCacheInstance<ItemType>;
3
+ export { LimitedCache };
4
+ //# sourceMappingURL=LimitedCache.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { LimitedCacheOptions, LimitedCacheObjectInstance, LimitedCacheMeta } from '../types.js';
2
+ declare const LimitedCacheObject: <ItemType = any>(options?: LimitedCacheOptions) => LimitedCacheObjectInstance<ItemType>;
3
+ declare const getCacheMetaFromObject: (instance: LimitedCacheObjectInstance) => LimitedCacheMeta;
4
+ export { LimitedCacheObject, getCacheMetaFromObject };
5
+ //# sourceMappingURL=LimitedCacheObject.d.ts.map
@@ -0,0 +1,12 @@
1
+ declare const objectCreate: {
2
+ (o: object | null): any;
3
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
4
+ }, objectAssign: {
5
+ <T extends {}, U>(target: T, source: U): T & U;
6
+ <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
7
+ <T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
8
+ (target: object, ...sources: any[]): any;
9
+ }, hasOwnProperty: (v: PropertyKey) => boolean;
10
+ declare const dateNow: () => number;
11
+ export { objectAssign, objectCreate, dateNow, hasOwnProperty };
12
+ //# sourceMappingURL=builtIns.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { LimitedCacheOptionsReadonly } from '../types.js';
2
+ declare const CURRENT_META_VERSION = 2;
3
+ declare const MAXIMUM_CACHE_TIME: number;
4
+ declare const defaultOptions: LimitedCacheOptionsReadonly;
5
+ export { CURRENT_META_VERSION, MAXIMUM_CACHE_TIME, defaultOptions };
6
+ //# sourceMappingURL=defaultOptions.d.ts.map
@@ -0,0 +1,13 @@
1
+ declare const limitedCacheUtil: {
2
+ init: <ItemType = any>(optionsOrCacheMeta?: import("../types.js").LimitedCacheOptions | import("../types.js").LimitedCacheMeta<ItemType> | undefined) => import("../types.js").LimitedCacheMeta<ItemType>;
3
+ get: <ItemType_1 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_1>, cacheKey: string) => ItemType_1 | undefined;
4
+ getAll: <ItemType_2 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_2>) => Record<string, ItemType_2>;
5
+ has: <ItemType_3 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_3>, cacheKey: string) => boolean;
6
+ set: <ItemType_4 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_4>, cacheKey: string, item: ItemType_4) => import("../types.js").LimitedCacheMeta<ItemType_4>;
7
+ remove: <ItemType_5 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_5>, cacheKey: string) => import("../types.js").LimitedCacheMeta<ItemType_5>;
8
+ reset: <ItemType_6 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_6>) => import("../types.js").LimitedCacheMeta<ItemType_6>;
9
+ doMaintenance: <ItemType_7 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_7>) => import("../types.js").LimitedCacheMeta<ItemType_7>;
10
+ setOptions: <ItemType_8 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_8>, options: import("../types.js").LimitedCacheOptions) => Readonly<import("../types.js").LimitedCacheOptionsFull>;
11
+ };
12
+ export { limitedCacheUtil };
13
+ //# sourceMappingURL=limitedCacheUtil.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { LimitedCacheOptions, LimitedCacheOptionsReadonly, LimitedCacheMeta } from '../types.js';
2
+ declare const isCacheMeta: (cacheMeta: LimitedCacheMeta) => boolean;
3
+ declare const upgradeCacheMeta: (cacheMeta: LimitedCacheMeta) => void;
4
+ declare const lowLevelSetOptions: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, options: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
5
+ declare const lowLevelInit: <ItemType = any>(optionsOrCacheMeta?: LimitedCacheOptions | LimitedCacheMeta<ItemType> | undefined) => LimitedCacheMeta<ItemType>;
6
+ declare const lowLevelDoMaintenance: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => LimitedCacheMeta<ItemType>;
7
+ declare const lowLevelHas: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => boolean;
8
+ declare const lowLevelGetOne: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => ItemType | undefined;
9
+ declare const lowLevelGetAll: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => Record<string, ItemType>;
10
+ declare const lowLevelSet: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string, item: ItemType) => LimitedCacheMeta<ItemType>;
11
+ declare const lowLevelRemove: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => LimitedCacheMeta<ItemType>;
12
+ declare const lowLevelReset: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => LimitedCacheMeta<ItemType>;
13
+ export { isCacheMeta, upgradeCacheMeta, lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, lowLevelReset, lowLevelDoMaintenance, lowLevelSetOptions, };
14
+ //# sourceMappingURL=lowLevelFunctions.d.ts.map