@@ -54,7 +54,7 @@ export const enum HttpHeader {
54
54
X_FIREBASE_APP_CHECK = 'X-Firebase-AppCheck'
55
55
}
56
56
57
- export const enum Endpoint {
57
+ export enum Endpoint {
58
58
CREATE_AUTH_URI = '/v1/accounts:createAuthUri' ,
59
59
DELETE_ACCOUNT = '/v1/accounts:delete' ,
60
60
RESET_PASSWORD = '/v1/accounts:resetPassword' ,
@@ -155,6 +155,7 @@ async function performApiRequest<T, V>(
155
155
request ?: T ,
156
156
customErrorMap : Partial < ServerErrorMap < ServerError > > = { }
157
157
) : Promise < V > {
158
+ _assertValidEndpointForAuth ( auth , path ) ;
158
159
return _performFetchWithErrorHandling ( auth , customErrorMap , async ( ) => {
159
160
let body = { } ;
160
161
let params = { } ;
@@ -374,6 +375,22 @@ export function _parseEnforcementState(
374
375
}
375
376
}
376
377
378
+ function _assertValidEndpointForAuth (
379
+ auth : Auth ,
380
+ path : Endpoint | RegionalEndpoint
381
+ ) : void {
382
+ if (
383
+ ! auth . tenantConfig &&
384
+ Object . values ( RegionalEndpoint ) . includes ( path as RegionalEndpoint )
385
+ ) {
386
+ throw _operationNotSupportedForInitializedAuthInstance ( auth ) ;
387
+ }
388
+
389
+ if ( auth . tenantConfig && Object . values ( Endpoint ) . includes ( path as Endpoint ) ) {
390
+ throw _operationNotSupportedForInitializedAuthInstance ( auth ) ;
391
+ }
392
+ }
393
+
377
394
class NetworkTimeout < T > {
378
395
// Node timers and browser timers are fundamentally incompatible, but we
379
396
// don't care about the value here
0 commit comments