@pdtf/schemas 3.0.0-2 → 3.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 +15 -13
- package/package.json +1 -1
- package/src/examples/v3/exampleTransaction.json +82 -75
- package/src/schemas/v2/overlays/baspi.json +510 -2331
- package/src/schemas/v2/overlays/con29DW.json +36 -125
- package/src/schemas/v2/overlays/con29R.json +5 -143
- package/src/schemas/v2/overlays/fme1.json +48 -233
- package/src/schemas/v2/overlays/lpe1.json +75 -367
- package/src/schemas/v2/overlays/nts.json +17 -103
- package/src/schemas/v2/overlays/piq.json +146 -693
- package/src/schemas/v2/overlays/rds.json +50 -316
- package/src/schemas/v2/overlays/ta10.json +540 -1755
- package/src/schemas/v2/overlays/ta6.json +241 -1193
- package/src/schemas/v2/overlays/ta7.json +106 -440
- package/src/schemas/v3/combined.json +2434 -2581
- package/src/schemas/v3/overlays/baspi.json +1360 -3480
- package/src/schemas/v3/overlays/con29DW.json +36 -125
- package/src/schemas/v3/overlays/con29R.json +5 -143
- package/src/schemas/v3/overlays/fme1.json +53 -233
- package/src/schemas/v3/overlays/lpe1.json +85 -367
- package/src/schemas/v3/overlays/nts.json +711 -634
- package/src/schemas/v3/overlays/piq.json +452 -1190
- package/src/schemas/v3/overlays/rds.json +500 -1059
- package/src/schemas/v3/overlays/ta10.json +540 -1755
- package/src/schemas/v3/overlays/ta6.json +787 -1678
- package/src/schemas/v3/overlays/ta7.json +220 -462
- package/src/schemas/v3/pdtf-transaction.json +1976 -2286
- package/src/schemas/v3/skeleton.json +248 -214
- package/src/tests/v3/transactionSchema.test.js +28 -18
- package/src/tests/v3/verifiedClaimsValidator.test.js +2 -2
- package/src/utils/extractOverlay.js +5 -27
- package/src/tests/v2/transactionSchema.test.js +0 -361
- package/src/tests/v2/verifiedClaimsValidator.test.js +0 -128
package/index.js
CHANGED
|
@@ -71,16 +71,23 @@ const combineMerge = (target, source, options) => {
|
|
|
71
71
|
return destination;
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
+
const mergeEnums = (target, source) => source;
|
|
75
|
+
|
|
74
76
|
const getTransactionSchema = (
|
|
75
77
|
schemaId = "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
|
|
76
|
-
overlays = ["baspiV4"]
|
|
78
|
+
overlays // = ["baspiV4"]
|
|
77
79
|
) => {
|
|
78
80
|
const sourceSchema = transactionSchemas[schemaId];
|
|
79
81
|
if (!overlays || overlays.length < 1) return sourceSchema;
|
|
80
82
|
let mergedSchema = sourceSchema;
|
|
81
83
|
overlays.forEach((overlay) => {
|
|
82
84
|
const overlaySchema = overlaysMap[schemaId][overlay] || {};
|
|
83
|
-
mergedSchema = merge(
|
|
85
|
+
mergedSchema = merge(mergedSchema, overlaySchema, {
|
|
86
|
+
customMerge: (key) => {
|
|
87
|
+
if (key === "enum") {
|
|
88
|
+
return mergeEnums;
|
|
89
|
+
}
|
|
90
|
+
},
|
|
84
91
|
arrayMerge: combineMerge,
|
|
85
92
|
});
|
|
86
93
|
});
|
|
@@ -88,13 +95,7 @@ const getTransactionSchema = (
|
|
|
88
95
|
};
|
|
89
96
|
|
|
90
97
|
const getValidator = (schemaId, overlays) => {
|
|
91
|
-
|
|
92
|
-
if (!validator) {
|
|
93
|
-
const schema = getTransactionSchema(schemaId, overlays);
|
|
94
|
-
ajv.addSchema(schema, schemaId);
|
|
95
|
-
validator = ajv.getSchema(schemaId);
|
|
96
|
-
}
|
|
97
|
-
return validator;
|
|
98
|
+
return getSubschemaValidator("", schemaId, overlays);
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
// common functions for v1 and v2
|
|
@@ -129,7 +130,7 @@ const isPathValid = (path, schemaId, overlays) => {
|
|
|
129
130
|
}
|
|
130
131
|
};
|
|
131
132
|
|
|
132
|
-
const getSubschemaValidator = (path, schemaId, overlays
|
|
133
|
+
const getSubschemaValidator = (path, schemaId, overlays) => {
|
|
133
134
|
const subSchema = getSubschema(path, schemaId, overlays);
|
|
134
135
|
const overlayKey = (overlays || []).join(".");
|
|
135
136
|
// see if we can retrieve the schema by path, schemaId and overlays
|
|
@@ -162,6 +163,7 @@ const getTitleAtPath = (schema, path, rootPath = path) => {
|
|
|
162
163
|
}
|
|
163
164
|
const propertyName = pathArray.shift();
|
|
164
165
|
const subPath = "/" + pathArray.join("/");
|
|
166
|
+
|
|
165
167
|
let subSchema = schema.properties
|
|
166
168
|
? schema.properties[propertyName]
|
|
167
169
|
: undefined;
|
|
@@ -172,10 +174,9 @@ const getTitleAtPath = (schema, path, rootPath = path) => {
|
|
|
172
174
|
subSchema = schema.items;
|
|
173
175
|
return getTitleAtPath(subSchema, subPath, rootPath);
|
|
174
176
|
}
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
+
const oneOfs = schema.oneOf;
|
|
178
|
+
if (oneOfs) {
|
|
177
179
|
// only single dependency discriminator, oneOf keyword is supported
|
|
178
|
-
const oneOfs = schema.oneOf;
|
|
179
180
|
const matchingOneOf = oneOfs.find(
|
|
180
181
|
(oneOf) => oneOf["properties"][propertyName]
|
|
181
182
|
);
|
|
@@ -235,4 +236,5 @@ module.exports = {
|
|
|
235
236
|
getTitleAtPath,
|
|
236
237
|
verifiedClaimsSchema,
|
|
237
238
|
validateVerifiedClaims,
|
|
239
|
+
overlaysMap,
|
|
238
240
|
};
|
package/package.json
CHANGED
|
@@ -39,6 +39,13 @@
|
|
|
39
39
|
"town": "HARPENDEN",
|
|
40
40
|
"postcode": "AL3 5AF"
|
|
41
41
|
},
|
|
42
|
+
"localAuthority": { "localAuthorityName": "Neverland Hook" },
|
|
43
|
+
"buildInformation": {
|
|
44
|
+
"building": { "propertyType": "House", "builtForm": "Detached" },
|
|
45
|
+
"roomDimensions": {
|
|
46
|
+
"hasFloorplan": "Yes"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
42
49
|
"delayFactors": {
|
|
43
50
|
"hasDelayFactors": { "yesNo": "No" }
|
|
44
51
|
},
|
|
@@ -112,7 +119,7 @@
|
|
|
112
119
|
},
|
|
113
120
|
"parking": {
|
|
114
121
|
"parkingArrangements": ["Garage", "Driveway"],
|
|
115
|
-
|
|
122
|
+
"disabledParking": { "yesNo": "No" },
|
|
116
123
|
"electricVehicleChargingPoint": { "yesNo": "No" },
|
|
117
124
|
"controlledParking": { "yesNo": "No" }
|
|
118
125
|
},
|
|
@@ -296,12 +303,56 @@
|
|
|
296
303
|
"yesNo": "No"
|
|
297
304
|
}
|
|
298
305
|
},
|
|
306
|
+
"electricity": {
|
|
307
|
+
"mainsElectricity": {
|
|
308
|
+
"yesNo": "Yes",
|
|
309
|
+
"supplier": "Octopus Energy",
|
|
310
|
+
"electricityMeter": {
|
|
311
|
+
"location": "Under the stairs"
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
"solarPanels": {
|
|
315
|
+
"yesNo": "No"
|
|
316
|
+
},
|
|
317
|
+
"otherSources": {
|
|
318
|
+
"yesNo": "No"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"heating": {
|
|
322
|
+
"heatingSystem": {
|
|
323
|
+
"heatingType": "Central heating",
|
|
324
|
+
"centralHeatingDetails": {
|
|
325
|
+
"boilerInstallationCertificate": {
|
|
326
|
+
"yesNo": "Yes",
|
|
327
|
+
"details": "Certified installation",
|
|
328
|
+
"attachments": "To follow"
|
|
329
|
+
},
|
|
330
|
+
"heatingInGoodWorkingOrder": {
|
|
331
|
+
"yesNo": "Yes"
|
|
332
|
+
},
|
|
333
|
+
"centralHeatingFuel": {
|
|
334
|
+
"centralHeatingFuelType": "Other",
|
|
335
|
+
"otherCentralHeatingFuelType": "Ground-source Heat Pump"
|
|
336
|
+
},
|
|
337
|
+
"centralHeatingInstalled": "2016-04-20",
|
|
338
|
+
"heatingLastServicedDate": "2021-03-26",
|
|
339
|
+
"heatingLastServicedReport": "To follow"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"otherHeatingFeatures": ["Underfloor heating"]
|
|
343
|
+
},
|
|
299
344
|
"waterAndDrainage": {
|
|
300
345
|
"water": {
|
|
301
346
|
"mainsWater": {
|
|
302
|
-
"yesNo": "
|
|
303
|
-
"
|
|
304
|
-
|
|
347
|
+
"yesNo": "Yes",
|
|
348
|
+
"waterMeter": {
|
|
349
|
+
"isSupplyMetered": "Yes",
|
|
350
|
+
"location": "At the front"
|
|
351
|
+
},
|
|
352
|
+
"supplier": "Northumbria Water",
|
|
353
|
+
"stopcock": {
|
|
354
|
+
"location": "Under the sink"
|
|
355
|
+
}
|
|
305
356
|
}
|
|
306
357
|
},
|
|
307
358
|
"drainage": {
|
|
@@ -310,22 +361,17 @@
|
|
|
310
361
|
},
|
|
311
362
|
"mainsFoulDrainage": {
|
|
312
363
|
"yesNo": "No",
|
|
313
|
-
"
|
|
314
|
-
|
|
315
|
-
"yesNo": "Yes",
|
|
316
|
-
"details": "Last emptied on 1 Jan 2022",
|
|
364
|
+
"offMainsDrainageSystem": {
|
|
365
|
+
"offMainsDrainageSystemType": "Septic tank",
|
|
317
366
|
"dateReplaced": "2022-01-01",
|
|
318
|
-
"dateLastEmptied": "2022-01-01"
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
"plantDrainsIntoWaterway": {
|
|
327
|
-
"yesNo": "Yes",
|
|
328
|
-
"dischargeCompliesWithGBR": "Yes"
|
|
367
|
+
"dateLastEmptied": "2022-01-01",
|
|
368
|
+
"plantOnOtherLand": { "yesNo": "No" },
|
|
369
|
+
"otherConnectedProperties": { "yesNo": "No" },
|
|
370
|
+
"plantRegistered": { "yesNo": "No" },
|
|
371
|
+
"plantDrainsIntoWaterway": {
|
|
372
|
+
"yesNo": "Yes",
|
|
373
|
+
"dischargeCompliesWithGBR": "Yes"
|
|
374
|
+
}
|
|
329
375
|
}
|
|
330
376
|
}
|
|
331
377
|
},
|
|
@@ -333,21 +379,7 @@
|
|
|
333
379
|
"yesNo": "No"
|
|
334
380
|
}
|
|
335
381
|
},
|
|
336
|
-
"
|
|
337
|
-
"mainsElectricity": {
|
|
338
|
-
"yesNo": "Yes",
|
|
339
|
-
"supplier": "Octopus Energy"
|
|
340
|
-
},
|
|
341
|
-
"mainsGas": {
|
|
342
|
-
"yesNo": "Yes",
|
|
343
|
-
"supplier": "Octopus Energy"
|
|
344
|
-
},
|
|
345
|
-
"lpg": {
|
|
346
|
-
"yesNo": "No"
|
|
347
|
-
},
|
|
348
|
-
"oil": {
|
|
349
|
-
"yesNo": "No"
|
|
350
|
-
},
|
|
382
|
+
"connectivity": {
|
|
351
383
|
"telephone": {
|
|
352
384
|
"yesNo": "Yes",
|
|
353
385
|
"supplier": "EE"
|
|
@@ -357,39 +389,13 @@
|
|
|
357
389
|
"supplier": "Sky"
|
|
358
390
|
},
|
|
359
391
|
"broadband": {
|
|
360
|
-
"yesNo": "Yes",
|
|
361
392
|
"supplier": "BT",
|
|
362
393
|
"typeOfConnection": "FTTC (Fibre to the Cabinet)"
|
|
363
394
|
},
|
|
364
|
-
"
|
|
365
|
-
"
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
"yesNo": "No"
|
|
369
|
-
},
|
|
370
|
-
"maintenanceAgreements": {
|
|
371
|
-
"yesNo": "No"
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
"heating": {
|
|
375
|
-
"heatingType": "Central heating",
|
|
376
|
-
"otherHeatingFeatures": ["Underfloor Heating"],
|
|
377
|
-
"centralHeatingDetails": {
|
|
378
|
-
"boilerInstallationCertificate": {
|
|
379
|
-
"yesNo": "Yes",
|
|
380
|
-
"details": "Certified installation",
|
|
381
|
-
"attachments": "To follow"
|
|
382
|
-
},
|
|
383
|
-
"heatingInGoodWorkingOrder": {
|
|
384
|
-
"yesNo": "Yes"
|
|
385
|
-
},
|
|
386
|
-
"centralHeatingFuel": {
|
|
387
|
-
"centralHeatingFuelType": "Other",
|
|
388
|
-
"otherCentralHeatingFuelType": "Ground-source Heat Pump"
|
|
389
|
-
},
|
|
390
|
-
"centralHeatingInstalled": "2016-04-20",
|
|
391
|
-
"heatingLastServicedDate": "2021-03-26",
|
|
392
|
-
"heatingLastServicedReport": "To follow"
|
|
395
|
+
"mobilePhone": {
|
|
396
|
+
"knownSignalIssues": {
|
|
397
|
+
"yesNo": "No"
|
|
398
|
+
}
|
|
393
399
|
}
|
|
394
400
|
},
|
|
395
401
|
"insurance": {
|
|
@@ -462,28 +468,30 @@
|
|
|
462
468
|
"environmentalIssues": {
|
|
463
469
|
"flooding": {
|
|
464
470
|
"floodRisk": {
|
|
465
|
-
"
|
|
471
|
+
"riskIndicator": "Yes",
|
|
466
472
|
"summary": "Likely to flood from surface water"
|
|
467
473
|
},
|
|
468
|
-
"
|
|
469
|
-
|
|
470
|
-
|
|
474
|
+
"historicalFlooding": {
|
|
475
|
+
"hasBeenFlooded": "Yes",
|
|
476
|
+
"details": "Minor basement flood",
|
|
477
|
+
"typeOfFlooding": ["Surface water"]
|
|
478
|
+
}
|
|
471
479
|
},
|
|
472
480
|
"radon": {
|
|
473
481
|
"radonTest": { "yesNo": "No" },
|
|
474
482
|
"remedialMeasuresOnConstruction": { "yesNo": "No" }
|
|
475
483
|
},
|
|
476
484
|
"coalMining": {
|
|
477
|
-
"
|
|
485
|
+
"riskIndicator": "No"
|
|
478
486
|
},
|
|
479
487
|
"nonCoalMining": {
|
|
480
|
-
"
|
|
488
|
+
"riskIndicator": "No"
|
|
481
489
|
},
|
|
482
490
|
"coastalErosion": {
|
|
483
|
-
"
|
|
491
|
+
"riskIndicator": "No"
|
|
484
492
|
},
|
|
485
493
|
"otherEnvironmental": {
|
|
486
|
-
"
|
|
494
|
+
"riskIndicator": "No"
|
|
487
495
|
}
|
|
488
496
|
},
|
|
489
497
|
"otherIssues": {
|
|
@@ -554,7 +562,7 @@
|
|
|
554
562
|
"pipesWiresCablesDrainsFromProperty": { "yesNo": "No" },
|
|
555
563
|
"formalOrInformalAgreements": { "yesNo": "No" }
|
|
556
564
|
},
|
|
557
|
-
"
|
|
565
|
+
"electricalWorks": {
|
|
558
566
|
"testedByQualifiedElectrician": {
|
|
559
567
|
"yesNo": "Yes",
|
|
560
568
|
"yearTested": 2015,
|
|
@@ -565,8 +573,7 @@
|
|
|
565
573
|
"yearWorkCarriedOut": 2016,
|
|
566
574
|
"details": "New fuse box",
|
|
567
575
|
"attachments": "To follow"
|
|
568
|
-
}
|
|
569
|
-
"solarPanels": { "hasSolarPanels": "No" }
|
|
576
|
+
}
|
|
570
577
|
},
|
|
571
578
|
"smartHomeSystems": { "hasSmartHomeSystems": "No" },
|
|
572
579
|
"guaranteesWarrantiesAndIndemnityInsurances": {
|