@dereekb/firebase 13.11.13 → 13.11.15
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/index.cjs.js +1446 -1137
- package/index.esm.js +1437 -1128
- package/package.json +5 -5
- package/src/lib/client/error/error.d.ts +1 -1
- package/src/lib/client/firestore/array.d.ts +3 -2
- package/src/lib/client/firestore/driver.accessor.batch.d.ts +5 -4
- package/src/lib/client/firestore/driver.accessor.create.d.ts +4 -3
- package/src/lib/client/firestore/driver.accessor.d.ts +2 -1
- package/src/lib/client/firestore/driver.accessor.default.d.ts +5 -3
- package/src/lib/client/firestore/driver.accessor.transaction.d.ts +7 -5
- package/src/lib/client/firestore/driver.d.ts +1 -1
- package/src/lib/client/firestore/driver.query.d.ts +5 -5
- package/src/lib/client/firestore/increment.d.ts +3 -2
- package/src/lib/client/function/development.function.factory.d.ts +3 -2
- package/src/lib/client/function/error.d.ts +2 -2
- package/src/lib/client/function/function.callable.d.ts +5 -5
- package/src/lib/client/function/function.factory.d.ts +6 -4
- package/src/lib/client/function/model.function.factory.d.ts +9 -8
- package/src/lib/client/storage/driver.accessor.d.ts +14 -14
- package/src/lib/client/storage/driver.d.ts +1 -1
- package/src/lib/common/auth/auth.error.d.ts +2 -2
- package/src/lib/common/development/function.d.ts +5 -5
- package/src/lib/common/firestore/accessor/accessor.d.ts +22 -16
- package/src/lib/common/firestore/accessor/accessor.wrap.d.ts +33 -29
- package/src/lib/common/firestore/accessor/accessor.wrap.modify.d.ts +11 -7
- package/src/lib/common/firestore/accessor/array.d.ts +3 -2
- package/src/lib/common/firestore/accessor/document.d.ts +27 -24
- package/src/lib/common/firestore/accessor/document.paged.d.ts +2 -2
- package/src/lib/common/firestore/accessor/document.rxjs.d.ts +15 -12
- package/src/lib/common/firestore/accessor/document.utility.d.ts +81 -72
- package/src/lib/common/firestore/accessor/increment.d.ts +3 -2
- package/src/lib/common/firestore/cache/cache.d.ts +8 -7
- package/src/lib/common/firestore/cache/cache.memory.d.ts +13 -10
- package/src/lib/common/firestore/collection/collection.d.ts +62 -42
- package/src/lib/common/firestore/collection/collection.group.d.ts +4 -2
- package/src/lib/common/firestore/collection/collection.query.d.ts +7 -4
- package/src/lib/common/firestore/collection/collection.single.d.ts +4 -2
- package/src/lib/common/firestore/collection/collection.util.d.ts +3 -2
- package/src/lib/common/firestore/collection/subcollection.d.ts +4 -2
- package/src/lib/common/firestore/collection/subcollection.paged.d.ts +7 -3
- package/src/lib/common/firestore/collection/subcollection.single.d.ts +4 -2
- package/src/lib/common/firestore/context.d.ts +4 -2
- package/src/lib/common/firestore/driver/query.handler.d.ts +4 -3
- package/src/lib/common/firestore/error.d.ts +6 -5
- package/src/lib/common/firestore/query/constraint.d.ts +56 -36
- package/src/lib/common/firestore/query/constraint.template.d.ts +15 -7
- package/src/lib/common/firestore/query/iterator.d.ts +20 -13
- package/src/lib/common/firestore/query/query.d.ts +6 -4
- package/src/lib/common/firestore/query/query.iterate.array.d.ts +10 -6
- package/src/lib/common/firestore/query/query.iterate.d.ts +8 -8
- package/src/lib/common/firestore/query/query.util.d.ts +11 -7
- package/src/lib/common/firestore/query/watcher.d.ts +9 -7
- package/src/lib/common/firestore/snapshot/snapshot.d.ts +6 -3
- package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +230 -132
- package/src/lib/common/firestore/util/id.batch.d.ts +4 -2
- package/src/lib/common/model/function.d.ts +21 -20
- package/src/lib/common/model/model/model.loader.d.ts +2 -2
- package/src/lib/common/model/model.service.d.ts +28 -20
- package/src/lib/common/model/permission/permission.service.d.ts +3 -2
- package/src/lib/common/model/permission/permission.service.grant.d.ts +27 -21
- package/src/lib/common/model/permission/permission.service.role.d.ts +7 -7
- package/src/lib/common/storage/accessor/path.model.d.ts +3 -2
- package/src/lib/common/storage/context.d.ts +3 -2
- package/src/lib/common/storage/driver/accessor.iterate.d.ts +7 -6
- package/src/lib/common/storage/driver/accessor.util.d.ts +4 -4
- package/src/lib/common/storage/driver/error.d.ts +3 -3
- package/src/lib/common/storage/driver/list.d.ts +4 -3
- package/src/lib/common/storage/storage.d.ts +9 -8
- package/src/lib/common/storage/types.d.ts +1 -1
- package/src/lib/model/notification/notification.api.d.ts +2 -2
- package/src/lib/model/notification/notification.api.util.d.ts +16 -16
- package/src/lib/model/notification/notification.config.d.ts +35 -34
- package/src/lib/model/notification/notification.create.d.ts +17 -15
- package/src/lib/model/notification/notification.create.loggedevent.d.ts +3 -2
- package/src/lib/model/notification/notification.create.task.d.ts +3 -2
- package/src/lib/model/notification/notification.d.ts +53 -45
- package/src/lib/model/notification/notification.details.d.ts +5 -4
- package/src/lib/model/notification/notification.id.d.ts +8 -8
- package/src/lib/model/notification/notification.item.d.ts +3 -3
- package/src/lib/model/notification/notification.loggedevent.loader.d.ts +2 -2
- package/src/lib/model/notification/notification.message.d.ts +6 -4
- package/src/lib/model/notification/notification.query.d.ts +12 -12
- package/src/lib/model/notification/notification.send.d.ts +3 -3
- package/src/lib/model/notification/notification.task.d.ts +15 -15
- package/src/lib/model/notification/notification.task.subtask.d.ts +3 -3
- package/src/lib/model/notification/notification.util.d.ts +29 -29
- package/src/lib/model/oidcmodel/oidcmodel.api.d.ts +2 -2
- package/src/lib/model/oidcmodel/oidcmodel.d.ts +6 -6
- package/src/lib/model/oidcmodel/oidcmodel.query.d.ts +18 -18
- package/src/lib/model/storagefile/storagefile.api.d.ts +2 -2
- package/src/lib/model/storagefile/storagefile.create.d.ts +8 -7
- package/src/lib/model/storagefile/storagefile.d.ts +19 -18
- package/src/lib/model/storagefile/storagefile.file.d.ts +2 -1
- package/src/lib/model/storagefile/storagefile.group.d.ts +5 -5
- package/src/lib/model/storagefile/storagefile.permission.d.ts +3 -2
- package/src/lib/model/storagefile/storagefile.query.d.ts +15 -15
- package/src/lib/model/storagefile/storagefile.task.d.ts +2 -2
- package/src/lib/model/storagefile/storagefile.upload.claims.d.ts +4 -4
- package/src/lib/model/storagefile/storagefile.upload.d.ts +8 -6
- package/src/lib/model/storagefile/storagefile.upload.determiner.d.ts +18 -16
- package/src/lib/model/storagefile/storagefile.util.d.ts +8 -8
- package/src/lib/model/system/system.d.ts +6 -6
- package/test/index.cjs.js +43 -43
- package/test/index.esm.js +38 -38
- package/test/package.json +6 -6
- package/test/src/lib/client/firebase.d.ts +1 -1
- package/test/src/lib/common/firestore/firestore.d.ts +3 -3
- package/test/src/lib/common/mock/mock.item.collection.fixture.d.ts +3 -3
- package/test/src/lib/common/mock/mock.item.d.ts +16 -16
- package/test/src/lib/common/mock/mock.item.query.d.ts +4 -4
- package/test/src/lib/common/mock/mock.item.storage.fixture.d.ts +3 -3
- package/test/src/lib/common/storage/storage.d.ts +1 -1
|
@@ -9,9 +9,9 @@ import { type FirestoreDocumentData, type FirestoreDocument, type FirestoreDocum
|
|
|
9
9
|
* but no data is written to the database. Useful for preparing document references in bulk before
|
|
10
10
|
* deciding what data to write.
|
|
11
11
|
*
|
|
12
|
-
* @param documentAccessor - Accessor that provides the `newDocument()` factory method
|
|
13
|
-
* @param count - Number of document instances to create
|
|
14
|
-
* @returns Array of `count` new document instances, each with a unique auto-generated ID
|
|
12
|
+
* @param documentAccessor - Accessor that provides the `newDocument()` factory method.
|
|
13
|
+
* @param count - Number of document instances to create.
|
|
14
|
+
* @returns Array of `count` new document instances, each with a unique auto-generated ID.
|
|
15
15
|
*
|
|
16
16
|
* @dbxUtil
|
|
17
17
|
* @dbxUtilCategory firestore
|
|
@@ -62,15 +62,16 @@ export interface MakeDocumentsParams<T, D extends FirestoreDocument<T> = Firesto
|
|
|
62
62
|
*
|
|
63
63
|
* Documents are created sequentially (not in parallel) to allow index-dependent logic.
|
|
64
64
|
*
|
|
65
|
-
* @param documentAccessor - Accessor providing the document factory and collection context
|
|
66
|
-
* @param make - Configuration controlling count, factory, and initialization
|
|
65
|
+
* @param documentAccessor - Accessor providing the document factory and collection context.
|
|
66
|
+
* @param make - Configuration controlling count, factory, and initialization.
|
|
67
67
|
* @returns Promise resolving to all created document instances (length === `make.count`)
|
|
68
|
-
* @__NO_SIDE_EFFECTS__
|
|
69
68
|
*
|
|
70
69
|
* @dbxUtil
|
|
71
70
|
* @dbxUtilCategory firestore
|
|
72
71
|
* @dbxUtilTags firestore, document, accessor, make, create, persist, bulk, fixture, seed
|
|
73
72
|
* @dbxUtilRelated new-documents
|
|
73
|
+
*
|
|
74
|
+
* @__NO_SIDE_EFFECTS__
|
|
74
75
|
*/
|
|
75
76
|
export declare function makeDocuments<T, D extends FirestoreDocument<T>>(documentAccessor: FirestoreDocumentAccessor<T, D>, make: MakeDocumentsParams<T, D>): Promise<D[]>;
|
|
76
77
|
/**
|
|
@@ -79,8 +80,8 @@ export declare function makeDocuments<T, D extends FirestoreDocument<T>>(documen
|
|
|
79
80
|
* Each document's `accessor.get()` is called concurrently. The returned array preserves
|
|
80
81
|
* the same ordering as the input `documents` array.
|
|
81
82
|
*
|
|
82
|
-
* @param documents - Documents to fetch snapshots for
|
|
83
|
-
* @returns Snapshots in the same order as the input array
|
|
83
|
+
* @param documents - Documents to fetch snapshots for.
|
|
84
|
+
* @returns Snapshots in the same order as the input array.
|
|
84
85
|
*
|
|
85
86
|
* @dbxUtil
|
|
86
87
|
* @dbxUtilCategory firestore
|
|
@@ -107,8 +108,8 @@ export type FirestoreDocumentSnapshotPair<D extends FirestoreDocument<any>> = {
|
|
|
107
108
|
/**
|
|
108
109
|
* Fetches the current snapshot of a single document and pairs it with the document instance.
|
|
109
110
|
*
|
|
110
|
-
* @param document - The document to fetch
|
|
111
|
-
* @returns A pair containing the document and its snapshot
|
|
111
|
+
* @param document - The document to fetch.
|
|
112
|
+
* @returns A pair containing the document and its snapshot.
|
|
112
113
|
*
|
|
113
114
|
* @dbxUtil
|
|
114
115
|
* @dbxUtilCategory firestore
|
|
@@ -119,8 +120,8 @@ export declare function getDocumentSnapshotPair<D extends FirestoreDocument<any>
|
|
|
119
120
|
/**
|
|
120
121
|
* Fetches snapshots for multiple documents in parallel and pairs each with its document instance.
|
|
121
122
|
*
|
|
122
|
-
* @param documents - Documents to fetch
|
|
123
|
-
* @returns Pairs in the same order as the input array
|
|
123
|
+
* @param documents - Documents to fetch.
|
|
124
|
+
* @returns Pairs in the same order as the input array.
|
|
124
125
|
*
|
|
125
126
|
* @dbxUtil
|
|
126
127
|
* @dbxUtilCategory firestore
|
|
@@ -163,7 +164,7 @@ export interface FirestoreDocumentSnapshotDataPairWithData<D extends FirestoreDo
|
|
|
163
164
|
/**
|
|
164
165
|
* Fetches a document's snapshot, extracts its data with `id`/`key` fields, and returns all three as a triplet.
|
|
165
166
|
*
|
|
166
|
-
* @param document - The document to fetch
|
|
167
|
+
* @param document - The document to fetch.
|
|
167
168
|
* @returns A triplet of document, snapshot, and data (data may be `undefined` if the document doesn't exist)
|
|
168
169
|
*
|
|
169
170
|
* @dbxUtil
|
|
@@ -178,8 +179,8 @@ export declare function getDocumentSnapshotDataPair<D extends FirestoreDocument<
|
|
|
178
179
|
* Processes up to 200 documents concurrently via {@link runAsyncTasksForValues}.
|
|
179
180
|
* The returned array preserves the same ordering as the input.
|
|
180
181
|
*
|
|
181
|
-
* @param documents - Documents to fetch
|
|
182
|
-
* @returns Triplets in the same order as the input array
|
|
182
|
+
* @param documents - Documents to fetch.
|
|
183
|
+
* @returns Triplets in the same order as the input array.
|
|
183
184
|
*
|
|
184
185
|
* @dbxUtil
|
|
185
186
|
* @dbxUtilCategory firestore
|
|
@@ -193,8 +194,8 @@ export declare function getDocumentSnapshotDataPairs<D extends FirestoreDocument
|
|
|
193
194
|
* Convenience wrapper around {@link getDocumentSnapshotDataPairs} that removes entries where `data` is nullish,
|
|
194
195
|
* returning only {@link FirestoreDocumentSnapshotDataPairWithData} results.
|
|
195
196
|
*
|
|
196
|
-
* @param documents - Documents to fetch
|
|
197
|
-
* @returns Triplets for documents that exist, in their original relative order
|
|
197
|
+
* @param documents - Documents to fetch.
|
|
198
|
+
* @returns Triplets for documents that exist, in their original relative order.
|
|
198
199
|
*
|
|
199
200
|
* @dbxUtil
|
|
200
201
|
* @dbxUtilCategory firestore
|
|
@@ -214,8 +215,8 @@ export type FirestoreDocumentSnapshotDataTuple<D extends FirestoreDocument<any>>
|
|
|
214
215
|
* and does not inject `id`/`key` fields onto the data. The `data` value is the raw result of
|
|
215
216
|
* `snapshot.data()` and may be `undefined` for non-existent documents.
|
|
216
217
|
*
|
|
217
|
-
* @param documents - Documents to fetch
|
|
218
|
-
* @returns Tuples in the same order as the input array
|
|
218
|
+
* @param documents - Documents to fetch.
|
|
219
|
+
* @returns Tuples in the same order as the input array.
|
|
219
220
|
*
|
|
220
221
|
* @dbxUtil
|
|
221
222
|
* @dbxUtilCategory firestore
|
|
@@ -289,9 +290,9 @@ export declare function getDataFromDocumentSnapshots<T>(snapshots: DocumentSnaps
|
|
|
289
290
|
* Maps each document in `snapshots.docs` to a loaded document via `accessor.loadDocument(ref)`.
|
|
290
291
|
* No additional data fetching occurs; the documents are loaded from their existing references.
|
|
291
292
|
*
|
|
292
|
-
* @param accessor - Accessor to load documents with
|
|
293
|
-
* @param snapshots - Query snapshot containing the document references
|
|
294
|
-
* @returns Document instances in the same order as the query results
|
|
293
|
+
* @param accessor - Accessor to load documents with.
|
|
294
|
+
* @param snapshots - Query snapshot containing the document references.
|
|
295
|
+
* @returns Document instances in the same order as the query results.
|
|
295
296
|
*
|
|
296
297
|
* @dbxUtil
|
|
297
298
|
* @dbxUtilCategory firestore
|
|
@@ -304,10 +305,10 @@ export declare function loadDocumentsForSnapshots<T, D extends FirestoreDocument
|
|
|
304
305
|
*
|
|
305
306
|
* Convenience function that maps values through `getRef` then delegates to {@link loadDocumentsForDocumentReferences}.
|
|
306
307
|
*
|
|
307
|
-
* @param accessor - Accessor to load documents with
|
|
308
|
-
* @param values - Source values to extract references from
|
|
309
|
-
* @param getRef - Extracts a document reference from each value
|
|
310
|
-
* @returns Document instances in the same order as the input values
|
|
308
|
+
* @param accessor - Accessor to load documents with.
|
|
309
|
+
* @param values - Source values to extract references from.
|
|
310
|
+
* @param getRef - Extracts a document reference from each value.
|
|
311
|
+
* @returns Document instances in the same order as the input values.
|
|
311
312
|
*
|
|
312
313
|
* @dbxUtil
|
|
313
314
|
* @dbxUtilCategory firestore
|
|
@@ -325,9 +326,9 @@ export declare const loadDocumentsForValues: typeof loadDocumentsForDocumentRefe
|
|
|
325
326
|
* Each reference is passed to `accessor.loadDocument()` to create a document wrapper.
|
|
326
327
|
* No network calls are made; this only creates in-memory document instances bound to the given references.
|
|
327
328
|
*
|
|
328
|
-
* @param accessor - Accessor to load documents with
|
|
329
|
-
* @param refs - Document references to load
|
|
330
|
-
* @returns Document instances in the same order as the input references
|
|
329
|
+
* @param accessor - Accessor to load documents with.
|
|
330
|
+
* @param refs - Document references to load.
|
|
331
|
+
* @returns Document instances in the same order as the input references.
|
|
331
332
|
*
|
|
332
333
|
* @dbxUtil
|
|
333
334
|
* @dbxUtilCategory firestore
|
|
@@ -340,10 +341,10 @@ export declare function loadDocumentsForDocumentReferences<T, D extends Firestor
|
|
|
340
341
|
*
|
|
341
342
|
* Convenience function that maps values through `getKey` then delegates to {@link loadDocumentsForKeys}.
|
|
342
343
|
*
|
|
343
|
-
* @param accessor - Accessor to load documents with
|
|
344
|
-
* @param values - Source values to extract keys from
|
|
345
|
-
* @param getKey - Extracts a model key (full Firestore path) from each value
|
|
346
|
-
* @returns Document instances in the same order as the input values
|
|
344
|
+
* @param accessor - Accessor to load documents with.
|
|
345
|
+
* @param values - Source values to extract keys from.
|
|
346
|
+
* @param getKey - Extracts a model key (full Firestore path) from each value.
|
|
347
|
+
* @returns Document instances in the same order as the input values.
|
|
347
348
|
*
|
|
348
349
|
* @dbxUtil
|
|
349
350
|
* @dbxUtilCategory firestore
|
|
@@ -356,9 +357,9 @@ export declare function loadDocumentsForKeysFromValues<I, T, D extends Firestore
|
|
|
356
357
|
*
|
|
357
358
|
* Each key is passed to `accessor.loadDocumentForKey()`. No network calls are made.
|
|
358
359
|
*
|
|
359
|
-
* @param accessor - Accessor to load documents with
|
|
360
|
+
* @param accessor - Accessor to load documents with.
|
|
360
361
|
* @param keys - Full Firestore document paths (e.g. `'users/abc123'`)
|
|
361
|
-
* @returns Document instances in the same order as the input keys
|
|
362
|
+
* @returns Document instances in the same order as the input keys.
|
|
362
363
|
*
|
|
363
364
|
* @dbxUtil
|
|
364
365
|
* @dbxUtilCategory firestore
|
|
@@ -373,9 +374,9 @@ export declare function loadDocumentsForKeys<T, D extends FirestoreDocument<T>>(
|
|
|
373
374
|
* Requires a full {@link FirestoreDocumentAccessor} (not limited) because loading by ID requires collection context.
|
|
374
375
|
*
|
|
375
376
|
* @param accessor - Accessor to load documents with (must have collection context for ID resolution)
|
|
376
|
-
* @param values - Source values to extract IDs from
|
|
377
|
-
* @param getId - Extracts a model ID from each value
|
|
378
|
-
* @returns Document instances in the same order as the input values
|
|
377
|
+
* @param values - Source values to extract IDs from.
|
|
378
|
+
* @param getId - Extracts a model ID from each value.
|
|
379
|
+
* @returns Document instances in the same order as the input values.
|
|
379
380
|
*
|
|
380
381
|
* @dbxUtil
|
|
381
382
|
* @dbxUtilCategory firestore
|
|
@@ -390,8 +391,8 @@ export declare function loadDocumentsForIdsFromValues<I, T, D extends FirestoreD
|
|
|
390
391
|
* because ID-based loading needs the collection reference to resolve the full path. No network calls are made.
|
|
391
392
|
*
|
|
392
393
|
* @param accessor - Accessor to load documents with (must have collection context)
|
|
393
|
-
* @param ids - Document IDs within the accessor's collection
|
|
394
|
-
* @returns Document instances in the same order as the input IDs
|
|
394
|
+
* @param ids - Document IDs within the accessor's collection.
|
|
395
|
+
* @returns Document instances in the same order as the input IDs.
|
|
395
396
|
*
|
|
396
397
|
* @dbxUtil
|
|
397
398
|
* @dbxUtilCategory firestore
|
|
@@ -412,15 +413,16 @@ export type FirestoreDocumentLoader<T, D extends FirestoreDocument<T>> = (refere
|
|
|
412
413
|
* The returned loader resolves the appropriate accessor based on whether a transaction is provided,
|
|
413
414
|
* then delegates to {@link loadDocumentsForDocumentReferences}.
|
|
414
415
|
*
|
|
415
|
-
* @param accessorContext - Context that provides accessors for both default and transactional use
|
|
416
|
-
* @returns A loader function that converts document references to document instances
|
|
417
|
-
* @__NO_SIDE_EFFECTS__
|
|
416
|
+
* @param accessorContext - Context that provides accessors for both default and transactional use.
|
|
417
|
+
* @returns A loader function that converts document references to document instances.
|
|
418
418
|
*
|
|
419
419
|
* @dbxUtil
|
|
420
420
|
* @dbxUtilCategory firestore
|
|
421
421
|
* @dbxUtilKind factory
|
|
422
422
|
* @dbxUtilTags firestore, document, loader, factory, transaction, accessor, context
|
|
423
423
|
* @dbxUtilRelated firestore-document-snapshot-pairs-loader, load-documents-for-document-references
|
|
424
|
+
*
|
|
425
|
+
* @__NO_SIDE_EFFECTS__
|
|
424
426
|
*/
|
|
425
427
|
export declare function firestoreDocumentLoader<T, D extends FirestoreDocument<T>>(accessorContext: LimitedFirestoreDocumentAccessorContextExtension<T, D>): FirestoreDocumentLoader<T, D>;
|
|
426
428
|
/**
|
|
@@ -446,15 +448,16 @@ export type FirestoreQueryDocumentSnapshotPairsLoader<T, D extends FirestoreDocu
|
|
|
446
448
|
* Also satisfies the {@link FirestoreQueryDocumentSnapshotPairsLoader} type since the implementation
|
|
447
449
|
* handles both {@link DocumentSnapshot} and {@link QueryDocumentSnapshot} inputs.
|
|
448
450
|
*
|
|
449
|
-
* @param accessorContext - Context that provides accessors for both default and transactional use
|
|
450
|
-
* @returns A loader function that converts snapshots to document-snapshot-data pairs
|
|
451
|
-
* @__NO_SIDE_EFFECTS__
|
|
451
|
+
* @param accessorContext - Context that provides accessors for both default and transactional use.
|
|
452
|
+
* @returns A loader function that converts snapshots to document-snapshot-data pairs.
|
|
452
453
|
*
|
|
453
454
|
* @dbxUtil
|
|
454
455
|
* @dbxUtilCategory firestore
|
|
455
456
|
* @dbxUtilKind factory
|
|
456
457
|
* @dbxUtilTags firestore, snapshot, pair, loader, factory, transaction, accessor, query, context
|
|
457
458
|
* @dbxUtilRelated firestore-document-snapshot-pairs-loader-instance, firestore-query-document-snapshot-pairs-loader, firestore-document-loader
|
|
459
|
+
*
|
|
460
|
+
* @__NO_SIDE_EFFECTS__
|
|
458
461
|
*/
|
|
459
462
|
export declare function firestoreDocumentSnapshotPairsLoader<T, D extends FirestoreDocument<T>>(accessorContext: LimitedFirestoreDocumentAccessorContextExtension<T, D>): FirestoreDocumentSnapshotPairsLoader<T, D> & FirestoreQueryDocumentSnapshotPairsLoader<T, D>;
|
|
460
463
|
/**
|
|
@@ -478,15 +481,16 @@ export type FirestoreDocumentSnapshotPairsLoaderInstance<T, D extends FirestoreD
|
|
|
478
481
|
* 2. Loading the document from the snapshot's reference via `accessor.loadDocument()`
|
|
479
482
|
* 3. Combining all three into a single pair object
|
|
480
483
|
*
|
|
481
|
-
* @param accessor - The accessor to bind for document loading
|
|
482
|
-
* @returns A reusable function that converts snapshots to pairs using the bound accessor
|
|
483
|
-
* @__NO_SIDE_EFFECTS__
|
|
484
|
+
* @param accessor - The accessor to bind for document loading.
|
|
485
|
+
* @returns A reusable function that converts snapshots to pairs using the bound accessor.
|
|
484
486
|
*
|
|
485
487
|
* @dbxUtil
|
|
486
488
|
* @dbxUtilCategory firestore
|
|
487
489
|
* @dbxUtilKind factory
|
|
488
490
|
* @dbxUtilTags firestore, snapshot, pair, loader, factory, instance, accessor, idkey
|
|
489
491
|
* @dbxUtilRelated firestore-document-snapshot-pairs-loader, document-data-with-id-and-key
|
|
492
|
+
*
|
|
493
|
+
* @__NO_SIDE_EFFECTS__
|
|
490
494
|
*/
|
|
491
495
|
export declare function firestoreDocumentSnapshotPairsLoaderInstance<T, D extends FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>): FirestoreDocumentSnapshotPairsLoaderInstance<T, D>;
|
|
492
496
|
/**
|
|
@@ -578,7 +582,7 @@ export declare function documentDataWithIdAndKey<T>(snapshot: DocumentSnapshot<T
|
|
|
578
582
|
* is modified in-place and also returned for chaining convenience.
|
|
579
583
|
*
|
|
580
584
|
* @param data - The data object to augment (mutated in-place)
|
|
581
|
-
* @param snapshot - Source of the `id` and `key` values
|
|
585
|
+
* @param snapshot - Source of the `id` and `key` values.
|
|
582
586
|
* @returns The same data object, now typed as {@link DocumentDataWithIdAndKey}
|
|
583
587
|
*
|
|
584
588
|
* @dbxUtil
|
|
@@ -595,7 +599,7 @@ export declare function setIdAndKeyFromSnapshotOnDocumentData<T>(data: T, snapsh
|
|
|
595
599
|
* The data object is modified in-place and also returned for chaining convenience.
|
|
596
600
|
*
|
|
597
601
|
* @param data - The data object to augment (mutated in-place)
|
|
598
|
-
* @param modelRef - Source of the `id` and `key` values
|
|
602
|
+
* @param modelRef - Source of the `id` and `key` values.
|
|
599
603
|
* @returns The same data object, now typed as {@link DocumentDataWithIdAndKey}
|
|
600
604
|
*
|
|
601
605
|
* @dbxUtil
|
|
@@ -610,10 +614,10 @@ export declare function setIdAndKeyFromKeyIdRefOnDocumentData<T>(data: T, modelR
|
|
|
610
614
|
* If `document` is nullish, the `use` callback is not invoked and `defaultValue` is returned instead.
|
|
611
615
|
* If `document` exists but the snapshot is nullish (shouldn't happen in practice), `defaultValue` is also used.
|
|
612
616
|
*
|
|
613
|
-
* @param document - The document to fetch, or nullish to skip
|
|
614
|
-
* @param use - Callback that receives the fetched snapshot and returns a result
|
|
615
|
-
* @param defaultValue - Fallback value when `document` is nullish or the snapshot is unavailable
|
|
616
|
-
* @returns The result of `use`, or the default value
|
|
617
|
+
* @param document - The document to fetch, or nullish to skip.
|
|
618
|
+
* @param use - Callback that receives the fetched snapshot and returns a result.
|
|
619
|
+
* @param defaultValue - Fallback value when `document` is nullish or the snapshot is unavailable.
|
|
620
|
+
* @returns The result of `use`, or the default value.
|
|
617
621
|
*
|
|
618
622
|
* @dbxUtil
|
|
619
623
|
* @dbxUtilCategory firestore
|
|
@@ -645,27 +649,29 @@ export declare const useDocumentSnapshotData: <D extends FirestoreDocument<any>,
|
|
|
645
649
|
*
|
|
646
650
|
* Useful as a mapper function, e.g. `documents.map(firestoreModelIdFromDocument)`.
|
|
647
651
|
*
|
|
648
|
-
* @param document - The document to extract the ID from
|
|
652
|
+
* @param document - The document to extract the ID from.
|
|
649
653
|
* @returns The document's ID (the last segment of its Firestore path)
|
|
650
|
-
* @__NO_SIDE_EFFECTS__
|
|
651
654
|
*
|
|
652
655
|
* @dbxUtil
|
|
653
656
|
* @dbxUtilCategory firestore
|
|
654
657
|
* @dbxUtilTags firestore, document, id, accessor, mapper, key
|
|
655
658
|
* @dbxUtilRelated firestore-model-ids-from-documents, firestore-model-key-from-document
|
|
659
|
+
*
|
|
660
|
+
* @__NO_SIDE_EFFECTS__
|
|
656
661
|
*/
|
|
657
662
|
export declare function firestoreModelIdFromDocument<T, D extends FirestoreDocument<T>>(document: D): FirestoreModelId;
|
|
658
663
|
/**
|
|
659
664
|
* Extracts document IDs from an array of {@link FirestoreDocument}s.
|
|
660
665
|
*
|
|
661
|
-
* @param documents - Documents to extract IDs from
|
|
662
|
-
* @returns Array of document IDs in the same order as the input
|
|
663
|
-
* @__NO_SIDE_EFFECTS__
|
|
666
|
+
* @param documents - Documents to extract IDs from.
|
|
667
|
+
* @returns Array of document IDs in the same order as the input.
|
|
664
668
|
*
|
|
665
669
|
* @dbxUtil
|
|
666
670
|
* @dbxUtilCategory firestore
|
|
667
671
|
* @dbxUtilTags firestore, document, id, accessor, batch, mapper
|
|
668
672
|
* @dbxUtilRelated firestore-model-id-from-document, firestore-model-keys-from-documents
|
|
673
|
+
*
|
|
674
|
+
* @__NO_SIDE_EFFECTS__
|
|
669
675
|
*/
|
|
670
676
|
export declare function firestoreModelIdsFromDocuments<T, D extends FirestoreDocument<T>>(documents: D[]): FirestoreModelId[];
|
|
671
677
|
/**
|
|
@@ -673,27 +679,29 @@ export declare function firestoreModelIdsFromDocuments<T, D extends FirestoreDoc
|
|
|
673
679
|
*
|
|
674
680
|
* Useful as a mapper function, e.g. `documents.map(firestoreModelKeyFromDocument)`.
|
|
675
681
|
*
|
|
676
|
-
* @param document - The document to extract the key from
|
|
682
|
+
* @param document - The document to extract the key from.
|
|
677
683
|
* @returns The document's full Firestore path (e.g. `'users/abc123'`)
|
|
678
|
-
* @__NO_SIDE_EFFECTS__
|
|
679
684
|
*
|
|
680
685
|
* @dbxUtil
|
|
681
686
|
* @dbxUtilCategory firestore
|
|
682
687
|
* @dbxUtilTags firestore, document, key, path, accessor, mapper
|
|
683
688
|
* @dbxUtilRelated firestore-model-keys-from-documents, firestore-model-id-from-document
|
|
689
|
+
*
|
|
690
|
+
* @__NO_SIDE_EFFECTS__
|
|
684
691
|
*/
|
|
685
692
|
export declare function firestoreModelKeyFromDocument<T, D extends FirestoreDocument<T>>(document: D): FirestoreModelKey;
|
|
686
693
|
/**
|
|
687
694
|
* Extracts full Firestore paths from an array of {@link FirestoreDocument}s.
|
|
688
695
|
*
|
|
689
|
-
* @param documents - Documents to extract keys from
|
|
690
|
-
* @returns Array of full Firestore paths in the same order as the input
|
|
691
|
-
* @__NO_SIDE_EFFECTS__
|
|
696
|
+
* @param documents - Documents to extract keys from.
|
|
697
|
+
* @returns Array of full Firestore paths in the same order as the input.
|
|
692
698
|
*
|
|
693
699
|
* @dbxUtil
|
|
694
700
|
* @dbxUtilCategory firestore
|
|
695
701
|
* @dbxUtilTags firestore, document, key, path, accessor, batch, mapper
|
|
696
702
|
* @dbxUtilRelated firestore-model-key-from-document, firestore-model-ids-from-documents
|
|
703
|
+
*
|
|
704
|
+
* @__NO_SIDE_EFFECTS__
|
|
697
705
|
*/
|
|
698
706
|
export declare function firestoreModelKeysFromDocuments<T, D extends FirestoreDocument<T>>(documents: D[]): FirestoreModelKey[];
|
|
699
707
|
/**
|
|
@@ -701,8 +709,8 @@ export declare function firestoreModelKeysFromDocuments<T, D extends FirestoreDo
|
|
|
701
709
|
*
|
|
702
710
|
* Useful as a mapper function, e.g. `documents.map(documentReferenceFromDocument)`.
|
|
703
711
|
*
|
|
704
|
-
* @param document - The document to extract the reference from
|
|
705
|
-
* @returns The underlying Firestore document reference
|
|
712
|
+
* @param document - The document to extract the reference from.
|
|
713
|
+
* @returns The underlying Firestore document reference.
|
|
706
714
|
*
|
|
707
715
|
* @dbxUtil
|
|
708
716
|
* @dbxUtilCategory firestore
|
|
@@ -713,8 +721,8 @@ export declare function documentReferenceFromDocument<T, D extends FirestoreDocu
|
|
|
713
721
|
/**
|
|
714
722
|
* Extracts {@link DocumentReference}s from an array of {@link FirestoreDocument}s.
|
|
715
723
|
*
|
|
716
|
-
* @param documents - Documents to extract references from
|
|
717
|
-
* @returns Array of document references in the same order as the input
|
|
724
|
+
* @param documents - Documents to extract references from.
|
|
725
|
+
* @returns Array of document references in the same order as the input.
|
|
718
726
|
*
|
|
719
727
|
* @dbxUtil
|
|
720
728
|
* @dbxUtilCategory firestore
|
|
@@ -792,14 +800,14 @@ export interface LimitedFirestoreDocumentAccessorSnapshotCache<T, D extends Fire
|
|
|
792
800
|
* best suited for short-lived scopes (e.g. a single request or batch operation) where stale reads
|
|
793
801
|
* are acceptable.
|
|
794
802
|
*
|
|
803
|
+
* @param accessor - The accessor to wrap with caching behavior.
|
|
804
|
+
* @returns A {@link LimitedFirestoreDocumentAccessorSnapshotCache} backed by the given accessor.
|
|
805
|
+
*
|
|
795
806
|
* @dbxUtil
|
|
796
807
|
* @dbxUtilCategory firestore
|
|
797
808
|
* @dbxUtilKind factory
|
|
798
809
|
* @dbxUtilTags firestore, cache, snapshot, accessor, deduplicate, memoize, reader
|
|
799
810
|
*
|
|
800
|
-
* @param accessor - The accessor to wrap with caching behavior
|
|
801
|
-
* @returns A {@link LimitedFirestoreDocumentAccessorSnapshotCache} backed by the given accessor
|
|
802
|
-
*
|
|
803
811
|
* @example
|
|
804
812
|
* ```typescript
|
|
805
813
|
* const cache = limitedFirestoreDocumentAccessorSnapshotCache(accessor);
|
|
@@ -814,6 +822,7 @@ export interface LimitedFirestoreDocumentAccessorSnapshotCache<T, D extends Fire
|
|
|
814
822
|
* // Access the underlying accessor directly
|
|
815
823
|
* const doc = cache.accessor.loadDocumentForKey('users/xyz');
|
|
816
824
|
* ```
|
|
825
|
+
*
|
|
817
826
|
* @__NO_SIDE_EFFECTS__
|
|
818
827
|
*/
|
|
819
828
|
export declare function limitedFirestoreDocumentAccessorSnapshotCache<T, D extends FirestoreDocument<T> = FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>): LimitedFirestoreDocumentAccessorSnapshotCache<T, D>;
|
|
@@ -14,10 +14,11 @@ export type IncrementUpdateWithAccessorFunction<T> = (data: FirestoreAccessorInc
|
|
|
14
14
|
*
|
|
15
15
|
* Uses Firestore's built-in atomic increment operation, which is safe for concurrent updates.
|
|
16
16
|
*
|
|
17
|
-
* @param accessor -
|
|
18
|
-
* @returns
|
|
17
|
+
* @param accessor - Accessor used to apply the increment.
|
|
18
|
+
* @returns Update function that runs the supplied increment operations.
|
|
19
19
|
*
|
|
20
20
|
* @see https://cloud.google.com/firestore/docs/samples/firestore-data-set-numeric-increment
|
|
21
|
+
*
|
|
21
22
|
* @__NO_SIDE_EFFECTS__
|
|
22
23
|
*/
|
|
23
24
|
export declare function incrementUpdateWithAccessorFunction<T>(accessor: FirestoreDocumentDataAccessor<T>): IncrementUpdateWithAccessorFunction<T>;
|
|
@@ -273,9 +273,9 @@ export interface FirestoreCollectionDocumentCache<T = unknown> {
|
|
|
273
273
|
* Creates a {@link FirestoreCollectionDocumentCache} that delegates to the given
|
|
274
274
|
* collection cache with the key pre-bound.
|
|
275
275
|
*
|
|
276
|
-
* @param collectionCache - The parent collection cache
|
|
277
|
-
* @param key - The document path to bind
|
|
278
|
-
* @returns A document-scoped cache
|
|
276
|
+
* @param collectionCache - The parent collection cache.
|
|
277
|
+
* @param key - The document path to bind.
|
|
278
|
+
* @returns A document-scoped cache.
|
|
279
279
|
*
|
|
280
280
|
* @example
|
|
281
281
|
* ```ts
|
|
@@ -283,6 +283,7 @@ export interface FirestoreCollectionDocumentCache<T = unknown> {
|
|
|
283
283
|
* docCache.set({ data: userData });
|
|
284
284
|
* const entry = docCache.get();
|
|
285
285
|
* ```
|
|
286
|
+
*
|
|
286
287
|
* @__NO_SIDE_EFFECTS__
|
|
287
288
|
*/
|
|
288
289
|
export declare function firestoreCollectionDocumentCache<T>(collectionCache: FirestoreCollectionCache<T>, key: FirestoreModelKey): FirestoreCollectionDocumentCache<T>;
|
|
@@ -343,14 +344,14 @@ export interface FirestoreContextCacheFactoryRef {
|
|
|
343
344
|
*
|
|
344
345
|
* Used when no cache driver is configured so that `.cache` is always defined.
|
|
345
346
|
*
|
|
347
|
+
* @returns The singleton noop collection cache.
|
|
348
|
+
*
|
|
346
349
|
* @example
|
|
347
350
|
* ```ts
|
|
348
351
|
* const cache = noopFirestoreCollectionCache();
|
|
349
352
|
* cache.get('path/to/doc'); // always returns undefined
|
|
350
353
|
* cache.set('path/to/doc', { data }); // no-op
|
|
351
354
|
* ```
|
|
352
|
-
*
|
|
353
|
-
* @returns The singleton noop collection cache.
|
|
354
355
|
*/
|
|
355
356
|
export declare function noopFirestoreCollectionCache<T>(): FirestoreCollectionCache<T>;
|
|
356
357
|
/**
|
|
@@ -359,13 +360,13 @@ export declare function noopFirestoreCollectionCache<T>(): FirestoreCollectionCa
|
|
|
359
360
|
* Used when no cache factory is configured so that `FirestoreContext.cache` is always defined,
|
|
360
361
|
* avoiding null checks throughout the codebase.
|
|
361
362
|
*
|
|
363
|
+
* @returns The singleton noop context cache.
|
|
364
|
+
*
|
|
362
365
|
* @example
|
|
363
366
|
* ```ts
|
|
364
367
|
* const cache = noopFirestoreContextCache();
|
|
365
368
|
* cache.cacheForCollection('user', { defaultTtl: 0 }); // returns noop collection cache
|
|
366
369
|
* cache.isEnabled(); // false
|
|
367
370
|
* ```
|
|
368
|
-
*
|
|
369
|
-
* @returns The singleton noop context cache.
|
|
370
371
|
*/
|
|
371
372
|
export declare function noopFirestoreContextCache(): FirestoreContextCache;
|
|
@@ -7,7 +7,7 @@ import { type FirestoreContextCacheFactory, type FirestoreCacheEntry, type Fires
|
|
|
7
7
|
*
|
|
8
8
|
* Set to 5 minutes.
|
|
9
9
|
*/
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const DEFAULT_IN_MEMORY_CACHE_TTL: Milliseconds;
|
|
11
11
|
/**
|
|
12
12
|
* Delegate that handles actual cache storage for a single collection.
|
|
13
13
|
*
|
|
@@ -38,7 +38,7 @@ export interface FirestoreCollectionCacheDelegate<T> {
|
|
|
38
38
|
/**
|
|
39
39
|
* Creates an in-memory {@link FirestoreCollectionCacheDelegate} backed by a Map.
|
|
40
40
|
*
|
|
41
|
-
* @returns
|
|
41
|
+
* @returns Delegate backed by an in-process Map.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
44
|
* ```ts
|
|
@@ -91,8 +91,8 @@ export interface MakeFirestoreContextCacheConfig {
|
|
|
91
91
|
* This is the shared foundation used by both {@link inMemoryFirestoreContextCache} and
|
|
92
92
|
* {@link readLoggingFirestoreContextCache}.
|
|
93
93
|
*
|
|
94
|
-
* @param config - Configuration including default TTL and delegate factory
|
|
95
|
-
* @returns A new context cache
|
|
94
|
+
* @param config - Configuration including default TTL and delegate factory.
|
|
95
|
+
* @returns A new context cache.
|
|
96
96
|
*
|
|
97
97
|
* @example
|
|
98
98
|
* ```ts
|
|
@@ -101,6 +101,7 @@ export interface MakeFirestoreContextCacheConfig {
|
|
|
101
101
|
* createDelegate: () => inMemoryFirestoreCollectionCacheDelegate()
|
|
102
102
|
* });
|
|
103
103
|
* ```
|
|
104
|
+
*
|
|
104
105
|
* @__NO_SIDE_EFFECTS__
|
|
105
106
|
*/
|
|
106
107
|
export declare function makeFirestoreContextCache(config: MakeFirestoreContextCacheConfig): FirestoreContextCache;
|
|
@@ -110,13 +111,14 @@ export declare function makeFirestoreContextCache(config: MakeFirestoreContextCa
|
|
|
110
111
|
* Uses simple Map-based storage with TTL-based expiration. Suitable for
|
|
111
112
|
* client-side caching where the application lifecycle matches the cache lifecycle.
|
|
112
113
|
*
|
|
113
|
-
* @returns A factory function that creates in-memory context caches
|
|
114
|
+
* @returns A factory function that creates in-memory context caches.
|
|
114
115
|
*
|
|
115
116
|
* @example
|
|
116
117
|
* ```ts
|
|
117
118
|
* const factory = inMemoryFirestoreContextCacheFactory();
|
|
118
119
|
* const contextCache = factory({ defaultTtl: 60000 });
|
|
119
120
|
* ```
|
|
121
|
+
*
|
|
120
122
|
* @__NO_SIDE_EFFECTS__
|
|
121
123
|
*/
|
|
122
124
|
export declare function inMemoryFirestoreContextCacheFactory(): FirestoreContextCacheFactory;
|
|
@@ -133,8 +135,8 @@ export interface InMemoryFirestoreContextCacheConfig {
|
|
|
133
135
|
* Creates an in-memory {@link FirestoreContextCache} that manages per-collection
|
|
134
136
|
* caches with TTL-based expiration, per-type enable/disable, and event streaming.
|
|
135
137
|
*
|
|
136
|
-
* @param config - Optional configuration
|
|
137
|
-
* @returns A new context cache
|
|
138
|
+
* @param config - Optional configuration.
|
|
139
|
+
* @returns A new context cache.
|
|
138
140
|
*
|
|
139
141
|
* @example
|
|
140
142
|
* ```ts
|
|
@@ -151,7 +153,7 @@ export declare function inMemoryFirestoreContextCache(config?: InMemoryFirestore
|
|
|
151
153
|
* Useful for analytics, debugging, and monitoring read patterns without the
|
|
152
154
|
* memory overhead of actual caching.
|
|
153
155
|
*
|
|
154
|
-
* @returns A factory function that creates read-logging context caches
|
|
156
|
+
* @returns A factory function that creates read-logging context caches.
|
|
155
157
|
*
|
|
156
158
|
* @example
|
|
157
159
|
* ```ts
|
|
@@ -159,6 +161,7 @@ export declare function inMemoryFirestoreContextCache(config?: InMemoryFirestore
|
|
|
159
161
|
* const contextCache = factory();
|
|
160
162
|
* contextCache.events$.subscribe((event) => console.log(event));
|
|
161
163
|
* ```
|
|
164
|
+
*
|
|
162
165
|
* @__NO_SIDE_EFFECTS__
|
|
163
166
|
*/
|
|
164
167
|
export declare function readLoggingFirestoreContextCacheFactory(): FirestoreContextCacheFactory;
|
|
@@ -179,8 +182,8 @@ export interface ReadLoggingFirestoreContextCacheConfig {
|
|
|
179
182
|
* Useful for tracking read patterns, debugging, and monitoring which documents
|
|
180
183
|
* are accessed and how often, without the memory overhead of actual caching.
|
|
181
184
|
*
|
|
182
|
-
* @param config - Optional configuration
|
|
183
|
-
* @returns A new read-logging context cache
|
|
185
|
+
* @param config - Optional configuration.
|
|
186
|
+
* @returns A new read-logging context cache.
|
|
184
187
|
*
|
|
185
188
|
* @example
|
|
186
189
|
* ```ts
|