@warp-drive-mirror/experiments 0.2.4-alpha.1 → 0.2.4-alpha.12

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.
Files changed (47) hide show
  1. package/addon-main.cjs +1 -1
  2. package/declarations/data-worker/cache-handler.d.ts +8 -0
  3. package/declarations/data-worker/cache-handler.d.ts.map +1 -0
  4. package/declarations/data-worker/fetch.d.ts +26 -0
  5. package/declarations/data-worker/fetch.d.ts.map +1 -0
  6. package/declarations/data-worker/types.d.ts +32 -0
  7. package/declarations/data-worker/types.d.ts.map +1 -0
  8. package/declarations/data-worker/utils.d.ts +21 -0
  9. package/declarations/data-worker/utils.d.ts.map +1 -0
  10. package/declarations/data-worker/worker.d.ts +24 -0
  11. package/declarations/data-worker/worker.d.ts.map +1 -0
  12. package/declarations/data-worker.d.ts +3 -0
  13. package/declarations/data-worker.d.ts.map +1 -0
  14. package/declarations/document-storage/index.d.ts +91 -0
  15. package/declarations/document-storage/index.d.ts.map +1 -0
  16. package/declarations/document-storage.d.ts +2 -0
  17. package/declarations/document-storage.d.ts.map +1 -0
  18. package/declarations/image-fetch.d.ts +2 -0
  19. package/declarations/image-fetch.d.ts.map +1 -0
  20. package/declarations/image-worker/fetch.d.ts +19 -0
  21. package/declarations/image-worker/fetch.d.ts.map +1 -0
  22. package/declarations/image-worker/types.d.ts +22 -0
  23. package/declarations/image-worker/types.d.ts.map +1 -0
  24. package/declarations/image-worker/worker.d.ts +18 -0
  25. package/declarations/image-worker/worker.d.ts.map +1 -0
  26. package/declarations/image-worker.d.ts +2 -0
  27. package/declarations/image-worker.d.ts.map +1 -0
  28. package/declarations/persisted-cache/cache.d.ts +450 -0
  29. package/declarations/persisted-cache/cache.d.ts.map +1 -0
  30. package/declarations/persisted-cache/db.d.ts +21 -0
  31. package/declarations/persisted-cache/db.d.ts.map +1 -0
  32. package/declarations/persisted-cache/fetch.d.ts +10 -0
  33. package/declarations/persisted-cache/fetch.d.ts.map +1 -0
  34. package/declarations/persisted-cache.d.ts +2 -0
  35. package/declarations/persisted-cache.d.ts.map +1 -0
  36. package/declarations/worker-fetch.d.ts +2 -0
  37. package/declarations/worker-fetch.d.ts.map +1 -0
  38. package/dist/data-worker.js +1 -2
  39. package/dist/data-worker.js.map +1 -1
  40. package/dist/image-fetch.js +3 -1
  41. package/dist/image-fetch.js.map +1 -1
  42. package/dist/index-CGCX7hY2.js.map +1 -1
  43. package/dist/persisted-cache.js +2 -36
  44. package/dist/persisted-cache.js.map +1 -1
  45. package/dist/worker-fetch.js +3 -1
  46. package/dist/worker-fetch.js.map +1 -1
  47. package/package.json +13 -18
@@ -0,0 +1,450 @@
1
+ import type { Cache, ChangedAttributesHash, RelationshipDiff } from '@warp-drive-mirror/core/types/cache';
2
+ import type { ResourceBlob } from '@warp-drive-mirror/core/types/cache/aliases';
3
+ import type { Change } from '@warp-drive-mirror/core/types/cache/change';
4
+ import type { Mutation } from '@warp-drive-mirror/core/types/cache/mutations';
5
+ import type { Operation } from '@warp-drive-mirror/core/types/cache/operations';
6
+ import type { CollectionRelationship, ResourceRelationship } from '@warp-drive-mirror/core/types/cache/relationship';
7
+ import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive-mirror/core/types/identifier';
8
+ import type { Value } from '@warp-drive-mirror/core/types/json/raw';
9
+ import type { TypeFromInstanceOrString } from '@warp-drive-mirror/core/types/record';
10
+ import type { RequestContext, StructuredDataDocument, StructuredDocument } from '@warp-drive-mirror/core/types/request';
11
+ import type { ResourceDocument, SingleResourceDataDocument } from '@warp-drive-mirror/core/types/spec/document';
12
+ import type { ApiError } from '@warp-drive-mirror/core/types/spec/error';
13
+ /**
14
+ * The PersistedCache wraps a Cache to enhance it with
15
+ * Persisted Storage capabilities.
16
+ *
17
+ * @class PersistedCache
18
+ * @internal
19
+ */
20
+ export declare class PersistedCache implements Cache {
21
+ _cache: Cache;
22
+ _db: IDBDatabase;
23
+ version: '2';
24
+ constructor(cache: Cache, db: IDBDatabase);
25
+ /**
26
+ * Cache the response to a request
27
+ *
28
+ * Unlike `store.push` which has UPSERT
29
+ * semantics, `put` has `replace` semantics similar to
30
+ * the `http` method `PUT`
31
+ *
32
+ * the individually cacheabl
33
+ * e resource data it may contain
34
+ * should upsert, but the document data surrounding it should
35
+ * fully replace any existing information
36
+ *
37
+ * Note that in order to support inserting arbitrary data
38
+ * to the cache that did not originate from a request `put`
39
+ * should expect to sometimes encounter a document with only
40
+ * a `content` member and therefor must not assume the existence
41
+ * of `request` and `response` on the document.
42
+ *
43
+ * @param {StructuredDocument} doc
44
+ * @return {ResourceDocument}
45
+ * @internal
46
+ */
47
+ put<T>(doc: StructuredDocument<T> | {
48
+ content: T;
49
+ }): ResourceDocument;
50
+ /**
51
+ * Perform an operation on the cache to update the remote state.
52
+ *
53
+ * Note: currently the only valid operation is a MergeOperation
54
+ * which occurs when a collision of identifiers is detected.
55
+ *
56
+ * @internal
57
+ * @param op the operation to perform
58
+ * @return {void}
59
+ */
60
+ patch(op: Operation): void;
61
+ /**
62
+ * Update resource data with a local mutation. Currently supports operations
63
+ * on relationships only.
64
+ *
65
+ * @internal
66
+ * @param mutation
67
+ */
68
+ mutate(mutation: Mutation): void;
69
+ /**
70
+ * Peek resource data from the Cache.
71
+ *
72
+ * In development, if the return value
73
+ * is JSON the return value
74
+ * will be deep-cloned and deep-frozen
75
+ * to prevent mutation thereby enforcing cache
76
+ * Immutability.
77
+ *
78
+ * This form of peek is useful for implementations
79
+ * that want to feed raw-data from cache to the UI
80
+ * or which want to interact with a blob of data
81
+ * directly from the presentation cache.
82
+ *
83
+ * An implementation might want to do this because
84
+ * de-referencing records which read from their own
85
+ * blob is generally safer because the record does
86
+ * not require retainining connections to the Store
87
+ * and Cache to present data on a per-field basis.
88
+ *
89
+ * This generally takes the place of `getAttr` as
90
+ * an API and may even take the place of `getRelationship`
91
+ * depending on implementation specifics, though this
92
+ * latter usage is less recommended due to the advantages
93
+ * of the Graph handling necessary entanglements and
94
+ * notifications for relational data.
95
+ *
96
+ * @internal
97
+ * @param {StableRecordIdentifier | StableDocumentIdentifier} identifier
98
+ * @return {ResourceDocument | ResourceBlob | null} the known resource data
99
+ */
100
+ peek<T = unknown>(identifier: StableRecordIdentifier<TypeFromInstanceOrString<T>>): T | null;
101
+ peek(identifier: StableDocumentIdentifier): ResourceDocument | null;
102
+ /**
103
+ * Peek resource data from the Cache.
104
+ *
105
+ * In development, if the return value
106
+ * is JSON the return value
107
+ * will be deep-cloned and deep-frozen
108
+ * to prevent mutation thereby enforcing cache
109
+ * Immutability.
110
+ *
111
+ * This form of peek is useful for implementations
112
+ * that want to feed raw-data from cache to the UI
113
+ * or which want to interact with a blob of data
114
+ * directly from the presentation cache.
115
+ *
116
+ * An implementation might want to do this because
117
+ * de-referencing records which read from their own
118
+ * blob is generally safer because the record does
119
+ * not require retainining connections to the Store
120
+ * and Cache to present data on a per-field basis.
121
+ *
122
+ * This generally takes the place of `getAttr` as
123
+ * an API and may even take the place of `getRelationship`
124
+ * depending on implementation specifics, though this
125
+ * latter usage is less recommended due to the advantages
126
+ * of the Graph handling necessary entanglements and
127
+ * notifications for relational data.
128
+ *
129
+ * @internal
130
+ * @param {StableRecordIdentifier | StableDocumentIdentifier} identifier
131
+ * @return {ResourceDocument | ResourceBlob | null} the known resource data
132
+ */
133
+ peekRemoteState<T = unknown>(identifier: StableRecordIdentifier<TypeFromInstanceOrString<T>>): T | null;
134
+ peekRemoteState(identifier: StableDocumentIdentifier): ResourceDocument | null;
135
+ /**
136
+ * Peek the Cache for the existing request data associated with
137
+ * a cacheable request
138
+ *
139
+ * @param {StableDocumentIdentifier}
140
+ * @return {StableDocumentIdentifier | null}
141
+ * @internal
142
+ */
143
+ peekRequest(identifier: StableDocumentIdentifier): StructuredDocument<ResourceDocument> | null;
144
+ /**
145
+ * Push resource data from a remote source into the cache for this identifier
146
+ *
147
+ * @internal
148
+ * @param identifier
149
+ * @param data
150
+ * @param hasRecord
151
+ * @return {void | string[]} if `hasRecord` is true then calculated key changes should be returned
152
+ */
153
+ upsert(identifier: StableRecordIdentifier, data: ResourceBlob, hasRecord: boolean): void | string[];
154
+ /**
155
+ * Create a fork of the cache from the current state.
156
+ *
157
+ * Applications should typically not call this method themselves,
158
+ * preferring instead to fork at the Store level, which will
159
+ * utilize this method to fork the cache.
160
+ *
161
+ * @internal
162
+ * @return {Promise<Cache>}
163
+ */
164
+ fork(): Promise<Cache>;
165
+ /**
166
+ * Merge a fork back into a parent Cache.
167
+ *
168
+ * Applications should typically not call this method themselves,
169
+ * preferring instead to merge at the Store level, which will
170
+ * utilize this method to merge the caches.
171
+ *
172
+ * @param {Cache} cache
173
+ * @internal
174
+ * @return {Promise<void>}
175
+ */
176
+ merge(cache: Cache): Promise<void>;
177
+ /**
178
+ * Generate the list of changes applied to all
179
+ * record in the store.
180
+ *
181
+ * Each individual resource or document that has
182
+ * been mutated should be described as an individual
183
+ * `Change` entry in the returned array.
184
+ *
185
+ * A `Change` is described by an object containing up to
186
+ * three properties: (1) the `identifier` of the entity that
187
+ * changed; (2) the `op` code of that change being one of
188
+ * `upsert` or `remove`, and if the op is `upsert` a `patch`
189
+ * containing the data to merge into the cache for the given
190
+ * entity.
191
+ *
192
+ * This `patch` is opaque to the Store but should be understood
193
+ * by the Cache and may expect to be utilized by an Adapter
194
+ * when generating data during a `save` operation.
195
+ *
196
+ * It is generally recommended that the `patch` contain only
197
+ * the updated state, ignoring fields that are unchanged
198
+ *
199
+ * ```ts
200
+ * interface Change {
201
+ * identifier: StableRecordIdentifier | StableDocumentIdentifier;
202
+ * op: 'upsert' | 'remove';
203
+ * patch?: unknown;
204
+ * }
205
+ * ```
206
+ *
207
+ * @internal
208
+ */
209
+ diff(): Promise<Change[]>;
210
+ /**
211
+ * Serialize the entire contents of the Cache into a Stream
212
+ * which may be fed back into a new instance of the same Cache
213
+ * via `cache.hydrate`.
214
+ *
215
+ * @return {Promise<ReadableStream>}
216
+ * @internal
217
+ */
218
+ dump(): Promise<ReadableStream<unknown>>;
219
+ /**
220
+ * hydrate a Cache from a Stream with content previously serialized
221
+ * from another instance of the same Cache, resolving when hydration
222
+ * is complete.
223
+ *
224
+ * This method should expect to be called both in the context of restoring
225
+ * the Cache during application rehydration after SSR **AND** at unknown
226
+ * times during the lifetime of an already booted application when it is
227
+ * desired to bulk-load additional information into the cache. This latter
228
+ * behavior supports optimizing pre/fetching of data for route transitions
229
+ * via data-only SSR modes.
230
+ *
231
+ * @param {ReadableStream} stream
232
+ * @return {Promise<void>}
233
+ * @internal
234
+ */
235
+ hydrate(stream: ReadableStream<unknown>): Promise<void>;
236
+ /**
237
+ * [LIFECYLCE] Signal to the cache that a new record has been instantiated on the client
238
+ *
239
+ * It returns properties from options that should be set on the record during the create
240
+ * process. This return value behavior is deprecated.
241
+ *
242
+ * @internal
243
+ * @param identifier
244
+ * @param options
245
+ */
246
+ clientDidCreate(identifier: StableRecordIdentifier, options?: Record<string, unknown>): Record<string, unknown>;
247
+ /**
248
+ * [LIFECYCLE] Signals to the cache that a resource
249
+ * will be part of a save transaction.
250
+ *
251
+ * @internal
252
+ * @param identifier
253
+ */
254
+ willCommit(identifier: StableRecordIdentifier, context: RequestContext): void;
255
+ /**
256
+ * [LIFECYCLE] Signals to the cache that a resource
257
+ * was successfully updated as part of a save transaction.
258
+ *
259
+ * @internal
260
+ * @param identifier
261
+ * @param data
262
+ */
263
+ didCommit(identifier: StableRecordIdentifier, result: StructuredDataDocument<unknown>): SingleResourceDataDocument;
264
+ /**
265
+ * [LIFECYCLE] Signals to the cache that a resource
266
+ * was update via a save transaction failed.
267
+ *
268
+ * @internal
269
+ * @param identifier
270
+ * @param errors
271
+ */
272
+ commitWasRejected(identifier: StableRecordIdentifier, errors?: ApiError[]): void;
273
+ /**
274
+ * [LIFECYCLE] Signals to the cache that all data for a resource
275
+ * should be cleared.
276
+ *
277
+ * @internal
278
+ * @param identifier
279
+ */
280
+ unloadRecord(identifier: StableRecordIdentifier): void;
281
+ /**
282
+ * Retrieve the data for an attribute from the cache
283
+ *
284
+ * @internal
285
+ * @param identifier
286
+ * @param propertyName
287
+ * @return {unknown}
288
+ */
289
+ getAttr(identifier: StableRecordIdentifier, field: string): Value | undefined;
290
+ /**
291
+ * Retrieve the remote state for an attribute from the cache
292
+ *
293
+ * @internal
294
+ * @param identifier
295
+ * @param propertyName
296
+ * @return {unknown}
297
+ */
298
+ getRemoteAttr(identifier: StableRecordIdentifier, field: string): Value | undefined;
299
+ /**
300
+ * Mutate the data for an attribute in the cache
301
+ *
302
+ * @internal
303
+ * @param identifier
304
+ * @param propertyName
305
+ * @param value
306
+ */
307
+ setAttr(identifier: StableRecordIdentifier, propertyName: string, value: Value): void;
308
+ /**
309
+ * Query the cache for the changed attributes of a resource.
310
+ *
311
+ * @internal
312
+ * @param identifier
313
+ * @return
314
+ */
315
+ changedAttrs(identifier: StableRecordIdentifier): ChangedAttributesHash;
316
+ /**
317
+ * Query the cache for whether any mutated attributes exist
318
+ *
319
+ * @internal
320
+ * @param identifier
321
+ * @return {Boolean}
322
+ */
323
+ hasChangedAttrs(identifier: StableRecordIdentifier): boolean;
324
+ /**
325
+ * Tell the cache to discard any uncommitted mutations to attributes
326
+ *
327
+ * @internal
328
+ * @param identifier
329
+ * @return the names of attributes that were restored
330
+ */
331
+ rollbackAttrs(identifier: StableRecordIdentifier): string[];
332
+ /**
333
+ * Query the cache for the changes to relationships of a resource.
334
+ *
335
+ * Returns a map of relationship names to RelationshipDiff objects.
336
+ *
337
+ * ```ts
338
+ * type RelationshipDiff =
339
+ | {
340
+ kind: 'collection';
341
+ remoteState: StableRecordIdentifier[];
342
+ additions: Set<StableRecordIdentifier>;
343
+ removals: Set<StableRecordIdentifier>;
344
+ localState: StableRecordIdentifier[];
345
+ reordered: boolean;
346
+ }
347
+ | {
348
+ kind: 'resource';
349
+ remoteState: StableRecordIdentifier | null;
350
+ localState: StableRecordIdentifier | null;
351
+ };
352
+ ```
353
+ *
354
+ * @public
355
+ * @param {StableRecordIdentifier} identifier
356
+ * @return {Map<string, RelationshipDiff>}
357
+ */
358
+ changedRelationships(identifier: StableRecordIdentifier): Map<string, RelationshipDiff>;
359
+ /**
360
+ * Query the cache for whether any mutated attributes exist
361
+ *
362
+ * @public
363
+ * @param {StableRecordIdentifier} identifier
364
+ * @return {Boolean}
365
+ */
366
+ hasChangedRelationships(identifier: StableRecordIdentifier): boolean;
367
+ /**
368
+ * Tell the cache to discard any uncommitted mutations to relationships.
369
+ *
370
+ * This will also discard the change on any appropriate inverses.
371
+ *
372
+ * This method is a candidate to become a mutation
373
+ *
374
+ * @public
375
+ * @param {StableRecordIdentifier} identifier
376
+ * @return {String[]} the names of relationships that were restored
377
+ */
378
+ rollbackRelationships(identifier: StableRecordIdentifier): string[];
379
+ /**
380
+ * Query the cache for the current state of a relationship property
381
+ *
382
+ * @internal
383
+ * @param identifier
384
+ * @param propertyName
385
+ * @return resource relationship object
386
+ */
387
+ getRelationship(identifier: StableRecordIdentifier, field: string, isCollection?: boolean): ResourceRelationship | CollectionRelationship;
388
+ /**
389
+ * Query the remote state for the current state of a relationship property
390
+ *
391
+ * @internal
392
+ * @param identifier
393
+ * @param propertyName
394
+ * @return resource relationship object
395
+ */
396
+ getRemoteRelationship(identifier: StableRecordIdentifier, field: string, isCollection?: boolean): ResourceRelationship | CollectionRelationship;
397
+ /**
398
+ * Update the cache state for the given resource to be marked as locally deleted,
399
+ * or remove such a mark.
400
+ *
401
+ * @internal
402
+ * @param identifier
403
+ * @param isDeleted
404
+ */
405
+ setIsDeleted(identifier: StableRecordIdentifier, isDeleted: boolean): void;
406
+ /**
407
+ * Query the cache for any validation errors applicable to the given resource.
408
+ *
409
+ * @internal
410
+ * @param identifier
411
+ * @return
412
+ */
413
+ getErrors(identifier: StableRecordIdentifier): ApiError[];
414
+ /**
415
+ * Query the cache for whether a given resource has any available data
416
+ *
417
+ * @internal
418
+ * @param identifier
419
+ * @return {Boolean}
420
+ */
421
+ isEmpty(identifier: StableRecordIdentifier): boolean;
422
+ /**
423
+ * Query the cache for whether a given resource was created locally and not
424
+ * yet persisted.
425
+ *
426
+ * @internal
427
+ * @param identifier
428
+ * @return {Boolean}
429
+ */
430
+ isNew(identifier: StableRecordIdentifier): boolean;
431
+ /**
432
+ * Query the cache for whether a given resource is marked as deleted (but not
433
+ * necessarily persisted yet).
434
+ *
435
+ * @internal
436
+ * @param identifier
437
+ * @return {Boolean}
438
+ */
439
+ isDeleted(identifier: StableRecordIdentifier): boolean;
440
+ /**
441
+ * Query the cache for whether a given resource has been deleted and that deletion
442
+ * has also been persisted.
443
+ *
444
+ * @internal
445
+ * @param identifier
446
+ * @return {Boolean}
447
+ */
448
+ isDeletionCommitted(identifier: StableRecordIdentifier): boolean;
449
+ }
450
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/persisted-cache/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAC9G,OAAO,KAAK,EACV,wBAAwB,EAExB,sBAAsB,EACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC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AAC,UAAU,EAAE,sBAAsB,GAAG,OAAO;IAIlD;;;;;;;OAOG;IACH,SAAS,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO;IAItD;;;;;;;OAOG;IACH,mBAAmB,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO;CAGjE"}
@@ -0,0 +1,21 @@
1
+ import type { ExistingRecordIdentifier } from '@warp-drive-mirror/core/types/identifier';
2
+ import type { StructuredDocument } from '@warp-drive-mirror/core/types/request';
3
+ import type { ResourceDocument } from '@warp-drive-mirror/core/types/spec/document';
4
+ import type { ExistingResourceObject } from '@warp-drive-mirror/core/types/spec/json-api-raw';
5
+ /**
6
+ * Retrieve the configured IndexedDB database instance
7
+ *
8
+ */
9
+ export declare function getCache(): Promise<IDBDatabase>;
10
+ /**
11
+ * Retrieve a previously cached request from the IndexedDB database
12
+ * if one exists.
13
+ *
14
+ * If the request is found, the associated resources will also be
15
+ * loaded from the cache and added to the response.
16
+ *
17
+ * If any resource is not found in the cache, the result will be null.
18
+ *
19
+ */
20
+ export declare function getCachedRequest(db: IDBDatabase, lid: string): Promise<StructuredDocument<ResourceDocument<ExistingResourceObject & ExistingRecordIdentifier>> | null>;
21
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/persisted-cache/db.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AASvF;;;GAGG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,CAgBrD;AA0ED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,WAAW,EACf,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,sBAAsB,GAAG,wBAAwB,CAAC,CAAC,GAAG,IAAI,CAAC,CAiEzG"}
@@ -0,0 +1,10 @@
1
+ import type { StoreRequestContext } from '@warp-drive-mirror/core';
2
+ import type { Future, Handler, NextFn } from '@warp-drive-mirror/core/request';
3
+ import type { StructuredDataDocument } from '@warp-drive-mirror/core/types/request';
4
+ /**
5
+ * A Handler that resolves requests from the persisted cache.
6
+ */
7
+ export declare class PersistedFetch implements Handler {
8
+ request<T>(context: StoreRequestContext, next: NextFn<T>): Future<T> | Promise<StructuredDataDocument<T>>;
9
+ }
10
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/persisted-cache/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,gCAAgC,CAAC;AAKxC;;GAEG;AACH,qBAAa,cAAe,YAAW,OAAO;IAC5C,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;CAsE1G"}
@@ -0,0 +1,2 @@
1
+ export { PersistedCache } from './persisted-cache/cache';
2
+ //# sourceMappingURL=persisted-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persisted-cache.d.ts","sourceRoot":"","sources":["../src/persisted-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { WorkerFetch } from './data-worker/fetch';
2
+ //# sourceMappingURL=worker-fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-fetch.d.ts","sourceRoot":"","sources":["../src/worker-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { D as DocumentStorage } from "./index-CGCX7hY2.js";
2
- import { SkipCache } from '@warp-drive-mirror/core-types/request';
2
+ import { SkipCache } from '@warp-drive-mirror/core/types/request';
3
3
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
4
4
  const WorkerScope = globalThis.SharedWorkerGlobalScope;
5
5
  class DataWorker {
@@ -194,7 +194,6 @@ function cloneError(error) {
194
194
  * A simplified CacheHandler that hydrates ResourceDataDocuments from the cache
195
195
  * with their referenced resources.
196
196
  *
197
- * @typedoc
198
197
  */
199
198
  const CacheHandler = {
200
199
  request(context, next) {