@gls_spain/gps-common 27.0.0 → 27.0.2
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 +14 -0
- package/README.md +13 -14
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [27.0.2](https://github.com/GLS-Spain/gps-common/compare/v27.0.1...v27.0.2) (2020-01-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fix readme ([6187025](https://github.com/GLS-Spain/gps-common/commit/61870251d99f1db115c94600ecfdadf596ad37d1))
|
|
7
|
+
|
|
8
|
+
## [27.0.1](https://github.com/GLS-Spain/gps-common/compare/v27.0.0...v27.0.1) (2020-01-29)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* update readme with new [@gls](https://github.com/gls)_spain scope ([5cb67d3](https://github.com/GLS-Spain/gps-common/commit/5cb67d3871b820cd520798d57b2d00a975d2cdd2))
|
|
14
|
+
|
|
1
15
|
# [27.0.0](https://github.com/GLS-Spain/gps-common/compare/v26.1.0...v27.0.0) (2020-01-29)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @gls_spain/gps-common
|
|
2
2
|
|
|
3
|
-
Errors, schemas and documentation
|
|
3
|
+
Errors, schemas and documentation for the Parcel Shops project.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @gls_spain/gps-common
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
This is a **@
|
|
11
|
+
This is a **@gls_spain** private package so you need an [npm authentication token](https://docs.npmjs.com/about-authentication-tokens) to be able to install it.
|
|
12
12
|
|
|
13
13
|
Also remember to include a [.npmrc file](https://docs.npmjs.com/using-private-packages-in-a-ci-cd-workflow) at the root of your project so that when you deploy the project to production, the deployment server (or Google App Engine, Heroku, etc) is able to install it.
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ This package provides error classes, json schemas for route validation and an Op
|
|
|
19
19
|
It is recommended that you import what you need individually (see below), but you can also import the entire package at once:
|
|
20
20
|
|
|
21
21
|
```javascript
|
|
22
|
-
const { errors, openApiSpec, schemas } = require('@
|
|
22
|
+
const { errors, openApiSpec, schemas } = require('@gls_spain/gps-common');
|
|
23
23
|
|
|
24
24
|
const { DatabaseNotEmptyError } = errors;
|
|
25
25
|
|
|
@@ -31,19 +31,19 @@ const { loginResponse } = schemas;
|
|
|
31
31
|
You can import all the errors at once:
|
|
32
32
|
|
|
33
33
|
```javascript
|
|
34
|
-
const errors = require('@
|
|
34
|
+
const errors = require('@gls_spain/gps-common');
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Or you can import them individually:
|
|
38
38
|
|
|
39
39
|
```javascript
|
|
40
|
-
const DatabaseNotEmptyError = require('@
|
|
40
|
+
const DatabaseNotEmptyError = require('@gls_spain/gps-common/errors/DatabaseNotEmptyError');
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
There is also a list of all the error names:
|
|
44
44
|
|
|
45
45
|
```javascript
|
|
46
|
-
const { errorsNames } = require('@
|
|
46
|
+
const { errorsNames } = require('@gls_spain/gps-common/errors');
|
|
47
47
|
|
|
48
48
|
console.log(errorsNames.UserDoesNotExistError);
|
|
49
49
|
// UserDoesNotExistError
|
|
@@ -56,13 +56,13 @@ The provided json schemas are the requests and responses schemas of the API. The
|
|
|
56
56
|
You can import all of them at once:
|
|
57
57
|
|
|
58
58
|
```javascript
|
|
59
|
-
const schemas = require('@
|
|
59
|
+
const schemas = require('@gls_spain/gps-common/schemas');
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Or each one of them individually:
|
|
63
63
|
|
|
64
64
|
```javascript
|
|
65
|
-
const loginResponse = require('@
|
|
65
|
+
const loginResponse = require('@gls_spain/gps-common/schemas/login-response');
|
|
66
66
|
const Ajv = require('ajv');
|
|
67
67
|
const validator = Ajv();
|
|
68
68
|
validator.addSchema(loginResponse);
|
|
@@ -79,7 +79,6 @@ const myResponse = {
|
|
|
79
79
|
name: 'Super administrator',
|
|
80
80
|
emails: [],
|
|
81
81
|
phones: [],
|
|
82
|
-
tags: [],
|
|
83
82
|
}
|
|
84
83
|
};
|
|
85
84
|
|
|
@@ -91,7 +90,7 @@ const valid = validator.validate(loginResponse, myResponse); // true
|
|
|
91
90
|
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.
|
|
92
91
|
|
|
93
92
|
```javascript
|
|
94
|
-
const openApiSpec = require('@
|
|
93
|
+
const openApiSpec = require('@gls_spain/gps-common/open-api-spec');
|
|
95
94
|
|
|
96
95
|
console.log(openApiSpec);
|
|
97
96
|
/*
|
|
@@ -114,9 +113,9 @@ console.log(openApiSpec);
|
|
|
114
113
|
This package provides two scripts, one to build a static version of the json schemas and one to build a [Redoc](https://rebilly.github.io/ReDoc/) HTML with the OpenAPI documentation.
|
|
115
114
|
|
|
116
115
|
```bash
|
|
117
|
-
build-
|
|
116
|
+
build-gps-json-schemas --output=build/gls-schemas
|
|
118
117
|
```
|
|
119
118
|
|
|
120
119
|
```bash
|
|
121
|
-
build-
|
|
120
|
+
build-gps-documentation --output=build/gls-documentation.html
|
|
122
121
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gls_spain/gps-common",
|
|
3
|
-
"version": "27.0.
|
|
3
|
+
"version": "27.0.2",
|
|
4
4
|
"description": "Errors, schemas and documentation for the Parcel Shops project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"build-documentation": "node scripts/build-documentation.js --output=build/documentation/documentation.html"
|
|
63
63
|
},
|
|
64
64
|
"bin": {
|
|
65
|
-
"build-
|
|
66
|
-
"build-
|
|
65
|
+
"build-gps-schemas": "scripts/build-json-schemas.js",
|
|
66
|
+
"build-gps-documentation": "scripts/build-documentation.js"
|
|
67
67
|
}
|
|
68
68
|
}
|