@pdtf/schemas 3.6.0-38 → 3.6.0-39

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-38",
3
+ "version": "3.6.0-39",
4
4
  "description": "Property Data Trust Framework Schemas and Utilities",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -29,11 +29,25 @@
29
29
  }
30
30
  },
31
31
  {
32
+ "required": [
33
+ "details"
34
+ ],
32
35
  "properties": {
36
+ "details": {
37
+ "ntsRef": "M1.1.2",
38
+ "type": "string",
39
+ "minLength": 1
40
+ },
33
41
  "yesNo": {
34
42
  "enum": [
35
43
  "Yes"
36
44
  ]
45
+ },
46
+ "attachments": {
47
+ "enum": [
48
+ "Attached",
49
+ "To follow"
50
+ ]
37
51
  }
38
52
  }
39
53
  }
@@ -27,6 +27,15 @@
27
27
  }
28
28
  },
29
29
  {
30
+ "required": [
31
+ "newHomeWarranty",
32
+ "roofingWork",
33
+ "dampProofingTreatment",
34
+ "centralHeatingAndorPlumbing",
35
+ "electricalRepairOrInstallation",
36
+ "subsidenceWork",
37
+ "otherGuarantees"
38
+ ],
30
39
  "properties": {
31
40
  "newHomeWarranty": {
32
41
  "ntsRef": "W1.1",
@@ -36,6 +45,12 @@
36
45
  "discriminator": {
37
46
  "propertyName": "yesNo"
38
47
  },
48
+ "properties": {
49
+ "yesNo": {
50
+ "ntsRef": "W1.1.1",
51
+ "type": "string"
52
+ }
53
+ },
39
54
  "oneOf": [
40
55
  {
41
56
  "properties": {
@@ -65,6 +80,12 @@
65
80
  "discriminator": {
66
81
  "propertyName": "yesNo"
67
82
  },
83
+ "properties": {
84
+ "yesNo": {
85
+ "ntsRef": "W1.2.1",
86
+ "type": "string"
87
+ }
88
+ },
68
89
  "oneOf": [
69
90
  {
70
91
  "properties": {
@@ -94,6 +115,12 @@
94
115
  "discriminator": {
95
116
  "propertyName": "yesNo"
96
117
  },
118
+ "properties": {
119
+ "yesNo": {
120
+ "ntsRef": "W1.3.1",
121
+ "type": "string"
122
+ }
123
+ },
97
124
  "oneOf": [
98
125
  {
99
126
  "properties": {
@@ -123,6 +150,12 @@
123
150
  "discriminator": {
124
151
  "propertyName": "yesNo"
125
152
  },
153
+ "properties": {
154
+ "yesNo": {
155
+ "ntsRef": "W1.4.1",
156
+ "type": "string"
157
+ }
158
+ },
126
159
  "oneOf": [
127
160
  {
128
161
  "properties": {
@@ -152,6 +185,12 @@
152
185
  "discriminator": {
153
186
  "propertyName": "yesNo"
154
187
  },
188
+ "properties": {
189
+ "yesNo": {
190
+ "ntsRef": "W1.5.1",
191
+ "type": "string"
192
+ }
193
+ },
155
194
  "oneOf": [
156
195
  {
157
196
  "properties": {
@@ -181,6 +220,12 @@
181
220
  "discriminator": {
182
221
  "propertyName": "yesNo"
183
222
  },
223
+ "properties": {
224
+ "yesNo": {
225
+ "ntsRef": "W1.6.1",
226
+ "type": "string"
227
+ }
228
+ },
184
229
  "oneOf": [
185
230
  {
186
231
  "properties": {
@@ -210,6 +255,12 @@
210
255
  "discriminator": {
211
256
  "propertyName": "yesNo"
212
257
  },
258
+ "properties": {
259
+ "yesNo": {
260
+ "ntsRef": "W1.7.1",
261
+ "type": "string"
262
+ }
263
+ },
213
264
  "oneOf": [
214
265
  {
215
266
  "properties": {
@@ -143,6 +143,73 @@ describe("Extension Overlays", () => {
143
143
  });
144
144
  });
145
145
 
146
+ describe("SEF25 extension leaf annotations", () => {
147
+ test("wg: every W1.x subsection exposes a yesNo ntsRef", () => {
148
+ const schema = getTransactionSchema(schemaId, ["nts2023", "wg"]);
149
+ const subsections =
150
+ schema.properties?.propertyPack?.properties
151
+ ?.guaranteesWarrantiesAndIndemnityInsurances?.oneOf?.[1]?.properties;
152
+
153
+ expect(subsections).toBeDefined();
154
+
155
+ const discriminated = Object.entries(subsections).filter(
156
+ ([, sub]) => sub?.discriminator?.propertyName === "yesNo"
157
+ );
158
+ expect(discriminated.length).toBeGreaterThan(0);
159
+
160
+ for (const [key, sub] of discriminated) {
161
+ expect(sub.ntsRef).toMatch(/^W1\.\d+$/);
162
+ expect(sub.properties?.yesNo?.ntsRef).toMatch(/^W1\.\d+\.1$/);
163
+ expect(sub.required).toContain("yesNo");
164
+ }
165
+ });
166
+
167
+ test("ic: insuranceClaims exposes a yesNo ntsRef", () => {
168
+ const schema = getTransactionSchema(schemaId, ["nts2023", "ic"]);
169
+ const icProp =
170
+ schema.properties?.propertyPack?.properties?.insurance?.oneOf?.[1]
171
+ ?.properties?.insuranceClaims;
172
+
173
+ expect(icProp).toBeDefined();
174
+ expect(icProp.ntsRef).toBe("I1.1");
175
+ expect(icProp.properties?.yesNo?.ntsRef).toBe("I1.1.1");
176
+ expect(icProp.required).toContain("yesNo");
177
+ });
178
+
179
+ test("nd: neighbourDevelopment N1.1 marker merges with nts yesNo ref", () => {
180
+ // nd extension only carries the parent N1.1 marker; the yesNo leaf
181
+ // annotation comes from the nts overlay (C4.1.1), which is required
182
+ // alongside nd for the field to render.
183
+ const schema = getTransactionSchema(schemaId, ["nts2023", "nd"]);
184
+ const ndProp =
185
+ schema.properties?.propertyPack?.properties?.notices?.properties
186
+ ?.neighbourDevelopment;
187
+
188
+ expect(ndProp).toBeDefined();
189
+ expect(ndProp.ntsRef).toBe("N1.1");
190
+ expect(ndProp.properties?.yesNo?.ntsRef).toBe("C4.1.1");
191
+ expect(ndProp.required).toContain("yesNo");
192
+ });
193
+
194
+ test("mi: otherMaterialIssue exposes yesNo and details ntsRef", () => {
195
+ const schema = getTransactionSchema(schemaId, ["nts2023", "mi"]);
196
+ const miProp =
197
+ schema.properties?.propertyPack?.properties?.additionalInformation
198
+ ?.properties?.otherMaterialIssue;
199
+
200
+ expect(miProp).toBeDefined();
201
+ expect(miProp.ntsRef).toBe("M1.1");
202
+ expect(miProp.properties?.yesNo?.ntsRef).toBe("M1.1.1");
203
+ expect(miProp.required).toContain("yesNo");
204
+
205
+ const yesBranch = miProp.oneOf?.find((branch) =>
206
+ branch.required?.includes("details")
207
+ );
208
+ expect(yesBranch).toBeDefined();
209
+ expect(yesBranch.properties?.details?.ntsRef).toBe("M1.1.2");
210
+ });
211
+ });
212
+
146
213
  describe("Extension overlay availability", () => {
147
214
  test("should export all extension overlays", () => {
148
215
  const expectedKeys = [