Skip to content

Commit 0ef4c5b

Browse files
committed
Merge branch 'master' into jw/get-index-fix
2 parents 156b84f + 997040a commit 0ef4c5b

File tree

257 files changed

+6567
-759
lines changed

Some content is hidden

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

257 files changed

+6567
-759
lines changed

.changeset/fast-mangos-serve.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+
Ensure emulator warning text is accessible.

.changeset/perfect-comics-march.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+
Use 'pagehide' for page termination by default.

.changeset/silent-planets-raise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/rules-unit-testing": patch
3+
---
4+
5+
Allow using useEmulators() with only the storage configuration.

.changeset/tender-eels-greet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/functions': patch
3+
---
4+
5+
Fixed a bug in `httpsCallable()` when used in the same project as Firebase Messaging.

.github/CODEOWNERS

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ packages/messaging-types @zwu52 @chliangGoogle @ciarand @firebase/jssdk-global-a
5555
integration/messaging @zwu52 @chliangGoogle @ciarand @firebase/jssdk-global-approvers
5656

5757
# Auth Code
58-
packages/auth @bojeil-google @avolkovi @samhorlbeck @yuchenshi @firebase/jssdk-global-approvers
59-
packages/auth-types @bojeil-google @avolkovi @samhorlbeck @yuchenshi @firebase/jssdk-global-approvers
58+
packages/auth @bojeil-google @avolkovi @sam-gc @yuchenshi @firebase/jssdk-global-approvers
59+
packages/auth-types @bojeil-google @avolkovi @sam-gc @yuchenshi @firebase/jssdk-global-approvers
6060

6161
# Testing Code
62-
packages/testing @avolkovi @samhorlbeck @yuchenshi @firebase/jssdk-global-approvers
63-
packages/rules-unit-testing @avolkovi @samhorlbeck @yuchenshi @firebase/jssdk-global-approvers
62+
packages/testing @avolkovi @sam-gc @yuchenshi @firebase/jssdk-global-approvers
63+
packages/rules-unit-testing @avolkovi @sam-gc @yuchenshi @firebase/jssdk-global-approvers
6464

6565
# RxFire Code
6666
packages/rxfire @davideast @jamesdaniels @firebase/jssdk-global-approvers
@@ -89,8 +89,8 @@ scripts/docgen/content-sources/ @firebase/firebase-techwriters @firebase/jssdk-g
8989
.changeset @firebase/firebase-techwriters @firebase/jssdk-changeset-approvers @firebase/firestore-js-team @firebase/jssdk-global-approvers
9090

9191
# Auth-Exp Code
92-
packages-exp/auth-exp @avolkovi @samhorlbeck @yuchenshi @firebase/jssdk-global-approvers
93-
packages-exp/auth-compat-exp @avolkovi @samhorlbeck @yuchenshi @firebase/jssdk-global-approvers
92+
packages-exp/auth-exp @avolkovi @sam-gc @yuchenshi @firebase/jssdk-global-approvers
93+
packages-exp/auth-compat-exp @avolkovi @sam-gc @yuchenshi @firebase/jssdk-global-approvers
9494

9595
# Installations-Exp Code
9696
packages/installations-exp @andirayo @ChaoqunCHEN @firebase/jssdk-global-approvers

.github/ISSUE_TEMPLATE/alpha_bug_report.md

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/canary-deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
NPM_TOKEN_ANALYTICS_TYPES: ${{secrets.NPM_TOKEN_ANALYTICS_TYPES}}
3131
NPM_TOKEN_APP: ${{secrets.NPM_TOKEN_APP}}
3232
NPM_TOKEN_APP_TYPES: ${{secrets.NPM_TOKEN_APP_TYPES}}
33+
NPM_TOKEN_APP_CHECK: ${{secrets.NPM_TOKEN_APP_CHECK}}
34+
NPM_TOKEN_APP_CHECK_INTEROP_TYPES: ${{secrets.NPM_TOKEN_APP_CHECK_INTEROP_TYPES}}
35+
NPM_TOKEN_APP_CHECK_TYPES: ${{secrets.NPM_TOKEN_APP_CHECK_TYPES}}
3336
NPM_TOKEN_AUTH: ${{secrets.NPM_TOKEN_AUTH}}
3437
NPM_TOKEN_AUTH_INTEROP_TYPES: ${{secrets.NPM_TOKEN_AUTH_INTEROP_TYPES}}
3538
NPM_TOKEN_AUTH_TYPES: ${{secrets.NPM_TOKEN_AUTH_TYPES}}

.github/workflows/health-metrics-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ env:
66
METRICS_SERVICE_URL: ${{ secrets.METRICS_SERVICE_URL }}
77
GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
88
GITHUB_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
9+
NODE_OPTIONS: "--max-old-space-size=4096"
910

1011
jobs:
1112
binary-size:

common/api-review/database.api.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
55
```ts
66

7+
import { EmulatorMockTokenOptions } from '@firebase/util';
78
import { FirebaseApp } from '@firebase/app';
89

9-
// @public (undocumented)
10+
// @public
1011
export function child(parent: Reference, path: string): Reference;
1112

1213
// @public
@@ -229,7 +230,9 @@ export type Unsubscribe = () => void;
229230
export function update(ref: Reference, values: object): Promise<void>;
230231

231232
// @public
232-
export function useDatabaseEmulator(db: FirebaseDatabase, host: string, port: number): void;
233+
export function useDatabaseEmulator(db: FirebaseDatabase, host: string, port: number, options?: {
234+
mockUserToken?: EmulatorMockTokenOptions;
235+
}): void;
233236

234237

235238
```

common/api-review/storage.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
```ts
66

7+
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
78
import { CompleteFn } from '@firebase/util';
89
import { FirebaseApp } from '@firebase/app';
910
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';

integration/firebase/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test"
88
},
99
"devDependencies": {
10-
"firebase": "8.4.1",
10+
"firebase": "8.6.1",
1111
"@types/chai": "4.2.14",
1212
"@types/mocha": "7.0.2",
1313
"chai": "4.2.0",

integration/firestore/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"test:memory:debug": "yarn build:memory; karma start --auto-watch --browsers Chrome"
1515
},
1616
"devDependencies": {
17-
"@firebase/app": "0.6.20",
18-
"@firebase/firestore": "2.2.4",
17+
"@firebase/app": "0.6.22",
18+
"@firebase/firestore": "2.3.0",
1919
"@types/mocha": "7.0.2",
2020
"gulp": "4.0.2",
2121
"gulp-filter": "6.0.0",

integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"test:manual": "mocha --exit"
1010
},
1111
"devDependencies": {
12-
"firebase": "8.4.1",
12+
"firebase": "8.6.1",
1313
"chai": "4.2.0",
1414
"chromedriver": "89.0.0",
1515
"express": "4.17.1",

packages-exp/analytics-compat/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
},
4545
"typings": "dist/src/index.d.ts",
4646
"dependencies": {
47-
"@firebase/component": "0.4.1",
47+
"@firebase/component": "0.5.0",
4848
"@firebase/analytics-exp": "0.0.900",
4949
"@firebase/analytics-types": "0.4.0",
50-
"@firebase/util": "1.0.0",
50+
"@firebase/util": "1.1.0",
5151
"tslib": "^2.1.0"
5252
},
5353
"nyc": {

packages-exp/analytics-exp/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"dependencies": {
3535
"@firebase/installations-exp": "0.0.900",
3636
"@firebase/logger": "0.2.6",
37-
"@firebase/util": "1.0.0",
38-
"@firebase/component": "0.4.1",
37+
"@firebase/util": "1.1.0",
38+
"@firebase/component": "0.5.0",
3939
"tslib": "^2.1.0"
4040
},
4141
"license": "Apache-2.0",

packages-exp/app-compat/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
"license": "Apache-2.0",
3030
"dependencies": {
3131
"@firebase/app-exp": "0.0.900",
32-
"@firebase/util": "1.0.0",
32+
"@firebase/util": "1.1.0",
3333
"@firebase/logger": "0.2.6",
34-
"@firebase/component": "0.4.1",
34+
"@firebase/component": "0.5.0",
3535
"tslib": "^2.1.0",
3636
"dom-storage": "2.1.0",
3737
"xmlhttprequest": "1.8.0"

packages-exp/app-compat/src/firebaseApp.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
Component,
2121
ComponentContainer,
2222
ComponentType,
23+
InstantiationMode,
2324
Name
2425
} from '@firebase/component';
2526
import {
@@ -121,8 +122,17 @@ export class FirebaseAppImpl implements Compat<_FirebaseAppExp>, _FirebaseApp {
121122
): _FirebaseService {
122123
this._delegate.checkDestroyed();
123124

125+
// Initialize instance if InstatiationMode is `EXPLICIT`.
126+
const provider = this._delegate.container.getProvider(name as Name);
127+
if (
128+
!provider.isInitialized() &&
129+
provider.getComponent()?.instantiationMode === InstantiationMode.EXPLICIT
130+
) {
131+
provider.initialize();
132+
}
133+
124134
// getImmediate will always succeed because _getService is only called for registered components.
125-
return (this._delegate.container.getProvider(name as Name).getImmediate({
135+
return (provider.getImmediate({
126136
identifier: instanceIdentifier
127137
}) as unknown) as _FirebaseService;
128138
}

packages-exp/app-compat/src/lite/firebaseNamespaceLite.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export function createFirebaseNamespaceLite(): FirebaseNamespace {
4040
// only allow performance to register with firebase lite
4141
if (
4242
component.type === ComponentType.PUBLIC &&
43-
component.name !== 'performance' &&
44-
component.name !== 'installations'
43+
!component.name.includes('performance') &&
44+
!component.name.includes('installations')
4545
) {
4646
throw Error(`${name} cannot register with the standalone perf instance`);
4747
}

packages-exp/app-compat/test/firebaseAppCompat.test.ts

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ import { stub } from 'sinon';
2121
import { FirebaseNamespace, FirebaseOptions } from '../src/public-types';
2222
import { _FirebaseApp, _FirebaseNamespace } from '../src/types';
2323
import { _components, _clearComponents } from '@firebase/app-exp';
24-
import { ComponentType } from '@firebase/component';
24+
import {
25+
Component,
26+
ComponentType,
27+
InstantiationMode
28+
} from '@firebase/component';
2529

2630
import { createFirebaseNamespace } from '../src/firebaseNamespace';
2731
import { createFirebaseNamespaceLite } from '../src/lite/firebaseNamespaceLite';
@@ -67,6 +71,7 @@ function executeFirebaseTests(): void {
6771

6872
expect(serviceNamespace).to.eq(serviceNamespace2);
6973
expect(registerStub).to.have.not.thrown();
74+
registerStub.restore();
7075
});
7176

7277
it('returns cached service instances', () => {
@@ -80,6 +85,71 @@ function executeFirebaseTests(): void {
8085
expect(service).to.eq((firebase as any).test());
8186
});
8287

88+
it('does not instantiate explicit components unless called explicitly', () => {
89+
firebase.initializeApp({});
90+
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
91+
createTestComponent('explicit1').setInstantiationMode(
92+
InstantiationMode.EXPLICIT
93+
)
94+
);
95+
96+
let explicitService;
97+
98+
// Expect getImmediate in a consuming component to return null.
99+
const consumerComponent = new Component(
100+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
101+
'consumer' as any,
102+
container => {
103+
explicitService = container
104+
.getProvider('explicit1' as any)
105+
.getImmediate({ optional: true });
106+
return new TestService(
107+
container.getProvider('app-compat').getImmediate()
108+
);
109+
},
110+
ComponentType.PUBLIC
111+
);
112+
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
113+
consumerComponent
114+
);
115+
116+
(firebase as any).consumer();
117+
expect(explicitService).to.be.null;
118+
});
119+
120+
it('does instantiate explicit components when called explicitly', () => {
121+
firebase.initializeApp({});
122+
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
123+
createTestComponent('explicit2').setInstantiationMode(
124+
InstantiationMode.EXPLICIT
125+
)
126+
);
127+
128+
let explicitService;
129+
130+
// Expect getImmediate in a consuming component to return the service.
131+
const consumerComponent = new Component(
132+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
133+
'consumer' as any,
134+
container => {
135+
explicitService = container
136+
.getProvider('explicit2' as any)
137+
.getImmediate({ optional: true });
138+
return new TestService(
139+
container.getProvider('app-compat').getImmediate()
140+
);
141+
},
142+
ComponentType.PUBLIC
143+
);
144+
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
145+
consumerComponent
146+
);
147+
148+
(firebase as any).explicit2();
149+
(firebase as any).consumer();
150+
expect(explicitService).to.not.be.null;
151+
});
152+
83153
it(`creates a new instance of a service after removing the existing instance`, () => {
84154
const app = firebase.initializeApp({});
85155
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(

packages-exp/app-exp/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"typings:internal": "node ../../scripts/exp/use_typings.js ./dist/app-exp.d.ts"
3131
},
3232
"dependencies": {
33-
"@firebase/util": "1.0.0",
33+
"@firebase/util": "1.1.0",
3434
"@firebase/logger": "0.2.6",
35-
"@firebase/component": "0.4.1",
35+
"@firebase/component": "0.5.0",
3636
"tslib": "^2.1.0"
3737
},
3838
"license": "Apache-2.0",

packages-exp/auth-compat-exp/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
},
3434
"dependencies": {
3535
"@firebase/auth-exp": "0.0.900",
36-
"@firebase/auth-types": "0.10.2",
37-
"@firebase/component": "0.4.1",
38-
"@firebase/util": "1.0.0",
36+
"@firebase/auth-types": "0.10.3",
37+
"@firebase/component": "0.5.0",
38+
"@firebase/util": "1.1.0",
3939
"node-fetch": "2.6.1",
4040
"selenium-webdriver": "^4.0.0-beta.2",
4141
"tslib": "^2.1.0"

packages-exp/auth-compat-exp/src/auth.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ export class Auth
170170
}
171171
return convertCredential(this._delegate, Promise.resolve(credential));
172172
}
173+
174+
// This function should only be called by frameworks (e.g. FirebaseUI-web) to log their usage.
175+
// It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it
176+
// out of autogenerated documentation pages to reduce accidental misuse.
177+
addFrameworkForLogging(framework: string): void {
178+
exp.addFrameworkForLogging(this._delegate, framework);
179+
}
180+
173181
onAuthStateChanged(
174182
nextOrObserver: Observer<unknown> | ((a: compat.User | null) => unknown),
175183
errorFn?: (error: compat.Error) => unknown,

0 commit comments

Comments
 (0)