@openaddresses/batch-schema 2.4.0 → 3.1.1
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 +2 -2
- package/CHANGELOG.md +12 -0
- package/index.js +6 -3
- package/lib/error.js +1 -5
- package/lib/schema.js +9 -13
- package/package-lock.json +5491 -0
- package/package.json +3 -1
- package/routes/schema.js +2 -5
- package/test/schema.srv.test.js +4 -5
- package/test/schema.test.js +8 -9
package/.eslintrc.json
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"Map": true
|
|
9
9
|
},
|
|
10
10
|
"parserOptions": {
|
|
11
|
-
"ecmaVersion": 13
|
|
11
|
+
"ecmaVersion": 13,
|
|
12
|
+
"sourceType": "module"
|
|
12
13
|
},
|
|
13
14
|
"plugins": [ "node" ],
|
|
14
15
|
"rules": {
|
|
@@ -39,7 +40,6 @@
|
|
|
39
40
|
"template-curly-spacing": [ "error", "never" ],
|
|
40
41
|
"semi-spacing": "error",
|
|
41
42
|
"strict": "error",
|
|
42
|
-
"node/no-unsupported-features": [ "error", { "version": 8 } ],
|
|
43
43
|
"node/no-missing-require": "error",
|
|
44
44
|
"valid-jsdoc": ["error", {
|
|
45
45
|
"requireParamDescription": false,
|
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
## Version History
|
|
12
12
|
|
|
13
|
+
### v3.1.1
|
|
14
|
+
|
|
15
|
+
- :bug: Internal schema path
|
|
16
|
+
|
|
17
|
+
### v3.0.1
|
|
18
|
+
|
|
19
|
+
- :rocket: Add `.main` property to package.json
|
|
20
|
+
|
|
21
|
+
### v3.0.0
|
|
22
|
+
|
|
23
|
+
- :rocket: Update to ES Module System
|
|
24
|
+
|
|
13
25
|
### v2.4.0
|
|
14
26
|
|
|
15
27
|
- :tada: Add `schema.not_found()`
|
package/index.js
CHANGED
package/lib/error.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* @class
|
|
5
3
|
*/
|
|
6
|
-
class PublicError {
|
|
4
|
+
export default class PublicError {
|
|
7
5
|
constructor(status, err, safe, print = true) {
|
|
8
6
|
// Wrap postgres errors to ensure stack trace (line nums) are returned
|
|
9
7
|
if (err && err.severity) err = new Error(err);
|
|
@@ -43,5 +41,3 @@ class PublicError {
|
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
|
-
|
|
47
|
-
module.exports = PublicError;
|
package/lib/schema.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { Validator } from 'express-json-validator-middleware';
|
|
2
|
+
import { ValidationError } from 'express-json-validator-middleware';
|
|
3
|
+
import $RefParser from 'json-schema-ref-parser';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const Err = require('./error');
|
|
7
|
-
const SchemaRoute = require('../routes/schema');
|
|
8
|
-
const { ValidationError } = require('express-json-validator-middleware');
|
|
5
|
+
import Err from './error.js';
|
|
6
|
+
import SchemaRoute from '../routes/schema.js';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* @class
|
|
@@ -38,7 +36,7 @@ class Param {
|
|
|
38
36
|
/**
|
|
39
37
|
* @class
|
|
40
38
|
*/
|
|
41
|
-
class Schemas {
|
|
39
|
+
export default class Schemas {
|
|
42
40
|
/**
|
|
43
41
|
* @constructor
|
|
44
42
|
*
|
|
@@ -50,7 +48,7 @@ class Schemas {
|
|
|
50
48
|
if (!router) throw new Error('Router Param Required');
|
|
51
49
|
|
|
52
50
|
if (!opts.schemas) {
|
|
53
|
-
this.schemas_path =
|
|
51
|
+
this.schemas_path = String(new URL('../schema/', import.meta.url)).replace('file://', '');
|
|
54
52
|
} else {
|
|
55
53
|
this.schemas_path = opts.schemas;
|
|
56
54
|
}
|
|
@@ -121,9 +119,9 @@ class Schemas {
|
|
|
121
119
|
if (!schemas[type]) continue;
|
|
122
120
|
|
|
123
121
|
try {
|
|
124
|
-
schemas[type] = await $RefParser.dereference(
|
|
122
|
+
schemas[type] = await $RefParser.dereference(new URL(`../schema/${schemas[type]}`, import.meta.url));
|
|
125
123
|
} catch (err) {
|
|
126
|
-
schemas[type] = await $RefParser.dereference(
|
|
124
|
+
schemas[type] = await $RefParser.dereference(`${this.schemas_path}/${schemas[type]}`);
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
|
|
@@ -294,5 +292,3 @@ class Schemas {
|
|
|
294
292
|
return lite;
|
|
295
293
|
}
|
|
296
294
|
}
|
|
297
|
-
|
|
298
|
-
module.exports = Schemas;
|