@pdtf/schemas 3.6.0-36 → 3.6.0-37
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/README.md +52 -33
- package/docs/sef25-extensions-ui-spec.md +258 -49
- package/index.js +9 -0
- package/package.json +1 -1
- package/src/schemas/v3/combined.json +199 -12
- package/src/schemas/v3/compactSkeleton.txt +14 -0
- package/src/schemas/v3/overlays/extensions/as.json +4 -2
- package/src/schemas/v3/overlays/extensions/dk.json +32 -0
- package/src/schemas/v3/overlays/extensions/dr.json +4 -2
- package/src/schemas/v3/overlays/extensions/er.json +4 -2
- package/src/schemas/v3/overlays/extensions/fd.json +6 -3
- package/src/schemas/v3/overlays/extensions/hi.json +6 -3
- package/src/schemas/v3/overlays/extensions/hs.json +4 -2
- package/src/schemas/v3/overlays/extensions/ic.json +59 -0
- package/src/schemas/v3/overlays/extensions/jk.json +4 -2
- package/src/schemas/v3/overlays/extensions/la.json +4 -2
- package/src/schemas/v3/overlays/extensions/lc.json +52 -0
- package/src/schemas/v3/overlays/extensions/ma.json +6 -3
- package/src/schemas/v3/overlays/extensions/mc.json +4 -2
- package/src/schemas/v3/overlays/extensions/mi.json +55 -0
- package/src/schemas/v3/overlays/extensions/nd.json +43 -0
- package/src/schemas/v3/overlays/extensions/oa.json +4 -2
- package/src/schemas/v3/overlays/extensions/oc.json +4 -2
- package/src/schemas/v3/overlays/extensions/pc.json +2 -1
- package/src/schemas/v3/overlays/extensions/ph.json +11 -14
- package/src/schemas/v3/overlays/extensions/rw.json +68 -0
- package/src/schemas/v3/overlays/extensions/sb.json +4 -2
- package/src/schemas/v3/overlays/extensions/sd.json +63 -0
- package/src/schemas/v3/overlays/extensions/sf.json +4 -2
- package/src/schemas/v3/overlays/extensions/sl.json +4 -2
- package/src/schemas/v3/overlays/extensions/tf.json +6 -3
- package/src/schemas/v3/overlays/extensions/tr.json +73 -0
- package/src/schemas/v3/overlays/extensions/wg.json +250 -0
- package/src/schemas/v3/overlays/sef25.json +639 -0
- package/src/schemas/v3/pdtf-transaction.json +150 -0
- package/src/schemas/v3/skeleton.json +20 -1
- package/src/tests/v3/extensionOverlays.test.js +397 -0
- package/src/utils/extractExtensionOverlays.js +116 -4
|
@@ -214,10 +214,97 @@ const extensionMappings = {
|
|
|
214
214
|
description: "Property hazards and known issues",
|
|
215
215
|
refType: "sef25Ref",
|
|
216
216
|
paths: [
|
|
217
|
-
"/properties/propertyPack/properties/specialistIssues
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
"/properties/propertyPack/properties/specialistIssues",
|
|
218
|
+
],
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
// Dropped kerb access to parking
|
|
222
|
+
dk: {
|
|
223
|
+
name: "droppedKerbAccess",
|
|
224
|
+
description: "Dropped kerb access to parking",
|
|
225
|
+
refType: "sef25Ref",
|
|
226
|
+
paths: [
|
|
227
|
+
"/properties/propertyPack/properties/parking/properties/droppedKerbAccess",
|
|
228
|
+
],
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
// Private right of way
|
|
232
|
+
rw: {
|
|
233
|
+
name: "privateRightOfWay",
|
|
234
|
+
description: "Private right of way",
|
|
235
|
+
refType: "sef25Ref",
|
|
236
|
+
paths: [
|
|
237
|
+
"/properties/propertyPack/properties/rightsAndInformalArrangements/properties/rightsOrArrangements/properties/privateRightOfWay",
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
// Storm, fire or flood damage
|
|
242
|
+
sd: {
|
|
243
|
+
name: "stormFireFloodDamage",
|
|
244
|
+
description: "Storm, fire or flood damage",
|
|
245
|
+
refType: "sef25Ref",
|
|
246
|
+
paths: [
|
|
247
|
+
"/properties/propertyPack/properties/environmentalIssues/properties/stormFireFloodDamage",
|
|
248
|
+
],
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
// Solar panel lease costs
|
|
252
|
+
lc: {
|
|
253
|
+
name: "solarLeaseCosts",
|
|
254
|
+
description: "Solar panel lease costs",
|
|
255
|
+
refType: "sef25Ref",
|
|
256
|
+
paths: [
|
|
257
|
+
"/properties/propertyPack/properties/electricity/properties/solarPanels/oneOf/1/properties/panelsOwnedOutright/oneOf/1/properties/associatedCost",
|
|
258
|
+
],
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
// Warranties and guarantees upfront
|
|
262
|
+
wg: {
|
|
263
|
+
name: "warrantiesGuarantees",
|
|
264
|
+
description: "Warranties and guarantees upfront Y/N for SEF25",
|
|
265
|
+
refType: "sef25Ref",
|
|
266
|
+
paths: [
|
|
267
|
+
"/properties/propertyPack/properties/guaranteesWarrantiesAndIndemnityInsurances",
|
|
268
|
+
],
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
// Insurance claims upfront
|
|
272
|
+
ic: {
|
|
273
|
+
name: "insuranceClaims",
|
|
274
|
+
description: "Insurance claims upfront for SEF25",
|
|
275
|
+
refType: "sef25Ref",
|
|
276
|
+
paths: [
|
|
277
|
+
"/properties/propertyPack/properties/insurance/oneOf/1/properties/insuranceClaims",
|
|
278
|
+
],
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
// Neighbour development upfront
|
|
282
|
+
nd: {
|
|
283
|
+
name: "neighbourDevelopment",
|
|
284
|
+
description: "Neighbour development upfront for SEF25",
|
|
285
|
+
refType: "sef25Ref",
|
|
286
|
+
paths: [
|
|
287
|
+
"/properties/propertyPack/properties/notices/properties/neighbourDevelopment",
|
|
288
|
+
],
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
// Other material issue upfront
|
|
292
|
+
mi: {
|
|
293
|
+
name: "otherMaterialIssue",
|
|
294
|
+
description: "Other material issue upfront for SEF25",
|
|
295
|
+
refType: "sef25Ref",
|
|
296
|
+
paths: [
|
|
297
|
+
"/properties/propertyPack/properties/additionalInformation/properties/otherMaterialIssue",
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
// Title restrictions for freehold
|
|
302
|
+
tr: {
|
|
303
|
+
name: "titleRestrictions",
|
|
304
|
+
description: "Title restrictions for freehold properties",
|
|
305
|
+
refType: "sef25Ref",
|
|
306
|
+
paths: [
|
|
307
|
+
"/properties/propertyPack/properties/ownership/properties/ownershipsToBeTransferred/items/oneOf/0/properties/titleRestrictions",
|
|
221
308
|
],
|
|
222
309
|
},
|
|
223
310
|
};
|
|
@@ -405,6 +492,28 @@ function addRequiredArrays(overlay, schema, refConfig) {
|
|
|
405
492
|
return overlay;
|
|
406
493
|
}
|
|
407
494
|
|
|
495
|
+
// Annotate intermediate nodes with refs from the source schema
|
|
496
|
+
// This ensures every level of the overlay tree carries an ntsRef
|
|
497
|
+
function addIntermediateRefs(overlay, schema, refConfig) {
|
|
498
|
+
traverse(overlay).forEach(function (node) {
|
|
499
|
+
if (node && typeof node === "object" && !Array.isArray(node) && node.properties) {
|
|
500
|
+
// Skip if this node already has a ref
|
|
501
|
+
if (node[refConfig.outputRef]) return;
|
|
502
|
+
|
|
503
|
+
const schemaPath = "/" + this.path.join("/");
|
|
504
|
+
try {
|
|
505
|
+
const schemaNode = jp.get(schema, schemaPath);
|
|
506
|
+
if (schemaNode && schemaNode[refConfig.ref]) {
|
|
507
|
+
node[refConfig.outputRef] = schemaNode[refConfig.ref];
|
|
508
|
+
}
|
|
509
|
+
} catch (err) {
|
|
510
|
+
// Path doesn't exist in schema, skip
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
return overlay;
|
|
515
|
+
}
|
|
516
|
+
|
|
408
517
|
// Generate extension overlays
|
|
409
518
|
Object.entries(extensionMappings).forEach(([code, config]) => {
|
|
410
519
|
const refType = config.refType || "nts2Ref";
|
|
@@ -418,6 +527,9 @@ Object.entries(extensionMappings).forEach(([code, config]) => {
|
|
|
418
527
|
// Add required arrays where needed
|
|
419
528
|
overlay = addRequiredArrays(overlay, combinedSchema, refConfig);
|
|
420
529
|
|
|
530
|
+
// Add refs to intermediate nodes in the path hierarchy
|
|
531
|
+
overlay = addIntermediateRefs(overlay, combinedSchema, refConfig);
|
|
532
|
+
|
|
421
533
|
// Add schema metadata
|
|
422
534
|
overlay.$schema = "http://json-schema.org/draft-07/schema#";
|
|
423
535
|
overlay.$id = `https://trust.propdata.org.uk/schemas/v3/overlays/extensions/${code}.json`;
|