Skip to content

Commit

Permalink
Merge branch 'master' of github.com:firebase/firebase-js-sdk into mar…
Browse files Browse the repository at this point in the history
…kduckworth/sum-avg-release
  • Loading branch information
MarkDuckworth committed Oct 5, 2023
2 parents cae9d0d + cbfd14c commit b15c529
Show file tree
Hide file tree
Showing 22 changed files with 832 additions and 477 deletions.
6 changes: 6 additions & 0 deletions .changeset/flat-cups-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/firestore': minor
'firebase': minor
---

Added a default template type parameter to withConverter() functions to improve backwards compatibility with the v9 SDK
40 changes: 20 additions & 20 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
build:
name: Build the SDK
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
# Install Chrome so the correct version of webdriver can be installed by chromedriver when
# setting up the repo. This must be done to build and execute Auth properly.
Expand All @@ -28,8 +30,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Bump Node memory limit
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
Expand All @@ -54,12 +54,13 @@ jobs:
name: (bulk) Node.js and Browser (Chrome) Tests
needs: build
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
# install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo
- name: install Chrome stable
run: |
sudo apt-get update
sudo apt-get install google-chrome-stable
npx @puppeteer/browsers install chrome@stable
- name: Download build archive
uses: actions/download-artifact@v3
with:
Expand All @@ -70,8 +71,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Bump Node memory limit
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
Expand All @@ -98,12 +97,14 @@ jobs:
name: (Auth) Node.js and Browser (Chrome) Tests
needs: build
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
# install Chrome first, so the correct version of webdriver can be installed by chromedriver
# when setting up the repo
- name: install Chrome stable
run: |
npx @puppeteer/browsers install chrome@stable
- name: install Chrome stable
run: |
npx @puppeteer/browsers install chrome@stable
- name: Download build archive
uses: actions/download-artifact@v3
with:
Expand All @@ -114,8 +115,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Bump Node memory limit
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
Expand All @@ -141,12 +140,16 @@ jobs:
name: (Firestore) Node.js and Browser (Chrome) Tests
needs: build
runs-on: ubuntu-latest
if: false
# Disable test for now since it's failing 100% of the time since
# https://github.com/firebase/firebase-js-sdk/pull/7453 and it needs to be investigated.
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
# install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo
- name: install Chrome stable
run: |
sudo apt-get update
sudo apt-get install google-chrome-stable
npx @puppeteer/browsers install chrome@stable
- name: Download build archive
uses: actions/download-artifact@v3
with:
Expand All @@ -157,8 +160,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Bump Node memory limit
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
Expand All @@ -171,6 +172,7 @@ jobs:
node scripts/print_test_logs.js
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
EXPERIMENTAL_MODE: true
- name: Generate coverage file
run: yarn ci:coverage
- name: Run coverage
Expand All @@ -179,7 +181,6 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov-all.info
continue-on-error: true

test-firestore-integration:
strategy:
fail-fast: false
Expand All @@ -188,12 +189,13 @@ jobs:
name: Firestore Integration Tests (${{ matrix.persistence }})
needs: build
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
# install Chrome so the correct version of webdriver can be installed by chromedriver when setting up the repo
- name: install Chrome stable
run: |
sudo apt-get update
sudo apt-get install google-chrome-stable
npx @puppeteer/browsers install chrome@stable
- name: Download build archive
uses: actions/download-artifact@v3
with:
Expand All @@ -204,8 +206,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Bump Node memory limit
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
- run: cp config/ci.config.json config/project.json
- run: yarn
- run: yarn build:${{ matrix.persistence }}
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/test-changed-firestore-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ jobs:
with:
# This makes Actions fetch all Git history so run-changed script can diff properly.
fetch-depth: 0
- uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.JSSDK_ACTIONS_SA_KEY }}'
# create composite indexes with Terraform
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
- name: Terraform Init
run: |
cp config/ci.config.json config/project.json
cd packages/firestore
terraform init
continue-on-error: true
- name: Terraform Apply
if: github.event_name == 'pull_request'
run: |
cd packages/firestore
terraform apply -var-file=../../config/project.json -auto-approve
continue-on-error: true
- name: Set up Node (16)
uses: actions/setup-node@v3
with:
Expand All @@ -24,9 +42,7 @@ jobs:
- name: Bump Node memory limit
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
- name: Test setup and yarn install
run: |
cp config/ci.config.json config/project.json
yarn
run: yarn
- name: build
run: yarn build:changed firestore-integration
- name: Run tests if firestore or its dependencies has changed
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,10 @@ tsdoc-metadata.json
# generated html docs
docs-rut/
docs/
toc/
toc/

# generated Terraform docs
.terraform/*
.terraform.lock.hcl
*.tfstate
*.tfstate.*
6 changes: 3 additions & 3 deletions common/api-review/firestore-lite.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class CollectionReference<AppModelType = DocumentData, DbModelType extend
get parent(): DocumentReference<DocumentData, DocumentData> | null;
get path(): string;
readonly type = "collection";
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
withConverter(converter: null): CollectionReference<DocumentData, DocumentData>;
}

Expand Down Expand Up @@ -139,7 +139,7 @@ export class DocumentReference<AppModelType = DocumentData, DbModelType extends
get parent(): CollectionReference<AppModelType, DbModelType>;
get path(): string;
readonly type = "document";
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
}

Expand Down Expand Up @@ -286,7 +286,7 @@ export class Query<AppModelType = DocumentData, DbModelType extends DocumentData
readonly firestore: Firestore;
readonly type: 'query' | 'collection';
withConverter(converter: null): Query<DocumentData, DocumentData>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
}

// @public
Expand Down
6 changes: 3 additions & 3 deletions common/api-review/firestore.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class CollectionReference<AppModelType = DocumentData, DbModelType extend
get parent(): DocumentReference<DocumentData, DocumentData> | null;
get path(): string;
readonly type = "collection";
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
withConverter(converter: null): CollectionReference<DocumentData, DocumentData>;
}

Expand Down Expand Up @@ -165,7 +165,7 @@ export class DocumentReference<AppModelType = DocumentData, DbModelType extends
get parent(): CollectionReference<AppModelType, DbModelType>;
get path(): string;
readonly type = "document";
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
}

Expand Down Expand Up @@ -541,7 +541,7 @@ export class Query<AppModelType = DocumentData, DbModelType extends DocumentData
readonly firestore: Firestore;
readonly type: 'query' | 'collection';
withConverter(converter: null): Query<DocumentData, DocumentData>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
}

// @public
Expand Down
2 changes: 1 addition & 1 deletion docs-devsite/firestore_.collectionreference.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Applies a custom data converter to this `CollectionReference`<!-- -->, allowing
<b>Signature:</b>
```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
```
### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs-devsite/firestore_.documentreference.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Applies a custom data converter to this `DocumentReference`<!-- -->, allowing yo
<b>Signature:</b>

```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs-devsite/firestore_.query.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Applies a custom data converter to this query, allowing you to use your own cust
<b>Signature:</b>

```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs-devsite/firestore_lite.collectionreference.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Applies a custom data converter to this `CollectionReference`<!-- -->, allowing
<b>Signature:</b>
```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
```
### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs-devsite/firestore_lite.documentreference.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Applies a custom data converter to this `DocumentReference`<!-- -->, allowing yo
<b>Signature:</b>

```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs-devsite/firestore_lite.query.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Applies a custom data converter to this query, allowing you to use your own cust
<b>Signature:</b>

```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
```

### Parameters
Expand Down
Loading

0 comments on commit b15c529

Please sign in to comment.