@nicia-ai/typegraph 0.33.0 → 0.35.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 (284) hide show
  1. package/README.md +20 -0
  2. package/dist/backend/postgres/index.cjs +30 -26
  3. package/dist/backend/postgres/index.d.cts +39 -7
  4. package/dist/backend/postgres/index.d.ts +39 -7
  5. package/dist/backend/postgres/index.js +17 -13
  6. package/dist/backend/postgres/pglite.cjs +22 -18
  7. package/dist/backend/postgres/pglite.cjs.map +1 -1
  8. package/dist/backend/postgres/pglite.d.cts +4 -4
  9. package/dist/backend/postgres/pglite.d.ts +4 -4
  10. package/dist/backend/postgres/pglite.js +17 -13
  11. package/dist/backend/postgres/pglite.js.map +1 -1
  12. package/dist/backend/sqlite/index.cjs +26 -23
  13. package/dist/backend/sqlite/index.d.cts +8 -8
  14. package/dist/backend/sqlite/index.d.ts +8 -8
  15. package/dist/backend/sqlite/index.js +14 -11
  16. package/dist/backend/sqlite/libsql.cjs +21 -17
  17. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  18. package/dist/backend/sqlite/libsql.d.cts +13 -6
  19. package/dist/backend/sqlite/libsql.d.ts +13 -6
  20. package/dist/backend/sqlite/libsql.js +17 -13
  21. package/dist/backend/sqlite/libsql.js.map +1 -1
  22. package/dist/backend/sqlite/local.cjs +102 -18
  23. package/dist/backend/sqlite/local.cjs.map +1 -1
  24. package/dist/backend/sqlite/local.d.cts +95 -5
  25. package/dist/backend/sqlite/local.d.ts +95 -5
  26. package/dist/backend/sqlite/local.js +96 -13
  27. package/dist/backend/sqlite/local.js.map +1 -1
  28. package/dist/{chunk-JHOBXD7O.js → chunk-3TWF3SH4.js} +332 -64
  29. package/dist/chunk-3TWF3SH4.js.map +1 -0
  30. package/dist/chunk-4JEZZJ6S.cjs +1271 -0
  31. package/dist/chunk-4JEZZJ6S.cjs.map +1 -0
  32. package/dist/{chunk-I4W7MKVG.cjs → chunk-4TOD4LBZ.cjs} +249 -294
  33. package/dist/chunk-4TOD4LBZ.cjs.map +1 -0
  34. package/dist/chunk-55MZDDZV.js +239 -0
  35. package/dist/chunk-55MZDDZV.js.map +1 -0
  36. package/dist/{chunk-LM2IC4ZJ.cjs → chunk-5A6FNS6N.cjs} +75 -19
  37. package/dist/chunk-5A6FNS6N.cjs.map +1 -0
  38. package/dist/{chunk-FDN43KXV.cjs → chunk-5AQIKK56.cjs} +65 -24
  39. package/dist/chunk-5AQIKK56.cjs.map +1 -0
  40. package/dist/{chunk-IZ4PCL47.js → chunk-5SEGFTZX.js} +4 -66
  41. package/dist/chunk-5SEGFTZX.js.map +1 -0
  42. package/dist/{chunk-CWFPJ3RC.js → chunk-6FR2MMS6.js} +7 -7
  43. package/dist/chunk-6FR2MMS6.js.map +1 -0
  44. package/dist/chunk-7YSP4V4R.cjs +69 -0
  45. package/dist/chunk-7YSP4V4R.cjs.map +1 -0
  46. package/dist/chunk-A42GCBGX.cjs +28 -0
  47. package/dist/chunk-A42GCBGX.cjs.map +1 -0
  48. package/dist/chunk-ACSVZPK7.cjs +21 -0
  49. package/dist/chunk-ACSVZPK7.cjs.map +1 -0
  50. package/dist/{chunk-OIE2UPVG.cjs → chunk-BLZDPRXT.cjs} +52 -21
  51. package/dist/chunk-BLZDPRXT.cjs.map +1 -0
  52. package/dist/chunk-BYPOGQWK.js +25 -0
  53. package/dist/chunk-BYPOGQWK.js.map +1 -0
  54. package/dist/{chunk-NG5N7R45.cjs → chunk-CK5BVQOW.cjs} +325 -213
  55. package/dist/chunk-CK5BVQOW.cjs.map +1 -0
  56. package/dist/chunk-CTTSDJLY.cjs +261 -0
  57. package/dist/chunk-CTTSDJLY.cjs.map +1 -0
  58. package/dist/chunk-CUHM5CWJ.cjs +12 -0
  59. package/dist/chunk-CUHM5CWJ.cjs.map +1 -0
  60. package/dist/chunk-CZQ3FO2Q.js +2320 -0
  61. package/dist/chunk-CZQ3FO2Q.js.map +1 -0
  62. package/dist/{chunk-CFNT3ITG.cjs → chunk-D7ZEOS56.cjs} +25 -52
  63. package/dist/chunk-D7ZEOS56.cjs.map +1 -0
  64. package/dist/chunk-DFVLCOP6.js +10 -0
  65. package/dist/chunk-DFVLCOP6.js.map +1 -0
  66. package/dist/chunk-DI74SMXS.cjs +29 -0
  67. package/dist/chunk-DI74SMXS.cjs.map +1 -0
  68. package/dist/{chunk-KY5SDVA7.cjs → chunk-EM3CWPND.cjs} +442 -113
  69. package/dist/chunk-EM3CWPND.cjs.map +1 -0
  70. package/dist/chunk-EMF62TZG.cjs +1176 -0
  71. package/dist/chunk-EMF62TZG.cjs.map +1 -0
  72. package/dist/chunk-EOLERH7Y.cjs +40 -0
  73. package/dist/chunk-EOLERH7Y.cjs.map +1 -0
  74. package/dist/{chunk-3QRBXYT5.cjs → chunk-FACJJWGF.cjs} +24 -6
  75. package/dist/chunk-FACJJWGF.cjs.map +1 -0
  76. package/dist/{chunk-KTIEB7VH.cjs → chunk-FL472AMI.cjs} +49 -165
  77. package/dist/chunk-FL472AMI.cjs.map +1 -0
  78. package/dist/{chunk-4RBAJVEC.cjs → chunk-FN35DLCN.cjs} +31 -9
  79. package/dist/chunk-FN35DLCN.cjs.map +1 -0
  80. package/dist/{chunk-C4C4Q7A6.js → chunk-FPIZFYHE.js} +12 -35
  81. package/dist/chunk-FPIZFYHE.js.map +1 -0
  82. package/dist/{chunk-XKNAK27R.js → chunk-FRV5Q5IO.js} +64 -8
  83. package/dist/chunk-FRV5Q5IO.js.map +1 -0
  84. package/dist/{chunk-K5P5OZXS.js → chunk-G6Q5UM7U.js} +2 -2
  85. package/dist/{chunk-K5P5OZXS.js.map → chunk-G6Q5UM7U.js.map} +1 -1
  86. package/dist/chunk-GSQ6NPH6.cjs +100 -0
  87. package/dist/chunk-GSQ6NPH6.cjs.map +1 -0
  88. package/dist/chunk-GUR2FNB5.cjs +12 -0
  89. package/dist/{chunk-6ZR4QC3O.cjs.map → chunk-GUR2FNB5.cjs.map} +1 -1
  90. package/dist/{chunk-ZFWNO3GE.cjs → chunk-H7YNSMA7.cjs} +107 -2
  91. package/dist/chunk-H7YNSMA7.cjs.map +1 -0
  92. package/dist/{chunk-GYVBEZAO.js → chunk-I7ZUZKFD.js} +47 -19
  93. package/dist/chunk-I7ZUZKFD.js.map +1 -0
  94. package/dist/chunk-ITE4IXAK.js +25 -0
  95. package/dist/chunk-ITE4IXAK.js.map +1 -0
  96. package/dist/{chunk-D3EWZ67S.cjs → chunk-J7WFGBJR.cjs} +3372 -4970
  97. package/dist/chunk-J7WFGBJR.cjs.map +1 -0
  98. package/dist/{chunk-PYD3UCDU.js → chunk-JBTOYDMN.js} +202 -251
  99. package/dist/chunk-JBTOYDMN.js.map +1 -0
  100. package/dist/{chunk-XVUJY72M.js → chunk-K3PPLHY7.js} +234 -118
  101. package/dist/chunk-K3PPLHY7.js.map +1 -0
  102. package/dist/{chunk-454I6GDF.js → chunk-KBGQIPRQ.js} +102 -3
  103. package/dist/chunk-KBGQIPRQ.js.map +1 -0
  104. package/dist/chunk-KMI7LYAF.js +1252 -0
  105. package/dist/chunk-KMI7LYAF.js.map +1 -0
  106. package/dist/{chunk-JIEJCTDS.cjs → chunk-LGEALRC6.cjs} +21 -4
  107. package/dist/chunk-LGEALRC6.cjs.map +1 -0
  108. package/dist/{chunk-TQOYM4LN.js → chunk-MP2JQKSG.js} +21 -5
  109. package/dist/chunk-MP2JQKSG.js.map +1 -0
  110. package/dist/{chunk-3642VBVC.cjs → chunk-O7UN7OXA.cjs} +389 -121
  111. package/dist/chunk-O7UN7OXA.cjs.map +1 -0
  112. package/dist/chunk-OHMP6N2J.js +47 -0
  113. package/dist/chunk-OHMP6N2J.js.map +1 -0
  114. package/dist/{chunk-6NRFUHMS.js → chunk-OR5ZA5WP.js} +135 -24
  115. package/dist/chunk-OR5ZA5WP.js.map +1 -0
  116. package/dist/{chunk-PRMKPFN5.js → chunk-Q5TEXCTB.js} +61 -6
  117. package/dist/chunk-Q5TEXCTB.js.map +1 -0
  118. package/dist/chunk-QNKSQTKQ.js +1312 -0
  119. package/dist/chunk-QNKSQTKQ.js.map +1 -0
  120. package/dist/{chunk-YCV72E6L.js → chunk-QOTI55H7.js} +7 -116
  121. package/dist/chunk-QOTI55H7.js.map +1 -0
  122. package/dist/{chunk-QBYTJSAY.js → chunk-QWEUYILR.js} +99 -34
  123. package/dist/chunk-QWEUYILR.js.map +1 -0
  124. package/dist/{chunk-OS6KS3HV.js → chunk-RGP33ZJ5.js} +485 -82
  125. package/dist/chunk-RGP33ZJ5.js.map +1 -0
  126. package/dist/chunk-RGPG7EOJ.js +94 -0
  127. package/dist/chunk-RGPG7EOJ.js.map +1 -0
  128. package/dist/{chunk-WWVV44DY.cjs → chunk-S55OV6PW.cjs} +15 -15
  129. package/dist/chunk-S55OV6PW.cjs.map +1 -0
  130. package/dist/{chunk-3E7SNSIA.cjs → chunk-SJDMVITW.cjs} +4 -4
  131. package/dist/{chunk-3E7SNSIA.cjs.map → chunk-SJDMVITW.cjs.map} +1 -1
  132. package/dist/{chunk-XLUNB2TZ.js → chunk-SNXVDZAJ.js} +3 -3
  133. package/dist/{chunk-XLUNB2TZ.js.map → chunk-SNXVDZAJ.js.map} +1 -1
  134. package/dist/{chunk-CEF2QOTO.js → chunk-T2WUSPDA.js} +49 -8
  135. package/dist/chunk-T2WUSPDA.js.map +1 -0
  136. package/dist/{chunk-YW7GHMF4.cjs → chunk-TCOCYN2P.cjs} +75 -20
  137. package/dist/chunk-TCOCYN2P.cjs.map +1 -0
  138. package/dist/{chunk-FLRCVI2G.cjs → chunk-TDXIBCGY.cjs} +2 -2
  139. package/dist/{chunk-FLRCVI2G.cjs.map → chunk-TDXIBCGY.cjs.map} +1 -1
  140. package/dist/chunk-TEDRJXOG.cjs +32 -0
  141. package/dist/chunk-TEDRJXOG.cjs.map +1 -0
  142. package/dist/{chunk-WLP6TKFB.js → chunk-UES55P7G.js} +2809 -4398
  143. package/dist/chunk-UES55P7G.js.map +1 -0
  144. package/dist/{chunk-EF3Z645U.cjs → chunk-UMDVATGY.cjs} +6 -72
  145. package/dist/chunk-UMDVATGY.cjs.map +1 -0
  146. package/dist/chunk-UR7W5YQK.js +18 -0
  147. package/dist/chunk-UR7W5YQK.js.map +1 -0
  148. package/dist/chunk-UT3S4SEN.js +31 -0
  149. package/dist/chunk-UT3S4SEN.js.map +1 -0
  150. package/dist/{chunk-3IR2GEMJ.cjs → chunk-UUT7UN2N.cjs} +149 -38
  151. package/dist/chunk-UUT7UN2N.cjs.map +1 -0
  152. package/dist/{chunk-PIHXFF73.js → chunk-UZV3AZKF.js} +21 -3
  153. package/dist/chunk-UZV3AZKF.js.map +1 -0
  154. package/dist/{chunk-DJYRRDHA.js → chunk-VHMPG6UL.js} +29 -7
  155. package/dist/chunk-VHMPG6UL.js.map +1 -0
  156. package/dist/{chunk-MBLXCV2Y.cjs → chunk-VPYHY3LJ.cjs} +111 -43
  157. package/dist/chunk-VPYHY3LJ.cjs.map +1 -0
  158. package/dist/{chunk-WYTUF3QO.js → chunk-VSPCZAXF.js} +3 -3
  159. package/dist/{chunk-WYTUF3QO.js.map → chunk-VSPCZAXF.js.map} +1 -1
  160. package/dist/chunk-W63OVYY4.js +29 -0
  161. package/dist/chunk-W63OVYY4.js.map +1 -0
  162. package/dist/{chunk-UPDMJEW6.js → chunk-WDBCBWC4.js} +356 -30
  163. package/dist/chunk-WDBCBWC4.js.map +1 -0
  164. package/dist/chunk-WJT7OU7E.cjs +1334 -0
  165. package/dist/chunk-WJT7OU7E.cjs.map +1 -0
  166. package/dist/chunk-XOX22WHL.cjs +2383 -0
  167. package/dist/chunk-XOX22WHL.cjs.map +1 -0
  168. package/dist/{ddl-CVnHJcar.d.ts → ddl-C2rZ-Aen.d.ts} +4 -4
  169. package/dist/{ddl-Dxt_fBHr.d.cts → ddl-CZz7a0E8.d.cts} +4 -4
  170. package/dist/{extension-types-YGFJPrzK.d.cts → extension-types-ixRpJVUp.d.cts} +24 -1
  171. package/dist/{extension-types-YGFJPrzK.d.ts → extension-types-ixRpJVUp.d.ts} +24 -1
  172. package/dist/{types-DGylBhWo.d.ts → fulltext-strategy-B57yvC5Q.d.ts} +2558 -2125
  173. package/dist/{types-C_UnQOQp.d.cts → fulltext-strategy-CDkSSYhq.d.cts} +2558 -2125
  174. package/dist/graph-extension/index.cjs +21 -19
  175. package/dist/graph-extension/index.d.cts +4 -4
  176. package/dist/graph-extension/index.d.ts +4 -4
  177. package/dist/graph-extension/index.js +6 -4
  178. package/dist/graph-merge/index.cjs +408 -169
  179. package/dist/graph-merge/index.cjs.map +1 -1
  180. package/dist/graph-merge/index.d.cts +63 -33
  181. package/dist/graph-merge/index.d.ts +63 -33
  182. package/dist/graph-merge/index.js +286 -47
  183. package/dist/graph-merge/index.js.map +1 -1
  184. package/dist/{index-DGX6D9j1.d.ts → index-6CSUAq-x.d.ts} +234 -93
  185. package/dist/{index-SEvUHDA6.d.cts → index-Bks_3HHK.d.cts} +234 -93
  186. package/dist/index.cjs +240 -211
  187. package/dist/index.cjs.map +1 -1
  188. package/dist/index.d.cts +11 -11
  189. package/dist/index.d.ts +11 -11
  190. package/dist/index.js +35 -27
  191. package/dist/index.js.map +1 -1
  192. package/dist/indexes/index.cjs +28 -27
  193. package/dist/indexes/index.d.cts +5 -5
  194. package/dist/indexes/index.d.ts +5 -5
  195. package/dist/indexes/index.js +10 -9
  196. package/dist/interchange/index.cjs +47 -17
  197. package/dist/interchange/index.d.cts +126 -12
  198. package/dist/interchange/index.d.ts +126 -12
  199. package/dist/interchange/index.js +14 -4
  200. package/dist/{manager-BYl_zyZR.d.cts → manager-DwQi8eV0.d.cts} +9 -2
  201. package/dist/{manager-C0_r0ALf.d.ts → manager-ejUCB52T.d.ts} +9 -2
  202. package/dist/{materialize-indexes-D20xNluI.d.cts → materialize-indexes-B4e9360H.d.cts} +20 -4
  203. package/dist/{materialize-indexes-CAkIYFV-.d.ts → materialize-indexes-te9TPMMJ.d.ts} +20 -4
  204. package/dist/{postgres-_9psmVGm.d.cts → postgres-CfEqsRMp.d.cts} +152 -1
  205. package/dist/{postgres-MzBPkYzq.d.ts → postgres-DQ5R6rzV.d.ts} +152 -1
  206. package/dist/profiler/index.cjs +11 -11
  207. package/dist/profiler/index.d.cts +7 -7
  208. package/dist/profiler/index.d.ts +7 -7
  209. package/dist/profiler/index.js +4 -4
  210. package/dist/provenance/index.cjs +590 -0
  211. package/dist/provenance/index.cjs.map +1 -0
  212. package/dist/provenance/index.d.cts +73 -0
  213. package/dist/provenance/index.d.ts +73 -0
  214. package/dist/provenance/index.js +588 -0
  215. package/dist/provenance/index.js.map +1 -0
  216. package/dist/schema/index.cjs +55 -38
  217. package/dist/schema/index.cjs.map +1 -1
  218. package/dist/schema/index.d.cts +57 -57
  219. package/dist/schema/index.d.ts +57 -57
  220. package/dist/schema/index.js +30 -13
  221. package/dist/schema/index.js.map +1 -1
  222. package/dist/{sqlite-gm44dShb.d.ts → sqlite-D7zBinNR.d.cts} +92 -1
  223. package/dist/{sqlite-BfksSb45.d.cts → sqlite-DvQndLky.d.ts} +92 -1
  224. package/dist/{store-view-FfE5_7eo.d.ts → store-view-BSpqvAxK.d.cts} +445 -46
  225. package/dist/{store-view-9jQ2rPum.d.cts → store-view-CKbHFRnn.d.ts} +445 -46
  226. package/dist/{types-B6mhrcLv.d.cts → types-Bv9DcS_E.d.cts} +2 -2
  227. package/dist/{types-CdWxK-nD.d.ts → types-CoxuV7EJ.d.ts} +2 -2
  228. package/dist/{where-Bpp2ul_z.d.cts → where-7RKFOsXt.d.ts} +2 -2
  229. package/dist/{where-BsEXraKW.d.ts → where-DdMIXOtH.d.cts} +2 -2
  230. package/package.json +21 -14
  231. package/dist/chunk-2YMGNYXY.js +0 -40
  232. package/dist/chunk-2YMGNYXY.js.map +0 -1
  233. package/dist/chunk-3642VBVC.cjs.map +0 -1
  234. package/dist/chunk-3EUKJEQ3.js +0 -77
  235. package/dist/chunk-3EUKJEQ3.js.map +0 -1
  236. package/dist/chunk-3IR2GEMJ.cjs.map +0 -1
  237. package/dist/chunk-3QRBXYT5.cjs.map +0 -1
  238. package/dist/chunk-454I6GDF.js.map +0 -1
  239. package/dist/chunk-4RBAJVEC.cjs.map +0 -1
  240. package/dist/chunk-6NRFUHMS.js.map +0 -1
  241. package/dist/chunk-6ZR4QC3O.cjs +0 -12
  242. package/dist/chunk-73KASJGO.cjs +0 -52
  243. package/dist/chunk-73KASJGO.cjs.map +0 -1
  244. package/dist/chunk-BF3ZDEUE.cjs +0 -773
  245. package/dist/chunk-BF3ZDEUE.cjs.map +0 -1
  246. package/dist/chunk-C4C4Q7A6.js.map +0 -1
  247. package/dist/chunk-CEF2QOTO.js.map +0 -1
  248. package/dist/chunk-CFNT3ITG.cjs.map +0 -1
  249. package/dist/chunk-CWFPJ3RC.js.map +0 -1
  250. package/dist/chunk-D3EWZ67S.cjs.map +0 -1
  251. package/dist/chunk-DJYRRDHA.js.map +0 -1
  252. package/dist/chunk-EF3Z645U.cjs.map +0 -1
  253. package/dist/chunk-FDN43KXV.cjs.map +0 -1
  254. package/dist/chunk-GYVBEZAO.js.map +0 -1
  255. package/dist/chunk-HTGDWIDE.cjs +0 -89
  256. package/dist/chunk-HTGDWIDE.cjs.map +0 -1
  257. package/dist/chunk-I4W7MKVG.cjs.map +0 -1
  258. package/dist/chunk-IZ4PCL47.js.map +0 -1
  259. package/dist/chunk-JHOBXD7O.js.map +0 -1
  260. package/dist/chunk-JIEJCTDS.cjs.map +0 -1
  261. package/dist/chunk-KTIEB7VH.cjs.map +0 -1
  262. package/dist/chunk-KY5SDVA7.cjs.map +0 -1
  263. package/dist/chunk-LM2IC4ZJ.cjs.map +0 -1
  264. package/dist/chunk-MBLXCV2Y.cjs.map +0 -1
  265. package/dist/chunk-NG5N7R45.cjs.map +0 -1
  266. package/dist/chunk-OIE2UPVG.cjs.map +0 -1
  267. package/dist/chunk-OS6KS3HV.js.map +0 -1
  268. package/dist/chunk-PIHXFF73.js.map +0 -1
  269. package/dist/chunk-PRMKPFN5.js.map +0 -1
  270. package/dist/chunk-PYD3UCDU.js.map +0 -1
  271. package/dist/chunk-QBYTJSAY.js.map +0 -1
  272. package/dist/chunk-SPT5JMME.js +0 -610
  273. package/dist/chunk-SPT5JMME.js.map +0 -1
  274. package/dist/chunk-SST7XDY6.cjs +0 -624
  275. package/dist/chunk-SST7XDY6.cjs.map +0 -1
  276. package/dist/chunk-TQOYM4LN.js.map +0 -1
  277. package/dist/chunk-UPDMJEW6.js.map +0 -1
  278. package/dist/chunk-WLP6TKFB.js.map +0 -1
  279. package/dist/chunk-WWVV44DY.cjs.map +0 -1
  280. package/dist/chunk-XKNAK27R.js.map +0 -1
  281. package/dist/chunk-XVUJY72M.js.map +0 -1
  282. package/dist/chunk-YCV72E6L.js.map +0 -1
  283. package/dist/chunk-YW7GHMF4.cjs.map +0 -1
  284. package/dist/chunk-ZFWNO3GE.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/provenance/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AA8BA,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;A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C,OAAA,KAAY,UAAA,CAAW,SAAS,KAAK,CAAA;AAAA,IAErD,MAAM,OAAA,GAAU;AACd,MAAA,OAAO,KAAA,CAAM,WAAA,CAAY,OAAO,EAAA,KAAO;AAKrC,QAAA,MAAM,sBAAA,CAAuB,EAAA,CAAG,OAAA,EAAS,KAAA,CAAM,OAAO,CAAA;AACtD,QAAA,MAAM,WAAW,MAAM,cAAA;AAAA,UACrB,EAAA,CAAG,OAAA;AAAA,UACH,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","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} from \"../backend/types\";\nimport type { GraphDef } from \"../core/define-graph\";\nimport type { NodeRegistration } from \"../core/types\";\nimport { ConfigurationError, NodeNotFoundError } from \"../errors\";\nimport type {\n DynamicNodeCollection,\n HistorySafeTransactionBackend,\n HistoryStore,\n HistoryTransactionContext,\n} from \"../store\";\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 { compareStrings } from \"../utils/compare\";\nimport { nowIso } from \"../utils/date\";\nimport { isPlainObject } from \"../utils/object\";\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 * `HistoryTransactionContext[\"runNodeOperationHooks\"]`. 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: HistorySafeTransactionBackend,\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: HistorySafeTransactionBackend,\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: HistorySafeTransactionBackend,\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: HistoryTransactionContext<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: HistoryTransactionContext<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 // 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(tx.backend, store.graphId);\n const rows = await Promise.all(\n uniqueSources.map((source) =>\n tx.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(\n tx.backend,\n store.graphId,\n config,\n );\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 tx.backend,\n store,\n tx.runNodeOperationHooks,\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 const historyEnabled = (store as Readonly<{ historyEnabled: boolean }>)\n .historyEnabled;\n if (!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 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 // 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(tx.backend, store.graphId);\n const snapshot = await computeSupport(\n tx.backend,\n store.graphId,\n normalized,\n );\n return sortedReferences<G, FactKindsFromConfig<G, C>>(\n snapshot.believedFactKeys,\n );\n });\n },\n };\n}\n"]}
@@ -1,16 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var chunkNG5N7R45_cjs = require('../chunk-NG5N7R45.cjs');
4
- require('../chunk-MBLXCV2Y.cjs');
5
- require('../chunk-3IR2GEMJ.cjs');
6
- require('../chunk-EF3Z645U.cjs');
7
- require('../chunk-ZFWNO3GE.cjs');
8
- require('../chunk-KTIEB7VH.cjs');
9
- require('../chunk-OIE2UPVG.cjs');
10
- require('../chunk-73KASJGO.cjs');
11
- require('../chunk-3E7SNSIA.cjs');
12
- require('../chunk-JIEJCTDS.cjs');
13
- require('../chunk-FLRCVI2G.cjs');
3
+ var chunkCK5BVQOW_cjs = require('../chunk-CK5BVQOW.cjs');
4
+ require('../chunk-ACSVZPK7.cjs');
5
+ var chunkVPYHY3LJ_cjs = require('../chunk-VPYHY3LJ.cjs');
6
+ require('../chunk-UUT7UN2N.cjs');
7
+ require('../chunk-TEDRJXOG.cjs');
8
+ require('../chunk-D7ZEOS56.cjs');
9
+ require('../chunk-UMDVATGY.cjs');
10
+ require('../chunk-FL472AMI.cjs');
11
+ require('../chunk-GSQ6NPH6.cjs');
12
+ require('../chunk-BLZDPRXT.cjs');
13
+ require('../chunk-7YSP4V4R.cjs');
14
+ require('../chunk-H7YNSMA7.cjs');
15
+ require('../chunk-SJDMVITW.cjs');
16
+ require('../chunk-DI74SMXS.cjs');
17
+ require('../chunk-LGEALRC6.cjs');
18
+ require('../chunk-TDXIBCGY.cjs');
14
19
 
15
20
  // src/schema/deserializer.ts
16
21
  function deserializeSchema(schema) {
@@ -50,7 +55,7 @@ function buildRegistryFromClosures(schema) {
50
55
  const edgeImplyingClosure = recordToMap(closures.edgeImplyingClosure);
51
56
  const nodeKinds = /* @__PURE__ */ new Map();
52
57
  const edgeKinds = /* @__PURE__ */ new Map();
53
- return new chunkNG5N7R45_cjs.KindRegistry(nodeKinds, edgeKinds, {
58
+ const registry = new chunkCK5BVQOW_cjs.KindRegistry(nodeKinds, edgeKinds, {
54
59
  subClassAncestors,
55
60
  subClassDescendants,
56
61
  broaderClosure,
@@ -64,6 +69,18 @@ function buildRegistryFromClosures(schema) {
64
69
  edgeImplicationsClosure,
65
70
  edgeImplyingClosure
66
71
  });
72
+ chunkCK5BVQOW_cjs.validateImpliesEndpointCompatibility(
73
+ buildEdgeEndpointKinds(schema.edges),
74
+ registry
75
+ );
76
+ return registry;
77
+ }
78
+ function buildEdgeEndpointKinds(edges) {
79
+ const result = /* @__PURE__ */ new Map();
80
+ for (const [kind, def] of Object.entries(edges)) {
81
+ result.set(kind, { from: def.fromKinds, to: def.toKinds });
82
+ }
83
+ return result;
67
84
  }
68
85
  function recordToMap(record) {
69
86
  const result = /* @__PURE__ */ new Map();
@@ -78,95 +95,95 @@ function simpleRecordToMap(record) {
78
95
 
79
96
  Object.defineProperty(exports, "applyDeprecatedKinds", {
80
97
  enumerable: true,
81
- get: function () { return chunkNG5N7R45_cjs.applyDeprecatedKinds; }
98
+ get: function () { return chunkCK5BVQOW_cjs.applyDeprecatedKinds; }
82
99
  });
83
100
  Object.defineProperty(exports, "assertSchemaCurrent", {
84
101
  enumerable: true,
85
- get: function () { return chunkNG5N7R45_cjs.assertSchemaCurrent; }
102
+ get: function () { return chunkCK5BVQOW_cjs.assertSchemaCurrent; }
86
103
  });
87
104
  Object.defineProperty(exports, "computeSchemaDiff", {
88
105
  enumerable: true,
89
- get: function () { return chunkNG5N7R45_cjs.computeSchemaDiff; }
106
+ get: function () { return chunkCK5BVQOW_cjs.computeSchemaDiff; }
90
107
  });
91
108
  Object.defineProperty(exports, "computeSchemaHash", {
92
109
  enumerable: true,
93
- get: function () { return chunkNG5N7R45_cjs.computeSchemaHash; }
94
- });
95
- Object.defineProperty(exports, "createValidationError", {
96
- enumerable: true,
97
- get: function () { return chunkNG5N7R45_cjs.createValidationError; }
110
+ get: function () { return chunkCK5BVQOW_cjs.computeSchemaHash; }
98
111
  });
99
112
  Object.defineProperty(exports, "deserializeWherePredicate", {
100
113
  enumerable: true,
101
- get: function () { return chunkNG5N7R45_cjs.deserializeWherePredicate; }
114
+ get: function () { return chunkCK5BVQOW_cjs.deserializeWherePredicate; }
102
115
  });
103
116
  Object.defineProperty(exports, "ensureSchema", {
104
117
  enumerable: true,
105
- get: function () { return chunkNG5N7R45_cjs.ensureSchema; }
118
+ get: function () { return chunkCK5BVQOW_cjs.ensureSchema; }
106
119
  });
107
120
  Object.defineProperty(exports, "getActiveSchema", {
108
121
  enumerable: true,
109
- get: function () { return chunkNG5N7R45_cjs.getActiveSchema; }
122
+ get: function () { return chunkCK5BVQOW_cjs.getActiveSchema; }
110
123
  });
111
124
  Object.defineProperty(exports, "getMigrationActions", {
112
125
  enumerable: true,
113
- get: function () { return chunkNG5N7R45_cjs.getMigrationActions; }
126
+ get: function () { return chunkCK5BVQOW_cjs.getMigrationActions; }
114
127
  });
115
128
  Object.defineProperty(exports, "getSchemaChanges", {
116
129
  enumerable: true,
117
- get: function () { return chunkNG5N7R45_cjs.getSchemaChanges; }
130
+ get: function () { return chunkCK5BVQOW_cjs.getSchemaChanges; }
118
131
  });
119
132
  Object.defineProperty(exports, "initializeSchema", {
120
133
  enumerable: true,
121
- get: function () { return chunkNG5N7R45_cjs.initializeSchema; }
134
+ get: function () { return chunkCK5BVQOW_cjs.initializeSchema; }
122
135
  });
123
136
  Object.defineProperty(exports, "isBackwardsCompatible", {
124
137
  enumerable: true,
125
- get: function () { return chunkNG5N7R45_cjs.isBackwardsCompatible; }
138
+ get: function () { return chunkCK5BVQOW_cjs.isBackwardsCompatible; }
126
139
  });
127
140
  Object.defineProperty(exports, "isSchemaInitialized", {
128
141
  enumerable: true,
129
- get: function () { return chunkNG5N7R45_cjs.isSchemaInitialized; }
142
+ get: function () { return chunkCK5BVQOW_cjs.isSchemaInitialized; }
130
143
  });
131
144
  Object.defineProperty(exports, "loadActiveSchemaWithBootstrap", {
132
145
  enumerable: true,
133
- get: function () { return chunkNG5N7R45_cjs.loadActiveSchemaWithBootstrap; }
146
+ get: function () { return chunkCK5BVQOW_cjs.loadActiveSchemaWithBootstrap; }
134
147
  });
135
148
  Object.defineProperty(exports, "loadAndMergeGraphExtensionDocument", {
136
149
  enumerable: true,
137
- get: function () { return chunkNG5N7R45_cjs.loadAndMergeGraphExtensionDocument; }
150
+ get: function () { return chunkCK5BVQOW_cjs.loadAndMergeGraphExtensionDocument; }
138
151
  });
139
152
  Object.defineProperty(exports, "migrateSchema", {
140
153
  enumerable: true,
141
- get: function () { return chunkNG5N7R45_cjs.migrateSchema; }
154
+ get: function () { return chunkCK5BVQOW_cjs.migrateSchema; }
142
155
  });
143
156
  Object.defineProperty(exports, "parseSerializedSchema", {
144
157
  enumerable: true,
145
- get: function () { return chunkNG5N7R45_cjs.parseSerializedSchema; }
158
+ get: function () { return chunkCK5BVQOW_cjs.parseSerializedSchema; }
146
159
  });
147
160
  Object.defineProperty(exports, "rollbackSchema", {
148
161
  enumerable: true,
149
- get: function () { return chunkNG5N7R45_cjs.rollbackSchema; }
162
+ get: function () { return chunkCK5BVQOW_cjs.rollbackSchema; }
150
163
  });
151
164
  Object.defineProperty(exports, "serializeSchema", {
152
165
  enumerable: true,
153
- get: function () { return chunkNG5N7R45_cjs.serializeSchema; }
166
+ get: function () { return chunkCK5BVQOW_cjs.serializeSchema; }
167
+ });
168
+ Object.defineProperty(exports, "createValidationError", {
169
+ enumerable: true,
170
+ get: function () { return chunkVPYHY3LJ_cjs.createValidationError; }
154
171
  });
155
172
  Object.defineProperty(exports, "validateEdgeProps", {
156
173
  enumerable: true,
157
- get: function () { return chunkNG5N7R45_cjs.validateEdgeProps; }
174
+ get: function () { return chunkVPYHY3LJ_cjs.validateEdgeProps; }
158
175
  });
159
176
  Object.defineProperty(exports, "validateNodeProps", {
160
177
  enumerable: true,
161
- get: function () { return chunkNG5N7R45_cjs.validateNodeProps; }
178
+ get: function () { return chunkVPYHY3LJ_cjs.validateNodeProps; }
162
179
  });
163
180
  Object.defineProperty(exports, "validateProps", {
164
181
  enumerable: true,
165
- get: function () { return chunkNG5N7R45_cjs.validateProps; }
182
+ get: function () { return chunkVPYHY3LJ_cjs.validateProps; }
166
183
  });
167
184
  Object.defineProperty(exports, "wrapZodError", {
168
185
  enumerable: true,
169
- get: function () { return chunkNG5N7R45_cjs.wrapZodError; }
186
+ get: function () { return chunkVPYHY3LJ_cjs.wrapZodError; }
170
187
  });
171
188
  exports.deserializeSchema = deserializeSchema;
172
189
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schema/deserializer.ts"],"names":["KindRegistry"],"mappings":";;;;;;;;;;;;;;;AA6EO,SAAS,kBACd,MAAA,EACoB;AACpB,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA;AAC1C,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA;AAC1C,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAO,IAAA,CAAK,MAAA,C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C","file":"index.cjs","sourcesContent":["/**\n * Schema deserializer for loading stored schemas.\n *\n * Reconstructs runtime objects from SerializedSchema.\n * Note: Zod schemas cannot be fully reconstructed from JSON Schema,\n * so this provides access to the serialized data for introspection.\n */\nimport { KindRegistry } from \"../registry/kind-registry\";\nimport {\n type SerializedClosures,\n type SerializedEdgeDef,\n type SerializedMetaEdge,\n type SerializedNodeDef,\n type SerializedOntologyRelation,\n type SerializedSchema,\n} from \"./types\";\n\n// ============================================================\n// Deserialized Schema\n// ============================================================\n\n/**\n * A deserialized schema provides read-only access to schema metadata.\n *\n * Note: Unlike the original GraphDef, this does not include Zod schemas\n * since those cannot be reconstructed from JSON Schema. Use this for\n * introspection and metadata access only.\n */\nexport type DeserializedSchema = Readonly<{\n graphId: string;\n version: number;\n generatedAt: string;\n\n /** Get node definition by name */\n getNode: (name: string) => SerializedNodeDef | undefined;\n\n /** Get all node names */\n getNodeNames: () => readonly string[];\n\n /** Get edge definition by name */\n getEdge: (name: string) => SerializedEdgeDef | undefined;\n\n /** Get all edge names */\n getEdgeNames: () => readonly string[];\n\n /** Get meta-edge definition by name */\n getMetaEdge: (name: string) => SerializedMetaEdge | undefined;\n\n /** Get all meta-edge names */\n getMetaEdgeNames: () => readonly string[];\n\n /** Get all ontology relations */\n getRelations: () => readonly SerializedOntologyRelation[];\n\n /** Get precomputed closures */\n getClosures: () => SerializedClosures;\n\n /** Get graph defaults */\n getDefaults: () => SerializedSchema[\"defaults\"];\n\n /** Get the raw serialized schema */\n getRaw: () => SerializedSchema;\n\n /** Build a KindRegistry from the closures */\n buildRegistry: () => KindRegistry;\n}>;\n\n// ============================================================\n// Deserialization\n// ============================================================\n\n/**\n * Deserializes a SerializedSchema into a DeserializedSchema.\n *\n * @param schema - The serialized schema to deserialize\n * @returns A deserialized schema with accessor methods\n */\nexport function deserializeSchema(\n schema: SerializedSchema,\n): DeserializedSchema {\n const nodeNames = Object.keys(schema.nodes);\n const edgeNames = Object.keys(schema.edges);\n const metaEdgeNames = Object.keys(schema.ontology.metaEdges);\n\n return {\n graphId: schema.graphId,\n version: schema.version,\n generatedAt: schema.generatedAt,\n\n getNode: (name) => schema.nodes[name],\n getNodeNames: () => nodeNames,\n\n getEdge: (name) => schema.edges[name],\n getEdgeNames: () => edgeNames,\n\n getMetaEdge: (name) => schema.ontology.metaEdges[name],\n getMetaEdgeNames: () => metaEdgeNames,\n\n getRelations: () => schema.ontology.relations,\n getClosures: () => schema.ontology.closures,\n\n getDefaults: () => schema.defaults,\n getRaw: () => schema,\n\n buildRegistry: () => buildRegistryFromClosures(schema),\n };\n}\n\n// ============================================================\n// Registry Building\n// ============================================================\n\n/**\n * Builds a KindRegistry from serialized closures.\n *\n * This allows query execution without recomputing closures.\n */\nfunction buildRegistryFromClosures(schema: SerializedSchema): KindRegistry {\n const { closures } = schema.ontology;\n\n // Convert Record<string, string[]> back to Map<string, Set<string>>\n const subClassAncestors = recordToMap(closures.subClassAncestors);\n const subClassDescendants = recordToMap(closures.subClassDescendants);\n const broaderClosure = recordToMap(closures.broaderClosure);\n const narrowerClosure = recordToMap(closures.narrowerClosure);\n const equivalenceSets = recordToMap(closures.equivalenceSets);\n const partOfClosure = recordToMap(closures.partOfClosure);\n const hasPartClosure = recordToMap(closures.hasPartClosure);\n const iriToKind = simpleRecordToMap(closures.iriToKind);\n const disjointPairs = new Set(closures.disjointPairs);\n const edgeInverses = simpleRecordToMap(closures.edgeInverses);\n const edgeImplicationsClosure = recordToMap(closures.edgeImplicationsClosure);\n const edgeImplyingClosure = recordToMap(closures.edgeImplyingClosure);\n\n // Build empty node/edge kind maps (we don't have the actual Zod schemas)\n const nodeKinds = new Map();\n const edgeKinds = new Map();\n\n return new KindRegistry(nodeKinds, edgeKinds, {\n subClassAncestors,\n subClassDescendants,\n broaderClosure,\n narrowerClosure,\n equivalenceSets,\n iriToKind,\n disjointPairs,\n partOfClosure,\n hasPartClosure,\n edgeInverses,\n edgeImplicationsClosure,\n edgeImplyingClosure,\n });\n}\n\n/**\n * Converts Record<string, string[]> to Map<string, Set<string>>.\n */\nfunction recordToMap(\n record: Record<string, readonly string[]>,\n): ReadonlyMap<string, ReadonlySet<string>> {\n const result = new Map<string, Set<string>>();\n for (const [key, values] of Object.entries(record)) {\n result.set(key, new Set(values));\n }\n return result;\n}\n\n/**\n * Converts Record<string, string> to Map<string, string>.\n */\nfunction simpleRecordToMap(\n record: Record<string, string>,\n): ReadonlyMap<string, string> {\n return new Map(Object.entries(record));\n}\n"]}
1
+ {"version":3,"sources":["../../src/schema/deserializer.ts"],"names":["KindRegistry","validateImpliesEndpointCompatibility"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiFO,SAAS,kBACd,MAAA,EACoB;AACpB,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA;AAC1C,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA;AAC1C,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,SAAS,SAAS,CAAA;AAE3D,EAAA,OAAO;AAAA,IACL,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,aAAa,MAAA,CAAO,WAAA;AAAA,IAEpB,OAAA,EAAS,CAAC,IAAA,KAAS,MAAA,CAAO,MAAM,IAAI,CAAA;AAAA,IACpC,cAAc,MAAM,SAAA;AAAA,IAEpB,OAAA,EAAS,CAAC,IAAA,KAAS,MAAA,CAAO,MAAM,IAAI,CAAA;AAAA,IACpC,cAAc,MAAM,SAAA;AAAA,IAEpB,aAAa,CAAC,IAAA,KAAS,MAAA,CAAO,QAAA,CAAS,UAAU,IAAI,CAAA;AAAA,IACrD,kBAAkB,MAAM,aAAA;AAAA,IAExB,YAAA,EAAc,MAAM,MAAA,CAAO,QAAA,CAAS,SAAA;AAAA,IACpC,WAAA,EAAa,MAAM,MAAA,CAAO,QAAA,CAA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a,SAAA,EAAW,SAAA,EAAW;AAAA,IACtD,iBAAA;AAAA,IACA,mBAAA;AAAA,IACA,cAAA;AAAA,IACA,eAAA;AAAA,IACA,eAAA;AAAA,IACA,SAAA;AAAA,IACA,aAAA;AAAA,IACA,aAAA;AAAA,IACA,cAAA;AAAA,IACA,YAAA;AAAA,IACA,uBAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAAC,sDAAA;AAAA,IACE,sBAAA,CAAuB,OAAO,KAAK,CAAA;AAAA,IACnC;AAAA,GACF;AAEA,EAAA,OAAO,QAAA;AACT;AASA,SAAS,uBACP,KAAA,EACwC;AACxC,EAAA,MAAM,MAAA,uBAAa,GAAA,EAA+B;AAClD,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,GAAG,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC/C,IAAA,MAAA,CAAO,GAAA,CAAI,MAAM,EAAE,IAAA,EAAM,IAAI,SAAA,EAAW,EAAA,EAAI,GAAA,CAAI,OAAA,EAAS,CAAA;AAAA,EAC3D;AACA,EAAA,OAAO,MAAA;AACT;AAKA,SAAS,YACP,MAAA,EAC0C;AAC1C,EAAA,MAAM,MAAA,uBAAa,GAAA,EAAyB;AAC5C,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,MAAM,KAAK,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,EAAG;AAClD,IAAA,MAAA,CAAO,GAAA,CAAI,GAAA,EAAK,IAAI,GAAA,CAAI,MAAM,CAAC,CAAA;AAAA,EACjC;AACA,EAAA,OAAO,MAAA;AACT;AAKA,SAAS,kBACP,MAAA,EAC6B;AAC7B,EAAA,OAAO,IAAI,GAAA,CAAI,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAC,CAAA;AACvC","file":"index.cjs","sourcesContent":["/**\n * Schema deserializer for loading stored schemas.\n *\n * Reconstructs runtime objects from SerializedSchema.\n * Note: Zod schemas cannot be fully reconstructed from JSON Schema,\n * so this provides access to the serialized data for introspection.\n */\nimport { KindRegistry } from \"../registry/kind-registry\";\nimport {\n type EdgeEndpointKinds,\n validateImpliesEndpointCompatibility,\n} from \"../registry/validate-implies\";\nimport {\n type SerializedClosures,\n type SerializedEdgeDef,\n type SerializedMetaEdge,\n type SerializedNodeDef,\n type SerializedOntologyRelation,\n type SerializedSchema,\n} from \"./types\";\n\n// ============================================================\n// Deserialized Schema\n// ============================================================\n\n/**\n * A deserialized schema provides read-only access to schema metadata.\n *\n * Note: Unlike the original GraphDef, this does not include Zod schemas\n * since those cannot be reconstructed from JSON Schema. Use this for\n * introspection and metadata access only.\n */\nexport type DeserializedSchema = Readonly<{\n graphId: string;\n version: number;\n generatedAt: string;\n\n /** Get node definition by name */\n getNode: (name: string) => SerializedNodeDef | undefined;\n\n /** Get all node names */\n getNodeNames: () => readonly string[];\n\n /** Get edge definition by name */\n getEdge: (name: string) => SerializedEdgeDef | undefined;\n\n /** Get all edge names */\n getEdgeNames: () => readonly string[];\n\n /** Get meta-edge definition by name */\n getMetaEdge: (name: string) => SerializedMetaEdge | undefined;\n\n /** Get all meta-edge names */\n getMetaEdgeNames: () => readonly string[];\n\n /** Get all ontology relations */\n getRelations: () => readonly SerializedOntologyRelation[];\n\n /** Get precomputed closures */\n getClosures: () => SerializedClosures;\n\n /** Get graph defaults */\n getDefaults: () => SerializedSchema[\"defaults\"];\n\n /** Get the raw serialized schema */\n getRaw: () => SerializedSchema;\n\n /** Build a KindRegistry from the closures */\n buildRegistry: () => KindRegistry;\n}>;\n\n// ============================================================\n// Deserialization\n// ============================================================\n\n/**\n * Deserializes a SerializedSchema into a DeserializedSchema.\n *\n * @param schema - The serialized schema to deserialize\n * @returns A deserialized schema with accessor methods\n */\nexport function deserializeSchema(\n schema: SerializedSchema,\n): DeserializedSchema {\n const nodeNames = Object.keys(schema.nodes);\n const edgeNames = Object.keys(schema.edges);\n const metaEdgeNames = Object.keys(schema.ontology.metaEdges);\n\n return {\n graphId: schema.graphId,\n version: schema.version,\n generatedAt: schema.generatedAt,\n\n getNode: (name) => schema.nodes[name],\n getNodeNames: () => nodeNames,\n\n getEdge: (name) => schema.edges[name],\n getEdgeNames: () => edgeNames,\n\n getMetaEdge: (name) => schema.ontology.metaEdges[name],\n getMetaEdgeNames: () => metaEdgeNames,\n\n getRelations: () => schema.ontology.relations,\n getClosures: () => schema.ontology.closures,\n\n getDefaults: () => schema.defaults,\n getRaw: () => schema,\n\n buildRegistry: () => buildRegistryFromClosures(schema),\n };\n}\n\n// ============================================================\n// Registry Building\n// ============================================================\n\n/**\n * Builds a KindRegistry from serialized closures.\n *\n * This allows query execution without recomputing closures.\n */\nfunction buildRegistryFromClosures(schema: SerializedSchema): KindRegistry {\n const { closures } = schema.ontology;\n\n // Convert Record<string, string[]> back to Map<string, Set<string>>\n const subClassAncestors = recordToMap(closures.subClassAncestors);\n const subClassDescendants = recordToMap(closures.subClassDescendants);\n const broaderClosure = recordToMap(closures.broaderClosure);\n const narrowerClosure = recordToMap(closures.narrowerClosure);\n const equivalenceSets = recordToMap(closures.equivalenceSets);\n const partOfClosure = recordToMap(closures.partOfClosure);\n const hasPartClosure = recordToMap(closures.hasPartClosure);\n const iriToKind = simpleRecordToMap(closures.iriToKind);\n const disjointPairs = new Set(closures.disjointPairs);\n const edgeInverses = simpleRecordToMap(closures.edgeInverses);\n const edgeImplicationsClosure = recordToMap(closures.edgeImplicationsClosure);\n const edgeImplyingClosure = recordToMap(closures.edgeImplyingClosure);\n\n // Build empty node/edge kind maps (we don't have the actual Zod schemas)\n const nodeKinds = new Map();\n const edgeKinds = new Map();\n\n const registry = new KindRegistry(nodeKinds, edgeKinds, {\n subClassAncestors,\n subClassDescendants,\n broaderClosure,\n narrowerClosure,\n equivalenceSets,\n iriToKind,\n disjointPairs,\n partOfClosure,\n hasPartClosure,\n edgeInverses,\n edgeImplicationsClosure,\n edgeImplyingClosure,\n });\n\n validateImpliesEndpointCompatibility(\n buildEdgeEndpointKinds(schema.edges),\n registry,\n );\n\n return registry;\n}\n\n/**\n * Maps each edge kind's serialized definition to its domain/range kind\n * names, for `validateImpliesEndpointCompatibility`. A `Map` (rather than\n * the plain `schema.edges` object) so a lookup for an edge kind literally\n * named \"toString\" or another `Object.prototype` member can't resolve to\n * an inherited member instead of `undefined`.\n */\nfunction buildEdgeEndpointKinds(\n edges: Record<string, SerializedEdgeDef>,\n): ReadonlyMap<string, EdgeEndpointKinds> {\n const result = new Map<string, EdgeEndpointKinds>();\n for (const [kind, def] of Object.entries(edges)) {\n result.set(kind, { from: def.fromKinds, to: def.toKinds });\n }\n return result;\n}\n\n/**\n * Converts Record<string, string[]> to Map<string, Set<string>>.\n */\nfunction recordToMap(\n record: Record<string, readonly string[]>,\n): ReadonlyMap<string, ReadonlySet<string>> {\n const result = new Map<string, Set<string>>();\n for (const [key, values] of Object.entries(record)) {\n result.set(key, new Set(values));\n }\n return result;\n}\n\n/**\n * Converts Record<string, string> to Map<string, string>.\n */\nfunction simpleRecordToMap(\n record: Record<string, string>,\n): ReadonlyMap<string, string> {\n return new Map(Object.entries(record));\n}\n"]}
@@ -1,64 +1,14 @@
1
- import { K as KindRegistry, G as GraphDef } from '../manager-BYl_zyZR.cjs';
2
- export { C as ChangeSeverity, a as ChangeType, D as DeprecatedKindsChange, E as EdgeChange, b as ExtensionChange, I as IndexChange, M as MigrationHookContext, N as NodeChange, O as OntologyChange, S as SchemaDiff, c as SchemaManagerOptions, d as SchemaValidationResult, e as applyDeprecatedKinds, f as assertSchemaCurrent, g as computeSchemaDiff, h as ensureSchema, i as getActiveSchema, j as getMigrationActions, k as getSchemaChanges, l as initializeSchema, m as isBackwardsCompatible, n as isSchemaInitialized, o as loadActiveSchemaWithBootstrap, p as loadAndMergeGraphExtensionDocument, q as migrateSchema, r as parseSerializedSchema, s as rollbackSchema } from '../manager-BYl_zyZR.cjs';
3
- import { f as SerializedNodeDef, g as SerializedEdgeDef, h as SerializedMetaEdge, i as SerializedOntologyRelation, j as SerializedClosures, k as SerializedSchema, l as SchemaHash } from '../types-C_UnQOQp.cjs';
4
- export { m as JsonSchema, n as SerializedOntology, o as SerializedUniqueConstraint } from '../types-C_UnQOQp.cjs';
5
- import { a as NullCheckOp, K as KindEntity } from '../extension-types-YGFJPrzK.cjs';
1
+ import { G as GraphDef, K as KindRegistry } from '../manager-DwQi8eV0.cjs';
2
+ export { C as ChangeSeverity, a as ChangeType, D as DeprecatedKindsChange, E as EdgeChange, b as ExtensionChange, I as IndexChange, M as MigrationHookContext, N as NodeChange, O as OntologyChange, S as SchemaDiff, c as SchemaManagerOptions, d as SchemaValidationResult, e as applyDeprecatedKinds, f as assertSchemaCurrent, g as computeSchemaDiff, h as ensureSchema, i as getActiveSchema, j as getMigrationActions, k as getSchemaChanges, l as initializeSchema, m as isBackwardsCompatible, n as isSchemaInitialized, o as loadActiveSchemaWithBootstrap, p as loadAndMergeGraphExtensionDocument, q as migrateSchema, r as parseSerializedSchema, s as rollbackSchema } from '../manager-DwQi8eV0.cjs';
3
+ import { s as SerializedSchema, t as SchemaHash, u as SerializedNodeDef, v as SerializedEdgeDef, w as SerializedMetaEdge, x as SerializedOntologyRelation, y as SerializedClosures } from '../fulltext-strategy-CDkSSYhq.cjs';
4
+ export { z as JsonSchema, C as SerializedOntology, D as SerializedUniqueConstraint } from '../fulltext-strategy-CDkSSYhq.cjs';
5
+ import { a as NullCheckOp, K as KindEntity } from '../extension-types-ixRpJVUp.cjs';
6
6
  import { ZodType, ZodError } from 'zod';
7
- import { V as ValidationIssue, a as ValidationError } from '../index-SEvUHDA6.cjs';
7
+ import { V as ValidationIssue, a as ValidationError } from '../index-Bks_3HHK.cjs';
8
8
  import 'drizzle-orm';
9
9
  import 'drizzle-orm/pg-core';
10
10
  import 'drizzle-orm/sqlite-core';
11
- import '../materialize-indexes-D20xNluI.cjs';
12
-
13
- /**
14
- * Schema deserializer for loading stored schemas.
15
- *
16
- * Reconstructs runtime objects from SerializedSchema.
17
- * Note: Zod schemas cannot be fully reconstructed from JSON Schema,
18
- * so this provides access to the serialized data for introspection.
19
- */
20
-
21
- /**
22
- * A deserialized schema provides read-only access to schema metadata.
23
- *
24
- * Note: Unlike the original GraphDef, this does not include Zod schemas
25
- * since those cannot be reconstructed from JSON Schema. Use this for
26
- * introspection and metadata access only.
27
- */
28
- type DeserializedSchema = Readonly<{
29
- graphId: string;
30
- version: number;
31
- generatedAt: string;
32
- /** Get node definition by name */
33
- getNode: (name: string) => SerializedNodeDef | undefined;
34
- /** Get all node names */
35
- getNodeNames: () => readonly string[];
36
- /** Get edge definition by name */
37
- getEdge: (name: string) => SerializedEdgeDef | undefined;
38
- /** Get all edge names */
39
- getEdgeNames: () => readonly string[];
40
- /** Get meta-edge definition by name */
41
- getMetaEdge: (name: string) => SerializedMetaEdge | undefined;
42
- /** Get all meta-edge names */
43
- getMetaEdgeNames: () => readonly string[];
44
- /** Get all ontology relations */
45
- getRelations: () => readonly SerializedOntologyRelation[];
46
- /** Get precomputed closures */
47
- getClosures: () => SerializedClosures;
48
- /** Get graph defaults */
49
- getDefaults: () => SerializedSchema["defaults"];
50
- /** Get the raw serialized schema */
51
- getRaw: () => SerializedSchema;
52
- /** Build a KindRegistry from the closures */
53
- buildRegistry: () => KindRegistry;
54
- }>;
55
- /**
56
- * Deserializes a SerializedSchema into a DeserializedSchema.
57
- *
58
- * @param schema - The serialized schema to deserialize
59
- * @returns A deserialized schema with accessor methods
60
- */
61
- declare function deserializeSchema(schema: SerializedSchema): DeserializedSchema;
11
+ import '../materialize-indexes-B4e9360H.cjs';
62
12
 
63
13
  /**
64
14
  * Schema serializer for homoiconic storage.
@@ -119,6 +69,56 @@ declare function deserializeWherePredicate(serialized: string): (builder: Predic
119
69
  */
120
70
  declare function computeSchemaHash(schema: SerializedSchema): Promise<SchemaHash>;
121
71
 
72
+ /**
73
+ * Schema deserializer for loading stored schemas.
74
+ *
75
+ * Reconstructs runtime objects from SerializedSchema.
76
+ * Note: Zod schemas cannot be fully reconstructed from JSON Schema,
77
+ * so this provides access to the serialized data for introspection.
78
+ */
79
+
80
+ /**
81
+ * A deserialized schema provides read-only access to schema metadata.
82
+ *
83
+ * Note: Unlike the original GraphDef, this does not include Zod schemas
84
+ * since those cannot be reconstructed from JSON Schema. Use this for
85
+ * introspection and metadata access only.
86
+ */
87
+ type DeserializedSchema = Readonly<{
88
+ graphId: string;
89
+ version: number;
90
+ generatedAt: string;
91
+ /** Get node definition by name */
92
+ getNode: (name: string) => SerializedNodeDef | undefined;
93
+ /** Get all node names */
94
+ getNodeNames: () => readonly string[];
95
+ /** Get edge definition by name */
96
+ getEdge: (name: string) => SerializedEdgeDef | undefined;
97
+ /** Get all edge names */
98
+ getEdgeNames: () => readonly string[];
99
+ /** Get meta-edge definition by name */
100
+ getMetaEdge: (name: string) => SerializedMetaEdge | undefined;
101
+ /** Get all meta-edge names */
102
+ getMetaEdgeNames: () => readonly string[];
103
+ /** Get all ontology relations */
104
+ getRelations: () => readonly SerializedOntologyRelation[];
105
+ /** Get precomputed closures */
106
+ getClosures: () => SerializedClosures;
107
+ /** Get graph defaults */
108
+ getDefaults: () => SerializedSchema["defaults"];
109
+ /** Get the raw serialized schema */
110
+ getRaw: () => SerializedSchema;
111
+ /** Build a KindRegistry from the closures */
112
+ buildRegistry: () => KindRegistry;
113
+ }>;
114
+ /**
115
+ * Deserializes a SerializedSchema into a DeserializedSchema.
116
+ *
117
+ * @param schema - The serialized schema to deserialize
118
+ * @returns A deserialized schema with accessor methods
119
+ */
120
+ declare function deserializeSchema(schema: SerializedSchema): DeserializedSchema;
121
+
122
122
  /**
123
123
  * Contextual Validation Utilities
124
124
  *
@@ -1,64 +1,14 @@
1
- import { K as KindRegistry, G as GraphDef } from '../manager-C0_r0ALf.js';
2
- export { C as ChangeSeverity, a as ChangeType, D as DeprecatedKindsChange, E as EdgeChange, b as ExtensionChange, I as IndexChange, M as MigrationHookContext, N as NodeChange, O as OntologyChange, S as SchemaDiff, c as SchemaManagerOptions, d as SchemaValidationResult, e as applyDeprecatedKinds, f as assertSchemaCurrent, g as computeSchemaDiff, h as ensureSchema, i as getActiveSchema, j as getMigrationActions, k as getSchemaChanges, l as initializeSchema, m as isBackwardsCompatible, n as isSchemaInitialized, o as loadActiveSchemaWithBootstrap, p as loadAndMergeGraphExtensionDocument, q as migrateSchema, r as parseSerializedSchema, s as rollbackSchema } from '../manager-C0_r0ALf.js';
3
- import { f as SerializedNodeDef, g as SerializedEdgeDef, h as SerializedMetaEdge, i as SerializedOntologyRelation, j as SerializedClosures, k as SerializedSchema, l as SchemaHash } from '../types-DGylBhWo.js';
4
- export { m as JsonSchema, n as SerializedOntology, o as SerializedUniqueConstraint } from '../types-DGylBhWo.js';
5
- import { a as NullCheckOp, K as KindEntity } from '../extension-types-YGFJPrzK.js';
1
+ import { G as GraphDef, K as KindRegistry } from '../manager-ejUCB52T.js';
2
+ export { C as ChangeSeverity, a as ChangeType, D as DeprecatedKindsChange, E as EdgeChange, b as ExtensionChange, I as IndexChange, M as MigrationHookContext, N as NodeChange, O as OntologyChange, S as SchemaDiff, c as SchemaManagerOptions, d as SchemaValidationResult, e as applyDeprecatedKinds, f as assertSchemaCurrent, g as computeSchemaDiff, h as ensureSchema, i as getActiveSchema, j as getMigrationActions, k as getSchemaChanges, l as initializeSchema, m as isBackwardsCompatible, n as isSchemaInitialized, o as loadActiveSchemaWithBootstrap, p as loadAndMergeGraphExtensionDocument, q as migrateSchema, r as parseSerializedSchema, s as rollbackSchema } from '../manager-ejUCB52T.js';
3
+ import { s as SerializedSchema, t as SchemaHash, u as SerializedNodeDef, v as SerializedEdgeDef, w as SerializedMetaEdge, x as SerializedOntologyRelation, y as SerializedClosures } from '../fulltext-strategy-B57yvC5Q.js';
4
+ export { z as JsonSchema, C as SerializedOntology, D as SerializedUniqueConstraint } from '../fulltext-strategy-B57yvC5Q.js';
5
+ import { a as NullCheckOp, K as KindEntity } from '../extension-types-ixRpJVUp.js';
6
6
  import { ZodType, ZodError } from 'zod';
7
- import { V as ValidationIssue, a as ValidationError } from '../index-DGX6D9j1.js';
7
+ import { V as ValidationIssue, a as ValidationError } from '../index-6CSUAq-x.js';
8
8
  import 'drizzle-orm';
9
9
  import 'drizzle-orm/pg-core';
10
10
  import 'drizzle-orm/sqlite-core';
11
- import '../materialize-indexes-CAkIYFV-.js';
12
-
13
- /**
14
- * Schema deserializer for loading stored schemas.
15
- *
16
- * Reconstructs runtime objects from SerializedSchema.
17
- * Note: Zod schemas cannot be fully reconstructed from JSON Schema,
18
- * so this provides access to the serialized data for introspection.
19
- */
20
-
21
- /**
22
- * A deserialized schema provides read-only access to schema metadata.
23
- *
24
- * Note: Unlike the original GraphDef, this does not include Zod schemas
25
- * since those cannot be reconstructed from JSON Schema. Use this for
26
- * introspection and metadata access only.
27
- */
28
- type DeserializedSchema = Readonly<{
29
- graphId: string;
30
- version: number;
31
- generatedAt: string;
32
- /** Get node definition by name */
33
- getNode: (name: string) => SerializedNodeDef | undefined;
34
- /** Get all node names */
35
- getNodeNames: () => readonly string[];
36
- /** Get edge definition by name */
37
- getEdge: (name: string) => SerializedEdgeDef | undefined;
38
- /** Get all edge names */
39
- getEdgeNames: () => readonly string[];
40
- /** Get meta-edge definition by name */
41
- getMetaEdge: (name: string) => SerializedMetaEdge | undefined;
42
- /** Get all meta-edge names */
43
- getMetaEdgeNames: () => readonly string[];
44
- /** Get all ontology relations */
45
- getRelations: () => readonly SerializedOntologyRelation[];
46
- /** Get precomputed closures */
47
- getClosures: () => SerializedClosures;
48
- /** Get graph defaults */
49
- getDefaults: () => SerializedSchema["defaults"];
50
- /** Get the raw serialized schema */
51
- getRaw: () => SerializedSchema;
52
- /** Build a KindRegistry from the closures */
53
- buildRegistry: () => KindRegistry;
54
- }>;
55
- /**
56
- * Deserializes a SerializedSchema into a DeserializedSchema.
57
- *
58
- * @param schema - The serialized schema to deserialize
59
- * @returns A deserialized schema with accessor methods
60
- */
61
- declare function deserializeSchema(schema: SerializedSchema): DeserializedSchema;
11
+ import '../materialize-indexes-te9TPMMJ.js';
62
12
 
63
13
  /**
64
14
  * Schema serializer for homoiconic storage.
@@ -119,6 +69,56 @@ declare function deserializeWherePredicate(serialized: string): (builder: Predic
119
69
  */
120
70
  declare function computeSchemaHash(schema: SerializedSchema): Promise<SchemaHash>;
121
71
 
72
+ /**
73
+ * Schema deserializer for loading stored schemas.
74
+ *
75
+ * Reconstructs runtime objects from SerializedSchema.
76
+ * Note: Zod schemas cannot be fully reconstructed from JSON Schema,
77
+ * so this provides access to the serialized data for introspection.
78
+ */
79
+
80
+ /**
81
+ * A deserialized schema provides read-only access to schema metadata.
82
+ *
83
+ * Note: Unlike the original GraphDef, this does not include Zod schemas
84
+ * since those cannot be reconstructed from JSON Schema. Use this for
85
+ * introspection and metadata access only.
86
+ */
87
+ type DeserializedSchema = Readonly<{
88
+ graphId: string;
89
+ version: number;
90
+ generatedAt: string;
91
+ /** Get node definition by name */
92
+ getNode: (name: string) => SerializedNodeDef | undefined;
93
+ /** Get all node names */
94
+ getNodeNames: () => readonly string[];
95
+ /** Get edge definition by name */
96
+ getEdge: (name: string) => SerializedEdgeDef | undefined;
97
+ /** Get all edge names */
98
+ getEdgeNames: () => readonly string[];
99
+ /** Get meta-edge definition by name */
100
+ getMetaEdge: (name: string) => SerializedMetaEdge | undefined;
101
+ /** Get all meta-edge names */
102
+ getMetaEdgeNames: () => readonly string[];
103
+ /** Get all ontology relations */
104
+ getRelations: () => readonly SerializedOntologyRelation[];
105
+ /** Get precomputed closures */
106
+ getClosures: () => SerializedClosures;
107
+ /** Get graph defaults */
108
+ getDefaults: () => SerializedSchema["defaults"];
109
+ /** Get the raw serialized schema */
110
+ getRaw: () => SerializedSchema;
111
+ /** Build a KindRegistry from the closures */
112
+ buildRegistry: () => KindRegistry;
113
+ }>;
114
+ /**
115
+ * Deserializes a SerializedSchema into a DeserializedSchema.
116
+ *
117
+ * @param schema - The serialized schema to deserialize
118
+ * @returns A deserialized schema with accessor methods
119
+ */
120
+ declare function deserializeSchema(schema: SerializedSchema): DeserializedSchema;
121
+
122
122
  /**
123
123
  * Contextual Validation Utilities
124
124
  *