@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/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openaddresses/batch-schema",
|
|
3
|
+
"type": "module",
|
|
3
4
|
"root": true,
|
|
4
|
-
"
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"version": "3.1.1",
|
|
5
7
|
"description": "Strongly Validated JSON Schema support for address",
|
|
6
8
|
"repository": "git@github.com:openaddresses/batch-schema",
|
|
7
9
|
"author": "ingalls <nick@ingalls.ca>",
|
package/routes/schema.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const Err = require('../lib/error');
|
|
1
|
+
import Err from '../lib/error.js';
|
|
3
2
|
|
|
4
|
-
async function router(schema) {
|
|
3
|
+
export default async function router(schema) {
|
|
5
4
|
/**
|
|
6
5
|
* @api {get} /api/schema List Schemas
|
|
7
6
|
* @apiVersion 1.0.0
|
|
@@ -36,5 +35,3 @@ async function router(schema) {
|
|
|
36
35
|
}
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
module.exports = router;
|
package/test/schema.srv.test.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const got = require('got');
|
|
1
|
+
import test from 'tape';
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import { Schema } from '../index.js';
|
|
4
|
+
import got from 'got';
|
|
6
5
|
|
|
7
6
|
const app = express();
|
|
8
7
|
const schema = new Schema(express.Router(), {
|
package/test/schema.test.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const test = require('tape');
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import test from 'tape';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import glob from 'glob';
|
|
6
|
+
import $RefParser from 'json-schema-ref-parser';
|
|
7
|
+
import Ajv from 'ajv';
|
|
9
8
|
|
|
10
9
|
const ajv = new Ajv({
|
|
11
10
|
allErrors: true
|
|
12
11
|
});
|
|
13
12
|
|
|
14
|
-
glob.sync(
|
|
13
|
+
for (const source of glob.sync('../schema/**/*.json')) {
|
|
15
14
|
test(`schema/${path.parse(source).base}`, async (t) => {
|
|
16
15
|
try {
|
|
17
16
|
const file = fs.readFileSync(source);
|
|
@@ -31,4 +30,4 @@ glob.sync(path.resolve(__dirname, '../schema/**/*.json')).forEach((source) => {
|
|
|
31
30
|
}
|
|
32
31
|
t.end();
|
|
33
32
|
});
|
|
34
|
-
}
|
|
33
|
+
}
|