@dereekb/firebase 13.11.2 → 13.11.3
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 +2440 -575
- package/index.esm.js +2419 -579
- package/package.json +5 -5
- package/src/lib/client/firestore/array.d.ts +1 -0
- package/src/lib/client/firestore/driver.accessor.batch.d.ts +1 -0
- package/src/lib/client/firestore/driver.accessor.create.d.ts +1 -0
- package/src/lib/client/firestore/driver.accessor.d.ts +1 -0
- package/src/lib/client/firestore/driver.accessor.default.d.ts +1 -0
- package/src/lib/client/firestore/driver.accessor.transaction.d.ts +1 -0
- package/src/lib/client/firestore/increment.d.ts +1 -0
- package/src/lib/client/function/development.function.factory.d.ts +1 -0
- package/src/lib/client/function/function.factory.d.ts +2 -0
- package/src/lib/client/function/model.function.factory.d.ts +1 -0
- package/src/lib/common/firestore/accessor/accessor.d.ts +1 -0
- package/src/lib/common/firestore/accessor/accessor.wrap.d.ts +1 -0
- package/src/lib/common/firestore/accessor/accessor.wrap.modify.d.ts +4 -0
- package/src/lib/common/firestore/accessor/array.d.ts +1 -0
- package/src/lib/common/firestore/accessor/document.d.ts +4 -0
- package/src/lib/common/firestore/accessor/document.paged.d.ts +134 -0
- package/src/lib/common/firestore/accessor/document.utility.d.ts +195 -0
- package/src/lib/common/firestore/accessor/increment.d.ts +1 -0
- package/src/lib/common/firestore/accessor/index.d.ts +1 -0
- package/src/lib/common/firestore/cache/cache.d.ts +1 -0
- package/src/lib/common/firestore/cache/cache.memory.d.ts +3 -0
- package/src/lib/common/firestore/collection/collection.d.ts +29 -2
- package/src/lib/common/firestore/collection/collection.group.d.ts +1 -0
- package/src/lib/common/firestore/collection/collection.query.d.ts +1 -0
- package/src/lib/common/firestore/collection/collection.single.d.ts +1 -0
- package/src/lib/common/firestore/collection/collection.util.d.ts +1 -0
- package/src/lib/common/firestore/collection/index.d.ts +1 -0
- package/src/lib/common/firestore/collection/subcollection.d.ts +1 -0
- package/src/lib/common/firestore/collection/subcollection.paged.d.ts +226 -0
- package/src/lib/common/firestore/collection/subcollection.single.d.ts +1 -0
- package/src/lib/common/firestore/context.d.ts +37 -1
- package/src/lib/common/firestore/driver/query.handler.d.ts +1 -0
- package/src/lib/common/firestore/error.d.ts +1 -0
- package/src/lib/common/firestore/query/constraint.d.ts +2 -0
- package/src/lib/common/firestore/query/iterator.d.ts +5 -0
- package/src/lib/common/firestore/query/query.d.ts +1 -0
- package/src/lib/common/firestore/snapshot/snapshot.d.ts +1 -0
- package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +262 -0
- package/src/lib/common/firestore/util/id.batch.d.ts +1 -0
- package/src/lib/common/model/function.d.ts +1 -0
- package/src/lib/common/model/model.service.d.ts +8 -0
- package/src/lib/common/model/permission/permission.service.d.ts +1 -0
- package/src/lib/common/model/permission/permission.service.grant.d.ts +6 -0
- package/src/lib/common/storage/accessor/path.model.d.ts +1 -0
- package/src/lib/common/storage/context.d.ts +1 -0
- package/src/lib/common/storage/driver/accessor.iterate.d.ts +1 -0
- package/src/lib/common/storage/driver/list.d.ts +1 -0
- package/src/lib/common/storage/storage.d.ts +1 -0
- package/src/lib/model/notification/index.d.ts +2 -0
- package/src/lib/model/notification/notification.api.d.ts +36 -1
- package/src/lib/model/notification/notification.config.d.ts +1 -0
- package/src/lib/model/notification/notification.create.d.ts +2 -0
- package/src/lib/model/notification/notification.create.loggedevent.d.ts +33 -0
- package/src/lib/model/notification/notification.create.task.d.ts +1 -0
- package/src/lib/model/notification/notification.d.ts +179 -3
- package/src/lib/model/notification/notification.details.d.ts +1 -0
- package/src/lib/model/notification/notification.id.d.ts +23 -1
- package/src/lib/model/notification/notification.loggedevent.loader.d.ts +82 -0
- package/src/lib/model/notification/notification.message.d.ts +2 -0
- package/src/lib/model/notification/notification.query.d.ts +17 -0
- package/src/lib/model/notification/notification.util.d.ts +12 -1
- package/src/lib/model/storagefile/storagefile.create.d.ts +1 -0
- package/src/lib/model/storagefile/storagefile.d.ts +1 -0
- package/src/lib/model/storagefile/storagefile.file.d.ts +1 -0
- package/src/lib/model/storagefile/storagefile.permission.d.ts +1 -0
- package/src/lib/model/storagefile/storagefile.upload.d.ts +2 -0
- package/src/lib/model/storagefile/storagefile.upload.determiner.d.ts +2 -0
- package/test/index.cjs.js +1038 -1
- package/test/index.esm.js +1031 -3
- package/test/package.json +6 -6
- package/test/src/lib/common/mock/mock.item.d.ts +119 -2
- package/test/src/lib/common/mock/mock.item.service.d.ts +21 -1
|
@@ -12,6 +12,11 @@ import { type FirestoreDocumentData, type FirestoreDocument, type FirestoreDocum
|
|
|
12
12
|
* @param documentAccessor - Accessor that provides the `newDocument()` factory method
|
|
13
13
|
* @param count - Number of document instances to create
|
|
14
14
|
* @returns Array of `count` new document instances, each with a unique auto-generated ID
|
|
15
|
+
*
|
|
16
|
+
* @dbxUtil
|
|
17
|
+
* @dbxUtilCategory firestore
|
|
18
|
+
* @dbxUtilTags firestore, document, accessor, new, allocate, bulk
|
|
19
|
+
* @dbxUtilRelated make-documents
|
|
15
20
|
*/
|
|
16
21
|
export declare function newDocuments<T, D extends FirestoreDocument<T>>(documentAccessor: FirestoreDocumentAccessor<T, D>, count: number): D[];
|
|
17
22
|
/**
|
|
@@ -60,6 +65,12 @@ export interface MakeDocumentsParams<T, D extends FirestoreDocument<T> = Firesto
|
|
|
60
65
|
* @param documentAccessor - Accessor providing the document factory and collection context
|
|
61
66
|
* @param make - Configuration controlling count, factory, and initialization
|
|
62
67
|
* @returns Promise resolving to all created document instances (length === `make.count`)
|
|
68
|
+
* @__NO_SIDE_EFFECTS__
|
|
69
|
+
*
|
|
70
|
+
* @dbxUtil
|
|
71
|
+
* @dbxUtilCategory firestore
|
|
72
|
+
* @dbxUtilTags firestore, document, accessor, make, create, persist, bulk, fixture, seed
|
|
73
|
+
* @dbxUtilRelated new-documents
|
|
63
74
|
*/
|
|
64
75
|
export declare function makeDocuments<T, D extends FirestoreDocument<T>>(documentAccessor: FirestoreDocumentAccessor<T, D>, make: MakeDocumentsParams<T, D>): Promise<D[]>;
|
|
65
76
|
/**
|
|
@@ -70,6 +81,11 @@ export declare function makeDocuments<T, D extends FirestoreDocument<T>>(documen
|
|
|
70
81
|
*
|
|
71
82
|
* @param documents - Documents to fetch snapshots for
|
|
72
83
|
* @returns Snapshots in the same order as the input array
|
|
84
|
+
*
|
|
85
|
+
* @dbxUtil
|
|
86
|
+
* @dbxUtilCategory firestore
|
|
87
|
+
* @dbxUtilTags firestore, snapshot, document, fetch, parallel, batch, read
|
|
88
|
+
* @dbxUtilRelated get-document-snapshot-pair, get-document-snapshot-data-pair
|
|
73
89
|
*/
|
|
74
90
|
export declare function getDocumentSnapshots<D extends FirestoreDocument<any>>(documents: D[]): Promise<DocumentSnapshot<FirestoreDocumentData<D>>[]>;
|
|
75
91
|
/**
|
|
@@ -93,6 +109,11 @@ export type FirestoreDocumentSnapshotPair<D extends FirestoreDocument<any>> = {
|
|
|
93
109
|
*
|
|
94
110
|
* @param document - The document to fetch
|
|
95
111
|
* @returns A pair containing the document and its snapshot
|
|
112
|
+
*
|
|
113
|
+
* @dbxUtil
|
|
114
|
+
* @dbxUtilCategory firestore
|
|
115
|
+
* @dbxUtilTags firestore, snapshot, pair, fetch, document, read
|
|
116
|
+
* @dbxUtilRelated get-document-snapshot-pairs, get-document-snapshot-data-pair
|
|
96
117
|
*/
|
|
97
118
|
export declare function getDocumentSnapshotPair<D extends FirestoreDocument<any>>(document: D): Promise<FirestoreDocumentSnapshotPair<D>>;
|
|
98
119
|
/**
|
|
@@ -100,6 +121,11 @@ export declare function getDocumentSnapshotPair<D extends FirestoreDocument<any>
|
|
|
100
121
|
*
|
|
101
122
|
* @param documents - Documents to fetch
|
|
102
123
|
* @returns Pairs in the same order as the input array
|
|
124
|
+
*
|
|
125
|
+
* @dbxUtil
|
|
126
|
+
* @dbxUtilCategory firestore
|
|
127
|
+
* @dbxUtilTags firestore, snapshot, pair, fetch, parallel, batch, document
|
|
128
|
+
* @dbxUtilRelated get-document-snapshot-pair, get-document-snapshot-data-pairs
|
|
103
129
|
*/
|
|
104
130
|
export declare function getDocumentSnapshotPairs<D extends FirestoreDocument<any>>(documents: D[]): Promise<FirestoreDocumentSnapshotPair<D>[]>;
|
|
105
131
|
/**
|
|
@@ -139,6 +165,11 @@ export interface FirestoreDocumentSnapshotDataPairWithData<D extends FirestoreDo
|
|
|
139
165
|
*
|
|
140
166
|
* @param document - The document to fetch
|
|
141
167
|
* @returns A triplet of document, snapshot, and data (data may be `undefined` if the document doesn't exist)
|
|
168
|
+
*
|
|
169
|
+
* @dbxUtil
|
|
170
|
+
* @dbxUtilCategory firestore
|
|
171
|
+
* @dbxUtilTags firestore, snapshot, data, pair, fetch, document, read, idkey
|
|
172
|
+
* @dbxUtilRelated get-document-snapshot-data-pairs, get-document-snapshot-pair
|
|
142
173
|
*/
|
|
143
174
|
export declare function getDocumentSnapshotDataPair<D extends FirestoreDocument<any>>(document: D): Promise<FirestoreDocumentSnapshotDataPair<D>>;
|
|
144
175
|
/**
|
|
@@ -149,6 +180,11 @@ export declare function getDocumentSnapshotDataPair<D extends FirestoreDocument<
|
|
|
149
180
|
*
|
|
150
181
|
* @param documents - Documents to fetch
|
|
151
182
|
* @returns Triplets in the same order as the input array
|
|
183
|
+
*
|
|
184
|
+
* @dbxUtil
|
|
185
|
+
* @dbxUtilCategory firestore
|
|
186
|
+
* @dbxUtilTags firestore, snapshot, data, pair, fetch, parallel, batch, idkey
|
|
187
|
+
* @dbxUtilRelated get-document-snapshot-data-pair, get-document-snapshot-data-pairs-with-data
|
|
152
188
|
*/
|
|
153
189
|
export declare function getDocumentSnapshotDataPairs<D extends FirestoreDocument<any>>(documents: D[]): Promise<FirestoreDocumentSnapshotDataPair<D>[]>;
|
|
154
190
|
/**
|
|
@@ -159,6 +195,11 @@ export declare function getDocumentSnapshotDataPairs<D extends FirestoreDocument
|
|
|
159
195
|
*
|
|
160
196
|
* @param documents - Documents to fetch
|
|
161
197
|
* @returns Triplets for documents that exist, in their original relative order
|
|
198
|
+
*
|
|
199
|
+
* @dbxUtil
|
|
200
|
+
* @dbxUtilCategory firestore
|
|
201
|
+
* @dbxUtilTags firestore, snapshot, data, pair, fetch, batch, exists, filter, idkey
|
|
202
|
+
* @dbxUtilRelated get-document-snapshot-data-pairs
|
|
162
203
|
*/
|
|
163
204
|
export declare function getDocumentSnapshotDataPairsWithData<D extends FirestoreDocument<any>>(documents: D[]): Promise<FirestoreDocumentSnapshotDataPairWithData<D>[]>;
|
|
164
205
|
/**
|
|
@@ -175,6 +216,11 @@ export type FirestoreDocumentSnapshotDataTuple<D extends FirestoreDocument<any>>
|
|
|
175
216
|
*
|
|
176
217
|
* @param documents - Documents to fetch
|
|
177
218
|
* @returns Tuples in the same order as the input array
|
|
219
|
+
*
|
|
220
|
+
* @dbxUtil
|
|
221
|
+
* @dbxUtilCategory firestore
|
|
222
|
+
* @dbxUtilTags firestore, snapshot, data, tuple, fetch, parallel, batch
|
|
223
|
+
* @dbxUtilRelated get-document-snapshot-data-pairs
|
|
178
224
|
*/
|
|
179
225
|
export declare function getDocumentSnapshotDataTuples<D extends FirestoreDocument<any>>(documents: D[]): Promise<FirestoreDocumentSnapshotDataTuple<D>[]>;
|
|
180
226
|
/**
|
|
@@ -188,6 +234,11 @@ export declare function getDocumentSnapshotDataTuples<D extends FirestoreDocumen
|
|
|
188
234
|
* @param document - The document to fetch data for
|
|
189
235
|
* @param withId - Whether to inject `id` and `key` fields onto the data (default: `true`)
|
|
190
236
|
* @returns The document's data, or `undefined` if it doesn't exist
|
|
237
|
+
*
|
|
238
|
+
* @dbxUtil
|
|
239
|
+
* @dbxUtilCategory firestore
|
|
240
|
+
* @dbxUtilTags firestore, snapshot, data, fetch, document, read, withid, idkey
|
|
241
|
+
* @dbxUtilRelated get-document-snapshots-data, get-document-snapshot-data-pair
|
|
191
242
|
*/
|
|
192
243
|
export declare function getDocumentSnapshotData<D extends FirestoreDocument<any>>(document: D): Promise<Maybe<DocumentDataWithIdAndKey<FirestoreDocumentData<D>>>>;
|
|
193
244
|
export declare function getDocumentSnapshotData<D extends FirestoreDocument<any>>(document: D, withId: true): Promise<Maybe<DocumentDataWithIdAndKey<FirestoreDocumentData<D>>>>;
|
|
@@ -203,6 +254,11 @@ export declare function getDocumentSnapshotData<D extends FirestoreDocument<any>
|
|
|
203
254
|
* @param documents - Documents to fetch data for
|
|
204
255
|
* @param withId - Whether to inject `id` and `key` fields onto each data object (default: `true`)
|
|
205
256
|
* @returns Data objects for existing documents only
|
|
257
|
+
*
|
|
258
|
+
* @dbxUtil
|
|
259
|
+
* @dbxUtilCategory firestore
|
|
260
|
+
* @dbxUtilTags firestore, snapshot, data, fetch, parallel, batch, filter, withid, idkey
|
|
261
|
+
* @dbxUtilRelated get-document-snapshot-data, get-data-from-document-snapshots
|
|
206
262
|
*/
|
|
207
263
|
export declare function getDocumentSnapshotsData<D extends FirestoreDocument<any>>(documents: D[]): Promise<DocumentDataWithIdAndKey<FirestoreDocumentData<D>>[]>;
|
|
208
264
|
export declare function getDocumentSnapshotsData<D extends FirestoreDocument<any>>(documents: D[], withId: true): Promise<DocumentDataWithIdAndKey<FirestoreDocumentData<D>>[]>;
|
|
@@ -217,6 +273,11 @@ export declare function getDocumentSnapshotsData<D extends FirestoreDocument<any
|
|
|
217
273
|
* @param snapshots - Snapshots to extract data from
|
|
218
274
|
* @param withId - Whether to inject `id` and `key` fields onto each data object (default: `true`)
|
|
219
275
|
* @returns Data objects for existing documents only (may be shorter than input)
|
|
276
|
+
*
|
|
277
|
+
* @dbxUtil
|
|
278
|
+
* @dbxUtilCategory firestore
|
|
279
|
+
* @dbxUtilTags firestore, snapshot, data, extract, filter, batch, withid, idkey, mapper
|
|
280
|
+
* @dbxUtilRelated get-document-snapshots-data, document-data-function
|
|
220
281
|
*/
|
|
221
282
|
export declare function getDataFromDocumentSnapshots<T>(snapshots: DocumentSnapshot<T>[]): DocumentDataWithIdAndKey<T>[];
|
|
222
283
|
export declare function getDataFromDocumentSnapshots<T>(snapshots: DocumentSnapshot<T>[], withId: true): DocumentDataWithIdAndKey<T>[];
|
|
@@ -231,6 +292,11 @@ export declare function getDataFromDocumentSnapshots<T>(snapshots: DocumentSnaps
|
|
|
231
292
|
* @param accessor - Accessor to load documents with
|
|
232
293
|
* @param snapshots - Query snapshot containing the document references
|
|
233
294
|
* @returns Document instances in the same order as the query results
|
|
295
|
+
*
|
|
296
|
+
* @dbxUtil
|
|
297
|
+
* @dbxUtilCategory firestore
|
|
298
|
+
* @dbxUtilTags firestore, document, loader, accessor, snapshot, query, querysnapshot, batch
|
|
299
|
+
* @dbxUtilRelated load-documents-for-document-references, load-documents-for-keys
|
|
234
300
|
*/
|
|
235
301
|
export declare function loadDocumentsForSnapshots<T, D extends FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>, snapshots: QuerySnapshot<T>): D[];
|
|
236
302
|
/**
|
|
@@ -242,6 +308,11 @@ export declare function loadDocumentsForSnapshots<T, D extends FirestoreDocument
|
|
|
242
308
|
* @param values - Source values to extract references from
|
|
243
309
|
* @param getRef - Extracts a document reference from each value
|
|
244
310
|
* @returns Document instances in the same order as the input values
|
|
311
|
+
*
|
|
312
|
+
* @dbxUtil
|
|
313
|
+
* @dbxUtilCategory firestore
|
|
314
|
+
* @dbxUtilTags firestore, document, loader, accessor, reference, value, mapper, batch
|
|
315
|
+
* @dbxUtilRelated load-documents-for-document-references, load-documents-for-keys-from-values, load-documents-for-ids-from-values
|
|
245
316
|
*/
|
|
246
317
|
export declare function loadDocumentsForDocumentReferencesFromValues<I, T, D extends FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>, values: I[], getRef: (value: I) => DocumentReference<T>): D[];
|
|
247
318
|
/**
|
|
@@ -257,6 +328,11 @@ export declare const loadDocumentsForValues: typeof loadDocumentsForDocumentRefe
|
|
|
257
328
|
* @param accessor - Accessor to load documents with
|
|
258
329
|
* @param refs - Document references to load
|
|
259
330
|
* @returns Document instances in the same order as the input references
|
|
331
|
+
*
|
|
332
|
+
* @dbxUtil
|
|
333
|
+
* @dbxUtilCategory firestore
|
|
334
|
+
* @dbxUtilTags firestore, document, loader, accessor, reference, batch
|
|
335
|
+
* @dbxUtilRelated load-documents-for-document-references-from-values, load-documents-for-keys, load-documents-for-snapshots
|
|
260
336
|
*/
|
|
261
337
|
export declare function loadDocumentsForDocumentReferences<T, D extends FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>, refs: DocumentReference<T>[]): D[];
|
|
262
338
|
/**
|
|
@@ -268,6 +344,11 @@ export declare function loadDocumentsForDocumentReferences<T, D extends Firestor
|
|
|
268
344
|
* @param values - Source values to extract keys from
|
|
269
345
|
* @param getKey - Extracts a model key (full Firestore path) from each value
|
|
270
346
|
* @returns Document instances in the same order as the input values
|
|
347
|
+
*
|
|
348
|
+
* @dbxUtil
|
|
349
|
+
* @dbxUtilCategory firestore
|
|
350
|
+
* @dbxUtilTags firestore, document, loader, accessor, key, path, value, mapper, batch
|
|
351
|
+
* @dbxUtilRelated load-documents-for-keys, load-documents-for-document-references-from-values, load-documents-for-ids-from-values
|
|
271
352
|
*/
|
|
272
353
|
export declare function loadDocumentsForKeysFromValues<I, T, D extends FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>, values: I[], getKey: (value: I) => FirestoreModelKey): D[];
|
|
273
354
|
/**
|
|
@@ -278,6 +359,11 @@ export declare function loadDocumentsForKeysFromValues<I, T, D extends Firestore
|
|
|
278
359
|
* @param accessor - Accessor to load documents with
|
|
279
360
|
* @param keys - Full Firestore document paths (e.g. `'users/abc123'`)
|
|
280
361
|
* @returns Document instances in the same order as the input keys
|
|
362
|
+
*
|
|
363
|
+
* @dbxUtil
|
|
364
|
+
* @dbxUtilCategory firestore
|
|
365
|
+
* @dbxUtilTags firestore, document, loader, accessor, key, path, batch
|
|
366
|
+
* @dbxUtilRelated load-documents-for-keys-from-values, load-documents-for-document-references, load-documents-for-ids
|
|
281
367
|
*/
|
|
282
368
|
export declare function loadDocumentsForKeys<T, D extends FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>, keys: FirestoreModelKey[]): D[];
|
|
283
369
|
/**
|
|
@@ -290,6 +376,11 @@ export declare function loadDocumentsForKeys<T, D extends FirestoreDocument<T>>(
|
|
|
290
376
|
* @param values - Source values to extract IDs from
|
|
291
377
|
* @param getId - Extracts a model ID from each value
|
|
292
378
|
* @returns Document instances in the same order as the input values
|
|
379
|
+
*
|
|
380
|
+
* @dbxUtil
|
|
381
|
+
* @dbxUtilCategory firestore
|
|
382
|
+
* @dbxUtilTags firestore, document, loader, accessor, id, value, mapper, batch, collection
|
|
383
|
+
* @dbxUtilRelated load-documents-for-ids, load-documents-for-keys-from-values, load-documents-for-document-references-from-values
|
|
293
384
|
*/
|
|
294
385
|
export declare function loadDocumentsForIdsFromValues<I, T, D extends FirestoreDocument<T>>(accessor: FirestoreDocumentAccessor<T, D>, values: I[], getId: (value: I) => FirestoreModelId): D[];
|
|
295
386
|
/**
|
|
@@ -301,6 +392,11 @@ export declare function loadDocumentsForIdsFromValues<I, T, D extends FirestoreD
|
|
|
301
392
|
* @param accessor - Accessor to load documents with (must have collection context)
|
|
302
393
|
* @param ids - Document IDs within the accessor's collection
|
|
303
394
|
* @returns Document instances in the same order as the input IDs
|
|
395
|
+
*
|
|
396
|
+
* @dbxUtil
|
|
397
|
+
* @dbxUtilCategory firestore
|
|
398
|
+
* @dbxUtilTags firestore, document, loader, accessor, id, batch, collection
|
|
399
|
+
* @dbxUtilRelated load-documents-for-ids-from-values, load-documents-for-keys, load-documents-for-document-references
|
|
304
400
|
*/
|
|
305
401
|
export declare function loadDocumentsForIds<T, D extends FirestoreDocument<T>>(accessor: FirestoreDocumentAccessor<T, D>, ids: FirestoreModelId[]): D[];
|
|
306
402
|
/**
|
|
@@ -318,6 +414,13 @@ export type FirestoreDocumentLoader<T, D extends FirestoreDocument<T>> = (refere
|
|
|
318
414
|
*
|
|
319
415
|
* @param accessorContext - Context that provides accessors for both default and transactional use
|
|
320
416
|
* @returns A loader function that converts document references to document instances
|
|
417
|
+
* @__NO_SIDE_EFFECTS__
|
|
418
|
+
*
|
|
419
|
+
* @dbxUtil
|
|
420
|
+
* @dbxUtilCategory firestore
|
|
421
|
+
* @dbxUtilKind factory
|
|
422
|
+
* @dbxUtilTags firestore, document, loader, factory, transaction, accessor, context
|
|
423
|
+
* @dbxUtilRelated firestore-document-snapshot-pairs-loader, load-documents-for-document-references
|
|
321
424
|
*/
|
|
322
425
|
export declare function firestoreDocumentLoader<T, D extends FirestoreDocument<T>>(accessorContext: LimitedFirestoreDocumentAccessorContextExtension<T, D>): FirestoreDocumentLoader<T, D>;
|
|
323
426
|
/**
|
|
@@ -345,6 +448,13 @@ export type FirestoreQueryDocumentSnapshotPairsLoader<T, D extends FirestoreDocu
|
|
|
345
448
|
*
|
|
346
449
|
* @param accessorContext - Context that provides accessors for both default and transactional use
|
|
347
450
|
* @returns A loader function that converts snapshots to document-snapshot-data pairs
|
|
451
|
+
* @__NO_SIDE_EFFECTS__
|
|
452
|
+
*
|
|
453
|
+
* @dbxUtil
|
|
454
|
+
* @dbxUtilCategory firestore
|
|
455
|
+
* @dbxUtilKind factory
|
|
456
|
+
* @dbxUtilTags firestore, snapshot, pair, loader, factory, transaction, accessor, query, context
|
|
457
|
+
* @dbxUtilRelated firestore-document-snapshot-pairs-loader-instance, firestore-query-document-snapshot-pairs-loader, firestore-document-loader
|
|
348
458
|
*/
|
|
349
459
|
export declare function firestoreDocumentSnapshotPairsLoader<T, D extends FirestoreDocument<T>>(accessorContext: LimitedFirestoreDocumentAccessorContextExtension<T, D>): FirestoreDocumentSnapshotPairsLoader<T, D> & FirestoreQueryDocumentSnapshotPairsLoader<T, D>;
|
|
350
460
|
/**
|
|
@@ -370,6 +480,13 @@ export type FirestoreDocumentSnapshotPairsLoaderInstance<T, D extends FirestoreD
|
|
|
370
480
|
*
|
|
371
481
|
* @param accessor - The accessor to bind for document loading
|
|
372
482
|
* @returns A reusable function that converts snapshots to pairs using the bound accessor
|
|
483
|
+
* @__NO_SIDE_EFFECTS__
|
|
484
|
+
*
|
|
485
|
+
* @dbxUtil
|
|
486
|
+
* @dbxUtilCategory firestore
|
|
487
|
+
* @dbxUtilKind factory
|
|
488
|
+
* @dbxUtilTags firestore, snapshot, pair, loader, factory, instance, accessor, idkey
|
|
489
|
+
* @dbxUtilRelated firestore-document-snapshot-pairs-loader, document-data-with-id-and-key
|
|
373
490
|
*/
|
|
374
491
|
export declare function firestoreDocumentSnapshotPairsLoaderInstance<T, D extends FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>): FirestoreDocumentSnapshotPairsLoaderInstance<T, D>;
|
|
375
492
|
/**
|
|
@@ -392,6 +509,11 @@ export declare const firestoreQueryDocumentSnapshotPairsLoader: <T, D extends Fi
|
|
|
392
509
|
* @param snapshot - The snapshot to extract data from
|
|
393
510
|
* @param withId - Whether to inject `id` and `key` fields (default: `false`)
|
|
394
511
|
* @returns The snapshot data, or `undefined` for non-existent documents
|
|
512
|
+
*
|
|
513
|
+
* @dbxUtil
|
|
514
|
+
* @dbxUtilCategory firestore
|
|
515
|
+
* @dbxUtilTags firestore, snapshot, data, extract, withid, idkey, mapper
|
|
516
|
+
* @dbxUtilRelated document-data-with-id-and-key, document-data-function, get-document-snapshot-data
|
|
395
517
|
*/
|
|
396
518
|
export declare function documentData<T>(snapshot: QueryDocumentSnapshot<T>): DocumentDataWithIdAndKey<T>;
|
|
397
519
|
export declare function documentData<T>(snapshot: QueryDocumentSnapshot<T>, withId: true): DocumentDataWithIdAndKey<T>;
|
|
@@ -418,6 +540,13 @@ export type DocumentDataWithIdAndKeyFunction<T> = ((snapshot: QueryDocumentSnaps
|
|
|
418
540
|
*
|
|
419
541
|
* @param withId - Whether the returned function should inject `id` and `key` fields
|
|
420
542
|
* @returns A snapshot-to-data extraction function
|
|
543
|
+
* @__NO_SIDE_EFFECTS__
|
|
544
|
+
*
|
|
545
|
+
* @dbxUtil
|
|
546
|
+
* @dbxUtilCategory firestore
|
|
547
|
+
* @dbxUtilKind factory
|
|
548
|
+
* @dbxUtilTags firestore, snapshot, data, factory, mapper, withid, idkey, extract
|
|
549
|
+
* @dbxUtilRelated document-data, document-data-with-id-and-key, get-data-from-document-snapshots
|
|
421
550
|
*/
|
|
422
551
|
export declare function documentDataFunction<T>(withId: true): DocumentDataWithIdAndKeyFunction<T>;
|
|
423
552
|
export declare function documentDataFunction<T>(withId: false): DocumentDataFunction<T>;
|
|
@@ -434,6 +563,11 @@ export declare function documentDataFunction<T>(withId: boolean): DocumentDataWi
|
|
|
434
563
|
*
|
|
435
564
|
* @param snapshot - The snapshot to extract and augment data from
|
|
436
565
|
* @returns The data object with `id` and `key` fields, or `undefined` if the document doesn't exist
|
|
566
|
+
*
|
|
567
|
+
* @dbxUtil
|
|
568
|
+
* @dbxUtilCategory firestore
|
|
569
|
+
* @dbxUtilTags firestore, snapshot, data, augment, idkey, id, key, mutate, extract
|
|
570
|
+
* @dbxUtilRelated document-data, set-id-and-key-from-snapshot-on-document-data, document-data-function
|
|
437
571
|
*/
|
|
438
572
|
export declare function documentDataWithIdAndKey<T>(snapshot: QueryDocumentSnapshot<T>): DocumentDataWithIdAndKey<T>;
|
|
439
573
|
export declare function documentDataWithIdAndKey<T>(snapshot: DocumentSnapshot<T>): Maybe<DocumentDataWithIdAndKey<T>>;
|
|
@@ -446,6 +580,11 @@ export declare function documentDataWithIdAndKey<T>(snapshot: DocumentSnapshot<T
|
|
|
446
580
|
* @param data - The data object to augment (mutated in-place)
|
|
447
581
|
* @param snapshot - Source of the `id` and `key` values
|
|
448
582
|
* @returns The same data object, now typed as {@link DocumentDataWithIdAndKey}
|
|
583
|
+
*
|
|
584
|
+
* @dbxUtil
|
|
585
|
+
* @dbxUtilCategory firestore
|
|
586
|
+
* @dbxUtilTags firestore, data, augment, mutate, idkey, id, key, snapshot
|
|
587
|
+
* @dbxUtilRelated set-id-and-key-from-key-id-ref-on-document-data, document-data-with-id-and-key
|
|
449
588
|
*/
|
|
450
589
|
export declare function setIdAndKeyFromSnapshotOnDocumentData<T>(data: T, snapshot: DocumentSnapshot<T>): DocumentDataWithIdAndKey<T>;
|
|
451
590
|
/**
|
|
@@ -458,6 +597,11 @@ export declare function setIdAndKeyFromSnapshotOnDocumentData<T>(data: T, snapsh
|
|
|
458
597
|
* @param data - The data object to augment (mutated in-place)
|
|
459
598
|
* @param modelRef - Source of the `id` and `key` values
|
|
460
599
|
* @returns The same data object, now typed as {@link DocumentDataWithIdAndKey}
|
|
600
|
+
*
|
|
601
|
+
* @dbxUtil
|
|
602
|
+
* @dbxUtilCategory firestore
|
|
603
|
+
* @dbxUtilTags firestore, data, augment, mutate, idkey, id, key, ref, modelref
|
|
604
|
+
* @dbxUtilRelated set-id-and-key-from-snapshot-on-document-data
|
|
461
605
|
*/
|
|
462
606
|
export declare function setIdAndKeyFromKeyIdRefOnDocumentData<T>(data: T, modelRef: FirestoreModelKeyRef & FirestoreModelIdRef): DocumentDataWithIdAndKey<T>;
|
|
463
607
|
/**
|
|
@@ -470,6 +614,11 @@ export declare function setIdAndKeyFromKeyIdRefOnDocumentData<T>(data: T, modelR
|
|
|
470
614
|
* @param use - Callback that receives the fetched snapshot and returns a result
|
|
471
615
|
* @param defaultValue - Fallback value when `document` is nullish or the snapshot is unavailable
|
|
472
616
|
* @returns The result of `use`, or the default value
|
|
617
|
+
*
|
|
618
|
+
* @dbxUtil
|
|
619
|
+
* @dbxUtilCategory firestore
|
|
620
|
+
* @dbxUtilTags firestore, snapshot, document, use, async, callback, default, optional
|
|
621
|
+
* @dbxUtilRelated use-document-snapshot-data, get-document-snapshot-pair
|
|
473
622
|
*/
|
|
474
623
|
export declare function useDocumentSnapshot<D extends FirestoreDocument<any>, O = void>(document: Maybe<D>, use: UseAsync<DocumentSnapshot<FirestoreDocumentData<D>>, O>, defaultValue?: Maybe<AsyncGetterOrValue<O>>): Promise<Maybe<O>>;
|
|
475
624
|
/**
|
|
@@ -483,6 +632,12 @@ export declare function useDocumentSnapshot<D extends FirestoreDocument<any>, O
|
|
|
483
632
|
* @param use - Callback that receives the snapshot data and returns a result
|
|
484
633
|
* @param defaultValue - Fallback value when the document is nullish or doesn't exist
|
|
485
634
|
* @returns The result of `use`, or the default value
|
|
635
|
+
*
|
|
636
|
+
* @dbxUtil
|
|
637
|
+
* @dbxUtilCategory firestore
|
|
638
|
+
* @dbxUtilKind function
|
|
639
|
+
* @dbxUtilTags firestore, snapshot, data, document, use, async, callback, default
|
|
640
|
+
* @dbxUtilRelated use-document-snapshot, get-document-snapshot-data
|
|
486
641
|
*/
|
|
487
642
|
export declare const useDocumentSnapshotData: <D extends FirestoreDocument<any>, O = void>(document: Maybe<D>, use: UseAsync<FirestoreDocumentData<D>, O>, defaultValue?: Maybe<AsyncGetterOrValue<O>>) => Promise<Maybe<O>>;
|
|
488
643
|
/**
|
|
@@ -492,6 +647,12 @@ export declare const useDocumentSnapshotData: <D extends FirestoreDocument<any>,
|
|
|
492
647
|
*
|
|
493
648
|
* @param document - The document to extract the ID from
|
|
494
649
|
* @returns The document's ID (the last segment of its Firestore path)
|
|
650
|
+
* @__NO_SIDE_EFFECTS__
|
|
651
|
+
*
|
|
652
|
+
* @dbxUtil
|
|
653
|
+
* @dbxUtilCategory firestore
|
|
654
|
+
* @dbxUtilTags firestore, document, id, accessor, mapper, key
|
|
655
|
+
* @dbxUtilRelated firestore-model-ids-from-documents, firestore-model-key-from-document
|
|
495
656
|
*/
|
|
496
657
|
export declare function firestoreModelIdFromDocument<T, D extends FirestoreDocument<T>>(document: D): FirestoreModelId;
|
|
497
658
|
/**
|
|
@@ -499,6 +660,12 @@ export declare function firestoreModelIdFromDocument<T, D extends FirestoreDocum
|
|
|
499
660
|
*
|
|
500
661
|
* @param documents - Documents to extract IDs from
|
|
501
662
|
* @returns Array of document IDs in the same order as the input
|
|
663
|
+
* @__NO_SIDE_EFFECTS__
|
|
664
|
+
*
|
|
665
|
+
* @dbxUtil
|
|
666
|
+
* @dbxUtilCategory firestore
|
|
667
|
+
* @dbxUtilTags firestore, document, id, accessor, batch, mapper
|
|
668
|
+
* @dbxUtilRelated firestore-model-id-from-document, firestore-model-keys-from-documents
|
|
502
669
|
*/
|
|
503
670
|
export declare function firestoreModelIdsFromDocuments<T, D extends FirestoreDocument<T>>(documents: D[]): FirestoreModelId[];
|
|
504
671
|
/**
|
|
@@ -508,6 +675,12 @@ export declare function firestoreModelIdsFromDocuments<T, D extends FirestoreDoc
|
|
|
508
675
|
*
|
|
509
676
|
* @param document - The document to extract the key from
|
|
510
677
|
* @returns The document's full Firestore path (e.g. `'users/abc123'`)
|
|
678
|
+
* @__NO_SIDE_EFFECTS__
|
|
679
|
+
*
|
|
680
|
+
* @dbxUtil
|
|
681
|
+
* @dbxUtilCategory firestore
|
|
682
|
+
* @dbxUtilTags firestore, document, key, path, accessor, mapper
|
|
683
|
+
* @dbxUtilRelated firestore-model-keys-from-documents, firestore-model-id-from-document
|
|
511
684
|
*/
|
|
512
685
|
export declare function firestoreModelKeyFromDocument<T, D extends FirestoreDocument<T>>(document: D): FirestoreModelKey;
|
|
513
686
|
/**
|
|
@@ -515,6 +688,12 @@ export declare function firestoreModelKeyFromDocument<T, D extends FirestoreDocu
|
|
|
515
688
|
*
|
|
516
689
|
* @param documents - Documents to extract keys from
|
|
517
690
|
* @returns Array of full Firestore paths in the same order as the input
|
|
691
|
+
* @__NO_SIDE_EFFECTS__
|
|
692
|
+
*
|
|
693
|
+
* @dbxUtil
|
|
694
|
+
* @dbxUtilCategory firestore
|
|
695
|
+
* @dbxUtilTags firestore, document, key, path, accessor, batch, mapper
|
|
696
|
+
* @dbxUtilRelated firestore-model-key-from-document, firestore-model-ids-from-documents
|
|
518
697
|
*/
|
|
519
698
|
export declare function firestoreModelKeysFromDocuments<T, D extends FirestoreDocument<T>>(documents: D[]): FirestoreModelKey[];
|
|
520
699
|
/**
|
|
@@ -524,6 +703,11 @@ export declare function firestoreModelKeysFromDocuments<T, D extends FirestoreDo
|
|
|
524
703
|
*
|
|
525
704
|
* @param document - The document to extract the reference from
|
|
526
705
|
* @returns The underlying Firestore document reference
|
|
706
|
+
*
|
|
707
|
+
* @dbxUtil
|
|
708
|
+
* @dbxUtilCategory firestore
|
|
709
|
+
* @dbxUtilTags firestore, document, reference, accessor, mapper
|
|
710
|
+
* @dbxUtilRelated document-references-from-documents, firestore-model-key-from-document
|
|
527
711
|
*/
|
|
528
712
|
export declare function documentReferenceFromDocument<T, D extends FirestoreDocument<T>>(document: D): DocumentReference<T>;
|
|
529
713
|
/**
|
|
@@ -531,6 +715,11 @@ export declare function documentReferenceFromDocument<T, D extends FirestoreDocu
|
|
|
531
715
|
*
|
|
532
716
|
* @param documents - Documents to extract references from
|
|
533
717
|
* @returns Array of document references in the same order as the input
|
|
718
|
+
*
|
|
719
|
+
* @dbxUtil
|
|
720
|
+
* @dbxUtilCategory firestore
|
|
721
|
+
* @dbxUtilTags firestore, document, reference, accessor, batch, mapper
|
|
722
|
+
* @dbxUtilRelated document-reference-from-document, firestore-model-keys-from-documents
|
|
534
723
|
*/
|
|
535
724
|
export declare function documentReferencesFromDocuments<T, D extends FirestoreDocument<T>>(documents: D[]): DocumentReference<T>[];
|
|
536
725
|
/**
|
|
@@ -603,6 +792,11 @@ export interface LimitedFirestoreDocumentAccessorSnapshotCache<T, D extends Fire
|
|
|
603
792
|
* best suited for short-lived scopes (e.g. a single request or batch operation) where stale reads
|
|
604
793
|
* are acceptable.
|
|
605
794
|
*
|
|
795
|
+
* @dbxUtil
|
|
796
|
+
* @dbxUtilCategory firestore
|
|
797
|
+
* @dbxUtilKind factory
|
|
798
|
+
* @dbxUtilTags firestore, cache, snapshot, accessor, deduplicate, memoize, reader
|
|
799
|
+
*
|
|
606
800
|
* @param accessor - The accessor to wrap with caching behavior
|
|
607
801
|
* @returns A {@link LimitedFirestoreDocumentAccessorSnapshotCache} backed by the given accessor
|
|
608
802
|
*
|
|
@@ -620,5 +814,6 @@ export interface LimitedFirestoreDocumentAccessorSnapshotCache<T, D extends Fire
|
|
|
620
814
|
* // Access the underlying accessor directly
|
|
621
815
|
* const doc = cache.accessor.loadDocumentForKey('users/xyz');
|
|
622
816
|
* ```
|
|
817
|
+
* @__NO_SIDE_EFFECTS__
|
|
623
818
|
*/
|
|
624
819
|
export declare function limitedFirestoreDocumentAccessorSnapshotCache<T, D extends FirestoreDocument<T> = FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>): LimitedFirestoreDocumentAccessorSnapshotCache<T, D>;
|
|
@@ -18,5 +18,6 @@ export type IncrementUpdateWithAccessorFunction<T> = (data: FirestoreAccessorInc
|
|
|
18
18
|
* @returns A function that applies increment updates to the document
|
|
19
19
|
*
|
|
20
20
|
* @see https://cloud.google.com/firestore/docs/samples/firestore-data-set-numeric-increment
|
|
21
|
+
* @__NO_SIDE_EFFECTS__
|
|
21
22
|
*/
|
|
22
23
|
export declare function incrementUpdateWithAccessorFunction<T>(accessor: FirestoreDocumentDataAccessor<T>): IncrementUpdateWithAccessorFunction<T>;
|
|
@@ -10,6 +10,7 @@ export * from './context.transaction';
|
|
|
10
10
|
export * from './context';
|
|
11
11
|
export * from './converter';
|
|
12
12
|
export * from './document';
|
|
13
|
+
export * from './document.paged';
|
|
13
14
|
export * from './document.utility';
|
|
14
15
|
export * from './document.rxjs';
|
|
15
16
|
export * from './increment';
|
|
@@ -283,6 +283,7 @@ export interface FirestoreCollectionDocumentCache<T = unknown> {
|
|
|
283
283
|
* docCache.set({ data: userData });
|
|
284
284
|
* const entry = docCache.get();
|
|
285
285
|
* ```
|
|
286
|
+
* @__NO_SIDE_EFFECTS__
|
|
286
287
|
*/
|
|
287
288
|
export declare function firestoreCollectionDocumentCache<T>(collectionCache: FirestoreCollectionCache<T>, key: FirestoreModelKey): FirestoreCollectionDocumentCache<T>;
|
|
288
289
|
/**
|
|
@@ -101,6 +101,7 @@ export interface MakeFirestoreContextCacheConfig {
|
|
|
101
101
|
* createDelegate: () => inMemoryFirestoreCollectionCacheDelegate()
|
|
102
102
|
* });
|
|
103
103
|
* ```
|
|
104
|
+
* @__NO_SIDE_EFFECTS__
|
|
104
105
|
*/
|
|
105
106
|
export declare function makeFirestoreContextCache(config: MakeFirestoreContextCacheConfig): FirestoreContextCache;
|
|
106
107
|
/**
|
|
@@ -116,6 +117,7 @@ export declare function makeFirestoreContextCache(config: MakeFirestoreContextCa
|
|
|
116
117
|
* const factory = inMemoryFirestoreContextCacheFactory();
|
|
117
118
|
* const contextCache = factory({ defaultTtl: 60000 });
|
|
118
119
|
* ```
|
|
120
|
+
* @__NO_SIDE_EFFECTS__
|
|
119
121
|
*/
|
|
120
122
|
export declare function inMemoryFirestoreContextCacheFactory(): FirestoreContextCacheFactory;
|
|
121
123
|
/**
|
|
@@ -157,6 +159,7 @@ export declare function inMemoryFirestoreContextCache(config?: InMemoryFirestore
|
|
|
157
159
|
* const contextCache = factory();
|
|
158
160
|
* contextCache.events$.subscribe((event) => console.log(event));
|
|
159
161
|
* ```
|
|
162
|
+
* @__NO_SIDE_EFFECTS__
|
|
160
163
|
*/
|
|
161
164
|
export declare function readLoggingFirestoreContextCacheFactory(): FirestoreContextCacheFactory;
|
|
162
165
|
/**
|