@checkfirst/nestjs-outlook
Version:
An opinionated NestJS module for Microsoft Outlook integration that provides easy access to Microsoft Graph API for emails, calendars, and more.
186 lines • 7.46 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OutlookWebhookNotificationDto = exports.OutlookWebhookNotificationItemDto = exports.OutlookResourceData = void 0;
const class_validator_1 = require("class-validator");
const swagger_1 = require("@nestjs/swagger");
class OutlookResourceData {
constructor() {
this.id = '';
}
}
exports.OutlookResourceData = OutlookResourceData;
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The OData entity type in Microsoft Graph',
example: '#microsoft.graph.event',
required: false,
}),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", String)
], OutlookResourceData.prototype, "@odata.type", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The OData identifier of the object',
example: 'https://graph.microsoft.com/v1.0/users/{userId}/events/{eventId}',
required: false,
}),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", String)
], OutlookResourceData.prototype, "@odata.id", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The OData entity tag that represents the version of the object',
example: 'W/"ZWRafd0rFkORSLqrpwPMEQlFkSo="',
required: false,
}),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", String)
], OutlookResourceData.prototype, "@odata.etag", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The identifier of the object',
example: 'AAMkADI5MAAIT3drCAAA=',
}),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsNotEmpty)(),
__metadata("design:type", String)
], OutlookResourceData.prototype, "id", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The user ID associated with the resource',
example: 123,
}),
__metadata("design:type", Number)
], OutlookResourceData.prototype, "userId", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The subscription ID that triggered this notification',
example: '08ee466c-5ceb-4af2-a98f-aea3316a854c',
}),
__metadata("design:type", String)
], OutlookResourceData.prototype, "subscriptionId", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The resource path that changed',
example: '/me/messages/AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAEMAAAiIsqMbYjsT5e-T7KzowPTAAAYbuK-AAA=',
}),
__metadata("design:type", String)
], OutlookResourceData.prototype, "resource", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The type of change that occurred',
example: 'created',
}),
__metadata("design:type", String)
], OutlookResourceData.prototype, "changeType", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'Additional data for the resource (like email content for new emails)',
required: false,
type: 'object',
}),
(0, class_validator_1.IsObject)(),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", Object)
], OutlookResourceData.prototype, "data", void 0);
class OutlookWebhookNotificationItemDto {
constructor() {
this.subscriptionId = '';
this.subscriptionExpirationDateTime = '';
this.changeType = '';
this.resource = '';
}
}
exports.OutlookWebhookNotificationItemDto = OutlookWebhookNotificationItemDto;
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The ID of the webhook subscription',
example: '08ee466c-5ceb-4af2-a98f-aea3316a854c',
}),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsNotEmpty)(),
__metadata("design:type", String)
], OutlookWebhookNotificationItemDto.prototype, "subscriptionId", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The date and time when the subscription expires',
example: '2019-09-16T02:17:10Z',
}),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsNotEmpty)(),
__metadata("design:type", String)
], OutlookWebhookNotificationItemDto.prototype, "subscriptionExpirationDateTime", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The type of change that occurred',
example: 'deleted',
}),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsNotEmpty)(),
__metadata("design:type", String)
], OutlookWebhookNotificationItemDto.prototype, "changeType", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The type of resource that changed',
example: 'event',
}),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsNotEmpty)(),
__metadata("design:type", String)
], OutlookWebhookNotificationItemDto.prototype, "resource", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The data of the resource that changed',
type: OutlookResourceData,
}),
(0, class_validator_1.IsObject)(),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", OutlookResourceData)
], OutlookWebhookNotificationItemDto.prototype, "resourceData", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The unique identifier for the client state',
example: 'c75831bd-fad3-4191-9a66-280a48528679',
required: false,
}),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", String)
], OutlookWebhookNotificationItemDto.prototype, "clientState", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: 'The tenant ID',
example: 'bb8775a4-4d8c-4b2d-9411-b77d0123456',
required: false,
}),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", String)
], OutlookWebhookNotificationItemDto.prototype, "tenantId", void 0);
class OutlookWebhookNotificationDto {
constructor() {
this.value = [];
}
}
exports.OutlookWebhookNotificationDto = OutlookWebhookNotificationDto;
__decorate([
(0, swagger_1.ApiProperty)({
description: 'Array of notification items',
type: [OutlookWebhookNotificationItemDto],
}),
(0, class_validator_1.IsArray)(),
__metadata("design:type", Array)
], OutlookWebhookNotificationDto.prototype, "value", void 0);
//# sourceMappingURL=outlook-webhook-notification.dto.js.map