@gls_spain/gps-common 35.15.1 → 35.15.3

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.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,24 @@
1
- ## [35.15.1](https://github.com/GLS-Spain/gps-common/compare/v35.15.0...v35.15.1) (2026-03-06)
1
+ ## [35.15.3](https://github.com/GLS-Spain/gps-common/compare/v35.15.2...v35.15.3) (2026-03-10)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * add imports schema lockers create ([d34edce](https://github.com/GLS-Spain/gps-common/commit/d34edce15f31b4f0f3c0b2ec05c47f5aa56e3e5f))
6
+ * add properties locker schema ([3450fae](https://github.com/GLS-Spain/gps-common/commit/3450fae69e5079590a6d8e160b49907a6cd75992))
7
7
 
8
+ ## [35.15.2](https://github.com/GLS-Spain/gps-common/compare/v35.15.1...v35.15.2) (2026-03-06)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * test schema lockers ([a525c25](https://github.com/GLS-Spain/gps-common/commit/a525c256202951fd9b9354109eae04521d94125d))
14
+
15
+ ## [35.15.1](https://github.com/GLS-Spain/gps-common/compare/v35.15.0...v35.15.1) (2026-03-06)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * add imports schema lockers create ([d34edce](https://github.com/GLS-Spain/gps-common/commit/d34edce15f31b4f0f3c0b2ec05c47f5aa56e3e5f))
21
+
8
22
  # [35.15.0](https://github.com/GLS-Spain/gps-common/compare/v35.14.3...v35.15.0) (2026-03-06)
9
23
 
10
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "35.15.1",
3
+ "version": "35.15.3",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "keywords": [
6
6
  "gls"
@@ -557,145 +557,52 @@ const upsertShopResponse = () => ({
557
557
 
558
558
  // LOCKERS
559
559
 
560
- const locker = () => ({
561
- title: 'locker',
562
- type: 'object',
563
- properties: {
564
- _id: uuid(),
565
- createdAt: datetime(),
566
- updatedAt: datetime(),
567
- deletable: { type: 'boolean' },
568
- readonly: { type: 'boolean', description: 'readonly shops do not allow updates or adding expeditions to them' },
569
- international: {
570
- type: 'object',
571
- properties: {
572
- partnerKey: { type: 'string' },
573
- parcelShopId: { type: 'string' },
574
- },
575
- required: ['partnerKey', 'parcelShopId'],
576
- additionalProperties: false,
577
- },
578
- defaults: {
579
- type: 'object',
580
- properties: { ...pickProperties(defaults(), ['derivationSettings', 'expirationSettings']) },
581
- required: ['derivationSettings', 'expirationSettings'],
582
- additionalProperties: false,
583
- },
584
- network: {
585
- type: 'object',
586
- properties: { ...pickProperties(network(), ['_id', 'name', 'derivationSettings', 'expirationSettings']) },
587
- required: ['_id', 'name'],
588
- additionalProperties: false,
589
- },
590
- zone: {
591
- type: 'object',
592
- properties: { ...pickProperties(zone(), ['_id', 'name']) },
593
- required: ['_id', 'name'],
594
- additionalProperties: false,
595
- },
596
- openingRepresentative: shopRepresentative(),
597
- managingRepresentative: shopRepresentative(),
598
- status: {
599
- type: 'object',
600
- properties: {
601
- code: { type: 'string', enum: ['enabled', 'disabled', 'manuallyDisabled'] },
602
- disabled: {
603
- type: 'object',
604
- properties: {
605
- at: datetime(),
606
- reason: { type: 'string', trim: true },
607
- },
608
- required: ['at', 'reason'],
609
- additionalProperties: false,
610
- },
611
- manuallyDisabled: {
612
- type: 'object',
613
- properties: {
614
- _id: uuid(),
615
- at: datetime(),
616
- to: datetime(),
617
- reason: { type: 'string', trim: true },
618
- },
619
- required: ['at', 'reason'],
620
- additionalProperties: false,
621
- },
622
- },
623
- required: ['code'],
624
- additionalProperties: false,
625
- },
626
- name: { type: 'string', trim: true },
627
- address: addressWithRequiredLocation(),
628
- capabilities: {
629
- type: 'array',
630
- items: { type: 'string', enum: ['deliver', 'pickup', 'sell', 'sellplus'] },
631
- uniqueItems: true,
632
- },
633
- openingSchedule: shopSchedule(),
634
- holidays: { type: 'array', items: shopHoliday(), uniqueItems: true },
635
- timezone: timezone(),
636
- contacts: {
637
- type: 'array',
638
- items: contact(),
639
- },
640
- fiscal: fiscal(),
641
- activity: shopActivity(),
642
- notes: { type: 'string', trim: true },
643
- derivationSettings: derivationSettings(),
644
- expirationSettings: expirationSettings(),
645
- eco: { type: 'boolean', default: false },
646
- gold: { type: 'boolean', default: false },
647
- radical: { type: 'boolean', default: false },
648
- operations: { type: ['boolean', 'string'], trim: true },
649
- reverseLogistic: { type: 'boolean', default: false },
650
- squareCode: { type: ['integer', 'string'], minimum: 0, maximum: 32767, description: 'agency code' },
651
- clientCode: { type: ['integer', 'string'], description: 'client code' },
652
- channelingAgencyCode: { type: ['integer', 'string', 'null'], description: 'Channeling Agency Code' },
653
- capacity: { type: 'string' },
654
- courierAccessCode: {
655
- type: 'object',
656
- properties: {
657
- code: { type: 'string' },
658
- updatedAt: { type: 'string', format: 'date-time' },
659
- },
660
- required: ['code', 'updatedAt'],
661
- additionalProperties: false,
662
- },
663
- },
664
- required: [
665
- '_id',
666
- 'createdAt',
667
- 'updatedAt',
668
- 'deletable',
669
- 'readonly',
670
- 'international',
671
- 'defaults',
672
- 'network',
673
- 'status',
674
- 'name',
675
- 'address',
676
- 'capabilities',
677
- 'openingSchedule',
678
- 'timezone',
679
- 'contacts',
680
- ],
681
- additionalProperties: false,
682
- });
683
-
684
560
  const createLockerRequest = () =>
685
561
  createRequest({
686
562
  type: 'object',
687
563
  properties: {
688
- // ----- parcelshop -----
564
+
689
565
  parcelshop: {
690
566
  type: 'object',
691
567
  properties: {
692
- _id: uuid(), // el handler lo asigna a locker.carrier.lockerId
568
+ _id: uuid(),
693
569
  createdAt: datetime(),
694
570
  network: objectWithUuid(),
695
571
  zone: objectWithUuid(),
696
572
  openingRepresentative: setShopRepresentative(),
697
573
  managingRepresentative: setShopRepresentative(),
698
- name: shop().properties.name,
574
+
575
+ status: {
576
+ type: 'object',
577
+ properties: {
578
+ code: { type: 'string', enum: ['enabled', 'disabled', 'manuallyDisabled'] },
579
+ disabled: {
580
+ type: 'object',
581
+ properties: {
582
+ at: datetime(),
583
+ reason: { type: 'string', trim: true },
584
+ },
585
+ required: ['at', 'reason'],
586
+ additionalProperties: false,
587
+ },
588
+ manuallyDisabled: {
589
+ type: 'object',
590
+ properties: {
591
+ _id: uuid(),
592
+ at: datetime(),
593
+ to: datetime(),
594
+ reason: { type: 'string', trim: true },
595
+ },
596
+ required: ['at', 'reason'],
597
+ additionalProperties: false,
598
+ },
599
+ },
600
+ required: ['code'],
601
+ additionalProperties: false,
602
+ },
603
+
604
+ name: { type: 'string', trim: true },
605
+
699
606
  address: {
700
607
  type: 'object',
701
608
  properties: {
@@ -704,6 +611,7 @@ const createLockerRequest = () =>
704
611
  postalCode: { type: 'string', trim: true },
705
612
  locality: { type: 'string', trim: true },
706
613
  country: { type: 'string', trim: true },
614
+ access_descript_locker: { type: 'string', trim: true },
707
615
  location: {
708
616
  type: 'object',
709
617
  properties: {
@@ -711,56 +619,48 @@ const createLockerRequest = () =>
711
619
  type: 'object',
712
620
  properties: {
713
621
  type: { type: 'string', enum: ['Point'] },
714
- coordinates: { type: 'array', items: { type: 'number' }, minItems: 2, maxItems: 2 },
622
+ coordinates: {
623
+ type: 'array',
624
+ items: { type: 'number' },
625
+ minItems: 2,
626
+ maxItems: 2,
627
+ },
715
628
  },
716
- required: ['coordinates'],
629
+ required: ['type', 'coordinates'],
717
630
  additionalProperties: false,
718
631
  },
719
- precision: { type: 'string' },
720
632
  },
721
633
  required: ['geometry'],
722
634
  additionalProperties: false,
723
635
  },
724
636
  },
725
- additionalProperties: true, // permite access_descript_locker y otros campos extra
637
+ required: ['street', 'postalCode', 'locality', 'country', 'location'],
638
+ additionalProperties: false,
726
639
  },
640
+
727
641
  openingSchedule: shop().properties.openingSchedule,
728
642
  timezone: shop().properties.timezone,
729
643
  activity: shop().properties.activity,
730
644
  eco: shop().properties.eco,
731
- status: {
645
+
646
+ fiscal: fiscal(),
647
+
648
+ nxt: {
732
649
  type: 'object',
733
650
  properties: {
734
- code: { type: 'string', enum: ['enabled', 'disabled', 'manuallyDisabled'] },
735
- disabled: {
736
- type: 'object',
737
- properties: {
738
- at: datetime(),
739
- reason: { type: 'string', trim: true },
740
- },
741
- required: ['at', 'reason'],
742
- additionalProperties: false,
743
- },
744
- manuallyDisabled: {
745
- type: 'object',
746
- properties: {
747
- _id: uuid(),
748
- at: datetime(),
749
- to: datetime(),
750
- reason: { type: 'string', trim: true },
751
- },
752
- required: ['at', 'reason'],
753
- additionalProperties: false,
754
- },
651
+ parcelShopId: { type: 'string' },
755
652
  },
756
- required: ['code'],
653
+ required: ['parcelShopId'],
757
654
  additionalProperties: false,
758
655
  },
656
+
657
+ // Campos _locker: fuente de verdad para coordenadas y dirección
759
658
  direccion_locker: { type: 'string', trim: true },
760
659
  codpostal_locker: { type: 'string', trim: true },
761
660
  ciudad_locker: { type: 'string', trim: true },
762
- longitud_locker: { type: 'number' },
763
- latitud_locker: { type: 'number' },
661
+ // ✅ longitud_locker y latitud_locker son la fuente de verdad de coordenadas
662
+ longitud_locker: { type: 'number', description: 'Fuente de verdad para longitude — sobreescribe address.location.geometry.coordinates[0]' },
663
+ latitud_locker: { type: 'number', description: 'Fuente de verdad para latitude — sobreescribe address.location.geometry.coordinates[1]' },
764
664
  capacity_locker: { type: 'string' },
765
665
  access_descript_locker: { type: 'string', trim: true },
766
666
  },
@@ -779,18 +679,18 @@ const createLockerRequest = () =>
779
679
  ],
780
680
  additionalProperties: false,
781
681
  },
782
- // ----- locker ----- NXT MODEL
783
- lockerDevice: {
784
- title: 'lockerDevice',
682
+
683
+ locker: {
684
+ title: 'locker',
785
685
  type: 'object',
786
686
  properties: {
787
687
 
788
688
  provider: {
789
689
  type: 'object',
790
690
  properties: {
791
- name: { type: 'string', trim: true }, // "KEBA"
792
- lockerVersion: { type: 'string', trim: true }, // "v1.0"
793
- lockerModel: { type: 'string', trim: true }, // "gls_es_0001_m03_b031"
691
+ name: { type: 'string', trim: true },
692
+ lockerVersion: { type: 'string', trim: true },
693
+ lockerModel: { type: 'string', trim: true },
794
694
  },
795
695
  required: ['name'],
796
696
  additionalProperties: false,
@@ -799,13 +699,13 @@ const createLockerRequest = () =>
799
699
  location: {
800
700
  type: 'object',
801
701
  properties: {
802
- streetNumber: { type: 'string', trim: true }, // "3"
803
- street: { type: 'string', trim: true }, // "AL-12 3"
804
- postalCode: { type: 'string', trim: true }, // "04006"
805
- lon: { type: 'number' }, // -2.4229276567318436
806
- lat: { type: 'number' }, // 36.84309556940104
807
- countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 }, // "ES"
808
- city: { type: 'string', trim: true }, // "Almería"
702
+ streetNumber: { type: 'string', trim: true },
703
+ street: { type: 'string', trim: true },
704
+ postalCode: { type: 'string', trim: true },
705
+ lon: { type: 'number' },
706
+ lat: { type: 'number' },
707
+ countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 },
708
+ city: { type: 'string', trim: true },
809
709
  },
810
710
  required: ['street', 'postalCode', 'countryCode', 'city'],
811
711
  additionalProperties: false,
@@ -814,9 +714,9 @@ const createLockerRequest = () =>
814
714
  features: {
815
715
  type: 'object',
816
716
  properties: {
817
- hasScreen: { type: 'boolean' }, // true
818
- hasPinPad: { type: 'boolean' }, // true
819
- hasPinBarcodeReader: { type: 'boolean' }, // true
717
+ hasScreen: { type: 'boolean' },
718
+ hasPinPad: { type: 'boolean' },
719
+ hasPinBarcodeReader: { type: 'boolean' },
820
720
  },
821
721
  additionalProperties: false,
822
722
  },
@@ -824,9 +724,9 @@ const createLockerRequest = () =>
824
724
  carrier: {
825
725
  type: 'object',
826
726
  properties: {
827
- lockerName: { type: 'string', trim: true }, // "Locker GLS NXT - 24/7 MOEVE Los Partidores"
828
- activationDate: { type: 'string', format: 'date-time' }, // "2027-03-10T01:00:00Z"
829
- lockerId: { type: 'string' }, // uuid — asignado por el handler antes de validar
727
+ lockerName: { type: 'string', trim: true },
728
+ activationDate: { type: 'string', format: 'date-time' },
729
+ lockerId: { type: 'string' }, // asignado por el handler con parcelshop._id
830
730
  },
831
731
  required: ['lockerName', 'lockerId'],
832
732
  additionalProperties: false,
@@ -835,8 +735,10 @@ const createLockerRequest = () =>
835
735
  },
836
736
  required: ['provider', 'location', 'carrier'],
837
737
  additionalProperties: false,
838
- }
738
+ },
739
+
839
740
  },
741
+ // FIX: era ['parcelshop', 'locker'] con 'lockerDevice' en properties → siempre fallaba
840
742
  required: ['parcelshop', 'locker'],
841
743
  additionalProperties: false,
842
744
  });
@@ -844,9 +746,9 @@ const createLockerRequest = () =>
844
746
  const createLockerResponse = () => createResponse(locker());
845
747
 
846
748
 
847
-
848
749
  module.exports = {
849
750
  shop,
751
+ locker,
850
752
  objectWithShopId,
851
753
  createShopRequest,
852
754
  createShopResponse,
package/schemas/index.js CHANGED
@@ -62,6 +62,7 @@ const {
62
62
  upsertShopResponse,
63
63
  shop,
64
64
  createLockerRequest,
65
+ locker,
65
66
  } = require('./definitions/shops');
66
67
  const {
67
68
  createExpeditionRequest,
@@ -310,6 +311,7 @@ const shopUserSchema = addMetadata(shopUser(), 'shopUser');
310
311
  const saleSchema = addMetadata(sale(), 'sale');
311
312
  const integrationSchema = addMetadata(integration(), 'integration');
312
313
  const shopSchema = addMetadata(shop(), 'shop');
314
+ const lockerSchema = addMetadata(locker(), 'locker');
313
315
  const networkSchema = addMetadata(network(), 'network');
314
316
  const countersSchema = addMetadata(counters(), 'counters');
315
317
  const historicRecordSchema = addMetadata(historicRecord(), 'historicRecord');
@@ -470,6 +472,7 @@ module.exports = {
470
472
  sale: saleSchema,
471
473
  integration: integrationSchema,
472
474
  shop: shopSchema,
475
+ locker: lockerSchema,
473
476
  network: networkSchema,
474
477
  zone: zoneSchema,
475
478
  counters: countersSchema,