@fiado/type-kit 3.410.0 → 3.411.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.
Files changed (29) hide show
  1. package/_test_/unit/messagesConnector/NotificationQueueMessageRequestV2.test.ts +49 -0
  2. package/_test_/unit/messagesConnector/TemplateMessageUpdateRequest.test.ts +51 -0
  3. package/bin/messagesConnector/dtos/NotificationQueueMessageRequestV2.d.ts +5 -0
  4. package/bin/messagesConnector/dtos/NotificationQueueMessageRequestV2.js +13 -0
  5. package/bin/messagesConnector/dtos/TemplateMessageCreateRequest.d.ts +12 -5
  6. package/bin/messagesConnector/dtos/TemplateMessageCreateRequest.js +24 -4
  7. package/bin/messagesConnector/dtos/TemplateMessageListFiltersRequest.d.ts +4 -2
  8. package/bin/messagesConnector/dtos/TemplateMessageListFiltersRequest.js +8 -2
  9. package/bin/messagesConnector/dtos/TemplateMessageResponse.d.ts +9 -2
  10. package/bin/messagesConnector/dtos/TemplateMessageResponse.js +13 -0
  11. package/bin/messagesConnector/dtos/TemplateMessageUpdateRequest.d.ts +5 -1
  12. package/bin/messagesConnector/dtos/TemplateMessageUpdateRequest.js +14 -1
  13. package/bin/messagesConnector/enums/NotificationOriginEnum.d.ts +9 -0
  14. package/bin/messagesConnector/enums/NotificationOriginEnum.js +13 -0
  15. package/bin/messagesConnector/index.d.ts +1 -0
  16. package/bin/messagesConnector/index.js +1 -0
  17. package/bin/messaging/dtos/MessageDeliveryRequest.d.ts +5 -0
  18. package/bin/messaging/dtos/MessageDeliveryRequest.js +6 -0
  19. package/bin/twilioConnector/dtos/SelectedProvider.d.ts +1 -1
  20. package/package.json +1 -1
  21. package/src/messagesConnector/dtos/NotificationQueueMessageRequestV2.ts +13 -0
  22. package/src/messagesConnector/dtos/TemplateMessageCreateRequest.ts +27 -7
  23. package/src/messagesConnector/dtos/TemplateMessageListFiltersRequest.ts +9 -3
  24. package/src/messagesConnector/dtos/TemplateMessageResponse.ts +15 -2
  25. package/src/messagesConnector/dtos/TemplateMessageUpdateRequest.ts +15 -2
  26. package/src/messagesConnector/enums/NotificationOriginEnum.ts +9 -0
  27. package/src/messagesConnector/index.ts +1 -0
  28. package/src/messaging/dtos/MessageDeliveryRequest.ts +10 -1
  29. package/src/twilioConnector/dtos/SelectedProvider.ts +1 -1
@@ -0,0 +1,49 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { NotificationQueueMessageRequestV2 } from '../../../src/messagesConnector/dtos/NotificationQueueMessageRequestV2';
5
+ import { NotificationOriginEnum } from '../../../src/messagesConnector/enums/NotificationOriginEnum';
6
+ import { DeliveryChannelExtendedEnum } from '../../../src/messagesConnector/enums/DeliveryChannelExtendedEnum';
7
+
8
+ const base = {
9
+ templateId: 'OTP_CODE',
10
+ channelType: DeliveryChannelExtendedEnum.SMS,
11
+ language: 'es',
12
+ country: 'MX',
13
+ typeOfDirectoryId: 'PHONE',
14
+ directoryId: '4422194128',
15
+ destination: '4422194128',
16
+ variables: { code: '123456' },
17
+ };
18
+
19
+ const errorsOn = async (payload: Record<string, unknown>, property: string) => {
20
+ const dto = plainToInstance(NotificationQueueMessageRequestV2, { ...base, ...payload });
21
+ const errors = await validate(dto);
22
+ return errors.filter((e) => e.property === property);
23
+ };
24
+
25
+ /**
26
+ * Candado: `origin` NO lleva default en el DTO. Un default borraria la diferencia
27
+ * entre "no vino" y "vino EVENT", y platform-rbac-business, el unico productor real
28
+ * hoy, no manda el campo.
29
+ */
30
+ describe('NotificationQueueMessageRequestV2.origin', () => {
31
+ it('acepta los tres valores del enum', async () => {
32
+ expect(await errorsOn({ origin: NotificationOriginEnum.MANUAL }, 'origin')).toHaveLength(0);
33
+ expect(await errorsOn({ origin: NotificationOriginEnum.TEST }, 'origin')).toHaveLength(0);
34
+ expect(await errorsOn({ origin: NotificationOriginEnum.EVENT }, 'origin')).toHaveLength(0);
35
+ });
36
+
37
+ it('sigue siendo valido cuando el productor no lo manda', async () => {
38
+ expect(await errorsOn({}, 'origin')).toHaveLength(0);
39
+ });
40
+
41
+ it('no se rellena solo: ausente queda undefined, no EVENT', async () => {
42
+ const dto = plainToInstance(NotificationQueueMessageRequestV2, base);
43
+ expect(dto.origin).toBeUndefined();
44
+ });
45
+
46
+ it('rechaza un valor fuera del enum', async () => {
47
+ expect(await errorsOn({ origin: 'CRON' }, 'origin')).not.toHaveLength(0);
48
+ });
49
+ });
@@ -0,0 +1,51 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { TemplateMessageUpdateRequest } from '../../../src/messagesConnector/dtos/TemplateMessageUpdateRequest';
5
+
6
+ /**
7
+ * Candado: sin `providerTemplateId` ni `slotVariables` en el PUT, una plantilla de
8
+ * WhatsApp se puede crear pero no corregir, y arreglar un contentSid o un slot mal
9
+ * cargado obliga a DELETE + POST.
10
+ */
11
+ const errorsOn = async (payload: Record<string, unknown>, property: string) => {
12
+ const dto = plainToInstance(TemplateMessageUpdateRequest, payload);
13
+ const errors = await validate(dto);
14
+ return errors.filter((e) => e.property === property);
15
+ };
16
+
17
+ describe('TemplateMessageUpdateRequest.providerTemplateId', () => {
18
+ it('acepta un contentSid HX de Twilio', async () => {
19
+ expect(await errorsOn({ providerTemplateId: 'HX1234567890abcdef' }, 'providerTemplateId')).toHaveLength(0);
20
+ });
21
+
22
+ it('es opcional: el PUT que no toca WhatsApp no lo manda', async () => {
23
+ expect(await errorsOn({ template: 'Hola {{name}}' }, 'providerTemplateId')).toHaveLength(0);
24
+ });
25
+
26
+ it('rechaza un valor que no es string', async () => {
27
+ expect(await errorsOn({ providerTemplateId: 12345 }, 'providerTemplateId')).not.toHaveLength(0);
28
+ });
29
+ });
30
+
31
+ describe('TemplateMessageUpdateRequest.slotVariables', () => {
32
+ it('acepta el arreglo de nombres de variable por slot', async () => {
33
+ expect(await errorsOn({ slotVariables: ['code', 'expiresIn'] }, 'slotVariables')).toHaveLength(0);
34
+ });
35
+
36
+ it('acepta el arreglo vacio (plantilla sin slots)', async () => {
37
+ expect(await errorsOn({ slotVariables: [] }, 'slotVariables')).toHaveLength(0);
38
+ });
39
+
40
+ it('es opcional: el PUT que no toca WhatsApp no lo manda', async () => {
41
+ expect(await errorsOn({ template: 'Hola {{name}}' }, 'slotVariables')).toHaveLength(0);
42
+ });
43
+
44
+ it('rechaza un valor que no es arreglo', async () => {
45
+ expect(await errorsOn({ slotVariables: 'code' }, 'slotVariables')).not.toHaveLength(0);
46
+ });
47
+
48
+ it('rechaza los elementos que no son string', async () => {
49
+ expect(await errorsOn({ slotVariables: ['code', 7] }, 'slotVariables')).not.toHaveLength(0);
50
+ });
51
+ });
@@ -1,5 +1,8 @@
1
1
  import { DeliveryChannelExtendedEnum } from '../enums/DeliveryChannelExtendedEnum';
2
+ import { NotificationOriginEnum } from '../enums/NotificationOriginEnum';
2
3
  export declare class NotificationQueueMessageRequestV2 {
4
+ /** Tenant emisor del mensaje. Si se omite, messages-business asume FIADO. */
5
+ tenantId?: string;
3
6
  templateId: string;
4
7
  channelType: DeliveryChannelExtendedEnum;
5
8
  language: string;
@@ -10,4 +13,6 @@ export declare class NotificationQueueMessageRequestV2 {
10
13
  variables: Record<string, string>;
11
14
  referenceMessageId?: string;
12
15
  data?: unknown;
16
+ /** Quien disparo la notificacion. Sin default: su ausencia ya significa EVENT. */
17
+ origin?: NotificationOriginEnum;
13
18
  }
@@ -13,10 +13,17 @@ exports.NotificationQueueMessageRequestV2 = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const class_transformer_1 = require("class-transformer");
15
15
  const DeliveryChannelExtendedEnum_1 = require("../enums/DeliveryChannelExtendedEnum");
16
+ const NotificationOriginEnum_1 = require("../enums/NotificationOriginEnum");
16
17
  const IsStringValueRecord_1 = require("../validators/IsStringValueRecord");
17
18
  class NotificationQueueMessageRequestV2 {
18
19
  }
19
20
  exports.NotificationQueueMessageRequestV2 = NotificationQueueMessageRequestV2;
21
+ __decorate([
22
+ (0, class_transformer_1.Expose)(),
23
+ (0, class_validator_1.IsOptional)(),
24
+ (0, class_validator_1.IsString)(),
25
+ __metadata("design:type", String)
26
+ ], NotificationQueueMessageRequestV2.prototype, "tenantId", void 0);
20
27
  __decorate([
21
28
  (0, class_transformer_1.Expose)(),
22
29
  (0, class_validator_1.IsString)(),
@@ -75,3 +82,9 @@ __decorate([
75
82
  (0, class_validator_1.IsOptional)(),
76
83
  __metadata("design:type", Object)
77
84
  ], NotificationQueueMessageRequestV2.prototype, "data", void 0);
85
+ __decorate([
86
+ (0, class_transformer_1.Expose)(),
87
+ (0, class_validator_1.IsOptional)(),
88
+ (0, class_validator_1.IsEnum)(NotificationOriginEnum_1.NotificationOriginEnum),
89
+ __metadata("design:type", String)
90
+ ], NotificationQueueMessageRequestV2.prototype, "origin", void 0);
@@ -1,16 +1,23 @@
1
- import { ContentTypeEnum, DeliveryChannelEnum } from '../../messaging';
1
+ import { ContentTypeEnum } from '../../messaging';
2
+ import { DeliveryChannelExtendedEnum } from '../enums/DeliveryChannelExtendedEnum';
2
3
  /**
3
- * Body para POST /templates (backoffice). Identifica un template por sus 4
4
- * componentes de PK (messageType, channelType, language, country) + campos
5
- * de contenido. `typeOfDirectoryId` es campo no-key del Row (ver TD pendiente).
4
+ * Body para POST /templates (backoffice). Identifica un template por sus 5
5
+ * componentes de PK (tenantId, messageType, channelType, language, country) +
6
+ * campos de contenido. `typeOfDirectoryId` es campo no-key del Row (ver TD pendiente).
6
7
  */
7
8
  export declare class TemplateMessageCreateRequest {
9
+ /** Tenant al que pertenece la plantilla. Si se omite, se asume FIADO. */
10
+ tenantId?: string;
8
11
  messageType: string;
9
- channelType: DeliveryChannelEnum;
12
+ channelType: DeliveryChannelExtendedEnum;
10
13
  language: string;
11
14
  country: string;
12
15
  typeOfDirectoryId: string;
13
16
  template: string;
14
17
  contentType: ContentTypeEnum;
15
18
  subject?: string;
19
+ /** contentSid HX de Twilio. Solo en plantillas de WhatsApp. */
20
+ providerTemplateId?: string;
21
+ /** Que variable va en cada slot posicional de Twilio. Solo en plantillas de WhatsApp. */
22
+ slotVariables?: string[];
16
23
  }
@@ -13,15 +13,22 @@ exports.TemplateMessageCreateRequest = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
15
  const messaging_1 = require("../../messaging");
16
+ const DeliveryChannelExtendedEnum_1 = require("../enums/DeliveryChannelExtendedEnum");
16
17
  const IsTemplatePlaceholders_1 = require("../validators/IsTemplatePlaceholders");
17
18
  /**
18
- * Body para POST /templates (backoffice). Identifica un template por sus 4
19
- * componentes de PK (messageType, channelType, language, country) + campos
20
- * de contenido. `typeOfDirectoryId` es campo no-key del Row (ver TD pendiente).
19
+ * Body para POST /templates (backoffice). Identifica un template por sus 5
20
+ * componentes de PK (tenantId, messageType, channelType, language, country) +
21
+ * campos de contenido. `typeOfDirectoryId` es campo no-key del Row (ver TD pendiente).
21
22
  */
22
23
  class TemplateMessageCreateRequest {
23
24
  }
24
25
  exports.TemplateMessageCreateRequest = TemplateMessageCreateRequest;
26
+ __decorate([
27
+ (0, class_transformer_1.Expose)(),
28
+ (0, class_validator_1.IsOptional)(),
29
+ (0, class_validator_1.IsString)(),
30
+ __metadata("design:type", String)
31
+ ], TemplateMessageCreateRequest.prototype, "tenantId", void 0);
25
32
  __decorate([
26
33
  (0, class_transformer_1.Expose)(),
27
34
  (0, class_validator_1.IsString)(),
@@ -30,7 +37,7 @@ __decorate([
30
37
  ], TemplateMessageCreateRequest.prototype, "messageType", void 0);
31
38
  __decorate([
32
39
  (0, class_transformer_1.Expose)(),
33
- (0, class_validator_1.IsEnum)(messaging_1.DeliveryChannelEnum),
40
+ (0, class_validator_1.IsEnum)(DeliveryChannelExtendedEnum_1.DeliveryChannelExtendedEnum),
34
41
  __metadata("design:type", String)
35
42
  ], TemplateMessageCreateRequest.prototype, "channelType", void 0);
36
43
  __decorate([
@@ -70,3 +77,16 @@ __decorate([
70
77
  (0, class_validator_1.Validate)(IsTemplatePlaceholders_1.IsTemplatePlaceholders),
71
78
  __metadata("design:type", String)
72
79
  ], TemplateMessageCreateRequest.prototype, "subject", void 0);
80
+ __decorate([
81
+ (0, class_transformer_1.Expose)(),
82
+ (0, class_validator_1.IsOptional)(),
83
+ (0, class_validator_1.IsString)(),
84
+ __metadata("design:type", String)
85
+ ], TemplateMessageCreateRequest.prototype, "providerTemplateId", void 0);
86
+ __decorate([
87
+ (0, class_transformer_1.Expose)(),
88
+ (0, class_validator_1.IsOptional)(),
89
+ (0, class_validator_1.IsArray)(),
90
+ (0, class_validator_1.IsString)({ each: true }),
91
+ __metadata("design:type", Array)
92
+ ], TemplateMessageCreateRequest.prototype, "slotVariables", void 0);
@@ -1,11 +1,13 @@
1
- import { DeliveryChannelEnum } from '../../messaging';
1
+ import { DeliveryChannelExtendedEnum } from '../enums/DeliveryChannelExtendedEnum';
2
2
  /**
3
3
  * Query string de GET /templates. Todos los filtros son opcionales; si todos
4
4
  * estan vacios, lista todo (scan paginado). `limit` default 20, max 100.
5
5
  */
6
6
  export declare class TemplateMessageListFiltersRequest {
7
+ /** Filtra por tenant. Si se omite, no filtra por tenant. */
8
+ tenantId?: string;
7
9
  messageType?: string;
8
- channelType?: DeliveryChannelEnum;
10
+ channelType?: DeliveryChannelExtendedEnum;
9
11
  language?: string;
10
12
  country?: string;
11
13
  typeOfDirectoryId?: string;
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.TemplateMessageListFiltersRequest = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
- const messaging_1 = require("../../messaging");
15
+ const DeliveryChannelExtendedEnum_1 = require("../enums/DeliveryChannelExtendedEnum");
16
16
  /**
17
17
  * Query string de GET /templates. Todos los filtros son opcionales; si todos
18
18
  * estan vacios, lista todo (scan paginado). `limit` default 20, max 100.
@@ -20,6 +20,12 @@ const messaging_1 = require("../../messaging");
20
20
  class TemplateMessageListFiltersRequest {
21
21
  }
22
22
  exports.TemplateMessageListFiltersRequest = TemplateMessageListFiltersRequest;
23
+ __decorate([
24
+ (0, class_transformer_1.Expose)(),
25
+ (0, class_validator_1.IsOptional)(),
26
+ (0, class_validator_1.IsString)(),
27
+ __metadata("design:type", String)
28
+ ], TemplateMessageListFiltersRequest.prototype, "tenantId", void 0);
23
29
  __decorate([
24
30
  (0, class_transformer_1.Expose)(),
25
31
  (0, class_validator_1.IsOptional)(),
@@ -29,7 +35,7 @@ __decorate([
29
35
  __decorate([
30
36
  (0, class_transformer_1.Expose)(),
31
37
  (0, class_validator_1.IsOptional)(),
32
- (0, class_validator_1.IsEnum)(messaging_1.DeliveryChannelEnum),
38
+ (0, class_validator_1.IsEnum)(DeliveryChannelExtendedEnum_1.DeliveryChannelExtendedEnum),
33
39
  __metadata("design:type", String)
34
40
  ], TemplateMessageListFiltersRequest.prototype, "channelType", void 0);
35
41
  __decorate([
@@ -1,4 +1,5 @@
1
- import { ContentTypeEnum, DeliveryChannelEnum } from '../../messaging';
1
+ import { ContentTypeEnum } from '../../messaging';
2
+ import { DeliveryChannelExtendedEnum } from '../enums/DeliveryChannelExtendedEnum';
2
3
  /**
3
4
  * Forma del template retornada por GET /templates/{id}, POST, PUT.
4
5
  * El `id` es opaco (base64url de la PK compuesta) y el cliente lo trata como
@@ -8,14 +9,20 @@ import { ContentTypeEnum, DeliveryChannelEnum } from '../../messaging';
8
9
  export declare class TemplateMessageResponse {
9
10
  id: string;
10
11
  pk: string;
12
+ /** Tenant al que pertenece la plantilla. Ausente en las plantillas legacy de FIADO. */
13
+ tenantId?: string;
11
14
  messageType: string;
12
- channelType: DeliveryChannelEnum;
15
+ channelType: DeliveryChannelExtendedEnum;
13
16
  language: string;
14
17
  country: string;
15
18
  typeOfDirectoryId: string;
16
19
  template: string;
17
20
  contentType: ContentTypeEnum;
18
21
  subject?: string;
22
+ /** contentSid HX de Twilio. Solo en plantillas de WhatsApp. */
23
+ providerTemplateId?: string;
24
+ /** Que variable va en cada slot posicional de Twilio. Solo en plantillas de WhatsApp. */
25
+ slotVariables?: string[];
19
26
  createdAt: number;
20
27
  updatedAt: number;
21
28
  createdBy?: string;
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.TemplateMessageResponse = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const messaging_1 = require("../../messaging");
15
+ const DeliveryChannelExtendedEnum_1 = require("../enums/DeliveryChannelExtendedEnum");
15
16
  /**
16
17
  * Forma del template retornada por GET /templates/{id}, POST, PUT.
17
18
  * El `id` es opaco (base64url de la PK compuesta) y el cliente lo trata como
@@ -29,6 +30,10 @@ __decorate([
29
30
  (0, class_transformer_1.Expose)(),
30
31
  __metadata("design:type", String)
31
32
  ], TemplateMessageResponse.prototype, "pk", void 0);
33
+ __decorate([
34
+ (0, class_transformer_1.Expose)(),
35
+ __metadata("design:type", String)
36
+ ], TemplateMessageResponse.prototype, "tenantId", void 0);
32
37
  __decorate([
33
38
  (0, class_transformer_1.Expose)(),
34
39
  __metadata("design:type", String)
@@ -61,6 +66,14 @@ __decorate([
61
66
  (0, class_transformer_1.Expose)(),
62
67
  __metadata("design:type", String)
63
68
  ], TemplateMessageResponse.prototype, "subject", void 0);
69
+ __decorate([
70
+ (0, class_transformer_1.Expose)(),
71
+ __metadata("design:type", String)
72
+ ], TemplateMessageResponse.prototype, "providerTemplateId", void 0);
73
+ __decorate([
74
+ (0, class_transformer_1.Expose)(),
75
+ __metadata("design:type", Array)
76
+ ], TemplateMessageResponse.prototype, "slotVariables", void 0);
64
77
  __decorate([
65
78
  (0, class_transformer_1.Expose)(),
66
79
  __metadata("design:type", Number)
@@ -1,7 +1,7 @@
1
1
  import { ContentTypeEnum } from '../../messaging';
2
2
  /**
3
3
  * Body para PUT /templates/{id} (backoffice). Solo campos no-key son mutables.
4
- * Los componentes del PK (messageType, channelType, language, country) viven
4
+ * Los componentes del PK (tenantId, messageType, channelType, language, country) viven
5
5
  * en el `{id}` opaco del path y NO se aceptan en el body (PK structurally
6
6
  * immutable - ver spec seccion "Mutabilidad PK").
7
7
  *
@@ -13,4 +13,8 @@ export declare class TemplateMessageUpdateRequest {
13
13
  template?: string;
14
14
  contentType?: ContentTypeEnum;
15
15
  subject?: string;
16
+ /** contentSid HX de Twilio. Solo en plantillas de WhatsApp. */
17
+ providerTemplateId?: string;
18
+ /** Que variable va en cada slot posicional de Twilio. Solo en plantillas de WhatsApp. */
19
+ slotVariables?: string[];
16
20
  }
@@ -16,7 +16,7 @@ const messaging_1 = require("../../messaging");
16
16
  const IsTemplatePlaceholders_1 = require("../validators/IsTemplatePlaceholders");
17
17
  /**
18
18
  * Body para PUT /templates/{id} (backoffice). Solo campos no-key son mutables.
19
- * Los componentes del PK (messageType, channelType, language, country) viven
19
+ * Los componentes del PK (tenantId, messageType, channelType, language, country) viven
20
20
  * en el `{id}` opaco del path y NO se aceptan en el body (PK structurally
21
21
  * immutable - ver spec seccion "Mutabilidad PK").
22
22
  *
@@ -54,3 +54,16 @@ __decorate([
54
54
  (0, class_validator_1.Validate)(IsTemplatePlaceholders_1.IsTemplatePlaceholders),
55
55
  __metadata("design:type", String)
56
56
  ], TemplateMessageUpdateRequest.prototype, "subject", void 0);
57
+ __decorate([
58
+ (0, class_transformer_1.Expose)(),
59
+ (0, class_validator_1.IsOptional)(),
60
+ (0, class_validator_1.IsString)(),
61
+ __metadata("design:type", String)
62
+ ], TemplateMessageUpdateRequest.prototype, "providerTemplateId", void 0);
63
+ __decorate([
64
+ (0, class_transformer_1.Expose)(),
65
+ (0, class_validator_1.IsOptional)(),
66
+ (0, class_validator_1.IsArray)(),
67
+ (0, class_validator_1.IsString)({ each: true }),
68
+ __metadata("design:type", Array)
69
+ ], TemplateMessageUpdateRequest.prototype, "slotVariables", void 0);
@@ -0,0 +1,9 @@
1
+ /** Quien disparo la notificacion. Su ausencia significa EVENT. */
2
+ export declare enum NotificationOriginEnum {
3
+ /** Un admin lo disparo a mano desde el backoffice. */
4
+ MANUAL = "MANUAL",
5
+ /** Envio de prueba del editor de plantillas, a un solo destinatario. */
6
+ TEST = "TEST",
7
+ /** Lo publico un productor del ciclo de vida. */
8
+ EVENT = "EVENT"
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationOriginEnum = void 0;
4
+ /** Quien disparo la notificacion. Su ausencia significa EVENT. */
5
+ var NotificationOriginEnum;
6
+ (function (NotificationOriginEnum) {
7
+ /** Un admin lo disparo a mano desde el backoffice. */
8
+ NotificationOriginEnum["MANUAL"] = "MANUAL";
9
+ /** Envio de prueba del editor de plantillas, a un solo destinatario. */
10
+ NotificationOriginEnum["TEST"] = "TEST";
11
+ /** Lo publico un productor del ciclo de vida. */
12
+ NotificationOriginEnum["EVENT"] = "EVENT";
13
+ })(NotificationOriginEnum || (exports.NotificationOriginEnum = NotificationOriginEnum = {}));
@@ -1,4 +1,5 @@
1
1
  export * from './enums/DeliveryChannelExtendedEnum';
2
+ export * from './enums/NotificationOriginEnum';
2
3
  export * from './validators/IsStringValueRecord';
3
4
  export * from './dtos/NotificationQueueMessageRequestV2';
4
5
  export * from './dtos/SendMessageRequest';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./enums/DeliveryChannelExtendedEnum"), exports);
18
+ __exportStar(require("./enums/NotificationOriginEnum"), exports);
18
19
  __exportStar(require("./validators/IsStringValueRecord"), exports);
19
20
  __exportStar(require("./dtos/NotificationQueueMessageRequestV2"), exports);
20
21
  __exportStar(require("./dtos/SendMessageRequest"), exports);
@@ -6,4 +6,9 @@ export declare class MessageDeliveryRequest {
6
6
  subject: string;
7
7
  message: string;
8
8
  contentType: ContentTypeEnum;
9
+ /**
10
+ * Remitente ya resuelto: direccion From de SES para MAIL, sender ID de SNS para SMS.
11
+ * Si se omite, el connector usa su remitente por defecto.
12
+ */
13
+ sender?: string;
9
14
  }
@@ -45,3 +45,9 @@ __decorate([
45
45
  (0, class_validator_1.IsEnum)(ContentTypeEnum_1.ContentTypeEnum),
46
46
  __metadata("design:type", String)
47
47
  ], MessageDeliveryRequest.prototype, "contentType", void 0);
48
+ __decorate([
49
+ (0, class_transformer_1.Expose)(),
50
+ (0, class_validator_1.IsOptional)(),
51
+ (0, class_validator_1.IsString)(),
52
+ __metadata("design:type", String)
53
+ ], MessageDeliveryRequest.prototype, "sender", void 0);
@@ -13,7 +13,7 @@ export declare class SelectedProvider {
13
13
  contentVariables?: Record<string, string>;
14
14
  /**
15
15
  * Referencia (nombre/ARN) al secret de Secrets Manager con las credenciales
16
- * de la cuenta de Twilio de este `(tenant, channel)`. Ej: "twilio/FIADO/credentials".
16
+ * de la cuenta de Twilio de este `(tenant, channel)`. Ej: "twilio-<tenant>-credentials".
17
17
  * El connector resuelve el secret real con esta referencia justo antes de enviar.
18
18
  * Opcional: si se omite, el connector usa su secret por defecto (TWILIO_SECRET_NAME).
19
19
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.410.0",
3
+ "version": "3.411.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -1,9 +1,16 @@
1
1
  import { IsEnum, IsNotEmpty, IsObject, IsOptional, IsString, Validate } from 'class-validator';
2
2
  import { Expose } from 'class-transformer';
3
3
  import { DeliveryChannelExtendedEnum } from '../enums/DeliveryChannelExtendedEnum';
4
+ import { NotificationOriginEnum } from '../enums/NotificationOriginEnum';
4
5
  import { IsStringValueRecord } from '../validators/IsStringValueRecord';
5
6
 
6
7
  export class NotificationQueueMessageRequestV2 {
8
+ /** Tenant emisor del mensaje. Si se omite, messages-business asume FIADO. */
9
+ @Expose()
10
+ @IsOptional()
11
+ @IsString()
12
+ tenantId?: string;
13
+
7
14
  @Expose()
8
15
  @IsString()
9
16
  @IsNotEmpty()
@@ -51,4 +58,10 @@ export class NotificationQueueMessageRequestV2 {
51
58
  @Expose()
52
59
  @IsOptional()
53
60
  data?: unknown;
61
+
62
+ /** Quien disparo la notificacion. Sin default: su ausencia ya significa EVENT. */
63
+ @Expose()
64
+ @IsOptional()
65
+ @IsEnum(NotificationOriginEnum)
66
+ origin?: NotificationOriginEnum;
54
67
  }
@@ -1,22 +1,29 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { IsEnum, IsNotEmpty, IsOptional, IsString, Validate } from 'class-validator';
3
- import { ContentTypeEnum, DeliveryChannelEnum } from '../../messaging';
2
+ import { IsArray, IsEnum, IsNotEmpty, IsOptional, IsString, Validate } from 'class-validator';
3
+ import { ContentTypeEnum } from '../../messaging';
4
+ import { DeliveryChannelExtendedEnum } from '../enums/DeliveryChannelExtendedEnum';
4
5
  import { IsTemplatePlaceholders } from '../validators/IsTemplatePlaceholders';
5
6
 
6
7
  /**
7
- * Body para POST /templates (backoffice). Identifica un template por sus 4
8
- * componentes de PK (messageType, channelType, language, country) + campos
9
- * de contenido. `typeOfDirectoryId` es campo no-key del Row (ver TD pendiente).
8
+ * Body para POST /templates (backoffice). Identifica un template por sus 5
9
+ * componentes de PK (tenantId, messageType, channelType, language, country) +
10
+ * campos de contenido. `typeOfDirectoryId` es campo no-key del Row (ver TD pendiente).
10
11
  */
11
12
  export class TemplateMessageCreateRequest {
13
+ /** Tenant al que pertenece la plantilla. Si se omite, se asume FIADO. */
14
+ @Expose()
15
+ @IsOptional()
16
+ @IsString()
17
+ tenantId?: string;
18
+
12
19
  @Expose()
13
20
  @IsString()
14
21
  @IsNotEmpty()
15
22
  messageType!: string;
16
23
 
17
24
  @Expose()
18
- @IsEnum(DeliveryChannelEnum)
19
- channelType!: DeliveryChannelEnum;
25
+ @IsEnum(DeliveryChannelExtendedEnum)
26
+ channelType!: DeliveryChannelExtendedEnum;
20
27
 
21
28
  @Expose()
22
29
  @IsString()
@@ -48,4 +55,17 @@ export class TemplateMessageCreateRequest {
48
55
  @IsString()
49
56
  @Validate(IsTemplatePlaceholders)
50
57
  subject?: string;
58
+
59
+ /** contentSid HX de Twilio. Solo en plantillas de WhatsApp. */
60
+ @Expose()
61
+ @IsOptional()
62
+ @IsString()
63
+ providerTemplateId?: string;
64
+
65
+ /** Que variable va en cada slot posicional de Twilio. Solo en plantillas de WhatsApp. */
66
+ @Expose()
67
+ @IsOptional()
68
+ @IsArray()
69
+ @IsString({ each: true })
70
+ slotVariables?: string[];
51
71
  }
@@ -1,12 +1,18 @@
1
1
  import { Expose, Type } from 'class-transformer';
2
2
  import { IsEnum, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
3
- import { DeliveryChannelEnum } from '../../messaging';
3
+ import { DeliveryChannelExtendedEnum } from '../enums/DeliveryChannelExtendedEnum';
4
4
 
5
5
  /**
6
6
  * Query string de GET /templates. Todos los filtros son opcionales; si todos
7
7
  * estan vacios, lista todo (scan paginado). `limit` default 20, max 100.
8
8
  */
9
9
  export class TemplateMessageListFiltersRequest {
10
+ /** Filtra por tenant. Si se omite, no filtra por tenant. */
11
+ @Expose()
12
+ @IsOptional()
13
+ @IsString()
14
+ tenantId?: string;
15
+
10
16
  @Expose()
11
17
  @IsOptional()
12
18
  @IsString()
@@ -14,8 +20,8 @@ export class TemplateMessageListFiltersRequest {
14
20
 
15
21
  @Expose()
16
22
  @IsOptional()
17
- @IsEnum(DeliveryChannelEnum)
18
- channelType?: DeliveryChannelEnum;
23
+ @IsEnum(DeliveryChannelExtendedEnum)
24
+ channelType?: DeliveryChannelExtendedEnum;
19
25
 
20
26
  @Expose()
21
27
  @IsOptional()
@@ -1,5 +1,6 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { ContentTypeEnum, DeliveryChannelEnum } from '../../messaging';
2
+ import { ContentTypeEnum } from '../../messaging';
3
+ import { DeliveryChannelExtendedEnum } from '../enums/DeliveryChannelExtendedEnum';
3
4
 
4
5
  /**
5
6
  * Forma del template retornada por GET /templates/{id}, POST, PUT.
@@ -14,11 +15,15 @@ export class TemplateMessageResponse {
14
15
  @Expose()
15
16
  pk!: string;
16
17
 
18
+ /** Tenant al que pertenece la plantilla. Ausente en las plantillas legacy de FIADO. */
19
+ @Expose()
20
+ tenantId?: string;
21
+
17
22
  @Expose()
18
23
  messageType!: string;
19
24
 
20
25
  @Expose()
21
- channelType!: DeliveryChannelEnum;
26
+ channelType!: DeliveryChannelExtendedEnum;
22
27
 
23
28
  @Expose()
24
29
  language!: string;
@@ -38,6 +43,14 @@ export class TemplateMessageResponse {
38
43
  @Expose()
39
44
  subject?: string;
40
45
 
46
+ /** contentSid HX de Twilio. Solo en plantillas de WhatsApp. */
47
+ @Expose()
48
+ providerTemplateId?: string;
49
+
50
+ /** Que variable va en cada slot posicional de Twilio. Solo en plantillas de WhatsApp. */
51
+ @Expose()
52
+ slotVariables?: string[];
53
+
41
54
  @Expose()
42
55
  createdAt!: number;
43
56
 
@@ -1,11 +1,11 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { IsEnum, IsNotEmpty, IsOptional, IsString, Validate } from 'class-validator';
2
+ import { IsArray, IsEnum, IsNotEmpty, IsOptional, IsString, Validate } from 'class-validator';
3
3
  import { ContentTypeEnum } from '../../messaging';
4
4
  import { IsTemplatePlaceholders } from '../validators/IsTemplatePlaceholders';
5
5
 
6
6
  /**
7
7
  * Body para PUT /templates/{id} (backoffice). Solo campos no-key son mutables.
8
- * Los componentes del PK (messageType, channelType, language, country) viven
8
+ * Los componentes del PK (tenantId, messageType, channelType, language, country) viven
9
9
  * en el `{id}` opaco del path y NO se aceptan en el body (PK structurally
10
10
  * immutable - ver spec seccion "Mutabilidad PK").
11
11
  *
@@ -36,4 +36,17 @@ export class TemplateMessageUpdateRequest {
36
36
  @IsString()
37
37
  @Validate(IsTemplatePlaceholders)
38
38
  subject?: string;
39
+
40
+ /** contentSid HX de Twilio. Solo en plantillas de WhatsApp. */
41
+ @Expose()
42
+ @IsOptional()
43
+ @IsString()
44
+ providerTemplateId?: string;
45
+
46
+ /** Que variable va en cada slot posicional de Twilio. Solo en plantillas de WhatsApp. */
47
+ @Expose()
48
+ @IsOptional()
49
+ @IsArray()
50
+ @IsString({ each: true })
51
+ slotVariables?: string[];
39
52
  }
@@ -0,0 +1,9 @@
1
+ /** Quien disparo la notificacion. Su ausencia significa EVENT. */
2
+ export enum NotificationOriginEnum {
3
+ /** Un admin lo disparo a mano desde el backoffice. */
4
+ MANUAL = 'MANUAL',
5
+ /** Envio de prueba del editor de plantillas, a un solo destinatario. */
6
+ TEST = 'TEST',
7
+ /** Lo publico un productor del ciclo de vida. */
8
+ EVENT = 'EVENT',
9
+ }
@@ -1,4 +1,5 @@
1
1
  export * from './enums/DeliveryChannelExtendedEnum';
2
+ export * from './enums/NotificationOriginEnum';
2
3
  export * from './validators/IsStringValueRecord';
3
4
  export * from './dtos/NotificationQueueMessageRequestV2';
4
5
  export * from './dtos/SendMessageRequest';
@@ -1,5 +1,5 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { IsEnum, Validate, ValidateIf } from 'class-validator';
2
+ import { IsEnum, IsOptional, IsString, Validate, ValidateIf } from 'class-validator';
3
3
  import { DeliveryChannelEnum } from '../enums/DeliveryChannelEnum';
4
4
  import { ContentTypeEnum } from '../enums/ContentTypeEnum';
5
5
  import { IsDestinationByChannel } from '../validators/IsDestinationByChannel';
@@ -26,4 +26,13 @@ export class MessageDeliveryRequest {
26
26
  @Expose()
27
27
  @IsEnum(ContentTypeEnum)
28
28
  contentType: ContentTypeEnum;
29
+
30
+ /**
31
+ * Remitente ya resuelto: direccion From de SES para MAIL, sender ID de SNS para SMS.
32
+ * Si se omite, el connector usa su remitente por defecto.
33
+ */
34
+ @Expose()
35
+ @IsOptional()
36
+ @IsString()
37
+ sender?: string;
29
38
  }
@@ -19,7 +19,7 @@ export class SelectedProvider {
19
19
 
20
20
  /**
21
21
  * Referencia (nombre/ARN) al secret de Secrets Manager con las credenciales
22
- * de la cuenta de Twilio de este `(tenant, channel)`. Ej: "twilio/FIADO/credentials".
22
+ * de la cuenta de Twilio de este `(tenant, channel)`. Ej: "twilio-<tenant>-credentials".
23
23
  * El connector resuelve el secret real con esta referencia justo antes de enviar.
24
24
  * Opcional: si se omite, el connector usa su secret por defecto (TWILIO_SECRET_NAME).
25
25
  */