@keq-request/cache 5.0.0-alpha.10

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 (117) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/LICENSE +21 -0
  3. package/dist/cache-entry/cache-entry.d.ts +17 -0
  4. package/dist/cache-entry/cache-entry.d.ts.map +1 -0
  5. package/dist/cache-entry/index.d.ts +4 -0
  6. package/dist/cache-entry/index.d.ts.map +1 -0
  7. package/dist/cache-entry/types/cache-entry-build-options.d.ts +8 -0
  8. package/dist/cache-entry/types/cache-entry-build-options.d.ts.map +1 -0
  9. package/dist/cache-entry/types/cache-entry-options.d.ts +7 -0
  10. package/dist/cache-entry/types/cache-entry-options.d.ts.map +1 -0
  11. package/dist/cache.d.ts +30 -0
  12. package/dist/cache.d.ts.map +1 -0
  13. package/dist/constants/eviction.enum.d.ts +7 -0
  14. package/dist/constants/eviction.enum.d.ts.map +1 -0
  15. package/dist/constants/strategy.enum.d.ts +7 -0
  16. package/dist/constants/strategy.enum.d.ts.map +1 -0
  17. package/dist/index.d.ts +10 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +1102 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/index.mjs +1059 -0
  22. package/dist/index.mjs.map +1 -0
  23. package/dist/storage/index.d.ts +6 -0
  24. package/dist/storage/index.d.ts.map +1 -0
  25. package/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts +24 -0
  26. package/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts.map +1 -0
  27. package/dist/storage/indexed-db-storage/constants/default-table-name.d.ts +2 -0
  28. package/dist/storage/indexed-db-storage/constants/default-table-name.d.ts.map +1 -0
  29. package/dist/storage/indexed-db-storage/indexed-db-storage.d.ts +12 -0
  30. package/dist/storage/indexed-db-storage/indexed-db-storage.d.ts.map +1 -0
  31. package/dist/storage/indexed-db-storage/lfu-indexed-db-storage.d.ts +11 -0
  32. package/dist/storage/indexed-db-storage/lfu-indexed-db-storage.d.ts.map +1 -0
  33. package/dist/storage/indexed-db-storage/lru-indexed-db-storage.d.ts +11 -0
  34. package/dist/storage/indexed-db-storage/lru-indexed-db-storage.d.ts.map +1 -0
  35. package/dist/storage/indexed-db-storage/random-indexed-db-storage.d.ts +11 -0
  36. package/dist/storage/indexed-db-storage/random-indexed-db-storage.d.ts.map +1 -0
  37. package/dist/storage/indexed-db-storage/ttl-indexed-db-storage.d.ts +11 -0
  38. package/dist/storage/indexed-db-storage/ttl-indexed-db-storage.d.ts.map +1 -0
  39. package/dist/storage/indexed-db-storage/types/indexed-db-entry-metadata.d.ts +12 -0
  40. package/dist/storage/indexed-db-storage/types/indexed-db-entry-metadata.d.ts.map +1 -0
  41. package/dist/storage/indexed-db-storage/types/indexed-db-entry-response.d.ts +8 -0
  42. package/dist/storage/indexed-db-storage/types/indexed-db-entry-response.d.ts.map +1 -0
  43. package/dist/storage/indexed-db-storage/types/indexed-db-entry-visits.d.ts +14 -0
  44. package/dist/storage/indexed-db-storage/types/indexed-db-entry-visits.d.ts.map +1 -0
  45. package/dist/storage/indexed-db-storage/types/indexed-db-schema.d.ts +29 -0
  46. package/dist/storage/indexed-db-storage/types/indexed-db-schema.d.ts.map +1 -0
  47. package/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts +14 -0
  48. package/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts.map +1 -0
  49. package/dist/storage/indexed-db-storage/types/indexed-db-storage-size.d.ts +13 -0
  50. package/dist/storage/indexed-db-storage/types/indexed-db-storage-size.d.ts.map +1 -0
  51. package/dist/storage/internal-storage/internal-storage.d.ts +16 -0
  52. package/dist/storage/internal-storage/internal-storage.d.ts.map +1 -0
  53. package/dist/storage/internal-storage/types/events.d.ts +16 -0
  54. package/dist/storage/internal-storage/types/events.d.ts.map +1 -0
  55. package/dist/storage/internal-storage/types/storage-options.d.ts +20 -0
  56. package/dist/storage/internal-storage/types/storage-options.d.ts.map +1 -0
  57. package/dist/storage/keq-cache-storage.d.ts +20 -0
  58. package/dist/storage/keq-cache-storage.d.ts.map +1 -0
  59. package/dist/storage/memory-storage/base-memory-storage.d.ts +26 -0
  60. package/dist/storage/memory-storage/base-memory-storage.d.ts.map +1 -0
  61. package/dist/storage/memory-storage/lfu-memory-storage.d.ts +11 -0
  62. package/dist/storage/memory-storage/lfu-memory-storage.d.ts.map +1 -0
  63. package/dist/storage/memory-storage/lru-memory-storage.d.ts +11 -0
  64. package/dist/storage/memory-storage/lru-memory-storage.d.ts.map +1 -0
  65. package/dist/storage/memory-storage/memory-storage.d.ts +12 -0
  66. package/dist/storage/memory-storage/memory-storage.d.ts.map +1 -0
  67. package/dist/storage/memory-storage/random-memory-storage.d.ts +11 -0
  68. package/dist/storage/memory-storage/random-memory-storage.d.ts.map +1 -0
  69. package/dist/storage/memory-storage/ttl-memory-storage.d.ts +11 -0
  70. package/dist/storage/memory-storage/ttl-memory-storage.d.ts.map +1 -0
  71. package/dist/storage/memory-storage/types/memory-storage-options.d.ts +9 -0
  72. package/dist/storage/memory-storage/types/memory-storage-options.d.ts.map +1 -0
  73. package/dist/storage/memory-storage/types/memory-storage-size.d.ts +13 -0
  74. package/dist/storage/memory-storage/types/memory-storage-size.d.ts.map +1 -0
  75. package/dist/storage/multi-tier-storage/index.d.ts +2 -0
  76. package/dist/storage/multi-tier-storage/index.d.ts.map +1 -0
  77. package/dist/storage/multi-tier-storage/multi-tier-storage.d.ts +36 -0
  78. package/dist/storage/multi-tier-storage/multi-tier-storage.d.ts.map +1 -0
  79. package/dist/storage/multi-tier-storage/types/multi-tier-storage-options.d.ts +5 -0
  80. package/dist/storage/multi-tier-storage/types/multi-tier-storage-options.d.ts.map +1 -0
  81. package/dist/storage/tier-storage/index.d.ts +3 -0
  82. package/dist/storage/tier-storage/index.d.ts.map +1 -0
  83. package/dist/storage/tier-storage/tier-storage.d.ts +15 -0
  84. package/dist/storage/tier-storage/tier-storage.d.ts.map +1 -0
  85. package/dist/storage/tier-storage/types/tier-storage-options.d.ts +21 -0
  86. package/dist/storage/tier-storage/types/tier-storage-options.d.ts.map +1 -0
  87. package/dist/strategies/cache-first.d.ts +3 -0
  88. package/dist/strategies/cache-first.d.ts.map +1 -0
  89. package/dist/strategies/network-first.d.ts +3 -0
  90. package/dist/strategies/network-first.d.ts.map +1 -0
  91. package/dist/strategies/network-only.d.ts +3 -0
  92. package/dist/strategies/network-only.d.ts.map +1 -0
  93. package/dist/strategies/stale-while-revalidate.d.ts +3 -0
  94. package/dist/strategies/stale-while-revalidate.d.ts.map +1 -0
  95. package/dist/strategies/utils/cache-context.d.ts +5 -0
  96. package/dist/strategies/utils/cache-context.d.ts.map +1 -0
  97. package/dist/strategies/utils/index.d.ts +2 -0
  98. package/dist/strategies/utils/index.d.ts.map +1 -0
  99. package/dist/types/keq-cache-key.d.ts +3 -0
  100. package/dist/types/keq-cache-key.d.ts.map +1 -0
  101. package/dist/types/keq-cache-option.d.ts +24 -0
  102. package/dist/types/keq-cache-option.d.ts.map +1 -0
  103. package/dist/types/keq-cache-parameters.d.ts +12 -0
  104. package/dist/types/keq-cache-parameters.d.ts.map +1 -0
  105. package/dist/types/keq-cache-rule.d.ts +6 -0
  106. package/dist/types/keq-cache-rule.d.ts.map +1 -0
  107. package/dist/types/keq-cache-strategy.d.ts +6 -0
  108. package/dist/types/keq-cache-strategy.d.ts.map +1 -0
  109. package/dist/types/strategies-options.d.ts +14 -0
  110. package/dist/types/strategies-options.d.ts.map +1 -0
  111. package/dist/utils/debug.d.ts +2 -0
  112. package/dist/utils/debug.d.ts.map +1 -0
  113. package/dist/utils/get-response-bytes.d.ts +2 -0
  114. package/dist/utils/get-response-bytes.d.ts.map +1 -0
  115. package/dist/utils/random.d.ts +2 -0
  116. package/dist/utils/random.d.ts.map +1 -0
  117. package/package.json +58 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,166 @@
1
+ # Changelog
2
+
3
+ ## 5.0.0-alpha.10
4
+
5
+ ### Patch Changes
6
+
7
+ - e7eb9dc: Don't publish .turbo and jest.config.cts to npm
8
+ - 7343445: Incorrect build before release
9
+ - Updated dependencies [e7eb9dc]
10
+ - Updated dependencies [7343445]
11
+ - keq@5.0.0-alpha.10
12
+
13
+ ## 5.0.0-alpha.9
14
+
15
+ ### Patch Changes
16
+
17
+ - 2686b8d: build with burbo
18
+ - 2686b8d: remove private dependencies
19
+ - Updated dependencies [2686b8d]
20
+ - Updated dependencies [2686b8d]
21
+ - keq@5.0.0-alpha.9
22
+
23
+ ## 5.0.0-alpha.8
24
+
25
+ ### Patch Changes
26
+
27
+ - 0873c7e: Incorrect build before release.
28
+ - Updated dependencies [0873c7e]
29
+ - keq@5.0.0-alpha.8
30
+
31
+ ## 5.0.0-alpha.7
32
+
33
+ ### Major Changes
34
+
35
+ - 5175097: **BREAKING CHANGE:** group all packages under the @keq-request scope
36
+
37
+ - keq-cache => @keq-request/cache
38
+ - keq-headers => @keq-request/headers
39
+ - keq-cli => @keq-request/cli
40
+ - keq-url => @keq-request/url
41
+ - keq-exception => @keq-request/exception
42
+
43
+ - 153244f: **BREAKING CHANGE:** `onNetworkResponse` has been removed, please use `.on('cache:update', callback)` instead.
44
+
45
+ ### Minor Changes
46
+
47
+ - 153244f: **Feat:** Add `onCacheGet`, `onCacheSet`, `onCacheRemove`, `onCacheEvict` and `onCacheExpired` hook for `MemoryStorage` and `IndexedDBStorage`.
48
+ - 153244f: **Feat:** Add `cache:hit`, `cache:miss` and `cache:update` to keq events.
49
+
50
+ ### Patch Changes
51
+
52
+ - 153244f: **Feat:** `pattern` accept boolean and defaults to true
53
+ - 153244f: **Fix:** unable to cache modified `ctx.res`.
54
+ - Updated dependencies [153244f]
55
+ - Updated dependencies [153244f]
56
+ - Updated dependencies [153244f]
57
+ - Updated dependencies [153244f]
58
+ - Updated dependencies [153244f]
59
+ - Updated dependencies [7ff2162]
60
+ - Updated dependencies [153244f]
61
+ - Updated dependencies [153244f]
62
+ - Updated dependencies [153244f]
63
+ - Updated dependencies [153244f]
64
+ - Updated dependencies [153244f]
65
+ - keq@5.0.0-alpha.7
66
+
67
+ ## [2.1.1](https://github.com/keq-request/keq-cache/compare/v2.1.0...v2.1.1) (2025-07-11)
68
+
69
+ ### Bug Fixes
70
+
71
+ - missing .js ext ([609631a](https://github.com/keq-request/keq-cache/commit/609631af7334fa41f42b9607137c61be1435e29e))
72
+
73
+ ## [2.1.0](https://github.com/keq-request/keq-cache/compare/v2.0.0...v2.1.0) (2025-07-03)
74
+
75
+ ### Features
76
+
77
+ - add MultiTierStorage ([07a293b](https://github.com/keq-request/keq-cache/commit/07a293b75689c33ee05f31bd3446856244f83aa4))
78
+ - add TierStorage ([02ceb48](https://github.com/keq-request/keq-cache/commit/02ceb4885f8a413fddd9fa732c0a2223a809b1f5))
79
+ - custom strategy ([3053306](https://github.com/keq-request/keq-cache/commit/3053306cfa408b9ed72a1d5fbbb9d4bbdfe7e816))
80
+
81
+ ### Bug Fixes
82
+
83
+ - wrong class name ([91989ea](https://github.com/keq-request/keq-cache/commit/91989eaeb1241d16128f08351f95b7b1b1c9fd22))
84
+
85
+ ## [2.0.0](https://github.com/keq-request/keq-cache/compare/v1.2.2...v2.0.0) (2025-05-26)
86
+
87
+ ### ⚠ BREAKING CHANGES
88
+
89
+ - maxStorageSize and threshold is removed, please use size parameter of Storage
90
+
91
+ ### Features
92
+
93
+ - custom storage support ([bebd310](https://github.com/keq-request/keq-cache/commit/bebd3106c735fcb5b12142a3d1c19025806a2098))
94
+
95
+ ### Bug Fixes
96
+
97
+ - memory storage does not specify the isolation scope ([99da6d7](https://github.com/keq-request/keq-cache/commit/99da6d7c23b2b91eb12075195a5d55ae1021fab0))
98
+
99
+ ## [1.2.2](https://github.com/keq-request/keq-cache/compare/v1.2.1...v1.2.2) (2025-04-27)
100
+
101
+ ### Performance Improvements
102
+
103
+ - skip cache if indexed-db not work ([45ccbd8](https://github.com/keq-request/keq-cache/commit/45ccbd8d42ce7bf14fc03f98b7a8ce162c61e43d)), closes [#10](https://github.com/keq-request/keq-cache/issues/10)
104
+
105
+ ## [1.2.1](https://github.com/keq-request/keq-cache/compare/v1.2.0...v1.2.1) (2025-04-23)
106
+
107
+ ### Bug Fixes
108
+
109
+ - should not add proxy to indexed db ([02b5442](https://github.com/keq-request/keq-cache/commit/02b54429856f4e343cd04d98cfb78a1d99e31249))
110
+
111
+ ## [1.2.0](https://github.com/keq-request/keq-cache/compare/v1.1.0...v1.2.0) (2025-04-22)
112
+
113
+ ### Features
114
+
115
+ - add exclude options used exlcude the response should not be cached ([4f6aa79](https://github.com/keq-request/keq-cache/commit/4f6aa793b4aa671695ee1e792dcf1de83b66b37b))
116
+
117
+ ### Bug Fixes
118
+
119
+ - response is consumed abnormally ([3b6d204](https://github.com/keq-request/keq-cache/commit/3b6d204f94982219e27f751b162396bd1ff27548))
120
+
121
+ ## [1.1.0](https://github.com/keq-request/keq-cache/compare/v1.0.6...v1.1.0) (2025-04-18)
122
+
123
+ ### Features
124
+
125
+ - add onNetworkResponse event ([d9b94d0](https://github.com/keq-request/keq-cache/commit/d9b94d0e5d3dd172d48c8228ba51ad32d1eeee41))
126
+
127
+ ## [1.0.6](https://github.com/keq-request/keq-cache/compare/v1.0.5...v1.0.6) (2025-04-16)
128
+
129
+ ### Bug Fixes
130
+
131
+ - cannot find idb package ([b33e267](https://github.com/keq-request/keq-cache/commit/b33e267b7eb845e9e78c2ccb5d2a33db0ee7973a))
132
+
133
+ ## [1.0.5](https://github.com/keq-request/keq-cache/compare/v1.0.4...v1.0.5) (2025-04-16)
134
+
135
+ ### Bug Fixes
136
+
137
+ - cannot find idb package ([031f453](https://github.com/keq-request/keq-cache/commit/031f45358713cff0fe95a13613c2bf8b72fcb5c8))
138
+
139
+ ## [1.0.4](https://github.com/keq-request/keq-cache/compare/v1.0.3...v1.0.4) (2024-11-25)
140
+
141
+ ### Bug Fixes
142
+
143
+ - indexed-db not work ([187ed1f](https://github.com/keq-request/keq-cache/commit/187ed1ff399ca681a683c2b4d615963aced202b8))
144
+
145
+ ## [1.0.3](https://github.com/keq-request/keq-cache/compare/v1.0.2...v1.0.3) (2024-11-19)
146
+
147
+ ### Bug Fixes
148
+
149
+ - update import statements to include file extensions for esm ([f7118ee](https://github.com/keq-request/keq-cache/commit/f7118eeb2913ce48dc2bc53c99b831d52ecb8098))
150
+
151
+ ## [1.0.2](https://github.com/keq-request/keq-cache/compare/v1.0.1...v1.0.2) (2024-11-19)
152
+
153
+ ### Bug Fixes
154
+
155
+ - update import statements to include file extensions for esm ([49ed02f](https://github.com/keq-request/keq-cache/commit/49ed02f64e15f14a04c8f54281b913545db97af2))
156
+
157
+ ## 1.0.1 (2024-11-18)
158
+
159
+ ### Bug Fixes
160
+
161
+ - ctx.options.cache not working ([4f327eb](https://github.com/keq-request/keq-cache/commit/4f327eb887698b51cb44ebe4742f9e79a94fa30d))
162
+ - update cache strategy handling to enforce required strategy option ([7798327](https://github.com/keq-request/keq-cache/commit/77983270544286046ab47df11b39c054fa84164e))
163
+
164
+ ### Miscellaneous Chores
165
+
166
+ - release 1.0.1 ([6dcfd9d](https://github.com/keq-request/keq-cache/commit/6dcfd9d94ad82f0726d5c4031291ece719bd766c))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Val.istar.Guo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,17 @@
1
+ import { CacheEntryOptions } from './types/cache-entry-options.js';
2
+ import { CacheEntryBuildOptions } from './types/cache-entry-build-options.js';
3
+ export declare class CacheEntry {
4
+ key: string;
5
+ response: Response;
6
+ /**
7
+ * @en bytes
8
+ * @zh 字节数
9
+ */
10
+ size: number;
11
+ expiredAt: Date;
12
+ constructor(options: CacheEntryOptions);
13
+ static build(options: CacheEntryBuildOptions): Promise<CacheEntry>;
14
+ clone(): CacheEntry;
15
+ assign(another: CacheEntry): CacheEntry;
16
+ }
17
+ //# sourceMappingURL=cache-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-entry.d.ts","sourceRoot":"","sources":["../../src/cache-entry/cache-entry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAG7E,qBAAa,UAAU;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,QAAQ,CAAA;IAElB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ,SAAS,EAAE,IAAI,CAAA;gBAEH,OAAO,EAAE,iBAAiB;WAOzB,KAAK,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC;IAgBxE,KAAK,IAAI,UAAU;IAUnB,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU;CAOxC"}
@@ -0,0 +1,4 @@
1
+ export * from './cache-entry.js';
2
+ export * from './types/cache-entry-options.js';
3
+ export * from './types/cache-entry-build-options.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache-entry/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,sCAAsC,CAAA"}
@@ -0,0 +1,8 @@
1
+ export interface CacheEntryBuildOptions {
2
+ key: string;
3
+ response: Response;
4
+ size?: number;
5
+ ttl?: number;
6
+ expiredAt?: Date;
7
+ }
8
+ //# sourceMappingURL=cache-entry-build-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-entry-build-options.d.ts","sourceRoot":"","sources":["../../../src/cache-entry/types/cache-entry-build-options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,IAAI,CAAA;CACjB"}
@@ -0,0 +1,7 @@
1
+ export interface CacheEntryOptions {
2
+ key: string;
3
+ response: Response;
4
+ size: number;
5
+ expiredAt?: Date;
6
+ }
7
+ //# sourceMappingURL=cache-entry-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-entry-options.d.ts","sourceRoot":"","sources":["../../../src/cache-entry/types/cache-entry-options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,IAAI,CAAA;CACjB"}
@@ -0,0 +1,30 @@
1
+ import type { Keq, KeqMiddleware, KeqContext } from 'keq';
2
+ import { KeqCacheOption } from './types/keq-cache-option.js';
3
+ import { KeqCacheParameters } from './types/keq-cache-parameters.js';
4
+ declare module 'keq' {
5
+ interface KeqMiddlewareOptions<OP> {
6
+ /**
7
+ * [keq-cache](https://github.com/keq-request/keq-cache)
8
+ */
9
+ cache(option: KeqCacheOption): Keq<OP>;
10
+ }
11
+ interface KeqEvents {
12
+ 'cache:hit': {
13
+ key: string;
14
+ response: Response;
15
+ context: KeqContext;
16
+ };
17
+ 'cache:miss': {
18
+ key: string;
19
+ context: KeqContext;
20
+ };
21
+ 'cache:update': {
22
+ key: string;
23
+ oldResponse?: Response;
24
+ newResponse: Response;
25
+ context: KeqContext;
26
+ };
27
+ }
28
+ }
29
+ export declare function cache(opts: KeqCacheParameters): KeqMiddleware;
30
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAMpE,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAiB,oBAAoB,CAAC,EAAE;QACtC;;WAEG;QACH,KAAK,CAAC,MAAM,EAAE,cAAc,GAAG,GAAG,CAAC,EAAE,CAAC,CAAA;KACvC;IAED,UAAiB,SAAS;QACxB,WAAW,EAAE;YACX,GAAG,EAAE,MAAM,CAAA;YACX,QAAQ,EAAE,QAAQ,CAAA;YAClB,OAAO,EAAE,UAAU,CAAA;SACpB,CAAA;QAED,YAAY,EAAE;YACZ,GAAG,EAAE,MAAM,CAAA;YACX,OAAO,EAAE,UAAU,CAAA;SACpB,CAAA;QAED,cAAc,EAAE;YACd,GAAG,EAAE,MAAM,CAAA;YACX,WAAW,CAAC,EAAE,QAAQ,CAAA;YACtB,WAAW,EAAE,QAAQ,CAAA;YACrB,OAAO,EAAE,UAAU,CAAA;SACpB,CAAA;KACF;CACF;AAGD,wBAAgB,KAAK,CAAC,IAAI,EAAE,kBAAkB,GAAG,aAAa,CA0C7D"}
@@ -0,0 +1,7 @@
1
+ export declare enum Eviction {
2
+ LRU = "lru",
3
+ LFU = "lfu",
4
+ RANDOM = "random",
5
+ TTL = "ttl"
6
+ }
7
+ //# sourceMappingURL=eviction.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eviction.enum.d.ts","sourceRoot":"","sources":["../../src/constants/eviction.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ"}
@@ -0,0 +1,7 @@
1
+ export declare const Strategy: {
2
+ STALE_WHILE_REVALIDATE: import("..").KeqCacheStrategy;
3
+ NETWORK_FIRST: import("..").KeqCacheStrategy;
4
+ NETWORK_ONLY: import("..").KeqCacheStrategy;
5
+ CACHE_FIRST: import("..").KeqCacheStrategy;
6
+ };
7
+ //# sourceMappingURL=strategy.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.enum.d.ts","sourceRoot":"","sources":["../../src/constants/strategy.enum.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,QAAQ;;;;;CAKpB,CAAA"}
@@ -0,0 +1,10 @@
1
+ export * from './cache.js';
2
+ export * from './constants/strategy.enum.js';
3
+ export * from './constants/eviction.enum.js';
4
+ export { KeqCacheStorage as CacheStorage, IndexedDBStorage, MemoryStorage, TierStorage, } from './storage/index.js';
5
+ export { KeqCacheOption } from './types/keq-cache-option.js';
6
+ export { KeqCacheStrategy } from './types/keq-cache-strategy.js';
7
+ export { KeqCacheParameters } from './types/keq-cache-parameters.js';
8
+ export { KeqCacheRule } from './types/keq-cache-rule.js';
9
+ export { StrategyOptions } from './types/strategies-options.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAE5C,OAAO,EACL,eAAe,IAAI,YAAY,EAC/B,gBAAgB,EAChB,aAAa,EACb,WAAW,GACZ,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA"}