@keq-request/cache 5.0.0-alpha.7

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 ADDED
@@ -0,0 +1,138 @@
1
+ # Changelog
2
+
3
+ ## 5.0.0-alpha.7
4
+
5
+ ### Major Changes
6
+
7
+ - 5175097: **BREAKING CHANGE:** group all packages under the @keq-request scope
8
+
9
+ - keq-cache => @keq-request/cache
10
+ - keq-headers => @keq-request/headers
11
+ - keq-cli => @keq-request/cli
12
+ - keq-url => @keq-request/url
13
+ - keq-exception => @keq-request/exception
14
+
15
+ - 153244f: **BREAKING CHANGE:** `onNetworkResponse` has been removed, please use `.on('cache:update', callback)` instead.
16
+
17
+ ### Minor Changes
18
+
19
+ - 153244f: **Feat:** Add `onCacheGet`, `onCacheSet`, `onCacheRemove`, `onCacheEvict` and `onCacheExpired` hook for `MemoryStorage` and `IndexedDBStorage`.
20
+ - 153244f: **Feat:** Add `cache:hit`, `cache:miss` and `cache:update` to keq events.
21
+
22
+ ### Patch Changes
23
+
24
+ - 153244f: **Feat:** `pattern` accept boolean and defaults to true
25
+ - 153244f: **Fix:** unable to cache modified `ctx.res`.
26
+ - Updated dependencies [153244f]
27
+ - Updated dependencies [153244f]
28
+ - Updated dependencies [153244f]
29
+ - Updated dependencies [153244f]
30
+ - Updated dependencies [153244f]
31
+ - Updated dependencies [7ff2162]
32
+ - Updated dependencies [153244f]
33
+ - Updated dependencies [153244f]
34
+ - Updated dependencies [153244f]
35
+ - Updated dependencies [153244f]
36
+ - Updated dependencies [153244f]
37
+ - keq@5.0.0-alpha.7
38
+
39
+ ## [2.1.1](https://github.com/keq-request/keq-cache/compare/v2.1.0...v2.1.1) (2025-07-11)
40
+
41
+ ### Bug Fixes
42
+
43
+ - missing .js ext ([609631a](https://github.com/keq-request/keq-cache/commit/609631af7334fa41f42b9607137c61be1435e29e))
44
+
45
+ ## [2.1.0](https://github.com/keq-request/keq-cache/compare/v2.0.0...v2.1.0) (2025-07-03)
46
+
47
+ ### Features
48
+
49
+ - add MultiTierStorage ([07a293b](https://github.com/keq-request/keq-cache/commit/07a293b75689c33ee05f31bd3446856244f83aa4))
50
+ - add TierStorage ([02ceb48](https://github.com/keq-request/keq-cache/commit/02ceb4885f8a413fddd9fa732c0a2223a809b1f5))
51
+ - custom strategy ([3053306](https://github.com/keq-request/keq-cache/commit/3053306cfa408b9ed72a1d5fbbb9d4bbdfe7e816))
52
+
53
+ ### Bug Fixes
54
+
55
+ - wrong class name ([91989ea](https://github.com/keq-request/keq-cache/commit/91989eaeb1241d16128f08351f95b7b1b1c9fd22))
56
+
57
+ ## [2.0.0](https://github.com/keq-request/keq-cache/compare/v1.2.2...v2.0.0) (2025-05-26)
58
+
59
+ ### ⚠ BREAKING CHANGES
60
+
61
+ - maxStorageSize and threshold is removed, please use size parameter of Storage
62
+
63
+ ### Features
64
+
65
+ - custom storage support ([bebd310](https://github.com/keq-request/keq-cache/commit/bebd3106c735fcb5b12142a3d1c19025806a2098))
66
+
67
+ ### Bug Fixes
68
+
69
+ - memory storage does not specify the isolation scope ([99da6d7](https://github.com/keq-request/keq-cache/commit/99da6d7c23b2b91eb12075195a5d55ae1021fab0))
70
+
71
+ ## [1.2.2](https://github.com/keq-request/keq-cache/compare/v1.2.1...v1.2.2) (2025-04-27)
72
+
73
+ ### Performance Improvements
74
+
75
+ - 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)
76
+
77
+ ## [1.2.1](https://github.com/keq-request/keq-cache/compare/v1.2.0...v1.2.1) (2025-04-23)
78
+
79
+ ### Bug Fixes
80
+
81
+ - should not add proxy to indexed db ([02b5442](https://github.com/keq-request/keq-cache/commit/02b54429856f4e343cd04d98cfb78a1d99e31249))
82
+
83
+ ## [1.2.0](https://github.com/keq-request/keq-cache/compare/v1.1.0...v1.2.0) (2025-04-22)
84
+
85
+ ### Features
86
+
87
+ - add exclude options used exlcude the response should not be cached ([4f6aa79](https://github.com/keq-request/keq-cache/commit/4f6aa793b4aa671695ee1e792dcf1de83b66b37b))
88
+
89
+ ### Bug Fixes
90
+
91
+ - response is consumed abnormally ([3b6d204](https://github.com/keq-request/keq-cache/commit/3b6d204f94982219e27f751b162396bd1ff27548))
92
+
93
+ ## [1.1.0](https://github.com/keq-request/keq-cache/compare/v1.0.6...v1.1.0) (2025-04-18)
94
+
95
+ ### Features
96
+
97
+ - add onNetworkResponse event ([d9b94d0](https://github.com/keq-request/keq-cache/commit/d9b94d0e5d3dd172d48c8228ba51ad32d1eeee41))
98
+
99
+ ## [1.0.6](https://github.com/keq-request/keq-cache/compare/v1.0.5...v1.0.6) (2025-04-16)
100
+
101
+ ### Bug Fixes
102
+
103
+ - cannot find idb package ([b33e267](https://github.com/keq-request/keq-cache/commit/b33e267b7eb845e9e78c2ccb5d2a33db0ee7973a))
104
+
105
+ ## [1.0.5](https://github.com/keq-request/keq-cache/compare/v1.0.4...v1.0.5) (2025-04-16)
106
+
107
+ ### Bug Fixes
108
+
109
+ - cannot find idb package ([031f453](https://github.com/keq-request/keq-cache/commit/031f45358713cff0fe95a13613c2bf8b72fcb5c8))
110
+
111
+ ## [1.0.4](https://github.com/keq-request/keq-cache/compare/v1.0.3...v1.0.4) (2024-11-25)
112
+
113
+ ### Bug Fixes
114
+
115
+ - indexed-db not work ([187ed1f](https://github.com/keq-request/keq-cache/commit/187ed1ff399ca681a683c2b4d615963aced202b8))
116
+
117
+ ## [1.0.3](https://github.com/keq-request/keq-cache/compare/v1.0.2...v1.0.3) (2024-11-19)
118
+
119
+ ### Bug Fixes
120
+
121
+ - update import statements to include file extensions for esm ([f7118ee](https://github.com/keq-request/keq-cache/commit/f7118eeb2913ce48dc2bc53c99b831d52ecb8098))
122
+
123
+ ## [1.0.2](https://github.com/keq-request/keq-cache/compare/v1.0.1...v1.0.2) (2024-11-19)
124
+
125
+ ### Bug Fixes
126
+
127
+ - update import statements to include file extensions for esm ([49ed02f](https://github.com/keq-request/keq-cache/commit/49ed02f64e15f14a04c8f54281b913545db97af2))
128
+
129
+ ## 1.0.1 (2024-11-18)
130
+
131
+ ### Bug Fixes
132
+
133
+ - ctx.options.cache not working ([4f327eb](https://github.com/keq-request/keq-cache/commit/4f327eb887698b51cb44ebe4742f9e79a94fa30d))
134
+ - update cache strategy handling to enforce required strategy option ([7798327](https://github.com/keq-request/keq-cache/commit/77983270544286046ab47df11b39c054fa84164e))
135
+
136
+ ### Miscellaneous Chores
137
+
138
+ - 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,14 @@
1
+ import type { Config } from 'jest'
2
+ import { pathsToModuleNameMapper } from 'ts-jest'
3
+ import { compilerOptions } from './tsconfig.json'
4
+
5
+
6
+ export default async (): Promise<Config> => ({
7
+ preset: 'ts-jest',
8
+ setupFilesAfterEnv: ['<rootDir>/__tests__/setup.ts'],
9
+ moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/src', useESM: true }),
10
+ testMatch: [
11
+ '<rootDir>/__tests__/**/*.spec.ts',
12
+ '<rootDir>/src/**/*.spec.ts',
13
+ ],
14
+ })
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@keq-request/cache",
3
+ "version": "5.0.0-alpha.7",
4
+ "description": "Adds request caching capabilities similar to service workers",
5
+ "keywords": [
6
+ "keq",
7
+ "cache"
8
+ ],
9
+ "license": "MIT",
10
+ "author": "Val.istar.Guo <val.istar.guo@gmail.com>",
11
+ "types": "dist/index.d.ts",
12
+ "main": "dist/index.js",
13
+ "exports": {
14
+ ".": {
15
+ "require": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "import": {
20
+ "types": "./dist/index.d.mts",
21
+ "default": "./dist/index.mjs"
22
+ }
23
+ }
24
+ },
25
+ "homepage": "https://github.com/keq-request/keq#readme",
26
+ "bugs": {
27
+ "url": "https://github.com/keq-request/keq/issues"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/keq-request/keq.git"
32
+ },
33
+ "devDependencies": {
34
+ "@types/node": "^20.19.24",
35
+ "@types/ramda": "^0.31.1",
36
+ "fake-indexeddb": "^6.2.4",
37
+ "isomorphic-fetch": "^3.0.0",
38
+ "keq": "5.0.0-alpha.7",
39
+ "@keq-request/test": "5.0.0-alpha.7"
40
+ },
41
+ "engines": {
42
+ "node": ">=18.0.0"
43
+ },
44
+ "peerDependencies": {
45
+ "keq": "^5.0.0-alpha.7"
46
+ },
47
+ "dependencies": {
48
+ "dayjs": "^1.11.19",
49
+ "idb": "^8.0.3",
50
+ "ramda": "^0.32.0",
51
+ "type-fest": "^5.2.0"
52
+ },
53
+ "scripts": {
54
+ "build": "tsup",
55
+ "dev": "tsup --watch",
56
+ "test": "jest",
57
+ "test:update": "jest --updateSnapshot"
58
+ }
59
+ }