Skip to content

Commit e7c44da

Browse files
committed
remove Gapi interface
1 parent e459d70 commit e7c44da

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

packages/firestore/src/api/credentials.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ export type AuthTokenFactory = () => string;
4141

4242
export interface FirstPartyCredentialsSettings {
4343
// These are external types. Prevent minification.
44-
['type']: 'gapi';
45-
['client']: unknown;
44+
['type']: 'firstParty';
4645
['sessionIndex']: string;
4746
['iamToken']: string | null;
4847
['authTokenFactory']: AuthTokenFactory | null;
@@ -379,15 +378,6 @@ export class FirebaseAuthCredentialsProvider
379378
}
380379
}
381380

382-
// Manual type definition for the subset of Gapi we use.
383-
interface Gapi {
384-
auth: {
385-
getAuthHeaderValueForFirstParty: (
386-
userIdentifiers: Array<{ [key: string]: string }>
387-
) => string | null;
388-
};
389-
}
390-
391381
/*
392382
* FirstPartyToken provides a fresh token each time its value
393383
* is requested, because if the token is too old, requests will be rejected.
@@ -401,7 +391,6 @@ export class FirstPartyToken implements Token {
401391
private _headers = new Map();
402392

403393
constructor(
404-
private readonly gapi: Gapi | null,
405394
private readonly sessionIndex: string,
406395
private readonly iamToken: string | null,
407396
private readonly authTokenFactory: AuthTokenFactory | null
@@ -443,7 +432,6 @@ export class FirstPartyAuthCredentialsProvider
443432
implements CredentialsProvider<User>
444433
{
445434
constructor(
446-
private gapi: Gapi | null,
447435
private sessionIndex: string,
448436
private iamToken: string | null,
449437
private authTokenFactory: AuthTokenFactory | null
@@ -452,7 +440,6 @@ export class FirstPartyAuthCredentialsProvider
452440
getToken(): Promise<Token | null> {
453441
return Promise.resolve(
454442
new FirstPartyToken(
455-
this.gapi,
456443
this.sessionIndex,
457444
this.iamToken,
458445
this.authTokenFactory
@@ -661,12 +648,9 @@ export function makeAuthCredentialsProvider(
661648
if (!credentials) {
662649
return new EmptyAuthCredentialsProvider();
663650
}
664-
665651
switch (credentials['type']) {
666-
case 'gapi':
667-
const client = credentials['client'] as Gapi;
652+
case 'firstParty':
668653
return new FirstPartyAuthCredentialsProvider(
669-
client,
670654
credentials['sessionIndex'] || '0',
671655
credentials['iamToken'] || null,
672656
credentials['authTokenFactory'] || null

0 commit comments

Comments
 (0)