@checkfirst/nestjs-outlook 0.1.0
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/LICENSE +21 -0
- package/README.md +224 -0
- package/assets/checkfirst-logo.png +0 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/controllers/microsoft-auth.controller.d.ts +7 -0
- package/dist/controllers/microsoft-auth.controller.js +101 -0
- package/dist/controllers/microsoft-auth.controller.js.map +1 -0
- package/dist/controllers/outlook.controller.d.ts +8 -0
- package/dist/controllers/outlook.controller.js +117 -0
- package/dist/controllers/outlook.controller.js.map +1 -0
- package/dist/dto/outlook-webhook-notification.dto.d.ts +19 -0
- package/dist/dto/outlook-webhook-notification.dto.js +149 -0
- package/dist/dto/outlook-webhook-notification.dto.js.map +1 -0
- package/dist/entities/csrf-token.entity.d.ts +7 -0
- package/dist/entities/csrf-token.entity.js +48 -0
- package/dist/entities/csrf-token.entity.js.map +1 -0
- package/dist/entities/outlook-webhook-subscription.entity.d.ts +15 -0
- package/dist/entities/outlook-webhook-subscription.entity.js +87 -0
- package/dist/entities/outlook-webhook-subscription.entity.js.map +1 -0
- package/dist/event-types.enum.d.ts +7 -0
- package/dist/event-types.enum.js +12 -0
- package/dist/event-types.enum.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/config/outlook-config.interface.d.ts +7 -0
- package/dist/interfaces/config/outlook-config.interface.js +3 -0
- package/dist/interfaces/config/outlook-config.interface.js.map +1 -0
- package/dist/interfaces/microsoft-auth/microsoft-token-api-response.interface.d.ts +9 -0
- package/dist/interfaces/microsoft-auth/microsoft-token-api-response.interface.js +3 -0
- package/dist/interfaces/microsoft-auth/microsoft-token-api-response.interface.js.map +1 -0
- package/dist/interfaces/microsoft-auth/state-object.interface.d.ts +5 -0
- package/dist/interfaces/microsoft-auth/state-object.interface.js +3 -0
- package/dist/interfaces/microsoft-auth/state-object.interface.js.map +1 -0
- package/dist/interfaces/outlook/token-response.interface.d.ts +5 -0
- package/dist/interfaces/outlook/token-response.interface.js +3 -0
- package/dist/interfaces/outlook/token-response.interface.js.map +1 -0
- package/dist/microsoft-outlook.module.d.ts +4 -0
- package/dist/microsoft-outlook.module.js +50 -0
- package/dist/microsoft-outlook.module.js.map +1 -0
- package/dist/migrations/1697025846000-CreateOutlookTables.d.ts +5 -0
- package/dist/migrations/1697025846000-CreateOutlookTables.js +40 -0
- package/dist/migrations/1697025846000-CreateOutlookTables.js.map +1 -0
- package/dist/repositories/microsoft-csrf-token.repository.d.ts +9 -0
- package/dist/repositories/microsoft-csrf-token.repository.js +60 -0
- package/dist/repositories/microsoft-csrf-token.repository.js.map +1 -0
- package/dist/repositories/outlook-webhook-subscription.repository.d.ts +12 -0
- package/dist/repositories/outlook-webhook-subscription.repository.js +70 -0
- package/dist/repositories/outlook-webhook-subscription.repository.js.map +1 -0
- package/dist/services/microsoft-auth.service.d.ts +32 -0
- package/dist/services/microsoft-auth.service.js +254 -0
- package/dist/services/microsoft-auth.service.js.map +1 -0
- package/dist/services/outlook.service.d.ts +28 -0
- package/dist/services/outlook.service.js +265 -0
- package/dist/services/outlook.service.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +103 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OutlookWebhookNotificationDto = exports.OutlookWebhookNotificationItemDto = exports.OutlookResourceData = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
class OutlookResourceData {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.id = '';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.OutlookResourceData = OutlookResourceData;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, swagger_1.ApiProperty)({
|
|
23
|
+
description: 'The OData entity type in Microsoft Graph',
|
|
24
|
+
example: '#microsoft.graph.event',
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.IsOptional)(),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], OutlookResourceData.prototype, "@odata.type", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, swagger_1.ApiProperty)({
|
|
33
|
+
description: 'The OData identifier of the object',
|
|
34
|
+
example: 'https://graph.microsoft.com/v1.0/users/{userId}/events/{eventId}',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
(0, class_validator_1.IsString)(),
|
|
38
|
+
(0, class_validator_1.IsOptional)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], OutlookResourceData.prototype, "@odata.id", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, swagger_1.ApiProperty)({
|
|
43
|
+
description: 'The HTTP entity tag that represents the version of the object',
|
|
44
|
+
example: 'W/"ZWRafd0rFkORSLqrpwPMEQlFkSo="',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
(0, class_validator_1.IsString)(),
|
|
48
|
+
(0, class_validator_1.IsOptional)(),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], OutlookResourceData.prototype, "@odata.etag", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, swagger_1.ApiProperty)({
|
|
53
|
+
description: 'The identifier of the object',
|
|
54
|
+
example: 'AAMkADI5MAAIT3drCAAA=',
|
|
55
|
+
}),
|
|
56
|
+
(0, class_validator_1.IsString)(),
|
|
57
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], OutlookResourceData.prototype, "id", void 0);
|
|
60
|
+
class OutlookWebhookNotificationItemDto {
|
|
61
|
+
constructor() {
|
|
62
|
+
this.subscriptionId = '';
|
|
63
|
+
this.subscriptionExpirationDateTime = '';
|
|
64
|
+
this.changeType = '';
|
|
65
|
+
this.resource = '';
|
|
66
|
+
this.resourceData = new OutlookResourceData();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.OutlookWebhookNotificationItemDto = OutlookWebhookNotificationItemDto;
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, swagger_1.ApiProperty)({
|
|
72
|
+
description: 'The ID of the webhook subscription',
|
|
73
|
+
example: '08ee466c-5ceb-4af2-a98f-aea3316a854c',
|
|
74
|
+
}),
|
|
75
|
+
(0, class_validator_1.IsString)(),
|
|
76
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], OutlookWebhookNotificationItemDto.prototype, "subscriptionId", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, swagger_1.ApiProperty)({
|
|
81
|
+
description: 'The date and time when the subscription expires',
|
|
82
|
+
example: '2019-09-16T02:17:10Z',
|
|
83
|
+
}),
|
|
84
|
+
(0, class_validator_1.IsString)(),
|
|
85
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
86
|
+
__metadata("design:type", String)
|
|
87
|
+
], OutlookWebhookNotificationItemDto.prototype, "subscriptionExpirationDateTime", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, swagger_1.ApiProperty)({
|
|
90
|
+
description: 'The type of change that occurred',
|
|
91
|
+
example: 'deleted',
|
|
92
|
+
}),
|
|
93
|
+
(0, class_validator_1.IsString)(),
|
|
94
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
95
|
+
__metadata("design:type", String)
|
|
96
|
+
], OutlookWebhookNotificationItemDto.prototype, "changeType", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, swagger_1.ApiProperty)({
|
|
99
|
+
description: 'The type of resource that changed',
|
|
100
|
+
example: 'event',
|
|
101
|
+
}),
|
|
102
|
+
(0, class_validator_1.IsString)(),
|
|
103
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
104
|
+
__metadata("design:type", String)
|
|
105
|
+
], OutlookWebhookNotificationItemDto.prototype, "resource", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, swagger_1.ApiProperty)({
|
|
108
|
+
description: 'The data of the resource that changed',
|
|
109
|
+
type: OutlookResourceData,
|
|
110
|
+
}),
|
|
111
|
+
(0, class_validator_1.IsObject)(),
|
|
112
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
113
|
+
__metadata("design:type", OutlookResourceData)
|
|
114
|
+
], OutlookWebhookNotificationItemDto.prototype, "resourceData", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, swagger_1.ApiProperty)({
|
|
117
|
+
description: 'The unique identifier for the client state',
|
|
118
|
+
example: 'c75831bd-fad3-4191-9a66-280a48528679',
|
|
119
|
+
required: false,
|
|
120
|
+
}),
|
|
121
|
+
(0, class_validator_1.IsString)(),
|
|
122
|
+
(0, class_validator_1.IsOptional)(),
|
|
123
|
+
__metadata("design:type", String)
|
|
124
|
+
], OutlookWebhookNotificationItemDto.prototype, "clientState", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, swagger_1.ApiProperty)({
|
|
127
|
+
description: 'The tenant ID',
|
|
128
|
+
example: 'bb8775a4-4d8c-4b2d-9411-b77d0123456',
|
|
129
|
+
required: false,
|
|
130
|
+
}),
|
|
131
|
+
(0, class_validator_1.IsString)(),
|
|
132
|
+
(0, class_validator_1.IsOptional)(),
|
|
133
|
+
__metadata("design:type", String)
|
|
134
|
+
], OutlookWebhookNotificationItemDto.prototype, "tenantId", void 0);
|
|
135
|
+
class OutlookWebhookNotificationDto {
|
|
136
|
+
constructor() {
|
|
137
|
+
this.value = [];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.OutlookWebhookNotificationDto = OutlookWebhookNotificationDto;
|
|
141
|
+
__decorate([
|
|
142
|
+
(0, swagger_1.ApiProperty)({
|
|
143
|
+
description: 'Array of notification items',
|
|
144
|
+
type: [OutlookWebhookNotificationItemDto],
|
|
145
|
+
}),
|
|
146
|
+
(0, class_validator_1.IsArray)(),
|
|
147
|
+
__metadata("design:type", Array)
|
|
148
|
+
], OutlookWebhookNotificationDto.prototype, "value", void 0);
|
|
149
|
+
//# sourceMappingURL=outlook-webhook-notification.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlook-webhook-notification.dto.js","sourceRoot":"","sources":["../../src/dto/outlook-webhook-notification.dto.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MicrosoftCsrfToken = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
let MicrosoftCsrfToken = class MicrosoftCsrfToken {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.id = 0;
|
|
17
|
+
this.token = '';
|
|
18
|
+
this.userId = '';
|
|
19
|
+
this.expires = new Date();
|
|
20
|
+
this.createdAt = new Date();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.MicrosoftCsrfToken = MicrosoftCsrfToken;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
26
|
+
__metadata("design:type", Number)
|
|
27
|
+
], MicrosoftCsrfToken.prototype, "id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Column)({ length: 64 }),
|
|
30
|
+
(0, typeorm_1.Index)({ unique: true }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], MicrosoftCsrfToken.prototype, "token", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ name: 'user_id' }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], MicrosoftCsrfToken.prototype, "userId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)(),
|
|
39
|
+
__metadata("design:type", Date)
|
|
40
|
+
], MicrosoftCsrfToken.prototype, "expires", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
43
|
+
__metadata("design:type", Date)
|
|
44
|
+
], MicrosoftCsrfToken.prototype, "createdAt", void 0);
|
|
45
|
+
exports.MicrosoftCsrfToken = MicrosoftCsrfToken = __decorate([
|
|
46
|
+
(0, typeorm_1.Entity)('microsoft_csrf_tokens')
|
|
47
|
+
], MicrosoftCsrfToken);
|
|
48
|
+
//# sourceMappingURL=csrf-token.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csrf-token.entity.js","sourceRoot":"","sources":["../../src/entities/csrf-token.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA0F;AAQnF,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QAEL,OAAE,GAAW,CAAC,CAAC;QAIf,UAAK,GAAW,EAAE,CAAC;QAGnB,WAAM,GAAW,EAAE,CAAC;QAGpB,YAAO,GAAS,IAAI,IAAI,EAAE,CAAC;QAG3B,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAC/B,CAAC;CAAA,CAAA;AAhBY,gDAAkB;AAE7B;IADC,IAAA,gCAAsB,GAAE;;8CACV;AAIf;IAFC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACtB,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;iDACL;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;kDACR;AAGpB;IADC,IAAA,gBAAM,GAAE;8BACA,IAAI;mDAAc;AAG3B;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;qDAAc;6BAflB,kBAAkB;IAD9B,IAAA,gBAAM,EAAC,uBAAuB,CAAC;GACnB,kBAAkB,CAgB9B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class OutlookWebhookSubscription {
|
|
2
|
+
id: number;
|
|
3
|
+
subscriptionId: string;
|
|
4
|
+
userId: number;
|
|
5
|
+
resource: string;
|
|
6
|
+
changeType: string;
|
|
7
|
+
clientState: string;
|
|
8
|
+
notificationUrl: string;
|
|
9
|
+
expirationDateTime: Date;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
accessToken: string;
|
|
12
|
+
refreshToken: string;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OutlookWebhookSubscription = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
let OutlookWebhookSubscription = class OutlookWebhookSubscription {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.id = 0;
|
|
17
|
+
this.subscriptionId = '';
|
|
18
|
+
this.userId = 0;
|
|
19
|
+
this.resource = '';
|
|
20
|
+
this.changeType = '';
|
|
21
|
+
this.clientState = '';
|
|
22
|
+
this.notificationUrl = '';
|
|
23
|
+
this.expirationDateTime = new Date();
|
|
24
|
+
this.isActive = true;
|
|
25
|
+
this.accessToken = '';
|
|
26
|
+
this.refreshToken = '';
|
|
27
|
+
this.createdAt = new Date();
|
|
28
|
+
this.updatedAt = new Date();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.OutlookWebhookSubscription = OutlookWebhookSubscription;
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
34
|
+
__metadata("design:type", Number)
|
|
35
|
+
], OutlookWebhookSubscription.prototype, "id", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ name: 'subscription_id', length: 255 }),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], OutlookWebhookSubscription.prototype, "subscriptionId", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ name: 'user_id' }),
|
|
42
|
+
__metadata("design:type", Number)
|
|
43
|
+
], OutlookWebhookSubscription.prototype, "userId", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)({ length: 255 }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], OutlookWebhookSubscription.prototype, "resource", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ name: 'change_type', length: 255 }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], OutlookWebhookSubscription.prototype, "changeType", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({ name: 'client_state', length: 255 }),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], OutlookWebhookSubscription.prototype, "clientState", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ name: 'notification_url', length: 255 }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], OutlookWebhookSubscription.prototype, "notificationUrl", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({ name: 'expiration_date_time', type: 'timestamp' }),
|
|
62
|
+
__metadata("design:type", Date)
|
|
63
|
+
], OutlookWebhookSubscription.prototype, "expirationDateTime", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.Column)({ name: 'is_active', default: true }),
|
|
66
|
+
__metadata("design:type", Boolean)
|
|
67
|
+
], OutlookWebhookSubscription.prototype, "isActive", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, typeorm_1.Column)({ name: 'access_token', type: 'text', nullable: true }),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], OutlookWebhookSubscription.prototype, "accessToken", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, typeorm_1.Column)({ name: 'refresh_token', type: 'text', nullable: true }),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], OutlookWebhookSubscription.prototype, "refreshToken", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
78
|
+
__metadata("design:type", Date)
|
|
79
|
+
], OutlookWebhookSubscription.prototype, "createdAt", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
|
|
82
|
+
__metadata("design:type", Date)
|
|
83
|
+
], OutlookWebhookSubscription.prototype, "updatedAt", void 0);
|
|
84
|
+
exports.OutlookWebhookSubscription = OutlookWebhookSubscription = __decorate([
|
|
85
|
+
(0, typeorm_1.Entity)('outlook_webhook_subscriptions')
|
|
86
|
+
], OutlookWebhookSubscription);
|
|
87
|
+
//# sourceMappingURL=outlook-webhook-subscription.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlook-webhook-subscription.entity.js","sourceRoot":"","sources":["../../src/entities/outlook-webhook-subscription.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAMiB;AAGV,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAAhC;QAEL,OAAE,GAAW,CAAC,CAAC;QAGf,mBAAc,GAAW,EAAE,CAAC;QAG5B,WAAM,GAAW,CAAC,CAAC;QAGnB,aAAQ,GAAW,EAAE,CAAC;QAGtB,eAAU,GAAW,EAAE,CAAC;QAGxB,gBAAW,GAAW,EAAE,CAAC;QAGzB,oBAAe,GAAW,EAAE,CAAC;QAG7B,uBAAkB,GAAS,IAAI,IAAI,EAAE,CAAC;QAGtC,aAAQ,GAAY,IAAI,CAAC;QAGzB,gBAAW,GAAW,EAAE,CAAC;QAGzB,iBAAY,GAAW,EAAE,CAAC;QAG1B,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;QAG7B,cAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAC/B,CAAC;CAAA,CAAA;AAvCY,gEAA0B;AAErC;IADC,IAAA,gCAAsB,GAAE;;sDACV;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;kEACrB;AAG5B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;0DACT;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;4DACF;AAGtB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;8DACrB;AAGxB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;+DACrB;AAGzB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;mEACrB;AAG7B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BACxC,IAAI;sEAAc;AAGtC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;4DACpB;AAGzB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+DACtC;AAGzB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gEACtC;AAG1B;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;6DAAc;AAG7B;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;6DAAc;qCAtClB,0BAA0B;IADtC,IAAA,gBAAM,EAAC,+BAA+B,CAAC;GAC3B,0BAA0B,CAuCtC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare enum OutlookEventTypes {
|
|
2
|
+
AUTH_TOKENS_SAVE = "microsoft.auth.tokens.save",
|
|
3
|
+
AUTH_TOKENS_UPDATE = "microsoft.auth.tokens.update",
|
|
4
|
+
EVENT_DELETED = "outlook.event.deleted",
|
|
5
|
+
EVENT_CREATED = "outlook.event.created",
|
|
6
|
+
EVENT_UPDATED = "outlook.event.updated"
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutlookEventTypes = void 0;
|
|
4
|
+
var OutlookEventTypes;
|
|
5
|
+
(function (OutlookEventTypes) {
|
|
6
|
+
OutlookEventTypes["AUTH_TOKENS_SAVE"] = "microsoft.auth.tokens.save";
|
|
7
|
+
OutlookEventTypes["AUTH_TOKENS_UPDATE"] = "microsoft.auth.tokens.update";
|
|
8
|
+
OutlookEventTypes["EVENT_DELETED"] = "outlook.event.deleted";
|
|
9
|
+
OutlookEventTypes["EVENT_CREATED"] = "outlook.event.created";
|
|
10
|
+
OutlookEventTypes["EVENT_UPDATED"] = "outlook.event.updated";
|
|
11
|
+
})(OutlookEventTypes || (exports.OutlookEventTypes = OutlookEventTypes = {}));
|
|
12
|
+
//# sourceMappingURL=event-types.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-types.enum.js","sourceRoot":"","sources":["../src/event-types.enum.ts"],"names":[],"mappings":";;;AAGA,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,oEAA+C,CAAA;IAC/C,wEAAmD,CAAA;IACnD,4DAAuC,CAAA;IACvC,4DAAuC,CAAA;IACvC,4DAAuC,CAAA;AACzC,CAAC,EANW,iBAAiB,iCAAjB,iBAAiB,QAM5B"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './microsoft-outlook.module';
|
|
2
|
+
export * from './controllers/outlook.controller';
|
|
3
|
+
export * from './services/outlook.service';
|
|
4
|
+
export * from './services/microsoft-auth.service';
|
|
5
|
+
export * from './dto/outlook-webhook-notification.dto';
|
|
6
|
+
export * from './interfaces/outlook/token-response.interface';
|
|
7
|
+
export * from './interfaces/config/outlook-config.interface';
|
|
8
|
+
export * from './event-types.enum';
|
|
9
|
+
export * from './constants';
|
|
10
|
+
export * from './entities/outlook-webhook-subscription.entity';
|
|
11
|
+
export * from './repositories/outlook-webhook-subscription.repository';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./microsoft-outlook.module"), exports);
|
|
18
|
+
__exportStar(require("./controllers/outlook.controller"), exports);
|
|
19
|
+
__exportStar(require("./services/outlook.service"), exports);
|
|
20
|
+
__exportStar(require("./services/microsoft-auth.service"), exports);
|
|
21
|
+
__exportStar(require("./dto/outlook-webhook-notification.dto"), exports);
|
|
22
|
+
__exportStar(require("./interfaces/outlook/token-response.interface"), exports);
|
|
23
|
+
__exportStar(require("./interfaces/config/outlook-config.interface"), exports);
|
|
24
|
+
__exportStar(require("./event-types.enum"), exports);
|
|
25
|
+
__exportStar(require("./constants"), exports);
|
|
26
|
+
__exportStar(require("./entities/outlook-webhook-subscription.entity"), exports);
|
|
27
|
+
__exportStar(require("./repositories/outlook-webhook-subscription.repository"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,6DAA2C;AAG3C,mEAAiD;AAGjD,6DAA2C;AAC3C,oEAAkD;AAGlD,yEAAuD;AAGvD,gFAA8D;AAC9D,+EAA6D;AAG7D,qDAAmC;AAGnC,8CAA4B;AAG5B,iFAA+D;AAG/D,yFAAuE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlook-config.interface.js","sourceRoot":"","sources":["../../../src/interfaces/config/outlook-config.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microsoft-token-api-response.interface.js","sourceRoot":"","sources":["../../../src/interfaces/microsoft-auth/microsoft-token-api-response.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-object.interface.js","sourceRoot":"","sources":["../../../src/interfaces/microsoft-auth/state-object.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-response.interface.js","sourceRoot":"","sources":["../../../src/interfaces/outlook/token-response.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MicrosoftOutlookConfig } from './interfaces/config/outlook-config.interface';
|
|
2
|
+
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<MicrosoftOutlookConfig, "forRoot", "create", {}>, MODULE_OPTIONS_TOKEN: string | symbol;
|
|
3
|
+
export declare class MicrosoftOutlookModule extends ConfigurableModuleClass {
|
|
4
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var _a;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.MicrosoftOutlookModule = exports.MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
13
|
+
const schedule_1 = require("@nestjs/schedule");
|
|
14
|
+
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
15
|
+
const outlook_service_1 = require("./services/outlook.service");
|
|
16
|
+
const microsoft_auth_service_1 = require("./services/microsoft-auth.service");
|
|
17
|
+
const microsoft_auth_controller_1 = require("./controllers/microsoft-auth.controller");
|
|
18
|
+
const outlook_controller_1 = require("./controllers/outlook.controller");
|
|
19
|
+
const outlook_webhook_subscription_entity_1 = require("./entities/outlook-webhook-subscription.entity");
|
|
20
|
+
const outlook_webhook_subscription_repository_1 = require("./repositories/outlook-webhook-subscription.repository");
|
|
21
|
+
const constants_1 = require("./constants");
|
|
22
|
+
const csrf_token_entity_1 = require("./entities/csrf-token.entity");
|
|
23
|
+
const microsoft_csrf_token_repository_1 = require("./repositories/microsoft-csrf-token.repository");
|
|
24
|
+
_a = new common_1.ConfigurableModuleBuilder().setClassMethodName('forRoot').build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN;
|
|
25
|
+
let MicrosoftOutlookModule = class MicrosoftOutlookModule extends exports.ConfigurableModuleClass {
|
|
26
|
+
};
|
|
27
|
+
exports.MicrosoftOutlookModule = MicrosoftOutlookModule;
|
|
28
|
+
exports.MicrosoftOutlookModule = MicrosoftOutlookModule = __decorate([
|
|
29
|
+
(0, common_1.Module)({
|
|
30
|
+
imports: [
|
|
31
|
+
schedule_1.ScheduleModule.forRoot(),
|
|
32
|
+
typeorm_1.TypeOrmModule.forFeature([outlook_webhook_subscription_entity_1.OutlookWebhookSubscription, csrf_token_entity_1.MicrosoftCsrfToken]),
|
|
33
|
+
event_emitter_1.EventEmitterModule.forRoot(),
|
|
34
|
+
],
|
|
35
|
+
controllers: [microsoft_auth_controller_1.MicrosoftAuthController, outlook_controller_1.OutlookController],
|
|
36
|
+
providers: [
|
|
37
|
+
{
|
|
38
|
+
provide: constants_1.MICROSOFT_CONFIG,
|
|
39
|
+
useFactory: (options) => options,
|
|
40
|
+
inject: [exports.MODULE_OPTIONS_TOKEN],
|
|
41
|
+
},
|
|
42
|
+
outlook_webhook_subscription_repository_1.OutlookWebhookSubscriptionRepository,
|
|
43
|
+
microsoft_csrf_token_repository_1.MicrosoftCsrfTokenRepository,
|
|
44
|
+
outlook_service_1.OutlookService,
|
|
45
|
+
microsoft_auth_service_1.MicrosoftAuthService,
|
|
46
|
+
],
|
|
47
|
+
exports: [outlook_service_1.OutlookService, microsoft_auth_service_1.MicrosoftAuthService],
|
|
48
|
+
})
|
|
49
|
+
], MicrosoftOutlookModule);
|
|
50
|
+
//# sourceMappingURL=microsoft-outlook.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microsoft-outlook.module.js","sourceRoot":"","sources":["../src/microsoft-outlook.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAmE;AACnE,6CAAgD;AAChD,+CAAkD;AAClD,yDAA2D;AAC3D,gEAA4D;AAC5D,8EAAyE;AACzE,uFAAkF;AAClF,yEAAqE;AACrE,wGAA4F;AAC5F,oHAA8G;AAC9G,2CAA+C;AAE/C,oEAAkE;AAClE,oGAA8F;AAEjF,KACX,IAAI,kCAAyB,EAA0B,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EADhF,+BAAuB,+BAAE,4BAAoB,2BACoC;AA0BzF,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,+BAAuB;CAAG,CAAA;AAAzD,wDAAsB;iCAAtB,sBAAsB;IApBlC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,yBAAc,CAAC,OAAO,EAAE;YACxB,uBAAa,CAAC,UAAU,CAAC,CAAC,gEAA0B,EAAE,sCAAkB,CAAC,CAAC;YAC1E,kCAAkB,CAAC,OAAO,EAAE;SAC7B;QACD,WAAW,EAAE,CAAC,mDAAuB,EAAE,sCAAiB,CAAC;QACzD,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,4BAAgB;gBACzB,UAAU,EAAE,CAAC,OAA+B,EAAE,EAAE,CAAC,OAAO;gBACxD,MAAM,EAAE,CAAC,4BAAoB,CAAC;aAC/B;YACD,8EAAoC;YACpC,8DAA4B;YAC5B,gCAAc;YACd,6CAAoB;SACrB;QACD,OAAO,EAAE,CAAC,gCAAc,EAAE,6CAAoB,CAAC;KAChD,CAAC;GACW,sBAAsB,CAAmC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateOutlookTables1697025846000 = void 0;
|
|
4
|
+
class CreateOutlookTables1697025846000 {
|
|
5
|
+
async up(queryRunner) {
|
|
6
|
+
await queryRunner.query(`
|
|
7
|
+
CREATE TABLE outlook_webhook_subscriptions (
|
|
8
|
+
id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
|
9
|
+
subscription_id VARCHAR(255) NOT NULL,
|
|
10
|
+
user_id INTEGER NOT NULL,
|
|
11
|
+
resource VARCHAR(255) NOT NULL,
|
|
12
|
+
change_type VARCHAR(255) NOT NULL,
|
|
13
|
+
client_state VARCHAR(255) NOT NULL,
|
|
14
|
+
notification_url VARCHAR(255) NOT NULL,
|
|
15
|
+
expiration_date_time TIMESTAMP NOT NULL,
|
|
16
|
+
is_active BOOLEAN DEFAULT true,
|
|
17
|
+
access_token TEXT,
|
|
18
|
+
refresh_token TEXT,
|
|
19
|
+
created_at TIMESTAMP DEFAULT NOW() NOT NULL,
|
|
20
|
+
updated_at TIMESTAMP DEFAULT NOW() NOT NULL
|
|
21
|
+
);
|
|
22
|
+
`);
|
|
23
|
+
await queryRunner.query(`
|
|
24
|
+
CREATE TABLE microsoft_csrf_tokens (
|
|
25
|
+
id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
|
26
|
+
token VARCHAR(64) NOT NULL,
|
|
27
|
+
user_id VARCHAR(255) NOT NULL,
|
|
28
|
+
expires TIMESTAMP NOT NULL,
|
|
29
|
+
created_at TIMESTAMP DEFAULT NOW() NOT NULL,
|
|
30
|
+
CONSTRAINT "UQ_microsoft_csrf_tokens_token" UNIQUE (token)
|
|
31
|
+
);
|
|
32
|
+
`);
|
|
33
|
+
}
|
|
34
|
+
async down(queryRunner) {
|
|
35
|
+
await queryRunner.query(`DROP TABLE IF EXISTS outlook_webhook_subscriptions`);
|
|
36
|
+
await queryRunner.query(`DROP TABLE IF EXISTS microsoft_csrf_tokens`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.CreateOutlookTables1697025846000 = CreateOutlookTables1697025846000;
|
|
40
|
+
//# sourceMappingURL=1697025846000-CreateOutlookTables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1697025846000-CreateOutlookTables.js","sourceRoot":"","sources":["../../src/migrations/1697025846000-CreateOutlookTables.ts"],"names":[],"mappings":";;;AAEA,MAAa,gCAAgC;IACpC,KAAK,CAAC,EAAE,CAAC,WAAwB;QAEtC,MAAM,WAAW,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;KAgBvB,CAAC,CAAC;QAGH,MAAM,WAAW,CAAC,KAAK,CAAC;;;;;;;;;KASvB,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,WAAwB;QACxC,MAAM,WAAW,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;QAC9E,MAAM,WAAW,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IACxE,CAAC;CACF;AAtCD,4EAsCC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { MicrosoftCsrfToken } from '../entities/csrf-token.entity';
|
|
3
|
+
export declare class MicrosoftCsrfTokenRepository {
|
|
4
|
+
private readonly repository;
|
|
5
|
+
constructor(repository: Repository<MicrosoftCsrfToken>);
|
|
6
|
+
saveToken(token: string, userId: string | number, expiresInMs: number): Promise<MicrosoftCsrfToken>;
|
|
7
|
+
findAndValidateToken(token: string): Promise<MicrosoftCsrfToken | null>;
|
|
8
|
+
cleanupExpiredTokens(): Promise<void>;
|
|
9
|
+
}
|