@pdtf/schemas 3.6.0-20 → 3.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdtf/schemas",
3
- "version": "3.6.0-20",
3
+ "version": "3.6.0-21",
4
4
  "description": "Property Data Trust Framework Schemas and Utilities",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -9,7 +9,8 @@
9
9
  "scripts": {
10
10
  "test": "jest",
11
11
  "test:watch": "jest --watch",
12
- "extract-overlays": "cd src/utils && node extractOverlay.js"
12
+ "extract-overlays": "cd src/utils && node extractOverlay.js",
13
+ "extract-extension-overlays": "cd src/utils && node extractExtensionOverlays.js"
13
14
  },
14
15
  "repository": {
15
16
  "type": "git",
@@ -10360,19 +10360,24 @@
10360
10360
  "yesNo": {
10361
10361
  "enum": ["Yes"]
10362
10362
  },
10363
- "annualCostOfPermit": {
10363
+ "costOfPermit": {
10364
10364
  "baspi5Ref": "A1.6.0.2.2",
10365
+ "sef25Ref": "P1.1",
10365
10366
  "title": "Cost of permit (£)",
10366
10367
  "type": "number"
10367
10368
  },
10368
10369
  "costOfPermitFrequency": {
10369
- "sef25Ref": "P1.1",
10370
+ "sef25Ref": "P1.2",
10370
10371
  "title": "Payment frequency",
10371
10372
  "type": "string",
10372
10373
  "enum": ["Per month", "Per year"]
10373
10374
  }
10374
10375
  },
10375
- "baspi5Required": ["annualCostOfPermit"]
10376
+ "baspi5Required": ["costOfPermit"],
10377
+ "sef25Required": [
10378
+ "costOfPermit",
10379
+ "costOfPermitFrequency"
10380
+ ]
10376
10381
  }
10377
10382
  ]
10378
10383
  },
@@ -15613,6 +15618,12 @@
15613
15618
  "subsidenceOrStructuralFault",
15614
15619
  "ongoingHealthOrSafetyIssue"
15615
15620
  ],
15621
+ "sef25Required": [
15622
+ "wellsDitchesShaft",
15623
+ "damagedOrExposedElectrics",
15624
+ "damageToFlooringOrStaircases",
15625
+ "knownAreasInPoorCondition"
15626
+ ],
15616
15627
  "properties": {
15617
15628
  "dryRotEtcTreatment": {
15618
15629
  "baspi4Ref": "A5.1",
@@ -22312,18 +22323,18 @@
22312
22323
  },
22313
22324
  "associatedCost": {
22314
22325
  "sef25Ref": "U1.1",
22315
- "title": "Associated costs for water",
22326
+ "title": "Please provide the associated costs for water supply",
22316
22327
  "type": "object",
22317
22328
  "sef25Required": ["amount", "frequency"],
22318
22329
  "properties": {
22319
22330
  "amount": {
22320
22331
  "sef25Ref": "U1.1.1",
22321
- "title": "Cost (£)",
22332
+ "title": "Associated costs of supply if any (£)",
22322
22333
  "type": "number"
22323
22334
  },
22324
22335
  "frequency": {
22325
22336
  "sef25Ref": "U1.1.2",
22326
- "title": "Payment frequency",
22337
+ "title": "Payment frequency if costs are associated",
22327
22338
  "type": "string",
22328
22339
  "enum": ["Per month", "Per year"]
22329
22340
  }
@@ -22333,7 +22344,8 @@
22333
22344
  "ntsRequired": ["details"],
22334
22345
  "nts2Required": ["details"],
22335
22346
  "ntslRequired": ["details"],
22336
- "ntsl2Required": ["details"]
22347
+ "ntsl2Required": ["details"],
22348
+ "sef25Required": ["associatedCost"]
22337
22349
  },
22338
22350
  {
22339
22351
  "properties": {
@@ -23350,12 +23362,12 @@
23350
23362
  "properties": {
23351
23363
  "amount": {
23352
23364
  "sef25Ref": "U1.2.1",
23353
- "title": "Cost (£)",
23365
+ "title": "Associated costs for sewerage if any (£)",
23354
23366
  "type": "number"
23355
23367
  },
23356
23368
  "frequency": {
23357
23369
  "sef25Ref": "U1.2.2",
23358
- "title": "Payment frequency",
23370
+ "title": "Payment frequency if costs are associated",
23359
23371
  "type": "string",
23360
23372
  "enum": ["Per month", "Per year"]
23361
23373
  }
@@ -23365,7 +23377,8 @@
23365
23377
  "ntsRequired": ["offMainsDrainageSystem"],
23366
23378
  "nts2Required": ["offMainsDrainageSystem"],
23367
23379
  "ntslRequired": ["offMainsDrainageSystem"],
23368
- "ntsl2Required": ["offMainsDrainageSystem"]
23380
+ "ntsl2Required": ["offMainsDrainageSystem"],
23381
+ "sef25Required": ["associatedCost"]
23369
23382
  }
23370
23383
  ]
23371
23384
  },
@@ -950,7 +950,7 @@
950
950
  yesNo
951
951
  controlledParking
952
952
  yesNo
953
- annualCostOfPermit
953
+ costOfPermit
954
954
  costOfPermitFrequency
955
955
  vehicleTypeRestriction
956
956
  yesNo
@@ -1261,12 +1261,12 @@
1261
1261
  "Yes"
1262
1262
  ]
1263
1263
  },
1264
- "annualCostOfPermit": {
1264
+ "costOfPermit": {
1265
1265
  "baspi5Ref": "A1.6.0.2.2"
1266
1266
  }
1267
1267
  },
1268
1268
  "required": [
1269
- "annualCostOfPermit"
1269
+ "costOfPermit"
1270
1270
  ]
1271
1271
  }
1272
1272
  ],
@@ -9,11 +9,19 @@
9
9
  null,
10
10
  {
11
11
  "properties": {
12
- "costOfPermitFrequency": {
12
+ "costOfPermit": {
13
13
  "ntsRef": "P1.1",
14
+ "type": "number"
15
+ },
16
+ "costOfPermitFrequency": {
17
+ "ntsRef": "P1.2",
14
18
  "type": "string"
15
19
  }
16
- }
20
+ },
21
+ "required": [
22
+ "costOfPermit",
23
+ "costOfPermitFrequency"
24
+ ]
17
25
  }
18
26
  ]
19
27
  }
@@ -180,7 +180,13 @@
180
180
  ],
181
181
  "type": "object"
182
182
  }
183
- }
183
+ },
184
+ "required": [
185
+ "wellsDitchesShaft",
186
+ "damagedOrExposedElectrics",
187
+ "damageToFlooringOrStaircases",
188
+ "knownAreasInPoorCondition"
189
+ ]
184
190
  }
185
191
  }
186
192
  }
@@ -28,7 +28,10 @@
28
28
  },
29
29
  "type": "object"
30
30
  }
31
- }
31
+ },
32
+ "required": [
33
+ "associatedCost"
34
+ ]
32
35
  }
33
36
  ]
34
37
  }
@@ -60,7 +63,10 @@
60
63
  },
61
64
  "type": "object"
62
65
  }
63
- }
66
+ },
67
+ "required": [
68
+ "associatedCost"
69
+ ]
64
70
  }
65
71
  ]
66
72
  }
@@ -8370,12 +8370,13 @@
8370
8370
  "Yes"
8371
8371
  ]
8372
8372
  },
8373
- "annualCostOfPermit": {
8373
+ "costOfPermit": {
8374
+ "sef25Ref": "P1.1",
8374
8375
  "title": "Cost of permit (£)",
8375
8376
  "type": "number"
8376
8377
  },
8377
8378
  "costOfPermitFrequency": {
8378
- "sef25Ref": "P1.1",
8379
+ "sef25Ref": "P1.2",
8379
8380
  "title": "Payment frequency",
8380
8381
  "type": "string",
8381
8382
  "enum": [
@@ -8383,7 +8384,11 @@
8383
8384
  "Per year"
8384
8385
  ]
8385
8386
  }
8386
- }
8387
+ },
8388
+ "sef25Required": [
8389
+ "costOfPermit",
8390
+ "costOfPermitFrequency"
8391
+ ]
8387
8392
  }
8388
8393
  ]
8389
8394
  },
@@ -12429,6 +12434,12 @@
12429
12434
  "specialistIssues": {
12430
12435
  "title": "Specialist Issues",
12431
12436
  "type": "object",
12437
+ "sef25Required": [
12438
+ "wellsDitchesShaft",
12439
+ "damagedOrExposedElectrics",
12440
+ "damageToFlooringOrStaircases",
12441
+ "knownAreasInPoorCondition"
12442
+ ],
12432
12443
  "properties": {
12433
12444
  "dryRotEtcTreatment": {
12434
12445
  "title": "To your knowledge, has there been any preventative work for, or treatment of dry rot, wet rot or damp carried out at the property?",
@@ -18588,7 +18599,7 @@
18588
18599
  },
18589
18600
  "associatedCost": {
18590
18601
  "sef25Ref": "U1.1",
18591
- "title": "Associated costs for water",
18602
+ "title": "Please provide the associated costs for water supply",
18592
18603
  "type": "object",
18593
18604
  "sef25Required": [
18594
18605
  "amount",
@@ -18597,12 +18608,12 @@
18597
18608
  "properties": {
18598
18609
  "amount": {
18599
18610
  "sef25Ref": "U1.1.1",
18600
- "title": "Cost (£)",
18611
+ "title": "Associated costs of supply if any (£)",
18601
18612
  "type": "number"
18602
18613
  },
18603
18614
  "frequency": {
18604
18615
  "sef25Ref": "U1.1.2",
18605
- "title": "Payment frequency",
18616
+ "title": "Payment frequency if costs are associated",
18606
18617
  "type": "string",
18607
18618
  "enum": [
18608
18619
  "Per month",
@@ -18611,7 +18622,10 @@
18611
18622
  }
18612
18623
  }
18613
18624
  }
18614
- }
18625
+ },
18626
+ "sef25Required": [
18627
+ "associatedCost"
18628
+ ]
18615
18629
  },
18616
18630
  {
18617
18631
  "properties": {
@@ -19273,12 +19287,12 @@
19273
19287
  "properties": {
19274
19288
  "amount": {
19275
19289
  "sef25Ref": "U1.2.1",
19276
- "title": "Cost (£)",
19290
+ "title": "Associated costs for sewerage if any (£)",
19277
19291
  "type": "number"
19278
19292
  },
19279
19293
  "frequency": {
19280
19294
  "sef25Ref": "U1.2.2",
19281
- "title": "Payment frequency",
19295
+ "title": "Payment frequency if costs are associated",
19282
19296
  "type": "string",
19283
19297
  "enum": [
19284
19298
  "Per month",
@@ -19287,7 +19301,10 @@
19287
19301
  }
19288
19302
  }
19289
19303
  }
19290
- }
19304
+ },
19305
+ "sef25Required": [
19306
+ "associatedCost"
19307
+ ]
19291
19308
  }
19292
19309
  ]
19293
19310
  },
@@ -1222,7 +1222,7 @@
1222
1222
  },
1223
1223
  "controlledParking": {
1224
1224
  "yesNo": "variant",
1225
- "annualCostOfPermit": "number",
1225
+ "costOfPermit": "number",
1226
1226
  "costOfPermitFrequency": "string"
1227
1227
  },
1228
1228
  "vehicleTypeRestriction": {
@@ -507,7 +507,7 @@ describe("Extension Overlays", () => {
507
507
  expect(cost.required).toEqual(["amount", "frequency"]);
508
508
  });
509
509
 
510
- test("should merge parking permit frequency into controlledParking Yes branch", () => {
510
+ test("should merge parking permit cost and frequency into controlledParking Yes branch", () => {
511
511
  const schema = getTransactionSchema(schemaId, ["pc"]);
512
512
  const controlled =
513
513
  schema.properties?.propertyPack?.properties?.parking?.properties
@@ -517,13 +517,15 @@ describe("Extension Overlays", () => {
517
517
 
518
518
  // Branch 1 is yesNo="Yes"
519
519
  const yesBranch = controlled.oneOf[1];
520
+ const cost = yesBranch?.properties?.costOfPermit;
521
+ expect(cost).toBeDefined();
522
+ expect(cost.sef25Ref).toBe("P1.1");
523
+ expect(cost.type).toBe("number");
524
+
520
525
  const freq = yesBranch?.properties?.costOfPermitFrequency;
521
526
  expect(freq).toBeDefined();
522
- expect(freq.sef25Ref).toBe("P1.1");
527
+ expect(freq.sef25Ref).toBe("P1.2");
523
528
  expect(freq.type).toBe("string");
524
-
525
- // Existing annualCostOfPermit should still be present
526
- expect(yesBranch.properties.annualCostOfPermit).toBeDefined();
527
529
  });
528
530
 
529
531
  test("should merge all 4 property hazard fields into specialistIssues", () => {
@@ -640,7 +642,7 @@ describe("Extension Overlays", () => {
640
642
  expect(result).toBe(true);
641
643
  });
642
644
 
643
- test("should validate private water with no associated cost (cost is optional at schema level)", () => {
645
+ test("should require associated cost for private water supply", () => {
644
646
  const validator = getSubschemaValidator(
645
647
  "/propertyPack/waterAndDrainage/water/mainsWater",
646
648
  schemaId,
@@ -652,7 +654,8 @@ describe("Extension Overlays", () => {
652
654
  details: "Private well",
653
655
  });
654
656
 
655
- expect(result).toBe(true);
657
+ // associatedCost is required by the sc extension
658
+ expect(result).toBe(false);
656
659
  });
657
660
 
658
661
  test("should reject invalid frequency value for water cost", () => {
@@ -764,7 +767,7 @@ describe("Extension Overlays", () => {
764
767
 
765
768
  const result = validator({
766
769
  yesNo: "Yes",
767
- annualCostOfPermit: 150,
770
+ costOfPermit: 150,
768
771
  costOfPermitFrequency: "Per year",
769
772
  });
770
773
 
@@ -780,7 +783,7 @@ describe("Extension Overlays", () => {
780
783
 
781
784
  const result = validator({
782
785
  yesNo: "Yes",
783
- annualCostOfPermit: 12.50,
786
+ costOfPermit: 12.50,
784
787
  costOfPermitFrequency: "Per month",
785
788
  });
786
789
 
@@ -796,7 +799,7 @@ describe("Extension Overlays", () => {
796
799
 
797
800
  const result = validator({
798
801
  yesNo: "Yes",
799
- annualCostOfPermit: 150,
802
+ costOfPermit: 150,
800
803
  costOfPermitFrequency: "Per quarter",
801
804
  });
802
805
 
@@ -203,6 +203,7 @@ const extensionMappings = {
203
203
  description: "Parking permit cost and frequency",
204
204
  refType: "sef25Ref",
205
205
  paths: [
206
+ "/properties/propertyPack/properties/parking/properties/controlledParking/oneOf/1/properties/costOfPermit",
206
207
  "/properties/propertyPack/properties/parking/properties/controlledParking/oneOf/1/properties/costOfPermitFrequency",
207
208
  ],
208
209
  },