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