@pdtf/schemas 3.6.0-dev.3 → 3.6.0-dev.5

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.
Files changed (280) hide show
  1. package/charming-napier-57a77c/LICENSE +21 -0
  2. package/charming-napier-57a77c/README.md +430 -0
  3. package/charming-napier-57a77c/docs/sef25-extensions-ui-spec.md +355 -0
  4. package/charming-napier-57a77c/index.js +654 -0
  5. package/charming-napier-57a77c/package-lock.json +7297 -0
  6. package/charming-napier-57a77c/package.json +41 -0
  7. package/charming-napier-57a77c/src/examples/v1/exampleAddParticipantVouch.json +32 -0
  8. package/charming-napier-57a77c/src/examples/v1/exampleDocumentedVouch.json +40 -0
  9. package/charming-napier-57a77c/src/examples/v1/exampleElectronicRecord.json +30 -0
  10. package/charming-napier-57a77c/src/examples/v1/exampleTransaction.json +878 -0
  11. package/charming-napier-57a77c/src/examples/v1/exampleVouch.json +25 -0
  12. package/charming-napier-57a77c/src/examples/v2/exampleTransaction.json +901 -0
  13. package/charming-napier-57a77c/src/examples/v3/exampleAddParticipantVouch.json +38 -0
  14. package/charming-napier-57a77c/src/examples/v3/exampleCustomOverlay.json +55 -0
  15. package/charming-napier-57a77c/src/examples/v3/exampleCustomOverlay2.json +93 -0
  16. package/charming-napier-57a77c/src/examples/v3/exampleDocumentedVouch.json +47 -0
  17. package/charming-napier-57a77c/src/examples/v3/exampleElectronicRecord.json +36 -0
  18. package/charming-napier-57a77c/src/examples/v3/exampleTransaction.json +1038 -0
  19. package/charming-napier-57a77c/src/examples/v3/exampleVouch.json +32 -0
  20. package/charming-napier-57a77c/src/mappings/SendPropertyDetailsRequestSchema.json +1588 -0
  21. package/charming-napier-57a77c/src/mappings/adf.js +198 -0
  22. package/charming-napier-57a77c/src/schemas/v1/GeoJSON.json +1279 -0
  23. package/charming-napier-57a77c/src/schemas/v1/baspiNotes.html +102 -0
  24. package/charming-napier-57a77c/src/schemas/v1/energy-performance-certificate.json +124 -0
  25. package/charming-napier-57a77c/src/schemas/v1/freehold-information.json +2051 -0
  26. package/charming-napier-57a77c/src/schemas/v1/leasehold-information.json +2064 -0
  27. package/charming-napier-57a77c/src/schemas/v1/legal-information.json +1045 -0
  28. package/charming-napier-57a77c/src/schemas/v1/material-facts.json +2109 -0
  29. package/charming-napier-57a77c/src/schemas/v1/pdtf-transaction-search-results.json +40 -0
  30. package/charming-napier-57a77c/src/schemas/v1/pdtf-transaction.json +191 -0
  31. package/charming-napier-57a77c/src/schemas/v1/searches/drainage-and-water.json +261 -0
  32. package/charming-napier-57a77c/src/schemas/v1/searches/local-land-charges.json +69 -0
  33. package/charming-napier-57a77c/src/schemas/v1/searches/local-searches-required.json +857 -0
  34. package/charming-napier-57a77c/src/schemas/v1/searches.json +237 -0
  35. package/charming-napier-57a77c/src/schemas/v1/title-deed.json +841 -0
  36. package/charming-napier-57a77c/src/schemas/v2/baspiNotes.html +102 -0
  37. package/charming-napier-57a77c/src/schemas/v2/combined.json +37731 -0
  38. package/charming-napier-57a77c/src/schemas/v2/overlays/baspi.json +8132 -0
  39. package/charming-napier-57a77c/src/schemas/v2/overlays/con29DW.json +705 -0
  40. package/charming-napier-57a77c/src/schemas/v2/overlays/con29R.json +2956 -0
  41. package/charming-napier-57a77c/src/schemas/v2/overlays/fme1.json +1259 -0
  42. package/charming-napier-57a77c/src/schemas/v2/overlays/llc1.json +25 -0
  43. package/charming-napier-57a77c/src/schemas/v2/overlays/lpe1.json +2171 -0
  44. package/charming-napier-57a77c/src/schemas/v2/overlays/nts.json +326 -0
  45. package/charming-napier-57a77c/src/schemas/v2/overlays/oc1.json +2799 -0
  46. package/charming-napier-57a77c/src/schemas/v2/overlays/piq.json +3419 -0
  47. package/charming-napier-57a77c/src/schemas/v2/overlays/rds.json +3736 -0
  48. package/charming-napier-57a77c/src/schemas/v2/overlays/ta10.json +5306 -0
  49. package/charming-napier-57a77c/src/schemas/v2/overlays/ta6.json +4533 -0
  50. package/charming-napier-57a77c/src/schemas/v2/overlays/ta7.json +1045 -0
  51. package/charming-napier-57a77c/src/schemas/v2/pdtf-transaction.json +34351 -0
  52. package/charming-napier-57a77c/src/schemas/v2/skeleton.json +3973 -0
  53. package/charming-napier-57a77c/src/schemas/v3/combined.json +48153 -0
  54. package/charming-napier-57a77c/src/schemas/v3/compactSkeleton.txt +4457 -0
  55. package/charming-napier-57a77c/src/schemas/v3/overlays/README.md +299 -0
  56. package/charming-napier-57a77c/src/schemas/v3/overlays/baspi4.json +8027 -0
  57. package/charming-napier-57a77c/src/schemas/v3/overlays/baspi5.json +8177 -0
  58. package/charming-napier-57a77c/src/schemas/v3/overlays/con29DW.json +716 -0
  59. package/charming-napier-57a77c/src/schemas/v3/overlays/con29R.json +2981 -0
  60. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/ac.json +333 -0
  61. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/as.json +74 -0
  62. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/dk.json +32 -0
  63. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/dr.json +73 -0
  64. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/er.json +85 -0
  65. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/fd.json +75 -0
  66. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/hi.json +51 -0
  67. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/hs.json +73 -0
  68. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/ic.json +59 -0
  69. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/jk.json +96 -0
  70. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/la.json +85 -0
  71. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/lc.json +75 -0
  72. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/ma.json +90 -0
  73. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/mc.json +38 -0
  74. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/mi.json +69 -0
  75. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/nd.json +43 -0
  76. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/oa.json +24 -0
  77. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/oc.json +57 -0
  78. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/pc.json +37 -0
  79. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/ph.json +194 -0
  80. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/rw.json +68 -0
  81. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/sb.json +73 -0
  82. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/sc.json +129 -0
  83. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/sd.json +63 -0
  84. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/sf.json +74 -0
  85. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/sl.json +68 -0
  86. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/ta.json +240 -0
  87. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/tf.json +103 -0
  88. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/tr.json +73 -0
  89. package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/wg.json +350 -0
  90. package/charming-napier-57a77c/src/schemas/v3/overlays/fme1.json +1266 -0
  91. package/charming-napier-57a77c/src/schemas/v3/overlays/llc1.json +25 -0
  92. package/charming-napier-57a77c/src/schemas/v3/overlays/lpe1.json +2199 -0
  93. package/charming-napier-57a77c/src/schemas/v3/overlays/nts.json +2157 -0
  94. package/charming-napier-57a77c/src/schemas/v3/overlays/nts2.json +2742 -0
  95. package/charming-napier-57a77c/src/schemas/v3/overlays/ntsl.json +1813 -0
  96. package/charming-napier-57a77c/src/schemas/v3/overlays/ntsl2.json +2217 -0
  97. package/charming-napier-57a77c/src/schemas/v3/overlays/oc1.json +2817 -0
  98. package/charming-napier-57a77c/src/schemas/v3/overlays/piq.json +3321 -0
  99. package/charming-napier-57a77c/src/schemas/v3/overlays/rds.json +3665 -0
  100. package/charming-napier-57a77c/src/schemas/v3/overlays/sef25.json +1639 -0
  101. package/charming-napier-57a77c/src/schemas/v3/overlays/sr24.json +38 -0
  102. package/charming-napier-57a77c/src/schemas/v3/overlays/ta10.json +4654 -0
  103. package/charming-napier-57a77c/src/schemas/v3/overlays/ta6.json +4568 -0
  104. package/charming-napier-57a77c/src/schemas/v3/overlays/ta6ed6.json +6537 -0
  105. package/charming-napier-57a77c/src/schemas/v3/overlays/ta7.json +1537 -0
  106. package/charming-napier-57a77c/src/schemas/v3/overlays/ta7ed5.json +1551 -0
  107. package/charming-napier-57a77c/src/schemas/v3/pdtf-transaction.json +41229 -0
  108. package/charming-napier-57a77c/src/schemas/v3/skeleton.json +5703 -0
  109. package/charming-napier-57a77c/src/schemas/verifiedClaims/README.md +21 -0
  110. package/charming-napier-57a77c/src/schemas/verifiedClaims/pdtf-verified-claims.json +447 -0
  111. package/charming-napier-57a77c/src/tests/v3/buyerCircumstances.test.js +543 -0
  112. package/charming-napier-57a77c/src/tests/v3/caching.test.js +591 -0
  113. package/charming-napier-57a77c/src/tests/v3/enquiries.test.js +1096 -0
  114. package/charming-napier-57a77c/src/tests/v3/extensionOverlays.test.js +1599 -0
  115. package/charming-napier-57a77c/src/tests/v3/offers.test.js +823 -0
  116. package/charming-napier-57a77c/src/tests/v3/patternProperties.test.js +688 -0
  117. package/charming-napier-57a77c/src/tests/v3/ta6ed6.test.js +2374 -0
  118. package/charming-napier-57a77c/src/tests/v3/ta7ed5.test.js +600 -0
  119. package/charming-napier-57a77c/src/tests/v3/transactionSchema.test.js +646 -0
  120. package/charming-napier-57a77c/src/tests/v3/verifiedClaimsValidator.test.js +195 -0
  121. package/charming-napier-57a77c/src/utils/compactSkeleton.js +84 -0
  122. package/charming-napier-57a77c/src/utils/countTokens.js +67 -0
  123. package/charming-napier-57a77c/src/utils/extractExtensionOverlays.js +624 -0
  124. package/charming-napier-57a77c/src/utils/extractOverlay.js +381 -0
  125. package/charming-napier-57a77c/src/utils/extractProperties.js +44 -0
  126. package/charming-napier-57a77c/src/utils/listPathTitles.js +36 -0
  127. package/charming-napier-57a77c/src/utils/minimalSkeleton.js +85 -0
  128. package/charming-napier-57a77c/src/utils/pathList.csv +903 -0
  129. package/charming-napier-57a77c/src/utils/pathSkeleton.js +181 -0
  130. package/compassionate-easley-bafb14/CLAUDE.md +101 -0
  131. package/compassionate-easley-bafb14/LICENSE +21 -0
  132. package/compassionate-easley-bafb14/README.md +435 -0
  133. package/compassionate-easley-bafb14/docs/branch-release-workflow.md +138 -0
  134. package/compassionate-easley-bafb14/docs/sef25-extensions-ui-spec.md +355 -0
  135. package/compassionate-easley-bafb14/index.js +654 -0
  136. package/compassionate-easley-bafb14/package-lock.json +7297 -0
  137. package/compassionate-easley-bafb14/package.json +44 -0
  138. package/compassionate-easley-bafb14/src/examples/v1/exampleAddParticipantVouch.json +32 -0
  139. package/compassionate-easley-bafb14/src/examples/v1/exampleDocumentedVouch.json +40 -0
  140. package/compassionate-easley-bafb14/src/examples/v1/exampleElectronicRecord.json +30 -0
  141. package/compassionate-easley-bafb14/src/examples/v1/exampleTransaction.json +878 -0
  142. package/compassionate-easley-bafb14/src/examples/v1/exampleVouch.json +25 -0
  143. package/compassionate-easley-bafb14/src/examples/v2/exampleTransaction.json +901 -0
  144. package/compassionate-easley-bafb14/src/examples/v3/exampleAddParticipantVouch.json +38 -0
  145. package/compassionate-easley-bafb14/src/examples/v3/exampleCustomOverlay.json +55 -0
  146. package/compassionate-easley-bafb14/src/examples/v3/exampleCustomOverlay2.json +93 -0
  147. package/compassionate-easley-bafb14/src/examples/v3/exampleDocumentedVouch.json +47 -0
  148. package/compassionate-easley-bafb14/src/examples/v3/exampleElectronicRecord.json +36 -0
  149. package/compassionate-easley-bafb14/src/examples/v3/exampleTransaction.json +1038 -0
  150. package/compassionate-easley-bafb14/src/examples/v3/exampleVouch.json +32 -0
  151. package/compassionate-easley-bafb14/src/mappings/SendPropertyDetailsRequestSchema.json +1588 -0
  152. package/compassionate-easley-bafb14/src/mappings/adf.js +198 -0
  153. package/compassionate-easley-bafb14/src/schemas/v1/GeoJSON.json +1279 -0
  154. package/compassionate-easley-bafb14/src/schemas/v1/baspiNotes.html +102 -0
  155. package/compassionate-easley-bafb14/src/schemas/v1/energy-performance-certificate.json +124 -0
  156. package/compassionate-easley-bafb14/src/schemas/v1/freehold-information.json +2051 -0
  157. package/compassionate-easley-bafb14/src/schemas/v1/leasehold-information.json +2064 -0
  158. package/compassionate-easley-bafb14/src/schemas/v1/legal-information.json +1045 -0
  159. package/compassionate-easley-bafb14/src/schemas/v1/material-facts.json +2109 -0
  160. package/compassionate-easley-bafb14/src/schemas/v1/pdtf-transaction-search-results.json +40 -0
  161. package/compassionate-easley-bafb14/src/schemas/v1/pdtf-transaction.json +191 -0
  162. package/compassionate-easley-bafb14/src/schemas/v1/searches/drainage-and-water.json +261 -0
  163. package/compassionate-easley-bafb14/src/schemas/v1/searches/local-land-charges.json +69 -0
  164. package/compassionate-easley-bafb14/src/schemas/v1/searches/local-searches-required.json +857 -0
  165. package/compassionate-easley-bafb14/src/schemas/v1/searches.json +237 -0
  166. package/compassionate-easley-bafb14/src/schemas/v1/title-deed.json +841 -0
  167. package/compassionate-easley-bafb14/src/schemas/v2/baspiNotes.html +102 -0
  168. package/compassionate-easley-bafb14/src/schemas/v2/combined.json +37731 -0
  169. package/compassionate-easley-bafb14/src/schemas/v2/overlays/baspi.json +8132 -0
  170. package/compassionate-easley-bafb14/src/schemas/v2/overlays/con29DW.json +705 -0
  171. package/compassionate-easley-bafb14/src/schemas/v2/overlays/con29R.json +2956 -0
  172. package/compassionate-easley-bafb14/src/schemas/v2/overlays/fme1.json +1259 -0
  173. package/compassionate-easley-bafb14/src/schemas/v2/overlays/llc1.json +25 -0
  174. package/compassionate-easley-bafb14/src/schemas/v2/overlays/lpe1.json +2171 -0
  175. package/compassionate-easley-bafb14/src/schemas/v2/overlays/nts.json +326 -0
  176. package/compassionate-easley-bafb14/src/schemas/v2/overlays/oc1.json +2799 -0
  177. package/compassionate-easley-bafb14/src/schemas/v2/overlays/piq.json +3419 -0
  178. package/compassionate-easley-bafb14/src/schemas/v2/overlays/rds.json +3736 -0
  179. package/compassionate-easley-bafb14/src/schemas/v2/overlays/ta10.json +5306 -0
  180. package/compassionate-easley-bafb14/src/schemas/v2/overlays/ta6.json +4533 -0
  181. package/compassionate-easley-bafb14/src/schemas/v2/overlays/ta7.json +1045 -0
  182. package/compassionate-easley-bafb14/src/schemas/v2/pdtf-transaction.json +34351 -0
  183. package/compassionate-easley-bafb14/src/schemas/v2/skeleton.json +3973 -0
  184. package/compassionate-easley-bafb14/src/schemas/v3/combined.json +48461 -0
  185. package/compassionate-easley-bafb14/src/schemas/v3/compactSkeleton.txt +4519 -0
  186. package/compassionate-easley-bafb14/src/schemas/v3/overlays/README.md +299 -0
  187. package/compassionate-easley-bafb14/src/schemas/v3/overlays/baspi4.json +8030 -0
  188. package/compassionate-easley-bafb14/src/schemas/v3/overlays/baspi5.json +8180 -0
  189. package/compassionate-easley-bafb14/src/schemas/v3/overlays/con29DW.json +716 -0
  190. package/compassionate-easley-bafb14/src/schemas/v3/overlays/con29R.json +2981 -0
  191. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/ac.json +334 -0
  192. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/as.json +74 -0
  193. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/dk.json +33 -0
  194. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/dr.json +73 -0
  195. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/er.json +85 -0
  196. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/fd.json +75 -0
  197. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/hi.json +51 -0
  198. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/hs.json +73 -0
  199. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/ic.json +83 -0
  200. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/jk.json +96 -0
  201. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/la.json +85 -0
  202. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/lc.json +76 -0
  203. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/ma.json +90 -0
  204. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/mc.json +38 -0
  205. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/mi.json +70 -0
  206. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/nd.json +44 -0
  207. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/oa.json +24 -0
  208. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/oc.json +57 -0
  209. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/pc.json +38 -0
  210. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/ph.json +195 -0
  211. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/rw.json +69 -0
  212. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/sb.json +73 -0
  213. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/sc.json +133 -0
  214. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/sd.json +64 -0
  215. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/sf.json +74 -0
  216. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/sl.json +68 -0
  217. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/ta.json +204 -0
  218. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/tf.json +103 -0
  219. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/tr.json +74 -0
  220. package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/wg.json +351 -0
  221. package/compassionate-easley-bafb14/src/schemas/v3/overlays/fme1.json +1266 -0
  222. package/compassionate-easley-bafb14/src/schemas/v3/overlays/llc1.json +25 -0
  223. package/compassionate-easley-bafb14/src/schemas/v3/overlays/lpe1.json +2199 -0
  224. package/compassionate-easley-bafb14/src/schemas/v3/overlays/nts.json +2159 -0
  225. package/compassionate-easley-bafb14/src/schemas/v3/overlays/nts2.json +2744 -0
  226. package/compassionate-easley-bafb14/src/schemas/v3/overlays/ntsl.json +1815 -0
  227. package/compassionate-easley-bafb14/src/schemas/v3/overlays/ntsl2.json +2219 -0
  228. package/compassionate-easley-bafb14/src/schemas/v3/overlays/oc1.json +2817 -0
  229. package/compassionate-easley-bafb14/src/schemas/v3/overlays/piq.json +3324 -0
  230. package/compassionate-easley-bafb14/src/schemas/v3/overlays/rds.json +3668 -0
  231. package/compassionate-easley-bafb14/src/schemas/v3/overlays/sef25.json +1644 -0
  232. package/compassionate-easley-bafb14/src/schemas/v3/overlays/sr24.json +38 -0
  233. package/compassionate-easley-bafb14/src/schemas/v3/overlays/ta10.json +4645 -0
  234. package/compassionate-easley-bafb14/src/schemas/v3/overlays/ta6.json +4572 -0
  235. package/compassionate-easley-bafb14/src/schemas/v3/overlays/ta6ed6.json +6536 -0
  236. package/compassionate-easley-bafb14/src/schemas/v3/overlays/ta7.json +1537 -0
  237. package/compassionate-easley-bafb14/src/schemas/v3/overlays/ta7ed5.json +1551 -0
  238. package/compassionate-easley-bafb14/src/schemas/v3/pdtf-transaction.json +41570 -0
  239. package/compassionate-easley-bafb14/src/schemas/v3/skeleton.json +5767 -0
  240. package/compassionate-easley-bafb14/src/schemas/verifiedClaims/README.md +21 -0
  241. package/compassionate-easley-bafb14/src/schemas/verifiedClaims/pdtf-verified-claims.json +447 -0
  242. package/compassionate-easley-bafb14/src/utils/compactSkeleton.js +84 -0
  243. package/compassionate-easley-bafb14/src/utils/countTokens.js +67 -0
  244. package/compassionate-easley-bafb14/src/utils/extractExtensionOverlays.js +633 -0
  245. package/compassionate-easley-bafb14/src/utils/extractOverlay.js +381 -0
  246. package/compassionate-easley-bafb14/src/utils/extractProperties.js +44 -0
  247. package/compassionate-easley-bafb14/src/utils/listPathTitles.js +36 -0
  248. package/compassionate-easley-bafb14/src/utils/minimalSkeleton.js +85 -0
  249. package/compassionate-easley-bafb14/src/utils/pathList.csv +903 -0
  250. package/compassionate-easley-bafb14/src/utils/pathSkeleton.js +181 -0
  251. package/package.json +1 -1
  252. package/src/schemas/v3/combined.json +9 -15
  253. package/src/schemas/v3/overlays/baspi4.json +12 -7
  254. package/src/schemas/v3/overlays/baspi5.json +12 -7
  255. package/src/schemas/v3/overlays/extensions/ac.json +2 -1
  256. package/src/schemas/v3/overlays/extensions/dk.json +3 -2
  257. package/src/schemas/v3/overlays/extensions/ic.json +33 -9
  258. package/src/schemas/v3/overlays/extensions/lc.json +3 -2
  259. package/src/schemas/v3/overlays/extensions/mi.json +2 -1
  260. package/src/schemas/v3/overlays/extensions/nd.json +3 -2
  261. package/src/schemas/v3/overlays/extensions/pc.json +3 -2
  262. package/src/schemas/v3/overlays/extensions/ph.json +2 -1
  263. package/src/schemas/v3/overlays/extensions/rw.json +4 -3
  264. package/src/schemas/v3/overlays/extensions/sc.json +8 -4
  265. package/src/schemas/v3/overlays/extensions/sd.json +3 -2
  266. package/src/schemas/v3/overlays/extensions/tr.json +3 -2
  267. package/src/schemas/v3/overlays/extensions/wg.json +2 -1
  268. package/src/schemas/v3/overlays/lpe1.json +1 -1
  269. package/src/schemas/v3/overlays/nts.json +3 -1
  270. package/src/schemas/v3/overlays/nts2.json +3 -1
  271. package/src/schemas/v3/overlays/ntsl.json +3 -1
  272. package/src/schemas/v3/overlays/ntsl2.json +3 -1
  273. package/src/schemas/v3/overlays/piq.json +7 -5
  274. package/src/schemas/v3/overlays/rds.json +9 -6
  275. package/src/schemas/v3/overlays/sef25.json +6 -1
  276. package/src/schemas/v3/overlays/ta10.json +0 -9
  277. package/src/schemas/v3/overlays/ta6.json +8 -4
  278. package/src/schemas/v3/overlays/ta6ed6.json +4 -2
  279. package/src/schemas/v3/pdtf-transaction.json +15 -18
  280. package/src/utils/extractExtensionOverlays.js +11 -2
@@ -0,0 +1,646 @@
1
+ const jp = require("jsonpointer");
2
+ const fs = require("fs");
3
+
4
+ const {
5
+ getTransactionSchema,
6
+ getSubschema,
7
+ isPathValid,
8
+ getValidator,
9
+ getSubschemaValidator,
10
+ getTitleAtPath,
11
+ } = require("../../../index.js");
12
+
13
+ const exampleTransaction = require("../../examples/v3/exampleTransaction.json");
14
+
15
+ const schemaId =
16
+ "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json";
17
+ // const validator = getValidator(schemaId);
18
+ const v3TransactionSchema = getTransactionSchema(schemaId);
19
+
20
+ test("exports a property pack schema, v3 with no overlay by default", () => {
21
+ const testSchema = getTransactionSchema(schemaId);
22
+ // expect(testSchema.$id).toEqual(
23
+ // "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json"
24
+ // );
25
+ expect(testSchema.properties.propertyPack.properties.baspi5Ref).toEqual(
26
+ undefined
27
+ );
28
+ });
29
+
30
+ test("sample is valid BASPI", () => {
31
+ const testSchema = getTransactionSchema(schemaId, ["baspiV4"]);
32
+ expect(testSchema.properties.propertyPack.baspi4Ref).toEqual("0");
33
+ const validator = getValidator(schemaId, ["baspiV4"]);
34
+ const isValid = validator(exampleTransaction);
35
+ expect(isValid).toBe(true);
36
+ });
37
+
38
+ test("sample is valid NTS", () => {
39
+ const validator = getValidator(schemaId, ["nts2023"]);
40
+ const isValid = validator(exampleTransaction);
41
+ expect(isValid).toBe(true);
42
+ });
43
+
44
+ test("sample is not valid nts2025 out of the box", () => {
45
+ const validator = getValidator(schemaId, ["nts2025"]);
46
+ const isValid = validator(exampleTransaction);
47
+ expect(isValid).toBe(false);
48
+ expect(validator.errors.length).toBe(3);
49
+ expect(validator.errors.map((e) => e.message)).toEqual([
50
+ "must have required property 'transferFees'",
51
+ "must have required property 'constructionType'",
52
+ "must have required property 'floodDefences'",
53
+ ]);
54
+ });
55
+
56
+ test("sample is valid nts2025 with some additions", () => {
57
+ const validator = getValidator(schemaId, ["nts2025"]);
58
+ const clonedExampleTransaction = JSON.parse(
59
+ JSON.stringify(exampleTransaction)
60
+ );
61
+ clonedExampleTransaction.propertyPack.ownership.ownershipsToBeTransferred[0].leaseholdInformation.serviceCharge.transferFees =
62
+ {
63
+ yesNo: "Yes",
64
+ details: "Transfer fees exist",
65
+ };
66
+ clonedExampleTransaction.propertyPack.typeOfConstruction.isStandardForm = {
67
+ yesNo: "Yes",
68
+ constructionType: "Timber frame",
69
+ };
70
+ clonedExampleTransaction.propertyPack.environmentalIssues.flooding.floodDefences =
71
+ {
72
+ hasFloodDefences: "Yes",
73
+ details: "Flood defences exist",
74
+ };
75
+
76
+ const isValid = validator(clonedExampleTransaction);
77
+ expect(isValid).toBe(true);
78
+ });
79
+
80
+ test("sample is not valid NTSL (lettings)", () => {
81
+ const validator = getValidator(schemaId, ["ntsl2023"]);
82
+ const isValid = validator(exampleTransaction);
83
+ expect(isValid).toBe(false);
84
+ expect(validator.errors[0].message).toBe(
85
+ "must have required property 'lettingInformation'"
86
+ );
87
+ });
88
+
89
+ test("sample is valid NTSL if we change it accordingly", () => {
90
+ const validator = getValidator(schemaId, ["ntsl2023"]);
91
+ const clonedExampleTransaction = JSON.parse(
92
+ JSON.stringify(exampleTransaction)
93
+ );
94
+ clonedExampleTransaction.propertyPack.lettingInformation = {
95
+ rent: 3500,
96
+ rentFrequency: "Monthly",
97
+ securityDeposit: 5000,
98
+ };
99
+ delete clonedExampleTransaction.propertyPack.priceInformation;
100
+ delete clonedExampleTransaction.propertyPack.ownership;
101
+ const isValid = validator(clonedExampleTransaction);
102
+ expect(isValid).toBe(true);
103
+ });
104
+
105
+ test("invalid sample is invalid", () => {
106
+ const clonedExampleTransaction = JSON.parse(
107
+ JSON.stringify(exampleTransaction)
108
+ );
109
+ delete clonedExampleTransaction.propertyPack.notices;
110
+ const validator = getValidator(schemaId, ["baspiV4"]);
111
+ const isValid = validator(clonedExampleTransaction);
112
+ expect(isValid).toBe(false);
113
+ });
114
+
115
+ test("sample with missing dependent required fields is invalid", () => {
116
+ const clonedExampleTransaction = JSON.parse(
117
+ JSON.stringify(exampleTransaction)
118
+ );
119
+ clonedExampleTransaction.propertyPack.ownership.ownershipsToBeTransferred[0].ownershipType =
120
+ "leasehold";
121
+ const validator = getValidator(schemaId);
122
+ const isValid = validator(clonedExampleTransaction);
123
+ expect(isValid).toBe(false);
124
+ });
125
+
126
+ test("sample with missing dependent required fields with NTS overlay is invalid", () => {
127
+ // Previously a required field was missing from the NTS overlay
128
+ const clonedExampleTransaction = JSON.parse(
129
+ JSON.stringify(exampleTransaction)
130
+ );
131
+ clonedExampleTransaction.propertyPack.ownership.ownershipsToBeTransferred[0].leaseholdInformation =
132
+ undefined;
133
+ const validator = getValidator(schemaId, ["nts2023"]);
134
+ const isValid = validator(clonedExampleTransaction);
135
+ expect(isValid).toBe(false);
136
+ });
137
+
138
+ test("correctly gets a top level subschema", () => {
139
+ const subschema = getSubschema("/propertyPack");
140
+ expect(subschema.title).toBe("Property Pack");
141
+ });
142
+
143
+ test("correctly identifies a valid path", () => {
144
+ const isValid = isPathValid("/propertyPack");
145
+ expect(isValid).toBe(true);
146
+ });
147
+
148
+ test("correctly identifies an undefined invalid path", () => {
149
+ const isValid = isPathValid("/propertyPack/materialItems");
150
+ expect(isValid).toBe(false);
151
+ });
152
+
153
+ test("correctly identifies an error generating invalid path", () => {
154
+ const isValid = isPathValid(
155
+ "/propertyPack/materialItems/someProperty/item",
156
+ schemaId
157
+ );
158
+ expect(isValid).toBe(false);
159
+ });
160
+
161
+ test("correctly identifies an array invalid path", () => {
162
+ const isValid = isPathValid("/propertyPack/1/item");
163
+ expect(isValid).toBe(false);
164
+ });
165
+
166
+ test("correctly gets a subschema", () => {
167
+ const subschema = getSubschema("/propertyPack/notices", schemaId);
168
+ expect(subschema.title).toBe("Notices which Affect the Property");
169
+ });
170
+
171
+ test("correctly gets a subschema through an arrays element", () => {
172
+ const subschema = getSubschema(
173
+ "/propertyPack/titlesToBeSold/0/registerExtract",
174
+ schemaId
175
+ );
176
+ expect(Object.keys(subschema.properties)).toEqual([
177
+ "ocSummaryData",
178
+ "ocRegisterData",
179
+ ]);
180
+ });
181
+
182
+ test("correctly gets a subschema through a dependency", () => {
183
+ const subschema = getSubschema(
184
+ "/propertyPack/delayFactors/hasDelayFactors/details",
185
+ schemaId
186
+ );
187
+ expect(subschema.title).toBe(
188
+ "Provide details and likely timescale for delay"
189
+ );
190
+ });
191
+
192
+ test("correctly gets another subschema through a dependency", () => {
193
+ const subschema = getSubschema(
194
+ "/propertyPack/ownership/ownershipsToBeTransferred/0/leaseholdInformation/leaseTerm/lengthOfLeaseInYears",
195
+ schemaId
196
+ );
197
+ expect(subschema.title).toBe("Length of lease (years)");
198
+ });
199
+
200
+ test("correctly gets yet another subschema through a dependency", () => {
201
+ const subschema = getSubschema(
202
+ "/propertyPack/ownership/ownershipsToBeTransferred/0/leaseholdInformation/groundRent/rentSubjectToIncrease/rentIncreaseCalculated"
203
+ );
204
+ expect(subschema.title).toBe("How is the increase calculated?");
205
+ });
206
+
207
+ test("correctly gets yet, yet another subschema through a dependency", () => {
208
+ const subschema = getSubschema(
209
+ "/propertyPack/listingAndConservation/isConservationArea/yesNo"
210
+ );
211
+ expect(subschema.type).toBe("string");
212
+ expect(subschema.enum).toStrictEqual(["Yes", "No", "Not known"]);
213
+ });
214
+
215
+ test("correctly gets yet, yet, yet another subschema through a second item dependency", () => {
216
+ const subschema = getSubschema(
217
+ "/propertyPack/environmentalIssues/flooding/historicalFlooding/typeOfFlooding"
218
+ );
219
+ expect(subschema.type).toBe("array");
220
+ });
221
+
222
+ test("correctly gets yes another subschema but through a non-baspi oneOf structure", () => {
223
+ const subschema = getSubschema(
224
+ "/propertyPack/titlesToBeSold/0/registerExtract/ocSummaryData/restrictionDetails/restrictionEntry/chargeRestriction/entryDetails/entryText"
225
+ );
226
+ expect(subschema).toEqual({ type: "string" });
227
+ });
228
+
229
+ test("correctly gets yes another subschema but through a non-baspi oneOf structure with array option", () => {
230
+ const subschema = getSubschema(
231
+ "/propertyPack/titlesToBeSold/0/registerExtract/ocSummaryData/restrictionDetails/restrictionEntry/0/chargeRestriction/entryDetails/entryText"
232
+ );
233
+ expect(subschema).toEqual({ type: "string" });
234
+ });
235
+
236
+ test("correctly resolves properties inside nested oneOf branches", () => {
237
+ // attachments is at japaneseKnotweed.oneOf[1].oneOf[1].properties.attachments
238
+ const subschema = getSubschema(
239
+ "/propertyPack/specialistIssues/japaneseKnotweed/attachments"
240
+ );
241
+ expect(subschema).toBeDefined();
242
+ expect(subschema.type).toBe("string");
243
+ expect(subschema.enum).toContain("To follow");
244
+ expect(subschema.enum).toContain("Attached");
245
+ });
246
+
247
+ test("isPathValid returns true for nested oneOf properties", () => {
248
+ expect(
249
+ isPathValid("/propertyPack/specialistIssues/japaneseKnotweed/attachments")
250
+ ).toBe(true);
251
+ // knotweedSurveyCarriedOut.attachments is also nested in a oneOf
252
+ expect(
253
+ isPathValid(
254
+ "/propertyPack/specialistIssues/japaneseKnotweed/knotweedSurveyCarriedOut/attachments"
255
+ )
256
+ ).toBe(true);
257
+ });
258
+
259
+ test("isPathValid returns false for non-existent paths in nested oneOf", () => {
260
+ expect(
261
+ isPathValid(
262
+ "/propertyPack/specialistIssues/japaneseKnotweed/nonExistentField"
263
+ )
264
+ ).toBe(false);
265
+ });
266
+
267
+ test("correctly gets an overlaid enum in a subschema", () => {
268
+ const subschema = getSubschema(
269
+ "/propertyPack/electricity/mainsElectricity/yesNo",
270
+ schemaId,
271
+ ["nts2023"]
272
+ );
273
+ expect(subschema.enum).toEqual(["Yes", "No"]);
274
+ });
275
+
276
+ test("correctly gets a subschema with multiple overlays", () => {
277
+ const subschema = getSubschema(
278
+ "/propertyPack/parking/parkingArrangements",
279
+ schemaId,
280
+ ["baspiV5", "ta6ed4"]
281
+ );
282
+ expect(subschema.baspi5Ref).toBe("A1.6.0");
283
+ expect(subschema.ta6Ref).toBe("9.1");
284
+ });
285
+
286
+ test("correctly gets a subschema validator which is already cached", () => {
287
+ const validator = getSubschemaValidator(
288
+ "/propertyPack/energyEfficiency/certificate"
289
+ );
290
+ expect(validator).not.toBeNull();
291
+ const anotherValidator = getSubschemaValidator(
292
+ "/propertyPack/energyEfficiency/certificate"
293
+ );
294
+ expect(anotherValidator).not.toBeNull();
295
+ });
296
+
297
+ test("correctly gets a subschema validator for a TA6 overlay", () => {
298
+ const path = "/propertyPack";
299
+ const data = jp.get(exampleTransaction, path);
300
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
301
+ "ta6ed4",
302
+ ]);
303
+ let isValid = validator(data);
304
+ expect(isValid).toBe(true);
305
+ });
306
+
307
+ test("correctly gets a subschema validator for a TA7 overlay", () => {
308
+ const path = "/propertyPack";
309
+ const data = jp.get(exampleTransaction, path);
310
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
311
+ "ta7ed3",
312
+ ]);
313
+ let isValid = validator(data);
314
+ expect(isValid).toBe(false);
315
+ });
316
+
317
+ test("correctly gets a subschema validator for a TA10 overlay", () => {
318
+ const path = "/propertyPack";
319
+ const data = jp.get(exampleTransaction, path);
320
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
321
+ "ta10ed3",
322
+ ]);
323
+ let isValid = validator(data);
324
+ expect(isValid).toBe(false);
325
+ });
326
+
327
+ test("correctly gets a subschema validator for a TA6 overlay which validates", () => {
328
+ const path =
329
+ "/propertyPack/guaranteesWarrantiesAndIndemnityInsurances/subsidenceWork";
330
+ const data = { yesNo: "Yes" };
331
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
332
+ "ta6ed4",
333
+ ]);
334
+ let isValid = validator(data);
335
+ expect(isValid).toBe(false);
336
+ expect(validator.errors[0].message).toBe(
337
+ "must have required property 'attachments'"
338
+ );
339
+ });
340
+
341
+ test("correctly gets a subschema validator for a TA6 overlay which validates with non-TA6 field missing", () => {
342
+ const path = "/propertyPack";
343
+ const clonedExampleTransaction = JSON.parse(
344
+ JSON.stringify(exampleTransaction)
345
+ );
346
+ const data = jp.get(exampleTransaction, path);
347
+ data.uprn = undefined;
348
+ const validator = getSubschemaValidator(
349
+ path,
350
+ clonedExampleTransaction.$schema,
351
+ ["ta6ed4"]
352
+ );
353
+ let isValid = validator(data);
354
+ expect(isValid).toBe(true);
355
+ });
356
+
357
+ test("correctly gets a subschema validator for a TA6 overlay which validates with non-TA6 section missing", () => {
358
+ const path = "/propertyPack";
359
+ const clonedExampleTransaction = JSON.parse(
360
+ JSON.stringify(exampleTransaction)
361
+ );
362
+ const data = jp.get(clonedExampleTransaction, path);
363
+ data.smartHomeSystems = undefined;
364
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
365
+ "ta6ed4",
366
+ ]);
367
+ let isValid = validator(data);
368
+ expect(isValid).toBe(true);
369
+ });
370
+
371
+ test("correctly gets a subschema validator for a TA6 overlay which fails to validate with BASPI/TA6 section missing", () => {
372
+ const path = "/propertyPack";
373
+ const clonedExampleTransaction = JSON.parse(
374
+ JSON.stringify(exampleTransaction)
375
+ );
376
+ const data = jp.get(clonedExampleTransaction, path);
377
+ data.waterAndDrainage = {};
378
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
379
+ "ta6ed4",
380
+ ]);
381
+ let isValid = validator(data);
382
+ expect(isValid).toBe(false);
383
+ });
384
+
385
+ test("correctly gets a subschema validator for an NTS overlay", () => {
386
+ const path = "/propertyPack";
387
+ const clonedExampleTransaction = JSON.parse(
388
+ JSON.stringify(exampleTransaction)
389
+ );
390
+ const data = jp.get(clonedExampleTransaction, path);
391
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
392
+ "nts2023",
393
+ ]);
394
+ let isValid = validator(data);
395
+ expect(isValid).toBe(true);
396
+ });
397
+
398
+ test("correctly gets a subschema validator for an TA7 overlay", () => {
399
+ const path = "/propertyPack";
400
+ const clonedExampleTransaction = JSON.parse(
401
+ JSON.stringify(exampleTransaction)
402
+ );
403
+ const data = jp.get(clonedExampleTransaction, path);
404
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
405
+ "ta7ed3",
406
+ ]);
407
+ let isValid = validator(data);
408
+ expect(isValid).toBe(false);
409
+ });
410
+
411
+ test("correctly gets a subschema validator which validates", () => {
412
+ const path = "/propertyPack/notices";
413
+ const validator = getSubschemaValidator(path);
414
+ const data = jp.get(exampleTransaction, path);
415
+ expect(data.neighbourDevelopment.yesNo).toBe("No");
416
+ let isValid = validator(data);
417
+ expect(isValid).toBe(true);
418
+ data.neighbourDevelopment.yesNo = "Invalid string";
419
+ isValid = validator(data);
420
+ expect(isValid).toBe(false);
421
+ });
422
+
423
+ test("correctly gets titles across schemas, arrays and non-existient title properties", () => {
424
+ expect(
425
+ getTitleAtPath(
426
+ v3TransactionSchema,
427
+ "/propertyPack/ownership/ownershipsToBeTransferred/0/ownershipType"
428
+ )
429
+ ).toBe("What type of ownership is the property?");
430
+
431
+ expect(
432
+ getTitleAtPath(
433
+ v3TransactionSchema,
434
+ "/propertyPack/ownership/ownershipsToBeTransferred/0/leaseholdInformation/leaseTerm/lengthOfLeaseInYears"
435
+ )
436
+ ).toBe("Length of lease (years)");
437
+
438
+ expect(getTitleAtPath(v3TransactionSchema, "/propertyPack/invalidPath")).toBe(
439
+ undefined
440
+ );
441
+
442
+ expect(
443
+ getTitleAtPath(
444
+ v3TransactionSchema,
445
+ "/propertyPack/titlesToBeSold/0/registerExtract"
446
+ )
447
+ ).toBe("HMLR Official Copy Register Extract");
448
+
449
+ expect(
450
+ getTitleAtPath(
451
+ v3TransactionSchema,
452
+ "/propertyPack/titlesToBeSold/0/registerExtract/ocSummaryData/propertyAddress"
453
+ )
454
+ ).toBe("Property address");
455
+
456
+ expect(
457
+ getTitleAtPath(
458
+ v3TransactionSchema,
459
+ "/propertyPack/titlesToBeSold/0/registerExtract/ocSummaryData/invalidProp"
460
+ )
461
+ ).toBe(undefined);
462
+
463
+ expect(
464
+ getTitleAtPath(
465
+ v3TransactionSchema,
466
+ "/propertyPack/energyEfficiency/certificate/currentEnergyRating"
467
+ )
468
+ ).toBe("Current energy efficiency rating");
469
+
470
+ expect(
471
+ getTitleAtPath(
472
+ v3TransactionSchema,
473
+ "/propertyPack/occupiers/othersAged17OrOver/aged17OrOverNames"
474
+ )
475
+ ).toBe("Please provide their full names and ages.");
476
+ });
477
+ test("validates a valid contract", () => {
478
+ const path = "/contracts";
479
+ const data = jp.get(exampleTransaction, path);
480
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema);
481
+ const isValid = validator(data);
482
+ expect(isValid).toBe(true);
483
+ });
484
+
485
+ test("ntsl2025 requires parking and listingAndConservation fields", () => {
486
+ // This test validates that the ntsl2025 overlay correctly enforces required fields
487
+ // for the parking and listingAndConservation sections.
488
+ // It should fail validation when these fields are missing.
489
+ // NOTE: This test will fail until overlays are regenerated from combined.json
490
+ const validator = getValidator(schemaId, ["ntsl2025"]);
491
+ const clonedExampleTransaction = JSON.parse(
492
+ JSON.stringify(exampleTransaction)
493
+ );
494
+
495
+ // Set up lettings-specific fields
496
+ clonedExampleTransaction.propertyPack.lettingInformation = {
497
+ rent: 3500,
498
+ rentFrequency: "Monthly",
499
+ securityDeposit: 5000,
500
+ };
501
+ delete clonedExampleTransaction.propertyPack.priceInformation;
502
+ delete clonedExampleTransaction.propertyPack.ownership;
503
+
504
+ // Remove ALL parking fields - this should make validation fail
505
+ delete clonedExampleTransaction.propertyPack.parking.parkingArrangements;
506
+ delete clonedExampleTransaction.propertyPack.parking.disabledParking;
507
+ delete clonedExampleTransaction.propertyPack.parking.controlledParking;
508
+ delete clonedExampleTransaction.propertyPack.parking
509
+ .electricVehicleChargingPoint;
510
+
511
+ // Remove ALL listingAndConservation fields - this should make validation fail
512
+ delete clonedExampleTransaction.propertyPack.listingAndConservation.isListed;
513
+ delete clonedExampleTransaction.propertyPack.listingAndConservation
514
+ .isConservationArea;
515
+ delete clonedExampleTransaction.propertyPack.listingAndConservation
516
+ .hasTreePreservationOrder;
517
+
518
+ const isValid = validator(clonedExampleTransaction);
519
+
520
+ // The data should be INVALID because required fields are missing
521
+ expect(isValid).toBe(false);
522
+
523
+ // Specifically check that parking and listingAndConservation fields are reported as missing
524
+ const errorMessages = validator.errors.map((e) => e.message);
525
+ expect(errorMessages).toContain(
526
+ "must have required property 'parkingArrangements'"
527
+ );
528
+ expect(errorMessages).toContain(
529
+ "must have required property 'disabledParking'"
530
+ );
531
+ expect(errorMessages).toContain(
532
+ "must have required property 'controlledParking'"
533
+ );
534
+ expect(errorMessages).toContain(
535
+ "must have required property 'electricVehicleChargingPoint'"
536
+ );
537
+ expect(errorMessages).toContain("must have required property 'isListed'");
538
+ expect(errorMessages).toContain(
539
+ "must have required property 'isConservationArea'"
540
+ );
541
+ expect(errorMessages).toContain(
542
+ "must have required property 'hasTreePreservationOrder'"
543
+ );
544
+ });
545
+
546
+ test("waterAndDrainage state is invalid under nts2023 overlay when mainsFoulDrainage yesNo is Not known", () => {
547
+ const validator = getValidator(schemaId, ["nts2023"]);
548
+ const clonedExampleTransaction = JSON.parse(
549
+ JSON.stringify(exampleTransaction)
550
+ );
551
+
552
+ // Set the waterAndDrainage to an actually invalid state for nts2023
553
+ // The nts overlay restricts mainsFoulDrainage.yesNo to only "Yes" or "No"
554
+ // (not "Not known" like the base schema allows)
555
+ clonedExampleTransaction.propertyPack.waterAndDrainage = {
556
+ water: {
557
+ mainsWater: {
558
+ yesNo: "Yes",
559
+ waterMeter: {
560
+ isSupplyMetered: "No",
561
+ },
562
+ },
563
+ },
564
+ drainage: {
565
+ mainsSurfaceWaterDrainage: {
566
+ yesNo: "Yes",
567
+ },
568
+ mainsFoulDrainage: {
569
+ yesNo: "Not known", // This is invalid under nts2023 overlay
570
+ },
571
+ },
572
+ };
573
+
574
+ const isValid = validator(clonedExampleTransaction);
575
+ expect(isValid).toBe(false);
576
+
577
+ // Check that the validation error is about the invalid enum value
578
+ const relevantError = validator.errors.find(
579
+ (error) =>
580
+ error.instancePath.includes("mainsFoulDrainage") &&
581
+ error.message.includes("must be equal to one of the allowed values")
582
+ );
583
+ expect(relevantError).toBeDefined();
584
+ });
585
+
586
+ test("waterAndDrainage state with mainsFoulDrainage No missing offMainsDrainageSystem is now invalid under nts2023 overlay", () => {
587
+ const validator = getValidator(schemaId, ["nts2023"]);
588
+ const clonedExampleTransaction = JSON.parse(
589
+ JSON.stringify(exampleTransaction)
590
+ );
591
+
592
+ // Set the waterAndDrainage to the state from the user request
593
+ // This SHOULD be invalid because offMainsDrainageSystem is required when mainsFoulDrainage.yesNo is "No"
594
+ clonedExampleTransaction.propertyPack.waterAndDrainage = {
595
+ water: {
596
+ mainsWater: {
597
+ yesNo: "Yes",
598
+ waterMeter: {
599
+ isSupplyMetered: "No",
600
+ },
601
+ },
602
+ },
603
+ drainage: {
604
+ mainsSurfaceWaterDrainage: {
605
+ yesNo: "Yes",
606
+ },
607
+ mainsFoulDrainage: {
608
+ yesNo: "No",
609
+ // Missing offMainsDrainageSystem - this should make validation fail
610
+ },
611
+ },
612
+ };
613
+
614
+ const isValid = validator(clonedExampleTransaction);
615
+ expect(isValid).toBe(false);
616
+
617
+ // Check that the validation error is about missing offMainsDrainageSystem
618
+ const relevantError = validator.errors.find(
619
+ (error) =>
620
+ error.instancePath.includes("mainsFoulDrainage") &&
621
+ error.message.includes("offMainsDrainageSystem")
622
+ );
623
+ expect(relevantError).toBeDefined();
624
+ });
625
+
626
+ test("TA7 overlay organisesBuildingInsurance enum has exactly three items", () => {
627
+ const schema = getTransactionSchema(schemaId, ["ta7ed3"]);
628
+
629
+ // Navigate to the organisesBuildingInsurance property in the merged schema
630
+ const organisesBuildingInsurance =
631
+ schema.properties?.propertyPack?.properties?.ownership?.properties
632
+ ?.ownershipsToBeTransferred?.items?.oneOf?.[2]?.properties
633
+ ?.leaseholdInformation?.properties?.contactDetails?.properties
634
+ ?.serviceContactAssignments?.properties?.organisesBuildingInsurance;
635
+
636
+ expect(organisesBuildingInsurance).toBeDefined();
637
+ expect(organisesBuildingInsurance.enum).toBeDefined();
638
+
639
+ // The TA7 overlay defines exactly 3 enum values, which should replace the base schema's 6 values
640
+ expect(organisesBuildingInsurance.enum).toHaveLength(3);
641
+ expect(organisesBuildingInsurance.enum).toEqual([
642
+ "the Lessees",
643
+ "Management Company",
644
+ "Landlord",
645
+ ]);
646
+ });