@keq-request/cache 5.0.0-alpha.21 → 5.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/cache-entry/cache-entry.d.ts.map +1 -1
- package/dist/cache.d.ts +13 -4
- package/dist/cache.d.ts.map +1 -1
- package/dist/constants/index.d.ts +5 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/max-expired-at.d.ts +2 -0
- package/dist/constants/max-expired-at.d.ts.map +1 -0
- package/dist/exceptions/cache-exception.d.ts +5 -0
- package/dist/exceptions/cache-exception.d.ts.map +1 -0
- package/dist/exceptions/index.d.ts +2 -0
- package/dist/exceptions/index.d.ts.map +1 -0
- package/dist/index.d.ts +4 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +295 -224
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +295 -224
- package/dist/index.mjs.map +1 -1
- package/dist/request-cache-handler/index.d.ts +3 -0
- package/dist/request-cache-handler/index.d.ts.map +1 -0
- package/dist/request-cache-handler/request-cache-handler.d.ts +22 -0
- package/dist/request-cache-handler/request-cache-handler.d.ts.map +1 -0
- package/dist/request-cache-handler/types/index.d.ts +2 -0
- package/dist/request-cache-handler/types/index.d.ts.map +1 -0
- package/dist/{types/keq-cache-option.d.ts → request-cache-handler/types/request-cache-options.d.ts} +6 -4
- package/dist/request-cache-handler/types/request-cache-options.d.ts.map +1 -0
- package/dist/storage/index.d.ts +4 -4
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts +2 -4
- package/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts.map +1 -1
- package/dist/storage/indexed-db-storage/index.d.ts +3 -0
- package/dist/storage/indexed-db-storage/index.d.ts.map +1 -0
- package/dist/storage/indexed-db-storage/indexed-db-storage.d.ts.map +1 -1
- package/dist/storage/indexed-db-storage/types/index.d.ts +7 -0
- package/dist/storage/indexed-db-storage/types/index.d.ts.map +1 -0
- package/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts +1 -1
- package/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts.map +1 -1
- package/dist/storage/internal-storage/internal-storage.d.ts +1 -1
- package/dist/storage/internal-storage/internal-storage.d.ts.map +1 -1
- package/dist/storage/memory-storage/base-memory-storage.d.ts +5 -4
- package/dist/storage/memory-storage/base-memory-storage.d.ts.map +1 -1
- package/dist/storage/memory-storage/index.d.ts +3 -0
- package/dist/storage/memory-storage/index.d.ts.map +1 -0
- package/dist/storage/memory-storage/memory-storage.d.ts +1 -0
- package/dist/storage/memory-storage/memory-storage.d.ts.map +1 -1
- package/dist/storage/memory-storage/types/index.d.ts +3 -0
- package/dist/storage/memory-storage/types/index.d.ts.map +1 -0
- package/dist/storage/memory-storage/types/memory-storage-options.d.ts +1 -1
- package/dist/storage/memory-storage/types/memory-storage-options.d.ts.map +1 -1
- package/dist/storage/memory-storage/utils/humanize-size.d.ts +6 -0
- package/dist/storage/memory-storage/utils/humanize-size.d.ts.map +1 -0
- package/dist/storage/memory-storage/utils/index.d.ts +3 -0
- package/dist/storage/memory-storage/utils/index.d.ts.map +1 -0
- package/dist/storage/memory-storage/utils/serialize-response-body.d.ts +6 -0
- package/dist/storage/memory-storage/utils/serialize-response-body.d.ts.map +1 -0
- package/dist/storage/multi-tier-storage/index.d.ts +1 -0
- package/dist/storage/multi-tier-storage/index.d.ts.map +1 -1
- package/dist/storage/multi-tier-storage/types/index.d.ts +2 -0
- package/dist/storage/multi-tier-storage/types/index.d.ts.map +1 -0
- package/dist/storage/tier-storage/index.d.ts +2 -2
- package/dist/storage/tier-storage/index.d.ts.map +1 -1
- package/dist/storage/tier-storage/types/index.d.ts +2 -0
- package/dist/storage/tier-storage/types/index.d.ts.map +1 -0
- package/dist/strategies/cache-first.d.ts.map +1 -1
- package/dist/strategies/index.d.ts +5 -0
- package/dist/strategies/index.d.ts.map +1 -0
- package/dist/strategies/network-first.d.ts.map +1 -1
- package/dist/strategies/network-only.d.ts.map +1 -1
- package/dist/strategies/stale-while-revalidate.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/keq-cache-key.d.ts +2 -1
- package/dist/types/keq-cache-key.d.ts.map +1 -1
- package/dist/types/keq-cache-pattern.d.ts +3 -0
- package/dist/types/keq-cache-pattern.d.ts.map +1 -0
- package/dist/types/keq-cache-rule.d.ts +4 -4
- package/dist/types/keq-cache-rule.d.ts.map +1 -1
- package/dist/types/keq-cache-strategy.d.ts +2 -2
- package/dist/types/keq-cache-strategy.d.ts.map +1 -1
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +5 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/package.json +6 -11
- package/dist/strategies/utils/cache-context.d.ts +0 -5
- package/dist/strategies/utils/cache-context.d.ts.map +0 -1
- package/dist/strategies/utils/index.d.ts +0 -2
- package/dist/strategies/utils/index.d.ts.map +0 -1
- package/dist/types/keq-cache-option.d.ts.map +0 -1
- package/dist/types/keq-cache-parameters.d.ts +0 -12
- package/dist/types/keq-cache-parameters.d.ts.map +0 -1
- package/dist/types/strategies-options.d.ts +0 -14
- package/dist/types/strategies-options.d.ts.map +0 -1
- package/dist/utils/debug.d.ts +0 -2
- package/dist/utils/debug.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.0.0-alpha.23
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 5f5bdd9: **BREAKING CHANGE:** Simplified KeqCacheStrategy interface.
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- 9ab2c64: Convert non-essential cli tasks into plugins.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- b8d68c7: **Fix:** IndexedDBStorage cannot evict ttl cache
|
|
16
|
+
- 20c7067: **Fix:** Failed to automatically clean up expired cache data when get immediately after initialization.
|
|
17
|
+
- 9a9caa4: Cannot call CacheEntry.response.json multiple times.
|
|
18
|
+
- Updated dependencies [842e555]
|
|
19
|
+
- Updated dependencies [7873a0a]
|
|
20
|
+
- keq@5.0.0-alpha.23
|
|
21
|
+
|
|
22
|
+
## 5.0.0-alpha.22
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [df114d1]
|
|
27
|
+
- keq@5.0.0-alpha.22
|
|
28
|
+
|
|
3
29
|
## 5.0.0-alpha.21
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-entry.d.ts","sourceRoot":"","sources":["../../src/cache-entry/cache-entry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cache-entry.d.ts","sourceRoot":"","sources":["../../src/cache-entry/cache-entry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAI7E,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"}
|
package/dist/cache.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type { Keq, KeqMiddleware, KeqContext } from 'keq';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { KeqCacheStorage } from './storage/keq-cache-storage.js';
|
|
3
|
+
import { RequestCacheOptions } from './request-cache-handler/index.js';
|
|
4
|
+
import { KeqCacheKeyFactory, KeqCacheRule } from './types/index.js';
|
|
5
|
+
export interface KeqCacheOptions {
|
|
6
|
+
storage: KeqCacheStorage;
|
|
7
|
+
/**
|
|
8
|
+
* Cache Key Factory
|
|
9
|
+
*/
|
|
10
|
+
keyFactory?: KeqCacheKeyFactory;
|
|
11
|
+
rules?: KeqCacheRule[];
|
|
12
|
+
}
|
|
4
13
|
declare module 'keq' {
|
|
5
14
|
interface KeqMiddlewareOptions<OP> {
|
|
6
15
|
/**
|
|
7
16
|
* [keq-cache](https://github.com/keq-request/keq-cache)
|
|
8
17
|
*/
|
|
9
|
-
cache(option:
|
|
18
|
+
cache(option: RequestCacheOptions | false): Keq<OP>;
|
|
10
19
|
}
|
|
11
20
|
interface KeqEvents {
|
|
12
21
|
'cache:hit': {
|
|
@@ -26,5 +35,5 @@ declare module 'keq' {
|
|
|
26
35
|
};
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
|
-
export declare function cache(
|
|
38
|
+
export declare function cache(options: KeqCacheOptions): KeqMiddleware;
|
|
30
39
|
//# sourceMappingURL=cache.d.ts.map
|
package/dist/cache.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAuB,MAAM,kCAAkC,CAAA;AAC3F,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGnE,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,eAAe,CAAA;IAExB;;OAEG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAE/B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAA;CACvB;AAGD,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAiB,oBAAoB,CAAC,EAAE;QACtC;;WAEG;QACH,KAAK,CAAC,MAAM,EAAE,mBAAmB,GAAG,KAAK,GAAG,GAAG,CAAC,EAAE,CAAC,CAAA;KACpD;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,OAAO,EAAE,eAAe,GAAG,aAAa,CAuC7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"max-expired-at.d.ts","sourceRoot":"","sources":["../../src/constants/max-expired-at.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,MAA6B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/cache-exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAE/B,qBAAa,cAAe,SAAQ,SAAS;gBAC/B,OAAO,EAAE,MAAM;CAG5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
export * from './cache.js';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export { KeqCacheOption } from './types/keq-cache-option.js';
|
|
7
|
-
export { KeqCacheStrategy } from './types/keq-cache-strategy.js';
|
|
8
|
-
export { KeqCacheParameters } from './types/keq-cache-parameters.js';
|
|
9
|
-
export { KeqCacheRule } from './types/keq-cache-rule.js';
|
|
10
|
-
export { StrategyOptions } from './types/strategies-options.js';
|
|
2
|
+
export { Strategy, Eviction, Size, } from './constants/index.js';
|
|
3
|
+
export { KeqCacheStorage, IndexedDBStorage, MemoryStorage, MultiTierStorage, TierStorage, } from './storage/index.js';
|
|
4
|
+
export { type MemoryStorageOptions, type IndexedDbStorageOptions, type TierStorageOptions, type MultiTierStorageOptions, } from './storage/index.js';
|
|
5
|
+
export { type KeqCacheRule, type KeqCacheKey, type KeqCacheKeyFactory, type KeqCachePattern, type KeqCacheStrategy, } from './types/index.js';
|
|
11
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAE1B,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,GACL,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,WAAW,GACZ,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,kBAAkB,CAAA"}
|