mblabs-roccato-backend-commons 1.0.55 → 1.0.56
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/azure.d.ts +31 -0
- package/dist/services/azure/calendar.d.ts +7 -0
- package/dist/services/azure/calendar.js +40 -0
- package/dist/services/azure/index.d.ts +2 -1
- package/dist/services/azure/index.js +3 -1
- package/dist/services/date.d.ts +5 -4
- package/dist/services/date.js +6 -0
- package/dist/services/gcp/calendar.js +13 -14
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.js +2 -1
- package/package.json +3 -1
- package/src/interfaces/azure.ts +37 -1
- package/src/services/azure/calendar.ts +46 -0
- package/src/services/azure/index.ts +2 -0
- package/src/services/date.ts +12 -4
- package/src/services/gcp/calendar.ts +13 -15
- package/src/services/index.ts +2 -0
- package/yarn.lock +19 -1
|
@@ -64,6 +64,34 @@ export declare namespace AzureApplicationInsights {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
export declare namespace AzureCalendar {
|
|
68
|
+
namespace GetEvents {
|
|
69
|
+
interface Request {
|
|
70
|
+
data: {
|
|
71
|
+
user: string;
|
|
72
|
+
accessToken: string;
|
|
73
|
+
startDate: Date;
|
|
74
|
+
endDate: Date;
|
|
75
|
+
};
|
|
76
|
+
credentials: Credentials;
|
|
77
|
+
}
|
|
78
|
+
interface Response {
|
|
79
|
+
events: {
|
|
80
|
+
title?: string;
|
|
81
|
+
description?: string;
|
|
82
|
+
type?: string;
|
|
83
|
+
status?: string;
|
|
84
|
+
createdAt?: string | Date;
|
|
85
|
+
startAt?: string | Date;
|
|
86
|
+
endAt?: string | Date;
|
|
87
|
+
organizer?: {
|
|
88
|
+
name?: string;
|
|
89
|
+
email?: string;
|
|
90
|
+
} | null;
|
|
91
|
+
}[];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
67
95
|
export declare namespace AzureCommunication {
|
|
68
96
|
namespace SendMail {
|
|
69
97
|
interface Request {
|
|
@@ -168,6 +196,9 @@ export interface IAzureApplicationInsightsService {
|
|
|
168
196
|
trackException(req: AzureApplicationInsights.TrackException.Request): Promise<void>;
|
|
169
197
|
trackMetric(req: AzureApplicationInsights.TrackMetric.Request): Promise<void>;
|
|
170
198
|
}
|
|
199
|
+
export interface IAzureCalendarService {
|
|
200
|
+
getEvents(req: AzureCalendar.GetEvents.Request): Promise<AzureCalendar.GetEvents.Response>;
|
|
201
|
+
}
|
|
171
202
|
export interface IAzureCommunicationService {
|
|
172
203
|
sendMail(req: AzureCommunication.SendMail.Request): Promise<void>;
|
|
173
204
|
sendSMS(req: AzureCommunication.SendSMS.Request): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import 'isomorphic-fetch';
|
|
2
|
+
import { AzureCalendar, IAzureCalendarService } from '../../interfaces';
|
|
3
|
+
declare class AzuerCalendarService implements IAzureCalendarService {
|
|
4
|
+
getEvents({ credentials, data, }: AzureCalendar.GetEvents.Request): Promise<AzureCalendar.GetEvents.Response>;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: AzuerCalendarService;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
require("isomorphic-fetch");
|
|
7
|
+
const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
|
8
|
+
const date_1 = __importDefault(require("../date"));
|
|
9
|
+
class AzuerCalendarService {
|
|
10
|
+
async getEvents({ credentials, data, }) {
|
|
11
|
+
const client = microsoft_graph_client_1.Client.init({
|
|
12
|
+
authProvider: (done) => { done(null, data.accessToken); },
|
|
13
|
+
});
|
|
14
|
+
const { value: items } = await client
|
|
15
|
+
.api(`/users/${data.user}/calendarview`)
|
|
16
|
+
.query({
|
|
17
|
+
'startDateTime': date_1.default.toISO(data.startDate),
|
|
18
|
+
'endDateTime': date_1.default.toISO(data.endDate),
|
|
19
|
+
'$select': 'subject,start,end,location,organizer,type,responseStatus',
|
|
20
|
+
'$orderby': 'start/dateTime',
|
|
21
|
+
})
|
|
22
|
+
.get();
|
|
23
|
+
return {
|
|
24
|
+
events: items.map((item) => ({
|
|
25
|
+
title: item.subject,
|
|
26
|
+
description: '',
|
|
27
|
+
type: item.type,
|
|
28
|
+
status: item.responseStatus?.response,
|
|
29
|
+
createdAt: item.createdDateTime,
|
|
30
|
+
startAt: item.start.dateTime,
|
|
31
|
+
endAt: item.end?.dateTime,
|
|
32
|
+
organizer: {
|
|
33
|
+
name: item.organizer?.emailAddress?.name,
|
|
34
|
+
email: item.organizer?.emailAddress?.address,
|
|
35
|
+
},
|
|
36
|
+
})),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = new AzuerCalendarService();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import AzureApplicationInsightsService from './application-insights';
|
|
2
2
|
import AzureAuthService from './auth';
|
|
3
|
+
import AzureCalendarService from './calendar';
|
|
3
4
|
import AzureCommunicationService from './communication';
|
|
4
5
|
import AzureKeyVaultService from './keyvault';
|
|
5
6
|
import AzureStorageBlobService from './storage-blob';
|
|
6
|
-
export { AzureAuthService, AzureApplicationInsightsService, AzureCommunicationService, AzureKeyVaultService, AzureStorageBlobService, };
|
|
7
|
+
export { AzureAuthService, AzureApplicationInsightsService, AzureCalendarService, AzureCommunicationService, AzureKeyVaultService, AzureStorageBlobService, };
|
|
@@ -3,11 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AzureStorageBlobService = exports.AzureKeyVaultService = exports.AzureCommunicationService = exports.AzureApplicationInsightsService = exports.AzureAuthService = void 0;
|
|
6
|
+
exports.AzureStorageBlobService = exports.AzureKeyVaultService = exports.AzureCommunicationService = exports.AzureCalendarService = exports.AzureApplicationInsightsService = exports.AzureAuthService = void 0;
|
|
7
7
|
const application_insights_1 = __importDefault(require("./application-insights"));
|
|
8
8
|
exports.AzureApplicationInsightsService = application_insights_1.default;
|
|
9
9
|
const auth_1 = __importDefault(require("./auth"));
|
|
10
10
|
exports.AzureAuthService = auth_1.default;
|
|
11
|
+
const calendar_1 = __importDefault(require("./calendar"));
|
|
12
|
+
exports.AzureCalendarService = calendar_1.default;
|
|
11
13
|
const communication_1 = __importDefault(require("./communication"));
|
|
12
14
|
exports.AzureCommunicationService = communication_1.default;
|
|
13
15
|
const keyvault_1 = __importDefault(require("./keyvault"));
|
package/dist/services/date.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare class DateService {
|
|
2
|
-
toDate(inp:
|
|
3
|
-
toFormat(inp:
|
|
2
|
+
toDate(inp: string | Date, format?: string): Date;
|
|
3
|
+
toFormat(inp: string | Date, format?: string): string;
|
|
4
|
+
toISO(inp: string | Date): string;
|
|
4
5
|
convertTimestampToDate(inp: string | number): Date;
|
|
5
6
|
getCurrent(): string;
|
|
6
7
|
getCurrentDate(): Date;
|
|
@@ -11,7 +12,7 @@ declare class DateService {
|
|
|
11
12
|
minusHours(start: Date, toRemove: number): Date;
|
|
12
13
|
minusMinutes(start: Date, toRemove: number): Date;
|
|
13
14
|
isValidDate(inp: string, format?: string): boolean;
|
|
14
|
-
getStartAndEndOfDay(inp?:
|
|
15
|
+
getStartAndEndOfDay(inp?: string | Date, useUTC?: boolean): {
|
|
15
16
|
startOfDay: Date;
|
|
16
17
|
endOfDay: Date;
|
|
17
18
|
};
|
|
@@ -24,7 +25,7 @@ declare class DateService {
|
|
|
24
25
|
getCurrentTimestamp(): number;
|
|
25
26
|
getMillisFromFormattedDate(date: string, format?: string): number;
|
|
26
27
|
getMonthsInRange(startDate: Date, endDate: Date): string[];
|
|
27
|
-
isSameDay(inp:
|
|
28
|
+
isSameDay(inp: string | Date, compare?: Date): boolean;
|
|
28
29
|
isToday(date: Date): boolean;
|
|
29
30
|
}
|
|
30
31
|
declare const _default: DateService;
|
package/dist/services/date.js
CHANGED
|
@@ -21,6 +21,12 @@ class DateService {
|
|
|
21
21
|
}
|
|
22
22
|
return luxon_1.DateTime.fromISO(inp).toFormat(format);
|
|
23
23
|
}
|
|
24
|
+
toISO(inp) {
|
|
25
|
+
if (inp instanceof Date) {
|
|
26
|
+
return luxon_1.DateTime.fromJSDate(inp).toISO();
|
|
27
|
+
}
|
|
28
|
+
return luxon_1.DateTime.fromISO(inp).toISO();
|
|
29
|
+
}
|
|
24
30
|
convertTimestampToDate(inp) {
|
|
25
31
|
const timestamp = typeof inp === 'string' ? parseInt(inp, 10) : inp;
|
|
26
32
|
return luxon_1.DateTime.fromMillis(timestamp).toJSDate();
|
|
@@ -12,21 +12,20 @@ class GoogleCalendarService {
|
|
|
12
12
|
.calendar({ version: 'v3', auth: client })
|
|
13
13
|
.events
|
|
14
14
|
.list();
|
|
15
|
-
const events = items.map(item => ({
|
|
16
|
-
title: item.summary,
|
|
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,
|
|
23
|
-
organizer: {
|
|
24
|
-
name: item.organizer?.displayName,
|
|
25
|
-
email: item.organizer?.email,
|
|
26
|
-
},
|
|
27
|
-
}));
|
|
28
15
|
return {
|
|
29
|
-
events
|
|
16
|
+
events: items.map(item => ({
|
|
17
|
+
title: item.summary,
|
|
18
|
+
description: item.description,
|
|
19
|
+
type: item.eventType,
|
|
20
|
+
status: item.status,
|
|
21
|
+
createdAt: item.created,
|
|
22
|
+
startAt: item.start?.dateTime,
|
|
23
|
+
endAt: item.end?.dateTime,
|
|
24
|
+
organizer: {
|
|
25
|
+
name: item.organizer?.displayName,
|
|
26
|
+
email: item.organizer?.email,
|
|
27
|
+
},
|
|
28
|
+
})),
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AmazonCloudwatchService, AmazonPinpointService, AmazonS3Service, AmazonSecretManagerService, AmazonSQSService } from './aws';
|
|
2
|
-
import { AzureApplicationInsightsService, AzureAuthService, AzureCommunicationService, AzureKeyVaultService, AzureStorageBlobService } from './azure';
|
|
2
|
+
import { AzureApplicationInsightsService, AzureAuthService, AzureCalendarService, AzureCommunicationService, AzureKeyVaultService, AzureStorageBlobService } from './azure';
|
|
3
3
|
import DateService from './date';
|
|
4
4
|
import FileService from './file';
|
|
5
5
|
import FirebaseService from './firebase';
|
|
@@ -12,4 +12,4 @@ import NodeMailerService from './nodemailer';
|
|
|
12
12
|
import RabbitMQService from './rabbit';
|
|
13
13
|
import RedisService from './redis';
|
|
14
14
|
import SendgridService from './sendgrid';
|
|
15
|
-
export { AmazonCloudwatchService, AmazonPinpointService, AmazonS3Service, AmazonSecretManagerService, AmazonSQSService, AzureApplicationInsightsService, AzureAuthService, AzureCommunicationService, AzureKeyVaultService, AzureStorageBlobService, DateService, FileService, FirebaseService, GoogleAuthService, GoogleCalendarService, GoogleSecretsService, GoogleSheetsService, GoogleStorageService, GrafanaService, I18nService, KafkaService, KeycloakService, NodeMailerService, RabbitMQService, RedisService, SendgridService, };
|
|
15
|
+
export { AmazonCloudwatchService, AmazonPinpointService, AmazonS3Service, AmazonSecretManagerService, AmazonSQSService, AzureApplicationInsightsService, AzureAuthService, AzureCalendarService, AzureCommunicationService, AzureKeyVaultService, AzureStorageBlobService, DateService, FileService, FirebaseService, GoogleAuthService, GoogleCalendarService, GoogleSecretsService, GoogleSheetsService, GoogleStorageService, GrafanaService, I18nService, KafkaService, KeycloakService, NodeMailerService, RabbitMQService, RedisService, SendgridService, };
|
package/dist/services/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SendgridService = exports.RedisService = exports.RabbitMQService = exports.NodeMailerService = exports.KeycloakService = exports.KafkaService = exports.I18nService = exports.GrafanaService = exports.GoogleStorageService = exports.GoogleSheetsService = exports.GoogleSecretsService = exports.GoogleCalendarService = exports.GoogleAuthService = exports.FirebaseService = exports.FileService = exports.DateService = exports.AzureStorageBlobService = exports.AzureKeyVaultService = exports.AzureCommunicationService = exports.AzureAuthService = exports.AzureApplicationInsightsService = exports.AmazonSQSService = exports.AmazonSecretManagerService = exports.AmazonS3Service = exports.AmazonPinpointService = exports.AmazonCloudwatchService = void 0;
|
|
6
|
+
exports.SendgridService = exports.RedisService = exports.RabbitMQService = exports.NodeMailerService = exports.KeycloakService = exports.KafkaService = exports.I18nService = exports.GrafanaService = exports.GoogleStorageService = exports.GoogleSheetsService = exports.GoogleSecretsService = exports.GoogleCalendarService = exports.GoogleAuthService = exports.FirebaseService = exports.FileService = exports.DateService = exports.AzureStorageBlobService = exports.AzureKeyVaultService = exports.AzureCommunicationService = exports.AzureCalendarService = exports.AzureAuthService = exports.AzureApplicationInsightsService = exports.AmazonSQSService = exports.AmazonSecretManagerService = exports.AmazonS3Service = exports.AmazonPinpointService = exports.AmazonCloudwatchService = void 0;
|
|
7
7
|
const aws_1 = require("./aws");
|
|
8
8
|
Object.defineProperty(exports, "AmazonCloudwatchService", { enumerable: true, get: function () { return aws_1.AmazonCloudwatchService; } });
|
|
9
9
|
Object.defineProperty(exports, "AmazonPinpointService", { enumerable: true, get: function () { return aws_1.AmazonPinpointService; } });
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "AmazonSQSService", { enumerable: true, get: func
|
|
|
13
13
|
const azure_1 = require("./azure");
|
|
14
14
|
Object.defineProperty(exports, "AzureApplicationInsightsService", { enumerable: true, get: function () { return azure_1.AzureApplicationInsightsService; } });
|
|
15
15
|
Object.defineProperty(exports, "AzureAuthService", { enumerable: true, get: function () { return azure_1.AzureAuthService; } });
|
|
16
|
+
Object.defineProperty(exports, "AzureCalendarService", { enumerable: true, get: function () { return azure_1.AzureCalendarService; } });
|
|
16
17
|
Object.defineProperty(exports, "AzureCommunicationService", { enumerable: true, get: function () { return azure_1.AzureCommunicationService; } });
|
|
17
18
|
Object.defineProperty(exports, "AzureKeyVaultService", { enumerable: true, get: function () { return azure_1.AzureKeyVaultService; } });
|
|
18
19
|
Object.defineProperty(exports, "AzureStorageBlobService", { enumerable: true, get: function () { return azure_1.AzureStorageBlobService; } });
|
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.56",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"google-auth-library": "^10.3.0",
|
|
68
68
|
"googleapis": "^148.0.0",
|
|
69
69
|
"i18next": "^25.3.6",
|
|
70
|
+
"isomorphic-fetch": "^3.0.0",
|
|
70
71
|
"kafkajs": "^2.2.4",
|
|
71
72
|
"luxon": "^3.6.1",
|
|
72
73
|
"nodemailer": "^7.0.3",
|
|
@@ -77,6 +78,7 @@
|
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@commitlint/cli": "^19.8.0",
|
|
79
80
|
"@commitlint/config-conventional": "^19.8.0",
|
|
81
|
+
"@microsoft/microsoft-graph-types": "^2.40.0",
|
|
80
82
|
"@types/amqplib": "^0.10.7",
|
|
81
83
|
"@types/express": "^5.0.1",
|
|
82
84
|
"@types/luxon": "^3.6.2",
|
package/src/interfaces/azure.ts
CHANGED
|
@@ -43,7 +43,9 @@ export namespace AzureApplicationInsights {
|
|
|
43
43
|
export interface Request {
|
|
44
44
|
data: {
|
|
45
45
|
name: string;
|
|
46
|
-
properties?: {
|
|
46
|
+
properties?: {
|
|
47
|
+
[key: string]: string;
|
|
48
|
+
};
|
|
47
49
|
};
|
|
48
50
|
credentials: Credentials;
|
|
49
51
|
}
|
|
@@ -69,6 +71,36 @@ export namespace AzureApplicationInsights {
|
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
|
|
74
|
+
export namespace AzureCalendar {
|
|
75
|
+
export namespace GetEvents {
|
|
76
|
+
export interface Request {
|
|
77
|
+
data: {
|
|
78
|
+
user: string;
|
|
79
|
+
accessToken: string;
|
|
80
|
+
startDate: Date;
|
|
81
|
+
endDate: Date;
|
|
82
|
+
};
|
|
83
|
+
credentials: Credentials;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface Response {
|
|
87
|
+
events: {
|
|
88
|
+
title?: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
type?: string;
|
|
91
|
+
status?: string;
|
|
92
|
+
createdAt?: string | Date;
|
|
93
|
+
startAt?: string | Date;
|
|
94
|
+
endAt?: string | Date;
|
|
95
|
+
organizer?: {
|
|
96
|
+
name?: string;
|
|
97
|
+
email?: string;
|
|
98
|
+
} | null;
|
|
99
|
+
}[];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
72
104
|
export namespace AzureCommunication {
|
|
73
105
|
export namespace SendMail {
|
|
74
106
|
export interface Request {
|
|
@@ -185,6 +217,10 @@ export interface IAzureApplicationInsightsService {
|
|
|
185
217
|
trackMetric(req: AzureApplicationInsights.TrackMetric.Request): Promise<void>;
|
|
186
218
|
}
|
|
187
219
|
|
|
220
|
+
export interface IAzureCalendarService {
|
|
221
|
+
getEvents(req: AzureCalendar.GetEvents.Request): Promise<AzureCalendar.GetEvents.Response>;
|
|
222
|
+
}
|
|
223
|
+
|
|
188
224
|
export interface IAzureCommunicationService {
|
|
189
225
|
sendMail(req: AzureCommunication.SendMail.Request): Promise<void>;
|
|
190
226
|
sendSMS(req: AzureCommunication.SendSMS.Request): Promise<void>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import 'isomorphic-fetch';
|
|
2
|
+
|
|
3
|
+
import { Client } from '@microsoft/microsoft-graph-client';
|
|
4
|
+
import { Event } from '@microsoft/microsoft-graph-types';
|
|
5
|
+
|
|
6
|
+
import { AzureCalendar, IAzureCalendarService } from '../../interfaces';
|
|
7
|
+
import DateService from '../date';
|
|
8
|
+
|
|
9
|
+
class AzuerCalendarService implements IAzureCalendarService {
|
|
10
|
+
async getEvents ({
|
|
11
|
+
credentials,
|
|
12
|
+
data,
|
|
13
|
+
}: AzureCalendar.GetEvents.Request): Promise<AzureCalendar.GetEvents.Response> {
|
|
14
|
+
const client = Client.init({
|
|
15
|
+
authProvider: (done) => { done(null, data.accessToken); },
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const { value: items } = await client
|
|
19
|
+
.api(`/users/${data.user}/calendarview`)
|
|
20
|
+
.query({
|
|
21
|
+
'startDateTime': DateService.toISO(data.startDate),
|
|
22
|
+
'endDateTime': DateService.toISO(data.endDate),
|
|
23
|
+
'$select': 'subject,start,end,location,organizer,type,responseStatus',
|
|
24
|
+
'$orderby': 'start/dateTime',
|
|
25
|
+
})
|
|
26
|
+
.get();
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
events: (items as Event[]).map((item) => ({
|
|
30
|
+
title: item.subject,
|
|
31
|
+
description: '',
|
|
32
|
+
type: item.type,
|
|
33
|
+
status: item.responseStatus?.response,
|
|
34
|
+
createdAt: item.createdDateTime,
|
|
35
|
+
startAt: item.start.dateTime,
|
|
36
|
+
endAt: item.end?.dateTime,
|
|
37
|
+
organizer: {
|
|
38
|
+
name: item.organizer?.emailAddress?.name,
|
|
39
|
+
email: item.organizer?.emailAddress?.address,
|
|
40
|
+
},
|
|
41
|
+
})),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default new AzuerCalendarService();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import AzureApplicationInsightsService from './application-insights';
|
|
2
2
|
import AzureAuthService from './auth';
|
|
3
|
+
import AzureCalendarService from './calendar';
|
|
3
4
|
import AzureCommunicationService from './communication';
|
|
4
5
|
import AzureKeyVaultService from './keyvault';
|
|
5
6
|
import AzureStorageBlobService from './storage-blob';
|
|
@@ -7,6 +8,7 @@ import AzureStorageBlobService from './storage-blob';
|
|
|
7
8
|
export {
|
|
8
9
|
AzureAuthService,
|
|
9
10
|
AzureApplicationInsightsService,
|
|
11
|
+
AzureCalendarService,
|
|
10
12
|
AzureCommunicationService,
|
|
11
13
|
AzureKeyVaultService,
|
|
12
14
|
AzureStorageBlobService,
|
package/src/services/date.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { DateTime } from 'luxon';
|
|
|
3
3
|
import { DATE } from '../constants';
|
|
4
4
|
|
|
5
5
|
class DateService {
|
|
6
|
-
public toDate (inp:
|
|
6
|
+
public toDate (inp: string | Date, format = DATE.SYSTEM.COMMON_DATE): Date {
|
|
7
7
|
if (inp instanceof Date) {
|
|
8
8
|
return inp;
|
|
9
9
|
}
|
|
@@ -19,7 +19,7 @@ class DateService {
|
|
|
19
19
|
return DateTime.local().toJSDate();
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
public toFormat (inp:
|
|
22
|
+
public toFormat (inp: string | Date, format = DATE.SYSTEM.COMMON_DATE): string {
|
|
23
23
|
if (inp instanceof Date) {
|
|
24
24
|
return DateTime.fromJSDate(inp).toFormat(format);
|
|
25
25
|
}
|
|
@@ -27,6 +27,14 @@ class DateService {
|
|
|
27
27
|
return DateTime.fromISO(inp).toFormat(format);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
public toISO (inp: string | Date) {
|
|
31
|
+
if (inp instanceof Date) {
|
|
32
|
+
return DateTime.fromJSDate(inp).toISO();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return DateTime.fromISO(inp).toISO();
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
public convertTimestampToDate (inp: string | number): Date {
|
|
31
39
|
const timestamp = typeof inp === 'string' ? parseInt(inp, 10) : inp;
|
|
32
40
|
return DateTime.fromMillis(timestamp).toJSDate();
|
|
@@ -69,7 +77,7 @@ class DateService {
|
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
public getStartAndEndOfDay (
|
|
72
|
-
inp:
|
|
80
|
+
inp: string | Date = this.getCurrentDate(),
|
|
73
81
|
useUTC = false
|
|
74
82
|
) {
|
|
75
83
|
const date = inp instanceof Date
|
|
@@ -143,7 +151,7 @@ class DateService {
|
|
|
143
151
|
return months;
|
|
144
152
|
}
|
|
145
153
|
|
|
146
|
-
public isSameDay (inp:
|
|
154
|
+
public isSameDay (inp: string | Date, compare = this.getCurrentDate()): boolean {
|
|
147
155
|
const startDate = DateTime.fromJSDate(this.toDate(inp)).startOf('day');
|
|
148
156
|
const endDate = DateTime.fromJSDate(this.toDate(compare)).startOf('day');
|
|
149
157
|
|
|
@@ -23,22 +23,20 @@ class GoogleCalendarService implements IGoogleCalendarService {
|
|
|
23
23
|
.events
|
|
24
24
|
.list();
|
|
25
25
|
|
|
26
|
-
const events = items.map(item => ({
|
|
27
|
-
title: item.summary,
|
|
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,
|
|
34
|
-
organizer: {
|
|
35
|
-
name: item.organizer?.displayName,
|
|
36
|
-
email: item.organizer?.email,
|
|
37
|
-
},
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
26
|
return {
|
|
41
|
-
events
|
|
27
|
+
events: items.map(item => ({
|
|
28
|
+
title: item.summary,
|
|
29
|
+
description: item.description,
|
|
30
|
+
type: item.eventType,
|
|
31
|
+
status: item.status,
|
|
32
|
+
createdAt: item.created,
|
|
33
|
+
startAt: item.start?.dateTime,
|
|
34
|
+
endAt: item.end?.dateTime,
|
|
35
|
+
organizer: {
|
|
36
|
+
name: item.organizer?.displayName,
|
|
37
|
+
email: item.organizer?.email,
|
|
38
|
+
},
|
|
39
|
+
})),
|
|
42
40
|
};
|
|
43
41
|
}
|
|
44
42
|
}
|
package/src/services/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
AzureApplicationInsightsService,
|
|
10
10
|
AzureAuthService,
|
|
11
|
+
AzureCalendarService,
|
|
11
12
|
AzureCommunicationService,
|
|
12
13
|
AzureKeyVaultService,
|
|
13
14
|
AzureStorageBlobService,
|
|
@@ -39,6 +40,7 @@ export {
|
|
|
39
40
|
AmazonSQSService,
|
|
40
41
|
AzureApplicationInsightsService,
|
|
41
42
|
AzureAuthService,
|
|
43
|
+
AzureCalendarService,
|
|
42
44
|
AzureCommunicationService,
|
|
43
45
|
AzureKeyVaultService,
|
|
44
46
|
AzureStorageBlobService,
|
package/yarn.lock
CHANGED
|
@@ -2107,6 +2107,11 @@
|
|
|
2107
2107
|
"@babel/runtime" "^7.12.5"
|
|
2108
2108
|
tslib "^2.2.0"
|
|
2109
2109
|
|
|
2110
|
+
"@microsoft/microsoft-graph-types@^2.40.0":
|
|
2111
|
+
version "2.40.0"
|
|
2112
|
+
resolved "https://registry.yarnpkg.com/@microsoft/microsoft-graph-types/-/microsoft-graph-types-2.40.0.tgz#65f51600ab45ace97d7b1368c47f9e0f835fddca"
|
|
2113
|
+
integrity sha512-1fcPVrB/NkbNcGNfCy+Cgnvwxt6/sbIEEFgZHFBJ670zYLegENYJF8qMo7x3LqBjWX2/Eneq5BVVRCLTmlJN+g==
|
|
2114
|
+
|
|
2110
2115
|
"@nodelib/fs.scandir@2.1.5":
|
|
2111
2116
|
version "2.1.5"
|
|
2112
2117
|
resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
|
|
@@ -5657,6 +5662,14 @@ isexe@^2.0.0:
|
|
|
5657
5662
|
resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
|
5658
5663
|
integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==
|
|
5659
5664
|
|
|
5665
|
+
isomorphic-fetch@^3.0.0:
|
|
5666
|
+
version "3.0.0"
|
|
5667
|
+
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4"
|
|
5668
|
+
integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==
|
|
5669
|
+
dependencies:
|
|
5670
|
+
node-fetch "^2.6.1"
|
|
5671
|
+
whatwg-fetch "^3.4.1"
|
|
5672
|
+
|
|
5660
5673
|
jackspeak@^3.1.2:
|
|
5661
5674
|
version "3.4.3"
|
|
5662
5675
|
resolved "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a"
|
|
@@ -6110,7 +6123,7 @@ node-domexception@^1.0.0:
|
|
|
6110
6123
|
resolved "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
|
|
6111
6124
|
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
|
|
6112
6125
|
|
|
6113
|
-
node-fetch@^2.6.9, node-fetch@^2.7.0:
|
|
6126
|
+
node-fetch@^2.6.1, node-fetch@^2.6.9, node-fetch@^2.7.0:
|
|
6114
6127
|
version "2.7.0"
|
|
6115
6128
|
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
|
|
6116
6129
|
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
|
|
@@ -7396,6 +7409,11 @@ websocket-extensions@>=0.1.1:
|
|
|
7396
7409
|
resolved "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42"
|
|
7397
7410
|
integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==
|
|
7398
7411
|
|
|
7412
|
+
whatwg-fetch@^3.4.1:
|
|
7413
|
+
version "3.6.20"
|
|
7414
|
+
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70"
|
|
7415
|
+
integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==
|
|
7416
|
+
|
|
7399
7417
|
whatwg-url@^5.0.0:
|
|
7400
7418
|
version "5.0.0"
|
|
7401
7419
|
resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
|