@fiado/type-kit 3.519.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.
Files changed (91) hide show
  1. package/_test_/unit/mdm/dtos/mdmDeviceContract.test.ts +22 -0
  2. package/_test_/unit/rewards/backoffice.test.ts +1 -1
  3. package/_test_/unit/rewards/chargeDtos.test.ts +21 -0
  4. package/_test_/unit/rewards/deliveryMetricsDtos.test.ts +25 -0
  5. package/_test_/unit/rewards/grantBackofficeDtos.test.ts +30 -0
  6. package/_test_/unit/rewards/partnerDtos.test.ts +47 -0
  7. package/_test_/unit/rewardsEligibility/metricsDtos.test.ts +8 -2
  8. package/bin/mdm/dtos/DeviceEnrollRequest.d.ts +2 -0
  9. package/bin/mdm/dtos/DeviceEnrollRequest.js +6 -0
  10. package/bin/rewards/constants/BackofficeLimits.d.ts +13 -0
  11. package/bin/rewards/constants/BackofficeLimits.js +14 -1
  12. package/bin/rewards/dtos/backoffice/BackofficeGrantAttemptResponse.d.ts +5 -0
  13. package/bin/rewards/dtos/backoffice/BackofficeGrantAttemptResponse.js +7 -0
  14. package/bin/rewards/dtos/backoffice/BackofficeGrantItemResponse.d.ts +7 -0
  15. package/bin/rewards/dtos/backoffice/BackofficeGrantItemResponse.js +7 -0
  16. package/bin/rewards/dtos/backoffice/BackofficeGrantResponse.d.ts +7 -0
  17. package/bin/rewards/dtos/backoffice/BackofficeGrantResponse.js +8 -0
  18. package/bin/rewards/dtos/backoffice/ChargeListResponse.d.ts +6 -0
  19. package/bin/rewards/dtos/backoffice/ChargeListResponse.js +6 -0
  20. package/bin/rewards/dtos/backoffice/ChargeRecord.d.ts +17 -0
  21. package/bin/rewards/dtos/backoffice/ChargeRecord.js +7 -0
  22. package/bin/rewards/dtos/backoffice/ChargesExportQuery.d.ts +5 -0
  23. package/bin/rewards/dtos/backoffice/ChargesExportQuery.js +7 -0
  24. package/bin/rewards/dtos/backoffice/ChargesQuery.d.ts +7 -0
  25. package/bin/rewards/dtos/backoffice/ChargesQuery.js +7 -0
  26. package/bin/rewards/dtos/backoffice/DeliveryMetricsPoint.d.ts +13 -0
  27. package/bin/rewards/dtos/backoffice/DeliveryMetricsPoint.js +7 -0
  28. package/bin/rewards/dtos/backoffice/DeliveryMetricsQuery.d.ts +9 -0
  29. package/bin/rewards/dtos/backoffice/DeliveryMetricsQuery.js +7 -0
  30. package/bin/rewards/dtos/backoffice/DeliveryTopEntry.d.ts +16 -0
  31. package/bin/rewards/dtos/backoffice/DeliveryTopEntry.js +7 -0
  32. package/bin/rewards/dtos/backoffice/DeliveryTopQuery.d.ts +11 -0
  33. package/bin/rewards/dtos/backoffice/DeliveryTopQuery.js +7 -0
  34. package/bin/rewards/dtos/backoffice/GrantListQuery.d.ts +22 -0
  35. package/bin/rewards/dtos/backoffice/GrantListQuery.js +7 -0
  36. package/bin/rewards/dtos/backoffice/GrantListResponse.d.ts +5 -0
  37. package/bin/rewards/dtos/backoffice/GrantListResponse.js +6 -0
  38. package/bin/rewards/dtos/backoffice/PartnerListResponse.d.ts +6 -0
  39. package/bin/rewards/dtos/backoffice/PartnerListResponse.js +6 -0
  40. package/bin/rewards/dtos/backoffice/PartnerRequest.d.ts +7 -0
  41. package/bin/rewards/dtos/backoffice/PartnerRequest.js +38 -0
  42. package/bin/rewards/dtos/backoffice/PartnerResponse.d.ts +11 -0
  43. package/bin/rewards/dtos/backoffice/PartnerResponse.js +6 -0
  44. package/bin/rewards/dtos/backoffice/PartnerSummary.d.ts +12 -0
  45. package/bin/rewards/dtos/backoffice/PartnerSummary.js +7 -0
  46. package/bin/rewards/dtos/backoffice/PartnersSummaryQuery.d.ts +5 -0
  47. package/bin/rewards/dtos/backoffice/PartnersSummaryQuery.js +7 -0
  48. package/bin/rewards/dtos/backoffice/RewardChargeToInput.d.ts +1 -1
  49. package/bin/rewards/dtos/backoffice/RewardChargeToInput.js +1 -7
  50. package/bin/rewards/enums/DeliveryDimensionEnum.d.ts +8 -0
  51. package/bin/rewards/enums/DeliveryDimensionEnum.js +12 -0
  52. package/bin/rewards/enums/DeliveryTopByEnum.d.ts +5 -0
  53. package/bin/rewards/enums/DeliveryTopByEnum.js +9 -0
  54. package/bin/rewards/enums/DeliveryTopDimensionEnum.d.ts +7 -0
  55. package/bin/rewards/enums/DeliveryTopDimensionEnum.js +11 -0
  56. package/bin/rewards/index.d.ts +21 -0
  57. package/bin/rewards/index.js +21 -0
  58. package/bin/rewardsEligibility/dtos/backoffice/FailedConditionEvaluationResponse.d.ts +6 -0
  59. package/bin/rewardsEligibility/dtos/backoffice/FailedConditionEvaluationResponse.js +7 -0
  60. package/bin/rewardsEligibility/dtos/backoffice/FailedConditionStatResponse.d.ts +3 -0
  61. package/bin/rewardsEligibility/index.d.ts +1 -0
  62. package/bin/rewardsEligibility/index.js +1 -0
  63. package/package.json +1 -1
  64. package/src/mdm/dtos/DeviceEnrollRequest.ts +7 -1
  65. package/src/rewards/constants/BackofficeLimits.ts +16 -0
  66. package/src/rewards/dtos/backoffice/BackofficeGrantAttemptResponse.ts +6 -0
  67. package/src/rewards/dtos/backoffice/BackofficeGrantItemResponse.ts +8 -0
  68. package/src/rewards/dtos/backoffice/BackofficeGrantResponse.ts +8 -0
  69. package/src/rewards/dtos/backoffice/ChargeListResponse.ts +7 -0
  70. package/src/rewards/dtos/backoffice/ChargeRecord.ts +18 -0
  71. package/src/rewards/dtos/backoffice/ChargesExportQuery.ts +5 -0
  72. package/src/rewards/dtos/backoffice/ChargesQuery.ts +7 -0
  73. package/src/rewards/dtos/backoffice/DeliveryMetricsPoint.ts +14 -0
  74. package/src/rewards/dtos/backoffice/DeliveryMetricsQuery.ts +10 -0
  75. package/src/rewards/dtos/backoffice/DeliveryTopEntry.ts +14 -0
  76. package/src/rewards/dtos/backoffice/DeliveryTopQuery.ts +12 -0
  77. package/src/rewards/dtos/backoffice/GrantListQuery.ts +23 -0
  78. package/src/rewards/dtos/backoffice/GrantListResponse.ts +6 -0
  79. package/src/rewards/dtos/backoffice/PartnerListResponse.ts +7 -0
  80. package/src/rewards/dtos/backoffice/PartnerRequest.ts +22 -0
  81. package/src/rewards/dtos/backoffice/PartnerResponse.ts +12 -0
  82. package/src/rewards/dtos/backoffice/PartnerSummary.ts +13 -0
  83. package/src/rewards/dtos/backoffice/PartnersSummaryQuery.ts +5 -0
  84. package/src/rewards/dtos/backoffice/RewardChargeToInput.ts +1 -6
  85. package/src/rewards/enums/DeliveryDimensionEnum.ts +8 -0
  86. package/src/rewards/enums/DeliveryTopByEnum.ts +5 -0
  87. package/src/rewards/enums/DeliveryTopDimensionEnum.ts +7 -0
  88. package/src/rewards/index.ts +21 -0
  89. package/src/rewardsEligibility/dtos/backoffice/FailedConditionEvaluationResponse.ts +6 -0
  90. package/src/rewardsEligibility/dtos/backoffice/FailedConditionStatResponse.ts +4 -0
  91. package/src/rewardsEligibility/index.ts +1 -0
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PartnerSummary = void 0;
4
+ /** Un aliado con sus recompensas cobradas y el valor entregado en el rango (`GET /partners/summary`). */
5
+ class PartnerSummary {
6
+ }
7
+ exports.PartnerSummary = PartnerSummary;
@@ -0,0 +1,5 @@
1
+ /** Query params ya validados de `GET /partners/summary` (`AAAA-MM-DD`, UTC, inclusivos; default últimos 30 días). */
2
+ export declare class PartnersSummaryQuery {
3
+ from?: string;
4
+ to?: string;
5
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PartnersSummaryQuery = void 0;
4
+ /** Query params ya validados de `GET /partners/summary` (`AAAA-MM-DD`, UTC, inclusivos; default últimos 30 días). */
5
+ class PartnersSummaryQuery {
6
+ }
7
+ exports.PartnersSummaryQuery = PartnersSummaryQuery;
@@ -1,4 +1,4 @@
1
+ /** A quién se le cobra. `partnerName` ya no se escribe a mano: el servidor lo copia de `RewardPartner_GT` (D-A2). */
1
2
  export declare class RewardChargeToInput {
2
3
  partnerId: string;
3
- partnerName: string;
4
4
  }
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.RewardChargeToInput = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
+ /** A quién se le cobra. `partnerName` ya no se escribe a mano: el servidor lo copia de `RewardPartner_GT` (D-A2). */
15
16
  class RewardChargeToInput {
16
17
  }
17
18
  exports.RewardChargeToInput = RewardChargeToInput;
@@ -22,10 +23,3 @@ __decorate([
22
23
  (0, class_validator_1.MaxLength)(64),
23
24
  __metadata("design:type", String)
24
25
  ], RewardChargeToInput.prototype, "partnerId", void 0);
25
- __decorate([
26
- (0, class_transformer_1.Expose)(),
27
- (0, class_validator_1.IsString)(),
28
- (0, class_validator_1.IsNotEmpty)(),
29
- (0, class_validator_1.MaxLength)(120),
30
- __metadata("design:type", String)
31
- ], RewardChargeToInput.prototype, "partnerName", void 0);
@@ -0,0 +1,8 @@
1
+ /** Dimensión de la serie diaria de métricas. Las etiquetas (`TAG#campaignId`, `TAG#evaluationId`) se validan con `METRICS_TAG_DIMENSION_PATTERN`. */
2
+ export declare enum DeliveryDimensionEnum {
3
+ ALL = "ALL",
4
+ PACKAGE = "PACKAGE",
5
+ CATALOG_ITEM = "CATALOG_ITEM",
6
+ PARTNER = "PARTNER",
7
+ SOURCE = "SOURCE"
8
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeliveryDimensionEnum = void 0;
4
+ /** Dimensión de la serie diaria de métricas. Las etiquetas (`TAG#campaignId`, `TAG#evaluationId`) se validan con `METRICS_TAG_DIMENSION_PATTERN`. */
5
+ var DeliveryDimensionEnum;
6
+ (function (DeliveryDimensionEnum) {
7
+ DeliveryDimensionEnum["ALL"] = "ALL";
8
+ DeliveryDimensionEnum["PACKAGE"] = "PACKAGE";
9
+ DeliveryDimensionEnum["CATALOG_ITEM"] = "CATALOG_ITEM";
10
+ DeliveryDimensionEnum["PARTNER"] = "PARTNER";
11
+ DeliveryDimensionEnum["SOURCE"] = "SOURCE";
12
+ })(DeliveryDimensionEnum || (exports.DeliveryDimensionEnum = DeliveryDimensionEnum = {}));
@@ -0,0 +1,5 @@
1
+ /** Criterio de ordenamiento del top de métricas. */
2
+ export declare enum DeliveryTopByEnum {
3
+ cost = "cost",
4
+ count = "count"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeliveryTopByEnum = void 0;
4
+ /** Criterio de ordenamiento del top de métricas. */
5
+ var DeliveryTopByEnum;
6
+ (function (DeliveryTopByEnum) {
7
+ DeliveryTopByEnum["cost"] = "cost";
8
+ DeliveryTopByEnum["count"] = "count";
9
+ })(DeliveryTopByEnum || (exports.DeliveryTopByEnum = DeliveryTopByEnum = {}));
@@ -0,0 +1,7 @@
1
+ /** Dimensiones sobre las que se calcula el top de métricas. */
2
+ export declare enum DeliveryTopDimensionEnum {
3
+ PACKAGE = "PACKAGE",
4
+ CATALOG_ITEM = "CATALOG_ITEM",
5
+ PARTNER = "PARTNER",
6
+ SOURCE = "SOURCE"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeliveryTopDimensionEnum = void 0;
4
+ /** Dimensiones sobre las que se calcula el top de métricas. */
5
+ var DeliveryTopDimensionEnum;
6
+ (function (DeliveryTopDimensionEnum) {
7
+ DeliveryTopDimensionEnum["PACKAGE"] = "PACKAGE";
8
+ DeliveryTopDimensionEnum["CATALOG_ITEM"] = "CATALOG_ITEM";
9
+ DeliveryTopDimensionEnum["PARTNER"] = "PARTNER";
10
+ DeliveryTopDimensionEnum["SOURCE"] = "SOURCE";
11
+ })(DeliveryTopDimensionEnum || (exports.DeliveryTopDimensionEnum = DeliveryTopDimensionEnum = {}));
@@ -7,6 +7,9 @@ export * from './enums/ItemErrorCategoryEnum';
7
7
  export * from './enums/RewardStatusEnum';
8
8
  export * from './enums/DependencyIfMissingEnum';
9
9
  export * from './enums/RewardsErrorCodeEnum';
10
+ export * from './enums/DeliveryDimensionEnum';
11
+ export * from './enums/DeliveryTopDimensionEnum';
12
+ export * from './enums/DeliveryTopByEnum';
10
13
  export * from './types/RewardInputs';
11
14
  export * from './dtos/RewardCost';
12
15
  export * from './dtos/RewardChargeTo';
@@ -33,3 +36,21 @@ export * from './dtos/backoffice/PackageResponse';
33
36
  export * from './dtos/backoffice/RewardTypeResponse';
34
37
  export * from './dtos/backoffice/CatalogItemListResponse';
35
38
  export * from './dtos/backoffice/PackageListResponse';
39
+ export * from './dtos/backoffice/PartnerRequest';
40
+ export * from './dtos/backoffice/PartnerResponse';
41
+ export * from './dtos/backoffice/PartnerListResponse';
42
+ export * from './dtos/backoffice/PartnerSummary';
43
+ export * from './dtos/backoffice/PartnersSummaryQuery';
44
+ export * from './dtos/backoffice/GrantListQuery';
45
+ export * from './dtos/backoffice/BackofficeGrantAttemptResponse';
46
+ export * from './dtos/backoffice/BackofficeGrantItemResponse';
47
+ export * from './dtos/backoffice/BackofficeGrantResponse';
48
+ export * from './dtos/backoffice/GrantListResponse';
49
+ export * from './dtos/backoffice/ChargeRecord';
50
+ export * from './dtos/backoffice/ChargeListResponse';
51
+ export * from './dtos/backoffice/ChargesQuery';
52
+ export * from './dtos/backoffice/ChargesExportQuery';
53
+ export * from './dtos/backoffice/DeliveryMetricsQuery';
54
+ export * from './dtos/backoffice/DeliveryTopQuery';
55
+ export * from './dtos/backoffice/DeliveryMetricsPoint';
56
+ export * from './dtos/backoffice/DeliveryTopEntry';
@@ -24,6 +24,9 @@ __exportStar(require("./enums/ItemErrorCategoryEnum"), exports);
24
24
  __exportStar(require("./enums/RewardStatusEnum"), exports);
25
25
  __exportStar(require("./enums/DependencyIfMissingEnum"), exports);
26
26
  __exportStar(require("./enums/RewardsErrorCodeEnum"), exports);
27
+ __exportStar(require("./enums/DeliveryDimensionEnum"), exports);
28
+ __exportStar(require("./enums/DeliveryTopDimensionEnum"), exports);
29
+ __exportStar(require("./enums/DeliveryTopByEnum"), exports);
27
30
  //Types
28
31
  __exportStar(require("./types/RewardInputs"), exports);
29
32
  //DTOs
@@ -58,3 +61,21 @@ __exportStar(require("./dtos/backoffice/PackageResponse"), exports);
58
61
  __exportStar(require("./dtos/backoffice/RewardTypeResponse"), exports);
59
62
  __exportStar(require("./dtos/backoffice/CatalogItemListResponse"), exports);
60
63
  __exportStar(require("./dtos/backoffice/PackageListResponse"), exports);
64
+ __exportStar(require("./dtos/backoffice/PartnerRequest"), exports);
65
+ __exportStar(require("./dtos/backoffice/PartnerResponse"), exports);
66
+ __exportStar(require("./dtos/backoffice/PartnerListResponse"), exports);
67
+ __exportStar(require("./dtos/backoffice/PartnerSummary"), exports);
68
+ __exportStar(require("./dtos/backoffice/PartnersSummaryQuery"), exports);
69
+ __exportStar(require("./dtos/backoffice/GrantListQuery"), exports);
70
+ __exportStar(require("./dtos/backoffice/BackofficeGrantAttemptResponse"), exports);
71
+ __exportStar(require("./dtos/backoffice/BackofficeGrantItemResponse"), exports);
72
+ __exportStar(require("./dtos/backoffice/BackofficeGrantResponse"), exports);
73
+ __exportStar(require("./dtos/backoffice/GrantListResponse"), exports);
74
+ __exportStar(require("./dtos/backoffice/ChargeRecord"), exports);
75
+ __exportStar(require("./dtos/backoffice/ChargeListResponse"), exports);
76
+ __exportStar(require("./dtos/backoffice/ChargesQuery"), exports);
77
+ __exportStar(require("./dtos/backoffice/ChargesExportQuery"), exports);
78
+ __exportStar(require("./dtos/backoffice/DeliveryMetricsQuery"), exports);
79
+ __exportStar(require("./dtos/backoffice/DeliveryTopQuery"), exports);
80
+ __exportStar(require("./dtos/backoffice/DeliveryMetricsPoint"), exports);
81
+ __exportStar(require("./dtos/backoffice/DeliveryTopEntry"), exports);
@@ -0,0 +1,6 @@
1
+ /** En qué evaluación falló una condición y cuántas veces (máximo 5 por condición, de mayor a menor). */
2
+ export declare class FailedConditionEvaluationResponse {
3
+ evaluationId: string;
4
+ evaluationName: string;
5
+ count: number;
6
+ }
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.519.0",
3
+ "version": "3.521.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -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()
@@ -4,3 +4,19 @@ export const REWARD_ITEM_KEY_PATTERN = new RegExp(`^[A-Za-z0-9_-]{1,${REWARD_ITE
4
4
  export const REWARD_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
5
5
  /** Máximo de ítems de un paquete (B-12 de rewards-business: presupuesto de tiempo del worker). Igual a `MAX_ITEMS_PER_PACKAGE` del lambda. */
6
6
  export const REWARD_PACKAGE_MAX_ITEMS = 4;
7
+
8
+ /** Entregas de backoffice (Fase 4): ventana máxima del listado, default y tope del CSV. */
9
+ export const GRANTS_MAX_RANGE_DAYS = 92;
10
+ export const GRANTS_DEFAULT_RANGE_DAYS = 7;
11
+ export const GRANTS_EXPORT_MAX_ROWS = 5000;
12
+
13
+ /** Cierre mensual por aliado (D-C1): tope del CSV y formato de `month` (UTC). */
14
+ export const CHARGES_EXPORT_MAX_ROWS = 10000;
15
+ export const CHARGES_MONTH_PATTERN = /^\d{4}-(0[1-9]|1[0-2])$/;
16
+
17
+ /** Métricas de entregas (D-D3): top de 10, máximo 200 valores por dimensión, y etiquetas permitidas. */
18
+ export const METRICS_TOP_LIMIT = 10;
19
+ export const METRICS_TOP_MAX_VALUES = 200;
20
+ /** Etiquetas permitidas en métricas (D-D3b): una llave libre tendría cardinalidad ilimitada. */
21
+ export const METRICS_TAG_ALLOWLIST: readonly string[] = ['campaignId', 'evaluationId'];
22
+ export const METRICS_TAG_DIMENSION_PATTERN = /^TAG#(campaignId|evaluationId)$/;
@@ -0,0 +1,6 @@
1
+ import { GrantAttemptResponse } from '../responses/GrantAttemptResponse';
2
+
3
+ export class BackofficeGrantAttemptResponse extends GrantAttemptResponse {
4
+ /** Texto corto sin PII, mapeado desde `errorCategory`. */
5
+ message?: string;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { GrantItemResponse } from '../responses/GrantItemResponse';
2
+ import { BackofficeGrantAttemptResponse } from './BackofficeGrantAttemptResponse';
3
+
4
+ export class BackofficeGrantItemResponse extends GrantItemResponse {
5
+ /** Nombre de la recompensa congelada en la entrega. */
6
+ name: string;
7
+ attempts: BackofficeGrantAttemptResponse[];
8
+ }
@@ -0,0 +1,8 @@
1
+ import { GrantResponse } from '../responses/GrantResponse';
2
+ import { BackofficeGrantItemResponse } from './BackofficeGrantItemResponse';
3
+
4
+ /** Sin `directoryName`: Directory no trae un campo de nombre confiable (Q2). Sin `requestSnapshot`/`providerResponse` (R2). */
5
+ export class BackofficeGrantResponse extends GrantResponse {
6
+ packageName?: string;
7
+ items: BackofficeGrantItemResponse[];
8
+ }
@@ -0,0 +1,7 @@
1
+ import { ChargeRecord } from './ChargeRecord';
2
+
3
+ export class ChargeListResponse {
4
+ items: ChargeRecord[];
5
+ /** Cursor opaco de la página siguiente; ausente en la última página. */
6
+ nextCursor?: string;
7
+ }
@@ -0,0 +1,18 @@
1
+ import { RewardChargeTo } from '../RewardChargeTo';
2
+ import { RewardCost } from '../RewardCost';
3
+
4
+ /** Un cargo = un ítem que quedó GRANTED, con el costo CONGELADO en la entrega (no el actual del catálogo). Sin `source` (R4 lo guarda, no se expone). */
5
+ export class ChargeRecord {
6
+ grantId: string;
7
+ itemKey: string;
8
+ /** Epoch en milisegundos (UTC). */
9
+ grantedAt: number;
10
+ directoryId: string;
11
+ catalogItemId: string;
12
+ catalogItemName: string;
13
+ campaignId?: string;
14
+ packageId: string;
15
+ cost: RewardCost;
16
+ chargeTo: RewardChargeTo;
17
+ externalRef?: Record<string, string>;
18
+ }
@@ -0,0 +1,5 @@
1
+ /** Query params ya validados de `GET /charges/export`. `month` = `AAAA-MM` UTC. */
2
+ export class ChargesExportQuery {
3
+ partnerId: string;
4
+ month: string;
5
+ }
@@ -0,0 +1,7 @@
1
+ /** Query params ya validados de `GET /charges`. `month` = `AAAA-MM` UTC. */
2
+ export class ChargesQuery {
3
+ partnerId: string;
4
+ month: string;
5
+ limit?: number;
6
+ cursor?: string;
7
+ }
@@ -0,0 +1,14 @@
1
+ import { CurrencyId } from '../../../currency';
2
+
3
+ /** Un punto de la serie diaria. `date` = `AAAA-MM-DD` UTC. `costGranted` = `costGrantedMinor / 100` (nunca se suman monedas distintas). */
4
+ export class DeliveryMetricsPoint {
5
+ date: string;
6
+ currency: CurrencyId;
7
+ granted: number;
8
+ failed: number;
9
+ skipped: number;
10
+ grantsCompleted: number;
11
+ grantsPartial: number;
12
+ grantsFailed: number;
13
+ costGranted: number;
14
+ }
@@ -0,0 +1,10 @@
1
+ import { CurrencyId } from '../../../currency';
2
+
3
+ /** Query params ya validados de `GET /metrics/deliveries`. `dimension` es un `DeliveryDimensionEnum` o `TAG#campaignId|TAG#evaluationId`. `from`/`to` = `AAAA-MM-DD` UTC. */
4
+ export class DeliveryMetricsQuery {
5
+ dimension: string;
6
+ value?: string;
7
+ from: string;
8
+ to: string;
9
+ currency?: CurrencyId;
10
+ }
@@ -0,0 +1,14 @@
1
+ import { ItemErrorCategoryEnum } from '../../enums/ItemErrorCategoryEnum';
2
+ import { RewardCost } from '../RewardCost';
3
+
4
+ /** Una fila del top de métricas. `errors` solo viene en la dimensión `CATALOG_ITEM`. */
5
+ export class DeliveryTopEntry {
6
+ value: string;
7
+ label: string;
8
+ granted: number;
9
+ failed: number;
10
+ skipped: number;
11
+ /** Un costo por moneda; las monedas no se suman entre sí. */
12
+ cost: RewardCost[];
13
+ errors?: { category: ItemErrorCategoryEnum; count: number }[];
14
+ }
@@ -0,0 +1,12 @@
1
+ import { CurrencyId } from '../../../currency';
2
+ import { DeliveryTopByEnum } from '../../enums/DeliveryTopByEnum';
3
+ import { DeliveryTopDimensionEnum } from '../../enums/DeliveryTopDimensionEnum';
4
+
5
+ /** Query params ya validados de `GET /metrics/deliveries/top`. `from`/`to` = `AAAA-MM-DD` UTC. */
6
+ export class DeliveryTopQuery {
7
+ dimension: DeliveryTopDimensionEnum;
8
+ from: string;
9
+ to: string;
10
+ by: DeliveryTopByEnum;
11
+ currency?: CurrencyId;
12
+ }
@@ -0,0 +1,23 @@
1
+ import { ItemErrorCategoryEnum } from '../../enums/ItemErrorCategoryEnum';
2
+
3
+ /** Query params ya validados de `GET /grants` y `GET /grants/export` (el lambda los valida; ver `GrantListQueryHelper`). */
4
+ export class GrantListQuery {
5
+ limit?: number;
6
+ cursor?: string;
7
+ /** Uno o varios `GrantStatusEnum` separados por coma. */
8
+ status?: string;
9
+ packageId?: string;
10
+ campaignId?: string;
11
+ service?: string;
12
+ partnerId?: string;
13
+ directoryId?: string;
14
+ /** Coincide con un `id` de entrega; si no, se trata como `directoryId`. Sin búsqueda por nombre. */
15
+ search?: string;
16
+ /** `AAAA-MM-DD` UTC, inclusivos. Default: `to` = hoy, `from` = `to − 6`. Máximo 92 días. */
17
+ from?: string;
18
+ to?: string;
19
+ /** Entregas que contienen esta recompensa del catálogo (D-F1). */
20
+ catalogItemId?: string;
21
+ /** Entregas con al menos un ítem FAILED cuyo último intento falló con esta categoría (D-F1). */
22
+ errorCategory?: ItemErrorCategoryEnum;
23
+ }
@@ -0,0 +1,6 @@
1
+ import { BackofficeGrantResponse } from './BackofficeGrantResponse';
2
+
3
+ export class GrantListResponse {
4
+ items: BackofficeGrantResponse[];
5
+ nextCursor?: string;
6
+ }
@@ -0,0 +1,7 @@
1
+ import { PartnerResponse } from './PartnerResponse';
2
+
3
+ export class PartnerListResponse {
4
+ items: PartnerResponse[];
5
+ /** Cursor opaco de la página siguiente; ausente en la última página. */
6
+ nextCursor?: string;
7
+ }
@@ -0,0 +1,22 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsEnum, IsNotEmpty, IsString, Matches, MaxLength } from 'class-validator';
3
+ import { REWARD_ID_PATTERN } from '../../constants/BackofficeLimits';
4
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
5
+
6
+ /** Crear (POST) o reemplazar (PUT) un aliado. `version` y `updatedBy` los pone el servidor. El `id` lo genera el front del nombre. */
7
+ export class PartnerRequest {
8
+ @Expose()
9
+ @IsString()
10
+ @Matches(REWARD_ID_PATTERN)
11
+ id: string;
12
+
13
+ @Expose()
14
+ @IsString()
15
+ @IsNotEmpty()
16
+ @MaxLength(120)
17
+ name: string;
18
+
19
+ @Expose()
20
+ @IsEnum(RewardStatusEnum)
21
+ status: RewardStatusEnum;
22
+ }
@@ -0,0 +1,12 @@
1
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
2
+
3
+ export class PartnerResponse {
4
+ id: string;
5
+ name: string;
6
+ status: RewardStatusEnum;
7
+ version: number;
8
+ /** Epoch en milisegundos. */
9
+ createdAt: number;
10
+ updatedAt: number;
11
+ updatedBy: string;
12
+ }
@@ -0,0 +1,13 @@
1
+ import { RewardCost } from '../RewardCost';
2
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
3
+
4
+ /** Un aliado con sus recompensas cobradas y el valor entregado en el rango (`GET /partners/summary`). */
5
+ export class PartnerSummary {
6
+ partnerId: string;
7
+ partnerName: string;
8
+ status: RewardStatusEnum;
9
+ /** Recompensas del catálogo que se le cobran a este aliado. */
10
+ catalogItemIds: string[];
11
+ /** Valor entregado en el rango, POR MONEDA (nunca se mezclan). Vacío si no hubo entregas. */
12
+ delivered: RewardCost[];
13
+ }
@@ -0,0 +1,5 @@
1
+ /** Query params ya validados de `GET /partners/summary` (`AAAA-MM-DD`, UTC, inclusivos; default últimos 30 días). */
2
+ export class PartnersSummaryQuery {
3
+ from?: string;
4
+ to?: string;
5
+ }
@@ -1,16 +1,11 @@
1
1
  import { Expose } from 'class-transformer';
2
2
  import { IsNotEmpty, IsString, MaxLength } from 'class-validator';
3
3
 
4
+ /** A quién se le cobra. `partnerName` ya no se escribe a mano: el servidor lo copia de `RewardPartner_GT` (D-A2). */
4
5
  export class RewardChargeToInput {
5
6
  @Expose()
6
7
  @IsString()
7
8
  @IsNotEmpty()
8
9
  @MaxLength(64)
9
10
  partnerId: string;
10
-
11
- @Expose()
12
- @IsString()
13
- @IsNotEmpty()
14
- @MaxLength(120)
15
- partnerName: string;
16
11
  }
@@ -0,0 +1,8 @@
1
+ /** Dimensión de la serie diaria de métricas. Las etiquetas (`TAG#campaignId`, `TAG#evaluationId`) se validan con `METRICS_TAG_DIMENSION_PATTERN`. */
2
+ export enum DeliveryDimensionEnum {
3
+ ALL = 'ALL',
4
+ PACKAGE = 'PACKAGE',
5
+ CATALOG_ITEM = 'CATALOG_ITEM',
6
+ PARTNER = 'PARTNER',
7
+ SOURCE = 'SOURCE',
8
+ }
@@ -0,0 +1,5 @@
1
+ /** Criterio de ordenamiento del top de métricas. */
2
+ export enum DeliveryTopByEnum {
3
+ cost = 'cost',
4
+ count = 'count',
5
+ }
@@ -0,0 +1,7 @@
1
+ /** Dimensiones sobre las que se calcula el top de métricas. */
2
+ export enum DeliveryTopDimensionEnum {
3
+ PACKAGE = 'PACKAGE',
4
+ CATALOG_ITEM = 'CATALOG_ITEM',
5
+ PARTNER = 'PARTNER',
6
+ SOURCE = 'SOURCE',
7
+ }
@@ -8,6 +8,9 @@ export * from './enums/ItemErrorCategoryEnum';
8
8
  export * from './enums/RewardStatusEnum';
9
9
  export * from './enums/DependencyIfMissingEnum';
10
10
  export * from './enums/RewardsErrorCodeEnum';
11
+ export * from './enums/DeliveryDimensionEnum';
12
+ export * from './enums/DeliveryTopDimensionEnum';
13
+ export * from './enums/DeliveryTopByEnum';
11
14
 
12
15
  //Types
13
16
  export * from './types/RewardInputs';
@@ -50,3 +53,21 @@ export * from './dtos/backoffice/PackageResponse';
50
53
  export * from './dtos/backoffice/RewardTypeResponse';
51
54
  export * from './dtos/backoffice/CatalogItemListResponse';
52
55
  export * from './dtos/backoffice/PackageListResponse';
56
+ export * from './dtos/backoffice/PartnerRequest';
57
+ export * from './dtos/backoffice/PartnerResponse';
58
+ export * from './dtos/backoffice/PartnerListResponse';
59
+ export * from './dtos/backoffice/PartnerSummary';
60
+ export * from './dtos/backoffice/PartnersSummaryQuery';
61
+ export * from './dtos/backoffice/GrantListQuery';
62
+ export * from './dtos/backoffice/BackofficeGrantAttemptResponse';
63
+ export * from './dtos/backoffice/BackofficeGrantItemResponse';
64
+ export * from './dtos/backoffice/BackofficeGrantResponse';
65
+ export * from './dtos/backoffice/GrantListResponse';
66
+ export * from './dtos/backoffice/ChargeRecord';
67
+ export * from './dtos/backoffice/ChargeListResponse';
68
+ export * from './dtos/backoffice/ChargesQuery';
69
+ export * from './dtos/backoffice/ChargesExportQuery';
70
+ export * from './dtos/backoffice/DeliveryMetricsQuery';
71
+ export * from './dtos/backoffice/DeliveryTopQuery';
72
+ export * from './dtos/backoffice/DeliveryMetricsPoint';
73
+ export * from './dtos/backoffice/DeliveryTopEntry';
@@ -0,0 +1,6 @@
1
+ /** En qué evaluación falló una condición y cuántas veces (máximo 5 por condición, de mayor a menor). */
2
+ export class FailedConditionEvaluationResponse {
3
+ evaluationId: string;
4
+ evaluationName: string;
5
+ count: number;
6
+ }
@@ -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';