Skip to content

Commit 6783c3c

Browse files
committed
Merge remote-tracking branch 'origin/master' into UpdateDataTypeFix2
2 parents b01cf18 + 9f2ce14 commit 6783c3c

Some content is hidden

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

47 files changed

+258
-346
lines changed

.changeset/funny-ways-carry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/app': patch
3+
---
4+
5+
Make the error more helpful when `getApp()` is called before `initializeApp()`.

.changeset/olive-goats-greet.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+
Simplified the internal handling of aggregation results.

.github/CODEOWNERS

Lines changed: 3 additions & 28 deletions
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/test-all.yml

Lines changed: 5 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 14 additions & 7 deletions
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/auth.api.md

Lines changed: 5 additions & 5 deletions
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/storage.api.md

Lines changed: 2 additions & 2 deletions
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: {

docs-devsite/auth.actioncodeinfo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface ActionCodeInfo
2323
| Property | Type | Description |
2424
| --- | --- | --- |
2525
| [data](./auth.actioncodeinfo.md#actioncodeinfodata) | { email?: string \| null; multiFactorInfo?: [MultiFactorInfo](./auth.multifactorinfo.md#multifactorinfo_interface) \| null; previousEmail?: string \| null; } | The data associated with the action code. |
26-
| [operation](./auth.actioncodeinfo.md#actioncodeinfooperation) | typeof [ActionCodeOperationMap](./auth.md#actioncodeoperation)<!-- -->\[keyof typeof [ActionCodeOperationMap](./auth.md#actioncodeoperation)<!-- -->\] | The type of operation that generated the action code. |
26+
| [operation](./auth.actioncodeinfo.md#actioncodeinfooperation) | (typeof [ActionCodeOperationMap](./auth.md#actioncodeoperation)<!-- -->)\[keyof typeof [ActionCodeOperationMap](./auth.md#actioncodeoperation)<!-- -->\] | The type of operation that generated the action code. |
2727

2828
## ActionCodeInfo.data
2929

@@ -54,5 +54,5 @@ The type of operation that generated the action code.
5454
<b>Signature:</b>
5555

5656
```typescript
57-
operation: typeof ActionCodeOperationMap[keyof typeof ActionCodeOperationMap];
57+
operation: (typeof ActionCodeOperationMap)[keyof typeof ActionCodeOperationMap];
5858
```

docs-devsite/auth.auth.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface Auth
4141
| [onAuthStateChanged(nextOrObserver, error, completed)](./auth.auth.md#authonauthstatechanged) | Adds an observer for changes to the user's sign-in state. |
4242
| [onIdTokenChanged(nextOrObserver, error, completed)](./auth.auth.md#authonidtokenchanged) | Adds an observer for changes to the signed-in user's ID token. |
4343
| [setPersistence(persistence)](./auth.auth.md#authsetpersistence) | Changes the type of persistence on the <code>Auth</code> instance. |
44-
| [signOut()](./auth.auth.md#authsignout) | Signs out the current user. |
44+
| [signOut()](./auth.auth.md#authsignout) | Signs out the current user. This does not automatically revoke the user's ID token. |
4545
| [updateCurrentUser(user)](./auth.auth.md#authupdatecurrentuser) | Asynchronously sets the provided user as [Auth.currentUser](./auth.auth.md#authcurrentuser) on the [Auth](./auth.auth.md#auth_interface) instance. |
4646
| [useDeviceLanguage()](./auth.auth.md#authusedevicelanguage) | Sets the current language to the default device/browser preference. |
4747

@@ -247,7 +247,7 @@ auth.setPersistence(browserSessionPersistence);
247247

248248
## Auth.signOut()
249249

250-
Signs out the current user.
250+
Signs out the current user. This does not automatically revoke the user's ID token.
251251

252252
<b>Signature:</b>
253253

docs-devsite/auth.multifactorassertion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface MultiFactorAssertion
2424

2525
| Property | Type | Description |
2626
| --- | --- | --- |
27-
| [factorId](./auth.multifactorassertion.md#multifactorassertionfactorid) | typeof [FactorIdMap](./auth.md#factorid)<!-- -->\[keyof typeof [FactorIdMap](./auth.md#factorid)<!-- -->\] | The identifier of the second factor. |
27+
| [factorId](./auth.multifactorassertion.md#multifactorassertionfactorid) | (typeof [FactorIdMap](./auth.md#factorid)<!-- -->)\[keyof typeof [FactorIdMap](./auth.md#factorid)<!-- -->\] | The identifier of the second factor. |
2828

2929
## MultiFactorAssertion.factorId
3030

@@ -33,5 +33,5 @@ The identifier of the second factor.
3333
<b>Signature:</b>
3434

3535
```typescript
36-
readonly factorId: typeof FactorIdMap[keyof typeof FactorIdMap];
36+
readonly factorId: (typeof FactorIdMap)[keyof typeof FactorIdMap];
3737
```

docs-devsite/auth.multifactorerror.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface MultiFactorError extends AuthError
2525
2626
| Property | Type | Description |
2727
| --- | --- | --- |
28-
| [customData](./auth.multifactorerror.md#multifactorerrorcustomdata) | [AuthError](./auth.autherror.md#autherror_interface)<!-- -->\['customData'\] &amp; { readonly operationType: typeof [OperationTypeMap](./auth.md#operationtype)<!-- -->\[keyof typeof [OperationTypeMap](./auth.md#operationtype)<!-- -->\]; } | Details about the MultiFactorError. |
28+
| [customData](./auth.multifactorerror.md#multifactorerrorcustomdata) | [AuthError](./auth.autherror.md#autherror_interface)<!-- -->\['customData'\] &amp; { readonly operationType: (typeof [OperationTypeMap](./auth.md#operationtype)<!-- -->)\[keyof typeof [OperationTypeMap](./auth.md#operationtype)<!-- -->\]; } | Details about the MultiFactorError. |
2929
3030
## MultiFactorError.customData
3131
@@ -35,7 +35,7 @@ Details about the MultiFactorError.
3535
3636
```typescript
3737
readonly customData: AuthError['customData'] & {
38-
readonly operationType: typeof OperationTypeMap[keyof typeof OperationTypeMap];
38+
readonly operationType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap];
3939
};
4040
```
4141

docs-devsite/auth.multifactorinfo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface MultiFactorInfo
2424
| --- | --- | --- |
2525
| [displayName](./auth.multifactorinfo.md#multifactorinfodisplayname) | string \| null | The user friendly name of the current second factor. |
2626
| [enrollmentTime](./auth.multifactorinfo.md#multifactorinfoenrollmenttime) | string | The enrollment date of the second factor formatted as a UTC string. |
27-
| [factorId](./auth.multifactorinfo.md#multifactorinfofactorid) | typeof [FactorIdMap](./auth.md#factorid)<!-- -->\[keyof typeof [FactorIdMap](./auth.md#factorid)<!-- -->\] | The identifier of the second factor. |
27+
| [factorId](./auth.multifactorinfo.md#multifactorinfofactorid) | (typeof [FactorIdMap](./auth.md#factorid)<!-- -->)\[keyof typeof [FactorIdMap](./auth.md#factorid)<!-- -->\] | The identifier of the second factor. |
2828
| [uid](./auth.multifactorinfo.md#multifactorinfouid) | string | The multi-factor enrollment ID. |
2929

3030
## MultiFactorInfo.displayName
@@ -54,7 +54,7 @@ The identifier of the second factor.
5454
<b>Signature:</b>
5555

5656
```typescript
57-
readonly factorId: typeof FactorIdMap[keyof typeof FactorIdMap];
57+
readonly factorId: (typeof FactorIdMap)[keyof typeof FactorIdMap];
5858
```
5959

6060
## MultiFactorInfo.uid

docs-devsite/auth.usercredential.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface UserCredential
2424

2525
| Property | Type | Description |
2626
| --- | --- | --- |
27-
| [operationType](./auth.usercredential.md#usercredentialoperationtype) | typeof [OperationTypeMap](./auth.md#operationtype)<!-- -->\[keyof typeof [OperationTypeMap](./auth.md#operationtype)<!-- -->\] | The type of operation which was used to authenticate the user (such as sign-in or link). |
27+
| [operationType](./auth.usercredential.md#usercredentialoperationtype) | (typeof [OperationTypeMap](./auth.md#operationtype)<!-- -->)\[keyof typeof [OperationTypeMap](./auth.md#operationtype)<!-- -->\] | The type of operation which was used to authenticate the user (such as sign-in or link). |
2828
| [providerId](./auth.usercredential.md#usercredentialproviderid) | string \| null | The provider which was used to authenticate the user. |
2929
| [user](./auth.usercredential.md#usercredentialuser) | [User](./auth.user.md#user_interface) | The user authenticated by this credential. |
3030

@@ -35,7 +35,7 @@ The type of operation which was used to authenticate the user (such as sign-in o
3535
<b>Signature:</b>
3636

3737
```typescript
38-
operationType: typeof OperationTypeMap[keyof typeof OperationTypeMap];
38+
operationType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap];
3939
```
4040

4141
## UserCredential.providerId

docs-devsite/storage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ An enumeration of the possible string formats for upload.
485485
<b>Signature:</b>
486486

487487
```typescript
488-
export declare type StringFormat = typeof StringFormat[keyof typeof StringFormat];
488+
export declare type StringFormat = (typeof StringFormat)[keyof typeof StringFormat];
489489
```
490490

491491
## TaskEvent

packages/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@firebase/util": "1.9.3",
4242
"@firebase/logger": "0.4.0",
4343
"@firebase/component": "0.6.4",
44-
"idb": "7.0.1",
44+
"idb": "7.1.1",
4545
"tslib": "^2.1.0"
4646
},
4747
"license": "Apache-2.0",

packages/app/src/api.test.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,20 @@ describe('API tests', () => {
199199
expect(getApp(appName)).to.equal(app);
200200
});
201201

202-
it('throws retrieving a non existing App', () => {
202+
it('throws retrieving a non existing App (custom name)', () => {
203203
expect(() => getApp('RandomName')).throws(/No Firebase App 'RandomName'/);
204204
});
205+
206+
it('throws retrieving a non existing App (default name)', () => {
207+
expect(() => getApp()).throws(/No Firebase App/);
208+
});
209+
210+
it('does not throw on a non existing App (default name) if a defaults object exists', () => {
211+
global.__FIREBASE_DEFAULTS__ = { config: { apiKey: 'abcd' } };
212+
const app = getApp();
213+
expect(app.options.apiKey).to.equal('abcd');
214+
global.__FIREBASE_DEFAULTS__ = undefined;
215+
});
205216
});
206217

207218
describe('getApps', () => {

packages/app/src/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export function initializeApp(
202202
*/
203203
export function getApp(name: string = DEFAULT_ENTRY_NAME): FirebaseApp {
204204
const app = _apps.get(name);
205-
if (!app && name === DEFAULT_ENTRY_NAME) {
205+
if (!app && name === DEFAULT_ENTRY_NAME && getDefaultAppConfig()) {
206206
return initializeApp();
207207
}
208208
if (!app) {

packages/app/src/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const enum AppError {
3434
const ERRORS: ErrorMap<AppError> = {
3535
[AppError.NO_APP]:
3636
"No Firebase App '{$appName}' has been created - " +
37-
'call Firebase App.initializeApp()',
37+
'call initializeApp() first',
3838
[AppError.BAD_APP_NAME]: "Illegal App name: '{$appName}",
3939
[AppError.DUPLICATE_APP]:
4040
"Firebase App named '{$appName}' already exists with different options or config",

packages/app/src/internal.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
_getProvider,
3131
_removeServiceInstance
3232
} from './internal';
33+
import { logger } from './logger';
3334

3435
declare module '@firebase/component' {
3536
interface NameServiceMapping {
@@ -60,10 +61,12 @@ describe('Internal API tests', () => {
6061
it('does NOT throw registering duplicate components', () => {
6162
const app = initializeApp({}) as FirebaseAppImpl;
6263
const testComp = createTestComponent('test');
64+
const debugStub = stub(logger, 'debug');
6365

6466
_addComponent(app, testComp);
6567

6668
expect(() => _addComponent(app, testComp)).to.not.throw();
69+
expect(debugStub).to.be.called;
6770
expect(app.container.getProvider('test').getComponent()).to.equal(
6871
testComp
6972
);

0 commit comments

Comments
 (0)