Skip to content

Commit e0d07f6

Browse files
Merge master into release
2 parents f7b4a4b + 450e000 commit e0d07f6

File tree

160 files changed

+4237
-959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+4237
-959
lines changed

.changeset/dry-cats-lick.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/auth': patch
3+
---
4+
5+
Increase the popup poller timeout to 8s to support blocking functions + Firefox

.changeset/grumpy-bees-shake.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
Fixed stack overflow caused by deeply nested server timestamps.

.changeset/olive-cycles-count.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'firebase': minor
3+
'@firebase/firestore': minor
4+
---
5+
6+
Introduces a new LRU garbage document collector for memory cache.

.changeset/olive-goats-greet.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
Simplified the internal handling of aggregation results.

.changeset/silent-islands-fix.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/analytics': minor
3+
'firebase': minor
4+
---
5+
6+
Add method `getGoogleAnalyticsClientId()` to retrieve an unique identifier for a web client. This allows users to log purchase and other events from their backends using Google Analytics 4 Measurement Protocol and to have those events be connected to actions taken on the client within their Firebase web app. `getGoogleAnalyticsClientId()` will simplify this event recording process.

.changeset/strong-ghosts-compare.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/webchannel-wrapper': patch
3+
---
4+
5+
Make webchannel-wrapper exports Node-ESM-friendly.

.changeset/swift-eels-change.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@firebase/webchannel-wrapper': minor
3+
'@firebase/firestore': minor
4+
'firebase': minor
5+
---
6+
7+
Implemented an optimization in the local cache synchronization logic that reduces the number of billed document reads when documents were deleted on the server while the client was not actively listening to the query (e.g. while the client was offline).

.changeset/wicked-tomatoes-smoke.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@firebase/app-check": minor
3+
"firebase": minor
4+
---
5+
6+
Add new limited use token method to App Check

.github/CODEOWNERS

+3-28
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,13 @@
77
#
88
#######################################################################################################
99

10-
# ===========================================================
11-
# @firebase/jssdk-global-approvers
12-
# ===========================================================
13-
# Used for approving minor changes, large-scale refactorings, and emergency situations.
14-
# (secret team to avoid review requests)
15-
#
16-
# - @lahirumaramba
17-
# - @hsubox76
18-
# - @allspain
19-
# - @dwyfrequency
20-
21-
22-
# ===========================================================
23-
# @firebase/firestore-js-team
24-
# ===========================================================
25-
# Used for approving firestore changes.
26-
# (secret team to avoid review requests)
27-
#
28-
# - @schmidt-sebastian
29-
# - @thebrianchen
30-
# - @wu-hui
31-
# - @ehsannas
32-
# - @dconeybe
33-
34-
3510
# These owners will be the default owners for everything in the repo.
3611
* @dwyfrequency @hsubox76 @firebase/jssdk-global-approvers
3712

3813
# Database Code
39-
packages/database @maneesht @jsdt @IanWyszynski @firebase/jssdk-global-approvers
40-
packages/database-compat @maneesht @jsdt @IanWyszynski @firebase/jssdk-global-approvers
41-
packages/database-types @maneesht @jsdt @IanWyszynski @firebase/jssdk-global-approvers
14+
packages/database @maneesht @jsdt @jmwski @firebase/jssdk-global-approvers
15+
packages/database-compat @maneesht @jsdt @jmwski @firebase/jssdk-global-approvers
16+
packages/database-types @maneesht @jsdt @jmwski @firebase/jssdk-global-approvers
4217

4318
# Firestore Code
4419
packages/firestore @firebase/firestore-js-team @firebase/jssdk-global-approvers

.github/workflows/release-staging.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ jobs:
134134
https://api.github.com/repos/firebase/firebase-js-sdk/dispatches
135135
- name: Check for changes requiring a reference doc publish
136136
id: docs-check
137-
run: git diff --exit-code origin/master HEAD docs-devsite
137+
run: |
138+
LAST_PUBLISHED_VERSION=$(npm info firebase version)
139+
git diff --exit-code firebase@$LAST_PUBLISHED_VERSION HEAD docs-devsite
138140
- name: No diff, docs not needed
139141
if: ${{ success() }}
140142
run: echo "DOCS_NEEDED=false" >> $GITHUB_STATE

.github/workflows/test-all.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ jobs:
1616
steps:
1717
# install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo
1818
- name: install Chrome stable
19+
# Install Chrome version 110.0.5481.177-1 as some Auth tests start to fail on version 111.
20+
# Temporary: Auth team will explore what's going wrong with the auth tests.
1921
run: |
2022
sudo apt-get update
21-
sudo apt-get install google-chrome-stable
23+
sudo apt-get install wget
24+
sudo wget http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_110.0.5481.177-1_amd64.deb
25+
sudo apt-get install -f ./google-chrome-stable_110.0.5481.177-1_amd64.deb --allow-downgrades
2226
- uses: actions/checkout@v3
2327
- name: Set up Node (16)
2428
uses: actions/setup-node@v3

.github/workflows/test-changed-auth.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
# install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo
1616
- name: install Chrome stable
1717
# Install Chrome version 110.0.5481.177-1 as test starts to fail on version 111.
18-
# We will retry to use the latest, once version 112 becomes stable.
18+
# Temporary: Auth team will explore what's going wrong with the auth tests.
1919
run: |
2020
sudo apt-get update
2121
sudo apt-get install wget

README.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ 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` or greater.
32+
installed on your machine. The currently supported versions are `10.15.0` through `16.6.0`.
3333

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

@@ -43,9 +43,14 @@ In addition to Node.js we use `yarn` to facilitate multi package development.
4343
To install `yarn` follow the instructions listed on their website:
4444
https://yarnpkg.com/en/docs/install
4545

46+
This repo currently supports building with yarn `1.x`. For instance, after installating yarn, run
47+
```bash
48+
$ yarn set version 1.22.11`
49+
```
50+
4651
#### Java
4752

48-
The closure compiler requires a modern Java installation. Java 8+ should be installed: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
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
4954

5055
#### Verify Prerequisites
5156

@@ -57,8 +62,8 @@ $ yarn -v
5762
$ java -version
5863
```
5964

60-
Your Node.js version should be `10.15.0` or greater, your `yarn` version should
61-
be `1.0.0` or greater, and your `java` version should be `1.8.0` or greater.
65+
Your `node` version should be between `10.15.0` and `16.6.0`, your `yarn` version should
66+
be between `1.0.0` and `1.22.11`, and your `java` version should be `11.0` or greater.
6267

6368
_NOTE: We will update the documentation as new versions are required, however
6469
for continuing development on the SDK, staying up to date on the stable versions
@@ -109,7 +114,7 @@ will be overwritten below.
109114
110115
Visit the "Realtime Database" section of the console and create a realtime
111116
database. When prompted to select the set of initial security rules, select
112-
any option (e.g. "Start in Production Mode") since these permission settings
117+
any option (e.g. "Start in Locked Mode") since these permission settings
113118
will be overwritten below.
114119
115120
#### Storage Setup
@@ -127,8 +132,10 @@ order to run the tests, you will need to update your bucket's CORS rules.
127132
}
128133
]
129134
```
130-
2. Install `gsutil` from https://cloud.google.com/storage/docs/gsutil_install
131-
3. Run `gsutil cors set cors.json gs://<your-cloud-storage-bucket>`
135+
1. Install `gsutil` from https://cloud.google.com/storage/docs/gsutil_install
136+
1. You will need to login if this is your first time using `gsutil`. Run `gcloud auth login`
137+
and follow the instructions to login.
138+
1. Run `gsutil cors set cors.json gs://<your-cloud-storage-bucket>`
132139
133140
For more information, visit https://firebase.google.com/docs/storage/web/download-files#cors_configuration
134141

common/api-review/analytics.api.md

+3
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ export interface EventParams {
133133
// @public
134134
export function getAnalytics(app?: FirebaseApp): Analytics;
135135

136+
// @public
137+
export function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;
138+
136139
// @public
137140
export interface GtagConfigParams {
138141
// (undocumented)

common/api-review/app-check.api.md

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ export interface CustomProviderOptions {
6060
getToken: () => Promise<AppCheckToken>;
6161
}
6262

63+
// @public
64+
export function getLimitedUseToken(appCheckInstance: AppCheck): Promise<AppCheckTokenResult>;
65+
6366
// @public
6467
export function getToken(appCheckInstance: AppCheck, forceRefresh?: boolean): Promise<AppCheckTokenResult>;
6568

common/api-review/auth.api.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface ActionCodeInfo {
2020
multiFactorInfo?: MultiFactorInfo | null;
2121
previousEmail?: string | null;
2222
};
23-
operation: typeof ActionCodeOperation[keyof typeof ActionCodeOperation];
23+
operation: (typeof ActionCodeOperation)[keyof typeof ActionCodeOperation];
2424
}
2525

2626
// @public
@@ -456,21 +456,21 @@ export function multiFactor(user: User): MultiFactorUser;
456456

457457
// @public
458458
export interface MultiFactorAssertion {
459-
readonly factorId: typeof FactorId[keyof typeof FactorId];
459+
readonly factorId: (typeof FactorId)[keyof typeof FactorId];
460460
}
461461

462462
// @public
463463
export interface MultiFactorError extends AuthError {
464464
readonly customData: AuthError['customData'] & {
465-
readonly operationType: typeof OperationType[keyof typeof OperationType];
465+
readonly operationType: (typeof OperationType)[keyof typeof OperationType];
466466
};
467467
}
468468

469469
// @public
470470
export interface MultiFactorInfo {
471471
readonly displayName?: string | null;
472472
readonly enrollmentTime: string;
473-
readonly factorId: typeof FactorId[keyof typeof FactorId];
473+
readonly factorId: (typeof FactorId)[keyof typeof FactorId];
474474
readonly uid: string;
475475
}
476476

@@ -844,7 +844,7 @@ export interface User extends UserInfo {
844844

845845
// @public
846846
export interface UserCredential {
847-
operationType: typeof OperationType[keyof typeof OperationType];
847+
operationType: (typeof OperationType)[keyof typeof OperationType];
848848
providerId: string | null;
849849
user: User;
850850
}

common/api-review/firestore.api.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,42 @@ export interface LoadBundleTaskProgress {
331331

332332
export { LogLevel }
333333

334+
// @public
335+
export interface MemoryCacheSettings {
336+
garbageCollector?: MemoryGarbageCollector;
337+
}
338+
339+
// @public
340+
export interface MemoryEagerGarbageCollector {
341+
// (undocumented)
342+
kind: 'memoryEager';
343+
}
344+
345+
// @public
346+
export function memoryEagerGarbageCollector(): MemoryEagerGarbageCollector;
347+
348+
// @public
349+
export type MemoryGarbageCollector = MemoryEagerGarbageCollector | MemoryLruGarbageCollector;
350+
334351
// @public
335352
export interface MemoryLocalCache {
336353
// (undocumented)
337354
kind: 'memory';
338355
}
339356

340357
// @public
341-
export function memoryLocalCache(): MemoryLocalCache;
358+
export function memoryLocalCache(settings?: MemoryCacheSettings): MemoryLocalCache;
359+
360+
// @public
361+
export interface MemoryLruGarbageCollector {
362+
// (undocumented)
363+
kind: 'memoryLru';
364+
}
365+
366+
// @public
367+
export function memoryLruGarbageCollector(settings?: {
368+
cacheSizeBytes?: number;
369+
}): MemoryLruGarbageCollector;
342370

343371
// @public
344372
export function namedQuery(firestore: Firestore, name: string): Promise<Query | null>;

common/api-review/storage.api.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export interface StorageReference {
304304
}
305305

306306
// @public
307-
export type StringFormat = typeof StringFormat[keyof typeof StringFormat];
307+
export type StringFormat = (typeof StringFormat)[keyof typeof StringFormat];
308308

309309
// @public
310310
export const StringFormat: {
@@ -329,7 +329,7 @@ export const _TaskEvent: {
329329
export type TaskState = 'running' | 'paused' | 'success' | 'canceled' | 'error';
330330

331331
// @internal
332-
export type _TaskState = typeof _TaskState[keyof typeof _TaskState];
332+
export type _TaskState = (typeof _TaskState)[keyof typeof _TaskState];
333333

334334
// @internal
335335
export const _TaskState: {

config/functions/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Cloud Functions for Firebase",
44
"dependencies": {
55
"cors": "2.8.5",
6-
"firebase-admin": "11.5.0",
6+
"firebase-admin": "11.6.0",
77
"firebase-functions": "3.24.1"
88
},
99
"private": true,

docs-devsite/analytics.md

+21
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Firebase Analytics
2020
| [getAnalytics(app)](./analytics.md#getanalytics) | Returns an [Analytics](./analytics.analytics.md#analytics_interface) instance for the given app. |
2121
| [initializeAnalytics(app, options)](./analytics.md#initializeanalytics) | Returns an [Analytics](./analytics.analytics.md#analytics_interface) instance for the given app. |
2222
| <b>function(analyticsInstance...)</b> |
23+
| [getGoogleAnalyticsClientId(analyticsInstance)](./analytics.md#getgoogleanalyticsclientid) | Retrieves a unique Google Analytics identifier for the web client. See [client\_id](https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id)<!-- -->. |
2324
| [logEvent(analyticsInstance, eventName, eventParams, options)](./analytics.md#logevent) | Sends a Google Analytics event with given <code>eventParams</code>. This method automatically associates this logged event with this Firebase web app instance on this device.<!-- -->List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events)<!-- -->. |
2425
| [logEvent(analyticsInstance, eventName, eventParams, options)](./analytics.md#logevent) | Sends a Google Analytics event with given <code>eventParams</code>. This method automatically associates this logged event with this Firebase web app instance on this device.<!-- -->List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events)<!-- -->. |
2526
| [logEvent(analyticsInstance, eventName, eventParams, options)](./analytics.md#logevent) | Sends a Google Analytics event with given <code>eventParams</code>. This method automatically associates this logged event with this Firebase web app instance on this device.<!-- -->See [Track Screenviews](https://firebase.google.com/docs/analytics/screenviews)<!-- -->. |
@@ -121,6 +122,26 @@ export declare function initializeAnalytics(app: FirebaseApp, options?: Analytic
121122

122123
[Analytics](./analytics.analytics.md#analytics_interface)
123124

125+
## getGoogleAnalyticsClientId()
126+
127+
Retrieves a unique Google Analytics identifier for the web client. See [client\_id](https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id)<!-- -->.
128+
129+
<b>Signature:</b>
130+
131+
```typescript
132+
export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;
133+
```
134+
135+
### Parameters
136+
137+
| Parameter | Type | Description |
138+
| --- | --- | --- |
139+
| analyticsInstance | [Analytics](./analytics.analytics.md#analytics_interface) | |
140+
141+
<b>Returns:</b>
142+
143+
Promise&lt;string&gt;
144+
124145
## logEvent()
125146

126147
Sends a Google Analytics event with given `eventParams`<!-- -->. This method automatically associates this logged event with this Firebase web app instance on this device.

docs-devsite/app-check.md

+25
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Firebase App Check
1919
| <b>function(app...)</b> |
2020
| [initializeAppCheck(app, options)](./app-check.md#initializeappcheck) | Activate App Check for the given app. Can be called only once per app. |
2121
| <b>function(appCheckInstance...)</b> |
22+
| [getLimitedUseToken(appCheckInstance)](./app-check.md#getlimitedusetoken) | Requests a Firebase App Check token. This method should be used only if you need to authorize requests to a non-Firebase backend.<!-- -->Returns limited-use tokens that are intended for use with your non-Firebase backend endpoints that are protected with <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection"> Replay Protection</a>. This method does not affect the token generation behavior of the \#getAppCheckToken() method. |
2223
| [getToken(appCheckInstance, forceRefresh)](./app-check.md#gettoken) | Get the current App Check token. Attaches to the most recent in-flight request if one is present. Returns null if no token is present and no token requests are in-flight. |
2324
| [onTokenChanged(appCheckInstance, observer)](./app-check.md#ontokenchanged) | Registers a listener to changes in the token state. There can be more than one listener registered at the same time for one or more App Check instances. The listeners call back on the UI thread whenever the current token associated with this App Check instance changes. |
2425
| [onTokenChanged(appCheckInstance, onNext, onError, onCompletion)](./app-check.md#ontokenchanged) | Registers a listener to changes in the token state. There can be more than one listener registered at the same time for one or more App Check instances. The listeners call back on the UI thread whenever the current token associated with this App Check instance changes. |
@@ -69,6 +70,30 @@ export declare function initializeAppCheck(app: FirebaseApp | undefined, options
6970

7071
[AppCheck](./app-check.appcheck.md#appcheck_interface)
7172

73+
## getLimitedUseToken()
74+
75+
Requests a Firebase App Check token. This method should be used only if you need to authorize requests to a non-Firebase backend.
76+
77+
Returns limited-use tokens that are intended for use with your non-Firebase backend endpoints that are protected with <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection"> Replay Protection</a>. This method does not affect the token generation behavior of the \#getAppCheckToken() method.
78+
79+
<b>Signature:</b>
80+
81+
```typescript
82+
export declare function getLimitedUseToken(appCheckInstance: AppCheck): Promise<AppCheckTokenResult>;
83+
```
84+
85+
### Parameters
86+
87+
| Parameter | Type | Description |
88+
| --- | --- | --- |
89+
| appCheckInstance | [AppCheck](./app-check.appcheck.md#appcheck_interface) | The App Check service instance. |
90+
91+
<b>Returns:</b>
92+
93+
Promise&lt;[AppCheckTokenResult](./app-check.appchecktokenresult.md#appchecktokenresult_interface)<!-- -->&gt;
94+
95+
The limited use token.
96+
7297
## getToken()
7398

7499
Get the current App Check token. Attaches to the most recent in-flight request if one is present. Returns null if no token is present and no token requests are in-flight.

0 commit comments

Comments
 (0)