@react-native-firebase/firestore 22.2.0 → 22.3.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [22.3.0](https://github.com/invertase/react-native-firebase/compare/v22.2.1...v22.3.0) (2025-07-08)
7
+
8
+ ### Features
9
+
10
+ - **firestore:** add support for onSnapshotsInSync ([#8379](https://github.com/invertase/react-native-firebase/issues/8379)) ([f8c1464](https://github.com/invertase/react-native-firebase/commit/f8c1464fc0249864e9c6bf01af7f8679e3d235cf))
11
+
12
+ ### Bug Fixes
13
+
14
+ - **app:** firebase-js-sdk bump 11.3.1 > 11.10.0 ([29ea831](https://github.com/invertase/react-native-firebase/commit/29ea8310beed3eb0598bda55aacc29c100c7f770))
15
+ - **firestore:** type definitions ([#8378](https://github.com/invertase/react-native-firebase/issues/8378)) ([497c6d1](https://github.com/invertase/react-native-firebase/commit/497c6d153a897226ddf195b4187ee6a3be99d1f2))
16
+
17
+ ## [22.2.1](https://github.com/invertase/react-native-firebase/compare/v22.2.0...v22.2.1) (2025-06-10)
18
+
19
+ **Note:** Version bump only for package @react-native-firebase/firestore
20
+
6
21
  ## [22.2.0](https://github.com/invertase/react-native-firebase/compare/v22.1.0...v22.2.0) (2025-05-12)
7
22
 
8
23
  **Note:** Version bump only for package @react-native-firebase/firestore
@@ -22,10 +22,15 @@ import static io.invertase.firebase.firestore.UniversalFirebaseFirestoreCommon.g
22
22
  import static io.invertase.firebase.firestore.UniversalFirebaseFirestoreCommon.instanceCache;
23
23
 
24
24
  import android.content.Context;
25
+ import android.util.SparseArray;
26
+ import com.facebook.react.bridge.Arguments;
27
+ import com.facebook.react.bridge.WritableMap;
25
28
  import com.google.android.gms.tasks.Task;
26
29
  import com.google.android.gms.tasks.Tasks;
27
30
  import com.google.firebase.firestore.FirebaseFirestore;
31
+ import com.google.firebase.firestore.ListenerRegistration;
28
32
  import com.google.firebase.firestore.LoadBundleTask;
33
+ import io.invertase.firebase.common.ReactNativeFirebaseEventEmitter;
29
34
  import io.invertase.firebase.common.UniversalFirebaseModule;
30
35
  import io.invertase.firebase.common.UniversalFirebasePreferences;
31
36
  import java.nio.charset.StandardCharsets;
@@ -34,6 +39,7 @@ import java.util.Map;
34
39
  import java.util.Objects;
35
40
 
36
41
  public class UniversalFirebaseFirestoreModule extends UniversalFirebaseModule {
42
+ private static SparseArray<ListenerRegistration> onSnapshotInSyncListeners = new SparseArray<>();
37
43
 
38
44
  private static HashMap<String, String> emulatorConfigs = new HashMap<>();
39
45
 
@@ -41,6 +47,35 @@ public class UniversalFirebaseFirestoreModule extends UniversalFirebaseModule {
41
47
  super(context, serviceName);
42
48
  }
43
49
 
50
+ void addSnapshotsInSync(String appName, String databaseId, int listenerId) {
51
+
52
+ FirebaseFirestore firebaseFirestore = getFirestoreForApp(appName, databaseId);
53
+ ListenerRegistration listenerRegistration =
54
+ firebaseFirestore.addSnapshotsInSyncListener(
55
+ () -> {
56
+ ReactNativeFirebaseEventEmitter emitter =
57
+ ReactNativeFirebaseEventEmitter.getSharedInstance();
58
+ WritableMap body = Arguments.createMap();
59
+ emitter.sendEvent(
60
+ new ReactNativeFirebaseFirestoreEvent(
61
+ ReactNativeFirebaseFirestoreEvent.SNAPSHOT_IN_SYNC_EVENT_SYNC,
62
+ body,
63
+ appName,
64
+ databaseId,
65
+ listenerId));
66
+ });
67
+
68
+ onSnapshotInSyncListeners.put(listenerId, listenerRegistration);
69
+ }
70
+
71
+ void removeSnapshotsInSync(String appName, String databaseId, int listenerId) {
72
+ ListenerRegistration listenerRegistration = onSnapshotInSyncListeners.get(listenerId);
73
+ if (listenerRegistration != null) {
74
+ listenerRegistration.remove();
75
+ onSnapshotInSyncListeners.remove(listenerId);
76
+ }
77
+ }
78
+
44
79
  Task<Void> disableNetwork(String appName, String databaseId) {
45
80
  return getFirestoreForApp(appName, databaseId).disableNetwork();
46
81
  }
@@ -26,6 +26,7 @@ public class ReactNativeFirebaseFirestoreEvent implements NativeEvent {
26
26
  static final String COLLECTION_EVENT_SYNC = "firestore_collection_sync_event";
27
27
  static final String DOCUMENT_EVENT_SYNC = "firestore_document_sync_event";
28
28
  static final String TRANSACTION_EVENT_SYNC = "firestore_transaction_event";
29
+ static final String SNAPSHOT_IN_SYNC_EVENT_SYNC = "firestore_snapshots_in_sync_event";
29
30
  private static final String KEY_ID = "listenerId";
30
31
  private static final String KEY_BODY = "body";
31
32
  private static final String KEY_APP_NAME = "appName";
@@ -193,6 +193,20 @@ public class ReactNativeFirebaseFirestoreModule extends ReactNativeFirebaseModul
193
193
  promise.resolve(null);
194
194
  }
195
195
 
196
+ @ReactMethod
197
+ public void addSnapshotsInSync(
198
+ String appName, String databaseId, int listenerId, Promise promise) {
199
+ module.addSnapshotsInSync(appName, databaseId, listenerId);
200
+ promise.resolve(null);
201
+ }
202
+
203
+ @ReactMethod
204
+ public void removeSnapshotsInSync(
205
+ String appName, String databaseId, int listenerId, Promise promise) {
206
+ module.removeSnapshotsInSync(appName, databaseId, listenerId);
207
+ promise.resolve(null);
208
+ }
209
+
196
210
  private WritableMap taskProgressToWritableMap(LoadBundleTaskProgress progress) {
197
211
  WritableMap writableMap = Arguments.createMap();
198
212
  writableMap.putDouble("bytesLoaded", progress.getBytesLoaded());
@@ -16,12 +16,15 @@
16
16
  */
17
17
 
18
18
  #import "RNFBFirestoreModule.h"
19
+ #import <RNFBApp/RNFBRCTEventEmitter.h>
19
20
  #import <React/RCTUtils.h>
20
21
  #import "FirebaseFirestoreInternal/FIRPersistentCacheIndexManager.h"
21
22
  #import "RNFBFirestoreCommon.h"
22
23
  #import "RNFBPreferences.h"
23
24
 
24
25
  NSMutableDictionary *emulatorConfigs;
26
+ static __strong NSMutableDictionary *snapshotsInSyncListeners;
27
+ static NSString *const RNFB_FIRESTORE_SNAPSHOTS_IN_SYNC = @"firestore_snapshots_in_sync_event";
25
28
 
26
29
  @implementation RNFBFirestoreModule
27
30
  #pragma mark -
@@ -240,6 +243,51 @@ RCT_EXPORT_METHOD(persistenceCacheIndexManager
240
243
  resolve(nil);
241
244
  }
242
245
 
246
+ RCT_EXPORT_METHOD(addSnapshotsInSync
247
+ : (FIRApp *)firebaseApp
248
+ : (NSString *)databaseId
249
+ : (nonnull NSNumber *)listenerId
250
+ : (RCTPromiseResolveBlock)resolve
251
+ : (RCTPromiseRejectBlock)reject) {
252
+ if (snapshotsInSyncListeners[listenerId]) {
253
+ resolve(nil);
254
+ return;
255
+ }
256
+
257
+ FIRFirestore *firestore = [RNFBFirestoreCommon getFirestoreForApp:firebaseApp
258
+ databaseId:databaseId];
259
+
260
+ id<FIRListenerRegistration> listener = [firestore addSnapshotsInSyncListener:^{
261
+ [[RNFBRCTEventEmitter shared]
262
+ sendEventWithName:RNFB_FIRESTORE_SNAPSHOTS_IN_SYNC
263
+ body:@{
264
+ @"appName" : [RNFBSharedUtils getAppJavaScriptName:firebaseApp.name],
265
+ @"databaseId" : databaseId,
266
+ @"listenerId" : listenerId,
267
+ @"body" : @{}
268
+ }];
269
+ }];
270
+
271
+ snapshotsInSyncListeners[listenerId] = listener;
272
+
273
+ resolve(nil);
274
+ }
275
+
276
+ RCT_EXPORT_METHOD(removeSnapshotsInSync
277
+ : (FIRApp *)firebaseApp
278
+ : (NSString *)databaseId
279
+ : (nonnull NSNumber *)listenerId
280
+ : (RCTPromiseResolveBlock)resolve
281
+ : (RCTPromiseRejectBlock)reject) {
282
+ id<FIRListenerRegistration> listener = snapshotsInSyncListeners[listenerId];
283
+ if (listener) {
284
+ [listener remove];
285
+ [snapshotsInSyncListeners removeObjectForKey:listenerId];
286
+ }
287
+
288
+ resolve(nil);
289
+ }
290
+
243
291
  - (NSMutableDictionary *)taskProgressToDictionary:(FIRLoadBundleTaskProgress *)progress {
244
292
  NSMutableDictionary *progressMap = [[NSMutableDictionary alloc] init];
245
293
  progressMap[@"bytesLoaded"] = @(progress.bytesLoaded);
package/lib/index.js CHANGED
@@ -43,6 +43,12 @@ import version from './version';
43
43
  import fallBackModule from './web/RNFBFirestoreModule';
44
44
  import FirestorePersistentCacheIndexManager from './FirestorePersistentCacheIndexManager';
45
45
 
46
+ // react-native at least through 0.77 does not correctly support URL.host, which
47
+ // is needed by firebase-js-sdk. It appears that in 0.80+ it is supported, so this
48
+ // (and the package.json entry for this package) should be removed when the minimum
49
+ // supported version of react-native is 0.80 or higher.
50
+ import 'react-native-url-polyfill/auto';
51
+
46
52
  const namespace = 'firestore';
47
53
 
48
54
  const nativeModuleName = [
@@ -56,6 +62,7 @@ const nativeEvents = [
56
62
  'firestore_collection_sync_event',
57
63
  'firestore_document_sync_event',
58
64
  'firestore_transaction_event',
65
+ 'firestore_snapshots_in_sync_event',
59
66
  ];
60
67
 
61
68
  class FirebaseFirestoreModule extends FirebaseModule {
@@ -84,6 +91,13 @@ class FirebaseFirestoreModule extends FirebaseModule {
84
91
  );
85
92
  });
86
93
 
94
+ this.emitter.addListener(this.eventNameForApp('firestore_snapshots_in_sync_event'), event => {
95
+ this.emitter.emit(
96
+ this.eventNameForApp(`firestore_snapshots_in_sync_event:${event.listenerId}`),
97
+ event,
98
+ );
99
+ });
100
+
87
101
  this._settings = {
88
102
  ignoreUndefinedProperties: false,
89
103
  persistence: true,
@@ -11,3 +11,10 @@ export declare class FieldPath {
11
11
 
12
12
  isEqual(other: FieldPath): boolean;
13
13
  }
14
+
15
+ /**
16
+ * Returns a special sentinel FieldPath to refer to the ID of a document
17
+ * It can be used in queries to sort or filter by the document ID
18
+ */
19
+
20
+ export declare function documentId(): FieldPath;
@@ -1,3 +1,7 @@
1
1
  import FirestoreFieldPath from '../FirestoreFieldPath';
2
2
 
3
3
  export const FieldPath = FirestoreFieldPath;
4
+
5
+ export function documentId() {
6
+ return FieldPath.documentId();
7
+ }
@@ -185,11 +185,11 @@ export function doc(
185
185
  * a document.
186
186
  * @returns The `DocumentReference` instance.
187
187
  */
188
- export function doc<T>(
189
- reference: CollectionReference<T>,
188
+ export declare function doc<AppModelType, DbModelType extends DocumentData>(
189
+ reference: CollectionReference<AppModelType, DbModelType>,
190
190
  path?: string,
191
191
  ...pathSegments: string[]
192
- ): DocumentReference<T>;
192
+ ): DocumentReference<AppModelType, DbModelType>;
193
193
 
194
194
  /**
195
195
  * Gets a `DocumentReference` instance that refers to a document within
@@ -203,11 +203,11 @@ export function doc<T>(
203
203
  * a document.
204
204
  * @returns The `DocumentReference` instance.
205
205
  */
206
- export function doc(
207
- reference: DocumentReference<unknown>,
206
+ export declare function doc<AppModelType, DbModelType extends DocumentData>(
207
+ reference: DocumentReference<AppModelType, DbModelType>,
208
208
  path: string,
209
209
  ...pathSegments: string[]
210
- ): DocumentReference<DocumentData>;
210
+ ): DocumentReference<DocumentData, DocumentData>;
211
211
 
212
212
  export function doc<T>(
213
213
  parent: Firestore | CollectionReference<T> | DocumentReference<unknown>,
@@ -231,7 +231,7 @@ export function collection(
231
231
  firestore: Firestore,
232
232
  path: string,
233
233
  ...pathSegments: string[]
234
- ): CollectionReference<DocumentData>;
234
+ ): CollectionReference<DocumentData, DocumentData>;
235
235
 
236
236
  /**
237
237
  * Gets a `CollectionReference` instance that refers to a subcollection of
@@ -245,11 +245,29 @@ export function collection(
245
245
  * to a collection.
246
246
  * @returns The `CollectionReference` instance.
247
247
  */
248
- export function collection(
249
- reference: CollectionReference<unknown>,
248
+ export declare function collection<AppModelType, DbModelType extends DocumentData>(
249
+ reference: CollectionReference<AppModelType, DbModelType>,
250
250
  path: string,
251
251
  ...pathSegments: string[]
252
- ): CollectionReference<DocumentData>;
252
+ ): CollectionReference<DocumentData, DocumentData>;
253
+
254
+ /**
255
+ * Gets a `CollectionReference` instance that refers to a subcollection of
256
+ * `reference` at the specified relative path.
257
+ *
258
+ * @param reference - A reference to a document.
259
+ * @param path - A slash-separated path to a collection.
260
+ * @param pathSegments - Additional path segments to apply relative to the first
261
+ * argument.
262
+ * @throws If the final path has an even number of segments and does not point
263
+ * to a collection.
264
+ * @returns The `CollectionReference` instance.
265
+ */
266
+ export declare function collection<AppModelType, DbModelType extends DocumentData>(
267
+ reference: DocumentReference<AppModelType, DbModelType>,
268
+ path: string,
269
+ ...pathSegments: string[]
270
+ ): CollectionReference<DocumentData, DocumentData>;
253
271
 
254
272
  /**
255
273
  * Gets a `CollectionReference` instance that refers to a subcollection of
@@ -302,7 +320,10 @@ export declare function refEqual<AppModelType, DbModelType extends DocumentData>
302
320
  * will be included. Cannot contain a slash.
303
321
  * @returns The created `Query`.
304
322
  */
305
- export function collectionGroup(firestore: Firestore, collectionId: string): Query<DocumentData>;
323
+ export function collectionGroup(
324
+ firestore: Firestore,
325
+ collectionId: string,
326
+ ): Query<DocumentData, DocumentData>;
306
327
 
307
328
  /**
308
329
  * Writes to the document referred to by this `DocumentReference`. If the
@@ -383,10 +404,10 @@ export function updateDoc(
383
404
  * newly created document after it has been written to the backend (Note that it
384
405
  * won't resolve while you're offline).
385
406
  */
386
- export function addDoc<T>(
387
- reference: CollectionReference<T>,
388
- data: WithFieldValue<T>,
389
- ): Promise<DocumentReference<T>>;
407
+ export declare function addDoc<AppModelType, DbModelType extends DocumentData>(
408
+ reference: CollectionReference<AppModelType, DbModelType>,
409
+ data: WithFieldValue<AppModelType>,
410
+ ): Promise<DocumentReference<AppModelType, DbModelType>>;
390
411
 
391
412
  /**
392
413
  * Re-enables use of the network for this {@link Firestore} instance after a prior
@@ -701,7 +722,7 @@ export function loadBundle(
701
722
  * @param name - The name of the query.
702
723
  * @returns A named Query.
703
724
  */
704
- export function namedQuery(firestore: Firestore, name: string): Query<DocumentData>;
725
+ export function namedQuery(firestore: Firestore, name: string): Promise<Query | null>;
705
726
 
706
727
  /**
707
728
  * Creates a write batch, used for performing multiple writes as a single
@@ -89,6 +89,24 @@ export function collectionGroup(firestore, collectionId) {
89
89
  return firestore.collectionGroup.call(firestore, collectionId, MODULAR_DEPRECATION_ARG);
90
90
  }
91
91
 
92
+ let _id_SnapshotInSync = 0;
93
+
94
+ export function onSnapshotsInSync(firestore, callback) {
95
+ const listenerId = _id_SnapshotInSync++;
96
+ firestore.native.addSnapshotsInSync(listenerId);
97
+ const onSnapshotsInSyncSubscription = firestore.emitter.addListener(
98
+ firestore.eventNameForApp(`firestore_snapshots_in_sync_event:${listenerId}`),
99
+ () => {
100
+ callback();
101
+ },
102
+ );
103
+
104
+ return () => {
105
+ onSnapshotsInSyncSubscription.remove();
106
+ firestore.native.removeSnapshotsInSync(listenerId);
107
+ };
108
+ }
109
+
92
110
  /**
93
111
  * @param {DocumentReference} reference
94
112
  * @param {import('.').PartialWithFieldValue} data
@@ -100,11 +100,11 @@ export type QueryNonFilterConstraint =
100
100
  * @throws if any of the provided query constraints cannot be combined with the
101
101
  * existing or new constraints.
102
102
  */
103
- export function query<T>(
104
- query: Query<T>,
103
+ export declare function query<AppModelType, DbModelType extends DocumentData>(
104
+ query: Query<AppModelType, DbModelType>,
105
105
  compositeFilter: QueryCompositeFilterConstraint,
106
106
  ...queryConstraints: QueryNonFilterConstraint[]
107
- ): Query<T>;
107
+ ): Query<AppModelType, DbModelType>;
108
108
 
109
109
  /**
110
110
  * Creates a new immutable instance of {@link Query} that is extended to also
@@ -116,7 +116,10 @@ export function query<T>(
116
116
  * @throws if any of the provided query constraints cannot be combined with the
117
117
  * existing or new constraints.
118
118
  */
119
- export function query<T>(query: Query<T>, ...queryConstraints: IQueryConstraint[]): Query<T>;
119
+ export declare function query<AppModelType, DbModelType extends DocumentData>(
120
+ query: Query<AppModelType, DbModelType>,
121
+ ...queryConstraints: QueryConstraint[]
122
+ ): Query<AppModelType, DbModelType>;
120
123
 
121
124
  export function query<T>(
122
125
  query: Query<T>,
@@ -173,7 +176,7 @@ export type OrderByDirection = 'desc' | 'asc';
173
176
  */
174
177
  export function orderBy(
175
178
  fieldPath: string | FieldPath,
176
- directionStr: OrderByDirection = 'asc',
179
+ directionStr?: OrderByDirection = 'asc',
177
180
  ): QueryOrderByConstraint;
178
181
 
179
182
  /**
@@ -285,7 +288,9 @@ export declare function getDocFromServer<T>(
285
288
  *
286
289
  * @returns A `Promise` that will be resolved with the results of the query.
287
290
  */
288
- export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
291
+ export declare function getDocs<AppModelType, DbModelType extends DocumentData>(
292
+ query: Query<AppModelType, DbModelType>,
293
+ ): Promise<QuerySnapshot<AppModelType, DbModelType>>;
289
294
 
290
295
  /**
291
296
  * Executes the query and returns the results as a `QuerySnapshot` from cache.
@@ -294,7 +299,9 @@ export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
294
299
  *
295
300
  * @returns A `Promise` that will be resolved with the results of the query.
296
301
  */
297
- export function getDocsFromCache<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
302
+ export declare function getDocsFromCache<AppModelType, DbModelType extends DocumentData>(
303
+ query: Query<AppModelType, DbModelType>,
304
+ ): Promise<QuerySnapshot<AppModelType, DbModelType>>;
298
305
 
299
306
  /**
300
307
  * Executes the query and returns the results as a `QuerySnapshot` from the
@@ -302,7 +309,9 @@ export function getDocsFromCache<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
302
309
  *
303
310
  * @returns A `Promise` that will be resolved with the results of the query.
304
311
  */
305
- export function getDocsFromServer<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
312
+ export declare function getDocsFromServer<AppModelType, DbModelType extends DocumentData>(
313
+ query: Query<AppModelType, DbModelType>,
314
+ ): Promise<QuerySnapshot<AppModelType, DbModelType>>;
306
315
 
307
316
  /**
308
317
  * Deletes the document referred to by the specified `DocumentReference`.
@@ -311,53 +320,34 @@ export function getDocsFromServer<T>(query: Query<T>): Promise<QuerySnapshot<T>>
311
320
  * @returns A Promise resolved once the document has been successfully
312
321
  * deleted from the backend (note that it won't resolve while you're offline).
313
322
  */
314
- export function deleteDoc(reference: DocumentReference<unknown>): Promise<void>;
323
+ export declare function deleteDoc<AppModelType, DbModelType extends DocumentData>(
324
+ reference: DocumentReference<AppModelType, DbModelType>,
325
+ ): Promise<void>;
315
326
 
316
327
  /**
317
- * Creates a `QueryConstraint` with the specified ending point.
318
- *
319
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
320
- * allows you to choose arbitrary starting and ending points for your queries.
321
- *
322
- * The ending point is inclusive, so children with exactly the specified value
323
- * will be included in the query. The optional key argument can be used to
324
- * further limit the range of the query. If it is specified, then children that
325
- * have exactly the specified value must also have a key name less than or equal
326
- * to the specified key.
327
- *
328
- * You can read more about `endAt()` in
329
- * {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
328
+ * Creates a QueryEndAtConstraint that modifies the result set to end at the provided fields relative to the order of the query.
329
+ * The order of the field values must match the order of the order by clauses of the query.
330
330
  *
331
- * @param value - The value to end at. The argument type depends on which
332
- * `orderBy*()` function was used in this query. Specify a value that matches
333
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
334
- * value must be a string.
335
- * @param key - The child key to end at, among the children with the previously
336
- * specified priority. This argument is only allowed if ordering by child,
337
- * value, or priority.
331
+ * @param fieldValues
338
332
  */
339
- export function endAt(value: number | string | boolean | null, key?: string): QueryConstraint;
333
+ export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;
340
334
 
341
335
  /**
342
- * Creates a `QueryConstraint` with the specified ending point (exclusive).
343
- *
344
- * Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
345
- * allows you to choose arbitrary starting and ending points for your queries.
346
- *
347
- * The ending point is exclusive. If only a value is provided, children
348
- * with a value less than the specified value will be included in the query.
349
- * If a key is specified, then children must have a value less than or equal
350
- * to the specified value and a key name less than the specified key.
336
+ * reates a QueryEndAtConstraint that modifies the result set to end at the provided document (inclusive).
337
+ * The end position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of the query.
338
+ * @param snapshot
339
+ */
340
+ export function endAt<AppModelType, DbModelType extends DocumentData>(
341
+ snapshot: DocumentSnapshot<AppModelType, DbModelType>,
342
+ ): QueryEndAtConstraint;
343
+
344
+ /**
345
+ * Creates a QueryEndAtConstraint that modifies the result set to end before the provided fields relative to the order of the query.
346
+ * The order of the field values must match the order of the order by clauses of the query.
351
347
  *
352
- * @param value - The value to end before. The argument type depends on which
353
- * `orderBy*()` function was used in this query. Specify a value that matches
354
- * the `orderBy*()` type. When used in combination with `orderByKey()`, the
355
- * value must be a string.
356
- * @param key - The child key to end before, among the children with the
357
- * previously specified priority. This argument is only allowed if ordering by
358
- * child, value, or priority.
348
+ * @param fieldValues
359
349
  */
360
- export function endBefore(value: number | string | boolean | null, key?: string): QueryConstraint;
350
+ export declare function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint;
361
351
 
362
352
  /**
363
353
  * Creates a new `QueryConstraint` that is limited to return only the last
@@ -130,27 +130,25 @@ export function startAfter(...docOrFields) {
130
130
  }
131
131
 
132
132
  /**
133
- * @param {number | string | boolean | null} value
134
- * @param {string?} key
135
- * @returns {QueryConstraint}
133
+ * Creates a QueryEndAtConstraint that modifies the result set to end at the provided fields relative to the order of the query.
134
+ * The order of the field values must match the order of the order by clauses of the query.
135
+ *
136
+ * @param {*} ...args Can be either a DocumentSnapshot or an array of field values.
136
137
  */
137
- export function endAt(value, key) {
138
- if (!key) {
139
- return new QueryConstraint('endAt', value);
140
- }
141
- return new QueryConstraint('endAt', value, key);
138
+
139
+ export function endAt(...args) {
140
+ return new QueryConstraint('endAt', ...args);
142
141
  }
143
142
 
144
143
  /**
145
- * @param {number | string | boolean | null} value
146
- * @param {string?} key
147
- * @returns {QueryConstraint}
144
+ * Creates a QueryEndAtConstraint that modifies the result set to end before the provided fields relative to the order of the query.
145
+ * The order of the field values must match the order of the order by clauses of the query.
146
+ *
147
+ * @param {*} fieldValues
148
148
  */
149
- export function endBefore(value, key) {
150
- if (!key) {
151
- return new QueryConstraint('endBefore', value);
152
- }
153
- return new QueryConstraint('endBefore', value, key);
149
+
150
+ export function endBefore(...fieldValues) {
151
+ return new QueryConstraint('endBefore', ...fieldValues);
154
152
  }
155
153
 
156
154
  /**
@@ -117,10 +117,10 @@ export function onSnapshot<T>(
117
117
  * @returns An unsubscribe function that can be called to cancel
118
118
  * the snapshot listener.
119
119
  */
120
- export function onSnapshot<T>(
121
- query: Query<T>,
120
+ export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(
121
+ query: Query<AppModelType, DbModelType>,
122
122
  observer: {
123
- next?: (snapshot: QuerySnapshot<T>) => void;
123
+ next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
124
124
  error?: (error: FirestoreError) => void;
125
125
  complete?: () => void;
126
126
  },
@@ -140,11 +140,11 @@ export function onSnapshot<T>(
140
140
  * @returns An unsubscribe function that can be called to cancel
141
141
  * the snapshot listener.
142
142
  */
143
- export function onSnapshot<T>(
144
- query: Query<T>,
143
+ export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(
144
+ query: Query<AppModelType, DbModelType>,
145
145
  options: SnapshotListenOptions,
146
146
  observer: {
147
- next?: (snapshot: QuerySnapshot<T>) => void;
147
+ next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
148
148
  error?: (error: FirestoreError) => void;
149
149
  complete?: () => void;
150
150
  },
@@ -168,9 +168,9 @@ export function onSnapshot<T>(
168
168
  * @returns An unsubscribe function that can be called to cancel
169
169
  * the snapshot listener.
170
170
  */
171
- export function onSnapshot<T>(
172
- query: Query<T>,
173
- onNext: (snapshot: QuerySnapshot<T>) => void,
171
+ export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(
172
+ query: Query<AppModelType, DbModelType>,
173
+ onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void,
174
174
  onError?: (error: FirestoreError) => void,
175
175
  onCompletion?: () => void,
176
176
  ): Unsubscribe;
@@ -194,10 +194,10 @@ export function onSnapshot<T>(
194
194
  * @returns An unsubscribe function that can be called to cancel
195
195
  * the snapshot listener.
196
196
  */
197
- export function onSnapshot<T>(
198
- query: Query<T>,
197
+ export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(
198
+ query: Query<AppModelType, DbModelType>,
199
199
  options: SnapshotListenOptions,
200
- onNext: (snapshot: QuerySnapshot<T>) => void,
200
+ onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void,
201
201
  onError?: (error: FirestoreError) => void,
202
202
  onCompletion?: () => void,
203
203
  ): Unsubscribe;
@@ -227,3 +227,30 @@ export declare function queryEqual<AppModelType, DbModelType extends DocumentDat
227
227
  left: Query<AppModelType, DbModelType>,
228
228
  right: Query<AppModelType, DbModelType>,
229
229
  ): boolean;
230
+
231
+ /**
232
+ * Attaches a listener for a snapshots-in-sync event.
233
+ * The snapshots-in-sync event indicates that all listeners affected by a given change have fired, even if
234
+ * a single server-generated change affects multiple listeners.
235
+ *
236
+ * @param firestore
237
+ * @param observer
238
+ */
239
+ export declare function onSnapshotsInSync(
240
+ firestore: Firestore,
241
+ observer: {
242
+ next?: (value: void) => void;
243
+ error?: (error: FirestoreError) => void;
244
+ complete?: () => void;
245
+ },
246
+ ): Unsubscribe;
247
+
248
+ /**
249
+ * Attaches a listener for a snapshots-in-sync event.
250
+ * The snapshots-in-sync event indicates that all listeners affected by a given change have fired, even if
251
+ * a single server-generated change affects multiple listeners.
252
+ *
253
+ * @param firestore
254
+ * @param onSync
255
+ */
256
+ export declare function onSnapshotsInSync(firestore: Firestore, onSync: () => void): Unsubscribe;
@@ -18,3 +18,16 @@ export function onSnapshot(reference, ...args) {
18
18
  export function snapshotEqual(left, right) {
19
19
  return left.isEqual.call(left, right, MODULAR_DEPRECATION_ARG);
20
20
  }
21
+
22
+ /**
23
+ * Attaches a listener for a snapshots-in-sync event.
24
+ * The snapshots-in-sync event indicates that all listeners affected by a given change have fired, even if
25
+ * a single server-generated change affects multiple listeners.
26
+ *
27
+ * @param {*} firestore
28
+ * @param {...any} args
29
+ */
30
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
+ export function onSnapshotsInSync(firestore, ...args) {
32
+ throw new Error('onSnapshotsInSync() is not implemented');
33
+ }
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '22.2.0';
2
+ module.exports = '22.3.0';
@@ -132,6 +132,14 @@ export default {
132
132
  return rejectWithCodeAndMessage('unsupported', 'Not supported in the lite SDK.');
133
133
  },
134
134
 
135
+ addSnapshotsInSync() {
136
+ return rejectWithCodeAndMessage('unsupported', 'Not supported in the lite SDK.');
137
+ },
138
+
139
+ removeSnapshotsInSync() {
140
+ return rejectWithCodeAndMessage('unsupported', 'Not supported in the lite SDK.');
141
+ },
142
+
135
143
  /**
136
144
  * Use the Firestore emulator.
137
145
  * @param {string} appName - The app name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/firestore",
3
- "version": "22.2.0",
3
+ "version": "22.3.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - Cloud Firestore is a NoSQL cloud database to store and sync data between your React Native application and Firebase's database. The API matches the Firebase Web SDK whilst taking advantage of the native SDKs performance and offline capabilities.",
6
6
  "main": "lib/index.js",
@@ -26,12 +26,15 @@
26
26
  "realtime",
27
27
  "firestore"
28
28
  ],
29
+ "dependencies": {
30
+ "react-native-url-polyfill": "2.0.0"
31
+ },
29
32
  "peerDependencies": {
30
- "@react-native-firebase/app": "22.2.0"
33
+ "@react-native-firebase/app": "22.3.0"
31
34
  },
32
35
  "publishConfig": {
33
36
  "access": "public",
34
37
  "provenance": true
35
38
  },
36
- "gitHead": "b302210509ceac8078b5fb9fd0b24e68f0641c6a"
39
+ "gitHead": "c04f2a3b681460edde5518812646cf5e0dd86627"
37
40
  }