@nicia-ai/typegraph 0.48.0 → 0.50.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 (327) 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 +56 -52
  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 +34 -28
  10. package/dist/backend/postgres/index.d.cts +7 -7
  11. package/dist/backend/postgres/index.d.ts +7 -7
  12. package/dist/backend/postgres/index.js +17 -15
  13. package/dist/backend/postgres/pglite-store.cjs +36 -35
  14. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  15. package/dist/backend/postgres/pglite-store.d.cts +8 -8
  16. package/dist/backend/postgres/pglite-store.d.ts +8 -8
  17. package/dist/backend/postgres/pglite-store.js +32 -31
  18. package/dist/backend/postgres/pglite-store.js.map +1 -1
  19. package/dist/backend/postgres/pglite.cjs +19 -17
  20. package/dist/backend/postgres/pglite.d.cts +3 -3
  21. package/dist/backend/postgres/pglite.d.ts +3 -3
  22. package/dist/backend/postgres/pglite.js +18 -16
  23. package/dist/backend/sqlite/index.cjs +31 -25
  24. package/dist/backend/sqlite/index.d.cts +7 -7
  25. package/dist/backend/sqlite/index.d.ts +7 -7
  26. package/dist/backend/sqlite/index.js +15 -13
  27. package/dist/backend/sqlite/libsql.cjs +22 -20
  28. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  29. package/dist/backend/sqlite/libsql.d.cts +3 -3
  30. package/dist/backend/sqlite/libsql.d.ts +3 -3
  31. package/dist/backend/sqlite/libsql.js +17 -15
  32. package/dist/backend/sqlite/libsql.js.map +1 -1
  33. package/dist/backend/sqlite/local-store.cjs +37 -36
  34. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  35. package/dist/backend/sqlite/local-store.d.cts +8 -8
  36. package/dist/backend/sqlite/local-store.d.ts +8 -8
  37. package/dist/backend/sqlite/local-store.js +33 -32
  38. package/dist/backend/sqlite/local-store.js.map +1 -1
  39. package/dist/backend/sqlite/local.cjs +20 -18
  40. package/dist/backend/sqlite/local.d.cts +3 -3
  41. package/dist/backend/sqlite/local.d.ts +3 -3
  42. package/dist/backend/sqlite/local.js +18 -16
  43. package/dist/{chunk-AX6JGVTZ.js → chunk-2CYI5HRH.js} +276 -206
  44. package/dist/chunk-2CYI5HRH.js.map +1 -0
  45. package/dist/{chunk-KF6K7TGH.js → chunk-2GIV5X4P.js} +702 -422
  46. package/dist/chunk-2GIV5X4P.js.map +1 -0
  47. package/dist/{chunk-2TYSSBU5.js → chunk-2Q45FAIE.js} +15 -15
  48. package/dist/{chunk-2TYSSBU5.js.map → chunk-2Q45FAIE.js.map} +1 -1
  49. package/dist/{chunk-WODMN3Q2.cjs → chunk-45YZXI6X.cjs} +27 -27
  50. package/dist/{chunk-WODMN3Q2.cjs.map → chunk-45YZXI6X.cjs.map} +1 -1
  51. package/dist/{chunk-3DMMGT6S.js → chunk-46UGOVRW.js} +3 -3
  52. package/dist/{chunk-3DMMGT6S.js.map → chunk-46UGOVRW.js.map} +1 -1
  53. package/dist/{chunk-GLHXM7C4.js → chunk-5LKOVCPP.js} +60 -23
  54. package/dist/chunk-5LKOVCPP.js.map +1 -0
  55. package/dist/{chunk-JFRT7S3B.cjs → chunk-5OWHU7Z7.cjs} +261 -459
  56. package/dist/chunk-5OWHU7Z7.cjs.map +1 -0
  57. package/dist/{chunk-7SQSZN2J.js → chunk-5PP4KRPV.js} +5 -5
  58. package/dist/{chunk-7SQSZN2J.js.map → chunk-5PP4KRPV.js.map} +1 -1
  59. package/dist/chunk-6KQEICJ6.cjs +12 -0
  60. package/dist/{chunk-MKJ4KXL5.cjs.map → chunk-6KQEICJ6.cjs.map} +1 -1
  61. package/dist/{chunk-6SWPJEYN.js → chunk-6LEOAIIB.js} +40 -6
  62. package/dist/chunk-6LEOAIIB.js.map +1 -0
  63. package/dist/{chunk-DZAICA5J.js → chunk-6NKSE5AU.js} +4 -4
  64. package/dist/{chunk-DZAICA5J.js.map → chunk-6NKSE5AU.js.map} +1 -1
  65. package/dist/{chunk-OVI7IXYX.js → chunk-6S3PTHL4.js} +3 -3
  66. package/dist/{chunk-OVI7IXYX.js.map → chunk-6S3PTHL4.js.map} +1 -1
  67. package/dist/{chunk-3FPR224C.cjs → chunk-7CCMCMJO.cjs} +102 -102
  68. package/dist/{chunk-3FPR224C.cjs.map → chunk-7CCMCMJO.cjs.map} +1 -1
  69. package/dist/{chunk-SHFBB23Q.js → chunk-7OWE7WD6.js} +6 -4
  70. package/dist/chunk-7OWE7WD6.js.map +1 -0
  71. package/dist/chunk-7PRMDZIA.cjs +182 -0
  72. package/dist/chunk-7PRMDZIA.cjs.map +1 -0
  73. package/dist/{chunk-CHAOFCHV.js → chunk-AH2A74OZ.js} +3 -3
  74. package/dist/{chunk-CHAOFCHV.js.map → chunk-AH2A74OZ.js.map} +1 -1
  75. package/dist/{chunk-OORXGFL5.cjs → chunk-BYBDM423.cjs} +48 -48
  76. package/dist/{chunk-OORXGFL5.cjs.map → chunk-BYBDM423.cjs.map} +1 -1
  77. package/dist/{chunk-JB6T4GLL.cjs → chunk-C76WFIVZ.cjs} +808 -519
  78. package/dist/chunk-C76WFIVZ.cjs.map +1 -0
  79. package/dist/{chunk-OTUPEF2W.cjs → chunk-CS6JTQQ2.cjs} +328 -257
  80. package/dist/chunk-CS6JTQQ2.cjs.map +1 -0
  81. package/dist/{chunk-AOSSQDVO.cjs → chunk-CSNOYIB4.cjs} +13 -13
  82. package/dist/{chunk-AOSSQDVO.cjs.map → chunk-CSNOYIB4.cjs.map} +1 -1
  83. package/dist/{chunk-HEV35TGT.js → chunk-DI6VC62F.js} +13 -4
  84. package/dist/chunk-DI6VC62F.js.map +1 -0
  85. package/dist/{chunk-2QGYQBS2.cjs → chunk-DWUDZ66O.cjs} +10 -10
  86. package/dist/{chunk-2QGYQBS2.cjs.map → chunk-DWUDZ66O.cjs.map} +1 -1
  87. package/dist/{chunk-ZDKTPBGV.js → chunk-EDLKIQRI.js} +4 -4
  88. package/dist/{chunk-ZDKTPBGV.js.map → chunk-EDLKIQRI.js.map} +1 -1
  89. package/dist/chunk-EH3JZJUM.cjs +567 -0
  90. package/dist/chunk-EH3JZJUM.cjs.map +1 -0
  91. package/dist/{chunk-S5TERQVW.js → chunk-FX5ZW6PN.js} +196 -33
  92. package/dist/chunk-FX5ZW6PN.js.map +1 -0
  93. package/dist/{chunk-XVWOYKIK.js → chunk-FZHF5UWR.js} +3 -3
  94. package/dist/{chunk-XVWOYKIK.js.map → chunk-FZHF5UWR.js.map} +1 -1
  95. package/dist/{chunk-BFUOME67.cjs → chunk-G2TLHH6T.cjs} +20 -11
  96. package/dist/chunk-G2TLHH6T.cjs.map +1 -0
  97. package/dist/{chunk-5PRKMB24.cjs → chunk-GHZPZNFC.cjs} +12 -4
  98. package/dist/chunk-GHZPZNFC.cjs.map +1 -0
  99. package/dist/{chunk-ZFMCDJGB.js → chunk-GVYVGGPJ.js} +11 -199
  100. package/dist/chunk-GVYVGGPJ.js.map +1 -0
  101. package/dist/{chunk-SDBBMD4N.js → chunk-H3XP6BAV.js} +3 -3
  102. package/dist/{chunk-SDBBMD4N.js.map → chunk-H3XP6BAV.js.map} +1 -1
  103. package/dist/{chunk-ROR5ZR6A.cjs → chunk-HSEZ7X6Y.cjs} +45 -45
  104. package/dist/{chunk-ROR5ZR6A.cjs.map → chunk-HSEZ7X6Y.cjs.map} +1 -1
  105. package/dist/{chunk-LRQKXRXO.cjs → chunk-HY5BNOUN.cjs} +4 -4
  106. package/dist/{chunk-LRQKXRXO.cjs.map → chunk-HY5BNOUN.cjs.map} +1 -1
  107. package/dist/chunk-HZUB5CON.js +27 -0
  108. package/dist/chunk-HZUB5CON.js.map +1 -0
  109. package/dist/{chunk-MYKHJI2J.js → chunk-I5C6OTKR.js} +3 -3
  110. package/dist/{chunk-MYKHJI2J.js.map → chunk-I5C6OTKR.js.map} +1 -1
  111. package/dist/{chunk-3U5ABFDW.cjs → chunk-IHK5KA2Q.cjs} +31 -28
  112. package/dist/chunk-IHK5KA2Q.cjs.map +1 -0
  113. package/dist/{chunk-26YKDNUD.cjs → chunk-IPRP6TDL.cjs} +12 -10
  114. package/dist/chunk-IPRP6TDL.cjs.map +1 -0
  115. package/dist/{chunk-UGHG7PGX.js → chunk-IRPYOHRC.js} +26 -4
  116. package/dist/chunk-IRPYOHRC.js.map +1 -0
  117. package/dist/{chunk-7XUYFFR4.cjs → chunk-ISKCIQF2.cjs} +20 -20
  118. package/dist/{chunk-7XUYFFR4.cjs.map → chunk-ISKCIQF2.cjs.map} +1 -1
  119. package/dist/{chunk-OD4SSY2U.js → chunk-JG5XIJDY.js} +57 -31
  120. package/dist/chunk-JG5XIJDY.js.map +1 -0
  121. package/dist/{chunk-2HIYYMWY.cjs → chunk-K2XYLVVB.cjs} +134 -133
  122. package/dist/chunk-K2XYLVVB.cjs.map +1 -0
  123. package/dist/{chunk-5K2BKEBD.js → chunk-K46SDNQD.js} +10 -4
  124. package/dist/chunk-K46SDNQD.js.map +1 -0
  125. package/dist/{chunk-TZEGUG6D.cjs → chunk-K6VKTBST.cjs} +4 -4
  126. package/dist/{chunk-TZEGUG6D.cjs.map → chunk-K6VKTBST.cjs.map} +1 -1
  127. package/dist/chunk-KWNWG4RC.cjs +12 -0
  128. package/dist/{chunk-CICO5GXD.cjs.map → chunk-KWNWG4RC.cjs.map} +1 -1
  129. package/dist/{chunk-FQPEMEWX.cjs → chunk-LLVOQOWE.cjs} +80 -32
  130. package/dist/chunk-LLVOQOWE.cjs.map +1 -0
  131. package/dist/{chunk-TQHGE7UC.cjs → chunk-M5MSP3BI.cjs} +18 -10
  132. package/dist/chunk-M5MSP3BI.cjs.map +1 -0
  133. package/dist/{chunk-ACGSAMD3.js → chunk-MJPZNEJZ.js} +274 -292
  134. package/dist/chunk-MJPZNEJZ.js.map +1 -0
  135. package/dist/{chunk-TUNPBZY3.cjs → chunk-MM3JHVKZ.cjs} +4 -4
  136. package/dist/{chunk-TUNPBZY3.cjs.map → chunk-MM3JHVKZ.cjs.map} +1 -1
  137. package/dist/{chunk-BRRP76WO.js → chunk-MX7EKQPM.js} +457 -299
  138. package/dist/chunk-MX7EKQPM.js.map +1 -0
  139. package/dist/{chunk-2SYZXD54.js → chunk-MZ34E2GN.js} +13 -12
  140. package/dist/chunk-MZ34E2GN.js.map +1 -0
  141. package/dist/{chunk-EDN4Y4ZG.cjs → chunk-OJHD3LXJ.cjs} +9 -9
  142. package/dist/{chunk-EDN4Y4ZG.cjs.map → chunk-OJHD3LXJ.cjs.map} +1 -1
  143. package/dist/{chunk-DO7SAMEK.cjs → chunk-ON47CBE4.cjs} +47 -47
  144. package/dist/{chunk-DO7SAMEK.cjs.map → chunk-ON47CBE4.cjs.map} +1 -1
  145. package/dist/{chunk-6LN7FIVU.js → chunk-PALYTHGM.js} +11 -4
  146. package/dist/chunk-PALYTHGM.js.map +1 -0
  147. package/dist/{chunk-YVF2EM7B.js → chunk-R7MRFE5P.js} +3 -3
  148. package/dist/{chunk-YVF2EM7B.js.map → chunk-R7MRFE5P.js.map} +1 -1
  149. package/dist/{chunk-EZEEWCFJ.cjs → chunk-RDP6ZRSM.cjs} +435 -265
  150. package/dist/chunk-RDP6ZRSM.cjs.map +1 -0
  151. package/dist/{chunk-GYEG3ZLZ.cjs → chunk-RJMHU2MG.cjs} +121 -18
  152. package/dist/chunk-RJMHU2MG.cjs.map +1 -0
  153. package/dist/chunk-RWUWTJQY.cjs +30 -0
  154. package/dist/chunk-RWUWTJQY.cjs.map +1 -0
  155. package/dist/{chunk-CT3ZKTOF.js → chunk-S33YQEL7.js} +7 -7
  156. package/dist/{chunk-CT3ZKTOF.js.map → chunk-S33YQEL7.js.map} +1 -1
  157. package/dist/chunk-S3SDEQMC.js +532 -0
  158. package/dist/chunk-S3SDEQMC.js.map +1 -0
  159. package/dist/{chunk-OI2GQ25X.cjs → chunk-SHC7BCG5.cjs} +7 -7
  160. package/dist/{chunk-OI2GQ25X.cjs.map → chunk-SHC7BCG5.cjs.map} +1 -1
  161. package/dist/{chunk-L3LQNR34.cjs → chunk-TEC24ZDA.cjs} +161 -161
  162. package/dist/{chunk-L3LQNR34.cjs.map → chunk-TEC24ZDA.cjs.map} +1 -1
  163. package/dist/{chunk-HDL2ARHX.cjs → chunk-TP4NJTI3.cjs} +63 -27
  164. package/dist/chunk-TP4NJTI3.cjs.map +1 -0
  165. package/dist/{chunk-UMGZDVOA.cjs → chunk-TTCOPKUL.cjs} +124 -124
  166. package/dist/{chunk-UMGZDVOA.cjs.map → chunk-TTCOPKUL.cjs.map} +1 -1
  167. package/dist/chunk-TUVD4DFR.cjs +1207 -0
  168. package/dist/chunk-TUVD4DFR.cjs.map +1 -0
  169. package/dist/{chunk-PFBRJBUL.cjs → chunk-TYGGUWMS.cjs} +178 -152
  170. package/dist/chunk-TYGGUWMS.cjs.map +1 -0
  171. package/dist/{chunk-4WMMBDS5.js → chunk-U3Z7XKAG.js} +7 -7
  172. package/dist/{chunk-4WMMBDS5.js.map → chunk-U3Z7XKAG.js.map} +1 -1
  173. package/dist/{chunk-NACVVDWB.js → chunk-U5EL6JUV.js} +10 -10
  174. package/dist/{chunk-NACVVDWB.js.map → chunk-U5EL6JUV.js.map} +1 -1
  175. package/dist/{chunk-OMZ37BM2.js → chunk-V76FGHY3.js} +5 -5
  176. package/dist/{chunk-OMZ37BM2.js.map → chunk-V76FGHY3.js.map} +1 -1
  177. package/dist/{chunk-6NGW27EO.cjs → chunk-VLBTRXA2.cjs} +10 -10
  178. package/dist/{chunk-6NGW27EO.cjs.map → chunk-VLBTRXA2.cjs.map} +1 -1
  179. package/dist/chunk-VTJVMP4I.js +1182 -0
  180. package/dist/chunk-VTJVMP4I.js.map +1 -0
  181. package/dist/{chunk-QTD6HX4O.js → chunk-W5SOCUBL.js} +5 -5
  182. package/dist/{chunk-QTD6HX4O.js.map → chunk-W5SOCUBL.js.map} +1 -1
  183. package/dist/{chunk-SR725PWF.cjs → chunk-WCLMKNQE.cjs} +1750 -1592
  184. package/dist/chunk-WCLMKNQE.cjs.map +1 -0
  185. package/dist/{chunk-TKZXMWQF.cjs → chunk-WK23PGTP.cjs} +13 -13
  186. package/dist/{chunk-TKZXMWQF.cjs.map → chunk-WK23PGTP.cjs.map} +1 -1
  187. package/dist/{chunk-KKBDXCLQ.js → chunk-WQBAQZHR.js} +4 -4
  188. package/dist/{chunk-KKBDXCLQ.js.map → chunk-WQBAQZHR.js.map} +1 -1
  189. package/dist/{chunk-MRDBBHIZ.cjs → chunk-X4GDXBOP.cjs} +2 -2
  190. package/dist/chunk-X4GDXBOP.cjs.map +1 -0
  191. package/dist/{chunk-WCCATHMB.cjs → chunk-XMY2SXOH.cjs} +438 -456
  192. package/dist/chunk-XMY2SXOH.cjs.map +1 -0
  193. package/dist/{chunk-D5R42W5D.js → chunk-XZW2CTNO.js} +115 -12
  194. package/dist/chunk-XZW2CTNO.js.map +1 -0
  195. package/dist/{chunk-NVY5CJFP.js → chunk-Y55DLLEG.js} +9 -6
  196. package/dist/chunk-Y55DLLEG.js.map +1 -0
  197. package/dist/chunk-YA36ABIL.js +174 -0
  198. package/dist/chunk-YA36ABIL.js.map +1 -0
  199. package/dist/{chunk-ZLONH2UD.js → chunk-YDEJQWOL.js} +2 -2
  200. package/dist/chunk-YDEJQWOL.js.map +1 -0
  201. package/dist/{chunk-JONXFAPO.js → chunk-ZAQUKCUC.js} +5 -5
  202. package/dist/{chunk-JONXFAPO.js.map → chunk-ZAQUKCUC.js.map} +1 -1
  203. package/dist/{chunk-SIT26LAZ.cjs → chunk-ZBFZGLZE.cjs} +29 -5
  204. package/dist/chunk-ZBFZGLZE.cjs.map +1 -0
  205. package/dist/{chunk-P6YLZTRE.js → chunk-ZRJTM7MT.js} +3 -3
  206. package/dist/{chunk-P6YLZTRE.js.map → chunk-ZRJTM7MT.js.map} +1 -1
  207. package/dist/core/index.cjs +29 -28
  208. package/dist/core/index.d.cts +4 -4
  209. package/dist/core/index.d.ts +4 -4
  210. package/dist/core/index.js +9 -8
  211. package/dist/{ddl-D_oW-EVO.d.ts → ddl-B49O7dB_.d.ts} +3 -3
  212. package/dist/{ddl-BL1NZLMY.d.cts → ddl-DcZG660s.d.cts} +3 -3
  213. package/dist/graph-extension/index.cjs +21 -20
  214. package/dist/graph-extension/index.d.cts +4 -4
  215. package/dist/graph-extension/index.d.ts +4 -4
  216. package/dist/graph-extension/index.js +5 -4
  217. package/dist/graph-merge/index.cjs +327 -302
  218. package/dist/graph-merge/index.cjs.map +1 -1
  219. package/dist/graph-merge/index.d.cts +14 -11
  220. package/dist/graph-merge/index.d.ts +14 -11
  221. package/dist/graph-merge/index.js +52 -27
  222. package/dist/graph-merge/index.js.map +1 -1
  223. package/dist/{index-D7d1u2gr.d.ts → index-B0PrmE3K.d.cts} +16 -2
  224. package/dist/{index-COs_z6nV.d.cts → index-CwcXsL5R.d.ts} +16 -2
  225. package/dist/index.cjs +223 -222
  226. package/dist/index.cjs.map +1 -1
  227. package/dist/index.d.cts +12 -12
  228. package/dist/index.d.ts +12 -12
  229. package/dist/index.js +37 -36
  230. package/dist/index.js.map +1 -1
  231. package/dist/indexes/index.cjs +13 -13
  232. package/dist/indexes/index.d.cts +4 -4
  233. package/dist/indexes/index.d.ts +4 -4
  234. package/dist/indexes/index.js +6 -6
  235. package/dist/ingestion-import-target-CI8OWIkM.d.ts +17 -0
  236. package/dist/ingestion-import-target-DCpfM1PX.d.cts +17 -0
  237. package/dist/interchange/index.cjs +55 -54
  238. package/dist/interchange/index.cjs.map +1 -1
  239. package/dist/interchange/index.d.cts +26 -12
  240. package/dist/interchange/index.d.ts +26 -12
  241. package/dist/interchange/index.js +19 -18
  242. package/dist/interchange/index.js.map +1 -1
  243. package/dist/{manager-D9eRT_ns.d.ts → manager-Cfg1ENj1.d.ts} +30 -2
  244. package/dist/{manager-CYaff3n3.d.cts → manager-D348fa6W.d.cts} +30 -2
  245. package/dist/{materialize-indexes-DJ3ykH59.d.ts → materialize-indexes-C9GG3O3C.d.ts} +1 -1
  246. package/dist/{materialize-indexes-DTtAnvfY.d.cts → materialize-indexes-CrSiW_lT.d.cts} +1 -1
  247. package/dist/{postgres-DMj39MEu.d.cts → postgres-CH1kkM5J.d.cts} +279 -2
  248. package/dist/{postgres-CcL4bAHS.d.ts → postgres-UStOycLI.d.ts} +279 -2
  249. package/dist/profiler/index.d.cts +9 -9
  250. package/dist/profiler/index.d.ts +9 -9
  251. package/dist/provenance/index.cjs +46 -44
  252. package/dist/provenance/index.cjs.map +1 -1
  253. package/dist/provenance/index.d.cts +7 -7
  254. package/dist/provenance/index.d.ts +7 -7
  255. package/dist/provenance/index.js +12 -10
  256. package/dist/provenance/index.js.map +1 -1
  257. package/dist/{repair-validity-windows-DlUSqwCg.d.ts → repair-validity-windows-BtOEe2pS.d.ts} +2 -2
  258. package/dist/{repair-validity-windows-BFNZvd_H.d.cts → repair-validity-windows-aWX7VNvv.d.cts} +2 -2
  259. package/dist/schema/index.cjs +46 -46
  260. package/dist/schema/index.d.cts +6 -6
  261. package/dist/schema/index.d.ts +6 -6
  262. package/dist/schema/index.js +19 -19
  263. package/dist/{searchable-DHJMh_nj.d.cts → searchable-C8-RrL3l.d.cts} +1 -1
  264. package/dist/{searchable-bpE1bBfc.d.ts → searchable-z4BiFfHI.d.ts} +1 -1
  265. package/dist/{sqlite-D7Oz0SQh.d.ts → sqlite-Cyx9j9o6.d.cts} +309 -2
  266. package/dist/{sqlite-YppHrNFb.d.cts → sqlite-axLw5Lo5.d.ts} +309 -2
  267. package/dist/{store-JUVvtmR4.d.cts → store-CTfQ9taw.d.ts} +110 -13
  268. package/dist/{store-UzrGvZOo.d.ts → store-DR9J7JVB.d.cts} +110 -13
  269. package/dist/{temporal-5GqpYCk2.d.cts → temporal-B4Ky4wzh.d.cts} +1 -1
  270. package/dist/{temporal-CbnLzTmM.d.ts → temporal-CBOrERz5.d.ts} +1 -1
  271. package/dist/{types-CXAhpW-c.d.cts → types-BE921wRl.d.cts} +1 -1
  272. package/dist/{types-Bx74kaTt.d.ts → types-BScHXVM7.d.ts} +1 -1
  273. package/dist/{types-BqFZTQmV.d.cts → types-CWg4dTjj.d.cts} +257 -6
  274. package/dist/{types-BqFZTQmV.d.ts → types-CWg4dTjj.d.ts} +257 -6
  275. package/dist/{where-O-k2wgYm.d.ts → where-BWXUPV3C.d.ts} +1 -1
  276. package/dist/{where-DI_Fqz-X.d.cts → where-CNtx1aLc.d.cts} +1 -1
  277. package/package.json +4 -4
  278. package/dist/chunk-26YKDNUD.cjs.map +0 -1
  279. package/dist/chunk-2HIYYMWY.cjs.map +0 -1
  280. package/dist/chunk-2SYZXD54.js.map +0 -1
  281. package/dist/chunk-3KOY4FH3.cjs +0 -934
  282. package/dist/chunk-3KOY4FH3.cjs.map +0 -1
  283. package/dist/chunk-3U5ABFDW.cjs.map +0 -1
  284. package/dist/chunk-5K2BKEBD.js.map +0 -1
  285. package/dist/chunk-5PRKMB24.cjs.map +0 -1
  286. package/dist/chunk-6LN7FIVU.js.map +0 -1
  287. package/dist/chunk-6SWPJEYN.js.map +0 -1
  288. package/dist/chunk-ACGSAMD3.js.map +0 -1
  289. package/dist/chunk-AX6JGVTZ.js.map +0 -1
  290. package/dist/chunk-BFUOME67.cjs.map +0 -1
  291. package/dist/chunk-BRRP76WO.js.map +0 -1
  292. package/dist/chunk-CICO5GXD.cjs +0 -12
  293. package/dist/chunk-D5R42W5D.js.map +0 -1
  294. package/dist/chunk-EZEEWCFJ.cjs.map +0 -1
  295. package/dist/chunk-FA2AFWLP.cjs +0 -167
  296. package/dist/chunk-FA2AFWLP.cjs.map +0 -1
  297. package/dist/chunk-FQPEMEWX.cjs.map +0 -1
  298. package/dist/chunk-GLHXM7C4.js.map +0 -1
  299. package/dist/chunk-GYEG3ZLZ.cjs.map +0 -1
  300. package/dist/chunk-HDL2ARHX.cjs.map +0 -1
  301. package/dist/chunk-HEV35TGT.js.map +0 -1
  302. package/dist/chunk-I4GAZH5Z.js +0 -913
  303. package/dist/chunk-I4GAZH5Z.js.map +0 -1
  304. package/dist/chunk-JB6T4GLL.cjs.map +0 -1
  305. package/dist/chunk-JBQQ7THH.js +0 -20
  306. package/dist/chunk-JBQQ7THH.js.map +0 -1
  307. package/dist/chunk-JFRT7S3B.cjs.map +0 -1
  308. package/dist/chunk-KF6K7TGH.js.map +0 -1
  309. package/dist/chunk-MKJ4KXL5.cjs +0 -12
  310. package/dist/chunk-MRDBBHIZ.cjs.map +0 -1
  311. package/dist/chunk-NVY5CJFP.js.map +0 -1
  312. package/dist/chunk-OD4SSY2U.js.map +0 -1
  313. package/dist/chunk-OTUPEF2W.cjs.map +0 -1
  314. package/dist/chunk-PFBRJBUL.cjs.map +0 -1
  315. package/dist/chunk-PWLJ77UV.cjs +0 -23
  316. package/dist/chunk-PWLJ77UV.cjs.map +0 -1
  317. package/dist/chunk-S5TERQVW.js.map +0 -1
  318. package/dist/chunk-SHFBB23Q.js.map +0 -1
  319. package/dist/chunk-SIT26LAZ.cjs.map +0 -1
  320. package/dist/chunk-SR725PWF.cjs.map +0 -1
  321. package/dist/chunk-TQHGE7UC.cjs.map +0 -1
  322. package/dist/chunk-UGHG7PGX.js.map +0 -1
  323. package/dist/chunk-WCCATHMB.cjs.map +0 -1
  324. package/dist/chunk-YIURNGXI.js +0 -155
  325. package/dist/chunk-YIURNGXI.js.map +0 -1
  326. package/dist/chunk-ZFMCDJGB.js.map +0 -1
  327. package/dist/chunk-ZLONH2UD.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/interchange/trusted-import.ts"],"names":["TrustedImportError","getSearchableFields","resolveGraphVectorSlots","isCanonicalIsoDate","isInvertedValidityWindow","storeBackend","exportStreamBackend","snapshotExportContention","serializedStreamRefusal","withImportStreamLease"],"mappings":";;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A,EAAM,SAAS,IAAA;AAAK;AAC7D,GAEN;AACA,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAM;AAC7B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAM;AAC7B,EAAA,IAAI,aAAa,MAAA,EAAW;AAC1B,IAAA,MAAM,EAAE,IAAA,EAAM,UAAA,EAAY,UAAA,EAAY,SAAS,UAAA,EAAW;AAAA,EAC5D;AACF;AAGO,SAAS,kBAAA,CACd,OACA,IAAA,EAC8B;AAC9B,EAAA,OAAO,wBAAA,CAAyB,KAAA,EAAO,eAAA,CAAgB,IAAI,CAAC,CAAA;AAC9D","file":"index.cjs","sourcesContent":["import { snapshotExportContention } from \"../backend/transaction-resource\";\nimport type {\n InsertEdgeParams,\n InsertNodeParams,\n TrustedImportOptions,\n TrustedImportSession,\n} from \"../backend/types\";\nimport type { GraphDef } from \"../core/define-graph\";\nimport { resolveGraphVectorSlots } from \"../core/embedding\";\nimport { getSearchableFields } from \"../core/searchable\";\nimport { TrustedImportError } from \"../errors\";\nimport { storeBackend } from \"../store/runtime-port\";\nimport type { Store } from \"../store/store\";\nimport { isCanonicalIsoDate, isInvertedValidityWindow } from \"../utils/date\";\nimport { serializedStreamRefusal, withImportStreamLease } from \"./import\";\nimport { exportStreamBackend } from \"./stream-source\";\nimport type {\n GraphData,\n GraphInterchangeChunk,\n InterchangeEdge,\n InterchangeNode,\n} from \"./types\";\n\n/** Counts committed by a trusted initial import. */\nexport type TrustedImportResult = Readonly<{\n nodes: number;\n edges: number;\n}>;\n\nfunction rejectUnsupportedStoreFeatures<G extends GraphDef>(\n store: Store<G>,\n): void {\n if (store.historyEnabled) {\n throw new TrustedImportError(\n \"Trusted import does not support recorded-time history capture.\",\n \"history_unsupported\",\n { graphId: store.graphId },\n );\n }\n if (store.revisionTrackingEnabled) {\n throw new TrustedImportError(\n \"Trusted import does not support revision tracking.\",\n \"revision_tracking_unsupported\",\n { graphId: store.graphId },\n );\n }\n if (store.graph.identity !== undefined) {\n throw new TrustedImportError(\n \"Trusted import does not maintain Operational Identity assertions or closure.\",\n \"identity_unsupported\",\n { graphId: store.graphId },\n );\n }\n\n const uniqueKinds = Object.values(store.graph.nodes)\n .filter((registration) => (registration.unique?.length ?? 0) > 0)\n .map((registration) => registration.type.kind);\n if (uniqueKinds.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain node uniqueness sidecars.\",\n \"uniqueness_unsupported\",\n { graphId: store.graphId, nodeKinds: uniqueKinds },\n );\n }\n\n const searchableKinds = Object.values(store.graph.nodes)\n .filter(\n (registration) =>\n getSearchableFields(registration.type.schema).length > 0,\n )\n .map((registration) => registration.type.kind);\n if (searchableKinds.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain fulltext sidecars.\",\n \"fulltext_unsupported\",\n { graphId: store.graphId, nodeKinds: searchableKinds },\n );\n }\n\n const vectorSlots = resolveGraphVectorSlots(store.graph);\n if (vectorSlots.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain vector sidecars.\",\n \"vector_unsupported\",\n {\n graphId: store.graphId,\n fields: vectorSlots.map((slot) => `${slot.nodeKind}.${slot.fieldPath}`),\n },\n );\n }\n}\n\nfunction invalidStream(message: string): TrustedImportError {\n return new TrustedImportError(message, \"invalid_stream\");\n}\n\n/** The stated validity window of a streamed node or edge. */\ntype StatedValidityWindow = Readonly<{\n validFrom?: string | null | undefined;\n validTo?: string | undefined;\n}>;\n\ntype ValidityWindowField = \"validFrom\" | \"validTo\";\n\n/** A stated window field that is not canonical, with the offending value. */\ntype NonCanonicalWindow = Readonly<{\n field: ValidityWindowField;\n value: string;\n}>;\n\n/**\n * The first window field of `entity` stating a timestamp that is not canonical\n * fixed-width UTC ISO 8601 — with the offending value — or `undefined` when\n * every stated one is canonical.\n *\n * A trusted stream is never re-parsed, so this is the only place its timestamps\n * are held to the format the rest of the system assumes. It is deliberately\n * format-ONLY — the same {@link isCanonicalIsoDate} decision the untrusted\n * path's schema and the store's own write validation make, and nothing more —\n * because a non-canonical instant is not merely ugly: every temporal filter\n * compares these values AS TEXT against an `asOf` coordinate, so a variable-width\n * one (`...:00.1Z`, an offset, date-only) mis-sorts and silently includes or\n * excludes the wrong rows once stored, and it would mis-decide the negative-width\n * check below on the way in. Two field tests per row costs about a microsecond\n * against the ~4µs an in-memory SQLite row already costs — the price of the\n * stream's ordering claims meaning anything.\n *\n * An absent field states nothing, and a `null` validFrom is a confirmed\n * open-left window (see {@link nodeParams}) — neither is a timestamp to check.\n */\nfunction nonCanonicalWindowOf(\n entity: StatedValidityWindow,\n): NonCanonicalWindow | undefined {\n const { validFrom, validTo } = entity;\n if (typeof validFrom === \"string\" && !isCanonicalIsoDate(validFrom)) {\n return { field: \"validFrom\", value: validFrom };\n }\n if (typeof validTo === \"string\" && !isCanonicalIsoDate(validTo)) {\n return { field: \"validTo\", value: validTo };\n }\n return undefined;\n}\n\n/**\n * The first entity in `entities` stating a non-canonical window timestamp, with\n * the offending field and value. Allocates only on the failing path, so a clean\n * chunk pays one predicate per stated timestamp and nothing else.\n */\nfunction findNonCanonicalWindow<Entity extends StatedValidityWindow>(\n entities: readonly Entity[],\n): (NonCanonicalWindow & Readonly<{ entity: Entity }>) | undefined {\n for (const entity of entities) {\n const nonCanonical = nonCanonicalWindowOf(entity);\n if (nonCanonical !== undefined) return { entity, ...nonCanonical };\n }\n return undefined;\n}\n\n/** The refusal message for a non-canonical window timestamp on `subject`. */\nfunction nonCanonicalWindowMessage(\n subject: string,\n field: ValidityWindowField,\n value: string,\n): string {\n return (\n `Non-canonical ${field} in trusted import: ${subject} states \"${value}\". ` +\n `Expected canonical fixed-width UTC ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ), ` +\n `which is what makes a stored timestamp sort chronologically against an asOf ` +\n `coordinate. Convert with new Date(value).toISOString().`\n );\n}\n\n/**\n * An entity whose stated window has negative width. Trusted import writes\n * straight to SQL and skips schema validation for throughput, but a row that\n * stopped being true before it started is a stream SHAPE fault rather than a\n * policy check: it is unobservable at every `asOf` coordinate, and no later\n * write repairs it. `null` validFrom is a confirmed open-left window, so there\n * is no lower bound to invert against; zero width is legal (see\n * {@link isInvertedValidityWindow}).\n *\n * Only ever reached for a chunk whose timestamps {@link findNonCanonicalWindow}\n * has already accepted, which is what makes the lexicographic compare inside a\n * chronological one.\n */\nfunction hasInvertedWindow(entity: StatedValidityWindow): boolean {\n return isInvertedValidityWindow(\n entity.validFrom ?? undefined,\n entity.validTo,\n );\n}\n\nfunction nodeParams(graphId: string, node: InterchangeNode): InsertNodeParams {\n return {\n graphId,\n kind: node.kind,\n id: node.id,\n props: node.properties,\n ...(node.validFrom === undefined ? {} : { validFrom: node.validFrom }),\n ...(node.validTo === undefined ? {} : { validTo: node.validTo }),\n };\n}\n\nfunction edgeParams(graphId: string, edge: InterchangeEdge): InsertEdgeParams {\n return {\n graphId,\n id: edge.id,\n kind: edge.kind,\n fromKind: edge.from.kind,\n fromId: edge.from.id,\n toKind: edge.to.kind,\n toId: edge.to.id,\n props: edge.properties,\n ...(edge.validFrom === undefined ? {} : { validFrom: edge.validFrom }),\n ...(edge.validTo === undefined ? {} : { validTo: edge.validTo }),\n };\n}\n\nasync function consumeTrustedChunks<G extends GraphDef>(\n store: Store<G>,\n session: TrustedImportSession,\n chunks:\n AsyncIterable<GraphInterchangeChunk> | Iterable<GraphInterchangeChunk>,\n): Promise<TrustedImportResult> {\n const nodeKinds = new Set(\n Object.values(store.graph.nodes).map(\n (registration) => registration.type.kind,\n ),\n );\n const edgeKinds = new Set(\n Object.values(store.graph.edges).map(\n (registration) => registration.type.kind,\n ),\n );\n let receivedHeader = false;\n let receivedEdges = false;\n let nodeCount = 0;\n let edgeCount = 0;\n\n for await (const chunk of chunks) {\n switch (chunk.type) {\n case \"header\": {\n if (receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream emitted more than one header.\",\n );\n }\n if (chunk.header.identity !== undefined) {\n throw invalidStream(\n \"Trusted graph interchange import does not support identity data. \" +\n \"Use importGraphStream() for an identity export.\",\n );\n }\n receivedHeader = true;\n break;\n }\n case \"nodes\": {\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream must start with a header.\",\n );\n }\n if (receivedEdges) {\n throw invalidStream(\n \"Trusted graph interchange stream cannot emit nodes after edges.\",\n );\n }\n const unknownKind = chunk.nodes.find(\n (node) => !nodeKinds.has(node.kind),\n )?.kind;\n if (unknownKind !== undefined) {\n throw invalidStream(\n `Unknown node kind in trusted import: ${unknownKind}`,\n );\n }\n const nonCanonicalNode = findNonCanonicalWindow(chunk.nodes);\n if (nonCanonicalNode !== undefined) {\n const { entity, field, value } = nonCanonicalNode;\n throw invalidStream(\n nonCanonicalWindowMessage(\n `${entity.kind} \"${entity.id}\"`,\n field,\n value,\n ),\n );\n }\n const invertedNode = chunk.nodes.find((node) =>\n hasInvertedWindow(node),\n );\n if (invertedNode !== undefined) {\n throw invalidStream(\n `Inverted validity window in trusted import: ${invertedNode.kind} \"${invertedNode.id}\" ends at ` +\n `\"${String(invertedNode.validTo)}\", before its validFrom \"${String(invertedNode.validFrom)}\".`,\n );\n }\n await session.insertNodes(\n chunk.nodes.map((node) => nodeParams(store.graphId, node)),\n );\n nodeCount += chunk.nodes.length;\n break;\n }\n case \"edges\": {\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream must start with a header.\",\n );\n }\n receivedEdges = true;\n const invalidEdge = chunk.edges.find(\n (edge) =>\n !edgeKinds.has(edge.kind) ||\n !nodeKinds.has(edge.from.kind) ||\n !nodeKinds.has(edge.to.kind),\n );\n if (invalidEdge !== undefined) {\n throw invalidStream(\n `Unknown edge or endpoint kind in trusted import: ${invalidEdge.kind}`,\n );\n }\n const nonCanonicalEdge = findNonCanonicalWindow(chunk.edges);\n if (nonCanonicalEdge !== undefined) {\n const { entity, field, value } = nonCanonicalEdge;\n throw invalidStream(\n nonCanonicalWindowMessage(\n `${entity.kind} edge \"${entity.id}\"`,\n field,\n value,\n ),\n );\n }\n const invertedEdge = chunk.edges.find((edge) =>\n hasInvertedWindow(edge),\n );\n if (invertedEdge !== undefined) {\n throw invalidStream(\n `Inverted validity window in trusted import: ${invertedEdge.kind} edge \"${invertedEdge.id}\" ends at ` +\n `\"${String(invertedEdge.validTo)}\", before its validFrom \"${String(invertedEdge.validFrom)}\".`,\n );\n }\n await session.insertEdges(\n chunk.edges.map((edge) => edgeParams(store.graphId, edge)),\n );\n edgeCount += chunk.edges.length;\n break;\n }\n case \"identity\": {\n // The trusted session writes only the node and edge relations, so it\n // has no way to persist assertions or materialize the derived closure.\n // Refuse rather than drop identity truth from an identity-enabled\n // export: `importGraph` / `importGraphStream` carry it correctly.\n throw invalidStream(\n \"Trusted graph interchange import does not support identity assertions. \" +\n \"Use importGraphStream() for an export that carries identity truth.\",\n );\n }\n }\n }\n\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream ended before emitting a header.\",\n );\n }\n return { nodes: nodeCount, edges: edgeCount };\n}\n\n/**\n * Atomically imports a header-first stream into a fresh, dedicated database.\n *\n * This is an intentionally trusted path. It checks stream ordering and kind\n * names, but it does not validate properties, references, cardinality, or\n * conflicts. The caller must guarantee those invariants. Use\n * {@link importGraphStream} for untrusted data.\n *\n * Trusted of the DATA, not of the connection: this holds ONE write transaction\n * open for the entire stream, which makes it a long-lived import holder exactly\n * like {@link importGraphStream}, and it is guarded the same way — the source\n * stream's own backend is checked against the target before the first chunk, and\n * the target connection's exclusive stream lease is held for the whole import.\n * `trustedImportGraphStream(target, exportGraphStream(source))` over one\n * serialized connection is therefore refused with the shared typed\n * {@link ConfigurationError} (codes and `details.heldBy` / `details.requested`\n * as documented on `importGraphStream`) rather than reaching the driver as a\n * nested BEGIN.\n */\nexport async function trustedImportGraphStream<G extends GraphDef>(\n store: Store<G>,\n chunks:\n AsyncIterable<GraphInterchangeChunk> | Iterable<GraphInterchangeChunk>,\n): Promise<TrustedImportResult> {\n rejectUnsupportedStoreFeatures(store);\n const backend = storeBackend(store);\n const trustedImport = backend.trustedImport;\n if (trustedImport === undefined) {\n throw new TrustedImportError(\n `The ${backend.dialect} backend does not support trusted import.`,\n \"backend_unsupported\",\n { dialect: backend.dialect },\n );\n }\n // The same pre-flight `importGraphStream` runs, through the same owner of\n // \"would this export hold the connection that write needs\": a synchronous\n // iterable was materialized by its producer and holds nothing, so only an\n // async stream can name a source backend.\n const sourceBackend =\n Symbol.asyncIterator in chunks ? exportStreamBackend(chunks) : undefined;\n const contention =\n sourceBackend === undefined ? undefined : (\n snapshotExportContention(sourceBackend, backend)\n );\n if (contention !== undefined) {\n throw serializedStreamRefusal({\n graphId: store.graphId,\n requested: \"import-stream\",\n heldBy: \"export-snapshot\",\n detector: contention,\n });\n }\n const schemaVersion = store.introspect().schemaVersion;\n const options: TrustedImportOptions | undefined =\n schemaVersion === undefined ? undefined : (\n {\n schemaWrite: {\n graphId: store.graphId,\n expectedVersion: schemaVersion,\n },\n }\n );\n return withImportStreamLease(store, () =>\n trustedImport(\n (session) => consumeTrustedChunks(store, session, chunks),\n options,\n ),\n );\n}\n\nfunction* graphDataChunks(data: GraphData): Iterable<GraphInterchangeChunk> {\n const { nodes, edges, identity, ...header } = data;\n yield {\n type: \"header\",\n header:\n identity === undefined ? header : (\n {\n ...header,\n identity: { profile: identity.profile, mode: identity.mode },\n }\n ),\n };\n yield { type: \"nodes\", nodes };\n yield { type: \"edges\", edges };\n if (identity !== undefined) {\n yield { type: \"identity\", assertions: identity.assertions };\n }\n}\n\n/** In-memory convenience wrapper around {@link trustedImportGraphStream}. */\nexport function trustedImportGraph<G extends GraphDef>(\n store: Store<G>,\n data: GraphData,\n): Promise<TrustedImportResult> {\n return trustedImportGraphStream(store, graphDataChunks(data));\n}\n"]}
1
+ {"version":3,"sources":["../../src/interchange/trusted-import.ts"],"names":["TrustedImportError","getSearchableFields","resolveGraphVectorSlots","isCanonicalIsoDate","isInvertedValidityWindow","storeBackend","exportStreamBackend","snapshotExportContention","serializedStreamRefusal","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SAAS,OAAA,EAAS,IAAA,EAAM,SAAS,IAAA;AAAK;AAC7D,GAEN;AACA,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAM;AAC7B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAM;AAC7B,EAAA,IAAI,aAAa,MAAA,EAAW;AAC1B,IAAA,MAAM,EAAE,IAAA,EAAM,UAAA,EAAY,UAAA,EAAY,SAAS,UAAA,EAAW;AAAA,EAC5D;AACF;AAGO,SAAS,kBAAA,CACd,OACA,IAAA,EAC8B;AAC9B,EAAA,OAAO,wBAAA,CAAyB,KAAA,EAAO,eAAA,CAAgB,IAAI,CAAC,CAAA;AAC9D","file":"index.cjs","sourcesContent":["import { snapshotExportContention } from \"../backend/transaction-resource\";\nimport type {\n InsertEdgeParams,\n InsertNodeParams,\n TrustedImportOptions,\n TrustedImportSession,\n} from \"../backend/types\";\nimport type { GraphDef } from \"../core/define-graph\";\nimport { resolveGraphVectorSlots } from \"../core/embedding\";\nimport { getSearchableFields } from \"../core/searchable\";\nimport { TrustedImportError } from \"../errors\";\nimport { storeBackend } from \"../store/runtime-port\";\nimport type { Store } from \"../store/store\";\nimport { isCanonicalIsoDate, isInvertedValidityWindow } from \"../utils/date\";\nimport { serializedStreamRefusal, withImportStreamLease } from \"./import\";\nimport { exportStreamBackend } from \"./stream-source\";\nimport type {\n GraphData,\n GraphInterchangeChunk,\n InterchangeEdge,\n InterchangeNode,\n} from \"./types\";\n\n/** Counts committed by a trusted initial import. */\nexport type TrustedImportResult = Readonly<{\n nodes: number;\n edges: number;\n}>;\n\nfunction rejectUnsupportedStoreFeatures<G extends GraphDef>(\n store: Store<G>,\n): void {\n if (store.historyEnabled) {\n throw new TrustedImportError(\n \"Trusted import does not support recorded-time history capture.\",\n \"history_unsupported\",\n { graphId: store.graphId },\n );\n }\n if (store.revisionTrackingEnabled) {\n throw new TrustedImportError(\n \"Trusted import does not support revision tracking.\",\n \"revision_tracking_unsupported\",\n { graphId: store.graphId },\n );\n }\n if (store.graph.identity !== undefined) {\n throw new TrustedImportError(\n \"Trusted import does not maintain Operational Identity assertions or closure.\",\n \"identity_unsupported\",\n { graphId: store.graphId },\n );\n }\n\n const uniqueKinds = Object.values(store.graph.nodes)\n .filter((registration) => (registration.unique?.length ?? 0) > 0)\n .map((registration) => registration.type.kind);\n if (uniqueKinds.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain node uniqueness sidecars.\",\n \"uniqueness_unsupported\",\n { graphId: store.graphId, nodeKinds: uniqueKinds },\n );\n }\n\n const searchableKinds = Object.values(store.graph.nodes)\n .filter(\n (registration) =>\n getSearchableFields(registration.type.schema).length > 0,\n )\n .map((registration) => registration.type.kind);\n if (searchableKinds.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain fulltext sidecars.\",\n \"fulltext_unsupported\",\n { graphId: store.graphId, nodeKinds: searchableKinds },\n );\n }\n\n const vectorSlots = resolveGraphVectorSlots(store.graph);\n if (vectorSlots.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain vector sidecars.\",\n \"vector_unsupported\",\n {\n graphId: store.graphId,\n fields: vectorSlots.map((slot) => `${slot.nodeKind}.${slot.fieldPath}`),\n },\n );\n }\n}\n\nfunction invalidStream(message: string): TrustedImportError {\n return new TrustedImportError(message, \"invalid_stream\");\n}\n\n/** The stated validity window of a streamed node or edge. */\ntype StatedValidityWindow = Readonly<{\n validFrom?: string | null | undefined;\n validTo?: string | undefined;\n}>;\n\ntype ValidityWindowField = \"validFrom\" | \"validTo\";\n\n/** A stated window field that is not canonical, with the offending value. */\ntype NonCanonicalWindow = Readonly<{\n field: ValidityWindowField;\n value: string;\n}>;\n\n/**\n * The first window field of `entity` stating a timestamp that is not canonical\n * fixed-width UTC ISO 8601 — with the offending value — or `undefined` when\n * every stated one is canonical.\n *\n * A trusted stream is never re-parsed, so this is the only place its timestamps\n * are held to the format the rest of the system assumes. It is deliberately\n * format-ONLY — the same {@link isCanonicalIsoDate} decision the untrusted\n * path's schema and the store's own write validation make, and nothing more —\n * because a non-canonical instant is not merely ugly: every temporal filter\n * compares these values AS TEXT against an `asOf` coordinate, so a variable-width\n * one (`...:00.1Z`, an offset, date-only) mis-sorts and silently includes or\n * excludes the wrong rows once stored, and it would mis-decide the negative-width\n * check below on the way in. Two field tests per row costs about a microsecond\n * against the ~4µs an in-memory SQLite row already costs — the price of the\n * stream's ordering claims meaning anything.\n *\n * An absent field states nothing, and a `null` validFrom is a confirmed\n * open-left window (see {@link nodeParams}) — neither is a timestamp to check.\n */\nfunction nonCanonicalWindowOf(\n entity: StatedValidityWindow,\n): NonCanonicalWindow | undefined {\n const { validFrom, validTo } = entity;\n if (typeof validFrom === \"string\" && !isCanonicalIsoDate(validFrom)) {\n return { field: \"validFrom\", value: validFrom };\n }\n if (typeof validTo === \"string\" && !isCanonicalIsoDate(validTo)) {\n return { field: \"validTo\", value: validTo };\n }\n return undefined;\n}\n\n/**\n * The first entity in `entities` stating a non-canonical window timestamp, with\n * the offending field and value. Allocates only on the failing path, so a clean\n * chunk pays one predicate per stated timestamp and nothing else.\n */\nfunction findNonCanonicalWindow<Entity extends StatedValidityWindow>(\n entities: readonly Entity[],\n): (NonCanonicalWindow & Readonly<{ entity: Entity }>) | undefined {\n for (const entity of entities) {\n const nonCanonical = nonCanonicalWindowOf(entity);\n if (nonCanonical !== undefined) return { entity, ...nonCanonical };\n }\n return undefined;\n}\n\n/** The refusal message for a non-canonical window timestamp on `subject`. */\nfunction nonCanonicalWindowMessage(\n subject: string,\n field: ValidityWindowField,\n value: string,\n): string {\n return (\n `Non-canonical ${field} in trusted import: ${subject} states \"${value}\". ` +\n `Expected canonical fixed-width UTC ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ), ` +\n `which is what makes a stored timestamp sort chronologically against an asOf ` +\n `coordinate. Convert with new Date(value).toISOString().`\n );\n}\n\n/**\n * An entity whose stated window has negative width. Trusted import writes\n * straight to SQL and skips schema validation for throughput, but a row that\n * stopped being true before it started is a stream SHAPE fault rather than a\n * policy check: it is unobservable at every `asOf` coordinate, and no later\n * write repairs it. `null` validFrom is a confirmed open-left window, so there\n * is no lower bound to invert against; zero width is legal (see\n * {@link isInvertedValidityWindow}).\n *\n * Only ever reached for a chunk whose timestamps {@link findNonCanonicalWindow}\n * has already accepted, which is what makes the lexicographic compare inside a\n * chronological one.\n */\nfunction hasInvertedWindow(entity: StatedValidityWindow): boolean {\n return isInvertedValidityWindow(\n entity.validFrom ?? undefined,\n entity.validTo,\n );\n}\n\nfunction nodeParams(graphId: string, node: InterchangeNode): InsertNodeParams {\n return {\n graphId,\n kind: node.kind,\n id: node.id,\n props: node.properties,\n ...(node.validFrom === undefined ? {} : { validFrom: node.validFrom }),\n ...(node.validTo === undefined ? {} : { validTo: node.validTo }),\n };\n}\n\nfunction edgeParams(graphId: string, edge: InterchangeEdge): InsertEdgeParams {\n return {\n graphId,\n id: edge.id,\n kind: edge.kind,\n fromKind: edge.from.kind,\n fromId: edge.from.id,\n toKind: edge.to.kind,\n toId: edge.to.id,\n props: edge.properties,\n ...(edge.validFrom === undefined ? {} : { validFrom: edge.validFrom }),\n ...(edge.validTo === undefined ? {} : { validTo: edge.validTo }),\n };\n}\n\nasync function consumeTrustedChunks<G extends GraphDef>(\n store: Store<G>,\n session: TrustedImportSession,\n chunks:\n AsyncIterable<GraphInterchangeChunk> | Iterable<GraphInterchangeChunk>,\n): Promise<TrustedImportResult> {\n const nodeKinds = new Set(\n Object.values(store.graph.nodes).map(\n (registration) => registration.type.kind,\n ),\n );\n const edgeKinds = new Set(\n Object.values(store.graph.edges).map(\n (registration) => registration.type.kind,\n ),\n );\n let receivedHeader = false;\n let receivedEdges = false;\n let nodeCount = 0;\n let edgeCount = 0;\n\n for await (const chunk of chunks) {\n switch (chunk.type) {\n case \"header\": {\n if (receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream emitted more than one header.\",\n );\n }\n if (chunk.header.identity !== undefined) {\n throw invalidStream(\n \"Trusted graph interchange import does not support identity data. \" +\n \"Use importGraphStream() for an identity export.\",\n );\n }\n receivedHeader = true;\n break;\n }\n case \"nodes\": {\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream must start with a header.\",\n );\n }\n if (receivedEdges) {\n throw invalidStream(\n \"Trusted graph interchange stream cannot emit nodes after edges.\",\n );\n }\n const unknownKind = chunk.nodes.find(\n (node) => !nodeKinds.has(node.kind),\n )?.kind;\n if (unknownKind !== undefined) {\n throw invalidStream(\n `Unknown node kind in trusted import: ${unknownKind}`,\n );\n }\n const nonCanonicalNode = findNonCanonicalWindow(chunk.nodes);\n if (nonCanonicalNode !== undefined) {\n const { entity, field, value } = nonCanonicalNode;\n throw invalidStream(\n nonCanonicalWindowMessage(\n `${entity.kind} \"${entity.id}\"`,\n field,\n value,\n ),\n );\n }\n const invertedNode = chunk.nodes.find((node) =>\n hasInvertedWindow(node),\n );\n if (invertedNode !== undefined) {\n throw invalidStream(\n `Inverted validity window in trusted import: ${invertedNode.kind} \"${invertedNode.id}\" ends at ` +\n `\"${String(invertedNode.validTo)}\", before its validFrom \"${String(invertedNode.validFrom)}\".`,\n );\n }\n await session.insertNodes(\n chunk.nodes.map((node) => nodeParams(store.graphId, node)),\n );\n nodeCount += chunk.nodes.length;\n break;\n }\n case \"edges\": {\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream must start with a header.\",\n );\n }\n receivedEdges = true;\n const invalidEdge = chunk.edges.find(\n (edge) =>\n !edgeKinds.has(edge.kind) ||\n !nodeKinds.has(edge.from.kind) ||\n !nodeKinds.has(edge.to.kind),\n );\n if (invalidEdge !== undefined) {\n throw invalidStream(\n `Unknown edge or endpoint kind in trusted import: ${invalidEdge.kind}`,\n );\n }\n const nonCanonicalEdge = findNonCanonicalWindow(chunk.edges);\n if (nonCanonicalEdge !== undefined) {\n const { entity, field, value } = nonCanonicalEdge;\n throw invalidStream(\n nonCanonicalWindowMessage(\n `${entity.kind} edge \"${entity.id}\"`,\n field,\n value,\n ),\n );\n }\n const invertedEdge = chunk.edges.find((edge) =>\n hasInvertedWindow(edge),\n );\n if (invertedEdge !== undefined) {\n throw invalidStream(\n `Inverted validity window in trusted import: ${invertedEdge.kind} edge \"${invertedEdge.id}\" ends at ` +\n `\"${String(invertedEdge.validTo)}\", before its validFrom \"${String(invertedEdge.validFrom)}\".`,\n );\n }\n await session.insertEdges(\n chunk.edges.map((edge) => edgeParams(store.graphId, edge)),\n );\n edgeCount += chunk.edges.length;\n break;\n }\n case \"identity\": {\n // The trusted session writes only the node and edge relations, so it\n // has no way to persist assertions or materialize the derived closure.\n // Refuse rather than drop identity truth from an identity-enabled\n // export: `importGraph` / `importGraphStream` carry it correctly.\n throw invalidStream(\n \"Trusted graph interchange import does not support identity assertions. \" +\n \"Use importGraphStream() for an export that carries identity truth.\",\n );\n }\n }\n }\n\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream ended before emitting a header.\",\n );\n }\n return { nodes: nodeCount, edges: edgeCount };\n}\n\n/**\n * Atomically imports a header-first stream into a fresh, dedicated database.\n *\n * This is an intentionally trusted path. It checks stream ordering and kind\n * names, but it does not validate properties, references, cardinality, or\n * conflicts. The caller must guarantee those invariants. Use\n * {@link importGraphStream} for untrusted data.\n *\n * Trusted of the DATA, not of the connection: this holds ONE write transaction\n * open for the entire stream, which makes it a long-lived import holder exactly\n * like {@link importGraphStream}, and it is guarded the same way — the source\n * stream's own backend is checked against the target before the first chunk, and\n * the target connection's exclusive stream lease is held for the whole import.\n * `trustedImportGraphStream(target, exportGraphStream(source))` over one\n * serialized connection is therefore refused with the shared typed\n * {@link ConfigurationError} (codes and `details.heldBy` / `details.requested`\n * as documented on `importGraphStream`) rather than reaching the driver as a\n * nested BEGIN.\n */\nexport async function trustedImportGraphStream<G extends GraphDef>(\n store: Store<G>,\n chunks:\n AsyncIterable<GraphInterchangeChunk> | Iterable<GraphInterchangeChunk>,\n): Promise<TrustedImportResult> {\n rejectUnsupportedStoreFeatures(store);\n const backend = storeBackend(store);\n const trustedImport = backend.trustedImport;\n if (trustedImport === undefined) {\n throw new TrustedImportError(\n `The ${backend.dialect} backend does not support trusted import.`,\n \"backend_unsupported\",\n { dialect: backend.dialect },\n );\n }\n // The same pre-flight `importGraphStream` runs, through the same owner of\n // \"would this export hold the connection that write needs\": a synchronous\n // iterable was materialized by its producer and holds nothing, so only an\n // async stream can name a source backend.\n const sourceBackend =\n Symbol.asyncIterator in chunks ? exportStreamBackend(chunks) : undefined;\n const contention =\n sourceBackend === undefined ? undefined : (\n snapshotExportContention(sourceBackend, backend)\n );\n if (contention !== undefined) {\n throw serializedStreamRefusal({\n graphId: store.graphId,\n requested: \"import-stream\",\n heldBy: \"export-snapshot\",\n detector: contention,\n });\n }\n const schemaVersion = store.introspect().schemaVersion;\n const options: TrustedImportOptions | undefined =\n schemaVersion === undefined ? undefined : (\n {\n schemaWrite: {\n graphId: store.graphId,\n expectedVersion: schemaVersion,\n },\n }\n );\n return withImportStreamLease(store, () =>\n trustedImport(\n (session) => consumeTrustedChunks(store, session, chunks),\n options,\n ),\n );\n}\n\nfunction* graphDataChunks(data: GraphData): Iterable<GraphInterchangeChunk> {\n const { nodes, edges, identity, ...header } = data;\n yield {\n type: \"header\",\n header:\n identity === undefined ? header : (\n {\n ...header,\n identity: { profile: identity.profile, mode: identity.mode },\n }\n ),\n };\n yield { type: \"nodes\", nodes };\n yield { type: \"edges\", edges };\n if (identity !== undefined) {\n yield { type: \"identity\", assertions: identity.assertions };\n }\n}\n\n/** In-memory convenience wrapper around {@link trustedImportGraphStream}. */\nexport function trustedImportGraph<G extends GraphDef>(\n store: Store<G>,\n data: GraphData,\n): Promise<TrustedImportResult> {\n return trustedImportGraphStream(store, graphDataChunks(data));\n}\n"]}
@@ -1,11 +1,12 @@
1
- import { d8 as GraphDef } from '../types-BqFZTQmV.cjs';
2
- export { u as ContributionDiagnostic, v as ContributionDiagnosticState, J as ContributionRepairEntry, K as ContributionRepairResult } from '../types-BqFZTQmV.cjs';
1
+ import { dk as GraphDef } from '../types-CWg4dTjj.cjs';
2
+ export { y as ContributionDiagnostic, z as ContributionDiagnosticState, N as ContributionRepairEntry, O as ContributionRepairResult } from '../types-CWg4dTjj.cjs';
3
3
  import { z } from 'zod';
4
- import { a as Store } from '../store-JUVvtmR4.cjs';
5
- import '../temporal-5GqpYCk2.cjs';
6
- import '../searchable-DHJMh_nj.cjs';
7
- import '../manager-CYaff3n3.cjs';
8
- import '../materialize-indexes-DTtAnvfY.cjs';
4
+ import { a as Store } from '../store-DR9J7JVB.cjs';
5
+ import { I as IngestionImportTarget } from '../ingestion-import-target-DCpfM1PX.cjs';
6
+ import '../temporal-B4Ky4wzh.cjs';
7
+ import '../searchable-C8-RrL3l.cjs';
8
+ import '../manager-D348fa6W.cjs';
9
+ import '../materialize-indexes-CrSiW_lT.cjs';
9
10
 
10
11
  /**
11
12
  * Graph interchange format types.
@@ -559,8 +560,10 @@ declare function exportGraph<G extends GraphDef>(store: Store<G>, options?: Expo
559
560
  */
560
561
  declare function exportGraphStream<G extends GraphDef>(store: Store<G>, options?: ExportStreamOptionsInput): AsyncIterable<GraphInterchangeChunk>;
561
562
 
563
+ /** A normal Store or an opaque ingestion branch that interchange may stage. */
564
+ type ImportTarget<G extends GraphDef> = Store<G> | IngestionImportTarget<G>;
562
565
  /**
563
- * Import graph data into a store.
566
+ * Import graph data into a store or opaque ingestion branch.
564
567
  *
565
568
  * Nodes are imported first to satisfy edge reference validation.
566
569
  * The import runs within a transaction for atomicity when supported.
@@ -573,7 +576,18 @@ declare function exportGraphStream<G extends GraphDef>(store: Store<G>, options?
573
576
  * connection is therefore refused on the first chunk instead of nesting a write
574
577
  * transaction inside the export's open snapshot.
575
578
  *
576
- * @param store - The graph store to import into
579
+ * Also refused, with `CONSTRAINT_WRITE_FENCE_UNSUPPORTED`, when the backend
580
+ * reports `transactions: false` AND the graph owes a claim that must be written
581
+ * before the row it gates — any unique constraint of any scope, any node kind
582
+ * with a `disjointWith` partner, or any edge kind whose cardinality is not
583
+ * `many`. An import writes those reservations like every other writer and takes
584
+ * no per-graph lock, so without a transaction a failure between a reservation
585
+ * and its row would leave a key blocked with no repair path. The verdict is per
586
+ * GRAPH rather than per payload, and it is reached before the first row: a
587
+ * streamed import cannot commit part of itself and only then discover it could
588
+ * not be fenced.
589
+ *
590
+ * @param target - The graph store or ingestion branch to import into
577
591
  * @param data - Graph data in interchange format
578
592
  * @param options - Import configuration
579
593
  * @returns Import statistics and any errors
@@ -588,7 +602,7 @@ declare function exportGraphStream<G extends GraphDef>(store: Store<G>, options?
588
602
  * console.log(`Created ${result.nodes.created} nodes`);
589
603
  * ```
590
604
  */
591
- declare function importGraph<G extends GraphDef>(store: Store<G>, data: GraphData, rawOptions: ImportOptions): Promise<ImportResult>;
605
+ declare function importGraph<G extends GraphDef>(target: ImportTarget<G>, data: GraphData, rawOptions: ImportOptions): Promise<ImportResult>;
592
606
  /**
593
607
  * Imports a header-first stream of bounded interchange chunks.
594
608
  *
@@ -626,7 +640,7 @@ declare function importGraph<G extends GraphDef>(store: Store<G>, data: GraphDat
626
640
  * single-connection — see the residual gap documented in
627
641
  * `backend/transaction-resource.ts`.
628
642
  */
629
- declare function importGraphStream<G extends GraphDef>(store: Store<G>, chunks: AsyncIterable<GraphInterchangeChunk>, rawOptions: ImportOptions): Promise<ImportResult>;
643
+ declare function importGraphStream<G extends GraphDef>(target: ImportTarget<G>, chunks: AsyncIterable<GraphInterchangeChunk>, rawOptions: ImportOptions): Promise<ImportResult>;
630
644
 
631
645
  /** Counts committed by a trusted initial import. */
632
646
  type TrustedImportResult = Readonly<{
@@ -656,4 +670,4 @@ declare function trustedImportGraphStream<G extends GraphDef>(store: Store<G>, c
656
670
  /** In-memory convenience wrapper around {@link trustedImportGraphStream}. */
657
671
  declare function trustedImportGraph<G extends GraphDef>(store: Store<G>, data: GraphData): Promise<TrustedImportResult>;
658
672
 
659
- export { type ConflictStrategy, ConflictStrategySchema, type ExportOptions, type ExportOptionsInput, ExportOptionsSchema, type ExportStreamOptions, type ExportStreamOptionsInput, ExportStreamOptionsSchema, FORMAT_VERSION, type GraphData, type GraphDataHeader, GraphDataHeaderSchema, GraphDataSchema, type GraphDataSource, GraphDataSourceSchema, type GraphInterchangeChunk, GraphInterchangeChunkSchema, type IdentityInterchangeMode, IdentityInterchangeModeSchema, type ImportError, ImportErrorSchema, type ImportOptions, ImportOptionsSchema, type ImportResult, ImportResultSchema, type InterchangeEdge, InterchangeEdgeSchema, type InterchangeIdentity, type InterchangeIdentityAssertion, InterchangeIdentityAssertionSchema, InterchangeIdentitySchema, type InterchangeNode, InterchangeNodeSchema, type TrustedImportResult, type UnknownPropertyStrategy, UnknownPropertyStrategySchema, exportGraph, exportGraphStream, importGraph, importGraphStream, trustedImportGraph, trustedImportGraphStream };
673
+ export { type ConflictStrategy, ConflictStrategySchema, type ExportOptions, type ExportOptionsInput, ExportOptionsSchema, type ExportStreamOptions, type ExportStreamOptionsInput, ExportStreamOptionsSchema, FORMAT_VERSION, type GraphData, type GraphDataHeader, GraphDataHeaderSchema, GraphDataSchema, type GraphDataSource, GraphDataSourceSchema, type GraphInterchangeChunk, GraphInterchangeChunkSchema, type IdentityInterchangeMode, IdentityInterchangeModeSchema, type ImportError, ImportErrorSchema, type ImportOptions, ImportOptionsSchema, type ImportResult, ImportResultSchema, type ImportTarget, IngestionImportTarget, type InterchangeEdge, InterchangeEdgeSchema, type InterchangeIdentity, type InterchangeIdentityAssertion, InterchangeIdentityAssertionSchema, InterchangeIdentitySchema, type InterchangeNode, InterchangeNodeSchema, type TrustedImportResult, type UnknownPropertyStrategy, UnknownPropertyStrategySchema, exportGraph, exportGraphStream, importGraph, importGraphStream, trustedImportGraph, trustedImportGraphStream };
@@ -1,11 +1,12 @@
1
- import { d8 as GraphDef } from '../types-BqFZTQmV.js';
2
- export { u as ContributionDiagnostic, v as ContributionDiagnosticState, J as ContributionRepairEntry, K as ContributionRepairResult } from '../types-BqFZTQmV.js';
1
+ import { dk as GraphDef } from '../types-CWg4dTjj.js';
2
+ export { y as ContributionDiagnostic, z as ContributionDiagnosticState, N as ContributionRepairEntry, O as ContributionRepairResult } from '../types-CWg4dTjj.js';
3
3
  import { z } from 'zod';
4
- import { a as Store } from '../store-UzrGvZOo.js';
5
- import '../temporal-CbnLzTmM.js';
6
- import '../searchable-bpE1bBfc.js';
7
- import '../manager-D9eRT_ns.js';
8
- import '../materialize-indexes-DJ3ykH59.js';
4
+ import { a as Store } from '../store-CTfQ9taw.js';
5
+ import { I as IngestionImportTarget } from '../ingestion-import-target-CI8OWIkM.js';
6
+ import '../temporal-CBOrERz5.js';
7
+ import '../searchable-z4BiFfHI.js';
8
+ import '../manager-Cfg1ENj1.js';
9
+ import '../materialize-indexes-C9GG3O3C.js';
9
10
 
10
11
  /**
11
12
  * Graph interchange format types.
@@ -559,8 +560,10 @@ declare function exportGraph<G extends GraphDef>(store: Store<G>, options?: Expo
559
560
  */
560
561
  declare function exportGraphStream<G extends GraphDef>(store: Store<G>, options?: ExportStreamOptionsInput): AsyncIterable<GraphInterchangeChunk>;
561
562
 
563
+ /** A normal Store or an opaque ingestion branch that interchange may stage. */
564
+ type ImportTarget<G extends GraphDef> = Store<G> | IngestionImportTarget<G>;
562
565
  /**
563
- * Import graph data into a store.
566
+ * Import graph data into a store or opaque ingestion branch.
564
567
  *
565
568
  * Nodes are imported first to satisfy edge reference validation.
566
569
  * The import runs within a transaction for atomicity when supported.
@@ -573,7 +576,18 @@ declare function exportGraphStream<G extends GraphDef>(store: Store<G>, options?
573
576
  * connection is therefore refused on the first chunk instead of nesting a write
574
577
  * transaction inside the export's open snapshot.
575
578
  *
576
- * @param store - The graph store to import into
579
+ * Also refused, with `CONSTRAINT_WRITE_FENCE_UNSUPPORTED`, when the backend
580
+ * reports `transactions: false` AND the graph owes a claim that must be written
581
+ * before the row it gates — any unique constraint of any scope, any node kind
582
+ * with a `disjointWith` partner, or any edge kind whose cardinality is not
583
+ * `many`. An import writes those reservations like every other writer and takes
584
+ * no per-graph lock, so without a transaction a failure between a reservation
585
+ * and its row would leave a key blocked with no repair path. The verdict is per
586
+ * GRAPH rather than per payload, and it is reached before the first row: a
587
+ * streamed import cannot commit part of itself and only then discover it could
588
+ * not be fenced.
589
+ *
590
+ * @param target - The graph store or ingestion branch to import into
577
591
  * @param data - Graph data in interchange format
578
592
  * @param options - Import configuration
579
593
  * @returns Import statistics and any errors
@@ -588,7 +602,7 @@ declare function exportGraphStream<G extends GraphDef>(store: Store<G>, options?
588
602
  * console.log(`Created ${result.nodes.created} nodes`);
589
603
  * ```
590
604
  */
591
- declare function importGraph<G extends GraphDef>(store: Store<G>, data: GraphData, rawOptions: ImportOptions): Promise<ImportResult>;
605
+ declare function importGraph<G extends GraphDef>(target: ImportTarget<G>, data: GraphData, rawOptions: ImportOptions): Promise<ImportResult>;
592
606
  /**
593
607
  * Imports a header-first stream of bounded interchange chunks.
594
608
  *
@@ -626,7 +640,7 @@ declare function importGraph<G extends GraphDef>(store: Store<G>, data: GraphDat
626
640
  * single-connection — see the residual gap documented in
627
641
  * `backend/transaction-resource.ts`.
628
642
  */
629
- declare function importGraphStream<G extends GraphDef>(store: Store<G>, chunks: AsyncIterable<GraphInterchangeChunk>, rawOptions: ImportOptions): Promise<ImportResult>;
643
+ declare function importGraphStream<G extends GraphDef>(target: ImportTarget<G>, chunks: AsyncIterable<GraphInterchangeChunk>, rawOptions: ImportOptions): Promise<ImportResult>;
630
644
 
631
645
  /** Counts committed by a trusted initial import. */
632
646
  type TrustedImportResult = Readonly<{
@@ -656,4 +670,4 @@ declare function trustedImportGraphStream<G extends GraphDef>(store: Store<G>, c
656
670
  /** In-memory convenience wrapper around {@link trustedImportGraphStream}. */
657
671
  declare function trustedImportGraph<G extends GraphDef>(store: Store<G>, data: GraphData): Promise<TrustedImportResult>;
658
672
 
659
- export { type ConflictStrategy, ConflictStrategySchema, type ExportOptions, type ExportOptionsInput, ExportOptionsSchema, type ExportStreamOptions, type ExportStreamOptionsInput, ExportStreamOptionsSchema, FORMAT_VERSION, type GraphData, type GraphDataHeader, GraphDataHeaderSchema, GraphDataSchema, type GraphDataSource, GraphDataSourceSchema, type GraphInterchangeChunk, GraphInterchangeChunkSchema, type IdentityInterchangeMode, IdentityInterchangeModeSchema, type ImportError, ImportErrorSchema, type ImportOptions, ImportOptionsSchema, type ImportResult, ImportResultSchema, type InterchangeEdge, InterchangeEdgeSchema, type InterchangeIdentity, type InterchangeIdentityAssertion, InterchangeIdentityAssertionSchema, InterchangeIdentitySchema, type InterchangeNode, InterchangeNodeSchema, type TrustedImportResult, type UnknownPropertyStrategy, UnknownPropertyStrategySchema, exportGraph, exportGraphStream, importGraph, importGraphStream, trustedImportGraph, trustedImportGraphStream };
673
+ export { type ConflictStrategy, ConflictStrategySchema, type ExportOptions, type ExportOptionsInput, ExportOptionsSchema, type ExportStreamOptions, type ExportStreamOptionsInput, ExportStreamOptionsSchema, FORMAT_VERSION, type GraphData, type GraphDataHeader, GraphDataHeaderSchema, GraphDataSchema, type GraphDataSource, GraphDataSourceSchema, type GraphInterchangeChunk, GraphInterchangeChunkSchema, type IdentityInterchangeMode, IdentityInterchangeModeSchema, type ImportError, ImportErrorSchema, type ImportOptions, ImportOptionsSchema, type ImportResult, ImportResultSchema, type ImportTarget, IngestionImportTarget, type InterchangeEdge, InterchangeEdgeSchema, type InterchangeIdentity, type InterchangeIdentityAssertion, InterchangeIdentityAssertionSchema, InterchangeIdentitySchema, type InterchangeNode, InterchangeNodeSchema, type TrustedImportResult, type UnknownPropertyStrategy, UnknownPropertyStrategySchema, exportGraph, exportGraphStream, importGraph, importGraphStream, trustedImportGraph, trustedImportGraphStream };
@@ -1,24 +1,25 @@
1
- import { exportStreamBackend, serializedStreamRefusal, withImportStreamLease } from '../chunk-AX6JGVTZ.js';
2
- export { ConflictStrategySchema, ExportOptionsSchema, ExportStreamOptionsSchema, FORMAT_VERSION, GraphDataHeaderSchema, GraphDataSchema, GraphDataSourceSchema, GraphInterchangeChunkSchema, IdentityInterchangeModeSchema, ImportErrorSchema, ImportOptionsSchema, ImportResultSchema, InterchangeEdgeSchema, InterchangeIdentityAssertionSchema, InterchangeIdentitySchema, InterchangeNodeSchema, UnknownPropertyStrategySchema, exportGraph, exportGraphStream, importGraph, importGraphStream } from '../chunk-AX6JGVTZ.js';
3
- import '../chunk-KF6K7TGH.js';
4
- import { storeBackend } from '../chunk-I4GAZH5Z.js';
5
- import '../chunk-ZFMCDJGB.js';
6
- import '../chunk-S5TERQVW.js';
7
- import '../chunk-JBQQ7THH.js';
8
- import { snapshotExportContention } from '../chunk-UGHG7PGX.js';
9
- import '../chunk-NVY5CJFP.js';
10
- import '../chunk-6LN7FIVU.js';
11
- import '../chunk-HEV35TGT.js';
12
- import '../chunk-GLHXM7C4.js';
13
- import '../chunk-DZAICA5J.js';
14
- import { isInvertedValidityWindow, isCanonicalIsoDate } from '../chunk-5K2BKEBD.js';
1
+ import { exportStreamBackend, serializedStreamRefusal, withImportStreamLease } from '../chunk-2CYI5HRH.js';
2
+ export { ConflictStrategySchema, ExportOptionsSchema, ExportStreamOptionsSchema, FORMAT_VERSION, GraphDataHeaderSchema, GraphDataSchema, GraphDataSourceSchema, GraphInterchangeChunkSchema, IdentityInterchangeModeSchema, ImportErrorSchema, ImportOptionsSchema, ImportResultSchema, InterchangeEdgeSchema, InterchangeIdentityAssertionSchema, InterchangeIdentitySchema, InterchangeNodeSchema, UnknownPropertyStrategySchema, exportGraph, exportGraphStream, importGraph, importGraphStream } from '../chunk-2CYI5HRH.js';
3
+ import '../chunk-2GIV5X4P.js';
4
+ import { storeBackend } from '../chunk-VTJVMP4I.js';
5
+ import '../chunk-YA36ABIL.js';
6
+ import '../chunk-GVYVGGPJ.js';
7
+ import '../chunk-FX5ZW6PN.js';
8
+ import { snapshotExportContention } from '../chunk-IRPYOHRC.js';
9
+ import '../chunk-Y55DLLEG.js';
10
+ import '../chunk-PALYTHGM.js';
11
+ import '../chunk-DI6VC62F.js';
12
+ import '../chunk-5LKOVCPP.js';
13
+ import '../chunk-6NKSE5AU.js';
14
+ import { isInvertedValidityWindow, isCanonicalIsoDate } from '../chunk-K46SDNQD.js';
15
15
  import '../chunk-2EBMPJBO.js';
16
- import '../chunk-ZDKTPBGV.js';
17
- import '../chunk-3DMMGT6S.js';
16
+ import '../chunk-EDLKIQRI.js';
17
+ import '../chunk-46UGOVRW.js';
18
18
  import '../chunk-W6OG3HDG.js';
19
19
  import { getSearchableFields, resolveGraphVectorSlots } from '../chunk-PC2UBAUB.js';
20
- import '../chunk-XVWOYKIK.js';
21
- import { TrustedImportError } from '../chunk-ZLONH2UD.js';
20
+ import '../chunk-FZHF5UWR.js';
21
+ import '../chunk-HZUB5CON.js';
22
+ import { TrustedImportError } from '../chunk-YDEJQWOL.js';
22
23
  import '../chunk-FWJKWH6U.js';
23
24
  import '../chunk-DYATYRY4.js';
24
25
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/interchange/trusted-import.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAS,+BACP,KAAA,EACM;AACN,EAAA,IAAI,MAAM,cAAA,EAAgB;AACxB,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,gEAAA;AAAA,MACA,qBAAA;AAAA,MACA,EAAE,OAAA,EAAS,KAAA,CAAM,OAAA;AAAQ,KAC3B;AAAA,EACF;AACA,EAAA,IAAI,MAAM,uBAAA,EAAyB;AACjC,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,oDAAA;AAAA,MACA,+BAAA;AAAA,MACA,EAAE,OAAA,EAAS,KAAA,CAAM,OAAA;AAAQ,KAC3B;AAAA,EACF;AACA,EAAA,IAAI,KAAA,CAAM,KAAA,CAAM,QAAA,KAAa,MAAA,EAAW;AACtC,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,8EAAA;AAAA,MACA,sBAAA;AAAA,MACA,EAAE,OAAA,EAAS,KAAA,CAAM,OAAA;AAAQ,KAC3B;AAAA,EACF;A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AY,MAAA,GAC5B;AAAA,IACE,WAAA,EAAa;AAAA,MACX,SAAS,KAAA,CAAM,OAAA;AAAA,MACf,eAAA,EAAiB;AAAA;AACnB,GACF;AAEJ,EAAA,OAAO,qBAAA;AAAA,IAAsB,KAAA;AAAA,IAAO,MAClC,aAAA;AAAA,MACE,CAAC,OAAA,KAAY,oBAAA,CAAqB,KAAA,EAAO,SAAS,MAAM,CAAA;AAAA,MACxD;AAAA;AACF,GACF;AACF;AAEA,UAAU,gBAAgB,IAAA,EAAkD;AAC1E,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAO,QAAA,EAAU,GAAG,QAAO,GAAI,IAAA;AAC9C,EAAA,MAAM;AAAA,IACJ,IAAA,EAAM,QAAA;AAAA,IACN,MAAA,EACE,QAAA,KAAa,MAAA,GAAY,MAAA,GACvB;AAAA,MACE,GAAG,MAAA;AAAA,MACH,UAAU,EAAE,OAAA,EAAS,SAAS,OAAA,EAAS,IAAA,EAAM,SAAS,IAAA;AAAK;AAC7D,GAEN;AACA,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAM;AAC7B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAM;AAC7B,EAAA,IAAI,aAAa,MAAA,EAAW;AAC1B,IAAA,MAAM,EAAE,IAAA,EAAM,UAAA,EAAY,UAAA,EAAY,SAAS,UAAA,EAAW;AAAA,EAC5D;AACF;AAGO,SAAS,kBAAA,CACd,OACA,IAAA,EAC8B;AAC9B,EAAA,OAAO,wBAAA,CAAyB,KAAA,EAAO,eAAA,CAAgB,IAAI,CAAC,CAAA;AAC9D","file":"index.js","sourcesContent":["import { snapshotExportContention } from \"../backend/transaction-resource\";\nimport type {\n InsertEdgeParams,\n InsertNodeParams,\n TrustedImportOptions,\n TrustedImportSession,\n} from \"../backend/types\";\nimport type { GraphDef } from \"../core/define-graph\";\nimport { resolveGraphVectorSlots } from \"../core/embedding\";\nimport { getSearchableFields } from \"../core/searchable\";\nimport { TrustedImportError } from \"../errors\";\nimport { storeBackend } from \"../store/runtime-port\";\nimport type { Store } from \"../store/store\";\nimport { isCanonicalIsoDate, isInvertedValidityWindow } from \"../utils/date\";\nimport { serializedStreamRefusal, withImportStreamLease } from \"./import\";\nimport { exportStreamBackend } from \"./stream-source\";\nimport type {\n GraphData,\n GraphInterchangeChunk,\n InterchangeEdge,\n InterchangeNode,\n} from \"./types\";\n\n/** Counts committed by a trusted initial import. */\nexport type TrustedImportResult = Readonly<{\n nodes: number;\n edges: number;\n}>;\n\nfunction rejectUnsupportedStoreFeatures<G extends GraphDef>(\n store: Store<G>,\n): void {\n if (store.historyEnabled) {\n throw new TrustedImportError(\n \"Trusted import does not support recorded-time history capture.\",\n \"history_unsupported\",\n { graphId: store.graphId },\n );\n }\n if (store.revisionTrackingEnabled) {\n throw new TrustedImportError(\n \"Trusted import does not support revision tracking.\",\n \"revision_tracking_unsupported\",\n { graphId: store.graphId },\n );\n }\n if (store.graph.identity !== undefined) {\n throw new TrustedImportError(\n \"Trusted import does not maintain Operational Identity assertions or closure.\",\n \"identity_unsupported\",\n { graphId: store.graphId },\n );\n }\n\n const uniqueKinds = Object.values(store.graph.nodes)\n .filter((registration) => (registration.unique?.length ?? 0) > 0)\n .map((registration) => registration.type.kind);\n if (uniqueKinds.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain node uniqueness sidecars.\",\n \"uniqueness_unsupported\",\n { graphId: store.graphId, nodeKinds: uniqueKinds },\n );\n }\n\n const searchableKinds = Object.values(store.graph.nodes)\n .filter(\n (registration) =>\n getSearchableFields(registration.type.schema).length > 0,\n )\n .map((registration) => registration.type.kind);\n if (searchableKinds.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain fulltext sidecars.\",\n \"fulltext_unsupported\",\n { graphId: store.graphId, nodeKinds: searchableKinds },\n );\n }\n\n const vectorSlots = resolveGraphVectorSlots(store.graph);\n if (vectorSlots.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain vector sidecars.\",\n \"vector_unsupported\",\n {\n graphId: store.graphId,\n fields: vectorSlots.map((slot) => `${slot.nodeKind}.${slot.fieldPath}`),\n },\n );\n }\n}\n\nfunction invalidStream(message: string): TrustedImportError {\n return new TrustedImportError(message, \"invalid_stream\");\n}\n\n/** The stated validity window of a streamed node or edge. */\ntype StatedValidityWindow = Readonly<{\n validFrom?: string | null | undefined;\n validTo?: string | undefined;\n}>;\n\ntype ValidityWindowField = \"validFrom\" | \"validTo\";\n\n/** A stated window field that is not canonical, with the offending value. */\ntype NonCanonicalWindow = Readonly<{\n field: ValidityWindowField;\n value: string;\n}>;\n\n/**\n * The first window field of `entity` stating a timestamp that is not canonical\n * fixed-width UTC ISO 8601 — with the offending value — or `undefined` when\n * every stated one is canonical.\n *\n * A trusted stream is never re-parsed, so this is the only place its timestamps\n * are held to the format the rest of the system assumes. It is deliberately\n * format-ONLY — the same {@link isCanonicalIsoDate} decision the untrusted\n * path's schema and the store's own write validation make, and nothing more —\n * because a non-canonical instant is not merely ugly: every temporal filter\n * compares these values AS TEXT against an `asOf` coordinate, so a variable-width\n * one (`...:00.1Z`, an offset, date-only) mis-sorts and silently includes or\n * excludes the wrong rows once stored, and it would mis-decide the negative-width\n * check below on the way in. Two field tests per row costs about a microsecond\n * against the ~4µs an in-memory SQLite row already costs — the price of the\n * stream's ordering claims meaning anything.\n *\n * An absent field states nothing, and a `null` validFrom is a confirmed\n * open-left window (see {@link nodeParams}) — neither is a timestamp to check.\n */\nfunction nonCanonicalWindowOf(\n entity: StatedValidityWindow,\n): NonCanonicalWindow | undefined {\n const { validFrom, validTo } = entity;\n if (typeof validFrom === \"string\" && !isCanonicalIsoDate(validFrom)) {\n return { field: \"validFrom\", value: validFrom };\n }\n if (typeof validTo === \"string\" && !isCanonicalIsoDate(validTo)) {\n return { field: \"validTo\", value: validTo };\n }\n return undefined;\n}\n\n/**\n * The first entity in `entities` stating a non-canonical window timestamp, with\n * the offending field and value. Allocates only on the failing path, so a clean\n * chunk pays one predicate per stated timestamp and nothing else.\n */\nfunction findNonCanonicalWindow<Entity extends StatedValidityWindow>(\n entities: readonly Entity[],\n): (NonCanonicalWindow & Readonly<{ entity: Entity }>) | undefined {\n for (const entity of entities) {\n const nonCanonical = nonCanonicalWindowOf(entity);\n if (nonCanonical !== undefined) return { entity, ...nonCanonical };\n }\n return undefined;\n}\n\n/** The refusal message for a non-canonical window timestamp on `subject`. */\nfunction nonCanonicalWindowMessage(\n subject: string,\n field: ValidityWindowField,\n value: string,\n): string {\n return (\n `Non-canonical ${field} in trusted import: ${subject} states \"${value}\". ` +\n `Expected canonical fixed-width UTC ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ), ` +\n `which is what makes a stored timestamp sort chronologically against an asOf ` +\n `coordinate. Convert with new Date(value).toISOString().`\n );\n}\n\n/**\n * An entity whose stated window has negative width. Trusted import writes\n * straight to SQL and skips schema validation for throughput, but a row that\n * stopped being true before it started is a stream SHAPE fault rather than a\n * policy check: it is unobservable at every `asOf` coordinate, and no later\n * write repairs it. `null` validFrom is a confirmed open-left window, so there\n * is no lower bound to invert against; zero width is legal (see\n * {@link isInvertedValidityWindow}).\n *\n * Only ever reached for a chunk whose timestamps {@link findNonCanonicalWindow}\n * has already accepted, which is what makes the lexicographic compare inside a\n * chronological one.\n */\nfunction hasInvertedWindow(entity: StatedValidityWindow): boolean {\n return isInvertedValidityWindow(\n entity.validFrom ?? undefined,\n entity.validTo,\n );\n}\n\nfunction nodeParams(graphId: string, node: InterchangeNode): InsertNodeParams {\n return {\n graphId,\n kind: node.kind,\n id: node.id,\n props: node.properties,\n ...(node.validFrom === undefined ? {} : { validFrom: node.validFrom }),\n ...(node.validTo === undefined ? {} : { validTo: node.validTo }),\n };\n}\n\nfunction edgeParams(graphId: string, edge: InterchangeEdge): InsertEdgeParams {\n return {\n graphId,\n id: edge.id,\n kind: edge.kind,\n fromKind: edge.from.kind,\n fromId: edge.from.id,\n toKind: edge.to.kind,\n toId: edge.to.id,\n props: edge.properties,\n ...(edge.validFrom === undefined ? {} : { validFrom: edge.validFrom }),\n ...(edge.validTo === undefined ? {} : { validTo: edge.validTo }),\n };\n}\n\nasync function consumeTrustedChunks<G extends GraphDef>(\n store: Store<G>,\n session: TrustedImportSession,\n chunks:\n AsyncIterable<GraphInterchangeChunk> | Iterable<GraphInterchangeChunk>,\n): Promise<TrustedImportResult> {\n const nodeKinds = new Set(\n Object.values(store.graph.nodes).map(\n (registration) => registration.type.kind,\n ),\n );\n const edgeKinds = new Set(\n Object.values(store.graph.edges).map(\n (registration) => registration.type.kind,\n ),\n );\n let receivedHeader = false;\n let receivedEdges = false;\n let nodeCount = 0;\n let edgeCount = 0;\n\n for await (const chunk of chunks) {\n switch (chunk.type) {\n case \"header\": {\n if (receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream emitted more than one header.\",\n );\n }\n if (chunk.header.identity !== undefined) {\n throw invalidStream(\n \"Trusted graph interchange import does not support identity data. \" +\n \"Use importGraphStream() for an identity export.\",\n );\n }\n receivedHeader = true;\n break;\n }\n case \"nodes\": {\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream must start with a header.\",\n );\n }\n if (receivedEdges) {\n throw invalidStream(\n \"Trusted graph interchange stream cannot emit nodes after edges.\",\n );\n }\n const unknownKind = chunk.nodes.find(\n (node) => !nodeKinds.has(node.kind),\n )?.kind;\n if (unknownKind !== undefined) {\n throw invalidStream(\n `Unknown node kind in trusted import: ${unknownKind}`,\n );\n }\n const nonCanonicalNode = findNonCanonicalWindow(chunk.nodes);\n if (nonCanonicalNode !== undefined) {\n const { entity, field, value } = nonCanonicalNode;\n throw invalidStream(\n nonCanonicalWindowMessage(\n `${entity.kind} \"${entity.id}\"`,\n field,\n value,\n ),\n );\n }\n const invertedNode = chunk.nodes.find((node) =>\n hasInvertedWindow(node),\n );\n if (invertedNode !== undefined) {\n throw invalidStream(\n `Inverted validity window in trusted import: ${invertedNode.kind} \"${invertedNode.id}\" ends at ` +\n `\"${String(invertedNode.validTo)}\", before its validFrom \"${String(invertedNode.validFrom)}\".`,\n );\n }\n await session.insertNodes(\n chunk.nodes.map((node) => nodeParams(store.graphId, node)),\n );\n nodeCount += chunk.nodes.length;\n break;\n }\n case \"edges\": {\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream must start with a header.\",\n );\n }\n receivedEdges = true;\n const invalidEdge = chunk.edges.find(\n (edge) =>\n !edgeKinds.has(edge.kind) ||\n !nodeKinds.has(edge.from.kind) ||\n !nodeKinds.has(edge.to.kind),\n );\n if (invalidEdge !== undefined) {\n throw invalidStream(\n `Unknown edge or endpoint kind in trusted import: ${invalidEdge.kind}`,\n );\n }\n const nonCanonicalEdge = findNonCanonicalWindow(chunk.edges);\n if (nonCanonicalEdge !== undefined) {\n const { entity, field, value } = nonCanonicalEdge;\n throw invalidStream(\n nonCanonicalWindowMessage(\n `${entity.kind} edge \"${entity.id}\"`,\n field,\n value,\n ),\n );\n }\n const invertedEdge = chunk.edges.find((edge) =>\n hasInvertedWindow(edge),\n );\n if (invertedEdge !== undefined) {\n throw invalidStream(\n `Inverted validity window in trusted import: ${invertedEdge.kind} edge \"${invertedEdge.id}\" ends at ` +\n `\"${String(invertedEdge.validTo)}\", before its validFrom \"${String(invertedEdge.validFrom)}\".`,\n );\n }\n await session.insertEdges(\n chunk.edges.map((edge) => edgeParams(store.graphId, edge)),\n );\n edgeCount += chunk.edges.length;\n break;\n }\n case \"identity\": {\n // The trusted session writes only the node and edge relations, so it\n // has no way to persist assertions or materialize the derived closure.\n // Refuse rather than drop identity truth from an identity-enabled\n // export: `importGraph` / `importGraphStream` carry it correctly.\n throw invalidStream(\n \"Trusted graph interchange import does not support identity assertions. \" +\n \"Use importGraphStream() for an export that carries identity truth.\",\n );\n }\n }\n }\n\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream ended before emitting a header.\",\n );\n }\n return { nodes: nodeCount, edges: edgeCount };\n}\n\n/**\n * Atomically imports a header-first stream into a fresh, dedicated database.\n *\n * This is an intentionally trusted path. It checks stream ordering and kind\n * names, but it does not validate properties, references, cardinality, or\n * conflicts. The caller must guarantee those invariants. Use\n * {@link importGraphStream} for untrusted data.\n *\n * Trusted of the DATA, not of the connection: this holds ONE write transaction\n * open for the entire stream, which makes it a long-lived import holder exactly\n * like {@link importGraphStream}, and it is guarded the same way — the source\n * stream's own backend is checked against the target before the first chunk, and\n * the target connection's exclusive stream lease is held for the whole import.\n * `trustedImportGraphStream(target, exportGraphStream(source))` over one\n * serialized connection is therefore refused with the shared typed\n * {@link ConfigurationError} (codes and `details.heldBy` / `details.requested`\n * as documented on `importGraphStream`) rather than reaching the driver as a\n * nested BEGIN.\n */\nexport async function trustedImportGraphStream<G extends GraphDef>(\n store: Store<G>,\n chunks:\n AsyncIterable<GraphInterchangeChunk> | Iterable<GraphInterchangeChunk>,\n): Promise<TrustedImportResult> {\n rejectUnsupportedStoreFeatures(store);\n const backend = storeBackend(store);\n const trustedImport = backend.trustedImport;\n if (trustedImport === undefined) {\n throw new TrustedImportError(\n `The ${backend.dialect} backend does not support trusted import.`,\n \"backend_unsupported\",\n { dialect: backend.dialect },\n );\n }\n // The same pre-flight `importGraphStream` runs, through the same owner of\n // \"would this export hold the connection that write needs\": a synchronous\n // iterable was materialized by its producer and holds nothing, so only an\n // async stream can name a source backend.\n const sourceBackend =\n Symbol.asyncIterator in chunks ? exportStreamBackend(chunks) : undefined;\n const contention =\n sourceBackend === undefined ? undefined : (\n snapshotExportContention(sourceBackend, backend)\n );\n if (contention !== undefined) {\n throw serializedStreamRefusal({\n graphId: store.graphId,\n requested: \"import-stream\",\n heldBy: \"export-snapshot\",\n detector: contention,\n });\n }\n const schemaVersion = store.introspect().schemaVersion;\n const options: TrustedImportOptions | undefined =\n schemaVersion === undefined ? undefined : (\n {\n schemaWrite: {\n graphId: store.graphId,\n expectedVersion: schemaVersion,\n },\n }\n );\n return withImportStreamLease(store, () =>\n trustedImport(\n (session) => consumeTrustedChunks(store, session, chunks),\n options,\n ),\n );\n}\n\nfunction* graphDataChunks(data: GraphData): Iterable<GraphInterchangeChunk> {\n const { nodes, edges, identity, ...header } = data;\n yield {\n type: \"header\",\n header:\n identity === undefined ? header : (\n {\n ...header,\n identity: { profile: identity.profile, mode: identity.mode },\n }\n ),\n };\n yield { type: \"nodes\", nodes };\n yield { type: \"edges\", edges };\n if (identity !== undefined) {\n yield { type: \"identity\", assertions: identity.assertions };\n }\n}\n\n/** In-memory convenience wrapper around {@link trustedImportGraphStream}. */\nexport function trustedImportGraph<G extends GraphDef>(\n store: Store<G>,\n data: GraphData,\n): Promise<TrustedImportResult> {\n return trustedImportGraphStream(store, graphDataChunks(data));\n}\n"]}
1
+ {"version":3,"sources":["../../src/interchange/trusted-import.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAS,+BACP,KAAA,EACM;AACN,EAAA,IAAI,MAAM,cAAA,EAAgB;AACxB,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,gEAAA;AAAA,MACA,qBAAA;AAAA,MACA,EAAE,OAAA,EAAS,KAAA,CAAM,OAAA;AAAQ,KAC3B;AAAA,EACF;AACA,EAAA,IAAI,MAAM,uBAAA,EAAyB;AACjC,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,oDAAA;AAAA,MACA,+BAAA;AAAA,MACA,EAAE,OAAA,EAAS,KAAA,CAAM,OAAA;AAAQ,KAC3B;AAAA,EACF;AACA,EAAA,IAAI,KAAA,CAAM,KAAA,CAAM,QAAA,KAAa,MAAA,EAAW;AACtC,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,8EAAA;AAAA,MACA,sBAAA;AAAA,MACA,EAAE,OAAA,EAAS,KAAA,CAAM,OAAA;AAAQ,KAC3B;AAAA,EACF;AAEA,EAAA,MAAM,WAAA,GAAc,OAAO,MAAA,CAAO,KAAA,CAAM,MAAM,KAAK,CAAA,CAChD,OAAO,CAAC,YAAA,KAAA,CAAkB,aA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AEJ,EAAA,OAAO,qBAAA;AAAA,IAAsB,KAAA;AAAA,IAAO,MAClC,aAAA;AAAA,MACE,CAAC,OAAA,KAAY,oBAAA,CAAqB,KAAA,EAAO,SAAS,MAAM,CAAA;AAAA,MACxD;AAAA;AACF,GACF;AACF;AAEA,UAAU,gBAAgB,IAAA,EAAkD;AAC1E,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAO,QAAA,EAAU,GAAG,QAAO,GAAI,IAAA;AAC9C,EAAA,MAAM;AAAA,IACJ,IAAA,EAAM,QAAA;AAAA,IACN,MAAA,EACE,QAAA,KAAa,MAAA,GAAY,MAAA,GACvB;AAAA,MACE,GAAG,MAAA;AAAA,MACH,UAAU,EAAE,OAAA,EAAS,SAAS,OAAA,EAAS,IAAA,EAAM,SAAS,IAAA;AAAK;AAC7D,GAEN;AACA,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAM;AAC7B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAM;AAC7B,EAAA,IAAI,aAAa,MAAA,EAAW;AAC1B,IAAA,MAAM,EAAE,IAAA,EAAM,UAAA,EAAY,UAAA,EAAY,SAAS,UAAA,EAAW;AAAA,EAC5D;AACF;AAGO,SAAS,kBAAA,CACd,OACA,IAAA,EAC8B;AAC9B,EAAA,OAAO,wBAAA,CAAyB,KAAA,EAAO,eAAA,CAAgB,IAAI,CAAC,CAAA;AAC9D","file":"index.js","sourcesContent":["import { snapshotExportContention } from \"../backend/transaction-resource\";\nimport type {\n InsertEdgeParams,\n InsertNodeParams,\n TrustedImportOptions,\n TrustedImportSession,\n} from \"../backend/types\";\nimport type { GraphDef } from \"../core/define-graph\";\nimport { resolveGraphVectorSlots } from \"../core/embedding\";\nimport { getSearchableFields } from \"../core/searchable\";\nimport { TrustedImportError } from \"../errors\";\nimport { storeBackend } from \"../store/runtime-port\";\nimport type { Store } from \"../store/store\";\nimport { isCanonicalIsoDate, isInvertedValidityWindow } from \"../utils/date\";\nimport { serializedStreamRefusal, withImportStreamLease } from \"./import\";\nimport { exportStreamBackend } from \"./stream-source\";\nimport type {\n GraphData,\n GraphInterchangeChunk,\n InterchangeEdge,\n InterchangeNode,\n} from \"./types\";\n\n/** Counts committed by a trusted initial import. */\nexport type TrustedImportResult = Readonly<{\n nodes: number;\n edges: number;\n}>;\n\nfunction rejectUnsupportedStoreFeatures<G extends GraphDef>(\n store: Store<G>,\n): void {\n if (store.historyEnabled) {\n throw new TrustedImportError(\n \"Trusted import does not support recorded-time history capture.\",\n \"history_unsupported\",\n { graphId: store.graphId },\n );\n }\n if (store.revisionTrackingEnabled) {\n throw new TrustedImportError(\n \"Trusted import does not support revision tracking.\",\n \"revision_tracking_unsupported\",\n { graphId: store.graphId },\n );\n }\n if (store.graph.identity !== undefined) {\n throw new TrustedImportError(\n \"Trusted import does not maintain Operational Identity assertions or closure.\",\n \"identity_unsupported\",\n { graphId: store.graphId },\n );\n }\n\n const uniqueKinds = Object.values(store.graph.nodes)\n .filter((registration) => (registration.unique?.length ?? 0) > 0)\n .map((registration) => registration.type.kind);\n if (uniqueKinds.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain node uniqueness sidecars.\",\n \"uniqueness_unsupported\",\n { graphId: store.graphId, nodeKinds: uniqueKinds },\n );\n }\n\n const searchableKinds = Object.values(store.graph.nodes)\n .filter(\n (registration) =>\n getSearchableFields(registration.type.schema).length > 0,\n )\n .map((registration) => registration.type.kind);\n if (searchableKinds.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain fulltext sidecars.\",\n \"fulltext_unsupported\",\n { graphId: store.graphId, nodeKinds: searchableKinds },\n );\n }\n\n const vectorSlots = resolveGraphVectorSlots(store.graph);\n if (vectorSlots.length > 0) {\n throw new TrustedImportError(\n \"Trusted import does not maintain vector sidecars.\",\n \"vector_unsupported\",\n {\n graphId: store.graphId,\n fields: vectorSlots.map((slot) => `${slot.nodeKind}.${slot.fieldPath}`),\n },\n );\n }\n}\n\nfunction invalidStream(message: string): TrustedImportError {\n return new TrustedImportError(message, \"invalid_stream\");\n}\n\n/** The stated validity window of a streamed node or edge. */\ntype StatedValidityWindow = Readonly<{\n validFrom?: string | null | undefined;\n validTo?: string | undefined;\n}>;\n\ntype ValidityWindowField = \"validFrom\" | \"validTo\";\n\n/** A stated window field that is not canonical, with the offending value. */\ntype NonCanonicalWindow = Readonly<{\n field: ValidityWindowField;\n value: string;\n}>;\n\n/**\n * The first window field of `entity` stating a timestamp that is not canonical\n * fixed-width UTC ISO 8601 — with the offending value — or `undefined` when\n * every stated one is canonical.\n *\n * A trusted stream is never re-parsed, so this is the only place its timestamps\n * are held to the format the rest of the system assumes. It is deliberately\n * format-ONLY — the same {@link isCanonicalIsoDate} decision the untrusted\n * path's schema and the store's own write validation make, and nothing more —\n * because a non-canonical instant is not merely ugly: every temporal filter\n * compares these values AS TEXT against an `asOf` coordinate, so a variable-width\n * one (`...:00.1Z`, an offset, date-only) mis-sorts and silently includes or\n * excludes the wrong rows once stored, and it would mis-decide the negative-width\n * check below on the way in. Two field tests per row costs about a microsecond\n * against the ~4µs an in-memory SQLite row already costs — the price of the\n * stream's ordering claims meaning anything.\n *\n * An absent field states nothing, and a `null` validFrom is a confirmed\n * open-left window (see {@link nodeParams}) — neither is a timestamp to check.\n */\nfunction nonCanonicalWindowOf(\n entity: StatedValidityWindow,\n): NonCanonicalWindow | undefined {\n const { validFrom, validTo } = entity;\n if (typeof validFrom === \"string\" && !isCanonicalIsoDate(validFrom)) {\n return { field: \"validFrom\", value: validFrom };\n }\n if (typeof validTo === \"string\" && !isCanonicalIsoDate(validTo)) {\n return { field: \"validTo\", value: validTo };\n }\n return undefined;\n}\n\n/**\n * The first entity in `entities` stating a non-canonical window timestamp, with\n * the offending field and value. Allocates only on the failing path, so a clean\n * chunk pays one predicate per stated timestamp and nothing else.\n */\nfunction findNonCanonicalWindow<Entity extends StatedValidityWindow>(\n entities: readonly Entity[],\n): (NonCanonicalWindow & Readonly<{ entity: Entity }>) | undefined {\n for (const entity of entities) {\n const nonCanonical = nonCanonicalWindowOf(entity);\n if (nonCanonical !== undefined) return { entity, ...nonCanonical };\n }\n return undefined;\n}\n\n/** The refusal message for a non-canonical window timestamp on `subject`. */\nfunction nonCanonicalWindowMessage(\n subject: string,\n field: ValidityWindowField,\n value: string,\n): string {\n return (\n `Non-canonical ${field} in trusted import: ${subject} states \"${value}\". ` +\n `Expected canonical fixed-width UTC ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ), ` +\n `which is what makes a stored timestamp sort chronologically against an asOf ` +\n `coordinate. Convert with new Date(value).toISOString().`\n );\n}\n\n/**\n * An entity whose stated window has negative width. Trusted import writes\n * straight to SQL and skips schema validation for throughput, but a row that\n * stopped being true before it started is a stream SHAPE fault rather than a\n * policy check: it is unobservable at every `asOf` coordinate, and no later\n * write repairs it. `null` validFrom is a confirmed open-left window, so there\n * is no lower bound to invert against; zero width is legal (see\n * {@link isInvertedValidityWindow}).\n *\n * Only ever reached for a chunk whose timestamps {@link findNonCanonicalWindow}\n * has already accepted, which is what makes the lexicographic compare inside a\n * chronological one.\n */\nfunction hasInvertedWindow(entity: StatedValidityWindow): boolean {\n return isInvertedValidityWindow(\n entity.validFrom ?? undefined,\n entity.validTo,\n );\n}\n\nfunction nodeParams(graphId: string, node: InterchangeNode): InsertNodeParams {\n return {\n graphId,\n kind: node.kind,\n id: node.id,\n props: node.properties,\n ...(node.validFrom === undefined ? {} : { validFrom: node.validFrom }),\n ...(node.validTo === undefined ? {} : { validTo: node.validTo }),\n };\n}\n\nfunction edgeParams(graphId: string, edge: InterchangeEdge): InsertEdgeParams {\n return {\n graphId,\n id: edge.id,\n kind: edge.kind,\n fromKind: edge.from.kind,\n fromId: edge.from.id,\n toKind: edge.to.kind,\n toId: edge.to.id,\n props: edge.properties,\n ...(edge.validFrom === undefined ? {} : { validFrom: edge.validFrom }),\n ...(edge.validTo === undefined ? {} : { validTo: edge.validTo }),\n };\n}\n\nasync function consumeTrustedChunks<G extends GraphDef>(\n store: Store<G>,\n session: TrustedImportSession,\n chunks:\n AsyncIterable<GraphInterchangeChunk> | Iterable<GraphInterchangeChunk>,\n): Promise<TrustedImportResult> {\n const nodeKinds = new Set(\n Object.values(store.graph.nodes).map(\n (registration) => registration.type.kind,\n ),\n );\n const edgeKinds = new Set(\n Object.values(store.graph.edges).map(\n (registration) => registration.type.kind,\n ),\n );\n let receivedHeader = false;\n let receivedEdges = false;\n let nodeCount = 0;\n let edgeCount = 0;\n\n for await (const chunk of chunks) {\n switch (chunk.type) {\n case \"header\": {\n if (receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream emitted more than one header.\",\n );\n }\n if (chunk.header.identity !== undefined) {\n throw invalidStream(\n \"Trusted graph interchange import does not support identity data. \" +\n \"Use importGraphStream() for an identity export.\",\n );\n }\n receivedHeader = true;\n break;\n }\n case \"nodes\": {\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream must start with a header.\",\n );\n }\n if (receivedEdges) {\n throw invalidStream(\n \"Trusted graph interchange stream cannot emit nodes after edges.\",\n );\n }\n const unknownKind = chunk.nodes.find(\n (node) => !nodeKinds.has(node.kind),\n )?.kind;\n if (unknownKind !== undefined) {\n throw invalidStream(\n `Unknown node kind in trusted import: ${unknownKind}`,\n );\n }\n const nonCanonicalNode = findNonCanonicalWindow(chunk.nodes);\n if (nonCanonicalNode !== undefined) {\n const { entity, field, value } = nonCanonicalNode;\n throw invalidStream(\n nonCanonicalWindowMessage(\n `${entity.kind} \"${entity.id}\"`,\n field,\n value,\n ),\n );\n }\n const invertedNode = chunk.nodes.find((node) =>\n hasInvertedWindow(node),\n );\n if (invertedNode !== undefined) {\n throw invalidStream(\n `Inverted validity window in trusted import: ${invertedNode.kind} \"${invertedNode.id}\" ends at ` +\n `\"${String(invertedNode.validTo)}\", before its validFrom \"${String(invertedNode.validFrom)}\".`,\n );\n }\n await session.insertNodes(\n chunk.nodes.map((node) => nodeParams(store.graphId, node)),\n );\n nodeCount += chunk.nodes.length;\n break;\n }\n case \"edges\": {\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream must start with a header.\",\n );\n }\n receivedEdges = true;\n const invalidEdge = chunk.edges.find(\n (edge) =>\n !edgeKinds.has(edge.kind) ||\n !nodeKinds.has(edge.from.kind) ||\n !nodeKinds.has(edge.to.kind),\n );\n if (invalidEdge !== undefined) {\n throw invalidStream(\n `Unknown edge or endpoint kind in trusted import: ${invalidEdge.kind}`,\n );\n }\n const nonCanonicalEdge = findNonCanonicalWindow(chunk.edges);\n if (nonCanonicalEdge !== undefined) {\n const { entity, field, value } = nonCanonicalEdge;\n throw invalidStream(\n nonCanonicalWindowMessage(\n `${entity.kind} edge \"${entity.id}\"`,\n field,\n value,\n ),\n );\n }\n const invertedEdge = chunk.edges.find((edge) =>\n hasInvertedWindow(edge),\n );\n if (invertedEdge !== undefined) {\n throw invalidStream(\n `Inverted validity window in trusted import: ${invertedEdge.kind} edge \"${invertedEdge.id}\" ends at ` +\n `\"${String(invertedEdge.validTo)}\", before its validFrom \"${String(invertedEdge.validFrom)}\".`,\n );\n }\n await session.insertEdges(\n chunk.edges.map((edge) => edgeParams(store.graphId, edge)),\n );\n edgeCount += chunk.edges.length;\n break;\n }\n case \"identity\": {\n // The trusted session writes only the node and edge relations, so it\n // has no way to persist assertions or materialize the derived closure.\n // Refuse rather than drop identity truth from an identity-enabled\n // export: `importGraph` / `importGraphStream` carry it correctly.\n throw invalidStream(\n \"Trusted graph interchange import does not support identity assertions. \" +\n \"Use importGraphStream() for an export that carries identity truth.\",\n );\n }\n }\n }\n\n if (!receivedHeader) {\n throw invalidStream(\n \"Trusted graph interchange stream ended before emitting a header.\",\n );\n }\n return { nodes: nodeCount, edges: edgeCount };\n}\n\n/**\n * Atomically imports a header-first stream into a fresh, dedicated database.\n *\n * This is an intentionally trusted path. It checks stream ordering and kind\n * names, but it does not validate properties, references, cardinality, or\n * conflicts. The caller must guarantee those invariants. Use\n * {@link importGraphStream} for untrusted data.\n *\n * Trusted of the DATA, not of the connection: this holds ONE write transaction\n * open for the entire stream, which makes it a long-lived import holder exactly\n * like {@link importGraphStream}, and it is guarded the same way — the source\n * stream's own backend is checked against the target before the first chunk, and\n * the target connection's exclusive stream lease is held for the whole import.\n * `trustedImportGraphStream(target, exportGraphStream(source))` over one\n * serialized connection is therefore refused with the shared typed\n * {@link ConfigurationError} (codes and `details.heldBy` / `details.requested`\n * as documented on `importGraphStream`) rather than reaching the driver as a\n * nested BEGIN.\n */\nexport async function trustedImportGraphStream<G extends GraphDef>(\n store: Store<G>,\n chunks:\n AsyncIterable<GraphInterchangeChunk> | Iterable<GraphInterchangeChunk>,\n): Promise<TrustedImportResult> {\n rejectUnsupportedStoreFeatures(store);\n const backend = storeBackend(store);\n const trustedImport = backend.trustedImport;\n if (trustedImport === undefined) {\n throw new TrustedImportError(\n `The ${backend.dialect} backend does not support trusted import.`,\n \"backend_unsupported\",\n { dialect: backend.dialect },\n );\n }\n // The same pre-flight `importGraphStream` runs, through the same owner of\n // \"would this export hold the connection that write needs\": a synchronous\n // iterable was materialized by its producer and holds nothing, so only an\n // async stream can name a source backend.\n const sourceBackend =\n Symbol.asyncIterator in chunks ? exportStreamBackend(chunks) : undefined;\n const contention =\n sourceBackend === undefined ? undefined : (\n snapshotExportContention(sourceBackend, backend)\n );\n if (contention !== undefined) {\n throw serializedStreamRefusal({\n graphId: store.graphId,\n requested: \"import-stream\",\n heldBy: \"export-snapshot\",\n detector: contention,\n });\n }\n const schemaVersion = store.introspect().schemaVersion;\n const options: TrustedImportOptions | undefined =\n schemaVersion === undefined ? undefined : (\n {\n schemaWrite: {\n graphId: store.graphId,\n expectedVersion: schemaVersion,\n },\n }\n );\n return withImportStreamLease(store, () =>\n trustedImport(\n (session) => consumeTrustedChunks(store, session, chunks),\n options,\n ),\n );\n}\n\nfunction* graphDataChunks(data: GraphData): Iterable<GraphInterchangeChunk> {\n const { nodes, edges, identity, ...header } = data;\n yield {\n type: \"header\",\n header:\n identity === undefined ? header : (\n {\n ...header,\n identity: { profile: identity.profile, mode: identity.mode },\n }\n ),\n };\n yield { type: \"nodes\", nodes };\n yield { type: \"edges\", edges };\n if (identity !== undefined) {\n yield { type: \"identity\", assertions: identity.assertions };\n }\n}\n\n/** In-memory convenience wrapper around {@link trustedImportGraphStream}. */\nexport function trustedImportGraph<G extends GraphDef>(\n store: Store<G>,\n data: GraphData,\n): Promise<TrustedImportResult> {\n return trustedImportGraphStream(store, graphDataChunks(data));\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { dg as NodeType, dh as AnyEdgeType, aR as GraphIdentityConfig, di as SqlSchema, bR as SchemaVersionRow, aM as GraphBackend, bZ as SerializedSchema, d8 as GraphDef } from './types-BqFZTQmV.js';
2
- import { S as SchemaDiff } from './materialize-indexes-DJ3ykH59.js';
1
+ import { dt as NodeType, du as AnyEdgeType, a_ as GraphIdentityConfig, dv as SqlSchema, c1 as SchemaVersionRow, aV as GraphBackend, c9 as SerializedSchema, dk as GraphDef } from './types-CWg4dTjj.js';
2
+ import { S as SchemaDiff } from './materialize-indexes-C9GG3O3C.js';
3
3
 
4
4
  /**
5
5
  * KindRegistry holds precomputed closures for ontological reasoning.
@@ -7,6 +7,7 @@ import { S as SchemaDiff } from './materialize-indexes-DJ3ykH59.js';
7
7
  * Computed at store initialization and cached for fast query-time lookups.
8
8
  */
9
9
  declare class KindRegistry {
10
+ #private;
10
11
  readonly nodeKinds: ReadonlyMap<string, NodeType>;
11
12
  readonly edgeKinds: ReadonlyMap<string, AnyEdgeType>;
12
13
  /**
@@ -60,6 +61,11 @@ declare class KindRegistry {
60
61
  * Gets all descendants of a kind (via subClassOf).
61
62
  */
62
63
  getDescendants(kind: string): ReadonlySet<string>;
64
+ /**
65
+ * Returns the precomputed undirected `subClassOf` component containing kind,
66
+ * in code-point order. Every member of one component returns the same array.
67
+ */
68
+ getSubClassComponent(kind: string): readonly string[];
63
69
  /**
64
70
  * Checks if narrowerConcept is narrower than broaderConcept.
65
71
  */
@@ -90,10 +96,32 @@ declare class KindRegistry {
90
96
  resolveIri(iri: string): string | undefined;
91
97
  /** Gets directly associated kinds declared through symmetric `relatedTo`. */
92
98
  getRelatedKinds(kind: string): readonly string[];
99
+ /**
100
+ * THE canonical label of an unordered pair of kinds — the form
101
+ * {@link disjointPairs} stores, and the form a disjointness CLAIM AXIS is
102
+ * folded from.
103
+ *
104
+ * Exposed on the registry because the claim axis needs it: a fence keyed on
105
+ * a second spelling of this normalization would put the two kinds of one
106
+ * disjoint pair on two rows that can never collide, which is exactly the
107
+ * failure the fence exists to prevent. One expression, called by the
108
+ * membership test, by the pair computation, and by the axis.
109
+ */
110
+ disjointPairLabel(a: string, b: string): string;
93
111
  /**
94
112
  * Checks if two kinds are disjoint.
95
113
  */
96
114
  areDisjoint(a: string, b: string): boolean;
115
+ /**
116
+ * Every declared disjoint pair, once each, as the two kinds it names.
117
+ *
118
+ * The inverse of {@link disjointPairLabel} lives in this module alone, so a
119
+ * caller enumerating the pairs — the fence audit is the one that needs them —
120
+ * never has to know how a label is spelled. Iterating the kinds and folding
121
+ * {@link getDisjointKinds} would be a second, order-dependent spelling of
122
+ * exactly this set.
123
+ */
124
+ disjointKindPairs(): readonly (readonly [string, string])[];
97
125
  /**
98
126
  * Gets all kinds that are disjoint with the given kind.
99
127
  */
@@ -1,5 +1,5 @@
1
- import { dg as NodeType, dh as AnyEdgeType, aR as GraphIdentityConfig, di as SqlSchema, bR as SchemaVersionRow, aM as GraphBackend, bZ as SerializedSchema, d8 as GraphDef } from './types-BqFZTQmV.cjs';
2
- import { S as SchemaDiff } from './materialize-indexes-DTtAnvfY.cjs';
1
+ import { dt as NodeType, du as AnyEdgeType, a_ as GraphIdentityConfig, dv as SqlSchema, c1 as SchemaVersionRow, aV as GraphBackend, c9 as SerializedSchema, dk as GraphDef } from './types-CWg4dTjj.cjs';
2
+ import { S as SchemaDiff } from './materialize-indexes-CrSiW_lT.cjs';
3
3
 
4
4
  /**
5
5
  * KindRegistry holds precomputed closures for ontological reasoning.
@@ -7,6 +7,7 @@ import { S as SchemaDiff } from './materialize-indexes-DTtAnvfY.cjs';
7
7
  * Computed at store initialization and cached for fast query-time lookups.
8
8
  */
9
9
  declare class KindRegistry {
10
+ #private;
10
11
  readonly nodeKinds: ReadonlyMap<string, NodeType>;
11
12
  readonly edgeKinds: ReadonlyMap<string, AnyEdgeType>;
12
13
  /**
@@ -60,6 +61,11 @@ declare class KindRegistry {
60
61
  * Gets all descendants of a kind (via subClassOf).
61
62
  */
62
63
  getDescendants(kind: string): ReadonlySet<string>;
64
+ /**
65
+ * Returns the precomputed undirected `subClassOf` component containing kind,
66
+ * in code-point order. Every member of one component returns the same array.
67
+ */
68
+ getSubClassComponent(kind: string): readonly string[];
63
69
  /**
64
70
  * Checks if narrowerConcept is narrower than broaderConcept.
65
71
  */
@@ -90,10 +96,32 @@ declare class KindRegistry {
90
96
  resolveIri(iri: string): string | undefined;
91
97
  /** Gets directly associated kinds declared through symmetric `relatedTo`. */
92
98
  getRelatedKinds(kind: string): readonly string[];
99
+ /**
100
+ * THE canonical label of an unordered pair of kinds — the form
101
+ * {@link disjointPairs} stores, and the form a disjointness CLAIM AXIS is
102
+ * folded from.
103
+ *
104
+ * Exposed on the registry because the claim axis needs it: a fence keyed on
105
+ * a second spelling of this normalization would put the two kinds of one
106
+ * disjoint pair on two rows that can never collide, which is exactly the
107
+ * failure the fence exists to prevent. One expression, called by the
108
+ * membership test, by the pair computation, and by the axis.
109
+ */
110
+ disjointPairLabel(a: string, b: string): string;
93
111
  /**
94
112
  * Checks if two kinds are disjoint.
95
113
  */
96
114
  areDisjoint(a: string, b: string): boolean;
115
+ /**
116
+ * Every declared disjoint pair, once each, as the two kinds it names.
117
+ *
118
+ * The inverse of {@link disjointPairLabel} lives in this module alone, so a
119
+ * caller enumerating the pairs — the fence audit is the one that needs them —
120
+ * never has to know how a label is spelled. Iterating the kinds and folding
121
+ * {@link getDisjointKinds} would be a second, order-dependent spelling of
122
+ * exactly this set.
123
+ */
124
+ disjointKindPairs(): readonly (readonly [string, string])[];
97
125
  /**
98
126
  * Gets all kinds that are disjoint with the given kind.
99
127
  */
@@ -1,4 +1,4 @@
1
- import { bW as SerializedNodeDef, bU as SerializedEdgeDef, b0 as IndexEntity, I as IndexDeclaration, bZ as SerializedSchema } from './types-BqFZTQmV.js';
1
+ import { c6 as SerializedNodeDef, c4 as SerializedEdgeDef, ba as IndexEntity, I as IndexDeclaration, c9 as SerializedSchema } from './types-CWg4dTjj.js';
2
2
 
3
3
  /**
4
4
  * Schema migration utilities.
@@ -1,4 +1,4 @@
1
- import { bW as SerializedNodeDef, bU as SerializedEdgeDef, b0 as IndexEntity, I as IndexDeclaration, bZ as SerializedSchema } from './types-BqFZTQmV.cjs';
1
+ import { c6 as SerializedNodeDef, c4 as SerializedEdgeDef, ba as IndexEntity, I as IndexDeclaration, c9 as SerializedSchema } from './types-CWg4dTjj.cjs';
2
2
 
3
3
  /**
4
4
  * Schema migration utilities.