itlab-internal-services 2.16.10 → 2.16.12

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.
@@ -9,4 +9,4 @@
9
9
  * @throws {UnprocessableEntityException} When the 'Authorization' header is missing.
10
10
  * @returns {string} The extracted JWT token without the 'Bearer ' prefix.
11
11
  */
12
- export declare function Jwt(): ParameterDecorator;
12
+ export declare const Jwt: (...dataOrPipes: any[]) => ParameterDecorator;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Jwt = Jwt;
3
+ exports.Jwt = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  /**
6
6
  * Custom decorator to extract the JWT token from the request headers.
@@ -13,15 +13,13 @@ const common_1 = require("@nestjs/common");
13
13
  * @throws {UnprocessableEntityException} When the 'Authorization' header is missing.
14
14
  * @returns {string} The extracted JWT token without the 'Bearer ' prefix.
15
15
  */
16
- function Jwt() {
17
- return (0, common_1.createParamDecorator)((_, executionContext) => {
18
- const request = executionContext.switchToHttp().getRequest();
19
- const authHeader = request.header('Authorization');
20
- if (!authHeader) {
21
- throw new common_1.UnprocessableEntityException('Authorization header is missing from the request');
22
- }
23
- // Extract token by removing the 'Bearer ' prefix (case-insensitive)
24
- const token = authHeader.replace(/^Bearer\s+/i, '');
25
- return token;
26
- });
27
- }
16
+ exports.Jwt = (0, common_1.createParamDecorator)((_, executionContext) => {
17
+ const request = executionContext.switchToHttp().getRequest();
18
+ const authHeader = request.header('Authorization');
19
+ if (!authHeader) {
20
+ throw new common_1.UnprocessableEntityException('Authorization header is missing from the request');
21
+ }
22
+ // Extract token by removing the 'Bearer ' prefix (case-insensitive)
23
+ const token = authHeader.replace(/^Bearer\s+/i, '');
24
+ return token;
25
+ });
@@ -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).then(() => {
62
- this.logger.log(`Comments cache for ${this.options.resource} ${resourceId} cleared.`);
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).then(() => {
95
- this.logger.log(`Content cache for ${this.options.resource} ${resourceId} cleared.`);
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);
@@ -2,7 +2,7 @@ import { MailRecipient } from '../models';
2
2
  /**
3
3
  * Payload for sending a login token email to a user.
4
4
  */
5
- export type AuthLoginTokenMailDtoV1 = {
5
+ export type AccountLoginTokenMailDtoV1 = {
6
6
  /**
7
7
  * Recipient information for the email.
8
8
  */
@@ -2,7 +2,7 @@ import { MailRecipient } from '../models';
2
2
  /**
3
3
  * Payload for sending a password reset email to a user.
4
4
  */
5
- export type AuthPasswordResetMailDtoV1 = {
5
+ export type AccountPasswordResetMailDtoV1 = {
6
6
  /**
7
7
  * Recipient information for the email.
8
8
  */
@@ -1,8 +1,8 @@
1
- import { AuthLoginTokenMailDtoV1, AuthPasswordResetMailDtoV1, EventCancelMailDtoV1, EventInviteMailDtoV1, IdeaStatusUpdateMailDtoV1, IdeaSubmittedMailDtoV1, LunchRouletteCancelMailDtoV1, LunchRouletteMatchedMailDtoV1, LunchRouletteSubmittedMailDtoV1, LunchRouletteUnmatchedMailDtoV1, NewsletterIssueMailDtoV1, NewsletterSubscribedMailDtoV1, NewsletterUnsubscribedMailDtoV1, NotificationMailDtoV1 } from './dtos';
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.auth.login-token", "v1.auth.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"];
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.auth.login-token': AuthLoginTokenMailDtoV1;
16
- 'v1.auth.password-reset': AuthPasswordResetMailDtoV1;
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.auth.login-token',
10
- 'v1.auth.password-reset',
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.auth.login-token': 'v1/auth/login-token',
26
- 'v1.auth.password-reset': 'v1/auth/password-reset',
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 { AuthLoginTokenMailDtoV1, AuthPasswordResetMailDtoV1, EventCancelMailDtoV1, EventInviteMailDtoV1, IdeaStatusUpdateMailDtoV1, IdeaSubmittedMailDtoV1, LunchRouletteCancelMailDtoV1, LunchRouletteMatchedMailDtoV1, LunchRouletteSubmittedMailDtoV1, LunchRouletteUnmatchedMailDtoV1, NewsletterIssueMailDtoV1, NewsletterSubscribedMailDtoV1, NewsletterUnsubscribedMailDtoV1, NotificationMailDtoV1 } from './dtos';
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 {AuthLoginTokenMailDtoV1} payload - DTO containing recipient and token.
30
+ * @param {AccountLoginTokenMailDtoV1} payload - DTO containing recipient and token.
31
31
  */
32
- sendAuthLoginTokenMailV1(payload: AuthLoginTokenMailDtoV1): void;
32
+ sendAccountLoginTokenMailV1(payload: AccountLoginTokenMailDtoV1): void;
33
33
  /**
34
34
  * Sends a password reset email with a secure link.
35
- * @param {AuthPasswordResetMailDtoV1} payload - DTO containing recipient and reset URL.
35
+ * @param {AccountPasswordResetMailDtoV1} payload - DTO containing recipient and reset URL.
36
36
  */
37
- sendAuthPasswordResetMailV1(payload: AuthPasswordResetMailDtoV1): void;
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
- // Authentication Emails
59
+ // Account Emails
60
60
  // ─────────────────────────────────────────────
61
61
  /**
62
62
  * Sends an email with a one-time login token.
63
- * @param {AuthLoginTokenMailDtoV1} payload - DTO containing recipient and token.
63
+ * @param {AccountLoginTokenMailDtoV1} payload - DTO containing recipient and token.
64
64
  */
65
- sendAuthLoginTokenMailV1(payload) {
66
- this.sendMail('v1.auth.login-token', payload);
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 {AuthPasswordResetMailDtoV1} payload - DTO containing recipient and reset URL.
70
+ * @param {AccountPasswordResetMailDtoV1} payload - DTO containing recipient and reset URL.
71
71
  */
72
- sendAuthPasswordResetMailV1(payload) {
73
- this.sendMail('v1.auth.password-reset', payload);
72
+ sendAccountPasswordResetMailV1(payload) {
73
+ this.sendMail('v1.account.password-reset', payload);
74
74
  }
75
75
  // ─────────────────────────────────────────────
76
76
  // Event Emails
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Timo Scheuermann",
5
5
  "email": "timo.scheuermann@sv-informatik.de"
6
6
  },
7
- "version": "2.16.10",
7
+ "version": "2.16.12",
8
8
  "type": "commonjs",
9
9
  "files": [
10
10
  "dist"