Skip to content

Commit d37fbca

Browse files
committed
Merge branch 'master' into fei-firestore-wait
2 parents eded4b7 + 5ad33ab commit d37fbca

File tree

141 files changed

+4451
-427
lines changed

Some content is hidden

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

141 files changed

+4451
-427
lines changed

.changeset/clever-icons-leave.md

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

.changeset/friendly-cooks-tan.md

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

.changeset/loud-feet-jump.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@firebase/database": minor
3+
"firebase": minor
4+
"@firebase/util": minor
5+
---
6+
7+
Add mockUserToken support for database emulator.

.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.

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.4.3",
1111
"@types/chai": "4.2.14",
1212
"@types/mocha": "7.0.2",
1313
"chai": "4.2.0",

integration/firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"devDependencies": {
1717
"@firebase/app": "0.6.20",
18-
"@firebase/firestore": "2.2.4",
18+
"@firebase/firestore": "2.2.5",
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.4.3",
1313
"chai": "4.2.0",
1414
"chromedriver": "89.0.0",
1515
"express": "4.17.1",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"dependencies": {
3535
"@firebase/auth-exp": "0.0.900",
36-
"@firebase/auth-types": "0.10.2",
36+
"@firebase/auth-types": "0.10.3",
3737
"@firebase/component": "0.4.1",
3838
"@firebase/util": "1.0.0",
3939
"node-fetch": "2.6.1",

packages-exp/auth-exp/src/core/user/token_manager.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ export const enum Buffer {
3232
TOKEN_REFRESH = 30_000
3333
}
3434

35+
/**
36+
* We need to mark this class as internal explicitly to exclude it in the public typings, because
37+
* it references AuthInternal which has a circular dependency with UserInternal.
38+
*
39+
* @internal
40+
*/
3541
export class StsTokenManager {
3642
refreshToken: string | null = null;
3743
accessToken: string | null = null;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ export interface ConfigInternal extends Config {
4848
clientPlatform: ClientPlatform;
4949
}
5050

51+
/**
52+
* UserInternal and AuthInternal reference each other, so both of them are included in the public typings.
53+
* In order to exclude them, we mark them as internal explicitly.
54+
*
55+
* @internal
56+
*/
5157
export interface AuthInternal extends Auth {
5258
currentUser: User | null;
5359
emulatorConfig: EmulatorConfig | null;

packages-exp/auth-exp/src/model/popup_redirect.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ export interface EventManager {
7979
unregisterConsumer(authEventConsumer: AuthEventConsumer): void;
8080
}
8181

82+
/**
83+
* We need to mark this interface as internal explicitly to exclude it in the public typings, because
84+
* it references AuthInternal which has a circular dependency with UserInternal.
85+
*
86+
* @internal
87+
*/
8288
export interface PopupRedirectResolverInternal extends PopupRedirectResolver {
8389
// Whether or not to initialize the event manager early
8490
_shouldInitProactively: boolean;

packages-exp/auth-exp/src/model/user.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ export interface UserParameters {
5252
lastLoginAt?: string | null;
5353
}
5454

55+
/**
56+
* UserInternal and AuthInternal reference each other, so both of them are included in the public typings.
57+
* In order to exclude them, we mark them as internal explicitly.
58+
*
59+
* @internal
60+
*/
5561
export interface UserInternal extends User {
5662
displayName: string | null;
5763
email: string | null;

packages-exp/auth-exp/src/platform_browser/recaptcha/recaptcha_loader.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ export const _JSLOAD_CALLBACK = jsHelpers._generateCallbackName('rcb');
3232
const NETWORK_TIMEOUT_DELAY = new Delay(30000, 60000);
3333
const RECAPTCHA_BASE = 'https://www.google.com/recaptcha/api.js?';
3434

35+
/**
36+
* We need to mark this interface as internal explicitly to exclude it in the public typings, because
37+
* it references AuthInternal which has a circular dependency with UserInternal.
38+
*
39+
* @internal
40+
*/
3541
export interface ReCaptchaLoader {
3642
load(auth: AuthInternal, hl?: string): Promise<Recaptcha>;
3743
clearedOneInstance(): void;

packages-exp/firebase-exp/package.json

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@
5252
"node": "./functions/dist/index.cjs.js",
5353
"default": "./functions/dist/index.esm.js"
5454
},
55-
"./installations": {
56-
"node": "./installations/dist/index.cjs.js",
57-
"default": "./installations/dist/index.esm.js"
58-
},
5955
"./messaging": {
6056
"node": "./messaging/dist/index.cjs.js",
6157
"default": "./messaging/dist/index.esm.js"
@@ -96,10 +92,6 @@
9692
"node": "./compat/functions/dist/index.cjs.js",
9793
"default": "./compat/functions/dist/index.esm.js"
9894
},
99-
"./compat/installations": {
100-
"node": "./compat/installations/dist/index.cjs.js",
101-
"default": "./compat/installations/dist/index.esm.js"
102-
},
10395
"./compat/messaging": {
10496
"node": "./compat/messaging/dist/index.cjs.js",
10597
"default": "./compat/messaging/dist/index.esm.js"
@@ -137,11 +129,11 @@
137129
"@firebase/app-compat": "0.0.900",
138130
"@firebase/auth-exp": "0.0.900",
139131
"@firebase/auth-compat": "0.0.900",
140-
"@firebase/database": "0.9.10",
132+
"@firebase/database": "0.9.12",
141133
"@firebase/functions-exp": "0.0.900",
142134
"@firebase/functions-compat": "0.0.900",
143-
"@firebase/firestore": "2.2.4",
144-
"@firebase/storage": "0.5.0",
135+
"@firebase/firestore": "2.2.5",
136+
"@firebase/storage": "0.5.1",
145137
"@firebase/performance-exp": "0.0.900",
146138
"@firebase/performance-compat": "0.0.900",
147139
"@firebase/remote-config-exp": "0.0.900",

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

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import {
2424
MessagePayload,
2525
deleteToken,
2626
getToken,
27-
onMessage,
28-
onBackgroundMessage
27+
onBackgroundMessage,
28+
onMessage
2929
} from '@firebase/messaging-exp';
3030
import { NextFn, Observer, Unsubscribe } from '@firebase/util';
3131

@@ -46,6 +46,47 @@ export interface MessagingCompat {
4646
): Unsubscribe;
4747
}
4848

49+
export function isSupported(): boolean {
50+
if (self && 'ServiceWorkerGlobalScope' in self) {
51+
// Running in ServiceWorker context
52+
return isSwSupported();
53+
} else {
54+
// Assume we are in the window context.
55+
return isWindowSupported();
56+
}
57+
}
58+
59+
/**
60+
* Checks to see if the required APIs exist.
61+
*/
62+
function isWindowSupported(): boolean {
63+
return (
64+
'indexedDB' in window &&
65+
indexedDB !== null &&
66+
navigator.cookieEnabled &&
67+
'serviceWorker' in navigator &&
68+
'PushManager' in window &&
69+
'Notification' in window &&
70+
'fetch' in window &&
71+
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
72+
PushSubscription.prototype.hasOwnProperty('getKey')
73+
);
74+
}
75+
76+
/**
77+
* Checks to see if the required APIs exist within SW Context.
78+
*/
79+
function isSwSupported(): boolean {
80+
return (
81+
'indexedDB' in self &&
82+
indexedDB !== null &&
83+
'PushManager' in self &&
84+
'Notification' in self &&
85+
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
86+
PushSubscription.prototype.hasOwnProperty('getKey')
87+
);
88+
}
89+
4990
export class MessagingCompatImpl implements MessagingCompat, _FirebaseService {
5091
swRegistration?: ServiceWorkerRegistration;
5192
vapidKey?: string;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# @firebase/app-check-interop-types
2+
3+
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
export interface FirebaseAppCheckInternal {
19+
// Get the current AttestationToken. Attaches to the most recent in-flight request if one
20+
// is present. Returns null if no token is present and no token requests are in-flight.
21+
getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
22+
23+
// Registers a listener to changes in the token state. There can be more than one listener
24+
// registered at the same time for one or more FirebaseAppAttestation instances. The
25+
// listeners call back on the UI thread whenever the current token associated with this
26+
// FirebaseAppAttestation changes.
27+
addTokenListener(listener: AppCheckTokenListener): void;
28+
29+
// Unregisters a listener to changes in the token state.
30+
removeTokenListener(listener: AppCheckTokenListener): void;
31+
}
32+
33+
type AppCheckTokenListener = (token: AppCheckTokenResult) => void;
34+
35+
// If the error field is defined, the token field will be populated with a dummy token
36+
interface AppCheckTokenResult {
37+
readonly token: string;
38+
readonly error?: Error;
39+
}
40+
41+
export type AppCheckInternalComponentName = 'app-check-internal';
42+
43+
declare module '@firebase/component' {
44+
interface NameServiceMapping {
45+
'app-check-internal': FirebaseAppCheckInternal;
46+
}
47+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "@firebase/app-check-interop-types",
3+
"private": true,
4+
"version": "0.1.0",
5+
"description": "@firebase/app-check-interop-types Types",
6+
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
7+
"license": "Apache-2.0",
8+
"scripts": {
9+
"test": "tsc",
10+
"test:ci": "node ../../scripts/run_tests_in_ci.js"
11+
},
12+
"files": [
13+
"index.d.ts"
14+
],
15+
"repository": {
16+
"directory": "packages/app-check-interop-types",
17+
"type": "git",
18+
"url": "https://github.com/firebase/firebase-js-sdk.git"
19+
},
20+
"bugs": {
21+
"url": "https://github.com/firebase/firebase-js-sdk/issues"
22+
},
23+
"devDependencies": {
24+
"typescript": "4.2.2"
25+
}
26+
}

0 commit comments

Comments
 (0)