Skip to content

Commit c55c098

Browse files
committed
Merge remote-tracking branch 'origin/master' into ocavue/fix-fetch-prov
2 parents c34e6bd + 12f2559 commit c55c098

File tree

84 files changed

+1637
-956
lines changed

Some content is hidden

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

84 files changed

+1637
-956
lines changed

.changeset/flat-eagles-obey.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.changeset/lucky-dragons-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/auth': patch
3+
---
4+
5+
Create handleRecaptchaFlow helper method

.changeset/quick-otters-applaud.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': patch
3+
---
4+
5+
Clarify method documentation.

.github/workflows/test-all.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
build:
1818
name: Build the SDK
1919
runs-on: ubuntu-latest
20+
env:
21+
NODE_OPTIONS: "--max_old_space_size=4096"
2022
steps:
2123
# Install Chrome so the correct version of webdriver can be installed by chromedriver when
2224
# setting up the repo. This must be done to build and execute Auth properly.
@@ -28,8 +30,6 @@ jobs:
2830
uses: actions/setup-node@v3
2931
with:
3032
node-version: 16.x
31-
- name: Bump Node memory limit
32-
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
3333
- name: Test setup and yarn install
3434
run: |
3535
cp config/ci.config.json config/project.json
@@ -54,12 +54,13 @@ jobs:
5454
name: (bulk) Node.js and Browser (Chrome) Tests
5555
needs: build
5656
runs-on: ubuntu-latest
57+
env:
58+
NODE_OPTIONS: "--max_old_space_size=4096"
5759
steps:
5860
# install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo
5961
- name: install Chrome stable
6062
run: |
61-
sudo apt-get update
62-
sudo apt-get install google-chrome-stable
63+
npx @puppeteer/browsers install chrome@stable
6364
- name: Download build archive
6465
uses: actions/download-artifact@v3
6566
with:
@@ -70,8 +71,6 @@ jobs:
7071
uses: actions/setup-node@v3
7172
with:
7273
node-version: 16.x
73-
- name: Bump Node memory limit
74-
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
7574
- name: Test setup and yarn install
7675
run: |
7776
cp config/ci.config.json config/project.json
@@ -98,12 +97,14 @@ jobs:
9897
name: (Auth) Node.js and Browser (Chrome) Tests
9998
needs: build
10099
runs-on: ubuntu-latest
100+
env:
101+
NODE_OPTIONS: "--max_old_space_size=4096"
101102
steps:
102103
# install Chrome first, so the correct version of webdriver can be installed by chromedriver
103104
# when setting up the repo
104-
- name: install Chrome stable
105-
run: |
106-
npx @puppeteer/browsers install chrome@stable
105+
- name: install Chrome stable
106+
run: |
107+
npx @puppeteer/browsers install chrome@stable
107108
- name: Download build archive
108109
uses: actions/download-artifact@v3
109110
with:
@@ -114,8 +115,6 @@ jobs:
114115
uses: actions/setup-node@v3
115116
with:
116117
node-version: 16.x
117-
- name: Bump Node memory limit
118-
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
119118
- name: Test setup and yarn install
120119
run: |
121120
cp config/ci.config.json config/project.json
@@ -141,12 +140,16 @@ jobs:
141140
name: (Firestore) Node.js and Browser (Chrome) Tests
142141
needs: build
143142
runs-on: ubuntu-latest
143+
if: false
144+
# Disable test for now since it's failing 100% of the time since
145+
# https://github.com/firebase/firebase-js-sdk/pull/7453 and it needs to be investigated.
146+
env:
147+
NODE_OPTIONS: "--max_old_space_size=4096"
144148
steps:
145149
# install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo
146150
- name: install Chrome stable
147151
run: |
148-
sudo apt-get update
149-
sudo apt-get install google-chrome-stable
152+
npx @puppeteer/browsers install chrome@stable
150153
- name: Download build archive
151154
uses: actions/download-artifact@v3
152155
with:
@@ -157,8 +160,6 @@ jobs:
157160
uses: actions/setup-node@v3
158161
with:
159162
node-version: 16.x
160-
- name: Bump Node memory limit
161-
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
162163
- name: Test setup and yarn install
163164
run: |
164165
cp config/ci.config.json config/project.json
@@ -171,6 +172,7 @@ jobs:
171172
node scripts/print_test_logs.js
172173
env:
173174
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
175+
EXPERIMENTAL_MODE: true
174176
- name: Generate coverage file
175177
run: yarn ci:coverage
176178
- name: Run coverage
@@ -179,7 +181,6 @@ jobs:
179181
github-token: ${{ secrets.GITHUB_TOKEN }}
180182
path-to-lcov: ./lcov-all.info
181183
continue-on-error: true
182-
183184
test-firestore-integration:
184185
strategy:
185186
fail-fast: false
@@ -188,12 +189,13 @@ jobs:
188189
name: Firestore Integration Tests (${{ matrix.persistence }})
189190
needs: build
190191
runs-on: ubuntu-latest
192+
env:
193+
NODE_OPTIONS: "--max_old_space_size=4096"
191194
steps:
192195
# install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo
193196
- name: install Chrome stable
194197
run: |
195-
sudo apt-get update
196-
sudo apt-get install google-chrome-stable
198+
npx @puppeteer/browsers install chrome@stable
197199
- name: Download build archive
198200
uses: actions/download-artifact@v3
199201
with:
@@ -204,8 +206,6 @@ jobs:
204206
uses: actions/setup-node@v3
205207
with:
206208
node-version: 16.x
207-
- name: Bump Node memory limit
208-
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
209209
- run: cp config/ci.config.json config/project.json
210210
- run: yarn
211211
- run: yarn build:${{ matrix.persistence }}

.github/workflows/test-changed-firestore-integration.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@ jobs:
1313
with:
1414
# This makes Actions fetch all Git history so run-changed script can diff properly.
1515
fetch-depth: 0
16+
- uses: 'google-github-actions/auth@v0'
17+
with:
18+
credentials_json: '${{ secrets.JSSDK_ACTIONS_SA_KEY }}'
19+
# create composite indexes with Terraform
20+
- name: Setup Terraform
21+
uses: hashicorp/setup-terraform@v2
22+
- name: Terraform Init
23+
run: |
24+
cp config/ci.config.json config/project.json
25+
cd packages/firestore
26+
terraform init
27+
continue-on-error: true
28+
- name: Terraform Apply
29+
if: github.event_name == 'pull_request'
30+
run: |
31+
cd packages/firestore
32+
terraform apply -var-file=../../config/project.json -auto-approve &> /dev/null
33+
continue-on-error: true
1634
- name: Set up Node (16)
1735
uses: actions/setup-node@v3
1836
with:
@@ -24,9 +42,7 @@ jobs:
2442
- name: Bump Node memory limit
2543
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
2644
- name: Test setup and yarn install
27-
run: |
28-
cp config/ci.config.json config/project.json
29-
yarn
45+
run: yarn
3046
- name: build
3147
run: yarn build:changed firestore-integration
3248
- name: Run tests if firestore or its dependencies has changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ jobs:
118118
run: cp config/ci.config.json config/project.json
119119
- name: Run tests
120120
run: cd packages/firestore && yarn run ${{ matrix.test-name }}
121+
env:
122+
EXPERIMENTAL_MODE: true
121123

122124
compat-test-firefox:
123125
name: Test Firestore Compatible on Firefox
@@ -185,6 +187,7 @@ jobs:
185187
run: cd packages/firestore && xvfb-run yarn run ${{ matrix.test-name }}
186188
env:
187189
BROWSERS: 'Firefox'
190+
EXPERIMENTAL_MODE: true
188191

189192
# A job that fails if any required job in the test matrix fails,
190193
# to be used as a required check for merging.

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,10 @@ tsdoc-metadata.json
9191
# generated html docs
9292
docs-rut/
9393
docs/
94-
toc/
94+
toc/
95+
96+
# generated Terraform docs
97+
.terraform/*
98+
.terraform.lock.hcl
99+
*.tfstate
100+
*.tfstate.*

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

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ export type AddPrefixToKeys<Prefix extends string, T extends Record<string, unkn
1919

2020
// @public
2121
export class AggregateField<T> {
22+
readonly aggregateType: AggregateType;
2223
readonly type = "AggregateField";
2324
}
2425

2526
// @public
26-
export type AggregateFieldType = AggregateField<number | null>;
27+
export function aggregateFieldEqual(left: AggregateField<unknown>, right: AggregateField<unknown>): boolean;
28+
29+
// @public
30+
export type AggregateFieldType = ReturnType<typeof sum> | ReturnType<typeof average> | ReturnType<typeof count>;
2731

2832
// @public
2933
export class AggregateQuerySnapshot<AggregateSpecType extends AggregateSpec, AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
@@ -46,6 +50,9 @@ export type AggregateSpecData<T extends AggregateSpec> = {
4650
[P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
4751
};
4852

53+
// @public
54+
export type AggregateType = 'count' | 'avg' | 'sum';
55+
4956
// @public
5057
export function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
5158

@@ -55,6 +62,9 @@ export function arrayRemove(...elements: unknown[]): FieldValue;
5562
// @public
5663
export function arrayUnion(...elements: unknown[]): FieldValue;
5764

65+
// @public
66+
export function average(field: string | FieldPath): AggregateField<number | null>;
67+
5868
// @public
5969
export class Bytes {
6070
static fromBase64String(base64: string): Bytes;
@@ -86,7 +96,7 @@ export class CollectionReference<AppModelType = DocumentData, DbModelType extend
8696
get parent(): DocumentReference<DocumentData, DocumentData> | null;
8797
get path(): string;
8898
readonly type = "collection";
89-
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
99+
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
90100
withConverter(converter: null): CollectionReference<DocumentData, DocumentData>;
91101
}
92102

@@ -95,6 +105,9 @@ export function connectFirestoreEmulator(firestore: Firestore, host: string, por
95105
mockUserToken?: EmulatorMockTokenOptions | string;
96106
}): void;
97107

108+
// @public
109+
export function count(): AggregateField<number>;
110+
98111
// @public
99112
export function deleteDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<void>;
100113

@@ -126,7 +139,7 @@ export class DocumentReference<AppModelType = DocumentData, DbModelType extends
126139
get parent(): CollectionReference<AppModelType, DbModelType>;
127140
get path(): string;
128141
readonly type = "document";
129-
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
142+
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
130143
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
131144
}
132145

@@ -201,6 +214,9 @@ export class GeoPoint {
201214
};
202215
}
203216

217+
// @public
218+
export function getAggregate<AggregateSpecType extends AggregateSpec, AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, aggregateSpec: AggregateSpecType): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>;
219+
204220
// @public
205221
export function getCount<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<AggregateQuerySnapshot<{
206222
count: AggregateField<number>;
@@ -270,7 +286,7 @@ export class Query<AppModelType = DocumentData, DbModelType extends DocumentData
270286
readonly firestore: Firestore;
271287
readonly type: 'query' | 'collection';
272288
withConverter(converter: null): Query<DocumentData, DocumentData>;
273-
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
289+
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
274290
}
275291

276292
// @public
@@ -388,6 +404,9 @@ export function startAt<AppModelType, DbModelType extends DocumentData>(snapshot
388404
// @public
389405
export function startAt(...fieldValues: unknown[]): QueryStartAtConstraint;
390406

407+
// @public
408+
export function sum(field: string | FieldPath): AggregateField<number>;
409+
391410
// @public
392411
export function terminate(firestore: Firestore): Promise<void>;
393412

0 commit comments

Comments
 (0)