@blaze-cache/core 0.4.0-beta.0 → 0.4.0-beta.2
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 +28 -12
- package/dist/cache.d.ts +46 -22
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +467 -54
- package/dist/cache.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/persistence/indexeddb.d.ts +16 -2
- package/dist/persistence/indexeddb.d.ts.map +1 -1
- package/dist/persistence/indexeddb.js +280 -55
- package/dist/persistence/indexeddb.js.map +1 -1
- package/dist/persistence/types.d.ts +271 -0
- package/dist/persistence/types.d.ts.map +1 -1
- package/dist/wasm.d.ts +79 -1
- package/dist/wasm.d.ts.map +1 -1
- package/dist/wasm.js +142 -0
- package/dist/wasm.js.map +1 -1
- package/package.json +2 -1
- package/pkg/blaze_cache_wasm.d.ts +11 -7
- package/pkg/blaze_cache_wasm.js +11 -7
- package/pkg/blaze_cache_wasm_bg.wasm +0 -0
- package/pkg/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexeddb.js","sourceRoot":"","sources":["../../src/persistence/indexeddb.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG,aAAa,CAAC;AACvC,MAAM,aAAa,GAAG,SAAS,CAAC;AAChC,MAAM,iBAAiB,GAAG,SAAS,CAAC;AACpC,MAAM,UAAU,GAAG,CAAC,CAAC;AAQrB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAA4B,EAAE;IACjE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,gBAAgB,CAAC;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC;IAC7C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,iBAAiB,CAAC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C,IAAI;YAAE,OAAO,IAAI,CAAC,CAAC,yDAAyD;QACjF,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -13,6 +13,21 @@ export interface PersistedRecord<V = unknown> {
|
|
|
13
13
|
/** `Date.now()` at the moment the record was written. */
|
|
14
14
|
storedAt: number;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The batch one flush wants to apply — what {@link CachePersistence.write} receives.
|
|
18
|
+
*
|
|
19
|
+
* The three parts are disjoint by construction (`remove` never contains a key the same
|
|
20
|
+
* pass also saves), so an adapter may apply them in any order it likes as long as `clear`
|
|
21
|
+
* is honoured **before** the other two.
|
|
22
|
+
*/
|
|
23
|
+
export interface PersistenceWriteOps {
|
|
24
|
+
/** `true` when the namespace must be emptied before `save` lands. */
|
|
25
|
+
clear?: boolean;
|
|
26
|
+
/** Records to upsert (last write wins per key). */
|
|
27
|
+
save: PersistedRecord[];
|
|
28
|
+
/** Keys whose rows must be deleted. */
|
|
29
|
+
remove: string[];
|
|
30
|
+
}
|
|
16
31
|
/**
|
|
17
32
|
* Pluggable storage backend used for write-through persistence.
|
|
18
33
|
*
|
|
@@ -40,9 +55,164 @@ export interface CachePersistence {
|
|
|
40
55
|
* diff, and any explicit `delete`/`invalidateTags`/`prune` still reaches `remove`.
|
|
41
56
|
*/
|
|
42
57
|
keys?(): Promise<string[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Applies a whole flush — `clear` + `save` + `remove` — as **one unit of work**.
|
|
60
|
+
*
|
|
61
|
+
* Optional. When present the cache hands the entire batch over instead of calling
|
|
62
|
+
* `clear`/`save`/`remove` separately, which turns a flush of up to three IndexedDB
|
|
63
|
+
* transactions into one. The adapter must make the batch atomic: either every part
|
|
64
|
+
* lands or none does (the built-in adapter aborts its transaction on failure).
|
|
65
|
+
*/
|
|
66
|
+
write?(ops: PersistenceWriteOps): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Adopts a new persistence **generation** — the session/account token that isolates
|
|
69
|
+
* one login from the next. Optional.
|
|
70
|
+
*
|
|
71
|
+
* Called by `cache.persistence.rotate(generation)` *after* the cache has already
|
|
72
|
+
* invalidated every queued and in-flight operation from the previous generation.
|
|
73
|
+
* Implementations must guarantee that an operation already in flight continues to
|
|
74
|
+
* read and write the **previous** generation's bucket (the built-in adapter snapshots
|
|
75
|
+
* its effective namespace per operation, so a late write lands there and is invisible
|
|
76
|
+
* to the new generation). Rows already stored are left alone — call `clear()` before
|
|
77
|
+
* `rotate()` to wipe them.
|
|
78
|
+
*
|
|
79
|
+
* Adapters without it still get the cache-level protection (queued and in-flight
|
|
80
|
+
* flushes are dropped on rotation), but their stored rows are not namespaced by
|
|
81
|
+
* generation.
|
|
82
|
+
*/
|
|
83
|
+
rotate?(generation: string): void | Promise<void>;
|
|
43
84
|
/** Releases any underlying handle. */
|
|
44
85
|
close?(): void | Promise<void>;
|
|
45
86
|
}
|
|
87
|
+
/** How queued writes reach storage. */
|
|
88
|
+
export type PersistenceWriteMode =
|
|
89
|
+
/** Coalesce writes and flush once the debounce window (`debounceMs`) elapses. */
|
|
90
|
+
'debounce'
|
|
91
|
+
/** Flush on the next task after a mutation — no debounce window. */
|
|
92
|
+
| 'immediate';
|
|
93
|
+
/** The phase a {@link PersistenceActivity} `error` event belongs to. */
|
|
94
|
+
export type PersistenceErrorPhase = 'hydrate' | 'flush' | 'clear' | 'rotate';
|
|
95
|
+
/**
|
|
96
|
+
* Persistence activity, as reported by the `onActivity` option.
|
|
97
|
+
*
|
|
98
|
+
* The observability channel for the write-through layer: hydrate start/finish, flush
|
|
99
|
+
* start/finish, a flush invalidated by a generation change, and contained errors. It is
|
|
100
|
+
* deliberately separate from the cache's event bus — persistence activity is not a cache
|
|
101
|
+
* mutation, and wildcard listeners must not start waking up for it.
|
|
102
|
+
*/
|
|
103
|
+
export type PersistenceActivity = {
|
|
104
|
+
type: 'hydrate-start';
|
|
105
|
+
generation: string;
|
|
106
|
+
} | {
|
|
107
|
+
type: 'hydrate-finish';
|
|
108
|
+
generation: string;
|
|
109
|
+
/** Records that made it into memory. */
|
|
110
|
+
restored: number;
|
|
111
|
+
/** Records skipped (malformed, expired, unreadable). */
|
|
112
|
+
skipped: number;
|
|
113
|
+
durationMs: number;
|
|
114
|
+
}
|
|
115
|
+
/** The generation changed while a hydrate was loading — its records were discarded. */
|
|
116
|
+
| {
|
|
117
|
+
type: 'hydrate-abort';
|
|
118
|
+
generation: string;
|
|
119
|
+
} | {
|
|
120
|
+
type: 'flush-start';
|
|
121
|
+
generation: string;
|
|
122
|
+
records: number;
|
|
123
|
+
} | {
|
|
124
|
+
type: 'flush-finish';
|
|
125
|
+
generation: string;
|
|
126
|
+
records: number;
|
|
127
|
+
durationMs: number;
|
|
128
|
+
}
|
|
129
|
+
/** The generation changed mid-flush — the pass' claimed work was dropped. */
|
|
130
|
+
| {
|
|
131
|
+
type: 'flush-abort';
|
|
132
|
+
generation: string;
|
|
133
|
+
} | {
|
|
134
|
+
type: 'rotate';
|
|
135
|
+
generation: string;
|
|
136
|
+
} | {
|
|
137
|
+
type: 'error';
|
|
138
|
+
phase: PersistenceErrorPhase;
|
|
139
|
+
error: unknown;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* A snapshot of persistence's current state and cumulative counters — what
|
|
143
|
+
* `cache.persistence.stats()` returns.
|
|
144
|
+
*
|
|
145
|
+
* The counters are cumulative for the lifetime of the cache instance; the `last*`
|
|
146
|
+
* timestamps are `Date.now()` values (or `null` when the phase has not run yet).
|
|
147
|
+
*/
|
|
148
|
+
export interface PersistenceStats {
|
|
149
|
+
/** `false` when persistence was never attached (or was disabled after a startup failure). */
|
|
150
|
+
enabled: boolean;
|
|
151
|
+
/** The configured namespace — `'default'` when none was given. */
|
|
152
|
+
namespace: string;
|
|
153
|
+
/** The current session generation; `''` when no generation is in use. */
|
|
154
|
+
generation: string;
|
|
155
|
+
/** Writes queued right now: dirty keys + pending deletes (+1 for a pending full clear). */
|
|
156
|
+
pending: number;
|
|
157
|
+
/** Hydrates that completed. */
|
|
158
|
+
hydrates: number;
|
|
159
|
+
/** Records restored into memory across all hydrates. */
|
|
160
|
+
restored: number;
|
|
161
|
+
/** Records skipped across all hydrates — malformed, expired or unreadable. */
|
|
162
|
+
skipped: number;
|
|
163
|
+
/** Flush passes that completed. */
|
|
164
|
+
flushes: number;
|
|
165
|
+
/** Records written across all completed flushes. */
|
|
166
|
+
recordsWritten: number;
|
|
167
|
+
/** Flushes/hydrates dropped because the generation changed mid-flight. */
|
|
168
|
+
aborted: number;
|
|
169
|
+
/** Successful {@link PersistenceControl.rotate} calls. */
|
|
170
|
+
rotations: number;
|
|
171
|
+
/** Failures the cache saw (they still reject the awaited call, when there is one). */
|
|
172
|
+
errors: number;
|
|
173
|
+
/** The most recent failure, or `null`. */
|
|
174
|
+
lastError: unknown;
|
|
175
|
+
/** `Date.now()` of the last completed flush, or `null`. */
|
|
176
|
+
lastFlushAt: number | null;
|
|
177
|
+
/** `Date.now()` of the last completed hydrate, or `null`. */
|
|
178
|
+
lastHydrateAt: number | null;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The persistence control surface — `cache.persistence`.
|
|
182
|
+
*
|
|
183
|
+
* Every method is safe to call on a cache created without persistence: they resolve as
|
|
184
|
+
* no-ops and `stats()` reports `enabled: false`, so application code never has to branch.
|
|
185
|
+
*/
|
|
186
|
+
export interface PersistenceControl {
|
|
187
|
+
/** `true` while a storage adapter is attached. */
|
|
188
|
+
readonly enabled: boolean;
|
|
189
|
+
/** The current session generation; `''` when none is in use. */
|
|
190
|
+
readonly generation: string;
|
|
191
|
+
/** Writes pending changes to storage now — same as `cache.flush()`. */
|
|
192
|
+
flush(): Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* Empties this namespace in storage **and** drops every queued write, without touching
|
|
195
|
+
* the cache's memory. Rows written by other namespaces are left alone.
|
|
196
|
+
*/
|
|
197
|
+
clear(): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Reloads stored records into memory (merge, not replace: memory-only entries survive).
|
|
200
|
+
* A queued full-clear that predates the call is dropped — storage was just adopted
|
|
201
|
+
* as-is, and clearing it again would contradict that.
|
|
202
|
+
*/
|
|
203
|
+
hydrate(): Promise<void>;
|
|
204
|
+
/** A snapshot of persistence's state and counters. */
|
|
205
|
+
stats(): PersistenceStats;
|
|
206
|
+
/**
|
|
207
|
+
* Rotates the persistence generation — call this on logout/login.
|
|
208
|
+
*
|
|
209
|
+
* Invalidates every write queued by the previous session **and** every operation still
|
|
210
|
+
* in flight (a late save can no longer repopulate the next session's storage), then
|
|
211
|
+
* hands the new generation to the adapter. Memory is left alone: pair it with
|
|
212
|
+
* `cache.clear()` for a full account switch.
|
|
213
|
+
*/
|
|
214
|
+
rotate(generation: string): Promise<void>;
|
|
215
|
+
}
|
|
46
216
|
/** IndexedDB connection settings. */
|
|
47
217
|
export interface IndexedDbOptions {
|
|
48
218
|
/** Database name. Default `'blaze-cache'`. */
|
|
@@ -52,7 +222,108 @@ export interface IndexedDbOptions {
|
|
|
52
222
|
/**
|
|
53
223
|
* Key prefix isolating this cache from other caches in the same store.
|
|
54
224
|
* Default `'default'`.
|
|
225
|
+
*
|
|
226
|
+
* Must not contain a NUL character (`\0`) — it is the separator the composite primary
|
|
227
|
+
* key is built from. For per-account isolation prefer {@link generation}, which can be
|
|
228
|
+
* rotated in place; baking the account into the namespace also works but orphans the
|
|
229
|
+
* previous account's rows instead of keeping them one rotation away.
|
|
55
230
|
*/
|
|
56
231
|
namespace?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Session/account token folded into the stored key space, isolating one login from the
|
|
234
|
+
* next. Default `''` (the plain namespace, exactly as before generations existed).
|
|
235
|
+
*
|
|
236
|
+
* Rows written under one generation are invisible to every other: `load`, `keys`,
|
|
237
|
+
* `clear` and a late in-flight write all stay inside the bucket they started in.
|
|
238
|
+
* Change it through `cache.persistence.rotate()` rather than by hand.
|
|
239
|
+
*/
|
|
240
|
+
generation?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Every option `createCache({ persistence })` accepts — one shape for the built-in
|
|
244
|
+
* IndexedDB adapter and for custom {@link CachePersistence} adapters alike.
|
|
245
|
+
*
|
|
246
|
+
* ```ts
|
|
247
|
+
* const cache = await createCache({
|
|
248
|
+
* persistence: {
|
|
249
|
+
* namespace: 'app:v1', // isolate this cache from others in the database
|
|
250
|
+
* debounceMs: 50, // coalesce writes for 50 ms before hitting storage
|
|
251
|
+
* maxEntries: 2000, // cap on records written by a single flush
|
|
252
|
+
* restoreExpired: false, // never resurrect records that expired while away
|
|
253
|
+
* writeMode: 'debounce', // or 'immediate' — flush on the next task
|
|
254
|
+
* onError: (err) => report(err), // failures nobody awaited
|
|
255
|
+
* onActivity: (a) => debug(a), // hydrate/flush/rotate lifecycle
|
|
256
|
+
* },
|
|
257
|
+
* });
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
export interface PersistenceOptions extends IndexedDbOptions {
|
|
261
|
+
/**
|
|
262
|
+
* Custom storage implementation. Omit it (keeping `namespace`/`database`/…) to use the
|
|
263
|
+
* built-in IndexedDB adapter.
|
|
264
|
+
*/
|
|
265
|
+
adapter?: CachePersistence;
|
|
266
|
+
/**
|
|
267
|
+
* How long a write waits for more writes before reaching storage. Default `400`.
|
|
268
|
+
* Must be a finite number `>= 0`.
|
|
269
|
+
*
|
|
270
|
+
* The window is where write coalescing happens: repeated writes to the same key inside
|
|
271
|
+
* it produce **one** row, with the final value.
|
|
272
|
+
*/
|
|
273
|
+
debounceMs?: number;
|
|
274
|
+
/**
|
|
275
|
+
* Legacy spelling of {@link debounceMs}. Keep one of the two — passing both with
|
|
276
|
+
* different values throws a `RangeError` from `create`.
|
|
277
|
+
*
|
|
278
|
+
* @deprecated Rename to `debounceMs`; this alias still works and will keep working.
|
|
279
|
+
*/
|
|
280
|
+
flushDelayMs?: number;
|
|
281
|
+
/**
|
|
282
|
+
* Upper bound on the records a single flush writes (the newest `maxEntries` dirty keys
|
|
283
|
+
* win). Default `2000`. Must be an integer `>= 1`.
|
|
284
|
+
*/
|
|
285
|
+
maxEntries?: number;
|
|
286
|
+
/**
|
|
287
|
+
* Legacy spelling of {@link maxEntries}. Keep one of the two — passing both with
|
|
288
|
+
* different values throws a `RangeError` from `create`.
|
|
289
|
+
*
|
|
290
|
+
* @deprecated Rename to `maxEntries`; this alias still works and will keep working.
|
|
291
|
+
*/
|
|
292
|
+
maxRecords?: number;
|
|
293
|
+
/**
|
|
294
|
+
* Whether records whose TTL elapsed while the tab was away are restored on hydrate.
|
|
295
|
+
* Default `false` — an expired record stays gone.
|
|
296
|
+
*
|
|
297
|
+
* `true` restores them with their **original TTL window restarted from now** (fresh,
|
|
298
|
+
* but not forever). It is never restored with the expired remainder: a non-positive
|
|
299
|
+
* TTL reads as "never expires" to the wasm core, which would turn a dead record into
|
|
300
|
+
* an immortal one.
|
|
301
|
+
*/
|
|
302
|
+
restoreExpired?: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* `'debounce'` (default) waits {@link debounceMs} before writing;
|
|
305
|
+
* `'immediate'` flushes on the next task after a mutation — no debounce window, while
|
|
306
|
+
* still coalescing everything written within the current task into one pass.
|
|
307
|
+
*/
|
|
308
|
+
writeMode?: PersistenceWriteMode;
|
|
309
|
+
/**
|
|
310
|
+
* Called for persistence failures **nobody awaited** — the debounced timer's flush, the
|
|
311
|
+
* pagehide flush, and a startup that had to fall back to memory-only. Awaited calls
|
|
312
|
+
* (`flush()`, `clear()`, `hydrate()`, `rotate()`) still reject with the same error, so
|
|
313
|
+
* treat this as an observability hook rather than the only error path.
|
|
314
|
+
*
|
|
315
|
+
* When absent, those failures go to `console.error` as before.
|
|
316
|
+
*/
|
|
317
|
+
onError?: (error: unknown) => void;
|
|
318
|
+
/**
|
|
319
|
+
* Called for persistence activity: hydrate start/finish, flush start/finish, passes
|
|
320
|
+
* aborted by a {@link PersistenceControl.rotate}, rotations and errors. See
|
|
321
|
+
* {@link PersistenceActivity} for the exact shapes.
|
|
322
|
+
*
|
|
323
|
+
* This channel is separate from the cache's event bus on purpose: persistence activity
|
|
324
|
+
* is not a cache mutation, and a wildcard `cache.on(listener)` must not start waking
|
|
325
|
+
* up for it. An observer that throws is isolated (logged, never propagated).
|
|
326
|
+
*/
|
|
327
|
+
onActivity?: (activity: PersistenceActivity) => void;
|
|
57
328
|
}
|
|
58
329
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/persistence/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,CAAC,CAAC;IACT,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,mFAAmF;IACnF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kFAAkF;IAClF,IAAI,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IACnC,yDAAyD;IACzD,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,8BAA8B;IAC9B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,sFAAsF;IACtF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;;;;;;OAUG;IACH,IAAI,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3B,sCAAsC;IACtC,KAAK,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,qCAAqC;AAC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C;IAC1B;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACtD"}
|
package/dist/wasm.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import init, { BlazeCache as WasmCache } from '../pkg/blaze_cache_wasm.js';
|
|
2
|
-
import type { InitOutput } from '../pkg/blaze_cache_wasm.js';
|
|
2
|
+
import type { InitInput, InitOutput } from '../pkg/blaze_cache_wasm.js';
|
|
3
3
|
/** Whatever the generated `init()` accepts — passed through untouched. */
|
|
4
4
|
export type WasmInitInput = NonNullable<Parameters<typeof init>[0]>;
|
|
5
|
+
/**
|
|
6
|
+
* Anything the generated `init()` can instantiate from: a URL to fetch, a `Request`, a
|
|
7
|
+
* `Response`, raw bytes, or an already-compiled `WebAssembly.Module`.
|
|
8
|
+
*/
|
|
9
|
+
export type WasmSource = InitInput;
|
|
5
10
|
/**
|
|
6
11
|
* URL of the `.wasm` binary, resolved relative to **this** module.
|
|
7
12
|
*
|
|
@@ -9,6 +14,61 @@ export type WasmInitInput = NonNullable<Parameters<typeof init>[0]>;
|
|
|
9
14
|
* bundler-specific wasm plugin is required — only `type: module` output.
|
|
10
15
|
*/
|
|
11
16
|
export declare const wasmUrl: URL;
|
|
17
|
+
/** Every option that says *where* the `.wasm` comes from — at most one may be given. */
|
|
18
|
+
export interface WasmLoadOptions {
|
|
19
|
+
/**
|
|
20
|
+
* URL of the `.wasm` binary to fetch: absolute, or relative to the document.
|
|
21
|
+
*
|
|
22
|
+
* Defaults to the asset shipped inside `@blaze-cache/core`, resolved relative to this
|
|
23
|
+
* module — which is what makes the zero-config path work under Vite, webpack and plain
|
|
24
|
+
* static hosting alike. Override it when the binary lives somewhere else: a `public/`
|
|
25
|
+
* asset path, a CDN, another origin.
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* await createCache({ wasmUrl: '/assets/blaze_cache_wasm_bg.wasm' });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
wasmUrl?: string | URL;
|
|
32
|
+
/**
|
|
33
|
+
* A precompiled `WebAssembly.Module` — no fetch and no compile at all, for callers that
|
|
34
|
+
* already hold one (a service worker, a warm `WebAssembly.compileStream`, a test fixture).
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* const module = await WebAssembly.compile(await (await fetch(url)).arrayBuffer());
|
|
38
|
+
* await createCache({ module });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
module?: WebAssembly.Module;
|
|
42
|
+
/**
|
|
43
|
+
* Full custom loader — the escape hatch for everything the defaults do not cover: a fetch
|
|
44
|
+
* that needs auth headers or retries, an asset behind a signed CDN path, bytes already in
|
|
45
|
+
* memory or in IndexedDB.
|
|
46
|
+
*
|
|
47
|
+
* Resolve to the **source** the loader should instantiate from — a URL, a `Request` or
|
|
48
|
+
* `Response`, raw bytes, or a precompiled `WebAssembly.Module`. The loader still does the
|
|
49
|
+
* linking, streaming instantiation and one-time registration.
|
|
50
|
+
*
|
|
51
|
+
* It deliberately does *not* receive the wasm-bindgen import object and must not resolve
|
|
52
|
+
* to a `WebAssembly.Instance` or to an object's exports: the generated glue owns linking
|
|
53
|
+
* and registration, and an instance created outside it can never be adopted afterwards —
|
|
54
|
+
* `WebAssembly.instantiate` rejects an `Instance`, and the glue's finaliser is private.
|
|
55
|
+
* Producing a *source* instead keeps the escape hatch honest, and covers the same ground:
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* const cache = await createCache({
|
|
59
|
+
* instantiate: async () => (await fetch(url, { headers: { authorization } })).arrayBuffer(),
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
instantiate?: () => WasmSource | Promise<WasmSource>;
|
|
64
|
+
/**
|
|
65
|
+
* Low-level passthrough: a source handed straight to wasm-bindgen's generated `init()`,
|
|
66
|
+
* bypassing the loader's own fetch. Equivalent to {@link WasmLoadOptions.wasmUrl} for a
|
|
67
|
+
* URL, and the way to pass pre-read bytes (`Uint8Array`) — which is what the test suites
|
|
68
|
+
* do, since Node cannot `fetch()` a `file:` URL.
|
|
69
|
+
*/
|
|
70
|
+
wasm?: WasmInitInput;
|
|
71
|
+
}
|
|
12
72
|
/**
|
|
13
73
|
* Encodes JS keys straight into wasm memory for the `*Raw` bindings.
|
|
14
74
|
*
|
|
@@ -62,5 +122,23 @@ export declare const keyScratch: KeyScratch;
|
|
|
62
122
|
* @param input Override how the binary is fetched (CDN URL, pre-fetched `Response`, …).
|
|
63
123
|
*/
|
|
64
124
|
export declare function initBlazeWasm(input?: WasmInitInput): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Loads and instantiates the Blaze Cache wasm module exactly once, from the source the
|
|
127
|
+
* given options describe.
|
|
128
|
+
*
|
|
129
|
+
* This is what `createCache()` awaits. Concurrent callers share one load: the first call's
|
|
130
|
+
* options decide where the binary comes from, every later call awaits that same promise
|
|
131
|
+
* and never fetches, compiles or instantiates again — so N simultaneous `createCache()`
|
|
132
|
+
* calls cost one download. A failure resets the promise, so the next call may retry.
|
|
133
|
+
*
|
|
134
|
+
* @param options Exactly one of `wasmUrl`, `module`, `instantiate` or `wasm`; with none of
|
|
135
|
+
* them the binary shipped next to this module is fetched.
|
|
136
|
+
*
|
|
137
|
+
* @throws TypeError if more than one source option is given — silently picking one would
|
|
138
|
+
* hide a real mistake.
|
|
139
|
+
* @throws Error if the binary cannot be fetched or instantiated. The message names the URL
|
|
140
|
+
* (or the step that failed) and what to do about it; the original error is on `cause`.
|
|
141
|
+
*/
|
|
142
|
+
export declare function loadBlazeWasm(options?: WasmLoadOptions): Promise<void>;
|
|
65
143
|
export { WasmCache };
|
|
66
144
|
//# sourceMappingURL=wasm.d.ts.map
|
package/dist/wasm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAGX,UAAU,IAAI,SAAS,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAGX,UAAU,IAAI,SAAS,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;A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m(input) {
|
|
|
136
136
|
});
|
|
137
137
|
return pending;
|
|
138
138
|
}
|
|
139
|
+
/** The one in-flight {@link loadBlazeWasm}, shared by every concurrent `createCache()`. */
|
|
140
|
+
let loading = null;
|
|
141
|
+
/** The four ways to say where the `.wasm` is, in the order they are reported and resolved. */
|
|
142
|
+
const SOURCE_KEYS = ['wasmUrl', 'module', 'instantiate', 'wasm'];
|
|
143
|
+
/**
|
|
144
|
+
* Loads and instantiates the Blaze Cache wasm module exactly once, from the source the
|
|
145
|
+
* given options describe.
|
|
146
|
+
*
|
|
147
|
+
* This is what `createCache()` awaits. Concurrent callers share one load: the first call's
|
|
148
|
+
* options decide where the binary comes from, every later call awaits that same promise
|
|
149
|
+
* and never fetches, compiles or instantiates again — so N simultaneous `createCache()`
|
|
150
|
+
* calls cost one download. A failure resets the promise, so the next call may retry.
|
|
151
|
+
*
|
|
152
|
+
* @param options Exactly one of `wasmUrl`, `module`, `instantiate` or `wasm`; with none of
|
|
153
|
+
* them the binary shipped next to this module is fetched.
|
|
154
|
+
*
|
|
155
|
+
* @throws TypeError if more than one source option is given — silently picking one would
|
|
156
|
+
* hide a real mistake.
|
|
157
|
+
* @throws Error if the binary cannot be fetched or instantiated. The message names the URL
|
|
158
|
+
* (or the step that failed) and what to do about it; the original error is on `cause`.
|
|
159
|
+
*/
|
|
160
|
+
export function loadBlazeWasm(options = {}) {
|
|
161
|
+
// Validate before any short-circuit: two sources is a programming error, and it should
|
|
162
|
+
// surface whether or not the module happens to be loaded already.
|
|
163
|
+
const requested = SOURCE_KEYS.filter((key) => options[key] !== undefined);
|
|
164
|
+
if (requested.length > 1) {
|
|
165
|
+
throw new TypeError(`@blaze-cache/core: pass at most one wasm source, got ${requested
|
|
166
|
+
.map((key) => `\`${key}\``)
|
|
167
|
+
.join(' and ')}. Use \`wasmUrl\` for an asset URL, \`module\` for a precompiled ` +
|
|
168
|
+
'WebAssembly.Module, `instantiate` for a custom loader, or `wasm` to hand a ' +
|
|
169
|
+
"source straight to wasm-bindgen's init().");
|
|
170
|
+
}
|
|
171
|
+
// Already loading/loaded: nothing to resolve, whatever the later callers asked for.
|
|
172
|
+
if (pending !== null)
|
|
173
|
+
return pending;
|
|
174
|
+
if (loading !== null)
|
|
175
|
+
return loading;
|
|
176
|
+
loading = (async () => {
|
|
177
|
+
const source = await resolveWasmSource(options);
|
|
178
|
+
try {
|
|
179
|
+
await initBlazeWasm(await prepareWasmSource(source));
|
|
180
|
+
}
|
|
181
|
+
catch (cause) {
|
|
182
|
+
throw new Error(`@blaze-cache/core: failed to instantiate the WebAssembly binary — ${describeCause(cause)}. ` +
|
|
183
|
+
'Check that the asset is the Blaze Cache `.wasm` for this package version and that ' +
|
|
184
|
+
'your server allows WebAssembly (a `Content-Type` of `application/wasm` lets the ' +
|
|
185
|
+
'loader stream it; anything else still works, just slower).', { cause });
|
|
186
|
+
}
|
|
187
|
+
})();
|
|
188
|
+
// Reset on failure so a bad URL or a transient network error is retryable. The original
|
|
189
|
+
// promise still rejects for whoever is awaiting it.
|
|
190
|
+
void loading.catch(() => {
|
|
191
|
+
loading = null;
|
|
192
|
+
});
|
|
193
|
+
return loading;
|
|
194
|
+
}
|
|
195
|
+
/** Picks the one requested source — or the default asset shipped with this module. */
|
|
196
|
+
async function resolveWasmSource(options) {
|
|
197
|
+
if (options.wasmUrl !== undefined)
|
|
198
|
+
return options.wasmUrl;
|
|
199
|
+
if (options.module !== undefined)
|
|
200
|
+
return options.module;
|
|
201
|
+
if (options.instantiate !== undefined)
|
|
202
|
+
return adoptWasmSource(await options.instantiate());
|
|
203
|
+
if (options.wasm !== undefined)
|
|
204
|
+
return options.wasm;
|
|
205
|
+
return wasmUrl; // default: the binary that ships next to this module
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Fetches URL sources here rather than handing them to the glue, so a wrong path, a blocked
|
|
209
|
+
* request and a corrupt binary each fail with their own message instead of one opaque
|
|
210
|
+
* "failed to load wasm". Bytes, `Response`s and `Module`s pass through untouched — there is
|
|
211
|
+
* nothing to fetch for those.
|
|
212
|
+
*/
|
|
213
|
+
async function prepareWasmSource(source) {
|
|
214
|
+
if (typeof source === 'string')
|
|
215
|
+
return await fetchWasmBinary(source);
|
|
216
|
+
if (typeof URL !== 'undefined' && source instanceof URL)
|
|
217
|
+
return await fetchWasmBinary(source);
|
|
218
|
+
return source;
|
|
219
|
+
}
|
|
220
|
+
/** `fetch()` with the failure modes spelled out; resolves to a body that is known good. */
|
|
221
|
+
async function fetchWasmBinary(target) {
|
|
222
|
+
const href = typeof target === 'string' ? target : target.href;
|
|
223
|
+
const hint = 'Pass `wasmUrl` for a public asset path or a CDN, `module` for a precompiled ' +
|
|
224
|
+
'WebAssembly.Module, or `instantiate` for a fully custom loader.';
|
|
225
|
+
let response;
|
|
226
|
+
try {
|
|
227
|
+
response = await fetch(target);
|
|
228
|
+
}
|
|
229
|
+
catch (cause) {
|
|
230
|
+
throw new Error(`@blaze-cache/core: could not fetch the WebAssembly binary from ${JSON.stringify(href)} — ` +
|
|
231
|
+
`${describeCause(cause)}. ${hint}`, { cause });
|
|
232
|
+
}
|
|
233
|
+
if (!response.ok) {
|
|
234
|
+
throw new Error(`@blaze-cache/core: could not fetch the WebAssembly binary — HTTP ${response.status} ` +
|
|
235
|
+
`${response.statusText} for ${JSON.stringify(response.url || href)}. ${hint}`);
|
|
236
|
+
}
|
|
237
|
+
return response;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Rejects the one shape the loader cannot honour, with the reason instead of a mystery deep
|
|
241
|
+
* inside wasm-bindgen. See {@link WasmLoadOptions.instantiate} for why an instance or an
|
|
242
|
+
* exports object cannot be adopted.
|
|
243
|
+
*/
|
|
244
|
+
function adoptWasmSource(source) {
|
|
245
|
+
if (isWasmSource(source))
|
|
246
|
+
return source;
|
|
247
|
+
throw new Error("@blaze-cache/core: `instantiate` must resolve to a *source* — a URL, a Request or " +
|
|
248
|
+
'Response, raw bytes, or a precompiled WebAssembly.Module — not to a ' +
|
|
249
|
+
'WebAssembly.Instance or to an object\'s exports. wasm-bindgen\'s generated glue owns ' +
|
|
250
|
+
'the import object and has to create the instance itself, so an instance built ' +
|
|
251
|
+
'elsewhere can never be wired up. Return the source instead, for example ' +
|
|
252
|
+
'`(await fetch(url)).arrayBuffer()`.');
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Narrows to {@link WasmSource} — everything `init()` can actually instantiate from. An
|
|
256
|
+
* `Instance` or an exports object falls through and is rejected by {@link adoptWasmSource}.
|
|
257
|
+
*/
|
|
258
|
+
function isWasmSource(value) {
|
|
259
|
+
if (typeof value === 'string')
|
|
260
|
+
return true;
|
|
261
|
+
if (typeof URL !== 'undefined' && value instanceof URL)
|
|
262
|
+
return true;
|
|
263
|
+
if (typeof Request !== 'undefined' && value instanceof Request)
|
|
264
|
+
return true;
|
|
265
|
+
if (typeof Response !== 'undefined' && value instanceof Response)
|
|
266
|
+
return true;
|
|
267
|
+
if (value instanceof WebAssembly.Module)
|
|
268
|
+
return true;
|
|
269
|
+
if (value instanceof ArrayBuffer)
|
|
270
|
+
return true;
|
|
271
|
+
if (ArrayBuffer.isView(value))
|
|
272
|
+
return true;
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
/** One line out of an unknown thrown value, for the messages above. */
|
|
276
|
+
function describeCause(cause) {
|
|
277
|
+
if (!(cause instanceof Error))
|
|
278
|
+
return String(cause);
|
|
279
|
+
return cause.name === 'Error' ? cause.message : `${cause.name}: ${cause.message}`;
|
|
280
|
+
}
|
|
139
281
|
export { WasmCache };
|
|
140
282
|
//# sourceMappingURL=wasm.js.map
|
package/dist/wasm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm.js","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EACX,YAAY,EACZ,aAAa,EACb,UAAU,IAAI,SAAS,GACxB,MAAM,4BAA4B,CAAC;
|
|
1
|
+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,KAAK,CAAC;AACf,CAAC;AAED,uEAAuE;AACvE,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;AACpF,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cache/core",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.2",
|
|
4
4
|
"description": "WebAssembly client-side cache for the browser: SIEVE eviction, per-entry TTLs, tag invalidation and optional IndexedDB persistence",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cache",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"./dist/wasm.js"
|
|
48
48
|
],
|
|
49
49
|
"devDependencies": {
|
|
50
|
+
"fake-indexeddb": "^6.2.8",
|
|
50
51
|
"typescript": "^5.9.3"
|
|
51
52
|
},
|
|
52
53
|
"scripts": {
|