@pdtf/schemas 2.3.0 → 3.0.0-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/index.js +37 -81
- package/package.json +1 -1
- package/src/examples/v2/exampleTransaction.json +6 -20
- package/src/examples/v3/exampleTransaction.json +900 -0
- package/src/mappings/SendPropertyDetailsRequestSchema.json +1588 -0
- package/src/mappings/adf.js +1 -1
- package/src/schemas/v2/combined.json +13206 -12615
- package/src/schemas/v2/overlays/con29DW.json +771 -762
- package/src/schemas/v2/overlays/con29R.json +3052 -3073
- package/src/schemas/v2/overlays/llc1.json +12 -33
- package/src/schemas/v2/overlays/rds.json +32 -0
- package/src/schemas/v2/pdtf-transaction.json +13656 -12911
- package/src/schemas/v2/skeleton.json +1342 -1155
- package/src/schemas/v3/combined.json +38311 -0
- package/src/schemas/v3/overlays/baspi.json +9812 -0
- package/src/schemas/v3/overlays/con29DW.json +794 -0
- package/src/schemas/v3/overlays/con29R.json +3094 -0
- package/src/schemas/v3/overlays/fme1.json +1444 -0
- package/src/schemas/v3/overlays/llc1.json +25 -0
- package/src/schemas/v3/overlays/lpe1.json +2463 -0
- package/src/schemas/v3/overlays/nts.json +1874 -0
- package/src/schemas/v3/overlays/oc1.json +2799 -0
- package/src/schemas/v3/overlays/piq.json +3931 -0
- package/src/schemas/v3/overlays/rds.json +4086 -0
- package/src/schemas/v3/overlays/ta10.json +6521 -0
- package/src/schemas/v3/overlays/ta6.json +5285 -0
- package/src/schemas/v3/overlays/ta7.json +1399 -0
- package/src/schemas/v3/pdtf-transaction.json +34771 -0
- package/src/schemas/v3/skeleton.json +3986 -0
- package/src/tests/v2/transactionSchema.test.js +26 -16
- package/src/tests/v3/transactionSchema.test.js +350 -0
- package/src/tests/v3/verifiedClaimsValidator.test.js +128 -0
- package/src/utils/extractOverlay.js +7 -7
- package/src/utils/hmlrLLC1.json +0 -275
package/index.js
CHANGED
|
@@ -11,79 +11,50 @@ const ajv = new Ajv({
|
|
|
11
11
|
// Adds date formats among other types to the validator.
|
|
12
12
|
addFormats(ajv);
|
|
13
13
|
|
|
14
|
-
// v1, deprecated direct access
|
|
15
|
-
const pdtfTransaction = require("./src/schemas/v1/pdtf-transaction.json");
|
|
16
|
-
const materialFacts = require("./src/schemas/v1/material-facts.json");
|
|
17
|
-
const legalInformation = require("./src/schemas/v1/legal-information.json");
|
|
18
|
-
const energyPerformanceCertificate = require("./src/schemas/v1/energy-performance-certificate.json");
|
|
19
|
-
const titleDeed = require("./src/schemas/v1/title-deed.json");
|
|
20
|
-
const searches = require("./src/schemas/v1/searches.json");
|
|
21
|
-
const localLandCharges = require("./src/schemas/v1/searches/local-land-charges.json");
|
|
22
|
-
const localSearchesRequired = require("./src/schemas/v1/searches/local-searches-required.json");
|
|
23
|
-
const drainageAndWater = require("./src/schemas/v1/searches/drainage-and-water.json");
|
|
24
|
-
const geoJson = require("./src/schemas/v1/GeoJSON.json");
|
|
25
14
|
const verifiedClaimsSchema = require("./src/schemas/v1/pdtf-verified-claims.json");
|
|
26
|
-
|
|
27
|
-
const subSchemas = {
|
|
28
|
-
"https://trust.propdata.org.uk/schemas/v1/material-facts.json": materialFacts,
|
|
29
|
-
"https://trust.propdata.org.uk/schemas/v1/legal-information.json":
|
|
30
|
-
legalInformation,
|
|
31
|
-
"https://trust.propdata.org.uk/schemas/v1/energy-performance-certificate.json":
|
|
32
|
-
energyPerformanceCertificate,
|
|
33
|
-
"https://geojson.org/schema/GeoJSON.json": geoJson,
|
|
34
|
-
"https://trust.propdata.org.uk/schemas/v1/title-deed.json": titleDeed,
|
|
35
|
-
"https://trust.propdata.org.uk/schemas/v1/searches.json": searches,
|
|
36
|
-
"https://trust.propdata.org.uk/schemas/v1/searches/local-land-charges.json":
|
|
37
|
-
localLandCharges,
|
|
38
|
-
"https://trust.propdata.org.uk/schemas/v1/searches/local-searches-required.json":
|
|
39
|
-
localSearchesRequired,
|
|
40
|
-
"https://trust.propdata.org.uk/schemas/v1/searches/drainage-and-water.json":
|
|
41
|
-
drainageAndWater,
|
|
42
|
-
};
|
|
43
|
-
const transactionSchema = dereference(pdtfTransaction, (id) => subSchemas[id]);
|
|
44
|
-
const validator = ajv.compile(transactionSchema);
|
|
45
|
-
|
|
46
|
-
// v2, via accessor functions and overlays
|
|
47
|
-
const combinedSchema = require("./src/schemas/v2/combined.json");
|
|
48
15
|
const v2CoreSchema = require("./src/schemas/v2/pdtf-transaction.json");
|
|
49
|
-
|
|
50
|
-
const baspiOverlay = require("./src/schemas/v2/overlays/baspi.json");
|
|
51
|
-
const ta6Overlay = require("./src/schemas/v2/overlays/ta6.json");
|
|
52
|
-
const ta7Overlay = require("./src/schemas/v2/overlays/ta7.json");
|
|
53
|
-
const ta10Overlay = require("./src/schemas/v2/overlays/ta10.json");
|
|
54
|
-
const lpe1Overlay = require("./src/schemas/v2/overlays/lpe1.json");
|
|
55
|
-
const fme1Overlay = require("./src/schemas/v2/overlays/fme1.json");
|
|
56
|
-
const llc1Overlay = require("./src/schemas/v2/overlays/llc1.json");
|
|
57
|
-
const ntsOverlay = require("./src/schemas/v2/overlays/nts.json");
|
|
58
|
-
const con29ROverlay = require("./src/schemas/v2/overlays/con29R.json");
|
|
59
|
-
const con29DWOverlay = require("./src/schemas/v2/overlays/con29DW.json");
|
|
60
|
-
const rdsOverlay = require("./src/schemas/v2/overlays/rds.json");
|
|
61
|
-
const oc1Overlay = require("./src/schemas/v2/overlays/oc1.json");
|
|
62
|
-
const piqOverlay = require("./src/schemas/v2/overlays/piq.json");
|
|
16
|
+
const v3CoreSchema = require("./src/schemas/v3/pdtf-transaction.json");
|
|
63
17
|
|
|
64
18
|
const overlaysMap = {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
19
|
+
"https://trust.propdata.org.uk/schemas/v2/pdtf-transaction.json": {
|
|
20
|
+
baspiV4: require("./src/schemas/v2/overlays/baspi.json"),
|
|
21
|
+
ta6ed4: require("./src/schemas/v2/overlays/ta6.json"),
|
|
22
|
+
ta7ed3: require("./src/schemas/v2/overlays/ta7.json"),
|
|
23
|
+
ta10ed3: require("./src/schemas/v2/overlays/ta10.json"),
|
|
24
|
+
lpe1ed4: require("./src/schemas/v2/overlays/lpe1.json"),
|
|
25
|
+
fme1ed2: require("./src/schemas/v2/overlays/fme1.json"),
|
|
26
|
+
llc1v2: require("./src/schemas/v2/overlays/llc1.json"),
|
|
27
|
+
nts2023: require("./src/schemas/v2/overlays/nts.json"),
|
|
28
|
+
con29R2019: require("./src/schemas/v2/overlays/con29R.json"),
|
|
29
|
+
con29DW: require("./src/schemas/v2/overlays/con29DW.json"),
|
|
30
|
+
rdsV333: require("./src/schemas/v2/overlays/rds.json"),
|
|
31
|
+
oc1v21: require("./src/schemas/v2/overlays/oc1.json"),
|
|
32
|
+
piqV3: require("./src/schemas/v2/overlays/piq.json"),
|
|
33
|
+
null: {},
|
|
34
|
+
},
|
|
35
|
+
"https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json": {
|
|
36
|
+
baspiV4: require("./src/schemas/v3/overlays/baspi.json"),
|
|
37
|
+
ta6ed4: require("./src/schemas/v3/overlays/ta6.json"),
|
|
38
|
+
ta7ed3: require("./src/schemas/v3/overlays/ta7.json"),
|
|
39
|
+
ta10ed3: require("./src/schemas/v3/overlays/ta10.json"),
|
|
40
|
+
lpe1ed4: require("./src/schemas/v3/overlays/lpe1.json"),
|
|
41
|
+
fme1ed2: require("./src/schemas/v3/overlays/fme1.json"),
|
|
42
|
+
llc1v2: require("./src/schemas/v3/overlays/llc1.json"),
|
|
43
|
+
nts2023: require("./src/schemas/v3/overlays/nts.json"),
|
|
44
|
+
con29R2019: require("./src/schemas/v3/overlays/con29R.json"),
|
|
45
|
+
con29DW: require("./src/schemas/v3/overlays/con29DW.json"),
|
|
46
|
+
rdsV333: require("./src/schemas/v3/overlays/rds.json"),
|
|
47
|
+
oc1v21: require("./src/schemas/v3/overlays/oc1.json"),
|
|
48
|
+
piqV3: require("./src/schemas/v3/overlays/piq.json"),
|
|
49
|
+
null: {},
|
|
50
|
+
},
|
|
80
51
|
};
|
|
81
52
|
|
|
82
53
|
const transactionSchemas = {
|
|
83
|
-
"https://trust.propdata.org.uk/schemas/v1/pdtf-transaction.json":
|
|
84
|
-
transactionSchema,
|
|
85
54
|
"https://trust.propdata.org.uk/schemas/v2/pdtf-transaction.json":
|
|
86
55
|
v2CoreSchema,
|
|
56
|
+
"https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json":
|
|
57
|
+
v3CoreSchema,
|
|
87
58
|
};
|
|
88
59
|
|
|
89
60
|
const combineMerge = (target, source, options) => {
|
|
@@ -101,19 +72,18 @@ const combineMerge = (target, source, options) => {
|
|
|
101
72
|
};
|
|
102
73
|
|
|
103
74
|
const getTransactionSchema = (
|
|
104
|
-
schemaId = "https://trust.propdata.org.uk/schemas/
|
|
75
|
+
schemaId = "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
|
|
105
76
|
overlays = ["baspiV4"]
|
|
106
77
|
) => {
|
|
107
78
|
const sourceSchema = transactionSchemas[schemaId];
|
|
108
79
|
if (!overlays || overlays.length < 1) return sourceSchema;
|
|
109
80
|
let mergedSchema = sourceSchema;
|
|
110
81
|
overlays.forEach((overlay) => {
|
|
111
|
-
const overlaySchema = overlaysMap[overlay] || {};
|
|
82
|
+
const overlaySchema = overlaysMap[schemaId][overlay] || {};
|
|
112
83
|
mergedSchema = merge(overlaySchema, mergedSchema, {
|
|
113
84
|
arrayMerge: combineMerge,
|
|
114
85
|
});
|
|
115
86
|
});
|
|
116
|
-
// console.log("mergedSchema", mergedSchema);
|
|
117
87
|
return mergedSchema;
|
|
118
88
|
};
|
|
119
89
|
|
|
@@ -257,8 +227,6 @@ const validateVerifiedClaims = (verifiedClaims, schemaId, overlays) => {
|
|
|
257
227
|
|
|
258
228
|
module.exports = {
|
|
259
229
|
ajv,
|
|
260
|
-
transactionSchema, // v1 deprecated
|
|
261
|
-
validator, // v1 deprecated
|
|
262
230
|
getTransactionSchema,
|
|
263
231
|
getValidator,
|
|
264
232
|
getSubschema,
|
|
@@ -267,16 +235,4 @@ module.exports = {
|
|
|
267
235
|
getTitleAtPath,
|
|
268
236
|
verifiedClaimsSchema,
|
|
269
237
|
validateVerifiedClaims,
|
|
270
|
-
baspiOverlay,
|
|
271
|
-
ta6Overlay,
|
|
272
|
-
ta7Overlay,
|
|
273
|
-
ta10Overlay,
|
|
274
|
-
lpe1Overlay,
|
|
275
|
-
fme1Overlay,
|
|
276
|
-
llc1Overlay,
|
|
277
|
-
ntsOverlay,
|
|
278
|
-
con29ROverlay,
|
|
279
|
-
con29DWOverlay,
|
|
280
|
-
rdsOverlay,
|
|
281
|
-
oc1Overlay,
|
|
282
238
|
};
|
package/package.json
CHANGED
|
@@ -478,6 +478,11 @@
|
|
|
478
478
|
"radonTest": { "yesNo": "No" },
|
|
479
479
|
"remedialMeasuresOnConstruction": { "yesNo": "No" }
|
|
480
480
|
},
|
|
481
|
+
"groundStability": {
|
|
482
|
+
"groundStabilityRiskReport": {
|
|
483
|
+
"recommendedActionIndicator": "Yes"
|
|
484
|
+
}
|
|
485
|
+
},
|
|
481
486
|
"otherEnvironmental": {
|
|
482
487
|
"yesNo": "No"
|
|
483
488
|
}
|
|
@@ -889,26 +894,7 @@
|
|
|
889
894
|
"providerName": "TM Group",
|
|
890
895
|
"status": "Delivered",
|
|
891
896
|
"reportDate": "2022-10-13T08:55:49",
|
|
892
|
-
"contentTypes": ["Environmental Risks"]
|
|
893
|
-
"results": [
|
|
894
|
-
{
|
|
895
|
-
"contentType": "Environmental Risks",
|
|
896
|
-
"riskResults": [
|
|
897
|
-
{
|
|
898
|
-
"riskCategory": "Flood",
|
|
899
|
-
"recommendedActionIndicator": "Yes"
|
|
900
|
-
},
|
|
901
|
-
{
|
|
902
|
-
"riskCategory": "Ground Stability",
|
|
903
|
-
"recommendedActionIndicator": "Yes"
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
"riskCategory": "Mining",
|
|
907
|
-
"recommendedActionIndicator": "No"
|
|
908
|
-
}
|
|
909
|
-
]
|
|
910
|
-
}
|
|
911
|
-
]
|
|
897
|
+
"contentTypes": ["Environmental Risks"]
|
|
912
898
|
}
|
|
913
899
|
]
|
|
914
900
|
}
|