@pdtf/schemas 0.5.5 → 0.5.8

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/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { dereference } from "@jdw/jst";
2
- import Ajv from "ajv";
3
- import addFormats from "ajv-formats";
4
-
5
- import propertyPack from "./src/schemas/property-pack.json";
6
- import baspiMaterialFacts from "./src/schemas/baspi-a-material-facts.json";
7
- import baspiLegalInformation from "./src/schemas/baspi-b-legal-information.json";
8
- import energyPerformanceCertificate from "./src/schemas/energy-performance-certificate.json";
9
- import titleDeed from "./src/schemas/title-deed.json";
10
- import geoJson from "./src/schemas/GeoJSON.json";
11
- import pdtfClaim from "./src/schemas/pdtf-claim.json";
12
- import verifiedClaim from "./src/schemas/verified_claims-12.json";
1
+ const { dereference } = require("@jdw/jst");
2
+ const Ajv = require("ajv");
3
+ const addFormats = require("ajv-formats");
4
+
5
+ const propertyPack = require("./src/schemas/property-pack.json");
6
+ const baspiMaterialFacts = require("./src/schemas/baspi-a-material-facts.json");
7
+ const baspiLegalInformation = require("./src/schemas/baspi-b-legal-information.json");
8
+ const energyPerformanceCertificate = require("./src/schemas/energy-performance-certificate.json");
9
+ const titleDeed = require("./src/schemas/title-deed.json");
10
+ const geoJson = require("./src/schemas/GeoJSON.json");
11
+ const pdtfClaim = require("./src/schemas/pdtf-claim.json");
12
+ const verifiedClaim = require("./src/schemas/verified_claims-12.json");
13
13
 
14
14
  const subSchemas = {
15
15
  "https://homebuyingandsellinggroup.co.uk/schemas/baspi-a-material-facts.json":
@@ -22,10 +22,7 @@ const subSchemas = {
22
22
  "https://homebuyingandsellinggroup.co.uk/schemas/title-deed.json": titleDeed
23
23
  };
24
24
 
25
- export const propertyPackSchema = dereference(
26
- propertyPack,
27
- (id) => subSchemas[id]
28
- );
25
+ const propertyPackSchema = dereference(propertyPack, (id) => subSchemas[id]);
29
26
 
30
27
  const ajv = new Ajv({
31
28
  allErrors: true,
@@ -34,9 +31,9 @@ const ajv = new Ajv({
34
31
  // Adds date formats among other types to the validator.
35
32
  addFormats(ajv);
36
33
 
37
- export const validator = ajv.compile(propertyPackSchema);
34
+ const validator = ajv.compile(propertyPackSchema);
38
35
 
39
- export const getSubschema = (path) => {
36
+ const getSubschema = (path) => {
40
37
  const pathArray = path.split("/").slice(1);
41
38
  if (pathArray.length < 1) {
42
39
  return schema;
@@ -46,9 +43,15 @@ export const getSubschema = (path) => {
46
43
  }, propertyPackSchema);
47
44
  };
48
45
 
49
- export const getSubschemaValidator = (path) => {
46
+ const getSubschemaValidator = (path) => {
50
47
  return ajv.getSchema(path) || ajv.compile(getSubschema(path));
51
48
  };
52
49
 
53
- export { verifiedClaim };
54
- export { pdtfClaim };
50
+ module.exports = {
51
+ propertyPackSchema,
52
+ validator,
53
+ getSubschema,
54
+ getSubschemaValidator,
55
+ pdtfClaim,
56
+ verifiedClaim
57
+ };
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@pdtf/schemas",
3
- "version": "0.5.5",
3
+ "version": "0.5.8",
4
4
  "description": "Property Data Trust Framework Schemas and Utilities",
5
5
  "main": "index.js",
6
- "type": "module",
7
6
  "directories": {
8
7
  "doc": "docs"
9
8
  },
@@ -32,9 +31,6 @@
32
31
  "jsonpointer": "^5.0.0"
33
32
  },
34
33
  "devDependencies": {
35
- "@babel/core": "^7.17.5",
36
- "@babel/preset-env": "^7.16.11",
37
- "babel-jest": "^27.5.1",
38
34
  "jest": "^27.5.1"
39
35
  }
40
36
  }