@gls_spain/gps-common 35.19.3 → 35.20.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.
- package/CHANGELOG.md +21 -0
- package/package.json +1 -1
- package/schemas/definitions/networks.js +29 -3
- package/schemas/definitions/shops.js +88 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [35.20.0](https://github.com/GLS-Spain/gps-common/compare/v35.19.4...v35.20.0) (2026-10-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* network & shops updated schemas ([73ecb9e](https://github.com/GLS-Spain/gps-common/commit/73ecb9ed5c6c998a93763599507db3368beb68a8))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* shop.channeling ([f15c86b](https://github.com/GLS-Spain/gps-common/commit/f15c86b6c8c8c7685cbc0898ce8d48105ec1c034))
|
|
12
|
+
|
|
13
|
+
## [35.19.4](https://github.com/GLS-Spain/gps-common/compare/v35.19.3...v35.19.4) (2026-10-19)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* channeling agency code now is type number ([9d09898](https://github.com/GLS-Spain/gps-common/commit/9d09898d7abef0c1658f2edb04e532e1de825447))
|
|
19
|
+
* channelingagencycode to type integer instaed number ([41cdd9a](https://github.com/GLS-Spain/gps-common/commit/41cdd9af0bddf7187ce2a17b2f6e0db64785e9de))
|
|
20
|
+
* check channelingAgencyCode is not required, can be null, integer and can be not an empty string ([79d9bad](https://github.com/GLS-Spain/gps-common/commit/79d9bad7e8efccd259d44386bfde3f95fa3d478c))
|
|
21
|
+
|
|
1
22
|
## [35.19.3](https://github.com/GLS-Spain/gps-common/compare/v35.19.2...v35.19.3) (2026-10-14)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
|
@@ -15,6 +15,10 @@ const {
|
|
|
15
15
|
const { findAll, findById, findByName, objectWithUuidAndName, contact, fiscal, networkType } = require('./common');
|
|
16
16
|
const { defaults, derivationSettings, expirationSettings } = require('./defaults');
|
|
17
17
|
|
|
18
|
+
function parseAddressType() {
|
|
19
|
+
return ['auto'];
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
const network = () => ({
|
|
19
23
|
title: 'network',
|
|
20
24
|
type: 'object',
|
|
@@ -47,9 +51,31 @@ const network = () => ({
|
|
|
47
51
|
required: ['networkPercentage', 'shopPercentage'],
|
|
48
52
|
additionalProperties: false,
|
|
49
53
|
},
|
|
50
|
-
type: networkType()
|
|
54
|
+
type: networkType(),
|
|
55
|
+
isActive: { type: 'boolean' },
|
|
56
|
+
searchName: { type: 'string' },
|
|
57
|
+
canUpdate: { type: 'boolean' },
|
|
58
|
+
// country: countryCode(),
|
|
59
|
+
country: { type: 'string' },
|
|
60
|
+
isInternational: { type: 'boolean' },
|
|
61
|
+
mandatoryShopFiscalData: { type: 'boolean' },
|
|
62
|
+
calcChanneling: { type: 'boolean' },
|
|
63
|
+
parseAddress: { type: 'string', enum: parseAddressType() },
|
|
51
64
|
},
|
|
52
|
-
required: [
|
|
65
|
+
required: [
|
|
66
|
+
'_id',
|
|
67
|
+
'createdAt',
|
|
68
|
+
'updatedAt',
|
|
69
|
+
'deletable',
|
|
70
|
+
'readonly',
|
|
71
|
+
'defaults',
|
|
72
|
+
'name',
|
|
73
|
+
'contacts',
|
|
74
|
+
'salesSettings',
|
|
75
|
+
'type',
|
|
76
|
+
'isActive',
|
|
77
|
+
'searchName',
|
|
78
|
+
],
|
|
53
79
|
additionalProperties: false,
|
|
54
80
|
});
|
|
55
81
|
|
|
@@ -74,7 +100,7 @@ const createNetworkRequest = () =>
|
|
|
74
100
|
'derivationSettings',
|
|
75
101
|
'expirationSettings',
|
|
76
102
|
'salesSettings',
|
|
77
|
-
'type'
|
|
103
|
+
'type',
|
|
78
104
|
]),
|
|
79
105
|
},
|
|
80
106
|
required: ['name', 'salesSettings'],
|
|
@@ -19,7 +19,7 @@ const {
|
|
|
19
19
|
addressWithRequiredLocation,
|
|
20
20
|
findAll,
|
|
21
21
|
findById,
|
|
22
|
-
findByStringId,
|
|
22
|
+
findByStringId, // _id string numérico — usado en updateLockerRequest
|
|
23
23
|
findByName,
|
|
24
24
|
findByAddress,
|
|
25
25
|
findByCircularArea,
|
|
@@ -27,8 +27,8 @@ const {
|
|
|
27
27
|
timezone,
|
|
28
28
|
contact,
|
|
29
29
|
fiscal,
|
|
30
|
-
lockerAddress,
|
|
31
|
-
lockerFiscal,
|
|
30
|
+
lockerAddress, // address con maxLength de BD + campo access_descript_locker
|
|
31
|
+
lockerFiscal, // fiscal con required mínimo y maxLength de BD
|
|
32
32
|
findByFiscal,
|
|
33
33
|
findByIdInternational,
|
|
34
34
|
} = require('./common');
|
|
@@ -58,7 +58,7 @@ const shopSchedule = () => ({
|
|
|
58
58
|
saturday: shopDaySchedule(),
|
|
59
59
|
sunday: shopDaySchedule(),
|
|
60
60
|
},
|
|
61
|
-
required: ['type', 'weekly']
|
|
61
|
+
required: ['type', 'weekly'], // saturday and sunday are optional
|
|
62
62
|
additionalProperties: false,
|
|
63
63
|
},
|
|
64
64
|
{
|
|
@@ -95,7 +95,6 @@ const shopHoliday = () => ({
|
|
|
95
95
|
additionalProperties: false,
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
-
|
|
99
98
|
const shopRepresentative = () => ({
|
|
100
99
|
type: 'object',
|
|
101
100
|
properties: {
|
|
@@ -150,6 +149,40 @@ const shopActivity = () => ({
|
|
|
150
149
|
],
|
|
151
150
|
});
|
|
152
151
|
|
|
152
|
+
function channelingType() {
|
|
153
|
+
return ['postalCode', 'parcelShop'];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function shopChanneling() {
|
|
157
|
+
return {
|
|
158
|
+
type: 'object',
|
|
159
|
+
properties: {
|
|
160
|
+
at: { type: 'string', format: 'date-time' },
|
|
161
|
+
type: { type: 'string', enum: channelingType() },
|
|
162
|
+
agency: {
|
|
163
|
+
type: 'object',
|
|
164
|
+
properties: {
|
|
165
|
+
code: { type: 'integer' },
|
|
166
|
+
name: { type: 'string' },
|
|
167
|
+
nxt: {
|
|
168
|
+
description:'nxt data',
|
|
169
|
+
type: 'object',
|
|
170
|
+
properties: {
|
|
171
|
+
uid: { type: 'string' },
|
|
172
|
+
},
|
|
173
|
+
required: ['uid'],
|
|
174
|
+
additionalProperties: false,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
required: ['code', 'name'],
|
|
178
|
+
additionalProperties: false,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
required: ['at'],
|
|
182
|
+
additionalProperties: false,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
153
186
|
const shop = () => ({
|
|
154
187
|
title: 'shop',
|
|
155
188
|
type: 'object',
|
|
@@ -246,7 +279,7 @@ const shop = () => ({
|
|
|
246
279
|
squareCode: { type: ['integer', 'string'], minimum: 0, maximum: 32767, description: 'agency code' },
|
|
247
280
|
clientCode: { type: ['integer', 'string'], description: 'client code' },
|
|
248
281
|
// 2024-07-22 JJC campo de agencia de canalización
|
|
249
|
-
channelingAgencyCode: { type: ['integer', '
|
|
282
|
+
channelingAgencyCode: { type: ['integer', 'null'], minimum: 0, maximum: 32767, description: 'Channeling Agency Code' },
|
|
250
283
|
// Volume capacity 07/11/2024
|
|
251
284
|
capacity: { type: 'string' },
|
|
252
285
|
// NXT integration
|
|
@@ -260,6 +293,8 @@ const shop = () => ({
|
|
|
260
293
|
required: ['code', 'updatedAt'],
|
|
261
294
|
additionalProperties: false,
|
|
262
295
|
},
|
|
296
|
+
// 2026-10-15 JL cálculo de canalización
|
|
297
|
+
shopChanneling: shopChanneling(),
|
|
263
298
|
},
|
|
264
299
|
required: [
|
|
265
300
|
'_id',
|
|
@@ -336,7 +371,7 @@ const createShopRequest = () =>
|
|
|
336
371
|
'clientCode',
|
|
337
372
|
'channelingAgencyCode',
|
|
338
373
|
]),
|
|
339
|
-
}
|
|
374
|
+
}, // Shop
|
|
340
375
|
required: ['network', 'status', 'name', 'address', 'openingSchedule', 'timezone'],
|
|
341
376
|
additionalProperties: false,
|
|
342
377
|
});
|
|
@@ -429,6 +464,15 @@ const findShopsNetworkAdminRequest = () =>
|
|
|
429
464
|
|
|
430
465
|
const findShopsResponse = () => findResponse(shop());
|
|
431
466
|
|
|
467
|
+
// En update, los strings obligatorios no pueden llegar vacíos: trim convierte " " en "" y se sobrescribiría el valor en BD.
|
|
468
|
+
// Se usa pattern en vez de minLength porque Ajv valida minLength antes de que trim modifique el dato.
|
|
469
|
+
const nonEmpty = () => ({ pattern: '\\S' });
|
|
470
|
+
|
|
471
|
+
const updateShopAddress = () =>
|
|
472
|
+
mergeSchemas(addressWithRequiredLocation(), {
|
|
473
|
+
properties: { street: nonEmpty(), postalCode: nonEmpty(), locality: nonEmpty(), country: nonEmpty() },
|
|
474
|
+
});
|
|
475
|
+
|
|
432
476
|
const updateShopRequest = () =>
|
|
433
477
|
updateRequest(
|
|
434
478
|
findById(),
|
|
@@ -461,6 +505,10 @@ const updateShopRequest = () =>
|
|
|
461
505
|
],
|
|
462
506
|
['fiscal', 'activity', 'notes', 'derivationSettings', 'expirationSettings'],
|
|
463
507
|
),
|
|
508
|
+
name: mergeSchemas(shop().properties.name, nonEmpty()),
|
|
509
|
+
address: updateShopAddress(),
|
|
510
|
+
squareCode: mergeSchemas(shop().properties.squareCode, nonEmpty()),
|
|
511
|
+
clientCode: mergeSchemas(shop().properties.clientCode, nonEmpty()),
|
|
464
512
|
},
|
|
465
513
|
minProperties: 0,
|
|
466
514
|
additionalProperties: false,
|
|
@@ -579,9 +627,9 @@ const locker = () => ({
|
|
|
579
627
|
|
|
580
628
|
// reutilizamos openingSchedule, timezone, activity y eco de shop()
|
|
581
629
|
openingSchedule: shop().properties.openingSchedule,
|
|
582
|
-
timezone:
|
|
583
|
-
activity:
|
|
584
|
-
eco:
|
|
630
|
+
timezone: shop().properties.timezone,
|
|
631
|
+
activity: shop().properties.activity,
|
|
632
|
+
eco: shop().properties.eco,
|
|
585
633
|
|
|
586
634
|
// fiscal con required mínimo y maxLength de BD — ver common.js
|
|
587
635
|
fiscal: lockerFiscal(),
|
|
@@ -597,17 +645,21 @@ const locker = () => ({
|
|
|
597
645
|
|
|
598
646
|
// ── Campos _locker — fuente de verdad para coordenadas y dirección ───────
|
|
599
647
|
direccion_locker: { type: 'string', trim: true, maxLength: 255 }, // varchar(255)
|
|
600
|
-
codpostal_locker: { type: 'string', trim: true, maxLength: 15 },
|
|
601
|
-
ciudad_locker:
|
|
648
|
+
codpostal_locker: { type: 'string', trim: true, maxLength: 15 }, // varchar(15)
|
|
649
|
+
ciudad_locker: { type: 'string', trim: true, maxLength: 100 }, // varchar(100)
|
|
602
650
|
longitud_locker: {
|
|
603
|
-
type: 'number',
|
|
651
|
+
type: 'number',
|
|
652
|
+
minimum: -180,
|
|
653
|
+
maximum: 180,
|
|
604
654
|
description: 'Fuente de verdad para longitude — sobreescribe address.location.geometry.coordinates[0]',
|
|
605
655
|
},
|
|
606
656
|
latitud_locker: {
|
|
607
|
-
type: 'number',
|
|
657
|
+
type: 'number',
|
|
658
|
+
minimum: -90,
|
|
659
|
+
maximum: 90,
|
|
608
660
|
description: 'Fuente de verdad para latitude — sobreescribe address.location.geometry.coordinates[1]',
|
|
609
661
|
},
|
|
610
|
-
capacity_locker:
|
|
662
|
+
capacity_locker: { type: 'string', maxLength: 20 },
|
|
611
663
|
access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
|
|
612
664
|
},
|
|
613
665
|
required: [
|
|
@@ -635,9 +687,9 @@ const lockerNxt = () => ({
|
|
|
635
687
|
provider: {
|
|
636
688
|
type: 'object',
|
|
637
689
|
properties: {
|
|
638
|
-
name:
|
|
690
|
+
name: { type: 'string', trim: true, maxLength: 100 }, // PartnerKey varchar(100)
|
|
639
691
|
lockerVersion: { type: 'string', trim: true, maxLength: 20 },
|
|
640
|
-
lockerModel:
|
|
692
|
+
lockerModel: { type: 'string', trim: true, maxLength: 100 },
|
|
641
693
|
},
|
|
642
694
|
required: ['name'],
|
|
643
695
|
additionalProperties: false,
|
|
@@ -646,12 +698,12 @@ const lockerNxt = () => ({
|
|
|
646
698
|
type: 'object',
|
|
647
699
|
properties: {
|
|
648
700
|
streetNumber: { type: 'string', trim: true, maxLength: 20 },
|
|
649
|
-
street:
|
|
650
|
-
postalCode:
|
|
651
|
-
lon:
|
|
652
|
-
lat:
|
|
653
|
-
countryCode:
|
|
654
|
-
city:
|
|
701
|
+
street: { type: 'string', trim: true, maxLength: 255 }, // varchar(255)
|
|
702
|
+
postalCode: { type: 'string', trim: true, maxLength: 15 }, // varchar(15)
|
|
703
|
+
lon: { type: 'number', minimum: -180, maximum: 180 }, // float BD
|
|
704
|
+
lat: { type: 'number', minimum: -90, maximum: 90 },
|
|
705
|
+
countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 }, // ISO 3166-1 alpha-2
|
|
706
|
+
city: { type: 'string', trim: true, maxLength: 100 }, // varchar(100)
|
|
655
707
|
},
|
|
656
708
|
required: ['street', 'postalCode', 'countryCode', 'city'],
|
|
657
709
|
additionalProperties: false,
|
|
@@ -659,8 +711,8 @@ const lockerNxt = () => ({
|
|
|
659
711
|
features: {
|
|
660
712
|
type: 'object',
|
|
661
713
|
properties: {
|
|
662
|
-
hasScreen:
|
|
663
|
-
hasPinPad:
|
|
714
|
+
hasScreen: { type: 'boolean' },
|
|
715
|
+
hasPinPad: { type: 'boolean' },
|
|
664
716
|
hasPinBarcodeReader: { type: 'boolean' },
|
|
665
717
|
},
|
|
666
718
|
additionalProperties: false,
|
|
@@ -668,9 +720,9 @@ const lockerNxt = () => ({
|
|
|
668
720
|
carrier: {
|
|
669
721
|
type: 'object',
|
|
670
722
|
properties: {
|
|
671
|
-
lockerName:
|
|
723
|
+
lockerName: { type: 'string', trim: true, maxLength: 100 }, // Nombre varchar(100)
|
|
672
724
|
activationDate: { type: 'string', format: 'date-time' },
|
|
673
|
-
lockerId:
|
|
725
|
+
lockerId: { type: 'string', maxLength: 36 }, // UUID = 36 chars
|
|
674
726
|
},
|
|
675
727
|
required: ['lockerName'],
|
|
676
728
|
additionalProperties: false,
|
|
@@ -711,9 +763,9 @@ const createLockerRequest = () =>
|
|
|
711
763
|
...pickProperties(locker(), ['_id', 'createdAt']),
|
|
712
764
|
// relaciones como objectWithUuid
|
|
713
765
|
network: objectWithUuid(),
|
|
714
|
-
zone:
|
|
766
|
+
zone: objectWithUuid(),
|
|
715
767
|
// representantes en formato "set" (solo _id + since, sin name)
|
|
716
|
-
openingRepresentative:
|
|
768
|
+
openingRepresentative: setShopRepresentative(),
|
|
717
769
|
managingRepresentative: setShopRepresentative(),
|
|
718
770
|
// resto de campos tomados directamente del schema base locker()
|
|
719
771
|
...pickProperties(locker(), [
|
|
@@ -775,11 +827,11 @@ const updateLockerRequest = () =>
|
|
|
775
827
|
type: 'object',
|
|
776
828
|
properties: {
|
|
777
829
|
// relaciones y representantes con helpers reutilizados de shop
|
|
778
|
-
network:
|
|
779
|
-
zone:
|
|
780
|
-
openingRepresentative:
|
|
830
|
+
network: schemaOrNull(objectWithUuid()),
|
|
831
|
+
zone: schemaOrNull(objectWithUuid()),
|
|
832
|
+
openingRepresentative: schemaOrNull(setShopRepresentative()),
|
|
781
833
|
managingRepresentative: schemaOrNull(setShopRepresentative()),
|
|
782
|
-
status:
|
|
834
|
+
status: setShopStatus(),
|
|
783
835
|
|
|
784
836
|
// campos actualizables del schema base locker() — todos con schemaOrNull
|
|
785
837
|
...Object.fromEntries(
|
|
@@ -800,8 +852,8 @@ const updateLockerRequest = () =>
|
|
|
800
852
|
'latitud_locker',
|
|
801
853
|
'capacity_locker',
|
|
802
854
|
'access_descript_locker',
|
|
803
|
-
])
|
|
804
|
-
).map(([key, schema]) => [key, schemaOrNull(schema)])
|
|
855
|
+
]),
|
|
856
|
+
).map(([key, schema]) => [key, schemaOrNull(schema)]),
|
|
805
857
|
),
|
|
806
858
|
|
|
807
859
|
// capabilities: array, no nullable — va sin schemaOrNull
|
|
@@ -842,4 +894,4 @@ module.exports = {
|
|
|
842
894
|
createLockerResponse,
|
|
843
895
|
updateLockerRequest,
|
|
844
896
|
updateLockerResponse,
|
|
845
|
-
};
|
|
897
|
+
};
|