@nicia-ai/typegraph 0.44.0 → 0.46.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 (392) hide show
  1. package/dist/backend/drizzle/indexes.cjs +11 -11
  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 +7 -7
  5. package/dist/backend/index.cjs +53 -54
  6. package/dist/backend/index.d.cts +3 -3
  7. package/dist/backend/index.d.ts +3 -3
  8. package/dist/backend/index.js +13 -14
  9. package/dist/backend/postgres/index.cjs +29 -30
  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 +16 -17
  13. package/dist/backend/postgres/pglite-store.cjs +48 -43
  14. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  15. package/dist/backend/postgres/pglite-store.d.cts +15 -9
  16. package/dist/backend/postgres/pglite-store.d.ts +15 -9
  17. package/dist/backend/postgres/pglite-store.js +44 -39
  18. package/dist/backend/postgres/pglite-store.js.map +1 -1
  19. package/dist/backend/postgres/pglite.cjs +18 -19
  20. package/dist/backend/postgres/pglite.d.cts +4 -4
  21. package/dist/backend/postgres/pglite.d.ts +4 -4
  22. package/dist/backend/postgres/pglite.js +17 -18
  23. package/dist/backend/sqlite/index.cjs +26 -27
  24. package/dist/backend/sqlite/index.d.cts +6 -6
  25. package/dist/backend/sqlite/index.d.ts +6 -6
  26. package/dist/backend/sqlite/index.js +14 -15
  27. package/dist/backend/sqlite/libsql.cjs +21 -22
  28. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  29. package/dist/backend/sqlite/libsql.d.cts +15 -8
  30. package/dist/backend/sqlite/libsql.d.ts +15 -8
  31. package/dist/backend/sqlite/libsql.js +17 -18
  32. package/dist/backend/sqlite/libsql.js.map +1 -1
  33. package/dist/backend/sqlite/local-store.cjs +49 -44
  34. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  35. package/dist/backend/sqlite/local-store.d.cts +15 -10
  36. package/dist/backend/sqlite/local-store.d.ts +15 -10
  37. package/dist/backend/sqlite/local-store.js +45 -40
  38. package/dist/backend/sqlite/local-store.js.map +1 -1
  39. package/dist/backend/sqlite/local.cjs +19 -20
  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 +17 -18
  43. package/dist/{chunk-XMYJY7NI.js → chunk-2LG2XB2M.js} +3 -3
  44. package/dist/{chunk-XMYJY7NI.js.map → chunk-2LG2XB2M.js.map} +1 -1
  45. package/dist/{chunk-QGKILWGZ.cjs → chunk-2NA5DYLO.cjs} +4 -4
  46. package/dist/{chunk-QGKILWGZ.cjs.map → chunk-2NA5DYLO.cjs.map} +1 -1
  47. package/dist/{chunk-5MUSU4ZP.cjs → chunk-3DHZCOT7.cjs} +20 -20
  48. package/dist/chunk-3DHZCOT7.cjs.map +1 -0
  49. package/dist/{chunk-OVUUTCPJ.cjs → chunk-4UGOKMI5.cjs} +268 -150
  50. package/dist/chunk-4UGOKMI5.cjs.map +1 -0
  51. package/dist/{chunk-FRHHDHKH.js → chunk-5262ZMTR.js} +26 -5
  52. package/dist/chunk-5262ZMTR.js.map +1 -0
  53. package/dist/{chunk-HOIFFY4M.js → chunk-5763DULU.js} +248 -76
  54. package/dist/chunk-5763DULU.js.map +1 -0
  55. package/dist/{chunk-7G32LIQM.js → chunk-5UVRGXD3.js} +277 -7
  56. package/dist/chunk-5UVRGXD3.js.map +1 -0
  57. package/dist/{chunk-IIT5K7SK.cjs → chunk-62ZP23AW.cjs} +15 -15
  58. package/dist/{chunk-IIT5K7SK.cjs.map → chunk-62ZP23AW.cjs.map} +1 -1
  59. package/dist/{chunk-S4KQ5LV4.js → chunk-775A4ZMN.js} +40 -6
  60. package/dist/chunk-775A4ZMN.js.map +1 -0
  61. package/dist/{chunk-QYWINYEA.cjs → chunk-7BQXPCGN.cjs} +830 -170
  62. package/dist/chunk-7BQXPCGN.cjs.map +1 -0
  63. package/dist/{chunk-FJMPR3OH.cjs → chunk-7EO3TCQB.cjs} +33 -7
  64. package/dist/chunk-7EO3TCQB.cjs.map +1 -0
  65. package/dist/chunk-7GT72YHH.cjs +1979 -0
  66. package/dist/chunk-7GT72YHH.cjs.map +1 -0
  67. package/dist/{chunk-SQRD2CYF.js → chunk-7VQXLT5O.js} +717 -76
  68. package/dist/chunk-7VQXLT5O.js.map +1 -0
  69. package/dist/{chunk-BCP7LLOY.js → chunk-7Z5OR7KO.js} +2706 -625
  70. package/dist/chunk-7Z5OR7KO.js.map +1 -0
  71. package/dist/chunk-A4OC4DVN.cjs +12 -0
  72. package/dist/{chunk-4SZ6XPTG.cjs.map → chunk-A4OC4DVN.cjs.map} +1 -1
  73. package/dist/{chunk-TDXIBCGY.cjs → chunk-A7J2YDDI.cjs} +5 -3
  74. package/dist/chunk-A7J2YDDI.cjs.map +1 -0
  75. package/dist/{chunk-FMMIX6N4.js → chunk-AKLS3BYZ.js} +56 -5
  76. package/dist/chunk-AKLS3BYZ.js.map +1 -0
  77. package/dist/{chunk-D7PG5D5K.js → chunk-AMKPPFUO.js} +32 -6
  78. package/dist/chunk-AMKPPFUO.js.map +1 -0
  79. package/dist/{chunk-PAW2XUZN.js → chunk-ASTI57H3.js} +3 -3
  80. package/dist/{chunk-PAW2XUZN.js.map → chunk-ASTI57H3.js.map} +1 -1
  81. package/dist/{chunk-FMGEZBAQ.js → chunk-BKCUOV7A.js} +27 -5
  82. package/dist/chunk-BKCUOV7A.js.map +1 -0
  83. package/dist/chunk-BSFJMMV3.cjs +268 -0
  84. package/dist/chunk-BSFJMMV3.cjs.map +1 -0
  85. package/dist/{chunk-63KCKSSH.js → chunk-C23WSN5E.js} +209 -24
  86. package/dist/chunk-C23WSN5E.js.map +1 -0
  87. package/dist/{chunk-JRP3VGHS.js → chunk-CBTIUB76.js} +3 -3
  88. package/dist/{chunk-JRP3VGHS.js.map → chunk-CBTIUB76.js.map} +1 -1
  89. package/dist/chunk-CNV4TXJG.js +58 -0
  90. package/dist/chunk-CNV4TXJG.js.map +1 -0
  91. package/dist/{chunk-QB6VMOJ2.cjs → chunk-CXBHOOIQ.cjs} +45 -10
  92. package/dist/chunk-CXBHOOIQ.cjs.map +1 -0
  93. package/dist/{chunk-46GDII45.js → chunk-DCQVHAYQ.js} +5 -5
  94. package/dist/{chunk-46GDII45.js.map → chunk-DCQVHAYQ.js.map} +1 -1
  95. package/dist/chunk-DLNROMQ7.js +306 -0
  96. package/dist/chunk-DLNROMQ7.js.map +1 -0
  97. package/dist/chunk-DYATYRY4.js +47 -0
  98. package/dist/chunk-DYATYRY4.js.map +1 -0
  99. package/dist/chunk-E4WNQBEF.cjs +217 -0
  100. package/dist/chunk-E4WNQBEF.cjs.map +1 -0
  101. package/dist/{chunk-G6Q5UM7U.js → chunk-FWJKWH6U.js} +5 -3
  102. package/dist/chunk-FWJKWH6U.js.map +1 -0
  103. package/dist/{chunk-BNUFUFAU.js → chunk-HFHTMECK.js} +7 -7
  104. package/dist/chunk-HFHTMECK.js.map +1 -0
  105. package/dist/{chunk-TFMVL4QH.js → chunk-I5MOXA4H.js} +20 -14
  106. package/dist/chunk-I5MOXA4H.js.map +1 -0
  107. package/dist/{chunk-4MB3AQAQ.js → chunk-J3WZ3FA2.js} +77 -3
  108. package/dist/chunk-J3WZ3FA2.js.map +1 -0
  109. package/dist/{chunk-UR7W5YQK.js → chunk-JBQQ7THH.js} +5 -3
  110. package/dist/chunk-JBQQ7THH.js.map +1 -0
  111. package/dist/chunk-JIVMTW7W.js +3393 -0
  112. package/dist/chunk-JIVMTW7W.js.map +1 -0
  113. package/dist/{chunk-2Y4IFKW7.js → chunk-JXA2ZP2Q.js} +6 -17
  114. package/dist/chunk-JXA2ZP2Q.js.map +1 -0
  115. package/dist/{chunk-GYA4JRP5.js → chunk-JXXDZTMN.js} +2 -2
  116. package/dist/chunk-JXXDZTMN.js.map +1 -0
  117. package/dist/chunk-JZUR7ZWE.js +254 -0
  118. package/dist/chunk-JZUR7ZWE.js.map +1 -0
  119. package/dist/chunk-K5ELX2GT.js +248 -0
  120. package/dist/chunk-K5ELX2GT.js.map +1 -0
  121. package/dist/chunk-LBJKZXDE.cjs +257 -0
  122. package/dist/chunk-LBJKZXDE.cjs.map +1 -0
  123. package/dist/{chunk-FGO5JFVJ.cjs → chunk-M4BDU5RX.cjs} +12 -12
  124. package/dist/{chunk-FGO5JFVJ.cjs.map → chunk-M4BDU5RX.cjs.map} +1 -1
  125. package/dist/{chunk-MIJKEVV7.js → chunk-MSY7FSX4.js} +37 -4
  126. package/dist/chunk-MSY7FSX4.js.map +1 -0
  127. package/dist/{chunk-ST3LPB2V.cjs → chunk-MUK4BU7K.cjs} +788 -146
  128. package/dist/chunk-MUK4BU7K.cjs.map +1 -0
  129. package/dist/{chunk-MCHP7RHZ.cjs → chunk-MXJDTH5B.cjs} +64 -41
  130. package/dist/chunk-MXJDTH5B.cjs.map +1 -0
  131. package/dist/{chunk-2VLBGQBY.cjs → chunk-N3257XE6.cjs} +724 -577
  132. package/dist/chunk-N3257XE6.cjs.map +1 -0
  133. package/dist/chunk-N66HCGCY.cjs +57 -0
  134. package/dist/chunk-N66HCGCY.cjs.map +1 -0
  135. package/dist/{chunk-CPEL3YIR.cjs → chunk-NFCVHQ5P.cjs} +55 -22
  136. package/dist/chunk-NFCVHQ5P.cjs.map +1 -0
  137. package/dist/{chunk-C4F7VJ5D.cjs → chunk-NI72YOJB.cjs} +84 -2
  138. package/dist/chunk-NI72YOJB.cjs.map +1 -0
  139. package/dist/{chunk-EE7N5XXQ.cjs → chunk-NK5Q7UNE.cjs} +10 -21
  140. package/dist/chunk-NK5Q7UNE.cjs.map +1 -0
  141. package/dist/{chunk-PHXITZE4.js → chunk-NMWDXFPH.js} +4 -4
  142. package/dist/{chunk-PHXITZE4.js.map → chunk-NMWDXFPH.js.map} +1 -1
  143. package/dist/{chunk-FSXTPBRN.js → chunk-NQ6BRJBE.js} +416 -850
  144. package/dist/chunk-NQ6BRJBE.js.map +1 -0
  145. package/dist/chunk-OH5E5KIO.js +2057 -0
  146. package/dist/chunk-OH5E5KIO.js.map +1 -0
  147. package/dist/chunk-ONU3HIED.cjs +2082 -0
  148. package/dist/chunk-ONU3HIED.cjs.map +1 -0
  149. package/dist/{chunk-STQ3BSED.cjs → chunk-PNN7RHVR.cjs} +66 -44
  150. package/dist/chunk-PNN7RHVR.cjs.map +1 -0
  151. package/dist/{chunk-6DCB664D.js → chunk-PQBQG7IM.js} +3 -3
  152. package/dist/{chunk-6DCB664D.js.map → chunk-PQBQG7IM.js.map} +1 -1
  153. package/dist/{chunk-ACSVZPK7.cjs → chunk-PWLJ77UV.cjs} +5 -3
  154. package/dist/chunk-PWLJ77UV.cjs.map +1 -0
  155. package/dist/chunk-Q7Q4WSLJ.cjs +328 -0
  156. package/dist/chunk-Q7Q4WSLJ.cjs.map +1 -0
  157. package/dist/{chunk-BEFM74L2.js → chunk-QLRESYPU.js} +637 -493
  158. package/dist/chunk-QLRESYPU.js.map +1 -0
  159. package/dist/{chunk-SBPC5IP3.js → chunk-QWX5YA3K.js} +784 -202
  160. package/dist/chunk-QWX5YA3K.js.map +1 -0
  161. package/dist/{chunk-TCRIQMBU.js → chunk-RJS7DECT.js} +8 -9
  162. package/dist/chunk-RJS7DECT.js.map +1 -0
  163. package/dist/{chunk-6JZUSDY2.cjs → chunk-RMQLSPA2.cjs} +297 -27
  164. package/dist/chunk-RMQLSPA2.cjs.map +1 -0
  165. package/dist/{chunk-SJDMVITW.cjs → chunk-RT5ZY4XA.cjs} +6 -5
  166. package/dist/chunk-RT5ZY4XA.cjs.map +1 -0
  167. package/dist/{chunk-IJTLXNGJ.js → chunk-T4XNKYXB.js} +780 -127
  168. package/dist/chunk-T4XNKYXB.js.map +1 -0
  169. package/dist/{chunk-PDGEXGS6.cjs → chunk-TQR4KBY2.cjs} +354 -182
  170. package/dist/chunk-TQR4KBY2.cjs.map +1 -0
  171. package/dist/chunk-TTAITEPJ.cjs +755 -0
  172. package/dist/chunk-TTAITEPJ.cjs.map +1 -0
  173. package/dist/{chunk-NN3QSOVS.cjs → chunk-U5SON7R2.cjs} +27 -27
  174. package/dist/{chunk-NN3QSOVS.cjs.map → chunk-U5SON7R2.cjs.map} +1 -1
  175. package/dist/{chunk-A2I2XO52.cjs → chunk-U63GDNRC.cjs} +32 -26
  176. package/dist/chunk-U63GDNRC.cjs.map +1 -0
  177. package/dist/{chunk-YNULOIR5.cjs → chunk-UDISNXDL.cjs} +64 -43
  178. package/dist/chunk-UDISNXDL.cjs.map +1 -0
  179. package/dist/{chunk-GWEDD3DH.js → chunk-UV3SN74I.js} +5 -5
  180. package/dist/{chunk-GWEDD3DH.js.map → chunk-UV3SN74I.js.map} +1 -1
  181. package/dist/{chunk-U5W4LKZV.cjs → chunk-VCRRKBLN.cjs} +9 -9
  182. package/dist/{chunk-U5W4LKZV.cjs.map → chunk-VCRRKBLN.cjs.map} +1 -1
  183. package/dist/{chunk-EFELJVLA.js → chunk-VGTJPTIC.js} +28 -5
  184. package/dist/chunk-VGTJPTIC.js.map +1 -0
  185. package/dist/chunk-VQH4VAWD.cjs +12 -0
  186. package/dist/{chunk-EPTSMFH7.cjs.map → chunk-VQH4VAWD.cjs.map} +1 -1
  187. package/dist/{chunk-SNXVDZAJ.js → chunk-W6OG3HDG.js} +5 -4
  188. package/dist/chunk-W6OG3HDG.js.map +1 -0
  189. package/dist/chunk-WDGA7IYB.js +207 -0
  190. package/dist/chunk-WDGA7IYB.js.map +1 -0
  191. package/dist/chunk-WEVQJ5LH.js +736 -0
  192. package/dist/chunk-WEVQJ5LH.js.map +1 -0
  193. package/dist/{chunk-3PRKZW6D.cjs → chunk-XBYVV3MP.cjs} +60 -5
  194. package/dist/chunk-XBYVV3MP.cjs.map +1 -0
  195. package/dist/{chunk-GFRGG2US.cjs → chunk-XCAGZAKP.cjs} +7 -7
  196. package/dist/{chunk-GFRGG2US.cjs.map → chunk-XCAGZAKP.cjs.map} +1 -1
  197. package/dist/{chunk-XR4YZFKW.cjs → chunk-XDF2UPEQ.cjs} +3864 -1783
  198. package/dist/chunk-XDF2UPEQ.cjs.map +1 -0
  199. package/dist/{chunk-7V2FGGI2.cjs → chunk-XMQSEJCF.cjs} +632 -1080
  200. package/dist/chunk-XMQSEJCF.cjs.map +1 -0
  201. package/dist/chunk-XNLIZYRZ.cjs +3432 -0
  202. package/dist/chunk-XNLIZYRZ.cjs.map +1 -0
  203. package/dist/{chunk-66UVLHQA.cjs → chunk-XNSI2FJO.cjs} +99 -100
  204. package/dist/chunk-XNSI2FJO.cjs.map +1 -0
  205. package/dist/chunk-XQSCL77R.cjs +60 -0
  206. package/dist/chunk-XQSCL77R.cjs.map +1 -0
  207. package/dist/{chunk-SVJ5GEXW.cjs → chunk-XUO3KQFO.cjs} +2 -2
  208. package/dist/chunk-XUO3KQFO.cjs.map +1 -0
  209. package/dist/{chunk-HJH3RMXG.cjs → chunk-YAAM3M2S.cjs} +10 -10
  210. package/dist/{chunk-HJH3RMXG.cjs.map → chunk-YAAM3M2S.cjs.map} +1 -1
  211. package/dist/{chunk-ATLN63JA.js → chunk-YBFHZUXX.js} +6 -6
  212. package/dist/{chunk-ATLN63JA.js.map → chunk-YBFHZUXX.js.map} +1 -1
  213. package/dist/{chunk-K3BUWSFR.js → chunk-YDFDBE6D.js} +119 -6
  214. package/dist/chunk-YDFDBE6D.js.map +1 -0
  215. package/dist/{chunk-OSZPLZIV.cjs → chunk-YVWGEQJE.cjs} +318 -132
  216. package/dist/chunk-YVWGEQJE.cjs.map +1 -0
  217. package/dist/{chunk-QT6V3YRH.js → chunk-YWGVVALJ.js} +3 -3
  218. package/dist/{chunk-QT6V3YRH.js.map → chunk-YWGVVALJ.js.map} +1 -1
  219. package/dist/core/index.cjs +40 -41
  220. package/dist/core/index.d.cts +4 -5
  221. package/dist/core/index.d.ts +4 -5
  222. package/dist/core/index.js +8 -9
  223. package/dist/{ddl-eWg7hx6R.d.cts → ddl-BJcOp4WZ.d.cts} +3 -3
  224. package/dist/{ddl-D5369kOY.d.ts → ddl-BXfGHbPN.d.ts} +3 -3
  225. package/dist/graph-extension/index.cjs +26 -23
  226. package/dist/graph-extension/index.d.cts +16 -6
  227. package/dist/graph-extension/index.d.ts +16 -6
  228. package/dist/graph-extension/index.js +7 -8
  229. package/dist/graph-merge/index.cjs +2459 -655
  230. package/dist/graph-merge/index.cjs.map +1 -1
  231. package/dist/graph-merge/index.d.cts +170 -33
  232. package/dist/graph-merge/index.d.ts +170 -33
  233. package/dist/graph-merge/index.js +2269 -468
  234. package/dist/graph-merge/index.js.map +1 -1
  235. package/dist/{index-By89Sezh.d.ts → index-BSHvKfok.d.ts} +221 -10
  236. package/dist/{index-DcQ3Sxs-.d.cts → index-DxaYCv8Y.d.cts} +221 -10
  237. package/dist/index.cjs +330 -269
  238. package/dist/index.cjs.map +1 -1
  239. package/dist/index.d.cts +590 -576
  240. package/dist/index.d.ts +590 -576
  241. package/dist/index.js +73 -50
  242. package/dist/index.js.map +1 -1
  243. package/dist/indexes/index.cjs +17 -17
  244. package/dist/indexes/index.d.cts +4 -4
  245. package/dist/indexes/index.d.ts +4 -4
  246. package/dist/indexes/index.js +10 -10
  247. package/dist/interchange/index.cjs +165 -50
  248. package/dist/interchange/index.cjs.map +1 -1
  249. package/dist/interchange/index.d.cts +261 -16
  250. package/dist/interchange/index.d.ts +261 -16
  251. package/dist/interchange/index.js +128 -24
  252. package/dist/interchange/index.js.map +1 -1
  253. package/dist/{manager-B0KjKE93.d.ts → manager-CfZAimti.d.ts} +36 -5
  254. package/dist/{manager-Cn0NFIhN.d.cts → manager-HGk6E_HW.d.cts} +36 -5
  255. package/dist/{materialize-indexes-BD4V3svD.d.ts → materialize-indexes-6A7dWGtb.d.cts} +10 -2
  256. package/dist/{materialize-indexes-DVRhd5h4.d.cts → materialize-indexes-BMJP6Tms.d.ts} +10 -2
  257. package/dist/{postgres-DaEWvN4x.d.cts → postgres-DFYWENdR.d.cts} +1961 -439
  258. package/dist/{postgres-u0a0HN2D.d.ts → postgres-e7a9TdvR.d.ts} +1961 -439
  259. package/dist/profiler/index.cjs +15 -15
  260. package/dist/profiler/index.d.cts +9 -10
  261. package/dist/profiler/index.d.ts +9 -10
  262. package/dist/profiler/index.js +4 -4
  263. package/dist/provenance/index.cjs +46 -48
  264. package/dist/provenance/index.cjs.map +1 -1
  265. package/dist/provenance/index.d.cts +7 -7
  266. package/dist/provenance/index.d.ts +7 -7
  267. package/dist/provenance/index.js +12 -14
  268. package/dist/provenance/index.js.map +1 -1
  269. package/dist/schema/index.cjs +50 -49
  270. package/dist/schema/index.d.cts +9 -16
  271. package/dist/schema/index.d.ts +9 -16
  272. package/dist/schema/index.js +23 -22
  273. package/dist/{searchable-CnYEancP.d.ts → searchable-9OQoPuRs.d.ts} +1 -2
  274. package/dist/{searchable-BT7j9_IK.d.cts → searchable-CIje5XYD.d.cts} +1 -2
  275. package/dist/{sqlite-BrMoSsI7.d.cts → sqlite-DerU5tc7.d.ts} +2029 -347
  276. package/dist/{sqlite-CHhZUyO5.d.ts → sqlite-DitnISa9.d.cts} +2029 -347
  277. package/dist/{store-view-Bvdku0Ht.d.ts → store-DawaWWjJ.d.ts} +3145 -2556
  278. package/dist/{store-view-w-md0nQ4.d.cts → store-RwTJx8LX.d.cts} +3145 -2556
  279. package/dist/{temporal-BCORwUau.d.cts → temporal-Bn-Fi8FJ.d.cts} +1 -1
  280. package/dist/{temporal--x9T8K4S.d.ts → temporal-BtM4UALv.d.ts} +1 -1
  281. package/dist/{types-6-WJmSD4.d.cts → types-CoIx8HX5.d.cts} +1 -1
  282. package/dist/{types-Cjvkj0jA.d.ts → types-HkveCCx0.d.cts} +866 -21
  283. package/dist/{types-Cjvkj0jA.d.cts → types-HkveCCx0.d.ts} +866 -21
  284. package/dist/{types-COODtTJU.d.ts → types-KFfk-8Ah.d.ts} +1 -1
  285. package/dist/{where-CUQmCR6d.d.cts → where--fk7_0kv.d.cts} +1 -1
  286. package/dist/{where-5xVawAwL.d.ts → where-ws5hf-Ov.d.ts} +1 -1
  287. package/package.json +1 -1
  288. package/dist/chunk-2BIG7U6E.cjs +0 -83
  289. package/dist/chunk-2BIG7U6E.cjs.map +0 -1
  290. package/dist/chunk-2L54C2C2.js +0 -144
  291. package/dist/chunk-2L54C2C2.js.map +0 -1
  292. package/dist/chunk-2VLBGQBY.cjs.map +0 -1
  293. package/dist/chunk-2WDD2NO3.js +0 -59
  294. package/dist/chunk-2WDD2NO3.js.map +0 -1
  295. package/dist/chunk-2Y4IFKW7.js.map +0 -1
  296. package/dist/chunk-35S6P5ZU.js +0 -27
  297. package/dist/chunk-35S6P5ZU.js.map +0 -1
  298. package/dist/chunk-3PRKZW6D.cjs.map +0 -1
  299. package/dist/chunk-4MB3AQAQ.js.map +0 -1
  300. package/dist/chunk-4SZ6XPTG.cjs +0 -12
  301. package/dist/chunk-5MUSU4ZP.cjs.map +0 -1
  302. package/dist/chunk-63KCKSSH.js.map +0 -1
  303. package/dist/chunk-66UVLHQA.cjs.map +0 -1
  304. package/dist/chunk-6JZUSDY2.cjs.map +0 -1
  305. package/dist/chunk-764JHTLT.cjs +0 -15
  306. package/dist/chunk-764JHTLT.cjs.map +0 -1
  307. package/dist/chunk-7G32LIQM.js.map +0 -1
  308. package/dist/chunk-7V2FGGI2.cjs.map +0 -1
  309. package/dist/chunk-A2I2XO52.cjs.map +0 -1
  310. package/dist/chunk-A4PBRX4C.cjs +0 -100
  311. package/dist/chunk-A4PBRX4C.cjs.map +0 -1
  312. package/dist/chunk-ACSVZPK7.cjs.map +0 -1
  313. package/dist/chunk-ALFUGRYB.cjs +0 -1282
  314. package/dist/chunk-ALFUGRYB.cjs.map +0 -1
  315. package/dist/chunk-B75XRV3O.js +0 -125
  316. package/dist/chunk-B75XRV3O.js.map +0 -1
  317. package/dist/chunk-BCP7LLOY.js.map +0 -1
  318. package/dist/chunk-BEFM74L2.js.map +0 -1
  319. package/dist/chunk-BNUFUFAU.js.map +0 -1
  320. package/dist/chunk-C4F7VJ5D.cjs.map +0 -1
  321. package/dist/chunk-CPEL3YIR.cjs.map +0 -1
  322. package/dist/chunk-D7PG5D5K.js.map +0 -1
  323. package/dist/chunk-DI74SMXS.cjs +0 -29
  324. package/dist/chunk-DI74SMXS.cjs.map +0 -1
  325. package/dist/chunk-DK2S42XB.js +0 -77
  326. package/dist/chunk-DK2S42XB.js.map +0 -1
  327. package/dist/chunk-DRACN6XG.js +0 -27
  328. package/dist/chunk-DRACN6XG.js.map +0 -1
  329. package/dist/chunk-EE7N5XXQ.cjs.map +0 -1
  330. package/dist/chunk-EFELJVLA.js.map +0 -1
  331. package/dist/chunk-EPTSMFH7.cjs +0 -12
  332. package/dist/chunk-EQ7JKLZO.cjs +0 -157
  333. package/dist/chunk-EQ7JKLZO.cjs.map +0 -1
  334. package/dist/chunk-FJMPR3OH.cjs.map +0 -1
  335. package/dist/chunk-FMGEZBAQ.js.map +0 -1
  336. package/dist/chunk-FMMIX6N4.js.map +0 -1
  337. package/dist/chunk-FRHHDHKH.js.map +0 -1
  338. package/dist/chunk-FSXTPBRN.js.map +0 -1
  339. package/dist/chunk-G6Q5UM7U.js.map +0 -1
  340. package/dist/chunk-GYA4JRP5.js.map +0 -1
  341. package/dist/chunk-HOHAJ2NR.cjs +0 -61
  342. package/dist/chunk-HOHAJ2NR.cjs.map +0 -1
  343. package/dist/chunk-HOIFFY4M.js.map +0 -1
  344. package/dist/chunk-IIMQJYAM.js +0 -81
  345. package/dist/chunk-IIMQJYAM.js.map +0 -1
  346. package/dist/chunk-IJTLXNGJ.js.map +0 -1
  347. package/dist/chunk-ITE4IXAK.js +0 -25
  348. package/dist/chunk-ITE4IXAK.js.map +0 -1
  349. package/dist/chunk-K3BUWSFR.js.map +0 -1
  350. package/dist/chunk-KCO5EFJU.js +0 -79
  351. package/dist/chunk-KCO5EFJU.js.map +0 -1
  352. package/dist/chunk-KKYELPZ2.cjs +0 -83
  353. package/dist/chunk-KKYELPZ2.cjs.map +0 -1
  354. package/dist/chunk-MCHP7RHZ.cjs.map +0 -1
  355. package/dist/chunk-MIJKEVV7.js.map +0 -1
  356. package/dist/chunk-NCX65HBY.cjs +0 -1396
  357. package/dist/chunk-NCX65HBY.cjs.map +0 -1
  358. package/dist/chunk-OSZPLZIV.cjs.map +0 -1
  359. package/dist/chunk-OVUUTCPJ.cjs.map +0 -1
  360. package/dist/chunk-PDGEXGS6.cjs.map +0 -1
  361. package/dist/chunk-QB6VMOJ2.cjs.map +0 -1
  362. package/dist/chunk-QMQLUA66.js +0 -12
  363. package/dist/chunk-QMQLUA66.js.map +0 -1
  364. package/dist/chunk-QYWINYEA.cjs.map +0 -1
  365. package/dist/chunk-S4KQ5LV4.js.map +0 -1
  366. package/dist/chunk-SBPC5IP3.js.map +0 -1
  367. package/dist/chunk-SJDMVITW.cjs.map +0 -1
  368. package/dist/chunk-SNXVDZAJ.js.map +0 -1
  369. package/dist/chunk-SQRD2CYF.js.map +0 -1
  370. package/dist/chunk-ST3LPB2V.cjs.map +0 -1
  371. package/dist/chunk-STQ3BSED.cjs.map +0 -1
  372. package/dist/chunk-SVJ5GEXW.cjs.map +0 -1
  373. package/dist/chunk-TCRIQMBU.js.map +0 -1
  374. package/dist/chunk-TDXIBCGY.cjs.map +0 -1
  375. package/dist/chunk-TFMVL4QH.js.map +0 -1
  376. package/dist/chunk-TRF4EBJT.cjs +0 -30
  377. package/dist/chunk-TRF4EBJT.cjs.map +0 -1
  378. package/dist/chunk-TVLKA4AY.js +0 -94
  379. package/dist/chunk-TVLKA4AY.js.map +0 -1
  380. package/dist/chunk-UR7W5YQK.js.map +0 -1
  381. package/dist/chunk-VITTKBWF.js +0 -1263
  382. package/dist/chunk-VITTKBWF.js.map +0 -1
  383. package/dist/chunk-WBUFJ7BS.cjs +0 -131
  384. package/dist/chunk-WBUFJ7BS.cjs.map +0 -1
  385. package/dist/chunk-XR4YZFKW.cjs.map +0 -1
  386. package/dist/chunk-YNULOIR5.cjs.map +0 -1
  387. package/dist/chunk-ZDH3DX3C.cjs +0 -30
  388. package/dist/chunk-ZDH3DX3C.cjs.map +0 -1
  389. package/dist/chunk-ZTAJL4DT.cjs +0 -85
  390. package/dist/chunk-ZTAJL4DT.cjs.map +0 -1
  391. package/dist/define-graph-DVF-oN1i.d.cts +0 -173
  392. package/dist/define-graph-SvYXOl78.d.ts +0 -173
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/provenance/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,IAAM,uBAAA,GAA0B,WAAA;AAChC,IAAM,aAAA,GAAgB,IAAA;AAmJtB,SAAS,OAAO,GAAA,EAAgC;AAC9C,EAAA,OAAO,GAAG,GAAA,CAAI,IAAI,GAAG,aAAa,CAAA,EAAG,IAAI,EAAE,CAAA,CAAA;AAC7C;AAEA,SAAS,OAAO,GAAA,EAA2C;AACzD,EAAA,OAAO,MAAA,CAAO,EAAE,IAAA,EAAM,GAAA,CAAI,MAAM,EAAA,EAAI,GAAA,CAAI,IAAI,CAAA;AAC9C;AAEA,SAAS,YAAY,IAAA,EAAuB;AAC1C,EAAA,OAAO,MAAA,CAAO,EAAE,IAAA,EAAM,IAAA,CAAK,WAAW,EAAA,EAAI,IAAA,CAAK,SAAS,CAAA;AAC1D;AAEA,SAAS,UAAU,IAAA,EAAuB;AACxC,EAAA,OAAO,MAAA,CAAO,EAAE,IAAA,EAAM,IAAA,CAAK,SAAS,EAAA,EAAI,IAAA,CAAK,OAAO,CAAA;AACtD;AAEA,SAAS,SAGP,GAAA,EAAsC;AACtC,EAAA,MAAM,cAAA,GAAiB,GAAA,CAAI,OAAA,CAAQ,aAAa,CAAA;AAChD,EAAA,IAAI,mBAAmB,EAAA,EAAI;AACzB,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,kCAAA;AAAA,MACA,EAAE,GAAA,EAAI;AAAA,MACN;AAAA,QACE,UAAA,EACE;AAAA;AACJ,KACF;AA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AA,EACM;AACN,EAAA,IAAI,CAAC,MAAM,cAAA,EAAgB;AACzB,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,6EAAA;AAAA,MACA,EAAE,OAAA,EAAS,KAAA,CAAM,OAAA,EAAQ;AAAA,MACzB;AAAA,QACE,UAAA,EACE;AAAA;AACJ,KACF;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import {\n type EdgeRow,\n type GraphReadBackend,\n isLiveNodeRow,\n isTombstonedNodeRow,\n type LiveNodeRow,\n type NodeRow,\n rowPropsToObject,\n type TombstonedNodeRow,\n type TransactionBackend,\n} from \"../backend/types\";\nimport type { GraphDef } from \"../core/define-graph\";\nimport type { NodeRegistration } from \"../core/types\";\nimport { ConfigurationError, NodeNotFoundError } from \"../errors\";\nimport {\n applyNodeResurrect,\n applyNodeSoftDelete,\n createNodeWriteContext,\n} from \"../store/operations/node-write-pipeline\";\nimport { lockRecordedGraphWrite } from \"../store/recorded-capture\";\nimport { type GraphWriteLock } from \"../store/recorded-capture/clock\";\nimport {\n transactionBackend,\n transactionNodeOperationHookRunner,\n} from \"../store/runtime-port\";\nimport type { HistoryStore } from \"../store/store\";\nimport {\n type DynamicNodeCollection,\n type TransactionContext,\n} from \"../store/types\";\nimport { compareStrings } from \"../utils/compare\";\nimport { nowIso } from \"../utils/date\";\nimport { isPlainObject } from \"../utils/object\";\n\nexport type {\n ContributionDiagnostic,\n ContributionDiagnosticState,\n} from \"../backend/types\";\n\nconst DEFAULT_RETRACTED_FIELD = \"retracted\";\nconst KEY_SEPARATOR = \"\\u0000\";\n\ntype NodeKind<G extends GraphDef> = Extract<keyof G[\"nodes\"], string>;\ntype EdgeKind<G extends GraphDef> = Extract<keyof G[\"edges\"], string>;\n\nexport type ProvenanceNodeRef<\n G extends GraphDef = GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n> = Readonly<{\n kind: K;\n id: string;\n}>;\n\nexport type ProvenanceJustificationRef<\n G extends GraphDef = GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n> = ProvenanceNodeRef<G, K>;\nexport type ProvenanceFactRef<\n G extends GraphDef = GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n> = ProvenanceNodeRef<G, K>;\n\ntype ProvenanceSourceConfig<G extends GraphDef = GraphDef> =\n | Readonly<{\n kind: NodeKind<G>;\n retractedField?: string;\n }>\n | Readonly<{\n kinds: readonly NodeKind<G>[];\n retractedField?: string;\n }>;\n\nexport type ProvenanceRetractionConfig<G extends GraphDef = GraphDef> =\n Readonly<{\n source: ProvenanceSourceConfig<G>;\n justification: Readonly<{ kind: NodeKind<G> }>;\n fact: Readonly<{ kinds: readonly NodeKind<G>[] }>;\n premiseOf: Readonly<{ kind: EdgeKind<G> }>;\n derives: Readonly<{ kind: EdgeKind<G> }>;\n }>;\n\n/**\n * Extracts the node kind(s) referenced by a provenance role config, whether\n * declared as a single `{ kind }` or a `{ kinds }` array. Falls back to the\n * full `NodeKind<G>` union when neither shape is present (e.g. a role config\n * that also carries unrelated fields, matched structurally).\n */\ntype KindsFromRef<G extends GraphDef, Ref> =\n Ref extends Readonly<{ kind: infer K }> ? Extract<K, NodeKind<G>>\n : Ref extends Readonly<{ kinds: readonly (infer K)[] }> ?\n Extract<K, NodeKind<G>>\n : NodeKind<G>;\n\ntype SourceKindsFromConfig<\n G extends GraphDef,\n C extends ProvenanceRetractionConfig<G>,\n> = KindsFromRef<G, C[\"source\"]>;\n\ntype FactKindsFromConfig<\n G extends GraphDef,\n C extends ProvenanceRetractionConfig<G>,\n> = KindsFromRef<G, C[\"fact\"]>;\n\ntype JustificationKindFromConfig<\n G extends GraphDef,\n C extends ProvenanceRetractionConfig<G>,\n> = KindsFromRef<G, C[\"justification\"]>;\n\nexport type SurvivedVia<\n G extends GraphDef = GraphDef,\n FactKind extends NodeKind<G> = NodeKind<G>,\n JustificationKind extends NodeKind<G> = NodeKind<G>,\n> = Readonly<{\n fact: ProvenanceFactRef<G, FactKind>;\n via: readonly ProvenanceJustificationRef<G, JustificationKind>[];\n}>;\n\nexport type RetractionReport<\n G extends GraphDef = GraphDef,\n FactKind extends NodeKind<G> = NodeKind<G>,\n JustificationKind extends NodeKind<G> = NodeKind<G>,\n> = Readonly<{\n died: readonly ProvenanceFactRef<G, FactKind>[];\n survivedVia: readonly SurvivedVia<G, FactKind, JustificationKind>[];\n unaffected: readonly ProvenanceFactRef<G, FactKind>[];\n}>;\n\nexport type RetractionCapability<\n G extends GraphDef = GraphDef,\n SourceKind extends NodeKind<G> = NodeKind<G>,\n FactKind extends NodeKind<G> = NodeKind<G>,\n JustificationKind extends NodeKind<G> = NodeKind<G>,\n> = Readonly<{\n retract: (\n source: ProvenanceNodeRef<G, SourceKind>,\n ) => Promise<RetractionReport<G, FactKind, JustificationKind>>;\n retractMany: (\n sources: readonly ProvenanceNodeRef<G, SourceKind>[],\n ) => Promise<RetractionReport<G, FactKind, JustificationKind>>;\n unRetract: (\n source: ProvenanceNodeRef<G, SourceKind>,\n ) => Promise<RetractionReport<G, FactKind, JustificationKind>>;\n unRetractMany: (\n sources: readonly ProvenanceNodeRef<G, SourceKind>[],\n ) => Promise<RetractionReport<G, FactKind, JustificationKind>>;\n holding: () => Promise<readonly ProvenanceFactRef<G, FactKind>[]>;\n}>;\n\ntype NormalizedConfig = Readonly<{\n sourceKinds: readonly string[];\n retractedField: string;\n justificationKind: string;\n factKinds: readonly string[];\n premiseOfKind: string;\n derivesKind: string;\n}>;\n\ntype ProvenanceRows = Readonly<{\n justifications: ReadonlyMap<string, NodeRow>;\n facts: ReadonlyMap<string, NodeRow>;\n premiseEdges: readonly EdgeRow[];\n deriveEdges: readonly EdgeRow[];\n}>;\n\ntype SupportEdges = Readonly<{\n premisesByJustification: ReadonlyMap<string, readonly string[]>;\n factsByJustification: ReadonlyMap<string, readonly string[]>;\n justificationsByPremise: ReadonlyMap<string, readonly string[]>;\n}>;\n\ntype SupportSnapshot = Readonly<{\n facts: ReadonlyMap<string, NodeRow>;\n supportedFactKeys: ReadonlySet<string>;\n believedFactKeys: ReadonlySet<string>;\n firingJustificationKeysByFact: ReadonlyMap<string, readonly string[]>;\n affectedFactKeys: (\n sources: readonly ProvenanceNodeRef[],\n ) => ReadonlySet<string>;\n}>;\n\ntype SourceRetractedState = \"retracted\" | \"available\";\n\ntype SourceRow<G extends GraphDef> = Readonly<{\n source: ProvenanceNodeRef<G>;\n row: NodeRow;\n}>;\n\nfunction refKey(ref: ProvenanceNodeRef): string {\n return `${ref.kind}${KEY_SEPARATOR}${ref.id}`;\n}\n\nfunction rowKey(row: Pick<NodeRow, \"kind\" | \"id\">): string {\n return refKey({ kind: row.kind, id: row.id });\n}\n\nfunction edgeFromKey(edge: EdgeRow): string {\n return refKey({ kind: edge.from_kind, id: edge.from_id });\n}\n\nfunction edgeToKey(edge: EdgeRow): string {\n return refKey({ kind: edge.to_kind, id: edge.to_id });\n}\n\nfunction keyToRef<\n G extends GraphDef = GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n>(key: string): ProvenanceNodeRef<G, K> {\n const separatorIndex = key.indexOf(KEY_SEPARATOR);\n if (separatorIndex === -1) {\n throw new ConfigurationError(\n \"Invalid provenance identity key.\",\n { key },\n {\n suggestion:\n \"Report this TypeGraph provenance bug with the graph roles that produced the key.\",\n },\n );\n }\n const kind = key.slice(0, separatorIndex);\n const id = key.slice(separatorIndex + KEY_SEPARATOR.length);\n return { kind, id } as ProvenanceNodeRef<G, K>;\n}\n\nfunction sortedReferences<\n G extends GraphDef = GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n>(keys: Iterable<string>): ProvenanceNodeRef<G, K>[] {\n return [...keys]\n .toSorted((left, right) => compareStrings(left, right))\n .map((key) => keyToRef<G, K>(key));\n}\n\nfunction parseNodeProps(row: NodeRow): Record<string, unknown> {\n const parsed = rowPropsToObject(row.props) as unknown;\n if (!isPlainObject(parsed)) {\n throw new ConfigurationError(\n `Node ${row.kind}/${row.id} props are not an object.`,\n { kind: row.kind, id: row.id },\n );\n }\n return parsed;\n}\n\nfunction sourceRetractedState(\n row: NodeRow,\n retractedField: string,\n): SourceRetractedState {\n const props = parseNodeProps(row);\n const value = props[retractedField];\n if (value === undefined) return \"available\";\n if (typeof value !== \"boolean\") {\n throw new ConfigurationError(\n `Provenance source field \"${retractedField}\" must contain a boolean value.`,\n { kind: row.kind, id: row.id, field: retractedField },\n {\n suggestion:\n \"Use a source node schema with a boolean retracted flag, for example z.boolean().default(false).\",\n },\n );\n }\n return value ? \"retracted\" : \"available\";\n}\n\nfunction normalizeConfig<G extends GraphDef>(\n graph: G,\n config: ProvenanceRetractionConfig<G>,\n): NormalizedConfig {\n const sourceKinds = sourceKindsFromConfig(config.source);\n const justificationKind = config.justification.kind;\n const factKinds = [...config.fact.kinds];\n const premiseOfKind = config.premiseOf.kind;\n const derivesKind = config.derives.kind;\n const retractedField =\n config.source.retractedField ?? DEFAULT_RETRACTED_FIELD;\n\n if (sourceKinds.length === 0) {\n throw new ConfigurationError(\n \"Provenance retraction requires at least one source kind.\",\n { role: \"source\" },\n );\n }\n\n if (factKinds.length === 0) {\n throw new ConfigurationError(\n \"Provenance retraction requires at least one fact kind.\",\n { role: \"fact\" },\n );\n }\n\n const duplicateSourceKinds = duplicateValues(sourceKinds);\n if (duplicateSourceKinds.length > 0) {\n throw new ConfigurationError(\"Provenance source kinds must be unique.\", {\n duplicateSourceKinds,\n });\n }\n\n const duplicateFactKinds = duplicateValues(factKinds);\n if (duplicateFactKinds.length > 0) {\n throw new ConfigurationError(\"Provenance fact kinds must be unique.\", {\n duplicateFactKinds,\n });\n }\n\n for (const kind of sourceKinds) {\n assertKind(graph.nodes, kind, \"source\", \"node\", graph.id);\n }\n assertKind(graph.nodes, justificationKind, \"justification\", \"node\", graph.id);\n for (const kind of factKinds) {\n assertKind(graph.nodes, kind, \"fact\", \"node\", graph.id);\n }\n for (const kind of sourceKinds)\n assertSourceField(graph, kind, retractedField);\n assertKind(graph.edges, premiseOfKind, \"premiseOf\", \"edge\", graph.id);\n assertKind(graph.edges, derivesKind, \"derives\", \"edge\", graph.id);\n\n if (\n factKinds.some(\n (kind) => sourceKinds.includes(kind) || kind === justificationKind,\n )\n ) {\n throw new ConfigurationError(\n \"Provenance fact kinds must be distinct from source and justification kinds.\",\n { sourceKinds, justificationKind, factKinds },\n );\n }\n\n assertEdgeEndpoints(graph, premiseOfKind, {\n role: \"premiseOf\",\n fromKinds: sourceKinds,\n toKinds: [justificationKind],\n });\n assertEdgeEndpoints(graph, derivesKind, {\n role: \"derives\",\n fromKinds: [justificationKind],\n toKinds: factKinds,\n });\n\n return {\n sourceKinds,\n retractedField,\n justificationKind,\n factKinds,\n premiseOfKind,\n derivesKind,\n };\n}\n\nfunction sourceKindsFromConfig<G extends GraphDef>(\n source: ProvenanceSourceConfig<G>,\n): string[] {\n if (\"kinds\" in source) return [...source.kinds];\n return [source.kind];\n}\n\nfunction duplicateValues(values: readonly string[]): string[] {\n const seen = new Set<string>();\n const duplicates = new Set<string>();\n for (const value of values) {\n if (seen.has(value)) {\n duplicates.add(value);\n continue;\n }\n seen.add(value);\n }\n return [...duplicates].toSorted((left, right) => compareStrings(left, right));\n}\n\nfunction assertKind(\n records: Readonly<Record<string, unknown>>,\n kind: string,\n role: string,\n noun: \"node\" | \"edge\",\n graphId: string,\n): void {\n if (Object.hasOwn(records, kind)) return;\n throw new ConfigurationError(\n `Provenance ${role} kind \"${kind}\" is not a ${noun} kind in this graph.`,\n { role, kind, graphId },\n );\n}\n\nfunction assertSourceField<G extends GraphDef>(\n graph: G,\n sourceKind: string,\n retractedField: string,\n): void {\n const registration = graph.nodes[sourceKind];\n if (registration === undefined) return;\n if (Object.hasOwn(registration.type.schema.shape, retractedField)) return;\n throw new ConfigurationError(\n `Provenance source kind \"${sourceKind}\" must include field \"${retractedField}\".`,\n { sourceKind, retractedField },\n {\n suggestion:\n \"Add a boolean retracted flag to the source node schema or pass source.retractedField.\",\n },\n );\n}\n\nfunction assertEdgeEndpoints<G extends GraphDef>(\n graph: G,\n edgeKind: string,\n expected: Readonly<{\n role: string;\n fromKinds: readonly string[];\n toKinds: readonly string[];\n }>,\n): void {\n const registration = graph.edges[edgeKind];\n if (registration === undefined) return;\n const fromKinds = new Set(registration.from.map((node) => node.kind));\n const toKinds = new Set(registration.to.map((node) => node.kind));\n for (const kind of expected.fromKinds) {\n if (fromKinds.has(kind)) continue;\n throw new ConfigurationError(\n `Provenance ${expected.role} edge \"${edgeKind}\" cannot start at \"${kind}\".`,\n { edgeKind, role: expected.role, expectedFrom: kind },\n );\n }\n for (const kind of expected.toKinds) {\n if (toKinds.has(kind)) continue;\n throw new ConfigurationError(\n `Provenance ${expected.role} edge \"${edgeKind}\" cannot end at \"${kind}\".`,\n { edgeKind, role: expected.role, expectedTo: kind },\n );\n }\n}\n\n/**\n * Whether a row's validity window contains `asOf`. The JS mirror of the SQL\n * `\"current\"`-mode predicate, for role reads that must include tombstoned\n * rows (which `\"current\"` cannot express) yet still respect validity.\n * Canonical fixed-width UTC ISO strings compare correctly as text.\n */\nfunction isValidAt(\n row: Pick<NodeRow, \"valid_from\" | \"valid_to\">,\n asOf: string,\n): boolean {\n return (\n (row.valid_from === undefined || row.valid_from <= asOf) &&\n (row.valid_to === undefined || row.valid_to > asOf)\n );\n}\n\n/**\n * Provenance reads follow the store's currency semantics: a source,\n * justification, or support edge counts only while currently valid (the\n * default `\"current\"` read mode), so a validity-expired source no longer\n * supports anything and `holding()` agrees with the collection API about\n * which facts are currently believed. Fact rows additionally need their\n * tombstones — a reopen candidate is by definition soft-deleted — so they\n * are loaded with tombstones and filtered to the same validity instant.\n */\nasync function findNodeRows(\n backend: GraphReadBackend,\n graphId: string,\n kind: string,\n options: Readonly<{ includeTombstones: boolean; asOf: string }>,\n): Promise<readonly NodeRow[]> {\n if (options.includeTombstones) {\n const rows = await backend.findNodesByKind({\n graphId,\n kind,\n excludeDeleted: false,\n temporalMode: \"includeTombstones\",\n orderBy: \"id\",\n });\n return rows.filter((row) => isValidAt(row, options.asOf));\n }\n return backend.findNodesByKind({\n graphId,\n kind,\n excludeDeleted: true,\n temporalMode: \"current\",\n asOf: options.asOf,\n orderBy: \"id\",\n });\n}\n\nasync function findEdgeRows(\n backend: GraphReadBackend,\n graphId: string,\n kind: string,\n asOf: string,\n): Promise<readonly EdgeRow[]> {\n return backend.findEdgesByKind({\n graphId,\n kind,\n excludeDeleted: true,\n temporalMode: \"current\",\n asOf,\n orderBy: \"id\",\n });\n}\n\nasync function readRoles(\n backend: GraphReadBackend,\n graphId: string,\n config: NormalizedConfig,\n asOf: string,\n): Promise<ProvenanceRows> {\n const [justificationRows, factRowsByKind, premiseEdges, deriveEdges] =\n await Promise.all([\n findNodeRows(backend, graphId, config.justificationKind, {\n includeTombstones: false,\n asOf,\n }),\n Promise.all(\n config.factKinds.map((kind) =>\n findNodeRows(backend, graphId, kind, {\n includeTombstones: true,\n asOf,\n }),\n ),\n ),\n findEdgeRows(backend, graphId, config.premiseOfKind, asOf),\n findEdgeRows(backend, graphId, config.derivesKind, asOf),\n ]);\n const factRows = factRowsByKind.flat();\n\n return {\n justifications: rowsByKey(justificationRows),\n facts: rowsByKey(factRows),\n premiseEdges,\n deriveEdges,\n };\n}\n\nfunction rowsByKey(rows: readonly NodeRow[]): ReadonlyMap<string, NodeRow> {\n const byKey = new Map<string, NodeRow>();\n for (const row of rows) byKey.set(rowKey(row), row);\n return byKey;\n}\n\nfunction appendGroupedValue(\n groups: Map<string, string[]>,\n key: string,\n value: string,\n): void {\n const group = groups.get(key);\n if (group === undefined) {\n groups.set(key, [value]);\n return;\n }\n if (group.includes(value)) return;\n group.push(value);\n}\n\nfunction buildSupportEdges(\n config: NormalizedConfig,\n rows: ProvenanceRows,\n): SupportEdges {\n const premisesByJustification = new Map<string, string[]>();\n const factsByJustification = new Map<string, string[]>();\n const justificationsByPremise = new Map<string, string[]>();\n\n for (const edge of rows.premiseEdges) {\n if (edge.to_kind !== config.justificationKind) continue;\n if (!isPremiseKind(config, edge.from_kind)) continue;\n\n const premiseKey = edgeFromKey(edge);\n const justificationKey = edgeToKey(edge);\n appendGroupedValue(premisesByJustification, justificationKey, premiseKey);\n appendGroupedValue(justificationsByPremise, premiseKey, justificationKey);\n }\n\n for (const edge of rows.deriveEdges) {\n if (edge.from_kind !== config.justificationKind) continue;\n if (!config.factKinds.includes(edge.to_kind)) continue;\n appendGroupedValue(\n factsByJustification,\n edgeFromKey(edge),\n edgeToKey(edge),\n );\n }\n\n return {\n premisesByJustification,\n factsByJustification,\n justificationsByPremise,\n };\n}\n\n/**\n * The whole-graph read a support computation needs: the role rows, the support\n * edges derived from them, and the (non-retracted-visible) source rows. Loaded\n * once per transition so `before` and `after` snapshots share one read instead\n * of scanning the entire provenance graph twice — the graph structure is\n * identical across a transition, only source availability changes.\n */\ntype SupportGraph = Readonly<{\n roles: ProvenanceRows;\n supportEdges: SupportEdges;\n sourceRows: readonly NodeRow[];\n}>;\n\nasync function loadSupportGraph(\n backend: GraphReadBackend,\n graphId: string,\n config: NormalizedConfig,\n): Promise<SupportGraph> {\n // One read instant for every role read, so the whole snapshot shares a\n // single \"currently valid\" coordinate.\n const asOf = nowIso();\n const roles = await readRoles(backend, graphId, config, asOf);\n const supportEdges = buildSupportEdges(config, roles);\n const sourceRowsByKind = await Promise.all(\n config.sourceKinds.map((kind) =>\n findNodeRows(backend, graphId, kind, { includeTombstones: false, asOf }),\n ),\n );\n return { roles, supportEdges, sourceRows: sourceRowsByKind.flat() };\n}\n\nfunction availableSourceKeys(\n sourceRows: readonly NodeRow[],\n retractedField: string,\n): Set<string> {\n const available = new Set<string>();\n for (const row of sourceRows) {\n if (sourceRetractedState(row, retractedField) === \"available\") {\n available.add(rowKey(row));\n }\n }\n return available;\n}\n\n/**\n * The pure TMS fixpoint: given the loaded graph and the set of available\n * (non-retracted) source keys, derive which facts are supported and believed.\n * No I/O — the same {@link SupportGraph} feeds both the pre- and post-transition\n * snapshots with different availability sets.\n */\nfunction computeSupportSnapshot(\n graph: Pick<SupportGraph, \"roles\" | \"supportEdges\">,\n available: ReadonlySet<string>,\n): SupportSnapshot {\n const { roles, supportEdges } = graph;\n const supported = new Set<string>();\n const inSet = new Set<string>(available);\n const firingJustifications = new Set<string>();\n const firingJustificationKeysByFact = new Map<string, string[]>();\n\n let changed = true;\n while (changed) {\n changed = false;\n for (const [justificationKey] of roles.justifications) {\n if (firingJustifications.has(justificationKey)) continue;\n const premises =\n supportEdges.premisesByJustification.get(justificationKey) ?? [];\n if (!allPremisesSupported(premises, inSet)) continue;\n\n firingJustifications.add(justificationKey);\n const derivedFacts =\n supportEdges.factsByJustification.get(justificationKey) ?? [];\n for (const factKey of derivedFacts) {\n if (!roles.facts.has(factKey)) continue;\n appendGroupedValue(\n firingJustificationKeysByFact,\n factKey,\n justificationKey,\n );\n if (supported.has(factKey)) continue;\n supported.add(factKey);\n inSet.add(factKey);\n changed = true;\n }\n }\n }\n\n const believed = new Set<string>();\n for (const key of supported) {\n const row = roles.facts.get(key);\n if (row !== undefined && row.deleted_at === undefined) believed.add(key);\n }\n\n return {\n facts: roles.facts,\n supportedFactKeys: supported,\n believedFactKeys: believed,\n firingJustificationKeysByFact,\n affectedFactKeys(\n targets: readonly ProvenanceNodeRef[],\n ): ReadonlySet<string> {\n return computeAffectedFactKeys(targets, roles, supportEdges);\n },\n };\n}\n\nasync function computeSupport(\n backend: GraphReadBackend,\n graphId: string,\n config: NormalizedConfig,\n): Promise<SupportSnapshot> {\n const graph = await loadSupportGraph(backend, graphId, config);\n return computeSupportSnapshot(\n graph,\n availableSourceKeys(graph.sourceRows, config.retractedField),\n );\n}\n\nfunction isPremiseKind(config: NormalizedConfig, kind: string): boolean {\n return config.sourceKinds.includes(kind) || config.factKinds.includes(kind);\n}\n\nfunction allPremisesSupported(\n premises: readonly string[],\n supported: ReadonlySet<string>,\n): boolean {\n for (const premise of premises) {\n if (!supported.has(premise)) return false;\n }\n return true;\n}\n\nfunction computeAffectedFactKeys(\n sources: readonly ProvenanceNodeRef[],\n roles: ProvenanceRows,\n supportEdges: SupportEdges,\n): ReadonlySet<string> {\n const affected = new Set<string>();\n // Seed the BFS with every source at once: the union of facts reachable from\n // any source falls out of one traversal, instead of one BFS per source.\n const frontier = sources.map((source) => refKey(source));\n const seen = new Set<string>(frontier);\n\n while (frontier.length > 0) {\n const current = frontier.shift();\n if (current === undefined) continue;\n\n const justifications =\n supportEdges.justificationsByPremise.get(current) ?? [];\n for (const justificationKey of justifications) {\n const derivedFacts =\n supportEdges.factsByJustification.get(justificationKey) ?? [];\n for (const factKey of derivedFacts) {\n if (!roles.facts.has(factKey)) continue;\n affected.add(factKey);\n if (seen.has(factKey)) continue;\n seen.add(factKey);\n frontier.push(factKey);\n }\n }\n }\n\n return affected;\n}\n\nfunction buildReport<\n G extends GraphDef,\n FactKind extends NodeKind<G>,\n JustificationKind extends NodeKind<G>,\n>(\n before: SupportSnapshot,\n after: SupportSnapshot,\n affected: ReadonlySet<string>,\n): RetractionReport<G, FactKind, JustificationKind> {\n const believedBefore = [...before.believedFactKeys];\n const died = sortedReferences<G, FactKind>(\n believedBefore.filter((key) => !after.supportedFactKeys.has(key)),\n );\n const unaffected = sortedReferences<G, FactKind>(\n believedBefore.filter((key) => !affected.has(key)),\n );\n const survivedVia = [...affected]\n .filter((key) => after.supportedFactKeys.has(key))\n .toSorted((left, right) => compareStrings(left, right))\n .map((key) => ({\n fact: keyToRef<G, FactKind>(key),\n via: sortedReferences<G, JustificationKind>(\n after.firingJustificationKeysByFact.get(key) ?? [],\n ),\n }));\n return { died, survivedVia, unaffected };\n}\n\n/**\n * Brings fact currency in line with the post-transition support snapshot —\n * but only for the facts the transition could have affected (those reachable\n * from the flipped sources through justification edges). Facts outside that\n * set are never touched: an unsupported live fact elsewhere in the graph\n * (e.g. one whose justification edges have not been linked yet) is not this\n * transition's business, and silently tombstoning it would be invisible data\n * loss the report cannot even mention.\n *\n * Closes run before reopens: a reopen re-checks uniqueness, and the unique\n * key it needs may still be held by a fact this same transition is about to\n * close — closing first makes a legal transition order-independent.\n */\n/**\n * Runs `action` over every fact row in `snapshot` that is both affected by the\n * transition and matches `isTargetKey`/`isTargetRow`, concurrently — the\n * matched rows are independent facts, so there is no ordering dependency\n * within a single pass (only between the close pass and the reopen pass,\n * which the caller sequences).\n */\nasync function forEachAffectedFact<T extends NodeRow>(\n snapshot: SupportSnapshot,\n affected: ReadonlySet<string>,\n isTargetKey: (key: string) => boolean,\n isTargetRow: (row: NodeRow) => row is T,\n action: (row: T) => Promise<void>,\n): Promise<void> {\n const rows: T[] = [];\n for (const [key, row] of snapshot.facts) {\n if (!affected.has(key)) continue;\n if (!isTargetKey(key)) continue;\n if (!isTargetRow(row)) continue;\n rows.push(row);\n }\n await Promise.all(rows.map((row) => action(row)));\n}\n\n/**\n * The transaction-scoped hook lifecycle fact close/reopen runs through —\n * transaction runtime's operation-hook runner. Using the\n * transaction's runner (not the store's) defers each fact's success hook\n * until the transition's COMMIT, so hooks never report a closed or reopened\n * fact that a failed commit then rolls back.\n */\ntype RunNodeOperationHooks = <T>(\n operation: \"create\" | \"update\" | \"delete\",\n kind: string,\n id: string,\n fn: () => Promise<T>,\n) => Promise<T>;\n\nasync function synchronizeFactCurrency<G extends GraphDef>(\n backend: TransactionBackend,\n store: HistoryStore<G>,\n runHooks: RunNodeOperationHooks,\n snapshot: SupportSnapshot,\n affected: ReadonlySet<string>,\n lock: GraphWriteLock,\n): Promise<void> {\n await forEachAffectedFact(\n snapshot,\n affected,\n (key) => !snapshot.supportedFactKeys.has(key),\n isLiveNodeRow,\n (row) => closeFactCurrency(backend, store, runHooks, row, lock),\n );\n await forEachAffectedFact(\n snapshot,\n affected,\n (key) => snapshot.supportedFactKeys.has(key),\n isTombstonedNodeRow,\n (row) => reopenFactCurrency(backend, store, runHooks, row, lock),\n );\n}\n\nfunction getFactRegistration<G extends GraphDef>(\n store: HistoryStore<G>,\n row: NodeRow,\n): NodeRegistration {\n const registration = store.graph.nodes[row.kind];\n if (registration !== undefined) return registration;\n throw new ConfigurationError(\n `Provenance fact kind \"${row.kind}\" is not a node kind in this graph.`,\n { kind: row.kind, graphId: store.graphId },\n );\n}\n\nasync function closeFactCurrency<G extends GraphDef>(\n backend: TransactionBackend,\n store: HistoryStore<G>,\n runHooks: RunNodeOperationHooks,\n row: LiveNodeRow,\n lock: GraphWriteLock,\n): Promise<void> {\n await runHooks(\"delete\", row.kind, row.id, async () => {\n const registration = getFactRegistration(store, row);\n // The canonical soft-delete steps (tombstone, uniqueness/embedding/\n // fulltext cleanup) WITHOUT delete-behavior enforcement: closing a\n // fact's currency is a belief-status change, not a domain delete, so\n // its connected edges neither block the close (`restrict`) nor get\n // removed (`cascade` / `disconnect`). Every edge survives untouched,\n // making a later reopen an exact inverse of this close.\n await applyNodeSoftDelete(\n createNodeWriteContext(store.graphId, store.registry, lock),\n {\n existing: row,\n schema: registration.type.schema,\n uniqueConstraints: registration.unique ?? [],\n onDelete: registration.onDelete,\n },\n backend,\n { enforceDeleteBehavior: false },\n );\n });\n}\n\nasync function reopenFactCurrency<G extends GraphDef>(\n backend: TransactionBackend,\n store: HistoryStore<G>,\n runHooks: RunNodeOperationHooks,\n row: TombstonedNodeRow,\n lock: GraphWriteLock,\n): Promise<void> {\n await runHooks(\"update\", row.kind, row.id, async () => {\n const registration = getFactRegistration(store, row);\n // The delete removed this fact's uniqueness entries, so reopen re-checks and\n // re-inserts them (rather than the diff-based update path) before clearing\n // the tombstone and re-syncing embeddings/fulltext.\n await applyNodeResurrect(\n createNodeWriteContext(store.graphId, store.registry, lock),\n {\n existing: row,\n schema: registration.type.schema,\n uniqueConstraints: registration.unique ?? [],\n },\n backend,\n );\n });\n}\n\nfunction getTransactionNodeCollection<G extends GraphDef>(\n tx: TransactionContext<G>,\n kind: string,\n): DynamicNodeCollection {\n const collection = tx.getNodeCollection(kind);\n if (collection !== undefined) return collection;\n throw new ConfigurationError(\n `Provenance source kind \"${kind}\" is not available on this transaction.`,\n { kind },\n );\n}\n\nasync function setSourceRetractionState<G extends GraphDef>(\n tx: TransactionContext<G>,\n config: NormalizedConfig,\n source: ProvenanceNodeRef,\n retracted: boolean,\n): Promise<void> {\n const collection = getTransactionNodeCollection(tx, source.kind);\n await collection.update(source.id, { [config.retractedField]: retracted });\n}\n\nasync function runTransition<\n G extends GraphDef,\n SourceKind extends NodeKind<G>,\n FactKind extends NodeKind<G>,\n JustificationKind extends NodeKind<G>,\n>(\n store: HistoryStore<G>,\n config: NormalizedConfig,\n sources: readonly ProvenanceNodeRef<G, SourceKind>[],\n retracted: boolean,\n): Promise<RetractionReport<G, FactKind, JustificationKind>> {\n const uniqueSources = uniqueNodeReferences(sources);\n for (const source of uniqueSources) {\n if (config.sourceKinds.includes(source.kind)) continue;\n throw new ConfigurationError(\n `Provenance retraction source must be one of: ${config.sourceKinds.join(\", \")}.`,\n { expectedKinds: config.sourceKinds, actualKind: source.kind },\n );\n }\n\n return store.transaction(async (tx) => {\n const backend = transactionBackend(tx);\n // Serialize the whole read-compute-write transition per graph BEFORE the\n // first read. `store.transaction` itself takes no lock (write operations\n // acquire it at their own boundaries), but a transition's support\n // snapshot must not race a concurrent transition or history write, so\n // the per-graph write lock is acquired explicitly up front. The token is\n // the evidence the currency-sync pipeline steps require.\n const lock = await lockRecordedGraphWrite(backend, store.graphId);\n const rows = await Promise.all(\n uniqueSources.map((source) =>\n backend.getNode(store.graphId, source.kind, source.id),\n ),\n );\n const sourceRows = uniqueSources.map((source, index): SourceRow<G> => {\n const sourceRow = rows[index];\n if (sourceRow === undefined || sourceRow.deleted_at !== undefined) {\n throw new NodeNotFoundError(source.kind, source.id);\n }\n return { source, row: sourceRow };\n });\n\n // Load the provenance graph once. Its structure (justifications, facts,\n // premise/derive edges) is identical before and after the transition — only\n // source availability changes — so the pre- and post-flip snapshots share\n // this read instead of scanning the whole graph twice per retraction.\n const supportGraph = await loadSupportGraph(backend, store.graphId, config);\n const availableBefore = availableSourceKeys(\n supportGraph.sourceRows,\n config.retractedField,\n );\n const before = computeSupportSnapshot(supportGraph, availableBefore);\n\n const nextState: SourceRetractedState =\n retracted ? \"retracted\" : \"available\";\n const availableAfter = new Set(availableBefore);\n for (const { source, row } of sourceRows) {\n const currentState = sourceRetractedState(row, config.retractedField);\n if (currentState === nextState) continue;\n await setSourceRetractionState(tx, config, source, retracted);\n // Mirror the flip in the in-memory availability so `after` matches the\n // source rows now persisted, without re-reading the whole graph.\n if (nextState === \"available\") {\n availableAfter.add(refKey(source));\n } else {\n availableAfter.delete(refKey(source));\n }\n }\n const after = computeSupportSnapshot(supportGraph, availableAfter);\n const affected = after.affectedFactKeys(uniqueSources);\n await synchronizeFactCurrency(\n backend,\n store,\n transactionNodeOperationHookRunner(tx),\n after,\n affected,\n lock,\n );\n return buildReport<G, FactKind, JustificationKind>(before, after, affected);\n });\n}\n\nfunction uniqueNodeReferences<\n G extends GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n>(references: readonly ProvenanceNodeRef<G, K>[]): ProvenanceNodeRef<G, K>[] {\n const byKey = new Map<string, ProvenanceNodeRef<G, K>>();\n for (const reference of references) {\n byKey.set(refKey(reference), reference);\n }\n return [...byKey.values()];\n}\n\nexport function createRetractionCapability<\n G extends GraphDef,\n const C extends ProvenanceRetractionConfig<G>,\n>(\n store: HistoryStore<G>,\n config: C,\n): RetractionCapability<\n G,\n SourceKindsFromConfig<G, C>,\n FactKindsFromConfig<G, C>,\n JustificationKindFromConfig<G, C>\n> {\n assertRetractionHistoryEnabled(store);\n const normalized = normalizeConfig(store.graph, config);\n\n // The four retract verbs differ only in one/many source shape and the target\n // retracted flag; the generics are fixed by the config, so hoist one call.\n const transition = (\n sources: readonly ProvenanceNodeRef<G, SourceKindsFromConfig<G, C>>[],\n retracted: boolean,\n ) =>\n runTransition<\n G,\n SourceKindsFromConfig<G, C>,\n FactKindsFromConfig<G, C>,\n JustificationKindFromConfig<G, C>\n >(store, normalized, sources, retracted);\n\n return {\n retract: (source) => transition([source], true),\n retractMany: (sources) => transition(sources, true),\n unRetract: (source) => transition([source], false),\n unRetractMany: (sources) => transition(sources, false),\n\n async holding() {\n return store.transaction(async (tx) => {\n const backend = transactionBackend(tx);\n // Same explicit lock as runTransition: the support computation reads\n // several relations, and PostgreSQL's READ COMMITTED gives each\n // statement its own snapshot — without the lock a concurrent\n // transition could commit between those reads and tear the view.\n await lockRecordedGraphWrite(backend, store.graphId);\n const snapshot = await computeSupport(\n backend,\n store.graphId,\n normalized,\n );\n return sortedReferences<G, FactKindsFromConfig<G, C>>(\n snapshot.believedFactKeys,\n );\n });\n },\n };\n}\n\nfunction assertRetractionHistoryEnabled(\n store: Readonly<{ historyEnabled: boolean; graphId: string }>,\n): void {\n if (!store.historyEnabled) {\n throw new ConfigurationError(\n \"createRetractionCapability requires a store created with { history: true }.\",\n { graphId: store.graphId },\n {\n suggestion:\n \"Use createStoreWithSchema(graph, backend, { history: true }) so retraction mutations are captured and queryable with asOfRecorded().\",\n },\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/provenance/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAyCA,IAAM,uBAAA,GAA0B,WAAA;AAChC,IAAM,aAAA,GAAgB,IAAA;AAmJtB,SAAS,OAAO,GAAA,EAAgC;AAC9C,EAAA,OAAO,GAAG,GAAA,CAAI,IAAI,GAAG,aAAa,CAAA,EAAG,IAAI,EAAE,CAAA,CAAA;AAC7C;AAEA,SAAS,OAAO,GAAA,EAA2C;AACzD,EAAA,OAAO,MAAA,CAAO,EAAE,IAAA,EAAM,GAAA,CAAI,MAAM,EAAA,EAAI,GAAA,CAAI,IAAI,CAAA;AAC9C;AAEA,SAAS,YAAY,IAAA,EAAuB;AAC1C,EAAA,OAAO,MAAA,CAAO,EAAE,IAAA,EAAM,IAAA,CAAK,WAAW,EAAA,EAAI,IAAA,CAAK,SAAS,CAAA;AAC1D;AAEA,SAAS,UAAU,IAAA,EAAuB;AACxC,EAAA,OAAO,MAAA,CAAO,EAAE,IAAA,EAAM,IAAA,CAAK,SAAS,EAAA,EAAI,IAAA,CAAK,OAAO,CAAA;AACtD;AAEA,S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AAS,KAAA,CAAM,OAAO,CAAA;AACnD,QAAA,MAAM,WAAW,MAAM,cAAA;AAAA,UACrB,OAAA;AAAA,UACA,KAAA,CAAM,OAAA;AAAA,UACN;AAAA,SACF;AACA,QAAA,OAAO,gBAAA;AAAA,UACL,QAAA,CAAS;AAAA,SACX;AAAA,MACF,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF;AAEA,SAAS,+BACP,KAAA,EACM;AACN,EAAA,IAAI,CAAC,MAAM,cAAA,EAAgB;AACzB,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,6EAAA;AAAA,MACA,EAAE,OAAA,EAAS,KAAA,CAAM,OAAA,EAAQ;AAAA,MACzB;AAAA,QACE,UAAA,EACE;AAAA;AACJ,KACF;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import {\n type EdgeRow,\n type GraphReadBackend,\n isLiveNodeRow,\n isTombstonedNodeRow,\n type LiveNodeRow,\n type NodeRow,\n rowPropsToObject,\n type TombstonedNodeRow,\n type TransactionBackend,\n} from \"../backend/types\";\nimport type { GraphDef } from \"../core/define-graph\";\nimport type { NodeRegistration } from \"../core/types\";\nimport { ConfigurationError, NodeNotFoundError } from \"../errors\";\nimport {\n applyNodeResurrect,\n applyNodeSoftDelete,\n createNodeWriteContext,\n} from \"../store/operations/node-write-pipeline\";\nimport { lockRecordedGraphWrite } from \"../store/recorded-capture\";\nimport { type GraphWriteLock } from \"../store/recorded-capture/clock\";\nimport {\n transactionBackend,\n transactionNodeOperationHookRunner,\n} from \"../store/runtime-port\";\nimport type { HistoryStore } from \"../store/store\";\nimport {\n type DynamicNodeCollection,\n type TransactionContext,\n} from \"../store/types\";\nimport { compareStrings } from \"../utils/compare\";\nimport { nowIso } from \"../utils/date\";\nimport { isPlainObject } from \"../utils/object\";\n\nexport type {\n ContributionDiagnostic,\n ContributionDiagnosticState,\n ContributionRepairEntry,\n ContributionRepairResult,\n} from \"../backend/types\";\n\nconst DEFAULT_RETRACTED_FIELD = \"retracted\";\nconst KEY_SEPARATOR = \"\\u0000\";\n\ntype NodeKind<G extends GraphDef> = Extract<keyof G[\"nodes\"], string>;\ntype EdgeKind<G extends GraphDef> = Extract<keyof G[\"edges\"], string>;\n\nexport type ProvenanceNodeRef<\n G extends GraphDef = GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n> = Readonly<{\n kind: K;\n id: string;\n}>;\n\nexport type ProvenanceJustificationRef<\n G extends GraphDef = GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n> = ProvenanceNodeRef<G, K>;\nexport type ProvenanceFactRef<\n G extends GraphDef = GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n> = ProvenanceNodeRef<G, K>;\n\ntype ProvenanceSourceConfig<G extends GraphDef = GraphDef> =\n | Readonly<{\n kind: NodeKind<G>;\n retractedField?: string;\n }>\n | Readonly<{\n kinds: readonly NodeKind<G>[];\n retractedField?: string;\n }>;\n\nexport type ProvenanceRetractionConfig<G extends GraphDef = GraphDef> =\n Readonly<{\n source: ProvenanceSourceConfig<G>;\n justification: Readonly<{ kind: NodeKind<G> }>;\n fact: Readonly<{ kinds: readonly NodeKind<G>[] }>;\n premiseOf: Readonly<{ kind: EdgeKind<G> }>;\n derives: Readonly<{ kind: EdgeKind<G> }>;\n }>;\n\n/**\n * Extracts the node kind(s) referenced by a provenance role config, whether\n * declared as a single `{ kind }` or a `{ kinds }` array. Falls back to the\n * full `NodeKind<G>` union when neither shape is present (e.g. a role config\n * that also carries unrelated fields, matched structurally).\n */\ntype KindsFromRef<G extends GraphDef, Ref> =\n Ref extends Readonly<{ kind: infer K }> ? Extract<K, NodeKind<G>>\n : Ref extends Readonly<{ kinds: readonly (infer K)[] }> ?\n Extract<K, NodeKind<G>>\n : NodeKind<G>;\n\ntype SourceKindsFromConfig<\n G extends GraphDef,\n C extends ProvenanceRetractionConfig<G>,\n> = KindsFromRef<G, C[\"source\"]>;\n\ntype FactKindsFromConfig<\n G extends GraphDef,\n C extends ProvenanceRetractionConfig<G>,\n> = KindsFromRef<G, C[\"fact\"]>;\n\ntype JustificationKindFromConfig<\n G extends GraphDef,\n C extends ProvenanceRetractionConfig<G>,\n> = KindsFromRef<G, C[\"justification\"]>;\n\nexport type SurvivedVia<\n G extends GraphDef = GraphDef,\n FactKind extends NodeKind<G> = NodeKind<G>,\n JustificationKind extends NodeKind<G> = NodeKind<G>,\n> = Readonly<{\n fact: ProvenanceFactRef<G, FactKind>;\n via: readonly ProvenanceJustificationRef<G, JustificationKind>[];\n}>;\n\nexport type RetractionReport<\n G extends GraphDef = GraphDef,\n FactKind extends NodeKind<G> = NodeKind<G>,\n JustificationKind extends NodeKind<G> = NodeKind<G>,\n> = Readonly<{\n died: readonly ProvenanceFactRef<G, FactKind>[];\n survivedVia: readonly SurvivedVia<G, FactKind, JustificationKind>[];\n unaffected: readonly ProvenanceFactRef<G, FactKind>[];\n}>;\n\nexport type RetractionCapability<\n G extends GraphDef = GraphDef,\n SourceKind extends NodeKind<G> = NodeKind<G>,\n FactKind extends NodeKind<G> = NodeKind<G>,\n JustificationKind extends NodeKind<G> = NodeKind<G>,\n> = Readonly<{\n retract: (\n source: ProvenanceNodeRef<G, SourceKind>,\n ) => Promise<RetractionReport<G, FactKind, JustificationKind>>;\n retractMany: (\n sources: readonly ProvenanceNodeRef<G, SourceKind>[],\n ) => Promise<RetractionReport<G, FactKind, JustificationKind>>;\n unRetract: (\n source: ProvenanceNodeRef<G, SourceKind>,\n ) => Promise<RetractionReport<G, FactKind, JustificationKind>>;\n unRetractMany: (\n sources: readonly ProvenanceNodeRef<G, SourceKind>[],\n ) => Promise<RetractionReport<G, FactKind, JustificationKind>>;\n holding: () => Promise<readonly ProvenanceFactRef<G, FactKind>[]>;\n}>;\n\ntype NormalizedConfig = Readonly<{\n sourceKinds: readonly string[];\n retractedField: string;\n justificationKind: string;\n factKinds: readonly string[];\n premiseOfKind: string;\n derivesKind: string;\n}>;\n\ntype ProvenanceRows = Readonly<{\n justifications: ReadonlyMap<string, NodeRow>;\n facts: ReadonlyMap<string, NodeRow>;\n premiseEdges: readonly EdgeRow[];\n deriveEdges: readonly EdgeRow[];\n}>;\n\ntype SupportEdges = Readonly<{\n premisesByJustification: ReadonlyMap<string, readonly string[]>;\n factsByJustification: ReadonlyMap<string, readonly string[]>;\n justificationsByPremise: ReadonlyMap<string, readonly string[]>;\n}>;\n\ntype SupportSnapshot = Readonly<{\n facts: ReadonlyMap<string, NodeRow>;\n supportedFactKeys: ReadonlySet<string>;\n believedFactKeys: ReadonlySet<string>;\n firingJustificationKeysByFact: ReadonlyMap<string, readonly string[]>;\n affectedFactKeys: (\n sources: readonly ProvenanceNodeRef[],\n ) => ReadonlySet<string>;\n}>;\n\ntype SourceRetractedState = \"retracted\" | \"available\";\n\ntype SourceRow<G extends GraphDef> = Readonly<{\n source: ProvenanceNodeRef<G>;\n row: NodeRow;\n}>;\n\nfunction refKey(ref: ProvenanceNodeRef): string {\n return `${ref.kind}${KEY_SEPARATOR}${ref.id}`;\n}\n\nfunction rowKey(row: Pick<NodeRow, \"kind\" | \"id\">): string {\n return refKey({ kind: row.kind, id: row.id });\n}\n\nfunction edgeFromKey(edge: EdgeRow): string {\n return refKey({ kind: edge.from_kind, id: edge.from_id });\n}\n\nfunction edgeToKey(edge: EdgeRow): string {\n return refKey({ kind: edge.to_kind, id: edge.to_id });\n}\n\nfunction keyToRef<\n G extends GraphDef = GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n>(key: string): ProvenanceNodeRef<G, K> {\n const separatorIndex = key.indexOf(KEY_SEPARATOR);\n if (separatorIndex === -1) {\n throw new ConfigurationError(\n \"Invalid provenance identity key.\",\n { key },\n {\n suggestion:\n \"Report this TypeGraph provenance bug with the graph roles that produced the key.\",\n },\n );\n }\n const kind = key.slice(0, separatorIndex);\n const id = key.slice(separatorIndex + KEY_SEPARATOR.length);\n return { kind, id } as ProvenanceNodeRef<G, K>;\n}\n\nfunction sortedReferences<\n G extends GraphDef = GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n>(keys: Iterable<string>): ProvenanceNodeRef<G, K>[] {\n return [...keys]\n .toSorted((left, right) => compareStrings(left, right))\n .map((key) => keyToRef<G, K>(key));\n}\n\nfunction parseNodeProps(row: NodeRow): Record<string, unknown> {\n const parsed = rowPropsToObject(row.props) as unknown;\n if (!isPlainObject(parsed)) {\n throw new ConfigurationError(\n `Node ${row.kind}/${row.id} props are not an object.`,\n { kind: row.kind, id: row.id },\n );\n }\n return parsed;\n}\n\nfunction sourceRetractedState(\n row: NodeRow,\n retractedField: string,\n): SourceRetractedState {\n const props = parseNodeProps(row);\n const value = props[retractedField];\n if (value === undefined) return \"available\";\n if (typeof value !== \"boolean\") {\n throw new ConfigurationError(\n `Provenance source field \"${retractedField}\" must contain a boolean value.`,\n { kind: row.kind, id: row.id, field: retractedField },\n {\n suggestion:\n \"Use a source node schema with a boolean retracted flag, for example z.boolean().default(false).\",\n },\n );\n }\n return value ? \"retracted\" : \"available\";\n}\n\nfunction normalizeConfig<G extends GraphDef>(\n graph: G,\n config: ProvenanceRetractionConfig<G>,\n): NormalizedConfig {\n const sourceKinds = sourceKindsFromConfig(config.source);\n const justificationKind = config.justification.kind;\n const factKinds = [...config.fact.kinds];\n const premiseOfKind = config.premiseOf.kind;\n const derivesKind = config.derives.kind;\n const retractedField =\n config.source.retractedField ?? DEFAULT_RETRACTED_FIELD;\n\n if (sourceKinds.length === 0) {\n throw new ConfigurationError(\n \"Provenance retraction requires at least one source kind.\",\n { role: \"source\" },\n );\n }\n\n if (factKinds.length === 0) {\n throw new ConfigurationError(\n \"Provenance retraction requires at least one fact kind.\",\n { role: \"fact\" },\n );\n }\n\n const duplicateSourceKinds = duplicateValues(sourceKinds);\n if (duplicateSourceKinds.length > 0) {\n throw new ConfigurationError(\"Provenance source kinds must be unique.\", {\n duplicateSourceKinds,\n });\n }\n\n const duplicateFactKinds = duplicateValues(factKinds);\n if (duplicateFactKinds.length > 0) {\n throw new ConfigurationError(\"Provenance fact kinds must be unique.\", {\n duplicateFactKinds,\n });\n }\n\n for (const kind of sourceKinds) {\n assertKind(graph.nodes, kind, \"source\", \"node\", graph.id);\n }\n assertKind(graph.nodes, justificationKind, \"justification\", \"node\", graph.id);\n for (const kind of factKinds) {\n assertKind(graph.nodes, kind, \"fact\", \"node\", graph.id);\n }\n for (const kind of sourceKinds)\n assertSourceField(graph, kind, retractedField);\n assertKind(graph.edges, premiseOfKind, \"premiseOf\", \"edge\", graph.id);\n assertKind(graph.edges, derivesKind, \"derives\", \"edge\", graph.id);\n\n if (\n factKinds.some(\n (kind) => sourceKinds.includes(kind) || kind === justificationKind,\n )\n ) {\n throw new ConfigurationError(\n \"Provenance fact kinds must be distinct from source and justification kinds.\",\n { sourceKinds, justificationKind, factKinds },\n );\n }\n\n assertEdgeEndpoints(graph, premiseOfKind, {\n role: \"premiseOf\",\n fromKinds: sourceKinds,\n toKinds: [justificationKind],\n });\n assertEdgeEndpoints(graph, derivesKind, {\n role: \"derives\",\n fromKinds: [justificationKind],\n toKinds: factKinds,\n });\n\n return {\n sourceKinds,\n retractedField,\n justificationKind,\n factKinds,\n premiseOfKind,\n derivesKind,\n };\n}\n\nfunction sourceKindsFromConfig<G extends GraphDef>(\n source: ProvenanceSourceConfig<G>,\n): string[] {\n if (\"kinds\" in source) return [...source.kinds];\n return [source.kind];\n}\n\nfunction duplicateValues(values: readonly string[]): string[] {\n const seen = new Set<string>();\n const duplicates = new Set<string>();\n for (const value of values) {\n if (seen.has(value)) {\n duplicates.add(value);\n continue;\n }\n seen.add(value);\n }\n return [...duplicates].toSorted((left, right) => compareStrings(left, right));\n}\n\nfunction assertKind(\n records: Readonly<Record<string, unknown>>,\n kind: string,\n role: string,\n noun: \"node\" | \"edge\",\n graphId: string,\n): void {\n if (Object.hasOwn(records, kind)) return;\n throw new ConfigurationError(\n `Provenance ${role} kind \"${kind}\" is not a ${noun} kind in this graph.`,\n { role, kind, graphId },\n );\n}\n\nfunction assertSourceField<G extends GraphDef>(\n graph: G,\n sourceKind: string,\n retractedField: string,\n): void {\n const registration = graph.nodes[sourceKind];\n if (registration === undefined) return;\n if (Object.hasOwn(registration.type.schema.shape, retractedField)) return;\n throw new ConfigurationError(\n `Provenance source kind \"${sourceKind}\" must include field \"${retractedField}\".`,\n { sourceKind, retractedField },\n {\n suggestion:\n \"Add a boolean retracted flag to the source node schema or pass source.retractedField.\",\n },\n );\n}\n\nfunction assertEdgeEndpoints<G extends GraphDef>(\n graph: G,\n edgeKind: string,\n expected: Readonly<{\n role: string;\n fromKinds: readonly string[];\n toKinds: readonly string[];\n }>,\n): void {\n const registration = graph.edges[edgeKind];\n if (registration === undefined) return;\n const fromKinds = new Set(registration.from.map((node) => node.kind));\n const toKinds = new Set(registration.to.map((node) => node.kind));\n for (const kind of expected.fromKinds) {\n if (fromKinds.has(kind)) continue;\n throw new ConfigurationError(\n `Provenance ${expected.role} edge \"${edgeKind}\" cannot start at \"${kind}\".`,\n { edgeKind, role: expected.role, expectedFrom: kind },\n );\n }\n for (const kind of expected.toKinds) {\n if (toKinds.has(kind)) continue;\n throw new ConfigurationError(\n `Provenance ${expected.role} edge \"${edgeKind}\" cannot end at \"${kind}\".`,\n { edgeKind, role: expected.role, expectedTo: kind },\n );\n }\n}\n\n/**\n * Whether a row's validity window contains `asOf`. The JS mirror of the SQL\n * `\"current\"`-mode predicate, for role reads that must include tombstoned\n * rows (which `\"current\"` cannot express) yet still respect validity.\n * Canonical fixed-width UTC ISO strings compare correctly as text.\n */\nfunction isValidAt(\n row: Pick<NodeRow, \"valid_from\" | \"valid_to\">,\n asOf: string,\n): boolean {\n return (\n (row.valid_from === undefined || row.valid_from <= asOf) &&\n (row.valid_to === undefined || row.valid_to > asOf)\n );\n}\n\n/**\n * Provenance reads follow the store's currency semantics: a source,\n * justification, or support edge counts only while currently valid (the\n * default `\"current\"` read mode), so a validity-expired source no longer\n * supports anything and `holding()` agrees with the collection API about\n * which facts are currently believed. Fact rows additionally need their\n * tombstones — a reopen candidate is by definition soft-deleted — so they\n * are loaded with tombstones and filtered to the same validity instant.\n */\nasync function findNodeRows(\n backend: GraphReadBackend,\n graphId: string,\n kind: string,\n options: Readonly<{ includeTombstones: boolean; asOf: string }>,\n): Promise<readonly NodeRow[]> {\n if (options.includeTombstones) {\n const rows = await backend.findNodesByKind({\n graphId,\n kind,\n excludeDeleted: false,\n temporalMode: \"includeTombstones\",\n orderBy: \"id\",\n });\n return rows.filter((row) => isValidAt(row, options.asOf));\n }\n return backend.findNodesByKind({\n graphId,\n kind,\n excludeDeleted: true,\n temporalMode: \"current\",\n asOf: options.asOf,\n orderBy: \"id\",\n });\n}\n\nasync function findEdgeRows(\n backend: GraphReadBackend,\n graphId: string,\n kind: string,\n asOf: string,\n): Promise<readonly EdgeRow[]> {\n return backend.findEdgesByKind({\n graphId,\n kind,\n excludeDeleted: true,\n temporalMode: \"current\",\n asOf,\n orderBy: \"id\",\n });\n}\n\nasync function readRoles(\n backend: GraphReadBackend,\n graphId: string,\n config: NormalizedConfig,\n asOf: string,\n): Promise<ProvenanceRows> {\n const [justificationRows, factRowsByKind, premiseEdges, deriveEdges] =\n await Promise.all([\n findNodeRows(backend, graphId, config.justificationKind, {\n includeTombstones: false,\n asOf,\n }),\n Promise.all(\n config.factKinds.map((kind) =>\n findNodeRows(backend, graphId, kind, {\n includeTombstones: true,\n asOf,\n }),\n ),\n ),\n findEdgeRows(backend, graphId, config.premiseOfKind, asOf),\n findEdgeRows(backend, graphId, config.derivesKind, asOf),\n ]);\n const factRows = factRowsByKind.flat();\n\n return {\n justifications: rowsByKey(justificationRows),\n facts: rowsByKey(factRows),\n premiseEdges,\n deriveEdges,\n };\n}\n\nfunction rowsByKey(rows: readonly NodeRow[]): ReadonlyMap<string, NodeRow> {\n const byKey = new Map<string, NodeRow>();\n for (const row of rows) byKey.set(rowKey(row), row);\n return byKey;\n}\n\nfunction appendGroupedValue(\n groups: Map<string, string[]>,\n key: string,\n value: string,\n): void {\n const group = groups.get(key);\n if (group === undefined) {\n groups.set(key, [value]);\n return;\n }\n if (group.includes(value)) return;\n group.push(value);\n}\n\nfunction buildSupportEdges(\n config: NormalizedConfig,\n rows: ProvenanceRows,\n): SupportEdges {\n const premisesByJustification = new Map<string, string[]>();\n const factsByJustification = new Map<string, string[]>();\n const justificationsByPremise = new Map<string, string[]>();\n\n for (const edge of rows.premiseEdges) {\n if (edge.to_kind !== config.justificationKind) continue;\n if (!isPremiseKind(config, edge.from_kind)) continue;\n\n const premiseKey = edgeFromKey(edge);\n const justificationKey = edgeToKey(edge);\n appendGroupedValue(premisesByJustification, justificationKey, premiseKey);\n appendGroupedValue(justificationsByPremise, premiseKey, justificationKey);\n }\n\n for (const edge of rows.deriveEdges) {\n if (edge.from_kind !== config.justificationKind) continue;\n if (!config.factKinds.includes(edge.to_kind)) continue;\n appendGroupedValue(\n factsByJustification,\n edgeFromKey(edge),\n edgeToKey(edge),\n );\n }\n\n return {\n premisesByJustification,\n factsByJustification,\n justificationsByPremise,\n };\n}\n\n/**\n * The whole-graph read a support computation needs: the role rows, the support\n * edges derived from them, and the (non-retracted-visible) source rows. Loaded\n * once per transition so `before` and `after` snapshots share one read instead\n * of scanning the entire provenance graph twice — the graph structure is\n * identical across a transition, only source availability changes.\n */\ntype SupportGraph = Readonly<{\n roles: ProvenanceRows;\n supportEdges: SupportEdges;\n sourceRows: readonly NodeRow[];\n}>;\n\nasync function loadSupportGraph(\n backend: GraphReadBackend,\n graphId: string,\n config: NormalizedConfig,\n): Promise<SupportGraph> {\n // One read instant for every role read, so the whole snapshot shares a\n // single \"currently valid\" coordinate.\n const asOf = nowIso();\n const roles = await readRoles(backend, graphId, config, asOf);\n const supportEdges = buildSupportEdges(config, roles);\n const sourceRowsByKind = await Promise.all(\n config.sourceKinds.map((kind) =>\n findNodeRows(backend, graphId, kind, { includeTombstones: false, asOf }),\n ),\n );\n return { roles, supportEdges, sourceRows: sourceRowsByKind.flat() };\n}\n\nfunction availableSourceKeys(\n sourceRows: readonly NodeRow[],\n retractedField: string,\n): Set<string> {\n const available = new Set<string>();\n for (const row of sourceRows) {\n if (sourceRetractedState(row, retractedField) === \"available\") {\n available.add(rowKey(row));\n }\n }\n return available;\n}\n\n/**\n * The pure TMS fixpoint: given the loaded graph and the set of available\n * (non-retracted) source keys, derive which facts are supported and believed.\n * No I/O — the same {@link SupportGraph} feeds both the pre- and post-transition\n * snapshots with different availability sets.\n */\nfunction computeSupportSnapshot(\n graph: Pick<SupportGraph, \"roles\" | \"supportEdges\">,\n available: ReadonlySet<string>,\n): SupportSnapshot {\n const { roles, supportEdges } = graph;\n const supported = new Set<string>();\n const inSet = new Set<string>(available);\n const firingJustifications = new Set<string>();\n const firingJustificationKeysByFact = new Map<string, string[]>();\n\n let changed = true;\n while (changed) {\n changed = false;\n for (const [justificationKey] of roles.justifications) {\n if (firingJustifications.has(justificationKey)) continue;\n const premises =\n supportEdges.premisesByJustification.get(justificationKey) ?? [];\n if (!allPremisesSupported(premises, inSet)) continue;\n\n firingJustifications.add(justificationKey);\n const derivedFacts =\n supportEdges.factsByJustification.get(justificationKey) ?? [];\n for (const factKey of derivedFacts) {\n if (!roles.facts.has(factKey)) continue;\n appendGroupedValue(\n firingJustificationKeysByFact,\n factKey,\n justificationKey,\n );\n if (supported.has(factKey)) continue;\n supported.add(factKey);\n inSet.add(factKey);\n changed = true;\n }\n }\n }\n\n const believed = new Set<string>();\n for (const key of supported) {\n const row = roles.facts.get(key);\n if (row !== undefined && row.deleted_at === undefined) believed.add(key);\n }\n\n return {\n facts: roles.facts,\n supportedFactKeys: supported,\n believedFactKeys: believed,\n firingJustificationKeysByFact,\n affectedFactKeys(\n targets: readonly ProvenanceNodeRef[],\n ): ReadonlySet<string> {\n return computeAffectedFactKeys(targets, roles, supportEdges);\n },\n };\n}\n\nasync function computeSupport(\n backend: GraphReadBackend,\n graphId: string,\n config: NormalizedConfig,\n): Promise<SupportSnapshot> {\n const graph = await loadSupportGraph(backend, graphId, config);\n return computeSupportSnapshot(\n graph,\n availableSourceKeys(graph.sourceRows, config.retractedField),\n );\n}\n\nfunction isPremiseKind(config: NormalizedConfig, kind: string): boolean {\n return config.sourceKinds.includes(kind) || config.factKinds.includes(kind);\n}\n\nfunction allPremisesSupported(\n premises: readonly string[],\n supported: ReadonlySet<string>,\n): boolean {\n for (const premise of premises) {\n if (!supported.has(premise)) return false;\n }\n return true;\n}\n\nfunction computeAffectedFactKeys(\n sources: readonly ProvenanceNodeRef[],\n roles: ProvenanceRows,\n supportEdges: SupportEdges,\n): ReadonlySet<string> {\n const affected = new Set<string>();\n // Seed the BFS with every source at once: the union of facts reachable from\n // any source falls out of one traversal, instead of one BFS per source.\n const frontier = sources.map((source) => refKey(source));\n const seen = new Set<string>(frontier);\n\n while (frontier.length > 0) {\n const current = frontier.shift();\n if (current === undefined) continue;\n\n const justifications =\n supportEdges.justificationsByPremise.get(current) ?? [];\n for (const justificationKey of justifications) {\n const derivedFacts =\n supportEdges.factsByJustification.get(justificationKey) ?? [];\n for (const factKey of derivedFacts) {\n if (!roles.facts.has(factKey)) continue;\n affected.add(factKey);\n if (seen.has(factKey)) continue;\n seen.add(factKey);\n frontier.push(factKey);\n }\n }\n }\n\n return affected;\n}\n\nfunction buildReport<\n G extends GraphDef,\n FactKind extends NodeKind<G>,\n JustificationKind extends NodeKind<G>,\n>(\n before: SupportSnapshot,\n after: SupportSnapshot,\n affected: ReadonlySet<string>,\n): RetractionReport<G, FactKind, JustificationKind> {\n const believedBefore = [...before.believedFactKeys];\n const died = sortedReferences<G, FactKind>(\n believedBefore.filter((key) => !after.supportedFactKeys.has(key)),\n );\n const unaffected = sortedReferences<G, FactKind>(\n believedBefore.filter((key) => !affected.has(key)),\n );\n const survivedVia = [...affected]\n .filter((key) => after.supportedFactKeys.has(key))\n .toSorted((left, right) => compareStrings(left, right))\n .map((key) => ({\n fact: keyToRef<G, FactKind>(key),\n via: sortedReferences<G, JustificationKind>(\n after.firingJustificationKeysByFact.get(key) ?? [],\n ),\n }));\n return { died, survivedVia, unaffected };\n}\n\n/**\n * Brings fact currency in line with the post-transition support snapshot —\n * but only for the facts the transition could have affected (those reachable\n * from the flipped sources through justification edges). Facts outside that\n * set are never touched: an unsupported live fact elsewhere in the graph\n * (e.g. one whose justification edges have not been linked yet) is not this\n * transition's business, and silently tombstoning it would be invisible data\n * loss the report cannot even mention.\n *\n * Closes run before reopens: a reopen re-checks uniqueness, and the unique\n * key it needs may still be held by a fact this same transition is about to\n * close — closing first makes a legal transition order-independent.\n */\n/**\n * Runs `action` over every fact row in `snapshot` that is both affected by the\n * transition and matches `isTargetKey`/`isTargetRow`, concurrently — the\n * matched rows are independent facts, so there is no ordering dependency\n * within a single pass (only between the close pass and the reopen pass,\n * which the caller sequences).\n */\nasync function forEachAffectedFact<T extends NodeRow>(\n snapshot: SupportSnapshot,\n affected: ReadonlySet<string>,\n isTargetKey: (key: string) => boolean,\n isTargetRow: (row: NodeRow) => row is T,\n action: (row: T) => Promise<void>,\n): Promise<void> {\n const rows: T[] = [];\n for (const [key, row] of snapshot.facts) {\n if (!affected.has(key)) continue;\n if (!isTargetKey(key)) continue;\n if (!isTargetRow(row)) continue;\n rows.push(row);\n }\n await Promise.all(rows.map((row) => action(row)));\n}\n\n/**\n * The transaction-scoped hook lifecycle fact close/reopen runs through —\n * transaction runtime's operation-hook runner. Using the\n * transaction's runner (not the store's) defers each fact's success hook\n * until the transition's COMMIT, so hooks never report a closed or reopened\n * fact that a failed commit then rolls back.\n */\ntype RunNodeOperationHooks = <T>(\n operation: \"create\" | \"update\" | \"delete\",\n kind: string,\n id: string,\n fn: () => Promise<T>,\n) => Promise<T>;\n\nasync function synchronizeFactCurrency<G extends GraphDef>(\n backend: TransactionBackend,\n store: HistoryStore<G>,\n runHooks: RunNodeOperationHooks,\n snapshot: SupportSnapshot,\n affected: ReadonlySet<string>,\n lock: GraphWriteLock,\n): Promise<void> {\n await forEachAffectedFact(\n snapshot,\n affected,\n (key) => !snapshot.supportedFactKeys.has(key),\n isLiveNodeRow,\n (row) => closeFactCurrency(backend, store, runHooks, row, lock),\n );\n await forEachAffectedFact(\n snapshot,\n affected,\n (key) => snapshot.supportedFactKeys.has(key),\n isTombstonedNodeRow,\n (row) => reopenFactCurrency(backend, store, runHooks, row, lock),\n );\n}\n\nfunction getFactRegistration<G extends GraphDef>(\n store: HistoryStore<G>,\n row: NodeRow,\n): NodeRegistration {\n const registration = store.graph.nodes[row.kind];\n if (registration !== undefined) return registration;\n throw new ConfigurationError(\n `Provenance fact kind \"${row.kind}\" is not a node kind in this graph.`,\n { kind: row.kind, graphId: store.graphId },\n );\n}\n\nasync function closeFactCurrency<G extends GraphDef>(\n backend: TransactionBackend,\n store: HistoryStore<G>,\n runHooks: RunNodeOperationHooks,\n row: LiveNodeRow,\n lock: GraphWriteLock,\n): Promise<void> {\n await runHooks(\"delete\", row.kind, row.id, async () => {\n const registration = getFactRegistration(store, row);\n // The canonical soft-delete steps (tombstone, uniqueness/embedding/\n // fulltext cleanup) WITHOUT delete-behavior enforcement: closing a\n // fact's currency is a belief-status change, not a domain delete, so\n // its connected edges neither block the close (`restrict`) nor get\n // removed (`cascade` / `disconnect`). Every edge survives untouched,\n // making a later reopen an exact inverse of this close.\n await applyNodeSoftDelete(\n createNodeWriteContext(store.graphId, store.registry, lock),\n {\n existing: row,\n schema: registration.type.schema,\n uniqueConstraints: registration.unique ?? [],\n onDelete: registration.onDelete,\n },\n backend,\n { enforceDeleteBehavior: false },\n );\n });\n}\n\nasync function reopenFactCurrency<G extends GraphDef>(\n backend: TransactionBackend,\n store: HistoryStore<G>,\n runHooks: RunNodeOperationHooks,\n row: TombstonedNodeRow,\n lock: GraphWriteLock,\n): Promise<void> {\n await runHooks(\"update\", row.kind, row.id, async () => {\n const registration = getFactRegistration(store, row);\n // The delete removed this fact's uniqueness entries, so reopen re-checks and\n // re-inserts them (rather than the diff-based update path) before clearing\n // the tombstone and re-syncing embeddings/fulltext.\n await applyNodeResurrect(\n createNodeWriteContext(store.graphId, store.registry, lock),\n {\n existing: row,\n schema: registration.type.schema,\n uniqueConstraints: registration.unique ?? [],\n },\n backend,\n );\n });\n}\n\nfunction getTransactionNodeCollection<G extends GraphDef>(\n tx: TransactionContext<G>,\n kind: string,\n): DynamicNodeCollection {\n const collection = tx.getNodeCollection(kind);\n if (collection !== undefined) return collection;\n throw new ConfigurationError(\n `Provenance source kind \"${kind}\" is not available on this transaction.`,\n { kind },\n );\n}\n\nasync function setSourceRetractionState<G extends GraphDef>(\n tx: TransactionContext<G>,\n config: NormalizedConfig,\n source: ProvenanceNodeRef,\n retracted: boolean,\n): Promise<void> {\n const collection = getTransactionNodeCollection(tx, source.kind);\n await collection.update(source.id, { [config.retractedField]: retracted });\n}\n\nasync function runTransition<\n G extends GraphDef,\n SourceKind extends NodeKind<G>,\n FactKind extends NodeKind<G>,\n JustificationKind extends NodeKind<G>,\n>(\n store: HistoryStore<G>,\n config: NormalizedConfig,\n sources: readonly ProvenanceNodeRef<G, SourceKind>[],\n retracted: boolean,\n): Promise<RetractionReport<G, FactKind, JustificationKind>> {\n const uniqueSources = uniqueNodeReferences(sources);\n for (const source of uniqueSources) {\n if (config.sourceKinds.includes(source.kind)) continue;\n throw new ConfigurationError(\n `Provenance retraction source must be one of: ${config.sourceKinds.join(\", \")}.`,\n { expectedKinds: config.sourceKinds, actualKind: source.kind },\n );\n }\n\n return store.transaction(async (tx) => {\n const backend = transactionBackend(tx);\n // Serialize the whole read-compute-write transition per graph BEFORE the\n // first read. `store.transaction` itself takes no lock (write operations\n // acquire it at their own boundaries), but a transition's support\n // snapshot must not race a concurrent transition or history write, so\n // the per-graph write lock is acquired explicitly up front. The token is\n // the evidence the currency-sync pipeline steps require.\n const lock = await lockRecordedGraphWrite(backend, store.graphId);\n const rows = await Promise.all(\n uniqueSources.map((source) =>\n backend.getNode(store.graphId, source.kind, source.id),\n ),\n );\n const sourceRows = uniqueSources.map((source, index): SourceRow<G> => {\n const sourceRow = rows[index];\n if (sourceRow === undefined || sourceRow.deleted_at !== undefined) {\n throw new NodeNotFoundError(source.kind, source.id);\n }\n return { source, row: sourceRow };\n });\n\n // Load the provenance graph once. Its structure (justifications, facts,\n // premise/derive edges) is identical before and after the transition — only\n // source availability changes — so the pre- and post-flip snapshots share\n // this read instead of scanning the whole graph twice per retraction.\n const supportGraph = await loadSupportGraph(backend, store.graphId, config);\n const availableBefore = availableSourceKeys(\n supportGraph.sourceRows,\n config.retractedField,\n );\n const before = computeSupportSnapshot(supportGraph, availableBefore);\n\n const nextState: SourceRetractedState =\n retracted ? \"retracted\" : \"available\";\n const availableAfter = new Set(availableBefore);\n for (const { source, row } of sourceRows) {\n const currentState = sourceRetractedState(row, config.retractedField);\n if (currentState === nextState) continue;\n await setSourceRetractionState(tx, config, source, retracted);\n // Mirror the flip in the in-memory availability so `after` matches the\n // source rows now persisted, without re-reading the whole graph.\n if (nextState === \"available\") {\n availableAfter.add(refKey(source));\n } else {\n availableAfter.delete(refKey(source));\n }\n }\n const after = computeSupportSnapshot(supportGraph, availableAfter);\n const affected = after.affectedFactKeys(uniqueSources);\n await synchronizeFactCurrency(\n backend,\n store,\n transactionNodeOperationHookRunner(tx),\n after,\n affected,\n lock,\n );\n return buildReport<G, FactKind, JustificationKind>(before, after, affected);\n });\n}\n\nfunction uniqueNodeReferences<\n G extends GraphDef,\n K extends NodeKind<G> = NodeKind<G>,\n>(references: readonly ProvenanceNodeRef<G, K>[]): ProvenanceNodeRef<G, K>[] {\n const byKey = new Map<string, ProvenanceNodeRef<G, K>>();\n for (const reference of references) {\n byKey.set(refKey(reference), reference);\n }\n return [...byKey.values()];\n}\n\nexport function createRetractionCapability<\n G extends GraphDef,\n const C extends ProvenanceRetractionConfig<G>,\n>(\n store: HistoryStore<G>,\n config: C,\n): RetractionCapability<\n G,\n SourceKindsFromConfig<G, C>,\n FactKindsFromConfig<G, C>,\n JustificationKindFromConfig<G, C>\n> {\n assertRetractionHistoryEnabled(store);\n const normalized = normalizeConfig(store.graph, config);\n\n // The four retract verbs differ only in one/many source shape and the target\n // retracted flag; the generics are fixed by the config, so hoist one call.\n const transition = (\n sources: readonly ProvenanceNodeRef<G, SourceKindsFromConfig<G, C>>[],\n retracted: boolean,\n ) =>\n runTransition<\n G,\n SourceKindsFromConfig<G, C>,\n FactKindsFromConfig<G, C>,\n JustificationKindFromConfig<G, C>\n >(store, normalized, sources, retracted);\n\n return {\n retract: (source) => transition([source], true),\n retractMany: (sources) => transition(sources, true),\n unRetract: (source) => transition([source], false),\n unRetractMany: (sources) => transition(sources, false),\n\n async holding() {\n return store.transaction(async (tx) => {\n const backend = transactionBackend(tx);\n // Same explicit lock as runTransition: the support computation reads\n // several relations, and PostgreSQL's READ COMMITTED gives each\n // statement its own snapshot — without the lock a concurrent\n // transition could commit between those reads and tear the view.\n await lockRecordedGraphWrite(backend, store.graphId);\n const snapshot = await computeSupport(\n backend,\n store.graphId,\n normalized,\n );\n return sortedReferences<G, FactKindsFromConfig<G, C>>(\n snapshot.believedFactKeys,\n );\n });\n },\n };\n}\n\nfunction assertRetractionHistoryEnabled(\n store: Readonly<{ historyEnabled: boolean; graphId: string }>,\n): void {\n if (!store.historyEnabled) {\n throw new ConfigurationError(\n \"createRetractionCapability requires a store created with { history: true }.\",\n { graphId: store.graphId },\n {\n suggestion:\n \"Use createStoreWithSchema(graph, backend, { history: true }) so retraction mutations are captured and queryable with asOfRecorded().\",\n },\n );\n }\n}\n"]}
@@ -1,140 +1,141 @@
1
1
  'use strict';
2
2
 
3
- var chunk2BIG7U6E_cjs = require('../chunk-2BIG7U6E.cjs');
4
- var chunk2VLBGQBY_cjs = require('../chunk-2VLBGQBY.cjs');
5
- require('../chunk-TRF4EBJT.cjs');
6
- require('../chunk-EE7N5XXQ.cjs');
7
- var chunkKKYELPZ2_cjs = require('../chunk-KKYELPZ2.cjs');
8
- require('../chunk-ACSVZPK7.cjs');
9
- require('../chunk-WBUFJ7BS.cjs');
10
- require('../chunk-QB6VMOJ2.cjs');
11
- require('../chunk-ZTAJL4DT.cjs');
12
- require('../chunk-A2I2XO52.cjs');
3
+ var chunkXQSCL77R_cjs = require('../chunk-XQSCL77R.cjs');
4
+ var chunkN3257XE6_cjs = require('../chunk-N3257XE6.cjs');
5
+ require('../chunk-NK5Q7UNE.cjs');
6
+ var chunkXNLIZYRZ_cjs = require('../chunk-XNLIZYRZ.cjs');
7
+ require('../chunk-XMQSEJCF.cjs');
8
+ require('../chunk-PWLJ77UV.cjs');
9
+ require('../chunk-BSFJMMV3.cjs');
10
+ require('../chunk-NFCVHQ5P.cjs');
11
+ require('../chunk-XBYVV3MP.cjs');
12
+ require('../chunk-CXBHOOIQ.cjs');
13
+ require('../chunk-E4WNQBEF.cjs');
14
+ require('../chunk-Q7Q4WSLJ.cjs');
15
+ require('../chunk-U63GDNRC.cjs');
13
16
  require('../chunk-ZY4GXIVN.cjs');
14
17
  require('../chunk-NAUA4PW5.cjs');
15
- require('../chunk-OVUUTCPJ.cjs');
16
- require('../chunk-U5W4LKZV.cjs');
17
- require('../chunk-FJMPR3OH.cjs');
18
- require('../chunk-SJDMVITW.cjs');
19
- require('../chunk-764JHTLT.cjs');
18
+ require('../chunk-4UGOKMI5.cjs');
19
+ require('../chunk-VCRRKBLN.cjs');
20
+ require('../chunk-7EO3TCQB.cjs');
21
+ require('../chunk-RT5ZY4XA.cjs');
20
22
  require('../chunk-HAHNRASW.cjs');
21
- require('../chunk-QYWINYEA.cjs');
22
- require('../chunk-SVJ5GEXW.cjs');
23
- require('../chunk-HOHAJ2NR.cjs');
24
- require('../chunk-DI74SMXS.cjs');
25
- require('../chunk-A4PBRX4C.cjs');
26
- require('../chunk-C4F7VJ5D.cjs');
27
- require('../chunk-TDXIBCGY.cjs');
23
+ require('../chunk-7BQXPCGN.cjs');
24
+ require('../chunk-XUO3KQFO.cjs');
25
+ require('../chunk-LBJKZXDE.cjs');
26
+ require('../chunk-NI72YOJB.cjs');
27
+ require('../chunk-A7J2YDDI.cjs');
28
+ require('../chunk-N66HCGCY.cjs');
28
29
 
29
30
 
30
31
 
31
32
  Object.defineProperty(exports, "deserializeSchema", {
32
33
  enumerable: true,
33
- get: function () { return chunk2BIG7U6E_cjs.deserializeSchema; }
34
+ get: function () { return chunkXQSCL77R_cjs.deserializeSchema; }
34
35
  });
35
36
  Object.defineProperty(exports, "applyDeprecatedKinds", {
36
37
  enumerable: true,
37
- get: function () { return chunk2VLBGQBY_cjs.applyDeprecatedKinds; }
38
+ get: function () { return chunkN3257XE6_cjs.applyDeprecatedKinds; }
38
39
  });
39
40
  Object.defineProperty(exports, "assertSchemaCurrent", {
40
41
  enumerable: true,
41
- get: function () { return chunk2VLBGQBY_cjs.assertSchemaCurrent; }
42
+ get: function () { return chunkN3257XE6_cjs.assertSchemaCurrent; }
42
43
  });
43
44
  Object.defineProperty(exports, "classifySchemaChanges", {
44
45
  enumerable: true,
45
- get: function () { return chunk2VLBGQBY_cjs.classifySchemaChanges; }
46
+ get: function () { return chunkN3257XE6_cjs.classifySchemaChanges; }
46
47
  });
47
48
  Object.defineProperty(exports, "computeSchemaDiff", {
48
49
  enumerable: true,
49
- get: function () { return chunk2VLBGQBY_cjs.computeSchemaDiff; }
50
+ get: function () { return chunkN3257XE6_cjs.computeSchemaDiff; }
50
51
  });
51
52
  Object.defineProperty(exports, "computeSchemaHash", {
52
53
  enumerable: true,
53
- get: function () { return chunk2VLBGQBY_cjs.computeSchemaHash; }
54
+ get: function () { return chunkN3257XE6_cjs.computeSchemaHash; }
54
55
  });
55
56
  Object.defineProperty(exports, "deserializeWherePredicate", {
56
57
  enumerable: true,
57
- get: function () { return chunk2VLBGQBY_cjs.deserializeWherePredicate; }
58
+ get: function () { return chunkN3257XE6_cjs.deserializeWherePredicate; }
58
59
  });
59
60
  Object.defineProperty(exports, "ensureSchema", {
60
61
  enumerable: true,
61
- get: function () { return chunk2VLBGQBY_cjs.ensureSchema; }
62
+ get: function () { return chunkN3257XE6_cjs.ensureSchema; }
62
63
  });
63
64
  Object.defineProperty(exports, "getActiveSchema", {
64
65
  enumerable: true,
65
- get: function () { return chunk2VLBGQBY_cjs.getActiveSchema; }
66
+ get: function () { return chunkN3257XE6_cjs.getActiveSchema; }
66
67
  });
67
68
  Object.defineProperty(exports, "getCommittedSchemaVersion", {
68
69
  enumerable: true,
69
- get: function () { return chunk2VLBGQBY_cjs.getCommittedSchemaVersion; }
70
+ get: function () { return chunkN3257XE6_cjs.getCommittedSchemaVersion; }
70
71
  });
71
72
  Object.defineProperty(exports, "getMigrationActions", {
72
73
  enumerable: true,
73
- get: function () { return chunk2VLBGQBY_cjs.getMigrationActions; }
74
+ get: function () { return chunkN3257XE6_cjs.getMigrationActions; }
74
75
  });
75
76
  Object.defineProperty(exports, "getSchemaChanges", {
76
77
  enumerable: true,
77
- get: function () { return chunk2VLBGQBY_cjs.getSchemaChanges; }
78
+ get: function () { return chunkN3257XE6_cjs.getSchemaChanges; }
78
79
  });
79
80
  Object.defineProperty(exports, "initializeSchema", {
80
81
  enumerable: true,
81
- get: function () { return chunk2VLBGQBY_cjs.initializeSchema; }
82
+ get: function () { return chunkN3257XE6_cjs.initializeSchema; }
82
83
  });
83
84
  Object.defineProperty(exports, "isBackwardsCompatible", {
84
85
  enumerable: true,
85
- get: function () { return chunk2VLBGQBY_cjs.isBackwardsCompatible; }
86
+ get: function () { return chunkN3257XE6_cjs.isBackwardsCompatible; }
86
87
  });
87
88
  Object.defineProperty(exports, "isSchemaInitialized", {
88
89
  enumerable: true,
89
- get: function () { return chunk2VLBGQBY_cjs.isSchemaInitialized; }
90
+ get: function () { return chunkN3257XE6_cjs.isSchemaInitialized; }
90
91
  });
91
92
  Object.defineProperty(exports, "loadActiveSchemaWithBootstrap", {
92
93
  enumerable: true,
93
- get: function () { return chunk2VLBGQBY_cjs.loadActiveSchemaWithBootstrap; }
94
+ get: function () { return chunkN3257XE6_cjs.loadActiveSchemaWithBootstrap; }
94
95
  });
95
96
  Object.defineProperty(exports, "loadAndMergeGraphExtensionDocument", {
96
97
  enumerable: true,
97
- get: function () { return chunk2VLBGQBY_cjs.loadAndMergeGraphExtensionDocument; }
98
+ get: function () { return chunkN3257XE6_cjs.loadAndMergeGraphExtensionDocument; }
98
99
  });
99
100
  Object.defineProperty(exports, "migrateSchema", {
100
101
  enumerable: true,
101
- get: function () { return chunk2VLBGQBY_cjs.migrateSchema; }
102
+ get: function () { return chunkN3257XE6_cjs.migrateSchema; }
102
103
  });
103
104
  Object.defineProperty(exports, "parseSerializedSchema", {
104
105
  enumerable: true,
105
- get: function () { return chunk2VLBGQBY_cjs.parseSerializedSchema; }
106
+ get: function () { return chunkN3257XE6_cjs.parseSerializedSchema; }
106
107
  });
107
108
  Object.defineProperty(exports, "requiresMigration", {
108
109
  enumerable: true,
109
- get: function () { return chunk2VLBGQBY_cjs.requiresMigration; }
110
+ get: function () { return chunkN3257XE6_cjs.requiresMigration; }
110
111
  });
111
112
  Object.defineProperty(exports, "rollbackSchema", {
112
113
  enumerable: true,
113
- get: function () { return chunk2VLBGQBY_cjs.rollbackSchema; }
114
+ get: function () { return chunkN3257XE6_cjs.rollbackSchema; }
114
115
  });
115
116
  Object.defineProperty(exports, "serializeSchema", {
116
117
  enumerable: true,
117
- get: function () { return chunk2VLBGQBY_cjs.serializeSchema; }
118
+ get: function () { return chunkN3257XE6_cjs.serializeSchema; }
118
119
  });
119
120
  Object.defineProperty(exports, "createValidationError", {
120
121
  enumerable: true,
121
- get: function () { return chunkKKYELPZ2_cjs.createValidationError; }
122
+ get: function () { return chunkXNLIZYRZ_cjs.createValidationError; }
122
123
  });
123
124
  Object.defineProperty(exports, "validateEdgeProps", {
124
125
  enumerable: true,
125
- get: function () { return chunkKKYELPZ2_cjs.validateEdgeProps; }
126
+ get: function () { return chunkXNLIZYRZ_cjs.validateEdgeProps; }
126
127
  });
127
128
  Object.defineProperty(exports, "validateNodeProps", {
128
129
  enumerable: true,
129
- get: function () { return chunkKKYELPZ2_cjs.validateNodeProps; }
130
+ get: function () { return chunkXNLIZYRZ_cjs.validateNodeProps; }
130
131
  });
131
132
  Object.defineProperty(exports, "validateProps", {
132
133
  enumerable: true,
133
- get: function () { return chunkKKYELPZ2_cjs.validateProps; }
134
+ get: function () { return chunkXNLIZYRZ_cjs.validateProps; }
134
135
  });
135
136
  Object.defineProperty(exports, "wrapZodError", {
136
137
  enumerable: true,
137
- get: function () { return chunkKKYELPZ2_cjs.wrapZodError; }
138
+ get: function () { return chunkXNLIZYRZ_cjs.wrapZodError; }
138
139
  });
139
140
  //# sourceMappingURL=index.cjs.map
140
141
  //# sourceMappingURL=index.cjs.map
@@ -1,19 +1,10 @@
1
- import { z as SerializedNodeDef, H as SerializedEdgeDef, M as SerializedMetaEdge, P as SerializedOntologyRelation, U as SerializedClosures, y as SerializedSchema, W as SchemaHash, X as NullCheckOp, K as KindEntity } from '../types-Cjvkj0jA.cjs';
2
- export { C as ContributionDiagnostic, a as ContributionDiagnosticState, Y as JsonSchema, Z as SerializedOntology, _ as SerializedUniqueConstraint } from '../types-Cjvkj0jA.cjs';
3
- import { K as KindRegistry } from '../manager-Cn0NFIhN.cjs';
4
- export { M as MigrateSchemaOptions, a as MigrationHookContext, S as SchemaManagerOptions, b as SchemaValidationResult, c as applyDeprecatedKinds, d as assertSchemaCurrent, e as ensureSchema, g as getActiveSchema, f as getCommittedSchemaVersion, h as getSchemaChanges, i as initializeSchema, j as isSchemaInitialized, l as loadActiveSchemaWithBootstrap, k as loadAndMergeGraphExtensionDocument, m as migrateSchema, p as parseSerializedSchema, r as requiresMigration, n as rollbackSchema } from '../manager-Cn0NFIhN.cjs';
5
- import { G as GraphDef } from '../define-graph-DVF-oN1i.cjs';
6
- export { C as ChangeSeverity, a as ChangeType, D as DeprecatedKindsChange, E as EdgeChange, b as ExtensionChange, I as IndexChange, N as NodeChange, O as OntologyChange, c as SchemaChangeClassification, S as SchemaDiff, d as classifySchemaChanges, e as computeSchemaDiff, g as getMigrationActions, i as isBackwardsCompatible } from '../materialize-indexes-DVRhd5h4.cjs';
1
+ import { D as SerializedNodeDef, H as SerializedEdgeDef, M as SerializedMetaEdge, O as SerializedOntologyRelation, P as SerializedClosures, z as SerializedSchema, U as SchemaHash, W as NullCheckOp, d as GraphDef, K as KindEntity } from '../types-HkveCCx0.cjs';
2
+ export { C as ContributionDiagnostic, a as ContributionDiagnosticState, b as ContributionRepairEntry, c as ContributionRepairResult, G as GraphIdentityConfig, X as JsonSchema, Y as SerializedOntology, Z as SerializedUniqueConstraint } from '../types-HkveCCx0.cjs';
3
+ import { K as KindRegistry } from '../manager-HGk6E_HW.cjs';
4
+ export { M as MigrateSchemaOptions, a as MigrationHookContext, S as SchemaManagerOptions, b as SchemaValidationResult, c as applyDeprecatedKinds, d as assertSchemaCurrent, e as ensureSchema, g as getActiveSchema, f as getCommittedSchemaVersion, h as getSchemaChanges, i as initializeSchema, j as isSchemaInitialized, l as loadActiveSchemaWithBootstrap, k as loadAndMergeGraphExtensionDocument, m as migrateSchema, p as parseSerializedSchema, r as requiresMigration, n as rollbackSchema } from '../manager-HGk6E_HW.cjs';
5
+ export { C as ChangeSeverity, a as ChangeType, D as DeprecatedKindsChange, E as EdgeChange, b as ExtensionChange, I as IdentityChange, c as IndexChange, N as NodeChange, O as OntologyChange, d as SchemaChangeClassification, S as SchemaDiff, e as classifySchemaChanges, f as computeSchemaDiff, g as getMigrationActions, i as isBackwardsCompatible } from '../materialize-indexes-6A7dWGtb.cjs';
7
6
  import { ZodType, ZodError } from 'zod';
8
- import { V as ValidationIssue, a as ValidationError } from '../index-DcQ3Sxs-.cjs';
9
-
10
- /**
11
- * Schema deserializer for loading stored schemas.
12
- *
13
- * Reconstructs runtime objects from SerializedSchema.
14
- * Note: Zod schemas cannot be fully reconstructed from JSON Schema,
15
- * so this provides access to the serialized data for introspection.
16
- */
7
+ import { V as ValidationIssue, a as ValidationError } from '../index-DxaYCv8Y.cjs';
17
8
 
18
9
  /**
19
10
  * A deserialized schema provides read-only access to schema metadata.
@@ -44,9 +35,11 @@ type DeserializedSchema = Readonly<{
44
35
  getClosures: () => SerializedClosures;
45
36
  /** Get graph defaults */
46
37
  getDefaults: () => SerializedSchema["defaults"];
38
+ /** Get the durable TypeGraph Identity Profile configuration. */
39
+ getIdentity: () => SerializedSchema["identity"];
47
40
  /** Get the raw serialized schema */
48
41
  getRaw: () => SerializedSchema;
49
- /** Build a KindRegistry from the closures */
42
+ /** Build a validated KindRegistry by recomputing closures from relations */
50
43
  buildRegistry: () => KindRegistry;
51
44
  }>;
52
45
  /**
@@ -1,19 +1,10 @@
1
- import { z as SerializedNodeDef, H as SerializedEdgeDef, M as SerializedMetaEdge, P as SerializedOntologyRelation, U as SerializedClosures, y as SerializedSchema, W as SchemaHash, X as NullCheckOp, K as KindEntity } from '../types-Cjvkj0jA.js';
2
- export { C as ContributionDiagnostic, a as ContributionDiagnosticState, Y as JsonSchema, Z as SerializedOntology, _ as SerializedUniqueConstraint } from '../types-Cjvkj0jA.js';
3
- import { K as KindRegistry } from '../manager-B0KjKE93.js';
4
- export { M as MigrateSchemaOptions, a as MigrationHookContext, S as SchemaManagerOptions, b as SchemaValidationResult, c as applyDeprecatedKinds, d as assertSchemaCurrent, e as ensureSchema, g as getActiveSchema, f as getCommittedSchemaVersion, h as getSchemaChanges, i as initializeSchema, j as isSchemaInitialized, l as loadActiveSchemaWithBootstrap, k as loadAndMergeGraphExtensionDocument, m as migrateSchema, p as parseSerializedSchema, r as requiresMigration, n as rollbackSchema } from '../manager-B0KjKE93.js';
5
- import { G as GraphDef } from '../define-graph-SvYXOl78.js';
6
- export { C as ChangeSeverity, a as ChangeType, D as DeprecatedKindsChange, E as EdgeChange, b as ExtensionChange, I as IndexChange, N as NodeChange, O as OntologyChange, c as SchemaChangeClassification, S as SchemaDiff, d as classifySchemaChanges, e as computeSchemaDiff, g as getMigrationActions, i as isBackwardsCompatible } from '../materialize-indexes-BD4V3svD.js';
1
+ import { D as SerializedNodeDef, H as SerializedEdgeDef, M as SerializedMetaEdge, O as SerializedOntologyRelation, P as SerializedClosures, z as SerializedSchema, U as SchemaHash, W as NullCheckOp, d as GraphDef, K as KindEntity } from '../types-HkveCCx0.js';
2
+ export { C as ContributionDiagnostic, a as ContributionDiagnosticState, b as ContributionRepairEntry, c as ContributionRepairResult, G as GraphIdentityConfig, X as JsonSchema, Y as SerializedOntology, Z as SerializedUniqueConstraint } from '../types-HkveCCx0.js';
3
+ import { K as KindRegistry } from '../manager-CfZAimti.js';
4
+ export { M as MigrateSchemaOptions, a as MigrationHookContext, S as SchemaManagerOptions, b as SchemaValidationResult, c as applyDeprecatedKinds, d as assertSchemaCurrent, e as ensureSchema, g as getActiveSchema, f as getCommittedSchemaVersion, h as getSchemaChanges, i as initializeSchema, j as isSchemaInitialized, l as loadActiveSchemaWithBootstrap, k as loadAndMergeGraphExtensionDocument, m as migrateSchema, p as parseSerializedSchema, r as requiresMigration, n as rollbackSchema } from '../manager-CfZAimti.js';
5
+ export { C as ChangeSeverity, a as ChangeType, D as DeprecatedKindsChange, E as EdgeChange, b as ExtensionChange, I as IdentityChange, c as IndexChange, N as NodeChange, O as OntologyChange, d as SchemaChangeClassification, S as SchemaDiff, e as classifySchemaChanges, f as computeSchemaDiff, g as getMigrationActions, i as isBackwardsCompatible } from '../materialize-indexes-BMJP6Tms.js';
7
6
  import { ZodType, ZodError } from 'zod';
8
- import { V as ValidationIssue, a as ValidationError } from '../index-By89Sezh.js';
9
-
10
- /**
11
- * Schema deserializer for loading stored schemas.
12
- *
13
- * Reconstructs runtime objects from SerializedSchema.
14
- * Note: Zod schemas cannot be fully reconstructed from JSON Schema,
15
- * so this provides access to the serialized data for introspection.
16
- */
7
+ import { V as ValidationIssue, a as ValidationError } from '../index-BSHvKfok.js';
17
8
 
18
9
  /**
19
10
  * A deserialized schema provides read-only access to schema metadata.
@@ -44,9 +35,11 @@ type DeserializedSchema = Readonly<{
44
35
  getClosures: () => SerializedClosures;
45
36
  /** Get graph defaults */
46
37
  getDefaults: () => SerializedSchema["defaults"];
38
+ /** Get the durable TypeGraph Identity Profile configuration. */
39
+ getIdentity: () => SerializedSchema["identity"];
47
40
  /** Get the raw serialized schema */
48
41
  getRaw: () => SerializedSchema;
49
- /** Build a KindRegistry from the closures */
42
+ /** Build a validated KindRegistry by recomputing closures from relations */
50
43
  buildRegistry: () => KindRegistry;
51
44
  }>;
52
45
  /**
@@ -1,27 +1,28 @@
1
- export { deserializeSchema } from '../chunk-IIMQJYAM.js';
2
- export { applyDeprecatedKinds, assertSchemaCurrent, classifySchemaChanges, computeSchemaDiff, computeSchemaHash, deserializeWherePredicate, ensureSchema, getActiveSchema, getCommittedSchemaVersion, getMigrationActions, getSchemaChanges, initializeSchema, isBackwardsCompatible, isSchemaInitialized, loadActiveSchemaWithBootstrap, loadAndMergeGraphExtensionDocument, migrateSchema, parseSerializedSchema, requiresMigration, rollbackSchema, serializeSchema } from '../chunk-BEFM74L2.js';
3
- import '../chunk-DRACN6XG.js';
4
- import '../chunk-2Y4IFKW7.js';
5
- export { createValidationError, validateEdgeProps, validateNodeProps, validateProps, wrapZodError } from '../chunk-DK2S42XB.js';
6
- import '../chunk-UR7W5YQK.js';
7
- import '../chunk-B75XRV3O.js';
8
- import '../chunk-S4KQ5LV4.js';
9
- import '../chunk-KCO5EFJU.js';
10
- import '../chunk-TFMVL4QH.js';
1
+ export { deserializeSchema } from '../chunk-CNV4TXJG.js';
2
+ export { applyDeprecatedKinds, assertSchemaCurrent, classifySchemaChanges, computeSchemaDiff, computeSchemaHash, deserializeWherePredicate, ensureSchema, getActiveSchema, getCommittedSchemaVersion, getMigrationActions, getSchemaChanges, initializeSchema, isBackwardsCompatible, isSchemaInitialized, loadActiveSchemaWithBootstrap, loadAndMergeGraphExtensionDocument, migrateSchema, parseSerializedSchema, requiresMigration, rollbackSchema, serializeSchema } from '../chunk-QLRESYPU.js';
3
+ import '../chunk-JXA2ZP2Q.js';
4
+ export { createValidationError, validateEdgeProps, validateNodeProps, validateProps, wrapZodError } from '../chunk-JIVMTW7W.js';
5
+ import '../chunk-NQ6BRJBE.js';
6
+ import '../chunk-JBQQ7THH.js';
7
+ import '../chunk-JZUR7ZWE.js';
8
+ import '../chunk-MSY7FSX4.js';
9
+ import '../chunk-AKLS3BYZ.js';
10
+ import '../chunk-775A4ZMN.js';
11
+ import '../chunk-WDGA7IYB.js';
12
+ import '../chunk-DLNROMQ7.js';
13
+ import '../chunk-I5MOXA4H.js';
11
14
  import '../chunk-K34OPSJK.js';
12
15
  import '../chunk-2EBMPJBO.js';
13
- import '../chunk-K3BUWSFR.js';
14
- import '../chunk-6DCB664D.js';
15
- import '../chunk-D7PG5D5K.js';
16
- import '../chunk-SNXVDZAJ.js';
17
- import '../chunk-QMQLUA66.js';
16
+ import '../chunk-YDFDBE6D.js';
17
+ import '../chunk-PQBQG7IM.js';
18
+ import '../chunk-AMKPPFUO.js';
19
+ import '../chunk-W6OG3HDG.js';
18
20
  import '../chunk-PC2UBAUB.js';
19
- import '../chunk-IJTLXNGJ.js';
20
- import '../chunk-GYA4JRP5.js';
21
- import '../chunk-2WDD2NO3.js';
22
- import '../chunk-ITE4IXAK.js';
23
- import '../chunk-TVLKA4AY.js';
24
- import '../chunk-4MB3AQAQ.js';
25
- import '../chunk-G6Q5UM7U.js';
21
+ import '../chunk-T4XNKYXB.js';
22
+ import '../chunk-JXXDZTMN.js';
23
+ import '../chunk-K5ELX2GT.js';
24
+ import '../chunk-J3WZ3FA2.js';
25
+ import '../chunk-FWJKWH6U.js';
26
+ import '../chunk-DYATYRY4.js';
26
27
  //# sourceMappingURL=index.js.map
27
28
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { v as VectorSlot } from './types-Cjvkj0jA.js';
3
- import { G as GraphDef } from './define-graph-SvYXOl78.js';
2
+ import { d as GraphDef, t as VectorSlot } from './types-HkveCCx0.js';
4
3
 
5
4
  /**
6
5
  * Embedding type for vector search.