@firebase/firestore 3.4.14-canary.fcd4b8ac3 → 3.4.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/firestore/src/api/database.d.ts +34 -3
  3. package/dist/firestore/src/core/database_info.d.ts +4 -0
  4. package/dist/firestore/src/lite-api/database.d.ts +51 -7
  5. package/dist/firestore/test/integration/api/provider.test.d.ts +17 -0
  6. package/dist/firestore/test/integration/util/firebase_export.d.ts +2 -1
  7. package/dist/firestore/test/integration/util/helpers.d.ts +1 -0
  8. package/dist/index.d.ts +14 -3
  9. package/dist/index.esm2017.js +67 -68
  10. package/dist/index.esm2017.js.map +1 -1
  11. package/dist/index.esm5.js +52 -55
  12. package/dist/index.esm5.js.map +1 -1
  13. package/dist/index.node.cjs.js +47 -42
  14. package/dist/index.node.cjs.js.map +1 -1
  15. package/dist/index.node.mjs +47 -42
  16. package/dist/index.node.mjs.map +1 -1
  17. package/dist/index.rn.js +67 -68
  18. package/dist/index.rn.js.map +1 -1
  19. package/dist/internal.d.ts +40 -6
  20. package/dist/lite/firestore/src/api/database.d.ts +34 -3
  21. package/dist/lite/firestore/src/core/database_info.d.ts +4 -0
  22. package/dist/lite/firestore/src/lite-api/database.d.ts +51 -7
  23. package/dist/lite/firestore/test/integration/api/provider.test.d.ts +17 -0
  24. package/dist/lite/firestore/test/integration/util/firebase_export.d.ts +2 -1
  25. package/dist/lite/firestore/test/integration/util/helpers.d.ts +1 -0
  26. package/dist/lite/index.browser.esm2017.js +43 -57
  27. package/dist/lite/index.browser.esm2017.js.map +1 -1
  28. package/dist/lite/index.browser.esm5.js +181 -184
  29. package/dist/lite/index.browser.esm5.js.map +1 -1
  30. package/dist/lite/index.d.ts +15 -4
  31. package/dist/lite/index.node.cjs.js +37 -45
  32. package/dist/lite/index.node.cjs.js.map +1 -1
  33. package/dist/lite/index.node.mjs +37 -45
  34. package/dist/lite/index.node.mjs.map +1 -1
  35. package/dist/lite/index.rn.esm2017.js +43 -57
  36. package/dist/lite/index.rn.esm2017.js.map +1 -1
  37. package/dist/lite/internal.d.ts +55 -7
  38. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +6 -43
  39. package/dist/lite/packages/firestore/src/api/database.d.ts +34 -3
  40. package/dist/lite/packages/firestore/src/core/database_info.d.ts +4 -0
  41. package/dist/lite/packages/firestore/src/lite-api/database.d.ts +51 -7
  42. package/dist/lite/packages/firestore/test/integration/api/provider.test.d.ts +17 -0
  43. package/dist/lite/packages/firestore/test/integration/util/firebase_export.d.ts +2 -1
  44. package/dist/lite/packages/firestore/test/integration/util/helpers.d.ts +1 -0
  45. package/dist/lite/private.d.ts +22 -7
  46. package/dist/packages/firestore/dist/index.esm2017.d.ts +20 -15
  47. package/dist/packages/firestore/src/api/database.d.ts +34 -3
  48. package/dist/packages/firestore/src/core/database_info.d.ts +4 -0
  49. package/dist/packages/firestore/src/lite-api/database.d.ts +51 -7
  50. package/dist/packages/firestore/test/integration/api/provider.test.d.ts +17 -0
  51. package/dist/packages/firestore/test/integration/util/firebase_export.d.ts +2 -1
  52. package/dist/packages/firestore/test/integration/util/helpers.d.ts +1 -0
  53. package/dist/private.d.ts +21 -7
  54. package/package.json +10 -9
@@ -979,18 +979,18 @@ declare abstract class Filter {
979
979
  export declare class Firestore implements FirestoreService {
980
980
  _authCredentials: CredentialsProvider<User>;
981
981
  _appCheckCredentials: CredentialsProvider<string>;
982
+ readonly _databaseId: DatabaseId;
983
+ readonly _app?: FirebaseApp | undefined;
982
984
  /**
983
985
  * Whether it's a Firestore or Firestore Lite instance.
984
986
  */
985
987
  type: 'firestore-lite' | 'firestore';
986
- readonly _databaseId: DatabaseId;
987
988
  readonly _persistenceKey: string;
988
989
  private _settings;
989
990
  private _settingsFrozen;
990
991
  private _terminateTask?;
991
- _app?: FirebaseApp;
992
992
  /** @hideconstructor */
993
- constructor(databaseIdOrApp: DatabaseId | FirebaseApp, _authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>);
993
+ constructor(_authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>, _databaseId: DatabaseId, _app?: FirebaseApp | undefined);
994
994
  /**
995
995
  * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
996
996
  * instance.
@@ -1555,15 +1555,48 @@ export declare function getDoc<T>(reference: DocumentReference<T>): Promise<Docu
1555
1555
  export declare function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
1556
1556
 
1557
1557
  /**
1558
- * Returns the existing `Firestore` instance that is associated with the
1558
+ * Returns the existing default {@link Firestore} instance that is associated with the
1559
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
1560
+ * instance with default settings.
1561
+ *
1562
+ * @returns The {@link Firestore} instance of the provided app.
1563
+ */
1564
+ export declare function getFirestore(): Firestore;
1565
+
1566
+ /**
1567
+ * Returns the existing default {@link Firestore} instance that is associated with the
1568
+ * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
1569
+ * instance with default settings.
1570
+ *
1571
+ * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
1572
+ * instance is associated with.
1573
+ * @returns The {@link Firestore} instance of the provided app.
1574
+ */
1575
+ export declare function getFirestore(app: FirebaseApp): Firestore;
1576
+
1577
+ /**
1578
+ * Returns the existing {@link Firestore} instance that is associated with the
1579
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
1580
+ * instance with default settings.
1581
+ *
1582
+ * @param databaseId - The name of database.
1583
+ * @returns The {@link Firestore} instance of the provided app.
1584
+ * @internal
1585
+ */
1586
+ export declare function getFirestore(databaseId: string): Firestore;
1587
+
1588
+ /**
1589
+ * Returns the existing {@link Firestore} instance that is associated with the
1559
1590
  * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
1560
1591
  * instance with default settings.
1561
1592
  *
1562
- * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
1593
+ * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
1563
1594
  * instance is associated with.
1564
- * @returns The `Firestore` instance of the provided app.
1595
+ * @param databaseId - The name of database.
1596
+ * @returns The {@link Firestore} instance of the provided app.
1597
+ * @internal
1565
1598
  */
1566
- export declare function getFirestore(app?: FirebaseApp): Firestore;
1599
+ export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
1567
1600
 
1568
1601
  /**
1569
1602
  * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
@@ -1603,6 +1636,21 @@ declare type IndexState = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR';
1603
1636
  */
1604
1637
  export declare function initializeFirestore(app: FirebaseApp, settings: Settings): Firestore;
1605
1638
 
1639
+ /**
1640
+ * Initializes a new instance of Cloud Firestore with the provided settings.
1641
+ * Can only be called before any other functions, including
1642
+ * {@link getFirestore}. If the custom settings are empty, this function is
1643
+ * equivalent to calling {@link getFirestore}.
1644
+ *
1645
+ * @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will
1646
+ * be associated.
1647
+ * @param settings - A settings object to configure the `Firestore` instance.
1648
+ * @param databaseId - The name of database.
1649
+ * @returns A newly initialized `Firestore` instance.
1650
+ * @internal
1651
+ */
1652
+ export declare function initializeFirestore(app: FirebaseApp, settings: Settings, databaseId?: string): Firestore;
1653
+
1606
1654
  /**
1607
1655
  * Creates a {@link QueryConstraint} that only returns the first matching documents.
1608
1656
  *
@@ -273,9 +273,11 @@ declare class wn {
273
273
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
274
274
  */ declare class an {
275
275
  /** @hideconstructor */
276
- constructor(t: any, e: any, n: any);
276
+ constructor(t: any, e: any, n: any, r: any);
277
277
  _authCredentials: any;
278
278
  _appCheckCredentials: any;
279
+ _databaseId: any;
280
+ _app: any;
279
281
  /**
280
282
  * Whether it's a Firestore or Firestore Lite instance.
281
283
  */
@@ -283,8 +285,6 @@ declare class wn {
283
285
  _persistenceKey: string;
284
286
  _settings: cn;
285
287
  _settingsFrozen: boolean;
286
- _databaseId: H;
287
- _app: any;
288
288
  /**
289
289
  * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
290
290
  * instance.
@@ -298,7 +298,7 @@ declare class wn {
298
298
  _terminateTask: Promise<void> | undefined;
299
299
  /** Returns a JSON-serializable representation of this `Firestore` instance. */ toJSON(): {
300
300
  app: any;
301
- databaseId: H;
301
+ databaseId: any;
302
302
  settings: cn;
303
303
  };
304
304
  /**
@@ -737,15 +737,7 @@ declare function yr(...t: any[]): pr;
737
737
  * @param query - The `Query` to execute.
738
738
  * @returns A Promise that will be resolved with the results of the query.
739
739
  */ declare function Rr(t: any): Promise<er>;
740
- /**
741
- * Returns the existing `Firestore` instance that is associated with the
742
- * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
743
- * instance with default settings.
744
- *
745
- * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
746
- * instance is associated with.
747
- * @returns The `Firestore` instance of the provided app.
748
- */ declare function ln(e?: import("@firebase/app").FirebaseApp): import("../../lite").Firestore;
740
+ declare function ln(e: any, n: any): import("../../lite").Firestore;
749
741
  /**
750
742
  * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
751
743
  * @firebase/firestore/lite#(updateDoc:1)} that tells the server to increment the field's current value by
@@ -765,7 +757,7 @@ declare function yr(...t: any[]): pr;
765
757
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
766
758
  * `updateDoc()`
767
759
  */ declare function qr(t: any): Mn;
768
- declare function hn(t: any, e: any): import("../../lite").Firestore;
760
+ declare function hn(t: any, e: any, n: any): import("../../lite").Firestore;
769
761
  /**
770
762
  * Creates a {@link QueryConstraint} that only returns the first matching documents.
771
763
  *
@@ -957,19 +949,6 @@ declare class cn {
957
949
  useFetchStreams: boolean;
958
950
  isEqual(t: any): boolean;
959
951
  }
960
- /** The default database name for a project. */
961
- /**
962
- * Represents the database ID a Firestore client is associated with.
963
- * @internal
964
- */
965
- declare class H {
966
- static empty(): H;
967
- constructor(t: any, e: any);
968
- projectId: any;
969
- database: any;
970
- get isDefaultDatabase(): boolean;
971
- isEqual(t: any): boolean;
972
- }
973
952
  import { FirebaseError as c } from "@firebase/util/dist/src/errors";
974
953
  /**
975
954
  * Helper for parsing raw user input (provided via the API) into internal model
@@ -1043,22 +1022,6 @@ declare class or extends sr {
1043
1022
  type: string;
1044
1023
  _apply(t: any): mn;
1045
1024
  }
1046
- /**
1047
- * @license
1048
- * Copyright 2017 Google LLC
1049
- *
1050
- * Licensed under the Apache License, Version 2.0 (the "License");
1051
- * you may not use this file except in compliance with the License.
1052
- * You may obtain a copy of the License at
1053
- *
1054
- * http://www.apache.org/licenses/LICENSE-2.0
1055
- *
1056
- * Unless required by applicable law or agreed to in writing, software
1057
- * distributed under the License is distributed on an "AS IS" BASIS,
1058
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1059
- * See the License for the specific language governing permissions and
1060
- * limitations under the License.
1061
- */
1062
1025
  /**
1063
1026
  * Path represents an ordered sequence of string segments.
1064
1027
  */
@@ -50,7 +50,7 @@ export declare class Firestore extends LiteFirestore {
50
50
  readonly _persistenceKey: string;
51
51
  _firestoreClient: FirestoreClient | undefined;
52
52
  /** @hideconstructor */
53
- constructor(databaseIdOrApp: DatabaseId | FirebaseApp, authCredentialsProvider: CredentialsProvider<User>, appCheckCredentialsProvider: CredentialsProvider<string>);
53
+ constructor(authCredentialsProvider: CredentialsProvider<User>, appCheckCredentialsProvider: CredentialsProvider<string>, databaseId: DatabaseId, app?: FirebaseApp);
54
54
  _terminate(): Promise<void>;
55
55
  }
56
56
  /**
@@ -62,9 +62,38 @@ export declare class Firestore extends LiteFirestore {
62
62
  * @param app - The {@link @firebase/app#FirebaseApp} with which the {@link Firestore} instance will
63
63
  * be associated.
64
64
  * @param settings - A settings object to configure the {@link Firestore} instance.
65
+ * @param databaseId - The name of database.
65
66
  * @returns A newly initialized {@link Firestore} instance.
66
67
  */
67
- export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings): Firestore;
68
+ export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings, databaseId?: string): Firestore;
69
+ /**
70
+ * Returns the existing default {@link Firestore} instance that is associated with the
71
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
72
+ * instance with default settings.
73
+ *
74
+ * @returns The {@link Firestore} instance of the provided app.
75
+ */
76
+ export declare function getFirestore(): Firestore;
77
+ /**
78
+ * Returns the existing default {@link Firestore} instance that is associated with the
79
+ * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
80
+ * instance with default settings.
81
+ *
82
+ * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
83
+ * instance is associated with.
84
+ * @returns The {@link Firestore} instance of the provided app.
85
+ */
86
+ export declare function getFirestore(app: FirebaseApp): Firestore;
87
+ /**
88
+ * Returns the existing {@link Firestore} instance that is associated with the
89
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
90
+ * instance with default settings.
91
+ *
92
+ * @param databaseId - The name of database.
93
+ * @returns The {@link Firestore} instance of the provided app.
94
+ * @internal
95
+ */
96
+ export declare function getFirestore(databaseId: string): Firestore;
68
97
  /**
69
98
  * Returns the existing {@link Firestore} instance that is associated with the
70
99
  * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
@@ -72,9 +101,11 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Firestor
72
101
  *
73
102
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
74
103
  * instance is associated with.
104
+ * @param databaseId - The name of database.
75
105
  * @returns The {@link Firestore} instance of the provided app.
106
+ * @internal
76
107
  */
77
- export declare function getFirestore(app?: FirebaseApp): Firestore;
108
+ export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
78
109
  /**
79
110
  * @internal
80
111
  */
@@ -1,3 +1,4 @@
1
+ import { FirebaseApp } from '@firebase/app';
1
2
  /**
2
3
  * @license
3
4
  * Copyright 2017 Google LLC
@@ -42,6 +43,8 @@ export declare class DatabaseInfo {
42
43
  */
43
44
  constructor(databaseId: DatabaseId, appId: string, persistenceKey: string, host: string, ssl: boolean, forceLongPolling: boolean, autoDetectLongPolling: boolean, useFetchStreams: boolean);
44
45
  }
46
+ /** The default database name for a project. */
47
+ export declare const DEFAULT_DATABASE_NAME = "(default)";
45
48
  /**
46
49
  * Represents the database ID a Firestore client is associated with.
47
50
  * @internal
@@ -54,3 +57,4 @@ export declare class DatabaseId {
54
57
  get isDefaultDatabase(): boolean;
55
58
  isEqual(other: {}): boolean;
56
59
  }
60
+ export declare function databaseIdFromApp(app: FirebaseApp, database?: string): DatabaseId;
@@ -34,18 +34,18 @@ declare module '@firebase/component' {
34
34
  export declare class Firestore implements FirestoreService {
35
35
  _authCredentials: CredentialsProvider<User>;
36
36
  _appCheckCredentials: CredentialsProvider<string>;
37
+ readonly _databaseId: DatabaseId;
38
+ readonly _app?: FirebaseApp | undefined;
37
39
  /**
38
40
  * Whether it's a Firestore or Firestore Lite instance.
39
41
  */
40
42
  type: 'firestore-lite' | 'firestore';
41
- readonly _databaseId: DatabaseId;
42
43
  readonly _persistenceKey: string;
43
44
  private _settings;
44
45
  private _settingsFrozen;
45
46
  private _terminateTask?;
46
- _app?: FirebaseApp;
47
47
  /** @hideconstructor */
48
- constructor(databaseIdOrApp: DatabaseId | FirebaseApp, _authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>);
48
+ constructor(_authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>, _databaseId: DatabaseId, _app?: FirebaseApp | undefined);
49
49
  /**
50
50
  * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
51
51
  * instance.
@@ -81,15 +81,59 @@ export declare class Firestore implements FirestoreService {
81
81
  */
82
82
  export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings): Firestore;
83
83
  /**
84
- * Returns the existing `Firestore` instance that is associated with the
84
+ * Initializes a new instance of Cloud Firestore with the provided settings.
85
+ * Can only be called before any other functions, including
86
+ * {@link getFirestore}. If the custom settings are empty, this function is
87
+ * equivalent to calling {@link getFirestore}.
88
+ *
89
+ * @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will
90
+ * be associated.
91
+ * @param settings - A settings object to configure the `Firestore` instance.
92
+ * @param databaseId - The name of database.
93
+ * @returns A newly initialized `Firestore` instance.
94
+ * @internal
95
+ */
96
+ export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings, databaseId?: string): Firestore;
97
+ /**
98
+ * Returns the existing default {@link Firestore} instance that is associated with the
99
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
100
+ * instance with default settings.
101
+ *
102
+ * @returns The {@link Firestore} instance of the provided app.
103
+ */
104
+ export declare function getFirestore(): Firestore;
105
+ /**
106
+ * Returns the existing default {@link Firestore} instance that is associated with the
107
+ * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
108
+ * instance with default settings.
109
+ *
110
+ * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
111
+ * instance is associated with.
112
+ * @returns The {@link Firestore} instance of the provided app.
113
+ */
114
+ export declare function getFirestore(app: FirebaseApp): Firestore;
115
+ /**
116
+ * Returns the existing {@link Firestore} instance that is associated with the
117
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
118
+ * instance with default settings.
119
+ *
120
+ * @param databaseId - The name of database.
121
+ * @returns The {@link Firestore} instance of the provided app.
122
+ * @internal
123
+ */
124
+ export declare function getFirestore(databaseId: string): Firestore;
125
+ /**
126
+ * Returns the existing {@link Firestore} instance that is associated with the
85
127
  * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
86
128
  * instance with default settings.
87
129
  *
88
- * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
130
+ * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
89
131
  * instance is associated with.
90
- * @returns The `Firestore` instance of the provided app.
132
+ * @param databaseId - The name of database.
133
+ * @returns The {@link Firestore} instance of the provided app.
134
+ * @internal
91
135
  */
92
- export declare function getFirestore(app?: FirebaseApp): Firestore;
136
+ export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
93
137
  export { EmulatorMockTokenOptions } from '@firebase/util';
94
138
  /**
95
139
  * Modify this instance to communicate with the Cloud Firestore emulator.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
@@ -17,6 +17,7 @@
17
17
  import { FirebaseApp } from '@firebase/app';
18
18
  import { Firestore } from '../../../src';
19
19
  import { PrivateSettings } from '../../../src/lite-api/settings';
20
- export declare function newTestFirestore(projectId: string, nameOrApp?: string | FirebaseApp, settings?: PrivateSettings): Firestore;
20
+ export declare function newTestApp(projectId: string, appName?: string): FirebaseApp;
21
+ export declare function newTestFirestore(app: FirebaseApp, settings?: PrivateSettings, dbName?: string): Firestore;
21
22
  export * from '../../../src';
22
23
  export { PrivateSettings };
@@ -37,6 +37,7 @@ export declare function withTestDb(persistence: boolean, fn: (db: Firestore) =>
37
37
  export declare function withAlternateTestDb(persistence: boolean, fn: (db: Firestore) => Promise<void>): Promise<void>;
38
38
  export declare function withTestDbs(persistence: boolean, numDbs: number, fn: (db: Firestore[]) => Promise<void>): Promise<void>;
39
39
  export declare function withTestDbsSettings(persistence: boolean, projectId: string, settings: PrivateSettings, numDbs: number, fn: (db: Firestore[]) => Promise<void>): Promise<void>;
40
+ export declare function withNamedTestDbsOrSkipUnlessUsingEmulator(persistence: boolean, dbNames: string[], fn: (db: Firestore[]) => Promise<void>): Promise<void>;
40
41
  export declare function withTestDoc(persistence: boolean, fn: (doc: DocumentReference, db: Firestore) => Promise<void>): Promise<void>;
41
42
  export declare function withTestDocAndSettings(persistence: boolean, settings: PrivateSettings, fn: (doc: DocumentReference) => Promise<void>): Promise<void>;
42
43
  export declare function withTestDocAndInitialData(persistence: boolean, initialData: DocumentData | null, fn: (doc: DocumentReference, db: Firestore) => Promise<void>): Promise<void>;
@@ -856,18 +856,18 @@ declare abstract class Filter {
856
856
  export declare class Firestore implements FirestoreService {
857
857
  _authCredentials: CredentialsProvider<User>;
858
858
  _appCheckCredentials: CredentialsProvider<string>;
859
+ readonly _databaseId: DatabaseId;
860
+ readonly _app?: FirebaseApp | undefined;
859
861
  /**
860
862
  * Whether it's a Firestore or Firestore Lite instance.
861
863
  */
862
864
  type: 'firestore-lite' | 'firestore';
863
- readonly _databaseId: DatabaseId;
864
865
  readonly _persistenceKey: string;
865
866
  private _settings;
866
867
  private _settingsFrozen;
867
868
  private _terminateTask?;
868
- _app?: FirebaseApp;
869
869
  /** @hideconstructor */
870
- constructor(databaseIdOrApp: DatabaseId | FirebaseApp, _authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>);
870
+ constructor(_authCredentials: CredentialsProvider<User>, _appCheckCredentials: CredentialsProvider<string>, _databaseId: DatabaseId, _app?: FirebaseApp | undefined);
871
871
  /**
872
872
  * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
873
873
  * instance.
@@ -1432,15 +1432,28 @@ export declare function getDoc<T>(reference: DocumentReference<T>): Promise<Docu
1432
1432
  export declare function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
1433
1433
 
1434
1434
  /**
1435
- * Returns the existing `Firestore` instance that is associated with the
1435
+ * Returns the existing default {@link Firestore} instance that is associated with the
1436
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
1437
+ * instance with default settings.
1438
+ *
1439
+ * @returns The {@link Firestore} instance of the provided app.
1440
+ */
1441
+ export declare function getFirestore(): Firestore;
1442
+
1443
+ /**
1444
+ * Returns the existing default {@link Firestore} instance that is associated with the
1436
1445
  * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
1437
1446
  * instance with default settings.
1438
1447
  *
1439
- * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
1448
+ * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
1440
1449
  * instance is associated with.
1441
- * @returns The `Firestore` instance of the provided app.
1450
+ * @returns The {@link Firestore} instance of the provided app.
1442
1451
  */
1443
- export declare function getFirestore(app?: FirebaseApp): Firestore;
1452
+ export declare function getFirestore(app: FirebaseApp): Firestore;
1453
+
1454
+ /* Excluded declaration from this release type: getFirestore */
1455
+
1456
+ /* Excluded declaration from this release type: getFirestore */
1444
1457
 
1445
1458
  /**
1446
1459
  * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
@@ -1480,6 +1493,8 @@ declare type IndexState = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR';
1480
1493
  */
1481
1494
  export declare function initializeFirestore(app: FirebaseApp, settings: Settings): Firestore;
1482
1495
 
1496
+ /* Excluded declaration from this release type: initializeFirestore */
1497
+
1483
1498
  /**
1484
1499
  * Creates a {@link QueryConstraint} that only returns the first matching documents.
1485
1500
  *
@@ -845,7 +845,19 @@ declare function Da(t: any, e: any, ...n: any[]): Sa;
845
845
  * will be included. Cannot contain a slash.
846
846
  * @returns The created `Query`.
847
847
  */ declare function Ca(t: any, e: any): Va;
848
- declare function Pa(t: any, e: any, n: any, s?: {}): void;
848
+ /**
849
+ * Modify this instance to communicate with the Cloud Firestore emulator.
850
+ *
851
+ * Note: This must be called before this instance has been used to do any
852
+ * operations.
853
+ *
854
+ * @param firestore - The `Firestore` instance to configure to connect to the
855
+ * emulator.
856
+ * @param host - the emulator host (ex: localhost).
857
+ * @param port - the emulator port (ex: 9000).
858
+ * @param options.mockUserToken - the mock auth token to use for unit testing
859
+ * Security Rules.
860
+ */ declare function Pa(t: any, e: any, n: any, s?: {}): void;
849
861
  /**
850
862
  * Deletes the document referred to by the specified `DocumentReference`.
851
863
  *
@@ -1034,15 +1046,7 @@ declare function dl(t: any): Promise<Oh>;
1034
1046
  *
1035
1047
  * @returns A `Promise` that will be resolved with the results of the query.
1036
1048
  */ declare function pl(t: any): Promise<$h>;
1037
- /**
1038
- * Returns the existing {@link Firestore} instance that is associated with the
1039
- * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
1040
- * instance with default settings.
1041
- *
1042
- * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
1043
- * instance is associated with.
1044
- * @returns The {@link Firestore} instance of the provided app.
1045
- */ declare function Ua(e?: import("@firebase/app").FirebaseApp): import("../src").Firestore;
1049
+ declare function Ua(e: any, n: any): import("../src").Firestore;
1046
1050
  /**
1047
1051
  * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
1048
1052
  * @firebase/firestore/lite#(updateDoc:1)} that tells the server to increment the field's current value by
@@ -1071,8 +1075,9 @@ declare function dl(t: any): Promise<Oh>;
1071
1075
  * @param app - The {@link @firebase/app#FirebaseApp} with which the {@link Firestore} instance will
1072
1076
  * be associated.
1073
1077
  * @param settings - A settings object to configure the {@link Firestore} instance.
1078
+ * @param databaseId - The name of database.
1074
1079
  * @returns A newly initialized {@link Firestore} instance.
1075
- */ declare function La(t: any, e: any): import("../src").Firestore;
1080
+ */ declare function La(t: any, e: any, n: any): import("../src").Firestore;
1076
1081
  /**
1077
1082
  * Creates a {@link QueryConstraint} that only returns the first matching documents.
1078
1083
  *
@@ -1368,9 +1373,11 @@ declare function Tl(t: any, e: any, n: any, ...s: any[]): Promise<any>;
1368
1373
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
1369
1374
  */ declare class ba {
1370
1375
  /** @hideconstructor */
1371
- constructor(t: any, e: any, n: any);
1376
+ constructor(t: any, e: any, n: any, s: any);
1372
1377
  _authCredentials: any;
1373
1378
  _appCheckCredentials: any;
1379
+ _databaseId: any;
1380
+ _app: any;
1374
1381
  /**
1375
1382
  * Whether it's a Firestore or Firestore Lite instance.
1376
1383
  */
@@ -1378,8 +1385,6 @@ declare function Tl(t: any, e: any, n: any, ...s: any[]): Promise<any>;
1378
1385
  _persistenceKey: string;
1379
1386
  _settings: Ra;
1380
1387
  _settingsFrozen: boolean;
1381
- _databaseId: ue;
1382
- _app: any;
1383
1388
  /**
1384
1389
  * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
1385
1390
  * instance.
@@ -1393,7 +1398,7 @@ declare function Tl(t: any, e: any, n: any, ...s: any[]): Promise<any>;
1393
1398
  _terminateTask: Promise<void> | undefined;
1394
1399
  /** Returns a JSON-serializable representation of this `Firestore` instance. */ toJSON(): {
1395
1400
  app: any;
1396
- databaseId: ue;
1401
+ databaseId: any;
1397
1402
  settings: Ra;
1398
1403
  };
1399
1404
  /**
@@ -50,7 +50,7 @@ export declare class Firestore extends LiteFirestore {
50
50
  readonly _persistenceKey: string;
51
51
  _firestoreClient: FirestoreClient | undefined;
52
52
  /** @hideconstructor */
53
- constructor(databaseIdOrApp: DatabaseId | FirebaseApp, authCredentialsProvider: CredentialsProvider<User>, appCheckCredentialsProvider: CredentialsProvider<string>);
53
+ constructor(authCredentialsProvider: CredentialsProvider<User>, appCheckCredentialsProvider: CredentialsProvider<string>, databaseId: DatabaseId, app?: FirebaseApp);
54
54
  _terminate(): Promise<void>;
55
55
  }
56
56
  /**
@@ -62,9 +62,38 @@ export declare class Firestore extends LiteFirestore {
62
62
  * @param app - The {@link @firebase/app#FirebaseApp} with which the {@link Firestore} instance will
63
63
  * be associated.
64
64
  * @param settings - A settings object to configure the {@link Firestore} instance.
65
+ * @param databaseId - The name of database.
65
66
  * @returns A newly initialized {@link Firestore} instance.
66
67
  */
67
- export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings): Firestore;
68
+ export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings, databaseId?: string): Firestore;
69
+ /**
70
+ * Returns the existing default {@link Firestore} instance that is associated with the
71
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
72
+ * instance with default settings.
73
+ *
74
+ * @returns The {@link Firestore} instance of the provided app.
75
+ */
76
+ export declare function getFirestore(): Firestore;
77
+ /**
78
+ * Returns the existing default {@link Firestore} instance that is associated with the
79
+ * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
80
+ * instance with default settings.
81
+ *
82
+ * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
83
+ * instance is associated with.
84
+ * @returns The {@link Firestore} instance of the provided app.
85
+ */
86
+ export declare function getFirestore(app: FirebaseApp): Firestore;
87
+ /**
88
+ * Returns the existing {@link Firestore} instance that is associated with the
89
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
90
+ * instance with default settings.
91
+ *
92
+ * @param databaseId - The name of database.
93
+ * @returns The {@link Firestore} instance of the provided app.
94
+ * @internal
95
+ */
96
+ export declare function getFirestore(databaseId: string): Firestore;
68
97
  /**
69
98
  * Returns the existing {@link Firestore} instance that is associated with the
70
99
  * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
@@ -72,9 +101,11 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Firestor
72
101
  *
73
102
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
74
103
  * instance is associated with.
104
+ * @param databaseId - The name of database.
75
105
  * @returns The {@link Firestore} instance of the provided app.
106
+ * @internal
76
107
  */
77
- export declare function getFirestore(app?: FirebaseApp): Firestore;
108
+ export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
78
109
  /**
79
110
  * @internal
80
111
  */
@@ -1,3 +1,4 @@
1
+ import { FirebaseApp } from '@firebase/app';
1
2
  /**
2
3
  * @license
3
4
  * Copyright 2017 Google LLC
@@ -42,6 +43,8 @@ export declare class DatabaseInfo {
42
43
  */
43
44
  constructor(databaseId: DatabaseId, appId: string, persistenceKey: string, host: string, ssl: boolean, forceLongPolling: boolean, autoDetectLongPolling: boolean, useFetchStreams: boolean);
44
45
  }
46
+ /** The default database name for a project. */
47
+ export declare const DEFAULT_DATABASE_NAME = "(default)";
45
48
  /**
46
49
  * Represents the database ID a Firestore client is associated with.
47
50
  * @internal
@@ -54,3 +57,4 @@ export declare class DatabaseId {
54
57
  get isDefaultDatabase(): boolean;
55
58
  isEqual(other: {}): boolean;
56
59
  }
60
+ export declare function databaseIdFromApp(app: FirebaseApp, database?: string): DatabaseId;