UNPKG

2.07 kBJavaScriptView Raw
1"use strict";
2// Copyright 2020 Google LLC
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14Object.defineProperty(exports, "__esModule", { value: true });
15exports.AuthPlus = void 0;
16const google_auth_library_1 = require("google-auth-library");
17class AuthPlus extends google_auth_library_1.GoogleAuth {
18 constructor() {
19 super(...arguments);
20 this.JWT = google_auth_library_1.JWT;
21 this.Compute = google_auth_library_1.Compute;
22 this.OAuth2 = google_auth_library_1.OAuth2Client;
23 this.GoogleAuth = google_auth_library_1.GoogleAuth;
24 this.AwsClient = google_auth_library_1.AwsClient;
25 this.IdentityPoolClient = google_auth_library_1.IdentityPoolClient;
26 this.ExternalAccountClient = google_auth_library_1.ExternalAccountClient;
27 }
28 /**
29 * Override getClient(), memoizing an instance of auth for
30 * subsequent calls to getProjectId().
31 */
32 async getClient(options) {
33 this._cachedAuth = new google_auth_library_1.GoogleAuth(options);
34 // eslint-disable-next-line @typescript-eslint/no-explicit-any
35 return this._cachedAuth.getClient();
36 }
37 getProjectId(callback) {
38 if (callback) {
39 return this._cachedAuth
40 ? this._cachedAuth.getProjectId(callback)
41 : super.getProjectId(callback);
42 }
43 else {
44 return this._cachedAuth
45 ? this._cachedAuth.getProjectId()
46 : super.getProjectId();
47 }
48 }
49}
50exports.AuthPlus = AuthPlus;
51//# sourceMappingURL=authplus.js.map
\No newline at end of file