sigo-entities 1.2.550 → 1.2.552

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.
@@ -0,0 +1,34 @@
1
+ // Prueba sobre el build (dist): correr `npm run build` antes de `npm test`
2
+ import { test } from 'node:test'
3
+ import assert from 'node:assert/strict'
4
+ import 'reflect-metadata'
5
+ import { createRequire } from 'node:module'
6
+
7
+ const require = createRequire(import.meta.url)
8
+ const { DatosTransportistaDTO, validateAndFormatData } = require('../dist/index.js')
9
+
10
+ const transportistaViejo = {
11
+ Identificacion: '45879632',
12
+ Nombres: 'JUAN',
13
+ Apellidos: 'PEREZ',
14
+ PlacaVehiculo: 'ABC123',
15
+ Licencia: 'Q45879632',
16
+ RUCEmpresa: '20512345678',
17
+ }
18
+
19
+ test('Documento viejo sin RazonSocialEmpresa pasa la validación', async () => {
20
+ const result = await validateAndFormatData(transportistaViejo, DatosTransportistaDTO)
21
+ assert.equal(result.Identificacion, '45879632')
22
+ })
23
+
24
+ test('RazonSocialEmpresa se guarda cuando viene', async () => {
25
+ const result = await validateAndFormatData({ ...transportistaViejo, RazonSocialEmpresa: 'TRANSPORTES SAC' }, DatosTransportistaDTO)
26
+ assert.equal(result.RazonSocialEmpresa, 'TRANSPORTES SAC')
27
+ })
28
+
29
+ test('RazonSocialEmpresa de más de 300 caracteres se rechaza', async () => {
30
+ await assert.rejects(
31
+ validateAndFormatData({ ...transportistaViejo, RazonSocialEmpresa: 'X'.repeat(301) }, DatosTransportistaDTO),
32
+ /RazonSocialEmpresa/
33
+ )
34
+ })
package/dist/index.d.mts CHANGED
@@ -5532,6 +5532,7 @@ declare class DatosTransportistaDTO {
5532
5532
  PlacaVehiculo: string;
5533
5533
  Licencia: string;
5534
5534
  RUCEmpresa: string;
5535
+ RazonSocialEmpresa: string;
5535
5536
  }
5536
5537
 
5537
5538
  declare class DatosTransportistaChileDTO {
@@ -10901,7 +10902,7 @@ declare class AuthUserDto {
10901
10902
  firstNames: string;
10902
10903
  identification: string;
10903
10904
  root: boolean;
10904
- profileId: string;
10905
+ profileIds: string[];
10905
10906
  }
10906
10907
 
10907
10908
  declare class ProfileDto {
@@ -10918,7 +10919,7 @@ declare class PayloadTokenDto {
10918
10919
  user: AuthUserDto;
10919
10920
  /** Gestor que suplanta al usuario (selección de cuadrilla). */
10920
10921
  manager?: AuthUserDto;
10921
- profile: ProfileDto;
10922
+ profiles: ProfileDto[];
10922
10923
  company: CodeNameDto;
10923
10924
  stockroom: CodeNameDto;
10924
10925
  warehouse: CodeNameDto;
@@ -11006,7 +11007,7 @@ declare class UserEntity extends BaseEntity {
11006
11007
  companies: CompanyDto[];
11007
11008
  delegationIds: string[];
11008
11009
  root: boolean;
11009
- profileId: string;
11010
+ profileIds: string[];
11010
11011
  resourceSystem: ResourceSystemDto[];
11011
11012
  }
11012
11013
 
@@ -11120,7 +11121,7 @@ declare class UpdateProfileDto {
11120
11121
  }
11121
11122
 
11122
11123
  declare class UpdateUserDto {
11123
- profileId: string;
11124
+ profileIds: string[];
11124
11125
  }
11125
11126
 
11126
11127
  declare enum FileExtension {
@@ -11212,7 +11213,7 @@ declare class CreateUserDto {
11212
11213
  companies: CompanyDto[];
11213
11214
  delegationIds: string[];
11214
11215
  root: boolean;
11215
- profileId: string;
11216
+ profileIds: string[];
11216
11217
  resourceSystem: ResourceSystemDto[];
11217
11218
  }
11218
11219
 
package/dist/index.d.ts CHANGED
@@ -5532,6 +5532,7 @@ declare class DatosTransportistaDTO {
5532
5532
  PlacaVehiculo: string;
5533
5533
  Licencia: string;
5534
5534
  RUCEmpresa: string;
5535
+ RazonSocialEmpresa: string;
5535
5536
  }
5536
5537
 
5537
5538
  declare class DatosTransportistaChileDTO {
@@ -10901,7 +10902,7 @@ declare class AuthUserDto {
10901
10902
  firstNames: string;
10902
10903
  identification: string;
10903
10904
  root: boolean;
10904
- profileId: string;
10905
+ profileIds: string[];
10905
10906
  }
10906
10907
 
10907
10908
  declare class ProfileDto {
@@ -10918,7 +10919,7 @@ declare class PayloadTokenDto {
10918
10919
  user: AuthUserDto;
10919
10920
  /** Gestor que suplanta al usuario (selección de cuadrilla). */
10920
10921
  manager?: AuthUserDto;
10921
- profile: ProfileDto;
10922
+ profiles: ProfileDto[];
10922
10923
  company: CodeNameDto;
10923
10924
  stockroom: CodeNameDto;
10924
10925
  warehouse: CodeNameDto;
@@ -11006,7 +11007,7 @@ declare class UserEntity extends BaseEntity {
11006
11007
  companies: CompanyDto[];
11007
11008
  delegationIds: string[];
11008
11009
  root: boolean;
11009
- profileId: string;
11010
+ profileIds: string[];
11010
11011
  resourceSystem: ResourceSystemDto[];
11011
11012
  }
11012
11013
 
@@ -11120,7 +11121,7 @@ declare class UpdateProfileDto {
11120
11121
  }
11121
11122
 
11122
11123
  declare class UpdateUserDto {
11123
- profileId: string;
11124
+ profileIds: string[];
11124
11125
  }
11125
11126
 
11126
11127
  declare enum FileExtension {
@@ -11212,7 +11213,7 @@ declare class CreateUserDto {
11212
11213
  companies: CompanyDto[];
11213
11214
  delegationIds: string[];
11214
11215
  root: boolean;
11215
- profileId: string;
11216
+ profileIds: string[];
11216
11217
  resourceSystem: ResourceSystemDto[];
11217
11218
  }
11218
11219
 
package/dist/index.js CHANGED
@@ -29408,6 +29408,7 @@ var DatosTransportistaDTO = class {
29408
29408
  PlacaVehiculo = "";
29409
29409
  Licencia = "";
29410
29410
  RUCEmpresa = "";
29411
+ RazonSocialEmpresa = "";
29411
29412
  };
29412
29413
  __decorateClass([
29413
29414
  (0, import_class_validator498.IsString)({ message: "debe ser un texto" }),
@@ -29439,6 +29440,12 @@ __decorateClass([
29439
29440
  (0, import_class_validator498.Length)(0, 50, { message: "debe tener entre 0 y 50 caracteres" }),
29440
29441
  (0, import_class_transformer500.Expose)()
29441
29442
  ], DatosTransportistaDTO.prototype, "RUCEmpresa", 2);
29443
+ __decorateClass([
29444
+ (0, import_class_validator498.IsOptional)(),
29445
+ (0, import_class_validator498.IsString)({ message: "debe ser un texto" }),
29446
+ (0, import_class_validator498.Length)(0, 300, { message: "debe tener entre 0 y 300 caracteres" }),
29447
+ (0, import_class_transformer500.Expose)()
29448
+ ], DatosTransportistaDTO.prototype, "RazonSocialEmpresa", 2);
29442
29449
 
29443
29450
  // src/logistica/salida almacen/shared/dto/datos-transportista-chile-dto.ts
29444
29451
  var import_class_transformer501 = require("class-transformer");
@@ -56376,7 +56383,7 @@ var AuthUserDto = class {
56376
56383
  firstNames;
56377
56384
  identification;
56378
56385
  root;
56379
- profileId;
56386
+ profileIds;
56380
56387
  };
56381
56388
  __decorateClass([
56382
56389
  (0, import_class_validator834.IsDefined)({ message: "El correo es requerido" }),
@@ -56414,11 +56421,11 @@ __decorateClass([
56414
56421
  (0, import_class_transformer857.Expose)()
56415
56422
  ], AuthUserDto.prototype, "root", 2);
56416
56423
  __decorateClass([
56417
- (0, import_class_validator834.IsDefined)({ message: "El campo Perfil es obligatorio" }),
56418
- (0, import_class_validator834.ValidateIf)((_, value) => value !== ""),
56419
- (0, import_class_validator834.IsUUID)("4", { message: "El campo Perfil debe ser un UUID v4 v\xE1lido." }),
56424
+ (0, import_class_validator834.IsDefined)({ message: "El campo Perfiles es obligatorio" }),
56425
+ (0, import_class_validator834.IsArray)({ message: "El campo Perfiles debe ser un array" }),
56426
+ (0, import_class_validator834.IsUUID)("4", { each: true, message: "Cada perfil debe ser un UUID v4 v\xE1lido." }),
56420
56427
  (0, import_class_transformer857.Expose)()
56421
- ], AuthUserDto.prototype, "profileId", 2);
56428
+ ], AuthUserDto.prototype, "profileIds", 2);
56422
56429
 
56423
56430
  // src/v2/dtos/Profile.ts
56424
56431
  var import_class_transformer858 = require("class-transformer");
@@ -56453,7 +56460,7 @@ var EmploymentType = /* @__PURE__ */ ((EmploymentType2) => {
56453
56460
  var PayloadTokenDto = class {
56454
56461
  user;
56455
56462
  manager;
56456
- profile = new ProfileDto();
56463
+ profiles = [];
56457
56464
  company;
56458
56465
  stockroom;
56459
56466
  warehouse;
@@ -56473,10 +56480,11 @@ __decorateClass([
56473
56480
  (0, import_class_transformer859.Expose)()
56474
56481
  ], PayloadTokenDto.prototype, "manager", 2);
56475
56482
  __decorateClass([
56476
- (0, import_class_validator836.ValidateNested)(),
56483
+ (0, import_class_validator836.IsArray)({ message: "Los perfiles deben ser un array" }),
56484
+ (0, import_class_validator836.ValidateNested)({ each: true }),
56477
56485
  (0, import_class_transformer859.Type)(() => ProfileDto),
56478
56486
  (0, import_class_transformer859.Expose)()
56479
- ], PayloadTokenDto.prototype, "profile", 2);
56487
+ ], PayloadTokenDto.prototype, "profiles", 2);
56480
56488
  __decorateClass([
56481
56489
  (0, import_class_validator836.IsDefined)({ message: "La empresa es requerida" }),
56482
56490
  (0, import_class_transformer859.Type)(() => CodeNameDto),
@@ -56744,14 +56752,14 @@ __decorateClass([
56744
56752
  var import_class_validator845 = require("class-validator");
56745
56753
  var import_class_transformer868 = require("class-transformer");
56746
56754
  var UpdateUserDto = class {
56747
- profileId;
56755
+ profileIds;
56748
56756
  };
56749
56757
  __decorateClass([
56750
- (0, import_class_validator845.IsDefined)({ message: "El campo Perfil es obligatorio" }),
56751
- (0, import_class_validator845.ValidateIf)((_, value) => value !== ""),
56752
- (0, import_class_validator845.IsUUID)("4", { message: "El campo Perfil debe ser un UUID v4 v\xE1lido." }),
56758
+ (0, import_class_validator845.IsDefined)({ message: "El campo Perfiles es obligatorio" }),
56759
+ (0, import_class_validator845.IsArray)({ message: "El campo Perfiles debe ser un array" }),
56760
+ (0, import_class_validator845.IsUUID)("4", { each: true, message: "Cada perfil debe ser un UUID v4 v\xE1lido." }),
56753
56761
  (0, import_class_transformer868.Expose)()
56754
- ], UpdateUserDto.prototype, "profileId", 2);
56762
+ ], UpdateUserDto.prototype, "profileIds", 2);
56755
56763
 
56756
56764
  // src/v2/dtos/DocumentRequirement.ts
56757
56765
  var import_class_transformer869 = require("class-transformer");
@@ -57175,7 +57183,7 @@ var CreateUserDto = class {
57175
57183
  companies;
57176
57184
  delegationIds;
57177
57185
  root;
57178
- profileId;
57186
+ profileIds;
57179
57187
  resourceSystem;
57180
57188
  };
57181
57189
  __decorateClass([
@@ -57238,11 +57246,11 @@ __decorateClass([
57238
57246
  (0, import_class_transformer877.Expose)()
57239
57247
  ], CreateUserDto.prototype, "root", 2);
57240
57248
  __decorateClass([
57241
- (0, import_class_validator854.IsDefined)({ message: "El campo Perfil es obligatorio" }),
57242
- (0, import_class_validator854.ValidateIf)((_, value) => value !== ""),
57243
- (0, import_class_validator854.IsUUID)("4", { message: "El campo Perfil debe ser un UUID v4 v\xE1lido." }),
57249
+ (0, import_class_validator854.IsDefined)({ message: "El campo Perfiles es obligatorio" }),
57250
+ (0, import_class_validator854.IsArray)({ message: "El campo Perfiles debe ser un array" }),
57251
+ (0, import_class_validator854.IsUUID)("4", { each: true, message: "Cada perfil debe ser un UUID v4 v\xE1lido." }),
57244
57252
  (0, import_class_transformer877.Expose)()
57245
- ], CreateUserDto.prototype, "profileId", 2);
57253
+ ], CreateUserDto.prototype, "profileIds", 2);
57246
57254
  __decorateClass([
57247
57255
  (0, import_class_validator854.IsDefined)({ message: "Resurso sistema es obligatoria" }),
57248
57256
  (0, import_class_transformer877.Type)(() => ResourceSystemDto),
@@ -58608,7 +58616,7 @@ var UserEntity = class extends BaseEntity {
58608
58616
  companies;
58609
58617
  delegationIds;
58610
58618
  root;
58611
- profileId;
58619
+ profileIds;
58612
58620
  resourceSystem;
58613
58621
  };
58614
58622
  __decorateClass([
@@ -58666,11 +58674,11 @@ __decorateClass([
58666
58674
  (0, import_class_transformer909.Expose)()
58667
58675
  ], UserEntity.prototype, "root", 2);
58668
58676
  __decorateClass([
58669
- (0, import_class_validator885.IsDefined)({ message: "El campo Perfil es obligatorio" }),
58670
- (0, import_class_validator885.ValidateIf)((_, value) => value !== ""),
58671
- (0, import_class_validator885.IsUUID)("4", { message: "El campo Perfil debe ser un UUID v4 v\xE1lido." }),
58677
+ (0, import_class_validator885.IsDefined)({ message: "El campo Perfiles es obligatorio" }),
58678
+ (0, import_class_validator885.IsArray)({ message: "El campo Perfiles debe ser un array" }),
58679
+ (0, import_class_validator885.IsUUID)("4", { each: true, message: "Cada perfil debe ser un UUID v4 v\xE1lido." }),
58672
58680
  (0, import_class_transformer909.Expose)()
58673
- ], UserEntity.prototype, "profileId", 2);
58681
+ ], UserEntity.prototype, "profileIds", 2);
58674
58682
  __decorateClass([
58675
58683
  (0, import_class_validator885.IsDefined)({ message: "Resurso sistema es obligatoria" }),
58676
58684
  (0, import_class_transformer909.Type)(() => ResourceSystemDto),