mblabs-roccato-backend-commons 1.0.52 → 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.
- package/dist/interfaces/gcp.d.ts +8 -4
- package/dist/services/gcp/auth.js +1 -1
- package/dist/services/gcp/calendar.js +9 -6
- package/dist/services/gcp/storage.js +1 -0
- package/package.json +2 -1
- package/src/interfaces/gcp.ts +8 -4
- package/src/services/gcp/auth.ts +2 -2
- package/src/services/gcp/calendar.ts +10 -8
- package/src/services/gcp/storage.ts +1 -0
- package/yarn.lock +13 -0
package/dist/interfaces/gcp.d.ts
CHANGED
|
@@ -2,12 +2,13 @@ import { sheets_v4 as Sheetsv4 } from 'googleapis';
|
|
|
2
2
|
export interface Credentials {
|
|
3
3
|
project?: string;
|
|
4
4
|
audience?: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
client?: {
|
|
6
|
+
id?: string;
|
|
7
|
+
secret?: string;
|
|
8
|
+
};
|
|
9
|
+
privateKey?: string;
|
|
7
10
|
redirectUri?: string;
|
|
8
11
|
apiKey?: string;
|
|
9
|
-
accessToken?: string;
|
|
10
|
-
refreshToken?: string;
|
|
11
12
|
}
|
|
12
13
|
export declare namespace GoogleAuth {
|
|
13
14
|
namespace RefreshAccess {
|
|
@@ -36,7 +37,10 @@ export declare namespace GoogleCalendar {
|
|
|
36
37
|
interface Response {
|
|
37
38
|
events: {
|
|
38
39
|
title?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
type?: string;
|
|
39
42
|
status?: string;
|
|
43
|
+
createdAt?: string | Date;
|
|
40
44
|
startAt?: string | Date;
|
|
41
45
|
endAt?: string | Date;
|
|
42
46
|
organizer?: {
|
|
@@ -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.
|
|
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,9 +3,9 @@ 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.
|
|
6
|
+
const client = new googleapis_1.google.auth.OAuth2(credentials.client.id, credentials.client.secret, credentials.redirectUri);
|
|
7
7
|
client.setCredentials({
|
|
8
|
-
access_token:
|
|
8
|
+
access_token: data.accessToken,
|
|
9
9
|
refresh_token: data.refreshToken,
|
|
10
10
|
});
|
|
11
11
|
const { data: { items } } = await googleapis_1.google
|
|
@@ -14,11 +14,14 @@ class GoogleCalendarService {
|
|
|
14
14
|
.list();
|
|
15
15
|
const events = items.map(item => ({
|
|
16
16
|
title: item.summary,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
description: item.description,
|
|
18
|
+
type: item.eventType,
|
|
19
|
+
status: item.status,
|
|
20
|
+
createdAt: item.created,
|
|
21
|
+
startAt: item.start?.dateTime,
|
|
22
|
+
endAt: item.end?.dateTime,
|
|
20
23
|
organizer: {
|
|
21
|
-
name: item.organizer?.displayName
|
|
24
|
+
name: item.organizer?.displayName,
|
|
22
25
|
email: item.organizer?.email,
|
|
23
26
|
},
|
|
24
27
|
}));
|
|
@@ -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.
|
|
3
|
+
"version": "1.0.54",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@google-cloud/secret-manager": "^6.0.1",
|
|
56
56
|
"@google-cloud/storage": "^7.16.0",
|
|
57
57
|
"@keycloak/keycloak-admin-client": "^26.3.1",
|
|
58
|
+
"@microsoft/microsoft-graph-client": "^3.0.7",
|
|
58
59
|
"@sendgrid/client": "^8.1.5",
|
|
59
60
|
"@sendgrid/mail": "^8.1.5",
|
|
60
61
|
"amqplib": "^0.10.8",
|
package/src/interfaces/gcp.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { sheets_v4 as Sheetsv4 } from 'googleapis';
|
|
|
3
3
|
export interface Credentials {
|
|
4
4
|
project?: string;
|
|
5
5
|
audience?: string;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
client?: {
|
|
7
|
+
id?: string;
|
|
8
|
+
secret?: string;
|
|
9
|
+
};
|
|
10
|
+
privateKey?: string;
|
|
8
11
|
redirectUri?: string;
|
|
9
12
|
apiKey?: string;
|
|
10
|
-
accessToken?: string;
|
|
11
|
-
refreshToken?: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export namespace GoogleAuth {
|
|
@@ -41,7 +42,10 @@ export namespace GoogleCalendar {
|
|
|
41
42
|
export interface Response {
|
|
42
43
|
events: {
|
|
43
44
|
title?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
type?: string;
|
|
44
47
|
status?: string;
|
|
48
|
+
createdAt?: string | Date;
|
|
45
49
|
startAt?: string | Date;
|
|
46
50
|
endAt?: string | Date;
|
|
47
51
|
organizer?: {
|
package/src/services/gcp/auth.ts
CHANGED
|
@@ -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.
|
|
13
|
-
credentials.
|
|
12
|
+
credentials.client.id,
|
|
13
|
+
credentials.client.secret,
|
|
14
14
|
credentials.redirectUri
|
|
15
15
|
);
|
|
16
16
|
|
|
@@ -8,13 +8,13 @@ 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.
|
|
12
|
-
credentials.
|
|
11
|
+
credentials.client.id,
|
|
12
|
+
credentials.client.secret,
|
|
13
13
|
credentials.redirectUri
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
client.setCredentials({
|
|
17
|
-
access_token:
|
|
17
|
+
access_token: data.accessToken,
|
|
18
18
|
refresh_token: data.refreshToken,
|
|
19
19
|
});
|
|
20
20
|
|
|
@@ -25,11 +25,14 @@ class GoogleCalendarService implements IGoogleCalendarService {
|
|
|
25
25
|
|
|
26
26
|
const events = items.map(item => ({
|
|
27
27
|
title: item.summary,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
description: item.description,
|
|
29
|
+
type: item.eventType,
|
|
30
|
+
status: item.status,
|
|
31
|
+
createdAt: item.created,
|
|
32
|
+
startAt: item.start?.dateTime,
|
|
33
|
+
endAt: item.end?.dateTime,
|
|
31
34
|
organizer: {
|
|
32
|
-
name: item.organizer?.displayName
|
|
35
|
+
name: item.organizer?.displayName,
|
|
33
36
|
email: item.organizer?.email,
|
|
34
37
|
},
|
|
35
38
|
}));
|
|
@@ -37,7 +40,6 @@ class GoogleCalendarService implements IGoogleCalendarService {
|
|
|
37
40
|
return {
|
|
38
41
|
events,
|
|
39
42
|
};
|
|
40
|
-
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
|
|
@@ -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,
|
package/yarn.lock
CHANGED
|
@@ -1463,6 +1463,11 @@
|
|
|
1463
1463
|
resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8"
|
|
1464
1464
|
integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==
|
|
1465
1465
|
|
|
1466
|
+
"@babel/runtime@^7.12.5":
|
|
1467
|
+
version "7.28.4"
|
|
1468
|
+
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.4.tgz#a70226016fabe25c5783b2f22d3e1c9bc5ca3326"
|
|
1469
|
+
integrity sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==
|
|
1470
|
+
|
|
1466
1471
|
"@babel/runtime@^7.27.6":
|
|
1467
1472
|
version "7.28.3"
|
|
1468
1473
|
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.3.tgz#75c5034b55ba868121668be5d5bb31cc64e6e61a"
|
|
@@ -2080,6 +2085,14 @@
|
|
|
2080
2085
|
resolved "https://registry.npmjs.org/@microsoft/applicationinsights-web-snippet/-/applicationinsights-web-snippet-1.2.1.tgz#c158081f8c40ea9ad94475abac15f67182768882"
|
|
2081
2086
|
integrity sha512-+Cy9zFqdQgdAbMK1dpm7B+3DUnrByai0Tq6XG9v737HJpW6G1EiNNbTuFeXdPWyGaq6FIx9jxm/SUcxA6/Rxxg==
|
|
2082
2087
|
|
|
2088
|
+
"@microsoft/microsoft-graph-client@^3.0.7":
|
|
2089
|
+
version "3.0.7"
|
|
2090
|
+
resolved "https://registry.yarnpkg.com/@microsoft/microsoft-graph-client/-/microsoft-graph-client-3.0.7.tgz#535507df2db40bd7ed24a670dc68c87c628177a4"
|
|
2091
|
+
integrity sha512-/AazAV/F+HK4LIywF9C+NYHcJo038zEnWkteilcxC1FM/uK/4NVGDKGrxx7nNq1ybspAroRKT4I1FHfxQzxkUw==
|
|
2092
|
+
dependencies:
|
|
2093
|
+
"@babel/runtime" "^7.12.5"
|
|
2094
|
+
tslib "^2.2.0"
|
|
2095
|
+
|
|
2083
2096
|
"@nodelib/fs.scandir@2.1.5":
|
|
2084
2097
|
version "2.1.5"
|
|
2085
2098
|
resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
|