Skip to content

Commit

Permalink
Merge branch 'master' into jw/get-index-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwski committed May 19, 2021
2 parents 156b84f + 997040a commit 0ef4c5b
Show file tree
Hide file tree
Showing 257 changed files with 6,567 additions and 759 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-mangos-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/auth": patch
---

Ensure emulator warning text is accessible.
5 changes: 5 additions & 0 deletions .changeset/perfect-comics-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/firestore": patch
---

Use 'pagehide' for page termination by default.
5 changes: 5 additions & 0 deletions .changeset/silent-planets-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/rules-unit-testing": patch
---

Allow using useEmulators() with only the storage configuration.
5 changes: 5 additions & 0 deletions .changeset/tender-eels-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/functions': patch
---

Fixed a bug in `httpsCallable()` when used in the same project as Firebase Messaging.
12 changes: 6 additions & 6 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ packages/messaging-types @zwu52 @chliangGoogle @ciarand @firebase/jssdk-global-a
integration/messaging @zwu52 @chliangGoogle @ciarand @firebase/jssdk-global-approvers

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

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

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

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

# Installations-Exp Code
packages/installations-exp @andirayo @ChaoqunCHEN @firebase/jssdk-global-approvers
Expand Down
43 changes: 0 additions & 43 deletions .github/ISSUE_TEMPLATE/alpha_bug_report.md

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/canary-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
NPM_TOKEN_ANALYTICS_TYPES: ${{secrets.NPM_TOKEN_ANALYTICS_TYPES}}
NPM_TOKEN_APP: ${{secrets.NPM_TOKEN_APP}}
NPM_TOKEN_APP_TYPES: ${{secrets.NPM_TOKEN_APP_TYPES}}
NPM_TOKEN_APP_CHECK: ${{secrets.NPM_TOKEN_APP_CHECK}}
NPM_TOKEN_APP_CHECK_INTEROP_TYPES: ${{secrets.NPM_TOKEN_APP_CHECK_INTEROP_TYPES}}
NPM_TOKEN_APP_CHECK_TYPES: ${{secrets.NPM_TOKEN_APP_CHECK_TYPES}}
NPM_TOKEN_AUTH: ${{secrets.NPM_TOKEN_AUTH}}
NPM_TOKEN_AUTH_INTEROP_TYPES: ${{secrets.NPM_TOKEN_AUTH_INTEROP_TYPES}}
NPM_TOKEN_AUTH_TYPES: ${{secrets.NPM_TOKEN_AUTH_TYPES}}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/health-metrics-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
METRICS_SERVICE_URL: ${{ secrets.METRICS_SERVICE_URL }}
GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
NODE_OPTIONS: "--max-old-space-size=4096"

jobs:
binary-size:
Expand Down
7 changes: 5 additions & 2 deletions common/api-review/database.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
```ts

import { EmulatorMockTokenOptions } from '@firebase/util';
import { FirebaseApp } from '@firebase/app';

// @public (undocumented)
// @public
export function child(parent: Reference, path: string): Reference;

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

// @public
export function useDatabaseEmulator(db: FirebaseDatabase, host: string, port: number): void;
export function useDatabaseEmulator(db: FirebaseDatabase, host: string, port: number, options?: {
mockUserToken?: EmulatorMockTokenOptions;
}): void;


```
1 change: 1 addition & 0 deletions common/api-review/storage.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
```ts

import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { CompleteFn } from '@firebase/util';
import { FirebaseApp } from '@firebase/app';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
Expand Down
2 changes: 1 addition & 1 deletion integration/firebase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test"
},
"devDependencies": {
"firebase": "8.4.1",
"firebase": "8.6.1",
"@types/chai": "4.2.14",
"@types/mocha": "7.0.2",
"chai": "4.2.0",
Expand Down
4 changes: 2 additions & 2 deletions integration/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"test:memory:debug": "yarn build:memory; karma start --auto-watch --browsers Chrome"
},
"devDependencies": {
"@firebase/app": "0.6.20",
"@firebase/firestore": "2.2.4",
"@firebase/app": "0.6.22",
"@firebase/firestore": "2.3.0",
"@types/mocha": "7.0.2",
"gulp": "4.0.2",
"gulp-filter": "6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion integration/messaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test:manual": "mocha --exit"
},
"devDependencies": {
"firebase": "8.4.1",
"firebase": "8.6.1",
"chai": "4.2.0",
"chromedriver": "89.0.0",
"express": "4.17.1",
Expand Down
4 changes: 2 additions & 2 deletions packages-exp/analytics-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
},
"typings": "dist/src/index.d.ts",
"dependencies": {
"@firebase/component": "0.4.1",
"@firebase/component": "0.5.0",
"@firebase/analytics-exp": "0.0.900",
"@firebase/analytics-types": "0.4.0",
"@firebase/util": "1.0.0",
"@firebase/util": "1.1.0",
"tslib": "^2.1.0"
},
"nyc": {
Expand Down
4 changes: 2 additions & 2 deletions packages-exp/analytics-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"dependencies": {
"@firebase/installations-exp": "0.0.900",
"@firebase/logger": "0.2.6",
"@firebase/util": "1.0.0",
"@firebase/component": "0.4.1",
"@firebase/util": "1.1.0",
"@firebase/component": "0.5.0",
"tslib": "^2.1.0"
},
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages-exp/app-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"license": "Apache-2.0",
"dependencies": {
"@firebase/app-exp": "0.0.900",
"@firebase/util": "1.0.0",
"@firebase/util": "1.1.0",
"@firebase/logger": "0.2.6",
"@firebase/component": "0.4.1",
"@firebase/component": "0.5.0",
"tslib": "^2.1.0",
"dom-storage": "2.1.0",
"xmlhttprequest": "1.8.0"
Expand Down
12 changes: 11 additions & 1 deletion packages-exp/app-compat/src/firebaseApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
Component,
ComponentContainer,
ComponentType,
InstantiationMode,
Name
} from '@firebase/component';
import {
Expand Down Expand Up @@ -121,8 +122,17 @@ export class FirebaseAppImpl implements Compat<_FirebaseAppExp>, _FirebaseApp {
): _FirebaseService {
this._delegate.checkDestroyed();

// Initialize instance if InstatiationMode is `EXPLICIT`.
const provider = this._delegate.container.getProvider(name as Name);
if (
!provider.isInitialized() &&
provider.getComponent()?.instantiationMode === InstantiationMode.EXPLICIT
) {
provider.initialize();
}

// getImmediate will always succeed because _getService is only called for registered components.
return (this._delegate.container.getProvider(name as Name).getImmediate({
return (provider.getImmediate({
identifier: instanceIdentifier
}) as unknown) as _FirebaseService;
}
Expand Down
4 changes: 2 additions & 2 deletions packages-exp/app-compat/src/lite/firebaseNamespaceLite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export function createFirebaseNamespaceLite(): FirebaseNamespace {
// only allow performance to register with firebase lite
if (
component.type === ComponentType.PUBLIC &&
component.name !== 'performance' &&
component.name !== 'installations'
!component.name.includes('performance') &&
!component.name.includes('installations')
) {
throw Error(`${name} cannot register with the standalone perf instance`);
}
Expand Down
72 changes: 71 additions & 1 deletion packages-exp/app-compat/test/firebaseAppCompat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import { stub } from 'sinon';
import { FirebaseNamespace, FirebaseOptions } from '../src/public-types';
import { _FirebaseApp, _FirebaseNamespace } from '../src/types';
import { _components, _clearComponents } from '@firebase/app-exp';
import { ComponentType } from '@firebase/component';
import {
Component,
ComponentType,
InstantiationMode
} from '@firebase/component';

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

expect(serviceNamespace).to.eq(serviceNamespace2);
expect(registerStub).to.have.not.thrown();
registerStub.restore();
});

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

it('does not instantiate explicit components unless called explicitly', () => {
firebase.initializeApp({});
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
createTestComponent('explicit1').setInstantiationMode(
InstantiationMode.EXPLICIT
)
);

let explicitService;

// Expect getImmediate in a consuming component to return null.
const consumerComponent = new Component(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
'consumer' as any,
container => {
explicitService = container
.getProvider('explicit1' as any)
.getImmediate({ optional: true });
return new TestService(
container.getProvider('app-compat').getImmediate()
);
},
ComponentType.PUBLIC
);
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
consumerComponent
);

(firebase as any).consumer();
expect(explicitService).to.be.null;
});

it('does instantiate explicit components when called explicitly', () => {
firebase.initializeApp({});
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
createTestComponent('explicit2').setInstantiationMode(
InstantiationMode.EXPLICIT
)
);

let explicitService;

// Expect getImmediate in a consuming component to return the service.
const consumerComponent = new Component(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
'consumer' as any,
container => {
explicitService = container
.getProvider('explicit2' as any)
.getImmediate({ optional: true });
return new TestService(
container.getProvider('app-compat').getImmediate()
);
},
ComponentType.PUBLIC
);
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
consumerComponent
);

(firebase as any).explicit2();
(firebase as any).consumer();
expect(explicitService).to.not.be.null;
});

it(`creates a new instance of a service after removing the existing instance`, () => {
const app = firebase.initializeApp({});
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
Expand Down
4 changes: 2 additions & 2 deletions packages-exp/app-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"typings:internal": "node ../../scripts/exp/use_typings.js ./dist/app-exp.d.ts"
},
"dependencies": {
"@firebase/util": "1.0.0",
"@firebase/util": "1.1.0",
"@firebase/logger": "0.2.6",
"@firebase/component": "0.4.1",
"@firebase/component": "0.5.0",
"tslib": "^2.1.0"
},
"license": "Apache-2.0",
Expand Down
6 changes: 3 additions & 3 deletions packages-exp/auth-compat-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
},
"dependencies": {
"@firebase/auth-exp": "0.0.900",
"@firebase/auth-types": "0.10.2",
"@firebase/component": "0.4.1",
"@firebase/util": "1.0.0",
"@firebase/auth-types": "0.10.3",
"@firebase/component": "0.5.0",
"@firebase/util": "1.1.0",
"node-fetch": "2.6.1",
"selenium-webdriver": "^4.0.0-beta.2",
"tslib": "^2.1.0"
Expand Down
8 changes: 8 additions & 0 deletions packages-exp/auth-compat-exp/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ export class Auth
}
return convertCredential(this._delegate, Promise.resolve(credential));
}

// This function should only be called by frameworks (e.g. FirebaseUI-web) to log their usage.
// It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it
// out of autogenerated documentation pages to reduce accidental misuse.
addFrameworkForLogging(framework: string): void {
exp.addFrameworkForLogging(this._delegate, framework);
}

onAuthStateChanged(
nextOrObserver: Observer<unknown> | ((a: compat.User | null) => unknown),
errorFn?: (error: compat.Error) => unknown,
Expand Down
Loading

0 comments on commit 0ef4c5b

Please sign in to comment.