@pdtf/schemas 2.0.0-2 → 2.0.0-21
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 +33 -19
- package/package.json +1 -1
- package/src/examples/v2/exampleTransaction.json +86 -87
- package/src/schemas/v2/combined.json +7432 -1101
- package/src/schemas/v2/overlays/baspi.json +1087 -742
- package/src/schemas/v2/overlays/con29DW.json +256 -127
- package/src/schemas/v2/overlays/con29R.json +1 -1
- package/src/schemas/v2/overlays/fme1.json +46 -212
- package/src/schemas/v2/overlays/lpe1.json +92 -63
- package/src/schemas/v2/overlays/nts.json +39 -43
- package/src/schemas/v2/overlays/rds.json +339 -337
- package/src/schemas/v2/overlays/ta10.json +844 -1
- package/src/schemas/v2/overlays/ta6.json +330 -291
- package/src/schemas/v2/overlays/ta7.json +98 -33
- package/src/schemas/v2/{core.json → pdtf-transaction.json} +6901 -927
- package/src/schemas/v2/skeleton.json +3559 -0
- package/src/tests/v1/transactionSchema.test.js +21 -13
- package/src/tests/v2/transactionSchema.test.js +6 -4
- package/src/tests/v2/verifiedClaimsValidator.test.js +128 -0
- package/src/utils/extractOverlay.js +47 -9
- package/src/utils/extractProperties.js +44 -0
- package/src/schemas/v2/merged.json +0 -28697
package/index.js
CHANGED
|
@@ -45,25 +45,28 @@ const validator = ajv.compile(transactionSchema);
|
|
|
45
45
|
|
|
46
46
|
// v2, via accessor functions and overlays
|
|
47
47
|
const combinedSchema = require("./src/schemas/v2/combined.json");
|
|
48
|
-
const
|
|
48
|
+
const v2CoreSchema = require("./src/schemas/v2/pdtf-transaction.json");
|
|
49
49
|
|
|
50
50
|
const baspiOverlay = require("./src/schemas/v2/overlays/baspi.json");
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
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
|
+
|
|
63
|
+
const overlays = { baspiV4: baspiOverlay, null: {} };
|
|
62
64
|
|
|
63
65
|
const transactionSchemas = {
|
|
64
66
|
"https://trust.propdata.org.uk/schemas/v1/pdtf-transaction.json":
|
|
65
67
|
transactionSchema,
|
|
66
|
-
"https://trust.propdata.org.uk/schemas/v2/pdtf-transaction.json":
|
|
68
|
+
"https://trust.propdata.org.uk/schemas/v2/pdtf-transaction.json":
|
|
69
|
+
v2CoreSchema,
|
|
67
70
|
};
|
|
68
71
|
|
|
69
72
|
const combineMerge = (target, source, options) => {
|
|
@@ -139,8 +142,8 @@ const isPathValid = (path, schemaId, overlay) => {
|
|
|
139
142
|
|
|
140
143
|
const getSubschemaValidator = (path, schemaId, overlay) => {
|
|
141
144
|
const subSchema = getSubschema(path, schemaId, overlay);
|
|
142
|
-
// see if we can retrieve the schema by path
|
|
143
|
-
const cacheKey = `${path}-${schemaId}`;
|
|
145
|
+
// see if we can retrieve the schema by path, schemaId and overlay
|
|
146
|
+
const cacheKey = `${path}-${schemaId}-${overlay}`;
|
|
144
147
|
let validator = ajv.getSchema(cacheKey);
|
|
145
148
|
// retrieve whole schema by $id if available
|
|
146
149
|
if (!validator && subSchema.$id) validator = ajv.getSchema(cacheKey);
|
|
@@ -195,7 +198,7 @@ const getTitleAtPath = (schema, path, rootPath = path) => {
|
|
|
195
198
|
}
|
|
196
199
|
};
|
|
197
200
|
|
|
198
|
-
const validateVerifiedClaims = (verifiedClaims) => {
|
|
201
|
+
const validateVerifiedClaims = (verifiedClaims, schemaId, overlay) => {
|
|
199
202
|
const validatorVClaims = ajv.compile(verifiedClaimsSchema);
|
|
200
203
|
|
|
201
204
|
const validationErrorsArr = [];
|
|
@@ -213,11 +216,10 @@ const validateVerifiedClaims = (verifiedClaims) => {
|
|
|
213
216
|
|
|
214
217
|
verifiedClaimsArray.forEach((claim) => {
|
|
215
218
|
const paths = Object.keys(claim.claims);
|
|
216
|
-
|
|
217
219
|
for (const path of paths) {
|
|
218
|
-
const validPath = isPathValid(path);
|
|
220
|
+
const validPath = isPathValid(path, schemaId, overlay);
|
|
219
221
|
if (validPath) {
|
|
220
|
-
const subValidator = getSubschemaValidator(path);
|
|
222
|
+
const subValidator = getSubschemaValidator(path, schemaId, overlay);
|
|
221
223
|
const isValid = subValidator(claim.claims[path]);
|
|
222
224
|
if (!isValid) {
|
|
223
225
|
validationErrorsArr.push(...subValidator.errors);
|
|
@@ -245,4 +247,16 @@ module.exports = {
|
|
|
245
247
|
getTitleAtPath,
|
|
246
248
|
verifiedClaimsSchema,
|
|
247
249
|
validateVerifiedClaims,
|
|
250
|
+
baspiOverlay,
|
|
251
|
+
ta6Overlay,
|
|
252
|
+
ta7Overlay,
|
|
253
|
+
ta10Overlay,
|
|
254
|
+
lpe1Overlay,
|
|
255
|
+
fme1Overlay,
|
|
256
|
+
llc1Overlay,
|
|
257
|
+
ntsOverlay,
|
|
258
|
+
con29ROverlay,
|
|
259
|
+
con29DWOverlay,
|
|
260
|
+
rdsOverlay,
|
|
261
|
+
oc1Overlay,
|
|
248
262
|
};
|
package/package.json
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"address": {
|
|
22
22
|
"line1": "47 Park Road",
|
|
23
23
|
"line2": "",
|
|
24
|
+
"line3": "",
|
|
24
25
|
"town": "HARPENDEN",
|
|
25
|
-
"county": "Herts",
|
|
26
26
|
"postcode": "AL3 5AF"
|
|
27
27
|
},
|
|
28
28
|
"delayFactors": {
|
|
@@ -34,23 +34,37 @@
|
|
|
34
34
|
"titleNumber": "HD221222",
|
|
35
35
|
"ownershipType": "Leasehold",
|
|
36
36
|
"leaseholdInformation": {
|
|
37
|
+
"typeOfLeasehold": {
|
|
38
|
+
"leaseholdType": "Shared ownership",
|
|
39
|
+
"sharedOwnershipPercentage": 50,
|
|
40
|
+
"sharedOwnershipRent": 200,
|
|
41
|
+
"sharedOwnershipRentFrequency": "Monthly"
|
|
42
|
+
},
|
|
43
|
+
"leaseTerm": {
|
|
44
|
+
"startYearOfLease": 1900,
|
|
45
|
+
"lengthOfLeaseInYears": 999
|
|
46
|
+
},
|
|
37
47
|
"contactDetails": {
|
|
38
48
|
"contacts": {
|
|
39
49
|
"landlord": {
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
"contact": {
|
|
51
|
+
"nameOrOrganisation": "Fleesum Properties",
|
|
52
|
+
"address": {
|
|
53
|
+
"line1": "47 Park Road",
|
|
54
|
+
"postcode": "AL3 5AF"
|
|
55
|
+
},
|
|
56
|
+
"emailAddress": "james@fleesum.com"
|
|
57
|
+
}
|
|
46
58
|
},
|
|
47
59
|
"managingAgent": {
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
"contact": {
|
|
61
|
+
"nameOrOrganisation": "Pricee Living",
|
|
62
|
+
"address": {
|
|
63
|
+
"line1": "Pricee House",
|
|
64
|
+
"postcode": "AL3 5KK"
|
|
65
|
+
},
|
|
66
|
+
"emailAddress": "marcel@pricee.co.uk"
|
|
67
|
+
}
|
|
54
68
|
}
|
|
55
69
|
}
|
|
56
70
|
},
|
|
@@ -77,20 +91,6 @@
|
|
|
77
91
|
"details": "There is sinking fund."
|
|
78
92
|
}
|
|
79
93
|
},
|
|
80
|
-
"general": {
|
|
81
|
-
"typeOfLeasehold": {
|
|
82
|
-
"leaseholdType": "Shared ownership",
|
|
83
|
-
"sharedOwnershipPercentage": 50,
|
|
84
|
-
"sharedOwnershipRent": 200,
|
|
85
|
-
"sharedOwnershipRentFrequency": "Monthly"
|
|
86
|
-
},
|
|
87
|
-
"leaseTerm": {
|
|
88
|
-
"startYearOfLease": 1900,
|
|
89
|
-
"lengthOfLeaseInYears": 999
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
"largeAdditionalExpense": { "yesNo": "No" },
|
|
94
94
|
"additionalFeesOnSale": 0
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -128,6 +128,11 @@
|
|
|
128
128
|
"certificate": {
|
|
129
129
|
"certificateNumber": "12345",
|
|
130
130
|
"currentEnergyRating": "A"
|
|
131
|
+
},
|
|
132
|
+
"greenDealLoan": {
|
|
133
|
+
"hasGreenDealLoan": {
|
|
134
|
+
"yesNo": "No"
|
|
135
|
+
}
|
|
131
136
|
}
|
|
132
137
|
},
|
|
133
138
|
"councilTax": {
|
|
@@ -272,50 +277,51 @@
|
|
|
272
277
|
}
|
|
273
278
|
},
|
|
274
279
|
"waterAndDrainage": {
|
|
275
|
-
"
|
|
276
|
-
"
|
|
277
|
-
"yesNo": "
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
"supplier": "Northumbria Water"
|
|
280
|
+
"water": {
|
|
281
|
+
"mainsWater": {
|
|
282
|
+
"yesNo": "To be connected",
|
|
283
|
+
"dateToBeConnected": "2022-12-15",
|
|
284
|
+
"supplier": "Northumbria Water"
|
|
285
|
+
}
|
|
282
286
|
},
|
|
283
|
-
"
|
|
284
|
-
"
|
|
285
|
-
"yesNo": "
|
|
287
|
+
"drainage": {
|
|
288
|
+
"mainsSurfaceWaterDrainage": {
|
|
289
|
+
"yesNo": "Yes"
|
|
286
290
|
},
|
|
287
|
-
"
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
"
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
"dischargeCompliesWithGBR": "Yes"
|
|
291
|
+
"mainsFoulDrainage": {
|
|
292
|
+
"yesNo": "No",
|
|
293
|
+
"sustainableDrainageSystem": { "yesNo": "No" },
|
|
294
|
+
"septicTank": {
|
|
295
|
+
"yesNo": "Yes",
|
|
296
|
+
"details": "Last emptied on 1 Jan 2022",
|
|
297
|
+
"dateReplaced": "2022-01-01",
|
|
298
|
+
"dateLastEmptied": "2022-01-01"
|
|
299
|
+
},
|
|
300
|
+
"cesspit": { "yesNo": "No" },
|
|
301
|
+
"sewerageTreatmentPlant": { "yesNo": "No" },
|
|
302
|
+
"otherConnectedProperties": { "yesNo": "No" },
|
|
303
|
+
"yearSystemInstalled": 1980,
|
|
304
|
+
"plantOnOtherLand": { "yesNo": "No" },
|
|
305
|
+
"plantRegistered": { "yesNo": "No" },
|
|
306
|
+
"plantDrainsIntoWaterway": {
|
|
307
|
+
"yesNo": "Yes",
|
|
308
|
+
"dischargeCompliesWithGBR": "Yes"
|
|
309
|
+
}
|
|
307
310
|
}
|
|
311
|
+
},
|
|
312
|
+
"maintenanceAgreements": {
|
|
313
|
+
"yesNo": "No"
|
|
308
314
|
}
|
|
309
315
|
},
|
|
310
|
-
"
|
|
311
|
-
"
|
|
316
|
+
"connectedUtilities": {
|
|
317
|
+
"mainsElectricity": {
|
|
312
318
|
"maintenanceAgreements": {
|
|
313
319
|
"yesNo": "No"
|
|
314
320
|
},
|
|
315
321
|
"yesNo": "Yes",
|
|
316
322
|
"supplier": "Octopus Energy"
|
|
317
323
|
},
|
|
318
|
-
"
|
|
324
|
+
"mainsGas": {
|
|
319
325
|
"maintenanceAgreements": {
|
|
320
326
|
"yesNo": "No"
|
|
321
327
|
},
|
|
@@ -356,11 +362,6 @@
|
|
|
356
362
|
"yesNo": "No"
|
|
357
363
|
}
|
|
358
364
|
},
|
|
359
|
-
"greenDealLoan": {
|
|
360
|
-
"hasGreenDealLoan": {
|
|
361
|
-
"yesNo": "No"
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
365
|
"centralHeating": {
|
|
365
366
|
"hasCentralHeating": "Yes",
|
|
366
367
|
"centralHeatingDetails": {
|
|
@@ -374,7 +375,8 @@
|
|
|
374
375
|
},
|
|
375
376
|
"centralHeatingFuel": { "centralHeatingFuelType": "Gas" },
|
|
376
377
|
"centralHeatingInstalled": "2016-04-20",
|
|
377
|
-
"
|
|
378
|
+
"heatingLastServicedDate": "2021-03-26",
|
|
379
|
+
"heatingLastServicedReport": "To follow"
|
|
378
380
|
}
|
|
379
381
|
},
|
|
380
382
|
"insurance": {
|
|
@@ -437,21 +439,11 @@
|
|
|
437
439
|
"hasBeenFlooded": "Yes",
|
|
438
440
|
"details": "Minor basement flood",
|
|
439
441
|
"typeOfFlooding": {
|
|
440
|
-
"groundWater":
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
"
|
|
444
|
-
|
|
445
|
-
},
|
|
446
|
-
"surfaceWater": {
|
|
447
|
-
"yesNo": "No"
|
|
448
|
-
},
|
|
449
|
-
"coastal": {
|
|
450
|
-
"yesNo": "No"
|
|
451
|
-
},
|
|
452
|
-
"river": {
|
|
453
|
-
"yesNo": "No"
|
|
454
|
-
},
|
|
442
|
+
"groundWater": "No",
|
|
443
|
+
"sewer": "Yes",
|
|
444
|
+
"surfaceWater": "No",
|
|
445
|
+
"coastal": "No",
|
|
446
|
+
"river": "No",
|
|
455
447
|
"other": {
|
|
456
448
|
"yesNo": "No"
|
|
457
449
|
}
|
|
@@ -528,10 +520,15 @@
|
|
|
528
520
|
"energyAndMeters": {
|
|
529
521
|
"testedByQualifiedElectrician": {
|
|
530
522
|
"yesNo": "Yes",
|
|
531
|
-
"
|
|
523
|
+
"yearTested": 2015,
|
|
524
|
+
"attachments": "To follow"
|
|
525
|
+
},
|
|
526
|
+
"electricalWorkSince2005": {
|
|
527
|
+
"yesNo": "Yes",
|
|
528
|
+
"yearWorkCarriedOut": 2016,
|
|
529
|
+
"details": "New fuse box",
|
|
532
530
|
"attachments": "To follow"
|
|
533
531
|
},
|
|
534
|
-
"electricalWorkSince2005": { "yesNo": "No" },
|
|
535
532
|
"solarPanels": { "hasSolarPanels": "No" }
|
|
536
533
|
},
|
|
537
534
|
"smartHomeSystems": { "hasSmartHomeSystems": "No" },
|
|
@@ -555,16 +552,18 @@
|
|
|
555
552
|
"willRemoveAllRubbish": true,
|
|
556
553
|
"otherPropertyInChain": { "yesNo": "No" },
|
|
557
554
|
"moveRestrictionDates": { "yesNo": "No" },
|
|
558
|
-
"digitalPropertyLogbook": {
|
|
555
|
+
"digitalPropertyLogbook": {
|
|
556
|
+
"yesNo": "Yes",
|
|
557
|
+
"logbookProvider": "someone",
|
|
558
|
+
"willHandoverLogbook": true
|
|
559
|
+
},
|
|
560
|
+
"sufficientToRepayAllMortgages": { "yesNo": "Yes" }
|
|
559
561
|
},
|
|
560
562
|
"confirmationOfAccuracyByOwners": {
|
|
561
563
|
"confirmWillProvideAdditionalDocumentation": true,
|
|
562
564
|
"confirmInformationIsAccurate": true
|
|
563
565
|
}
|
|
564
566
|
},
|
|
565
|
-
"energyPerformanceCertificate": {
|
|
566
|
-
"certificate": { "currentEnergyRating": "B" }
|
|
567
|
-
},
|
|
568
567
|
"titlesToBeSold": [
|
|
569
568
|
{
|
|
570
569
|
"titleNumber": "HD221222",
|