@gls_spain/gps-common 34.9.5 → 34.9.7

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
- ## [34.9.5](https://github.com/GLS-Spain/gps-common/compare/v34.9.4...v34.9.5) (2021-03-11)
1
+ ## [34.9.7](https://github.com/GLS-Spain/gps-common/compare/v34.9.6...v34.9.7) (2021-03-18)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * force publish ([a94a134](https://github.com/GLS-Spain/gps-common/commit/a94a13435f8ff0b360ab9887146de4ae27dede6f))
6
+ * update dependencias and generate documentation ([45ef47c](https://github.com/GLS-Spain/gps-common/commit/45ef47ca8bd0474576fcf6aab2b4ab0704c4dd48))
7
7
 
8
+ ## [34.9.6](https://github.com/GLS-Spain/gps-common/compare/v34.9.5...v34.9.6) (2021-03-15)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add to definition schema observation field ([fe1b5b9](https://github.com/GLS-Spain/gps-common/commit/fe1b5b961a80b2a73cba39b1d1ffe18bdeecde91))
14
+
15
+ ## [34.9.5](https://github.com/GLS-Spain/gps-common/compare/v34.9.4...v34.9.5) (2021-03-11)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * force publish ([a94a134](https://github.com/GLS-Spain/gps-common/commit/a94a13435f8ff0b360ab9887146de4ae27dede6f))
21
+
8
22
  ## [34.9.4](https://github.com/GLS-Spain/gps-common/compare/v34.9.3...v34.9.4) (2021-03-11)
9
23
 
10
24
 
package/README.md CHANGED
@@ -81,7 +81,7 @@ console.log(openApiSpec);
81
81
  info: {
82
82
  title: 'GLS Parcel Shops API',
83
83
  description: 'This is the API backend for the GLS Parcel Shops project.',
84
- contact: { name: 'Cristóbal Valverde Albo', email: 'cristobal@albo.dev' },
84
+ contact: { name: 'GLS Innovation', email: 'gls-innovation@gls-spain.es' },
85
85
  license: { name: 'NO LICENSE', url: 'https://choosealicense.com/no-permission/' },
86
86
  version: 'v1.0.0',
87
87
  },
@@ -193,6 +193,8 @@ const {
193
193
  downloadSaleLabelResponse,
194
194
  } = require('../schemas/definitions/sales');
195
195
 
196
+ const pkg = require('../package.json');
197
+
196
198
  const openApiSpec = { openapi: '3.0.2' };
197
199
 
198
200
  openApiSpec.info = {
@@ -201,9 +203,9 @@ openApiSpec.info = {
201
203
  This API is versioned using [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) and follows the semver specification.
202
204
 
203
205
  You can see what's new and the latest changes to the API in the [changelog](/help/changelog).`,
204
- contact: { name: 'Cristóbal Valverde', email: 'cristobal.valverde@gls-spain.es' },
206
+ contact: { name: 'GLS Innovation', email: 'gls-innovation@gls-spain.es' },
205
207
  license: { name: 'NO LICENSE', url: 'https://choosealicense.com/no-permission/' },
206
- version: 'v1.0.0',
208
+ version: pkg.version,
207
209
  };
208
210
 
209
211
  openApiSpec.servers = [
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "34.9.5",
3
+ "version": "34.9.7",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
- "main": "index.js",
6
5
  "keywords": [
7
6
  "gls"
8
7
  ],
8
+ "main": "index.js",
9
+ "private": false,
9
10
  "author": {
10
- "name": "Cristóbal Valverde Albo"
11
+ "name": "GLS Innovation"
11
12
  },
12
13
  "license": "UNLICENSED",
13
14
  "homepage": "https://github.com/GLS-Spain/gps-common",
@@ -37,7 +38,8 @@
37
38
  "husky": "^4.3.8",
38
39
  "jest": "^25.5.4",
39
40
  "prettier": "^1.19.1",
40
- "redoc-cli": "^0.9.13",
41
+ "redoc-cli": "^0.10.4",
42
+ "rimraf": "^2.6.3",
41
43
  "semantic-release": "^17.4.1"
42
44
  },
43
45
  "dependencies": {
@@ -55,7 +57,9 @@
55
57
  "semantic-release": "semantic-release",
56
58
  "test": "jest",
57
59
  "build-json-schemas": "node scripts/build-json-schemas.js --output=build/schemas",
58
- "build-documentation": "node scripts/build-documentation.js --output=build/documentation/documentation.html"
60
+ "build-documentation": "node scripts/build-documentation.js --output=build/documentation/documentation.html",
61
+ "__build-documentation": "redoc-cli bundle build/open-api-definition.json --output=build/documentation/documentation.html --options.noAutoAuth --options.hideDownloadButton --options.menuToggle=true",
62
+ "generate-documentation": "rimraf build && npm run build-json-schemas && redoc-cli bundle build/open-api-definition.json --output=build/documentation/documentation.html --options.noAutoAuth --options.hideDownloadButton --options.menuToggle=true"
59
63
  },
60
64
  "bin": {
61
65
  "build-gps-schemas": "scripts/build-json-schemas.js",
@@ -64,6 +64,7 @@ const sale = () => ({
64
64
  address: address(),
65
65
  emails: { type: 'array', items: email(), uniqueItems: true },
66
66
  phones: { type: 'array', items: phone(), uniqueItems: true },
67
+ observations: { type: 'string', trim: true },
67
68
  notes: { type: 'string', trim: true },
68
69
  },
69
70
  required: ['name', 'address', 'emails', 'phones'],
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
@@ -19,8 +19,8 @@ const { argv } = yargs
19
19
  const logger = winston.createLogger({ transports: new ColorConsoleTransport() });
20
20
 
21
21
  async function buildDocumentation() {
22
- const tmpDir = os.tmpdir();
23
- const jsonPath = path.resolve(tmpDir, 'open-api-spec.json');
22
+ const outDirPath = path.resolve(__dirname, '../build');;
23
+ const jsonPath = path.resolve(outDirPath, 'open-api-definition.json');
24
24
 
25
25
  logger.info(`output file is: ${argv.output}`);
26
26
  logger.info('creating output directory...');
@@ -28,10 +28,9 @@ async function buildDocumentation() {
28
28
 
29
29
  logger.info('writing html file...');
30
30
  fs.writeFileSync(jsonPath, JSON.stringify(openApiSpec, null, 2));
31
- const redocCli = require.resolve('redoc-cli');
32
31
  await exec(
33
- `"${redocCli}" bundle ${jsonPath} --output ${argv.output} --options.noAutoAuth --options.hideDownloadButton --options.menuToggle=true --title="GLS Parcel Shops API"`,
34
- );
32
+ `redoc-cli bundle ${jsonPath} --output ${argv.output} --options.noAutoAuth --options.hideDownloadButton --options.menuToggle=true --title="GLS Parcel Shops API"`,
33
+ ).catch(err => logger.warn(JSON.stringify(err)));
35
34
  logger.info('done');
36
35
  }
37
36
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
@@ -7,6 +7,7 @@ const kebabCase = require('lodash/kebabCase');
7
7
  const yargs = require('yargs');
8
8
  const { ColorConsoleTransport } = require('@gls_spain/winston-transports');
9
9
  const schemas = require('../schemas');
10
+ const openapispec = require('../open-api-spec');
10
11
 
11
12
  const { argv } = yargs
12
13
  .option('output', { string: true, required: true, describe: 'directory path to put the json schemas in' })
@@ -17,16 +18,23 @@ const logger = winston.createLogger({ transports: new ColorConsoleTransport() })
17
18
  async function buildJsonSchemas() {
18
19
  const schemasArray = Object.values(schemas);
19
20
  logger.info(`found ${schemasArray.length} schemas`);
20
-
21
- const outDirPath = path.resolve(argv.output);
21
+ logger.info(`Path: ${path.resolve(__dirname, '../build')}`)
22
+ const outDirPath = path.resolve(__dirname, '../build');
22
23
  logger.info(`output directory is: ${outDirPath}`);
23
24
 
24
25
  logger.info('creating output directory...');
26
+
25
27
  fs.mkdirSync(outDirPath, { recursive: true });
28
+
26
29
  logger.info(`writing ${schemasArray.length} new files...`);
30
+
27
31
  schemasArray.forEach(schema =>
28
32
  fs.writeFileSync(path.resolve(outDirPath, `${kebabCase(schema.$id)}.json`), JSON.stringify(schema, null, 2)),
29
33
  );
34
+
35
+ logger.info('Writing open-api-denition file');
36
+ fs.writeFileSync(path.resolve(outDirPath, `open-api-definition.json`), JSON.stringify(openapispec, null, 2))
37
+
30
38
  logger.info('done');
31
39
  }
32
40
 
@@ -1,8 +0,0 @@
1
- /node_modules/
2
- /build
3
- .idea/workspace.xml
4
- .idea/tasks.xml
5
- .idea_modules/
6
- encodings.xml
7
- /coverage/
8
- /*.env
@@ -1,9 +0,0 @@
1
- /node_modules/
2
- /build
3
- .idea/workspace.xml
4
- .idea/tasks.xml
5
- .idea_modules/
6
- encodings.xml
7
- /coverage/
8
- /*.env
9
- /.history
@@ -1,65 +0,0 @@
1
- {
2
- "name": "@gls_spain/gps-common",
3
- "version": "34.9.4",
4
- "description": "Errors, schemas and documentation for the Parcel Shops project",
5
- "main": "index.js",
6
- "keywords": [
7
- "gls"
8
- ],
9
- "author": {
10
- "name": "Cristóbal Valverde Albo",
11
- "email": "cristobal.valverde@gls-spain.es"
12
- },
13
- "license": "UNLICENSED",
14
- "homepage": "https://github.com/GLS-Spain/gps-common",
15
- "config": {
16
- "commitizen": {
17
- "path": "node_modules/cz-conventional-changelog"
18
- }
19
- },
20
- "husky": {
21
- "hooks": {
22
- "pre-commit": "npm run test"
23
- }
24
- },
25
- "devDependencies": {
26
- "@semantic-release/changelog": "^5.0.1",
27
- "@semantic-release/git": "^9.0.0",
28
- "@semantic-release/npm": "^7.0.10",
29
- "@semantic-release/release-notes-generator": "^9.0.1",
30
- "@types/jest": "^25.2.3",
31
- "ajv": "^6.12.6",
32
- "commitizen": "^4.2.3",
33
- "cz-conventional-changelog": "^3.3.0",
34
- "eslint": "^6.8.0",
35
- "eslint-config-airbnb-base": "^14.2.1",
36
- "eslint-config-prettier": "^6.15.0",
37
- "eslint-plugin-import": "^2.22.1",
38
- "husky": "^4.3.8",
39
- "jest": "^25.5.4",
40
- "prettier": "^1.19.1",
41
- "redoc-cli": "^0.9.13",
42
- "semantic-release": "^17.4.1"
43
- },
44
- "dependencies": {
45
- "@gls_spain/ajv-options": "^1.1.2",
46
- "@gls_spain/common-errors": "^1.1.0",
47
- "@gls_spain/common-json-schemas": "^1.2.4",
48
- "@gls_spain/mongodb": "^1.2.0",
49
- "@gls_spain/winston-transports": "^1.0.2",
50
- "lodash": "^4.17.21",
51
- "winston": "^3.3.3",
52
- "yargs": "^15.4.1"
53
- },
54
- "scripts": {
55
- "commit": "git-cz",
56
- "semantic-release": "semantic-release",
57
- "test": "jest",
58
- "build-json-schemas": "node scripts/build-json-schemas.js --output=build/schemas",
59
- "build-documentation": "node scripts/build-documentation.js --output=build/documentation/documentation.html"
60
- },
61
- "bin": {
62
- "build-gps-schemas": "scripts/build-json-schemas.js",
63
- "build-gps-documentation": "scripts/build-documentation.js"
64
- }
65
- }
@@ -1,64 +0,0 @@
1
- {
2
- "name": "@gls_spain/gps-common",
3
- "version": "34.9.4",
4
- "description": "Errors, schemas and documentation for the Parcel Shops project",
5
- "main": "index.js",
6
- "keywords": [
7
- "gls"
8
- ],
9
- "author": {
10
- "name": "Cristóbal Valverde Albo",
11
- },
12
- "license": "UNLICENSED",
13
- "homepage": "https://github.com/GLS-Spain/gps-common",
14
- "config": {
15
- "commitizen": {
16
- "path": "node_modules/cz-conventional-changelog"
17
- }
18
- },
19
- "husky": {
20
- "hooks": {
21
- "pre-commit": "npm run test"
22
- }
23
- },
24
- "devDependencies": {
25
- "@semantic-release/changelog": "^5.0.1",
26
- "@semantic-release/git": "^9.0.0",
27
- "@semantic-release/npm": "^7.0.10",
28
- "@semantic-release/release-notes-generator": "^9.0.1",
29
- "@types/jest": "^25.2.3",
30
- "ajv": "^6.12.6",
31
- "commitizen": "^4.2.3",
32
- "cz-conventional-changelog": "^3.3.0",
33
- "eslint": "^6.8.0",
34
- "eslint-config-airbnb-base": "^14.2.1",
35
- "eslint-config-prettier": "^6.15.0",
36
- "eslint-plugin-import": "^2.22.1",
37
- "husky": "^4.3.8",
38
- "jest": "^25.5.4",
39
- "prettier": "^1.19.1",
40
- "redoc-cli": "^0.9.13",
41
- "semantic-release": "^17.4.1"
42
- },
43
- "dependencies": {
44
- "@gls_spain/ajv-options": "^1.1.2",
45
- "@gls_spain/common-errors": "^1.1.0",
46
- "@gls_spain/common-json-schemas": "^1.2.4",
47
- "@gls_spain/mongodb": "^1.2.0",
48
- "@gls_spain/winston-transports": "^1.0.2",
49
- "lodash": "^4.17.21",
50
- "winston": "^3.3.3",
51
- "yargs": "^15.4.1"
52
- },
53
- "scripts": {
54
- "commit": "git-cz",
55
- "semantic-release": "semantic-release",
56
- "test": "jest",
57
- "build-json-schemas": "node scripts/build-json-schemas.js --output=build/schemas",
58
- "build-documentation": "node scripts/build-documentation.js --output=build/documentation/documentation.html"
59
- },
60
- "bin": {
61
- "build-gps-schemas": "scripts/build-json-schemas.js",
62
- "build-gps-documentation": "scripts/build-documentation.js"
63
- }
64
- }
@@ -1,64 +0,0 @@
1
- {
2
- "name": "@gls_spain/gps-common",
3
- "version": "34.9.4",
4
- "description": "Errors, schemas and documentation for the Parcel Shops project",
5
- "main": "index.js",
6
- "keywords": [
7
- "gls"
8
- ],
9
- "author": {
10
- "name": "Cristóbal Valverde Albo"
11
- },
12
- "license": "UNLICENSED",
13
- "homepage": "https://github.com/GLS-Spain/gps-common",
14
- "config": {
15
- "commitizen": {
16
- "path": "node_modules/cz-conventional-changelog"
17
- }
18
- },
19
- "husky": {
20
- "hooks": {
21
- "pre-commit": "npm run test"
22
- }
23
- },
24
- "devDependencies": {
25
- "@semantic-release/changelog": "^5.0.1",
26
- "@semantic-release/git": "^9.0.0",
27
- "@semantic-release/npm": "^7.0.10",
28
- "@semantic-release/release-notes-generator": "^9.0.1",
29
- "@types/jest": "^25.2.3",
30
- "ajv": "^6.12.6",
31
- "commitizen": "^4.2.3",
32
- "cz-conventional-changelog": "^3.3.0",
33
- "eslint": "^6.8.0",
34
- "eslint-config-airbnb-base": "^14.2.1",
35
- "eslint-config-prettier": "^6.15.0",
36
- "eslint-plugin-import": "^2.22.1",
37
- "husky": "^4.3.8",
38
- "jest": "^25.5.4",
39
- "prettier": "^1.19.1",
40
- "redoc-cli": "^0.9.13",
41
- "semantic-release": "^17.4.1"
42
- },
43
- "dependencies": {
44
- "@gls_spain/ajv-options": "^1.1.2",
45
- "@gls_spain/common-errors": "^1.1.0",
46
- "@gls_spain/common-json-schemas": "^1.2.4",
47
- "@gls_spain/mongodb": "^1.2.0",
48
- "@gls_spain/winston-transports": "^1.0.2",
49
- "lodash": "^4.17.21",
50
- "winston": "^3.3.3",
51
- "yargs": "^15.4.1"
52
- },
53
- "scripts": {
54
- "commit": "git-cz",
55
- "semantic-release": "semantic-release",
56
- "test": "jest",
57
- "build-json-schemas": "node scripts/build-json-schemas.js --output=build/schemas",
58
- "build-documentation": "node scripts/build-documentation.js --output=build/documentation/documentation.html"
59
- },
60
- "bin": {
61
- "build-gps-schemas": "scripts/build-json-schemas.js",
62
- "build-gps-documentation": "scripts/build-documentation.js"
63
- }
64
- }