Skip to content

Commit 1280052

Browse files
committed
Merge branch 'master' into markduckworth/or-queries-relaxing-in-restrictions
2 parents 9f5721e + fa0a7c0 commit 1280052

File tree

395 files changed

+22070
-4461
lines changed

Some content is hidden

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

395 files changed

+22070
-4461
lines changed

.changeset/config.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
"firebase-repo-scripts-prune-dts"
2222
],
2323
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
24-
"onlyUpdatePeerDependentsWhenOutOfRange": true,
25-
"useCalculatedVersionForSnapshots": true
24+
"onlyUpdatePeerDependentsWhenOutOfRange": true
25+
},
26+
"snapshot": {
27+
"useCalculatedVersion": true
2628
}
2729
}

.changeset/hot-insects-wink.md

-5
This file was deleted.

.changeset/selfish-worms-glow.md

-5
This file was deleted.

.github/CODEOWNERS

+4-5
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ packages/storage-types @maneesht @tonyjhuang @firebase/jssdk-global-approvers
5555
# Messaging Code
5656
packages/messaging @zwu52 @firebase/jssdk-global-approvers
5757
packages/messaging-compat @zwu52 @firebase/jssdk-global-approvers
58-
packages/messaging-types @zwu52 @firebase/jssdk-global-approvers
5958
packages/messaging-interop-types @zwu52 @firebase/jssdk-global-approvers
6059
integration/messaging @zwu52 @firebase/jssdk-global-approvers
6160

6261
# Auth Code
63-
packages/auth @avolkovi @lisajian @sam-gc @yuchenshi @firebase/jssdk-global-approvers
64-
packages/auth-compat @avolkovi @lisajian @sam-gc @yuchenshi @firebase/jssdk-global-approvers
65-
packages/auth-types @avolkovi @lisajian @sam-gc @yuchenshi @firebase/jssdk-global-approvers
66-
packages/auth-interop-types @avolkovi @lisajian @sam-gc @yuchenshi @firebase/jssdk-global-approvers
62+
packages/auth @lisajian @prameshj @renkelvin @sam-gc @firebase/jssdk-global-approvers
63+
packages/auth-compat @lisajian @prameshj @renkelvin @sam-gc @firebase/jssdk-global-approvers
64+
packages/auth-types @lisajian @prameshj @renkelvin @sam-gc @firebase/jssdk-global-approvers
65+
packages/auth-interop-types @lisajian @prameshj @renkelvin @sam-gc @firebase/jssdk-global-approvers
6766

6867
# Testing Code
6968
packages/rules-unit-testing @avolkovi @sam-gc @yuchenshi @firebase/jssdk-global-approvers

.github/workflows/merge-release-branch.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
run: |
1919
export VERSION_SCRIPT="const pkg = require('./packages/firebase/package.json'); console.log(pkg.version);"
2020
export VERSION=`node -e "${VERSION_SCRIPT}"`
21-
echo "::set-output name=RELEASE_VERSION::$VERSION"
21+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_OUTPUT
2222
- name: Echo version in shell
2323
run: |
2424
echo "Merging release ${{ steps.get-version.outputs.RELEASE_VERSION }}"

.github/workflows/release-prod.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
run: |
9696
VERSION_SCRIPT="const pkg = require('./packages/firebase/package.json'); console.log(pkg.version);"
9797
VERSION=`node -e "${VERSION_SCRIPT}"`
98-
echo "::set-output name=BASE_VERSION::$VERSION"
98+
echo "BASE_VERSION=$VERSION" >> $GITHUB_OUTPUT
9999
- name: Echo version in shell
100100
run: |
101101
echo "Base version: ${{ steps.get-version.outputs.BASE_VERSION }}"

.github/workflows/release-staging.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ jobs:
114114
run: |
115115
VERSION_SCRIPT="const pkg = require('./packages/firebase/package.json'); console.log(pkg.version);"
116116
VERSION=`node -e "${VERSION_SCRIPT}"`
117-
echo "::set-output name=STAGING_VERSION::$VERSION"
117+
echo "STAGING_VERSION=$VERSION" >> $GITHUB_OUTPUT
118118
BASE_VERSION=$(echo $VERSION | cut -d "-" -f 1)
119-
echo "::set-output name=BASE_VERSION::$BASE_VERSION"
119+
echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_OUTPUT
120120
- name: Echo versions in shell
121121
run: |
122122
echo "Staging release ${{ steps.get-version.outputs.STAGING_VERSION }}"

.github/workflows/release-tweet.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Send Release Tweet
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version number'
8+
type: string
9+
required: true
10+
force:
11+
description: 'Force publish'
12+
type: boolean
13+
default: false
14+
required: true
15+
16+
jobs:
17+
tweet:
18+
name: Send Release Tweet
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout Repo
22+
uses: actions/checkout@master
23+
- name: Setup Node.js 14.x
24+
uses: actions/setup-node@master
25+
with:
26+
node-version: 14.x
27+
- name: Poll release notes page on devsite
28+
run: node scripts/ci/poll_release_notes.js
29+
env:
30+
VERSION: ${{ github.event.inputs.version }}
31+
FORCE_PUBLISH: ${{ github.event.inputs.force }}
32+
- name: Post to Twitter
33+
uses: firebase/firebase-admin-node/.github/actions/send-tweet@master
34+
with:
35+
status: >
36+
v${{github.event.inputs.version}} of @Firebase JavaScript client for Web / Node.js is available.
37+
Release notes: https://firebase.google.com/support/release-notes/js#${{github.event.inputs.version}}
38+
consumer-key: ${{ secrets.TWITTER_CONSUMER_KEY }}
39+
consumer-secret: ${{ secrets.TWITTER_CONSUMER_SECRET }}
40+
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
41+
access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ jobs:
3838
run: xvfb-run yarn test:changed auth
3939
test-firefox:
4040
name: Test Auth on Firefox If Changed
41-
runs-on: ubuntu-latest
41+
# Whatever version of Firefox comes with 22.04 is causing Firefox
42+
# startup to hang when launched by karma. Need to look further into
43+
# why.
44+
runs-on: ubuntu-20.04
4245

4346
steps:
4447
- name: install Firefox stable

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ jobs:
3434

3535
test-firefox:
3636
name: Test Firestore on Firefox If Changed
37-
runs-on: ubuntu-latest
37+
# Whatever version of Firefox comes with 22.04 is causing Firefox
38+
# startup to hang when launched by karma. Need to look further into
39+
# why.
40+
runs-on: ubuntu-20.04
3841

3942
steps:
4043
- name: install Firefox stable

.github/workflows/test-changed.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ jobs:
3434

3535
test-firefox:
3636
name: Test Packages With Changed Files in Firefox
37-
runs-on: ubuntu-latest
37+
# Whatever version of Firefox comes with 22.04 is causing Firefox
38+
# startup to hang when launched by karma. Need to look further into
39+
# why.
40+
runs-on: ubuntu-20.04
3841

3942
steps:
4043
- name: Checkout Repo

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ coverage
3939
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
4040
.grunt
4141

42-
# Bower dependency directory (https://bower.io/)
43-
bower_components
44-
4542
# node-waf configuration
4643
.lock-wscript
4744

.vscode/launch.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@
7373
"--exit"
7474
],
7575
"env": {
76-
"FIRESTORE_EMULATOR_PORT" : "8080",
77-
"FIRESTORE_EMULATOR_PROJECT_ID" : "test-emulator"
76+
"FIRESTORE_TARGET_BACKEND" : "emulator",
7877
},
7978
"sourceMaps": true,
8079
"protocol": "inspector"
@@ -95,8 +94,7 @@
9594
],
9695
"env": {
9796
"USE_MOCK_PERSISTENCE": "YES",
98-
"FIRESTORE_EMULATOR_PORT" : "8080",
99-
"FIRESTORE_EMULATOR_PROJECT_ID" : "test-emulator"
97+
"FIRESTORE_TARGET_BACKEND" : "emulator",
10098
},
10199
"sourceMaps": true,
102100
"protocol": "inspector"

README.md

+25-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ applications using Firebase services. This SDK is distributed via:
1111

1212
- [CDN](https://firebase.google.com/docs/web/setup/#add-sdks-initialize)
1313
- [npm package](https://www.npmjs.com/package/firebase)
14-
- [Bower package](https://github.com/firebase/firebase-bower)
1514

1615
To get started using Firebase, see
1716
[Add Firebase to your JavaScript Project](https://firebase.google.com/docs/web/setup).
@@ -113,6 +112,26 @@ database. When prompted to select the set of initial security rules, select
113112
any option (e.g. "Start in Production Mode") since these permission settings
114113
will be overwritten below.
115114

115+
#### Storage Setup
116+
117+
Visit the "Storage" section of the console and create a storage bucket. In
118+
order to run the tests, you will need to update your bucket's CORS rules.
119+
120+
1. Create a new file called `cors.json` with the contents:
121+
```json
122+
[
123+
{
124+
"origin": ["http://localhost:8089"],
125+
"method": ["GET"],
126+
"maxAgeSeconds": 3600
127+
}
128+
]
129+
```
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>`
132+
133+
For more information, visit https://firebase.google.com/docs/storage/web/download-files#cors_configuration
134+
116135
#### Authentication Support
117136

118137
Visit the authentication config in your project and enable the `Anonymous`
@@ -171,14 +190,16 @@ scope](https://www.npmjs.com/search?q=scope%3Afirebase) on NPM.
171190

172191
### Testing the SDK Locally
173192

174-
Please be sure to build your repo before proceeding any further.
193+
Please be sure your product's package has been built before proceeding any further. (If you haven't built this repo before, make sure to run `yarn build` at the root)
175194
In order to manually test your SDK changes locally, you must use [yarn link](https://classic.yarnpkg.com/en/docs/cli/link):
176195

177196
```shell
178197
$ cd packages/firebase
179198
$ yarn link # initialize the linking to the other folder
180-
$ cd ../<my-test-app-dir> # cd into your personal project directory
181-
$ yarn link firebase # tell yarn to use the locally built firebase SDK instead
199+
$ cd ../packages/<my-product> # Example: $ cd packages/database
200+
$ yarn link # link your product to make it available elsewhere
201+
$ cd <my-test-app-dir> # cd into your personal project directory
202+
$ yarn link firebase @firebase/<my-product> # tell yarn to use the locally built firebase SDK instead
182203
```
183204

184205
This will create a symlink and point your `<my-test-app-dir>` to the locally built version of the firebase SDK.

common/api-review/analytics.api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ export interface SettingsOptions {
421421
}
422422

423423
// @public
424-
export function setUserId(analyticsInstance: Analytics, id: string, options?: AnalyticsCallOptions): void;
424+
export function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void;
425425

426426
// @public
427427
export function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void;

common/api-review/app.api.md

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ export function initializeApp(options: FirebaseOptions, name?: string): Firebase
9393
// @public
9494
export function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
9595

96+
// @public
97+
export function initializeApp(): FirebaseApp;
98+
9699
// @public
97100
export function onLog(logCallback: LogCallback | null, options?: LogOptions): void;
98101

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

+32-15
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,33 @@ export type AddPrefixToKeys<Prefix extends string, T extends Record<string, unkn
1818
};
1919

2020
// @public
21-
export function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
21+
export class AggregateField<T> {
22+
type: string;
23+
}
24+
25+
// @public
26+
export type AggregateFieldType = AggregateField<number>;
27+
28+
// @public
29+
export class AggregateQuerySnapshot<T extends AggregateSpec> {
30+
data(): AggregateSpecData<T>;
31+
readonly query: Query<unknown>;
32+
readonly type = "AggregateQuerySnapshot";
33+
}
34+
35+
// @public
36+
export function aggregateQuerySnapshotEqual<T extends AggregateSpec>(left: AggregateQuerySnapshot<T>, right: AggregateQuerySnapshot<T>): boolean;
37+
38+
// @public
39+
export interface AggregateSpec {
40+
// (undocumented)
41+
[field: string]: AggregateFieldType;
42+
}
43+
44+
// @public
45+
export type AggregateSpecData<T extends AggregateSpec> = {
46+
[P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
47+
};
2248

2349
// @public
2450
export function arrayRemove(...elements: unknown[]): FieldValue;
@@ -172,6 +198,11 @@ export class GeoPoint {
172198
};
173199
}
174200

201+
// @public
202+
export function getCount(query: Query<unknown>): Promise<AggregateQuerySnapshot<{
203+
count: AggregateField<number>;
204+
}>>;
205+
175206
// @public
176207
export function getDoc<T>(reference: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
177208

@@ -203,9 +234,6 @@ export type NestedUpdateFields<T extends Record<string, unknown>> = UnionToInter
203234
[K in keyof T & string]: ChildUpdateFields<K, T[K]>;
204235
}[keyof T & string]>;
205236

206-
// @public
207-
export function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
208-
209237
// @public
210238
export function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint;
211239

@@ -230,17 +258,9 @@ export class Query<T = DocumentData> {
230258
withConverter<U>(converter: FirestoreDataConverter<U>): Query<U>;
231259
}
232260

233-
// @public
234-
export function query<T>(query: Query<T>, compositeFilter: QueryCompositeFilterConstraint, ...queryConstraints: QueryNonFilterConstraint[]): Query<T>;
235-
236261
// @public
237262
export function query<T>(query: Query<T>, ...queryConstraints: QueryConstraint[]): Query<T>;
238263

239-
// @public
240-
export class QueryCompositeFilterConstraint {
241-
readonly type: 'or' | 'and';
242-
}
243-
244264
// @public
245265
export abstract class QueryConstraint {
246266
abstract readonly type: QueryConstraintType;
@@ -268,9 +288,6 @@ export class QueryFieldFilterConstraint extends QueryConstraint {
268288
readonly type = "where";
269289
}
270290

271-
// @public
272-
export type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;
273-
274291
// @public
275292
export class QueryLimitConstraint extends QueryConstraint {
276293
readonly type: 'limit' | 'limitToLast';

0 commit comments

Comments
 (0)