@fiado/type-kit 3.48.0 → 3.50.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/_test_/unit/cognitoBackofficeConnector/dtos/Introspect.test.ts +30 -30
- package/_test_/unit/platformRbac/auth/dtos.test.ts +42 -42
- package/_test_/unit/platformRbac/dtos/AuthorizeRequest.test.ts +30 -30
- package/_test_/unit/platformRbac/dtos/AuthorizeResponse.test.ts +25 -25
- package/bin/platformRbac/mfa/VerifyTotpEnrollmentRequest.d.ts +6 -0
- package/bin/platformRbac/mfa/VerifyTotpEnrollmentRequest.js +4 -0
- package/bin/provider/enums/Provider.d.ts +2 -1
- package/bin/provider/enums/Provider.js +1 -0
- package/bin/remittance/dtos/RemittancePayRequest.d.ts +20 -0
- package/bin/remittance/dtos/RemittancePayRequest.js +43 -0
- package/bin/remittance/dtos/RemittancePayResponse.d.ts +23 -0
- package/bin/remittance/dtos/RemittancePayResponse.js +14 -0
- package/bin/remittance/dtos/index.d.ts +2 -0
- package/bin/remittance/dtos/index.js +2 -0
- package/package.json +1 -1
- package/src/cognitoBackofficeConnector/dtos/InitiateAuthRequest.ts +12 -12
- package/src/cognitoBackofficeConnector/dtos/IntrospectRequest.ts +10 -10
- package/src/cognitoBackofficeConnector/dtos/IntrospectResponse.ts +10 -10
- package/src/cognitoBackofficeConnector/dtos/VerifyPasswordRequest.ts +15 -15
- package/src/cognitoBackofficeConnector/dtos/VerifyPasswordResponse.ts +6 -6
- package/src/cognitoBackofficeConnector/enums/CognitoChallengeType.ts +24 -24
- package/src/cognitoBackofficeConnector/enums/IntrospectFailReason.ts +11 -11
- package/src/mdm/README.md +78 -78
- package/src/mdm/dtos/DeviceArchiveRequest.ts +14 -14
- package/src/mdm/dtos/DeviceArchiveResponse.ts +10 -10
- package/src/mdm/dtos/DeviceAutoLockScheduleRequest.ts +18 -18
- package/src/mdm/dtos/DeviceAutoLockScheduleResponse.ts +10 -10
- package/src/mdm/dtos/DeviceEnrollInitiateResponse.ts +9 -9
- package/src/mdm/dtos/DeviceEnrollRequest.ts +38 -38
- package/src/mdm/dtos/DeviceEnrollStatusRequest.ts +14 -14
- package/src/mdm/dtos/DeviceEnrollStatusResponse.ts +15 -15
- package/src/mdm/dtos/DeviceEnrollmentCompletedEvent.ts +8 -8
- package/src/mdm/dtos/DeviceLastSeenRequest.ts +9 -9
- package/src/mdm/dtos/DeviceLastSeenResponse.ts +9 -9
- package/src/mdm/dtos/DeviceLockRequest.ts +46 -46
- package/src/mdm/dtos/DeviceLockResponse.ts +12 -12
- package/src/mdm/dtos/DeviceLockScreenMessage.ts +14 -14
- package/src/mdm/dtos/DeviceLogEntry.ts +5 -5
- package/src/mdm/dtos/DeviceLogRequest.ts +19 -19
- package/src/mdm/dtos/DeviceLogResponse.ts +10 -10
- package/src/mdm/dtos/DeviceNotifyRequest.ts +47 -47
- package/src/mdm/dtos/DeviceNotifyResponse.ts +10 -10
- package/src/mdm/dtos/DevicePinUnlockRequest.ts +19 -19
- package/src/mdm/dtos/DevicePinUnlockResponse.ts +12 -12
- package/src/mdm/dtos/DeviceReleaseCompletedEvent.ts +6 -6
- package/src/mdm/dtos/DeviceReleaseInitiateResponse.ts +10 -10
- package/src/mdm/dtos/DeviceReleaseRequest.ts +24 -24
- package/src/mdm/dtos/DeviceReleaseStatusRequest.ts +14 -14
- package/src/mdm/dtos/DeviceReleaseStatusResponse.ts +10 -10
- package/src/mdm/dtos/DeviceRestrictAppsRequest.ts +19 -19
- package/src/mdm/dtos/DeviceRestrictAppsResponse.ts +10 -10
- package/src/mdm/dtos/DeviceServiceDeactivateInitiateResponse.ts +9 -9
- package/src/mdm/dtos/DeviceServiceDeactivateRequest.ts +19 -19
- package/src/mdm/dtos/DeviceServiceDeactivateStatusRequest.ts +14 -14
- package/src/mdm/dtos/DeviceServiceDeactivateStatusResponse.ts +10 -10
- package/src/mdm/dtos/DeviceStatusRequest.ts +9 -9
- package/src/mdm/dtos/DeviceStatusResponse.ts +16 -16
- package/src/mdm/dtos/DeviceUnlockRequest.ts +14 -14
- package/src/mdm/dtos/DeviceUnlockResponse.ts +10 -10
- package/src/mdm/dtos/MdmError.ts +7 -7
- package/src/mdm/enums/DeviceEnrollmentModeEnum.ts +4 -4
- package/src/mdm/enums/DeviceLockModeEnum.ts +4 -4
- package/src/mdm/enums/DeviceNotifyIntensityEnum.ts +4 -4
- package/src/mdm/enums/DeviceReleaseReasonEnum.ts +5 -5
- package/src/mdm/enums/DeviceServiceDeactivateReasonEnum.ts +5 -5
- package/src/mdm/enums/MdmDeviceStatusEnum.ts +10 -10
- package/src/mdm/enums/MdmErrorCodeEnum.ts +17 -17
- package/src/mdm/enums/MdmOperationStatusEnum.ts +5 -5
- package/src/mdm/enums/MdmOperationTypeEnum.ts +15 -15
- package/src/mdm/enums/MdmProviderEnum.ts +4 -4
- package/src/mdm/index.ts +60 -60
- package/src/messagesConnector/dtos/MessagesByDestinationResponse.ts +5 -5
- package/src/messagesConnector/dtos/NotificationQueueMessageRequestV2.ts +54 -54
- package/src/messagesConnector/dtos/NotificationResponse.ts +19 -19
- package/src/messagesConnector/dtos/NotificationsCursorResponse.ts +6 -6
- package/src/messagesConnector/dtos/NotificationsPageResponse.ts +10 -10
- package/src/messagesConnector/dtos/NotificationsV3Response.ts +5 -5
- package/src/messagesConnector/dtos/OtpValidatedResponse.ts +9 -9
- package/src/messagesConnector/dtos/SendMessageResponse.ts +10 -10
- package/src/messagesConnector/dtos/TemplateMessageCreateRequest.ts +51 -51
- package/src/messagesConnector/dtos/TemplateMessageListFiltersRequest.ts +47 -47
- package/src/messagesConnector/dtos/TemplateMessageListResponse.ts +16 -16
- package/src/messagesConnector/dtos/TemplateMessageResponse.ts +52 -52
- package/src/messagesConnector/dtos/TemplateMessageUpdateRequest.ts +39 -39
- package/src/messagesConnector/dtos/VerifyOtpResponse.ts +5 -5
- package/src/messagesConnector/enums/DeliveryChannelExtendedEnum.ts +5 -5
- package/src/messagesConnector/validators/IsStringValueRecord.ts +12 -12
- package/src/messagesConnector/validators/IsTemplatePlaceholders.ts +45 -45
- package/src/messaging/dtos/MessageDeliveryRequest.ts +29 -29
- package/src/messaging/dtos/MessageDeliveryResponse.ts +6 -6
- package/src/messaging/enums/ContentTypeEnum.ts +4 -4
- package/src/messaging/enums/DeliveryChannelEnum.ts +4 -4
- package/src/messaging/index.ts +6 -6
- package/src/messaging/validators/IsDestinationByChannel.ts +61 -61
- package/src/messaging/validators/IsNotBlank.ts +31 -31
- package/src/platformRbac/auth/DefineNextChallengeRequest.ts +25 -25
- package/src/platformRbac/auth/DefineNextChallengeResponse.ts +14 -14
- package/src/platformRbac/auth/NewPasswordRequest.ts +10 -10
- package/src/platformRbac/auth/PrepareChallengeRequest.ts +13 -13
- package/src/platformRbac/auth/PrepareChallengeResponse.ts +9 -9
- package/src/platformRbac/auth/ResetPasswordRequest.ts +14 -14
- package/src/platformRbac/auth/VerifyChallengeRequest.ts +16 -16
- package/src/platformRbac/auth/VerifyChallengeResponse.ts +6 -6
- package/src/platformRbac/dtos/AuthorizeRequest.ts +14 -14
- package/src/platformRbac/dtos/AuthorizeResponse.ts +16 -16
- package/src/platformRbac/enums/AuthorizeDenyReason.ts +10 -10
- package/src/platformRbac/enums/ChallengeNameEnum.ts +7 -7
- package/src/platformRbac/enums/MfaMethodEnum.ts +4 -4
- package/src/platformRbac/mfa/ChangeMfaMethodRequest.ts +10 -10
- package/src/platformRbac/mfa/EnrollTotpResponse.ts +12 -12
- package/src/platformRbac/mfa/MfaStatusResponse.ts +14 -14
- package/src/platformRbac/mfa/VerifyTotpEnrollmentRequest.ts +15 -7
- package/src/provider/enums/Provider.ts +2 -1
- package/src/remittance/dtos/RemittancePayRequest.ts +30 -0
- package/src/remittance/dtos/RemittancePayResponse.ts +24 -0
- package/src/remittance/dtos/index.ts +2 -0
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { Expose, Type } from 'class-transformer';
|
|
2
|
-
import { IsEnum, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
|
|
3
|
-
import { DeliveryChannelEnum } from '../../messaging';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Query string de GET /templates. Todos los filtros son opcionales; si todos
|
|
7
|
-
* estan vacios, lista todo (scan paginado). `limit` default 20, max 100.
|
|
8
|
-
*/
|
|
9
|
-
export class TemplateMessageListFiltersRequest {
|
|
10
|
-
@Expose()
|
|
11
|
-
@IsOptional()
|
|
12
|
-
@IsString()
|
|
13
|
-
messageType?: string;
|
|
14
|
-
|
|
15
|
-
@Expose()
|
|
16
|
-
@IsOptional()
|
|
17
|
-
@IsEnum(DeliveryChannelEnum)
|
|
18
|
-
channelType?: DeliveryChannelEnum;
|
|
19
|
-
|
|
20
|
-
@Expose()
|
|
21
|
-
@IsOptional()
|
|
22
|
-
@IsString()
|
|
23
|
-
language?: string;
|
|
24
|
-
|
|
25
|
-
@Expose()
|
|
26
|
-
@IsOptional()
|
|
27
|
-
@IsString()
|
|
28
|
-
country?: string;
|
|
29
|
-
|
|
30
|
-
@Expose()
|
|
31
|
-
@IsOptional()
|
|
32
|
-
@IsString()
|
|
33
|
-
typeOfDirectoryId?: string;
|
|
34
|
-
|
|
35
|
-
@Expose()
|
|
36
|
-
@IsOptional()
|
|
37
|
-
@Type(() => Number)
|
|
38
|
-
@IsInt()
|
|
39
|
-
@Min(1)
|
|
40
|
-
@Max(100)
|
|
41
|
-
limit?: number;
|
|
42
|
-
|
|
43
|
-
@Expose()
|
|
44
|
-
@IsOptional()
|
|
45
|
-
@IsString()
|
|
46
|
-
cursor?: string;
|
|
47
|
-
}
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import { IsEnum, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
|
|
3
|
+
import { DeliveryChannelEnum } from '../../messaging';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Query string de GET /templates. Todos los filtros son opcionales; si todos
|
|
7
|
+
* estan vacios, lista todo (scan paginado). `limit` default 20, max 100.
|
|
8
|
+
*/
|
|
9
|
+
export class TemplateMessageListFiltersRequest {
|
|
10
|
+
@Expose()
|
|
11
|
+
@IsOptional()
|
|
12
|
+
@IsString()
|
|
13
|
+
messageType?: string;
|
|
14
|
+
|
|
15
|
+
@Expose()
|
|
16
|
+
@IsOptional()
|
|
17
|
+
@IsEnum(DeliveryChannelEnum)
|
|
18
|
+
channelType?: DeliveryChannelEnum;
|
|
19
|
+
|
|
20
|
+
@Expose()
|
|
21
|
+
@IsOptional()
|
|
22
|
+
@IsString()
|
|
23
|
+
language?: string;
|
|
24
|
+
|
|
25
|
+
@Expose()
|
|
26
|
+
@IsOptional()
|
|
27
|
+
@IsString()
|
|
28
|
+
country?: string;
|
|
29
|
+
|
|
30
|
+
@Expose()
|
|
31
|
+
@IsOptional()
|
|
32
|
+
@IsString()
|
|
33
|
+
typeOfDirectoryId?: string;
|
|
34
|
+
|
|
35
|
+
@Expose()
|
|
36
|
+
@IsOptional()
|
|
37
|
+
@Type(() => Number)
|
|
38
|
+
@IsInt()
|
|
39
|
+
@Min(1)
|
|
40
|
+
@Max(100)
|
|
41
|
+
limit?: number;
|
|
42
|
+
|
|
43
|
+
@Expose()
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsString()
|
|
46
|
+
cursor?: string;
|
|
47
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Expose, Type } from 'class-transformer';
|
|
2
|
-
import { TemplateMessageResponse } from './TemplateMessageResponse';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Forma del response de GET /templates (list con filtros + paginacion cursor).
|
|
6
|
-
* `cursor` es opaco (base64 del LastEvaluatedKey de DDB) y el cliente lo pasa
|
|
7
|
-
* tal cual al siguiente GET. Si no hay mas paginas, se omite.
|
|
8
|
-
*/
|
|
9
|
-
export class TemplateMessageListResponse {
|
|
10
|
-
@Expose()
|
|
11
|
-
@Type(() => TemplateMessageResponse)
|
|
12
|
-
items!: TemplateMessageResponse[];
|
|
13
|
-
|
|
14
|
-
@Expose()
|
|
15
|
-
cursor?: string;
|
|
16
|
-
}
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import { TemplateMessageResponse } from './TemplateMessageResponse';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Forma del response de GET /templates (list con filtros + paginacion cursor).
|
|
6
|
+
* `cursor` es opaco (base64 del LastEvaluatedKey de DDB) y el cliente lo pasa
|
|
7
|
+
* tal cual al siguiente GET. Si no hay mas paginas, se omite.
|
|
8
|
+
*/
|
|
9
|
+
export class TemplateMessageListResponse {
|
|
10
|
+
@Expose()
|
|
11
|
+
@Type(() => TemplateMessageResponse)
|
|
12
|
+
items!: TemplateMessageResponse[];
|
|
13
|
+
|
|
14
|
+
@Expose()
|
|
15
|
+
cursor?: string;
|
|
16
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { Expose } from 'class-transformer';
|
|
2
|
-
import { ContentTypeEnum, DeliveryChannelEnum } from '../../messaging';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Forma del template retornada por GET /templates/{id}, POST, PUT.
|
|
6
|
-
* El `id` es opaco (base64url de la PK compuesta) y el cliente lo trata como
|
|
7
|
-
* string sin parsear. El `pk` se incluye para auditoria/debug pero NO se usa
|
|
8
|
-
* como identificador del recurso en otras llamadas.
|
|
9
|
-
*/
|
|
10
|
-
export class TemplateMessageResponse {
|
|
11
|
-
@Expose()
|
|
12
|
-
id!: string;
|
|
13
|
-
|
|
14
|
-
@Expose()
|
|
15
|
-
pk!: string;
|
|
16
|
-
|
|
17
|
-
@Expose()
|
|
18
|
-
messageType!: string;
|
|
19
|
-
|
|
20
|
-
@Expose()
|
|
21
|
-
channelType!: DeliveryChannelEnum;
|
|
22
|
-
|
|
23
|
-
@Expose()
|
|
24
|
-
language!: string;
|
|
25
|
-
|
|
26
|
-
@Expose()
|
|
27
|
-
country!: string;
|
|
28
|
-
|
|
29
|
-
@Expose()
|
|
30
|
-
typeOfDirectoryId!: string;
|
|
31
|
-
|
|
32
|
-
@Expose()
|
|
33
|
-
template!: string;
|
|
34
|
-
|
|
35
|
-
@Expose()
|
|
36
|
-
contentType!: ContentTypeEnum;
|
|
37
|
-
|
|
38
|
-
@Expose()
|
|
39
|
-
subject?: string;
|
|
40
|
-
|
|
41
|
-
@Expose()
|
|
42
|
-
createdAt!: number;
|
|
43
|
-
|
|
44
|
-
@Expose()
|
|
45
|
-
updatedAt!: number;
|
|
46
|
-
|
|
47
|
-
@Expose()
|
|
48
|
-
createdBy?: string;
|
|
49
|
-
|
|
50
|
-
@Expose()
|
|
51
|
-
updatedBy?: string;
|
|
52
|
-
}
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { ContentTypeEnum, DeliveryChannelEnum } from '../../messaging';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Forma del template retornada por GET /templates/{id}, POST, PUT.
|
|
6
|
+
* El `id` es opaco (base64url de la PK compuesta) y el cliente lo trata como
|
|
7
|
+
* string sin parsear. El `pk` se incluye para auditoria/debug pero NO se usa
|
|
8
|
+
* como identificador del recurso en otras llamadas.
|
|
9
|
+
*/
|
|
10
|
+
export class TemplateMessageResponse {
|
|
11
|
+
@Expose()
|
|
12
|
+
id!: string;
|
|
13
|
+
|
|
14
|
+
@Expose()
|
|
15
|
+
pk!: string;
|
|
16
|
+
|
|
17
|
+
@Expose()
|
|
18
|
+
messageType!: string;
|
|
19
|
+
|
|
20
|
+
@Expose()
|
|
21
|
+
channelType!: DeliveryChannelEnum;
|
|
22
|
+
|
|
23
|
+
@Expose()
|
|
24
|
+
language!: string;
|
|
25
|
+
|
|
26
|
+
@Expose()
|
|
27
|
+
country!: string;
|
|
28
|
+
|
|
29
|
+
@Expose()
|
|
30
|
+
typeOfDirectoryId!: string;
|
|
31
|
+
|
|
32
|
+
@Expose()
|
|
33
|
+
template!: string;
|
|
34
|
+
|
|
35
|
+
@Expose()
|
|
36
|
+
contentType!: ContentTypeEnum;
|
|
37
|
+
|
|
38
|
+
@Expose()
|
|
39
|
+
subject?: string;
|
|
40
|
+
|
|
41
|
+
@Expose()
|
|
42
|
+
createdAt!: number;
|
|
43
|
+
|
|
44
|
+
@Expose()
|
|
45
|
+
updatedAt!: number;
|
|
46
|
+
|
|
47
|
+
@Expose()
|
|
48
|
+
createdBy?: string;
|
|
49
|
+
|
|
50
|
+
@Expose()
|
|
51
|
+
updatedBy?: string;
|
|
52
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { Expose } from 'class-transformer';
|
|
2
|
-
import { IsEnum, IsNotEmpty, IsOptional, IsString, Validate } from 'class-validator';
|
|
3
|
-
import { ContentTypeEnum } from '../../messaging';
|
|
4
|
-
import { IsTemplatePlaceholders } from '../validators/IsTemplatePlaceholders';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Body para PUT /templates/{id} (backoffice). Solo campos no-key son mutables.
|
|
8
|
-
* Los componentes del PK (messageType, channelType, language, country) viven
|
|
9
|
-
* en el `{id}` opaco del path y NO se aceptan en el body (PK structurally
|
|
10
|
-
* immutable - ver spec seccion "Mutabilidad PK").
|
|
11
|
-
*
|
|
12
|
-
* La validacion cross-field (subject required ⇔ MAIL, HTML solo en MAIL) se
|
|
13
|
-
* hace en el manager con el channelType decodificado del path, no aca.
|
|
14
|
-
*/
|
|
15
|
-
export class TemplateMessageUpdateRequest {
|
|
16
|
-
@Expose()
|
|
17
|
-
@IsOptional()
|
|
18
|
-
@IsString()
|
|
19
|
-
@IsNotEmpty()
|
|
20
|
-
typeOfDirectoryId?: string;
|
|
21
|
-
|
|
22
|
-
@Expose()
|
|
23
|
-
@IsOptional()
|
|
24
|
-
@IsString()
|
|
25
|
-
@IsNotEmpty()
|
|
26
|
-
@Validate(IsTemplatePlaceholders)
|
|
27
|
-
template?: string;
|
|
28
|
-
|
|
29
|
-
@Expose()
|
|
30
|
-
@IsOptional()
|
|
31
|
-
@IsEnum(ContentTypeEnum)
|
|
32
|
-
contentType?: ContentTypeEnum;
|
|
33
|
-
|
|
34
|
-
@Expose()
|
|
35
|
-
@IsOptional()
|
|
36
|
-
@IsString()
|
|
37
|
-
@Validate(IsTemplatePlaceholders)
|
|
38
|
-
subject?: string;
|
|
39
|
-
}
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsEnum, IsNotEmpty, IsOptional, IsString, Validate } from 'class-validator';
|
|
3
|
+
import { ContentTypeEnum } from '../../messaging';
|
|
4
|
+
import { IsTemplatePlaceholders } from '../validators/IsTemplatePlaceholders';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Body para PUT /templates/{id} (backoffice). Solo campos no-key son mutables.
|
|
8
|
+
* Los componentes del PK (messageType, channelType, language, country) viven
|
|
9
|
+
* en el `{id}` opaco del path y NO se aceptan en el body (PK structurally
|
|
10
|
+
* immutable - ver spec seccion "Mutabilidad PK").
|
|
11
|
+
*
|
|
12
|
+
* La validacion cross-field (subject required ⇔ MAIL, HTML solo en MAIL) se
|
|
13
|
+
* hace en el manager con el channelType decodificado del path, no aca.
|
|
14
|
+
*/
|
|
15
|
+
export class TemplateMessageUpdateRequest {
|
|
16
|
+
@Expose()
|
|
17
|
+
@IsOptional()
|
|
18
|
+
@IsString()
|
|
19
|
+
@IsNotEmpty()
|
|
20
|
+
typeOfDirectoryId?: string;
|
|
21
|
+
|
|
22
|
+
@Expose()
|
|
23
|
+
@IsOptional()
|
|
24
|
+
@IsString()
|
|
25
|
+
@IsNotEmpty()
|
|
26
|
+
@Validate(IsTemplatePlaceholders)
|
|
27
|
+
template?: string;
|
|
28
|
+
|
|
29
|
+
@Expose()
|
|
30
|
+
@IsOptional()
|
|
31
|
+
@IsEnum(ContentTypeEnum)
|
|
32
|
+
contentType?: ContentTypeEnum;
|
|
33
|
+
|
|
34
|
+
@Expose()
|
|
35
|
+
@IsOptional()
|
|
36
|
+
@IsString()
|
|
37
|
+
@Validate(IsTemplatePlaceholders)
|
|
38
|
+
subject?: string;
|
|
39
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export class VerifyOtpResponse {
|
|
2
|
-
verified!: boolean;
|
|
3
|
-
directoryId!: string;
|
|
4
|
-
typeOfDirectoryId!: string;
|
|
5
|
-
}
|
|
1
|
+
export class VerifyOtpResponse {
|
|
2
|
+
verified!: boolean;
|
|
3
|
+
directoryId!: string;
|
|
4
|
+
typeOfDirectoryId!: string;
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export enum DeliveryChannelExtendedEnum {
|
|
2
|
-
SMS = 'SMS',
|
|
3
|
-
MAIL = 'MAIL',
|
|
4
|
-
PUSH_NOTIFICATION = 'PUSH_NOTIFICATION',
|
|
5
|
-
}
|
|
1
|
+
export enum DeliveryChannelExtendedEnum {
|
|
2
|
+
SMS = 'SMS',
|
|
3
|
+
MAIL = 'MAIL',
|
|
4
|
+
PUSH_NOTIFICATION = 'PUSH_NOTIFICATION',
|
|
5
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ValidatorConstraint, ValidatorConstraintInterface, ValidationArguments } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
@ValidatorConstraint({ name: 'IsStringValueRecord', async: false })
|
|
4
|
-
export class IsStringValueRecord implements ValidatorConstraintInterface {
|
|
5
|
-
validate(value: unknown, _args: ValidationArguments): boolean {
|
|
6
|
-
if (!value || typeof value !== 'object') return false;
|
|
7
|
-
return Object.values(value as Record<string, unknown>).every(v => typeof v === 'string');
|
|
8
|
-
}
|
|
9
|
-
defaultMessage(_args: ValidationArguments): string {
|
|
10
|
-
return 'All values in variables must be strings';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
import { ValidatorConstraint, ValidatorConstraintInterface, ValidationArguments } from 'class-validator';
|
|
2
|
+
|
|
3
|
+
@ValidatorConstraint({ name: 'IsStringValueRecord', async: false })
|
|
4
|
+
export class IsStringValueRecord implements ValidatorConstraintInterface {
|
|
5
|
+
validate(value: unknown, _args: ValidationArguments): boolean {
|
|
6
|
+
if (!value || typeof value !== 'object') return false;
|
|
7
|
+
return Object.values(value as Record<string, unknown>).every(v => typeof v === 'string');
|
|
8
|
+
}
|
|
9
|
+
defaultMessage(_args: ValidationArguments): string {
|
|
10
|
+
return 'All values in variables must be strings';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { ValidatorConstraint, ValidatorConstraintInterface, ValidationArguments } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
const VALID_PLACEHOLDER = /^[a-zA-Z][a-zA-Z0-9_]*$/;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Valida que un string solo contenga placeholders bien formados `{varName}` donde
|
|
7
|
-
* `varName` matchea `^[a-zA-Z][a-zA-Z0-9_]*$`. Rechaza:
|
|
8
|
-
* - Placeholders con espacios o caracteres invalidos (`{var name}`, `{var-1}`).
|
|
9
|
-
* - Llaves sin balancear (`abc {def`, `abc } def`, `{ {nested}` ).
|
|
10
|
-
* - Placeholders vacios (`{}`).
|
|
11
|
-
* Acepta texto sin placeholders en absoluto.
|
|
12
|
-
*
|
|
13
|
-
* Uso en DTOs: `@Validate(IsTemplatePlaceholders)` sobre un campo string.
|
|
14
|
-
*/
|
|
15
|
-
@ValidatorConstraint({ name: 'IsTemplatePlaceholders', async: false })
|
|
16
|
-
export class IsTemplatePlaceholders implements ValidatorConstraintInterface {
|
|
17
|
-
validate(value: unknown): boolean {
|
|
18
|
-
if (typeof value !== 'string') return false;
|
|
19
|
-
|
|
20
|
-
// Detectar llaves desbalanceadas con un single-pass.
|
|
21
|
-
let depth = 0;
|
|
22
|
-
for (const ch of value) {
|
|
23
|
-
if (ch === '{') {
|
|
24
|
-
if (depth > 0) return false; // anidado no permitido
|
|
25
|
-
depth = 1;
|
|
26
|
-
} else if (ch === '}') {
|
|
27
|
-
if (depth === 0) return false; // cierre sin apertura
|
|
28
|
-
depth = 0;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (depth !== 0) return false; // apertura sin cierre
|
|
32
|
-
|
|
33
|
-
// Validar que cada `{...}` matchea el regex.
|
|
34
|
-
const matches = value.match(/\{([^}]*)\}/g) ?? [];
|
|
35
|
-
for (const raw of matches) {
|
|
36
|
-
const inner = raw.slice(1, -1);
|
|
37
|
-
if (!VALID_PLACEHOLDER.test(inner)) return false;
|
|
38
|
-
}
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
defaultMessage(args: ValidationArguments): string {
|
|
43
|
-
return `${args.property} contiene placeholders mal formados; debe seguir el patron {nombre} con nombre = [a-zA-Z][a-zA-Z0-9_]*`;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
import { ValidatorConstraint, ValidatorConstraintInterface, ValidationArguments } from 'class-validator';
|
|
2
|
+
|
|
3
|
+
const VALID_PLACEHOLDER = /^[a-zA-Z][a-zA-Z0-9_]*$/;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Valida que un string solo contenga placeholders bien formados `{varName}` donde
|
|
7
|
+
* `varName` matchea `^[a-zA-Z][a-zA-Z0-9_]*$`. Rechaza:
|
|
8
|
+
* - Placeholders con espacios o caracteres invalidos (`{var name}`, `{var-1}`).
|
|
9
|
+
* - Llaves sin balancear (`abc {def`, `abc } def`, `{ {nested}` ).
|
|
10
|
+
* - Placeholders vacios (`{}`).
|
|
11
|
+
* Acepta texto sin placeholders en absoluto.
|
|
12
|
+
*
|
|
13
|
+
* Uso en DTOs: `@Validate(IsTemplatePlaceholders)` sobre un campo string.
|
|
14
|
+
*/
|
|
15
|
+
@ValidatorConstraint({ name: 'IsTemplatePlaceholders', async: false })
|
|
16
|
+
export class IsTemplatePlaceholders implements ValidatorConstraintInterface {
|
|
17
|
+
validate(value: unknown): boolean {
|
|
18
|
+
if (typeof value !== 'string') return false;
|
|
19
|
+
|
|
20
|
+
// Detectar llaves desbalanceadas con un single-pass.
|
|
21
|
+
let depth = 0;
|
|
22
|
+
for (const ch of value) {
|
|
23
|
+
if (ch === '{') {
|
|
24
|
+
if (depth > 0) return false; // anidado no permitido
|
|
25
|
+
depth = 1;
|
|
26
|
+
} else if (ch === '}') {
|
|
27
|
+
if (depth === 0) return false; // cierre sin apertura
|
|
28
|
+
depth = 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (depth !== 0) return false; // apertura sin cierre
|
|
32
|
+
|
|
33
|
+
// Validar que cada `{...}` matchea el regex.
|
|
34
|
+
const matches = value.match(/\{([^}]*)\}/g) ?? [];
|
|
35
|
+
for (const raw of matches) {
|
|
36
|
+
const inner = raw.slice(1, -1);
|
|
37
|
+
if (!VALID_PLACEHOLDER.test(inner)) return false;
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
defaultMessage(args: ValidationArguments): string {
|
|
43
|
+
return `${args.property} contiene placeholders mal formados; debe seguir el patron {nombre} con nombre = [a-zA-Z][a-zA-Z0-9_]*`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { Expose } from 'class-transformer';
|
|
2
|
-
import { IsEnum, Validate, ValidateIf } from 'class-validator';
|
|
3
|
-
import { DeliveryChannelEnum } from '../enums/DeliveryChannelEnum';
|
|
4
|
-
import { ContentTypeEnum } from '../enums/ContentTypeEnum';
|
|
5
|
-
import { IsDestinationByChannel } from '../validators/IsDestinationByChannel';
|
|
6
|
-
import { IsNotBlank } from '../validators/IsNotBlank';
|
|
7
|
-
|
|
8
|
-
export class MessageDeliveryRequest {
|
|
9
|
-
@Expose()
|
|
10
|
-
@IsEnum(DeliveryChannelEnum)
|
|
11
|
-
deliveryChannel: DeliveryChannelEnum;
|
|
12
|
-
|
|
13
|
-
@Expose()
|
|
14
|
-
@Validate(IsDestinationByChannel)
|
|
15
|
-
destination: string;
|
|
16
|
-
|
|
17
|
-
@Expose()
|
|
18
|
-
@ValidateIf(o => o.deliveryChannel === DeliveryChannelEnum.MAIL)
|
|
19
|
-
@Validate(IsNotBlank)
|
|
20
|
-
subject: string;
|
|
21
|
-
|
|
22
|
-
@Expose()
|
|
23
|
-
@Validate(IsNotBlank)
|
|
24
|
-
message: string;
|
|
25
|
-
|
|
26
|
-
@Expose()
|
|
27
|
-
@IsEnum(ContentTypeEnum)
|
|
28
|
-
contentType: ContentTypeEnum;
|
|
29
|
-
}
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsEnum, Validate, ValidateIf } from 'class-validator';
|
|
3
|
+
import { DeliveryChannelEnum } from '../enums/DeliveryChannelEnum';
|
|
4
|
+
import { ContentTypeEnum } from '../enums/ContentTypeEnum';
|
|
5
|
+
import { IsDestinationByChannel } from '../validators/IsDestinationByChannel';
|
|
6
|
+
import { IsNotBlank } from '../validators/IsNotBlank';
|
|
7
|
+
|
|
8
|
+
export class MessageDeliveryRequest {
|
|
9
|
+
@Expose()
|
|
10
|
+
@IsEnum(DeliveryChannelEnum)
|
|
11
|
+
deliveryChannel: DeliveryChannelEnum;
|
|
12
|
+
|
|
13
|
+
@Expose()
|
|
14
|
+
@Validate(IsDestinationByChannel)
|
|
15
|
+
destination: string;
|
|
16
|
+
|
|
17
|
+
@Expose()
|
|
18
|
+
@ValidateIf(o => o.deliveryChannel === DeliveryChannelEnum.MAIL)
|
|
19
|
+
@Validate(IsNotBlank)
|
|
20
|
+
subject: string;
|
|
21
|
+
|
|
22
|
+
@Expose()
|
|
23
|
+
@Validate(IsNotBlank)
|
|
24
|
+
message: string;
|
|
25
|
+
|
|
26
|
+
@Expose()
|
|
27
|
+
@IsEnum(ContentTypeEnum)
|
|
28
|
+
contentType: ContentTypeEnum;
|
|
29
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DeliveryChannelEnum } from '../enums/DeliveryChannelEnum';
|
|
2
|
-
|
|
3
|
-
export class MessageDeliveryResponse {
|
|
4
|
-
messageId: string;
|
|
5
|
-
channel: DeliveryChannelEnum;
|
|
6
|
-
}
|
|
1
|
+
import { DeliveryChannelEnum } from '../enums/DeliveryChannelEnum';
|
|
2
|
+
|
|
3
|
+
export class MessageDeliveryResponse {
|
|
4
|
+
messageId: string;
|
|
5
|
+
channel: DeliveryChannelEnum;
|
|
6
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export enum ContentTypeEnum {
|
|
2
|
-
TEXT = 'TEXT',
|
|
3
|
-
HTML = 'HTML',
|
|
4
|
-
}
|
|
1
|
+
export enum ContentTypeEnum {
|
|
2
|
+
TEXT = 'TEXT',
|
|
3
|
+
HTML = 'HTML',
|
|
4
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export enum DeliveryChannelEnum {
|
|
2
|
-
SMS = 'SMS',
|
|
3
|
-
MAIL = 'MAIL',
|
|
4
|
-
}
|
|
1
|
+
export enum DeliveryChannelEnum {
|
|
2
|
+
SMS = 'SMS',
|
|
3
|
+
MAIL = 'MAIL',
|
|
4
|
+
}
|
package/src/messaging/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './enums/DeliveryChannelEnum';
|
|
2
|
-
export * from './enums/ContentTypeEnum';
|
|
3
|
-
export * from './validators/IsDestinationByChannel';
|
|
4
|
-
export * from './validators/IsNotBlank';
|
|
5
|
-
export * from './dtos/MessageDeliveryRequest';
|
|
6
|
-
export * from './dtos/MessageDeliveryResponse';
|
|
1
|
+
export * from './enums/DeliveryChannelEnum';
|
|
2
|
+
export * from './enums/ContentTypeEnum';
|
|
3
|
+
export * from './validators/IsDestinationByChannel';
|
|
4
|
+
export * from './validators/IsNotBlank';
|
|
5
|
+
export * from './dtos/MessageDeliveryRequest';
|
|
6
|
+
export * from './dtos/MessageDeliveryResponse';
|