@fiado/type-kit 3.520.0 → 3.521.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/mdm/dtos/mdmDeviceContract.test.ts +22 -0
- package/_test_/unit/rewardsEligibility/metricsDtos.test.ts +8 -2
- package/bin/mdm/dtos/DeviceEnrollRequest.d.ts +2 -0
- package/bin/mdm/dtos/DeviceEnrollRequest.js +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/FailedConditionEvaluationResponse.d.ts +6 -0
- package/bin/rewardsEligibility/dtos/backoffice/FailedConditionEvaluationResponse.js +7 -0
- package/bin/rewardsEligibility/dtos/backoffice/FailedConditionStatResponse.d.ts +3 -0
- package/bin/rewardsEligibility/index.d.ts +1 -0
- package/bin/rewardsEligibility/index.js +1 -0
- package/package.json +1 -1
- package/src/mdm/dtos/DeviceEnrollRequest.ts +7 -1
- package/src/rewardsEligibility/dtos/backoffice/FailedConditionEvaluationResponse.ts +6 -0
- package/src/rewardsEligibility/dtos/backoffice/FailedConditionStatResponse.ts +4 -0
- package/src/rewardsEligibility/index.ts +1 -0
|
@@ -62,6 +62,28 @@ describe('DeviceEnrollRequest.lockMode', () => {
|
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
+
describe('DeviceEnrollRequest.firstLockAt', () => {
|
|
66
|
+
it('valida sin firstLockAt: el consumidor de hoy no se rompe', async () => {
|
|
67
|
+
const dto = plainToInstance(DeviceEnrollRequest, validEnroll);
|
|
68
|
+
const errors = await validate(dto);
|
|
69
|
+
expect(errors).toEqual([]);
|
|
70
|
+
expect(dto.firstLockAt).toBeUndefined();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('valida con firstLockAt en ISO-8601', async () => {
|
|
74
|
+
const dto = plainToInstance(DeviceEnrollRequest, { ...validEnroll, firstLockAt: '2026-11-08T06:00:00.000Z' });
|
|
75
|
+
const errors = await validate(dto);
|
|
76
|
+
expect(errors).toEqual([]);
|
|
77
|
+
expect(dto.firstLockAt).toBe('2026-11-08T06:00:00.000Z');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('falla si firstLockAt no es ISO-8601', async () => {
|
|
81
|
+
const dto = plainToInstance(DeviceEnrollRequest, { ...validEnroll, firstLockAt: '08/11/2026' });
|
|
82
|
+
const errors = await validate(dto);
|
|
83
|
+
expect(hasConstraint(errors, 'firstLockAt', 'isIso8601')).toBe(true);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
65
87
|
describe('DeviceUnlockRequest.unlockUntil', () => {
|
|
66
88
|
it('valida sin unlockUntil: el consumidor de hoy no se rompe', async () => {
|
|
67
89
|
const dto = plainToInstance(DeviceUnlockRequest, validUnlock);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MetricsDimensionEnum } from '../../../src/rewardsEligibility/enums/MetricsDimensionEnum';
|
|
2
|
-
import type { FailedConditionStatResponse } from '../../../src/rewardsEligibility
|
|
2
|
+
import type { FailedConditionEvaluationResponse, FailedConditionStatResponse } from '../../../src/rewardsEligibility';
|
|
3
3
|
import type { MetricsPointResponse } from '../../../src/rewardsEligibility/dtos/backoffice/MetricsPointResponse';
|
|
4
4
|
import type { MetricsQuery } from '../../../src/rewardsEligibility/dtos/backoffice/MetricsQuery';
|
|
5
5
|
|
|
@@ -9,9 +9,15 @@ describe('DTOs de métricas (forma)', () => {
|
|
|
9
9
|
expect(Object.keys(point)).toHaveLength(10);
|
|
10
10
|
});
|
|
11
11
|
it('ranking y query', () => {
|
|
12
|
-
const stat: FailedConditionStatResponse = { key: 'directory.accountAgeDays', label: 'Antigüedad de la cuenta', count: 7 };
|
|
12
|
+
const stat: FailedConditionStatResponse = { key: 'directory.accountAgeDays', label: 'Antigüedad de la cuenta', count: 7, evaluations: [] };
|
|
13
13
|
const query: MetricsQuery = { dimension: MetricsDimensionEnum.CAMPAIGN, value: 'referidos-q4', from: '2026-10-01', to: '2026-10-08' };
|
|
14
14
|
expect(stat.count).toBe(7);
|
|
15
15
|
expect(query.dimension).toBe('CAMPAIGN');
|
|
16
16
|
});
|
|
17
|
+
|
|
18
|
+
it('FailedConditionStatResponse trae evaluations ordenables por count (D-E1)', () => {
|
|
19
|
+
const evaluation: FailedConditionEvaluationResponse = { evaluationId: 'ev-1', evaluationName: 'Referidos', count: 7 };
|
|
20
|
+
const stat: FailedConditionStatResponse = { key: 'payments.amount', label: 'Monto', count: 9, evaluations: [evaluation] };
|
|
21
|
+
expect(stat.evaluations[0]).toEqual({ evaluationId: 'ev-1', evaluationName: 'Referidos', count: 7 });
|
|
22
|
+
});
|
|
17
23
|
});
|
|
@@ -8,5 +8,7 @@ export declare class DeviceEnrollRequest {
|
|
|
8
8
|
termMonths: number;
|
|
9
9
|
/** Cuándo se dispara el bloqueo del equipo; si se omite es ONDEMAND, que es el modo de hoy. */
|
|
10
10
|
lockMode?: MdmLockModeEnum;
|
|
11
|
+
/** ISO-8601 del primer bloqueo programado (primer vencimiento); lo usan proveedores que agendan el bloqueo al enrolar. */
|
|
12
|
+
firstLockAt?: string;
|
|
11
13
|
operationReference: string;
|
|
12
14
|
}
|
|
@@ -58,6 +58,12 @@ __decorate([
|
|
|
58
58
|
(0, class_validator_1.IsOptional)(),
|
|
59
59
|
__metadata("design:type", String)
|
|
60
60
|
], DeviceEnrollRequest.prototype, "lockMode", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, class_transformer_1.Expose)(),
|
|
63
|
+
(0, class_validator_1.IsISO8601)(),
|
|
64
|
+
(0, class_validator_1.IsOptional)(),
|
|
65
|
+
__metadata("design:type", String)
|
|
66
|
+
], DeviceEnrollRequest.prototype, "firstLockAt", void 0);
|
|
61
67
|
__decorate([
|
|
62
68
|
(0, class_transformer_1.Expose)(),
|
|
63
69
|
(0, class_validator_1.IsString)(),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FailedConditionEvaluationResponse = void 0;
|
|
4
|
+
/** En qué evaluación falló una condición y cuántas veces (máximo 5 por condición, de mayor a menor). */
|
|
5
|
+
class FailedConditionEvaluationResponse {
|
|
6
|
+
}
|
|
7
|
+
exports.FailedConditionEvaluationResponse = FailedConditionEvaluationResponse;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FailedConditionEvaluationResponse } from './FailedConditionEvaluationResponse';
|
|
1
2
|
/** Condición que más hace fallar la regla (`GET /metrics/failed-conditions`). */
|
|
2
3
|
export declare class FailedConditionStatResponse {
|
|
3
4
|
/** `{source}.{field}`. */
|
|
@@ -5,4 +6,6 @@ export declare class FailedConditionStatResponse {
|
|
|
5
6
|
/** Etiqueta legible (del catálogo de reglas; si no está, la propia `key`). */
|
|
6
7
|
label: string;
|
|
7
8
|
count: number;
|
|
9
|
+
/** Evaluaciones donde falla esta condición, ordenadas por `count` descendente (máx. 5). */
|
|
10
|
+
evaluations: FailedConditionEvaluationResponse[];
|
|
8
11
|
}
|
|
@@ -66,4 +66,5 @@ export * from './dtos/backoffice/RunResultListResponse';
|
|
|
66
66
|
export * from './dtos/backoffice/CreateRunResponse';
|
|
67
67
|
export * from './dtos/backoffice/MetricsPointResponse';
|
|
68
68
|
export * from './dtos/backoffice/FailedConditionStatResponse';
|
|
69
|
+
export * from './dtos/backoffice/FailedConditionEvaluationResponse';
|
|
69
70
|
export * from './dtos/backoffice/MetricsQuery';
|
|
@@ -88,4 +88,5 @@ __exportStar(require("./dtos/backoffice/RunResultListResponse"), exports);
|
|
|
88
88
|
__exportStar(require("./dtos/backoffice/CreateRunResponse"), exports);
|
|
89
89
|
__exportStar(require("./dtos/backoffice/MetricsPointResponse"), exports);
|
|
90
90
|
__exportStar(require("./dtos/backoffice/FailedConditionStatResponse"), exports);
|
|
91
|
+
__exportStar(require("./dtos/backoffice/FailedConditionEvaluationResponse"), exports);
|
|
91
92
|
__exportStar(require("./dtos/backoffice/MetricsQuery"), exports);
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Expose } from "class-transformer";
|
|
2
|
-
import { IsString, IsNotEmpty, IsOptional, IsNumber, IsPositive, Matches, IsEnum } from "class-validator";
|
|
2
|
+
import { IsString, IsNotEmpty, IsOptional, IsNumber, IsPositive, Matches, IsEnum, IsISO8601 } from "class-validator";
|
|
3
3
|
import { CREDIT_ID_MESSAGE, CREDIT_ID_PATTERN } from "../../common/constants/CreditIdPattern";
|
|
4
4
|
import { MdmLockModeEnum } from "../../retailCatalog/enums/MdmLockModeEnum";
|
|
5
5
|
|
|
@@ -39,6 +39,12 @@ export class DeviceEnrollRequest {
|
|
|
39
39
|
@IsOptional()
|
|
40
40
|
lockMode?: MdmLockModeEnum;
|
|
41
41
|
|
|
42
|
+
/** ISO-8601 del primer bloqueo programado (primer vencimiento); lo usan proveedores que agendan el bloqueo al enrolar. */
|
|
43
|
+
@Expose()
|
|
44
|
+
@IsISO8601()
|
|
45
|
+
@IsOptional()
|
|
46
|
+
firstLockAt?: string;
|
|
47
|
+
|
|
42
48
|
@Expose()
|
|
43
49
|
@IsString()
|
|
44
50
|
@IsNotEmpty()
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { FailedConditionEvaluationResponse } from './FailedConditionEvaluationResponse';
|
|
2
|
+
|
|
1
3
|
/** Condición que más hace fallar la regla (`GET /metrics/failed-conditions`). */
|
|
2
4
|
export class FailedConditionStatResponse {
|
|
3
5
|
/** `{source}.{field}`. */
|
|
@@ -5,4 +7,6 @@ export class FailedConditionStatResponse {
|
|
|
5
7
|
/** Etiqueta legible (del catálogo de reglas; si no está, la propia `key`). */
|
|
6
8
|
label: string;
|
|
7
9
|
count: number;
|
|
10
|
+
/** Evaluaciones donde falla esta condición, ordenadas por `count` descendente (máx. 5). */
|
|
11
|
+
evaluations: FailedConditionEvaluationResponse[];
|
|
8
12
|
}
|
|
@@ -77,4 +77,5 @@ export * from './dtos/backoffice/RunResultListResponse';
|
|
|
77
77
|
export * from './dtos/backoffice/CreateRunResponse';
|
|
78
78
|
export * from './dtos/backoffice/MetricsPointResponse';
|
|
79
79
|
export * from './dtos/backoffice/FailedConditionStatResponse';
|
|
80
|
+
export * from './dtos/backoffice/FailedConditionEvaluationResponse';
|
|
80
81
|
export * from './dtos/backoffice/MetricsQuery';
|