Skip to content

Commit a173ba2

Browse files
Dirty merge
2 parents 40dea6a + f14ebc2 commit a173ba2

File tree

10 files changed

+498
-225
lines changed

10 files changed

+498
-225
lines changed

packages/auth/src/error_auth.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ fireauth.authenum.Error = {
147147
INVALID_PASSWORD: 'wrong-password',
148148
INVALID_PERSISTENCE: 'invalid-persistence-type',
149149
INVALID_PHONE_NUMBER: 'invalid-phone-number',
150+
INVALID_PROVIDER_ID: 'invalid-provider-id',
150151
INVALID_RECIPIENT_EMAIL: 'invalid-recipient-email',
151152
INVALID_SENDER: 'invalid-sender',
152153
INVALID_SESSION_INFO: 'invalid-verification-id',
@@ -294,6 +295,8 @@ fireauth.AuthError.MESSAGES_[fireauth.authenum.Error.INVALID_PHONE_NUMBER] =
294295
'phone number in a format that can be parsed into E.164 format. E.164 ' +
295296
'phone numbers are written in the format [+][country code][subscriber ' +
296297
'number including area code].';
298+
fireauth.AuthError.MESSAGES_[fireauth.authenum.Error.INVALID_PROVIDER_ID] =
299+
'The specified provider ID is invalid.';
297300
fireauth.AuthError.MESSAGES_[fireauth.authenum.Error.INVALID_RECIPIENT_EMAIL] =
298301
'The email corresponding to this action failed to send as the provided ' +
299302
'recipient email address is invalid.';

packages/auth/src/rpchandler.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ fireauth.RpcHandler.ServerError = {
207207
INVALID_OOB_CODE: 'INVALID_OOB_CODE',
208208
INVALID_PASSWORD: 'INVALID_PASSWORD',
209209
INVALID_PHONE_NUMBER: 'INVALID_PHONE_NUMBER',
210+
INVALID_PROVIDER_ID: 'INVALID_PROVIDER_ID',
210211
INVALID_RECIPIENT_EMAIL: 'INVALID_RECIPIENT_EMAIL',
211212
INVALID_SENDER: 'INVALID_SENDER',
212213
INVALID_SESSION_INFO: 'INVALID_SESSION_INFO',
@@ -2244,6 +2245,10 @@ fireauth.RpcHandler.getDeveloperError_ =
22442245
errorMap[fireauth.RpcHandler.ServerError.MISSING_OOB_CODE] =
22452246
fireauth.authenum.Error.INTERNAL_ERROR;
22462247

2248+
// Get Auth URI errors:
2249+
errorMap[fireauth.RpcHandler.ServerError.INVALID_PROVIDER_ID] =
2250+
fireauth.authenum.Error.INVALID_PROVIDER_ID;
2251+
22472252
// Operations that require ID token in request:
22482253
errorMap[fireauth.RpcHandler.ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN] =
22492254
fireauth.authenum.Error.CREDENTIAL_TOO_OLD_LOGIN_AGAIN;

packages/auth/test/rpchandler_test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5268,6 +5268,30 @@ function testGetAuthUri_success() {
52685268
}
52695269

52705270

5271+
/**
5272+
* Tests server side getAuthUri error.
5273+
*/
5274+
function testGetAuthUri_caughtServerError() {
5275+
var expectedUrl = 'https://www.googleapis.com/identitytoolkit/v3/relyin' +
5276+
'gparty/createAuthUri?key=apiKey';
5277+
var requestBody = {
5278+
'providerId': 'abc.com',
5279+
'continueUri': 'http://localhost/widget',
5280+
'customParameter': {}
5281+
};
5282+
var errorMap = {};
5283+
// All related server errors for getAuthUri.
5284+
errorMap[fireauth.RpcHandler.ServerError.INVALID_PROVIDER_ID] =
5285+
fireauth.authenum.Error.INVALID_PROVIDER_ID;
5286+
5287+
assertServerErrorsAreHandled(function() {
5288+
return rpcHandler.getAuthUri(
5289+
'abc.com',
5290+
'http://localhost/widget');
5291+
}, errorMap, expectedUrl, requestBody);
5292+
}
5293+
5294+
52715295
/**
52725296
* Tests successful getAuthUri request with Google provider and sessionId.
52735297
*/

packages/firestore/src/remote/datastore.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { WatchStreamListener, WriteStreamListener } from './persistent_stream';
12
/**
23
* Copyright 2017 Google Inc.
34
*
@@ -54,21 +55,27 @@ export class Datastore {
5455
private serializer: JsonProtoSerializer
5556
) {}
5657

57-
newPersistentWriteStream(): PersistentWriteStream {
58+
newPersistentWriteStream(
59+
listener: WriteStreamListener
60+
): PersistentWriteStream {
5861
return new PersistentWriteStream(
5962
this.queue,
6063
this.connection,
6164
this.credentials,
62-
this.serializer
65+
this.serializer,
66+
listener
6367
);
6468
}
6569

66-
newPersistentWatchStream(): PersistentListenStream {
70+
newPersistentWatchStream(
71+
listener: WatchStreamListener
72+
): PersistentListenStream {
6773
return new PersistentListenStream(
6874
this.queue,
6975
this.connection,
7076
this.credentials,
71-
this.serializer
77+
this.serializer,
78+
listener
7279
);
7380
}
7481

0 commit comments

Comments
 (0)