itlab-internal-services 2.16.10 → 2.16.11
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/modules/comments/comments.service.js +6 -7
- package/dist/modules/services/providers/content/content.service.js +6 -7
- package/dist/modules/services/providers/mail/dtos/auth-login-token-mail.dto.v1.d.ts +1 -1
- package/dist/modules/services/providers/mail/dtos/auth-password-reset-mail.dto.v1.d.ts +1 -1
- package/dist/modules/services/providers/mail/mail-types.d.ts +4 -4
- package/dist/modules/services/providers/mail/mail-types.js +16 -16
- package/dist/modules/services/providers/mail/mail.service.d.ts +5 -5
- package/dist/modules/services/providers/mail/mail.service.js +7 -7
- package/package.json +1 -1
|
@@ -55,12 +55,11 @@ let CommentsService = class CommentsService extends base_http_service_1.BaseHttp
|
|
|
55
55
|
}
|
|
56
56
|
return this.connection.model(this.options.model.name, this.options.model.schema);
|
|
57
57
|
}
|
|
58
|
-
clearCache(resourceId) {
|
|
58
|
+
async clearCache(resourceId) {
|
|
59
59
|
if (this.cacheService) {
|
|
60
60
|
const cacheKey = this.cacheKey(resourceId);
|
|
61
|
-
this.cacheService.remove(cacheKey)
|
|
62
|
-
|
|
63
|
-
});
|
|
61
|
+
await this.cacheService.remove(cacheKey);
|
|
62
|
+
this.logger.log(`Comments cache for ${this.options.resource} ${resourceId} cleared.`);
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
/**
|
|
@@ -97,7 +96,7 @@ let CommentsService = class CommentsService extends base_http_service_1.BaseHttp
|
|
|
97
96
|
params: { ownerId, ownerIds },
|
|
98
97
|
});
|
|
99
98
|
this.logger.log(`Account ${accountId} successfully posted a comment on ${resourceType} resource ${resourceId}`);
|
|
100
|
-
this.clearCache(resourceId);
|
|
99
|
+
await this.clearCache(resourceId);
|
|
101
100
|
return data;
|
|
102
101
|
}
|
|
103
102
|
catch (error) {
|
|
@@ -117,9 +116,9 @@ let CommentsService = class CommentsService extends base_http_service_1.BaseHttp
|
|
|
117
116
|
this.logger.log(`Deleting all comments for ${this.options.resource} ${resourceId}...`);
|
|
118
117
|
this.httpClient
|
|
119
118
|
.delete(endpoint)
|
|
120
|
-
.then(() => {
|
|
119
|
+
.then(async () => {
|
|
121
120
|
this.logger.log(`All comments for ${this.options.resource} ${resourceId} deleted successfully.`);
|
|
122
|
-
this.clearCache(resourceId);
|
|
121
|
+
await this.clearCache(resourceId);
|
|
123
122
|
})
|
|
124
123
|
.catch((error) => {
|
|
125
124
|
const { message } = this.parseError(error);
|
|
@@ -85,15 +85,14 @@ let ContentService = ContentService_1 = class ContentService extends base_http_s
|
|
|
85
85
|
],
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
clearCache(resourceId) {
|
|
88
|
+
async clearCache(resourceId) {
|
|
89
89
|
if (this.cacheService) {
|
|
90
90
|
const promises = content_return_types_1.supportedContentReturnTypes.map((returnType) => {
|
|
91
91
|
const cacheKey = this.cacheKey(resourceId, returnType);
|
|
92
92
|
return this.cacheService.remove(cacheKey);
|
|
93
93
|
});
|
|
94
|
-
Promise.all(promises)
|
|
95
|
-
|
|
96
|
-
});
|
|
94
|
+
await Promise.all(promises);
|
|
95
|
+
this.logger.log(`Content cache for ${this.options.resource} ${resourceId} cleared.`);
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
// ─────────────────────────────────────────────────────────────
|
|
@@ -174,7 +173,7 @@ let ContentService = ContentService_1 = class ContentService extends base_http_s
|
|
|
174
173
|
try {
|
|
175
174
|
await this.httpClient.post(`v1/internal/content/${this.options.resource}/${resourceId}`, { content });
|
|
176
175
|
this.logger.log(`Content successfully submitted for ${this.options.resource} ${resourceId}.`);
|
|
177
|
-
this.clearCache(resourceId);
|
|
176
|
+
await this.clearCache(resourceId);
|
|
178
177
|
}
|
|
179
178
|
catch (error) {
|
|
180
179
|
const { status, data, message } = this.parseError(error);
|
|
@@ -208,9 +207,9 @@ let ContentService = ContentService_1 = class ContentService extends base_http_s
|
|
|
208
207
|
this.logger.log(`Removing content for ${this.options.resource} ${resourceId}...`);
|
|
209
208
|
this.httpClient
|
|
210
209
|
.delete(endpoint)
|
|
211
|
-
.then(() => {
|
|
210
|
+
.then(async () => {
|
|
212
211
|
this.logger.log(`Content removed successfully for ${this.options.resource} (${resourceId}).`);
|
|
213
|
-
this.clearCache(resourceId);
|
|
212
|
+
await this.clearCache(resourceId);
|
|
214
213
|
})
|
|
215
214
|
.catch((error) => {
|
|
216
215
|
const { message } = this.parseError(error);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AccountLoginTokenMailDtoV1, AccountPasswordResetMailDtoV1, EventCancelMailDtoV1, EventInviteMailDtoV1, IdeaStatusUpdateMailDtoV1, IdeaSubmittedMailDtoV1, LunchRouletteCancelMailDtoV1, LunchRouletteMatchedMailDtoV1, LunchRouletteSubmittedMailDtoV1, LunchRouletteUnmatchedMailDtoV1, NewsletterIssueMailDtoV1, NewsletterSubscribedMailDtoV1, NewsletterUnsubscribedMailDtoV1, NotificationMailDtoV1 } from './dtos';
|
|
2
2
|
/**
|
|
3
3
|
* Constant list of supported mail types.
|
|
4
4
|
*/
|
|
5
|
-
declare const supportedMailTypes: readonly ["v1.
|
|
5
|
+
declare const supportedMailTypes: readonly ["v1.account.login-token", "v1.account.password-reset", "v1.event.invite", "v1.event.cancel", "v1.idea.submitted", "v1.idea.status-update", "v1.lunch-roulette.submitted", "v1.lunch-roulette.cancel", "v1.lunch-roulette.matched", "v1.lunch-roulette.unmatched", "v1.newsletter.subscribed", "v1.newsletter.unsubscribed", "v1.newsletter.issue", "v1.notification.notification"];
|
|
6
6
|
/**
|
|
7
7
|
* Union type representing valid mail kinds.
|
|
8
8
|
*/
|
|
@@ -12,8 +12,8 @@ export type MailType = (typeof supportedMailTypes)[number];
|
|
|
12
12
|
* This enables type-safe payload handling when creating passes.
|
|
13
13
|
*/
|
|
14
14
|
export type MailTypeDtoMap = {
|
|
15
|
-
'v1.
|
|
16
|
-
'v1.
|
|
15
|
+
'v1.account.login-token': AccountLoginTokenMailDtoV1;
|
|
16
|
+
'v1.account.password-reset': AccountPasswordResetMailDtoV1;
|
|
17
17
|
'v1.event.invite': EventInviteMailDtoV1;
|
|
18
18
|
'v1.event.cancel': EventCancelMailDtoV1;
|
|
19
19
|
'v1.idea.submitted': IdeaSubmittedMailDtoV1;
|
|
@@ -6,8 +6,8 @@ exports.MailTypeEndpointMap = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
// eslint-disable-next-line
|
|
8
8
|
const supportedMailTypes = [
|
|
9
|
-
'v1.
|
|
10
|
-
'v1.
|
|
9
|
+
'v1.account.login-token',
|
|
10
|
+
'v1.account.password-reset',
|
|
11
11
|
'v1.event.invite',
|
|
12
12
|
'v1.event.cancel',
|
|
13
13
|
'v1.idea.submitted',
|
|
@@ -22,18 +22,18 @@ const supportedMailTypes = [
|
|
|
22
22
|
'v1.notification.notification',
|
|
23
23
|
];
|
|
24
24
|
exports.MailTypeEndpointMap = {
|
|
25
|
-
'v1.
|
|
26
|
-
'v1.
|
|
27
|
-
'v1.event.invite': 'v1/event/invite',
|
|
28
|
-
'v1.event.cancel': 'v1/event/cancel',
|
|
29
|
-
'v1.idea.submitted': 'v1/idea/submitted',
|
|
30
|
-
'v1.idea.status-update': 'v1/idea/status-update',
|
|
31
|
-
'v1.lunch-roulette.submitted': 'v1/lunch-roulette/submitted',
|
|
32
|
-
'v1.lunch-roulette.cancel': 'v1/lunch-roulette/cancel',
|
|
33
|
-
'v1.lunch-roulette.matched': 'v1/lunch-roulette/matched',
|
|
34
|
-
'v1.lunch-roulette.unmatched': 'v1/lunch-roulette/unmatched',
|
|
35
|
-
'v1.newsletter.subscribed': 'v1/newsletter/subscribed',
|
|
36
|
-
'v1.newsletter.unsubscribed': 'v1/newsletter/unsubscribed',
|
|
37
|
-
'v1.newsletter.issue': 'v1/newsletter/issue',
|
|
38
|
-
'v1.notification.notification': 'v1/notification/notification',
|
|
25
|
+
'v1.account.login-token': 'v1/internal/account/login-token',
|
|
26
|
+
'v1.account.password-reset': 'v1/internal/account/password-reset',
|
|
27
|
+
'v1.event.invite': 'v1/internal/event/invite',
|
|
28
|
+
'v1.event.cancel': 'v1/internal/event/cancel',
|
|
29
|
+
'v1.idea.submitted': 'v1/internal/idea/submitted',
|
|
30
|
+
'v1.idea.status-update': 'v1/internal/idea/status-update',
|
|
31
|
+
'v1.lunch-roulette.submitted': 'v1/internal/lunch-roulette/submitted',
|
|
32
|
+
'v1.lunch-roulette.cancel': 'v1/internal/lunch-roulette/cancel',
|
|
33
|
+
'v1.lunch-roulette.matched': 'v1/internal/lunch-roulette/matched',
|
|
34
|
+
'v1.lunch-roulette.unmatched': 'v1/internal/lunch-roulette/unmatched',
|
|
35
|
+
'v1.newsletter.subscribed': 'v1/internal/newsletter/subscribed',
|
|
36
|
+
'v1.newsletter.unsubscribed': 'v1/internal/newsletter/unsubscribed',
|
|
37
|
+
'v1.newsletter.issue': 'v1/internal/newsletter/issue',
|
|
38
|
+
'v1.notification.notification': 'v1/internal/notification/notification',
|
|
39
39
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConfigService } from '@nestjs/config';
|
|
2
2
|
import { AuthenticationModuleOptions } from '../../../authentication';
|
|
3
3
|
import { BaseHttpService } from '../../base-http.service';
|
|
4
|
-
import {
|
|
4
|
+
import { AccountLoginTokenMailDtoV1, AccountPasswordResetMailDtoV1, EventCancelMailDtoV1, EventInviteMailDtoV1, IdeaStatusUpdateMailDtoV1, IdeaSubmittedMailDtoV1, LunchRouletteCancelMailDtoV1, LunchRouletteMatchedMailDtoV1, LunchRouletteSubmittedMailDtoV1, LunchRouletteUnmatchedMailDtoV1, NewsletterIssueMailDtoV1, NewsletterSubscribedMailDtoV1, NewsletterUnsubscribedMailDtoV1, NotificationMailDtoV1 } from './dtos';
|
|
5
5
|
/**
|
|
6
6
|
* MailService
|
|
7
7
|
*
|
|
@@ -27,14 +27,14 @@ export declare class MailService extends BaseHttpService {
|
|
|
27
27
|
private sendMail;
|
|
28
28
|
/**
|
|
29
29
|
* Sends an email with a one-time login token.
|
|
30
|
-
* @param {
|
|
30
|
+
* @param {AccountLoginTokenMailDtoV1} payload - DTO containing recipient and token.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
sendAccountLoginTokenMailV1(payload: AccountLoginTokenMailDtoV1): void;
|
|
33
33
|
/**
|
|
34
34
|
* Sends a password reset email with a secure link.
|
|
35
|
-
* @param {
|
|
35
|
+
* @param {AccountPasswordResetMailDtoV1} payload - DTO containing recipient and reset URL.
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
sendAccountPasswordResetMailV1(payload: AccountPasswordResetMailDtoV1): void;
|
|
38
38
|
/**
|
|
39
39
|
* Sends an event invitation email.
|
|
40
40
|
* @param {EventInviteMailDtoV1} payload - DTO containing event details and recipient.
|
|
@@ -56,21 +56,21 @@ let MailService = class MailService extends base_http_service_1.BaseHttpService
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
// ─────────────────────────────────────────────
|
|
59
|
-
//
|
|
59
|
+
// Account Emails
|
|
60
60
|
// ─────────────────────────────────────────────
|
|
61
61
|
/**
|
|
62
62
|
* Sends an email with a one-time login token.
|
|
63
|
-
* @param {
|
|
63
|
+
* @param {AccountLoginTokenMailDtoV1} payload - DTO containing recipient and token.
|
|
64
64
|
*/
|
|
65
|
-
|
|
66
|
-
this.sendMail('v1.
|
|
65
|
+
sendAccountLoginTokenMailV1(payload) {
|
|
66
|
+
this.sendMail('v1.account.login-token', payload);
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Sends a password reset email with a secure link.
|
|
70
|
-
* @param {
|
|
70
|
+
* @param {AccountPasswordResetMailDtoV1} payload - DTO containing recipient and reset URL.
|
|
71
71
|
*/
|
|
72
|
-
|
|
73
|
-
this.sendMail('v1.
|
|
72
|
+
sendAccountPasswordResetMailV1(payload) {
|
|
73
|
+
this.sendMail('v1.account.password-reset', payload);
|
|
74
74
|
}
|
|
75
75
|
// ─────────────────────────────────────────────
|
|
76
76
|
// Event Emails
|