@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.
- package/charming-napier-57a77c/LICENSE +21 -0
- package/charming-napier-57a77c/README.md +430 -0
- package/charming-napier-57a77c/docs/sef25-extensions-ui-spec.md +355 -0
- package/charming-napier-57a77c/index.js +654 -0
- package/charming-napier-57a77c/package-lock.json +7297 -0
- package/charming-napier-57a77c/package.json +41 -0
- package/charming-napier-57a77c/src/examples/v1/exampleAddParticipantVouch.json +32 -0
- package/charming-napier-57a77c/src/examples/v1/exampleDocumentedVouch.json +40 -0
- package/charming-napier-57a77c/src/examples/v1/exampleElectronicRecord.json +30 -0
- package/charming-napier-57a77c/src/examples/v1/exampleTransaction.json +878 -0
- package/charming-napier-57a77c/src/examples/v1/exampleVouch.json +25 -0
- package/charming-napier-57a77c/src/examples/v2/exampleTransaction.json +901 -0
- package/charming-napier-57a77c/src/examples/v3/exampleAddParticipantVouch.json +38 -0
- package/charming-napier-57a77c/src/examples/v3/exampleCustomOverlay.json +55 -0
- package/charming-napier-57a77c/src/examples/v3/exampleCustomOverlay2.json +93 -0
- package/charming-napier-57a77c/src/examples/v3/exampleDocumentedVouch.json +47 -0
- package/charming-napier-57a77c/src/examples/v3/exampleElectronicRecord.json +36 -0
- package/charming-napier-57a77c/src/examples/v3/exampleTransaction.json +1038 -0
- package/charming-napier-57a77c/src/examples/v3/exampleVouch.json +32 -0
- package/charming-napier-57a77c/src/mappings/SendPropertyDetailsRequestSchema.json +1588 -0
- package/charming-napier-57a77c/src/mappings/adf.js +198 -0
- package/charming-napier-57a77c/src/schemas/v1/GeoJSON.json +1279 -0
- package/charming-napier-57a77c/src/schemas/v1/baspiNotes.html +102 -0
- package/charming-napier-57a77c/src/schemas/v1/energy-performance-certificate.json +124 -0
- package/charming-napier-57a77c/src/schemas/v1/freehold-information.json +2051 -0
- package/charming-napier-57a77c/src/schemas/v1/leasehold-information.json +2064 -0
- package/charming-napier-57a77c/src/schemas/v1/legal-information.json +1045 -0
- package/charming-napier-57a77c/src/schemas/v1/material-facts.json +2109 -0
- package/charming-napier-57a77c/src/schemas/v1/pdtf-transaction-search-results.json +40 -0
- package/charming-napier-57a77c/src/schemas/v1/pdtf-transaction.json +191 -0
- package/charming-napier-57a77c/src/schemas/v1/searches/drainage-and-water.json +261 -0
- package/charming-napier-57a77c/src/schemas/v1/searches/local-land-charges.json +69 -0
- package/charming-napier-57a77c/src/schemas/v1/searches/local-searches-required.json +857 -0
- package/charming-napier-57a77c/src/schemas/v1/searches.json +237 -0
- package/charming-napier-57a77c/src/schemas/v1/title-deed.json +841 -0
- package/charming-napier-57a77c/src/schemas/v2/baspiNotes.html +102 -0
- package/charming-napier-57a77c/src/schemas/v2/combined.json +37731 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/baspi.json +8132 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/con29DW.json +705 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/con29R.json +2956 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/fme1.json +1259 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/llc1.json +25 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/lpe1.json +2171 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/nts.json +326 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/oc1.json +2799 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/piq.json +3419 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/rds.json +3736 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/ta10.json +5306 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/ta6.json +4533 -0
- package/charming-napier-57a77c/src/schemas/v2/overlays/ta7.json +1045 -0
- package/charming-napier-57a77c/src/schemas/v2/pdtf-transaction.json +34351 -0
- package/charming-napier-57a77c/src/schemas/v2/skeleton.json +3973 -0
- package/charming-napier-57a77c/src/schemas/v3/combined.json +48153 -0
- package/charming-napier-57a77c/src/schemas/v3/compactSkeleton.txt +4457 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/README.md +299 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/baspi4.json +8027 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/baspi5.json +8177 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/con29DW.json +716 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/con29R.json +2981 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/ac.json +333 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/as.json +74 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/dk.json +32 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/dr.json +73 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/er.json +85 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/fd.json +75 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/hi.json +51 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/hs.json +73 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/ic.json +59 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/jk.json +96 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/la.json +85 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/lc.json +75 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/ma.json +90 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/mc.json +38 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/mi.json +69 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/nd.json +43 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/oa.json +24 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/oc.json +57 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/pc.json +37 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/ph.json +194 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/rw.json +68 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/sb.json +73 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/sc.json +129 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/sd.json +63 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/sf.json +74 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/sl.json +68 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/ta.json +240 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/tf.json +103 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/tr.json +73 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/extensions/wg.json +350 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/fme1.json +1266 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/llc1.json +25 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/lpe1.json +2199 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/nts.json +2157 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/nts2.json +2742 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/ntsl.json +1813 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/ntsl2.json +2217 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/oc1.json +2817 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/piq.json +3321 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/rds.json +3665 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/sef25.json +1639 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/sr24.json +38 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/ta10.json +4654 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/ta6.json +4568 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/ta6ed6.json +6537 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/ta7.json +1537 -0
- package/charming-napier-57a77c/src/schemas/v3/overlays/ta7ed5.json +1551 -0
- package/charming-napier-57a77c/src/schemas/v3/pdtf-transaction.json +41229 -0
- package/charming-napier-57a77c/src/schemas/v3/skeleton.json +5703 -0
- package/charming-napier-57a77c/src/schemas/verifiedClaims/README.md +21 -0
- package/charming-napier-57a77c/src/schemas/verifiedClaims/pdtf-verified-claims.json +447 -0
- package/charming-napier-57a77c/src/tests/v3/buyerCircumstances.test.js +543 -0
- package/charming-napier-57a77c/src/tests/v3/caching.test.js +591 -0
- package/charming-napier-57a77c/src/tests/v3/enquiries.test.js +1096 -0
- package/charming-napier-57a77c/src/tests/v3/extensionOverlays.test.js +1599 -0
- package/charming-napier-57a77c/src/tests/v3/offers.test.js +823 -0
- package/charming-napier-57a77c/src/tests/v3/patternProperties.test.js +688 -0
- package/charming-napier-57a77c/src/tests/v3/ta6ed6.test.js +2374 -0
- package/charming-napier-57a77c/src/tests/v3/ta7ed5.test.js +600 -0
- package/charming-napier-57a77c/src/tests/v3/transactionSchema.test.js +646 -0
- package/charming-napier-57a77c/src/tests/v3/verifiedClaimsValidator.test.js +195 -0
- package/charming-napier-57a77c/src/utils/compactSkeleton.js +84 -0
- package/charming-napier-57a77c/src/utils/countTokens.js +67 -0
- package/charming-napier-57a77c/src/utils/extractExtensionOverlays.js +624 -0
- package/charming-napier-57a77c/src/utils/extractOverlay.js +381 -0
- package/charming-napier-57a77c/src/utils/extractProperties.js +44 -0
- package/charming-napier-57a77c/src/utils/listPathTitles.js +36 -0
- package/charming-napier-57a77c/src/utils/minimalSkeleton.js +85 -0
- package/charming-napier-57a77c/src/utils/pathList.csv +903 -0
- package/charming-napier-57a77c/src/utils/pathSkeleton.js +181 -0
- package/compassionate-easley-bafb14/CLAUDE.md +101 -0
- package/compassionate-easley-bafb14/LICENSE +21 -0
- package/compassionate-easley-bafb14/README.md +435 -0
- package/compassionate-easley-bafb14/docs/branch-release-workflow.md +138 -0
- package/compassionate-easley-bafb14/docs/sef25-extensions-ui-spec.md +355 -0
- package/compassionate-easley-bafb14/index.js +654 -0
- package/compassionate-easley-bafb14/package-lock.json +7297 -0
- package/compassionate-easley-bafb14/package.json +44 -0
- package/compassionate-easley-bafb14/src/examples/v1/exampleAddParticipantVouch.json +32 -0
- package/compassionate-easley-bafb14/src/examples/v1/exampleDocumentedVouch.json +40 -0
- package/compassionate-easley-bafb14/src/examples/v1/exampleElectronicRecord.json +30 -0
- package/compassionate-easley-bafb14/src/examples/v1/exampleTransaction.json +878 -0
- package/compassionate-easley-bafb14/src/examples/v1/exampleVouch.json +25 -0
- package/compassionate-easley-bafb14/src/examples/v2/exampleTransaction.json +901 -0
- package/compassionate-easley-bafb14/src/examples/v3/exampleAddParticipantVouch.json +38 -0
- package/compassionate-easley-bafb14/src/examples/v3/exampleCustomOverlay.json +55 -0
- package/compassionate-easley-bafb14/src/examples/v3/exampleCustomOverlay2.json +93 -0
- package/compassionate-easley-bafb14/src/examples/v3/exampleDocumentedVouch.json +47 -0
- package/compassionate-easley-bafb14/src/examples/v3/exampleElectronicRecord.json +36 -0
- package/compassionate-easley-bafb14/src/examples/v3/exampleTransaction.json +1038 -0
- package/compassionate-easley-bafb14/src/examples/v3/exampleVouch.json +32 -0
- package/compassionate-easley-bafb14/src/mappings/SendPropertyDetailsRequestSchema.json +1588 -0
- package/compassionate-easley-bafb14/src/mappings/adf.js +198 -0
- package/compassionate-easley-bafb14/src/schemas/v1/GeoJSON.json +1279 -0
- package/compassionate-easley-bafb14/src/schemas/v1/baspiNotes.html +102 -0
- package/compassionate-easley-bafb14/src/schemas/v1/energy-performance-certificate.json +124 -0
- package/compassionate-easley-bafb14/src/schemas/v1/freehold-information.json +2051 -0
- package/compassionate-easley-bafb14/src/schemas/v1/leasehold-information.json +2064 -0
- package/compassionate-easley-bafb14/src/schemas/v1/legal-information.json +1045 -0
- package/compassionate-easley-bafb14/src/schemas/v1/material-facts.json +2109 -0
- package/compassionate-easley-bafb14/src/schemas/v1/pdtf-transaction-search-results.json +40 -0
- package/compassionate-easley-bafb14/src/schemas/v1/pdtf-transaction.json +191 -0
- package/compassionate-easley-bafb14/src/schemas/v1/searches/drainage-and-water.json +261 -0
- package/compassionate-easley-bafb14/src/schemas/v1/searches/local-land-charges.json +69 -0
- package/compassionate-easley-bafb14/src/schemas/v1/searches/local-searches-required.json +857 -0
- package/compassionate-easley-bafb14/src/schemas/v1/searches.json +237 -0
- package/compassionate-easley-bafb14/src/schemas/v1/title-deed.json +841 -0
- package/compassionate-easley-bafb14/src/schemas/v2/baspiNotes.html +102 -0
- package/compassionate-easley-bafb14/src/schemas/v2/combined.json +37731 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/baspi.json +8132 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/con29DW.json +705 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/con29R.json +2956 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/fme1.json +1259 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/llc1.json +25 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/lpe1.json +2171 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/nts.json +326 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/oc1.json +2799 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/piq.json +3419 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/rds.json +3736 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/ta10.json +5306 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/ta6.json +4533 -0
- package/compassionate-easley-bafb14/src/schemas/v2/overlays/ta7.json +1045 -0
- package/compassionate-easley-bafb14/src/schemas/v2/pdtf-transaction.json +34351 -0
- package/compassionate-easley-bafb14/src/schemas/v2/skeleton.json +3973 -0
- package/compassionate-easley-bafb14/src/schemas/v3/combined.json +48461 -0
- package/compassionate-easley-bafb14/src/schemas/v3/compactSkeleton.txt +4519 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/README.md +299 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/baspi4.json +8030 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/baspi5.json +8180 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/con29DW.json +716 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/con29R.json +2981 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/ac.json +334 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/as.json +74 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/dk.json +33 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/dr.json +73 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/er.json +85 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/fd.json +75 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/hi.json +51 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/hs.json +73 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/ic.json +83 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/jk.json +96 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/la.json +85 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/lc.json +76 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/ma.json +90 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/mc.json +38 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/mi.json +70 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/nd.json +44 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/oa.json +24 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/oc.json +57 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/pc.json +38 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/ph.json +195 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/rw.json +69 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/sb.json +73 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/sc.json +133 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/sd.json +64 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/sf.json +74 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/sl.json +68 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/ta.json +204 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/tf.json +103 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/tr.json +74 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/extensions/wg.json +351 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/fme1.json +1266 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/llc1.json +25 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/lpe1.json +2199 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/nts.json +2159 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/nts2.json +2744 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/ntsl.json +1815 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/ntsl2.json +2219 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/oc1.json +2817 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/piq.json +3324 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/rds.json +3668 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/sef25.json +1644 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/sr24.json +38 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/ta10.json +4645 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/ta6.json +4572 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/ta6ed6.json +6536 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/ta7.json +1537 -0
- package/compassionate-easley-bafb14/src/schemas/v3/overlays/ta7ed5.json +1551 -0
- package/compassionate-easley-bafb14/src/schemas/v3/pdtf-transaction.json +41570 -0
- package/compassionate-easley-bafb14/src/schemas/v3/skeleton.json +5767 -0
- package/compassionate-easley-bafb14/src/schemas/verifiedClaims/README.md +21 -0
- package/compassionate-easley-bafb14/src/schemas/verifiedClaims/pdtf-verified-claims.json +447 -0
- package/compassionate-easley-bafb14/src/utils/compactSkeleton.js +84 -0
- package/compassionate-easley-bafb14/src/utils/countTokens.js +67 -0
- package/compassionate-easley-bafb14/src/utils/extractExtensionOverlays.js +633 -0
- package/compassionate-easley-bafb14/src/utils/extractOverlay.js +381 -0
- package/compassionate-easley-bafb14/src/utils/extractProperties.js +44 -0
- package/compassionate-easley-bafb14/src/utils/listPathTitles.js +36 -0
- package/compassionate-easley-bafb14/src/utils/minimalSkeleton.js +85 -0
- package/compassionate-easley-bafb14/src/utils/pathList.csv +903 -0
- package/compassionate-easley-bafb14/src/utils/pathSkeleton.js +181 -0
- package/package.json +1 -1
- package/src/schemas/v3/combined.json +9 -15
- package/src/schemas/v3/overlays/baspi4.json +12 -7
- package/src/schemas/v3/overlays/baspi5.json +12 -7
- package/src/schemas/v3/overlays/extensions/ac.json +2 -1
- package/src/schemas/v3/overlays/extensions/dk.json +3 -2
- package/src/schemas/v3/overlays/extensions/ic.json +33 -9
- package/src/schemas/v3/overlays/extensions/lc.json +3 -2
- package/src/schemas/v3/overlays/extensions/mi.json +2 -1
- package/src/schemas/v3/overlays/extensions/nd.json +3 -2
- package/src/schemas/v3/overlays/extensions/pc.json +3 -2
- package/src/schemas/v3/overlays/extensions/ph.json +2 -1
- package/src/schemas/v3/overlays/extensions/rw.json +4 -3
- package/src/schemas/v3/overlays/extensions/sc.json +8 -4
- package/src/schemas/v3/overlays/extensions/sd.json +3 -2
- package/src/schemas/v3/overlays/extensions/tr.json +3 -2
- package/src/schemas/v3/overlays/extensions/wg.json +2 -1
- package/src/schemas/v3/overlays/lpe1.json +1 -1
- package/src/schemas/v3/overlays/nts.json +3 -1
- package/src/schemas/v3/overlays/nts2.json +3 -1
- package/src/schemas/v3/overlays/ntsl.json +3 -1
- package/src/schemas/v3/overlays/ntsl2.json +3 -1
- package/src/schemas/v3/overlays/piq.json +7 -5
- package/src/schemas/v3/overlays/rds.json +9 -6
- package/src/schemas/v3/overlays/sef25.json +6 -1
- package/src/schemas/v3/overlays/ta10.json +0 -9
- package/src/schemas/v3/overlays/ta6.json +8 -4
- package/src/schemas/v3/overlays/ta6ed6.json +4 -2
- package/src/schemas/v3/pdtf-transaction.json +15 -18
- package/src/utils/extractExtensionOverlays.js +11 -2
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
const {
|
|
2
|
+
getSubschema,
|
|
3
|
+
getSubschemaValidator,
|
|
4
|
+
getCacheStats,
|
|
5
|
+
getDetailedCacheStats,
|
|
6
|
+
clearSchemaCache,
|
|
7
|
+
warmupCache,
|
|
8
|
+
pruneCacheByAge,
|
|
9
|
+
setCacheMaxSize,
|
|
10
|
+
isPathValid,
|
|
11
|
+
} = require("../../../index");
|
|
12
|
+
|
|
13
|
+
describe("Schema Caching System", () => {
|
|
14
|
+
const schemaId = "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json";
|
|
15
|
+
const testPath = "/propertyPack/surveys";
|
|
16
|
+
const overlays = ["baspiV5", "ta6ed4"];
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
clearSchemaCache();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe("Cache Hit/Miss Behavior", () => {
|
|
23
|
+
test("should start with empty cache", () => {
|
|
24
|
+
const stats = getCacheStats();
|
|
25
|
+
expect(stats.totalEntries).toBe(0);
|
|
26
|
+
expect(stats.cacheKeys).toEqual([]);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("should cache subschema on first call", () => {
|
|
30
|
+
// First call should populate cache
|
|
31
|
+
const schema1 = getSubschema(testPath, schemaId, overlays);
|
|
32
|
+
|
|
33
|
+
const stats = getCacheStats();
|
|
34
|
+
expect(stats.totalEntries).toBe(1);
|
|
35
|
+
expect(stats.cacheKeys).toHaveLength(1);
|
|
36
|
+
expect(stats.cacheKeys[0]).toContain(testPath);
|
|
37
|
+
expect(stats.cacheKeys[0]).toContain("baspiV5.ta6ed4");
|
|
38
|
+
|
|
39
|
+
// Second call should return cached version
|
|
40
|
+
const schema2 = getSubschema(testPath, schemaId, overlays);
|
|
41
|
+
|
|
42
|
+
// Same object reference indicates cache hit
|
|
43
|
+
expect(schema1).toBe(schema2);
|
|
44
|
+
|
|
45
|
+
// Cache size shouldn't change
|
|
46
|
+
const stats2 = getCacheStats();
|
|
47
|
+
expect(stats2.totalEntries).toBe(1);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("should cache validator on first call", () => {
|
|
51
|
+
// First call should populate cache
|
|
52
|
+
const validator1 = getSubschemaValidator(testPath, schemaId, overlays);
|
|
53
|
+
|
|
54
|
+
const stats = getCacheStats();
|
|
55
|
+
expect(stats.totalEntries).toBe(1);
|
|
56
|
+
|
|
57
|
+
// Second call should return cached version
|
|
58
|
+
const validator2 = getSubschemaValidator(testPath, schemaId, overlays);
|
|
59
|
+
|
|
60
|
+
// Same object reference indicates cache hit
|
|
61
|
+
expect(validator1).toBe(validator2);
|
|
62
|
+
|
|
63
|
+
// Cache size shouldn't change
|
|
64
|
+
const stats2 = getCacheStats();
|
|
65
|
+
expect(stats2.totalEntries).toBe(1);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("should create separate cache entries for different paths", () => {
|
|
69
|
+
const path1 = "/participants";
|
|
70
|
+
const path2 = "/propertyPack/surveys";
|
|
71
|
+
const path3 = "/status";
|
|
72
|
+
|
|
73
|
+
getSubschema(path1, schemaId, overlays);
|
|
74
|
+
getSubschema(path2, schemaId, overlays);
|
|
75
|
+
getSubschema(path3, schemaId, overlays);
|
|
76
|
+
|
|
77
|
+
const stats = getCacheStats();
|
|
78
|
+
expect(stats.totalEntries).toBe(3);
|
|
79
|
+
expect(stats.cacheKeys.some(key => key.includes(path1))).toBe(true);
|
|
80
|
+
expect(stats.cacheKeys.some(key => key.includes(path2))).toBe(true);
|
|
81
|
+
expect(stats.cacheKeys.some(key => key.includes(path3))).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test("should create separate cache entries for different overlays", () => {
|
|
85
|
+
const overlays1 = ["baspiV5"];
|
|
86
|
+
const overlays2 = ["ta6ed4"];
|
|
87
|
+
const overlays3 = ["baspiV5", "ta6ed4"];
|
|
88
|
+
|
|
89
|
+
getSubschema(testPath, schemaId, overlays1);
|
|
90
|
+
getSubschema(testPath, schemaId, overlays2);
|
|
91
|
+
getSubschema(testPath, schemaId, overlays3);
|
|
92
|
+
|
|
93
|
+
const stats = getCacheStats();
|
|
94
|
+
expect(stats.totalEntries).toBe(3);
|
|
95
|
+
expect(stats.cacheKeys.some(key => key.includes("baspiV5"))).toBe(true);
|
|
96
|
+
expect(stats.cacheKeys.some(key => key.includes("ta6ed4"))).toBe(true);
|
|
97
|
+
expect(stats.cacheKeys.some(key => key.includes("baspiV5.ta6ed4"))).toBe(true);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("should handle null/empty overlays consistently", () => {
|
|
101
|
+
getSubschema(testPath, schemaId, null);
|
|
102
|
+
getSubschema(testPath, schemaId, []);
|
|
103
|
+
getSubschema(testPath, schemaId, undefined);
|
|
104
|
+
|
|
105
|
+
const stats = getCacheStats();
|
|
106
|
+
// Should create separate entries for each null-equivalent
|
|
107
|
+
expect(stats.totalEntries).toBeGreaterThan(0);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe("Cache Management Functions", () => {
|
|
112
|
+
test("getCacheStats should return accurate information", () => {
|
|
113
|
+
// Start with empty cache
|
|
114
|
+
let stats = getCacheStats();
|
|
115
|
+
expect(stats).toHaveProperty("totalEntries");
|
|
116
|
+
expect(stats).toHaveProperty("cacheKeys");
|
|
117
|
+
expect(stats.totalEntries).toBe(0);
|
|
118
|
+
expect(Array.isArray(stats.cacheKeys)).toBe(true);
|
|
119
|
+
|
|
120
|
+
// Add some entries
|
|
121
|
+
getSubschema("/property", schemaId, ["baspiV5"]);
|
|
122
|
+
getSubschema("/property/propertyPack", schemaId, ["ta6ed4"]);
|
|
123
|
+
|
|
124
|
+
stats = getCacheStats();
|
|
125
|
+
expect(stats.totalEntries).toBe(2);
|
|
126
|
+
expect(stats.cacheKeys).toHaveLength(2);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test("clearSchemaCache should empty the cache", () => {
|
|
130
|
+
// Populate cache
|
|
131
|
+
getSubschema(testPath, schemaId, overlays);
|
|
132
|
+
getSubschemaValidator(testPath, schemaId, overlays);
|
|
133
|
+
|
|
134
|
+
let stats = getCacheStats();
|
|
135
|
+
expect(stats.totalEntries).toBe(1);
|
|
136
|
+
|
|
137
|
+
// Clear cache
|
|
138
|
+
clearSchemaCache();
|
|
139
|
+
|
|
140
|
+
stats = getCacheStats();
|
|
141
|
+
expect(stats.totalEntries).toBe(0);
|
|
142
|
+
expect(stats.cacheKeys).toEqual([]);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test("should rebuild cache after clearing", () => {
|
|
146
|
+
// Populate cache
|
|
147
|
+
const schema1 = getSubschema(testPath, schemaId, overlays);
|
|
148
|
+
|
|
149
|
+
// Clear cache
|
|
150
|
+
clearSchemaCache();
|
|
151
|
+
|
|
152
|
+
// Get schema again - should recompute
|
|
153
|
+
const schema2 = getSubschema(testPath, schemaId, overlays);
|
|
154
|
+
|
|
155
|
+
// Should be equivalent content
|
|
156
|
+
expect(schema1).toEqual(schema2);
|
|
157
|
+
// Note: The actual schema content may be the same object due to how schemas are stored,
|
|
158
|
+
// but cache entry should be recreated
|
|
159
|
+
|
|
160
|
+
const stats = getCacheStats();
|
|
161
|
+
expect(stats.totalEntries).toBe(1);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
describe("Schema Identity and Validator Consistency", () => {
|
|
166
|
+
test("cached schemas should be identical objects", () => {
|
|
167
|
+
const schema1 = getSubschema(testPath, schemaId, overlays);
|
|
168
|
+
const schema2 = getSubschema(testPath, schemaId, overlays);
|
|
169
|
+
const schema3 = getSubschema(testPath, schemaId, overlays);
|
|
170
|
+
|
|
171
|
+
expect(schema1).toBe(schema2);
|
|
172
|
+
expect(schema2).toBe(schema3);
|
|
173
|
+
expect(schema1).toBe(schema3);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test("cached validators should be identical objects", () => {
|
|
177
|
+
const validator1 = getSubschemaValidator(testPath, schemaId, overlays);
|
|
178
|
+
const validator2 = getSubschemaValidator(testPath, schemaId, overlays);
|
|
179
|
+
const validator3 = getSubschemaValidator(testPath, schemaId, overlays);
|
|
180
|
+
|
|
181
|
+
expect(validator1).toBe(validator2);
|
|
182
|
+
expect(validator2).toBe(validator3);
|
|
183
|
+
expect(validator1).toBe(validator3);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test("mixed calls should use same cached data", () => {
|
|
187
|
+
// First get schema
|
|
188
|
+
const schema = getSubschema(testPath, schemaId, overlays);
|
|
189
|
+
|
|
190
|
+
// Then get validator - should use same cache entry
|
|
191
|
+
const validator = getSubschemaValidator(testPath, schemaId, overlays);
|
|
192
|
+
|
|
193
|
+
// Then get schema again
|
|
194
|
+
const schema2 = getSubschema(testPath, schemaId, overlays);
|
|
195
|
+
|
|
196
|
+
expect(schema).toBe(schema2);
|
|
197
|
+
expect(typeof validator).toBe("function");
|
|
198
|
+
|
|
199
|
+
// Should still be only one cache entry
|
|
200
|
+
const stats = getCacheStats();
|
|
201
|
+
expect(stats.totalEntries).toBe(1);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test("validators should work correctly with cached schemas", () => {
|
|
205
|
+
// Use a path that exists - status
|
|
206
|
+
const validator = getSubschemaValidator("/status", schemaId, overlays);
|
|
207
|
+
|
|
208
|
+
// Test that the validator is a function
|
|
209
|
+
expect(typeof validator).toBe("function");
|
|
210
|
+
|
|
211
|
+
// Test with a valid status value
|
|
212
|
+
const result = validator("active");
|
|
213
|
+
|
|
214
|
+
// The validator should exist and be callable
|
|
215
|
+
expect(typeof result).toBe("boolean");
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
describe("Integration with Existing Functions", () => {
|
|
220
|
+
test("isPathValid should work with cached schemas", () => {
|
|
221
|
+
// Use a path that definitely exists
|
|
222
|
+
const validPath = "/participants";
|
|
223
|
+
|
|
224
|
+
// First call will populate cache
|
|
225
|
+
const isValid1 = isPathValid(validPath, schemaId, overlays);
|
|
226
|
+
|
|
227
|
+
// Second call should use cache
|
|
228
|
+
const isValid2 = isPathValid(validPath, schemaId, overlays);
|
|
229
|
+
|
|
230
|
+
expect(isValid1).toBe(isValid2);
|
|
231
|
+
expect(isValid1).toBe(true);
|
|
232
|
+
|
|
233
|
+
// Should have cached entry
|
|
234
|
+
const stats = getCacheStats();
|
|
235
|
+
expect(stats.totalEntries).toBeGreaterThan(0);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
test("should handle invalid paths gracefully", () => {
|
|
239
|
+
const invalidPath = "/nonexistent/path/here";
|
|
240
|
+
|
|
241
|
+
const schema = getSubschema(invalidPath, schemaId, overlays);
|
|
242
|
+
const validator = getSubschemaValidator(invalidPath, schemaId, overlays);
|
|
243
|
+
const isValid = isPathValid(invalidPath, schemaId, overlays);
|
|
244
|
+
|
|
245
|
+
expect(schema).toBeUndefined();
|
|
246
|
+
expect(typeof validator).toBe("function");
|
|
247
|
+
expect(isValid).toBe(false);
|
|
248
|
+
|
|
249
|
+
// Should still cache the result
|
|
250
|
+
const stats = getCacheStats();
|
|
251
|
+
expect(stats.totalEntries).toBe(1);
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
describe("Performance Characteristics", () => {
|
|
256
|
+
test("should demonstrate significant speedup on cached calls", () => {
|
|
257
|
+
const iterations = 10;
|
|
258
|
+
|
|
259
|
+
// First call (cold cache)
|
|
260
|
+
const start1 = process.hrtime.bigint();
|
|
261
|
+
for (let i = 0; i < iterations; i++) {
|
|
262
|
+
clearSchemaCache();
|
|
263
|
+
getSubschema(testPath, schemaId, overlays);
|
|
264
|
+
}
|
|
265
|
+
const end1 = process.hrtime.bigint();
|
|
266
|
+
const coldTime = Number(end1 - start1) / 1_000_000; // Convert to milliseconds
|
|
267
|
+
|
|
268
|
+
// Warm up cache
|
|
269
|
+
getSubschema(testPath, schemaId, overlays);
|
|
270
|
+
|
|
271
|
+
// Subsequent calls (warm cache)
|
|
272
|
+
const start2 = process.hrtime.bigint();
|
|
273
|
+
for (let i = 0; i < iterations; i++) {
|
|
274
|
+
getSubschema(testPath, schemaId, overlays);
|
|
275
|
+
}
|
|
276
|
+
const end2 = process.hrtime.bigint();
|
|
277
|
+
const warmTime = Number(end2 - start2) / 1_000_000; // Convert to milliseconds
|
|
278
|
+
|
|
279
|
+
// Warm cache should be significantly faster
|
|
280
|
+
expect(warmTime).toBeLessThan(coldTime / 10); // At least 10x faster
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
test("cache should scale well with multiple entries", () => {
|
|
284
|
+
const paths = [
|
|
285
|
+
"/participants",
|
|
286
|
+
"/status",
|
|
287
|
+
"/propertyPack/surveys",
|
|
288
|
+
"/propertyPack/valuations",
|
|
289
|
+
];
|
|
290
|
+
|
|
291
|
+
const overlaySet = [
|
|
292
|
+
["baspiV5"],
|
|
293
|
+
["ta6ed4"],
|
|
294
|
+
["baspiV5", "ta6ed4"],
|
|
295
|
+
];
|
|
296
|
+
|
|
297
|
+
// Populate cache with multiple combinations
|
|
298
|
+
paths.forEach(path => {
|
|
299
|
+
overlaySet.forEach(overlays => {
|
|
300
|
+
getSubschema(path, schemaId, overlays);
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
const stats = getCacheStats();
|
|
305
|
+
expect(stats.totalEntries).toBe(paths.length * overlaySet.length);
|
|
306
|
+
|
|
307
|
+
// All subsequent calls should be fast
|
|
308
|
+
const start = process.hrtime.bigint();
|
|
309
|
+
paths.forEach(path => {
|
|
310
|
+
overlaySet.forEach(overlays => {
|
|
311
|
+
getSubschema(path, schemaId, overlays);
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
const end = process.hrtime.bigint();
|
|
315
|
+
const timeMs = Number(end - start) / 1_000_000;
|
|
316
|
+
|
|
317
|
+
// Should be very fast (less than 1ms total for all cached calls)
|
|
318
|
+
expect(timeMs).toBeLessThan(1);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
describe("Enhanced Cache Management", () => {
|
|
323
|
+
beforeEach(() => {
|
|
324
|
+
clearSchemaCache();
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
describe("Enhanced Statistics", () => {
|
|
328
|
+
test("should track hit/miss statistics", () => {
|
|
329
|
+
const stats1 = getCacheStats();
|
|
330
|
+
expect(stats1.hits).toBe(0);
|
|
331
|
+
expect(stats1.misses).toBe(0);
|
|
332
|
+
expect(stats1.totalQueries).toBe(0);
|
|
333
|
+
expect(stats1.hitRate).toBe(0);
|
|
334
|
+
|
|
335
|
+
// First call should be a miss
|
|
336
|
+
getSubschema(testPath, schemaId, overlays);
|
|
337
|
+
const stats2 = getCacheStats();
|
|
338
|
+
expect(stats2.misses).toBe(1);
|
|
339
|
+
expect(stats2.hits).toBe(0);
|
|
340
|
+
expect(stats2.totalQueries).toBe(1);
|
|
341
|
+
expect(stats2.hitRate).toBe(0);
|
|
342
|
+
|
|
343
|
+
// Second call should be a hit
|
|
344
|
+
getSubschema(testPath, schemaId, overlays);
|
|
345
|
+
const stats3 = getCacheStats();
|
|
346
|
+
expect(stats3.misses).toBe(1);
|
|
347
|
+
expect(stats3.hits).toBe(1);
|
|
348
|
+
expect(stats3.totalQueries).toBe(2);
|
|
349
|
+
expect(stats3.hitRate).toBe(50);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
test("should provide detailed cache statistics", () => {
|
|
353
|
+
// Add some entries using safe paths
|
|
354
|
+
getSubschema("/participants", schemaId, []);
|
|
355
|
+
getSubschema("/status", schemaId, []);
|
|
356
|
+
|
|
357
|
+
const detailedStats = getDetailedCacheStats();
|
|
358
|
+
|
|
359
|
+
expect(detailedStats).toHaveProperty("totalEntries");
|
|
360
|
+
expect(detailedStats).toHaveProperty("hits");
|
|
361
|
+
expect(detailedStats).toHaveProperty("misses");
|
|
362
|
+
expect(detailedStats).toHaveProperty("hitRate");
|
|
363
|
+
expect(detailedStats).toHaveProperty("entries");
|
|
364
|
+
expect(detailedStats).toHaveProperty("oldestEntry");
|
|
365
|
+
expect(detailedStats).toHaveProperty("newestEntry");
|
|
366
|
+
|
|
367
|
+
expect(detailedStats.entries).toHaveLength(2);
|
|
368
|
+
expect(detailedStats.entries[0]).toHaveProperty("key");
|
|
369
|
+
expect(detailedStats.entries[0]).toHaveProperty("createdAt");
|
|
370
|
+
expect(detailedStats.entries[0]).toHaveProperty("age");
|
|
371
|
+
expect(detailedStats.entries[0]).toHaveProperty("hasValidator");
|
|
372
|
+
expect(detailedStats.entries[0]).toHaveProperty("hasSubSchema");
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
test("should track memory usage estimates", () => {
|
|
376
|
+
getSubschema(testPath, schemaId, overlays);
|
|
377
|
+
|
|
378
|
+
const stats = getCacheStats();
|
|
379
|
+
expect(stats.memoryUsage).toHaveProperty("entriesCount");
|
|
380
|
+
expect(stats.memoryUsage).toHaveProperty("estimatedSizeKB");
|
|
381
|
+
expect(stats.memoryUsage.entriesCount).toBe(1);
|
|
382
|
+
expect(typeof stats.memoryUsage.estimatedSizeKB).toBe("number");
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
describe("Cache Warming", () => {
|
|
387
|
+
test("should warm cache with default paths and overlays", () => {
|
|
388
|
+
const warmupStats = warmupCache();
|
|
389
|
+
|
|
390
|
+
expect(warmupStats).toHaveProperty("totalAttempted");
|
|
391
|
+
expect(warmupStats).toHaveProperty("successful");
|
|
392
|
+
expect(warmupStats).toHaveProperty("failed");
|
|
393
|
+
expect(warmupStats).toHaveProperty("errors");
|
|
394
|
+
|
|
395
|
+
expect(warmupStats.totalAttempted).toBeGreaterThan(0);
|
|
396
|
+
expect(warmupStats.successful).toBeGreaterThan(0);
|
|
397
|
+
expect(warmupStats.totalAttempted).toBe(warmupStats.successful + warmupStats.failed);
|
|
398
|
+
|
|
399
|
+
// Cache should now have entries
|
|
400
|
+
const stats = getCacheStats();
|
|
401
|
+
expect(stats.totalEntries).toBeGreaterThan(0);
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
test("should warm cache with custom paths and overlays", () => {
|
|
405
|
+
const customPaths = ["/propertyPack", "/participants"];
|
|
406
|
+
const customOverlays = [[], ["baspiV5"]];
|
|
407
|
+
|
|
408
|
+
const warmupStats = warmupCache(customPaths, schemaId, customOverlays);
|
|
409
|
+
|
|
410
|
+
expect(warmupStats.totalAttempted).toBe(customPaths.length * customOverlays.length);
|
|
411
|
+
expect(warmupStats.successful).toBeGreaterThan(0);
|
|
412
|
+
|
|
413
|
+
const stats = getCacheStats();
|
|
414
|
+
expect(stats.totalEntries).toBe(warmupStats.successful);
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
test("should handle invalid paths gracefully during warmup", () => {
|
|
418
|
+
const pathsWithInvalid = ["/participants", "/invalid/path", "/status"];
|
|
419
|
+
const warmupStats = warmupCache(pathsWithInvalid, schemaId, [[]]);
|
|
420
|
+
|
|
421
|
+
expect(warmupStats.totalAttempted).toBe(3);
|
|
422
|
+
expect(warmupStats.successful).toBe(3); // All paths are processed, even invalid ones
|
|
423
|
+
expect(warmupStats.failed).toBe(0); // Invalid paths still "succeed" but create null schemas
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
describe("Selective Cache Clearing", () => {
|
|
428
|
+
test("should clear cache entries by pattern", () => {
|
|
429
|
+
// Populate cache with different patterns using safe paths
|
|
430
|
+
getSubschema("/participants", schemaId, []);
|
|
431
|
+
getSubschema("/status", schemaId, []);
|
|
432
|
+
getSubschema("/participants", schemaId, ["baspiV5"]);
|
|
433
|
+
|
|
434
|
+
const stats1 = getCacheStats();
|
|
435
|
+
expect(stats1.totalEntries).toBe(3);
|
|
436
|
+
|
|
437
|
+
// Clear entries containing "participants"
|
|
438
|
+
const cleared = clearSchemaCache("participants");
|
|
439
|
+
expect(cleared).toBe(2);
|
|
440
|
+
|
|
441
|
+
const stats2 = getCacheStats();
|
|
442
|
+
expect(stats2.totalEntries).toBe(1);
|
|
443
|
+
|
|
444
|
+
// Remaining entry should be status
|
|
445
|
+
expect(stats2.cacheKeys[0]).toContain("status");
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
test("should return number of entries cleared", () => {
|
|
449
|
+
getSubschema("/participants", schemaId, []);
|
|
450
|
+
getSubschema("/status", schemaId, []);
|
|
451
|
+
|
|
452
|
+
const cleared = clearSchemaCache();
|
|
453
|
+
expect(cleared).toBe(2);
|
|
454
|
+
|
|
455
|
+
const stats = getCacheStats();
|
|
456
|
+
expect(stats.totalEntries).toBe(0);
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
test("should reset statistics when clearing all cache", () => {
|
|
460
|
+
getSubschema(testPath, schemaId, overlays);
|
|
461
|
+
getSubschema(testPath, schemaId, overlays); // Hit
|
|
462
|
+
|
|
463
|
+
const statsBefore = getCacheStats();
|
|
464
|
+
expect(statsBefore.hits).toBe(1);
|
|
465
|
+
expect(statsBefore.misses).toBe(1);
|
|
466
|
+
|
|
467
|
+
clearSchemaCache();
|
|
468
|
+
|
|
469
|
+
const statsAfter = getCacheStats();
|
|
470
|
+
expect(statsAfter.hits).toBe(0);
|
|
471
|
+
expect(statsAfter.misses).toBe(0);
|
|
472
|
+
expect(statsAfter.totalQueries).toBe(0);
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
describe("Cache Pruning", () => {
|
|
477
|
+
test("should prune entries by age", async () => {
|
|
478
|
+
// Add some entries using safe paths
|
|
479
|
+
getSubschema("/participants", schemaId, []);
|
|
480
|
+
|
|
481
|
+
// Wait a bit
|
|
482
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
483
|
+
|
|
484
|
+
getSubschema("/status", schemaId, []);
|
|
485
|
+
|
|
486
|
+
const stats1 = getCacheStats();
|
|
487
|
+
expect(stats1.totalEntries).toBe(2);
|
|
488
|
+
|
|
489
|
+
// Prune entries older than 5ms
|
|
490
|
+
const pruned = pruneCacheByAge(5);
|
|
491
|
+
expect(pruned).toBe(1); // Should remove the older entry
|
|
492
|
+
|
|
493
|
+
const stats2 = getCacheStats();
|
|
494
|
+
expect(stats2.totalEntries).toBe(1);
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
test("should not prune entries younger than max age", () => {
|
|
498
|
+
getSubschema("/participants", schemaId, []);
|
|
499
|
+
|
|
500
|
+
const pruned = pruneCacheByAge(60000); // 1 minute
|
|
501
|
+
expect(pruned).toBe(0);
|
|
502
|
+
|
|
503
|
+
const stats = getCacheStats();
|
|
504
|
+
expect(stats.totalEntries).toBe(1);
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
describe("Cache Size Management", () => {
|
|
509
|
+
test("should limit cache size by removing oldest entries", () => {
|
|
510
|
+
// Add multiple entries using safe paths
|
|
511
|
+
getSubschema("/participants", schemaId, []);
|
|
512
|
+
getSubschema("/status", schemaId, []);
|
|
513
|
+
getSubschema("/participants", schemaId, ["baspiV5"]);
|
|
514
|
+
getSubschema("/status", schemaId, ["baspiV5"]);
|
|
515
|
+
|
|
516
|
+
const stats1 = getCacheStats();
|
|
517
|
+
expect(stats1.totalEntries).toBe(4);
|
|
518
|
+
|
|
519
|
+
// Limit to 2 entries
|
|
520
|
+
const removed = setCacheMaxSize(2);
|
|
521
|
+
expect(removed).toBe(2);
|
|
522
|
+
|
|
523
|
+
const stats2 = getCacheStats();
|
|
524
|
+
expect(stats2.totalEntries).toBe(2);
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
test("should not remove entries if cache is under limit", () => {
|
|
528
|
+
getSubschema("/participants", schemaId, []);
|
|
529
|
+
|
|
530
|
+
const removed = setCacheMaxSize(10);
|
|
531
|
+
expect(removed).toBe(0);
|
|
532
|
+
|
|
533
|
+
const stats = getCacheStats();
|
|
534
|
+
expect(stats.totalEntries).toBe(1);
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
test("should remove oldest entries first", async () => {
|
|
538
|
+
// Add entries with delays to ensure different timestamps
|
|
539
|
+
getSubschema("/participants", schemaId, []);
|
|
540
|
+
await new Promise(resolve => setTimeout(resolve, 5));
|
|
541
|
+
|
|
542
|
+
getSubschema("/status", schemaId, []);
|
|
543
|
+
await new Promise(resolve => setTimeout(resolve, 5));
|
|
544
|
+
|
|
545
|
+
getSubschema("/participants", schemaId, ["baspiV5"]);
|
|
546
|
+
|
|
547
|
+
const stats1 = getCacheStats();
|
|
548
|
+
expect(stats1.totalEntries).toBe(3);
|
|
549
|
+
|
|
550
|
+
// Limit to 1 entry - should keep the newest one
|
|
551
|
+
setCacheMaxSize(1);
|
|
552
|
+
|
|
553
|
+
const stats2 = getCacheStats();
|
|
554
|
+
expect(stats2.totalEntries).toBe(1);
|
|
555
|
+
expect(stats2.cacheKeys[0]).toContain("baspiV5");
|
|
556
|
+
});
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
describe("Integration with Existing Cache Behavior", () => {
|
|
560
|
+
test("enhanced stats should work with existing cache operations", () => {
|
|
561
|
+
// Use existing functions with a safe path
|
|
562
|
+
const safePath = "/participants";
|
|
563
|
+
const validator = getSubschemaValidator(safePath, schemaId, []);
|
|
564
|
+
const schema = getSubschema(safePath, schemaId, []);
|
|
565
|
+
const valid = isPathValid(safePath, schemaId, []);
|
|
566
|
+
|
|
567
|
+
expect(typeof validator).toBe("function");
|
|
568
|
+
expect(schema).toBeDefined();
|
|
569
|
+
expect(valid).toBe(true);
|
|
570
|
+
|
|
571
|
+
const stats = getCacheStats();
|
|
572
|
+
expect(stats.totalQueries).toBeGreaterThan(0);
|
|
573
|
+
expect(stats.hits).toBeGreaterThan(0);
|
|
574
|
+
expect(stats.totalEntries).toBe(1);
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
test("should maintain backward compatibility", () => {
|
|
578
|
+
// Existing test patterns should still work
|
|
579
|
+
const schema1 = getSubschema(testPath, schemaId, overlays);
|
|
580
|
+
const schema2 = getSubschema(testPath, schemaId, overlays);
|
|
581
|
+
|
|
582
|
+
expect(schema1).toBe(schema2);
|
|
583
|
+
|
|
584
|
+
const stats = getCacheStats();
|
|
585
|
+
expect(stats).toHaveProperty("totalEntries");
|
|
586
|
+
expect(stats).toHaveProperty("cacheKeys");
|
|
587
|
+
expect(stats.totalEntries).toBe(1);
|
|
588
|
+
});
|
|
589
|
+
});
|
|
590
|
+
});
|
|
591
|
+
});
|