@gls_spain/gps-common 32.0.2 → 32.1.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/.idea/workspace.xml +31 -35
- package/CHANGELOG.md +15 -0
- package/README.md +8 -26
- package/open-api-spec/index.js +0 -10
- package/package.json +1 -1
- package/schemas/definitions/expeditions.js +40 -1
package/.idea/workspace.xml
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment=""
|
|
4
|
+
<list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment="">
|
|
5
|
+
<change beforePath="$PROJECT_DIR$/schemas/definitions/expeditions.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/expeditions.js" afterDir="false" />
|
|
6
|
+
</list>
|
|
5
7
|
<option name="SHOW_DIALOG" value="false" />
|
|
6
8
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
7
9
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
8
10
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
9
11
|
</component>
|
|
10
|
-
<component name="FavoritesManager">
|
|
11
|
-
<favorites_list name="gps-common" />
|
|
12
|
-
</component>
|
|
13
12
|
<component name="Git.Settings">
|
|
14
13
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
15
14
|
</component>
|
|
@@ -32,7 +31,6 @@
|
|
|
32
31
|
</component>
|
|
33
32
|
<component name="ProjectViewState">
|
|
34
33
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
35
|
-
<option name="showExcludedFiles" value="true" />
|
|
36
34
|
<option name="showLibraryContents" value="true" />
|
|
37
35
|
</component>
|
|
38
36
|
<component name="PropertiesComponent">
|
|
@@ -123,26 +121,14 @@
|
|
|
123
121
|
</configuration>
|
|
124
122
|
<recent_temporary>
|
|
125
123
|
<list>
|
|
126
|
-
<item itemvalue="JavaScript Debug.documentation.html (1)" />
|
|
127
124
|
<item itemvalue="npm.build-documentation" />
|
|
125
|
+
<item itemvalue="JavaScript Debug.documentation.html (1)" />
|
|
128
126
|
<item itemvalue="npm.test" />
|
|
129
127
|
<item itemvalue="Jest.index.test.js" />
|
|
130
128
|
<item itemvalue="Jest.#errors" />
|
|
131
129
|
</list>
|
|
132
130
|
</recent_temporary>
|
|
133
131
|
</component>
|
|
134
|
-
<component name="ServiceViewManager">
|
|
135
|
-
<option name="viewStates">
|
|
136
|
-
<list>
|
|
137
|
-
<serviceView>
|
|
138
|
-
<treeState>
|
|
139
|
-
<expand />
|
|
140
|
-
<select />
|
|
141
|
-
</treeState>
|
|
142
|
-
</serviceView>
|
|
143
|
-
</list>
|
|
144
|
-
</option>
|
|
145
|
-
</component>
|
|
146
132
|
<component name="SvnConfiguration">
|
|
147
133
|
<configuration />
|
|
148
134
|
</component>
|
|
@@ -550,7 +536,22 @@
|
|
|
550
536
|
<workItem from="1585635898343" duration="2594000" />
|
|
551
537
|
<workItem from="1585663493939" duration="466000" />
|
|
552
538
|
<workItem from="1585670078952" duration="596000" />
|
|
553
|
-
<workItem from="1585725349656" duration="
|
|
539
|
+
<workItem from="1585725349656" duration="1348000" />
|
|
540
|
+
<workItem from="1585819599856" duration="642000" />
|
|
541
|
+
<workItem from="1585902257563" duration="925000" />
|
|
542
|
+
<workItem from="1585932687294" duration="1089000" />
|
|
543
|
+
<workItem from="1585942481938" duration="276000" />
|
|
544
|
+
<workItem from="1585945064015" duration="1525000" />
|
|
545
|
+
<workItem from="1585948509596" duration="5000" />
|
|
546
|
+
<workItem from="1585949186854" duration="3244000" />
|
|
547
|
+
<workItem from="1586074623503" duration="583000" />
|
|
548
|
+
<workItem from="1586187589788" duration="2393000" />
|
|
549
|
+
<workItem from="1586338496466" duration="17000" />
|
|
550
|
+
<workItem from="1587155562828" duration="643000" />
|
|
551
|
+
<workItem from="1587566126161" duration="142000" />
|
|
552
|
+
<workItem from="1587569584217" duration="5000" />
|
|
553
|
+
<workItem from="1588001875839" duration="425000" />
|
|
554
|
+
<workItem from="1588014009601" duration="1351000" />
|
|
554
555
|
</task>
|
|
555
556
|
<servers />
|
|
556
557
|
</component>
|
|
@@ -564,7 +565,7 @@
|
|
|
564
565
|
</todo-panel>
|
|
565
566
|
</component>
|
|
566
567
|
<component name="TypeScriptGeneratedFilesManager">
|
|
567
|
-
<option name="version" value="
|
|
568
|
+
<option name="version" value="2" />
|
|
568
569
|
</component>
|
|
569
570
|
<component name="Vcs.Log.History.Properties">
|
|
570
571
|
<option name="COLUMN_ORDER">
|
|
@@ -581,13 +582,12 @@
|
|
|
581
582
|
<map>
|
|
582
583
|
<entry key="MAIN">
|
|
583
584
|
<value>
|
|
584
|
-
<State
|
|
585
|
-
<option name="COLUMN_ORDER" />
|
|
586
|
-
</State>
|
|
585
|
+
<State />
|
|
587
586
|
</value>
|
|
588
587
|
</entry>
|
|
589
588
|
</map>
|
|
590
589
|
</option>
|
|
590
|
+
<option name="oldMeFiltersMigrated" value="true" />
|
|
591
591
|
</component>
|
|
592
592
|
<component name="WindowStateProjectService">
|
|
593
593
|
<state x="712" y="322" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog" timestamp="1584696790922">
|
|
@@ -598,30 +598,26 @@
|
|
|
598
598
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
599
599
|
</state>
|
|
600
600
|
<state x="762" y="341" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1584283363756" />
|
|
601
|
-
<state x="100" y="123" width="1848" height="929" key="DiffContextDialog" timestamp="1579112408515">
|
|
602
|
-
<screen x="0" y="23" width="2048" height="1129" />
|
|
603
|
-
</state>
|
|
604
|
-
<state x="100" y="123" width="1848" height="929" key="DiffContextDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1579112408515" />
|
|
605
601
|
<state x="606" y="280" key="EditFileWatcherDialog" timestamp="1580283934403">
|
|
606
602
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
607
603
|
</state>
|
|
608
604
|
<state x="606" y="280" key="EditFileWatcherDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1580283934403" />
|
|
609
|
-
<state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="
|
|
605
|
+
<state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1588016053665">
|
|
610
606
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
611
607
|
</state>
|
|
612
|
-
<state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
613
|
-
<state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="
|
|
608
|
+
<state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1588016053665" />
|
|
609
|
+
<state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1588016053665">
|
|
614
610
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
615
611
|
</state>
|
|
616
|
-
<state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
617
|
-
<state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="
|
|
612
|
+
<state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1588016053665" />
|
|
613
|
+
<state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1588016053665">
|
|
618
614
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
619
615
|
</state>
|
|
620
|
-
<state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
621
|
-
<state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="
|
|
616
|
+
<state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1588016053665" />
|
|
617
|
+
<state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1588016053665">
|
|
622
618
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
623
619
|
</state>
|
|
624
|
-
<state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
620
|
+
<state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1588016053665" />
|
|
625
621
|
<state x="0" y="23" width="2048" height="1129" key="SettingsEditor" timestamp="1580283935326">
|
|
626
622
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
627
623
|
</state>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [32.1.0](https://github.com/GLS-Spain/gps-common/compare/v32.0.3...v32.1.0) (2020-04-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add find expeditions by shop and types and status ([7f6d137](https://github.com/GLS-Spain/gps-common/commit/7f6d13773419f5aa215435646d0862cd0a4cb7e7))
|
|
7
|
+
|
|
8
|
+
## [32.0.3](https://github.com/GLS-Spain/gps-common/compare/v32.0.2...v32.0.3) (2020-04-17)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fix old descriptions in readme and openapi ([d2b68e7](https://github.com/GLS-Spain/gps-common/commit/d2b68e78c05b1e4e701ea812c8d74b83ddaa2fa7))
|
|
14
|
+
* remove .npmrc ([a06b501](https://github.com/GLS-Spain/gps-common/commit/a06b50138e6979db223de0b72b443fd0d7b747e6))
|
|
15
|
+
|
|
1
16
|
## [32.0.2](https://github.com/GLS-Spain/gps-common/compare/v32.0.1...v32.0.2) (2020-04-01)
|
|
2
17
|
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -14,9 +14,7 @@ Also remember to include a [.npmrc file](https://docs.npmjs.com/using-private-pa
|
|
|
14
14
|
|
|
15
15
|
## Use
|
|
16
16
|
|
|
17
|
-
This package provides error classes, json schemas for route validation and an OpenAPI specification
|
|
18
|
-
|
|
19
|
-
It is recommended that you import what you need individually (see below), but you can also import the entire package at once:
|
|
17
|
+
This package provides error classes, json schemas for route validation and an OpenAPI specification:
|
|
20
18
|
|
|
21
19
|
```javascript
|
|
22
20
|
const { errors, openApiSpec, schemas } = require('@gls_spain/gps-common');
|
|
@@ -28,22 +26,12 @@ const { loginResponse } = schemas;
|
|
|
28
26
|
|
|
29
27
|
### Errors
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
Import the errors to have access to individual errors and a list of all the error names:
|
|
32
30
|
|
|
33
31
|
```javascript
|
|
34
|
-
const errors = require('@gls_spain/gps-common');
|
|
35
|
-
```
|
|
32
|
+
const { errors } = require('@gls_spain/gps-common');
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```javascript
|
|
40
|
-
const DatabaseNotEmptyError = require('@gls_spain/gps-common/errors/DatabaseNotEmptyError');
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
There is also a list of all the error names:
|
|
44
|
-
|
|
45
|
-
```javascript
|
|
46
|
-
const { errorsNames } = require('@gls_spain/gps-common/errors');
|
|
34
|
+
const { DatabaseNotEmptyError, errorsNames } = errors;
|
|
47
35
|
|
|
48
36
|
console.log(errorsNames.UserDoesNotExistError);
|
|
49
37
|
// UserDoesNotExistError
|
|
@@ -51,18 +39,12 @@ console.log(errorsNames.UserDoesNotExistError);
|
|
|
51
39
|
|
|
52
40
|
### JSON Schemas
|
|
53
41
|
|
|
54
|
-
The provided json schemas are the requests and responses schemas of the API. They can be used for validation and unit testing
|
|
55
|
-
|
|
56
|
-
You can import all of them at once:
|
|
42
|
+
The provided json schemas are the requests and responses schemas of the API. They can be used for validation and unit testing:
|
|
57
43
|
|
|
58
44
|
```javascript
|
|
59
|
-
const schemas = require('@gls_spain/gps-common
|
|
60
|
-
```
|
|
45
|
+
const { schemas } = require('@gls_spain/gps-common');
|
|
61
46
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
```javascript
|
|
65
|
-
const loginResponse = require('@gls_spain/gps-common/schemas/login-response');
|
|
47
|
+
const { loginResponse } = schemas;
|
|
66
48
|
const Ajv = require('ajv');
|
|
67
49
|
const validator = Ajv();
|
|
68
50
|
validator.addSchema(loginResponse);
|
|
@@ -90,7 +72,7 @@ const valid = validator.validate(loginResponse, myResponse); // true
|
|
|
90
72
|
The exported `openApiSpec` is an OpenAPI specification that can be used to build a documentation. If you need a static HTML version see scripts below.
|
|
91
73
|
|
|
92
74
|
```javascript
|
|
93
|
-
const openApiSpec = require('@gls_spain/gps-common
|
|
75
|
+
const { openApiSpec } = require('@gls_spain/gps-common');
|
|
94
76
|
|
|
95
77
|
console.log(openApiSpec);
|
|
96
78
|
/*
|
package/open-api-spec/index.js
CHANGED
|
@@ -1279,9 +1279,6 @@ ${descriptions.createIdIsOptional}
|
|
|
1279
1279
|
|
|
1280
1280
|
${descriptions.optionalArrayPropertiesEmptyByDefault}
|
|
1281
1281
|
|
|
1282
|
-
The only value in the \`integrations\` property applicable to super admins is \`glsApi\`, as explained in the [GLS integration](#tag/GLS)
|
|
1283
|
-
section.
|
|
1284
|
-
|
|
1285
1282
|
${securitySchemes.tokens}
|
|
1286
1283
|
${securitySchemes.superAdminRole}`,
|
|
1287
1284
|
requestBody: {
|
|
@@ -1424,8 +1421,6 @@ ${descriptions.optionalArrayPropertiesEmptyByDefault}
|
|
|
1424
1421
|
To set custom \`derivationSettings\` and \`expirationSettings\` provide theses properties, or do not provide them and the values under the
|
|
1425
1422
|
\`defaults\` property will be used.
|
|
1426
1423
|
|
|
1427
|
-
See the [GLS integration](#tag/GLS) section for more information about the \`integrations\` property.
|
|
1428
|
-
|
|
1429
1424
|
${securitySchemes.tokens}
|
|
1430
1425
|
${securitySchemes.superAdminRole}`,
|
|
1431
1426
|
requestBody: {
|
|
@@ -1588,8 +1583,6 @@ ${descriptions.optionalArrayPropertiesEmptyByDefault}
|
|
|
1588
1583
|
The \`network._id\` property that associates a network admin with his network cannot be changed after creation.
|
|
1589
1584
|
If the provided network does not exist the API will return a \`500 NetworkDoesNotExistError\`.
|
|
1590
1585
|
|
|
1591
|
-
The \`integrations\` property is not used yet for network admins, leave it empty for now.
|
|
1592
|
-
|
|
1593
1586
|
${securitySchemes.tokens}
|
|
1594
1587
|
${securitySchemes.superAdminRole}`,
|
|
1595
1588
|
requestBody: {
|
|
@@ -2276,9 +2269,6 @@ ${descriptions.optionalArrayPropertiesEmptyByDefault}
|
|
|
2276
2269
|
The \`network._id\` and \`shop._id\` properties associate a shop user with his network and shop, and cannot be changed after creation.
|
|
2277
2270
|
If the provided network or shop do not exist the API will return a \`500 NetworkDoesNotExistError\` or a \`500 ShopDoesNotExistError\`.
|
|
2278
2271
|
|
|
2279
|
-
The only value in the \`integrations\` property applicable to shop users is \`canReceiveAllFromDriver\`. Only those shop users that have it
|
|
2280
|
-
are authorized to call the [receiveAllFromDriver](#tag/Expeditions/paths/~1expeditions~1receiveAllFromDriver/post) endpoint.
|
|
2281
|
-
|
|
2282
2272
|
${securitySchemes.tokens}
|
|
2283
2273
|
${securitySchemes.superAdminRole}`,
|
|
2284
2274
|
requestBody: {
|
package/package.json
CHANGED
|
@@ -408,6 +408,35 @@ const findByStatus = () => ({
|
|
|
408
408
|
additionalProperties: false,
|
|
409
409
|
});
|
|
410
410
|
|
|
411
|
+
const findByShopAndTypesAndStatus = () =>
|
|
412
|
+
mergeSchemas(findByShop(), {
|
|
413
|
+
title: 'find by shop and types and status',
|
|
414
|
+
type: 'object',
|
|
415
|
+
properties: {
|
|
416
|
+
typesAndStatus: {
|
|
417
|
+
type: 'array',
|
|
418
|
+
items: {
|
|
419
|
+
type: 'object',
|
|
420
|
+
properties: {
|
|
421
|
+
type: expedition().properties.type,
|
|
422
|
+
status: {
|
|
423
|
+
type: 'object',
|
|
424
|
+
properties: { code: expedition().properties.status.properties.code },
|
|
425
|
+
required: ['code'],
|
|
426
|
+
additionalProperties: false,
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
required: ['type', 'status'],
|
|
430
|
+
additionalProperties: false,
|
|
431
|
+
},
|
|
432
|
+
uniqueItems: true,
|
|
433
|
+
minItems: 1,
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
required: ['typesAndStatus'],
|
|
437
|
+
additionalProperties: false,
|
|
438
|
+
});
|
|
439
|
+
|
|
411
440
|
const findByShopAndStatus = () => mergeSchemas(findByShop(), findByStatus(), { title: 'find by shop and status' });
|
|
412
441
|
|
|
413
442
|
const findByNoShopAndStatus = () => mergeSchemas(findByNoShop(), findByStatus(), { title: 'find by no shop and status' });
|
|
@@ -446,7 +475,17 @@ const findExpeditionsSuperAdminRequest = () =>
|
|
|
446
475
|
});
|
|
447
476
|
|
|
448
477
|
const findExpeditionsNetworkAdminAndShopUserRequest = () =>
|
|
449
|
-
findRequest({
|
|
478
|
+
findRequest({
|
|
479
|
+
oneOf: [
|
|
480
|
+
findById(),
|
|
481
|
+
findByShop(),
|
|
482
|
+
findByShopAndStatus(),
|
|
483
|
+
findByShopAndTypesAndStatus(),
|
|
484
|
+
findByNoShop(),
|
|
485
|
+
findByNoShopAndStatus(),
|
|
486
|
+
findByCode(),
|
|
487
|
+
],
|
|
488
|
+
});
|
|
450
489
|
|
|
451
490
|
const findExpeditionsResponse = () => findResponse(expedition());
|
|
452
491
|
|