@fiado/type-kit 3.188.0 → 3.190.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 (127) hide show
  1. package/bin/index.d.ts +2 -0
  2. package/bin/index.js +7 -1
  3. package/bin/loanConfig/dtos/Parameter.d.ts +0 -2
  4. package/bin/loanConfig/dtos/Parameter.js +0 -6
  5. package/bin/loanConfig/dtos/responses/ParameterResponse.d.ts +0 -2
  6. package/bin/loanConfig/index.d.ts +0 -1
  7. package/bin/loanConfig/index.js +0 -1
  8. package/bin/retailCards/dtos/requests/AssignCardRequest.d.ts +6 -0
  9. package/bin/retailCards/dtos/requests/AssignCardRequest.js +30 -0
  10. package/bin/retailCards/dtos/requests/CancelCardRequest.d.ts +5 -0
  11. package/bin/retailCards/dtos/requests/CancelCardRequest.js +22 -0
  12. package/bin/retailCards/dtos/requests/RegisterCardBatchRequest.d.ts +7 -0
  13. package/bin/retailCards/dtos/requests/RegisterCardBatchRequest.js +38 -0
  14. package/bin/retailCards/dtos/responses/CardBatchResponse.d.ts +17 -0
  15. package/bin/retailCards/dtos/responses/CardBatchResponse.js +2 -0
  16. package/bin/retailCards/dtos/responses/RetailCardResponse.d.ts +12 -0
  17. package/bin/retailCards/dtos/responses/RetailCardResponse.js +2 -0
  18. package/bin/retailCards/dtos/responses/StockAlertItem.d.ts +7 -0
  19. package/bin/retailCards/dtos/responses/StockAlertItem.js +2 -0
  20. package/bin/retailCards/dtos/responses/StockAlertsResponse.d.ts +5 -0
  21. package/bin/retailCards/dtos/responses/StockAlertsResponse.js +2 -0
  22. package/bin/retailCards/enums/CardBatchStatusEnum.d.ts +17 -0
  23. package/bin/retailCards/enums/CardBatchStatusEnum.js +21 -0
  24. package/bin/retailCards/enums/CardCancelReasonEnum.d.ts +13 -0
  25. package/bin/retailCards/enums/CardCancelReasonEnum.js +17 -0
  26. package/bin/retailCards/enums/RetailCardStatusEnum.d.ts +13 -0
  27. package/bin/retailCards/enums/RetailCardStatusEnum.js +17 -0
  28. package/bin/retailCards/events/CardBatchReceivedV1.d.ts +9 -0
  29. package/bin/retailCards/events/CardBatchReceivedV1.js +2 -0
  30. package/bin/retailCards/events/RetailCardAssignedV1.d.ts +10 -0
  31. package/bin/retailCards/events/RetailCardAssignedV1.js +2 -0
  32. package/bin/retailCards/events/RetailCardCancelledV1.d.ts +9 -0
  33. package/bin/retailCards/events/RetailCardCancelledV1.js +2 -0
  34. package/bin/retailCards/events/RetailCardReleasedV1.d.ts +7 -0
  35. package/bin/retailCards/events/RetailCardReleasedV1.js +2 -0
  36. package/bin/retailCards/index.d.ts +14 -0
  37. package/bin/retailCards/index.js +33 -0
  38. package/bin/retailCatalog/constants/SkuPattern.d.ts +2 -0
  39. package/bin/retailCatalog/constants/SkuPattern.js +5 -0
  40. package/bin/retailCatalog/dtos/InventoryItem.d.ts +20 -0
  41. package/bin/retailCatalog/dtos/InventoryItem.js +11 -0
  42. package/bin/retailCatalog/dtos/Product.d.ts +34 -0
  43. package/bin/retailCatalog/dtos/Product.js +11 -0
  44. package/bin/retailCatalog/dtos/requests/ChangeInventoryStatusRequest.d.ts +8 -0
  45. package/bin/retailCatalog/dtos/requests/ChangeInventoryStatusRequest.js +25 -0
  46. package/bin/retailCatalog/dtos/requests/CreateProductRequest.d.ts +22 -0
  47. package/bin/retailCatalog/dtos/requests/CreateProductRequest.js +98 -0
  48. package/bin/retailCatalog/dtos/requests/ListProductsQuery.d.ts +9 -0
  49. package/bin/retailCatalog/dtos/requests/ListProductsQuery.js +39 -0
  50. package/bin/retailCatalog/dtos/requests/RegisterInventoryRequest.d.ts +5 -0
  51. package/bin/retailCatalog/dtos/requests/RegisterInventoryRequest.js +27 -0
  52. package/bin/retailCatalog/dtos/requests/TransferInventoryRequest.d.ts +4 -0
  53. package/bin/retailCatalog/dtos/requests/TransferInventoryRequest.js +21 -0
  54. package/bin/retailCatalog/dtos/requests/UpdateProductRequest.d.ts +21 -0
  55. package/bin/retailCatalog/dtos/requests/UpdateProductRequest.js +100 -0
  56. package/bin/retailCatalog/dtos/requests/UpdateProductStatusRequest.d.ts +5 -0
  57. package/bin/retailCatalog/dtos/requests/UpdateProductStatusRequest.js +22 -0
  58. package/bin/retailCatalog/dtos/responses/ImportCsvFailure.d.ts +5 -0
  59. package/bin/retailCatalog/dtos/responses/ImportCsvFailure.js +7 -0
  60. package/bin/retailCatalog/dtos/responses/ImportCsvResult.d.ts +6 -0
  61. package/bin/retailCatalog/dtos/responses/ImportCsvResult.js +7 -0
  62. package/bin/retailCatalog/dtos/responses/InventoryItemResponse.d.ts +3 -0
  63. package/bin/retailCatalog/dtos/responses/InventoryItemResponse.js +2 -0
  64. package/bin/retailCatalog/dtos/responses/ProductResponse.d.ts +3 -0
  65. package/bin/retailCatalog/dtos/responses/ProductResponse.js +2 -0
  66. package/bin/retailCatalog/dtos/validation/ValidateInventoryResponse.d.ts +11 -0
  67. package/bin/retailCatalog/dtos/validation/ValidateInventoryResponse.js +10 -0
  68. package/bin/retailCatalog/dtos/validation/ValidateProductResponse.d.ts +20 -0
  69. package/bin/retailCatalog/dtos/validation/ValidateProductResponse.js +11 -0
  70. package/bin/retailCatalog/enums/InventoryItemStatusEnum.d.ts +18 -0
  71. package/bin/retailCatalog/enums/InventoryItemStatusEnum.js +22 -0
  72. package/bin/retailCatalog/enums/MdmLockModeEnum.d.ts +17 -0
  73. package/bin/retailCatalog/enums/MdmLockModeEnum.js +21 -0
  74. package/bin/retailCatalog/enums/MdmProviderEnum.d.ts +11 -0
  75. package/bin/retailCatalog/enums/MdmProviderEnum.js +15 -0
  76. package/bin/retailCatalog/enums/ProductStatusEnum.d.ts +13 -0
  77. package/bin/retailCatalog/enums/ProductStatusEnum.js +17 -0
  78. package/bin/retailCatalog/enums/ProductTierEnum.d.ts +15 -0
  79. package/bin/retailCatalog/enums/ProductTierEnum.js +19 -0
  80. package/bin/retailCatalog/index.d.ts +22 -0
  81. package/bin/retailCatalog/index.js +44 -0
  82. package/bin/retailCatalog/validators/IsMdmCoherentConstraint.d.ts +10 -0
  83. package/bin/retailCatalog/validators/IsMdmCoherentConstraint.js +31 -0
  84. package/package.json +1 -1
  85. package/src/index.ts +6 -0
  86. package/src/loanConfig/dtos/Parameter.ts +0 -5
  87. package/src/loanConfig/dtos/responses/ParameterResponse.ts +0 -2
  88. package/src/loanConfig/index.ts +0 -1
  89. package/src/retailCards/dtos/requests/AssignCardRequest.ts +14 -0
  90. package/src/retailCards/dtos/requests/CancelCardRequest.ts +8 -0
  91. package/src/retailCards/dtos/requests/RegisterCardBatchRequest.ts +21 -0
  92. package/src/retailCards/dtos/responses/CardBatchResponse.ts +18 -0
  93. package/src/retailCards/dtos/responses/RetailCardResponse.ts +13 -0
  94. package/src/retailCards/dtos/responses/StockAlertItem.ts +7 -0
  95. package/src/retailCards/dtos/responses/StockAlertsResponse.ts +6 -0
  96. package/src/retailCards/enums/CardBatchStatusEnum.ts +17 -0
  97. package/src/retailCards/enums/CardCancelReasonEnum.ts +13 -0
  98. package/src/retailCards/enums/RetailCardStatusEnum.ts +13 -0
  99. package/src/retailCards/events/CardBatchReceivedV1.ts +9 -0
  100. package/src/retailCards/events/RetailCardAssignedV1.ts +10 -0
  101. package/src/retailCards/events/RetailCardCancelledV1.ts +10 -0
  102. package/src/retailCards/events/RetailCardReleasedV1.ts +7 -0
  103. package/src/retailCards/index.ts +20 -0
  104. package/src/retailCatalog/constants/SkuPattern.ts +2 -0
  105. package/src/retailCatalog/dtos/InventoryItem.ts +21 -0
  106. package/src/retailCatalog/dtos/Product.ts +35 -0
  107. package/src/retailCatalog/dtos/requests/ChangeInventoryStatusRequest.ts +11 -0
  108. package/src/retailCatalog/dtos/requests/CreateProductRequest.ts +81 -0
  109. package/src/retailCatalog/dtos/requests/ListProductsQuery.ts +22 -0
  110. package/src/retailCatalog/dtos/requests/RegisterInventoryRequest.ts +12 -0
  111. package/src/retailCatalog/dtos/requests/TransferInventoryRequest.ts +7 -0
  112. package/src/retailCatalog/dtos/requests/UpdateProductRequest.ts +82 -0
  113. package/src/retailCatalog/dtos/requests/UpdateProductStatusRequest.ts +8 -0
  114. package/src/retailCatalog/dtos/responses/ImportCsvFailure.ts +5 -0
  115. package/src/retailCatalog/dtos/responses/ImportCsvResult.ts +7 -0
  116. package/src/retailCatalog/dtos/responses/InventoryItemResponse.ts +4 -0
  117. package/src/retailCatalog/dtos/responses/ProductResponse.ts +4 -0
  118. package/src/retailCatalog/dtos/validation/ValidateInventoryResponse.ts +12 -0
  119. package/src/retailCatalog/dtos/validation/ValidateProductResponse.ts +21 -0
  120. package/src/retailCatalog/enums/InventoryItemStatusEnum.ts +18 -0
  121. package/src/retailCatalog/enums/MdmLockModeEnum.ts +17 -0
  122. package/src/retailCatalog/enums/MdmProviderEnum.ts +11 -0
  123. package/src/retailCatalog/enums/ProductStatusEnum.ts +13 -0
  124. package/src/retailCatalog/enums/ProductTierEnum.ts +15 -0
  125. package/src/retailCatalog/index.ts +34 -0
  126. package/src/retailCatalog/validators/IsMdmCoherentConstraint.ts +25 -0
  127. package/src/loanConfig/enums/ModifiableByRoleEnum.ts +0 -11
@@ -0,0 +1,82 @@
1
+ import {
2
+ IsArray,
3
+ IsBoolean,
4
+ IsEnum,
5
+ IsInt,
6
+ IsObject,
7
+ IsOptional,
8
+ IsString,
9
+ Min,
10
+ Validate,
11
+ } from 'class-validator';
12
+ import { MdmLockModeEnum } from '../../enums/MdmLockModeEnum';
13
+ import { MdmProviderEnum } from '../../enums/MdmProviderEnum';
14
+ import { ProductTierEnum } from '../../enums/ProductTierEnum';
15
+ import { IsMdmCoherentConstraint } from '../../validators/IsMdmCoherentConstraint';
16
+
17
+ /** Body de PUT /retailers/:retailerId/products/:sku — actualización parcial (sku y status son inmutables acá). */
18
+ export class UpdateProductRequest {
19
+ @IsOptional()
20
+ @IsString()
21
+ externalId?: string | null;
22
+
23
+ @IsOptional()
24
+ @IsString()
25
+ brand?: string;
26
+
27
+ @IsOptional()
28
+ @IsString()
29
+ model?: string;
30
+
31
+ @IsOptional()
32
+ @IsString()
33
+ capacity?: string;
34
+
35
+ @IsOptional()
36
+ @IsString()
37
+ color?: string;
38
+
39
+ @IsOptional()
40
+ @IsString()
41
+ description?: string;
42
+
43
+ @IsOptional()
44
+ @IsObject()
45
+ specs?: Record<string, unknown> | null;
46
+
47
+ @IsOptional()
48
+ @IsString()
49
+ imageUrl?: string | null;
50
+
51
+ @IsOptional()
52
+ @IsEnum(ProductTierEnum)
53
+ tier?: ProductTierEnum;
54
+
55
+ @IsOptional()
56
+ @IsInt()
57
+ @Min(0)
58
+ basePriceCents?: number;
59
+
60
+ @IsOptional()
61
+ @IsInt()
62
+ @Min(0)
63
+ listPriceCents?: number | null;
64
+
65
+ @IsOptional()
66
+ @IsArray()
67
+ @IsString({ each: true })
68
+ eligibleFinanciers?: string[];
69
+
70
+ @Validate(IsMdmCoherentConstraint)
71
+ @IsOptional()
72
+ @IsBoolean()
73
+ mdmEnabled?: boolean;
74
+
75
+ @IsOptional()
76
+ @IsEnum(MdmProviderEnum)
77
+ mdmProvider?: MdmProviderEnum | null;
78
+
79
+ @IsOptional()
80
+ @IsEnum(MdmLockModeEnum)
81
+ mdmLockMode?: MdmLockModeEnum | null;
82
+ }
@@ -0,0 +1,8 @@
1
+ import { IsEnum } from 'class-validator';
2
+ import { ProductStatusEnum } from '../../enums/ProductStatusEnum';
3
+
4
+ /** Body de PUT /retailers/:retailerId/products/:sku/status — ACTIVE | DISCONTINUED. */
5
+ export class UpdateProductStatusRequest {
6
+ @IsEnum(ProductStatusEnum)
7
+ status!: ProductStatusEnum;
8
+ }
@@ -0,0 +1,5 @@
1
+ /** Detalle de una fila rechazada en la carga CSV de productos. */
2
+ export class ImportCsvFailure {
3
+ fila!: number;
4
+ motivo!: string;
5
+ }
@@ -0,0 +1,7 @@
1
+ import { ImportCsvFailure } from './ImportCsvFailure';
2
+
3
+ /** Response de POST /retailers/:retailerId/products/import-csv — resultado de la carga masiva. */
4
+ export class ImportCsvResult {
5
+ committed!: string[];
6
+ failed!: ImportCsvFailure[];
7
+ }
@@ -0,0 +1,4 @@
1
+ import { InventoryItem } from '../InventoryItem';
2
+
3
+ /** Response de los endpoints de inventario (= entidad InventoryItem). */
4
+ export type InventoryItemResponse = InventoryItem;
@@ -0,0 +1,4 @@
1
+ import { Product } from '../Product';
2
+
3
+ /** Response de los endpoints de producto (= entidad Product). */
4
+ export type ProductResponse = Product;
@@ -0,0 +1,12 @@
1
+ import { InventoryItemStatusEnum } from '../../enums/InventoryItemStatusEnum';
2
+
3
+ /**
4
+ * Response de GET /private/inventory/:imei — validar IMEI + status + store + producto.
5
+ * Shape de salida → sin class-validator.
6
+ */
7
+ export class ValidateInventoryResponse {
8
+ imei!: string;
9
+ status!: InventoryItemStatusEnum;
10
+ storeId!: string;
11
+ productId!: string;
12
+ }
@@ -0,0 +1,21 @@
1
+ import { MdmLockModeEnum } from '../../enums/MdmLockModeEnum';
2
+ import { MdmProviderEnum } from '../../enums/MdmProviderEnum';
3
+ import { ProductStatusEnum } from '../../enums/ProductStatusEnum';
4
+ import { ProductTierEnum } from '../../enums/ProductTierEnum';
5
+
6
+ /**
7
+ * Response de GET /private/products/:retailerId/:sku — validar que el producto existe + status.
8
+ * Incluye los campos que los downstream consumen: `eligibleFinanciers` (wizard F2 paso 4)
9
+ * y la config MDM (device router F4+). Shape de salida → sin class-validator.
10
+ */
11
+ export class ValidateProductResponse {
12
+ productId!: string;
13
+ retailerId!: string;
14
+ sku!: string;
15
+ status!: ProductStatusEnum;
16
+ tier!: ProductTierEnum;
17
+ eligibleFinanciers!: string[];
18
+ mdmEnabled!: boolean;
19
+ mdmProvider!: MdmProviderEnum | null;
20
+ mdmLockMode!: MdmLockModeEnum | null;
21
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Estado de una unidad física (IMEI) en inventario.
3
+ * Transiciones: AVAILABLE → RESERVED → SOLD/AVAILABLE (release); RETURNED desde SOLD; DAMAGED.
4
+ * @enum {string}
5
+ *
6
+ * @property {string} AVAILABLE - Disponible en stock.
7
+ * @property {string} RESERVED - Reservada para una venta en curso.
8
+ * @property {string} SOLD - Vendida.
9
+ * @property {string} RETURNED - Devuelta por el cliente.
10
+ * @property {string} DAMAGED - Dañada, fuera de stock vendible.
11
+ */
12
+ export enum InventoryItemStatusEnum {
13
+ AVAILABLE = 'AVAILABLE',
14
+ RESERVED = 'RESERVED',
15
+ SOLD = 'SOLD',
16
+ RETURNED = 'RETURNED',
17
+ DAMAGED = 'DAMAGED',
18
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Modo de bloqueo MDM. Valores del flow 04 de F1 (ONDEMAND/SCHEDULED).
3
+ *
4
+ * TD-007: el `DeviceLockModeEnum` del dominio `mdm` hoy tiene TEMPORARY/FIRM (semántica
5
+ * distinta: qué tan firme es el lock, no cuándo se dispara). Reconciliación pendiente con
6
+ * el dueño del dominio `mdm` (decidir reuso vs enum nuevo). En F1 el campo es pasivo
7
+ * (se guarda, no se ejerce) → no bloqueante.
8
+ *
9
+ * @enum {string}
10
+ *
11
+ * @property {string} ONDEMAND - El bloqueo se dispara bajo demanda.
12
+ * @property {string} SCHEDULED - El bloqueo se dispara de forma programada.
13
+ */
14
+ export enum MdmLockModeEnum {
15
+ ONDEMAND = 'ONDEMAND',
16
+ SCHEDULED = 'SCHEDULED',
17
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Proveedor MDM (Mobile Device Management) para el enrolamiento de dispositivos (F4+).
3
+ * @enum {string}
4
+ *
5
+ * @property {string} TRUSTONIC - Proveedor Trustonic.
6
+ * @property {string} DATACULTR - Proveedor Datacultr.
7
+ */
8
+ export enum MdmProviderEnum {
9
+ TRUSTONIC = 'TRUSTONIC',
10
+ DATACULTR = 'DATACULTR',
11
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Estado del producto en el catálogo.
3
+ * @enum {string}
4
+ *
5
+ * @property {string} ACTIVE - Producto activo y vendible.
6
+ * @property {string} INACTIVE - Producto inactivo temporalmente.
7
+ * @property {string} DISCONTINUED - Producto descontinuado.
8
+ */
9
+ export enum ProductStatusEnum {
10
+ ACTIVE = 'ACTIVE',
11
+ INACTIVE = 'INACTIVE',
12
+ DISCONTINUED = 'DISCONTINUED',
13
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Tier comercial del producto (segmenta catálogo por rango de precio/posicionamiento).
3
+ * @enum {string}
4
+ *
5
+ * @property {string} LOW - Gama de entrada.
6
+ * @property {string} MID - Gama media.
7
+ * @property {string} HIGH - Gama alta.
8
+ * @property {string} PREMIUM - Gama premium.
9
+ */
10
+ export enum ProductTierEnum {
11
+ LOW = 'LOW',
12
+ MID = 'MID',
13
+ HIGH = 'HIGH',
14
+ PREMIUM = 'PREMIUM',
15
+ }
@@ -0,0 +1,34 @@
1
+ export * from './enums/ProductTierEnum';
2
+ export * from './enums/ProductStatusEnum';
3
+ export * from './enums/InventoryItemStatusEnum';
4
+ export * from './enums/MdmProviderEnum';
5
+ export * from './enums/MdmLockModeEnum';
6
+
7
+ // Constantes del dominio
8
+ export * from './constants/SkuPattern';
9
+
10
+ // Validators custom
11
+ export * from './validators/IsMdmCoherentConstraint';
12
+
13
+ // Entity DTOs
14
+ export * from './dtos/Product';
15
+ export * from './dtos/InventoryItem';
16
+
17
+ // Request DTOs (input validado por endpoint)
18
+ export * from './dtos/requests/CreateProductRequest';
19
+ export * from './dtos/requests/UpdateProductRequest';
20
+ export * from './dtos/requests/UpdateProductStatusRequest';
21
+ export * from './dtos/requests/ListProductsQuery';
22
+ export * from './dtos/requests/RegisterInventoryRequest';
23
+ export * from './dtos/requests/TransferInventoryRequest';
24
+ export * from './dtos/requests/ChangeInventoryStatusRequest';
25
+
26
+ // Response DTOs
27
+ export * from './dtos/responses/ProductResponse';
28
+ export * from './dtos/responses/InventoryItemResponse';
29
+ export * from './dtos/responses/ImportCsvFailure';
30
+ export * from './dtos/responses/ImportCsvResult';
31
+
32
+ // Validation DTOs (shapes de endpoints privados)
33
+ export * from './dtos/validation/ValidateProductResponse';
34
+ export * from './dtos/validation/ValidateInventoryResponse';
@@ -0,0 +1,25 @@
1
+ import {
2
+ ValidatorConstraint,
3
+ type ValidationArguments,
4
+ type ValidatorConstraintInterface,
5
+ } from 'class-validator';
6
+
7
+ /**
8
+ * Coherencia de la config MDM del producto:
9
+ * - mdmEnabled === true → mdmProvider y mdmLockMode obligatorios.
10
+ * - mdmEnabled !== true → mdmProvider y mdmLockMode deben omitirse (null/undefined).
11
+ */
12
+ @ValidatorConstraint({ name: 'isMdmCoherent', async: false })
13
+ export class IsMdmCoherentConstraint implements ValidatorConstraintInterface {
14
+ validate(_value: unknown, args: ValidationArguments): boolean {
15
+ const o = args.object as { mdmEnabled?: boolean; mdmProvider?: unknown; mdmLockMode?: unknown };
16
+ if (o.mdmEnabled === true) {
17
+ return o.mdmProvider != null && o.mdmLockMode != null;
18
+ }
19
+ return o.mdmProvider == null && o.mdmLockMode == null;
20
+ }
21
+
22
+ defaultMessage(): string {
23
+ return 'Configuración MDM incoherente: con mdmEnabled=true se requieren mdmProvider y mdmLockMode; con mdmEnabled=false deben omitirse';
24
+ }
25
+ }
@@ -1,11 +0,0 @@
1
- /**
2
- * Rol RBAC mínimo que puede modificar un parámetro (RBAC a nivel de parámetro, modelo-datos §8).
3
- * `retailer_admin` = "Admin VentasLuga" de M6 §8. Valores = identificadores de rol de RBAC F0.
4
- * TD-004: confirmar mapeo super_admin ↔ platform_super_admin con el naming real de F0.
5
- * @enum {string}
6
- */
7
- export enum ModifiableByRoleEnum {
8
- SUPER_ADMIN = 'super_admin',
9
- SOFOM_ADMIN = 'sofom_admin',
10
- RETAILER_ADMIN = 'retailer_admin',
11
- }