mblabs-roccato-backend-commons 1.0.53 → 1.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,8 +2,11 @@ import { sheets_v4 as Sheetsv4 } from 'googleapis';
2
2
  export interface Credentials {
3
3
  project?: string;
4
4
  audience?: string;
5
- clientId?: string;
6
- clientSecret?: string;
5
+ client?: {
6
+ id?: string;
7
+ secret?: string;
8
+ };
9
+ privateKey?: string;
7
10
  redirectUri?: string;
8
11
  apiKey?: string;
9
12
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const google_auth_library_1 = require("google-auth-library");
4
4
  class GoogleAuthService {
5
5
  async refreshAccess({ credentials, data, }) {
6
- const client = new google_auth_library_1.OAuth2Client(credentials.clientId, credentials.clientSecret, credentials.redirectUri);
6
+ const client = new google_auth_library_1.OAuth2Client(credentials.client.id, credentials.client.secret, credentials.redirectUri);
7
7
  client.setCredentials({
8
8
  access_token: data.accessToken,
9
9
  refresh_token: data.refreshToken,
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const googleapis_1 = require("googleapis");
4
4
  class GoogleCalendarService {
5
5
  async getEvents({ credentials, data, }) {
6
- const client = new googleapis_1.google.auth.OAuth2(credentials.clientId, credentials.clientSecret, credentials.redirectUri);
6
+ const client = new googleapis_1.google.auth.OAuth2(credentials.client.id, credentials.client.secret, credentials.redirectUri);
7
7
  client.setCredentials({
8
8
  access_token: data.accessToken,
9
9
  refresh_token: data.refreshToken,
@@ -9,6 +9,7 @@ class GoogleStorageService {
9
9
  async getSignedUrl({ credentials, data, }) {
10
10
  const storage = new storage_1.Storage({
11
11
  credentials: {
12
+ private_key: credentials.privateKey,
12
13
  audience: credentials.audience,
13
14
  project_id: credentials.project,
14
15
  apiKey: credentials.apiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mblabs-roccato-backend-commons",
3
- "version": "1.0.53",
3
+ "version": "1.0.54",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,8 +3,11 @@ import { sheets_v4 as Sheetsv4 } from 'googleapis';
3
3
  export interface Credentials {
4
4
  project?: string;
5
5
  audience?: string;
6
- clientId?: string;
7
- clientSecret?: string;
6
+ client?: {
7
+ id?: string;
8
+ secret?: string;
9
+ };
10
+ privateKey?: string;
8
11
  redirectUri?: string;
9
12
  apiKey?: string;
10
13
  }
@@ -9,8 +9,8 @@ class GoogleAuthService implements IGoogleAuthService {
9
9
  }: GoogleAuth.RefreshAccess.Request): Promise<GoogleAuth.RefreshAccess.Response> {
10
10
 
11
11
  const client = new OAuth2Client(
12
- credentials.clientId,
13
- credentials.clientSecret,
12
+ credentials.client.id,
13
+ credentials.client.secret,
14
14
  credentials.redirectUri
15
15
  );
16
16
 
@@ -8,8 +8,8 @@ class GoogleCalendarService implements IGoogleCalendarService {
8
8
  data,
9
9
  }: GoogleCalendar.GetEvents.Request): Promise<GoogleCalendar.GetEvents.Response> {
10
10
  const client = new GoogleSDK.auth.OAuth2(
11
- credentials.clientId,
12
- credentials.clientSecret,
11
+ credentials.client.id,
12
+ credentials.client.secret,
13
13
  credentials.redirectUri
14
14
  );
15
15
 
@@ -10,6 +10,7 @@ class GoogleStorageService implements IGoogleStorageService {
10
10
  }: GoogleStorage.GetSignedUrl.Request) {
11
11
  const storage = new Storage({
12
12
  credentials: {
13
+ private_key: credentials.privateKey,
13
14
  audience: credentials.audience,
14
15
  project_id: credentials.project,
15
16
  apiKey: credentials.apiKey,