@openaddresses/batch-schema 2.2.0 → 2.3.3
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/.eslintrc.json +8 -10
- package/.github/workflows/test.yml +29 -0
- package/CHANGELOG.md +17 -0
- package/index.js +4 -4
- package/lib/error.js +3 -1
- package/lib/schema.js +2 -0
- package/package.json +1 -5
- package/routes/schema.js +1 -0
- package/test/schema.srv.test.js +7 -0
- package/test/schema.test.js +1 -0
- package/.babelrc +0 -7
package/.eslintrc.json
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "eslint:recommended",
|
|
3
3
|
"root": true,
|
|
4
|
-
"parser": "@babel/eslint-parser",
|
|
5
|
-
"parserOptions": {
|
|
6
|
-
"ecmaVersion": 2018,
|
|
7
|
-
"babelOptions": {
|
|
8
|
-
"configFile": "./.babelrc"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
4
|
"env": {
|
|
12
|
-
"node": true
|
|
13
|
-
|
|
5
|
+
"node": true
|
|
6
|
+
},
|
|
7
|
+
"globals": {
|
|
8
|
+
"Map": true
|
|
9
|
+
},
|
|
10
|
+
"parserOptions": {
|
|
11
|
+
"ecmaVersion": 13
|
|
14
12
|
},
|
|
15
|
-
"plugins": [ "node"
|
|
13
|
+
"plugins": [ "node" ],
|
|
16
14
|
"rules": {
|
|
17
15
|
"no-console": 0,
|
|
18
16
|
"arrow-parens": [ "error", "always" ],
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- synchronize
|
|
8
|
+
- reopened
|
|
9
|
+
- ready_for_review
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
if: github.event.pull_request.draft == false
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
with:
|
|
18
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-node@v2
|
|
21
|
+
with:
|
|
22
|
+
node-version: '16'
|
|
23
|
+
|
|
24
|
+
- run: npm install
|
|
25
|
+
|
|
26
|
+
- run: npm run lint
|
|
27
|
+
|
|
28
|
+
- run: npm test
|
|
29
|
+
|
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,23 @@
|
|
|
10
10
|
|
|
11
11
|
## Version History
|
|
12
12
|
|
|
13
|
+
### v2.3.3
|
|
14
|
+
|
|
15
|
+
- :rocket: Name exports explicitly instead of returning object for ES module compat.
|
|
16
|
+
|
|
17
|
+
### v2.3.2
|
|
18
|
+
|
|
19
|
+
- :bug: Fix a status code error handling bug which would crash express
|
|
20
|
+
- :arrow_Up: Update Base Deps
|
|
21
|
+
|
|
22
|
+
### v2.3.1
|
|
23
|
+
|
|
24
|
+
- :arrow_up: Update Base Deps
|
|
25
|
+
|
|
26
|
+
### v2.3.0
|
|
27
|
+
|
|
28
|
+
- :rocket: Remove babel in favour of ESLint's new ECMA13 support
|
|
29
|
+
|
|
13
30
|
### v2.2.0
|
|
14
31
|
|
|
15
32
|
- :tada: Add support for errors with `status` set from external libraries (IE OpenAddresses/tilebase)
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports.Schema = require('./lib/schema');
|
|
4
|
+
module.exports.Err = require('./lib/error')
|
package/lib/error.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* @class
|
|
3
5
|
*/
|
|
@@ -23,7 +25,7 @@ class PublicError {
|
|
|
23
25
|
|
|
24
26
|
// Duplicate Express supported Error extensions
|
|
25
27
|
} else if (err instanceof Error && (err.status || err.statusCode)) {
|
|
26
|
-
res.status(err.status).json({
|
|
28
|
+
res.status(err.status || err.statusCode).json({
|
|
27
29
|
status: err.status || err.statusCode,
|
|
28
30
|
message: err.message || 'Generic Error',
|
|
29
31
|
messages: messages
|
package/lib/schema.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openaddresses/batch-schema",
|
|
3
3
|
"root": true,
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.3",
|
|
5
5
|
"description": "Strongly Validated JSON Schema support for address",
|
|
6
6
|
"repository": "git@github.com:openaddresses/batch",
|
|
7
7
|
"author": "ingalls <nick@ingalls.ca>",
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
"tape": "^5.3.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/eslint-parser": "^7.15.7",
|
|
26
|
-
"@babel/eslint-plugin": "^7.14.5",
|
|
27
|
-
"@babel/plugin-syntax-class-properties": "^7.12.13",
|
|
28
|
-
"@babel/preset-env": "^7.15.6",
|
|
29
25
|
"eslint": "^8.0.1",
|
|
30
26
|
"eslint-plugin-node": "^11.0.0"
|
|
31
27
|
}
|
package/routes/schema.js
CHANGED
package/test/schema.srv.test.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
const test = require('tape');
|
|
2
3
|
const express = require('express');
|
|
3
4
|
const { Schema } = require('../');
|
|
@@ -51,6 +52,12 @@ test('GET: api/schema?method=FAKE', async (t) => {
|
|
|
51
52
|
status: 400,
|
|
52
53
|
message: 'validation error',
|
|
53
54
|
messages: [{
|
|
55
|
+
keyword: 'enum',
|
|
56
|
+
dataPath: '.method',
|
|
57
|
+
schemaPath: '#/properties/method/enum',
|
|
58
|
+
params: {
|
|
59
|
+
allowedValues: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH']
|
|
60
|
+
},
|
|
54
61
|
message: 'should be equal to one of the allowed values'
|
|
55
62
|
}]
|
|
56
63
|
});
|
package/test/schema.test.js
CHANGED