Skip to content

Commit cbef312

Browse files
committed
Merge branch 'master' into renovate/ts-node-10.x
2 parents 8b83f0d + a4b7003 commit cbef312

File tree

30 files changed

+390
-97
lines changed

30 files changed

+390
-97
lines changed

.changeset/cyan-eagles-carry.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+
Fixes a deadlock during asynchronous initialization of both Firestore and Auth.

.changeset/slimy-penguins-itch.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+
Remove `const enum`s from the public typing file.

.changeset/spicy-moose-approve.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+
Temporary fix for a bug causing `initializeFirestore()` to not work with certain bundling pipelines.

.changeset/tender-pumpkins-love.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/storage': patch
3+
---
4+
5+
Store protocol and host separately on Storage service instance. Fixes a bug when generating url strings.

common/api-review/storage.api.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export class _FirebaseStorageImpl implements FirebaseStorage {
7575
_getAppCheckToken(): Promise<string | null>;
7676
// (undocumented)
7777
_getAuthToken(): Promise<string | null>;
78-
// (undocumented)
7978
get host(): string;
8079
set host(host: string);
8180
// Warning: (ae-forgotten-export) The symbol "RequestInfo" needs to be exported by the entry point index.d.ts
@@ -97,6 +96,8 @@ export class _FirebaseStorageImpl implements FirebaseStorage {
9796
// (undocumented)
9897
readonly _pool: ConnectionPool;
9998
// (undocumented)
99+
_protocol: string;
100+
// (undocumented)
100101
readonly _url?: string | undefined;
101102
}
102103

@@ -292,7 +293,7 @@ export interface UploadResult {
292293
}
293294

294295
// @public
295-
export function uploadString(ref: StorageReference, value: string, format?: string, metadata?: UploadMetadata): Promise<UploadResult>;
296+
export function uploadString(ref: StorageReference, value: string, format?: StringFormat, metadata?: UploadMetadata): Promise<UploadResult>;
296297

297298
// @public
298299
export interface UploadTask {

integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"devDependencies": {
1212
"firebase": "9.0.1",
1313
"chai": "4.3.4",
14-
"chromedriver": "91.0.0",
14+
"chromedriver": "93.0.1",
1515
"express": "4.17.1",
1616
"geckodriver": "2.0.3",
1717
"mocha": "9.1.1",

packages/auth-compat/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"license": "Apache-2.0",
2828
"devDependencies": {
29-
"rollup": "1.32.1",
29+
"rollup": "2.56.3",
3030
"@rollup/plugin-json": "4.1.0",
3131
"rollup-plugin-replace": "2.2.0",
3232
"@rollup/plugin-commonjs": "17.1.0",

packages/auth-compat/demo/yarn.lock

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,11 +1017,6 @@ abbrev@1:
10171017
resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
10181018
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
10191019

1020-
acorn@^7.1.0:
1021-
version "7.4.1"
1022-
resolved "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
1023-
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
1024-
10251020
add-stream@^1.0.0:
10261021
version "1.0.0"
10271022
resolved "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa"
@@ -1981,6 +1976,11 @@ fs.realpath@^1.0.0:
19811976
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
19821977
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
19831978

1979+
fsevents@~2.3.2:
1980+
version "2.3.2"
1981+
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
1982+
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
1983+
19841984
function-bind@^1.1.1:
19851985
version "1.1.1"
19861986
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
@@ -3944,14 +3944,12 @@ rollup-pluginutils@^2.6.0:
39443944
dependencies:
39453945
estree-walker "^0.6.1"
39463946

3947-
3948-
version "1.32.1"
3949-
resolved "https://registry.npmjs.org/rollup/-/rollup-1.32.1.tgz#4480e52d9d9e2ae4b46ba0d9ddeaf3163940f9c4"
3950-
integrity sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A==
3951-
dependencies:
3952-
"@types/estree" "*"
3953-
"@types/node" "*"
3954-
acorn "^7.1.0"
3947+
3948+
version "2.56.3"
3949+
resolved "https://registry.npmjs.org/rollup/-/rollup-2.56.3.tgz#b63edadd9851b0d618a6d0e6af8201955a77aeff"
3950+
integrity sha512-Au92NuznFklgQCUcV96iXlxUbHuB1vQMaH76DHl5M11TotjOHwqk9CwcrT78+Tnv4FN9uTBxq6p4EJoYkpyekg==
3951+
optionalDependencies:
3952+
fsevents "~2.3.2"
39553953

39563954
run-async@^2.4.0:
39573955
version "2.4.1"

packages/auth/src/api/authentication/idp.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export interface SignInWithIdpRequest {
3636
pendingToken?: string;
3737
}
3838

39+
/**
40+
* @internal
41+
*/
3942
export interface SignInWithIdpResponse extends IdTokenResponse {
4043
oauthAccessToken?: string;
4144
oauthTokenSecret?: string;

packages/auth/src/api/authentication/mfa.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export interface FinalizeMfaResponse {
3030
refreshToken: string;
3131
}
3232

33+
/**
34+
* @internal
35+
*/
3336
export interface IdTokenMfaResponse extends IdTokenResponse {
3437
mfaPendingCredential?: string;
3538
mfaInfo?: MfaEnrollment[];
@@ -84,6 +87,9 @@ export function finalizeSignInPhoneMfa(
8487
});
8588
}
8689

90+
/**
91+
* @internal
92+
*/
8793
export type PhoneOrOauthTokenResponse =
8894
| SignInWithPhoneNumberResponse
8995
| SignInWithIdpResponse

packages/auth/src/api/authentication/sms.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ export async function sendPhoneVerificationCode(
5353
);
5454
}
5555

56+
/**
57+
* @internal
58+
*/
5659
export interface SignInWithPhoneNumberRequest {
5760
temporaryProof?: string;
5861
phoneNumber?: string;
@@ -66,6 +69,9 @@ export interface LinkWithPhoneNumberRequest
6669
idToken: string;
6770
}
6871

72+
/**
73+
* @internal
74+
*/
6975
export interface SignInWithPhoneNumberResponse extends IdTokenResponse {
7076
temporaryProof?: string;
7177
phoneNumber?: string;

packages/auth/src/core/errors.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { AuthCredential } from './credentials';
2424

2525
/**
2626
* Enumeration of Firebase Auth error codes.
27+
*
28+
* @internal
2729
*/
2830
export const enum AuthErrorCode {
2931
ADMIN_ONLY_OPERATION = 'admin-restricted-operation',
@@ -399,6 +401,9 @@ export interface NamedErrorParams {
399401
serverResponse?: object;
400402
}
401403

404+
/**
405+
* @internal
406+
*/
402407
type GenericAuthErrorParams = {
403408
[key in Exclude<
404409
AuthErrorCode,
@@ -415,6 +420,9 @@ type GenericAuthErrorParams = {
415420
};
416421
};
417422

423+
/**
424+
* @internal
425+
*/
418426
export interface AuthErrorParams extends GenericAuthErrorParams {
419427
[AuthErrorCode.ARGUMENT_ERROR]: { appName?: AppName };
420428
[AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH]: { appName?: AppName };

packages/auth/src/core/util/version.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export const enum ClientImplementation {
2323
CORE = 'JsCore'
2424
}
2525

26+
/**
27+
* @internal
28+
*/
2629
export const enum ClientPlatform {
2730
BROWSER = 'Browser',
2831
NODE = 'Node',

packages/auth/src/model/auth.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export type AppName = string;
3434
export type ApiKey = string;
3535
export type AuthDomain = string;
3636

37+
/**
38+
* @internal
39+
*/
3740
export interface ConfigInternal extends Config {
3841
/**
3942
* @readonly

packages/auth/src/model/enums.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
* Enumeration of supported providers.
20-
*
20+
* @internal
2121
*/
2222
export const enum ProviderId {
2323
/** @internal */
@@ -42,7 +42,7 @@ export const enum ProviderId {
4242

4343
/**
4444
* Enumeration of supported sign-in methods.
45-
*
45+
* @internal
4646
*/
4747
export const enum SignInMethod {
4848
/** @internal */
@@ -65,7 +65,7 @@ export const enum SignInMethod {
6565

6666
/**
6767
* Enumeration of supported operation types.
68-
*
68+
* @internal
6969
*/
7070
export const enum OperationType {
7171
/** Operation involving linking an additional provider to an already signed-in user. */

packages/auth/src/model/id_token.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface ParsedIdToken {
4747
/**
4848
* IdToken as returned by the API
4949
*
50+
* @internal
5051
*/
5152
export interface IdTokenResponse {
5253
localId: string;
@@ -67,6 +68,7 @@ export interface IdTokenResponse {
6768
/**
6869
* The possible types of the `IdTokenResponse`
6970
*
71+
* @internal
7072
*/
7173
export const enum IdTokenResponseKind {
7274
CreateAuthUri = 'identitytoolkit#CreateAuthUriResponse',

packages/auth/src/model/popup_redirect.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ export interface GapiAuthEvent extends gapi.iframes.Message {
4141
authEvent: AuthEvent;
4242
}
4343

44+
/**
45+
* @internal
46+
*/
4447
export const enum AuthEventType {
4548
LINK_VIA_POPUP = 'linkViaPopup',
4649
LINK_VIA_REDIRECT = 'linkViaRedirect',
@@ -57,6 +60,9 @@ export interface AuthEventError extends Error {
5760
message: string;
5861
}
5962

63+
/**
64+
* @internal
65+
*/
6066
export interface AuthEvent {
6167
type: AuthEventType;
6268
eventId: string | null;
@@ -67,13 +73,19 @@ export interface AuthEvent {
6773
error?: AuthEventError;
6874
}
6975

76+
/**
77+
* @internal
78+
*/
7079
export interface AuthEventConsumer {
7180
readonly filter: AuthEventType[];
7281
eventId: string | null;
7382
onAuthEvent(event: AuthEvent): unknown;
7483
onError(error: FirebaseError): unknown;
7584
}
7685

86+
/**
87+
* @internal
88+
*/
7789
export interface EventManager {
7890
registerConsumer(authEventConsumer: AuthEventConsumer): void;
7991
unregisterConsumer(authEventConsumer: AuthEventConsumer): void;

packages/firestore/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"devDependencies": {
8484
"@firebase/app": "0.7.0",
8585
"@firebase/app-compat": "0.1.1",
86+
"@firebase/auth": "0.17.1",
8687
"@rollup/plugin-alias": "3.1.2",
8788
"@rollup/plugin-json": "4.1.0",
8889
"@types/eslint": "7.2.10",

packages/firestore/rollup.shared.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ const manglePrivatePropertiesOptions = {
145145
beautify: true
146146
},
147147
mangle: {
148+
// Temporary hack fix for an issue where mangled code causes some downstream
149+
// bundlers (Babel?) to confuse the same variable name in different scopes.
150+
// This can be removed if the problem in the downstream library is fixed
151+
// or if terser's mangler provides an option to avoid mangling everything
152+
// that isn't a property.
153+
// See issue: https://github.com/firebase/firebase-js-sdk/issues/5384
154+
reserved: ['_getProvider'],
148155
properties: {
149156
regex: /^__PRIVATE_/,
150157
// All JS Keywords are reserved. Although this should be taken cared of by
@@ -284,7 +291,12 @@ exports.es2017ToEs5Plugins = function (mangled = false) {
284291
comments: 'all',
285292
beautify: true
286293
},
287-
mangle: true
294+
// See comment above `manglePrivatePropertiesOptions`. This build did
295+
// not have the identical variable name issue but we should be
296+
// consistent.
297+
mangle: {
298+
reserved: ['_getProvider']
299+
}
288300
}),
289301
sourcemaps()
290302
];

packages/firestore/src/api/credentials.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ export interface CredentialsProvider {
108108
shutdown(): void;
109109
}
110110

111-
/**
112-
* A CredentialsProvider that always yields an empty token.
111+
/**
112+
* A CredentialsProvider that always yields an empty token.
113113
* @internal
114114
*/
115115
export class EmptyCredentialsProvider implements CredentialsProvider {
@@ -261,18 +261,21 @@ export class FirebaseCredentialsProvider implements CredentialsProvider {
261261
);
262262
};
263263

264-
const registerAuth = (auth: FirebaseAuthInternal): void => {
264+
const awaitNextToken: () => void = () => {
265+
const currentTokenAttempt = nextToken;
265266
asyncQueue.enqueueRetryable(async () => {
266-
logDebug('FirebaseCredentialsProvider', 'Auth detected');
267-
this.auth = auth;
268-
this.auth.addAuthTokenListener(this.tokenListener);
269-
270-
// Call the change listener inline to block on the user change.
271-
await nextToken.promise;
267+
await currentTokenAttempt.promise;
272268
await guardedChangeListener(this.currentUser);
273269
});
274270
};
275271

272+
const registerAuth = (auth: FirebaseAuthInternal): void => {
273+
logDebug('FirebaseCredentialsProvider', 'Auth detected');
274+
this.auth = auth;
275+
this.auth.addAuthTokenListener(this.tokenListener);
276+
awaitNextToken();
277+
};
278+
276279
this.authProvider.onInit(auth => registerAuth(auth));
277280

278281
// Our users can initialize Auth right after Firestore, so we give it
@@ -292,13 +295,7 @@ export class FirebaseCredentialsProvider implements CredentialsProvider {
292295
}
293296
}, 0);
294297

295-
asyncQueue.enqueueRetryable(async () => {
296-
// If we have not received a token, wait for the first one.
297-
if (this.tokenCounter === 0) {
298-
await nextToken.promise;
299-
await guardedChangeListener(this.currentUser);
300-
}
301-
});
298+
awaitNextToken();
302299
}
303300

304301
getToken(): Promise<Token | null> {

0 commit comments

Comments
 (0)