@fiado/type-kit 3.416.0 → 3.418.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.
|
@@ -47,3 +47,34 @@ describe('NotificationQueueMessageRequestV2.origin', () => {
|
|
|
47
47
|
expect(await errorsOn({ origin: 'CRON' }, 'origin')).not.toHaveLength(0);
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
+
|
|
51
|
+
describe('referenceMessageId — la llave de idempotencia de la cola', () => {
|
|
52
|
+
const validQueueMessage = {
|
|
53
|
+
templateId: 'COLLECTION_PRE_DUE_2_DAYS',
|
|
54
|
+
channelType: DeliveryChannelExtendedEnum.SMS,
|
|
55
|
+
language: 'es',
|
|
56
|
+
country: 'MX',
|
|
57
|
+
typeOfDirectoryId: 'USER',
|
|
58
|
+
directoryId: '01M0B5D7FQA3T06K4REEVPRM33',
|
|
59
|
+
destination: '+525512345678',
|
|
60
|
+
variables: { name: 'Ana' },
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// A diferencia de los DTOs HTTP, aca NO es @IsUUID: el productor manda su referencia de
|
|
64
|
+
// negocio, y messages-business la usa como llave junto con el tenant.
|
|
65
|
+
it('acepta una referencia que no es UUID', async () => {
|
|
66
|
+
const dto = plainToInstance(NotificationQueueMessageRequestV2,
|
|
67
|
+
{ ...validQueueMessage, referenceMessageId: 'collections-2026-09-09-MORNING-0001' });
|
|
68
|
+
expect(await validate(dto)).toEqual([]);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('sigue valido sin referencia: sin ella no hay deduplicacion, que es el comportamiento de siempre', async () => {
|
|
72
|
+
const dto = plainToInstance(NotificationQueueMessageRequestV2, validQueueMessage);
|
|
73
|
+
expect(await validate(dto)).toEqual([]);
|
|
74
|
+
expect(dto.referenceMessageId).toBeUndefined();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('ya no acepta messageLogId: era plomeria del lote retirado', () => {
|
|
78
|
+
expect(Object.keys(new NotificationQueueMessageRequestV2())).not.toContain('messageLogId');
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -11,6 +11,10 @@ export declare class NotificationQueueMessageRequestV2 {
|
|
|
11
11
|
directoryId: string;
|
|
12
12
|
destination: string;
|
|
13
13
|
variables: Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Referencia del productor. Cuando viaja, messages-business la usa como llave de
|
|
16
|
+
* idempotencia: el par (tenantId, referenceMessageId) se entrega UNA sola vez.
|
|
17
|
+
*/
|
|
14
18
|
referenceMessageId?: string;
|
|
15
19
|
data?: unknown;
|
|
16
20
|
/** Quien disparo la notificacion. Sin default: su ausencia ya significa EVENT. */
|
package/package.json
CHANGED
|
@@ -50,6 +50,10 @@ export class NotificationQueueMessageRequestV2 {
|
|
|
50
50
|
@Validate(IsStringValueRecord)
|
|
51
51
|
variables!: Record<string, string>;
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Referencia del productor. Cuando viaja, messages-business la usa como llave de
|
|
55
|
+
* idempotencia: el par (tenantId, referenceMessageId) se entrega UNA sola vez.
|
|
56
|
+
*/
|
|
53
57
|
@Expose()
|
|
54
58
|
@IsOptional()
|
|
55
59
|
@IsString()
|