@blaze-cache/fetch 0.3.0 → 0.4.0-beta.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.
- package/README.md +109 -12
- package/dist/cache-control.d.ts +1 -1
- package/dist/cache-control.d.ts.map +1 -1
- package/dist/cache-control.js +1 -1
- package/dist/cache-control.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +132 -19
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/key.d.ts +38 -6
- package/dist/key.d.ts.map +1 -1
- package/dist/key.js +99 -9
- package/dist/key.js.map +1 -1
- package/dist/types.d.ts +115 -12
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
<h1 align="center">@blaze-cache/fetch</h1>
|
|
6
6
|
|
|
7
7
|
A drop-in `fetch()` replacement backed by a WebAssembly cache — TTLs, `Cache-Control`,
|
|
8
|
-
stale-while-revalidate
|
|
8
|
+
stale-while-revalidate, per-request `blazeCache` options and `HIT`/`MISS` observability
|
|
9
|
+
(`x-blaze-cache` plus `response.fromBlazeCache`).
|
|
9
10
|
|
|
10
11
|
## Install
|
|
11
12
|
|
|
@@ -27,11 +28,13 @@ const fetch = createBlazeFetch(cache, { ttlMs: 30_000 });
|
|
|
27
28
|
|
|
28
29
|
const response = await fetch('/api/users');
|
|
29
30
|
response.headers.get('x-blaze-cache'); // 'MISS' …
|
|
31
|
+
response.fromBlazeCache; // … false: it came off the wire
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
```ts
|
|
33
35
|
const again = await fetch('/api/users');
|
|
34
36
|
again.headers.get('x-blaze-cache'); // … then 'HIT'
|
|
37
|
+
again.fromBlazeCache; // … then true: replayed from the store
|
|
35
38
|
await again.json(); // the body replayed from the cache
|
|
36
39
|
```
|
|
37
40
|
|
|
@@ -46,8 +49,14 @@ window.fetch = fetch; // now every request in the app is cache
|
|
|
46
49
|
## Behaviour
|
|
47
50
|
|
|
48
51
|
* **Only `GET` is cached** — pass `methods: ['GET', 'HEAD']` to include `HEAD`. Everything
|
|
49
|
-
else (including errors from uncached methods) always goes to the network
|
|
50
|
-
|
|
52
|
+
else (including errors from uncached methods) always goes to the network, unless one
|
|
53
|
+
request opts itself in with `blazeCache: { enabled: true }`. A method you
|
|
54
|
+
*do* list is only stored (or coalesced) when its body can be folded into the cache key —
|
|
55
|
+
two different payloads to the same URL must never share an entry — so a body the key
|
|
56
|
+
cannot read (a stream, a `Blob`, raw bytes) leaves that request uncached unless you
|
|
57
|
+
supply a `key` callback that describes it.
|
|
58
|
+
* **`Cache-Control` is honoured on both sides** when `honourCacheControl` is on (the
|
|
59
|
+
default; `cacheControl` is its alias):
|
|
51
60
|
on the request, `no-store`/`no-cache` and `max-age=0` skip the read; on the response,
|
|
52
61
|
`max-age` overrides `ttlMs`, `Age` is deducted, and `no-store`/`no-cache` — the per-field
|
|
53
62
|
`no-cache="set-cookie"` form included — stop it being stored.
|
|
@@ -69,11 +78,15 @@ window.fetch = fetch; // now every request in the app is cache
|
|
|
69
78
|
a response varying on a header you have not put in `varyHeaders` is left uncached rather
|
|
70
79
|
than replay a variant to the wrong caller. Server headers missing from `varyHeaders`?
|
|
71
80
|
That is the safe default working as intended — list them to opt in. The check runs
|
|
72
|
-
before *every* store, `
|
|
81
|
+
before *every* store, `honourCacheControl: false` included: variant correctness is not a
|
|
73
82
|
freshness preference.
|
|
74
83
|
* **A hit is a real `Response`** — status, status text, headers, body, `url` after a
|
|
75
84
|
redirect and `redirected` are replayed exactly, so your code cannot tell the difference
|
|
76
85
|
apart from the marker header.
|
|
86
|
+
* **Every response says where it came from** — `response.fromBlazeCache` is `false` on a
|
|
87
|
+
network `MISS` and `true` on a `HIT`/`STALE`, cache bypasses included, so you can branch
|
|
88
|
+
without sniffing headers; `x-blaze-cache` carries the same information for the network
|
|
89
|
+
panel.
|
|
77
90
|
* **Binary, `Blob` and chunked bodies are first-class** — the payload is buffered as raw
|
|
78
91
|
bytes whether it arrived as a file, a `ReadableStream` or plain text, so an image
|
|
79
92
|
replays byte-for-byte with its `content-type` intact and `blob().type`/`blob().size`
|
|
@@ -87,10 +100,10 @@ window.fetch = fetch; // now every request in the app is cache
|
|
|
87
100
|
bytes — which breaks anything that measures a download. `HEAD` keeps its headers: no
|
|
88
101
|
body was sent, so its `content-length` is what a GET *would* return.
|
|
89
102
|
* **Failures behave like plain `fetch`** — a rejected network call still rejects; a cache
|
|
90
|
-
that cannot store a response never breaks the request that produced it. Reads, writes
|
|
91
|
-
and the `shouldCache` callback are all guarded: the first cache-layer
|
|
92
|
-
announced once on the console, then the wrapper keeps working *without* the
|
|
93
|
-
than warning on every call.
|
|
103
|
+
that cannot store a response never breaks the request that produced it. Reads, writes,
|
|
104
|
+
the `key` callback and the `shouldCache` callback are all guarded: the first cache-layer
|
|
105
|
+
failure is announced once on the console, then the wrapper keeps working *without* the
|
|
106
|
+
cache rather than warning on every call.
|
|
94
107
|
* **Cache activity is observable** — the wrapper reads with `cache.get` and writes with
|
|
95
108
|
`cache.set`, so the shared cache's typed event system sees every request it serves:
|
|
96
109
|
|
|
@@ -109,7 +122,7 @@ window.fetch = fetch; // now every request in the app is cache
|
|
|
109
122
|
const fetch = createBlazeFetch(cache, {
|
|
110
123
|
ttlMs: 30_000, // number | (response, url, init) => number
|
|
111
124
|
methods: ['GET'], // which methods are cacheable
|
|
112
|
-
|
|
125
|
+
honourCacheControl: true, // honour Cache-Control (alias: cacheControl)
|
|
113
126
|
staleWhileRevalidate: false, // true | milliseconds — see below
|
|
114
127
|
key: (url, init) => `${init.method} ${url}`, // custom cache key
|
|
115
128
|
shouldCache: (response) => response.ok, // which responses are stored
|
|
@@ -124,9 +137,9 @@ const fetch = createBlazeFetch(cache, {
|
|
|
124
137
|
| --- | --- | --- |
|
|
125
138
|
| `ttlMs` | `60_000` | Freshness window. Overridden by a response `max-age`. |
|
|
126
139
|
| `methods` | `['GET']` | Methods eligible for caching. |
|
|
127
|
-
| `
|
|
140
|
+
| `honourCacheControl` | `true` | Honour `Cache-Control`/`Age` on both sides. `cacheControl` is an accepted alias. |
|
|
128
141
|
| `staleWhileRevalidate` | `false` | Serve stale entries while refreshing. A number is the fallback window when the response omits the directive. |
|
|
129
|
-
| `key` | method + URL + vary hash | Custom cache key. |
|
|
142
|
+
| `key` | method + URL + vary/body hash | Custom cache key. Supplying one also opts a body-carrying request into caching. |
|
|
130
143
|
| `shouldCache` | `2xx` | Which responses are stored. |
|
|
131
144
|
| `tags` | `['fetch', '<method> <url>']` | Tags for `cache.invalidateTags(...)`. |
|
|
132
145
|
| `varyHeaders` | `['authorization']` | Request headers folded into the default key. |
|
|
@@ -141,6 +154,80 @@ await fetch('/api/users', { cache: 'no-cache' }); // the standard spelling of
|
|
|
141
154
|
await fetch('/api/users', { cache: 'no-store' }); // neither read nor write
|
|
142
155
|
```
|
|
143
156
|
|
|
157
|
+
## Recommended configuration
|
|
158
|
+
|
|
159
|
+
A solid starting point for a personalized API:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
const fetch = createBlazeFetch(cache, {
|
|
163
|
+
ttlMs: 30_000,
|
|
164
|
+
methods: ['GET', 'HEAD'],
|
|
165
|
+
honourCacheControl: true,
|
|
166
|
+
varyHeaders: ['Authorization'],
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
`ttlMs` is the freshness fallback (a response `max-age` still wins), `GET` and `HEAD` are
|
|
171
|
+
the methods worth storing, `Cache-Control`/`Age` are obeyed on both sides, and every
|
|
172
|
+
identity's `Authorization` value is hashed into its own key — so one user's response is
|
|
173
|
+
never replayed to another.
|
|
174
|
+
|
|
175
|
+
## Per-request options
|
|
176
|
+
|
|
177
|
+
Every request may override the wrapper's defaults through `blazeCache` — or switch the
|
|
178
|
+
cache off for that call entirely:
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
// bypass — neither read nor written; the network answers as usual
|
|
182
|
+
await fetch('/api/users/1', { blazeCache: false });
|
|
183
|
+
|
|
184
|
+
// custom TTL, tags and key for one request
|
|
185
|
+
await fetch('/api/users/1', {
|
|
186
|
+
blazeCache: {
|
|
187
|
+
ttlMs: 30_000,
|
|
188
|
+
tags: ['user', 'user:1'],
|
|
189
|
+
key: 'user:1',
|
|
190
|
+
varyHeaders: ['Authorization'],
|
|
191
|
+
forceRefresh: true, // skip the read; the fresh response is still stored
|
|
192
|
+
invalidateTags: ['todos'], // dropped after the network responds
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// invalidate after a mutation — the response itself is never cached
|
|
197
|
+
await fetch('/api/todos', {
|
|
198
|
+
method: 'POST',
|
|
199
|
+
body: JSON.stringify({ text: 'x' }),
|
|
200
|
+
blazeCache: { invalidateTags: ['todos'] },
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
| Override | Effect |
|
|
205
|
+
| --- | --- |
|
|
206
|
+
| `enabled` | `false` bypasses the read **and** the write for this call; `true` opts a method outside `methods` into caching. |
|
|
207
|
+
| `ttlMs` | Freshness window for this response — a number or `(response, url, init) => number`. |
|
|
208
|
+
| `tags` | Tags for this entry — an array or a function; replaces the wrapper's `tags`. |
|
|
209
|
+
| `key` | Cache key as a string, or `(url, init) => string`. It owns the whole key, so it also opts a body-carrying request into caching. |
|
|
210
|
+
| `varyHeaders` | Headers folded into this request's key (and checked against the response's `Vary`). |
|
|
211
|
+
| `forceRefresh` | Skip the cache read; the fresh response still replaces the entry. |
|
|
212
|
+
| `invalidateTags` | Tags dropped **after** the network responds — even when the request itself is never cached. Requires a cache with `invalidateTags`. |
|
|
213
|
+
|
|
214
|
+
`invalidateTags` runs only after a *successful* network call (a failed request invalidates
|
|
215
|
+
nothing) and before anything is stored, so the response to the mutation survives its own
|
|
216
|
+
invalidation. The same drops are available from outside a request with
|
|
217
|
+
`invalidateCacheTags(cache, ...tags)` — see [Invalidating](#invalidating).
|
|
218
|
+
|
|
219
|
+
## HIT / MISS observability
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
const response = await fetch('/api/users');
|
|
223
|
+
response.fromBlazeCache; // false on a MISS, true on a HIT or STALE
|
|
224
|
+
response.headers.get('x-blaze-cache'); // 'MISS' | 'HIT' | 'STALE' — same, for the network panel
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Both are set on **every** response the wrapper returns — `blazeCache: false` bypasses
|
|
228
|
+
included — so `fromBlazeCache` is always a boolean. `markerHeader` renames or removes the
|
|
229
|
+
header; the boolean is unaffected by it.
|
|
230
|
+
|
|
144
231
|
## Stale-while-revalidate
|
|
145
232
|
|
|
146
233
|
```ts
|
|
@@ -169,13 +256,23 @@ cache.invalidateTags('get /api/users'); // one resource
|
|
|
169
256
|
cache.set('get /api/users', /* … */); // … or just overwrite it
|
|
170
257
|
```
|
|
171
258
|
|
|
259
|
+
A request can do the same to itself after a mutation with
|
|
260
|
+
`blazeCache: { invalidateTags: [...] }` (see [Per-request options](#per-request-options)),
|
|
261
|
+
and code outside any request has the exported helper:
|
|
262
|
+
|
|
263
|
+
```ts
|
|
264
|
+
import { invalidateCacheTags } from '@blaze-cache/fetch';
|
|
265
|
+
|
|
266
|
+
invalidateCacheTags(cache, 'fetch', 'get /api/users'); // no-op without invalidateTags
|
|
267
|
+
```
|
|
268
|
+
|
|
172
269
|
## Custom keys
|
|
173
270
|
|
|
174
271
|
```ts
|
|
175
272
|
import { createBlazeFetch, defaultCacheKey } from '@blaze-cache/fetch';
|
|
176
273
|
|
|
177
274
|
const fetch = createBlazeFetch(cache, {
|
|
178
|
-
// Keep the default (method + URL + vary hash) and add a version prefix:
|
|
275
|
+
// Keep the default (method + URL + vary/body hash) and add a version prefix:
|
|
179
276
|
key: (url, init) => `v2:${defaultCacheKey(url, init, ['authorization'])}`,
|
|
180
277
|
});
|
|
181
278
|
```
|
package/dist/cache-control.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface CacheControl {
|
|
|
18
18
|
/** `stale-while-revalidate=<seconds>`, converted to milliseconds. */
|
|
19
19
|
staleWhileRevalidateMs: number | undefined;
|
|
20
20
|
}
|
|
21
|
-
/** The value used when parsing is switched off (`
|
|
21
|
+
/** The value used when parsing is switched off (`honourCacheControl: false`) or a header is absent. */
|
|
22
22
|
export declare const NO_DIRECTIVES: CacheControl;
|
|
23
23
|
/**
|
|
24
24
|
* Minimal `Cache-Control` parser — only the directives a client-side cache acts on.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-control.d.ts","sourceRoot":"","sources":["../src/cache-control.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,2GAA2G;IAC3G,OAAO,EAAE,OAAO,CAAC;IACjB,0GAA0G;IAC1G,cAAc,EAAE,OAAO,CAAC;IACxB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,qEAAqE;IACrE,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5C;AAED,
|
|
1
|
+
{"version":3,"file":"cache-control.d.ts","sourceRoot":"","sources":["../src/cache-control.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,2GAA2G;IAC3G,OAAO,EAAE,OAAO,CAAC;IACjB,0GAA0G;IAC1G,cAAc,EAAE,OAAO,CAAC;IACxB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,qEAAqE;IACrE,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5C;AAED,uGAAuG;AACvG,eAAO,MAAM,aAAa,EAAE,YAM1B,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,YAAY,CAuChF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAYnG;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAInE"}
|
package/dist/cache-control.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `@blaze-cache/axios` does not, and each package is free to grow its own directives without
|
|
7
7
|
* dragging the others along.
|
|
8
8
|
*/
|
|
9
|
-
/** The value used when parsing is switched off (`
|
|
9
|
+
/** The value used when parsing is switched off (`honourCacheControl: false`) or a header is absent. */
|
|
10
10
|
export const NO_DIRECTIVES = Object.freeze({
|
|
11
11
|
noStore: false,
|
|
12
12
|
noCache: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-control.js","sourceRoot":"","sources":["../src/cache-control.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,
|
|
1
|
+
{"version":3,"file":"cache-control.js","sourceRoot":"","sources":["../src/cache-control.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,uGAAuG;AACvG,MAAM,CAAC,MAAM,aAAa,GAAiB,MAAM,CAAC,MAAM,CAAC;IACvD,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,cAAc,EAAE,KAAK;IACrB,QAAQ,EAAE,SAAS;IACnB,sBAAsB,EAAE,SAAS;CAClC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAgC;IAChE,MAAM,MAAM,GAAiB;QAC3B,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,KAAK;QACd,cAAc,EAAE,KAAK;QACrB,QAAQ,EAAE,SAA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tF,CAAC;AAED,iGAAiG;AACjG,SAAS,OAAO,CAAC,GAAW;IAC1B,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,uFAAuF;IACvF,mFAAmF;IACnF,0FAA0F;IAC1F,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACrC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACzE,CAAC"}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EAKnB,iBAAiB,EAGlB,MAAM,YAAY,CAAC;AAuBpB;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,mBAAmB,EAC1B,OAAO,GAAE,iBAAsB,GAC9B,UAAU,CA8aZ"}
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NO_DIRECTIVES, parseAgeMs, parseCacheControl, varyIsStorable } from './cache-control.js';
|
|
2
|
-
import { defaultCacheKey } from './key.js';
|
|
2
|
+
import { defaultCacheKey, encodeRequestBody } from './key.js';
|
|
3
3
|
import { isRequest, normalizeInit, resolveMethod, resolveUrl } from './request.js';
|
|
4
4
|
/** Freshness window when neither the option nor `Cache-Control` says otherwise. */
|
|
5
5
|
const DEFAULT_TTL_MS = 60_000;
|
|
@@ -41,7 +41,8 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
41
41
|
const network = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
|
|
42
42
|
const markerHeader = options.markerHeader === undefined ? DEFAULT_MARKER_HEADER : options.markerHeader;
|
|
43
43
|
const methods = new Set((options.methods ?? DEFAULT_METHODS).map((method) => method.toUpperCase()));
|
|
44
|
-
|
|
44
|
+
// `honourCacheControl` is the axios-consistent spelling; `cacheControl` is its alias.
|
|
45
|
+
const honourCacheControl = options.honourCacheControl ?? options.cacheControl ?? true;
|
|
45
46
|
const varyHeaders = options.varyHeaders ?? DEFAULT_VARY_HEADERS;
|
|
46
47
|
const shouldCache = options.shouldCache ?? defaultShouldCache;
|
|
47
48
|
const swr = options.staleWhileRevalidate ?? false;
|
|
@@ -71,15 +72,82 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
71
72
|
warned = true;
|
|
72
73
|
console.warn('[blaze-cache] cache layer failed; continuing without it', error);
|
|
73
74
|
}
|
|
74
|
-
const keyOf = (url, init
|
|
75
|
+
const keyOf = (url, init, reqOpts) => {
|
|
76
|
+
if (typeof reqOpts?.key === 'string')
|
|
77
|
+
return reqOpts.key;
|
|
78
|
+
if (typeof reqOpts?.key === 'function')
|
|
79
|
+
return reqOpts.key(url, init);
|
|
80
|
+
return options.key
|
|
81
|
+
? options.key(url, init)
|
|
82
|
+
: defaultCacheKey(url, init, reqOpts?.varyHeaders ?? varyHeaders);
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Mutation invalidation: drops tagged entries after the network round-trip.
|
|
86
|
+
*
|
|
87
|
+
* Runs even when the request itself is never cacheable (a `POST` never is by default),
|
|
88
|
+
* and never when the cache has no `invalidateTags` — a structural `Map` shim simply
|
|
89
|
+
* does not support it. A cache that throws here is a cache-layer failure: warned once,
|
|
90
|
+
* never propagated into the caller's response.
|
|
91
|
+
*/
|
|
92
|
+
const invalidateTags = (tags) => {
|
|
93
|
+
if (!tags || tags.length === 0)
|
|
94
|
+
return;
|
|
95
|
+
if (typeof cache.invalidateTags !== 'function')
|
|
96
|
+
return;
|
|
97
|
+
try {
|
|
98
|
+
cache.invalidateTags(...tags);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
warnCacheFailure(error);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
75
104
|
async function dispatch(input, init) {
|
|
105
|
+
const reqOpts = getRequestOptions(init);
|
|
76
106
|
const method = resolveMethod(input, init);
|
|
77
107
|
const url = resolveUrl(input);
|
|
78
108
|
const request = normalizeInit(input, init, method);
|
|
79
|
-
|
|
109
|
+
// A body that cannot be folded into the key would make every request carrying one
|
|
110
|
+
// share a single entry — a `POST` with two payloads would occupy one entry and the
|
|
111
|
+
// first response would be replayed for the second. Refusing to cache costs one extra
|
|
112
|
+
// request; a wrong hit hands one caller another caller's response, so the asymmetry
|
|
113
|
+
// decides it. A caller-supplied `key` owns the whole key, so it is trusted to describe
|
|
114
|
+
// the body itself.
|
|
115
|
+
//
|
|
116
|
+
// The body may sit on the `init` or on a `Request` input (`init` winning); a `Request`'s
|
|
117
|
+
// own body is a `ReadableStream`, which no encoder can read — so a body-carrying
|
|
118
|
+
// `Request` bypasses caching just like any other unencodable body.
|
|
119
|
+
const carriedBody = request.body ?? (isRequest(input) ? input.body : undefined);
|
|
120
|
+
const ownsKey = typeof options.key === 'function' ||
|
|
121
|
+
typeof reqOpts?.key === 'string' ||
|
|
122
|
+
typeof reqOpts?.key === 'function';
|
|
123
|
+
const bodyKeyed = carriedBody === undefined ||
|
|
124
|
+
carriedBody === null ||
|
|
125
|
+
ownsKey ||
|
|
126
|
+
encodeRequestBody(carriedBody) !== undefined;
|
|
127
|
+
// Per-request `enabled: true` can opt a method in; `enabled: false` opts out entirely.
|
|
128
|
+
const enabled = reqOpts?.enabled ?? true;
|
|
129
|
+
const methodAllowed = methods.has(method) || reqOpts?.enabled === true;
|
|
130
|
+
// The key is only built when it can be trusted and may actually be used: an
|
|
131
|
+
// unencodable body never reaches `defaultCacheKey` (which would throw on it), a
|
|
132
|
+
// disabled request owes the key callback nothing — and a key callback that throws
|
|
133
|
+
// anyway is a cache-layer failure, costing this response its caching, never the
|
|
134
|
+
// response itself.
|
|
135
|
+
let cacheable = enabled && methodAllowed && bodyKeyed;
|
|
136
|
+
let key = '';
|
|
137
|
+
if (cacheable) {
|
|
138
|
+
try {
|
|
139
|
+
key = keyOf(url, request, reqOpts);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
warnCacheFailure(error);
|
|
143
|
+
cacheable = false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
80
146
|
// `init.cache` is the caller's instruction, `Cache-Control` is the server's; with
|
|
81
|
-
// `
|
|
82
|
-
const control =
|
|
147
|
+
// `honourCacheControl: false` only the former is still obeyed.
|
|
148
|
+
const control = honourCacheControl
|
|
149
|
+
? parseCacheControl(request.headers.get('Cache-Control'))
|
|
150
|
+
: NO_DIRECTIVES;
|
|
83
151
|
const bypassWrite = control.noStore || request.cache === 'no-store';
|
|
84
152
|
// A request `max-age=0` is, per RFC 9111 §5.2.2.1, a demand to revalidate before reuse.
|
|
85
153
|
// This cache has no conditional requests, so the closest honest reading is a full
|
|
@@ -88,9 +156,9 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
88
156
|
control.noCache ||
|
|
89
157
|
control.maxAgeMs === 0 ||
|
|
90
158
|
init.forceRefresh === true ||
|
|
159
|
+
reqOpts?.forceRefresh === true ||
|
|
91
160
|
request.cache === 'no-cache' ||
|
|
92
161
|
request.cache === 'reload';
|
|
93
|
-
const cacheable = methods.has(method);
|
|
94
162
|
if (cacheable) {
|
|
95
163
|
if (!bypassRead) {
|
|
96
164
|
const record = read(key);
|
|
@@ -170,6 +238,13 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
170
238
|
done();
|
|
171
239
|
throw error;
|
|
172
240
|
}
|
|
241
|
+
// Every network response admits where it came from from the moment it arrives, so even
|
|
242
|
+
// the `shouldCache`/`tags`/`ttlMs` callbacks see `fromBlazeCache: false`.
|
|
243
|
+
defineOwn(response, 'fromBlazeCache', false);
|
|
244
|
+
// Mutation invalidation: after the round-trip (a failed call invalidates nothing — the
|
|
245
|
+
// caller's data is unchanged), and before anything is stored, so a fresh entry written
|
|
246
|
+
// under the same tags survives the invalidation it triggered.
|
|
247
|
+
invalidateTags(reqOpts?.invalidateTags);
|
|
173
248
|
let keep = false;
|
|
174
249
|
if (leader) {
|
|
175
250
|
try {
|
|
@@ -186,7 +261,7 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
186
261
|
// so nothing about this call's latency depends on the write, and a later read can
|
|
187
262
|
// never race a half-written entry. The gate above, however, opens only once that
|
|
188
263
|
// write has settled: that is what lets a joiner trust the cache it finds.
|
|
189
|
-
void store(response, key, url, request)
|
|
264
|
+
void store(response, key, url, request, reqOpts)
|
|
190
265
|
.catch(warnCacheFailure)
|
|
191
266
|
.finally(done);
|
|
192
267
|
}
|
|
@@ -194,7 +269,8 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
194
269
|
// Nothing will be stored for this call: wake any joiners so they can lead in turn.
|
|
195
270
|
done();
|
|
196
271
|
}
|
|
197
|
-
// Marked last, so `shouldCache`/`tags`/`ttlMs` see exactly what the network sent
|
|
272
|
+
// Marked last, so `shouldCache`/`tags`/`ttlMs` see exactly what the network sent
|
|
273
|
+
// (bar `fromBlazeCache`, which describes provenance and is set on arrival).
|
|
198
274
|
return mark(response, 'MISS');
|
|
199
275
|
}
|
|
200
276
|
/** Fetches a fresh copy of a stale entry so the next read is a `HIT` again. */
|
|
@@ -231,11 +307,13 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
231
307
|
* of the caller's response, so every millisecond it spends buffering is invisible to the
|
|
232
308
|
* caller — and the record is complete (never half-written) by the time `cache.set` runs.
|
|
233
309
|
*/
|
|
234
|
-
async function store(response, key, url, request) {
|
|
310
|
+
async function store(response, key, url, request, reqOpts) {
|
|
235
311
|
// An opaque response exposes no status, headers or body: there is nothing to store.
|
|
236
312
|
if (response.status === 0)
|
|
237
313
|
return;
|
|
238
|
-
const control =
|
|
314
|
+
const control = honourCacheControl
|
|
315
|
+
? parseCacheControl(response.headers.get('Cache-Control'))
|
|
316
|
+
: NO_DIRECTIVES;
|
|
239
317
|
// `no-store` forbids storing; `no-cache` demands revalidation on every use, and this
|
|
240
318
|
// cache has no conditional requests — so neither is worth an entry.
|
|
241
319
|
if (control.noStore || control.noCache)
|
|
@@ -245,13 +323,13 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
245
323
|
// anything else would be keyed wrongly, and a wrong key replays the wrong variant —
|
|
246
324
|
// another user's `Cookie`, another locale's `Accept-Language`. When we cannot key on a
|
|
247
325
|
// header, the safe answer is not to cache at all. (Checked unconditionally, not only
|
|
248
|
-
// under `
|
|
249
|
-
|
|
326
|
+
// under `honourCacheControl`: variant correctness is not a freshness preference.)
|
|
327
|
+
// A per-request `varyHeaders` overrides the wrapper's for this entry.
|
|
328
|
+
if (!varyIsStorable(response.headers.get('Vary'), reqOpts?.varyHeaders ?? varyHeaders))
|
|
250
329
|
return;
|
|
251
|
-
const
|
|
252
|
-
const ttl = typeof configured === 'function' ? configured(response, url, request) : (configured ?? DEFAULT_TTL_MS);
|
|
330
|
+
const ttl = resolveTtl(reqOpts?.ttlMs ?? options.ttlMs, response, url, request);
|
|
253
331
|
const maxAge = control.maxAgeMs ?? ttl;
|
|
254
|
-
const age =
|
|
332
|
+
const age = honourCacheControl ? parseAgeMs(response.headers.get('Age')) : 0;
|
|
255
333
|
const freshMs = maxAge - age;
|
|
256
334
|
// Zero, negative or `NaN` means "keep nothing": already stale, or the caller opted out.
|
|
257
335
|
if (!(freshMs > 0))
|
|
@@ -263,7 +341,7 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
263
341
|
// freshness, so there is nothing it may serve "while revalidating".
|
|
264
342
|
const staleMs = !swrEnabled || control.mustRevalidate
|
|
265
343
|
? 0
|
|
266
|
-
:
|
|
344
|
+
: honourCacheControl && control.staleWhileRevalidateMs !== undefined
|
|
267
345
|
? control.staleWhileRevalidateMs
|
|
268
346
|
: swrFallbackMs;
|
|
269
347
|
let body;
|
|
@@ -290,10 +368,15 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
290
368
|
staleUntil: freshUntil + staleMs,
|
|
291
369
|
};
|
|
292
370
|
const totalMs = freshMs + staleMs;
|
|
371
|
+
// Per-request tags win over the wrapper's, and both over the default pair.
|
|
372
|
+
const reqTags = reqOpts?.tags;
|
|
373
|
+
const tagList = (typeof reqTags === 'function' ? reqTags(response, url, request) : reqTags) ??
|
|
374
|
+
options.tags?.(response, url, request) ??
|
|
375
|
+
defaultTags(request.method, url);
|
|
293
376
|
cache.set(key, record, {
|
|
294
377
|
// `0` is how the core spells "never expires" — reached only via `ttlMs: Infinity`.
|
|
295
378
|
ttlMs: Number.isFinite(totalMs) ? totalMs : 0,
|
|
296
|
-
tags:
|
|
379
|
+
tags: tagList,
|
|
297
380
|
});
|
|
298
381
|
}
|
|
299
382
|
/**
|
|
@@ -319,10 +402,19 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
319
402
|
// them so a hit carries the metadata of the network response it stands in for.
|
|
320
403
|
defineOwn(response, 'url', record.url);
|
|
321
404
|
defineOwn(response, 'redirected', record.redirected);
|
|
405
|
+
// Both `HIT` and `STALE` came out of the store — `STALE` merely also started a refresh.
|
|
406
|
+
defineOwn(response, 'fromBlazeCache', true);
|
|
322
407
|
return response;
|
|
323
408
|
}
|
|
324
|
-
/**
|
|
409
|
+
/**
|
|
410
|
+
* Stamps the marker on a network response, rebuilding it only if its headers refuse.
|
|
411
|
+
*
|
|
412
|
+
* Also stamps `fromBlazeCache`: `MISS` for anything that crossed the wire, `true` for a
|
|
413
|
+
* replay (which goes through {@link replay} instead).
|
|
414
|
+
*/
|
|
325
415
|
function mark(response, marker) {
|
|
416
|
+
const fromCache = marker !== 'MISS';
|
|
417
|
+
defineOwn(response, 'fromBlazeCache', fromCache);
|
|
326
418
|
if (markerHeader === false)
|
|
327
419
|
return response;
|
|
328
420
|
try {
|
|
@@ -344,11 +436,32 @@ export function createBlazeFetch(cache, options = {}) {
|
|
|
344
436
|
});
|
|
345
437
|
defineOwn(rebuilt, 'url', response.url);
|
|
346
438
|
defineOwn(rebuilt, 'redirected', response.redirected);
|
|
439
|
+
defineOwn(rebuilt, 'fromBlazeCache', fromCache);
|
|
347
440
|
return rebuilt;
|
|
348
441
|
}
|
|
349
442
|
}
|
|
350
443
|
return (input, init = {}) => dispatch(input, init);
|
|
351
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* `init.blazeCache` read once, at the top of `dispatch`.
|
|
447
|
+
*
|
|
448
|
+
* `false` collapses to "disabled for this request" — the shape a caller writes when they
|
|
449
|
+
* only mean *not this one* — so the rest of the dispatch reads a single type.
|
|
450
|
+
*/
|
|
451
|
+
function getRequestOptions(init) {
|
|
452
|
+
return init.blazeCache === false ? { enabled: false } : init.blazeCache;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* The configured freshness window for this response.
|
|
456
|
+
*
|
|
457
|
+
* `ttlMs` may be a callback, so it resolves per response; `Cache-Control: max-age` still
|
|
458
|
+
* wins afterwards when honouring is on (see `store`).
|
|
459
|
+
*/
|
|
460
|
+
function resolveTtl(ttl, response, url, init) {
|
|
461
|
+
if (typeof ttl === 'function')
|
|
462
|
+
return ttl(response, url, init);
|
|
463
|
+
return ttl ?? DEFAULT_TTL_MS;
|
|
464
|
+
}
|
|
352
465
|
/** Successful responses only. The {@link BlazeFetchOptions.methods} gate has already applied. */
|
|
353
466
|
function defaultShouldCache(response) {
|
|
354
467
|
return response.status >= 200 && response.status < 300;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAA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AC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* const response = await fetch('/api/users');
|
|
17
17
|
* response.headers.get('x-blaze-cache'); // 'MISS', then 'HIT'
|
|
18
|
+
* response.fromBlazeCache; // false, then true
|
|
18
19
|
* ```
|
|
19
20
|
*
|
|
20
21
|
* @packageDocumentation
|
|
@@ -23,5 +24,16 @@ export { createBlazeFetch } from './client.js';
|
|
|
23
24
|
export { parseCacheControl, parseAgeMs, varyIsStorable } from './cache-control.js';
|
|
24
25
|
export type { CacheControl } from './cache-control.js';
|
|
25
26
|
export { defaultCacheKey, fnv1a } from './key.js';
|
|
26
|
-
export type { BlazeFetch, BlazeFetchCacheLike, BlazeFetchEffectiveInit, BlazeFetchInit, BlazeFetchMarker, BlazeFetchOptions, FetchCacheRecord, } from './types.js';
|
|
27
|
+
export type { BlazeFetch, BlazeFetchCacheLike, BlazeFetchEffectiveInit, BlazeFetchRequestOptions, BlazeFetchInit, BlazeFetchMarker, BlazeFetchOptions, CachedFetchResponse, FetchCacheRecord, } from './types.js';
|
|
28
|
+
/**
|
|
29
|
+
* Invalidate tags on a cache that supports it (e.g. `BlazeCache` from
|
|
30
|
+
* `@blaze-cache/core`). A no-op when the cache has no `invalidateTags` method.
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* invalidateCacheTags(cache, 'todos'); // after a mutation, from outside a request
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function invalidateCacheTags(cache: {
|
|
37
|
+
invalidateTags?(...tags: string[]): unknown;
|
|
38
|
+
} | undefined | null, ...tags: string[]): void;
|
|
27
39
|
//# 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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACnF,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAElD,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE;IAAE,cAAc,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;CAAE,GAAG,SAAS,GAAG,IAAI,EACzE,GAAG,IAAI,EAAE,MAAM,EAAE,GAChB,IAAI,CAGN"}
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* const response = await fetch('/api/users');
|
|
17
17
|
* response.headers.get('x-blaze-cache'); // 'MISS', then 'HIT'
|
|
18
|
+
* response.fromBlazeCache; // false, then true
|
|
18
19
|
* ```
|
|
19
20
|
*
|
|
20
21
|
* @packageDocumentation
|
|
@@ -22,4 +23,18 @@
|
|
|
22
23
|
export { createBlazeFetch } from './client.js';
|
|
23
24
|
export { parseCacheControl, parseAgeMs, varyIsStorable } from './cache-control.js';
|
|
24
25
|
export { defaultCacheKey, fnv1a } from './key.js';
|
|
26
|
+
/**
|
|
27
|
+
* Invalidate tags on a cache that supports it (e.g. `BlazeCache` from
|
|
28
|
+
* `@blaze-cache/core`). A no-op when the cache has no `invalidateTags` method.
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* invalidateCacheTags(cache, 'todos'); // after a mutation, from outside a request
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function invalidateCacheTags(cache, ...tags) {
|
|
35
|
+
if (!cache || tags.length === 0)
|
|
36
|
+
return;
|
|
37
|
+
if (typeof cache.invalidateTags === 'function')
|
|
38
|
+
cache.invalidateTags(...tags);
|
|
39
|
+
}
|
|
25
40
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGnF,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAclD;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAyE,EACzE,GAAG,IAAc;IAEjB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IACxC,IAAI,OAAO,KAAK,CAAC,cAAc,KAAK,UAAU;QAAE,KAAK,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;AAChF,CAAC"}
|
package/dist/key.d.ts
CHANGED
|
@@ -2,13 +2,39 @@ import type { BlazeFetchEffectiveInit } from './types.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* FNV-1a, 32-bit.
|
|
4
4
|
*
|
|
5
|
-
* Folds sensitive material (bearer tokens, `vary` headers) into a short, stable token. It
|
|
6
|
-
* not a security primitive — the point is that a persisted cache key never contains a
|
|
7
|
-
* in readable form.
|
|
5
|
+
* Folds sensitive material (bearer tokens, `vary` headers) into a short, stable token. It
|
|
6
|
+
* is not a security primitive — the point is that a persisted cache key never contains a
|
|
7
|
+
* secret in readable form.
|
|
8
8
|
*/
|
|
9
9
|
export declare function fnv1a(input: string): string;
|
|
10
|
+
/** Whether a request actually carries a body — `null`/`undefined` mean it does not. */
|
|
11
|
+
export declare function hasRequestBody(body: unknown): boolean;
|
|
10
12
|
/**
|
|
11
|
-
*
|
|
13
|
+
* The request body as a stable, injective string for the cache key — or `undefined` when
|
|
14
|
+
* the body **cannot** be encoded and the request must therefore stay uncached.
|
|
15
|
+
*
|
|
16
|
+
* A body that reaches the key wrong is worse than no cached body at all: two different
|
|
17
|
+
* payloads would hash onto one entry and the first response would be replayed for the
|
|
18
|
+
* second. So anything whose content this function cannot actually read is refused rather
|
|
19
|
+
* than approximated:
|
|
20
|
+
*
|
|
21
|
+
* * a stream, a `Blob`/`File` or raw bytes have no readable own properties — the canonical
|
|
22
|
+
* serialisation renders each as the bare `'{}'`, which would collapse *every* such body
|
|
23
|
+
* onto *one* key;
|
|
24
|
+
* * an object that serialises to `'{}'` for any other reason (a class instance keeping its
|
|
25
|
+
* data in private fields, an empty object) carries nothing to tell bodies apart by;
|
|
26
|
+
* * a circular structure throws out of `JSON.stringify`.
|
|
27
|
+
*
|
|
28
|
+
* Key order is left as the caller wrote it. Two structurally equal bodies spelled in a
|
|
29
|
+
* different order then produce different keys — which costs a cache miss and nothing
|
|
30
|
+
* worse, because the error points at "did not reuse" rather than "reused the wrong
|
|
31
|
+
* response". Sorting instead would mean copying caller data into a fresh object, which is
|
|
32
|
+
* where `__proto__` handling goes wrong.
|
|
33
|
+
*/
|
|
34
|
+
export declare function encodeRequestBody(body: unknown): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Default cache key: method + resolved URL, plus a hash of the `varyHeaders` values and of
|
|
37
|
+
* the request body.
|
|
12
38
|
*
|
|
13
39
|
* ```ts
|
|
14
40
|
* defaultCacheKey('/api/users', init, ['authorization']); // "get /api/users?a3f9k"
|
|
@@ -16,8 +42,14 @@ export declare function fnv1a(input: string): string;
|
|
|
16
42
|
*
|
|
17
43
|
* The hash is appended whenever `varyHeaders` is non-empty — including when every value is
|
|
18
44
|
* absent — so keys stay stable across calls. Pass `varyHeaders: []` to get the bare
|
|
19
|
-
* `"<method> <url>"` form. Call it from the {@link BlazeFetchOptions.key} callback with
|
|
20
|
-
* `init` you were handed.
|
|
45
|
+
* `"<method> <url>"` form. Call it from the {@link BlazeFetchOptions.key} callback with
|
|
46
|
+
* the `init` you were handed.
|
|
47
|
+
*
|
|
48
|
+
* A request that carries a body folds that body into the hash, so a `POST` with two
|
|
49
|
+
* different payloads occupies two entries instead of replaying one for the other.
|
|
50
|
+
*
|
|
51
|
+
* @throws when a body is present but {@link encodeRequestBody} cannot read it — callers
|
|
52
|
+
* that must not throw should check first and skip caching instead.
|
|
21
53
|
*/
|
|
22
54
|
export declare function defaultCacheKey(url: string, init: BlazeFetchEffectiveInit, varyHeaders: readonly string[]): string;
|
|
23
55
|
//# sourceMappingURL=key.d.ts.map
|
package/dist/key.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../src/key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO3C;AAED
|
|
1
|
+
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../src/key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO3C;AAED,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAErD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CA2CnE;AASD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,uBAAuB,EAC7B,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,MAAM,CAsBR"}
|
package/dist/key.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* FNV-1a, 32-bit.
|
|
3
3
|
*
|
|
4
|
-
* Folds sensitive material (bearer tokens, `vary` headers) into a short, stable token. It
|
|
5
|
-
* not a security primitive — the point is that a persisted cache key never contains a
|
|
6
|
-
* in readable form.
|
|
4
|
+
* Folds sensitive material (bearer tokens, `vary` headers) into a short, stable token. It
|
|
5
|
+
* is not a security primitive — the point is that a persisted cache key never contains a
|
|
6
|
+
* secret in readable form.
|
|
7
7
|
*/
|
|
8
8
|
export function fnv1a(input) {
|
|
9
9
|
let hash = 0x811c9dc5;
|
|
@@ -13,8 +13,86 @@ export function fnv1a(input) {
|
|
|
13
13
|
}
|
|
14
14
|
return hash.toString(36);
|
|
15
15
|
}
|
|
16
|
+
/** Whether a request actually carries a body — `null`/`undefined` mean it does not. */
|
|
17
|
+
export function hasRequestBody(body) {
|
|
18
|
+
return body !== undefined && body !== null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The request body as a stable, injective string for the cache key — or `undefined` when
|
|
22
|
+
* the body **cannot** be encoded and the request must therefore stay uncached.
|
|
23
|
+
*
|
|
24
|
+
* A body that reaches the key wrong is worse than no cached body at all: two different
|
|
25
|
+
* payloads would hash onto one entry and the first response would be replayed for the
|
|
26
|
+
* second. So anything whose content this function cannot actually read is refused rather
|
|
27
|
+
* than approximated:
|
|
28
|
+
*
|
|
29
|
+
* * a stream, a `Blob`/`File` or raw bytes have no readable own properties — the canonical
|
|
30
|
+
* serialisation renders each as the bare `'{}'`, which would collapse *every* such body
|
|
31
|
+
* onto *one* key;
|
|
32
|
+
* * an object that serialises to `'{}'` for any other reason (a class instance keeping its
|
|
33
|
+
* data in private fields, an empty object) carries nothing to tell bodies apart by;
|
|
34
|
+
* * a circular structure throws out of `JSON.stringify`.
|
|
35
|
+
*
|
|
36
|
+
* Key order is left as the caller wrote it. Two structurally equal bodies spelled in a
|
|
37
|
+
* different order then produce different keys — which costs a cache miss and nothing
|
|
38
|
+
* worse, because the error points at "did not reuse" rather than "reused the wrong
|
|
39
|
+
* response". Sorting instead would mean copying caller data into a fresh object, which is
|
|
40
|
+
* where `__proto__` handling goes wrong.
|
|
41
|
+
*/
|
|
42
|
+
export function encodeRequestBody(body) {
|
|
43
|
+
if (!hasRequestBody(body))
|
|
44
|
+
return '';
|
|
45
|
+
if (typeof body === 'string')
|
|
46
|
+
return JSON.stringify(body);
|
|
47
|
+
if (typeof body === 'number' || typeof body === 'boolean' || typeof body === 'bigint') {
|
|
48
|
+
return String(body);
|
|
49
|
+
}
|
|
50
|
+
if (typeof body !== 'object')
|
|
51
|
+
return undefined; // function, symbol, ...
|
|
52
|
+
if (typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams) {
|
|
53
|
+
// Order-preserving: the search string goes on the wire verbatim, so two differently
|
|
54
|
+
// ordered ones are genuinely different requests.
|
|
55
|
+
return `URLSearchParams(${body.toString()})`;
|
|
56
|
+
}
|
|
57
|
+
if (typeof FormData !== 'undefined' && body instanceof FormData) {
|
|
58
|
+
// Multipart part order carries no semantics, so entries are sorted — same fields in a
|
|
59
|
+
// different order are the same request. Files are described by identity attributes;
|
|
60
|
+
// their bytes are not read (they may be huge or not yet loaded).
|
|
61
|
+
const parts = [];
|
|
62
|
+
for (const [key, item] of body.entries()) {
|
|
63
|
+
parts.push(typeof item === 'string'
|
|
64
|
+
? `${JSON.stringify(key)}=${JSON.stringify(item)}`
|
|
65
|
+
: `${JSON.stringify(key)}#file(${item.name},${item.size},${item.type})`);
|
|
66
|
+
}
|
|
67
|
+
return `FormData(${parts.sort().join('&')})`;
|
|
68
|
+
}
|
|
69
|
+
// Raw bytes: refused rather than hashed, because a 32-bit digest over caller-supplied
|
|
70
|
+
// bytes is a collision surface this key does not need to open.
|
|
71
|
+
if (typeof ArrayBuffer !== 'undefined' && (body instanceof ArrayBuffer || ArrayBuffer.isView(body))) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
let json;
|
|
75
|
+
try {
|
|
76
|
+
json = JSON.stringify(body);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return undefined; // circular
|
|
80
|
+
}
|
|
81
|
+
if (json === undefined)
|
|
82
|
+
return undefined;
|
|
83
|
+
if (json === '{}')
|
|
84
|
+
return undefined; // no enumerable content — see the doc comment above
|
|
85
|
+
return json;
|
|
86
|
+
}
|
|
16
87
|
/**
|
|
17
|
-
*
|
|
88
|
+
* Separator between the two hashed key components: a raw NUL, which `JSON.stringify` never
|
|
89
|
+
* emits unescaped (it writes a six-character escape instead), so no `vary` value or body
|
|
90
|
+
* can be crafted to straddle the boundary and impersonate the other component.
|
|
91
|
+
*/
|
|
92
|
+
const COMPONENT_SEPARATOR = String.fromCharCode(0);
|
|
93
|
+
/**
|
|
94
|
+
* Default cache key: method + resolved URL, plus a hash of the `varyHeaders` values and of
|
|
95
|
+
* the request body.
|
|
18
96
|
*
|
|
19
97
|
* ```ts
|
|
20
98
|
* defaultCacheKey('/api/users', init, ['authorization']); // "get /api/users?a3f9k"
|
|
@@ -22,12 +100,23 @@ export function fnv1a(input) {
|
|
|
22
100
|
*
|
|
23
101
|
* The hash is appended whenever `varyHeaders` is non-empty — including when every value is
|
|
24
102
|
* absent — so keys stay stable across calls. Pass `varyHeaders: []` to get the bare
|
|
25
|
-
* `"<method> <url>"` form. Call it from the {@link BlazeFetchOptions.key} callback with
|
|
26
|
-
* `init` you were handed.
|
|
103
|
+
* `"<method> <url>"` form. Call it from the {@link BlazeFetchOptions.key} callback with
|
|
104
|
+
* the `init` you were handed.
|
|
105
|
+
*
|
|
106
|
+
* A request that carries a body folds that body into the hash, so a `POST` with two
|
|
107
|
+
* different payloads occupies two entries instead of replaying one for the other.
|
|
108
|
+
*
|
|
109
|
+
* @throws when a body is present but {@link encodeRequestBody} cannot read it — callers
|
|
110
|
+
* that must not throw should check first and skip caching instead.
|
|
27
111
|
*/
|
|
28
112
|
export function defaultCacheKey(url, init, varyHeaders) {
|
|
29
113
|
const base = `${init.method.toLowerCase()} ${url}`;
|
|
30
|
-
|
|
114
|
+
const carriesBody = hasRequestBody(init.body);
|
|
115
|
+
const encodedBody = carriesBody ? encodeRequestBody(init.body) : undefined;
|
|
116
|
+
if (carriesBody && encodedBody === undefined) {
|
|
117
|
+
throw new Error('[blaze-cache] this request body cannot be encoded into a cache key');
|
|
118
|
+
}
|
|
119
|
+
if (varyHeaders.length === 0 && encodedBody === undefined)
|
|
31
120
|
return base;
|
|
32
121
|
const headers = init.headers instanceof Headers ? init.headers : new Headers(init.headers);
|
|
33
122
|
// JSON, never a plain join: the encoding must stay *injective*, because a collision here
|
|
@@ -35,7 +124,8 @@ export function defaultCacheKey(url, init, varyHeaders) {
|
|
|
35
124
|
// containing the separator impersonate the boundary — `['x y', '']` and `['x', 'y']` are
|
|
36
125
|
// two different identities, and only a length-delimited encoding (JSON being the simplest)
|
|
37
126
|
// keeps them apart.
|
|
38
|
-
const vary = JSON.stringify(varyHeaders.map((name) => headers.get(name) ?? ''));
|
|
39
|
-
|
|
127
|
+
const vary = varyHeaders.length === 0 ? '' : JSON.stringify(varyHeaders.map((name) => headers.get(name) ?? ''));
|
|
128
|
+
const payload = encodedBody === undefined ? vary : `${vary}${COMPONENT_SEPARATOR}${encodedBody}`;
|
|
129
|
+
return `${base}?${fnv1a(payload)}`;
|
|
40
130
|
}
|
|
41
131
|
//# sourceMappingURL=key.js.map
|
package/dist/key.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key.js","sourceRoot":"","sources":["../src/key.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,IAAI,IAAI,GAAG,UAAU,CAAC;IACtB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,IAAI,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"key.js","sourceRoot":"","sources":["../src/key.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,IAAI,IAAI,GAAG,UAAU,CAAC;IACtB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,IAAI,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAAC,IAAa;IAC1C,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAa;IAC7C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;QAAE,OAAO,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,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3F,yFAAyF;IACzF,oFAAoF;IACpF,yFAAyF;IACzF,2FAA2F;IAC3F,oBAAoB;IACpB,MAAM,IAAI,GACR,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAErG,MAAM,OAAO,GAAG,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,mBAAmB,GAAG,WAAW,EAAE,CAAC;IACjG,OAAO,GAAG,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;AACrC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -39,19 +39,97 @@ export interface FetchCacheRecord {
|
|
|
39
39
|
staleUntil: number;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* `RequestInit` as accepted by the wrapper, plus
|
|
42
|
+
* `RequestInit` as accepted by the wrapper, plus two non-standard escape hatches.
|
|
43
43
|
*
|
|
44
|
-
* Everything the platform defines keeps its meaning; {@link forceRefresh}
|
|
45
|
-
* the standard `cache: 'no-cache' | 'reload'`
|
|
44
|
+
* Everything the platform defines keeps its meaning; {@link forceRefresh} and
|
|
45
|
+
* {@link blazeCache} are additive, and the standard `cache: 'no-cache' | 'reload'`
|
|
46
|
+
* spellings do the same job as `forceRefresh` if you prefer them.
|
|
46
47
|
*/
|
|
47
48
|
export interface BlazeFetchInit extends RequestInit {
|
|
48
49
|
/**
|
|
49
50
|
* Skip the cache **read** and go straight to the network. The fresh response still
|
|
50
51
|
* replaces whatever was stored, so one forced refresh restores a `HIT` afterwards.
|
|
51
52
|
*
|
|
52
|
-
* Standard equivalent: `cache: 'no-cache'
|
|
53
|
+
* Standard equivalent: `cache: 'no-cache'`; shorthand for
|
|
54
|
+
* `blazeCache: { forceRefresh: true }`.
|
|
53
55
|
*/
|
|
54
56
|
forceRefresh?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Per-request cache overrides — or `false` to bypass the cache entirely for this call.
|
|
59
|
+
*
|
|
60
|
+
* ```ts
|
|
61
|
+
* await fetch('/users/1', { blazeCache: { ttlMs: 30_000, tags: ['user', 'user:1'] } });
|
|
62
|
+
* await fetch('/users/1', { blazeCache: false }); // neither read nor written
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* Non-standard, so it lives on `init` rather than on a `Request`: the network still
|
|
66
|
+
* receives the caller's original `input`/`init` unchanged, and a real `fetch` ignores
|
|
67
|
+
* the member it does not know.
|
|
68
|
+
*/
|
|
69
|
+
blazeCache?: BlazeFetchRequestOptions | false;
|
|
70
|
+
}
|
|
71
|
+
/** Per-request overrides passed via `init.blazeCache`. All of them are optional. */
|
|
72
|
+
export interface BlazeFetchRequestOptions {
|
|
73
|
+
/**
|
|
74
|
+
* Enable or disable caching for this request.
|
|
75
|
+
*
|
|
76
|
+
* `false` bypasses the cache read/write for this request (it still performs any
|
|
77
|
+
* {@link invalidateTags} after the network response). `true` opts a method *outside*
|
|
78
|
+
* {@link BlazeFetchOptions.methods} into caching. Omit to follow the wrapper defaults.
|
|
79
|
+
*/
|
|
80
|
+
enabled?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Freshness window for this request's cached response, in milliseconds.
|
|
83
|
+
*
|
|
84
|
+
* Overrides the wrapper-level `ttlMs`. Ignored when the response carries
|
|
85
|
+
* `Cache-Control: max-age` and Cache-Control honouring is on. `<= 0` means
|
|
86
|
+
* "do not store".
|
|
87
|
+
*/
|
|
88
|
+
ttlMs?: number | ((response: Response, url: string, init: BlazeFetchEffectiveInit) => number);
|
|
89
|
+
/**
|
|
90
|
+
* Tags attached to this request's stored response. Overrides the wrapper-level `tags`.
|
|
91
|
+
* The default (`['fetch', '<method> <url>']`) applies when neither is given.
|
|
92
|
+
*/
|
|
93
|
+
tags?: readonly string[] | ((response: Response, url: string, init: BlazeFetchEffectiveInit) => readonly string[]);
|
|
94
|
+
/**
|
|
95
|
+
* Cache key for this request. A string is used as-is; a function receives the resolved
|
|
96
|
+
* absolute `url` and the effective `init`. Overrides the wrapper-level `key`.
|
|
97
|
+
*
|
|
98
|
+
* Supplying it also opts a body-carrying request into caching — an explicit key is
|
|
99
|
+
* trusted to describe the body itself.
|
|
100
|
+
*/
|
|
101
|
+
key?: string | ((url: string, init: BlazeFetchEffectiveInit) => string);
|
|
102
|
+
/**
|
|
103
|
+
* Request headers whose values participate in the cache key for this request.
|
|
104
|
+
* Overrides the wrapper-level {@link BlazeFetchOptions.varyHeaders}.
|
|
105
|
+
*/
|
|
106
|
+
varyHeaders?: readonly string[];
|
|
107
|
+
/**
|
|
108
|
+
* Force a network round-trip, bypassing the cache read (the fresh response may still
|
|
109
|
+
* be stored, subject to normal rules). Shorthand for the top-level `forceRefresh`.
|
|
110
|
+
*/
|
|
111
|
+
forceRefresh?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Tags to invalidate on the cache **after** this request completes against the
|
|
114
|
+
* network (typically used on mutations: POST/PUT/PATCH/DELETE).
|
|
115
|
+
*
|
|
116
|
+
* Runs even when the request itself is never cached, and only after a *successful*
|
|
117
|
+
* network call — a failed request invalidates nothing. Requires a cache that
|
|
118
|
+
* implements `invalidateTags` (e.g. `BlazeCache` from `@blaze-cache/core`);
|
|
119
|
+
* silently ignored otherwise.
|
|
120
|
+
*/
|
|
121
|
+
invalidateTags?: readonly string[];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* A `Response` the wrapper returned, carrying its provenance.
|
|
125
|
+
*
|
|
126
|
+
* The extra field lets you branch without sniffing headers; the `x-blaze-cache` response
|
|
127
|
+
* header carries the same information for the network layer. It is set on **every**
|
|
128
|
+
* response the wrapper returns — cache bypasses included — so it is always a boolean.
|
|
129
|
+
*/
|
|
130
|
+
export interface CachedFetchResponse extends Response {
|
|
131
|
+
/** `true` when the response came from cache instead of the network. */
|
|
132
|
+
fromBlazeCache: boolean;
|
|
55
133
|
}
|
|
56
134
|
/**
|
|
57
135
|
* `BlazeFetchInit` as the callbacks receive it — the *effective* request.
|
|
@@ -82,8 +160,14 @@ export interface BlazeFetchEffectiveInit extends Omit<BlazeFetchInit, 'headers'
|
|
|
82
160
|
* window.fetch = blazeFetch;
|
|
83
161
|
* ```
|
|
84
162
|
*/
|
|
85
|
-
export type BlazeFetch = (input: RequestInfo | URL, init?: BlazeFetchInit) => Promise<
|
|
86
|
-
/**
|
|
163
|
+
export type BlazeFetch = (input: RequestInfo | URL, init?: BlazeFetchInit) => Promise<CachedFetchResponse>;
|
|
164
|
+
/**
|
|
165
|
+
* Options accepted by {@link createBlazeFetch}. All of them are optional.
|
|
166
|
+
*
|
|
167
|
+
* Most can also be set for a single request through `init.blazeCache` — see
|
|
168
|
+
* {@link BlazeFetchRequestOptions} — which additionally offers `enabled` and
|
|
169
|
+
* `invalidateTags`.
|
|
170
|
+
*/
|
|
87
171
|
export interface BlazeFetchOptions {
|
|
88
172
|
/**
|
|
89
173
|
* The function performing the real network call. Defaults to the global `fetch`.
|
|
@@ -104,8 +188,13 @@ export interface BlazeFetchOptions {
|
|
|
104
188
|
* HTTP methods eligible for caching. Default: `['GET']`.
|
|
105
189
|
*
|
|
106
190
|
* Pass `['GET', 'HEAD']` to cache `HEAD` too. Any other method always goes to the network
|
|
107
|
-
* and is never stored
|
|
108
|
-
*
|
|
191
|
+
* and is never stored — unless a single request opts itself in with
|
|
192
|
+
* `blazeCache: { enabled: true }`. Non-cacheable methods are also never coalesced with an
|
|
193
|
+
* identical in-flight request — replaying a side effect would be worse than repeating one.
|
|
194
|
+
*
|
|
195
|
+
* A method listed here is only stored (or coalesced) when its body can be folded into
|
|
196
|
+
* the key (or a `key` callback describes it) — otherwise two different payloads to the
|
|
197
|
+
* same URL would share one entry.
|
|
109
198
|
*/
|
|
110
199
|
methods?: readonly string[];
|
|
111
200
|
/**
|
|
@@ -121,7 +210,11 @@ export interface BlazeFetchOptions {
|
|
|
121
210
|
*
|
|
122
211
|
* Set to `false` to treat `ttlMs` as the only authority. The response's `Vary` header is
|
|
123
212
|
* *always* honoured (see {@link varyHeaders}) — variant correctness is not a preference.
|
|
213
|
+
*
|
|
214
|
+
* {@link cacheControl} is accepted as an alias; when both are given, this one wins.
|
|
124
215
|
*/
|
|
216
|
+
honourCacheControl?: boolean;
|
|
217
|
+
/** Alias for {@link honourCacheControl}. */
|
|
125
218
|
cacheControl?: boolean;
|
|
126
219
|
/**
|
|
127
220
|
* Serve responses past their freshness window while refreshing them in the background.
|
|
@@ -141,10 +234,12 @@ export interface BlazeFetchOptions {
|
|
|
141
234
|
* Builds the cache key. Receives the resolved absolute `url` and the effective `init`
|
|
142
235
|
* (see {@link BlazeFetchEffectiveInit}).
|
|
143
236
|
*
|
|
144
|
-
* The default is `"<method> <url>"` plus a hash of {@link varyHeaders}
|
|
145
|
-
* is that default, so you can wrap it and only change the
|
|
146
|
-
* the key replaces **everything** the default included,
|
|
147
|
-
* when caching more than one method
|
|
237
|
+
* The default is `"<method> <url>"` plus a hash of {@link varyHeaders} and of the request
|
|
238
|
+
* body — {@link defaultCacheKey} is that default, so you can wrap it and only change the
|
|
239
|
+
* parts you care about. Replacing the key replaces **everything** the default included,
|
|
240
|
+
* so include `init.method` yourself when caching more than one method — and the body too,
|
|
241
|
+
* if you cache a method that carries one. Supplying `key` also opts a body-carrying
|
|
242
|
+
* request into caching that would otherwise be skipped as unkeyable.
|
|
148
243
|
*/
|
|
149
244
|
key?: (url: string, init: BlazeFetchEffectiveInit) => string;
|
|
150
245
|
/**
|
|
@@ -188,5 +283,13 @@ export interface BlazeFetchCacheLike {
|
|
|
188
283
|
ttlMs?: number;
|
|
189
284
|
tags?: readonly string[];
|
|
190
285
|
}): void;
|
|
286
|
+
/**
|
|
287
|
+
* Optional tag-based invalidation (e.g. `BlazeCache` from `@blaze-cache/core`).
|
|
288
|
+
*
|
|
289
|
+
* Optional so a minimal `Map` shim still satisfies the interface; used by per-request
|
|
290
|
+
* `blazeCache.invalidateTags` on mutations, and by the exported
|
|
291
|
+
* `invalidateCacheTags(cache, ...tags)` helper.
|
|
292
|
+
*/
|
|
293
|
+
invalidateTags?(...tags: string[]): string[] | void;
|
|
191
294
|
}
|
|
192
295
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,yFAAyF;IACzF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC;;;;;OAKG;IACH,IAAI,EAAE,WAAW,CAAC;IAClB,+HAA+H;IAC/H,GAAG,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,UAAU,EAAE,MAAM,CAAC;IACnB,4HAA4H;IAC5H,UAAU,EAAE,MAAM,CAAC;CACpB;AAED
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC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CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,KAAK,OAAO,CAAC;IAE1F;;;;;OAKG;IACH,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,KAAK,SAAS,MAAM,EAAE,CAAC;IAE7F;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEhC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAC/B;AAED,wEAAwE;AACxE,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAC/C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IACxG;;;;;;OAMG;IACH,cAAc,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;CACrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cache/fetch",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-beta.0",
|
|
4
4
|
"description": "Drop-in fetch() replacement backed by a WebAssembly cache — TTLs, Cache-Control, stale-while-revalidate and an x-blaze-cache HIT/MISS marker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fetch",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@blaze-cache/core": "0.
|
|
41
|
+
"@blaze-cache/core": "0.4.0-beta.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typescript": "^5.9.3"
|