@fiado/type-kit 3.519.0 → 3.520.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 (78) hide show
  1. package/_test_/unit/rewards/backoffice.test.ts +1 -1
  2. package/_test_/unit/rewards/chargeDtos.test.ts +21 -0
  3. package/_test_/unit/rewards/deliveryMetricsDtos.test.ts +25 -0
  4. package/_test_/unit/rewards/grantBackofficeDtos.test.ts +30 -0
  5. package/_test_/unit/rewards/partnerDtos.test.ts +47 -0
  6. package/bin/rewards/constants/BackofficeLimits.d.ts +13 -0
  7. package/bin/rewards/constants/BackofficeLimits.js +14 -1
  8. package/bin/rewards/dtos/backoffice/BackofficeGrantAttemptResponse.d.ts +5 -0
  9. package/bin/rewards/dtos/backoffice/BackofficeGrantAttemptResponse.js +7 -0
  10. package/bin/rewards/dtos/backoffice/BackofficeGrantItemResponse.d.ts +7 -0
  11. package/bin/rewards/dtos/backoffice/BackofficeGrantItemResponse.js +7 -0
  12. package/bin/rewards/dtos/backoffice/BackofficeGrantResponse.d.ts +7 -0
  13. package/bin/rewards/dtos/backoffice/BackofficeGrantResponse.js +8 -0
  14. package/bin/rewards/dtos/backoffice/ChargeListResponse.d.ts +6 -0
  15. package/bin/rewards/dtos/backoffice/ChargeListResponse.js +6 -0
  16. package/bin/rewards/dtos/backoffice/ChargeRecord.d.ts +17 -0
  17. package/bin/rewards/dtos/backoffice/ChargeRecord.js +7 -0
  18. package/bin/rewards/dtos/backoffice/ChargesExportQuery.d.ts +5 -0
  19. package/bin/rewards/dtos/backoffice/ChargesExportQuery.js +7 -0
  20. package/bin/rewards/dtos/backoffice/ChargesQuery.d.ts +7 -0
  21. package/bin/rewards/dtos/backoffice/ChargesQuery.js +7 -0
  22. package/bin/rewards/dtos/backoffice/DeliveryMetricsPoint.d.ts +13 -0
  23. package/bin/rewards/dtos/backoffice/DeliveryMetricsPoint.js +7 -0
  24. package/bin/rewards/dtos/backoffice/DeliveryMetricsQuery.d.ts +9 -0
  25. package/bin/rewards/dtos/backoffice/DeliveryMetricsQuery.js +7 -0
  26. package/bin/rewards/dtos/backoffice/DeliveryTopEntry.d.ts +16 -0
  27. package/bin/rewards/dtos/backoffice/DeliveryTopEntry.js +7 -0
  28. package/bin/rewards/dtos/backoffice/DeliveryTopQuery.d.ts +11 -0
  29. package/bin/rewards/dtos/backoffice/DeliveryTopQuery.js +7 -0
  30. package/bin/rewards/dtos/backoffice/GrantListQuery.d.ts +22 -0
  31. package/bin/rewards/dtos/backoffice/GrantListQuery.js +7 -0
  32. package/bin/rewards/dtos/backoffice/GrantListResponse.d.ts +5 -0
  33. package/bin/rewards/dtos/backoffice/GrantListResponse.js +6 -0
  34. package/bin/rewards/dtos/backoffice/PartnerListResponse.d.ts +6 -0
  35. package/bin/rewards/dtos/backoffice/PartnerListResponse.js +6 -0
  36. package/bin/rewards/dtos/backoffice/PartnerRequest.d.ts +7 -0
  37. package/bin/rewards/dtos/backoffice/PartnerRequest.js +38 -0
  38. package/bin/rewards/dtos/backoffice/PartnerResponse.d.ts +11 -0
  39. package/bin/rewards/dtos/backoffice/PartnerResponse.js +6 -0
  40. package/bin/rewards/dtos/backoffice/PartnerSummary.d.ts +12 -0
  41. package/bin/rewards/dtos/backoffice/PartnerSummary.js +7 -0
  42. package/bin/rewards/dtos/backoffice/PartnersSummaryQuery.d.ts +5 -0
  43. package/bin/rewards/dtos/backoffice/PartnersSummaryQuery.js +7 -0
  44. package/bin/rewards/dtos/backoffice/RewardChargeToInput.d.ts +1 -1
  45. package/bin/rewards/dtos/backoffice/RewardChargeToInput.js +1 -7
  46. package/bin/rewards/enums/DeliveryDimensionEnum.d.ts +8 -0
  47. package/bin/rewards/enums/DeliveryDimensionEnum.js +12 -0
  48. package/bin/rewards/enums/DeliveryTopByEnum.d.ts +5 -0
  49. package/bin/rewards/enums/DeliveryTopByEnum.js +9 -0
  50. package/bin/rewards/enums/DeliveryTopDimensionEnum.d.ts +7 -0
  51. package/bin/rewards/enums/DeliveryTopDimensionEnum.js +11 -0
  52. package/bin/rewards/index.d.ts +21 -0
  53. package/bin/rewards/index.js +21 -0
  54. package/package.json +1 -1
  55. package/src/rewards/constants/BackofficeLimits.ts +16 -0
  56. package/src/rewards/dtos/backoffice/BackofficeGrantAttemptResponse.ts +6 -0
  57. package/src/rewards/dtos/backoffice/BackofficeGrantItemResponse.ts +8 -0
  58. package/src/rewards/dtos/backoffice/BackofficeGrantResponse.ts +8 -0
  59. package/src/rewards/dtos/backoffice/ChargeListResponse.ts +7 -0
  60. package/src/rewards/dtos/backoffice/ChargeRecord.ts +18 -0
  61. package/src/rewards/dtos/backoffice/ChargesExportQuery.ts +5 -0
  62. package/src/rewards/dtos/backoffice/ChargesQuery.ts +7 -0
  63. package/src/rewards/dtos/backoffice/DeliveryMetricsPoint.ts +14 -0
  64. package/src/rewards/dtos/backoffice/DeliveryMetricsQuery.ts +10 -0
  65. package/src/rewards/dtos/backoffice/DeliveryTopEntry.ts +14 -0
  66. package/src/rewards/dtos/backoffice/DeliveryTopQuery.ts +12 -0
  67. package/src/rewards/dtos/backoffice/GrantListQuery.ts +23 -0
  68. package/src/rewards/dtos/backoffice/GrantListResponse.ts +6 -0
  69. package/src/rewards/dtos/backoffice/PartnerListResponse.ts +7 -0
  70. package/src/rewards/dtos/backoffice/PartnerRequest.ts +22 -0
  71. package/src/rewards/dtos/backoffice/PartnerResponse.ts +12 -0
  72. package/src/rewards/dtos/backoffice/PartnerSummary.ts +13 -0
  73. package/src/rewards/dtos/backoffice/PartnersSummaryQuery.ts +5 -0
  74. package/src/rewards/dtos/backoffice/RewardChargeToInput.ts +1 -6
  75. package/src/rewards/enums/DeliveryDimensionEnum.ts +8 -0
  76. package/src/rewards/enums/DeliveryTopByEnum.ts +5 -0
  77. package/src/rewards/enums/DeliveryTopDimensionEnum.ts +7 -0
  78. package/src/rewards/index.ts +21 -0
@@ -11,7 +11,7 @@ const catalog = {
11
11
  type: 'ExampleType',
12
12
  config: { amount: 50, nested: { list: [1, 2] } },
13
13
  cost: { amount: 50, currency: 'MXN' },
14
- chargeTo: { partnerId: 'ALIADO-001', partnerName: 'Aliado de ejemplo' },
14
+ chargeTo: { partnerId: 'ALIADO-001' },
15
15
  status: 'ACTIVE',
16
16
  };
17
17
  const pkg = { id: 'paquete-1', name: 'Paquete 1', status: 'ACTIVE', items: [{ itemKey: 'itemA', catalogItemId: 'example-reward-a' }] };
@@ -0,0 +1,21 @@
1
+ import 'reflect-metadata';
2
+ import { CurrencyId } from '../../../src/currency';
3
+ import { CHARGES_EXPORT_MAX_ROWS, CHARGES_MONTH_PATTERN } from '../../../src/rewards';
4
+ import type { ChargeListResponse, ChargeRecord, ChargesExportQuery, ChargesQuery } from '../../../src/rewards';
5
+
6
+ describe('contrato de cargos (D-C1)', () => {
7
+ it.each(['2026-01', '2026-12'])('acepta el mes %s', (m) => expect(CHARGES_MONTH_PATTERN.test(m)).toBe(true));
8
+ it.each(['2026-13', '2026-00', '26-10', '2026-1', '2026-10-01'])('rechaza el mes %s', (m) => expect(CHARGES_MONTH_PATTERN.test(m)).toBe(false));
9
+
10
+ it('tope del export y forma de ChargeRecord (con packageId, sin source)', () => {
11
+ const record: ChargeRecord = {
12
+ grantId: 'g', itemKey: 'a', grantedAt: 1, directoryId: 'd', catalogItemId: 'c', catalogItemName: 'Recarga', packageId: 'p',
13
+ cost: { amount: 10, currency: CurrencyId.MXN }, chargeTo: { partnerId: 'FIADO', partnerName: 'Fiado' },
14
+ };
15
+ const list: ChargeListResponse = { items: [record] };
16
+ const q: ChargesQuery = { partnerId: 'FIADO', month: '2026-10', limit: 10 };
17
+ const e: ChargesExportQuery = { partnerId: 'FIADO', month: '2026-10' };
18
+ expect([CHARGES_EXPORT_MAX_ROWS, list.items.length, q.month, e.partnerId]).toEqual([10000, 1, '2026-10', 'FIADO']);
19
+ expect('source' in record).toBe(false);
20
+ });
21
+ });
@@ -0,0 +1,25 @@
1
+ import 'reflect-metadata';
2
+ import {
3
+ DeliveryDimensionEnum, DeliveryTopByEnum, DeliveryTopDimensionEnum, METRICS_TAG_ALLOWLIST, METRICS_TAG_DIMENSION_PATTERN,
4
+ METRICS_TOP_LIMIT, METRICS_TOP_MAX_VALUES,
5
+ } from '../../../src/rewards';
6
+ import type { DeliveryMetricsPoint, DeliveryTopEntry } from '../../../src/rewards';
7
+ import { CurrencyId } from '../../../src/currency';
8
+
9
+ describe('contrato de métricas de entregas (D-D3)', () => {
10
+ it('constantes y enums del spec §4.3/§5.5', () => {
11
+ expect([METRICS_TOP_LIMIT, METRICS_TOP_MAX_VALUES]).toEqual([10, 200]);
12
+ expect(METRICS_TAG_ALLOWLIST).toEqual(['campaignId', 'evaluationId']);
13
+ expect(Object.values(DeliveryDimensionEnum)).toEqual(['ALL', 'PACKAGE', 'CATALOG_ITEM', 'PARTNER', 'SOURCE']);
14
+ expect(Object.values(DeliveryTopDimensionEnum)).toEqual(['PACKAGE', 'CATALOG_ITEM', 'PARTNER', 'SOURCE']);
15
+ expect(Object.values(DeliveryTopByEnum)).toEqual(['cost', 'count']);
16
+ });
17
+ it.each(['TAG#campaignId', 'TAG#evaluationId'])('acepta %s', (d) => expect(METRICS_TAG_DIMENSION_PATTERN.test(d)).toBe(true));
18
+ it.each(['TAG#userId', 'TAG#', 'tag#campaignId', 'TAG#campaignId#x'])('rechaza %s', (d) => expect(METRICS_TAG_DIMENSION_PATTERN.test(d)).toBe(false));
19
+
20
+ it('formas de punto y top', () => {
21
+ const p: DeliveryMetricsPoint = { date: '2026-10-08', currency: CurrencyId.MXN, granted: 1, failed: 0, skipped: 0, grantsCompleted: 1, grantsPartial: 0, grantsFailed: 0, costGranted: 10.5 };
22
+ const t: DeliveryTopEntry = { value: 'FIADO', label: 'Fiado', granted: 1, failed: 0, skipped: 0, cost: [{ amount: 10.5, currency: CurrencyId.MXN }] };
23
+ expect([p.costGranted, t.cost[0].amount]).toEqual([10.5, 10.5]);
24
+ });
25
+ });
@@ -0,0 +1,30 @@
1
+ import 'reflect-metadata';
2
+ import { GRANTS_DEFAULT_RANGE_DAYS, GRANTS_EXPORT_MAX_ROWS, GRANTS_MAX_RANGE_DAYS } from '../../../src/rewards';
3
+ import { CurrencyId } from '../../../src/currency';
4
+ import type { BackofficeGrantResponse, GrantListQuery, GrantListResponse } from '../../../src/rewards';
5
+ import { GrantItemStatusEnum, GrantStatusEnum, ItemErrorCategoryEnum, RewardStatusEnum } from '../../../src/rewards';
6
+
7
+ describe('contrato de entregas de backoffice (Fase 4)', () => {
8
+ it('expone los límites del spec §6', () => {
9
+ expect([GRANTS_MAX_RANGE_DAYS, GRANTS_DEFAULT_RANGE_DAYS, GRANTS_EXPORT_MAX_ROWS]).toEqual([92, 7, 5000]);
10
+ });
11
+
12
+ it('BackofficeGrantResponse extiende GrantResponse con name por ítem y message por intento', () => {
13
+ const grant: BackofficeGrantResponse = {
14
+ id: 'g1', directoryId: 'd1', packageId: 'p1', packageVersion: 1, packageName: 'Paquete',
15
+ source: { service: 'rewards-eligibility', reference: 'run-1' }, status: GrantStatusEnum.PARTIAL, createdAt: 1, updatedAt: 2,
16
+ items: [{
17
+ itemKey: 'a', catalogItemId: 'c', name: 'Recarga', status: GrantItemStatusEnum.FAILED,
18
+ chargeTo: { partnerId: 'FIADO', partnerName: 'Fiado' }, cost: { amount: 10, currency: CurrencyId.MXN }, attemptCount: 1,
19
+ attempts: [{ attempt: 1, startedAt: 1, finishedAt: 2, errorCategory: ItemErrorCategoryEnum.PROVIDER_REJECTED, message: 'El proveedor rechazó la operación' }],
20
+ }],
21
+ };
22
+ expect(grant.items[0].attempts[0].message).toContain('proveedor');
23
+ });
24
+
25
+ it('GrantListQuery admite los filtros nuevos D-F1', () => {
26
+ const q: GrantListQuery = { status: 'PARTIAL,FAILED', catalogItemId: 'reward-a', errorCategory: ItemErrorCategoryEnum.INTERNAL_ERROR, search: 'abc', limit: 20 };
27
+ const res: GrantListResponse = { items: [] };
28
+ expect([q.catalogItemId, res.items.length, RewardStatusEnum.ACTIVE]).toEqual(['reward-a', 0, 'ACTIVE']);
29
+ });
30
+ });
@@ -0,0 +1,47 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import type { JsonValue } from '../../../src/common';
5
+ import { CatalogItemRequest, PartnerRequest, RewardChargeToInput } from '../../../src/rewards';
6
+
7
+ const partner = { id: 'telcel-mx', name: 'Telcel México', status: 'ACTIVE' };
8
+ const asPartner = (o: Record<string, JsonValue> = {}): PartnerRequest =>
9
+ plainToInstance(PartnerRequest, { ...partner, ...o }, { excludeExtraneousValues: true });
10
+ const props = async (dto: object): Promise<string[]> => (await validate(dto)).map((e) => e.property);
11
+
12
+ describe('PartnerRequest', () => {
13
+ it('valida un aliado correcto', async () => {
14
+ expect(await validate(asPartner())).toHaveLength(0);
15
+ });
16
+
17
+ it.each<[string, Record<string, JsonValue>, string]>([
18
+ ['id con espacios', { id: 'con espacio' }, 'id'],
19
+ ['id con #', { id: 'a#b' }, 'id'],
20
+ ['id vacío', { id: '' }, 'id'],
21
+ ['id de 65 caracteres', { id: 'x'.repeat(65) }, 'id'],
22
+ ['name vacío', { name: '' }, 'name'],
23
+ ['name > 120', { name: 'x'.repeat(121) }, 'name'],
24
+ ['status desconocido', { status: 'BORRADO' }, 'status'],
25
+ ])('rechaza %s', async (_label, override, property) => {
26
+ expect(await props(asPartner(override))).toContain(property);
27
+ });
28
+ });
29
+
30
+ describe('RewardChargeToInput (D-A2: el operador ya no escribe partnerName)', () => {
31
+ it('solo expone partnerId y descarta partnerName del cliente', () => {
32
+ const dto = plainToInstance(RewardChargeToInput, { partnerId: 'telcel-mx', partnerName: 'Falso' }, { excludeExtraneousValues: true });
33
+ expect(dto).toEqual({ partnerId: 'telcel-mx' });
34
+ });
35
+
36
+ it('CatalogItemRequest valida sin partnerName', async () => {
37
+ const dto = plainToInstance(
38
+ CatalogItemRequest,
39
+ {
40
+ id: 'r-a', name: 'A', description: 'd', type: 'T', config: {}, cost: { amount: 1, currency: 'MXN' },
41
+ chargeTo: { partnerId: 'FIADO' }, status: 'ACTIVE',
42
+ },
43
+ { excludeExtraneousValues: true },
44
+ );
45
+ expect(await validate(dto)).toHaveLength(0);
46
+ });
47
+ });
@@ -4,3 +4,16 @@ export declare const REWARD_ITEM_KEY_PATTERN: RegExp;
4
4
  export declare const REWARD_ID_PATTERN: RegExp;
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 declare const REWARD_PACKAGE_MAX_ITEMS = 4;
7
+ /** Entregas de backoffice (Fase 4): ventana máxima del listado, default y tope del CSV. */
8
+ export declare const GRANTS_MAX_RANGE_DAYS = 92;
9
+ export declare const GRANTS_DEFAULT_RANGE_DAYS = 7;
10
+ export declare const GRANTS_EXPORT_MAX_ROWS = 5000;
11
+ /** Cierre mensual por aliado (D-C1): tope del CSV y formato de `month` (UTC). */
12
+ export declare const CHARGES_EXPORT_MAX_ROWS = 10000;
13
+ export declare const CHARGES_MONTH_PATTERN: RegExp;
14
+ /** Métricas de entregas (D-D3): top de 10, máximo 200 valores por dimensión, y etiquetas permitidas. */
15
+ export declare const METRICS_TOP_LIMIT = 10;
16
+ export declare const METRICS_TOP_MAX_VALUES = 200;
17
+ /** Etiquetas permitidas en métricas (D-D3b): una llave libre tendría cardinalidad ilimitada. */
18
+ export declare const METRICS_TAG_ALLOWLIST: readonly string[];
19
+ export declare const METRICS_TAG_DIMENSION_PATTERN: RegExp;
@@ -1,9 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REWARD_PACKAGE_MAX_ITEMS = exports.REWARD_ID_PATTERN = exports.REWARD_ITEM_KEY_PATTERN = exports.REWARD_ITEM_KEY_MAX_LENGTH = void 0;
3
+ exports.METRICS_TAG_DIMENSION_PATTERN = exports.METRICS_TAG_ALLOWLIST = exports.METRICS_TOP_MAX_VALUES = exports.METRICS_TOP_LIMIT = exports.CHARGES_MONTH_PATTERN = exports.CHARGES_EXPORT_MAX_ROWS = exports.GRANTS_EXPORT_MAX_ROWS = exports.GRANTS_DEFAULT_RANGE_DAYS = exports.GRANTS_MAX_RANGE_DAYS = exports.REWARD_PACKAGE_MAX_ITEMS = exports.REWARD_ID_PATTERN = exports.REWARD_ITEM_KEY_PATTERN = exports.REWARD_ITEM_KEY_MAX_LENGTH = void 0;
4
4
  /** Máximo del `itemKey` de un paquete: `RW-{grantId(32)}-{itemKey}` ≤ 64 (igual que REWARDS_MAX_ITEM_KEY_LENGTH de api-invoker). */
5
5
  exports.REWARD_ITEM_KEY_MAX_LENGTH = 28;
6
6
  exports.REWARD_ITEM_KEY_PATTERN = new RegExp(`^[A-Za-z0-9_-]{1,${exports.REWARD_ITEM_KEY_MAX_LENGTH}}$`);
7
7
  exports.REWARD_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
8
8
  /** 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. */
9
9
  exports.REWARD_PACKAGE_MAX_ITEMS = 4;
10
+ /** Entregas de backoffice (Fase 4): ventana máxima del listado, default y tope del CSV. */
11
+ exports.GRANTS_MAX_RANGE_DAYS = 92;
12
+ exports.GRANTS_DEFAULT_RANGE_DAYS = 7;
13
+ exports.GRANTS_EXPORT_MAX_ROWS = 5000;
14
+ /** Cierre mensual por aliado (D-C1): tope del CSV y formato de `month` (UTC). */
15
+ exports.CHARGES_EXPORT_MAX_ROWS = 10000;
16
+ exports.CHARGES_MONTH_PATTERN = /^\d{4}-(0[1-9]|1[0-2])$/;
17
+ /** Métricas de entregas (D-D3): top de 10, máximo 200 valores por dimensión, y etiquetas permitidas. */
18
+ exports.METRICS_TOP_LIMIT = 10;
19
+ exports.METRICS_TOP_MAX_VALUES = 200;
20
+ /** Etiquetas permitidas en métricas (D-D3b): una llave libre tendría cardinalidad ilimitada. */
21
+ exports.METRICS_TAG_ALLOWLIST = ['campaignId', 'evaluationId'];
22
+ exports.METRICS_TAG_DIMENSION_PATTERN = /^TAG#(campaignId|evaluationId)$/;
@@ -0,0 +1,5 @@
1
+ import { GrantAttemptResponse } from '../responses/GrantAttemptResponse';
2
+ export declare class BackofficeGrantAttemptResponse extends GrantAttemptResponse {
3
+ /** Texto corto sin PII, mapeado desde `errorCategory`. */
4
+ message?: string;
5
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BackofficeGrantAttemptResponse = void 0;
4
+ const GrantAttemptResponse_1 = require("../responses/GrantAttemptResponse");
5
+ class BackofficeGrantAttemptResponse extends GrantAttemptResponse_1.GrantAttemptResponse {
6
+ }
7
+ exports.BackofficeGrantAttemptResponse = BackofficeGrantAttemptResponse;
@@ -0,0 +1,7 @@
1
+ import { GrantItemResponse } from '../responses/GrantItemResponse';
2
+ import { BackofficeGrantAttemptResponse } from './BackofficeGrantAttemptResponse';
3
+ export declare class BackofficeGrantItemResponse extends GrantItemResponse {
4
+ /** Nombre de la recompensa congelada en la entrega. */
5
+ name: string;
6
+ attempts: BackofficeGrantAttemptResponse[];
7
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BackofficeGrantItemResponse = void 0;
4
+ const GrantItemResponse_1 = require("../responses/GrantItemResponse");
5
+ class BackofficeGrantItemResponse extends GrantItemResponse_1.GrantItemResponse {
6
+ }
7
+ exports.BackofficeGrantItemResponse = BackofficeGrantItemResponse;
@@ -0,0 +1,7 @@
1
+ import { GrantResponse } from '../responses/GrantResponse';
2
+ import { BackofficeGrantItemResponse } from './BackofficeGrantItemResponse';
3
+ /** Sin `directoryName`: Directory no trae un campo de nombre confiable (Q2). Sin `requestSnapshot`/`providerResponse` (R2). */
4
+ export declare class BackofficeGrantResponse extends GrantResponse {
5
+ packageName?: string;
6
+ items: BackofficeGrantItemResponse[];
7
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BackofficeGrantResponse = void 0;
4
+ const GrantResponse_1 = require("../responses/GrantResponse");
5
+ /** Sin `directoryName`: Directory no trae un campo de nombre confiable (Q2). Sin `requestSnapshot`/`providerResponse` (R2). */
6
+ class BackofficeGrantResponse extends GrantResponse_1.GrantResponse {
7
+ }
8
+ exports.BackofficeGrantResponse = BackofficeGrantResponse;
@@ -0,0 +1,6 @@
1
+ import { ChargeRecord } from './ChargeRecord';
2
+ export declare class ChargeListResponse {
3
+ items: ChargeRecord[];
4
+ /** Cursor opaco de la página siguiente; ausente en la última página. */
5
+ nextCursor?: string;
6
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChargeListResponse = void 0;
4
+ class ChargeListResponse {
5
+ }
6
+ exports.ChargeListResponse = ChargeListResponse;
@@ -0,0 +1,17 @@
1
+ import { RewardChargeTo } from '../RewardChargeTo';
2
+ import { RewardCost } from '../RewardCost';
3
+ /** 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). */
4
+ export declare class ChargeRecord {
5
+ grantId: string;
6
+ itemKey: string;
7
+ /** Epoch en milisegundos (UTC). */
8
+ grantedAt: number;
9
+ directoryId: string;
10
+ catalogItemId: string;
11
+ catalogItemName: string;
12
+ campaignId?: string;
13
+ packageId: string;
14
+ cost: RewardCost;
15
+ chargeTo: RewardChargeTo;
16
+ externalRef?: Record<string, string>;
17
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChargeRecord = void 0;
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
+ class ChargeRecord {
6
+ }
7
+ exports.ChargeRecord = ChargeRecord;
@@ -0,0 +1,5 @@
1
+ /** Query params ya validados de `GET /charges/export`. `month` = `AAAA-MM` UTC. */
2
+ export declare class ChargesExportQuery {
3
+ partnerId: string;
4
+ month: string;
5
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChargesExportQuery = void 0;
4
+ /** Query params ya validados de `GET /charges/export`. `month` = `AAAA-MM` UTC. */
5
+ class ChargesExportQuery {
6
+ }
7
+ exports.ChargesExportQuery = ChargesExportQuery;
@@ -0,0 +1,7 @@
1
+ /** Query params ya validados de `GET /charges`. `month` = `AAAA-MM` UTC. */
2
+ export declare class ChargesQuery {
3
+ partnerId: string;
4
+ month: string;
5
+ limit?: number;
6
+ cursor?: string;
7
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChargesQuery = void 0;
4
+ /** Query params ya validados de `GET /charges`. `month` = `AAAA-MM` UTC. */
5
+ class ChargesQuery {
6
+ }
7
+ exports.ChargesQuery = ChargesQuery;
@@ -0,0 +1,13 @@
1
+ import { CurrencyId } from '../../../currency';
2
+ /** Un punto de la serie diaria. `date` = `AAAA-MM-DD` UTC. `costGranted` = `costGrantedMinor / 100` (nunca se suman monedas distintas). */
3
+ export declare class DeliveryMetricsPoint {
4
+ date: string;
5
+ currency: CurrencyId;
6
+ granted: number;
7
+ failed: number;
8
+ skipped: number;
9
+ grantsCompleted: number;
10
+ grantsPartial: number;
11
+ grantsFailed: number;
12
+ costGranted: number;
13
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeliveryMetricsPoint = void 0;
4
+ /** Un punto de la serie diaria. `date` = `AAAA-MM-DD` UTC. `costGranted` = `costGrantedMinor / 100` (nunca se suman monedas distintas). */
5
+ class DeliveryMetricsPoint {
6
+ }
7
+ exports.DeliveryMetricsPoint = DeliveryMetricsPoint;
@@ -0,0 +1,9 @@
1
+ import { CurrencyId } from '../../../currency';
2
+ /** Query params ya validados de `GET /metrics/deliveries`. `dimension` es un `DeliveryDimensionEnum` o `TAG#campaignId|TAG#evaluationId`. `from`/`to` = `AAAA-MM-DD` UTC. */
3
+ export declare class DeliveryMetricsQuery {
4
+ dimension: string;
5
+ value?: string;
6
+ from: string;
7
+ to: string;
8
+ currency?: CurrencyId;
9
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeliveryMetricsQuery = void 0;
4
+ /** Query params ya validados de `GET /metrics/deliveries`. `dimension` es un `DeliveryDimensionEnum` o `TAG#campaignId|TAG#evaluationId`. `from`/`to` = `AAAA-MM-DD` UTC. */
5
+ class DeliveryMetricsQuery {
6
+ }
7
+ exports.DeliveryMetricsQuery = DeliveryMetricsQuery;
@@ -0,0 +1,16 @@
1
+ import { ItemErrorCategoryEnum } from '../../enums/ItemErrorCategoryEnum';
2
+ import { RewardCost } from '../RewardCost';
3
+ /** Una fila del top de métricas. `errors` solo viene en la dimensión `CATALOG_ITEM`. */
4
+ export declare class DeliveryTopEntry {
5
+ value: string;
6
+ label: string;
7
+ granted: number;
8
+ failed: number;
9
+ skipped: number;
10
+ /** Un costo por moneda; las monedas no se suman entre sí. */
11
+ cost: RewardCost[];
12
+ errors?: {
13
+ category: ItemErrorCategoryEnum;
14
+ count: number;
15
+ }[];
16
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeliveryTopEntry = void 0;
4
+ /** Una fila del top de métricas. `errors` solo viene en la dimensión `CATALOG_ITEM`. */
5
+ class DeliveryTopEntry {
6
+ }
7
+ exports.DeliveryTopEntry = DeliveryTopEntry;
@@ -0,0 +1,11 @@
1
+ import { CurrencyId } from '../../../currency';
2
+ import { DeliveryTopByEnum } from '../../enums/DeliveryTopByEnum';
3
+ import { DeliveryTopDimensionEnum } from '../../enums/DeliveryTopDimensionEnum';
4
+ /** Query params ya validados de `GET /metrics/deliveries/top`. `from`/`to` = `AAAA-MM-DD` UTC. */
5
+ export declare class DeliveryTopQuery {
6
+ dimension: DeliveryTopDimensionEnum;
7
+ from: string;
8
+ to: string;
9
+ by: DeliveryTopByEnum;
10
+ currency?: CurrencyId;
11
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeliveryTopQuery = void 0;
4
+ /** Query params ya validados de `GET /metrics/deliveries/top`. `from`/`to` = `AAAA-MM-DD` UTC. */
5
+ class DeliveryTopQuery {
6
+ }
7
+ exports.DeliveryTopQuery = DeliveryTopQuery;
@@ -0,0 +1,22 @@
1
+ import { ItemErrorCategoryEnum } from '../../enums/ItemErrorCategoryEnum';
2
+ /** Query params ya validados de `GET /grants` y `GET /grants/export` (el lambda los valida; ver `GrantListQueryHelper`). */
3
+ export declare class GrantListQuery {
4
+ limit?: number;
5
+ cursor?: string;
6
+ /** Uno o varios `GrantStatusEnum` separados por coma. */
7
+ status?: string;
8
+ packageId?: string;
9
+ campaignId?: string;
10
+ service?: string;
11
+ partnerId?: string;
12
+ directoryId?: string;
13
+ /** Coincide con un `id` de entrega; si no, se trata como `directoryId`. Sin búsqueda por nombre. */
14
+ search?: string;
15
+ /** `AAAA-MM-DD` UTC, inclusivos. Default: `to` = hoy, `from` = `to − 6`. Máximo 92 días. */
16
+ from?: string;
17
+ to?: string;
18
+ /** Entregas que contienen esta recompensa del catálogo (D-F1). */
19
+ catalogItemId?: string;
20
+ /** Entregas con al menos un ítem FAILED cuyo último intento falló con esta categoría (D-F1). */
21
+ errorCategory?: ItemErrorCategoryEnum;
22
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GrantListQuery = void 0;
4
+ /** Query params ya validados de `GET /grants` y `GET /grants/export` (el lambda los valida; ver `GrantListQueryHelper`). */
5
+ class GrantListQuery {
6
+ }
7
+ exports.GrantListQuery = GrantListQuery;
@@ -0,0 +1,5 @@
1
+ import { BackofficeGrantResponse } from './BackofficeGrantResponse';
2
+ export declare class GrantListResponse {
3
+ items: BackofficeGrantResponse[];
4
+ nextCursor?: string;
5
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GrantListResponse = void 0;
4
+ class GrantListResponse {
5
+ }
6
+ exports.GrantListResponse = GrantListResponse;
@@ -0,0 +1,6 @@
1
+ import { PartnerResponse } from './PartnerResponse';
2
+ export declare class PartnerListResponse {
3
+ items: PartnerResponse[];
4
+ /** Cursor opaco de la página siguiente; ausente en la última página. */
5
+ nextCursor?: string;
6
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PartnerListResponse = void 0;
4
+ class PartnerListResponse {
5
+ }
6
+ exports.PartnerListResponse = PartnerListResponse;
@@ -0,0 +1,7 @@
1
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
2
+ /** Crear (POST) o reemplazar (PUT) un aliado. `version` y `updatedBy` los pone el servidor. El `id` lo genera el front del nombre. */
3
+ export declare class PartnerRequest {
4
+ id: string;
5
+ name: string;
6
+ status: RewardStatusEnum;
7
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PartnerRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const BackofficeLimits_1 = require("../../constants/BackofficeLimits");
16
+ const RewardStatusEnum_1 = require("../../enums/RewardStatusEnum");
17
+ /** Crear (POST) o reemplazar (PUT) un aliado. `version` y `updatedBy` los pone el servidor. El `id` lo genera el front del nombre. */
18
+ class PartnerRequest {
19
+ }
20
+ exports.PartnerRequest = PartnerRequest;
21
+ __decorate([
22
+ (0, class_transformer_1.Expose)(),
23
+ (0, class_validator_1.IsString)(),
24
+ (0, class_validator_1.Matches)(BackofficeLimits_1.REWARD_ID_PATTERN),
25
+ __metadata("design:type", String)
26
+ ], PartnerRequest.prototype, "id", void 0);
27
+ __decorate([
28
+ (0, class_transformer_1.Expose)(),
29
+ (0, class_validator_1.IsString)(),
30
+ (0, class_validator_1.IsNotEmpty)(),
31
+ (0, class_validator_1.MaxLength)(120),
32
+ __metadata("design:type", String)
33
+ ], PartnerRequest.prototype, "name", void 0);
34
+ __decorate([
35
+ (0, class_transformer_1.Expose)(),
36
+ (0, class_validator_1.IsEnum)(RewardStatusEnum_1.RewardStatusEnum),
37
+ __metadata("design:type", String)
38
+ ], PartnerRequest.prototype, "status", void 0);
@@ -0,0 +1,11 @@
1
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
2
+ export declare class PartnerResponse {
3
+ id: string;
4
+ name: string;
5
+ status: RewardStatusEnum;
6
+ version: number;
7
+ /** Epoch en milisegundos. */
8
+ createdAt: number;
9
+ updatedAt: number;
10
+ updatedBy: string;
11
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PartnerResponse = void 0;
4
+ class PartnerResponse {
5
+ }
6
+ exports.PartnerResponse = PartnerResponse;
@@ -0,0 +1,12 @@
1
+ import { RewardCost } from '../RewardCost';
2
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
3
+ /** Un aliado con sus recompensas cobradas y el valor entregado en el rango (`GET /partners/summary`). */
4
+ export declare class PartnerSummary {
5
+ partnerId: string;
6
+ partnerName: string;
7
+ status: RewardStatusEnum;
8
+ /** Recompensas del catálogo que se le cobran a este aliado. */
9
+ catalogItemIds: string[];
10
+ /** Valor entregado en el rango, POR MONEDA (nunca se mezclan). Vacío si no hubo entregas. */
11
+ delivered: RewardCost[];
12
+ }
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.519.0",
3
+ "version": "3.520.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -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';