@isdk/proxy 0.1.2 → 0.1.3
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/README.cn.md +59 -1
- package/README.md +59 -1
- package/dist/index.d.mts +113 -22
- package/dist/index.d.ts +113 -22
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/README.md +59 -1
- package/docs/classes/OfflineCacheMissError.md +426 -0
- package/docs/classes/SmartCache.md +30 -10
- package/docs/functions/createCachedFetch.md +1 -1
- package/docs/functions/createFetchWithCache.md +1 -1
- package/docs/functions/extractData.md +1 -1
- package/docs/functions/fetchWithCache.md +14 -15
- package/docs/functions/generateCacheKey.md +1 -1
- package/docs/functions/getSiteConfig.md +1 -1
- package/docs/functions/isAllowed.md +1 -1
- package/docs/functions/isCacheable.md +27 -0
- package/docs/functions/isGlob.md +1 -1
- package/docs/functions/isMatch.md +1 -1
- package/docs/functions/prefetch.md +33 -0
- package/docs/globals.md +10 -0
- package/docs/interfaces/BodyFilterConfig.md +6 -6
- package/docs/interfaces/CacheEntry.md +9 -9
- package/docs/interfaces/CacheMetadata.md +8 -8
- package/docs/interfaces/CacheRule.md +6 -6
- package/docs/interfaces/FetchWithCacheContext.md +11 -13
- package/docs/interfaces/FetchWithCacheOptions.md +7 -9
- package/docs/interfaces/KeyFilterConfig.md +3 -3
- package/docs/interfaces/PrefetchOptions.md +107 -0
- package/docs/interfaces/PrefetchRequest.md +31 -0
- package/docs/interfaces/PrefetchResult.md +47 -0
- package/docs/interfaces/ProxyConfig.md +4 -4
- package/docs/interfaces/SiteCacheConfig.md +19 -9
- package/docs/interfaces/SmartCacheOptions.md +5 -5
- package/docs/variables/OfflineCacheMissErrorCode.md +18 -0
- package/package.json +2 -2
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
[**@isdk/proxy**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/proxy](../globals.md) / PrefetchOptions
|
|
6
|
+
|
|
7
|
+
# Interface: PrefetchOptions
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:17](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L17)
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
### cache
|
|
14
|
+
|
|
15
|
+
> **cache**: [`SmartCache`](../classes/SmartCache.md)
|
|
16
|
+
|
|
17
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:23](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L23)
|
|
18
|
+
|
|
19
|
+
SmartCache 实例
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### concurrency?
|
|
24
|
+
|
|
25
|
+
> `optional` **concurrency**: `number`
|
|
26
|
+
|
|
27
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:27](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L27)
|
|
28
|
+
|
|
29
|
+
并发数,默认 3
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
### config
|
|
34
|
+
|
|
35
|
+
> **config**: [`ProxyConfig`](ProxyConfig.md)
|
|
36
|
+
|
|
37
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:21](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L21)
|
|
38
|
+
|
|
39
|
+
完整的代理配置
|
|
40
|
+
|
|
41
|
+
***
|
|
42
|
+
|
|
43
|
+
### fetcher()?
|
|
44
|
+
|
|
45
|
+
> `optional` **fetcher**: (`req`) => `Promise`\<`Response`\>
|
|
46
|
+
|
|
47
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:25](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L25)
|
|
48
|
+
|
|
49
|
+
自定义 fetcher,默认使用 globalThis.fetch
|
|
50
|
+
|
|
51
|
+
#### Parameters
|
|
52
|
+
|
|
53
|
+
##### req
|
|
54
|
+
|
|
55
|
+
`Request`
|
|
56
|
+
|
|
57
|
+
#### Returns
|
|
58
|
+
|
|
59
|
+
`Promise`\<`Response`\>
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### onProgress()?
|
|
64
|
+
|
|
65
|
+
> `optional` **onProgress**: (`completed`, `total`, `url`) => `void`
|
|
66
|
+
|
|
67
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:29](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L29)
|
|
68
|
+
|
|
69
|
+
进度回调 (completed, total, url)
|
|
70
|
+
|
|
71
|
+
#### Parameters
|
|
72
|
+
|
|
73
|
+
##### completed
|
|
74
|
+
|
|
75
|
+
`number`
|
|
76
|
+
|
|
77
|
+
##### total
|
|
78
|
+
|
|
79
|
+
`number`
|
|
80
|
+
|
|
81
|
+
##### url
|
|
82
|
+
|
|
83
|
+
`string`
|
|
84
|
+
|
|
85
|
+
#### Returns
|
|
86
|
+
|
|
87
|
+
`void`
|
|
88
|
+
|
|
89
|
+
***
|
|
90
|
+
|
|
91
|
+
### signal?
|
|
92
|
+
|
|
93
|
+
> `optional` **signal**: `AbortSignal`
|
|
94
|
+
|
|
95
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:31](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L31)
|
|
96
|
+
|
|
97
|
+
取消信号
|
|
98
|
+
|
|
99
|
+
***
|
|
100
|
+
|
|
101
|
+
### urls
|
|
102
|
+
|
|
103
|
+
> **urls**: [`PrefetchRequest`](PrefetchRequest.md)[]
|
|
104
|
+
|
|
105
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:19](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L19)
|
|
106
|
+
|
|
107
|
+
要预缓存的 URL 列表及其请求选项
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[**@isdk/proxy**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/proxy](../globals.md) / PrefetchRequest
|
|
6
|
+
|
|
7
|
+
# Interface: PrefetchRequest
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:10](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L10)
|
|
10
|
+
|
|
11
|
+
预缓存请求选项
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
### request?
|
|
16
|
+
|
|
17
|
+
> `optional` **request**: `RequestInit`
|
|
18
|
+
|
|
19
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:14](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L14)
|
|
20
|
+
|
|
21
|
+
可选的请求配置(method, headers, body 等)
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
25
|
+
### url
|
|
26
|
+
|
|
27
|
+
> **url**: `string`
|
|
28
|
+
|
|
29
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:12](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L12)
|
|
30
|
+
|
|
31
|
+
请求 URL
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[**@isdk/proxy**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/proxy](../globals.md) / PrefetchResult
|
|
6
|
+
|
|
7
|
+
# Interface: PrefetchResult
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:34](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L34)
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
### errors?
|
|
14
|
+
|
|
15
|
+
> `optional` **errors**: `object`[]
|
|
16
|
+
|
|
17
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:40](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L40)
|
|
18
|
+
|
|
19
|
+
失败详情
|
|
20
|
+
|
|
21
|
+
#### error
|
|
22
|
+
|
|
23
|
+
> **error**: `Error`
|
|
24
|
+
|
|
25
|
+
#### url
|
|
26
|
+
|
|
27
|
+
> **url**: `string`
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### failed
|
|
32
|
+
|
|
33
|
+
> **failed**: `number`
|
|
34
|
+
|
|
35
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:38](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L38)
|
|
36
|
+
|
|
37
|
+
失败数量
|
|
38
|
+
|
|
39
|
+
***
|
|
40
|
+
|
|
41
|
+
### succeeded
|
|
42
|
+
|
|
43
|
+
> **succeeded**: `number`
|
|
44
|
+
|
|
45
|
+
Defined in: [packages/proxy/src/core/prefetch.ts:36](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/prefetch.ts#L36)
|
|
46
|
+
|
|
47
|
+
成功数量
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: ProxyConfig
|
|
8
8
|
|
|
9
|
-
Defined in: [types.ts:
|
|
9
|
+
Defined in: [packages/proxy/src/types.ts:147](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L147)
|
|
10
10
|
|
|
11
11
|
代理拦截器全局配置
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ Defined in: [types.ts:145](https://github.com/isdk/proxy.js/blob/76fee3a101f98e5
|
|
|
16
16
|
|
|
17
17
|
> **default**: [`SiteCacheConfig`](SiteCacheConfig.md)
|
|
18
18
|
|
|
19
|
-
Defined in: [types.ts:
|
|
19
|
+
Defined in: [packages/proxy/src/types.ts:149](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L149)
|
|
20
20
|
|
|
21
21
|
默认缓存配置,当请求的域名未在 sites 中匹配时使用
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ Defined in: [types.ts:147](https://github.com/isdk/proxy.js/blob/76fee3a101f98e5
|
|
|
26
26
|
|
|
27
27
|
> **sites**: `Record`\<`string`, [`SiteCacheConfig`](SiteCacheConfig.md)\>
|
|
28
28
|
|
|
29
|
-
Defined in: [types.ts:
|
|
29
|
+
Defined in: [packages/proxy/src/types.ts:151](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L151)
|
|
30
30
|
|
|
31
31
|
针对特定域名的精细化缓存配置
|
|
32
32
|
|
|
@@ -36,6 +36,6 @@ Defined in: [types.ts:149](https://github.com/isdk/proxy.js/blob/76fee3a101f98e5
|
|
|
36
36
|
|
|
37
37
|
> `optional` **storagePath**: `string`
|
|
38
38
|
|
|
39
|
-
Defined in: [types.ts:
|
|
39
|
+
Defined in: [packages/proxy/src/types.ts:153](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L153)
|
|
40
40
|
|
|
41
41
|
磁盘缓存(cacache)的物理存储路径,可选,默认为系统临时目录
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: SiteCacheConfig
|
|
8
8
|
|
|
9
|
-
Defined in: [types.ts:81](https://github.com/isdk/proxy.js/blob/
|
|
9
|
+
Defined in: [packages/proxy/src/types.ts:81](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L81)
|
|
10
10
|
|
|
11
11
|
站点级缓存配置
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ Defined in: [types.ts:81](https://github.com/isdk/proxy.js/blob/76fee3a101f98e5b
|
|
|
16
16
|
|
|
17
17
|
> `optional` **body**: [`BodyFilterConfig`](BodyFilterConfig.md)
|
|
18
18
|
|
|
19
|
-
Defined in: [types.ts:104](https://github.com/isdk/proxy.js/blob/
|
|
19
|
+
Defined in: [packages/proxy/src/types.ts:104](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L104)
|
|
20
20
|
|
|
21
21
|
请求体过滤配置 (仅限 JSON 类型)。
|
|
22
22
|
当方法为 POST/PUT/PATCH 且为 JSON 格式时,用于从 Body 中提取特定字段参与指纹计算。
|
|
@@ -27,7 +27,7 @@ Defined in: [types.ts:104](https://github.com/isdk/proxy.js/blob/76fee3a101f98e5
|
|
|
27
27
|
|
|
28
28
|
> `optional` **cacheRules**: [`CacheRule`](CacheRule.md)[]
|
|
29
29
|
|
|
30
|
-
Defined in: [types.ts:93](https://github.com/isdk/proxy.js/blob/
|
|
30
|
+
Defined in: [packages/proxy/src/types.ts:93](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L93)
|
|
31
31
|
|
|
32
32
|
精细化缓存规则列表。
|
|
33
33
|
如果配置了此项,请求必须匹配其中至少一条规则才会被允许进入缓存流程。
|
|
@@ -39,7 +39,7 @@ Defined in: [types.ts:93](https://github.com/isdk/proxy.js/blob/76fee3a101f98e5b
|
|
|
39
39
|
|
|
40
40
|
> `optional` **cookies**: [`KeyFilterConfig`](KeyFilterConfig.md)
|
|
41
41
|
|
|
42
|
-
Defined in: [types.ts:99](https://github.com/isdk/proxy.js/blob/
|
|
42
|
+
Defined in: [packages/proxy/src/types.ts:99](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L99)
|
|
43
43
|
|
|
44
44
|
Cookie 过滤配置:决定哪些 Cookie 字段参与缓存指纹计算
|
|
45
45
|
|
|
@@ -49,7 +49,7 @@ Cookie 过滤配置:决定哪些 Cookie 字段参与缓存指纹计算
|
|
|
49
49
|
|
|
50
50
|
> `optional` **forceCache**: `boolean`
|
|
51
51
|
|
|
52
|
-
Defined in: [types.ts:108](https://github.com/isdk/proxy.js/blob/
|
|
52
|
+
Defined in: [packages/proxy/src/types.ts:108](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L108)
|
|
53
53
|
|
|
54
54
|
强制缓存:是否忽略 `Cache-Control: no-store` 等指令强制入库。
|
|
55
55
|
|
|
@@ -59,7 +59,7 @@ Defined in: [types.ts:108](https://github.com/isdk/proxy.js/blob/76fee3a101f98e5
|
|
|
59
59
|
|
|
60
60
|
> `optional` **headers**: [`KeyFilterConfig`](KeyFilterConfig.md)
|
|
61
61
|
|
|
62
|
-
Defined in: [types.ts:97](https://github.com/isdk/proxy.js/blob/
|
|
62
|
+
Defined in: [packages/proxy/src/types.ts:97](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L97)
|
|
63
63
|
|
|
64
64
|
请求头过滤配置:决定哪些 Header 参与缓存指纹计算
|
|
65
65
|
|
|
@@ -69,7 +69,7 @@ Defined in: [types.ts:97](https://github.com/isdk/proxy.js/blob/76fee3a101f98e5b
|
|
|
69
69
|
|
|
70
70
|
> `optional` **methods**: `string`[]
|
|
71
71
|
|
|
72
|
-
Defined in: [types.ts:87](https://github.com/isdk/proxy.js/blob/
|
|
72
|
+
Defined in: [packages/proxy/src/types.ts:87](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L87)
|
|
73
73
|
|
|
74
74
|
允许缓存的 HTTP 方法列表。
|
|
75
75
|
默认值: ['GET', 'HEAD']。
|
|
@@ -77,11 +77,21 @@ Defined in: [types.ts:87](https://github.com/isdk/proxy.js/blob/76fee3a101f98e5b
|
|
|
77
77
|
|
|
78
78
|
***
|
|
79
79
|
|
|
80
|
+
### offline?
|
|
81
|
+
|
|
82
|
+
> `optional` **offline**: `boolean`
|
|
83
|
+
|
|
84
|
+
Defined in: [packages/proxy/src/types.ts:110](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L110)
|
|
85
|
+
|
|
86
|
+
严格离线模式:不发起任何网络请求,只读缓存。缓存未命中时抛出 OfflineCacheMissError
|
|
87
|
+
|
|
88
|
+
***
|
|
89
|
+
|
|
80
90
|
### query?
|
|
81
91
|
|
|
82
92
|
> `optional` **query**: [`KeyFilterConfig`](KeyFilterConfig.md)
|
|
83
93
|
|
|
84
|
-
Defined in: [types.ts:95](https://github.com/isdk/proxy.js/blob/
|
|
94
|
+
Defined in: [packages/proxy/src/types.ts:95](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L95)
|
|
85
95
|
|
|
86
96
|
Query 参数过滤配置:决定哪些查询参数参与缓存指纹 (Cache Key) 的计算
|
|
87
97
|
|
|
@@ -91,6 +101,6 @@ Query 参数过滤配置:决定哪些查询参数参与缓存指纹 (Cache Key
|
|
|
91
101
|
|
|
92
102
|
> `optional` **staleIfError**: `boolean`
|
|
93
103
|
|
|
94
|
-
Defined in: [types.ts:106](https://github.com/isdk/proxy.js/blob/
|
|
104
|
+
Defined in: [packages/proxy/src/types.ts:106](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/types.ts#L106)
|
|
95
105
|
|
|
96
106
|
容错机制:当后端请求失败(网络错误或 5xx)且存在旧缓存时,是否强制返回旧缓存
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: SmartCacheOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [core/SmartCache.ts:10](https://github.com/isdk/proxy.js/blob/
|
|
9
|
+
Defined in: [packages/proxy/src/core/SmartCache.ts:10](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/SmartCache.ts#L10)
|
|
10
10
|
|
|
11
11
|
SmartCache 选项
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ SmartCache 选项
|
|
|
16
16
|
|
|
17
17
|
> `optional` **maxMemorySize**: `number`
|
|
18
18
|
|
|
19
|
-
Defined in: [core/SmartCache.ts:14](https://github.com/isdk/proxy.js/blob/
|
|
19
|
+
Defined in: [packages/proxy/src/core/SmartCache.ts:14](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/SmartCache.ts#L14)
|
|
20
20
|
|
|
21
21
|
内存缓存阈值(字节)。响应体大小超过此值时,Body 将只存入磁盘,而 Meta 仍保留在内存。默认 1MB。
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ Defined in: [core/SmartCache.ts:14](https://github.com/isdk/proxy.js/blob/76fee3
|
|
|
26
26
|
|
|
27
27
|
> `optional` **maxTotalMemorySize**: `number`
|
|
28
28
|
|
|
29
|
-
Defined in: [core/SmartCache.ts:16](https://github.com/isdk/proxy.js/blob/
|
|
29
|
+
Defined in: [packages/proxy/src/core/SmartCache.ts:16](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/SmartCache.ts#L16)
|
|
30
30
|
|
|
31
31
|
内存缓存总大小阈值(字节)。默认 100MB。超过此值将清空内存缓存。
|
|
32
32
|
|
|
@@ -36,7 +36,7 @@ Defined in: [core/SmartCache.ts:16](https://github.com/isdk/proxy.js/blob/76fee3
|
|
|
36
36
|
|
|
37
37
|
> `optional` **memoryOptions**: `object`
|
|
38
38
|
|
|
39
|
-
Defined in: [core/SmartCache.ts:18](https://github.com/isdk/proxy.js/blob/
|
|
39
|
+
Defined in: [packages/proxy/src/core/SmartCache.ts:18](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/SmartCache.ts#L18)
|
|
40
40
|
|
|
41
41
|
透传给 L1 (Memory) 的高级配置 (secondary-cache LRUCache options)
|
|
42
42
|
|
|
@@ -62,6 +62,6 @@ Defined in: [core/SmartCache.ts:18](https://github.com/isdk/proxy.js/blob/76fee3
|
|
|
62
62
|
|
|
63
63
|
> `optional` **storagePath**: `string`
|
|
64
64
|
|
|
65
|
-
Defined in: [core/SmartCache.ts:12](https://github.com/isdk/proxy.js/blob/
|
|
65
|
+
Defined in: [packages/proxy/src/core/SmartCache.ts:12](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/core/SmartCache.ts#L12)
|
|
66
66
|
|
|
67
67
|
磁盘缓存的物理路径。如果不提供,将默认使用系统临时目录。
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[**@isdk/proxy**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/proxy](../globals.md) / OfflineCacheMissErrorCode
|
|
6
|
+
|
|
7
|
+
# Variable: OfflineCacheMissErrorCode
|
|
8
|
+
|
|
9
|
+
> `const` **OfflineCacheMissErrorCode**: `OfflineCacheMiss` = `ErrorCode.OfflineCacheMiss`
|
|
10
|
+
|
|
11
|
+
Defined in: [packages/proxy/src/errors.ts:14](https://github.com/isdk/proxy.js/blob/a1563efa4c3081261eb3af8a6404f1b704b33bf1/src/errors.ts#L14)
|
|
12
|
+
|
|
13
|
+
Offline 缓存未命中错误代码
|
|
14
|
+
|
|
15
|
+
当处于 offline 模式且请求的 URL 没有对应缓存时抛出。
|
|
16
|
+
这帮助调用者区分:
|
|
17
|
+
- 网络请求失败(其他错误类型)
|
|
18
|
+
- offline 模式下缓存不存在(本错误)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isdk/proxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A framework-agnostic, high-performance hybrid caching middleware with SWR, request collapsing, and stale-if-error support.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Riceball LEE <snowyu.lee@gmail.com>",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@isdk/common-error": "^0.2.
|
|
22
|
+
"@isdk/common-error": "^0.2.2",
|
|
23
23
|
"cacache": "^20.0.4",
|
|
24
24
|
"events-ex": "^2.3.1",
|
|
25
25
|
"http-cache-semantics": "^4.2.0",
|