Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
f3b3caa
chore(core): Automate Daily Integration Tests (#1130)
lahirumaramba Jan 12, 2021
8ae44ce
Updating Google Cloud naming (#1122)
egilmorez Jan 14, 2021
1862342
update typo in interface name (#1138)
suchcodemuchwow Jan 22, 2021
6ce98e2
Improve token verification logic with Auth Emulator. (#1148)
yuchenshi Feb 4, 2021
01d8177
feat: Exporting all types of Messages so they can be used by consumer…
BorntraegerMarc Feb 4, 2021
fc2f557
feat(auth): Implement getUserByProviderId (#769)
rsgowman Feb 8, 2021
a00ce05
Allow enabling of anonymous provider via tenant configuration (#802)
rsgowman Feb 8, 2021
bea66a9
feat(auth): Add ability to link a federated ID with the `updateUser()…
rsgowman Feb 9, 2021
5c60cc4
(chore): Export UserProvider type and add it to toc.yaml (#1165)
lahirumaramba Feb 10, 2021
9585775
[chore] Release 9.5.0 (#1167)
lahirumaramba Feb 10, 2021
93362d5
chore: Updated doc generator for typedoc 0.19.0 (#1166)
hiranya911 Feb 11, 2021
6bcffa2
Update HOME.md (#1181)
egilmorez Feb 26, 2021
994fd43
feat(rtdb): Support emulator mode for rules management operations (#1…
hiranya911 Mar 10, 2021
bf4bacb
fix: Decoupled proactive token refresh from FirebaseApp (#1194)
hiranya911 Mar 18, 2021
738eba7
fix(rtdb): Fixing the RTDB token listener callback (#1203)
hiranya911 Mar 19, 2021
97d3823
Add emulator-based integration tests. (#1155)
yuchenshi Mar 23, 2021
19660d9
Disable one flaky tests in emulator. (#1205)
yuchenshi Mar 25, 2021
2a5b7f6
[chore] Release 9.6.0 (#1209)
hiranya911 Mar 29, 2021
60b4e29
(chore): Add JWT Decoder and Signature Verifier (#1204)
lahirumaramba Mar 30, 2021
1254850
chore: Add Mailgun send email action (#1210)
lahirumaramba Mar 31, 2021
e9e8a03
chore: Fix bug in send-email action code (#1214)
lahirumaramba Apr 1, 2021
1cc82ae
Change dispatch event name in nightly workflow (#1216)
lahirumaramba Apr 1, 2021
d961c3f
chore: Clean up nightly workflow trigger tests (#1212)
lahirumaramba Apr 1, 2021
da0f44f
Add support for FIREBASE_STORAGE_EMULATOR_HOST env var (#1175)
abeisgoat Apr 8, 2021
011c530
Revert "Disable one flaky tests in emulator. (#1205)" (#1227)
yuchenshi Apr 14, 2021
58f60d6
fix(rtdb): Fixing a token refresh livelock in Cloud Functions (#1234)
hiranya911 Apr 23, 2021
be4ebc6
[chore] Release 9.7.0 (#1240)
lahirumaramba Apr 27, 2021
c6e9ef7
fix: adds missing EMAIL_NOT_FOUND error code (#1246)
bojeil-google May 3, 2021
d8b769a
build(deps-dev): bump lodash from 4.17.19 to 4.17.21 (#1255)
dependabot[bot] May 6, 2021
43bfbd9
chore: Upgraded RTDB and other @firebase dependencies (#1250)
hiranya911 May 6, 2021
e65dbcf
build(deps): bump y18n from 3.2.1 to 3.2.2 (#1208)
dependabot[bot] May 6, 2021
3ae6a69
Fix storage emulator env formatting (#1257)
abeisgoat May 10, 2021
8267b56
build(deps): bump hosted-git-info from 2.8.8 to 2.8.9 (#1260)
dependabot[bot] May 10, 2021
b88f891
feat: Add abuse reduction support (#1264)
lahirumaramba May 10, 2021
ab034f5
Fix @types/node conflict with grpc and port type (#1258)
nikhilag May 10, 2021
e5dc9f8
[chore] Release 9.8.0 (#1266)
lahirumaramba May 10, 2021
e759958
build(deps): bump handlebars from 4.7.6 to 4.7.7 (#1253)
dependabot[bot] May 10, 2021
e7155ea
build(deps): bump jose from 2.0.4 to 2.0.5 (#1265)
dependabot[bot] May 10, 2021
fd23ad0
fix: Revert regression introduced in #1257 (#1277)
hiranya911 May 18, 2021
3b48235
fix(auth): make MFA uid optional for updateUser operations (#1278)
bojeil-google May 18, 2021
3a2d2fa
chore: Enabled dependabot (#1279)
hiranya911 May 20, 2021
6bf2aee
chore: Remove gulp-replace dependency (#1285)
hiranya911 May 20, 2021
11f2fb1
build(deps-dev): bump gulp-header from 1.8.12 to 2.0.9 (#1283)
dependabot[bot] May 20, 2021
df3b398
build(deps-dev): bump run-sequence from 1.2.2 to 2.2.1 (#1282)
dependabot[bot] May 20, 2021
89387c1
build(deps-dev): bump sinon from 9.0.2 to 9.2.4 (#1289)
dependabot[bot] May 24, 2021
a549a6c
build(deps-dev): bump nyc from 14.1.1 to 15.1.0 (#1290)
dependabot[bot] May 24, 2021
d6dcf9e
build(deps-dev): bump chalk from 1.1.3 to 4.1.1 (#1288)
dependabot[bot] May 24, 2021
9d87537
build(deps-dev): bump @microsoft/api-extractor from 7.11.2 to 7.15.2 …
dependabot[bot] May 24, 2021
7afaf6c
chore: Teporarily disabling sendToDeviceGroup integration test (#1292)
hiranya911 May 24, 2021
1d2ff69
feat(auth): Added code flow support for OIDC flow. (#1220)
xil222 May 25, 2021
03c66d8
Update supported Node version to 10.13.0v (#1300)
lahirumaramba May 26, 2021
f914f92
Fixed integration test failure of skipped tests (#1299)
xil222 May 26, 2021
c529496
[chore] Release 9.9.0 (#1302)
lahirumaramba May 26, 2021
2ffc177
Update OIDC reference docs (#1305)
lahirumaramba May 27, 2021
f4a9a16
Add OAuthResponseType to ToC (#1303)
lahirumaramba May 27, 2021
29271ad
fix(auth): Better type hierarchies for Auth API (#1294)
hiranya911 May 27, 2021
5d5cea2
build(deps-dev): bump nock from 13.0.5 to 13.0.11 (#1311)
dependabot[bot] Jun 1, 2021
09e82c0
build(deps): bump ws from 7.3.1 to 7.4.6 (#1309)
dependabot[bot] Jun 1, 2021
312cdbb
build(deps-dev): bump del from 2.2.2 to 6.0.0 (#1310)
dependabot[bot] Jun 1, 2021
278bfc9
build(deps-dev): bump @types/jsonwebtoken from 8.5.0 to 8.5.1 (#1315)
dependabot[bot] Jun 1, 2021
2256f03
build(deps-dev): bump nock from 13.0.11 to 13.1.0 (#1313)
dependabot[bot] Jun 1, 2021
2e6e5d3
build(deps-dev): bump @types/sinon-chai from 3.2.4 to 3.2.5 (#1316)
dependabot[bot] Jun 1, 2021
8548bb3
build(deps-dev): bump bcrypt from 5.0.0 to 5.0.1 (#1324)
dependabot[bot] Jun 9, 2021
eb04602
build(deps): bump @google-cloud/firestore from 4.5.0 to 4.12.2 (#1325)
dependabot[bot] Jun 9, 2021
3c78a73
build(deps-dev): bump @types/mocha from 2.2.48 to 8.2.2 (#1323)
dependabot[bot] Jun 9, 2021
2a4de46
build(deps-dev): bump @firebase/app from 0.6.21 to 0.6.26 (#1329)
dependabot[bot] Jun 14, 2021
24d3b91
build(deps): bump @firebase/database from 0.10.0 to 0.10.4 (#1328)
dependabot[bot] Jun 14, 2021
f09bd64
build(deps-dev): bump request-promise from 4.2.5 to 4.2.6 (#1331)
dependabot[bot] Jun 14, 2021
9539a50
build(deps-dev): bump gulp-filter from 6.0.0 to 7.0.0 (#1334)
dependabot[bot] Jun 22, 2021
9b0d7ef
build(deps-dev): bump @types/minimist from 1.2.0 to 1.2.1 (#1336)
dependabot[bot] Jun 22, 2021
9872b9b
fix(docs): replace all global.html -> admin.html (#1341)
NothingEverHappens Jun 22, 2021
0f9a7de
feat(fis): Adding the admin.installations() API for deleting Firebase…
hiranya911 Jun 23, 2021
6f73c8c
fix: Updated TOC for new Auth type aliases (#1342)
hiranya911 Jun 23, 2021
e51bf1d
[chore] Release 9.10.0
hiranya911 Jun 24, 2021
2ca2bca
[chore] Release 9.10.0 (#1345)
hiranya911 Jun 24, 2021
2feece3
build(deps-dev): bump @types/request-promise from 4.1.46 to 4.1.47 (#…
dependabot[bot] Jun 24, 2021
f990473
Merge branch 'master' of github.com:firebase/firebase-admin-node
hiranya911 Jun 24, 2021
dd942b0
build(deps): bump @firebase/database from 0.10.4 to 0.10.5 (#1350)
dependabot[bot] Jul 2, 2021
bf959e3
build(deps-dev): bump @types/nock from 9.3.1 to 11.1.0 (#1351)
dependabot[bot] Jul 2, 2021
e9cd6bf
build(deps-dev): bump @types/sinon from 9.0.4 to 10.0.2 (#1326)
dependabot[bot] Jul 2, 2021
068ea80
build(deps): bump @firebase/database from 0.10.5 to 0.10.6 (#1356)
dependabot[bot] Jul 5, 2021
b8e837b
build(deps): bump jwks-rsa from 2.0.2 to 2.0.3 (#1361)
dependabot[bot] Jul 9, 2021
c87f640
build(deps-dev): bump yargs from 16.1.0 to 17.0.1 (#1357)
dependabot[bot] Jul 9, 2021
0b45481
build(deps-dev): bump @types/chai from 4.2.11 to 4.2.21 (#1365)
dependabot[bot] Jul 9, 2021
bfaec79
Update index.ts (#1367)
dhritzkiv Jul 12, 2021
760cd6a
build(deps): bump @google-cloud/firestore from 4.12.2 to 4.13.1 (#1369)
dependabot[bot] Jul 12, 2021
4e816f4
feat(fac): Add custom TTL options for App Check (#1363)
lahirumaramba Jul 14, 2021
c2b126b
Reduce App Check custom token exp to 5 mins (#1372)
lahirumaramba Jul 14, 2021
ba07e12
Add AppCheckTokenOptions type to ToC (#1375)
lahirumaramba Jul 15, 2021
21869ee
Fix typo and formatting in docs (#1378)
lahirumaramba Jul 15, 2021
20dc462
[chore] Release 9.11.0 (#1376)
lahirumaramba Jul 15, 2021
db13ec1
build(deps-dev): bump nock from 13.1.0 to 13.1.1 (#1370)
dependabot[bot] Jul 15, 2021
25429b3
build(deps-dev): bump @types/bcrypt from 2.0.0 to 5.0.0 (#1384)
dependabot[bot] Jul 19, 2021
b403c15
build(deps): bump @firebase/database from 0.10.6 to 0.10.7 (#1385)
dependabot[bot] Jul 19, 2021
8bfbadf
build(deps-dev): bump @types/lodash from 4.14.157 to 4.14.171 (#1386)
dependabot[bot] Jul 20, 2021
6841d4c
build(deps-dev): bump @types/request from 2.48.5 to 2.48.6 (#1387)
dependabot[bot] Jul 20, 2021
9ad3be7
build(deps-dev): bump @types/minimist from 1.2.1 to 1.2.2 (#1388)
dependabot[bot] Jul 20, 2021
2e5e473
build(deps): bump jwks-rsa from 2.0.3 to 2.0.4 (#1393)
dependabot[bot] Jul 27, 2021
2574ba9
Merge branch 'master' of github.com:firebase/firebase-admin-node
hiranya911 Jul 28, 2021
63d12e0
build(deps-dev): bump @microsoft/api-extractor from 7.15.2 to 7.18.4 …
dependabot[bot] Aug 3, 2021
8474194
build(deps): bump tar from 6.1.0 to 6.1.3 (#1399)
dependabot[bot] Aug 3, 2021
a9d8b41
build(deps-dev): bump ts-node from 9.0.0 to 10.2.0 (#1402)
dependabot[bot] Aug 9, 2021
cd7e384
Merge branch 'master' of github.com:firebase/firebase-admin-node
hiranya911 Aug 13, 2021
c8b1542
chore: Merged from main branch
hiranya911 Aug 16, 2021
9c41224
fix: Regenerated package-lock file
hiranya911 Aug 16, 2021
3d8a8ab
fix: Fixing a typo in doc comment
hiranya911 Aug 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(fis): Adding the admin.installations() API for deleting Firebase…
… installation IDs (#1187)

* feat(fis): Added admin.installations() API

* fix: Marked IID APIs deprecated

* fix: Deprecated App.instanceId() method; Added more unit and integration tests

* fix: Throwing FirebaseInstallationsError from constructor

* fix: Some docs updates

* fix: Minor update to API doc comment

* fix: Added Installations class to API ref toc

* fix: Minor doc updates
  • Loading branch information
hiranya911 authored Jun 23, 2021
commit 0f9a7defd8873e630bb27374f4f3d29c90af59aa
6 changes: 6 additions & 0 deletions docgen/content-sources/node/toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ toc:
- title: "admin.firestore"
path: /docs/reference/admin/node/admin.firestore

- title: "admin.installations"
path: /docs/reference/admin/node/admin.installations
section:
- title: "Installations"
path: /docs/reference/admin/node/admin.installations.Installations-1

- title: "admin.instanceId"
path: /docs/reference/admin/node/admin.instanceId
section:
Expand Down
16 changes: 16 additions & 0 deletions etc/firebase-admin.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export namespace app {
// (undocumented)
firestore(): firestore.Firestore;
// (undocumented)
installations(): installations.Installations;
// @deprecated (undocumented)
instanceId(): instanceId.InstanceId;
// (undocumented)
machineLearning(): machineLearning.MachineLearning;
Expand Down Expand Up @@ -542,13 +544,27 @@ export interface GoogleOAuthAccessToken {
export function initializeApp(options?: AppOptions, name?: string): app.App;

// @public
export function installations(app?: app.App): installations.Installations;

// @public (undocumented)
export namespace installations {
export interface Installations {
// (undocumented)
app: app.App;
deleteInstallation(fid: string): Promise<void>;
}
}

// @public @deprecated
export function instanceId(app?: app.App): instanceId.InstanceId;

// @public (undocumented)
export namespace instanceId {
// @deprecated
export interface InstanceId {
// (undocumented)
app: app.App;
// @deprecated
deleteInstanceId(instanceId: string): Promise<void>;
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/firebase-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { database } from './database/index';
import { DatabaseService } from './database/database-internal';
import { Firestore } from '@google-cloud/firestore';
import { FirestoreService } from './firestore/firestore-internal';
import { Installations } from './installations/installations';
import { InstanceId } from './instance-id/instance-id';
import { ProjectManagement } from './project-management/project-management';
import { SecurityRules } from './security-rules/security-rules';
Expand Down Expand Up @@ -256,9 +257,23 @@ export class FirebaseApp implements app.App {
return service.client;
}

/**
* Returns the `Installations` service instance associated with this app.
*
* @return The `Installations` service instance of this app.
*/
public installations(): Installations {
return this.ensureService_('installations', () => {
const fisService: typeof Installations = require('./installations/installations').Installations;
return new fisService(this);
});
}

/**
* Returns the InstanceId service instance associated with this app.
*
* This API is deprecated. Use the `installations()` API instead.
*
* @return The InstanceId service instance of this app.
*/
public instanceId(): InstanceId {
Expand Down
3 changes: 3 additions & 0 deletions src/firebase-namespace-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { auth } from './auth/index';
import { credential } from './credential/index';
import { database } from './database/index';
import { firestore } from './firestore/index';
import { installations } from './installations/index';
import { instanceId } from './instance-id/index';
import { machineLearning } from './machine-learning/index';
import { messaging } from './messaging/index';
Expand Down Expand Up @@ -227,6 +228,8 @@ export namespace app {
auth(): auth.Auth;
database(url?: string): database.Database;
firestore(): firestore.Firestore;
installations(): installations.Installations;
/** @deprecated */
instanceId(): instanceId.InstanceId;
machineLearning(): machineLearning.MachineLearning;
messaging(): messaging.Messaging;
Expand Down
1 change: 1 addition & 0 deletions src/firebase-namespace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export * from './app-check/index';
export * from './auth/index';
export * from './database/index';
export * from './firestore/index';
export * from './installations/index';
export * from './instance-id/index';
export * from './machine-learning/index';
export * from './messaging/index';
Expand Down
14 changes: 14 additions & 0 deletions src/firebase-namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { appCheck } from './app-check/index';
import { auth } from './auth/index';
import { database } from './database/index';
import { firestore } from './firestore/index';
import { installations } from './installations/index';
import { instanceId } from './instance-id/index';
import { machineLearning } from './machine-learning/index';
import { messaging } from './messaging/index';
Expand All @@ -43,6 +44,7 @@ import AppCheck = appCheck.AppCheck;
import Auth = auth.Auth;
import Database = database.Database;
import Firestore = firestore.Firestore;
import Installations = installations.Installations;
import InstanceId = instanceId.InstanceId;
import MachineLearning = machineLearning.MachineLearning;
import Messaging = messaging.Messaging;
Expand Down Expand Up @@ -311,6 +313,18 @@ export class FirebaseNamespace {
return Object.assign(fn, { MachineLearning: machineLearning });
}

/**
* Gets the `Installations` service namespace. The returned namespace can be used to get the
* `Installations` service for the default app or an explicitly specified app.
*/
get installations(): FirebaseServiceNamespace<Installations> {
const fn: FirebaseServiceNamespace<Installations> = (app?: App) => {
return this.ensureApp(app).installations();
};
const installations = require('./installations/installations').Installations;
return Object.assign(fn, { Installations: installations });
}

/**
* Gets the `InstanceId` service namespace. The returned namespace can be used to get the
* `Instance` service for the default app or an explicitly specified app.
Expand Down
85 changes: 85 additions & 0 deletions src/installations/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*!
* Copyright 2021 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { app } from '../firebase-namespace-api';

/**
* Gets the {@link installations.Installations `Installations`} service for the
* default app or a given app.
*
* `admin.installations()` can be called with no arguments to access the default
* app's {@link installations.Installations `Installations`} service or as
* `admin.installations(app)` to access the
* {@link installations.Installations `Installations`} service associated with a
* specific app.
*
* @example
* ```javascript
* // Get the Installations service for the default app
* var defaultInstallations = admin.installations();
* ```
*
* @example
* ```javascript
* // Get the Installations service for a given app
* var otherInstallations = admin.installations(otherApp);
*```
*
* @param app Optional app whose `Installations` service to
* return. If not provided, the default `Installations` service is
* returned.
*
* @return The default `Installations` service if
* no app is provided or the `Installations` service associated with the
* provided app.
*/
export declare function installations(app?: app.App): installations.Installations;

/* eslint-disable @typescript-eslint/no-namespace */
export namespace installations {
/**
* Gets the {@link Installations `Installations`} service for the
* current app.
*
* @example
* ```javascript
* var installations = app.installations();
* // The above is shorthand for:
* // var installations = admin.installations(app);
* ```
*
* @return The `Installations` service for the
* current app.
*/
export interface Installations {
app: app.App;

/**
* Deletes the specified installation ID and the associated data from Firebase.
*
* Note that Google Analytics for Firebase uses its own form of Instance ID to
* keep track of analytics data. Therefore deleting a Firebase installation ID does
* not delete Analytics data. See
* [Delete a Firebase installation](/docs/projects/manage-installations#delete-installation)
* for more information.
*
* @param fid The Firebase installation ID to be deleted.
*
* @return A promise fulfilled when the installation ID is deleted.
*/
deleteInstallation(fid: string): Promise<void>;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2017 Google Inc.
* Copyright 2021 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

import { FirebaseApp } from '../firebase-app';
import { FirebaseInstanceIdError, InstanceIdClientErrorCode } from '../utils/error';
import { FirebaseInstallationsError, InstallationsClientErrorCode } from '../utils/error';
import {
ApiSettings, AuthorizedHttpClient, HttpRequestConfig, HttpError,
} from '../utils/api-request';
Expand All @@ -33,50 +33,50 @@ const FIREBASE_IID_TIMEOUT = 10000;

/** HTTP error codes raised by the backend server. */
const ERROR_CODES: {[key: number]: string} = {
400: 'Malformed instance ID argument.',
400: 'Malformed installation ID argument.',
401: 'Request not authorized.',
403: 'Project does not match instance ID or the client does not have sufficient privileges.',
404: 'Failed to find the instance ID.',
403: 'Project does not match installation ID or the client does not have sufficient privileges.',
404: 'Failed to find the installation ID.',
409: 'Already deleted.',
429: 'Request throttled out by the backend server.',
500: 'Internal server error.',
503: 'Backend servers are over capacity. Try again later.',
};

/**
* Class that provides mechanism to send requests to the Firebase Instance ID backend endpoints.
* Class that provides mechanism to send requests to the FIS backend endpoints.
*/
export class FirebaseInstanceIdRequestHandler {
export class FirebaseInstallationsRequestHandler {

private readonly host: string = FIREBASE_IID_HOST;
private readonly timeout: number = FIREBASE_IID_TIMEOUT;
private readonly httpClient: AuthorizedHttpClient;
private path: string;

/**
* @param {FirebaseApp} app The app used to fetch access tokens to sign API requests.
* @param app The app used to fetch access tokens to sign API requests.
*
* @constructor
*/
constructor(private readonly app: FirebaseApp) {
this.httpClient = new AuthorizedHttpClient(app);
}

public deleteInstanceId(instanceId: string): Promise<void> {
if (!validator.isNonEmptyString(instanceId)) {
return Promise.reject(new FirebaseInstanceIdError(
InstanceIdClientErrorCode.INVALID_INSTANCE_ID,
'Instance ID must be a non-empty string.',
public deleteInstallation(fid: string): Promise<void> {
if (!validator.isNonEmptyString(fid)) {
return Promise.reject(new FirebaseInstallationsError(
InstallationsClientErrorCode.INVALID_INSTALLATION_ID,
'Installation ID must be a non-empty string.',
));
}
return this.invokeRequestHandler(new ApiSettings(instanceId, 'DELETE'));
return this.invokeRequestHandler(new ApiSettings(fid, 'DELETE'));
}

/**
* Invokes the request handler based on the API settings object passed.
*
* @param {ApiSettings} apiSettings The API endpoint settings to apply to request and response.
* @return {Promise<void>} A promise that resolves when the request is complete.
* @param apiSettings The API endpoint settings to apply to request and response.
* @return A promise that resolves when the request is complete.
*/
private invokeRequestHandler(apiSettings: ApiSettings): Promise<void> {
return this.getPathPrefix()
Expand All @@ -98,8 +98,8 @@ export class FirebaseInstanceIdRequestHandler {
response.data.error : response.text;
const template: string = ERROR_CODES[response.status];
const message: string = template ?
`Instance ID "${apiSettings.getEndpoint()}": ${template}` : errorMessage;
throw new FirebaseInstanceIdError(InstanceIdClientErrorCode.API_ERROR, message);
`Installation ID "${apiSettings.getEndpoint()}": ${template}` : errorMessage;
throw new FirebaseInstallationsError(InstallationsClientErrorCode.API_ERROR, message);
}
// In case of timeouts and other network errors, the HttpClient returns a
// FirebaseError wrapped in the response. Simply throw it here.
Expand All @@ -116,9 +116,9 @@ export class FirebaseInstanceIdRequestHandler {
.then((projectId) => {
if (!validator.isNonEmptyString(projectId)) {
// Assert for an explicit projct ID (either via AppOptions or the cert itself).
throw new FirebaseInstanceIdError(
InstanceIdClientErrorCode.INVALID_PROJECT_ID,
'Failed to determine project ID for InstanceId. Initialize the '
throw new FirebaseInstallationsError(
InstallationsClientErrorCode.INVALID_PROJECT_ID,
'Failed to determine project ID for Installations. Initialize the '
+ 'SDK with service account credentials or set project ID as an app option. '
+ 'Alternatively set the GOOGLE_CLOUD_PROJECT environment variable.',
);
Expand Down
Loading