@fiado/type-kit 3.464.0 → 3.465.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 (115) hide show
  1. package/_test_/unit/retailCatalog/backofficeRequests.test.ts +283 -0
  2. package/_test_/unit/retailCatalog/catalogEnums.test.ts +28 -1
  3. package/_test_/unit/retailCatalog/responseFields.test.ts +53 -0
  4. package/_test_/unit/retailCatalog/returnConditions.test.ts +64 -0
  5. package/_test_/unit/retailWizard/cancelSaleConditions.test.ts +41 -0
  6. package/bin/retailCatalog/constants/AdjustmentReasons.d.ts +3 -0
  7. package/bin/retailCatalog/constants/AdjustmentReasons.js +10 -0
  8. package/bin/retailCatalog/constants/NonBundleCategories.d.ts +3 -0
  9. package/bin/retailCatalog/constants/NonBundleCategories.js +6 -0
  10. package/bin/retailCatalog/dtos/Product.d.ts +3 -0
  11. package/bin/retailCatalog/dtos/requests/BackofficeCreateKitRequest.d.ts +14 -0
  12. package/bin/retailCatalog/dtos/requests/BackofficeCreateKitRequest.js +66 -0
  13. package/bin/retailCatalog/dtos/requests/BackofficeCreateProductRequest.d.ts +30 -0
  14. package/bin/retailCatalog/dtos/requests/BackofficeCreateProductRequest.js +117 -0
  15. package/bin/retailCatalog/dtos/requests/BackofficeCreateServiceRequest.d.ts +9 -0
  16. package/bin/retailCatalog/dtos/requests/BackofficeCreateServiceRequest.js +43 -0
  17. package/bin/retailCatalog/dtos/requests/BackofficeCreateSkuPriceRequest.d.ts +7 -0
  18. package/bin/retailCatalog/dtos/requests/BackofficeCreateSkuPriceRequest.js +34 -0
  19. package/bin/retailCatalog/dtos/requests/BackofficeCreateTransferRequest.d.ts +9 -0
  20. package/bin/retailCatalog/dtos/requests/BackofficeCreateTransferRequest.js +48 -0
  21. package/bin/retailCatalog/dtos/requests/BackofficeListTransfersQuery.d.ts +5 -0
  22. package/bin/retailCatalog/dtos/requests/BackofficeListTransfersQuery.js +23 -0
  23. package/bin/retailCatalog/dtos/requests/BackofficeRegisterAdjustmentRequest.d.ts +12 -0
  24. package/bin/retailCatalog/dtos/requests/BackofficeRegisterAdjustmentRequest.js +49 -0
  25. package/bin/retailCatalog/dtos/requests/BackofficeRegisterEntryRequest.d.ts +9 -0
  26. package/bin/retailCatalog/dtos/requests/BackofficeRegisterEntryRequest.js +43 -0
  27. package/bin/retailCatalog/dtos/requests/BackofficeUpdateProductRequest.d.ts +27 -0
  28. package/bin/retailCatalog/dtos/requests/BackofficeUpdateProductRequest.js +118 -0
  29. package/bin/retailCatalog/dtos/requests/ChangeInventoryStatusRequest.d.ts +1 -0
  30. package/bin/retailCatalog/dtos/requests/ChangeInventoryStatusRequest.js +1 -0
  31. package/bin/retailCatalog/dtos/requests/CreateProductRequest.d.ts +4 -1
  32. package/bin/retailCatalog/dtos/requests/CreateProductRequest.js +4 -1
  33. package/bin/retailCatalog/dtos/requests/RegisterInventoryRequest.d.ts +4 -1
  34. package/bin/retailCatalog/dtos/requests/RegisterInventoryRequest.js +4 -1
  35. package/bin/retailCatalog/dtos/requests/ReturnPieceCondition.d.ts +11 -0
  36. package/bin/retailCatalog/dtos/requests/ReturnPieceCondition.js +57 -0
  37. package/bin/retailCatalog/dtos/requests/ReturnStockLine.d.ts +6 -0
  38. package/bin/retailCatalog/dtos/requests/ReturnStockLine.js +27 -0
  39. package/bin/retailCatalog/dtos/requests/ReturnStockRequest.d.ts +2 -2
  40. package/bin/retailCatalog/dtos/requests/ReturnStockRequest.js +2 -2
  41. package/bin/retailCatalog/dtos/requests/TransferInventoryRequest.d.ts +4 -1
  42. package/bin/retailCatalog/dtos/requests/TransferInventoryRequest.js +4 -1
  43. package/bin/retailCatalog/dtos/requests/UpdateProductRequest.d.ts +4 -1
  44. package/bin/retailCatalog/dtos/requests/UpdateProductRequest.js +4 -1
  45. package/bin/retailCatalog/dtos/requests/UpdateProductStatusRequest.d.ts +4 -1
  46. package/bin/retailCatalog/dtos/requests/UpdateProductStatusRequest.js +4 -1
  47. package/bin/retailCatalog/dtos/responses/InventoryLensResponse.d.ts +3 -0
  48. package/bin/retailCatalog/dtos/responses/ListTransfersResponse.d.ts +5 -0
  49. package/bin/retailCatalog/dtos/responses/ListTransfersResponse.js +2 -0
  50. package/bin/retailCatalog/dtos/responses/ReserveStockResponse.d.ts +2 -0
  51. package/bin/retailCatalog/dtos/responses/SkuPriceEntry.d.ts +2 -0
  52. package/bin/retailCatalog/dtos/responses/StoreCatalogItem.d.ts +3 -0
  53. package/bin/retailCatalog/dtos/responses/TransferResponse.d.ts +16 -0
  54. package/bin/retailCatalog/dtos/responses/TransferResponse.js +2 -0
  55. package/bin/retailCatalog/enums/InventoryItemStatusEnum.d.ts +3 -1
  56. package/bin/retailCatalog/enums/InventoryItemStatusEnum.js +2 -0
  57. package/bin/retailCatalog/enums/InventoryMovementReasonEnum.d.ts +7 -0
  58. package/bin/retailCatalog/enums/InventoryMovementReasonEnum.js +11 -0
  59. package/bin/retailCatalog/enums/InventoryMovementTypeEnum.d.ts +4 -1
  60. package/bin/retailCatalog/enums/InventoryMovementTypeEnum.js +3 -0
  61. package/bin/retailCatalog/enums/ItemTypeEnum.d.ts +5 -0
  62. package/bin/retailCatalog/enums/ItemTypeEnum.js +9 -0
  63. package/bin/retailCatalog/enums/PriceSourceEnum.d.ts +3 -2
  64. package/bin/retailCatalog/enums/PriceSourceEnum.js +2 -1
  65. package/bin/retailCatalog/enums/ReturnConditionEnum.d.ts +5 -0
  66. package/bin/retailCatalog/enums/ReturnConditionEnum.js +9 -0
  67. package/bin/retailCatalog/enums/TransferStateEnum.d.ts +6 -0
  68. package/bin/retailCatalog/enums/TransferStateEnum.js +10 -0
  69. package/bin/retailCatalog/index.d.ts +20 -0
  70. package/bin/retailCatalog/index.js +21 -0
  71. package/bin/retailCatalog/validators/IsPieceRefConstraint.d.ts +6 -0
  72. package/bin/retailCatalog/validators/IsPieceRefConstraint.js +26 -0
  73. package/bin/retailWizard/dtos/requests/BackofficeCancelSaleRequest.d.ts +3 -0
  74. package/bin/retailWizard/dtos/requests/BackofficeCancelSaleRequest.js +9 -0
  75. package/bin/retailWizard/dtos/requests/CancelSaleRequest.d.ts +3 -0
  76. package/bin/retailWizard/dtos/requests/CancelSaleRequest.js +9 -0
  77. package/package.json +1 -1
  78. package/src/retailCatalog/constants/AdjustmentReasons.ts +8 -0
  79. package/src/retailCatalog/constants/NonBundleCategories.ts +4 -0
  80. package/src/retailCatalog/dtos/Product.ts +3 -0
  81. package/src/retailCatalog/dtos/requests/BackofficeCreateKitRequest.ts +47 -0
  82. package/src/retailCatalog/dtos/requests/BackofficeCreateProductRequest.ts +92 -0
  83. package/src/retailCatalog/dtos/requests/BackofficeCreateServiceRequest.ts +26 -0
  84. package/src/retailCatalog/dtos/requests/BackofficeCreateSkuPriceRequest.ts +19 -0
  85. package/src/retailCatalog/dtos/requests/BackofficeCreateTransferRequest.ts +31 -0
  86. package/src/retailCatalog/dtos/requests/BackofficeListTransfersQuery.ts +9 -0
  87. package/src/retailCatalog/dtos/requests/BackofficeRegisterAdjustmentRequest.ts +34 -0
  88. package/src/retailCatalog/dtos/requests/BackofficeRegisterEntryRequest.ts +28 -0
  89. package/src/retailCatalog/dtos/requests/BackofficeUpdateProductRequest.ts +93 -0
  90. package/src/retailCatalog/dtos/requests/ChangeInventoryStatusRequest.ts +1 -0
  91. package/src/retailCatalog/dtos/requests/CreateProductRequest.ts +4 -1
  92. package/src/retailCatalog/dtos/requests/RegisterInventoryRequest.ts +4 -1
  93. package/src/retailCatalog/dtos/requests/ReturnPieceCondition.ts +48 -0
  94. package/src/retailCatalog/dtos/requests/ReturnStockLine.ts +13 -0
  95. package/src/retailCatalog/dtos/requests/ReturnStockRequest.ts +3 -3
  96. package/src/retailCatalog/dtos/requests/TransferInventoryRequest.ts +4 -1
  97. package/src/retailCatalog/dtos/requests/UpdateProductRequest.ts +4 -1
  98. package/src/retailCatalog/dtos/requests/UpdateProductStatusRequest.ts +4 -1
  99. package/src/retailCatalog/dtos/responses/InventoryLensResponse.ts +3 -0
  100. package/src/retailCatalog/dtos/responses/ListTransfersResponse.ts +6 -0
  101. package/src/retailCatalog/dtos/responses/ReserveStockResponse.ts +2 -0
  102. package/src/retailCatalog/dtos/responses/SkuPriceEntry.ts +2 -0
  103. package/src/retailCatalog/dtos/responses/StoreCatalogItem.ts +3 -0
  104. package/src/retailCatalog/dtos/responses/TransferResponse.ts +17 -0
  105. package/src/retailCatalog/enums/InventoryItemStatusEnum.ts +2 -0
  106. package/src/retailCatalog/enums/InventoryMovementReasonEnum.ts +7 -0
  107. package/src/retailCatalog/enums/InventoryMovementTypeEnum.ts +3 -0
  108. package/src/retailCatalog/enums/ItemTypeEnum.ts +5 -0
  109. package/src/retailCatalog/enums/PriceSourceEnum.ts +2 -1
  110. package/src/retailCatalog/enums/ReturnConditionEnum.ts +5 -0
  111. package/src/retailCatalog/enums/TransferStateEnum.ts +6 -0
  112. package/src/retailCatalog/index.ts +22 -0
  113. package/src/retailCatalog/validators/IsPieceRefConstraint.ts +19 -0
  114. package/src/retailWizard/dtos/requests/BackofficeCancelSaleRequest.ts +11 -2
  115. package/src/retailWizard/dtos/requests/CancelSaleRequest.ts +11 -2
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CancelSaleRequest = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
+ const ReturnPieceCondition_1 = require("../../../retailCatalog/dtos/requests/ReturnPieceCondition");
15
16
  /**
16
17
  * POST /sales/:saleId/cancel — cancela una venta (flujo C, solo BO dentro de ventana param). `reason`
17
18
  * OBLIGATORIO (AuditTrail). Retorna el IMEI al silo (`SOLD → AVAILABLE`) y emite `SaleCancelledV1`.
@@ -32,3 +33,11 @@ __decorate([
32
33
  (0, class_validator_1.IsBoolean)(),
33
34
  __metadata("design:type", Boolean)
34
35
  ], CancelSaleRequest.prototype, "equipmentVerified", void 0);
36
+ __decorate([
37
+ (0, class_transformer_1.Expose)(),
38
+ (0, class_validator_1.IsOptional)(),
39
+ (0, class_validator_1.IsArray)(),
40
+ (0, class_validator_1.ValidateNested)({ each: true }),
41
+ (0, class_transformer_1.Type)(() => ReturnPieceCondition_1.ReturnPieceCondition),
42
+ __metadata("design:type", Array)
43
+ ], CancelSaleRequest.prototype, "returnConditions", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.464.0",
3
+ "version": "3.465.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -0,0 +1,8 @@
1
+ import { InventoryMovementReasonEnum } from '../enums/InventoryMovementReasonEnum';
2
+
3
+ /** Motivos que el admin puede registrar en un ajuste; DAMAGED_RETURN lo genera la devolución. */
4
+ export const ADJUSTMENT_REASONS = [
5
+ InventoryMovementReasonEnum.SHRINKAGE,
6
+ InventoryMovementReasonEnum.ADJUSTMENT,
7
+ InventoryMovementReasonEnum.WARRANTY,
8
+ ];
@@ -0,0 +1,4 @@
1
+ import { ProductCategoryEnum } from '../enums/ProductCategoryEnum';
2
+
3
+ /** Categorías que admite el alta y la edición de producto; el kit (BUNDLE) tiene su propio endpoint. */
4
+ export const NON_BUNDLE_CATEGORIES = Object.values(ProductCategoryEnum).filter((c) => c !== ProductCategoryEnum.BUNDLE);
@@ -4,6 +4,7 @@ import { ProductStatusEnum } from '../enums/ProductStatusEnum';
4
4
  import { ProductTierEnum } from '../enums/ProductTierEnum';
5
5
  import { ProductCategoryEnum } from '../enums/ProductCategoryEnum';
6
6
  import { TrackingModeEnum } from '../enums/TrackingModeEnum';
7
+ import { ItemTypeEnum } from '../enums/ItemTypeEnum';
7
8
  import { ProductComponent } from './ProductComponent';
8
9
 
9
10
  /**
@@ -48,4 +49,6 @@ export class Product {
48
49
  components?: ProductComponent[] | null;
49
50
  /** Llave del registro PRICE# del que salen basePriceCents y listPriceCents. */
50
51
  currentPriceSk?: string | null;
52
+ /** Producto físico o servicio; inmutable tras el alta. Ausente = PRODUCT. */
53
+ itemType?: ItemTypeEnum;
51
54
  }
@@ -0,0 +1,47 @@
1
+ import { Type } from 'class-transformer';
2
+ import { ArrayMinSize, IsArray, IsBoolean, IsOptional, IsString, Length, Matches, ValidateNested } from 'class-validator';
3
+ import { SKU_PATTERN } from '../../constants/SkuPattern';
4
+ import { ProductComponent } from '../ProductComponent';
5
+
6
+ /** Body de POST /backoffice/catalog/kits (backofficeCreateKit); category BUNDLE y origen BACKOFFICE los fija el servidor. */
7
+ export class BackofficeCreateKitRequest {
8
+ @Matches(SKU_PATTERN, { message: 'sku admite solo [A-Za-z0-9-]' })
9
+ @Length(1, 64)
10
+ @IsString()
11
+ sku!: string;
12
+
13
+ @IsBoolean()
14
+ sellable!: boolean;
15
+
16
+ @IsBoolean()
17
+ showInSalesFlow!: boolean;
18
+
19
+ @IsArray()
20
+ @ArrayMinSize(1)
21
+ @ValidateNested({ each: true })
22
+ @Type(() => ProductComponent)
23
+ components!: ProductComponent[];
24
+
25
+ @IsOptional()
26
+ @Matches(/\S/)
27
+ @IsString()
28
+ description?: string;
29
+
30
+ @IsOptional()
31
+ @Matches(/\S/)
32
+ @IsString()
33
+ imageUrl?: string;
34
+
35
+ /** Id del SKU en el sistema del retailer. */
36
+ @IsOptional()
37
+ @Matches(/\S/)
38
+ @IsString()
39
+ externalId?: string;
40
+
41
+ /** Financieras que pueden financiar este SKU; vacío = no financiable. */
42
+ @IsOptional()
43
+ @IsArray()
44
+ @Matches(/\S/, { each: true })
45
+ @IsString({ each: true })
46
+ eligibleFinanciers?: string[];
47
+ }
@@ -0,0 +1,92 @@
1
+ import { IsArray, IsBoolean, IsEnum, IsIn, IsOptional, IsString, Length, Matches, Validate, ValidateIf } from 'class-validator';
2
+ import { SKU_PATTERN } from '../../constants/SkuPattern';
3
+ import { NON_BUNDLE_CATEGORIES } from '../../constants/NonBundleCategories';
4
+ import { ProductCategoryEnum } from '../../enums/ProductCategoryEnum';
5
+ import { ProductTierEnum } from '../../enums/ProductTierEnum';
6
+ import { TrackingModeEnum } from '../../enums/TrackingModeEnum';
7
+ import { MdmLockModeEnum } from '../../enums/MdmLockModeEnum';
8
+ import { MdmProviderEnum } from '../../enums/MdmProviderEnum';
9
+ import { IsMdmCoherentConstraint } from '../../validators/IsMdmCoherentConstraint';
10
+
11
+ /** Body de POST /backoffice/catalog/products (backofficeCreateProduct); itemType PRODUCT y origen BACKOFFICE los fija el servidor. */
12
+ export class BackofficeCreateProductRequest {
13
+ @Matches(SKU_PATTERN, { message: 'sku admite solo [A-Za-z0-9-]' })
14
+ @Length(1, 64)
15
+ @IsString()
16
+ sku!: string;
17
+
18
+ /** El kit (BUNDLE) se da de alta en backofficeCreateKit. */
19
+ @IsIn(NON_BUNDLE_CATEGORIES)
20
+ category!: ProductCategoryEnum;
21
+
22
+ /** Inmutable tras el alta. */
23
+ @IsEnum(TrackingModeEnum)
24
+ trackingMode!: TrackingModeEnum;
25
+
26
+ @IsBoolean()
27
+ sellable!: boolean;
28
+
29
+ @IsBoolean()
30
+ showInSalesFlow!: boolean;
31
+
32
+ @IsOptional()
33
+ @IsEnum(ProductTierEnum)
34
+ tier?: ProductTierEnum;
35
+
36
+ @IsOptional()
37
+ @Matches(/\S/)
38
+ @IsString()
39
+ brand?: string;
40
+
41
+ @IsOptional()
42
+ @Matches(/\S/)
43
+ @IsString()
44
+ model?: string;
45
+
46
+ @IsOptional()
47
+ @Matches(/\S/)
48
+ @IsString()
49
+ capacity?: string;
50
+
51
+ @IsOptional()
52
+ @Matches(/\S/)
53
+ @IsString()
54
+ color?: string;
55
+
56
+ @IsOptional()
57
+ @Matches(/\S/)
58
+ @IsString()
59
+ description?: string;
60
+
61
+ @IsOptional()
62
+ @Matches(/\S/)
63
+ @IsString()
64
+ imageUrl?: string;
65
+
66
+ /** Id del SKU en el sistema del retailer. */
67
+ @IsOptional()
68
+ @Matches(/\S/)
69
+ @IsString()
70
+ externalId?: string;
71
+
72
+ /** Financieras que pueden financiar este SKU; vacío = no financiable. */
73
+ @IsOptional()
74
+ @IsArray()
75
+ @Matches(/\S/, { each: true })
76
+ @IsString({ each: true })
77
+ eligibleFinanciers?: string[];
78
+
79
+ /** En el alta se evalúa aunque falte: si vienen mdmProvider o mdmLockMode, exige mdmEnabled=true. */
80
+ @Validate(IsMdmCoherentConstraint)
81
+ @ValidateIf((o: BackofficeCreateProductRequest) => o.mdmEnabled != null || o.mdmProvider != null || o.mdmLockMode != null)
82
+ @IsBoolean()
83
+ mdmEnabled?: boolean;
84
+
85
+ @IsOptional()
86
+ @IsEnum(MdmProviderEnum)
87
+ mdmProvider?: MdmProviderEnum | null;
88
+
89
+ @IsOptional()
90
+ @IsEnum(MdmLockModeEnum)
91
+ mdmLockMode?: MdmLockModeEnum | null;
92
+ }
@@ -0,0 +1,26 @@
1
+ import { IsBoolean, IsOptional, IsString, Length, Matches } from 'class-validator';
2
+ import { SKU_PATTERN } from '../../constants/SkuPattern';
3
+
4
+ /** Body de POST /backoffice/catalog/services (backofficeCreateService); itemType SERVICE y trackingMode QUANTITY los fija el servidor. */
5
+ export class BackofficeCreateServiceRequest {
6
+ @Matches(SKU_PATTERN, { message: 'sku admite solo [A-Za-z0-9-]' })
7
+ @Length(1, 64)
8
+ @IsString()
9
+ sku!: string;
10
+
11
+ @Matches(/\S/)
12
+ @IsString()
13
+ description!: string;
14
+
15
+ @IsBoolean()
16
+ sellable!: boolean;
17
+
18
+ @IsBoolean()
19
+ showInSalesFlow!: boolean;
20
+
21
+ /** Id del SKU en el sistema del retailer. */
22
+ @IsOptional()
23
+ @Matches(/\S/)
24
+ @IsString()
25
+ externalId?: string;
26
+ }
@@ -0,0 +1,19 @@
1
+ import { IsInt, IsOptional, Min } from 'class-validator';
2
+
3
+ /** Body de POST /backoffice/inventory/skus/{sku}/prices (backofficeCreateSkuPrice); crea un PRICE# nuevo con origen BACKOFFICE. */
4
+ export class BackofficeCreateSkuPriceRequest {
5
+ @IsInt()
6
+ @Min(0)
7
+ basePriceCents!: number;
8
+
9
+ @IsOptional()
10
+ @IsInt()
11
+ @Min(0)
12
+ listPriceCents?: number | null;
13
+
14
+ /** Precio dentro de un kit; se guarda, ninguna venta lo aplica. */
15
+ @IsOptional()
16
+ @IsInt()
17
+ @Min(0)
18
+ comboPriceCents?: number;
19
+ }
@@ -0,0 +1,31 @@
1
+ import { ArrayMinSize, ArrayUnique, IsArray, IsInt, IsOptional, IsString, Length, Matches, Min } from 'class-validator';
2
+ import { SKU_PATTERN } from '../../constants/SkuPattern';
3
+
4
+ /** Body de POST /backoffice/inventory/transfers (backofficeCreateTransfer); origen = destino lo rechaza el dominio. */
5
+ export class BackofficeCreateTransferRequest {
6
+ @Matches(/^\S+$/)
7
+ @IsString()
8
+ fromStoreId!: string;
9
+
10
+ @Matches(/^\S+$/)
11
+ @IsString()
12
+ toStoreId!: string;
13
+
14
+ @Matches(SKU_PATTERN, { message: 'sku admite solo [A-Za-z0-9-]' })
15
+ @Length(1, 64)
16
+ @IsString()
17
+ sku!: string;
18
+
19
+ @IsInt()
20
+ @Min(1)
21
+ qty!: number;
22
+
23
+ /** IMEI o serie de cada pieza; ausente si el SKU se rastrea por cantidad. */
24
+ @IsOptional()
25
+ @IsArray()
26
+ @ArrayMinSize(1)
27
+ @ArrayUnique()
28
+ @Matches(/^\S+$/, { each: true })
29
+ @IsString({ each: true })
30
+ identifiers?: string[];
31
+ }
@@ -0,0 +1,9 @@
1
+ import { IsEnum, IsOptional } from 'class-validator';
2
+ import { TransferStateEnum } from '../../enums/TransferStateEnum';
3
+
4
+ /** Query de GET /backoffice/inventory/transfers (backofficeListTransfers); el retailer sale del token. */
5
+ export class BackofficeListTransfersQuery {
6
+ @IsOptional()
7
+ @IsEnum(TransferStateEnum)
8
+ state?: TransferStateEnum;
9
+ }
@@ -0,0 +1,34 @@
1
+ import { ArrayMinSize, ArrayUnique, IsArray, IsIn, IsInt, IsOptional, IsString, Length, Matches, Min } from 'class-validator';
2
+ import { ADJUSTMENT_REASONS } from '../../constants/AdjustmentReasons';
3
+ import { SKU_PATTERN } from '../../constants/SkuPattern';
4
+ import { InventoryMovementReasonEnum } from '../../enums/InventoryMovementReasonEnum';
5
+
6
+ /** Body de POST /backoffice/inventory/adjustments (backofficeRegisterAdjustment); resta del disponible con motivo. */
7
+ export class BackofficeRegisterAdjustmentRequest {
8
+ /** Debe pertenecer al retailer del token. */
9
+ @Matches(/^\S+$/)
10
+ @IsString()
11
+ storeId!: string;
12
+
13
+ @Matches(SKU_PATTERN, { message: 'sku admite solo [A-Za-z0-9-]' })
14
+ @Length(1, 64)
15
+ @IsString()
16
+ sku!: string;
17
+
18
+ @IsInt()
19
+ @Min(1)
20
+ qty!: number;
21
+
22
+ /** DAMAGED_RETURN no aplica: lo genera la devolución, no el admin. */
23
+ @IsIn(ADJUSTMENT_REASONS)
24
+ reason!: InventoryMovementReasonEnum;
25
+
26
+ /** IMEI o serie de cada pieza; ausente si el SKU se rastrea por cantidad. */
27
+ @IsOptional()
28
+ @IsArray()
29
+ @ArrayMinSize(1)
30
+ @ArrayUnique()
31
+ @Matches(/^\S+$/, { each: true })
32
+ @IsString({ each: true })
33
+ identifiers?: string[];
34
+ }
@@ -0,0 +1,28 @@
1
+ import { ArrayMinSize, ArrayUnique, IsArray, IsInt, IsOptional, IsString, Length, Matches, Min } from 'class-validator';
2
+ import { SKU_PATTERN } from '../../constants/SkuPattern';
3
+
4
+ /** Body de POST /backoffice/inventory/entries (backofficeRegisterEntry); suma al saldo de la tienda con un MOV# ENTRY. */
5
+ export class BackofficeRegisterEntryRequest {
6
+ /** Debe pertenecer al retailer del token. */
7
+ @Matches(/^\S+$/)
8
+ @IsString()
9
+ storeId!: string;
10
+
11
+ @Matches(SKU_PATTERN, { message: 'sku admite solo [A-Za-z0-9-]' })
12
+ @Length(1, 64)
13
+ @IsString()
14
+ sku!: string;
15
+
16
+ @IsInt()
17
+ @Min(1)
18
+ qty!: number;
19
+
20
+ /** IMEI o serie de cada pieza; ausente si el SKU se rastrea por cantidad. */
21
+ @IsOptional()
22
+ @IsArray()
23
+ @ArrayMinSize(1)
24
+ @ArrayUnique()
25
+ @Matches(/^\S+$/, { each: true })
26
+ @IsString({ each: true })
27
+ identifiers?: string[];
28
+ }
@@ -0,0 +1,93 @@
1
+ import { Type } from 'class-transformer';
2
+ import { ArrayMinSize, IsArray, IsBoolean, IsEnum, IsIn, IsOptional, IsString, Matches, Validate, ValidateNested } from 'class-validator';
3
+ import { NON_BUNDLE_CATEGORIES } from '../../constants/NonBundleCategories';
4
+ import { ProductCategoryEnum } from '../../enums/ProductCategoryEnum';
5
+ import { ProductTierEnum } from '../../enums/ProductTierEnum';
6
+ import { ProductComponent } from '../ProductComponent';
7
+ import { MdmLockModeEnum } from '../../enums/MdmLockModeEnum';
8
+ import { MdmProviderEnum } from '../../enums/MdmProviderEnum';
9
+ import { IsMdmCoherentConstraint } from '../../validators/IsMdmCoherentConstraint';
10
+
11
+ /** Body de PATCH /backoffice/inventory/skus/{sku} (backofficeUpdateProduct); parcial, sin itemType ni trackingMode (inmutables) ni precio. */
12
+ export class BackofficeUpdateProductRequest {
13
+ @IsOptional()
14
+ @IsIn(NON_BUNDLE_CATEGORIES)
15
+ category?: ProductCategoryEnum;
16
+
17
+ @IsOptional()
18
+ @IsBoolean()
19
+ sellable?: boolean;
20
+
21
+ @IsOptional()
22
+ @IsBoolean()
23
+ showInSalesFlow?: boolean;
24
+
25
+ /** Solo en kits; reemplaza la lista completa sin tocar los apartados vivos. */
26
+ @IsOptional()
27
+ @IsArray()
28
+ @ArrayMinSize(1)
29
+ @ValidateNested({ each: true })
30
+ @Type(() => ProductComponent)
31
+ components?: ProductComponent[];
32
+
33
+ @IsOptional()
34
+ @IsEnum(ProductTierEnum)
35
+ tier?: ProductTierEnum;
36
+
37
+ @IsOptional()
38
+ @Matches(/\S/)
39
+ @IsString()
40
+ brand?: string;
41
+
42
+ @IsOptional()
43
+ @Matches(/\S/)
44
+ @IsString()
45
+ model?: string;
46
+
47
+ @IsOptional()
48
+ @Matches(/\S/)
49
+ @IsString()
50
+ capacity?: string;
51
+
52
+ @IsOptional()
53
+ @Matches(/\S/)
54
+ @IsString()
55
+ color?: string;
56
+
57
+ @IsOptional()
58
+ @Matches(/\S/)
59
+ @IsString()
60
+ description?: string;
61
+
62
+ @IsOptional()
63
+ @Matches(/\S/)
64
+ @IsString()
65
+ imageUrl?: string;
66
+
67
+ /** Id del SKU en el sistema del retailer. */
68
+ @IsOptional()
69
+ @Matches(/\S/)
70
+ @IsString()
71
+ externalId?: string;
72
+
73
+ /** Financieras que pueden financiar este SKU; vacío = no financiable. */
74
+ @IsOptional()
75
+ @IsArray()
76
+ @Matches(/\S/, { each: true })
77
+ @IsString({ each: true })
78
+ eligibleFinanciers?: string[];
79
+
80
+ // PATCH parcial: la coherencia contra el producto guardado la valida el dominio.
81
+ @Validate(IsMdmCoherentConstraint)
82
+ @IsOptional()
83
+ @IsBoolean()
84
+ mdmEnabled?: boolean;
85
+
86
+ @IsOptional()
87
+ @IsEnum(MdmProviderEnum)
88
+ mdmProvider?: MdmProviderEnum | null;
89
+
90
+ @IsOptional()
91
+ @IsEnum(MdmLockModeEnum)
92
+ mdmLockMode?: MdmLockModeEnum | null;
93
+ }
@@ -4,6 +4,7 @@ import { InventoryItemStatusEnum } from '../../enums/InventoryItemStatusEnum';
4
4
  /**
5
5
  * Body de PUT /retailers/:retailerId/inventory/:imei/status — cambio manual de estado.
6
6
  * Acotado a RETURNED | DAMAGED (los otros estados los mueve la máquina de venta, no el operador).
7
+ * @deprecated Modelo viejo por IMEI; usar BackofficeRegisterAdjustmentRequest. Se conserva porque otras ramas lo importan.
7
8
  */
8
9
  export class ChangeInventoryStatusRequest {
9
10
  @IsIn([InventoryItemStatusEnum.RETURNED, InventoryItemStatusEnum.DAMAGED])
@@ -17,7 +17,10 @@ import { MdmProviderEnum } from '../../enums/MdmProviderEnum';
17
17
  import { ProductTierEnum } from '../../enums/ProductTierEnum';
18
18
  import { IsMdmCoherentConstraint } from '../../validators/IsMdmCoherentConstraint';
19
19
 
20
- /** Body de POST /retailers/:retailerId/products — alta de producto (retailerId/status/audit son server-set). */
20
+ /**
21
+ * Body de POST /retailers/:retailerId/products — alta de producto (retailerId/status/audit son server-set).
22
+ * @deprecated Modelo viejo por IMEI; usar BackofficeCreateProductRequest. Se conserva porque otras ramas lo importan.
23
+ */
21
24
  export class CreateProductRequest {
22
25
  @Matches(SKU_PATTERN, { message: 'sku admite solo [A-Za-z0-9-]' })
23
26
  @Length(1, 64)
@@ -1,6 +1,9 @@
1
1
  import { ArrayNotEmpty, IsArray, IsString } from 'class-validator';
2
2
 
3
- /** Body de POST /retailers/:retailerId/stores/:storeId/inventory — registrar IMEIs nuevos (lote). */
3
+ /**
4
+ * Body de POST /retailers/:retailerId/stores/:storeId/inventory — registrar IMEIs nuevos (lote).
5
+ * @deprecated Modelo viejo por IMEI; usar BackofficeRegisterEntryRequest. Se conserva porque otras ramas lo importan.
6
+ */
4
7
  export class RegisterInventoryRequest {
5
8
  @IsString()
6
9
  productSku!: string;
@@ -0,0 +1,48 @@
1
+ import { Expose, Transform } from 'class-transformer';
2
+ import {
3
+ IsEnum,
4
+ IsInt,
5
+ IsString,
6
+ Length,
7
+ Matches,
8
+ MaxLength,
9
+ Min,
10
+ Validate,
11
+ ValidateIf,
12
+ } from 'class-validator';
13
+ import { SKU_PATTERN } from '../../constants/SkuPattern';
14
+ import { ReturnConditionEnum } from '../../enums/ReturnConditionEnum';
15
+ import { IsPieceRefConstraint } from '../../validators/IsPieceRefConstraint';
16
+
17
+ /** Condición de una pieza devuelta; ausente = GOOD. Un accesorio por cantidad se declara con sku + qty. */
18
+ export class ReturnPieceCondition {
19
+ @Expose()
20
+ @Matches(SKU_PATTERN, { message: 'sku admite solo [A-Za-z0-9-]' })
21
+ @Length(1, 64)
22
+ @IsString()
23
+ sku!: string;
24
+
25
+ @Expose()
26
+ @Validate(IsPieceRefConstraint)
27
+ identifier?: string;
28
+
29
+ /** Unidades del SKU por cantidad con esta condición; las no declaradas vuelven GOOD. */
30
+ @Expose()
31
+ @ValidateIf((o: ReturnPieceCondition) => o.qty !== undefined)
32
+ @IsInt()
33
+ @Min(1)
34
+ qty?: number;
35
+
36
+ @Expose()
37
+ @Transform(({ value }) => value ?? ReturnConditionEnum.GOOD)
38
+ @IsEnum(ReturnConditionEnum)
39
+ condition: ReturnConditionEnum = ReturnConditionEnum.GOOD;
40
+
41
+ /** Motivo del daño; obligatorio con DAMAGED, opcional con GOOD. */
42
+ @Expose()
43
+ @ValidateIf((o: ReturnPieceCondition) => o.condition === ReturnConditionEnum.DAMAGED || o.reason != null)
44
+ @MaxLength(200)
45
+ @Matches(/\S/)
46
+ @IsString()
47
+ reason?: string;
48
+ }
@@ -0,0 +1,13 @@
1
+ import { Type } from 'class-transformer';
2
+ import { IsArray, IsOptional, ValidateNested } from 'class-validator';
3
+ import { ReturnPieceCondition } from './ReturnPieceCondition';
4
+ import { StockLine } from './StockLine';
5
+
6
+ /** Línea de devolución: la línea vendida más la condición de sus piezas; las no listadas vuelven GOOD. */
7
+ export class ReturnStockLine extends StockLine {
8
+ @IsOptional()
9
+ @IsArray()
10
+ @ValidateNested({ each: true })
11
+ @Type(() => ReturnPieceCondition)
12
+ conditions?: ReturnPieceCondition[];
13
+ }
@@ -1,6 +1,6 @@
1
1
  import { Type } from 'class-transformer';
2
2
  import { ArrayMinSize, IsArray, IsISO8601, IsString, ValidateNested } from 'class-validator';
3
- import { StockLine } from './StockLine';
3
+ import { ReturnStockLine } from './ReturnStockLine';
4
4
 
5
5
  /** Body de PUT /private/stores/{storeId}/returns (privateReturnStock); componentes guardados en la venta. */
6
6
  export class ReturnStockRequest {
@@ -17,6 +17,6 @@ export class ReturnStockRequest {
17
17
  @IsArray()
18
18
  @ArrayMinSize(1)
19
19
  @ValidateNested({ each: true })
20
- @Type(() => StockLine)
21
- lines!: StockLine[];
20
+ @Type(() => ReturnStockLine)
21
+ lines!: ReturnStockLine[];
22
22
  }
@@ -1,6 +1,9 @@
1
1
  import { IsString } from 'class-validator';
2
2
 
3
- /** Body de PUT /retailers/:retailerId/inventory/:imei/transfer — mover IMEI a otro store. */
3
+ /**
4
+ * Body de PUT /retailers/:retailerId/inventory/:imei/transfer — mover IMEI a otro store.
5
+ * @deprecated Modelo viejo por IMEI; usar BackofficeCreateTransferRequest. Se conserva porque otras ramas lo importan.
6
+ */
4
7
  export class TransferInventoryRequest {
5
8
  @IsString()
6
9
  newStoreId!: string;
@@ -14,7 +14,10 @@ import { MdmProviderEnum } from '../../enums/MdmProviderEnum';
14
14
  import { ProductTierEnum } from '../../enums/ProductTierEnum';
15
15
  import { IsMdmCoherentConstraint } from '../../validators/IsMdmCoherentConstraint';
16
16
 
17
- /** Body de PUT /retailers/:retailerId/products/:sku — actualización parcial (sku y status son inmutables acá). */
17
+ /**
18
+ * Body de PUT /retailers/:retailerId/products/:sku — actualización parcial (sku y status son inmutables acá).
19
+ * @deprecated Modelo viejo por IMEI; usar BackofficeUpdateProductRequest. Se conserva porque otras ramas lo importan.
20
+ */
18
21
  export class UpdateProductRequest {
19
22
  @IsOptional()
20
23
  @IsString()
@@ -1,7 +1,10 @@
1
1
  import { IsEnum } from 'class-validator';
2
2
  import { ProductStatusEnum } from '../../enums/ProductStatusEnum';
3
3
 
4
- /** Body de PUT /retailers/:retailerId/products/:sku/status — ACTIVE | DISCONTINUED. */
4
+ /**
5
+ * Body de PUT /retailers/:retailerId/products/:sku/status — ACTIVE | DISCONTINUED.
6
+ * @deprecated Modelo viejo por IMEI; usar backofficeDeactivateProduct (sin body). Se conserva porque otras ramas lo importan.
7
+ */
5
8
  export class UpdateProductStatusRequest {
6
9
  @IsEnum(ProductStatusEnum)
7
10
  status!: ProductStatusEnum;
@@ -4,6 +4,7 @@ import type { ProductCategoryEnum } from '../../enums/ProductCategoryEnum';
4
4
  import type { ProductTierEnum } from '../../enums/ProductTierEnum';
5
5
  import type { InventoryLensUnavailableReasonEnum } from '../../enums/InventoryLensUnavailableReasonEnum';
6
6
  import type { InventoryTransferReasonEnum } from '../../enums/InventoryTransferReasonEnum';
7
+ import type { ItemTypeEnum } from '../../enums/ItemTypeEnum';
7
8
 
8
9
  /**
9
10
  * Los contadores que la pantalla «Inventario» del Admin VL pinta arriba, siempre — los cuatro viajan
@@ -127,6 +128,8 @@ export interface InventoryLensListItem {
127
128
  coverage: InventoryLensCoverage;
128
129
  alerts: InventoryLensAlerts;
129
130
  sold30d: number;
131
+ /** Producto físico o servicio. Ausente = PRODUCT. */
132
+ itemType?: ItemTypeEnum;
130
133
  }
131
134
 
132
135
  /** Fila del lente — el tipo depende del tab pedido. */
@@ -0,0 +1,6 @@
1
+ import type { TransferResponse } from './TransferResponse';
2
+
3
+ /** Response de backofficeListTransfers. */
4
+ export interface ListTransfersResponse {
5
+ items: TransferResponse[];
6
+ }
@@ -8,6 +8,8 @@ export interface ReservedComponent {
8
8
  qty: number;
9
9
  category: ProductCategoryEnum;
10
10
  trackingMode: TrackingModeEnum;
11
+ /** Precio vigente del componente, para repartir el precio del kit. */
12
+ priceCents?: number;
11
13
  }
12
14
 
13
15
  /** Response de privateReserveStock; el precio de la línea es `basePriceCents`. */
@@ -5,6 +5,8 @@ export interface SkuPriceEntry {
5
5
  effectiveFrom: string;
6
6
  listPriceCents: number | null;
7
7
  basePriceCents: number;
8
+ /** Precio del SKU dentro de un kit; informativo, no se aplica. */
9
+ comboPriceCents?: number;
8
10
  source: PriceSourceEnum;
9
11
  createdBy: string;
10
12
  }
@@ -3,6 +3,7 @@ import type { MdmProviderEnum } from '../../enums/MdmProviderEnum';
3
3
  import type { ProductCategoryEnum } from '../../enums/ProductCategoryEnum';
4
4
  import type { ProductTierEnum } from '../../enums/ProductTierEnum';
5
5
  import type { TrackingModeEnum } from '../../enums/TrackingModeEnum';
6
+ import type { ItemTypeEnum } from '../../enums/ItemTypeEnum';
6
7
  import type { ProductComponent } from '../ProductComponent';
7
8
 
8
9
  /** Fila por SKU del catálogo de venta de una tienda (privateGetStoreStockCatalog). */
@@ -25,6 +26,8 @@ export interface StoreCatalogItem {
25
26
  mdmLockMode: MdmLockModeEnum | null;
26
27
  /** Solo si es kit. */
27
28
  components?: ProductComponent[];
29
+ /** Producto físico o servicio. Ausente = PRODUCT. */
30
+ itemType?: ItemTypeEnum;
28
31
  }
29
32
 
30
33
  /** Response de privateGetStoreStockCatalog. */