@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @firebase/firestore
2
2
 
3
+ ## 3.4.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b993aeec4`](https://github.com/firebase/firebase-js-sdk/commit/b993aeec4a8f5188d1f53d07808da079f3ade846) [#6550](https://github.com/firebase/firebase-js-sdk/pull/6550) (fixes [#5871](https://github.com/firebase/firebase-js-sdk/issues/5871)) - Fix FAILED_PRECONDITION when writing to a deleted document in a transaction (#5871)
8
+
3
9
  ## 3.4.14
4
10
 
5
11
  ### Patch Changes
@@ -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>;
package/dist/index.d.ts CHANGED
@@ -900,7 +900,15 @@ export declare function getDocsFromCache<T>(query: Query<T>): Promise<QuerySnaps
900
900
  */
901
901
  export declare function getDocsFromServer<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
902
902
  /**
903
- * Returns the existing {@link Firestore} instance that is associated with the
903
+ * Returns the existing default {@link Firestore} instance that is associated with the
904
+ * default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
905
+ * instance with default settings.
906
+ *
907
+ * @returns The {@link Firestore} instance of the provided app.
908
+ */
909
+ export declare function getFirestore(): Firestore;
910
+ /**
911
+ * Returns the existing default {@link Firestore} instance that is associated with the
904
912
  * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
905
913
  * instance with default settings.
906
914
  *
@@ -908,7 +916,9 @@ export declare function getDocsFromServer<T>(query: Query<T>): Promise<QuerySnap
908
916
  * instance is associated with.
909
917
  * @returns The {@link Firestore} instance of the provided app.
910
918
  */
911
- export declare function getFirestore(app?: FirebaseApp): Firestore;
919
+ export declare function getFirestore(app: FirebaseApp): Firestore;
920
+ /* Excluded declaration from this release type: getFirestore */
921
+ /* Excluded declaration from this release type: getFirestore */
912
922
  /**
913
923
  * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
914
924
  * @firebase/firestore/lite#(updateDoc:1)} that tells the server to increment the field's current value by
@@ -938,9 +948,10 @@ export declare function increment(n: number): FieldValue;
938
948
  * @param app - The {@link @firebase/app#FirebaseApp} with which the {@link Firestore} instance will
939
949
  * be associated.
940
950
  * @param settings - A settings object to configure the {@link Firestore} instance.
951
+ * @param databaseId - The name of database.
941
952
  * @returns A newly initialized {@link Firestore} instance.
942
953
  */
943
- export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings): Firestore;
954
+ export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings, databaseId?: string): Firestore;
944
955
  /* Excluded from this release type: _isBase64Available */
945
956
  /**
946
957
  * Creates a {@link QueryConstraint} that only returns the first matching documents.
@@ -66,7 +66,7 @@ C.MOCK_USER = new C("mock-user");
66
66
  * See the License for the specific language governing permissions and
67
67
  * limitations under the License.
68
68
  */
69
- let x = "9.9.2-canary.fcd4b8ac3";
69
+ let x = "9.9.4";
70
70
 
71
71
  /**
72
72
  * @license
@@ -2957,23 +2957,6 @@ class ue {
2957
2957
  }
2958
2958
  }
2959
2959
 
2960
- /**
2961
- * @license
2962
- * Copyright 2017 Google LLC
2963
- *
2964
- * Licensed under the Apache License, Version 2.0 (the "License");
2965
- * you may not use this file except in compliance with the License.
2966
- * You may obtain a copy of the License at
2967
- *
2968
- * http://www.apache.org/licenses/LICENSE-2.0
2969
- *
2970
- * Unless required by applicable law or agreed to in writing, software
2971
- * distributed under the License is distributed on an "AS IS" BASIS,
2972
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2973
- * See the License for the specific language governing permissions and
2974
- * limitations under the License.
2975
- */
2976
- /** Sentinel value that sorts before any Mutation Batch ID. */
2977
2960
  /**
2978
2961
  * Returns whether a variable is either undefined or null.
2979
2962
  */
@@ -15932,7 +15915,7 @@ class zc {
15932
15915
  let e;
15933
15916
  if (t.isFoundDocument()) e = t.version; else {
15934
15917
  if (!t.isNoDocument()) throw L();
15935
- // For deleted docs, we must use baseVersion 0 when we overwrite them.
15918
+ // Represent a deleted doc using SnapshotVersion.min().
15936
15919
  e = ct.min();
15937
15920
  }
15938
15921
  const n = this.readVersions.get(t.key.toString());
@@ -15947,7 +15930,7 @@ class zc {
15947
15930
  * as a precondition, or no precondition if it was not read.
15948
15931
  */ precondition(t) {
15949
15932
  const e = this.readVersions.get(t.toString());
15950
- return !this.writtenDocs.has(t.toString()) && e ? Ln.updateTime(e) : Ln.none();
15933
+ return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(ct.min()) ? Ln.exists(!1) : Ln.updateTime(e) : Ln.none();
15951
15934
  }
15952
15935
  /**
15953
15936
  * Returns the precondition for a document if the operation is an update.
@@ -16539,30 +16522,14 @@ class Ra {
16539
16522
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
16540
16523
  */ class ba {
16541
16524
  /** @hideconstructor */
16542
- constructor(t, e, n) {
16543
- this._authCredentials = e, this._appCheckCredentials = n,
16525
+ constructor(t, e, n, s) {
16526
+ this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
16527
+ this._app = s,
16544
16528
  /**
16545
16529
  * Whether it's a Firestore or Firestore Lite instance.
16546
16530
  */
16547
16531
  this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Ra({}),
16548
- this._settingsFrozen = !1, t instanceof ue ? this._databaseId = t : (this._app = t,
16549
- this._databaseId = function(t) {
16550
- if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new Q(G.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
16551
- return new ue(t.options.projectId);
16552
- }
16553
- /**
16554
- * Modify this instance to communicate with the Cloud Firestore emulator.
16555
- *
16556
- * Note: This must be called before this instance has been used to do any
16557
- * operations.
16558
- *
16559
- * @param firestore - The `Firestore` instance to configure to connect to the
16560
- * emulator.
16561
- * @param host - the emulator host (ex: localhost).
16562
- * @param port - the emulator port (ex: 9000).
16563
- * @param options.mockUserToken - the mock auth token to use for unit testing
16564
- * Security Rules.
16565
- */ (t));
16532
+ this._settingsFrozen = !1;
16566
16533
  }
16567
16534
  /**
16568
16535
  * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
@@ -16628,7 +16595,19 @@ class Ra {
16628
16595
  }
16629
16596
  }
16630
16597
 
16631
- function Pa(t, e, n, s = {}) {
16598
+ /**
16599
+ * Modify this instance to communicate with the Cloud Firestore emulator.
16600
+ *
16601
+ * Note: This must be called before this instance has been used to do any
16602
+ * operations.
16603
+ *
16604
+ * @param firestore - The `Firestore` instance to configure to connect to the
16605
+ * emulator.
16606
+ * @param host - the emulator host (ex: localhost).
16607
+ * @param port - the emulator port (ex: 9000).
16608
+ * @param options.mockUserToken - the mock auth token to use for unit testing
16609
+ * Security Rules.
16610
+ */ function Pa(t, e, n, s = {}) {
16632
16611
  var i;
16633
16612
  const r = (t = Ea(t, ba))._getSettings();
16634
16613
  if ("firestore.googleapis.com" !== r.host && r.host !== e && $("Host has been set in both settings() and useEmulator(), emulator host will be used"),
@@ -17167,12 +17146,12 @@ class Fa {
17167
17146
  */
17168
17147
  class Ba extends ba {
17169
17148
  /** @hideconstructor */
17170
- constructor(t, e, n) {
17171
- super(t, e, n),
17149
+ constructor(t, e, n, s) {
17150
+ super(t, e, n, s),
17172
17151
  /**
17173
17152
  * Whether it's a {@link Firestore} or Firestore Lite instance.
17174
17153
  */
17175
- this.type = "firestore", this._queue = new Ma, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
17154
+ this.type = "firestore", this._queue = new Ma, this._persistenceKey = (null == s ? void 0 : s.name) || "[DEFAULT]";
17176
17155
  }
17177
17156
  _terminate() {
17178
17157
  return this._firestoreClient ||
@@ -17191,30 +17170,30 @@ class Ba extends ba {
17191
17170
  * @param app - The {@link @firebase/app#FirebaseApp} with which the {@link Firestore} instance will
17192
17171
  * be associated.
17193
17172
  * @param settings - A settings object to configure the {@link Firestore} instance.
17173
+ * @param databaseId - The name of database.
17194
17174
  * @returns A newly initialized {@link Firestore} instance.
17195
- */ function La(t, e) {
17196
- const n = _getProvider(t, "firestore");
17197
- if (n.isInitialized()) {
17198
- const t = n.getImmediate(), s = n.getOptions();
17199
- if (deepEqual(s, e)) return t;
17175
+ */ function La(t, e, n) {
17176
+ n || (n = "(default)");
17177
+ const s = _getProvider(t, "firestore");
17178
+ if (s.isInitialized(n)) {
17179
+ const t = s.getImmediate({
17180
+ identifier: n
17181
+ }), i = s.getOptions(n);
17182
+ if (deepEqual(i, e)) return t;
17200
17183
  throw new Q(G.FAILED_PRECONDITION, "initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.");
17201
17184
  }
17202
17185
  if (void 0 !== e.cacheSizeBytes && -1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new Q(G.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
17203
- return n.initialize({
17204
- options: e
17186
+ return s.initialize({
17187
+ options: e,
17188
+ instanceIdentifier: n
17205
17189
  });
17206
17190
  }
17207
17191
 
17208
- /**
17209
- * Returns the existing {@link Firestore} instance that is associated with the
17210
- * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
17211
- * instance with default settings.
17212
- *
17213
- * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
17214
- * instance is associated with.
17215
- * @returns The {@link Firestore} instance of the provided app.
17216
- */ function Ua(e = getApp()) {
17217
- return _getProvider(e, "firestore").getImmediate();
17192
+ function Ua(e, n) {
17193
+ const s = "object" == typeof e ? e : getApp(), i = "string" == typeof e ? e : n || "(default)";
17194
+ return _getProvider(s, "firestore").getImmediate({
17195
+ identifier: i
17196
+ });
17218
17197
  }
17219
17198
 
17220
17199
  /**
@@ -17463,7 +17442,7 @@ function Wa(t) {
17463
17442
  * @returns A `Promise` that is resolved when the instance has been successfully
17464
17443
  * terminated.
17465
17444
  */ function Ya(t) {
17466
- return _removeServiceInstance(t.app, "firestore"), t._delete();
17445
+ return _removeServiceInstance(t.app, "firestore", t._databaseId.database), t._delete();
17467
17446
  }
17468
17447
 
17469
17448
  /**
@@ -19753,14 +19732,34 @@ function Fl(t, e) {
19753
19732
  */ !function(t, e = !0) {
19754
19733
  !function(t) {
19755
19734
  x = t;
19756
- }(SDK_VERSION), _registerComponent(new Component("firestore", ((t, {options: n}) => {
19757
- const s = t.getProvider("app").getImmediate(), i = new Ba(s, new J(t.getProvider("auth-internal")), new tt(t.getProvider("app-check-internal")));
19758
- return n = Object.assign({
19735
+ }(SDK_VERSION), _registerComponent(new Component("firestore", ((t, {instanceIdentifier: n, options: s}) => {
19736
+ const i = t.getProvider("app").getImmediate(), r = new Ba(new J(t.getProvider("auth-internal")), new tt(t.getProvider("app-check-internal")), function(t, e) {
19737
+ if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new Q(G.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
19738
+ return new ue(t.options.projectId, e);
19739
+ }
19740
+ /**
19741
+ * @license
19742
+ * Copyright 2017 Google LLC
19743
+ *
19744
+ * Licensed under the Apache License, Version 2.0 (the "License");
19745
+ * you may not use this file except in compliance with the License.
19746
+ * You may obtain a copy of the License at
19747
+ *
19748
+ * http://www.apache.org/licenses/LICENSE-2.0
19749
+ *
19750
+ * Unless required by applicable law or agreed to in writing, software
19751
+ * distributed under the License is distributed on an "AS IS" BASIS,
19752
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19753
+ * See the License for the specific language governing permissions and
19754
+ * limitations under the License.
19755
+ */
19756
+ /** Sentinel value that sorts before any Mutation Batch ID. */ (i, n), i);
19757
+ return s = Object.assign({
19759
19758
  useFetchStreams: e
19760
- }, n), i._setSettings(n), i;
19761
- }), "PUBLIC")), registerVersion(D, "3.4.14-canary.fcd4b8ac3", t),
19759
+ }, s), r._setSettings(s), r;
19760
+ }), "PUBLIC").setMultipleInstances(!0)), registerVersion(D, "3.4.15", t),
19762
19761
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
19763
- registerVersion(D, "3.4.14-canary.fcd4b8ac3", "esm2017");
19762
+ registerVersion(D, "3.4.15", "esm2017");
19764
19763
  }();
19765
19764
 
19766
19765
  export { cl as AbstractUserDataWriter, sh as Bytes, $a as CACHE_SIZE_UNLIMITED, Sa as CollectionReference, va as DocumentReference, Oh as DocumentSnapshot, eh as FieldPath, ih as FieldValue, Ba as Firestore, Q as FirestoreError, rh as GeoPoint, Fa as LoadBundleTask, Va as Query, qh as QueryConstraint, Fh as QueryDocumentSnapshot, $h as QuerySnapshot, Mh as SnapshotMetadata, ut as Timestamp, Vl as Transaction, ll as WriteBatch, ue as _DatabaseId, dt as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, ft as _FieldPath, Ea as _cast, q as _debugAssert, Yt as _isBase64Available, $ as _logWarn, ya as _validateIsNotUsedTogether, Al as addDoc, Nl as arrayRemove, xl as arrayUnion, Wa as clearIndexedDbPersistence, Da as collection, Ca as collectionGroup, Pa as connectFirestoreEmulator, El as deleteDoc, Dl as deleteField, Ja as disableNetwork, xa as doc, nh as documentId, Ga as enableIndexedDbPersistence, Qa as enableMultiTabIndexedDbPersistence, Ha as enableNetwork, nl as endAt, el as endBefore, qa as ensureFirestoreConfigured, Pl as executeWrite, dl as getDoc, wl as getDocFromCache, ml as getDocFromServer, gl as getDocs, yl as getDocsFromCache, pl as getDocsFromServer, Ua as getFirestore, kl as increment, La as initializeFirestore, Hh as limit, Jh as limitToLast, Xa as loadBundle, Za as namedQuery, Rl as onSnapshot, bl as onSnapshotsInSync, Wh as orderBy, Kh as query, ka as queryEqual, Na as refEqual, Sl as runTransaction, Cl as serverTimestamp, Il as setDoc, Ol as setIndexConfiguration, M as setLogLevel, Lh as snapshotEqual, Zh as startAfter, Xh as startAt, Ya as terminate, Tl as updateDoc, za as waitForPendingWrites, Qh as where, Ml as writeBatch };