@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
|
@@ -38,8 +38,9 @@ export interface FirestoreQueryConstraint<T = unknown> {
|
|
|
38
38
|
* {@link limit}, {@link orderBy}). Most callers should use those typed builders instead.
|
|
39
39
|
*
|
|
40
40
|
* @param type - The constraint type identifier (e.g., 'where', 'limit')
|
|
41
|
-
* @param data - The constraint-specific configuration data
|
|
42
|
-
* @returns A typed constraint object
|
|
41
|
+
* @param data - The constraint-specific configuration data.
|
|
42
|
+
* @returns A typed constraint object.
|
|
43
|
+
*
|
|
43
44
|
* @__NO_SIDE_EFFECTS__
|
|
44
45
|
*/
|
|
45
46
|
export declare function firestoreQueryConstraint<T = unknown>(type: string, data: T): FirestoreQueryConstraint<T>;
|
|
@@ -50,16 +51,18 @@ export declare function firestoreQueryConstraint<T = unknown>(type: string, data
|
|
|
50
51
|
* for a particular constraint type, making it easier to create multiple constraints
|
|
51
52
|
* of the same type with different data.
|
|
52
53
|
*
|
|
53
|
-
* @param type -
|
|
54
|
-
* @returns
|
|
54
|
+
* @param type - Identifier registered for the constraint variant.
|
|
55
|
+
* @returns Factory bound to that constraint type.
|
|
55
56
|
*
|
|
56
57
|
* @example
|
|
58
|
+
* ```ts
|
|
57
59
|
* // Create a factory for 'where' constraints
|
|
58
60
|
* const whereFactory = firestoreQueryConstraintFactory('where');
|
|
59
|
-
*
|
|
60
61
|
* // Use the factory to create constraints
|
|
61
62
|
* const nameConstraint = whereFactory({ field: 'name', op: '==', value: 'John' });
|
|
62
63
|
* const ageConstraint = whereFactory({ field: 'age', op: '>', value: 21 });
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
63
66
|
* @__NO_SIDE_EFFECTS__
|
|
64
67
|
*/
|
|
65
68
|
export declare function firestoreQueryConstraintFactory(type: string): <T = unknown>(data: T) => FirestoreQueryConstraint<T>;
|
|
@@ -84,12 +87,14 @@ export interface LimitQueryConstraintData {
|
|
|
84
87
|
* This constraint restricts the number of documents returned by a query to at most
|
|
85
88
|
* the specified limit. This is useful for pagination and reducing query result size.
|
|
86
89
|
*
|
|
87
|
-
* @param limit - Maximum number of documents to return
|
|
88
|
-
* @returns A Firestore query constraint for limiting results
|
|
90
|
+
* @param limit - Maximum number of documents to return.
|
|
91
|
+
* @returns A Firestore query constraint for limiting results.
|
|
89
92
|
*
|
|
90
93
|
* @example
|
|
94
|
+
* ```ts
|
|
91
95
|
* // Limit results to 10 documents
|
|
92
96
|
* const query = applyConstraints(baseQuery, [limit(10)]);
|
|
97
|
+
* ```
|
|
93
98
|
*/
|
|
94
99
|
export declare function limit(limit: number): FirestoreQueryConstraint<LimitQueryConstraintData>;
|
|
95
100
|
/**
|
|
@@ -117,15 +122,17 @@ export interface LimitToLastQueryConstraintData {
|
|
|
117
122
|
*
|
|
118
123
|
* Important: Does not work with queries that use streaming results.
|
|
119
124
|
*
|
|
120
|
-
* @param limit - Maximum number of documents to return from the end of the results
|
|
121
|
-
* @returns A Firestore query constraint for limiting results to the last N documents
|
|
125
|
+
* @param limit - Maximum number of documents to return from the end of the results.
|
|
126
|
+
* @returns A Firestore query constraint for limiting results to the last N documents.
|
|
122
127
|
*
|
|
123
128
|
* @example
|
|
129
|
+
* ```ts
|
|
124
130
|
* // Get the 5 most recent documents when ordered by timestamp
|
|
125
131
|
* const query = applyConstraints(baseQuery, [
|
|
126
132
|
* orderBy('timestamp', 'desc'),
|
|
127
133
|
* limitToLast(5)
|
|
128
134
|
* ]);
|
|
135
|
+
* ```
|
|
129
136
|
*/
|
|
130
137
|
export declare function limitToLast(limit: number): FirestoreQueryConstraint<LimitToLastQueryConstraintData>;
|
|
131
138
|
/**
|
|
@@ -151,15 +158,17 @@ export interface OffsetQueryConstraintData {
|
|
|
151
158
|
* constraint. Note that performance can degrade with large offset values as Firestore
|
|
152
159
|
* still needs to read all skipped documents.
|
|
153
160
|
*
|
|
154
|
-
* @param offset - Number of documents to skip
|
|
155
|
-
* @returns A Firestore query constraint for offsetting results
|
|
161
|
+
* @param offset - Number of documents to skip.
|
|
162
|
+
* @returns A Firestore query constraint for offsetting results.
|
|
156
163
|
*
|
|
157
164
|
* @example
|
|
165
|
+
* ```ts
|
|
158
166
|
* // Skip the first 20 documents and take the next 10 (for page 3 with page size 10)
|
|
159
167
|
* const query = applyConstraints(baseQuery, [
|
|
160
168
|
* offset(20),
|
|
161
169
|
* limit(10)
|
|
162
170
|
* ]);
|
|
171
|
+
* ```
|
|
163
172
|
*/
|
|
164
173
|
export declare function offset(offset: number): FirestoreQueryConstraint<OffsetQueryConstraintData>;
|
|
165
174
|
/**
|
|
@@ -224,9 +233,9 @@ export type WhereDocumentIdQueryConstraintData = Omit<WhereQueryConstraintData,
|
|
|
224
233
|
/**
|
|
225
234
|
* Creates a constraint that filters documents by their document ID.
|
|
226
235
|
*
|
|
227
|
-
* @param opStr - Filter operator
|
|
228
|
-
* @param value - Document ID value to compare against
|
|
229
|
-
* @returns A Firestore query constraint for filtering documents by ID
|
|
236
|
+
* @param opStr - Filter operator.
|
|
237
|
+
* @param value - Document ID value to compare against.
|
|
238
|
+
* @returns A Firestore query constraint for filtering documents by ID.
|
|
230
239
|
*/
|
|
231
240
|
export declare function whereDocumentId(opStr: WhereFilterOp, value: unknown): FirestoreQueryConstraint<WhereDocumentIdQueryConstraintData>;
|
|
232
241
|
/**
|
|
@@ -280,7 +289,7 @@ export type OrderByDocumentIdQueryConstraintData = Pick<OrderByQueryConstraintDa
|
|
|
280
289
|
* Creates a constraint that orders documents by their document ID.
|
|
281
290
|
*
|
|
282
291
|
* @param directionStr - Direction to order results (defaults to ascending)
|
|
283
|
-
* @returns A Firestore query constraint for ordering documents by ID
|
|
292
|
+
* @returns A Firestore query constraint for ordering documents by ID.
|
|
284
293
|
*/
|
|
285
294
|
export declare function orderByDocumentId(directionStr?: OrderByDirection): FirestoreQueryConstraint<OrderByDocumentIdQueryConstraintData>;
|
|
286
295
|
/**
|
|
@@ -301,9 +310,10 @@ export interface StartAtQueryConstraintData<T = DocumentData> {
|
|
|
301
310
|
/**
|
|
302
311
|
* Creates a constraint that starts returning results at the document referenced by the snapshot.
|
|
303
312
|
*
|
|
313
|
+
* @param snapshot - Document snapshot to start at.
|
|
314
|
+
* @returns A Firestore query constraint for starting at a document.
|
|
315
|
+
*
|
|
304
316
|
* @template T - Type of document data
|
|
305
|
-
* @param snapshot - Document snapshot to start at
|
|
306
|
-
* @returns A Firestore query constraint for starting at a document
|
|
307
317
|
*/
|
|
308
318
|
export declare function startAt<T = DocumentData>(snapshot: DocumentSnapshot<T>): FirestoreQueryConstraint<StartAtQueryConstraintData<T>>;
|
|
309
319
|
/**
|
|
@@ -323,7 +333,7 @@ export interface StartAtValueQueryConstraintData {
|
|
|
323
333
|
* Creates a constraint that starts returning results at the specified field values.
|
|
324
334
|
*
|
|
325
335
|
* @param fieldValues - Field values to start at (must match the orderBy fields)
|
|
326
|
-
* @returns A Firestore query constraint for starting at field values
|
|
336
|
+
* @returns A Firestore query constraint for starting at field values.
|
|
327
337
|
*/
|
|
328
338
|
export declare function startAtValue(...fieldValues: unknown[]): FirestoreQueryConstraint<StartAtValueQueryConstraintData>;
|
|
329
339
|
/**
|
|
@@ -344,9 +354,10 @@ export interface StartAfterQueryConstraintData<T = DocumentData> {
|
|
|
344
354
|
/**
|
|
345
355
|
* Creates a constraint that starts returning results after the document referenced by the snapshot.
|
|
346
356
|
*
|
|
357
|
+
* @param snapshot - Document snapshot to start after.
|
|
358
|
+
* @returns A Firestore query constraint for starting after a document.
|
|
359
|
+
*
|
|
347
360
|
* @template T - Type of document data
|
|
348
|
-
* @param snapshot - Document snapshot to start after
|
|
349
|
-
* @returns A Firestore query constraint for starting after a document
|
|
350
361
|
*/
|
|
351
362
|
export declare function startAfter<T = DocumentData>(snapshot: DocumentSnapshot<T>): FirestoreQueryConstraint<StartAfterQueryConstraintData<T>>;
|
|
352
363
|
/**
|
|
@@ -381,15 +392,16 @@ export interface EndAtValueQueryConstraintData {
|
|
|
381
392
|
* Creates a constraint that ends results at the specified field values.
|
|
382
393
|
*
|
|
383
394
|
* @param fieldValues - Field values to end at (must match the orderBy fields)
|
|
384
|
-
* @returns A Firestore query constraint for ending at field values
|
|
395
|
+
* @returns A Firestore query constraint for ending at field values.
|
|
385
396
|
*/
|
|
386
397
|
export declare function endAtValue(...fieldValues: unknown[]): FirestoreQueryConstraint<EndAtValueQueryConstraintData>;
|
|
387
398
|
/**
|
|
388
399
|
* Creates a constraint that ends returning results at the document referenced by the snapshot.
|
|
389
400
|
*
|
|
401
|
+
* @param snapshot - Document snapshot to end at.
|
|
402
|
+
* @returns A Firestore query constraint for ending at a document.
|
|
403
|
+
*
|
|
390
404
|
* @template T - Type of document data
|
|
391
|
-
* @param snapshot - Document snapshot to end at
|
|
392
|
-
* @returns A Firestore query constraint for ending at a document
|
|
393
405
|
*/
|
|
394
406
|
export declare function endAt<T = DocumentData>(snapshot: DocumentSnapshot<T>): FirestoreQueryConstraint<EndAtQueryConstraintData<T>>;
|
|
395
407
|
/**
|
|
@@ -410,9 +422,10 @@ export interface EndBeforeQueryConstraintData<T = DocumentData> {
|
|
|
410
422
|
/**
|
|
411
423
|
* Creates a constraint that ends returning results before the document referenced by the snapshot.
|
|
412
424
|
*
|
|
425
|
+
* @param snapshot - Document snapshot to end before.
|
|
426
|
+
* @returns A Firestore query constraint for ending before a document.
|
|
427
|
+
*
|
|
413
428
|
* @template T - Type of document data
|
|
414
|
-
* @param snapshot - Document snapshot to end before
|
|
415
|
-
* @returns A Firestore query constraint for ending before a document
|
|
416
429
|
*/
|
|
417
430
|
export declare function endBefore<T = DocumentData>(snapshot: DocumentSnapshot<T>): FirestoreQueryConstraint<EndBeforeQueryConstraintData<T>>;
|
|
418
431
|
/**
|
|
@@ -482,18 +495,19 @@ export type FullFirestoreQueryConstraintHandlersMapping<B> = {
|
|
|
482
495
|
*
|
|
483
496
|
* It preserves the existing limit type (regular limit vs limitToLast) if one exists.
|
|
484
497
|
*
|
|
485
|
-
* @param limit - Maximum number of documents to return
|
|
486
|
-
* @param addedLimitType -
|
|
487
|
-
* @returns
|
|
498
|
+
* @param limit - Maximum number of documents to return.
|
|
499
|
+
* @param addedLimitType - Variant of limit constraint used when none already exists (default: regular limit).
|
|
500
|
+
* @returns Constraint transformer that adds or replaces the limit constraint.
|
|
488
501
|
*
|
|
489
502
|
* @example
|
|
503
|
+
* ```ts
|
|
490
504
|
* // Replace any existing limit with a limit of 25
|
|
491
505
|
* const withLimit25 = addOrReplaceLimitInConstraints(25);
|
|
492
506
|
* const newConstraints = withLimit25(existingConstraints);
|
|
493
|
-
*
|
|
494
507
|
* // Replace any existing limit with a limitToLast of 10
|
|
495
508
|
* const withLastLimit10 = addOrReplaceLimitInConstraints(10, FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE);
|
|
496
509
|
* const newConstraints = withLastLimit10(existingConstraints);
|
|
510
|
+
* ```
|
|
497
511
|
*/
|
|
498
512
|
export declare function addOrReplaceLimitInConstraints(limit: number, addedLimitType?: typeof FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE | typeof FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE): (constraints: FirestoreQueryConstraint[]) => FirestoreQueryConstraint[];
|
|
499
513
|
/**
|
|
@@ -510,13 +524,15 @@ export type FirestoreQueryConstraintMapFunction = (constraints: FirestoreQueryCo
|
|
|
510
524
|
* This is useful when you want to remove certain constraint types from a query,
|
|
511
525
|
* for example removing existing limit or where constraints before adding new ones.
|
|
512
526
|
*
|
|
513
|
-
* @param types - Constraint types to
|
|
514
|
-
* @returns
|
|
527
|
+
* @param types - Constraint types to drop from the list.
|
|
528
|
+
* @returns Mapper that yields the input constraints minus those matching `types`.
|
|
515
529
|
*
|
|
516
530
|
* @example
|
|
531
|
+
* ```ts
|
|
517
532
|
* // Remove all limit and offset constraints from the query
|
|
518
533
|
* const withoutPagination = filterConstraintsOfType('limit', 'offset');
|
|
519
534
|
* const newConstraints = withoutPagination(existingConstraints);
|
|
535
|
+
* ```
|
|
520
536
|
*/
|
|
521
537
|
export declare function filterConstraintsOfType(...types: FirestoreQueryConstraintType[]): FirestoreQueryConstraintMapFunction;
|
|
522
538
|
/**
|
|
@@ -526,17 +542,19 @@ export declare function filterConstraintsOfType(...types: FirestoreQueryConstrai
|
|
|
526
542
|
* preserving all other constraints. It's useful for updating pagination settings,
|
|
527
543
|
* changing filters, or modifying sorting without rebuilding the entire constraint list.
|
|
528
544
|
*
|
|
529
|
-
* @param replaceFn -
|
|
530
|
-
* @param types - Constraint types
|
|
531
|
-
* @returns
|
|
545
|
+
* @param replaceFn - Produces the replacement constraint(s) from the excluded ones.
|
|
546
|
+
* @param types - Constraint types whose entries are replaced.
|
|
547
|
+
* @returns Mapper that swaps matching constraints for the generated replacements.
|
|
532
548
|
*
|
|
533
549
|
* @example
|
|
550
|
+
* ```ts
|
|
534
551
|
* // Replace any existing limit constraint with a new limit of 20
|
|
535
552
|
* const replaceLimit = replaceConstraints(
|
|
536
553
|
* () => limit(20),
|
|
537
554
|
* [FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE]
|
|
538
555
|
* );
|
|
539
556
|
* const newConstraints = replaceLimit(existingConstraints);
|
|
557
|
+
* ```
|
|
540
558
|
*/
|
|
541
559
|
export declare function replaceConstraints(replaceFn: (constraints: FirestoreQueryConstraint[]) => Maybe<ArrayOrValue<FirestoreQueryConstraint>>, types: FirestoreQueryConstraintType[]): (constraints: FirestoreQueryConstraint[]) => FirestoreQueryConstraint[];
|
|
542
560
|
/**
|
|
@@ -546,14 +564,16 @@ export declare function replaceConstraints(replaceFn: (constraints: FirestoreQue
|
|
|
546
564
|
* the specified types and those that don't. This is used internally by other constraint
|
|
547
565
|
* manipulation functions and can be useful for custom constraint processing.
|
|
548
566
|
*
|
|
549
|
-
* @param types - Constraint types
|
|
550
|
-
* @returns
|
|
567
|
+
* @param types - Constraint types collected into the excluded group.
|
|
568
|
+
* @returns Mapper producing `{ included, excluded }` partitions.
|
|
551
569
|
*
|
|
552
570
|
* @example
|
|
571
|
+
* ```ts
|
|
553
572
|
* // Separate pagination constraints from filtering constraints
|
|
554
573
|
* const separatePagination = separateConstraints('limit', 'offset');
|
|
555
574
|
* const { included, excluded } = separatePagination(allConstraints);
|
|
556
575
|
* // included contains constraints that aren't limit or offset
|
|
557
576
|
* // excluded contains only the limit and offset constraints
|
|
577
|
+
* ```
|
|
558
578
|
*/
|
|
559
579
|
export declare function separateConstraints(...types: FirestoreQueryConstraintType[]): (constraints: FirestoreQueryConstraint[]) => SeparateResult<FirestoreQueryConstraint>;
|
|
@@ -30,15 +30,18 @@ export type FirestoreQueryOrderByAndRangeWhereTuple = [FirestoreQueryConstraint<
|
|
|
30
30
|
* include documents that are descendants of the specified parent. It's useful for hierarchical data
|
|
31
31
|
* structures where you need to retrieve all documents of a certain type that belong to a specific parent.
|
|
32
32
|
*
|
|
33
|
+
* @param parentRef - The parent document reference.
|
|
34
|
+
* @returns Array of query constraints to filter by parent document.
|
|
35
|
+
*
|
|
33
36
|
* @template P - The parent document data type
|
|
34
|
-
* @param parentRef - The parent document reference
|
|
35
|
-
* @returns Array of query constraints to filter by parent document
|
|
36
37
|
*
|
|
37
38
|
* @example
|
|
39
|
+
* ```ts
|
|
38
40
|
* // Get all 'comments' documents under a specific 'post'
|
|
39
41
|
* const postRef = doc(firestore, 'posts', postId);
|
|
40
42
|
* const query = collectionGroup(firestore, 'comments')
|
|
41
43
|
* .where(...allChildDocumentsUnderParent(postRef));
|
|
44
|
+
* ```
|
|
42
45
|
*/
|
|
43
46
|
export declare function allChildDocumentsUnderParent<P>(parentRef: DocumentReference<P>): FirestoreQueryOrderByDocumentIdRangeBoundsTuple;
|
|
44
47
|
/**
|
|
@@ -49,12 +52,14 @@ export declare function allChildDocumentsUnderParent<P>(parentRef: DocumentRefer
|
|
|
49
52
|
* Uses a range query on document IDs to efficiently filter for descendants.
|
|
50
53
|
*
|
|
51
54
|
* @param parentPath - The full path to the parent document (e.g., 'users/123')
|
|
52
|
-
* @returns Array of query constraints to filter by parent path
|
|
55
|
+
* @returns Array of query constraints to filter by parent path.
|
|
53
56
|
*
|
|
54
57
|
* @example
|
|
58
|
+
* ```ts
|
|
55
59
|
* // Get all 'comments' under a specific post without creating a reference
|
|
56
60
|
* const query = collectionGroup(firestore, 'comments')
|
|
57
61
|
* .where(...allChildDocumentsUnderParentPath('posts/abc123'));
|
|
62
|
+
* ```
|
|
58
63
|
*/
|
|
59
64
|
export declare function allChildDocumentsUnderParentPath(parentPath: string): FirestoreQueryOrderByDocumentIdRangeBoundsTuple;
|
|
60
65
|
/**
|
|
@@ -87,16 +92,19 @@ export declare function allChildDocumentsUnderRelativePath(orderByFieldPath: Fie
|
|
|
87
92
|
* It's useful when you're storing references to other models as strings in the format
|
|
88
93
|
* 'collectionType/id'.
|
|
89
94
|
*
|
|
90
|
-
* @
|
|
91
|
-
* @param
|
|
92
|
-
* @param value - The root model identity containing the collection type to search for
|
|
95
|
+
* @param orderByFieldPath - The field containing model references.
|
|
96
|
+
* @param value - The root model identity containing the collection type to search for.
|
|
93
97
|
* @param sortDirection - Optional direction to sort results (default: 'asc')
|
|
94
|
-
* @returns Array of query constraints to filter by model type
|
|
98
|
+
* @returns Array of query constraints to filter by model type.
|
|
99
|
+
*
|
|
100
|
+
* @template T - The document data type
|
|
95
101
|
*
|
|
96
102
|
* @example
|
|
103
|
+
* ```ts
|
|
97
104
|
* // Find all documents where the 'reference' field contains a reference to a 'users' model
|
|
98
105
|
* const query = collection(firestore, 'documents')
|
|
99
106
|
* .where(...whereStringHasRootIdentityModelKey('reference', { collectionType: 'users' }));
|
|
107
|
+
* ```
|
|
100
108
|
*/
|
|
101
109
|
export declare function whereStringHasRootIdentityModelKey<T = object>(orderByFieldPath: FieldPathOrStringPathOf<T> | FieldPathOrStringPath, value: RootFirestoreModelIdentity, sortDirection?: OrderByDirection): FirestoreQueryOrderByRangeBoundsTuple;
|
|
102
110
|
/**
|
|
@@ -157,8 +157,8 @@ export type InternalFirestoreItemPageIterationInstance<T> = ItemPageIterationIns
|
|
|
157
157
|
* This utility function removes constraints that would conflict with the pagination
|
|
158
158
|
* mechanics, such as 'limit' constraints which are automatically added by the paginator.
|
|
159
159
|
*
|
|
160
|
-
* @param constraints - Array of query constraints to filter
|
|
161
|
-
* @returns Filtered array with disallowed constraints removed
|
|
160
|
+
* @param constraints - Array of query constraints to filter.
|
|
161
|
+
* @returns Filtered array with disallowed constraints removed.
|
|
162
162
|
*/
|
|
163
163
|
export declare function filterDisallowedFirestoreItemPageIteratorInputConstraints(constraints: FirestoreQueryConstraint[]): FirestoreQueryConstraint[];
|
|
164
164
|
/**
|
|
@@ -240,11 +240,13 @@ export type FirestoreItemPageIterationFactoryFunction<T> = (filter?: FirestoreIt
|
|
|
240
240
|
* that can create properly configured pagination instances. This is useful when you need to create
|
|
241
241
|
* multiple pagination instances for the same collection but with different filters.
|
|
242
242
|
*
|
|
243
|
+
* @param baseConfig - The base configuration shared by all created pagination instances.
|
|
244
|
+
* @returns A factory function that creates pagination instances with the specified base configuration.
|
|
245
|
+
*
|
|
243
246
|
* @template T - The document data type in the query results
|
|
244
|
-
* @param baseConfig - The base configuration shared by all created pagination instances
|
|
245
|
-
* @returns A factory function that creates pagination instances with the specified base configuration
|
|
246
247
|
*
|
|
247
248
|
* @example
|
|
249
|
+
* ```ts
|
|
248
250
|
* // Create a factory for paginating users collection
|
|
249
251
|
* const usersQuery = collection(firestore, 'users');
|
|
250
252
|
* const usersPaginator = firestoreItemPageIterationFactory({
|
|
@@ -252,7 +254,6 @@ export type FirestoreItemPageIterationFactoryFunction<T> = (filter?: FirestoreIt
|
|
|
252
254
|
* itemsPerPage: 20,
|
|
253
255
|
* firestoreQueryDriver: driver
|
|
254
256
|
* });
|
|
255
|
-
*
|
|
256
257
|
* // Create specific pagination instances with different filters
|
|
257
258
|
* const activePaginator = usersPaginator({
|
|
258
259
|
* constraints: [where('status', '==', 'active')]
|
|
@@ -260,6 +261,8 @@ export type FirestoreItemPageIterationFactoryFunction<T> = (filter?: FirestoreIt
|
|
|
260
261
|
* const adminPaginator = usersPaginator({
|
|
261
262
|
* constraints: [where('role', '==', 'admin')]
|
|
262
263
|
* });
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
263
266
|
* @__NO_SIDE_EFFECTS__
|
|
264
267
|
*/
|
|
265
268
|
export declare function firestoreItemPageIterationFactory<T>(baseConfig: FirestoreItemPageIterationBaseConfig<T>): FirestoreItemPageIterationFactoryFunction<T>;
|
|
@@ -285,11 +288,13 @@ export declare const FIRESTORE_ITEM_PAGE_ITERATOR: ItemPageIterator<FirestoreIte
|
|
|
285
288
|
* that directly provides document arrays while also exposing access to the underlying
|
|
286
289
|
* snapshot iteration.
|
|
287
290
|
*
|
|
291
|
+
* @param config - The configuration for the pagination.
|
|
292
|
+
* @returns A Firestore pagination instance that loads documents in pages.
|
|
293
|
+
*
|
|
288
294
|
* @template T - The document data type in the query results
|
|
289
|
-
* @param config - The configuration for the pagination
|
|
290
|
-
* @returns A Firestore pagination instance that loads documents in pages
|
|
291
295
|
*
|
|
292
296
|
* @example
|
|
297
|
+
* ```ts
|
|
293
298
|
* // Create a pagination instance for a users collection
|
|
294
299
|
* const usersPagination = firestoreItemPageIteration({
|
|
295
300
|
* queryLike: collection(firestore, 'users'),
|
|
@@ -299,14 +304,14 @@ export declare const FIRESTORE_ITEM_PAGE_ITERATOR: ItemPageIterator<FirestoreIte
|
|
|
299
304
|
* constraints: [where('status', '==', 'active'), orderBy('createdAt', 'desc')]
|
|
300
305
|
* }
|
|
301
306
|
* });
|
|
302
|
-
*
|
|
303
307
|
* // Load the first page of results
|
|
304
308
|
* const firstPage = await usersPagination.loadNextPage().toPromise();
|
|
305
309
|
* console.log('First 10 users:', firstPage);
|
|
306
|
-
*
|
|
307
310
|
* // Load the next page when needed
|
|
308
311
|
* const secondPage = await usersPagination.loadNextPage().toPromise();
|
|
309
312
|
* console.log('Next 10 users:', secondPage);
|
|
313
|
+
* ```
|
|
314
|
+
*
|
|
310
315
|
* @__NO_SIDE_EFFECTS__
|
|
311
316
|
*/
|
|
312
317
|
export declare function firestoreItemPageIteration<T>(config: FirestoreItemPageIterationConfig<T>): FirestoreItemPageIterationInstance<T>;
|
|
@@ -327,8 +332,9 @@ export type FirestoreFixedItemPageIterationFactoryFunction<T> = (items: Document
|
|
|
327
332
|
* producing a pagination instance that iterates over those specific documents in pages.
|
|
328
333
|
*
|
|
329
334
|
* @param baseConfig - Base pagination configuration (query reference, driver, page size)
|
|
330
|
-
* @param documentAccessor - Accessor used to load document snapshots from the references
|
|
331
|
-
* @returns A factory function that creates fixed-set pagination instances
|
|
335
|
+
* @param documentAccessor - Accessor used to load document snapshots from the references.
|
|
336
|
+
* @returns A factory function that creates fixed-set pagination instances.
|
|
337
|
+
*
|
|
332
338
|
* @__NO_SIDE_EFFECTS__
|
|
333
339
|
*/
|
|
334
340
|
export declare function firestoreFixedItemPageIterationFactory<T>(baseConfig: FirestoreItemPageIterationConfig<T>, documentAccessor: LimitedFirestoreDocumentAccessor<T>): FirestoreFixedItemPageIterationFactoryFunction<T>;
|
|
@@ -361,8 +367,9 @@ export interface FirestoreFixedItemPageIterationConfig<T> extends FirestoreItemP
|
|
|
361
367
|
* This is useful for paginating over known document sets (e.g., from a pre-computed list
|
|
362
368
|
* of references) without executing Firestore queries.
|
|
363
369
|
*
|
|
364
|
-
* @param config - Configuration including the document references, accessor, and pagination settings
|
|
365
|
-
* @returns A pagination instance that pages through the fixed reference set
|
|
370
|
+
* @param config - Configuration including the document references, accessor, and pagination settings.
|
|
371
|
+
* @returns A pagination instance that pages through the fixed reference set.
|
|
372
|
+
*
|
|
366
373
|
* @__NO_SIDE_EFFECTS__
|
|
367
374
|
*/
|
|
368
375
|
export declare function firestoreFixedItemPageIteration<T>(config: FirestoreFixedItemPageIterationConfig<T>): FirestoreItemPageIterationInstance<T>;
|
|
@@ -136,28 +136,30 @@ export interface FirestoreQueryConfig<T> extends FirestoreQueryDriverRef, QueryL
|
|
|
136
136
|
* maintains the base query reference (typically a collection or collection group) and provides
|
|
137
137
|
* a fluent API for working with it.
|
|
138
138
|
*
|
|
139
|
+
* @param config - Configuration for the query factory, including the base query reference and driver.
|
|
140
|
+
* @returns A factory for creating and executing queries against the specified collection.
|
|
141
|
+
*
|
|
139
142
|
* @template T - The document data type in the query results
|
|
140
|
-
* @param config - Configuration for the query factory, including the base query reference and driver
|
|
141
|
-
* @returns A factory for creating and executing queries against the specified collection
|
|
142
143
|
*
|
|
143
144
|
* @example
|
|
145
|
+
* ```ts
|
|
144
146
|
* // Create a query factory for the 'users' collection
|
|
145
147
|
* const usersQuery = firestoreQueryFactory({
|
|
146
148
|
* queryLike: collection(firestore, 'users'),
|
|
147
149
|
* firestoreQueryDriver: driver
|
|
148
150
|
* });
|
|
149
|
-
*
|
|
150
151
|
* // Use the factory to create and execute queries
|
|
151
152
|
* const activeUsers = await usersQuery.query(
|
|
152
153
|
* where('status', '==', 'active'),
|
|
153
154
|
* orderBy('lastLogin', 'desc'),
|
|
154
155
|
* limit(10)
|
|
155
156
|
* ).getDocs();
|
|
156
|
-
*
|
|
157
157
|
* // Queries can be extended with additional constraints
|
|
158
158
|
* const adminUsers = activeUsers.filter(
|
|
159
159
|
* where('role', '==', 'admin')
|
|
160
160
|
* ).getDocs();
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
161
163
|
* @__NO_SIDE_EFFECTS__
|
|
162
164
|
*/
|
|
163
165
|
export declare function firestoreQueryFactory<T>(config: FirestoreQueryConfig<T>): FirestoreQueryFactory<T>;
|
|
@@ -52,12 +52,14 @@ export interface LoadAllFirestoreDocumentSnapshotPairsResult<T, D extends Firest
|
|
|
52
52
|
* result sets in batches, then combines them into a single result array. It supports optional
|
|
53
53
|
* batch processing while loading.
|
|
54
54
|
*
|
|
55
|
+
* @param config - Configuration options for the loading operation.
|
|
56
|
+
* @returns Promise resolving to the result containing all matching document snapshot pairs.
|
|
57
|
+
*
|
|
55
58
|
* @template T - The document data type
|
|
56
59
|
* @template D - The FirestoreDocument implementation type (defaults to FirestoreDocument<T>)
|
|
57
|
-
* @param config - Configuration options for the loading operation
|
|
58
|
-
* @returns Promise resolving to the result containing all matching document snapshot pairs
|
|
59
60
|
*
|
|
60
61
|
* @example
|
|
62
|
+
* ```ts
|
|
61
63
|
* // Load all active user documents with their data
|
|
62
64
|
* const result = await loadAllFirestoreDocumentSnapshotPairs({
|
|
63
65
|
* queryFactory: () => collection(firestore, 'users'),
|
|
@@ -68,8 +70,8 @@ export interface LoadAllFirestoreDocumentSnapshotPairsResult<T, D extends Firest
|
|
|
68
70
|
* console.log(`Processing batch ${index} with ${pairs.length} users`);
|
|
69
71
|
* }
|
|
70
72
|
* });
|
|
71
|
-
*
|
|
72
73
|
* console.log(`Loaded ${result.snapshotPairs.length} user documents`);
|
|
74
|
+
* ```
|
|
73
75
|
*/
|
|
74
76
|
export declare function loadAllFirestoreDocumentSnapshotPairs<T, D extends FirestoreDocument<T> = FirestoreDocument<T>>(config: LoadAllFirestoreDocumentSnapshotPairsConfig<T, D>): Promise<LoadAllFirestoreDocumentSnapshotPairsResult<T, D>>;
|
|
75
77
|
/**
|
|
@@ -121,11 +123,13 @@ export interface LoadAllFirestoreDocumentSnapshotsResult<T> extends Pick<Iterate
|
|
|
121
123
|
* Unlike loadAllFirestoreDocumentSnapshotPairs, this function only retrieves the document
|
|
122
124
|
* snapshots without automatically loading their associated data.
|
|
123
125
|
*
|
|
126
|
+
* @param config - Configuration options for the loading operation.
|
|
127
|
+
* @returns Promise resolving to the result containing all matching document snapshots.
|
|
128
|
+
*
|
|
124
129
|
* @template T - The document data type
|
|
125
|
-
* @param config - Configuration options for the loading operation
|
|
126
|
-
* @returns Promise resolving to the result containing all matching document snapshots
|
|
127
130
|
*
|
|
128
131
|
* @example
|
|
132
|
+
* ```ts
|
|
129
133
|
* // Load all documents created in the last 24 hours
|
|
130
134
|
* const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
|
131
135
|
* const result = await loadAllFirestoreDocumentSnapshot({
|
|
@@ -137,7 +141,7 @@ export interface LoadAllFirestoreDocumentSnapshotsResult<T> extends Pick<Iterate
|
|
|
137
141
|
* console.log(`Processing batch with ${snapshots.length} events`);
|
|
138
142
|
* }
|
|
139
143
|
* });
|
|
140
|
-
*
|
|
141
144
|
* console.log(`Loaded ${result.snapshots.length} event documents`);
|
|
145
|
+
* ```
|
|
142
146
|
*/
|
|
143
147
|
export declare function loadAllFirestoreDocumentSnapshot<T>(config: LoadAllFirestoreDocumentSnapshotsConfig<T>): Promise<LoadAllFirestoreDocumentSnapshotsResult<T>>;
|
|
@@ -56,7 +56,7 @@ export interface IterateFirestoreDocumentSnapshotPairsConfig<T, R, D extends Fir
|
|
|
56
56
|
* This is the highest-level iteration function — use it when your callback needs
|
|
57
57
|
* document-level operations (updates, deletes) alongside the snapshot data.
|
|
58
58
|
*
|
|
59
|
-
* @param config - Iteration config including the document accessor and per-pair callback
|
|
59
|
+
* @param config - Iteration config including the document accessor and per-pair callback.
|
|
60
60
|
* @returns Checkpoint-level statistics (total checkpoints, snapshots visited, limit status)
|
|
61
61
|
*
|
|
62
62
|
* @example
|
|
@@ -121,7 +121,7 @@ export type IterateFirestoreDocumentSnapshotsResult<T, R> = PerformAsyncTasksRes
|
|
|
121
121
|
* For document-level operations (needing the typed {@link FirestoreDocument} wrapper),
|
|
122
122
|
* use {@link iterateFirestoreDocumentSnapshotPairs} instead.
|
|
123
123
|
*
|
|
124
|
-
* @param config - Iteration config including the per-snapshot callback
|
|
124
|
+
* @param config - Iteration config including the per-snapshot callback.
|
|
125
125
|
* @returns Checkpoint-level statistics (total checkpoints, snapshots visited, limit status)
|
|
126
126
|
*
|
|
127
127
|
* @example
|
|
@@ -170,7 +170,7 @@ export interface IterateFirestoreDocumentSnapshotPairBatchesConfig<T, R, D exten
|
|
|
170
170
|
* typed document-snapshot pairs. Use this when you need batch-level operations with
|
|
171
171
|
* typed document access (e.g., bulk updates, batch writes).
|
|
172
172
|
*
|
|
173
|
-
* @param config - Iteration config including the document accessor and per-batch callback
|
|
173
|
+
* @param config - Iteration config including the document accessor and per-batch callback.
|
|
174
174
|
* @returns Checkpoint-level statistics (total checkpoints, snapshots visited, limit status)
|
|
175
175
|
*
|
|
176
176
|
* @example
|
|
@@ -236,7 +236,7 @@ export interface IterateFirestoreDocumentSnapshotBatchesConfig<T, R> extends Omi
|
|
|
236
236
|
* Called once per checkpoint with all snapshots from that checkpoint. If it returns `null`,
|
|
237
237
|
* all snapshots are processed in a single batch. Takes precedence over `batchSize` when provided.
|
|
238
238
|
*/
|
|
239
|
-
readonly batchSizeForSnapshots?: Maybe<FactoryWithRequiredInput<number
|
|
239
|
+
readonly batchSizeForSnapshots?: Maybe<FactoryWithRequiredInput<Maybe<number>, QueryDocumentSnapshot<T>[]>>;
|
|
240
240
|
/**
|
|
241
241
|
* Callback invoked for each batch of document snapshots within a checkpoint.
|
|
242
242
|
*
|
|
@@ -275,7 +275,7 @@ export declare const DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_S
|
|
|
275
275
|
* For per-snapshot processing, use {@link iterateFirestoreDocumentSnapshots}.
|
|
276
276
|
* For batch processing with typed document pairs, use {@link iterateFirestoreDocumentSnapshotPairBatches}.
|
|
277
277
|
*
|
|
278
|
-
* @param config - Iteration config including batch size and per-batch callback
|
|
278
|
+
* @param config - Iteration config including batch size and per-batch callback.
|
|
279
279
|
* @returns Checkpoint-level statistics (total checkpoints, snapshots visited, limit status)
|
|
280
280
|
*
|
|
281
281
|
* @example
|
|
@@ -544,8 +544,8 @@ export interface IterateFirestoreDocumentSnapshotCheckpointsResult {
|
|
|
544
544
|
* - {@link iterateFirestoreDocumentSnapshots} — processes one snapshot at a time
|
|
545
545
|
* - {@link iterateFirestoreDocumentSnapshotPairs} — loads typed document wrappers per snapshot
|
|
546
546
|
*
|
|
547
|
-
* @param config - Complete configuration for pagination, processing, and termination behavior
|
|
548
|
-
* @returns Statistics including total checkpoints executed, snapshots visited, and whether the limit was hit
|
|
547
|
+
* @param config - Complete configuration for pagination, processing, and termination behavior.
|
|
548
|
+
* @returns Statistics including total checkpoints executed, snapshots visited, and whether the limit was hit.
|
|
549
549
|
*
|
|
550
550
|
* @example
|
|
551
551
|
* ```typescript
|
|
@@ -573,7 +573,7 @@ export declare function iterateFirestoreDocumentSnapshotCheckpoints<T, R>(config
|
|
|
573
573
|
* this filter uses the full document path ({@link readFirestoreModelKeyFromDocumentSnapshot}),
|
|
574
574
|
* making it suitable for cross-collection iteration where document IDs alone may collide.
|
|
575
575
|
*
|
|
576
|
-
* @returns A reusable filter function that passes each unique document path exactly once
|
|
576
|
+
* @returns A reusable filter function that passes each unique document path exactly once.
|
|
577
577
|
*
|
|
578
578
|
* @example
|
|
579
579
|
* ```typescript
|
|
@@ -48,12 +48,14 @@ export type StreamDocsUnsubscribeFunction = () => void;
|
|
|
48
48
|
* and RxJS's reactive streams, allowing for seamless integration of Firestore
|
|
49
49
|
* query results into reactive applications.
|
|
50
50
|
*
|
|
51
|
-
* @template O - The type of output value to emit in the Observable
|
|
52
51
|
* @param callOnSnapshot - Function that sets up the Firestore snapshot listener
|
|
53
|
-
* and returns an unsubscribe function
|
|
54
|
-
* @returns An Observable that emits values from the Firestore snapshot listener
|
|
52
|
+
* and returns an unsubscribe function.
|
|
53
|
+
* @returns An Observable that emits values from the Firestore snapshot listener.
|
|
54
|
+
*
|
|
55
|
+
* @template O - The type of output value to emit in the Observable
|
|
55
56
|
*
|
|
56
57
|
* @example
|
|
58
|
+
* ```ts
|
|
57
59
|
* // Create a reactive stream from a Firestore query
|
|
58
60
|
* const usersStream = streamFromOnSnapshot(params => {
|
|
59
61
|
* return collection(firestore, 'users')
|
|
@@ -64,6 +66,7 @@ export type StreamDocsUnsubscribeFunction = () => void;
|
|
|
64
66
|
* () => params.complete()
|
|
65
67
|
* );
|
|
66
68
|
* });
|
|
69
|
+
* ```
|
|
67
70
|
*/
|
|
68
71
|
export declare function streamFromOnSnapshot<O>(callOnSnapshot: (params: StreamDocsWithOnSnapshotFunctionParams<O>) => StreamDocsUnsubscribeFunction): Observable<O>;
|
|
69
72
|
/**
|
|
@@ -73,9 +76,10 @@ export declare function streamFromOnSnapshot<O>(callOnSnapshot: (params: StreamD
|
|
|
73
76
|
* DocumentReference objects, making it easier to work with the references
|
|
74
77
|
* to the documents that matched a query.
|
|
75
78
|
*
|
|
79
|
+
* @param snapshots - The query snapshot containing document snapshots.
|
|
80
|
+
* @returns Array of document references extracted from the snapshot.
|
|
81
|
+
*
|
|
76
82
|
* @template T - The document data type
|
|
77
|
-
* @param snapshots - The query snapshot containing document snapshots
|
|
78
|
-
* @returns Array of document references extracted from the snapshot
|
|
79
83
|
*/
|
|
80
84
|
export declare function documentReferencesFromSnapshot<T>(snapshots: QuerySnapshot<T>): DocumentReference<T>[];
|
|
81
85
|
/**
|
|
@@ -85,7 +89,7 @@ export declare function documentReferencesFromSnapshot<T>(snapshots: QuerySnapsh
|
|
|
85
89
|
* which uniquely identifies the document within Firestore. This is useful
|
|
86
90
|
* for tracking documents across queries and preventing duplicate processing.
|
|
87
91
|
*
|
|
88
|
-
* @param snapshot - The document snapshot to extract the key from
|
|
89
|
-
* @returns The document's full path as a FirestoreModelKey
|
|
92
|
+
* @param snapshot - The document snapshot to extract the key from.
|
|
93
|
+
* @returns The document's full path as a FirestoreModelKey.
|
|
90
94
|
*/
|
|
91
95
|
export declare function readFirestoreModelKeyFromDocumentSnapshot(snapshot: DocumentSnapshot<any>): FirestoreModelKey;
|