Skip to content

Commit

Permalink
Merge master into release
Browse files Browse the repository at this point in the history
  • Loading branch information
google-oss-bot committed Jun 20, 2023
2 parents 767d41a + 59c7b58 commit 9cc1eea
Show file tree
Hide file tree
Showing 18 changed files with 280 additions and 57 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-zebras-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/firestore": minor
---

Expose the MultiDB API for Public Preview. [#7356](https://github.com/firebase/firebase-js-sdk/pull/7356)
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report_v2.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 🐞 Bug Report
description: File a bug report
title: 'Title for the bug'
labels: 'new, type: question'
labels: 'question, new'
body:
- type: markdown
id: before-you-start
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ Please see [Environment Support](https://firebase.google.com/support/guides/envi
#### Node.js

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

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

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

#### Java

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
The closure compiler requires a modern Java installation. Java 11+ should be installed: https://www.oracle.com/java/technologies/downloads/#java11

#### Verify Prerequisites

Expand All @@ -62,7 +64,7 @@ $ yarn -v
$ java -version
```

Your `node` version should be between `10.15.0` and `16.6.0`, your `yarn` version should
Your `node` version should be between `16.4.0` and `16.6.0`, your `yarn` version should
be between `1.0.0` and `1.22.11`, and your `java` version should be `11.0` or greater.

_NOTE: We will update the documentation as new versions are required, however
Expand Down
9 changes: 9 additions & 0 deletions common/api-review/firestore-lite.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,21 @@ export function getFirestore(): Firestore;
// @public
export function getFirestore(app: FirebaseApp): Firestore;

// @beta
export function getFirestore(databaseId: string): Firestore;

// @beta
export function getFirestore(app: FirebaseApp, databaseId: string): Firestore;

// @public
export function increment(n: number): FieldValue;

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

// @beta
export function initializeFirestore(app: FirebaseApp, settings: Settings, databaseId?: string): Firestore;

// @public
export function limit(limit: number): QueryLimitConstraint;

Expand Down
6 changes: 6 additions & 0 deletions common/api-review/firestore.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,15 @@ export function getDocsFromServer<T>(query: Query<T>): Promise<QuerySnapshot<T>>
// @public
export function getFirestore(app: FirebaseApp): Firestore;

// @beta
export function getFirestore(databaseId: string): Firestore;

// @public
export function getFirestore(): Firestore;

// @beta
export function getFirestore(app: FirebaseApp, databaseId: string): Firestore;

// @public
export function increment(n: number): FieldValue;

Expand Down
56 changes: 55 additions & 1 deletion docs-devsite/firestore_.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ https://github.com/firebase/firebase-js-sdk
| --- | --- |
| <b>function(app...)</b> |
| [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. |
| [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. |
| [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)<!-- -->. |
| <b>function(firestore...)</b> |
| [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. |
Expand Down Expand Up @@ -45,6 +46,8 @@ https://github.com/firebase/firebase-js-sdk
| [memoryEagerGarbageCollector()](./firestore_.md#memoryeagergarbagecollector) | Creates an instance of <code>MemoryEagerGarbageCollector</code>. This is also the default garbage collector unless it is explicitly specified otherwise. |
| [persistentMultipleTabManager()](./firestore_.md#persistentmultipletabmanager) | Creates an instance of <code>PersistentMultipleTabManager</code>. |
| [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. |
| <b>function(databaseId...)</b> |
| [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. |
| <b>function(elements...)</b> |
| [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. |
| [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. |
Expand Down Expand Up @@ -226,6 +229,32 @@ export declare function getFirestore(app: FirebaseApp): Firestore;

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

## getFirestore()

> 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.
>
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.

<b>Signature:</b>

```typescript
export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| 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. |
| databaseId | string | The name of the database. |

<b>Returns:</b>

[Firestore](./firestore_.firestore.md#firestore_class)

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

## 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)<!-- -->.
Expand All @@ -242,7 +271,7 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Firestor
| --- | --- | --- |
| 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. |
| settings | [FirestoreSettings](./firestore_.firestoresettings.md#firestoresettings_interface) | A settings object to configure the [Firestore](./firestore_.firestore.md#firestore_class) instance. |
| databaseId | string | The name of database. |
| databaseId | string | The name of the database. |

<b>Returns:</b>

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

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

## getFirestore()

> 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.
>
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.

<b>Signature:</b>

```typescript
export declare function getFirestore(databaseId: string): Firestore;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| databaseId | string | The name of the database. |

<b>Returns:</b>

[Firestore](./firestore_.firestore.md#firestore_class)

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

## 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.
Expand Down
82 changes: 82 additions & 0 deletions docs-devsite/firestore_lite.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ https://github.com/firebase/firebase-js-sdk
| --- | --- |
| <b>function(app...)</b> |
| [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. |
| [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. |
| [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)<!-- -->. |
| [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)<!-- -->. |
| <b>function(firestore...)</b> |
| [collection(firestore, path, pathSegments)](./firestore_lite.md#collection) | Gets a <code>CollectionReference</code> instance that refers to the collection at the specified absolute path. |
| [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>. |
Expand All @@ -31,6 +33,8 @@ https://github.com/firebase/firebase-js-sdk
| [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. |
| [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. |
| [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. |
| <b>function(databaseId...)</b> |
| [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. |
| <b>function(elements...)</b> |
| [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. |
| [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. |
Expand Down Expand Up @@ -163,6 +167,32 @@ export declare function getFirestore(app: FirebaseApp): Firestore;

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

## getFirestore()

> 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.
>
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.

<b>Signature:</b>

```typescript
export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| 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. |
| databaseId | string | The name of the database. |

<b>Returns:</b>

[Firestore](./firestore_lite.firestore.md#firestore_class)

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

## 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)<!-- -->.
Expand All @@ -186,6 +216,33 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Settings

A newly initialized `Firestore` instance.

## initializeFirestore()

> 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.
>
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)<!-- -->.

<b>Signature:</b>

```typescript
export declare function initializeFirestore(app: FirebaseApp, settings: Settings, databaseId?: string): Firestore;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| app | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) with which the <code>Firestore</code> instance will be associated. |
| settings | [Settings](./firestore_lite.settings.md#settings_interface) | A settings object to configure the <code>Firestore</code> instance. |
| databaseId | string | The name of the database. |

<b>Returns:</b>

[Firestore](./firestore_lite.firestore.md#firestore_class)

A newly initialized `Firestore` instance.

## collection()

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

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

## getFirestore()

> 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.
>
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.

<b>Signature:</b>

```typescript
export declare function getFirestore(databaseId: string): Firestore;
```

### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| databaseId | string | The name of the database. |

<b>Returns:</b>

[Firestore](./firestore_lite.firestore.md#firestore_class)

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

## 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.
Expand Down
Loading

0 comments on commit 9cc1eea

Please sign in to comment.