@openaddresses/batch-schema 2.4.0 → 3.0.0

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/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@openaddresses/batch-schema",
3
+ "type": "module",
3
4
  "root": true,
4
- "version": "2.4.0",
5
+ "version": "3.0.0",
5
6
  "description": "Strongly Validated JSON Schema support for address",
6
7
  "repository": "git@github.com:openaddresses/batch-schema",
7
8
  "author": "ingalls <nick@ingalls.ca>",
package/routes/schema.js CHANGED
@@ -1,7 +1,6 @@
1
- 'use strict';
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;
@@ -1,8 +1,7 @@
1
- 'use strict';
2
- const test = require('tape');
3
- const express = require('express');
4
- const { Schema } = require('../');
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(), {
@@ -1,17 +1,16 @@
1
- 'use strict';
2
- const fs = require('fs');
3
- const path = require('path');
4
- const test = require('tape');
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import test from 'tape';
5
4
 
6
- const glob = require('glob');
7
- const $RefParser = require('json-schema-ref-parser');
8
- const Ajv = require('ajv');
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(path.resolve(__dirname, '../schema/**/*.json')).forEach((source) => {
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
+ }