@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,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 declare enum ProductTierEnum {
11
+ LOW = "LOW",
12
+ MID = "MID",
13
+ HIGH = "HIGH",
14
+ PREMIUM = "PREMIUM"
15
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductTierEnum = void 0;
4
+ /**
5
+ * Tier comercial del producto (segmenta catálogo por rango de precio/posicionamiento).
6
+ * @enum {string}
7
+ *
8
+ * @property {string} LOW - Gama de entrada.
9
+ * @property {string} MID - Gama media.
10
+ * @property {string} HIGH - Gama alta.
11
+ * @property {string} PREMIUM - Gama premium.
12
+ */
13
+ var ProductTierEnum;
14
+ (function (ProductTierEnum) {
15
+ ProductTierEnum["LOW"] = "LOW";
16
+ ProductTierEnum["MID"] = "MID";
17
+ ProductTierEnum["HIGH"] = "HIGH";
18
+ ProductTierEnum["PREMIUM"] = "PREMIUM";
19
+ })(ProductTierEnum || (exports.ProductTierEnum = ProductTierEnum = {}));
@@ -0,0 +1,22 @@
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
+ export * from './constants/SkuPattern';
7
+ export * from './validators/IsMdmCoherentConstraint';
8
+ export * from './dtos/Product';
9
+ export * from './dtos/InventoryItem';
10
+ export * from './dtos/requests/CreateProductRequest';
11
+ export * from './dtos/requests/UpdateProductRequest';
12
+ export * from './dtos/requests/UpdateProductStatusRequest';
13
+ export * from './dtos/requests/ListProductsQuery';
14
+ export * from './dtos/requests/RegisterInventoryRequest';
15
+ export * from './dtos/requests/TransferInventoryRequest';
16
+ export * from './dtos/requests/ChangeInventoryStatusRequest';
17
+ export * from './dtos/responses/ProductResponse';
18
+ export * from './dtos/responses/InventoryItemResponse';
19
+ export * from './dtos/responses/ImportCsvFailure';
20
+ export * from './dtos/responses/ImportCsvResult';
21
+ export * from './dtos/validation/ValidateProductResponse';
22
+ export * from './dtos/validation/ValidateInventoryResponse';
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./enums/ProductTierEnum"), exports);
18
+ __exportStar(require("./enums/ProductStatusEnum"), exports);
19
+ __exportStar(require("./enums/InventoryItemStatusEnum"), exports);
20
+ __exportStar(require("./enums/MdmProviderEnum"), exports);
21
+ __exportStar(require("./enums/MdmLockModeEnum"), exports);
22
+ // Constantes del dominio
23
+ __exportStar(require("./constants/SkuPattern"), exports);
24
+ // Validators custom
25
+ __exportStar(require("./validators/IsMdmCoherentConstraint"), exports);
26
+ // Entity DTOs
27
+ __exportStar(require("./dtos/Product"), exports);
28
+ __exportStar(require("./dtos/InventoryItem"), exports);
29
+ // Request DTOs (input validado por endpoint)
30
+ __exportStar(require("./dtos/requests/CreateProductRequest"), exports);
31
+ __exportStar(require("./dtos/requests/UpdateProductRequest"), exports);
32
+ __exportStar(require("./dtos/requests/UpdateProductStatusRequest"), exports);
33
+ __exportStar(require("./dtos/requests/ListProductsQuery"), exports);
34
+ __exportStar(require("./dtos/requests/RegisterInventoryRequest"), exports);
35
+ __exportStar(require("./dtos/requests/TransferInventoryRequest"), exports);
36
+ __exportStar(require("./dtos/requests/ChangeInventoryStatusRequest"), exports);
37
+ // Response DTOs
38
+ __exportStar(require("./dtos/responses/ProductResponse"), exports);
39
+ __exportStar(require("./dtos/responses/InventoryItemResponse"), exports);
40
+ __exportStar(require("./dtos/responses/ImportCsvFailure"), exports);
41
+ __exportStar(require("./dtos/responses/ImportCsvResult"), exports);
42
+ // Validation DTOs (shapes de endpoints privados)
43
+ __exportStar(require("./dtos/validation/ValidateProductResponse"), exports);
44
+ __exportStar(require("./dtos/validation/ValidateInventoryResponse"), exports);
@@ -0,0 +1,10 @@
1
+ import { type ValidationArguments, type ValidatorConstraintInterface } from 'class-validator';
2
+ /**
3
+ * Coherencia de la config MDM del producto:
4
+ * - mdmEnabled === true → mdmProvider y mdmLockMode obligatorios.
5
+ * - mdmEnabled !== true → mdmProvider y mdmLockMode deben omitirse (null/undefined).
6
+ */
7
+ export declare class IsMdmCoherentConstraint implements ValidatorConstraintInterface {
8
+ validate(_value: unknown, args: ValidationArguments): boolean;
9
+ defaultMessage(): string;
10
+ }
@@ -0,0 +1,31 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.IsMdmCoherentConstraint = void 0;
10
+ const class_validator_1 = require("class-validator");
11
+ /**
12
+ * Coherencia de la config MDM del producto:
13
+ * - mdmEnabled === true → mdmProvider y mdmLockMode obligatorios.
14
+ * - mdmEnabled !== true → mdmProvider y mdmLockMode deben omitirse (null/undefined).
15
+ */
16
+ let IsMdmCoherentConstraint = class IsMdmCoherentConstraint {
17
+ validate(_value, args) {
18
+ const o = args.object;
19
+ if (o.mdmEnabled === true) {
20
+ return o.mdmProvider != null && o.mdmLockMode != null;
21
+ }
22
+ return o.mdmProvider == null && o.mdmLockMode == null;
23
+ }
24
+ defaultMessage() {
25
+ return 'Configuración MDM incoherente: con mdmEnabled=true se requieren mdmProvider y mdmLockMode; con mdmEnabled=false deben omitirse';
26
+ }
27
+ };
28
+ exports.IsMdmCoherentConstraint = IsMdmCoherentConstraint;
29
+ exports.IsMdmCoherentConstraint = IsMdmCoherentConstraint = __decorate([
30
+ (0, class_validator_1.ValidatorConstraint)({ name: 'isMdmCoherent', async: false })
31
+ ], IsMdmCoherentConstraint);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.188.0",
3
+ "version": "3.190.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
package/src/index.ts CHANGED
@@ -103,6 +103,12 @@ export * as EmailVerification from './emailVerification';
103
103
  // RetailOrg: DTOs/enums del lambda retail-org-business (SureKeep Fase 1 — pista Retail).
104
104
  // Dominio de retailers → zonas → tiendas → usuarios retail.
105
105
  export * as RetailOrg from './retailOrg';
106
+ // RetailCatalog: DTOs/enums del lambda retail-catalog-business (comp 05 — catálogo de productos
107
+ // por SKU + inventario por IMEI; SureKeep Fase 1 — pista Retail).
108
+ export * as RetailCatalog from './retailCatalog';
109
+ // RetailCards: DTOs/enums del lambda retail-cards-business (comp 06 — tarjetas físicas PCF:
110
+ // lotes, stock y asignación; SureKeep Fase 1 — pista Retail).
111
+ export * as RetailCards from './retailCards';
106
112
  // LoanConfig: DTOs/enums del lambda loan-config-business (comp 09 — parámetros operativos del SOFOM).
107
113
  export * as LoanConfig from './loanConfig';
108
114
  // LoanOfferings: DTOs/enums del lambda loan-offerings-business (comp 07 — planes de crédito,
@@ -1,7 +1,6 @@
1
1
  import { Expose } from 'class-transformer';
2
2
  import { IsEnum, IsOptional, IsString, Matches } from 'class-validator';
3
3
  import { regexIso8601 } from '../../helpers/constans/regex';
4
- import { ModifiableByRoleEnum } from '../enums/ModifiableByRoleEnum';
5
4
  import { ParameterTypeEnum } from '../enums/ParameterTypeEnum';
6
5
  import { ParameterValueTypeEnum } from '../enums/ParameterValueTypeEnum';
7
6
 
@@ -40,10 +39,6 @@ export class Parameter {
40
39
  @IsString()
41
40
  description!: string;
42
41
 
43
- @Expose()
44
- @IsEnum(ModifiableByRoleEnum)
45
- modifiableBy!: ModifiableByRoleEnum;
46
-
47
42
  @Expose()
48
43
  @IsString()
49
44
  lastModifiedByUserId!: string;
@@ -1,4 +1,3 @@
1
- import { ModifiableByRoleEnum } from '../../enums/ModifiableByRoleEnum';
2
1
  import { ParameterTypeEnum } from '../../enums/ParameterTypeEnum';
3
2
  import { ParameterValueTypeEnum } from '../../enums/ParameterValueTypeEnum';
4
3
 
@@ -12,7 +11,6 @@ export interface ParameterResponse {
12
11
  valueType: ParameterValueTypeEnum;
13
12
  defaultValue: string;
14
13
  description: string;
15
- modifiableBy: ModifiableByRoleEnum;
16
14
  lastModifiedByUserId: string;
17
15
  createdAt: string;
18
16
  updatedAt: string;
@@ -1,6 +1,5 @@
1
1
  export * from './enums/ParameterTypeEnum';
2
2
  export * from './enums/ParameterValueTypeEnum';
3
- export * from './enums/ModifiableByRoleEnum';
4
3
 
5
4
  // Entity DTOs
6
5
  export * from './dtos/Parameter';
@@ -0,0 +1,14 @@
1
+ import { IsOptional, IsString } from 'class-validator';
2
+
3
+ /** Body de la asignación de una tarjeta física a un cliente. */
4
+ export class AssignCardRequest {
5
+ @IsString()
6
+ assignedToCustomerId!: string;
7
+
8
+ @IsString()
9
+ assignedByUserId!: string;
10
+
11
+ @IsOptional()
12
+ @IsString()
13
+ creditId?: string;
14
+ }
@@ -0,0 +1,8 @@
1
+ import { IsEnum } from 'class-validator';
2
+ import { CardCancelReasonEnum } from '../../enums/CardCancelReasonEnum';
3
+
4
+ /** Body de la cancelación (anulación) de una tarjeta física. */
5
+ export class CancelCardRequest {
6
+ @IsEnum(CardCancelReasonEnum)
7
+ reason!: CardCancelReasonEnum;
8
+ }
@@ -0,0 +1,21 @@
1
+ import { ArrayMaxSize, IsArray, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
2
+
3
+ /** Body del registro (recepción) de un lote de tarjetas para una tienda. */
4
+ export class RegisterCardBatchRequest {
5
+ @IsString()
6
+ storeId!: string;
7
+
8
+ @IsInt()
9
+ @Min(1)
10
+ @Max(1000)
11
+ totalCards!: number;
12
+
13
+ @IsArray()
14
+ @ArrayMaxSize(1000)
15
+ @IsString({ each: true })
16
+ cardNumbers!: string[];
17
+
18
+ @IsOptional()
19
+ @IsString()
20
+ notes?: string | null;
21
+ }
@@ -0,0 +1,18 @@
1
+ import { CardBatchStatusEnum } from '../../enums/CardBatchStatusEnum';
2
+
3
+ /** Representación de un lote de tarjetas hacia el cliente. */
4
+ export interface CardBatchResponse {
5
+ batchId: string;
6
+ retailerId: string;
7
+ storeId: string;
8
+ totalCards: number;
9
+ expectedCardCount: number;
10
+ loadedCount: number;
11
+ availableCount: number;
12
+ assignedCount: number;
13
+ cancelledCount: number;
14
+ status: CardBatchStatusEnum;
15
+ receivedAt: string;
16
+ receivedByUserId: string;
17
+ notes: string | null;
18
+ }
@@ -0,0 +1,13 @@
1
+ import { RetailCardStatusEnum } from '../../enums/RetailCardStatusEnum';
2
+
3
+ /** Representación de una tarjeta física hacia el cliente. */
4
+ export interface RetailCardResponse {
5
+ cardNumber: string;
6
+ retailerId: string;
7
+ batchId: string;
8
+ storeId: string;
9
+ status: RetailCardStatusEnum;
10
+ assignedToCustomerId: string | null;
11
+ assignedAt: string | null;
12
+ assignedByUserId: string | null;
13
+ }
@@ -0,0 +1,7 @@
1
+ /** Ítem de alerta de stock por tienda. */
2
+ export interface StockAlertItem {
3
+ storeId: string;
4
+ storeName: string;
5
+ availableCount: number;
6
+ threshold: number;
7
+ }
@@ -0,0 +1,6 @@
1
+ import { StockAlertItem } from './StockAlertItem';
2
+
3
+ /** Respuesta del reporte de alertas de stock. */
4
+ export interface StockAlertsResponse {
5
+ alerts: StockAlertItem[];
6
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Estado de un lote de tarjetas.
3
+ * @enum {string}
4
+ *
5
+ * @property {string} RECEIVING - Transitorio, carga en curso (DEC-004/DEC-008).
6
+ * @property {string} RECEIVED - Carga completada, lote atado a una tienda (happy-path F1).
7
+ * @property {string} FAILED - Terminal, la carga del lote falló (DEC-004/DEC-008).
8
+ * @property {string} DISTRIBUTED - Reservado F1 — lote centralizado repartido a varias tiendas (TD-008).
9
+ * @property {string} CLOSED - Reservado F1 — cierre manual del lote (TD-008).
10
+ */
11
+ export enum CardBatchStatusEnum {
12
+ RECEIVING = 'RECEIVING',
13
+ RECEIVED = 'RECEIVED',
14
+ FAILED = 'FAILED',
15
+ DISTRIBUTED = 'DISTRIBUTED',
16
+ CLOSED = 'CLOSED',
17
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Motivo de cancelación de una tarjeta física.
3
+ * @enum {string}
4
+ *
5
+ * @property {string} PLASTIC_DAMAGED - Plástico dañado.
6
+ * @property {string} LOST - Tarjeta perdida.
7
+ * @property {string} THEFT_REPORTED - Robo reportado.
8
+ */
9
+ export enum CardCancelReasonEnum {
10
+ PLASTIC_DAMAGED = 'PLASTIC_DAMAGED',
11
+ LOST = 'LOST',
12
+ THEFT_REPORTED = 'THEFT_REPORTED',
13
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Estado de una tarjeta física individual.
3
+ * @enum {string}
4
+ *
5
+ * @property {string} AVAILABLE - Cargada en stock, disponible para asignar.
6
+ * @property {string} ASSIGNED - Asignada a un cliente.
7
+ * @property {string} CANCELLED - Anulada (plástico dañado, pérdida o robo). Estado terminal.
8
+ */
9
+ export enum RetailCardStatusEnum {
10
+ AVAILABLE = 'AVAILABLE',
11
+ ASSIGNED = 'ASSIGNED',
12
+ CANCELLED = 'CANCELLED',
13
+ }
@@ -0,0 +1,9 @@
1
+ /** Emitido cuando un lote de tarjetas se recibe (RECEIVED). */
2
+ export interface CardBatchReceivedV1 {
3
+ batchId: string;
4
+ retailerId: string;
5
+ storeId: string;
6
+ totalCards: number;
7
+ receivedByUserId: string;
8
+ occurredAt: string;
9
+ }
@@ -0,0 +1,10 @@
1
+ /** Emitido cuando una tarjeta se asigna a un cliente. */
2
+ export interface RetailCardAssignedV1 {
3
+ cardNumber: string;
4
+ retailerId: string;
5
+ storeId: string;
6
+ assignedToCustomerId: string;
7
+ assignedByUserId: string;
8
+ creditId?: string;
9
+ occurredAt: string;
10
+ }
@@ -0,0 +1,10 @@
1
+ import { CardCancelReasonEnum } from '../enums/CardCancelReasonEnum';
2
+
3
+ /** Emitido cuando una tarjeta se cancela (anula). */
4
+ export interface RetailCardCancelledV1 {
5
+ cardNumber: string;
6
+ retailerId: string;
7
+ storeId: string;
8
+ reason: CardCancelReasonEnum;
9
+ occurredAt: string;
10
+ }
@@ -0,0 +1,7 @@
1
+ /** Emitido cuando una tarjeta se libera (vuelve a AVAILABLE). */
2
+ export interface RetailCardReleasedV1 {
3
+ cardNumber: string;
4
+ retailerId: string;
5
+ storeId: string;
6
+ occurredAt: string;
7
+ }
@@ -0,0 +1,20 @@
1
+ export * from './enums/RetailCardStatusEnum';
2
+ export * from './enums/CardBatchStatusEnum';
3
+ export * from './enums/CardCancelReasonEnum';
4
+
5
+ // Request DTOs (input validado por endpoint)
6
+ export * from './dtos/requests/RegisterCardBatchRequest';
7
+ export * from './dtos/requests/CancelCardRequest';
8
+ export * from './dtos/requests/AssignCardRequest';
9
+
10
+ // Response DTOs
11
+ export * from './dtos/responses/CardBatchResponse';
12
+ export * from './dtos/responses/RetailCardResponse';
13
+ export * from './dtos/responses/StockAlertItem';
14
+ export * from './dtos/responses/StockAlertsResponse';
15
+
16
+ // Contratos de eventos (PascalCase + sufijo V1)
17
+ export * from './events/CardBatchReceivedV1';
18
+ export * from './events/RetailCardAssignedV1';
19
+ export * from './events/RetailCardReleasedV1';
20
+ export * from './events/RetailCardCancelledV1';
@@ -0,0 +1,2 @@
1
+ /** Charset permitido para el SKU: alfanumérico + guion, 1-64 chars. */
2
+ export const SKU_PATTERN = /^[A-Za-z0-9-]+$/;
@@ -0,0 +1,21 @@
1
+ import { InventoryItemStatusEnum } from '../enums/InventoryItemStatusEnum';
2
+
3
+ /**
4
+ * InventoryItem — unidad física de inventario identificada por IMEI
5
+ * (lambda retail-catalog-business, SureKeep Fase 1 — pista Retail).
6
+ * Representación de salida/datos: sin decoradores class-validator.
7
+ */
8
+ export class InventoryItem {
9
+ imei!: string;
10
+ retailerId!: string;
11
+ productId!: string;
12
+ storeId!: string;
13
+ status!: InventoryItemStatusEnum;
14
+ receivedAt!: string;
15
+ soldAt!: string | null;
16
+ soldToCustomerId!: string | null;
17
+ createdBy!: string;
18
+ updatedBy!: string;
19
+ createdAt!: string;
20
+ updatedAt!: string;
21
+ }
@@ -0,0 +1,35 @@
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
+ * Product — aggregate root del catálogo del dominio `retailCatalog`
8
+ * (lambda retail-catalog-business, SureKeep Fase 1 — pista Retail).
9
+ * Representación de salida/datos: sin decoradores class-validator.
10
+ */
11
+ export class Product {
12
+ productId!: string;
13
+ retailerId!: string;
14
+ sku!: string;
15
+ externalId!: string | null;
16
+ brand!: string;
17
+ model!: string;
18
+ capacity!: string;
19
+ color!: string;
20
+ description!: string;
21
+ specs!: Record<string, unknown> | null;
22
+ imageUrl!: string | null;
23
+ tier!: ProductTierEnum;
24
+ basePriceCents!: number;
25
+ listPriceCents!: number | null;
26
+ eligibleFinanciers!: string[];
27
+ mdmEnabled!: boolean;
28
+ mdmProvider!: MdmProviderEnum | null;
29
+ mdmLockMode!: MdmLockModeEnum | null;
30
+ status!: ProductStatusEnum;
31
+ createdBy!: string;
32
+ updatedBy!: string;
33
+ createdAt!: string;
34
+ updatedAt!: string;
35
+ }
@@ -0,0 +1,11 @@
1
+ import { IsIn } from 'class-validator';
2
+ import { InventoryItemStatusEnum } from '../../enums/InventoryItemStatusEnum';
3
+
4
+ /**
5
+ * Body de PUT /retailers/:retailerId/inventory/:imei/status — cambio manual de estado.
6
+ * Acotado a RETURNED | DAMAGED (los otros estados los mueve la máquina de venta, no el operador).
7
+ */
8
+ export class ChangeInventoryStatusRequest {
9
+ @IsIn([InventoryItemStatusEnum.RETURNED, InventoryItemStatusEnum.DAMAGED])
10
+ status!: InventoryItemStatusEnum.RETURNED | InventoryItemStatusEnum.DAMAGED;
11
+ }
@@ -0,0 +1,81 @@
1
+ import {
2
+ IsArray,
3
+ IsBoolean,
4
+ IsEnum,
5
+ IsInt,
6
+ IsObject,
7
+ IsOptional,
8
+ IsString,
9
+ Length,
10
+ Matches,
11
+ Min,
12
+ Validate,
13
+ } from 'class-validator';
14
+ import { SKU_PATTERN } from '../../constants/SkuPattern';
15
+ import { MdmLockModeEnum } from '../../enums/MdmLockModeEnum';
16
+ import { MdmProviderEnum } from '../../enums/MdmProviderEnum';
17
+ import { ProductTierEnum } from '../../enums/ProductTierEnum';
18
+ import { IsMdmCoherentConstraint } from '../../validators/IsMdmCoherentConstraint';
19
+
20
+ /** Body de POST /retailers/:retailerId/products — alta de producto (retailerId/status/audit son server-set). */
21
+ export class CreateProductRequest {
22
+ @Matches(SKU_PATTERN, { message: 'sku admite solo [A-Za-z0-9-]' })
23
+ @Length(1, 64)
24
+ @IsString()
25
+ sku!: string;
26
+
27
+ @IsOptional()
28
+ @IsString()
29
+ externalId?: string | null;
30
+
31
+ @IsString()
32
+ brand!: string;
33
+
34
+ @IsString()
35
+ model!: string;
36
+
37
+ @IsString()
38
+ capacity!: string;
39
+
40
+ @IsString()
41
+ color!: string;
42
+
43
+ @IsString()
44
+ description!: string;
45
+
46
+ @IsOptional()
47
+ @IsObject()
48
+ specs?: Record<string, unknown> | null;
49
+
50
+ @IsOptional()
51
+ @IsString()
52
+ imageUrl?: string | null;
53
+
54
+ @IsEnum(ProductTierEnum)
55
+ tier!: ProductTierEnum;
56
+
57
+ @IsInt()
58
+ @Min(0)
59
+ basePriceCents!: number;
60
+
61
+ @IsOptional()
62
+ @IsInt()
63
+ @Min(0)
64
+ listPriceCents?: number | null;
65
+
66
+ @IsArray()
67
+ @IsString({ each: true })
68
+ eligibleFinanciers!: string[];
69
+
70
+ @Validate(IsMdmCoherentConstraint)
71
+ @IsBoolean()
72
+ mdmEnabled!: boolean;
73
+
74
+ @IsOptional()
75
+ @IsEnum(MdmProviderEnum)
76
+ mdmProvider?: MdmProviderEnum | null;
77
+
78
+ @IsOptional()
79
+ @IsEnum(MdmLockModeEnum)
80
+ mdmLockMode?: MdmLockModeEnum | null;
81
+ }
@@ -0,0 +1,22 @@
1
+ import { IsEnum, IsOptional, IsString } from 'class-validator';
2
+ import { ProductStatusEnum } from '../../enums/ProductStatusEnum';
3
+ import { ProductTierEnum } from '../../enums/ProductTierEnum';
4
+
5
+ /** Query string de GET /retailers/:retailerId/products — filtros opcionales. */
6
+ export class ListProductsQuery {
7
+ @IsOptional()
8
+ @IsString()
9
+ brand?: string;
10
+
11
+ @IsOptional()
12
+ @IsString()
13
+ model?: string;
14
+
15
+ @IsOptional()
16
+ @IsEnum(ProductTierEnum)
17
+ tier?: ProductTierEnum;
18
+
19
+ @IsOptional()
20
+ @IsEnum(ProductStatusEnum)
21
+ status?: ProductStatusEnum;
22
+ }
@@ -0,0 +1,12 @@
1
+ import { ArrayNotEmpty, IsArray, IsString } from 'class-validator';
2
+
3
+ /** Body de POST /retailers/:retailerId/stores/:storeId/inventory — registrar IMEIs nuevos (lote). */
4
+ export class RegisterInventoryRequest {
5
+ @IsString()
6
+ productSku!: string;
7
+
8
+ @IsArray()
9
+ @ArrayNotEmpty()
10
+ @IsString({ each: true })
11
+ imeis!: string[];
12
+ }
@@ -0,0 +1,7 @@
1
+ import { IsString } from 'class-validator';
2
+
3
+ /** Body de PUT /retailers/:retailerId/inventory/:imei/transfer — mover IMEI a otro store. */
4
+ export class TransferInventoryRequest {
5
+ @IsString()
6
+ newStoreId!: string;
7
+ }