@nicia-ai/typegraph 0.46.2 → 0.47.0

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 (294) hide show
  1. package/README.md +20 -1
  2. package/dist/backend/drizzle/indexes.cjs +9 -9
  3. package/dist/backend/drizzle/indexes.d.cts +1 -1
  4. package/dist/backend/drizzle/indexes.d.ts +1 -1
  5. package/dist/backend/drizzle/indexes.js +5 -5
  6. package/dist/backend/index.cjs +50 -49
  7. package/dist/backend/index.d.cts +3 -3
  8. package/dist/backend/index.d.ts +3 -3
  9. package/dist/backend/index.js +11 -10
  10. package/dist/backend/postgres/index.cjs +27 -26
  11. package/dist/backend/postgres/index.d.cts +6 -6
  12. package/dist/backend/postgres/index.d.ts +6 -6
  13. package/dist/backend/postgres/index.js +14 -13
  14. package/dist/backend/postgres/pglite-store.cjs +34 -33
  15. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  16. package/dist/backend/postgres/pglite-store.d.cts +8 -8
  17. package/dist/backend/postgres/pglite-store.d.ts +8 -8
  18. package/dist/backend/postgres/pglite-store.js +30 -29
  19. package/dist/backend/postgres/pglite-store.js.map +1 -1
  20. package/dist/backend/postgres/pglite.cjs +16 -15
  21. package/dist/backend/postgres/pglite.d.cts +3 -3
  22. package/dist/backend/postgres/pglite.d.ts +3 -3
  23. package/dist/backend/postgres/pglite.js +15 -14
  24. package/dist/backend/sqlite/index.cjs +24 -23
  25. package/dist/backend/sqlite/index.d.cts +6 -6
  26. package/dist/backend/sqlite/index.d.ts +6 -6
  27. package/dist/backend/sqlite/index.js +12 -11
  28. package/dist/backend/sqlite/libsql.cjs +19 -18
  29. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  30. package/dist/backend/sqlite/libsql.d.cts +3 -3
  31. package/dist/backend/sqlite/libsql.d.ts +3 -3
  32. package/dist/backend/sqlite/libsql.js +14 -13
  33. package/dist/backend/sqlite/libsql.js.map +1 -1
  34. package/dist/backend/sqlite/local-store.cjs +35 -34
  35. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  36. package/dist/backend/sqlite/local-store.d.cts +8 -8
  37. package/dist/backend/sqlite/local-store.d.ts +8 -8
  38. package/dist/backend/sqlite/local-store.js +31 -30
  39. package/dist/backend/sqlite/local-store.js.map +1 -1
  40. package/dist/backend/sqlite/local.cjs +17 -16
  41. package/dist/backend/sqlite/local.d.cts +3 -3
  42. package/dist/backend/sqlite/local.d.ts +3 -3
  43. package/dist/backend/sqlite/local.js +15 -14
  44. package/dist/{chunk-TCT66A7N.cjs → chunk-26YKDNUD.cjs} +10 -10
  45. package/dist/{chunk-TCT66A7N.cjs.map → chunk-26YKDNUD.cjs.map} +1 -1
  46. package/dist/{chunk-QOJ2L2AD.js → chunk-3DMMGT6S.js} +3 -3
  47. package/dist/{chunk-QOJ2L2AD.js.map → chunk-3DMMGT6S.js.map} +1 -1
  48. package/dist/{chunk-ANKOXPCC.cjs → chunk-3HGRTCDU.cjs} +6 -4
  49. package/dist/chunk-3HGRTCDU.cjs.map +1 -0
  50. package/dist/{chunk-QU7QLJA4.cjs → chunk-3U5ABFDW.cjs} +26 -26
  51. package/dist/{chunk-QU7QLJA4.cjs.map → chunk-3U5ABFDW.cjs.map} +1 -1
  52. package/dist/{chunk-5PDSCELM.cjs → chunk-425IZOQ5.cjs} +11 -164
  53. package/dist/chunk-425IZOQ5.cjs.map +1 -0
  54. package/dist/{chunk-S7WIRFNS.cjs → chunk-5FBRVORR.cjs} +12 -12
  55. package/dist/{chunk-S7WIRFNS.cjs.map → chunk-5FBRVORR.cjs.map} +1 -1
  56. package/dist/{chunk-GWXXHOLU.js → chunk-5FT3TLPK.js} +11 -11
  57. package/dist/{chunk-GWXXHOLU.js.map → chunk-5FT3TLPK.js.map} +1 -1
  58. package/dist/{chunk-S3G5VLSW.js → chunk-5UMTUOM5.js} +6 -6
  59. package/dist/{chunk-S3G5VLSW.js.map → chunk-5UMTUOM5.js.map} +1 -1
  60. package/dist/{chunk-RFDEYLIK.js → chunk-6FWSNSRE.js} +7 -7
  61. package/dist/{chunk-RFDEYLIK.js.map → chunk-6FWSNSRE.js.map} +1 -1
  62. package/dist/{chunk-F36KZDFX.cjs → chunk-6JVZSOHQ.cjs} +91 -91
  63. package/dist/{chunk-F36KZDFX.cjs.map → chunk-6JVZSOHQ.cjs.map} +1 -1
  64. package/dist/chunk-6KFLYYOC.cjs +161 -0
  65. package/dist/chunk-6KFLYYOC.cjs.map +1 -0
  66. package/dist/{chunk-D6GCNNMK.cjs → chunk-6NGW27EO.cjs} +10 -10
  67. package/dist/{chunk-D6GCNNMK.cjs.map → chunk-6NGW27EO.cjs.map} +1 -1
  68. package/dist/{chunk-WHS2Y43J.js → chunk-6SWPJEYN.js} +5 -5
  69. package/dist/{chunk-WHS2Y43J.js.map → chunk-6SWPJEYN.js.map} +1 -1
  70. package/dist/{chunk-7TKNK32B.js → chunk-7SQSZN2J.js} +5 -5
  71. package/dist/{chunk-7TKNK32B.js.map → chunk-7SQSZN2J.js.map} +1 -1
  72. package/dist/{chunk-BEB4OFZF.cjs → chunk-AMMWA76F.cjs} +51 -59
  73. package/dist/chunk-AMMWA76F.cjs.map +1 -0
  74. package/dist/{chunk-PYKF7UIL.cjs → chunk-AOSSQDVO.cjs} +13 -13
  75. package/dist/{chunk-PYKF7UIL.cjs.map → chunk-AOSSQDVO.cjs.map} +1 -1
  76. package/dist/{chunk-EDHV4CBU.js → chunk-AVGUJWVX.js} +30 -10
  77. package/dist/chunk-AVGUJWVX.js.map +1 -0
  78. package/dist/{chunk-C2ZP5YS6.cjs → chunk-BCQ76AXA.cjs} +258 -153
  79. package/dist/chunk-BCQ76AXA.cjs.map +1 -0
  80. package/dist/{chunk-WA64ZSCA.cjs → chunk-BFUOME67.cjs} +11 -11
  81. package/dist/{chunk-WA64ZSCA.cjs.map → chunk-BFUOME67.cjs.map} +1 -1
  82. package/dist/{chunk-C6KE2HSQ.cjs → chunk-BR7SHKGM.cjs} +1611 -1382
  83. package/dist/chunk-BR7SHKGM.cjs.map +1 -0
  84. package/dist/{chunk-FCIZNUW5.js → chunk-CHAOFCHV.js} +3 -3
  85. package/dist/{chunk-FCIZNUW5.js.map → chunk-CHAOFCHV.js.map} +1 -1
  86. package/dist/chunk-CICO5GXD.cjs +12 -0
  87. package/dist/{chunk-73MWKDFK.cjs.map → chunk-CICO5GXD.cjs.map} +1 -1
  88. package/dist/{chunk-SXWLLQ3D.js → chunk-D5R42W5D.js} +4 -4
  89. package/dist/{chunk-SXWLLQ3D.js.map → chunk-D5R42W5D.js.map} +1 -1
  90. package/dist/{chunk-YQ4JONWE.js → chunk-DJZTXBWY.js} +342 -113
  91. package/dist/chunk-DJZTXBWY.js.map +1 -0
  92. package/dist/{chunk-BZZI7B43.cjs → chunk-DO7SAMEK.cjs} +47 -47
  93. package/dist/{chunk-BZZI7B43.cjs.map → chunk-DO7SAMEK.cjs.map} +1 -1
  94. package/dist/{chunk-2ZWM2RFH.cjs → chunk-EDN4Y4ZG.cjs} +9 -9
  95. package/dist/{chunk-2ZWM2RFH.cjs.map → chunk-EDN4Y4ZG.cjs.map} +1 -1
  96. package/dist/{chunk-E4OSGBCM.cjs → chunk-EMIB2RXD.cjs} +131 -131
  97. package/dist/{chunk-E4OSGBCM.cjs.map → chunk-EMIB2RXD.cjs.map} +1 -1
  98. package/dist/{chunk-GWUWRZXW.js → chunk-EP4RUYD6.js} +3 -3
  99. package/dist/{chunk-GWUWRZXW.js.map → chunk-EP4RUYD6.js.map} +1 -1
  100. package/dist/{chunk-LHYSY6SE.js → chunk-FNOMT74T.js} +10 -8
  101. package/dist/chunk-FNOMT74T.js.map +1 -0
  102. package/dist/{chunk-ZBVZ7HXD.cjs → chunk-FQPEMEWX.cjs} +12 -12
  103. package/dist/{chunk-ZBVZ7HXD.cjs.map → chunk-FQPEMEWX.cjs.map} +1 -1
  104. package/dist/{chunk-LNIWCQR4.js → chunk-GLHXM7C4.js} +3 -3
  105. package/dist/{chunk-LNIWCQR4.js.map → chunk-GLHXM7C4.js.map} +1 -1
  106. package/dist/{chunk-6BD6ZBKT.cjs → chunk-GYEG3ZLZ.cjs} +10 -10
  107. package/dist/{chunk-6BD6ZBKT.cjs.map → chunk-GYEG3ZLZ.cjs.map} +1 -1
  108. package/dist/{chunk-XBHRKLZU.cjs → chunk-GYUJZARH.cjs} +4 -4
  109. package/dist/{chunk-XBHRKLZU.cjs.map → chunk-GYUJZARH.cjs.map} +1 -1
  110. package/dist/{chunk-A7NMUYEL.cjs → chunk-HDL2ARHX.cjs} +27 -27
  111. package/dist/{chunk-A7NMUYEL.cjs.map → chunk-HDL2ARHX.cjs.map} +1 -1
  112. package/dist/{chunk-5ZJOB5YS.js → chunk-HEV35TGT.js} +4 -4
  113. package/dist/{chunk-5ZJOB5YS.js.map → chunk-HEV35TGT.js.map} +1 -1
  114. package/dist/{chunk-UTVQPZPN.cjs → chunk-I4G3SQPF.cjs} +20 -20
  115. package/dist/{chunk-UTVQPZPN.cjs.map → chunk-I4G3SQPF.cjs.map} +1 -1
  116. package/dist/{chunk-JCNTKRAK.js → chunk-JONXFAPO.js} +5 -5
  117. package/dist/{chunk-JCNTKRAK.js.map → chunk-JONXFAPO.js.map} +1 -1
  118. package/dist/{chunk-GVAMRRZR.cjs → chunk-JR6SX5RH.cjs} +4 -4
  119. package/dist/{chunk-GVAMRRZR.cjs.map → chunk-JR6SX5RH.cjs.map} +1 -1
  120. package/dist/{chunk-N3QTGPC7.cjs → chunk-KABFHAL7.cjs} +100 -99
  121. package/dist/chunk-KABFHAL7.cjs.map +1 -0
  122. package/dist/{chunk-KXSMF6PL.js → chunk-KH7XW7VV.js} +20 -12
  123. package/dist/chunk-KH7XW7VV.js.map +1 -0
  124. package/dist/{chunk-EDJDDY6H.js → chunk-KKBDXCLQ.js} +4 -4
  125. package/dist/{chunk-EDJDDY6H.js.map → chunk-KKBDXCLQ.js.map} +1 -1
  126. package/dist/{chunk-ZHOAZD7Q.cjs → chunk-L3LQNR34.cjs} +161 -161
  127. package/dist/{chunk-ZHOAZD7Q.cjs.map → chunk-L3LQNR34.cjs.map} +1 -1
  128. package/dist/{chunk-IHRDX7K6.js → chunk-LEWHMOUY.js} +46 -56
  129. package/dist/chunk-LEWHMOUY.js.map +1 -0
  130. package/dist/{chunk-AF3TWL5C.cjs → chunk-LRQKXRXO.cjs} +4 -4
  131. package/dist/{chunk-AF3TWL5C.cjs.map → chunk-LRQKXRXO.cjs.map} +1 -1
  132. package/dist/{chunk-WYFB7BN3.js → chunk-M35DF33T.js} +143 -38
  133. package/dist/chunk-M35DF33T.js.map +1 -0
  134. package/dist/{chunk-32UETY6S.cjs → chunk-MFZR4QKM.cjs} +30 -28
  135. package/dist/chunk-MFZR4QKM.cjs.map +1 -0
  136. package/dist/chunk-MKJ4KXL5.cjs +12 -0
  137. package/dist/{chunk-6LAXM4J2.cjs.map → chunk-MKJ4KXL5.cjs.map} +1 -1
  138. package/dist/{chunk-KCH7WQA5.cjs → chunk-MRDBBHIZ.cjs} +48 -2
  139. package/dist/chunk-MRDBBHIZ.cjs.map +1 -0
  140. package/dist/{chunk-QPOQX2DI.cjs → chunk-MX4DHSQP.cjs} +1023 -360
  141. package/dist/chunk-MX4DHSQP.cjs.map +1 -0
  142. package/dist/{chunk-FXNHZFZV.js → chunk-MYKHJI2J.js} +3 -3
  143. package/dist/{chunk-FXNHZFZV.js.map → chunk-MYKHJI2J.js.map} +1 -1
  144. package/dist/{chunk-DSAWGCMP.js → chunk-NAZ2RA4L.js} +3 -3
  145. package/dist/{chunk-DSAWGCMP.js.map → chunk-NAZ2RA4L.js.map} +1 -1
  146. package/dist/{chunk-R7EWHKID.js → chunk-NG2RB5WL.js} +4 -145
  147. package/dist/chunk-NG2RB5WL.js.map +1 -0
  148. package/dist/{chunk-A2LJG5GM.js → chunk-NNQ6A3RM.js} +803 -143
  149. package/dist/chunk-NNQ6A3RM.js.map +1 -0
  150. package/dist/{chunk-72WUT4GG.js → chunk-NVY5CJFP.js} +4 -4
  151. package/dist/{chunk-72WUT4GG.js.map → chunk-NVY5CJFP.js.map} +1 -1
  152. package/dist/{chunk-ZIH42CRX.cjs → chunk-OI2GQ25X.cjs} +7 -7
  153. package/dist/{chunk-ZIH42CRX.cjs.map → chunk-OI2GQ25X.cjs.map} +1 -1
  154. package/dist/{chunk-A4R3H7RU.cjs → chunk-OIFSOPSR.cjs} +259 -238
  155. package/dist/chunk-OIFSOPSR.cjs.map +1 -0
  156. package/dist/{chunk-AU3IJNNP.js → chunk-OMZ37BM2.js} +5 -5
  157. package/dist/{chunk-AU3IJNNP.js.map → chunk-OMZ37BM2.js.map} +1 -1
  158. package/dist/{chunk-C4DYN2SD.cjs → chunk-OORXGFL5.cjs} +48 -48
  159. package/dist/{chunk-C4DYN2SD.cjs.map → chunk-OORXGFL5.cjs.map} +1 -1
  160. package/dist/{chunk-BRN3RGD2.js → chunk-OVI7IXYX.js} +3 -3
  161. package/dist/{chunk-BRN3RGD2.js.map → chunk-OVI7IXYX.js.map} +1 -1
  162. package/dist/{chunk-WMKEGJG4.js → chunk-P6YLZTRE.js} +3 -3
  163. package/dist/{chunk-WMKEGJG4.js.map → chunk-P6YLZTRE.js.map} +1 -1
  164. package/dist/{chunk-AT3MLMJV.js → chunk-QS3NQZVC.js} +82 -16
  165. package/dist/chunk-QS3NQZVC.js.map +1 -0
  166. package/dist/{chunk-EJSYWAEV.js → chunk-QTD6HX4O.js} +5 -5
  167. package/dist/{chunk-EJSYWAEV.js.map → chunk-QTD6HX4O.js.map} +1 -1
  168. package/dist/{chunk-JL5UEBWT.cjs → chunk-ROR5ZR6A.cjs} +45 -45
  169. package/dist/{chunk-JL5UEBWT.cjs.map → chunk-ROR5ZR6A.cjs.map} +1 -1
  170. package/dist/{chunk-FSLTU57P.js → chunk-SDBBMD4N.js} +3 -3
  171. package/dist/{chunk-FSLTU57P.js.map → chunk-SDBBMD4N.js.map} +1 -1
  172. package/dist/{chunk-WEJHA7AD.js → chunk-SE6EGQSD.js} +78 -16
  173. package/dist/chunk-SE6EGQSD.js.map +1 -0
  174. package/dist/{chunk-36LIJXWC.js → chunk-SHFBB23Q.js} +4 -4
  175. package/dist/{chunk-36LIJXWC.js.map → chunk-SHFBB23Q.js.map} +1 -1
  176. package/dist/{chunk-FA6Z7B5L.js → chunk-SHSSRCFR.js} +5 -3
  177. package/dist/chunk-SHSSRCFR.js.map +1 -0
  178. package/dist/{chunk-KOAI3KIV.cjs → chunk-TZEGUG6D.cjs} +4 -4
  179. package/dist/{chunk-KOAI3KIV.cjs.map → chunk-TZEGUG6D.cjs.map} +1 -1
  180. package/dist/{chunk-HNYLMPQQ.cjs → chunk-U5EDAVOJ.cjs} +140 -74
  181. package/dist/chunk-U5EDAVOJ.cjs.map +1 -0
  182. package/dist/{chunk-RHDOAQCT.cjs → chunk-UPAJHMW3.cjs} +122 -114
  183. package/dist/chunk-UPAJHMW3.cjs.map +1 -0
  184. package/dist/{chunk-BQM5P2NO.cjs → chunk-WGX7JH7E.cjs} +235 -170
  185. package/dist/chunk-WGX7JH7E.cjs.map +1 -0
  186. package/dist/{chunk-DYPRZ53S.cjs → chunk-WODMN3Q2.cjs} +27 -27
  187. package/dist/{chunk-DYPRZ53S.cjs.map → chunk-WODMN3Q2.cjs.map} +1 -1
  188. package/dist/{chunk-OZJCH7ZS.js → chunk-XVWOYKIK.js} +3 -3
  189. package/dist/{chunk-OZJCH7ZS.js.map → chunk-XVWOYKIK.js.map} +1 -1
  190. package/dist/chunk-XY5OMOJD.js +147 -0
  191. package/dist/chunk-XY5OMOJD.js.map +1 -0
  192. package/dist/{chunk-KA4L2NZ3.js → chunk-XYBQI6LE.js} +14 -14
  193. package/dist/{chunk-KA4L2NZ3.js.map → chunk-XYBQI6LE.js.map} +1 -1
  194. package/dist/{chunk-EAMVXR5B.js → chunk-ZDKTPBGV.js} +4 -4
  195. package/dist/{chunk-EAMVXR5B.js.map → chunk-ZDKTPBGV.js.map} +1 -1
  196. package/dist/{chunk-Z43KWLZF.js → chunk-ZHNXLS3C.js} +9 -8
  197. package/dist/chunk-ZHNXLS3C.js.map +1 -0
  198. package/dist/{chunk-62ZXBMSD.js → chunk-ZLONH2UD.js} +46 -3
  199. package/dist/chunk-ZLONH2UD.js.map +1 -0
  200. package/dist/core/index.cjs +28 -27
  201. package/dist/core/index.d.cts +4 -4
  202. package/dist/core/index.d.ts +4 -4
  203. package/dist/core/index.js +8 -7
  204. package/dist/{ddl-opIn8DfX.d.ts → ddl-CprnMXJ-.d.ts} +3 -3
  205. package/dist/{ddl-mE07h_EM.d.cts → ddl-DJA7Lci5.d.cts} +3 -3
  206. package/dist/graph-extension/index.cjs +20 -20
  207. package/dist/graph-extension/index.d.cts +4 -4
  208. package/dist/graph-extension/index.d.ts +4 -4
  209. package/dist/graph-extension/index.js +4 -4
  210. package/dist/graph-merge/index.cjs +3204 -635
  211. package/dist/graph-merge/index.cjs.map +1 -1
  212. package/dist/graph-merge/index.d.cts +502 -60
  213. package/dist/graph-merge/index.d.ts +502 -60
  214. package/dist/graph-merge/index.js +2979 -427
  215. package/dist/graph-merge/index.js.map +1 -1
  216. package/dist/{index-Deyu8IXL.d.ts → index-CHTv4XMZ.d.cts} +47 -3
  217. package/dist/{index-DrRS51Ld.d.cts → index-CzoJ3MUw.d.ts} +47 -3
  218. package/dist/index.cjs +229 -216
  219. package/dist/index.cjs.map +1 -1
  220. package/dist/index.d.cts +11 -11
  221. package/dist/index.d.ts +11 -11
  222. package/dist/index.js +35 -34
  223. package/dist/index.js.map +1 -1
  224. package/dist/indexes/index.cjs +13 -13
  225. package/dist/indexes/index.d.cts +4 -4
  226. package/dist/indexes/index.d.ts +4 -4
  227. package/dist/indexes/index.js +6 -6
  228. package/dist/interchange/index.cjs +53 -52
  229. package/dist/interchange/index.cjs.map +1 -1
  230. package/dist/interchange/index.d.cts +17 -13
  231. package/dist/interchange/index.d.ts +17 -13
  232. package/dist/interchange/index.js +17 -16
  233. package/dist/interchange/index.js.map +1 -1
  234. package/dist/{manager-DX983gJ0.d.ts → manager-B6sOQzcQ.d.ts} +2 -2
  235. package/dist/{manager-ptr3JLRP.d.cts → manager-DlY1vlla.d.cts} +2 -2
  236. package/dist/{materialize-indexes-CpXoggWU.d.ts → materialize-indexes-DQL4xcpf.d.ts} +1 -1
  237. package/dist/{materialize-indexes-BXz77YqO.d.cts → materialize-indexes-sskhp-c_.d.cts} +1 -1
  238. package/dist/{postgres-DwgEXSPI.d.cts → postgres-B6YOUcaK.d.ts} +1 -1
  239. package/dist/{postgres-QdOMHTBz.d.ts → postgres-BXy_nyMs.d.cts} +1 -1
  240. package/dist/profiler/index.d.cts +9 -9
  241. package/dist/profiler/index.d.ts +9 -9
  242. package/dist/provenance/index.cjs +43 -42
  243. package/dist/provenance/index.cjs.map +1 -1
  244. package/dist/provenance/index.d.cts +7 -7
  245. package/dist/provenance/index.d.ts +7 -7
  246. package/dist/provenance/index.js +10 -9
  247. package/dist/provenance/index.js.map +1 -1
  248. package/dist/schema/index.cjs +45 -44
  249. package/dist/schema/index.d.cts +6 -6
  250. package/dist/schema/index.d.ts +6 -6
  251. package/dist/schema/index.js +18 -17
  252. package/dist/{searchable-BrUh0pdc.d.cts → searchable-0Cn_lY8U.d.cts} +1 -1
  253. package/dist/{searchable-BOUuA83f.d.ts → searchable-D9gMiwcS.d.ts} +1 -1
  254. package/dist/{sqlite-BfYcV61E.d.cts → sqlite-ClXuBYAj.d.ts} +1 -1
  255. package/dist/{sqlite-DK40XVR1.d.ts → sqlite-DioSxaPe.d.cts} +1 -1
  256. package/dist/{store-Bo1psfVZ.d.ts → store-5j-w5onJ.d.ts} +120 -71
  257. package/dist/{store-FTqBpuJD.d.cts → store-CFedKGU5.d.cts} +120 -71
  258. package/dist/{temporal-CXewwLTB.d.cts → temporal-Ce1pG0S1.d.cts} +1 -1
  259. package/dist/{temporal-DPtn0HOu.d.ts → temporal-CjO9FH1l.d.ts} +1 -1
  260. package/dist/{types-CeT7xM4M.d.ts → types-BrdOFu48.d.ts} +1 -1
  261. package/dist/{types-Du78EvpN.d.ts → types-DKkMJZjR.d.cts} +32 -6
  262. package/dist/{types-Du78EvpN.d.cts → types-DKkMJZjR.d.ts} +32 -6
  263. package/dist/{types-XR1nHERK.d.cts → types-oj_OGAaZ.d.cts} +1 -1
  264. package/dist/{where-CMbFiWwp.d.ts → where-C8w2627G.d.ts} +1 -1
  265. package/dist/{where-CJsp-YUf.d.cts → where-D1wKCJ4Q.d.cts} +1 -1
  266. package/package.json +1 -1
  267. package/dist/chunk-32UETY6S.cjs.map +0 -1
  268. package/dist/chunk-5PDSCELM.cjs.map +0 -1
  269. package/dist/chunk-62ZXBMSD.js.map +0 -1
  270. package/dist/chunk-6LAXM4J2.cjs +0 -12
  271. package/dist/chunk-73MWKDFK.cjs +0 -12
  272. package/dist/chunk-A2LJG5GM.js.map +0 -1
  273. package/dist/chunk-A4R3H7RU.cjs.map +0 -1
  274. package/dist/chunk-ANKOXPCC.cjs.map +0 -1
  275. package/dist/chunk-AT3MLMJV.js.map +0 -1
  276. package/dist/chunk-BEB4OFZF.cjs.map +0 -1
  277. package/dist/chunk-BQM5P2NO.cjs.map +0 -1
  278. package/dist/chunk-C2ZP5YS6.cjs.map +0 -1
  279. package/dist/chunk-C6KE2HSQ.cjs.map +0 -1
  280. package/dist/chunk-EDHV4CBU.js.map +0 -1
  281. package/dist/chunk-FA6Z7B5L.js.map +0 -1
  282. package/dist/chunk-HNYLMPQQ.cjs.map +0 -1
  283. package/dist/chunk-IHRDX7K6.js.map +0 -1
  284. package/dist/chunk-KCH7WQA5.cjs.map +0 -1
  285. package/dist/chunk-KXSMF6PL.js.map +0 -1
  286. package/dist/chunk-LHYSY6SE.js.map +0 -1
  287. package/dist/chunk-N3QTGPC7.cjs.map +0 -1
  288. package/dist/chunk-QPOQX2DI.cjs.map +0 -1
  289. package/dist/chunk-R7EWHKID.js.map +0 -1
  290. package/dist/chunk-RHDOAQCT.cjs.map +0 -1
  291. package/dist/chunk-WEJHA7AD.js.map +0 -1
  292. package/dist/chunk-WYFB7BN3.js.map +0 -1
  293. package/dist/chunk-YQ4JONWE.js.map +0 -1
  294. package/dist/chunk-Z43KWLZF.js.map +0 -1
@@ -0,0 +1,161 @@
1
+ 'use strict';
2
+
3
+ var chunk425IZOQ5_cjs = require('./chunk-425IZOQ5.cjs');
4
+ var chunkMRDBBHIZ_cjs = require('./chunk-MRDBBHIZ.cjs');
5
+
6
+ // src/core/temporal.ts
7
+ var RECORDED_INSTANT_VERSION = "r1";
8
+ var RECORDED_REVISION_WIDTH = 16;
9
+ var RECORDED_MAX_REVISION = Number.MAX_SAFE_INTEGER;
10
+ var RECORDED_INSTANT_PATTERN = /^r1:(\d{16}):(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)$/;
11
+ function invalidRecordedInstant(value, path) {
12
+ return new chunkMRDBBHIZ_cjs.ValidationError(
13
+ `${path} must be a canonical versioned recorded instant.`,
14
+ {
15
+ issues: [
16
+ {
17
+ path,
18
+ message: `Expected ${RECORDED_INSTANT_VERSION}:<${RECORDED_REVISION_WIDTH}-digit revision>:YYYY-MM-DDTHH:mm:ss.sssZ, got "${value}"`
19
+ }
20
+ ]
21
+ },
22
+ {
23
+ suggestion: "Persist the exact string returned by store.recordedNow(); migrate preview-schema checkpoints with migrateLegacyRecordedTime() and migrateRecordedAnchor()."
24
+ }
25
+ );
26
+ }
27
+ function parseRecordedInstant(value, path = "RecordedInstant") {
28
+ const match = RECORDED_INSTANT_PATTERN.exec(value);
29
+ if (match === null) throw invalidRecordedInstant(value, path);
30
+ const revisionText = match[1];
31
+ const recordedAt = match[2];
32
+ if (revisionText === void 0 || recordedAt === void 0) {
33
+ throw invalidRecordedInstant(value, path);
34
+ }
35
+ const revision = Number(revisionText);
36
+ if (!Number.isSafeInteger(revision) || revision < 1 || revision >= RECORDED_MAX_REVISION) {
37
+ throw invalidRecordedInstant(value, path);
38
+ }
39
+ chunk425IZOQ5_cjs.validateCanonicalIsoDate(recordedAt, path);
40
+ return { revision, recordedAt };
41
+ }
42
+ function assertValidRecordedInstant(value, path) {
43
+ parseRecordedInstant(value, path);
44
+ }
45
+ function optionalRecordedInstantParts(value, path = "RecordedInstant") {
46
+ return value === void 0 ? void 0 : parseRecordedInstant(value, path);
47
+ }
48
+ function createRecordedInstant(revision, recordedAt) {
49
+ if (!Number.isSafeInteger(revision) || revision < 1 || revision >= RECORDED_MAX_REVISION) {
50
+ throw new chunkMRDBBHIZ_cjs.ValidationError(
51
+ "createRecordedInstant revision must be a valid recorded revision.",
52
+ {
53
+ issues: [
54
+ {
55
+ path: "createRecordedInstant.revision",
56
+ message: `Expected a safe integer from 1 through ${String(RECORDED_MAX_REVISION - 1)}, got ${String(revision)}`
57
+ }
58
+ ]
59
+ }
60
+ );
61
+ }
62
+ const revisionText = revision.toString().padStart(RECORDED_REVISION_WIDTH, "0");
63
+ return asRecordedInstant(
64
+ `${RECORDED_INSTANT_VERSION}:${revisionText}:${recordedAt}`
65
+ );
66
+ }
67
+ function recordedInstantWallTime(instant) {
68
+ return parseRecordedInstant(instant).recordedAt;
69
+ }
70
+ function recordedInstantRevision(instant) {
71
+ return parseRecordedInstant(instant).revision;
72
+ }
73
+ function compareRecordedInstants(left, right) {
74
+ const leftRevision = recordedInstantRevision(left);
75
+ const rightRevision = recordedInstantRevision(right);
76
+ if (leftRevision < rightRevision) return -1;
77
+ if (leftRevision > rightRevision) return 1;
78
+ return 0;
79
+ }
80
+ function asRecordedInstant(value) {
81
+ assertValidRecordedInstant(value, "asRecordedInstant");
82
+ return value;
83
+ }
84
+ function resolveReadCoordinate(mode, asOf, suggestion) {
85
+ if (mode !== "asOf" && asOf !== void 0) {
86
+ throw new chunkMRDBBHIZ_cjs.ValidationError(
87
+ `Temporal mode "${mode}" does not take an asOf timestamp.`,
88
+ {
89
+ issues: [
90
+ {
91
+ path: "asOf",
92
+ message: `asOf is only valid with mode "asOf", not "${mode}"`
93
+ }
94
+ ]
95
+ },
96
+ {
97
+ suggestion: 'Pin an instant with store.asOf(timestamp) or store.view({ mode: "asOf", asOf }); drop asOf for other modes.'
98
+ }
99
+ );
100
+ }
101
+ assertValidAsOf(
102
+ mode,
103
+ asOf,
104
+ suggestion === void 0 ? void 0 : { suggestion }
105
+ );
106
+ return { valid: asOf === void 0 ? { mode } : { mode, asOf } };
107
+ }
108
+ function withRecordedCoordinate(coordinate, recordedAsOf) {
109
+ assertValidRecordedInstant(recordedAsOf, "asOfRecorded");
110
+ return {
111
+ ...coordinate,
112
+ recorded: { asOf: recordedAsOf }
113
+ };
114
+ }
115
+ function assertValidAsOf(mode, asOf, options) {
116
+ if (mode === "asOf" && asOf === void 0) {
117
+ throw new chunkMRDBBHIZ_cjs.ValidationError(
118
+ 'Temporal mode "asOf" requires a timestamp',
119
+ {
120
+ issues: [
121
+ { path: "asOf", message: "Timestamp is required for asOf mode" }
122
+ ]
123
+ },
124
+ {
125
+ suggestion: options?.suggestion ?? 'Provide an ISO-8601 timestamp for asOf mode, e.g. "2026-01-01T00:00:00.000Z".'
126
+ }
127
+ );
128
+ }
129
+ if (asOf !== void 0) {
130
+ chunk425IZOQ5_cjs.validateCanonicalIsoDate(asOf, "asOf");
131
+ }
132
+ }
133
+ function describeCoordinate(coordinate) {
134
+ const { mode, asOf } = coordinate.valid;
135
+ const valid = asOf === void 0 ? `mode "${mode}"` : `mode "${mode}" asOf ${asOf}`;
136
+ return coordinate.recorded === void 0 ? valid : `${valid}, recorded asOf ${coordinate.recorded.asOf}`;
137
+ }
138
+ function coordinateContext(coordinate) {
139
+ const { mode, asOf } = coordinate.valid;
140
+ return {
141
+ temporalMode: mode,
142
+ ...asOf !== void 0 && { asOf },
143
+ ...coordinate.recorded === void 0 ? {} : { recordedAsOf: coordinate.recorded.asOf }
144
+ };
145
+ }
146
+
147
+ exports.RECORDED_MAX_REVISION = RECORDED_MAX_REVISION;
148
+ exports.asRecordedInstant = asRecordedInstant;
149
+ exports.assertValidRecordedInstant = assertValidRecordedInstant;
150
+ exports.compareRecordedInstants = compareRecordedInstants;
151
+ exports.coordinateContext = coordinateContext;
152
+ exports.createRecordedInstant = createRecordedInstant;
153
+ exports.describeCoordinate = describeCoordinate;
154
+ exports.optionalRecordedInstantParts = optionalRecordedInstantParts;
155
+ exports.parseRecordedInstant = parseRecordedInstant;
156
+ exports.recordedInstantRevision = recordedInstantRevision;
157
+ exports.recordedInstantWallTime = recordedInstantWallTime;
158
+ exports.resolveReadCoordinate = resolveReadCoordinate;
159
+ exports.withRecordedCoordinate = withRecordedCoordinate;
160
+ //# sourceMappingURL=chunk-6KFLYYOC.cjs.map
161
+ //# sourceMappingURL=chunk-6KFLYYOC.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/temporal.ts"],"names":["ValidationError","validateCanonicalIsoDate"],"mappings":";;;;;;AAOA,IAAM,wBAAA,GAA2B,IAAA;AACjC,IAAM,uBAAA,GAA0B,EAAA;AAEzB,IAAM,wBAAwB,MAAA,CAAO;AAC5C,IAAM,wBAAA,GACJ,6DAAA;AA2BF,SAAS,sBAAA,CAAuB,OAAe,IAAA,EAA+B;AAC5E,EAAA,OAAO,IAAIA,iCAAA;AAAA,IACT,GAAG,IAAI,CAAA,gDAAA,CAAA;AAAA,IACP;AAAA,MACE,MAAA,EAAQ;AAAA,QACN;AAAA,UACE,IAAA;AAAA,UACA,SAAS,CAAA,SAAA,EAAY,wBAAwB,CAAA,EAAA,EAAK,uBAAuB,mDAAmD,KAAK,CAAA,CAAA;AAAA;AACnI;AACF,KACF;AAAA,IACA;AAAA,MACE,UAAA,EACE;AAAA;AACJ,GACF;AACF;AAEO,SAAS,oBAAA,CACd,KAAA,EACA,IAAA,GAAO,iBAAA,EACe;AACtB,EAAA,MAAM,KAAA,GAAQ,wBAAA,CAAyB,IAAA,CAAK,KAAK,CAAA;AACjD,EAAA,IAAI,KAAA,KAAU,IAAA,EAAM,MAAM,sBAAA,CAAuB,OAAO,IAAI,CAAA;AAC5D,EAAA,MAAM,YAAA,GAAe,MAAM,CAAC,CAAA;AAC5B,EAAA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AAI,UAAA,CAAW,KAAA;AAClC,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,IAAA;AAAA,IACd,GAAI,IAAA,KAAS,MAAA,IAAa,EAAE,IAAA,EAAK;AAAA,IACjC,GAAI,UAAA,CAAW,QAAA,KAAa,MAAA,GAC1B,KACA,EAAE,YAAA,EAAc,UAAA,CAAW,QAAA,CAAS,IAAA;AAAK,GAC7C;AACF","file":"chunk-6KFLYYOC.cjs","sourcesContent":["/**\n * Shared temporal coordinate + validation.\n */\nimport { ValidationError } from \"../errors\";\nimport { validateCanonicalIsoDate } from \"../utils/date\";\nimport { type TemporalMode } from \"./types\";\n\nconst RECORDED_INSTANT_VERSION = \"r1\";\nconst RECORDED_REVISION_WIDTH = 16;\n/** Open interval ceiling for numeric recorded-revision columns. */\nexport const RECORDED_MAX_REVISION = Number.MAX_SAFE_INTEGER;\nconst RECORDED_INSTANT_PATTERN =\n /^r1:(\\d{16}):(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z)$/;\n\ndeclare const RECORDED_INSTANT_BRAND: unique symbol;\n\n/**\n * A versioned recorded-time anchor containing a fixed-width logical revision\n * and a canonical UTC physical timestamp:\n * `r1:0000000000000001:YYYY-MM-DDTHH:mm:ss.sssZ`.\n *\n * Logical revisions are strictly monotonic per graph and make every commit\n * addressable even when many commits share one wall-clock millisecond. The\n * timestamp is a non-decreasing physical wall-time high-water mark used by\n * diagonal valid-time reads. Same-millisecond commits repeat it; backward clock\n * corrections hold it at the previous value until wall time catches up. The\n * string is canonical and lexicographically ordered by revision, so it can\n * round-trip through plain string checkpoint columns without a custom\n * serializer.\n */\nexport type RecordedInstant = string & {\n readonly [RECORDED_INSTANT_BRAND]: \"RecordedInstant\";\n};\n\nexport type RecordedInstantParts = Readonly<{\n revision: number;\n recordedAt: string;\n}>;\n\nfunction invalidRecordedInstant(value: string, path: string): ValidationError {\n return new ValidationError(\n `${path} must be a canonical versioned recorded instant.`,\n {\n issues: [\n {\n path,\n message: `Expected ${RECORDED_INSTANT_VERSION}:<${RECORDED_REVISION_WIDTH}-digit revision>:YYYY-MM-DDTHH:mm:ss.sssZ, got \"${value}\"`,\n },\n ],\n },\n {\n suggestion:\n \"Persist the exact string returned by store.recordedNow(); migrate preview-schema checkpoints with migrateLegacyRecordedTime() and migrateRecordedAnchor().\",\n },\n );\n}\n\nexport function parseRecordedInstant(\n value: string,\n path = \"RecordedInstant\",\n): RecordedInstantParts {\n const match = RECORDED_INSTANT_PATTERN.exec(value);\n if (match === null) throw invalidRecordedInstant(value, path);\n const revisionText = match[1];\n const recordedAt = match[2];\n if (revisionText === undefined || recordedAt === undefined) {\n throw invalidRecordedInstant(value, path);\n }\n const revision = Number(revisionText);\n if (\n !Number.isSafeInteger(revision) ||\n revision < 1 ||\n revision >= RECORDED_MAX_REVISION\n ) {\n throw invalidRecordedInstant(value, path);\n }\n validateCanonicalIsoDate(recordedAt, path);\n return { revision, recordedAt };\n}\n\nexport function assertValidRecordedInstant(value: string, path: string): void {\n parseRecordedInstant(value, path);\n}\n\n/**\n * Splits an optional recorded anchor into the numeric revision that recorded\n * relations store their `recorded_from`/`recorded_to` boundaries as, and the\n * wall time that valid-time windows are measured against. Compilers that\n * consult both halves parse once through this instead of per predicate.\n */\nexport function optionalRecordedInstantParts(\n value: string | undefined,\n path = \"RecordedInstant\",\n): RecordedInstantParts | undefined {\n return value === undefined ? undefined : parseRecordedInstant(value, path);\n}\n\nexport function createRecordedInstant(\n revision: number,\n recordedAt: string,\n): RecordedInstant {\n if (\n !Number.isSafeInteger(revision) ||\n revision < 1 ||\n revision >= RECORDED_MAX_REVISION\n ) {\n throw new ValidationError(\n \"createRecordedInstant revision must be a valid recorded revision.\",\n {\n issues: [\n {\n path: \"createRecordedInstant.revision\",\n message: `Expected a safe integer from 1 through ${String(RECORDED_MAX_REVISION - 1)}, got ${String(revision)}`,\n },\n ],\n },\n );\n }\n const revisionText = revision\n .toString()\n .padStart(RECORDED_REVISION_WIDTH, \"0\");\n return asRecordedInstant(\n `${RECORDED_INSTANT_VERSION}:${revisionText}:${recordedAt}`,\n );\n}\n\n/**\n * Returns the canonical UTC wall-time component of a recorded anchor.\n *\n * The value is non-decreasing per graph, but it is not the commit-order key;\n * use the complete {@link RecordedInstant} when ordering or replaying commits.\n */\nexport function recordedInstantWallTime(instant: RecordedInstant): string {\n return parseRecordedInstant(instant).recordedAt;\n}\n\n/** Returns the strict per-graph logical revision carried by an anchor. */\nexport function recordedInstantRevision(instant: RecordedInstant): number {\n return parseRecordedInstant(instant).revision;\n}\n\n/**\n * Compares two recorded anchors by logical revision.\n *\n * Revisions are local to a graph, so only compare anchors produced by the same\n * graph. The physical wall-time component deliberately does not participate.\n */\nexport function compareRecordedInstants(\n left: RecordedInstant,\n right: RecordedInstant,\n): -1 | 0 | 1 {\n const leftRevision = recordedInstantRevision(left);\n const rightRevision = recordedInstantRevision(right);\n if (leftRevision < rightRevision) return -1;\n if (leftRevision > rightRevision) return 1;\n return 0;\n}\n\n/**\n * Brands a canonical versioned anchor string as a {@link RecordedInstant}.\n *\n * The escape hatch for an instant that round-trips through untyped storage:\n * captured from {@link Store.recordedNow}, persisted as a plain string, read\n * back, and replayed into `asOfRecorded`. Validates the canonical form eagerly —\n * the same check `asOfRecorded` applies — so a malformed value fails here, at the\n * brand site, rather than deeper in a read. Does *not* assert the instant is a\n * real captured commit; it only guarantees the value is well-formed enough to\n * compare correctly against the recorded relations.\n *\n * @throws {ValidationError} when `value` is not a canonical versioned anchor.\n */\nexport function asRecordedInstant(value: string): RecordedInstant {\n assertValidRecordedInstant(value, \"asRecordedInstant\");\n return value as RecordedInstant;\n}\n\n/**\n * The single opaque temporal coordinate every pinned read is resolved\n * against. It carries the valid-time axis plus an optional recorded/system-time\n * axis, so every surface can inject one coordinate object instead of threading\n * each temporal dimension separately.\n */\nexport type ReadCoordinate = Readonly<{\n /**\n * The valid-time axis: a resolved temporal mode and (only for `\"asOf\"`) the\n * instant it is pinned to.\n */\n valid: Readonly<{\n mode: TemporalMode;\n /** Defined only when `mode` is `\"asOf\"`. */\n asOf?: string;\n }>;\n /** The recorded/system-time axis. Defined only for recorded-pinned views. */\n recorded?: Readonly<{ asOf: RecordedInstant }>;\n}>;\n\n/**\n * Resolves and validates a `(mode, asOf)` pair into a {@link ReadCoordinate}.\n * Rejects an `asOf` paired with any non-`\"asOf\"` mode rather than silently\n * dropping it — pinning an instant is only meaningful in `\"asOf\"` mode, so a\n * `view({ mode: \"current\", asOf })` is a caller mistake, not a coordinate to\n * quietly discard. Then validates via {@link assertValidAsOf}.\n *\n * @param mode - The temporal mode to pin.\n * @param asOf - The supplied timestamp. Required for `\"asOf\"`; rejected for\n * every other mode.\n * @param suggestion - Caller-specific remediation hint for the\n * missing/invalid-timestamp case.\n */\nexport function resolveReadCoordinate(\n mode: TemporalMode,\n asOf: string | undefined,\n suggestion?: string,\n): ReadCoordinate {\n if (mode !== \"asOf\" && asOf !== undefined) {\n throw new ValidationError(\n `Temporal mode \"${mode}\" does not take an asOf timestamp.`,\n {\n issues: [\n {\n path: \"asOf\",\n message: `asOf is only valid with mode \"asOf\", not \"${mode}\"`,\n },\n ],\n },\n {\n suggestion:\n 'Pin an instant with store.asOf(timestamp) or store.view({ mode: \"asOf\", asOf }); drop asOf for other modes.',\n },\n );\n }\n assertValidAsOf(\n mode,\n asOf,\n suggestion === undefined ? undefined : { suggestion },\n );\n return { valid: asOf === undefined ? { mode } : { mode, asOf } };\n}\n\n/**\n * Adds a recorded/system-time pin to an existing valid-time coordinate.\n * Direct `store.asOfRecorded(T)` passes the diagonal valid-time coordinate\n * (`mode: \"asOf\", asOf: T`); `store.asOf(vt).asOfRecorded(rt)` passes the\n * already-resolved valid coordinate and adds the recorded sibling.\n */\nexport function withRecordedCoordinate(\n coordinate: ReadCoordinate,\n recordedAsOf: RecordedInstant,\n): ReadCoordinate {\n assertValidRecordedInstant(recordedAsOf, \"asOfRecorded\");\n return {\n ...coordinate,\n recorded: { asOf: recordedAsOf },\n };\n}\n\n/**\n * Validates the `asOf` coordinate of a temporal read: `\"asOf\"` mode\n * requires a timestamp, and any supplied timestamp must be a canonical\n * fixed-width UTC ISO-8601 string (`YYYY-MM-DDTHH:mm:ss.sssZ`). The latter\n * is load-bearing — temporal filters compare `asOf` against `valid_from` /\n * `valid_to` as text on SQLite, so a non-canonical value (date-only, an\n * offset, natural language, or variable-width / missing milliseconds like\n * `.1Z`) would sort and compare wrong rather than error. Reached only through\n * {@link resolveReadCoordinate}, which every temporal read entry point routes\n * through (direct reads, queries, subgraphs, algorithms, and StoreView), so\n * they all fail identically.\n *\n * @param mode - The resolved temporal mode.\n * @param asOf - The supplied timestamp (may be `undefined`).\n * @param options.suggestion - A caller-specific remediation hint for the\n * missing-timestamp case.\n *\n * @throws {ValidationError} when `mode` is `\"asOf\"` and `asOf` is missing, or\n * when any supplied `asOf` is not a canonical UTC ISO-8601 timestamp. The\n * canonical check runs for *every* mode that consumes `asOf`, so a\n * non-canonical value can never reach a text comparison.\n */\nfunction assertValidAsOf(\n mode: TemporalMode,\n asOf: string | undefined,\n options?: Readonly<{ suggestion?: string }>,\n): void {\n if (mode === \"asOf\" && asOf === undefined) {\n throw new ValidationError(\n 'Temporal mode \"asOf\" requires a timestamp',\n {\n issues: [\n { path: \"asOf\", message: \"Timestamp is required for asOf mode\" },\n ],\n },\n {\n suggestion:\n options?.suggestion ??\n 'Provide an ISO-8601 timestamp for asOf mode, e.g. \"2026-01-01T00:00:00.000Z\".',\n },\n );\n }\n if (asOf !== undefined) {\n validateCanonicalIsoDate(asOf, \"asOf\");\n }\n}\n\n/**\n * A human-readable description of a coordinate for error messages, e.g.\n * `mode \"current\"` or `mode \"asOf\" asOf 2026-01-01T00:00:00.000Z`. Shared by\n * every refusal path (the `StoreView` read-only / current-only / search facades\n * and the sealed-query builder) so they describe a coordinate identically — and\n * a future axis (recorded time) is reflected everywhere from one place.\n */\nexport function describeCoordinate(coordinate: ReadCoordinate): string {\n const { mode, asOf } = coordinate.valid;\n const valid =\n asOf === undefined ? `mode \"${mode}\"` : `mode \"${mode}\" asOf ${asOf}`;\n return coordinate.recorded === undefined ?\n valid\n : `${valid}, recorded asOf ${coordinate.recorded.asOf}`;\n}\n\n/**\n * The structured error-context fields describing a coordinate, shared by the\n * same refusal paths as {@link describeCoordinate}.\n */\nexport function coordinateContext(\n coordinate: ReadCoordinate,\n): Record<string, unknown> {\n const { mode, asOf } = coordinate.valid;\n return {\n temporalMode: mode,\n ...(asOf !== undefined && { asOf }),\n ...(coordinate.recorded === undefined ?\n {}\n : { recordedAsOf: coordinate.recorded.asOf }),\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkKCH7WQA5_cjs = require('./chunk-KCH7WQA5.cjs');
3
+ var chunkMRDBBHIZ_cjs = require('./chunk-MRDBBHIZ.cjs');
4
4
  var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
5
5
  var zod = require('zod');
6
6
 
@@ -101,7 +101,7 @@ function assertSchemaKeysAreFree(entityKind, name, schema, reservedStructuralKey
101
101
  const locations = findings.unresolvableLazy.map(
102
102
  (lazy) => lazy.path === "" ? SCHEMA_ROOT_PATH_LABEL : lazy.path
103
103
  );
104
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
104
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
105
105
  `${entityKind} "${name}" schema contains a z.lazy() whose schema is not available yet at ${label}-definition time: ${locations.join(", ")}`,
106
106
  {
107
107
  [`${label}Type`]: name,
@@ -116,7 +116,7 @@ function assertSchemaKeysAreFree(entityKind, name, schema, reservedStructuralKey
116
116
  const unstorableConflicts = findings.unstorable;
117
117
  if (unstorableConflicts.length > 0) {
118
118
  const label = entityKind.toLowerCase();
119
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
119
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
120
120
  `${entityKind} "${name}" schema declares a property named "${UNSTORABLE_PROPERTY_NAME}", which ${UNSTORABLE_PROPERTY_NAME_REASON}: ${unstorableConflicts.join(", ")}`,
121
121
  {
122
122
  [`${label}Type`]: name,
@@ -133,7 +133,7 @@ function assertSchemaKeysAreFree(entityKind, name, schema, reservedStructuralKey
133
133
  );
134
134
  if (structuralConflicts.length > 0) {
135
135
  const label = entityKind.toLowerCase();
136
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
136
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
137
137
  `${entityKind} "${name}" schema contains reserved property names: ${structuralConflicts.join(", ")}`,
138
138
  {
139
139
  [`${label}Type`]: name,
@@ -148,7 +148,7 @@ function assertSchemaKeysAreFree(entityKind, name, schema, reservedStructuralKey
148
148
  const prefixConflicts = keys.filter((key) => isReservedPropertyName(key));
149
149
  if (prefixConflicts.length > 0) {
150
150
  const label = entityKind.toLowerCase();
151
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
151
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
152
152
  `${entityKind} "${name}" schema uses the reserved "${RESERVED_PROPERTY_PREFIX}" prefix on: ${prefixConflicts.join(", ")}`,
153
153
  {
154
154
  [`${label}Type`]: name,
@@ -164,7 +164,7 @@ function assertSchemaKeysAreFree(entityKind, name, schema, reservedStructuralKey
164
164
  function validateProjectionField(field, entityType, kind) {
165
165
  const reserved = entityType === "node" ? RESERVED_NODE_KEYS : RESERVED_EDGE_KEYS;
166
166
  if (reserved.has(field)) {
167
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
167
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
168
168
  `Projection field "${field}" on ${entityType} kind "${kind}" conflicts with a reserved structural key`,
169
169
  { field, kind, entityType, reservedKeys: [...reserved] },
170
170
  {
@@ -173,7 +173,7 @@ function validateProjectionField(field, entityType, kind) {
173
173
  );
174
174
  }
175
175
  if (PROTOTYPE_POLLUTION_KEYS.has(field)) {
176
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
176
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
177
177
  `Projection field "${field}" on ${entityType} kind "${kind}" is not allowed`,
178
178
  { field, kind, entityType },
179
179
  {
@@ -236,7 +236,7 @@ function describeNonPlain(value) {
236
236
  return "non-plain object";
237
237
  }
238
238
  function throwInvalid(path, kind, ownerKind) {
239
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
239
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
240
240
  `${ownerKind} ${path} contains a non-JSON value (${kind}). Annotations must be JSON-serializable.`,
241
241
  { path, valueKind: kind },
242
242
  {
@@ -253,5 +253,5 @@ exports.assertSchemaKeysAreFree = assertSchemaKeysAreFree;
253
253
  exports.filterReservedKeys = filterReservedKeys;
254
254
  exports.isUnstorablePropertyName = isUnstorablePropertyName;
255
255
  exports.validateProjectionField = validateProjectionField;
256
- //# sourceMappingURL=chunk-D6GCNNMK.cjs.map
257
- //# sourceMappingURL=chunk-D6GCNNMK.cjs.map
256
+ //# sourceMappingURL=chunk-6NGW27EO.cjs.map
257
+ //# sourceMappingURL=chunk-6NGW27EO.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/store/reserved-keys.ts","../src/core/json-value.ts"],"names":["z","isPlainObject","ConfigurationError","createDataKeyedBag"],"mappings":";;;;;;AAYO,IAAM,kBAAA,uBAA8C,GAAA,CAAI;AAAA,EAC7D,IAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,kBAAA,uBAA8C,GAAA,CAAI;AAAA,EAC7D,IAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAC;AAED,IAAM,wBAAA,uBAAoD,GAAA,CAAI;AAAA,EAC5D,WAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAC,CAAA;AAkBD,IAAM,wBAAA,GAA2B,WAAA;AAM1B,IAAM,+BAAA,GACX;AAGK,SAAS,yBAAyB,IAAA,EAAuB;AAC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EAC3B;AACA,EAAA,OAAO,kBAAA;AACT;AAEA,SAAS,YAAA,CAAa,IAAA,EAAc,IAAA,EAAc,SAAA,EAA0B;AAC1E,EAAA,MAAM,IAAIC,oCAAA;AAAA,IACR,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,IAAI,+BAA+B,IAAI,CAAA,yCAAA,CAAA;AAAA,IACvD,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAK;AAAA,IACxB;AAAA,MACE,UAAA,EACE;AAAA;AACJ,GACF;AACF","file":"chunk-D6GCNNMK.cjs","sourcesContent":["/**\n * Reserved Keys for Store Entities\n *\n * Structural keys that cannot be overwritten by user-defined properties.\n * Shared across row-mappers, subgraph projection, and schema validation.\n */\nimport { z } from \"zod\";\n\nimport type { KindEntity } from \"../core/types\";\nimport { ConfigurationError } from \"../errors\";\nimport { createDataKeyedBag, isPlainObject } from \"../utils/object\";\n\nexport const RESERVED_NODE_KEYS: ReadonlySet<string> = new Set([\n \"id\",\n \"kind\",\n \"meta\",\n]);\n\nexport const RESERVED_EDGE_KEYS: ReadonlySet<string> = new Set([\n \"id\",\n \"kind\",\n \"meta\",\n \"fromKind\",\n \"fromId\",\n \"toKind\",\n \"toId\",\n]);\n\nconst PROTOTYPE_POLLUTION_KEYS: ReadonlySet<string> = new Set([\n \"__proto__\",\n \"constructor\",\n \"prototype\",\n]);\n\n/**\n * The property name the SCHEMA LAYER cannot carry, and the single owner of that\n * question — every authoring path asks here rather than re-spelling the literal.\n *\n * Zod accepts `__proto__` in a shape but drops it from every parse result, and\n * reports success even when the field is required, so a value written to such a\n * field is silently lost. A declaration naming it is therefore refused rather\n * than accepted as a field the storage layer can never honor.\n *\n * TWO authoring paths ask, and they stay separate walkers by necessity — one\n * traverses Zod schemas (`defineNode` / `defineEdge`, below), the other JSON\n * property descriptors (`validateGraphExtension`, in\n * ./../graph-extension/validation.ts) — but the VERDICT and the reason they give\n * for it are shared from here, because a name unstorable on one path is\n * unstorable on the other: both compile to the same `z.object(...)`.\n */\nconst UNSTORABLE_PROPERTY_NAME = \"__proto__\";\n\n/**\n * The shared explanation both authoring paths give when they refuse\n * {@link UNSTORABLE_PROPERTY_NAME}, so the two refusals read as one rule.\n */\nexport const UNSTORABLE_PROPERTY_NAME_REASON =\n \"schema validation cannot carry it\";\n\n/** See {@link UNSTORABLE_PROPERTY_NAME}. */\nexport function isUnstorablePropertyName(name: string): boolean {\n return name === UNSTORABLE_PROPERTY_NAME;\n}\n\n/**\n * Renders a nested property path for a refusal message: object field names\n * joined by `.`, with the wrappers between them (optional, array, union, …)\n * contributing no segment because they name nothing.\n */\nfunction formatSchemaPath(segments: readonly string[]): string {\n return segments.join(\".\");\n}\n\n/** How a refusal names a location that is the schema itself, not a field. */\nconst SCHEMA_ROOT_PATH_LABEL = \"(schema root)\";\n\n/**\n * Every schema reachable one step down from `value` — a schema, an array of\n * them, or a plain object holding them.\n *\n * Deliberately STRUCTURAL rather than a per-Zod-type enumeration: every\n * composite (`array`, `record`, `map`, `set`, `tuple`, `union`, `intersection`,\n * `pipe`) and every wrapper (`optional`, `nullable`, `default`, `prefault`,\n * `catch`, `readonly`, `nonoptional`, `promise`) stores its inner schemas as\n * ordinary values of the public {@link z.ZodType.def} record, so one walk covers\n * all of them — including any Zod adds later. An enumeration would silently\n * stop covering the type it forgot, which is precisely how this defect class\n * survived a depth-0-only fix.\n */\nfunction collectNestedSchemas(value: unknown, found: z.ZodType[]): void {\n if (value instanceof z.ZodType) {\n found.push(value);\n return;\n }\n if (Array.isArray(value)) {\n for (const item of value) collectNestedSchemas(item, found);\n return;\n }\n if (isPlainObject(value)) {\n for (const nested of Object.values(value)) {\n collectNestedSchemas(nested, found);\n }\n }\n}\n\n/** A `z.lazy` whose getter could not run, and where in the schema it sits. */\ntype UnresolvableLazy = Readonly<{ path: string; cause: unknown }>;\n\n/** What one walk of a schema found. */\ntype SchemaFindings = Readonly<{\n unstorable: string[];\n unresolvableLazy: UnresolvableLazy[];\n}>;\n\n/**\n * The inner schema of a `z.lazy`, or the reason its getter could not run.\n *\n * `z.lazy` is the one shape the structural walk cannot see — its inner schema\n * hangs off a `getter` FUNCTION rather than a `def` value — so it is unwrapped\n * through the public `unwrap()`, which RUNS that getter. Running it is the only\n * way to inspect what it wraps, and the `visited` set in the caller makes the\n * resulting recursion safe for a self-referential schema.\n *\n * The failure is REPORTED rather than swallowed, and that is the whole contract\n * of this function. `unwrap()` throws when the getter names a binding still in\n * its temporal dead zone — a mutually recursive pair whose second `z.object`\n * const is declared AFTER the `defineNode` call that walks the first. Returning\n * `undefined` there made the walk fail OPEN: the subtree was never judged, and\n * because a definition is validated exactly once, it was never judged later\n * either — so a nested `__proto__` under that subtree was accepted at\n * definition time and then silently dropped by every parse, which is the exact\n * defect this validation exists to prevent. A branch that cannot be looked at\n * is refused, not waved through.\n */\nfunction resolveLazySchema(schema: z.ZodLazy<z.core.SomeType>):\n | Readonly<{ resolved: true; inner: unknown }>\n | Readonly<{\n resolved: false;\n cause: unknown;\n }> {\n try {\n return { resolved: true, inner: schema.unwrap() };\n } catch (error) {\n return { resolved: false, cause: error };\n }\n}\n\n/**\n * The schemas nested directly inside `schema`, recording an unrunnable `z.lazy`\n * getter in `findings` instead of quietly yielding nothing for it.\n */\nfunction nestedSchemasOf(\n schema: z.ZodType,\n path: readonly string[],\n findings: SchemaFindings,\n): readonly z.ZodType[] {\n const found: z.ZodType[] = [];\n if (schema instanceof z.ZodLazy) {\n const resolution = resolveLazySchema(schema);\n if (!resolution.resolved) {\n findings.unresolvableLazy.push({\n path: formatSchemaPath(path),\n cause: resolution.cause,\n });\n return found;\n }\n collectNestedSchemas(resolution.inner, found);\n return found;\n }\n collectNestedSchemas(Object.values(schema.def), found);\n return found;\n}\n\n/**\n * Collects the path of every property named {@link UNSTORABLE_PROPERTY_NAME}\n * anywhere in `schema`, at any depth and behind any wrapper — and the path of\n * every `z.lazy` that stopped the walk from getting there.\n *\n * `visited` both terminates recursive schemas and keeps a schema reused under\n * several fields from being re-walked; a name is reported once, which is enough\n * to refuse the definition.\n */\nfunction collectSchemaFindings(\n schema: z.ZodType,\n path: readonly string[],\n visited: Set<z.ZodType>,\n findings: SchemaFindings,\n): void {\n if (visited.has(schema)) return;\n visited.add(schema);\n\n if (schema instanceof z.ZodObject) {\n // A ZodObject is the only schema that NAMES anything, so its fields are\n // walked here, by name, rather than through the structural pass below.\n for (const [propertyName, field] of Object.entries(schema.shape)) {\n const fieldPath = [...path, propertyName];\n if (isUnstorablePropertyName(propertyName)) {\n findings.unstorable.push(formatSchemaPath(fieldPath));\n }\n if (field instanceof z.ZodType) {\n collectSchemaFindings(field, fieldPath, visited, findings);\n }\n }\n }\n\n // Runs for a ZodObject too, so its `catchall` is covered; the shape schemas it\n // re-reaches are already in `visited` and cost one set lookup each.\n for (const nested of nestedSchemasOf(schema, path, findings)) {\n collectSchemaFindings(nested, path, visited, findings);\n }\n}\n\n/**\n * Properties starting with `$` are reserved for TypeGraph-owned accessors\n * on the query-builder node/edge proxies (today: `$fulltext`). Reserving\n * the whole prefix — not just the currently-used names — keeps future\n * accessors (e.g. `$vector`, `$json`) from colliding with user fields.\n */\nconst RESERVED_PROPERTY_PREFIX = \"$\";\n\n/**\n * True if a user-defined field name is reserved by TypeGraph's accessor\n * namespace. `defineNode` / `defineEdge` call this against schema keys so\n * the collision fails fast at graph-definition time rather than silently\n * at query time.\n */\nfunction isReservedPropertyName(name: string): boolean {\n return name.startsWith(RESERVED_PROPERTY_PREFIX);\n}\n\n/**\n * Validates that a node or edge schema does not use any reserved property\n * name. Covers the unstorable name (at ANY depth), the structural keys (`id`,\n * `kind`, etc.) and the `$`-prefix accessor namespace. Throws a single\n * `ConfigurationError` per conflict class so the user sees all collisions in\n * one pass.\n *\n * A FOURTH class is refused here, and it is about the verdict rather than about\n * a name: a `z.lazy` whose getter cannot run yet. The walk must be able to see\n * the whole schema to answer at all, this is the only moment it ever runs, and\n * a branch it could not enter is a branch nothing will ever check. Refusing is\n * the fail-CLOSED reading of \"cannot judge\"; returning a clean verdict for a\n * subtree that was never looked at is the fail-open one.\n *\n * Takes the SCHEMA rather than its top-level key list: the unstorable-name\n * check is recursive, and a caller that could only hand over `Object.keys(\n * schema.shape)` could not express that.\n *\n * The structural and `$`-prefix classes stay top-level-only, and that is a\n * decision rather than an omission: both are about names TypeGraph itself\n * occupies on the node/edge OBJECT it hands back (`id`, `kind`, `meta`,\n * `$fulltext`), and nothing is projected onto a nested object, so a nested\n * field may legitimately be called `id`. Only unstorability is a property of\n * the schema layer at every depth.\n */\nexport function assertSchemaKeysAreFree(\n entityKind: \"Node\" | \"Edge\",\n name: string,\n schema: z.ZodObject<z.ZodRawShape>,\n reservedStructuralKeys: ReadonlySet<string>,\n): void {\n // A field named `__proto__` is UNSTORABLE, not merely reserved: Zod accepts\n // it in a shape but drops it from every parse result — and reports success\n // even when the field is required — so a write to it is silently lost.\n //\n // `validateGraphExtension` already refuses exactly this declaration for a\n // kind authored as a JSON document (`RESERVED_PROPERTY_NAME`), AT ANY DEPTH.\n // Checking only the top-level shape here left the two authoring paths\n // disagreeing again one level down: `z.object({ payload: z.object({\n // [\"__proto__\"]: z.string() }) })` was accepted, and the nested write was\n // dropped at parse exactly as the top-level one had been.\n //\n // Reachable only through a COMPUTED key — `z.object({ __proto__: … })`\n // written literally sets the shape object's prototype instead of creating\n // the entry — but `z.object({ [\"__proto__\"]: z.string() })` yields a shape\n // whose `Object.keys` really does contain it.\n const findings: SchemaFindings = { unstorable: [], unresolvableLazy: [] };\n collectSchemaFindings(schema, [], new Set(), findings);\n\n // Refused FIRST, because it is the reason the rest of the verdict may be\n // incomplete: an unrunnable `z.lazy` getter hides everything beneath it, and\n // a definition is validated exactly once, so \"judge it later\" is not on\n // offer. See `resolveLazySchema`.\n if (findings.unresolvableLazy.length > 0) {\n const label = entityKind.toLowerCase();\n const locations = findings.unresolvableLazy.map((lazy) =>\n lazy.path === \"\" ? SCHEMA_ROOT_PATH_LABEL : lazy.path,\n );\n throw new ConfigurationError(\n `${entityKind} \"${name}\" schema contains a z.lazy() whose schema is not available yet at ${label}-definition time: ${locations.join(\", \")}`,\n {\n [`${label}Type`]: name,\n conflicts: locations,\n },\n {\n cause: findings.unresolvableLazy[0]?.cause,\n suggestion:\n `Declare every schema the lazy getter references BEFORE this ` +\n `define${entityKind} call — a mutually recursive pair works when ` +\n `both z.object() consts are initialized first, and the getters then ` +\n `resolve. TypeGraph must read through the whole schema at definition ` +\n `time to refuse property names it cannot store, and a getter that ` +\n `throws leaves that subtree unchecked forever.`,\n },\n );\n }\n\n const unstorableConflicts = findings.unstorable;\n if (unstorableConflicts.length > 0) {\n const label = entityKind.toLowerCase();\n throw new ConfigurationError(\n `${entityKind} \"${name}\" schema declares a property named \"${UNSTORABLE_PROPERTY_NAME}\", which ${UNSTORABLE_PROPERTY_NAME_REASON}: ${unstorableConflicts.join(\", \")}`,\n {\n [`${label}Type`]: name,\n conflicts: unstorableConflicts,\n },\n {\n suggestion: `Rename the property at ${unstorableConflicts.join(\", \")}. Zod drops \"${UNSTORABLE_PROPERTY_NAME}\" from every parse result, so a value written to it would be silently lost.`,\n },\n );\n }\n\n const keys = Object.keys(schema.shape);\n const structuralConflicts = keys.filter((key) =>\n reservedStructuralKeys.has(key),\n );\n if (structuralConflicts.length > 0) {\n const label = entityKind.toLowerCase();\n throw new ConfigurationError(\n `${entityKind} \"${name}\" schema contains reserved property names: ${structuralConflicts.join(\", \")}`,\n {\n [`${label}Type`]: name,\n conflicts: structuralConflicts,\n reservedKeys: [...reservedStructuralKeys],\n },\n {\n suggestion: `Rename the conflicting properties. Reserved names (${[...reservedStructuralKeys].join(\", \")}) are added automatically to all ${label}s.`,\n },\n );\n }\n\n const prefixConflicts = keys.filter((key) => isReservedPropertyName(key));\n if (prefixConflicts.length > 0) {\n const label = entityKind.toLowerCase();\n throw new ConfigurationError(\n `${entityKind} \"${name}\" schema uses the reserved \"${RESERVED_PROPERTY_PREFIX}\" prefix on: ${prefixConflicts.join(\", \")}`,\n {\n [`${label}Type`]: name,\n conflicts: prefixConflicts,\n reservedPrefix: RESERVED_PROPERTY_PREFIX,\n },\n {\n suggestion: `Property names starting with \"${RESERVED_PROPERTY_PREFIX}\" are reserved for TypeGraph accessors (e.g. $fulltext). Rename each field.`,\n },\n );\n }\n}\n\n/**\n * Validates that a projection field name is safe to assign onto a result object.\n * Rejects reserved structural keys and prototype-pollution vectors.\n *\n * @throws ConfigurationError if the field is reserved or dangerous\n */\nexport function validateProjectionField(\n field: string,\n entityType: KindEntity,\n kind: string,\n): void {\n const reserved =\n entityType === \"node\" ? RESERVED_NODE_KEYS : RESERVED_EDGE_KEYS;\n\n if (reserved.has(field)) {\n throw new ConfigurationError(\n `Projection field \"${field}\" on ${entityType} kind \"${kind}\" conflicts with a reserved structural key`,\n { field, kind, entityType, reservedKeys: [...reserved] },\n {\n suggestion: `Remove \"${field}\" from the projection. Structural fields (${[...reserved].join(\", \")}) are included automatically when relevant.`,\n },\n );\n }\n\n if (PROTOTYPE_POLLUTION_KEYS.has(field)) {\n throw new ConfigurationError(\n `Projection field \"${field}\" on ${entityType} kind \"${kind}\" is not allowed`,\n { field, kind, entityType },\n {\n suggestion: `\"${field}\" cannot be used as a projection field name.`,\n },\n );\n }\n}\n\n/**\n * Filters out reserved keys from a props object to prevent runtime collisions.\n */\nexport function filterReservedKeys(\n props: Record<string, unknown>,\n reservedKeys: ReadonlySet<string>,\n): Record<string, unknown> {\n // Props keys are DATA (a trusted import writes a caller's bag verbatim, and\n // `JSON.parse` yields `__proto__` as an own key), so the accumulator must be\n // null-prototype — a `{}` literal would answer `filtered[\"__proto__\"] = v`\n // with the prototype setter and silently drop the value.\n const filtered = createDataKeyedBag<unknown>();\n for (const [key, value] of Object.entries(props)) {\n if (!reservedKeys.has(key)) {\n filtered[key] = value;\n }\n }\n return filtered;\n}\n","/**\n * Runtime validation for JSON-serializable values.\n *\n * Used at definition-time boundaries (e.g., `defineNode`/`defineEdge` annotations)\n * to reject values that would silently break `JSON.stringify` round-trips or\n * throw at hash time. Catches accidental violations from untyped JS callers\n * and `as any` escape hatches that bypass the `JsonValue` type.\n */\nimport { ConfigurationError } from \"../errors\";\nimport { isPlainObject } from \"../utils/object\";\n\n/**\n * Asserts that `value` is JSON-serializable.\n *\n * Throws `ConfigurationError` with a dotted path identifying the offending\n * field. Rejects `bigint`, `function`, `symbol`, `undefined`, and class\n * instances such as `Date`, `Map`, `Set`, regex literals, and Buffers — all\n * of which either throw or silently coerce under `JSON.stringify`.\n *\n * @param value - The value to validate\n * @param rootLabel - Label for the root of the value (e.g., `\"annotations\"`)\n * used as the prefix of the error path\n * @param ownerKind - Human-readable owner identifier for the error message\n * (e.g., `'Node \"Person\"'`)\n */\nexport function assertJsonValue(\n value: unknown,\n rootLabel: string,\n ownerKind: string,\n): void {\n walk(value, rootLabel, ownerKind);\n}\n\nfunction walk(value: unknown, path: string, ownerKind: string): void {\n if (value === null) return;\n const valueType = typeof value;\n if (valueType === \"number\") {\n // NaN/Infinity/-Infinity are not JSON values; JSON.stringify silently\n // coerces them to `null`, which would change the canonical hash input\n // without the consumer noticing.\n if (!Number.isFinite(value)) {\n throwInvalid(path, describeNonFinite(value as number), ownerKind);\n }\n return;\n }\n if (valueType === \"string\" || valueType === \"boolean\") return;\n if (\n valueType === \"bigint\" ||\n valueType === \"function\" ||\n valueType === \"symbol\" ||\n valueType === \"undefined\"\n ) {\n throwInvalid(path, valueType, ownerKind);\n }\n if (Array.isArray(value)) {\n for (const [index, element] of value.entries()) {\n walk(element, `${path}[${index}]`, ownerKind);\n }\n return;\n }\n if (!isPlainObject(value)) {\n throwInvalid(path, describeNonPlain(value), ownerKind);\n }\n for (const [key, nested] of Object.entries(value)) {\n walk(nested, `${path}.${key}`, ownerKind);\n }\n}\n\nfunction describeNonFinite(value: number): string {\n if (Number.isNaN(value)) return \"NaN\";\n if (value === Number.POSITIVE_INFINITY) return \"Infinity\";\n if (value === Number.NEGATIVE_INFINITY) return \"-Infinity\";\n return \"non-finite number\";\n}\n\nfunction describeNonPlain(value: unknown): string {\n const constructorName = (value as { constructor?: { name?: unknown } } | null)\n ?.constructor?.name;\n if (typeof constructorName === \"string\" && constructorName.length > 0) {\n return `${constructorName} instance`;\n }\n return \"non-plain object\";\n}\n\nfunction throwInvalid(path: string, kind: string, ownerKind: string): never {\n throw new ConfigurationError(\n `${ownerKind} ${path} contains a non-JSON value (${kind}). Annotations must be JSON-serializable.`,\n { path, valueKind: kind },\n {\n suggestion:\n \"Use only strings, numbers, booleans, null, arrays, and plain objects in annotations.\",\n },\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/store/reserved-keys.ts","../src/core/json-value.ts"],"names":["z","isPlainObject","ConfigurationError","createDataKeyedBag"],"mappings":";;;;;;AAYO,IAAM,kBAAA,uBAA8C,GAAA,CAAI;AAAA,EAC7D,IAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,kBAAA,uBAA8C,GAAA,CAAI;AAAA,EAC7D,IAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAC;AAED,IAAM,wBAAA,uBAAoD,GAAA,CAAI;AAAA,EAC5D,WAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAC,CAAA;AAkBD,IAAM,wBAAA,GAA2B,WAAA;AAM1B,IAAM,+BAAA,GACX;AAGK,SAAS,yBAAyB,IAAA,EAAuB;AAC9D,EAAA,OAAO,IAAA,KAAS,wBAAA;AAClB;AAOA,SAAS,iBAAiB,QAAA,EAAqC;AAC7D,EAAA,OAAO,QAAA,CAAS,KAAK,GAAG,CAAA;AAC1B;AAGA,IAAM,sBAAA,GAAyB,eAAA;AAe/B,SAAS,oBAAA,CAAqB,OAAgB,KAAA,EAA0B;AACtE,EAAA,IAAI,KAAA,YAAiBA,MAAE,OAAA,EAAS;AAC9B,IAAA,KAAA,CAAM,KAAK,KAAK,CAAA;AAChB,IAAA;AAAA,EACF;AAC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chunk-6NGW27EO.cjs","sourcesContent":["/**\n * Reserved Keys for Store Entities\n *\n * Structural keys that cannot be overwritten by user-defined properties.\n * Shared across row-mappers, subgraph projection, and schema validation.\n */\nimport { z } from \"zod\";\n\nimport type { KindEntity } from \"../core/types\";\nimport { ConfigurationError } from \"../errors\";\nimport { createDataKeyedBag, isPlainObject } from \"../utils/object\";\n\nexport const RESERVED_NODE_KEYS: ReadonlySet<string> = new Set([\n \"id\",\n \"kind\",\n \"meta\",\n]);\n\nexport const RESERVED_EDGE_KEYS: ReadonlySet<string> = new Set([\n \"id\",\n \"kind\",\n \"meta\",\n \"fromKind\",\n \"fromId\",\n \"toKind\",\n \"toId\",\n]);\n\nconst PROTOTYPE_POLLUTION_KEYS: ReadonlySet<string> = new Set([\n \"__proto__\",\n \"constructor\",\n \"prototype\",\n]);\n\n/**\n * The property name the SCHEMA LAYER cannot carry, and the single owner of that\n * question — every authoring path asks here rather than re-spelling the literal.\n *\n * Zod accepts `__proto__` in a shape but drops it from every parse result, and\n * reports success even when the field is required, so a value written to such a\n * field is silently lost. A declaration naming it is therefore refused rather\n * than accepted as a field the storage layer can never honor.\n *\n * TWO authoring paths ask, and they stay separate walkers by necessity — one\n * traverses Zod schemas (`defineNode` / `defineEdge`, below), the other JSON\n * property descriptors (`validateGraphExtension`, in\n * ./../graph-extension/validation.ts) — but the VERDICT and the reason they give\n * for it are shared from here, because a name unstorable on one path is\n * unstorable on the other: both compile to the same `z.object(...)`.\n */\nconst UNSTORABLE_PROPERTY_NAME = \"__proto__\";\n\n/**\n * The shared explanation both authoring paths give when they refuse\n * {@link UNSTORABLE_PROPERTY_NAME}, so the two refusals read as one rule.\n */\nexport const UNSTORABLE_PROPERTY_NAME_REASON =\n \"schema validation cannot carry it\";\n\n/** See {@link UNSTORABLE_PROPERTY_NAME}. */\nexport function isUnstorablePropertyName(name: string): boolean {\n return name === UNSTORABLE_PROPERTY_NAME;\n}\n\n/**\n * Renders a nested property path for a refusal message: object field names\n * joined by `.`, with the wrappers between them (optional, array, union, …)\n * contributing no segment because they name nothing.\n */\nfunction formatSchemaPath(segments: readonly string[]): string {\n return segments.join(\".\");\n}\n\n/** How a refusal names a location that is the schema itself, not a field. */\nconst SCHEMA_ROOT_PATH_LABEL = \"(schema root)\";\n\n/**\n * Every schema reachable one step down from `value` — a schema, an array of\n * them, or a plain object holding them.\n *\n * Deliberately STRUCTURAL rather than a per-Zod-type enumeration: every\n * composite (`array`, `record`, `map`, `set`, `tuple`, `union`, `intersection`,\n * `pipe`) and every wrapper (`optional`, `nullable`, `default`, `prefault`,\n * `catch`, `readonly`, `nonoptional`, `promise`) stores its inner schemas as\n * ordinary values of the public {@link z.ZodType.def} record, so one walk covers\n * all of them — including any Zod adds later. An enumeration would silently\n * stop covering the type it forgot, which is precisely how this defect class\n * survived a depth-0-only fix.\n */\nfunction collectNestedSchemas(value: unknown, found: z.ZodType[]): void {\n if (value instanceof z.ZodType) {\n found.push(value);\n return;\n }\n if (Array.isArray(value)) {\n for (const item of value) collectNestedSchemas(item, found);\n return;\n }\n if (isPlainObject(value)) {\n for (const nested of Object.values(value)) {\n collectNestedSchemas(nested, found);\n }\n }\n}\n\n/** A `z.lazy` whose getter could not run, and where in the schema it sits. */\ntype UnresolvableLazy = Readonly<{ path: string; cause: unknown }>;\n\n/** What one walk of a schema found. */\ntype SchemaFindings = Readonly<{\n unstorable: string[];\n unresolvableLazy: UnresolvableLazy[];\n}>;\n\n/**\n * The inner schema of a `z.lazy`, or the reason its getter could not run.\n *\n * `z.lazy` is the one shape the structural walk cannot see — its inner schema\n * hangs off a `getter` FUNCTION rather than a `def` value — so it is unwrapped\n * through the public `unwrap()`, which RUNS that getter. Running it is the only\n * way to inspect what it wraps, and the `visited` set in the caller makes the\n * resulting recursion safe for a self-referential schema.\n *\n * The failure is REPORTED rather than swallowed, and that is the whole contract\n * of this function. `unwrap()` throws when the getter names a binding still in\n * its temporal dead zone — a mutually recursive pair whose second `z.object`\n * const is declared AFTER the `defineNode` call that walks the first. Returning\n * `undefined` there made the walk fail OPEN: the subtree was never judged, and\n * because a definition is validated exactly once, it was never judged later\n * either — so a nested `__proto__` under that subtree was accepted at\n * definition time and then silently dropped by every parse, which is the exact\n * defect this validation exists to prevent. A branch that cannot be looked at\n * is refused, not waved through.\n */\nfunction resolveLazySchema(schema: z.ZodLazy<z.core.SomeType>):\n | Readonly<{ resolved: true; inner: unknown }>\n | Readonly<{\n resolved: false;\n cause: unknown;\n }> {\n try {\n return { resolved: true, inner: schema.unwrap() };\n } catch (error) {\n return { resolved: false, cause: error };\n }\n}\n\n/**\n * The schemas nested directly inside `schema`, recording an unrunnable `z.lazy`\n * getter in `findings` instead of quietly yielding nothing for it.\n */\nfunction nestedSchemasOf(\n schema: z.ZodType,\n path: readonly string[],\n findings: SchemaFindings,\n): readonly z.ZodType[] {\n const found: z.ZodType[] = [];\n if (schema instanceof z.ZodLazy) {\n const resolution = resolveLazySchema(schema);\n if (!resolution.resolved) {\n findings.unresolvableLazy.push({\n path: formatSchemaPath(path),\n cause: resolution.cause,\n });\n return found;\n }\n collectNestedSchemas(resolution.inner, found);\n return found;\n }\n collectNestedSchemas(Object.values(schema.def), found);\n return found;\n}\n\n/**\n * Collects the path of every property named {@link UNSTORABLE_PROPERTY_NAME}\n * anywhere in `schema`, at any depth and behind any wrapper — and the path of\n * every `z.lazy` that stopped the walk from getting there.\n *\n * `visited` both terminates recursive schemas and keeps a schema reused under\n * several fields from being re-walked; a name is reported once, which is enough\n * to refuse the definition.\n */\nfunction collectSchemaFindings(\n schema: z.ZodType,\n path: readonly string[],\n visited: Set<z.ZodType>,\n findings: SchemaFindings,\n): void {\n if (visited.has(schema)) return;\n visited.add(schema);\n\n if (schema instanceof z.ZodObject) {\n // A ZodObject is the only schema that NAMES anything, so its fields are\n // walked here, by name, rather than through the structural pass below.\n for (const [propertyName, field] of Object.entries(schema.shape)) {\n const fieldPath = [...path, propertyName];\n if (isUnstorablePropertyName(propertyName)) {\n findings.unstorable.push(formatSchemaPath(fieldPath));\n }\n if (field instanceof z.ZodType) {\n collectSchemaFindings(field, fieldPath, visited, findings);\n }\n }\n }\n\n // Runs for a ZodObject too, so its `catchall` is covered; the shape schemas it\n // re-reaches are already in `visited` and cost one set lookup each.\n for (const nested of nestedSchemasOf(schema, path, findings)) {\n collectSchemaFindings(nested, path, visited, findings);\n }\n}\n\n/**\n * Properties starting with `$` are reserved for TypeGraph-owned accessors\n * on the query-builder node/edge proxies (today: `$fulltext`). Reserving\n * the whole prefix — not just the currently-used names — keeps future\n * accessors (e.g. `$vector`, `$json`) from colliding with user fields.\n */\nconst RESERVED_PROPERTY_PREFIX = \"$\";\n\n/**\n * True if a user-defined field name is reserved by TypeGraph's accessor\n * namespace. `defineNode` / `defineEdge` call this against schema keys so\n * the collision fails fast at graph-definition time rather than silently\n * at query time.\n */\nfunction isReservedPropertyName(name: string): boolean {\n return name.startsWith(RESERVED_PROPERTY_PREFIX);\n}\n\n/**\n * Validates that a node or edge schema does not use any reserved property\n * name. Covers the unstorable name (at ANY depth), the structural keys (`id`,\n * `kind`, etc.) and the `$`-prefix accessor namespace. Throws a single\n * `ConfigurationError` per conflict class so the user sees all collisions in\n * one pass.\n *\n * A FOURTH class is refused here, and it is about the verdict rather than about\n * a name: a `z.lazy` whose getter cannot run yet. The walk must be able to see\n * the whole schema to answer at all, this is the only moment it ever runs, and\n * a branch it could not enter is a branch nothing will ever check. Refusing is\n * the fail-CLOSED reading of \"cannot judge\"; returning a clean verdict for a\n * subtree that was never looked at is the fail-open one.\n *\n * Takes the SCHEMA rather than its top-level key list: the unstorable-name\n * check is recursive, and a caller that could only hand over `Object.keys(\n * schema.shape)` could not express that.\n *\n * The structural and `$`-prefix classes stay top-level-only, and that is a\n * decision rather than an omission: both are about names TypeGraph itself\n * occupies on the node/edge OBJECT it hands back (`id`, `kind`, `meta`,\n * `$fulltext`), and nothing is projected onto a nested object, so a nested\n * field may legitimately be called `id`. Only unstorability is a property of\n * the schema layer at every depth.\n */\nexport function assertSchemaKeysAreFree(\n entityKind: \"Node\" | \"Edge\",\n name: string,\n schema: z.ZodObject<z.ZodRawShape>,\n reservedStructuralKeys: ReadonlySet<string>,\n): void {\n // A field named `__proto__` is UNSTORABLE, not merely reserved: Zod accepts\n // it in a shape but drops it from every parse result — and reports success\n // even when the field is required — so a write to it is silently lost.\n //\n // `validateGraphExtension` already refuses exactly this declaration for a\n // kind authored as a JSON document (`RESERVED_PROPERTY_NAME`), AT ANY DEPTH.\n // Checking only the top-level shape here left the two authoring paths\n // disagreeing again one level down: `z.object({ payload: z.object({\n // [\"__proto__\"]: z.string() }) })` was accepted, and the nested write was\n // dropped at parse exactly as the top-level one had been.\n //\n // Reachable only through a COMPUTED key — `z.object({ __proto__: … })`\n // written literally sets the shape object's prototype instead of creating\n // the entry — but `z.object({ [\"__proto__\"]: z.string() })` yields a shape\n // whose `Object.keys` really does contain it.\n const findings: SchemaFindings = { unstorable: [], unresolvableLazy: [] };\n collectSchemaFindings(schema, [], new Set(), findings);\n\n // Refused FIRST, because it is the reason the rest of the verdict may be\n // incomplete: an unrunnable `z.lazy` getter hides everything beneath it, and\n // a definition is validated exactly once, so \"judge it later\" is not on\n // offer. See `resolveLazySchema`.\n if (findings.unresolvableLazy.length > 0) {\n const label = entityKind.toLowerCase();\n const locations = findings.unresolvableLazy.map((lazy) =>\n lazy.path === \"\" ? SCHEMA_ROOT_PATH_LABEL : lazy.path,\n );\n throw new ConfigurationError(\n `${entityKind} \"${name}\" schema contains a z.lazy() whose schema is not available yet at ${label}-definition time: ${locations.join(\", \")}`,\n {\n [`${label}Type`]: name,\n conflicts: locations,\n },\n {\n cause: findings.unresolvableLazy[0]?.cause,\n suggestion:\n `Declare every schema the lazy getter references BEFORE this ` +\n `define${entityKind} call — a mutually recursive pair works when ` +\n `both z.object() consts are initialized first, and the getters then ` +\n `resolve. TypeGraph must read through the whole schema at definition ` +\n `time to refuse property names it cannot store, and a getter that ` +\n `throws leaves that subtree unchecked forever.`,\n },\n );\n }\n\n const unstorableConflicts = findings.unstorable;\n if (unstorableConflicts.length > 0) {\n const label = entityKind.toLowerCase();\n throw new ConfigurationError(\n `${entityKind} \"${name}\" schema declares a property named \"${UNSTORABLE_PROPERTY_NAME}\", which ${UNSTORABLE_PROPERTY_NAME_REASON}: ${unstorableConflicts.join(\", \")}`,\n {\n [`${label}Type`]: name,\n conflicts: unstorableConflicts,\n },\n {\n suggestion: `Rename the property at ${unstorableConflicts.join(\", \")}. Zod drops \"${UNSTORABLE_PROPERTY_NAME}\" from every parse result, so a value written to it would be silently lost.`,\n },\n );\n }\n\n const keys = Object.keys(schema.shape);\n const structuralConflicts = keys.filter((key) =>\n reservedStructuralKeys.has(key),\n );\n if (structuralConflicts.length > 0) {\n const label = entityKind.toLowerCase();\n throw new ConfigurationError(\n `${entityKind} \"${name}\" schema contains reserved property names: ${structuralConflicts.join(\", \")}`,\n {\n [`${label}Type`]: name,\n conflicts: structuralConflicts,\n reservedKeys: [...reservedStructuralKeys],\n },\n {\n suggestion: `Rename the conflicting properties. Reserved names (${[...reservedStructuralKeys].join(\", \")}) are added automatically to all ${label}s.`,\n },\n );\n }\n\n const prefixConflicts = keys.filter((key) => isReservedPropertyName(key));\n if (prefixConflicts.length > 0) {\n const label = entityKind.toLowerCase();\n throw new ConfigurationError(\n `${entityKind} \"${name}\" schema uses the reserved \"${RESERVED_PROPERTY_PREFIX}\" prefix on: ${prefixConflicts.join(\", \")}`,\n {\n [`${label}Type`]: name,\n conflicts: prefixConflicts,\n reservedPrefix: RESERVED_PROPERTY_PREFIX,\n },\n {\n suggestion: `Property names starting with \"${RESERVED_PROPERTY_PREFIX}\" are reserved for TypeGraph accessors (e.g. $fulltext). Rename each field.`,\n },\n );\n }\n}\n\n/**\n * Validates that a projection field name is safe to assign onto a result object.\n * Rejects reserved structural keys and prototype-pollution vectors.\n *\n * @throws ConfigurationError if the field is reserved or dangerous\n */\nexport function validateProjectionField(\n field: string,\n entityType: KindEntity,\n kind: string,\n): void {\n const reserved =\n entityType === \"node\" ? RESERVED_NODE_KEYS : RESERVED_EDGE_KEYS;\n\n if (reserved.has(field)) {\n throw new ConfigurationError(\n `Projection field \"${field}\" on ${entityType} kind \"${kind}\" conflicts with a reserved structural key`,\n { field, kind, entityType, reservedKeys: [...reserved] },\n {\n suggestion: `Remove \"${field}\" from the projection. Structural fields (${[...reserved].join(\", \")}) are included automatically when relevant.`,\n },\n );\n }\n\n if (PROTOTYPE_POLLUTION_KEYS.has(field)) {\n throw new ConfigurationError(\n `Projection field \"${field}\" on ${entityType} kind \"${kind}\" is not allowed`,\n { field, kind, entityType },\n {\n suggestion: `\"${field}\" cannot be used as a projection field name.`,\n },\n );\n }\n}\n\n/**\n * Filters out reserved keys from a props object to prevent runtime collisions.\n */\nexport function filterReservedKeys(\n props: Record<string, unknown>,\n reservedKeys: ReadonlySet<string>,\n): Record<string, unknown> {\n // Props keys are DATA (a trusted import writes a caller's bag verbatim, and\n // `JSON.parse` yields `__proto__` as an own key), so the accumulator must be\n // null-prototype — a `{}` literal would answer `filtered[\"__proto__\"] = v`\n // with the prototype setter and silently drop the value.\n const filtered = createDataKeyedBag<unknown>();\n for (const [key, value] of Object.entries(props)) {\n if (!reservedKeys.has(key)) {\n filtered[key] = value;\n }\n }\n return filtered;\n}\n","/**\n * Runtime validation for JSON-serializable values.\n *\n * Used at definition-time boundaries (e.g., `defineNode`/`defineEdge` annotations)\n * to reject values that would silently break `JSON.stringify` round-trips or\n * throw at hash time. Catches accidental violations from untyped JS callers\n * and `as any` escape hatches that bypass the `JsonValue` type.\n */\nimport { ConfigurationError } from \"../errors\";\nimport { isPlainObject } from \"../utils/object\";\n\n/**\n * Asserts that `value` is JSON-serializable.\n *\n * Throws `ConfigurationError` with a dotted path identifying the offending\n * field. Rejects `bigint`, `function`, `symbol`, `undefined`, and class\n * instances such as `Date`, `Map`, `Set`, regex literals, and Buffers — all\n * of which either throw or silently coerce under `JSON.stringify`.\n *\n * @param value - The value to validate\n * @param rootLabel - Label for the root of the value (e.g., `\"annotations\"`)\n * used as the prefix of the error path\n * @param ownerKind - Human-readable owner identifier for the error message\n * (e.g., `'Node \"Person\"'`)\n */\nexport function assertJsonValue(\n value: unknown,\n rootLabel: string,\n ownerKind: string,\n): void {\n walk(value, rootLabel, ownerKind);\n}\n\nfunction walk(value: unknown, path: string, ownerKind: string): void {\n if (value === null) return;\n const valueType = typeof value;\n if (valueType === \"number\") {\n // NaN/Infinity/-Infinity are not JSON values; JSON.stringify silently\n // coerces them to `null`, which would change the canonical hash input\n // without the consumer noticing.\n if (!Number.isFinite(value)) {\n throwInvalid(path, describeNonFinite(value as number), ownerKind);\n }\n return;\n }\n if (valueType === \"string\" || valueType === \"boolean\") return;\n if (\n valueType === \"bigint\" ||\n valueType === \"function\" ||\n valueType === \"symbol\" ||\n valueType === \"undefined\"\n ) {\n throwInvalid(path, valueType, ownerKind);\n }\n if (Array.isArray(value)) {\n for (const [index, element] of value.entries()) {\n walk(element, `${path}[${index}]`, ownerKind);\n }\n return;\n }\n if (!isPlainObject(value)) {\n throwInvalid(path, describeNonPlain(value), ownerKind);\n }\n for (const [key, nested] of Object.entries(value)) {\n walk(nested, `${path}.${key}`, ownerKind);\n }\n}\n\nfunction describeNonFinite(value: number): string {\n if (Number.isNaN(value)) return \"NaN\";\n if (value === Number.POSITIVE_INFINITY) return \"Infinity\";\n if (value === Number.NEGATIVE_INFINITY) return \"-Infinity\";\n return \"non-finite number\";\n}\n\nfunction describeNonPlain(value: unknown): string {\n const constructorName = (value as { constructor?: { name?: unknown } } | null)\n ?.constructor?.name;\n if (typeof constructorName === \"string\" && constructorName.length > 0) {\n return `${constructorName} instance`;\n }\n return \"non-plain object\";\n}\n\nfunction throwInvalid(path: string, kind: string, ownerKind: string): never {\n throw new ConfigurationError(\n `${ownerKind} ${path} contains a non-JSON value (${kind}). Annotations must be JSON-serializable.`,\n { path, valueKind: kind },\n {\n suggestion:\n \"Use only strings, numbers, booleans, null, arrays, and plain objects in annotations.\",\n },\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { buildPostgresSystemIndexBuilders, buildPostgresNodeIndexBuilders, buildPostgresEdgeIndexBuilders, buildSqliteSystemIndexBuilders, buildSqliteNodeIndexBuilders, buildSqliteEdgeIndexBuilders } from './chunk-AU3IJNNP.js';
2
- import { assertNoSystemIndexNameCollision } from './chunk-FSLTU57P.js';
3
- import { tsvectorStrategy, fts5Strategy, BASE_CONTRIBUTION_OWNER } from './chunk-EAMVXR5B.js';
1
+ import { buildPostgresSystemIndexBuilders, buildPostgresNodeIndexBuilders, buildPostgresEdgeIndexBuilders, buildSqliteSystemIndexBuilders, buildSqliteNodeIndexBuilders, buildSqliteEdgeIndexBuilders } from './chunk-OMZ37BM2.js';
2
+ import { assertNoSystemIndexNameCollision } from './chunk-SDBBMD4N.js';
3
+ import { tsvectorStrategy, fts5Strategy, BASE_CONTRIBUTION_OWNER } from './chunk-ZDKTPBGV.js';
4
4
  import { sql, is } from 'drizzle-orm';
5
5
  import { customType, pgTable, timestamp, integer, jsonb, text, primaryKey, bigint, index, uniqueIndex, check, boolean, getTableConfig as getTableConfig$1, PgTable } from 'drizzle-orm/pg-core';
6
6
  import { sqliteTable, text as text$1, integer as integer$1, primaryKey as primaryKey$1, index as index$1, uniqueIndex as uniqueIndex$1, check as check$1, getTableConfig, SQLiteTable } from 'drizzle-orm/sqlite-core';
@@ -1122,5 +1122,5 @@ ${ddlSql}`;
1122
1122
  }
1123
1123
 
1124
1124
  export { LEGACY_EMBEDDINGS_TABLE_NAME, createPostgresTables, createSqliteTables, edges, edges2, fulltext, generatePgCreateTableSQL, generatePostgresDDL, generatePostgresMigrationSQL, generateSqliteCreateTableSQL, generateSqliteDDL, generateSqliteMigrationSQL, nodes, nodes2, postgresContributions, recordedClock, recordedClock2, recordedEdges, recordedEdges2, recordedNodes, recordedNodes2, runtimeStrategyContributions, schemaVersions, schemaVersions2, sqliteContributions, tables, tables2, uniques, uniques2 };
1125
- //# sourceMappingURL=chunk-WHS2Y43J.js.map
1126
- //# sourceMappingURL=chunk-WHS2Y43J.js.map
1125
+ //# sourceMappingURL=chunk-6SWPJEYN.js.map
1126
+ //# sourceMappingURL=chunk-6SWPJEYN.js.map