@gls_spain/gps-common 27.1.1 → 27.2.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.
@@ -2,9 +2,16 @@
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
4
  <list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment="">
5
- <change afterPath="$PROJECT_DIR$/.npmrc" afterDir="false" />
5
+ <change beforePath="$PROJECT_DIR$/index.test.js" beforeDir="false" afterPath="$PROJECT_DIR$/index.test.js" afterDir="false" />
6
6
  <change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
7
7
  <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
8
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/common.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/common.js" afterDir="false" />
9
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/expeditions.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/expeditions.js" afterDir="false" />
10
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/networks.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/networks.js" afterDir="false" />
11
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/representatives.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/representatives.js" afterDir="false" />
12
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/shops.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/shops.js" afterDir="false" />
13
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/users.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/users.js" afterDir="false" />
14
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/zones.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/zones.js" afterDir="false" />
8
15
  </list>
9
16
  <option name="SHOW_DIALOG" value="false" />
10
17
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -126,9 +133,9 @@
126
133
  </configuration>
127
134
  <recent_temporary>
128
135
  <list>
136
+ <item itemvalue="npm.test" />
129
137
  <item itemvalue="npm.build-documentation" />
130
138
  <item itemvalue="JavaScript Debug.documentation.html (1)" />
131
- <item itemvalue="npm.test" />
132
139
  <item itemvalue="Jest.index.test.js" />
133
140
  <item itemvalue="Jest.#errors" />
134
141
  </list>
@@ -476,7 +483,12 @@
476
483
  <workItem from="1580815629850" duration="3000" />
477
484
  <workItem from="1580901981635" duration="165000" />
478
485
  <workItem from="1580905118835" duration="5000" />
479
- <workItem from="1582011818288" duration="964000" />
486
+ <workItem from="1582011818288" duration="1685000" />
487
+ <workItem from="1582048591172" duration="574000" />
488
+ <workItem from="1582099262907" duration="387000" />
489
+ <workItem from="1582154278772" duration="110000" />
490
+ <workItem from="1582185898197" duration="1121000" />
491
+ <workItem from="1582216910927" duration="2067000" />
480
492
  </task>
481
493
  <servers />
482
494
  </component>
@@ -524,22 +536,22 @@
524
536
  <screen x="0" y="23" width="2048" height="1129" />
525
537
  </state>
526
538
  <state x="606" y="280" key="EditFileWatcherDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1580283934403" />
527
- <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1582014108826">
539
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1582220329984">
528
540
  <screen x="0" y="23" width="2048" height="1129" />
529
541
  </state>
530
- <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1582014108826" />
531
- <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1582014108826">
542
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1582220329984" />
543
+ <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1582220329984">
532
544
  <screen x="0" y="23" width="2048" height="1129" />
533
545
  </state>
534
- <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1582014108826" />
535
- <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1582014108825">
546
+ <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1582220329984" />
547
+ <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1582220329984">
536
548
  <screen x="0" y="23" width="2048" height="1129" />
537
549
  </state>
538
- <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1582014108825" />
539
- <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1582014108826">
550
+ <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1582220329984" />
551
+ <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1582220329984">
540
552
  <screen x="0" y="23" width="2048" height="1129" />
541
553
  </state>
542
- <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1582014108826" />
554
+ <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1582220329984" />
543
555
  <state x="0" y="23" width="2048" height="1129" key="SettingsEditor" timestamp="1580283935326">
544
556
  <screen x="0" y="23" width="2048" height="1129" />
545
557
  </state>
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [27.2.0](https://github.com/GLS-Spain/gps-common/compare/v27.1.1...v27.2.0) (2020-02-20)
2
+
3
+
4
+ ### Features
5
+
6
+ * trim strings in schemas ([06fc8c1](https://github.com/GLS-Spain/gps-common/commit/06fc8c13e3dc32b0e9cbe0a5c3717e886919ee33))
7
+
1
8
  ## [27.1.1](https://github.com/GLS-Spain/gps-common/compare/v27.1.0...v27.1.1) (2020-02-18)
2
9
 
3
10
 
package/index.test.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const Ajv = require('ajv');
2
- const { lenientDatetimeFormat, timezoneFormat, normalizeKeyword } = require('@gls_spain/ajv-options');
2
+ const { lenientDatetimeFormat, timezoneFormat, normalizeKeyword, trimKeyword } = require('@gls_spain/ajv-options');
3
3
  const { errors, openApiSpec, schemas } = require('./index');
4
4
 
5
5
  describe('#errors', () => {
@@ -24,6 +24,7 @@ describe('#schemas', () => {
24
24
  test('should all be unique valid json schemas', () => {
25
25
  const ajv = Ajv({ formats: { 'date-time': lenientDatetimeFormat, timezone: timezoneFormat } });
26
26
  ajv.addKeyword('normalize', normalizeKeyword);
27
+ ajv.addKeyword('trim', trimKeyword);
27
28
  Object.values(schemas).forEach(schema => {
28
29
  try {
29
30
  ajv.compile(schema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "27.1.1",
3
+ "version": "27.2.0",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -27,28 +27,28 @@
27
27
  }
28
28
  },
29
29
  "devDependencies": {
30
- "@semantic-release/changelog": "latest",
31
- "@semantic-release/git": "latest",
30
+ "@semantic-release/changelog": "^5.0.0",
31
+ "@semantic-release/git": "^9.0.0",
32
32
  "@semantic-release/npm": "^7.0.3",
33
- "@semantic-release/release-notes-generator": "latest",
34
- "@types/jest": "^25.1.2",
33
+ "@semantic-release/release-notes-generator": "^9.0.0",
34
+ "@types/jest": "^25.1.3",
35
35
  "ajv": "^6.11.0",
36
- "commitizen": "latest",
37
- "cz-conventional-changelog": "latest",
38
- "eslint": "latest",
39
- "eslint-config-airbnb-base": "latest",
40
- "eslint-config-prettier": "latest",
36
+ "commitizen": "^4.0.3",
37
+ "cz-conventional-changelog": "^3.1.0",
38
+ "eslint": "^6.8.0",
39
+ "eslint-config-airbnb-base": "^14.0.0",
40
+ "eslint-config-prettier": "^6.10.0",
41
41
  "eslint-plugin-import": "^2.20.1",
42
42
  "husky": "^4.2.3",
43
- "jest": "latest",
44
- "prettier": "latest",
43
+ "jest": "^25.1.0",
44
+ "prettier": "^1.19.1",
45
45
  "redoc-cli": "^0.9.6",
46
46
  "semantic-release": "^17.0.4"
47
47
  },
48
48
  "dependencies": {
49
- "@gls_spain/ajv-options": "^1.0.0",
49
+ "@gls_spain/ajv-options": "^1.1.0",
50
50
  "@gls_spain/common-errors": "^1.0.0",
51
- "@gls_spain/common-json-schemas": "^1.0.0",
51
+ "@gls_spain/common-json-schemas": "^1.1.0",
52
52
  "@gls_spain/winston-transports": "^1.0.0",
53
53
  "lodash": "^4.17.15",
54
54
  "winston": "^3.2.1",
@@ -104,7 +104,7 @@ const objectWithUuidAndName = () => ({
104
104
 
105
105
  const tags = () => ({
106
106
  type: 'array',
107
- items: { type: 'string' },
107
+ items: { type: 'string', trim: true },
108
108
  uniqueItems: true,
109
109
  });
110
110
 
@@ -112,7 +112,7 @@ const contact = () => ({
112
112
  title: 'contact',
113
113
  type: 'object',
114
114
  properties: {
115
- name: { type: 'string' },
115
+ name: { type: 'string', trim: true },
116
116
  email: email(),
117
117
  phone: phone(),
118
118
  },
@@ -124,9 +124,9 @@ const fiscal = () => ({
124
124
  title: 'fiscal data',
125
125
  type: 'object',
126
126
  properties: {
127
- iban: { type: 'string' },
128
- businessName: { type: 'string' },
129
- nif: { type: 'string' },
127
+ iban: { type: 'string', trim: true },
128
+ businessName: { type: 'string', trim: true },
129
+ nif: { type: 'string', trim: true },
130
130
  contacts: {
131
131
  type: 'array',
132
132
  items: contact(),
@@ -134,7 +134,7 @@ const fiscal = () => ({
134
134
  address: address(),
135
135
  paymentMethod: { type: 'string', enum: ['transfer', 'confirming'] },
136
136
  dueDays: { type: 'integer', minimum: 0 },
137
- activity: { type: 'string', description: 'IAE' },
137
+ activity: { type: 'string', trim: true, description: 'IAE' },
138
138
  retention: { type: 'integer', description: 'invoice retention percentage' },
139
139
  },
140
140
  required: ['iban', 'businessName', 'nif', 'contacts', 'address', 'paymentMethod', 'dueDays', 'activity', 'retention'],
@@ -34,12 +34,12 @@ const expeditionAddress = () => ({
34
34
  title: 'expedition address',
35
35
  type: 'object',
36
36
  properties: {
37
- name: { type: 'string' },
38
- contact: { type: 'string' },
39
- department: { type: 'string' },
37
+ name: { type: 'string', trim: true },
38
+ contact: { type: 'string', trim: true },
39
+ department: { type: 'string', trim: true },
40
40
  emails: { type: 'array', items: email(), uniqueItems: true },
41
41
  phones: { type: 'array', items: phone(), uniqueItems: true },
42
- nif: { type: 'string' },
42
+ nif: { type: 'string', trim: true },
43
43
  address: address(),
44
44
  agency: objectWithAgencyCode(),
45
45
  },
@@ -51,9 +51,9 @@ const driver = () => ({
51
51
  title: 'driver',
52
52
  type: 'object',
53
53
  properties: {
54
- agency: { type: 'string' },
55
- code: { type: 'string' },
56
- device: { type: 'string' },
54
+ agency: { type: 'string', trim: true },
55
+ code: { type: 'string', trim: true },
56
+ device: { type: 'string', trim: true },
57
57
  },
58
58
  required: ['agency', 'code', 'device'],
59
59
  additionalProperties: false,
@@ -63,8 +63,8 @@ const customer = () => ({
63
63
  title: 'customer',
64
64
  type: 'object',
65
65
  properties: {
66
- name: { type: 'string' },
67
- nif: { type: 'string' },
66
+ name: { type: 'string', trim: true },
67
+ nif: { type: 'string', trim: true },
68
68
  pod: objectWithUuid(),
69
69
  },
70
70
  required: ['name', 'nif', 'pod'],
@@ -74,8 +74,8 @@ const customer = () => ({
74
74
  const customerWithPod = () => ({
75
75
  type: 'object',
76
76
  properties: {
77
- name: { type: 'string' },
78
- nif: { type: 'string' },
77
+ name: { type: 'string', trim: true },
78
+ nif: { type: 'string', trim: true },
79
79
  pod: { type: 'string', contentMediaType: 'image/jpg', contentEncoding: 'base64' },
80
80
  },
81
81
  required: ['name', 'nif', 'pod'],
@@ -199,7 +199,7 @@ const expedition = () => ({
199
199
  additionalProperties: false,
200
200
  description: 'only available for deliveries and pickups after reception at the shop',
201
201
  },
202
- barcodes: { type: 'array', items: { type: 'string' } },
202
+ barcodes: { type: 'array', items: { type: 'string', trim: true } },
203
203
  packageCount: { type: 'integer' },
204
204
  weight: { type: 'number' },
205
205
  volume: { type: 'number' },
@@ -211,11 +211,11 @@ const expedition = () => ({
211
211
  type: 'object',
212
212
  properties: {
213
213
  code: { type: 'integer' },
214
- name: { type: 'string' },
215
- contact: { type: 'string' },
214
+ name: { type: 'string', trim: true },
215
+ contact: { type: 'string', trim: true },
216
216
  emails: { type: 'array', items: email(), uniqueItems: true },
217
217
  phones: { type: 'array', items: phone(), uniqueItems: true },
218
- openingSchedule: { type: 'string' },
218
+ openingSchedule: { type: 'string', trim: true },
219
219
  },
220
220
  required: ['code', 'name', 'emails', 'phones'],
221
221
  additionalProperties: false,
@@ -225,7 +225,7 @@ const expedition = () => ({
225
225
  type: 'object',
226
226
  properties: {
227
227
  code: { type: 'integer' },
228
- name: { type: 'string' },
228
+ name: { type: 'string', trim: true },
229
229
  agency: objectWithAgencyCode(),
230
230
  },
231
231
  required: ['code', 'name', 'agency'],
@@ -237,8 +237,8 @@ const expedition = () => ({
237
237
  title: 'expedition reference',
238
238
  type: 'object',
239
239
  properties: {
240
- type: { type: 'string' },
241
- value: { type: 'string' },
240
+ type: { type: 'string', trim: true },
241
+ value: { type: 'string', trim: true },
242
242
  },
243
243
  required: ['type', 'value'],
244
244
  additionalProperties: false,
@@ -252,7 +252,7 @@ const expedition = () => ({
252
252
  type: 'object',
253
253
  properties: {
254
254
  number: { type: 'integer', description: 'package number in expedition (1, 2, 3), can be sparse' },
255
- barcodes: { type: 'array', items: { type: 'string' } },
255
+ barcodes: { type: 'array', items: { type: 'string', trim: true } },
256
256
  weight: { type: 'number' },
257
257
  width: { type: 'number' },
258
258
  length: { type: 'number' },
@@ -262,7 +262,7 @@ const expedition = () => ({
262
262
  additionalProperties: false,
263
263
  },
264
264
  },
265
- notes: { type: 'string' },
265
+ notes: { type: 'string', trim: true },
266
266
  },
267
267
  required: [
268
268
  '_id',
@@ -466,14 +466,14 @@ const scanExpeditionRequest = () => ({
466
466
  {
467
467
  title: 'barcode',
468
468
  type: 'object',
469
- properties: { barcode: { type: 'string' } },
469
+ properties: { barcode: { type: 'string', trim: true } },
470
470
  required: ['barcode'],
471
471
  additionalProperties: false,
472
472
  },
473
473
  {
474
474
  title: 'QR code',
475
475
  type: 'object',
476
- properties: { qrCode: { type: 'string' } },
476
+ properties: { qrCode: { type: 'string', trim: true } },
477
477
  required: ['qrCode'],
478
478
  additionalProperties: false,
479
479
  },
@@ -24,7 +24,7 @@ const network = () => ({
24
24
  updatedAt: datetime(),
25
25
  deletable: { type: 'boolean' },
26
26
  defaults: defaults(),
27
- name: { type: 'string' },
27
+ name: { type: 'string', trim: true },
28
28
  integrations: { type: 'array', items: { type: 'string', enum: ['gls'] }, uniqueItems: true },
29
29
  contacts: {
30
30
  type: 'array',
@@ -27,10 +27,10 @@ const representative = () => ({
27
27
  createdAt: datetime(),
28
28
  updatedAt: datetime(),
29
29
  deletable: { type: 'boolean' },
30
- name: { type: 'string' },
30
+ name: { type: 'string', trim: true },
31
31
  emails: { type: 'array', items: email(), uniqueItems: true },
32
32
  phones: { type: 'array', items: phone(), uniqueItems: true },
33
- nif: { type: 'string' },
33
+ nif: { type: 'string', trim: true },
34
34
  zones: {
35
35
  type: 'array',
36
36
  items: {
@@ -116,7 +116,7 @@ const shop = () => ({
116
116
  type: 'object',
117
117
  properties: {
118
118
  at: datetime(),
119
- reason: { type: 'string' },
119
+ reason: { type: 'string', trim: true },
120
120
  },
121
121
  required: ['at', 'reason'],
122
122
  additionalProperties: false,
@@ -125,7 +125,7 @@ const shop = () => ({
125
125
  type: 'object',
126
126
  properties: {
127
127
  at: datetime(),
128
- reason: { type: 'string' },
128
+ reason: { type: 'string', trim: true },
129
129
  },
130
130
  required: ['at', 'reason'],
131
131
  additionalProperties: false,
@@ -134,7 +134,7 @@ const shop = () => ({
134
134
  required: ['code'],
135
135
  additionalProperties: false,
136
136
  },
137
- name: { type: 'string' },
137
+ name: { type: 'string', trim: true },
138
138
  address: addressWithRequiredLocation(),
139
139
  capabilities: {
140
140
  type: 'array',
@@ -148,7 +148,7 @@ const shop = () => ({
148
148
  items: contact(),
149
149
  },
150
150
  fiscal: fiscal(),
151
- notes: { type: 'string' },
151
+ notes: { type: 'string', trim: true },
152
152
  derivationSettings: derivationSettings(),
153
153
  expirationSettings: expirationSettings(),
154
154
  },
@@ -36,10 +36,10 @@ const baseUser = () => ({
36
36
  loginEnabled: { type: 'boolean' },
37
37
  integrations: { type: 'array', items: { type: 'string', enum: ['glsApi', 'canReceiveAllFromDriver'] }, uniqueItems: true },
38
38
  role: { type: 'string' },
39
- name: { type: 'string' },
39
+ name: { type: 'string', trim: true },
40
40
  emails: { type: 'array', items: email(), uniqueItems: true },
41
41
  phones: { type: 'array', items: phone(), uniqueItems: true },
42
- nif: { type: 'string' },
42
+ nif: { type: 'string', trim: true },
43
43
  address: address(),
44
44
  },
45
45
  required: ['_id', 'createdAt', 'updatedAt', 'username', 'deletable', 'loginEnabled', 'integrations', 'role', 'name', 'emails', 'phones'],
@@ -22,7 +22,7 @@ const zone = () => ({
22
22
  createdAt: datetime(),
23
23
  updatedAt: datetime(),
24
24
  deletable: { type: 'boolean' },
25
- name: { type: 'string' },
25
+ name: { type: 'string', trim: true },
26
26
  commissions: {
27
27
  type: 'object',
28
28
  properties: {