Skip to content

Commit 9cc1eea

Browse files
Merge master into release
2 parents 767d41a + 59c7b58 commit 9cc1eea

File tree

18 files changed

+280
-57
lines changed

18 files changed

+280
-57
lines changed

.changeset/hungry-zebras-laugh.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": minor
3+
---
4+
5+
Expose the MultiDB API for Public Preview. [#7356](https://github.com/firebase/firebase-js-sdk/pull/7356)

.github/ISSUE_TEMPLATE/bug_report_v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: 🐞 Bug Report
22
description: File a bug report
33
title: 'Title for the bug'
4-
labels: 'new, type: question'
4+
labels: 'question, new'
55
body:
66
- type: markdown
77
id: before-you-start

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ Please see [Environment Support](https://firebase.google.com/support/guides/envi
2929
#### Node.js
3030

3131
Before you can start working on the Firebase JS SDK, you need to have Node.js
32-
installed on your machine. The currently supported versions are `10.15.0` through `16.6.0`.
32+
installed on your machine. As of June 13th, 2023 the team has been testing with Node.js versions
33+
between `16.4.0` and `16.16.0`, but the required verison of Node.js may change as we update
34+
our dependencies.
3335

3436
To download Node.js visit https://nodejs.org/en/download/.
3537

@@ -50,7 +52,7 @@ $ yarn set version 1.22.11
5052

5153
#### Java
5254

53-
The closure compiler requires a modern Java installation. Java 11+ should be installed: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
55+
The closure compiler requires a modern Java installation. Java 11+ should be installed: https://www.oracle.com/java/technologies/downloads/#java11
5456

5557
#### Verify Prerequisites
5658

@@ -62,7 +64,7 @@ $ yarn -v
6264
$ java -version
6365
```
6466

65-
Your `node` version should be between `10.15.0` and `16.6.0`, your `yarn` version should
67+
Your `node` version should be between `16.4.0` and `16.6.0`, your `yarn` version should
6668
be between `1.0.0` and `1.22.11`, and your `java` version should be `11.0` or greater.
6769

6870
_NOTE: We will update the documentation as new versions are required, however

common/api-review/firestore-lite.api.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,21 @@ export function getFirestore(): Firestore;
218218
// @public
219219
export function getFirestore(app: FirebaseApp): Firestore;
220220

221+
// @beta
222+
export function getFirestore(databaseId: string): Firestore;
223+
224+
// @beta
225+
export function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
226+
221227
// @public
222228
export function increment(n: number): FieldValue;
223229

224230
// @public
225231
export function initializeFirestore(app: FirebaseApp, settings: Settings): Firestore;
226232

233+
// @beta
234+
export function initializeFirestore(app: FirebaseApp, settings: Settings, databaseId?: string): Firestore;
235+
227236
// @public
228237
export function limit(limit: number): QueryLimitConstraint;
229238

common/api-review/firestore.api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,15 @@ export function getDocsFromServer<T>(query: Query<T>): Promise<QuerySnapshot<T>>
277277
// @public
278278
export function getFirestore(app: FirebaseApp): Firestore;
279279

280+
// @beta
281+
export function getFirestore(databaseId: string): Firestore;
282+
280283
// @public
281284
export function getFirestore(): Firestore;
282285

286+
// @beta
287+
export function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
288+
283289
// @public
284290
export function increment(n: number): FieldValue;
285291

docs-devsite/firestore_.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ https://github.com/firebase/firebase-js-sdk
1717
| --- | --- |
1818
| <b>function(app...)</b> |
1919
| [getFirestore(app)](./firestore_.md#getfirestore) | Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
20+
| [getFirestore(app, databaseId)](./firestore_.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
2021
| [initializeFirestore(app, settings, databaseId)](./firestore_.md#initializefirestore) | Initializes a new instance of [Firestore](./firestore_.firestore.md#firestore_class) with the provided settings. Can only be called before any other function, including [getFirestore()](./firestore_.md#getfirestore)<!-- -->. If the custom settings are empty, this function is equivalent to calling [getFirestore()](./firestore_.md#getfirestore)<!-- -->. |
2122
| <b>function(firestore...)</b> |
2223
| [clearIndexedDbPersistence(firestore)](./firestore_.md#clearindexeddbpersistence) | Clears the persistent storage. This includes pending writes and cached documents.<!-- -->Must be called while the [Firestore](./firestore_.firestore.md#firestore_class) instance is not started (after the app is terminated or when the app is first initialized). On startup, this function must be called before other functions (other than [initializeFirestore()](./firestore_.md#initializefirestore) or [getFirestore()](./firestore_.md#getfirestore)<!-- -->)). If the [Firestore](./firestore_.firestore.md#firestore_class) instance is still running, the promise will be rejected with the error code of <code>failed-precondition</code>.<!-- -->Note: <code>clearIndexedDbPersistence()</code> is primarily intended to help write reliable tests that use Cloud Firestore. It uses an efficient mechanism for dropping existing data but does not attempt to securely overwrite or otherwise make cached data unrecoverable. For applications that are sensitive to the disclosure of cached data in between user sessions, we strongly recommend not enabling persistence at all. |
@@ -45,6 +46,8 @@ https://github.com/firebase/firebase-js-sdk
4546
| [memoryEagerGarbageCollector()](./firestore_.md#memoryeagergarbagecollector) | Creates an instance of <code>MemoryEagerGarbageCollector</code>. This is also the default garbage collector unless it is explicitly specified otherwise. |
4647
| [persistentMultipleTabManager()](./firestore_.md#persistentmultipletabmanager) | Creates an instance of <code>PersistentMultipleTabManager</code>. |
4748
| [serverTimestamp()](./firestore_.md#servertimestamp) | Returns a sentinel used with [setDoc()](./firestore_lite.md#setdoc) or [updateDoc()](./firestore_lite.md#updatedoc) to include a server-generated timestamp in the written data. |
49+
| <b>function(databaseId...)</b> |
50+
| [getFirestore(databaseId)](./firestore_.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
4851
| <b>function(elements...)</b> |
4952
| [arrayRemove(elements)](./firestore_.md#arrayremove) | Returns a special value that can be used with [setDoc()](./firestore_.md#setdoc) or that tells the server to remove the given elements from any array value that already exists on the server. All instances of each element specified will be removed from the array. If the field being modified is not already an array it will be overwritten with an empty array. |
5053
| [arrayUnion(elements)](./firestore_.md#arrayunion) | Returns a special value that can be used with [setDoc()](./firestore_lite.md#setdoc) or [updateDoc()](./firestore_lite.md#updatedoc) that tells the server to union the given elements with any array value that already exists on the server. Each specified element that doesn't already exist in the array will be added to the end. If the field being modified is not already an array it will be overwritten with an array containing exactly the specified elements. |
@@ -226,6 +229,32 @@ export declare function getFirestore(app: FirebaseApp): Firestore;
226229

227230
The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
228231

232+
## getFirestore()
233+
234+
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
235+
>
236+
237+
Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.
238+
239+
<b>Signature:</b>
240+
241+
```typescript
242+
export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
243+
```
244+
245+
### Parameters
246+
247+
| Parameter | Type | Description |
248+
| --- | --- | --- |
249+
| app | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) instance that the returned [Firestore](./firestore_.firestore.md#firestore_class) instance is associated with. |
250+
| databaseId | string | The name of the database. |
251+
252+
<b>Returns:</b>
253+
254+
[Firestore](./firestore_.firestore.md#firestore_class)
255+
256+
The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
257+
229258
## initializeFirestore()
230259

231260
Initializes a new instance of [Firestore](./firestore_.firestore.md#firestore_class) with the provided settings. Can only be called before any other function, including [getFirestore()](./firestore_.md#getfirestore)<!-- -->. If the custom settings are empty, this function is equivalent to calling [getFirestore()](./firestore_.md#getfirestore)<!-- -->.
@@ -242,7 +271,7 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Firestor
242271
| --- | --- | --- |
243272
| app | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) with which the [Firestore](./firestore_.firestore.md#firestore_class) instance will be associated. |
244273
| settings | [FirestoreSettings](./firestore_.firestoresettings.md#firestoresettings_interface) | A settings object to configure the [Firestore](./firestore_.firestore.md#firestore_class) instance. |
245-
| databaseId | string | The name of database. |
274+
| databaseId | string | The name of the database. |
246275

247276
<b>Returns:</b>
248277

@@ -855,6 +884,31 @@ export declare function serverTimestamp(): FieldValue;
855884

856885
[FieldValue](./firestore_.fieldvalue.md#fieldvalue_class)
857886

887+
## getFirestore()
888+
889+
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
890+
>
891+
892+
Returns the existing [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.
893+
894+
<b>Signature:</b>
895+
896+
```typescript
897+
export declare function getFirestore(databaseId: string): Firestore;
898+
```
899+
900+
### Parameters
901+
902+
| Parameter | Type | Description |
903+
| --- | --- | --- |
904+
| databaseId | string | The name of the database. |
905+
906+
<b>Returns:</b>
907+
908+
[Firestore](./firestore_.firestore.md#firestore_class)
909+
910+
The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
911+
858912
## arrayRemove()
859913

860914
Returns a special value that can be used with [setDoc()](./firestore_.md#setdoc) or that tells the server to remove the given elements from any array value that already exists on the server. All instances of each element specified will be removed from the array. If the field being modified is not already an array it will be overwritten with an empty array.

docs-devsite/firestore_lite.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ https://github.com/firebase/firebase-js-sdk
1717
| --- | --- |
1818
| <b>function(app...)</b> |
1919
| [getFirestore(app)](./firestore_lite.md#getfirestore) | Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
20+
| [getFirestore(app, databaseId)](./firestore_lite.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
2021
| [initializeFirestore(app, settings)](./firestore_lite.md#initializefirestore) | Initializes a new instance of Cloud Firestore with the provided settings. Can only be called before any other functions, including [getFirestore()](./firestore_.md#getfirestore)<!-- -->. If the custom settings are empty, this function is equivalent to calling [getFirestore()](./firestore_.md#getfirestore)<!-- -->. |
22+
| [initializeFirestore(app, settings, databaseId)](./firestore_lite.md#initializefirestore) | <b><i>(BETA)</i></b> Initializes a new instance of Cloud Firestore with the provided settings. Can only be called before any other functions, including [getFirestore()](./firestore_.md#getfirestore)<!-- -->. If the custom settings are empty, this function is equivalent to calling [getFirestore()](./firestore_.md#getfirestore)<!-- -->. |
2123
| <b>function(firestore...)</b> |
2224
| [collection(firestore, path, pathSegments)](./firestore_lite.md#collection) | Gets a <code>CollectionReference</code> instance that refers to the collection at the specified absolute path. |
2325
| [collectionGroup(firestore, collectionId)](./firestore_lite.md#collectiongroup) | Creates and returns a new <code>Query</code> instance that includes all documents in the database that are contained in a collection or subcollection with the given <code>collectionId</code>. |
@@ -31,6 +33,8 @@ https://github.com/firebase/firebase-js-sdk
3133
| [documentId()](./firestore_lite.md#documentid) | Returns a special sentinel <code>FieldPath</code> to refer to the ID of a document. It can be used in queries to sort or filter by the document ID. |
3234
| [getFirestore()](./firestore_lite.md#getfirestore) | Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
3335
| [serverTimestamp()](./firestore_lite.md#servertimestamp) | Returns a sentinel used with [setDoc()](./firestore_lite.md#setdoc) or [updateDoc()](./firestore_lite.md#updatedoc) to include a server-generated timestamp in the written data. |
36+
| <b>function(databaseId...)</b> |
37+
| [getFirestore(databaseId)](./firestore_lite.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
3438
| <b>function(elements...)</b> |
3539
| [arrayRemove(elements)](./firestore_lite.md#arrayremove) | Returns a special value that can be used with [setDoc()](./firestore_.md#setdoc) or that tells the server to remove the given elements from any array value that already exists on the server. All instances of each element specified will be removed from the array. If the field being modified is not already an array it will be overwritten with an empty array. |
3640
| [arrayUnion(elements)](./firestore_lite.md#arrayunion) | Returns a special value that can be used with [setDoc()](./firestore_lite.md#setdoc) or [updateDoc()](./firestore_lite.md#updatedoc) that tells the server to union the given elements with any array value that already exists on the server. Each specified element that doesn't already exist in the array will be added to the end. If the field being modified is not already an array it will be overwritten with an array containing exactly the specified elements. |
@@ -163,6 +167,32 @@ export declare function getFirestore(app: FirebaseApp): Firestore;
163167

164168
The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
165169

170+
## getFirestore()
171+
172+
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
173+
>
174+
175+
Returns the existing [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.
176+
177+
<b>Signature:</b>
178+
179+
```typescript
180+
export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
181+
```
182+
183+
### Parameters
184+
185+
| Parameter | Type | Description |
186+
| --- | --- | --- |
187+
| app | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) instance that the returned [Firestore](./firestore_.firestore.md#firestore_class) instance is associated with. |
188+
| databaseId | string | The name of the database. |
189+
190+
<b>Returns:</b>
191+
192+
[Firestore](./firestore_lite.firestore.md#firestore_class)
193+
194+
The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
195+
166196
## initializeFirestore()
167197

168198
Initializes a new instance of Cloud Firestore with the provided settings. Can only be called before any other functions, including [getFirestore()](./firestore_.md#getfirestore)<!-- -->. If the custom settings are empty, this function is equivalent to calling [getFirestore()](./firestore_.md#getfirestore)<!-- -->.
@@ -186,6 +216,33 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Settings
186216

187217
A newly initialized `Firestore` instance.
188218

219+
## initializeFirestore()
220+
221+
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
222+
>
223+
224+
Initializes a new instance of Cloud Firestore with the provided settings. Can only be called before any other functions, including [getFirestore()](./firestore_.md#getfirestore)<!-- -->. If the custom settings are empty, this function is equivalent to calling [getFirestore()](./firestore_.md#getfirestore)<!-- -->.
225+
226+
<b>Signature:</b>
227+
228+
```typescript
229+
export declare function initializeFirestore(app: FirebaseApp, settings: Settings, databaseId?: string): Firestore;
230+
```
231+
232+
### Parameters
233+
234+
| Parameter | Type | Description |
235+
| --- | --- | --- |
236+
| app | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) with which the <code>Firestore</code> instance will be associated. |
237+
| settings | [Settings](./firestore_lite.settings.md#settings_interface) | A settings object to configure the <code>Firestore</code> instance. |
238+
| databaseId | string | The name of the database. |
239+
240+
<b>Returns:</b>
241+
242+
[Firestore](./firestore_lite.firestore.md#firestore_class)
243+
244+
A newly initialized `Firestore` instance.
245+
189246
## collection()
190247

191248
Gets a `CollectionReference` instance that refers to the collection at the specified absolute path.
@@ -424,6 +481,31 @@ export declare function serverTimestamp(): FieldValue;
424481

425482
[FieldValue](./firestore_lite.fieldvalue.md#fieldvalue_class)
426483

484+
## getFirestore()
485+
486+
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
487+
>
488+
489+
Returns the existing [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.
490+
491+
<b>Signature:</b>
492+
493+
```typescript
494+
export declare function getFirestore(databaseId: string): Firestore;
495+
```
496+
497+
### Parameters
498+
499+
| Parameter | Type | Description |
500+
| --- | --- | --- |
501+
| databaseId | string | The name of the database. |
502+
503+
<b>Returns:</b>
504+
505+
[Firestore](./firestore_lite.firestore.md#firestore_class)
506+
507+
The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
508+
427509
## arrayRemove()
428510

429511
Returns a special value that can be used with [setDoc()](./firestore_.md#setdoc) or that tells the server to remove the given elements from any array value that already exists on the server. All instances of each element specified will be removed from the array. If the field being modified is not already an array it will be overwritten with an empty array.

0 commit comments

Comments
 (0)