@nicia-ai/typegraph 0.43.0 → 0.45.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 (307) hide show
  1. package/dist/backend/drizzle/indexes.cjs +9 -9
  2. package/dist/backend/drizzle/indexes.d.cts +1 -1
  3. package/dist/backend/drizzle/indexes.d.ts +1 -1
  4. package/dist/backend/drizzle/indexes.js +5 -5
  5. package/dist/backend/index.cjs +50 -50
  6. package/dist/backend/index.d.cts +3 -3
  7. package/dist/backend/index.d.ts +3 -3
  8. package/dist/backend/index.js +11 -11
  9. package/dist/backend/postgres/index.cjs +26 -26
  10. package/dist/backend/postgres/index.d.cts +6 -5
  11. package/dist/backend/postgres/index.d.ts +6 -5
  12. package/dist/backend/postgres/index.js +13 -13
  13. package/dist/backend/postgres/pglite-store.cjs +32 -33
  14. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  15. package/dist/backend/postgres/pglite-store.d.cts +7 -7
  16. package/dist/backend/postgres/pglite-store.d.ts +7 -7
  17. package/dist/backend/postgres/pglite-store.js +28 -29
  18. package/dist/backend/postgres/pglite-store.js.map +1 -1
  19. package/dist/backend/postgres/pglite.cjs +15 -15
  20. package/dist/backend/postgres/pglite.d.cts +3 -2
  21. package/dist/backend/postgres/pglite.d.ts +3 -2
  22. package/dist/backend/postgres/pglite.js +14 -14
  23. package/dist/backend/sqlite/index.cjs +23 -23
  24. package/dist/backend/sqlite/index.d.cts +7 -6
  25. package/dist/backend/sqlite/index.d.ts +7 -6
  26. package/dist/backend/sqlite/index.js +11 -11
  27. package/dist/backend/sqlite/libsql.cjs +17 -17
  28. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  29. package/dist/backend/sqlite/libsql.d.cts +3 -2
  30. package/dist/backend/sqlite/libsql.d.ts +3 -2
  31. package/dist/backend/sqlite/libsql.js +13 -13
  32. package/dist/backend/sqlite/libsql.js.map +1 -1
  33. package/dist/backend/sqlite/local-store.cjs +33 -34
  34. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  35. package/dist/backend/sqlite/local-store.d.cts +8 -7
  36. package/dist/backend/sqlite/local-store.d.ts +8 -7
  37. package/dist/backend/sqlite/local-store.js +29 -30
  38. package/dist/backend/sqlite/local-store.js.map +1 -1
  39. package/dist/backend/sqlite/local.cjs +16 -16
  40. package/dist/backend/sqlite/local.d.cts +3 -2
  41. package/dist/backend/sqlite/local.d.ts +3 -2
  42. package/dist/backend/sqlite/local.js +14 -14
  43. package/dist/{chunk-2OOY4OYT.js → chunk-2L54C2C2.js} +4 -4
  44. package/dist/{chunk-2OOY4OYT.js.map → chunk-2L54C2C2.js.map} +1 -1
  45. package/dist/{chunk-4WYFRACU.js → chunk-42PYUGLS.js} +58 -4
  46. package/dist/chunk-42PYUGLS.js.map +1 -0
  47. package/dist/{chunk-EQOQOT55.js → chunk-4GUBTVPV.js} +4 -5
  48. package/dist/chunk-4GUBTVPV.js.map +1 -0
  49. package/dist/{chunk-ZIRC2U6G.js → chunk-4GUTQPVO.js} +102 -16
  50. package/dist/chunk-4GUTQPVO.js.map +1 -0
  51. package/dist/{chunk-OYJSYDIH.js → chunk-4MB3AQAQ.js} +13 -3
  52. package/dist/chunk-4MB3AQAQ.js.map +1 -0
  53. package/dist/{chunk-5Q3P6OIC.cjs → chunk-4MEWSUVM.cjs} +12 -12
  54. package/dist/chunk-4MEWSUVM.cjs.map +1 -0
  55. package/dist/{chunk-VC26BUNP.js → chunk-4QIKLIGG.js} +17 -5
  56. package/dist/chunk-4QIKLIGG.js.map +1 -0
  57. package/dist/chunk-4SZ6XPTG.cjs +12 -0
  58. package/dist/{chunk-VGMNGWBR.cjs.map → chunk-4SZ6XPTG.cjs.map} +1 -1
  59. package/dist/{chunk-UZLEQFTV.js → chunk-55ITBQJI.js} +4 -4
  60. package/dist/chunk-55ITBQJI.js.map +1 -0
  61. package/dist/{chunk-JOYPNY33.js → chunk-5EKPX6QU.js} +9 -9
  62. package/dist/{chunk-JOYPNY33.js.map → chunk-5EKPX6QU.js.map} +1 -1
  63. package/dist/{chunk-TRC646QQ.cjs → chunk-5GAONX5G.cjs} +7 -7
  64. package/dist/{chunk-TRC646QQ.cjs.map → chunk-5GAONX5G.cjs.map} +1 -1
  65. package/dist/{chunk-M4GYQF2H.js → chunk-6DCB664D.js} +7 -4
  66. package/dist/chunk-6DCB664D.js.map +1 -0
  67. package/dist/{chunk-64LERBFM.cjs → chunk-6RYPD3NJ.cjs} +75 -65
  68. package/dist/chunk-6RYPD3NJ.cjs.map +1 -0
  69. package/dist/{chunk-5AERZSHC.cjs → chunk-7PF2L3H6.cjs} +4 -4
  70. package/dist/{chunk-5AERZSHC.cjs.map → chunk-7PF2L3H6.cjs.map} +1 -1
  71. package/dist/chunk-B3F2D3SP.cjs +12 -0
  72. package/dist/{chunk-U3YRCZ5L.cjs.map → chunk-B3F2D3SP.cjs.map} +1 -1
  73. package/dist/{chunk-Z3WIL6S3.js → chunk-BGYJW37L.js} +5 -5
  74. package/dist/{chunk-Z3WIL6S3.js.map → chunk-BGYJW37L.js.map} +1 -1
  75. package/dist/{chunk-DMZEVJGL.cjs → chunk-BNS75YNF.cjs} +12 -13
  76. package/dist/chunk-BNS75YNF.cjs.map +1 -0
  77. package/dist/{chunk-KTBTSHU6.cjs → chunk-C4F7VJ5D.cjs} +13 -3
  78. package/dist/chunk-C4F7VJ5D.cjs.map +1 -0
  79. package/dist/{chunk-L2BYRYHC.js → chunk-CBKG6HEP.js} +43 -33
  80. package/dist/chunk-CBKG6HEP.js.map +1 -0
  81. package/dist/{chunk-CVK4T34X.cjs → chunk-CPEL3YIR.cjs} +22 -22
  82. package/dist/{chunk-CVK4T34X.cjs.map → chunk-CPEL3YIR.cjs.map} +1 -1
  83. package/dist/{chunk-O2GZM7UK.cjs → chunk-D54WH24V.cjs} +62 -7
  84. package/dist/chunk-D54WH24V.cjs.map +1 -0
  85. package/dist/{chunk-33PAKPED.cjs → chunk-D56XG4EI.cjs} +53 -41
  86. package/dist/chunk-D56XG4EI.cjs.map +1 -0
  87. package/dist/{chunk-O3USVVWS.js → chunk-DK2S42XB.js} +3 -3
  88. package/dist/{chunk-O3USVVWS.js.map → chunk-DK2S42XB.js.map} +1 -1
  89. package/dist/{chunk-HHBKGPEI.js → chunk-DXEEHSGN.js} +517 -26
  90. package/dist/chunk-DXEEHSGN.js.map +1 -0
  91. package/dist/{chunk-UJRWOV5B.js → chunk-EFEOOCJ3.js} +5 -5
  92. package/dist/{chunk-UJRWOV5B.js.map → chunk-EFEOOCJ3.js.map} +1 -1
  93. package/dist/{chunk-ECU53PMN.cjs → chunk-EKFUG4G7.cjs} +5 -5
  94. package/dist/chunk-EKFUG4G7.cjs.map +1 -0
  95. package/dist/{chunk-FSCJOTHF.cjs → chunk-EQ7JKLZO.cjs} +10 -10
  96. package/dist/{chunk-FSCJOTHF.cjs.map → chunk-EQ7JKLZO.cjs.map} +1 -1
  97. package/dist/{chunk-AQR6BHB3.cjs → chunk-F4NHQHEZ.cjs} +10 -10
  98. package/dist/{chunk-AQR6BHB3.cjs.map → chunk-F4NHQHEZ.cjs.map} +1 -1
  99. package/dist/{chunk-2G6ZEGYO.js → chunk-FL5UQRES.js} +4 -4
  100. package/dist/{chunk-2G6ZEGYO.js.map → chunk-FL5UQRES.js.map} +1 -1
  101. package/dist/{chunk-ZP2KPDNN.js → chunk-FLEQ2HBK.js} +3 -3
  102. package/dist/{chunk-ZP2KPDNN.js.map → chunk-FLEQ2HBK.js.map} +1 -1
  103. package/dist/{chunk-RAWG2FEU.js → chunk-FQ7ZPOTZ.js} +264 -18
  104. package/dist/chunk-FQ7ZPOTZ.js.map +1 -0
  105. package/dist/{chunk-O7XVCLXW.cjs → chunk-H7VE3FL4.cjs} +577 -82
  106. package/dist/chunk-H7VE3FL4.cjs.map +1 -0
  107. package/dist/{chunk-JNXZQBN3.js → chunk-ID4WXTKL.js} +1039 -482
  108. package/dist/chunk-ID4WXTKL.js.map +1 -0
  109. package/dist/{chunk-ZGOUVMVS.js → chunk-ISLPNELU.js} +17 -5
  110. package/dist/chunk-ISLPNELU.js.map +1 -0
  111. package/dist/{chunk-I73ATSAH.cjs → chunk-IX64T5OL.cjs} +4 -4
  112. package/dist/{chunk-I73ATSAH.cjs.map → chunk-IX64T5OL.cjs.map} +1 -1
  113. package/dist/{chunk-XDMPDUKL.cjs → chunk-J2ICGNHO.cjs} +8 -9
  114. package/dist/chunk-J2ICGNHO.cjs.map +1 -0
  115. package/dist/{chunk-KDRF3NR2.cjs → chunk-J7LXTUTP.cjs} +295 -201
  116. package/dist/chunk-J7LXTUTP.cjs.map +1 -0
  117. package/dist/{chunk-AO2WPYFZ.cjs → chunk-JQXSZHF2.cjs} +14 -4
  118. package/dist/chunk-JQXSZHF2.cjs.map +1 -0
  119. package/dist/{chunk-UTTW2Q3M.cjs → chunk-JXUTCSXX.cjs} +197 -133
  120. package/dist/chunk-JXUTCSXX.cjs.map +1 -0
  121. package/dist/{chunk-GT7NEXSU.js → chunk-KCO5EFJU.js} +3 -3
  122. package/dist/{chunk-GT7NEXSU.js.map → chunk-KCO5EFJU.js.map} +1 -1
  123. package/dist/{chunk-ARN3ZODS.cjs → chunk-KKYELPZ2.cjs} +6 -6
  124. package/dist/{chunk-ARN3ZODS.cjs.map → chunk-KKYELPZ2.cjs.map} +1 -1
  125. package/dist/{chunk-7Y6BV3TK.cjs → chunk-KMXWZLQX.cjs} +100 -100
  126. package/dist/{chunk-7Y6BV3TK.cjs.map → chunk-KMXWZLQX.cjs.map} +1 -1
  127. package/dist/{chunk-CDYRPI5U.js → chunk-MIJKEVV7.js} +4 -4
  128. package/dist/{chunk-CDYRPI5U.js.map → chunk-MIJKEVV7.js.map} +1 -1
  129. package/dist/{chunk-FFQGI67R.cjs → chunk-NAAMUYMS.cjs} +56 -44
  130. package/dist/chunk-NAAMUYMS.cjs.map +1 -0
  131. package/dist/{chunk-6TJ6PKPS.cjs → chunk-OOA273IJ.cjs} +27 -27
  132. package/dist/{chunk-6TJ6PKPS.cjs.map → chunk-OOA273IJ.cjs.map} +1 -1
  133. package/dist/{chunk-F2KVJ6FF.cjs → chunk-P7GTYOLB.cjs} +203 -117
  134. package/dist/chunk-P7GTYOLB.cjs.map +1 -0
  135. package/dist/{chunk-42XYPKZU.js → chunk-PVUI6KGR.js} +67 -3
  136. package/dist/chunk-PVUI6KGR.js.map +1 -0
  137. package/dist/{chunk-L5AUCL5P.js → chunk-Q6EDCUXV.js} +274 -14
  138. package/dist/chunk-Q6EDCUXV.js.map +1 -0
  139. package/dist/{chunk-ZPCKPLMX.cjs → chunk-QB6VMOJ2.cjs} +8 -8
  140. package/dist/{chunk-ZPCKPLMX.cjs.map → chunk-QB6VMOJ2.cjs.map} +1 -1
  141. package/dist/{chunk-3RPQDGUE.cjs → chunk-QC4MCOFV.cjs} +5 -5
  142. package/dist/{chunk-3RPQDGUE.cjs.map → chunk-QC4MCOFV.cjs.map} +1 -1
  143. package/dist/{chunk-4XRP2N6B.js → chunk-QLUXRWKL.js} +3 -3
  144. package/dist/{chunk-4XRP2N6B.js.map → chunk-QLUXRWKL.js.map} +1 -1
  145. package/dist/{chunk-OM6RIOA5.cjs → chunk-QR24DJDF.cjs} +13 -13
  146. package/dist/{chunk-OM6RIOA5.cjs.map → chunk-QR24DJDF.cjs.map} +1 -1
  147. package/dist/{chunk-YPVQYM3L.js → chunk-QRNYDV5Z.js} +138 -31
  148. package/dist/chunk-QRNYDV5Z.js.map +1 -0
  149. package/dist/{chunk-ZOHCFYXE.js → chunk-QT6V3YRH.js} +3 -3
  150. package/dist/{chunk-ZOHCFYXE.js.map → chunk-QT6V3YRH.js.map} +1 -1
  151. package/dist/{chunk-5C75HQYQ.js → chunk-RFRM3Q5K.js} +17 -5
  152. package/dist/chunk-RFRM3Q5K.js.map +1 -0
  153. package/dist/{chunk-NXIZL7ZZ.js → chunk-RUQS6M7G.js} +6 -6
  154. package/dist/chunk-RUQS6M7G.js.map +1 -0
  155. package/dist/{chunk-CI5NPLXX.js → chunk-S3ZRKJHY.js} +3 -3
  156. package/dist/{chunk-CI5NPLXX.js.map → chunk-S3ZRKJHY.js.map} +1 -1
  157. package/dist/{chunk-3V6D5DEC.js → chunk-S4KQ5LV4.js} +3 -3
  158. package/dist/{chunk-3V6D5DEC.js.map → chunk-S4KQ5LV4.js.map} +1 -1
  159. package/dist/{chunk-CTWZPYJW.js → chunk-TKORQCG4.js} +108 -15
  160. package/dist/chunk-TKORQCG4.js.map +1 -0
  161. package/dist/{chunk-2HKIID5K.js → chunk-TKP5T34P.js} +4 -5
  162. package/dist/chunk-TKP5T34P.js.map +1 -0
  163. package/dist/{chunk-X2XOQZT3.cjs → chunk-U5W4LKZV.cjs} +13 -9
  164. package/dist/chunk-U5W4LKZV.cjs.map +1 -0
  165. package/dist/{chunk-BLBG2VZ5.cjs → chunk-UCQ3BFSY.cjs} +372 -110
  166. package/dist/chunk-UCQ3BFSY.cjs.map +1 -0
  167. package/dist/{chunk-CUPJL6TS.js → chunk-V34A6R5V.js} +13 -4
  168. package/dist/chunk-V34A6R5V.js.map +1 -0
  169. package/dist/{chunk-LQLVJWUH.js → chunk-VTN3C3CH.js} +7 -7
  170. package/dist/chunk-VTN3C3CH.js.map +1 -0
  171. package/dist/{chunk-FY4VY5EV.cjs → chunk-VVQM4CZD.cjs} +20 -20
  172. package/dist/chunk-VVQM4CZD.cjs.map +1 -0
  173. package/dist/{chunk-LDCWO5B6.js → chunk-WDAVPX46.js} +3 -3
  174. package/dist/{chunk-LDCWO5B6.js.map → chunk-WDAVPX46.js.map} +1 -1
  175. package/dist/{chunk-5GV4JQNA.cjs → chunk-WDBXJOU5.cjs} +55 -43
  176. package/dist/chunk-WDBXJOU5.cjs.map +1 -0
  177. package/dist/{chunk-FMPZPOUD.js → chunk-WUFASQUO.js} +3 -3
  178. package/dist/{chunk-FMPZPOUD.js.map → chunk-WUFASQUO.js.map} +1 -1
  179. package/dist/{chunk-5ZPRE4CV.cjs → chunk-YDWLUT5V.cjs} +237 -130
  180. package/dist/chunk-YDWLUT5V.cjs.map +1 -0
  181. package/dist/{chunk-CVNGKTHO.js → chunk-YMTXMPV6.js} +4 -4
  182. package/dist/{chunk-CVNGKTHO.js.map → chunk-YMTXMPV6.js.map} +1 -1
  183. package/dist/{chunk-NDQLPKBX.cjs → chunk-YOALGKRE.cjs} +2092 -1535
  184. package/dist/chunk-YOALGKRE.cjs.map +1 -0
  185. package/dist/{chunk-OMQ2NBOR.cjs → chunk-Z3WO6MND.cjs} +27 -27
  186. package/dist/{chunk-OMQ2NBOR.cjs.map → chunk-Z3WO6MND.cjs.map} +1 -1
  187. package/dist/{chunk-V2GZBPY2.cjs → chunk-ZI6VQSZA.cjs} +310 -61
  188. package/dist/chunk-ZI6VQSZA.cjs.map +1 -0
  189. package/dist/{chunk-ZBV4LQD2.cjs → chunk-ZTAJL4DT.cjs} +4 -4
  190. package/dist/{chunk-ZBV4LQD2.cjs.map → chunk-ZTAJL4DT.cjs.map} +1 -1
  191. package/dist/core/index.cjs +27 -28
  192. package/dist/core/index.d.cts +5 -5
  193. package/dist/core/index.d.ts +5 -5
  194. package/dist/core/index.js +7 -8
  195. package/dist/{ddl-3unqC-kg.d.cts → ddl-BG4J805L.d.cts} +3 -3
  196. package/dist/{ddl-Bc4Dl8fu.d.ts → ddl-CgiS9QLj.d.ts} +3 -3
  197. package/dist/{define-graph-DBFnc7u_.d.ts → define-graph-BGrJahvp.d.ts} +1 -1
  198. package/dist/{define-graph-Byslw2OO.d.cts → define-graph-alREY2wj.d.cts} +1 -1
  199. package/dist/graph-extension/index.cjs +19 -20
  200. package/dist/graph-extension/index.d.cts +4 -4
  201. package/dist/graph-extension/index.d.ts +4 -4
  202. package/dist/graph-extension/index.js +4 -5
  203. package/dist/graph-merge/index.cjs +103 -104
  204. package/dist/graph-merge/index.cjs.map +1 -1
  205. package/dist/graph-merge/index.d.cts +9 -8
  206. package/dist/graph-merge/index.d.ts +9 -8
  207. package/dist/graph-merge/index.js +23 -24
  208. package/dist/graph-merge/index.js.map +1 -1
  209. package/dist/{index-DHXw7QAl.d.cts → index-BBxZCUdu.d.ts} +37 -7
  210. package/dist/{index-DQzVJBHa.d.ts → index-C3y_98iN.d.cts} +37 -7
  211. package/dist/index.cjs +209 -202
  212. package/dist/index.cjs.map +1 -1
  213. package/dist/index.d.cts +13 -13
  214. package/dist/index.d.ts +13 -13
  215. package/dist/index.js +33 -34
  216. package/dist/index.js.map +1 -1
  217. package/dist/indexes/index.cjs +13 -13
  218. package/dist/indexes/index.d.cts +4 -4
  219. package/dist/indexes/index.d.ts +4 -4
  220. package/dist/indexes/index.js +6 -6
  221. package/dist/interchange/index.cjs +50 -41
  222. package/dist/interchange/index.cjs.map +1 -1
  223. package/dist/interchange/index.d.cts +11 -11
  224. package/dist/interchange/index.d.ts +11 -11
  225. package/dist/interchange/index.js +24 -15
  226. package/dist/interchange/index.js.map +1 -1
  227. package/dist/{manager-U9_zopqr.d.cts → manager-KS7CGQQT.d.cts} +44 -6
  228. package/dist/{manager-Dl0-er1G.d.ts → manager-YoLEfcc1.d.ts} +44 -6
  229. package/dist/{materialize-indexes-BM3u0aXE.d.ts → materialize-indexes-Bhhyb1B3.d.ts} +1 -1
  230. package/dist/{materialize-indexes-DzMCetZe.d.cts → materialize-indexes-OHRWypW6.d.cts} +1 -1
  231. package/dist/{postgres-DpJqtbSX.d.cts → postgres-DpkW3R5Y.d.cts} +1 -1
  232. package/dist/{postgres-C5-WMKFA.d.ts → postgres-DwqyIniy.d.ts} +1 -1
  233. package/dist/profiler/index.d.cts +10 -9
  234. package/dist/profiler/index.d.ts +10 -9
  235. package/dist/provenance/index.cjs +38 -38
  236. package/dist/provenance/index.cjs.map +1 -1
  237. package/dist/provenance/index.d.cts +7 -7
  238. package/dist/provenance/index.d.ts +7 -7
  239. package/dist/provenance/index.js +8 -8
  240. package/dist/provenance/index.js.map +1 -1
  241. package/dist/schema/index.cjs +40 -41
  242. package/dist/schema/index.d.cts +7 -7
  243. package/dist/schema/index.d.ts +7 -7
  244. package/dist/schema/index.js +13 -14
  245. package/dist/{searchable-B4mUXZT6.d.cts → searchable-CIZL8Hyw.d.cts} +2 -2
  246. package/dist/{searchable-C7jmPNLT.d.ts → searchable-DLWEfC4a.d.ts} +2 -2
  247. package/dist/{sqlite-Ch5tSYQY.d.ts → sqlite-DY0WODUK.d.cts} +1 -1
  248. package/dist/{sqlite-Da7jiYu9.d.cts → sqlite-L-VIRzqA.d.ts} +1 -1
  249. package/dist/{store-view-DdwBNjZQ.d.ts → store-view-66p92IPi.d.ts} +1974 -1751
  250. package/dist/{store-view-D1F6KqsE.d.cts → store-view-A85FFRnk.d.cts} +1974 -1751
  251. package/dist/{temporal-CMpigMCW.d.cts → temporal-BNbjXqer.d.cts} +1 -1
  252. package/dist/{temporal-BtrTYTiB.d.ts → temporal-Bob6Nfbp.d.ts} +1 -1
  253. package/dist/{types-Dh-EgT-w.d.cts → types-Ch9a0Dx6.d.cts} +483 -20
  254. package/dist/{types-Dh-EgT-w.d.ts → types-Ch9a0Dx6.d.ts} +483 -20
  255. package/dist/{types-D2rU5Taq.d.ts → types-ClCzT-dT.d.ts} +1 -1
  256. package/dist/{types-G4sVM-76.d.cts → types-DeORZhxn.d.cts} +1 -1
  257. package/dist/{where-DbZ9XDOI.d.cts → where-DPw52ksb.d.cts} +1 -1
  258. package/dist/{where-B8Y21kig.d.ts → where-kWUZPvEA.d.ts} +1 -1
  259. package/package.json +1 -1
  260. package/dist/chunk-2HKIID5K.js.map +0 -1
  261. package/dist/chunk-33PAKPED.cjs.map +0 -1
  262. package/dist/chunk-42XYPKZU.js.map +0 -1
  263. package/dist/chunk-4WYFRACU.js.map +0 -1
  264. package/dist/chunk-5C75HQYQ.js.map +0 -1
  265. package/dist/chunk-5GV4JQNA.cjs.map +0 -1
  266. package/dist/chunk-5Q3P6OIC.cjs.map +0 -1
  267. package/dist/chunk-5ZPRE4CV.cjs.map +0 -1
  268. package/dist/chunk-64LERBFM.cjs.map +0 -1
  269. package/dist/chunk-AO2WPYFZ.cjs.map +0 -1
  270. package/dist/chunk-BLBG2VZ5.cjs.map +0 -1
  271. package/dist/chunk-CTWZPYJW.js.map +0 -1
  272. package/dist/chunk-CUPJL6TS.js.map +0 -1
  273. package/dist/chunk-DMZEVJGL.cjs.map +0 -1
  274. package/dist/chunk-ECU53PMN.cjs.map +0 -1
  275. package/dist/chunk-EQOQOT55.js.map +0 -1
  276. package/dist/chunk-F2KVJ6FF.cjs.map +0 -1
  277. package/dist/chunk-F7TDKSVB.cjs +0 -61
  278. package/dist/chunk-F7TDKSVB.cjs.map +0 -1
  279. package/dist/chunk-FFQGI67R.cjs.map +0 -1
  280. package/dist/chunk-FY4VY5EV.cjs.map +0 -1
  281. package/dist/chunk-HHBKGPEI.js.map +0 -1
  282. package/dist/chunk-JNXZQBN3.js.map +0 -1
  283. package/dist/chunk-KDRF3NR2.cjs.map +0 -1
  284. package/dist/chunk-KTBTSHU6.cjs.map +0 -1
  285. package/dist/chunk-L2BYRYHC.js.map +0 -1
  286. package/dist/chunk-L5AUCL5P.js.map +0 -1
  287. package/dist/chunk-LQLVJWUH.js.map +0 -1
  288. package/dist/chunk-M4GYQF2H.js.map +0 -1
  289. package/dist/chunk-NDQLPKBX.cjs.map +0 -1
  290. package/dist/chunk-NXIZL7ZZ.js.map +0 -1
  291. package/dist/chunk-O2GZM7UK.cjs.map +0 -1
  292. package/dist/chunk-O7XVCLXW.cjs.map +0 -1
  293. package/dist/chunk-OYJSYDIH.js.map +0 -1
  294. package/dist/chunk-RAWG2FEU.js.map +0 -1
  295. package/dist/chunk-RXOAXO3R.js +0 -59
  296. package/dist/chunk-RXOAXO3R.js.map +0 -1
  297. package/dist/chunk-U3YRCZ5L.cjs +0 -12
  298. package/dist/chunk-UTTW2Q3M.cjs.map +0 -1
  299. package/dist/chunk-UZLEQFTV.js.map +0 -1
  300. package/dist/chunk-V2GZBPY2.cjs.map +0 -1
  301. package/dist/chunk-VC26BUNP.js.map +0 -1
  302. package/dist/chunk-VGMNGWBR.cjs +0 -12
  303. package/dist/chunk-X2XOQZT3.cjs.map +0 -1
  304. package/dist/chunk-XDMPDUKL.cjs.map +0 -1
  305. package/dist/chunk-YPVQYM3L.js.map +0 -1
  306. package/dist/chunk-ZGOUVMVS.js.map +0 -1
  307. package/dist/chunk-ZIRC2U6G.js.map +0 -1
@@ -1,6 +1,5 @@
1
- import { NODE_TYPE_BRAND, EDGE_TYPE_BRAND } from './chunk-3V6D5DEC.js';
2
- import { assertJsonValue } from './chunk-RXOAXO3R.js';
3
- import { assertSchemaKeysAreFree, RESERVED_NODE_KEYS, RESERVED_EDGE_KEYS } from './chunk-4WYFRACU.js';
1
+ import { NODE_TYPE_BRAND, EDGE_TYPE_BRAND } from './chunk-S4KQ5LV4.js';
2
+ import { assertJsonValue, assertSchemaKeysAreFree, RESERVED_NODE_KEYS, RESERVED_EDGE_KEYS } from './chunk-42PYUGLS.js';
4
3
  import { z } from 'zod';
5
4
 
6
5
  // src/core/node.ts
@@ -64,5 +63,5 @@ function getTypeName(typeOrIri) {
64
63
  }
65
64
 
66
65
  export { META_EDGE_BRAND, defineEdge, defineNode, getTypeName, isMetaEdge };
67
- //# sourceMappingURL=chunk-2HKIID5K.js.map
68
- //# sourceMappingURL=chunk-2HKIID5K.js.map
66
+ //# sourceMappingURL=chunk-TKP5T34P.js.map
67
+ //# sourceMappingURL=chunk-TKP5T34P.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/node.ts","../src/core/edge.ts","../src/ontology/types.ts"],"names":["validateSchemaKeys"],"mappings":";;;;;AAmCA,SAAS,kBAAA,CACP,QACA,IAAA,EACM;AACN,EAAA,uBAAA;AAAA,IACE,MAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA;AAAA,IACxB;AAAA,GACF;AACF;AAgBO,SAAS,UAAA,CAGd,MAAS,OAAA,EAA+C;AACxD,EAAA,kBAAA,CAAmB,OAAA,CAAQ,QAAQ,IAAI,CAAA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,CAAA;AACH;;;AClIO,IAAM,eAAA,GAAkB;AA+ExB,SAAS,WAAW,KAAA,EAAmC;AAC5D,EAAA,OACE,OAAO,UAAU,QAAA,IACjB,KAAA,KAAU,QACV,eAAA,IAAmB,KAAA,IAClB,KAAA,CAAkC,eAAe,CAAA,KAAM,IAAA;AAE5D;AAKO,SAAS,YAAY,SAAA,EAAiD;AAC3E,EAAA,IAAI,OAAO,cAAc,QAAA,EAAU;AACjC,IAAA,OAAO,SAAA;AAAA,EACT;AACA,EAAA,OAAO,SAAA,CAAU,IAAA;AACnB","file":"chunk-TKP5T34P.js","sourcesContent":["import { type z } from \"zod\";\n\nimport {\n assertSchemaKeysAreFree,\n RESERVED_NODE_KEYS,\n} from \"../store/reserved-keys\";\nimport { assertJsonValue } from \"./json-value\";\nimport { type KindAnnotations, NODE_TYPE_BRAND, type NodeType } from \"./types\";\n\n// ============================================================\n// Node Factory Options\n// ============================================================\n\n/**\n * Options for defining a node type.\n */\nexport type DefineNodeOptions<S extends z.ZodObject<z.ZodRawShape>> = Readonly<{\n /** Zod schema for node properties */\n schema: S;\n /** Optional description for documentation */\n description?: string;\n /**\n * Consumer-owned structured annotations for the kind.\n *\n * Stored in the canonical schema and **participates in schema hashing** —\n * any change bumps the schema version and shows up as a `safe`-severity\n * diff in `getSchemaChanges`. See `KindAnnotations` for the contract.\n */\n annotations?: KindAnnotations;\n}>;\n\n// ============================================================\n// Node Factory\n// ============================================================\n\nfunction validateSchemaKeys(\n schema: z.ZodObject<z.ZodRawShape>,\n name: string,\n): void {\n assertSchemaKeysAreFree(\n \"Node\",\n name,\n Object.keys(schema.shape),\n RESERVED_NODE_KEYS,\n );\n}\n\n/**\n * Creates a node type definition.\n *\n * @example\n * ```typescript\n * const Person = defineNode(\"Person\", {\n * schema: z.object({\n * fullName: z.string().min(1),\n * email: z.string().email().optional(),\n * }),\n * description: \"A person in the system\",\n * });\n * ```\n */\nexport function defineNode<\n K extends string,\n S extends z.ZodObject<z.ZodRawShape>,\n>(name: K, options: DefineNodeOptions<S>): NodeType<K, S> {\n validateSchemaKeys(options.schema, name);\n if (options.annotations !== undefined) {\n assertJsonValue(options.annotations, \"annotations\", `Node \"${name}\"`);\n }\n\n return Object.freeze({\n [NODE_TYPE_BRAND]: true as const,\n kind: name,\n schema: options.schema,\n description: options.description,\n annotations: options.annotations,\n });\n}\n","import { z } from \"zod\";\n\nimport {\n assertSchemaKeysAreFree,\n RESERVED_EDGE_KEYS,\n} from \"../store/reserved-keys\";\nimport { assertJsonValue } from \"./json-value\";\nimport {\n EDGE_TYPE_BRAND,\n type EdgeType,\n type KindAnnotations,\n type NodeType,\n} from \"./types\";\n\n// ============================================================\n// Edge Factory Options\n// ============================================================\n\n/**\n * Options for defining an edge type.\n */\nexport type DefineEdgeOptions<\n S extends z.ZodObject<z.ZodRawShape>,\n From extends readonly NodeType[] | undefined = undefined,\n To extends readonly NodeType[] | undefined = undefined,\n> = Readonly<{\n /** Zod schema for edge properties (defaults to empty object) */\n schema?: S;\n /** Optional description for documentation */\n description?: string;\n /**\n * Consumer-owned structured annotations for the kind.\n *\n * Stored in the canonical schema and **participates in schema hashing** —\n * any change bumps the schema version and shows up as a `safe`-severity\n * diff in `getSchemaChanges`. See `KindAnnotations` for the contract.\n */\n annotations?: KindAnnotations;\n /** Node types that can be the source of this edge (domain constraint) */\n from?: From;\n /** Node types that can be the target of this edge (range constraint) */\n to?: To;\n}>;\n\n// ============================================================\n// Empty Schema\n// ============================================================\n\nconst EMPTY_SCHEMA = z.object({});\ntype EmptySchema = typeof EMPTY_SCHEMA;\n\n// ============================================================\n// Edge Factory\n// ============================================================\n\nfunction validateSchemaKeys(\n schema: z.ZodObject<z.ZodRawShape>,\n name: string,\n): void {\n assertSchemaKeysAreFree(\n \"Edge\",\n name,\n Object.keys(schema.shape),\n RESERVED_EDGE_KEYS,\n );\n}\n\n/**\n * Creates an edge type definition.\n *\n * @example\n * ```typescript\n * // Edge with no properties\n * const hasEpisode = defineEdge(\"hasEpisode\");\n *\n * // Edge with properties\n * const employedAt = defineEdge(\"employedAt\", {\n * schema: z.object({\n * isPrimary: z.boolean().default(true),\n * startedAt: z.date(),\n * }),\n * description: \"Employment relationship\",\n * });\n *\n * // Edge with domain/range constraints (can be used directly in defineGraph)\n * const worksAt = defineEdge(\"worksAt\", {\n * schema: z.object({ role: z.string() }),\n * from: [Person],\n * to: [Company],\n * });\n * ```\n */\n// Overload: no options - returns edge without domain/range\nexport function defineEdge<K extends string>(name: K): EdgeType<K, EmptySchema>;\n\n// Overload: options with both from and to - returns edge with domain/range\nexport function defineEdge<\n K extends string,\n S extends z.ZodObject<z.ZodRawShape>,\n From extends readonly NodeType[],\n To extends readonly NodeType[],\n>(\n name: K,\n options: DefineEdgeOptions<S, From, To> & { from: From; to: To },\n): EdgeType<K, S, From, To>;\n\n// Overload: options without from/to - returns edge without domain/range\nexport function defineEdge<\n K extends string,\n S extends z.ZodObject<z.ZodRawShape>,\n>(name: K, options: DefineEdgeOptions<S>): EdgeType<K, S>;\n\n// Implementation\nexport function defineEdge<\n K extends string,\n S extends z.ZodObject<z.ZodRawShape>,\n From extends readonly NodeType[] | undefined,\n To extends readonly NodeType[] | undefined,\n>(\n name: K,\n options?: DefineEdgeOptions<S, From, To>,\n): EdgeType<K, S, From, To> | EdgeType<K, EmptySchema> {\n const schema = options?.schema ?? EMPTY_SCHEMA;\n validateSchemaKeys(schema, name);\n if (options?.annotations !== undefined) {\n assertJsonValue(options.annotations, \"annotations\", `Edge \"${name}\"`);\n }\n\n return Object.freeze({\n [EDGE_TYPE_BRAND]: true as const,\n kind: name,\n schema,\n description: options?.description,\n annotations: options?.annotations,\n from: options?.from,\n to: options?.to,\n }) as EdgeType<K, S, From, To> | EdgeType<K, EmptySchema>;\n}\n","import { type EdgeType, type NodeType } from \"../core/types\";\n\n// ============================================================\n// Brand Key\n// ============================================================\n\n/** Brand key for MetaEdge */\nexport const META_EDGE_BRAND = \"__metaEdge\" as const;\n\n// ============================================================\n// Inference Types\n// ============================================================\n\n/**\n * How a meta-edge affects queries and validation.\n */\nexport type InferenceType =\n | \"subsumption\" // Query for X includes instances of subclasses\n | \"hierarchy\" // Enables broader/narrower traversal\n | \"substitution\" // Can substitute equivalent types\n | \"constraint\" // Validation rules\n | \"composition\" // Part-whole navigation\n | \"association\" // Discovery/recommendation\n | \"none\"; // No automatic inference\n\n// ============================================================\n// Meta-Edge Properties\n// ============================================================\n\n/**\n * Properties of a meta-edge.\n */\nexport type MetaEdgeProperties = Readonly<{\n transitive: boolean; // A→B, B→C implies A→C\n symmetric: boolean; // A→B implies B→A\n reflexive: boolean; // A→A is always true\n inverse: string | undefined; // Name of inverse meta-edge\n inference: InferenceType; // How this affects queries\n description: string | undefined;\n}>;\n\n// ============================================================\n// Meta-Edge Type\n// ============================================================\n\n/**\n * A meta-edge definition.\n *\n * Meta-edges represent type-level relationships (between kinds),\n * not instance-level relationships (between nodes).\n */\nexport type MetaEdge<K extends string = string> = Readonly<{\n [META_EDGE_BRAND]: true;\n name: K;\n properties: MetaEdgeProperties;\n}>;\n\n// ============================================================\n// Ontology Relation\n// ============================================================\n\n/**\n * A relation in the ontology (instance of meta-edge between types).\n *\n * @example\n * ```typescript\n * // Podcast subClassOf Media\n * subClassOf(Podcast, Media)\n *\n * // Person equivalentTo schema:Person\n * equivalentTo(Person, \"https://schema.org/Person\")\n * ```\n */\nexport type OntologyRelation = Readonly<{\n metaEdge: MetaEdge;\n from: NodeType | EdgeType | string; // string for external IRIs\n to: NodeType | EdgeType | string;\n}>;\n\n// ============================================================\n// Type Guards\n// ============================================================\n\n/**\n * Checks if a value is a MetaEdge.\n */\nexport function isMetaEdge(value: unknown): value is MetaEdge {\n return (\n typeof value === \"object\" &&\n value !== null &&\n META_EDGE_BRAND in value &&\n (value as Record<string, unknown>)[META_EDGE_BRAND] === true\n );\n}\n\n/**\n * Gets the type name from a NodeType, EdgeType, or IRI string.\n */\nexport function getTypeName(typeOrIri: NodeType | EdgeType | string): string {\n if (typeof typeOrIri === \"string\") {\n return typeOrIri;\n }\n return typeOrIri.kind;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkKTBTSHU6_cjs = require('./chunk-KTBTSHU6.cjs');
3
+ var chunkC4F7VJ5D_cjs = require('./chunk-C4F7VJ5D.cjs');
4
4
 
5
5
  // src/utils/global-symbol.ts
6
6
  function typeGraphGlobalSymbol(name) {
@@ -36,6 +36,9 @@ function bindSqlValue(value, dialect) {
36
36
  if (value instanceof Date) return value.toISOString();
37
37
  return getSqlDialectProfile(dialect).bindValue(value);
38
38
  }
39
+ function packSqlListValue(values, dialect) {
40
+ return JSON.stringify(values.map((value) => bindSqlValue(value, dialect)));
41
+ }
39
42
  function inlineSqlStringLiteral(value, dialect) {
40
43
  return SQL_STRING_LITERAL_RENDERERS[dialect](value);
41
44
  }
@@ -130,7 +133,7 @@ function createFragment(chunks, intentSources = []) {
130
133
  }
131
134
  function getChunks(fragment) {
132
135
  if (!isSqlFragment(fragment)) {
133
- throw new chunkKTBTSHU6_cjs.ConfigurationError(
136
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
134
137
  "Expected a SQL fragment created by TypeGraph's sql helper"
135
138
  );
136
139
  }
@@ -143,7 +146,7 @@ function isSqlPlaceholder(value) {
143
146
  return typeof value === "object" && value !== null && SQL_PLACEHOLDER_BRAND in value && value[SQL_PLACEHOLDER_BRAND] === true && "name" in value && typeof value.name === "string";
144
147
  }
145
148
  function throwUnsupportedSqlChunk(chunk) {
146
- throw new chunkKTBTSHU6_cjs.ConfigurationError("Unsupported SQL fragment chunk", { chunk });
149
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError("Unsupported SQL fragment chunk", { chunk });
147
150
  }
148
151
  function textNode(value) {
149
152
  return Object.freeze({ kind: "text", value });
@@ -210,7 +213,7 @@ function quotedIdentifier(identifier) {
210
213
  function resolvedPlaceholder(placeholder, bindings, dialect) {
211
214
  if (bindings === void 0) return placeholder;
212
215
  if (!Object.hasOwn(bindings, placeholder.name)) {
213
- throw new chunkKTBTSHU6_cjs.ConfigurationError(
216
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
214
217
  `Missing binding for parameter "${placeholder.name}"`,
215
218
  { parameterName: placeholder.name }
216
219
  );
@@ -262,7 +265,7 @@ function inlineLiteral(value, dialect) {
262
265
  if (typeof value === "string") return inlineSqlStringLiteral(value, dialect);
263
266
  if (typeof value === "number") {
264
267
  if (!Number.isFinite(value)) {
265
- throw new chunkKTBTSHU6_cjs.ConfigurationError("Cannot inline a non-finite SQL number", {
268
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError("Cannot inline a non-finite SQL number", {
266
269
  value
267
270
  });
268
271
  }
@@ -275,7 +278,7 @@ function inlineLiteral(value, dialect) {
275
278
  if (value instanceof Date) {
276
279
  return inlineSqlStringLiteral(value.toISOString(), dialect);
277
280
  }
278
- throw new chunkKTBTSHU6_cjs.ConfigurationError("Cannot inline this SQL parameter value", {
281
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError("Cannot inline this SQL parameter value", {
279
282
  value
280
283
  });
281
284
  }
@@ -296,7 +299,7 @@ function renderSqlInline(fragment, dialect) {
296
299
  break;
297
300
  }
298
301
  case "placeholder": {
299
- throw new chunkKTBTSHU6_cjs.ConfigurationError(
302
+ throw new chunkC4F7VJ5D_cjs.ConfigurationError(
300
303
  `Cannot inline unresolved SQL placeholder "${node.value.name}"`,
301
304
  { parameterName: node.value.name }
302
305
  );
@@ -329,6 +332,7 @@ exports.isSqlPlaceholder = isSqlPlaceholder;
329
332
  exports.likeEscapeClause = likeEscapeClause;
330
333
  exports.markAnnIndexScan = markAnnIndexScan;
331
334
  exports.markForceCustomPlan = markForceCustomPlan;
335
+ exports.packSqlListValue = packSqlListValue;
332
336
  exports.renderPostgres = renderPostgres;
333
337
  exports.renderSql = renderSql;
334
338
  exports.renderSqlInline = renderSqlInline;
@@ -337,5 +341,5 @@ exports.shouldForceCustomPlan = shouldForceCustomPlan;
337
341
  exports.sql = sql;
338
342
  exports.throwUnsupportedSqlChunk = throwUnsupportedSqlChunk;
339
343
  exports.typeGraphGlobalSymbol = typeGraphGlobalSymbol;
340
- //# sourceMappingURL=chunk-X2XOQZT3.cjs.map
341
- //# sourceMappingURL=chunk-X2XOQZT3.cjs.map
344
+ //# sourceMappingURL=chunk-U5W4LKZV.cjs.map
345
+ //# sourceMappingURL=chunk-U5W4LKZV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/global-symbol.ts","../src/query/dialect/profile.ts","../src/query/sql-intent.ts","../src/query/sql-fragment.ts","../src/query/dialect/like-escape.ts"],"names":["ConfigurationError"],"mappings":";;;;;AAYO,SAAS,sBACd,IAAA,EACS;AACT,EAAA,uBAAO,MAAA,CAAO,GAAA,CAAI,CAAA,oBAAA,EAAuB,IAAI,CAAA,CAAE,CAAA;AACjD;;;ACRA,IAAM,oBAAA,GAAuB;AAAA,EAC3B,QAAA,EAAU;AAAA,IACR,SAAA,EAAW,CAAC,KAAA,KAAmB,KAAA;AAAA,IAC/B,oBAAA,EAAsB,CAAC,KAAA,KAAoB,KAAA,GAAQ,MAAA,GAAS,OAAA;AAAA,IAC5D,WAAA,EAAa,CAAC,KAAA,KAAkB,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,GAC3C;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,SAAA,EAAW,CAAC,KAAA,KACV,OAAO,UAAU,SAAA,GACf,KAAA,GAAQ,IACN,CAAA,GACF,KAAA;AAAA,IACJ,oBAAA,EAAsB,CAAC,KAAA,KAAoB,KAAA,GAAQ,GAAA,GAAM,GAAA;AAAA,IACzD,aAAa,MAAM;AAAA;AAEvB,CAAA;AAEA,IAAM,4BAAA,GAA+B;AAAA,EACnC,QAAA,EAAU,CAAC,KAAA,KAAkB;AAC3B,IAAA,IAAI,KAAA,CAAM,QAAA,CAAS,IAAI,CAAA,EAAG;AACxB,MAAA,OAAO,CAAA,EAAA,EAAK,MAAM,UAAA,CAAW,I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| \"sql-intent-registry\"\n | \"internal-temporary-writes-v1\"\n | \"external-recorded-read-source-v1\"\n | \"sql-schema-v1\"\n | \"store-runtime-v1\"\n | \"typegraph-recorded-read-source-v1\"\n | \"transaction-runtime-v1\";\n\n/** Returns a process-wide symbol shared across ESM/CJS package instances. */\nexport function typeGraphGlobalSymbol<TSymbol extends symbol>(\n name: TypeGraphGlobalSymbolName,\n): TSymbol {\n return Symbol.for(`@nicia-ai/typegraph/${name}`) as TSymbol;\n}\n","import { type SqlDialect } from \"./types\";\n\nexport type SqlDialectProfile = Readonly<{\n bindValue: (value: unknown) => unknown;\n booleanLiteralString: (value: boolean) => string;\n placeholder: (index: number) => string;\n}>;\n\nconst SQL_DIALECT_PROFILES = {\n postgres: {\n bindValue: (value: unknown) => value,\n booleanLiteralString: (value: boolean) => (value ? \"TRUE\" : \"FALSE\"),\n placeholder: (index: number) => `$${index}`,\n },\n sqlite: {\n bindValue: (value: unknown) =>\n typeof value === \"boolean\" ?\n value ? 1\n : 0\n : value,\n booleanLiteralString: (value: boolean) => (value ? \"1\" : \"0\"),\n placeholder: () => \"?\",\n },\n} satisfies Record<SqlDialect, SqlDialectProfile>;\n\nconst SQL_STRING_LITERAL_RENDERERS = {\n postgres: (value: string) => {\n if (value.includes(\"\\\\\")) {\n return `E'${value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"'\", \"''\")}'`;\n }\n return `'${value.replaceAll(\"'\", \"''\")}'`;\n },\n sqlite: (value: string) => `'${value.replaceAll(\"'\", \"''\")}'`,\n} satisfies Record<SqlDialect, (value: string) => string>;\n\n/** Returns the primitive rendering and binding rules for a SQL dialect. */\nexport function getSqlDialectProfile(dialect: SqlDialect): SqlDialectProfile {\n return SQL_DIALECT_PROFILES[dialect];\n}\n\n/** Maps a JavaScript value to the representation expected by a SQL driver. */\nexport function bindSqlValue(value: unknown, dialect: SqlDialect): unknown {\n if (value instanceof Date) return value.toISOString();\n return getSqlDialectProfile(dialect).bindValue(value);\n}\n\n/**\n * Packs a scalar list into the single JSON-text value that a list-valued `IN`\n * parameter binds to. Every element is bound exactly as the literal form would\n * bind it, so `field.in([...])` and `field.in(param(...))` agree row for row.\n */\nexport function packSqlListValue(\n values: readonly unknown[],\n dialect: SqlDialect,\n): string {\n return JSON.stringify(values.map((value) => bindSqlValue(value, dialect)));\n}\n\n/** Renders one SQL string literal using the dialect's escaping rules. */\nexport function inlineSqlStringLiteral(\n value: string,\n dialect: SqlDialect,\n): string {\n return SQL_STRING_LITERAL_RENDERERS[dialect](value);\n}\n","import { typeGraphGlobalSymbol } from \"../utils/global-symbol\";\nimport { type SqlFragment } from \"./sql-fragment\";\n\ndeclare const SqlIntentBrand: unique symbol;\n\nexport type SqlIntent = \"rows\" | \"statement\" | \"temporary-statement\";\n\nexport type IntentSql<I extends SqlIntent> = SqlFragment &\n Readonly<{ [SqlIntentBrand]: I }>;\n\nexport type CompiledRowsSql = IntentSql<\"rows\">;\nexport type CompiledSelectSql = CompiledRowsSql;\nexport type CompiledStatementSql = IntentSql<\"statement\">;\nexport type CompiledTemporaryStatementSql = IntentSql<\"temporary-statement\">;\n\nexport function asCompiledRowsSql(query: SqlFragment): CompiledRowsSql {\n return query as CompiledRowsSql;\n}\n\nexport function asCompiledSelectSql(query: SqlFragment): CompiledSelectSql {\n return asCompiledRowsSql(query);\n}\n\nexport function asCompiledStatementSql(\n query: SqlFragment,\n): CompiledStatementSql {\n return query as CompiledStatementSql;\n}\n\n/**\n * Marks an internal statement that may write only connection-local temporary\n * state. This is intentionally separate from the public raw-statement intent:\n * history-enabled stores block arbitrary raw writes but iterative graph\n * operations still need to manage ephemeral working tables.\n */\nexport function asCompiledTemporaryStatementSql(\n query: SqlFragment,\n): CompiledTemporaryStatementSql {\n return query as CompiledTemporaryStatementSql;\n}\n\n/**\n * Statements whose good plan depends on the bound parameter values —\n * e.g. an id-array membership filter where the array cardinality varies\n * per call. PostgreSQL's prepared-statement machinery switches to a\n * generic (parameter-blind) plan after five executions, which for these\n * statements is catastrophically wrong (measured 21ms -> 310ms on the\n * subgraph edge fetch). Marked statements are executed unnamed so every\n * call is planned against the actual parameters; the re-parse cost is\n * ~1ms, the generic-plan cliff it avoids is 10-300ms.\n */\ntype SqlIntentRegistry = Readonly<{\n annIndexScanQueries: WeakMap<SqlFragment, readonly string[]>;\n forceCustomPlanQueries: WeakSet<SqlFragment>;\n}>;\n\nconst SQL_INTENT_REGISTRY: unique symbol = typeGraphGlobalSymbol(\n \"sql-intent-registry\",\n);\nconst globalWithSqlIntentRegistry = globalThis as typeof globalThis &\n Readonly<{\n [SQL_INTENT_REGISTRY]?: SqlIntentRegistry;\n }>;\nconst sqlIntentRegistry =\n globalWithSqlIntentRegistry[SQL_INTENT_REGISTRY] ??\n (() => {\n const registry: SqlIntentRegistry = {\n annIndexScanQueries: new WeakMap(),\n forceCustomPlanQueries: new WeakSet(),\n };\n Object.defineProperty(globalWithSqlIntentRegistry, SQL_INTENT_REGISTRY, {\n configurable: false,\n enumerable: false,\n value: registry,\n writable: false,\n });\n return registry;\n })();\n\nexport function markForceCustomPlan(query: SqlFragment): void {\n sqlIntentRegistry.forceCustomPlanQueries.add(query);\n}\n\nexport function shouldForceCustomPlan(query: SqlFragment): boolean {\n return sqlIntentRegistry.forceCustomPlanQueries.has(query);\n}\n\n/**\n * Statements whose plan includes an engine ANN index scan (the inline\n * `.similarTo(..., { approximate: true })` branch). The PostgreSQL\n * backend wraps their execution with the same pgvector GUC overrides\n * the search facade applies (`hnsw.iterative_scan = strict_order` /\n * `ivfflat.iterative_scan = relaxed_order` on pgvector >= 0.8), so a\n * filtered approximate query keeps scanning past the default ef_search\n * frontier instead of starving. Carries the slot index types so the\n * backend knows which GUCs apply. Backends without GUC semantics\n * ignore the brand.\n */\nexport function markAnnIndexScan(\n query: SqlFragment,\n indexTypes: readonly string[],\n): void {\n sqlIntentRegistry.annIndexScanQueries.set(query, indexTypes);\n}\n\nexport function annIndexScanTypes(\n query: SqlFragment,\n): readonly string[] | undefined {\n return sqlIntentRegistry.annIndexScanQueries.get(query);\n}\n\n/** @internal Copies execution semantics when immutable fragments are composed. */\nexport function copySqlIntents(\n target: SqlFragment,\n sources: readonly SqlFragment[],\n): void {\n if (sources.some((source) => shouldForceCustomPlan(source))) {\n markForceCustomPlan(target);\n }\n\n const indexTypes = new Set<string>();\n for (const source of sources) {\n for (const indexType of annIndexScanTypes(source) ?? []) {\n indexTypes.add(indexType);\n }\n }\n if (indexTypes.size > 0) markAnnIndexScan(target, [...indexTypes]);\n}\n\n/**\n * Whether a compiled statement can be run as raw text (`executeRaw`) without\n * losing execution semantics. Both brands above ride on the SQL *object* and\n * are honored only by `backend.execute`: the force-custom-plan flag makes\n * PostgreSQL re-plan against the actual parameters (opposed to reusing a\n * cached statement), and the ANN-scan brand drives the pgvector iterative-scan\n * GUC wrapper. A statement carrying either must not be flattened to text and\n * cached — callers fall back to `backend.execute`. Keeping this predicate\n * beside the brands means a future brand updates one place, not every caller.\n */\nexport function isRawExecutable(query: SqlFragment): boolean {\n return (\n !shouldForceCustomPlan(query) && annIndexScanTypes(query) === undefined\n );\n}\n","import { ConfigurationError } from \"../errors\";\nimport { typeGraphGlobalSymbol } from \"../utils/global-symbol\";\nimport {\n bindSqlValue,\n getSqlDialectProfile,\n inlineSqlStringLiteral,\n} from \"./dialect/profile\";\nimport { type SqlDialect } from \"./dialect/types\";\nimport { copySqlIntents } from \"./sql-intent\";\n\n/** Nominal identity shared by every package entrypoint. */\nconst SQL_FRAGMENT_BRAND: unique symbol = typeGraphGlobalSymbol(\"sql-fragment\");\nconst SQL_PLACEHOLDER_BRAND: unique symbol =\n typeGraphGlobalSymbol(\"sql-placeholder\");\n\nexport type SqlTextChunk = Readonly<{\n kind: \"text\";\n value: string;\n}>;\n\nexport type SqlParameterChunk = Readonly<{\n kind: \"parameter\";\n value: unknown;\n}>;\n\nexport type SqlIdentifierChunk = Readonly<{\n kind: \"identifier\";\n value: string;\n}>;\n\nexport type SqlPlaceholderChunk = Readonly<{\n kind: \"placeholder\";\n value: Placeholder;\n}>;\n\n/** One immutable unit in a database-independent SQL fragment. */\nexport type SqlChunk =\n SqlTextChunk | SqlParameterChunk | SqlIdentifierChunk | SqlPlaceholderChunk;\n\n/**\n * An immutable, database-independent SQL expression.\n *\n * Fragments contain syntax and bound values as separate nodes. A database\n * adapter renders the same fragment with its native placeholder convention at\n * the final execution boundary.\n */\nexport type SqlFragment = Readonly<{\n [SQL_FRAGMENT_BRAND]: true;\n append: (fragment: SqlFragment) => SqlFragment;\n chunks: readonly SqlChunk[];\n}>;\n\n/** A named value resolved when a prepared statement is executed. */\nexport class Placeholder {\n readonly [SQL_PLACEHOLDER_BRAND] = true as const;\n readonly name: string;\n\n constructor(name: string) {\n this.name = name;\n Object.freeze(this);\n }\n}\n\nclass SqlFragmentValue implements SqlFragment {\n readonly [SQL_FRAGMENT_BRAND] = true as const;\n\n readonly chunks: readonly SqlChunk[];\n\n constructor(chunks: readonly SqlChunk[]) {\n this.chunks = Object.freeze([...chunks]);\n Object.freeze(this);\n }\n\n append(fragment: SqlFragment): SqlFragment {\n return createFragment(\n [...this.chunks, ...getChunks(fragment)],\n [this, fragment],\n );\n }\n}\n\nfunction createFragment(\n chunks: readonly SqlChunk[],\n intentSources: readonly SqlFragment[] = [],\n): SqlFragment {\n const fragment = new SqlFragmentValue(chunks);\n copySqlIntents(fragment, intentSources);\n return fragment;\n}\n\nfunction getChunks(fragment: SqlFragment): readonly SqlChunk[] {\n if (!isSqlFragment(fragment)) {\n throw new ConfigurationError(\n \"Expected a SQL fragment created by TypeGraph's sql helper\",\n );\n }\n return fragment.chunks;\n}\n\n/** Returns whether a value is a TypeGraph-owned SQL fragment. */\nexport function isSqlFragment(value: unknown): value is SqlFragment {\n return (\n typeof value === \"object\" &&\n value !== null &&\n SQL_FRAGMENT_BRAND in value &&\n value[SQL_FRAGMENT_BRAND] === true &&\n \"chunks\" in value &&\n Array.isArray(value.chunks) &&\n \"append\" in value &&\n typeof value.append === \"function\"\n );\n}\n\n/** Returns whether a value is a TypeGraph named SQL placeholder. */\nexport function isSqlPlaceholder(value: unknown): value is Placeholder {\n return (\n typeof value === \"object\" &&\n value !== null &&\n SQL_PLACEHOLDER_BRAND in value &&\n value[SQL_PLACEHOLDER_BRAND] === true &&\n \"name\" in value &&\n typeof value.name === \"string\"\n );\n}\n\n/** @internal Enforces exhaustive handling at every fragment boundary. */\nexport function throwUnsupportedSqlChunk(chunk: never): never {\n throw new ConfigurationError(\"Unsupported SQL fragment chunk\", { chunk });\n}\n\nfunction textNode(value: string): SqlTextChunk {\n return Object.freeze({ kind: \"text\", value });\n}\n\nfunction parameterNode(value: unknown): SqlParameterChunk {\n return Object.freeze({ kind: \"parameter\", value });\n}\n\nfunction identifierNode(value: string): SqlIdentifierChunk {\n return Object.freeze({ kind: \"identifier\", value });\n}\n\nfunction placeholderNode(value: Placeholder): SqlPlaceholderChunk {\n return Object.freeze({ kind: \"placeholder\", value });\n}\n\nfunction templateSql(\n strings: TemplateStringsArray,\n ...values: readonly unknown[]\n): SqlFragment {\n const chunks: SqlChunk[] = [];\n const intentSources: SqlFragment[] = [];\n\n for (const [index, text] of strings.entries()) {\n if (text.length > 0) chunks.push(textNode(text));\n\n if (index >= values.length) continue;\n const value = values[index];\n if (isSqlFragment(value)) {\n chunks.push(...getChunks(value));\n intentSources.push(value);\n } else if (isSqlPlaceholder(value)) {\n chunks.push(placeholderNode(value));\n } else {\n chunks.push(parameterNode(value));\n }\n }\n\n return createFragment(chunks, intentSources);\n}\n\nfunction rawSql(value: string): SqlFragment {\n return createFragment(value.length === 0 ? [] : [textNode(value)]);\n}\n\nfunction identifierSql(value: string): SqlFragment {\n return createFragment([identifierNode(value)]);\n}\n\nfunction joinSql(\n fragments: readonly SqlFragment[],\n separator: SqlFragment = EMPTY_SQL,\n): SqlFragment {\n const chunks: SqlChunk[] = [];\n const intentSources: SqlFragment[] = [separator];\n\n for (const [index, fragment] of fragments.entries()) {\n if (index > 0) chunks.push(...getChunks(separator));\n chunks.push(...getChunks(fragment));\n intentSources.push(fragment);\n }\n\n return createFragment(chunks, intentSources);\n}\n\nfunction placeholderSql(name: string): SqlFragment {\n return createFragment([placeholderNode(new Placeholder(name))]);\n}\n\nconst EMPTY_SQL = createFragment([]);\n\n/** TypeGraph's database-independent SQL template and composition helpers. */\nexport type SqlTag = Readonly<{\n empty: () => SqlFragment;\n identifier: (value: string) => SqlFragment;\n join: (\n fragments: readonly SqlFragment[],\n separator?: SqlFragment,\n ) => SqlFragment;\n placeholder: (name: string) => SqlFragment;\n raw: (value: string) => SqlFragment;\n}> &\n ((\n strings: TemplateStringsArray,\n ...values: readonly unknown[]\n ) => SqlFragment);\n\n/** TypeGraph's database-independent SQL template and composition helpers. */\nexport const sql: SqlTag = Object.assign(templateSql, {\n empty: function empty(): SqlFragment {\n return EMPTY_SQL;\n },\n identifier: identifierSql,\n join: joinSql,\n placeholder: placeholderSql,\n raw: rawSql,\n});\n\n/** A rendered statement and its ordered bound parameters. */\nexport type RenderedSql = Readonly<{\n sql: string;\n params: readonly unknown[];\n}>;\n\nfunction quotedIdentifier(identifier: string): string {\n return `\"${identifier.replaceAll('\"', '\"\"')}\"`;\n}\n\nfunction resolvedPlaceholder(\n placeholder: Placeholder,\n bindings: Readonly<Record<string, unknown>> | undefined,\n dialect: SqlDialect,\n): unknown {\n if (bindings === undefined) return placeholder;\n\n if (!Object.hasOwn(bindings, placeholder.name)) {\n throw new ConfigurationError(\n `Missing binding for parameter \"${placeholder.name}\"`,\n { parameterName: placeholder.name },\n );\n }\n return bindSqlValue(bindings[placeholder.name], dialect);\n}\n\n/**\n * Renders a fragment for a database adapter.\n *\n * Named placeholders remain in `params` when `bindings` is omitted, allowing\n * a prepared template to resolve them later. Passing `bindings` resolves every\n * placeholder eagerly.\n */\nexport function renderSql(\n fragment: SqlFragment,\n dialect: SqlDialect,\n bindings?: Readonly<Record<string, unknown>>,\n): RenderedSql {\n const parts: string[] = [];\n const params: unknown[] = [];\n const profile = getSqlDialectProfile(dialect);\n\n for (const node of getChunks(fragment)) {\n switch (node.kind) {\n case \"text\": {\n parts.push(node.value);\n break;\n }\n case \"identifier\": {\n parts.push(quotedIdentifier(node.value));\n break;\n }\n case \"parameter\": {\n params.push(bindSqlValue(node.value, dialect));\n parts.push(profile.placeholder(params.length));\n break;\n }\n case \"placeholder\": {\n params.push(resolvedPlaceholder(node.value, bindings, dialect));\n parts.push(profile.placeholder(params.length));\n break;\n }\n default: {\n throwUnsupportedSqlChunk(node);\n }\n }\n }\n\n return Object.freeze({\n sql: parts.join(\"\"),\n params: Object.freeze(params),\n });\n}\n\n/** Renders a fragment using SQLite's `?` placeholders. */\nexport function renderSqlite(\n fragment: SqlFragment,\n bindings?: Readonly<Record<string, unknown>>,\n): RenderedSql {\n return renderSql(fragment, \"sqlite\", bindings);\n}\n\n/** Renders a fragment using PostgreSQL's numbered placeholders. */\nexport function renderPostgres(\n fragment: SqlFragment,\n bindings?: Readonly<Record<string, unknown>>,\n): RenderedSql {\n return renderSql(fragment, \"postgres\", bindings);\n}\n\nfunction inlineLiteral(value: unknown, dialect: SqlDialect): string {\n if (value === undefined || value === null) return \"NULL\";\n if (typeof value === \"string\") return inlineSqlStringLiteral(value, dialect);\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) {\n throw new ConfigurationError(\"Cannot inline a non-finite SQL number\", {\n value,\n });\n }\n return String(value);\n }\n if (typeof value === \"bigint\") return String(value);\n if (typeof value === \"boolean\") {\n return getSqlDialectProfile(dialect).booleanLiteralString(value);\n }\n if (value instanceof Date) {\n return inlineSqlStringLiteral(value.toISOString(), dialect);\n }\n\n throw new ConfigurationError(\"Cannot inline this SQL parameter value\", {\n value,\n });\n}\n\n/**\n * Renders a fragment with safe scalar literals instead of bound parameters.\n *\n * This is intentionally limited to DDL paths whose drivers cannot bind values.\n * Application queries should always use {@link renderSql}.\n */\nexport function renderSqlInline(\n fragment: SqlFragment,\n dialect: SqlDialect,\n): string {\n const parts: string[] = [];\n\n for (const node of getChunks(fragment)) {\n switch (node.kind) {\n case \"text\": {\n parts.push(node.value);\n break;\n }\n case \"identifier\": {\n parts.push(quotedIdentifier(node.value));\n break;\n }\n case \"parameter\": {\n parts.push(inlineLiteral(node.value, dialect));\n break;\n }\n case \"placeholder\": {\n throw new ConfigurationError(\n `Cannot inline unresolved SQL placeholder \"${node.value.name}\"`,\n { parameterName: node.value.name },\n );\n }\n default: {\n throwUnsupportedSqlChunk(node);\n }\n }\n }\n\n return parts.join(\"\");\n}\n","/**\n * Shared LIKE-escape clause for the query compiler.\n *\n * The compiler builds `contains` / `startsWith` / `endsWith` patterns by\n * escaping the literal `%`, `_`, and `\\` in user input with a backslash (see\n * the pattern builders in `compiler/predicates.ts`). For that escaping to take\n * effect the emitted `LIKE` / `ILIKE` must declare backslash as its escape\n * character. PostgreSQL's default LIKE escape is already backslash, so this\n * clause is a no-op there; SQLite has *no* default escape character, so without\n * it an escaped `\\%` matches a literal backslash followed by any character —\n * silently diverging from Postgres. Emitting it on every compiled predicate\n * makes the two backends match by construction.\n */\nimport { sql, type SqlFragment } from \"../sql-fragment\";\n\n/**\n * The backslash escape character used by the JS pattern builder\n * (`compileStringPattern` in `compiler/predicates.ts`) to prefix the literal\n * `%`, `_`, and `\\` in user input. It must match the character declared by\n * {@link likeEscapeClause}: the builder prefixes wildcards with this character,\n * and the clause tells SQL to treat it as the escape. Both are backslash.\n */\nexport const LIKE_ESCAPE_CHARACTER = \"\\\\\";\n\n/**\n * `ESCAPE '\\'` clause appended to every compiled `LIKE` / `ILIKE` predicate,\n * declaring {@link LIKE_ESCAPE_CHARACTER} as the escape character. The single\n * backslash inside the quotes is a literal in both PostgreSQL (with\n * `standard_conforming_strings`, the default) and SQLite.\n */\nexport const likeEscapeClause: SqlFragment = sql`ESCAPE '\\\\'`;\n"]}