@pdtf/schemas 3.6.0-30 → 3.6.0-32
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/docs/sef25-extensions-ui-spec.md +274 -5
- package/index.js +9 -0
- package/package.json +1 -1
- package/src/schemas/v3/combined.json +419 -69
- package/src/schemas/v3/compactSkeleton.txt +24 -5
- 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 +56 -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 +86 -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 +52 -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/rw.json +68 -0
- package/src/schemas/v3/overlays/extensions/sb.json +4 -2
- package/src/schemas/v3/overlays/extensions/sc.json +82 -14
- 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 +209 -0
- package/src/schemas/v3/overlays/ta6ed6.json +37 -18
- package/src/schemas/v3/pdtf-transaction.json +477 -51
- package/src/schemas/v3/skeleton.json +33 -10
- package/src/tests/v3/extensionOverlays.test.js +410 -4
- package/src/tests/v3/ta6ed6.test.js +1 -48
- package/src/utils/extractExtensionOverlays.js +121 -0
|
@@ -220,6 +220,102 @@ const extensionMappings = {
|
|
|
220
220
|
"/properties/propertyPack/properties/specialistIssues/properties/knownAreasInPoorCondition",
|
|
221
221
|
],
|
|
222
222
|
},
|
|
223
|
+
|
|
224
|
+
// Dropped kerb access to parking
|
|
225
|
+
dk: {
|
|
226
|
+
name: "droppedKerbAccess",
|
|
227
|
+
description: "Dropped kerb access to parking",
|
|
228
|
+
refType: "sef25Ref",
|
|
229
|
+
paths: [
|
|
230
|
+
"/properties/propertyPack/properties/parking/properties/droppedKerbAccess",
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
// Private right of way
|
|
235
|
+
rw: {
|
|
236
|
+
name: "privateRightOfWay",
|
|
237
|
+
description: "Private right of way",
|
|
238
|
+
refType: "sef25Ref",
|
|
239
|
+
paths: [
|
|
240
|
+
"/properties/propertyPack/properties/rightsAndInformalArrangements/properties/rightsOrArrangements/properties/privateRightOfWay",
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
// Storm, fire or flood damage
|
|
245
|
+
sd: {
|
|
246
|
+
name: "stormFireFloodDamage",
|
|
247
|
+
description: "Storm, fire or flood damage",
|
|
248
|
+
refType: "sef25Ref",
|
|
249
|
+
paths: [
|
|
250
|
+
"/properties/propertyPack/properties/environmentalIssues/properties/stormFireFloodDamage",
|
|
251
|
+
],
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
// Solar panel lease costs
|
|
255
|
+
lc: {
|
|
256
|
+
name: "solarLeaseCosts",
|
|
257
|
+
description: "Solar panel lease costs",
|
|
258
|
+
refType: "sef25Ref",
|
|
259
|
+
paths: [
|
|
260
|
+
"/properties/propertyPack/properties/electricity/properties/solarPanels/oneOf/1/properties/panelsOwnedOutright/oneOf/1/properties/associatedCost",
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
// Warranties and guarantees upfront
|
|
265
|
+
wg: {
|
|
266
|
+
name: "warrantiesGuarantees",
|
|
267
|
+
description: "Warranties and guarantees upfront Y/N for SEF25",
|
|
268
|
+
refType: "sef25Ref",
|
|
269
|
+
paths: [
|
|
270
|
+
"/properties/propertyPack/properties/guaranteesWarrantiesAndIndemnityInsurances/oneOf/1/properties/newHomeWarranty",
|
|
271
|
+
"/properties/propertyPack/properties/guaranteesWarrantiesAndIndemnityInsurances/oneOf/1/properties/roofingWork",
|
|
272
|
+
"/properties/propertyPack/properties/guaranteesWarrantiesAndIndemnityInsurances/oneOf/1/properties/dampProofingTreatment",
|
|
273
|
+
"/properties/propertyPack/properties/guaranteesWarrantiesAndIndemnityInsurances/oneOf/1/properties/centralHeatingAndorPlumbing",
|
|
274
|
+
"/properties/propertyPack/properties/guaranteesWarrantiesAndIndemnityInsurances/oneOf/1/properties/electricalRepairOrInstallation",
|
|
275
|
+
"/properties/propertyPack/properties/guaranteesWarrantiesAndIndemnityInsurances/oneOf/1/properties/subsidenceWork",
|
|
276
|
+
"/properties/propertyPack/properties/guaranteesWarrantiesAndIndemnityInsurances/oneOf/1/properties/otherGuarantees",
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
// Insurance claims upfront
|
|
281
|
+
ic: {
|
|
282
|
+
name: "insuranceClaims",
|
|
283
|
+
description: "Insurance claims upfront for SEF25",
|
|
284
|
+
refType: "sef25Ref",
|
|
285
|
+
paths: [
|
|
286
|
+
"/properties/propertyPack/properties/insurance/oneOf/1/properties/insuranceClaims",
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
// Neighbour development upfront
|
|
291
|
+
nd: {
|
|
292
|
+
name: "neighbourDevelopment",
|
|
293
|
+
description: "Neighbour development upfront for SEF25",
|
|
294
|
+
refType: "sef25Ref",
|
|
295
|
+
paths: [
|
|
296
|
+
"/properties/propertyPack/properties/notices/properties/neighbourDevelopment",
|
|
297
|
+
],
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
// Other material issue upfront
|
|
301
|
+
mi: {
|
|
302
|
+
name: "otherMaterialIssue",
|
|
303
|
+
description: "Other material issue upfront for SEF25",
|
|
304
|
+
refType: "sef25Ref",
|
|
305
|
+
paths: [
|
|
306
|
+
"/properties/propertyPack/properties/additionalInformation/properties/otherMaterialIssue",
|
|
307
|
+
],
|
|
308
|
+
},
|
|
309
|
+
|
|
310
|
+
// Title restrictions for freehold
|
|
311
|
+
tr: {
|
|
312
|
+
name: "titleRestrictions",
|
|
313
|
+
description: "Title restrictions for freehold properties",
|
|
314
|
+
refType: "sef25Ref",
|
|
315
|
+
paths: [
|
|
316
|
+
"/properties/propertyPack/properties/ownership/properties/ownershipsToBeTransferred/items/oneOf/0/properties/titleRestrictions",
|
|
317
|
+
],
|
|
318
|
+
},
|
|
223
319
|
};
|
|
224
320
|
|
|
225
321
|
// Function to extract properties at specific paths with given ref type
|
|
@@ -405,6 +501,28 @@ function addRequiredArrays(overlay, schema, refConfig) {
|
|
|
405
501
|
return overlay;
|
|
406
502
|
}
|
|
407
503
|
|
|
504
|
+
// Annotate intermediate nodes with refs from the source schema
|
|
505
|
+
// This ensures every level of the overlay tree carries an ntsRef
|
|
506
|
+
function addIntermediateRefs(overlay, schema, refConfig) {
|
|
507
|
+
traverse(overlay).forEach(function (node) {
|
|
508
|
+
if (node && typeof node === "object" && !Array.isArray(node) && node.properties) {
|
|
509
|
+
// Skip if this node already has a ref
|
|
510
|
+
if (node[refConfig.outputRef]) return;
|
|
511
|
+
|
|
512
|
+
const schemaPath = "/" + this.path.join("/");
|
|
513
|
+
try {
|
|
514
|
+
const schemaNode = jp.get(schema, schemaPath);
|
|
515
|
+
if (schemaNode && schemaNode[refConfig.ref]) {
|
|
516
|
+
node[refConfig.outputRef] = schemaNode[refConfig.ref];
|
|
517
|
+
}
|
|
518
|
+
} catch (err) {
|
|
519
|
+
// Path doesn't exist in schema, skip
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
return overlay;
|
|
524
|
+
}
|
|
525
|
+
|
|
408
526
|
// Generate extension overlays
|
|
409
527
|
Object.entries(extensionMappings).forEach(([code, config]) => {
|
|
410
528
|
const refType = config.refType || "nts2Ref";
|
|
@@ -418,6 +536,9 @@ Object.entries(extensionMappings).forEach(([code, config]) => {
|
|
|
418
536
|
// Add required arrays where needed
|
|
419
537
|
overlay = addRequiredArrays(overlay, combinedSchema, refConfig);
|
|
420
538
|
|
|
539
|
+
// Add refs to intermediate nodes in the path hierarchy
|
|
540
|
+
overlay = addIntermediateRefs(overlay, combinedSchema, refConfig);
|
|
541
|
+
|
|
421
542
|
// Add schema metadata
|
|
422
543
|
overlay.$schema = "http://json-schema.org/draft-07/schema#";
|
|
423
544
|
overlay.$id = `https://trust.propdata.org.uk/schemas/v3/overlays/extensions/${code}.json`;
|