@nicia-ai/typegraph 0.46.2 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/README.md +20 -1
  2. package/dist/backend/drizzle/indexes.cjs +9 -9
  3. package/dist/backend/drizzle/indexes.d.cts +1 -1
  4. package/dist/backend/drizzle/indexes.d.ts +1 -1
  5. package/dist/backend/drizzle/indexes.js +5 -5
  6. package/dist/backend/index.cjs +50 -49
  7. package/dist/backend/index.d.cts +3 -3
  8. package/dist/backend/index.d.ts +3 -3
  9. package/dist/backend/index.js +11 -10
  10. package/dist/backend/postgres/index.cjs +27 -26
  11. package/dist/backend/postgres/index.d.cts +6 -6
  12. package/dist/backend/postgres/index.d.ts +6 -6
  13. package/dist/backend/postgres/index.js +14 -13
  14. package/dist/backend/postgres/pglite-store.cjs +34 -33
  15. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  16. package/dist/backend/postgres/pglite-store.d.cts +8 -8
  17. package/dist/backend/postgres/pglite-store.d.ts +8 -8
  18. package/dist/backend/postgres/pglite-store.js +30 -29
  19. package/dist/backend/postgres/pglite-store.js.map +1 -1
  20. package/dist/backend/postgres/pglite.cjs +16 -15
  21. package/dist/backend/postgres/pglite.d.cts +3 -3
  22. package/dist/backend/postgres/pglite.d.ts +3 -3
  23. package/dist/backend/postgres/pglite.js +15 -14
  24. package/dist/backend/sqlite/index.cjs +24 -23
  25. package/dist/backend/sqlite/index.d.cts +6 -6
  26. package/dist/backend/sqlite/index.d.ts +6 -6
  27. package/dist/backend/sqlite/index.js +12 -11
  28. package/dist/backend/sqlite/libsql.cjs +19 -18
  29. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  30. package/dist/backend/sqlite/libsql.d.cts +3 -3
  31. package/dist/backend/sqlite/libsql.d.ts +3 -3
  32. package/dist/backend/sqlite/libsql.js +14 -13
  33. package/dist/backend/sqlite/libsql.js.map +1 -1
  34. package/dist/backend/sqlite/local-store.cjs +35 -34
  35. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  36. package/dist/backend/sqlite/local-store.d.cts +8 -8
  37. package/dist/backend/sqlite/local-store.d.ts +8 -8
  38. package/dist/backend/sqlite/local-store.js +31 -30
  39. package/dist/backend/sqlite/local-store.js.map +1 -1
  40. package/dist/backend/sqlite/local.cjs +17 -16
  41. package/dist/backend/sqlite/local.d.cts +3 -3
  42. package/dist/backend/sqlite/local.d.ts +3 -3
  43. package/dist/backend/sqlite/local.js +15 -14
  44. package/dist/{chunk-TCT66A7N.cjs → chunk-26YKDNUD.cjs} +10 -10
  45. package/dist/{chunk-TCT66A7N.cjs.map → chunk-26YKDNUD.cjs.map} +1 -1
  46. package/dist/{chunk-QOJ2L2AD.js → chunk-3DMMGT6S.js} +3 -3
  47. package/dist/{chunk-QOJ2L2AD.js.map → chunk-3DMMGT6S.js.map} +1 -1
  48. package/dist/{chunk-ANKOXPCC.cjs → chunk-3HGRTCDU.cjs} +6 -4
  49. package/dist/chunk-3HGRTCDU.cjs.map +1 -0
  50. package/dist/{chunk-QU7QLJA4.cjs → chunk-3U5ABFDW.cjs} +26 -26
  51. package/dist/{chunk-QU7QLJA4.cjs.map → chunk-3U5ABFDW.cjs.map} +1 -1
  52. package/dist/{chunk-5PDSCELM.cjs → chunk-425IZOQ5.cjs} +11 -164
  53. package/dist/chunk-425IZOQ5.cjs.map +1 -0
  54. package/dist/{chunk-S7WIRFNS.cjs → chunk-5FBRVORR.cjs} +12 -12
  55. package/dist/{chunk-S7WIRFNS.cjs.map → chunk-5FBRVORR.cjs.map} +1 -1
  56. package/dist/{chunk-GWXXHOLU.js → chunk-5FT3TLPK.js} +11 -11
  57. package/dist/{chunk-GWXXHOLU.js.map → chunk-5FT3TLPK.js.map} +1 -1
  58. package/dist/{chunk-S3G5VLSW.js → chunk-5UMTUOM5.js} +6 -6
  59. package/dist/{chunk-S3G5VLSW.js.map → chunk-5UMTUOM5.js.map} +1 -1
  60. package/dist/{chunk-RFDEYLIK.js → chunk-6FWSNSRE.js} +7 -7
  61. package/dist/{chunk-RFDEYLIK.js.map → chunk-6FWSNSRE.js.map} +1 -1
  62. package/dist/{chunk-F36KZDFX.cjs → chunk-6JVZSOHQ.cjs} +91 -91
  63. package/dist/{chunk-F36KZDFX.cjs.map → chunk-6JVZSOHQ.cjs.map} +1 -1
  64. package/dist/chunk-6KFLYYOC.cjs +161 -0
  65. package/dist/chunk-6KFLYYOC.cjs.map +1 -0
  66. package/dist/{chunk-D6GCNNMK.cjs → chunk-6NGW27EO.cjs} +10 -10
  67. package/dist/{chunk-D6GCNNMK.cjs.map → chunk-6NGW27EO.cjs.map} +1 -1
  68. package/dist/{chunk-WHS2Y43J.js → chunk-6SWPJEYN.js} +5 -5
  69. package/dist/{chunk-WHS2Y43J.js.map → chunk-6SWPJEYN.js.map} +1 -1
  70. package/dist/{chunk-7TKNK32B.js → chunk-7SQSZN2J.js} +5 -5
  71. package/dist/{chunk-7TKNK32B.js.map → chunk-7SQSZN2J.js.map} +1 -1
  72. package/dist/{chunk-BEB4OFZF.cjs → chunk-AMMWA76F.cjs} +51 -59
  73. package/dist/chunk-AMMWA76F.cjs.map +1 -0
  74. package/dist/{chunk-PYKF7UIL.cjs → chunk-AOSSQDVO.cjs} +13 -13
  75. package/dist/{chunk-PYKF7UIL.cjs.map → chunk-AOSSQDVO.cjs.map} +1 -1
  76. package/dist/{chunk-EDHV4CBU.js → chunk-AVGUJWVX.js} +30 -10
  77. package/dist/chunk-AVGUJWVX.js.map +1 -0
  78. package/dist/{chunk-C2ZP5YS6.cjs → chunk-BCQ76AXA.cjs} +258 -153
  79. package/dist/chunk-BCQ76AXA.cjs.map +1 -0
  80. package/dist/{chunk-WA64ZSCA.cjs → chunk-BFUOME67.cjs} +11 -11
  81. package/dist/{chunk-WA64ZSCA.cjs.map → chunk-BFUOME67.cjs.map} +1 -1
  82. package/dist/{chunk-C6KE2HSQ.cjs → chunk-BR7SHKGM.cjs} +1611 -1382
  83. package/dist/chunk-BR7SHKGM.cjs.map +1 -0
  84. package/dist/{chunk-FCIZNUW5.js → chunk-CHAOFCHV.js} +3 -3
  85. package/dist/{chunk-FCIZNUW5.js.map → chunk-CHAOFCHV.js.map} +1 -1
  86. package/dist/chunk-CICO5GXD.cjs +12 -0
  87. package/dist/{chunk-73MWKDFK.cjs.map → chunk-CICO5GXD.cjs.map} +1 -1
  88. package/dist/{chunk-SXWLLQ3D.js → chunk-D5R42W5D.js} +4 -4
  89. package/dist/{chunk-SXWLLQ3D.js.map → chunk-D5R42W5D.js.map} +1 -1
  90. package/dist/{chunk-YQ4JONWE.js → chunk-DJZTXBWY.js} +342 -113
  91. package/dist/chunk-DJZTXBWY.js.map +1 -0
  92. package/dist/{chunk-BZZI7B43.cjs → chunk-DO7SAMEK.cjs} +47 -47
  93. package/dist/{chunk-BZZI7B43.cjs.map → chunk-DO7SAMEK.cjs.map} +1 -1
  94. package/dist/{chunk-2ZWM2RFH.cjs → chunk-EDN4Y4ZG.cjs} +9 -9
  95. package/dist/{chunk-2ZWM2RFH.cjs.map → chunk-EDN4Y4ZG.cjs.map} +1 -1
  96. package/dist/{chunk-E4OSGBCM.cjs → chunk-EMIB2RXD.cjs} +131 -131
  97. package/dist/{chunk-E4OSGBCM.cjs.map → chunk-EMIB2RXD.cjs.map} +1 -1
  98. package/dist/{chunk-GWUWRZXW.js → chunk-EP4RUYD6.js} +3 -3
  99. package/dist/{chunk-GWUWRZXW.js.map → chunk-EP4RUYD6.js.map} +1 -1
  100. package/dist/{chunk-LHYSY6SE.js → chunk-FNOMT74T.js} +10 -8
  101. package/dist/chunk-FNOMT74T.js.map +1 -0
  102. package/dist/{chunk-ZBVZ7HXD.cjs → chunk-FQPEMEWX.cjs} +12 -12
  103. package/dist/{chunk-ZBVZ7HXD.cjs.map → chunk-FQPEMEWX.cjs.map} +1 -1
  104. package/dist/{chunk-LNIWCQR4.js → chunk-GLHXM7C4.js} +3 -3
  105. package/dist/{chunk-LNIWCQR4.js.map → chunk-GLHXM7C4.js.map} +1 -1
  106. package/dist/{chunk-6BD6ZBKT.cjs → chunk-GYEG3ZLZ.cjs} +10 -10
  107. package/dist/{chunk-6BD6ZBKT.cjs.map → chunk-GYEG3ZLZ.cjs.map} +1 -1
  108. package/dist/{chunk-XBHRKLZU.cjs → chunk-GYUJZARH.cjs} +4 -4
  109. package/dist/{chunk-XBHRKLZU.cjs.map → chunk-GYUJZARH.cjs.map} +1 -1
  110. package/dist/{chunk-A7NMUYEL.cjs → chunk-HDL2ARHX.cjs} +27 -27
  111. package/dist/{chunk-A7NMUYEL.cjs.map → chunk-HDL2ARHX.cjs.map} +1 -1
  112. package/dist/{chunk-5ZJOB5YS.js → chunk-HEV35TGT.js} +4 -4
  113. package/dist/{chunk-5ZJOB5YS.js.map → chunk-HEV35TGT.js.map} +1 -1
  114. package/dist/{chunk-UTVQPZPN.cjs → chunk-I4G3SQPF.cjs} +20 -20
  115. package/dist/{chunk-UTVQPZPN.cjs.map → chunk-I4G3SQPF.cjs.map} +1 -1
  116. package/dist/{chunk-JCNTKRAK.js → chunk-JONXFAPO.js} +5 -5
  117. package/dist/{chunk-JCNTKRAK.js.map → chunk-JONXFAPO.js.map} +1 -1
  118. package/dist/{chunk-GVAMRRZR.cjs → chunk-JR6SX5RH.cjs} +4 -4
  119. package/dist/{chunk-GVAMRRZR.cjs.map → chunk-JR6SX5RH.cjs.map} +1 -1
  120. package/dist/{chunk-N3QTGPC7.cjs → chunk-KABFHAL7.cjs} +100 -99
  121. package/dist/chunk-KABFHAL7.cjs.map +1 -0
  122. package/dist/{chunk-KXSMF6PL.js → chunk-KH7XW7VV.js} +20 -12
  123. package/dist/chunk-KH7XW7VV.js.map +1 -0
  124. package/dist/{chunk-EDJDDY6H.js → chunk-KKBDXCLQ.js} +4 -4
  125. package/dist/{chunk-EDJDDY6H.js.map → chunk-KKBDXCLQ.js.map} +1 -1
  126. package/dist/{chunk-ZHOAZD7Q.cjs → chunk-L3LQNR34.cjs} +161 -161
  127. package/dist/{chunk-ZHOAZD7Q.cjs.map → chunk-L3LQNR34.cjs.map} +1 -1
  128. package/dist/{chunk-IHRDX7K6.js → chunk-LEWHMOUY.js} +46 -56
  129. package/dist/chunk-LEWHMOUY.js.map +1 -0
  130. package/dist/{chunk-AF3TWL5C.cjs → chunk-LRQKXRXO.cjs} +4 -4
  131. package/dist/{chunk-AF3TWL5C.cjs.map → chunk-LRQKXRXO.cjs.map} +1 -1
  132. package/dist/{chunk-WYFB7BN3.js → chunk-M35DF33T.js} +143 -38
  133. package/dist/chunk-M35DF33T.js.map +1 -0
  134. package/dist/{chunk-32UETY6S.cjs → chunk-MFZR4QKM.cjs} +30 -28
  135. package/dist/chunk-MFZR4QKM.cjs.map +1 -0
  136. package/dist/chunk-MKJ4KXL5.cjs +12 -0
  137. package/dist/{chunk-6LAXM4J2.cjs.map → chunk-MKJ4KXL5.cjs.map} +1 -1
  138. package/dist/{chunk-KCH7WQA5.cjs → chunk-MRDBBHIZ.cjs} +48 -2
  139. package/dist/chunk-MRDBBHIZ.cjs.map +1 -0
  140. package/dist/{chunk-QPOQX2DI.cjs → chunk-MX4DHSQP.cjs} +1023 -360
  141. package/dist/chunk-MX4DHSQP.cjs.map +1 -0
  142. package/dist/{chunk-FXNHZFZV.js → chunk-MYKHJI2J.js} +3 -3
  143. package/dist/{chunk-FXNHZFZV.js.map → chunk-MYKHJI2J.js.map} +1 -1
  144. package/dist/{chunk-DSAWGCMP.js → chunk-NAZ2RA4L.js} +3 -3
  145. package/dist/{chunk-DSAWGCMP.js.map → chunk-NAZ2RA4L.js.map} +1 -1
  146. package/dist/{chunk-R7EWHKID.js → chunk-NG2RB5WL.js} +4 -145
  147. package/dist/chunk-NG2RB5WL.js.map +1 -0
  148. package/dist/{chunk-A2LJG5GM.js → chunk-NNQ6A3RM.js} +803 -143
  149. package/dist/chunk-NNQ6A3RM.js.map +1 -0
  150. package/dist/{chunk-72WUT4GG.js → chunk-NVY5CJFP.js} +4 -4
  151. package/dist/{chunk-72WUT4GG.js.map → chunk-NVY5CJFP.js.map} +1 -1
  152. package/dist/{chunk-ZIH42CRX.cjs → chunk-OI2GQ25X.cjs} +7 -7
  153. package/dist/{chunk-ZIH42CRX.cjs.map → chunk-OI2GQ25X.cjs.map} +1 -1
  154. package/dist/{chunk-A4R3H7RU.cjs → chunk-OIFSOPSR.cjs} +259 -238
  155. package/dist/chunk-OIFSOPSR.cjs.map +1 -0
  156. package/dist/{chunk-AU3IJNNP.js → chunk-OMZ37BM2.js} +5 -5
  157. package/dist/{chunk-AU3IJNNP.js.map → chunk-OMZ37BM2.js.map} +1 -1
  158. package/dist/{chunk-C4DYN2SD.cjs → chunk-OORXGFL5.cjs} +48 -48
  159. package/dist/{chunk-C4DYN2SD.cjs.map → chunk-OORXGFL5.cjs.map} +1 -1
  160. package/dist/{chunk-BRN3RGD2.js → chunk-OVI7IXYX.js} +3 -3
  161. package/dist/{chunk-BRN3RGD2.js.map → chunk-OVI7IXYX.js.map} +1 -1
  162. package/dist/{chunk-WMKEGJG4.js → chunk-P6YLZTRE.js} +3 -3
  163. package/dist/{chunk-WMKEGJG4.js.map → chunk-P6YLZTRE.js.map} +1 -1
  164. package/dist/{chunk-AT3MLMJV.js → chunk-QS3NQZVC.js} +82 -16
  165. package/dist/chunk-QS3NQZVC.js.map +1 -0
  166. package/dist/{chunk-EJSYWAEV.js → chunk-QTD6HX4O.js} +5 -5
  167. package/dist/{chunk-EJSYWAEV.js.map → chunk-QTD6HX4O.js.map} +1 -1
  168. package/dist/{chunk-JL5UEBWT.cjs → chunk-ROR5ZR6A.cjs} +45 -45
  169. package/dist/{chunk-JL5UEBWT.cjs.map → chunk-ROR5ZR6A.cjs.map} +1 -1
  170. package/dist/{chunk-FSLTU57P.js → chunk-SDBBMD4N.js} +3 -3
  171. package/dist/{chunk-FSLTU57P.js.map → chunk-SDBBMD4N.js.map} +1 -1
  172. package/dist/{chunk-WEJHA7AD.js → chunk-SE6EGQSD.js} +78 -16
  173. package/dist/chunk-SE6EGQSD.js.map +1 -0
  174. package/dist/{chunk-36LIJXWC.js → chunk-SHFBB23Q.js} +4 -4
  175. package/dist/{chunk-36LIJXWC.js.map → chunk-SHFBB23Q.js.map} +1 -1
  176. package/dist/{chunk-FA6Z7B5L.js → chunk-SHSSRCFR.js} +5 -3
  177. package/dist/chunk-SHSSRCFR.js.map +1 -0
  178. package/dist/{chunk-KOAI3KIV.cjs → chunk-TZEGUG6D.cjs} +4 -4
  179. package/dist/{chunk-KOAI3KIV.cjs.map → chunk-TZEGUG6D.cjs.map} +1 -1
  180. package/dist/{chunk-HNYLMPQQ.cjs → chunk-U5EDAVOJ.cjs} +140 -74
  181. package/dist/chunk-U5EDAVOJ.cjs.map +1 -0
  182. package/dist/{chunk-RHDOAQCT.cjs → chunk-UPAJHMW3.cjs} +122 -114
  183. package/dist/chunk-UPAJHMW3.cjs.map +1 -0
  184. package/dist/{chunk-BQM5P2NO.cjs → chunk-WGX7JH7E.cjs} +235 -170
  185. package/dist/chunk-WGX7JH7E.cjs.map +1 -0
  186. package/dist/{chunk-DYPRZ53S.cjs → chunk-WODMN3Q2.cjs} +27 -27
  187. package/dist/{chunk-DYPRZ53S.cjs.map → chunk-WODMN3Q2.cjs.map} +1 -1
  188. package/dist/{chunk-OZJCH7ZS.js → chunk-XVWOYKIK.js} +3 -3
  189. package/dist/{chunk-OZJCH7ZS.js.map → chunk-XVWOYKIK.js.map} +1 -1
  190. package/dist/chunk-XY5OMOJD.js +147 -0
  191. package/dist/chunk-XY5OMOJD.js.map +1 -0
  192. package/dist/{chunk-KA4L2NZ3.js → chunk-XYBQI6LE.js} +14 -14
  193. package/dist/{chunk-KA4L2NZ3.js.map → chunk-XYBQI6LE.js.map} +1 -1
  194. package/dist/{chunk-EAMVXR5B.js → chunk-ZDKTPBGV.js} +4 -4
  195. package/dist/{chunk-EAMVXR5B.js.map → chunk-ZDKTPBGV.js.map} +1 -1
  196. package/dist/{chunk-Z43KWLZF.js → chunk-ZHNXLS3C.js} +9 -8
  197. package/dist/chunk-ZHNXLS3C.js.map +1 -0
  198. package/dist/{chunk-62ZXBMSD.js → chunk-ZLONH2UD.js} +46 -3
  199. package/dist/chunk-ZLONH2UD.js.map +1 -0
  200. package/dist/core/index.cjs +28 -27
  201. package/dist/core/index.d.cts +4 -4
  202. package/dist/core/index.d.ts +4 -4
  203. package/dist/core/index.js +8 -7
  204. package/dist/{ddl-opIn8DfX.d.ts → ddl-CprnMXJ-.d.ts} +3 -3
  205. package/dist/{ddl-mE07h_EM.d.cts → ddl-DJA7Lci5.d.cts} +3 -3
  206. package/dist/graph-extension/index.cjs +20 -20
  207. package/dist/graph-extension/index.d.cts +4 -4
  208. package/dist/graph-extension/index.d.ts +4 -4
  209. package/dist/graph-extension/index.js +4 -4
  210. package/dist/graph-merge/index.cjs +3204 -635
  211. package/dist/graph-merge/index.cjs.map +1 -1
  212. package/dist/graph-merge/index.d.cts +502 -60
  213. package/dist/graph-merge/index.d.ts +502 -60
  214. package/dist/graph-merge/index.js +2979 -427
  215. package/dist/graph-merge/index.js.map +1 -1
  216. package/dist/{index-Deyu8IXL.d.ts → index-CHTv4XMZ.d.cts} +47 -3
  217. package/dist/{index-DrRS51Ld.d.cts → index-CzoJ3MUw.d.ts} +47 -3
  218. package/dist/index.cjs +229 -216
  219. package/dist/index.cjs.map +1 -1
  220. package/dist/index.d.cts +11 -11
  221. package/dist/index.d.ts +11 -11
  222. package/dist/index.js +35 -34
  223. package/dist/index.js.map +1 -1
  224. package/dist/indexes/index.cjs +13 -13
  225. package/dist/indexes/index.d.cts +4 -4
  226. package/dist/indexes/index.d.ts +4 -4
  227. package/dist/indexes/index.js +6 -6
  228. package/dist/interchange/index.cjs +53 -52
  229. package/dist/interchange/index.cjs.map +1 -1
  230. package/dist/interchange/index.d.cts +17 -13
  231. package/dist/interchange/index.d.ts +17 -13
  232. package/dist/interchange/index.js +17 -16
  233. package/dist/interchange/index.js.map +1 -1
  234. package/dist/{manager-DX983gJ0.d.ts → manager-B6sOQzcQ.d.ts} +2 -2
  235. package/dist/{manager-ptr3JLRP.d.cts → manager-DlY1vlla.d.cts} +2 -2
  236. package/dist/{materialize-indexes-CpXoggWU.d.ts → materialize-indexes-DQL4xcpf.d.ts} +1 -1
  237. package/dist/{materialize-indexes-BXz77YqO.d.cts → materialize-indexes-sskhp-c_.d.cts} +1 -1
  238. package/dist/{postgres-DwgEXSPI.d.cts → postgres-B6YOUcaK.d.ts} +1 -1
  239. package/dist/{postgres-QdOMHTBz.d.ts → postgres-BXy_nyMs.d.cts} +1 -1
  240. package/dist/profiler/index.d.cts +9 -9
  241. package/dist/profiler/index.d.ts +9 -9
  242. package/dist/provenance/index.cjs +43 -42
  243. package/dist/provenance/index.cjs.map +1 -1
  244. package/dist/provenance/index.d.cts +7 -7
  245. package/dist/provenance/index.d.ts +7 -7
  246. package/dist/provenance/index.js +10 -9
  247. package/dist/provenance/index.js.map +1 -1
  248. package/dist/schema/index.cjs +45 -44
  249. package/dist/schema/index.d.cts +6 -6
  250. package/dist/schema/index.d.ts +6 -6
  251. package/dist/schema/index.js +18 -17
  252. package/dist/{searchable-BrUh0pdc.d.cts → searchable-0Cn_lY8U.d.cts} +1 -1
  253. package/dist/{searchable-BOUuA83f.d.ts → searchable-D9gMiwcS.d.ts} +1 -1
  254. package/dist/{sqlite-BfYcV61E.d.cts → sqlite-ClXuBYAj.d.ts} +1 -1
  255. package/dist/{sqlite-DK40XVR1.d.ts → sqlite-DioSxaPe.d.cts} +1 -1
  256. package/dist/{store-Bo1psfVZ.d.ts → store-5j-w5onJ.d.ts} +120 -71
  257. package/dist/{store-FTqBpuJD.d.cts → store-CFedKGU5.d.cts} +120 -71
  258. package/dist/{temporal-CXewwLTB.d.cts → temporal-Ce1pG0S1.d.cts} +1 -1
  259. package/dist/{temporal-DPtn0HOu.d.ts → temporal-CjO9FH1l.d.ts} +1 -1
  260. package/dist/{types-CeT7xM4M.d.ts → types-BrdOFu48.d.ts} +1 -1
  261. package/dist/{types-Du78EvpN.d.ts → types-DKkMJZjR.d.cts} +32 -6
  262. package/dist/{types-Du78EvpN.d.cts → types-DKkMJZjR.d.ts} +32 -6
  263. package/dist/{types-XR1nHERK.d.cts → types-oj_OGAaZ.d.cts} +1 -1
  264. package/dist/{where-CMbFiWwp.d.ts → where-C8w2627G.d.ts} +1 -1
  265. package/dist/{where-CJsp-YUf.d.cts → where-D1wKCJ4Q.d.cts} +1 -1
  266. package/package.json +1 -1
  267. package/dist/chunk-32UETY6S.cjs.map +0 -1
  268. package/dist/chunk-5PDSCELM.cjs.map +0 -1
  269. package/dist/chunk-62ZXBMSD.js.map +0 -1
  270. package/dist/chunk-6LAXM4J2.cjs +0 -12
  271. package/dist/chunk-73MWKDFK.cjs +0 -12
  272. package/dist/chunk-A2LJG5GM.js.map +0 -1
  273. package/dist/chunk-A4R3H7RU.cjs.map +0 -1
  274. package/dist/chunk-ANKOXPCC.cjs.map +0 -1
  275. package/dist/chunk-AT3MLMJV.js.map +0 -1
  276. package/dist/chunk-BEB4OFZF.cjs.map +0 -1
  277. package/dist/chunk-BQM5P2NO.cjs.map +0 -1
  278. package/dist/chunk-C2ZP5YS6.cjs.map +0 -1
  279. package/dist/chunk-C6KE2HSQ.cjs.map +0 -1
  280. package/dist/chunk-EDHV4CBU.js.map +0 -1
  281. package/dist/chunk-FA6Z7B5L.js.map +0 -1
  282. package/dist/chunk-HNYLMPQQ.cjs.map +0 -1
  283. package/dist/chunk-IHRDX7K6.js.map +0 -1
  284. package/dist/chunk-KCH7WQA5.cjs.map +0 -1
  285. package/dist/chunk-KXSMF6PL.js.map +0 -1
  286. package/dist/chunk-LHYSY6SE.js.map +0 -1
  287. package/dist/chunk-N3QTGPC7.cjs.map +0 -1
  288. package/dist/chunk-QPOQX2DI.cjs.map +0 -1
  289. package/dist/chunk-R7EWHKID.js.map +0 -1
  290. package/dist/chunk-RHDOAQCT.cjs.map +0 -1
  291. package/dist/chunk-WEJHA7AD.js.map +0 -1
  292. package/dist/chunk-WYFB7BN3.js.map +0 -1
  293. package/dist/chunk-YQ4JONWE.js.map +0 -1
  294. package/dist/chunk-Z43KWLZF.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkA4R3H7RU_cjs = require('./chunk-A4R3H7RU.cjs');
4
- var chunkGVAMRRZR_cjs = require('./chunk-GVAMRRZR.cjs');
5
- var chunkANKOXPCC_cjs = require('./chunk-ANKOXPCC.cjs');
6
- var chunk5PDSCELM_cjs = require('./chunk-5PDSCELM.cjs');
7
- var chunkZHOAZD7Q_cjs = require('./chunk-ZHOAZD7Q.cjs');
8
- var chunk2ZWM2RFH_cjs = require('./chunk-2ZWM2RFH.cjs');
9
- var chunkKCH7WQA5_cjs = require('./chunk-KCH7WQA5.cjs');
3
+ var chunkOIFSOPSR_cjs = require('./chunk-OIFSOPSR.cjs');
4
+ var chunkJR6SX5RH_cjs = require('./chunk-JR6SX5RH.cjs');
5
+ var chunk3HGRTCDU_cjs = require('./chunk-3HGRTCDU.cjs');
6
+ var chunk425IZOQ5_cjs = require('./chunk-425IZOQ5.cjs');
7
+ var chunkL3LQNR34_cjs = require('./chunk-L3LQNR34.cjs');
8
+ var chunkEDN4Y4ZG_cjs = require('./chunk-EDN4Y4ZG.cjs');
9
+ var chunkMRDBBHIZ_cjs = require('./chunk-MRDBBHIZ.cjs');
10
10
  var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
11
11
 
12
12
  // src/errors/validation.ts
@@ -30,7 +30,7 @@ function validateProps(schema, props, context) {
30
30
  }
31
31
  const issues = zodIssuesToValidationIssues(result.error);
32
32
  const location = buildLocationString(context);
33
- throw new chunkKCH7WQA5_cjs.ValidationError(
33
+ throw new chunkMRDBBHIZ_cjs.ValidationError(
34
34
  `Invalid ${context.entityType} props for ${location}: ${result.error.message}`,
35
35
  {
36
36
  entityType: context.entityType,
@@ -57,7 +57,7 @@ function validateEdgeProps(schema, props, context) {
57
57
  function wrapZodError(error, context) {
58
58
  const issues = zodIssuesToValidationIssues(error);
59
59
  const location = buildLocationString(context);
60
- return new chunkKCH7WQA5_cjs.ValidationError(
60
+ return new chunkMRDBBHIZ_cjs.ValidationError(
61
61
  `Validation failed for ${context.entityType} ${location}: ${error.message}`,
62
62
  {
63
63
  entityType: context.entityType,
@@ -70,7 +70,7 @@ function wrapZodError(error, context) {
70
70
  );
71
71
  }
72
72
  function createValidationError(message, issues, context) {
73
- return new chunkKCH7WQA5_cjs.ValidationError(message, {
73
+ return new chunkMRDBBHIZ_cjs.ValidationError(message, {
74
74
  ...context?.entityType !== void 0 && {
75
75
  entityType: context.entityType
76
76
  },
@@ -88,9 +88,9 @@ function encodeTupleKey(values) {
88
88
 
89
89
  // src/identity/row-codec.ts
90
90
  function toCanonicalIdentityTimestamp(value) {
91
- const canonical = chunk5PDSCELM_cjs.canonicalizeDatabaseTimestamp(value);
91
+ const canonical = chunk425IZOQ5_cjs.canonicalizeDatabaseTimestamp(value);
92
92
  if (canonical === void 0) {
93
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
93
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
94
94
  "Identity relation returned a timestamp that is not a representable instant.",
95
95
  { value },
96
96
  {
@@ -138,8 +138,8 @@ function identityReferenceKey(ref) {
138
138
  return encodeTupleKey([ref.kind, ref.id]);
139
139
  }
140
140
  function compareIdentityReferences(left, right) {
141
- const kindOrder = chunkA4R3H7RU_cjs.compareCodePoints(left.kind, right.kind);
142
- return kindOrder === 0 ? chunkA4R3H7RU_cjs.compareCodePoints(left.id, right.id) : kindOrder;
141
+ const kindOrder = chunkOIFSOPSR_cjs.compareCodePoints(left.kind, right.kind);
142
+ return kindOrder === 0 ? chunkOIFSOPSR_cjs.compareCodePoints(left.id, right.id) : kindOrder;
143
143
  }
144
144
  function normalizeIdentityPair(first, second) {
145
145
  return compareIdentityReferences(first, second) <= 0 ? [first, second] : [second, first];
@@ -174,12 +174,12 @@ function spanningDifferentAssertion(assertions, first, second) {
174
174
  // src/identity/sql-target.ts
175
175
  var MAX_REFERENCE_CHUNK_SIZE = 200;
176
176
  function identityChunkSize(target, input) {
177
- const parameterLimit = chunkA4R3H7RU_cjs.recordedBindParamBudget(target);
177
+ const parameterLimit = chunkOIFSOPSR_cjs.recordedBindParamBudget(target);
178
178
  const chunkSize = Math.floor(
179
179
  (parameterLimit - input.fixedParameters) / input.parametersPerItem
180
180
  );
181
181
  if (chunkSize < 1) {
182
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
182
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
183
183
  "Operational Identity cannot fit this statement within the backend bind-parameter limit.",
184
184
  {
185
185
  code: "IDENTITY_BIND_BUDGET_TOO_SMALL",
@@ -193,7 +193,7 @@ function identityChunkSize(target, input) {
193
193
  }
194
194
  function requireStatementTarget(target) {
195
195
  if (target.executeStatement === void 0) {
196
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
196
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
197
197
  "Operational Identity requires statement execution support.",
198
198
  { code: "IDENTITY_REQUIRES_STATEMENT_EXECUTION" },
199
199
  {
@@ -203,7 +203,7 @@ function requireStatementTarget(target) {
203
203
  }
204
204
  }
205
205
  function identityWriterSlotError(cause) {
206
- return new chunkKCH7WQA5_cjs.ConfigurationError(
206
+ return new chunkMRDBBHIZ_cjs.ConfigurationError(
207
207
  "Operational Identity could not take the SQLite writer slot: this transaction was begun DEFERRED and another connection committed before the identity write, so its read snapshot is stale.",
208
208
  {
209
209
  code: "IDENTITY_TRANSACTION_NOT_WRITE_FENCED",
@@ -218,9 +218,9 @@ function identityWriterSlotError(cause) {
218
218
  async function executeIdentityStatement(target, statement) {
219
219
  requireStatementTarget(target);
220
220
  try {
221
- await target.executeStatement(chunk2ZWM2RFH_cjs.asCompiledStatementSql(statement));
221
+ await target.executeStatement(chunkEDN4Y4ZG_cjs.asCompiledStatementSql(statement));
222
222
  } catch (error) {
223
- if (!chunkGVAMRRZR_cjs.isSqliteStaleSnapshotError(error)) throw error;
223
+ if (!chunkJR6SX5RH_cjs.isSqliteStaleSnapshotError(error)) throw error;
224
224
  throw identityWriterSlotError(error);
225
225
  }
226
226
  }
@@ -234,7 +234,7 @@ function plainRef(ref) {
234
234
  function registeredPlainRef(ctx, ref) {
235
235
  const result = plainRef(ref);
236
236
  if (!ctx.registry.nodeKinds.has(result.kind)) {
237
- throw new chunkKCH7WQA5_cjs.KindNotFoundError(result.kind, "node", {
237
+ throw new chunkMRDBBHIZ_cjs.KindNotFoundError(result.kind, "node", {
238
238
  graphId: ctx.graphId
239
239
  });
240
240
  }
@@ -253,7 +253,7 @@ function normalizePair(first, second) {
253
253
  return normalizeIdentityPair(first, second);
254
254
  }
255
255
  function clampValidTo(timestamp, validFrom) {
256
- return chunkA4R3H7RU_cjs.compareCodePoints(timestamp, validFrom) < 0 ? validFrom : timestamp;
256
+ return chunkOIFSOPSR_cjs.compareCodePoints(timestamp, validFrom) < 0 ? validFrom : timestamp;
257
257
  }
258
258
  function publicAssertion(row) {
259
259
  return {
@@ -274,7 +274,7 @@ function publicNodeRef(ref) {
274
274
  async function lockIdentityGraph(target, graphId) {
275
275
  if (target.dialect !== "postgres") return;
276
276
  await target.execute(
277
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
277
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
278
278
  SELECT pg_advisory_xact_lock(
279
279
  hashtext('typegraph:identity'),
280
280
  hashtext(${graphId})
@@ -286,14 +286,14 @@ async function lockIdentityEnablementNodes(target, schema) {
286
286
  if (target.dialect !== "postgres") return;
287
287
  await executeIdentityStatement(
288
288
  target,
289
- chunk2ZWM2RFH_cjs.sql`LOCK TABLE ${schema.nodesTable} IN SHARE MODE`
289
+ chunkEDN4Y4ZG_cjs.sql`LOCK TABLE ${schema.nodesTable} IN SHARE MODE`
290
290
  );
291
291
  }
292
292
  async function loadNodeSnapshot(target, schema, graphId, coordinate) {
293
- const sqlCoordinate = chunkA4R3H7RU_cjs.identitySqlCoordinate(coordinate, chunk5PDSCELM_cjs.nowIso());
293
+ const sqlCoordinate = chunkOIFSOPSR_cjs.identitySqlCoordinate(coordinate, chunk425IZOQ5_cjs.nowIso());
294
294
  const rows = await target.execute(
295
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(
296
- chunkA4R3H7RU_cjs.identityNodeSnapshotSource(schema, graphId, sqlCoordinate)
295
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(
296
+ chunkOIFSOPSR_cjs.identityNodeSnapshotSource(schema, graphId, sqlCoordinate)
297
297
  )
298
298
  );
299
299
  return rows.map((row) => ({
@@ -319,7 +319,7 @@ async function loadCurrentStructuralClasses(target, schema, graphId, references)
319
319
  });
320
320
  if (uniqueReferences.length > chunkSize) {
321
321
  const combined = /* @__PURE__ */ new Map();
322
- for (const refChunk of chunkGVAMRRZR_cjs.chunk(uniqueReferences, chunkSize)) {
322
+ for (const refChunk of chunkJR6SX5RH_cjs.chunk(uniqueReferences, chunkSize)) {
323
323
  const classes2 = await loadCurrentStructuralClasses(
324
324
  target,
325
325
  schema,
@@ -330,12 +330,12 @@ async function loadCurrentStructuralClasses(target, schema, graphId, references)
330
330
  }
331
331
  return combined;
332
332
  }
333
- const seedRows = chunk2ZWM2RFH_cjs.sql.join(
334
- uniqueReferences.map((ref) => chunk2ZWM2RFH_cjs.sql`(${ref.kind}, ${ref.id})`),
335
- chunk2ZWM2RFH_cjs.sql`, `
333
+ const seedRows = chunkEDN4Y4ZG_cjs.sql.join(
334
+ uniqueReferences.map((ref) => chunkEDN4Y4ZG_cjs.sql`(${ref.kind}, ${ref.id})`),
335
+ chunkEDN4Y4ZG_cjs.sql`, `
336
336
  );
337
337
  const rows = await target.execute(
338
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
338
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
339
339
  WITH seeds(seed_kind, seed_id) AS (
340
340
  VALUES ${seedRows}
341
341
  ), anchors AS (
@@ -373,10 +373,10 @@ async function loadCurrentStructuralClasses(target, schema, graphId, references)
373
373
  );
374
374
  }
375
375
  async function loadCurrentVisibleMembers(target, schema, graphId, ref) {
376
- const now = chunk5PDSCELM_cjs.nowIso();
377
- const coordinate = chunkA4R3H7RU_cjs.identitySqlCoordinate(void 0, now);
376
+ const now = chunk425IZOQ5_cjs.nowIso();
377
+ const coordinate = chunkOIFSOPSR_cjs.identitySqlCoordinate(void 0, now);
378
378
  const rows = await target.execute(
379
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
379
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
380
380
  WITH anchor AS (
381
381
  SELECT class_kind, class_id
382
382
  FROM ${schema.identityClosureTable}
@@ -400,7 +400,7 @@ async function loadCurrentVisibleMembers(target, schema, graphId, ref) {
400
400
  WHERE n.graph_id = ${graphId}
401
401
  AND n.kind = m.kind
402
402
  AND n.id = m.id
403
- AND ${chunkA4R3H7RU_cjs.identityNodeVisibilitySql(coordinate, "n")}
403
+ AND ${chunkOIFSOPSR_cjs.identityNodeVisibilitySql(coordinate, "n")}
404
404
  `)
405
405
  );
406
406
  const members = rows.map((row) => ({ kind: row.kind, id: row.id })).toSorted((left, right) => compareReferences(left, right));
@@ -435,7 +435,7 @@ async function loadHistoricalClasses(target, schema, graphId, references, coordi
435
435
  });
436
436
  if (uniqueReferences.length > chunkSize) {
437
437
  const combined = /* @__PURE__ */ new Map();
438
- for (const refChunk of chunkGVAMRRZR_cjs.chunk(uniqueReferences, chunkSize)) {
438
+ for (const refChunk of chunkJR6SX5RH_cjs.chunk(uniqueReferences, chunkSize)) {
439
439
  const classes = await loadHistoricalClasses(
440
440
  target,
441
441
  schema,
@@ -448,26 +448,26 @@ async function loadHistoricalClasses(target, schema, graphId, references, coordi
448
448
  }
449
449
  return combined;
450
450
  }
451
- const currentInstant = chunk5PDSCELM_cjs.nowIso();
452
- const sqlCoordinate = chunkA4R3H7RU_cjs.identitySqlCoordinate(coordinate, currentInstant);
453
- const seeds = chunk2ZWM2RFH_cjs.sql.join(
454
- uniqueReferences.map((ref) => chunk2ZWM2RFH_cjs.sql`(${ref.kind}, ${ref.id})`),
455
- chunk2ZWM2RFH_cjs.sql`, `
451
+ const currentInstant = chunk425IZOQ5_cjs.nowIso();
452
+ const sqlCoordinate = chunkOIFSOPSR_cjs.identitySqlCoordinate(coordinate, currentInstant);
453
+ const seeds = chunkEDN4Y4ZG_cjs.sql.join(
454
+ uniqueReferences.map((ref) => chunkEDN4Y4ZG_cjs.sql`(${ref.kind}, ${ref.id})`),
455
+ chunkEDN4Y4ZG_cjs.sql`, `
456
456
  );
457
- const reconstruction = chunkA4R3H7RU_cjs.historicalIdentityReconstructionCtes({
457
+ const reconstruction = chunkOIFSOPSR_cjs.historicalIdentityReconstructionCtes({
458
458
  schema,
459
459
  graphId,
460
460
  coordinate: sqlCoordinate,
461
- seedSource: chunk2ZWM2RFH_cjs.sql`VALUES ${seeds}`,
461
+ seedSource: chunkEDN4Y4ZG_cjs.sql`VALUES ${seeds}`,
462
462
  sameIdAcrossKinds
463
463
  });
464
464
  const rows = await target.execute(
465
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
465
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
466
466
  WITH RECURSIVE
467
467
  ${reconstruction}
468
468
  SELECT member.seed_kind, member.seed_id,
469
469
  member.kind AS member_kind, member.id AS member_id,
470
- CASE WHEN ${chunkA4R3H7RU_cjs.identityNodeVisibilitySql(sqlCoordinate, "n")}
470
+ CASE WHEN ${chunkOIFSOPSR_cjs.identityNodeVisibilitySql(sqlCoordinate, "n")}
471
471
  THEN 1 ELSE 0 END AS is_visible
472
472
  FROM identity_members member
473
473
  JOIN node_snapshot n ON n.kind = member.kind AND n.id = member.id
@@ -518,24 +518,24 @@ function visibleMembersAtCoordinate(ctx, ref) {
518
518
  );
519
519
  }
520
520
  async function loadAssertions(target, schema, graphId, coordinate, currentInstant) {
521
- const source = chunkA4R3H7RU_cjs.identityAssertionSnapshotSource(
521
+ const source = chunkOIFSOPSR_cjs.identityAssertionSnapshotSource(
522
522
  schema,
523
523
  graphId,
524
- chunkA4R3H7RU_cjs.identitySqlCoordinate(coordinate, currentInstant),
524
+ chunkOIFSOPSR_cjs.identitySqlCoordinate(coordinate, currentInstant),
525
525
  void 0
526
526
  );
527
527
  const rows = await target.execute(
528
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(source)
528
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(source)
529
529
  );
530
530
  return rows.map((row) => normalizeIdentityAssertionRow(row));
531
531
  }
532
532
  function referenceCondition(kindColumn, idColumn, references) {
533
- if (references.length === 0) return chunk2ZWM2RFH_cjs.sql`1 = 0`;
534
- return chunk2ZWM2RFH_cjs.sql`(${chunk2ZWM2RFH_cjs.sql.join(
533
+ if (references.length === 0) return chunkEDN4Y4ZG_cjs.sql`1 = 0`;
534
+ return chunkEDN4Y4ZG_cjs.sql`(${chunkEDN4Y4ZG_cjs.sql.join(
535
535
  references.map(
536
- (ref) => chunk2ZWM2RFH_cjs.sql`(${kindColumn} = ${ref.kind} AND ${idColumn} = ${ref.id})`
536
+ (ref) => chunkEDN4Y4ZG_cjs.sql`(${kindColumn} = ${ref.kind} AND ${idColumn} = ${ref.id})`
537
537
  ),
538
- chunk2ZWM2RFH_cjs.sql` OR `
538
+ chunkEDN4Y4ZG_cjs.sql` OR `
539
539
  )})`;
540
540
  }
541
541
  async function loadAssertionsTouching(target, schema, graphId, references, coordinate, relation) {
@@ -547,7 +547,7 @@ async function loadAssertionsTouching(target, schema, graphId, references, coord
547
547
  });
548
548
  if (references.length > chunkSize) {
549
549
  const byId = /* @__PURE__ */ new Map();
550
- for (const refChunk of chunkGVAMRRZR_cjs.chunk(references, chunkSize)) {
550
+ for (const refChunk of chunkJR6SX5RH_cjs.chunk(references, chunkSize)) {
551
551
  const assertions = await loadAssertionsTouching(
552
552
  target,
553
553
  schema,
@@ -560,25 +560,25 @@ async function loadAssertionsTouching(target, schema, graphId, references, coord
560
560
  }
561
561
  return [...byId.values()];
562
562
  }
563
- const source = chunkA4R3H7RU_cjs.identityAssertionSnapshotSource(
563
+ const source = chunkOIFSOPSR_cjs.identityAssertionSnapshotSource(
564
564
  schema,
565
565
  graphId,
566
- chunkA4R3H7RU_cjs.identitySqlCoordinate(coordinate, chunk5PDSCELM_cjs.nowIso()),
566
+ chunkOIFSOPSR_cjs.identitySqlCoordinate(coordinate, chunk425IZOQ5_cjs.nowIso()),
567
567
  relation
568
568
  );
569
569
  const aMatches = referenceCondition(
570
- chunk2ZWM2RFH_cjs.sql`identity_assertions.a_kind`,
571
- chunk2ZWM2RFH_cjs.sql`identity_assertions.a_id`,
570
+ chunkEDN4Y4ZG_cjs.sql`identity_assertions.a_kind`,
571
+ chunkEDN4Y4ZG_cjs.sql`identity_assertions.a_id`,
572
572
  references
573
573
  );
574
574
  const bMatches = referenceCondition(
575
- chunk2ZWM2RFH_cjs.sql`identity_assertions.b_kind`,
576
- chunk2ZWM2RFH_cjs.sql`identity_assertions.b_id`,
575
+ chunkEDN4Y4ZG_cjs.sql`identity_assertions.b_kind`,
576
+ chunkEDN4Y4ZG_cjs.sql`identity_assertions.b_id`,
577
577
  references
578
578
  );
579
579
  const rows = await target.execute(
580
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
581
- SELECT ${chunkA4R3H7RU_cjs.IDENTITY_ASSERTION_COLUMNS}
580
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
581
+ SELECT ${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS}
582
582
  FROM (${source}) identity_assertions
583
583
  WHERE ${aMatches} OR ${bMatches}
584
584
  `)
@@ -599,11 +599,11 @@ async function loadSpanningDifferentAssertion(target, schema, graphId, firstClas
599
599
 
600
600
  // src/identity/interchange-read.ts
601
601
  function codePointOrderedAssertionId(target) {
602
- return chunkZHOAZD7Q_cjs.getDialect(target.dialect).binaryText(chunk2ZWM2RFH_cjs.sql`identity_assertions.id`);
602
+ return chunkL3LQNR34_cjs.getDialect(target.dialect).binaryText(chunkEDN4Y4ZG_cjs.sql`identity_assertions.id`);
603
603
  }
604
604
  async function readIdentityAssertionPageAtTarget(ctx, target, mode, options) {
605
605
  if (!Number.isSafeInteger(options.limit) || options.limit <= 0) {
606
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
606
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
607
607
  "Identity assertion page limit must be a positive safe integer.",
608
608
  { limit: options.limit }
609
609
  );
@@ -615,17 +615,17 @@ async function readIdentityAssertionPageAtTarget(ctx, target, mode, options) {
615
615
  parametersPerItem: 2
616
616
  });
617
617
  const filterKindsInMemory = nodeKinds !== void 0 && nodeKinds.length > kindFilterChunkSize;
618
- const kindFilter = nodeKinds === void 0 ? chunk2ZWM2RFH_cjs.sql`` : nodeKinds.length === 0 ? chunk2ZWM2RFH_cjs.sql`AND 1 = 0` : filterKindsInMemory ? chunk2ZWM2RFH_cjs.sql`` : chunk2ZWM2RFH_cjs.sql`
619
- AND identity_assertions.a_kind IN (${chunk2ZWM2RFH_cjs.sql.join(
620
- nodeKinds.map((kind) => chunk2ZWM2RFH_cjs.sql`${kind}`),
621
- chunk2ZWM2RFH_cjs.sql`, `
618
+ const kindFilter = nodeKinds === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : nodeKinds.length === 0 ? chunkEDN4Y4ZG_cjs.sql`AND 1 = 0` : filterKindsInMemory ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`
619
+ AND identity_assertions.a_kind IN (${chunkEDN4Y4ZG_cjs.sql.join(
620
+ nodeKinds.map((kind) => chunkEDN4Y4ZG_cjs.sql`${kind}`),
621
+ chunkEDN4Y4ZG_cjs.sql`, `
622
622
  )})
623
- AND identity_assertions.b_kind IN (${chunk2ZWM2RFH_cjs.sql.join(
624
- nodeKinds.map((kind) => chunk2ZWM2RFH_cjs.sql`${kind}`),
625
- chunk2ZWM2RFH_cjs.sql`, `
623
+ AND identity_assertions.b_kind IN (${chunkEDN4Y4ZG_cjs.sql.join(
624
+ nodeKinds.map((kind) => chunkEDN4Y4ZG_cjs.sql`${kind}`),
625
+ chunkEDN4Y4ZG_cjs.sql`, `
626
626
  )})
627
627
  `;
628
- const liveEndpointJoins = options.includeDeleted === false ? chunk2ZWM2RFH_cjs.sql`
628
+ const liveEndpointJoins = options.includeDeleted === false ? chunkEDN4Y4ZG_cjs.sql`
629
629
  JOIN ${ctx.schema.nodesTable} identity_a_node
630
630
  ON identity_a_node.graph_id = identity_assertions.graph_id
631
631
  AND identity_a_node.kind = identity_assertions.a_kind
@@ -636,10 +636,10 @@ async function readIdentityAssertionPageAtTarget(ctx, target, mode, options) {
636
636
  AND identity_b_node.kind = identity_assertions.b_kind
637
637
  AND identity_b_node.id = identity_assertions.b_id
638
638
  AND identity_b_node.deleted_at IS NULL
639
- ` : chunk2ZWM2RFH_cjs.sql``;
639
+ ` : chunkEDN4Y4ZG_cjs.sql``;
640
640
  const assertionIdKey = codePointOrderedAssertionId(target);
641
641
  const rows = await target.execute(
642
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
642
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
643
643
  SELECT identity_assertions.graph_id AS graph_id,
644
644
  identity_assertions.id AS id,
645
645
  identity_assertions.rel AS rel,
@@ -658,8 +658,8 @@ async function readIdentityAssertionPageAtTarget(ctx, target, mode, options) {
658
658
  ${liveEndpointJoins}
659
659
  WHERE identity_assertions.graph_id = ${ctx.graphId}
660
660
  AND identity_assertions.deleted_at IS NULL
661
- ${options.after === void 0 ? chunk2ZWM2RFH_cjs.sql`` : chunk2ZWM2RFH_cjs.sql`AND ${assertionIdKey} > ${options.after}`}
662
- ${mode === "state" ? chunk2ZWM2RFH_cjs.sql`AND identity_assertions.valid_to IS NULL` : chunk2ZWM2RFH_cjs.sql``}
661
+ ${options.after === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`AND ${assertionIdKey} > ${options.after}`}
662
+ ${mode === "state" ? chunkEDN4Y4ZG_cjs.sql`AND identity_assertions.valid_to IS NULL` : chunkEDN4Y4ZG_cjs.sql``}
663
663
  ${kindFilter}
664
664
  ORDER BY ${assertionIdKey} ASC
665
665
  LIMIT ${options.limit}
@@ -686,6 +686,12 @@ async function readIdentityAssertionsForInterchange(ctx, mode, options) {
686
686
 
687
687
  // src/store/operations/write-transaction.ts
688
688
  var writeTransactionSessions = /* @__PURE__ */ new WeakMap();
689
+ function forceWriteTransactionRevision(target) {
690
+ const session = writeTransactionSessions.get(target);
691
+ if (session === void 0) return false;
692
+ session.wrote = true;
693
+ return true;
694
+ }
689
695
  var heldGraphWriteLocks = /* @__PURE__ */ new WeakMap();
690
696
  async function withWriteTransactionSession(target, ctx, fn) {
691
697
  const session = {
@@ -696,7 +702,7 @@ async function withWriteTransactionSession(target, ctx, fn) {
696
702
  try {
697
703
  const result = await fn();
698
704
  if (session.wrote && ctx.revisionTrackingEnabled && !ctx.historyEnabled) {
699
- await chunkA4R3H7RU_cjs.advanceRevisionClock(target, ctx.revisionSchema, ctx.graphId, true);
705
+ await chunkOIFSOPSR_cjs.advanceRevisionClock(target, ctx.revisionSchema, ctx.graphId, true);
700
706
  }
701
707
  return result;
702
708
  } finally {
@@ -707,7 +713,7 @@ async function lockSchemaVersionForStoreWrite(ctx, backend) {
707
713
  const expectedVersion = ctx.schemaVersion;
708
714
  if (expectedVersion === void 0) return;
709
715
  if ("transaction" in backend && !backend.capabilities.transactions) {
710
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
716
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
711
717
  "Schema-managed Store writes require a transactional backend so schema changes and entity writes can share one fence.",
712
718
  {
713
719
  code: "SCHEMA_WRITE_FENCE_UNSUPPORTED",
@@ -717,7 +723,7 @@ async function lockSchemaVersionForStoreWrite(ctx, backend) {
717
723
  }
718
724
  const lockSchemaVersionForWrite = backend.lockSchemaVersionForWrite;
719
725
  if (lockSchemaVersionForWrite === void 0) {
720
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
726
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
721
727
  "This backend cannot fence schema-managed Store writes against a concurrent schema change.",
722
728
  {
723
729
  code: "SCHEMA_WRITE_FENCE_UNSUPPORTED",
@@ -740,7 +746,7 @@ function graphWriteFenceRefusal(ctx, backend, reason) {
740
746
  if (!("transaction" in backend) || backend.capabilities.transactions) {
741
747
  return void 0;
742
748
  }
743
- return new chunkKCH7WQA5_cjs.ConfigurationError(
749
+ return new chunkMRDBBHIZ_cjs.ConfigurationError(
744
750
  "This backend cannot fence a constrained write: enforcing a declared constraint requires a transaction to scope the per-graph write lock to, and this backend has no transactions.",
745
751
  {
746
752
  code: "CONSTRAINT_WRITE_FENCE_UNSUPPORTED",
@@ -758,19 +764,19 @@ function runInWriteTransaction(ctx, backend, fn, options) {
758
764
  const refusal = fenceReason === void 0 ? void 0 : graphWriteFenceRefusal(ctx, backend, fenceReason);
759
765
  if (refusal !== void 0) return Promise.reject(refusal);
760
766
  const needsGraphWriteLock = ctx.historyEnabled || ctx.revisionTrackingEnabled || fenceReason !== void 0;
761
- return chunkANKOXPCC_cjs.runOptionallyInTransaction(backend, async (target) => {
767
+ return chunk3HGRTCDU_cjs.runOptionallyInTransaction(backend, async (target) => {
762
768
  await lockSchemaVersionForStoreWrite(ctx, target);
763
769
  const session = needsGraphWriteLock ? writeTransactionSessions.get(target) : void 0;
764
770
  const held = heldGraphWriteLocks.get(target) ?? /* @__PURE__ */ new Set();
765
771
  heldGraphWriteLocks.set(target, held);
766
772
  const acquiresLock = needsGraphWriteLock && session?.lock === void 0 && !held.has(ctx.graphId);
767
773
  if (acquiresLock) held.add(ctx.graphId);
768
- const lock = acquiresLock ? await chunkA4R3H7RU_cjs.lockRecordedGraphWrite(target, ctx.graphId).catch(
774
+ const lock = acquiresLock ? await chunkOIFSOPSR_cjs.lockRecordedGraphWrite(target, ctx.graphId).catch(
769
775
  (error) => {
770
776
  held.delete(ctx.graphId);
771
777
  throw error;
772
778
  }
773
- ) : session?.lock ?? chunkA4R3H7RU_cjs.uncapturedGraphWriteLock();
779
+ ) : session?.lock ?? chunkOIFSOPSR_cjs.uncapturedGraphWriteLock();
774
780
  if (session !== void 0) session.lock = lock;
775
781
  const result = await (acquiresLock ? fn(target, lock).finally(() => held.delete(ctx.graphId)) : fn(target, lock));
776
782
  if (session !== void 0) {
@@ -778,7 +784,7 @@ function runInWriteTransaction(ctx, backend, fn, options) {
778
784
  return result;
779
785
  }
780
786
  if (ctx.revisionTrackingEnabled && !ctx.historyEnabled && (options?.didWrite?.(result) ?? true)) {
781
- await chunkA4R3H7RU_cjs.advanceRevisionClock(
787
+ await chunkOIFSOPSR_cjs.advanceRevisionClock(
782
788
  target,
783
789
  ctx.revisionSchema,
784
790
  ctx.graphId,
@@ -897,7 +903,7 @@ function identityActiveKinds(registry) {
897
903
  return new Set(registry.nodeKinds.keys());
898
904
  }
899
905
  async function loadSnapshot(target, schema, graphId, coordinate, allowedKinds, sameIdAcrossKinds = "fold") {
900
- const currentInstant = chunk5PDSCELM_cjs.nowIso();
906
+ const currentInstant = chunk425IZOQ5_cjs.nowIso();
901
907
  const [nodes, assertions] = await Promise.all([
902
908
  loadNodeSnapshot(target, schema, graphId, coordinate),
903
909
  loadAssertions(target, schema, graphId, coordinate, currentInstant)
@@ -981,7 +987,7 @@ function validateSnapshotIntegrity(snapshot, registry, graphId) {
981
987
  const a = { kind: assertion.a_kind, id: assertion.a_id };
982
988
  const b = { kind: assertion.b_kind, id: assertion.b_id };
983
989
  if (!structuralKeys.has(refKey(a)) || !structuralKeys.has(refKey(b))) {
984
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
990
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
985
991
  "Operational Identity contains a current assertion with a missing or deleted endpoint.",
986
992
  {
987
993
  code: "IDENTITY_SCHEMA_CONTRADICTION",
@@ -993,7 +999,7 @@ function validateSnapshotIntegrity(snapshot, registry, graphId) {
993
999
  );
994
1000
  }
995
1001
  if (assertion.rel === "different" && sameComponent(snapshot, a, b)) {
996
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
1002
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
997
1003
  "Operational Identity contains a different assertion within one identity class.",
998
1004
  {
999
1005
  code: "IDENTITY_SCHEMA_CONTRADICTION",
@@ -1015,7 +1021,7 @@ function validateSnapshotIntegrity(snapshot, registry, graphId) {
1015
1021
  component
1016
1022
  );
1017
1023
  if (conflictingKinds !== void 0) {
1018
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
1024
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
1019
1025
  "Operational Identity class conflicts with ontology disjointness.",
1020
1026
  {
1021
1027
  code: "IDENTITY_SCHEMA_CONTRADICTION",
@@ -1028,7 +1034,7 @@ function validateSnapshotIntegrity(snapshot, registry, graphId) {
1028
1034
  }
1029
1035
  }
1030
1036
  function closureMismatchError(graphId, detail) {
1031
- return new chunkKCH7WQA5_cjs.ConfigurationError(
1037
+ return new chunkMRDBBHIZ_cjs.ConfigurationError(
1032
1038
  "Operational Identity materialized closure does not match computed identity components.",
1033
1039
  { code: "IDENTITY_SCHEMA_CONTRADICTION", graphId, ...detail },
1034
1040
  {
@@ -1049,7 +1055,7 @@ async function assertClosureMatchesComponents(target, schema, graphId, component
1049
1055
  }
1050
1056
  }
1051
1057
  const rows = await target.execute(
1052
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
1058
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1053
1059
  SELECT member_kind, member_id, class_kind, class_id
1054
1060
  FROM ${schema.identityClosureTable}
1055
1061
  WHERE graph_id = ${graphId}
@@ -1079,7 +1085,7 @@ async function assertClosureMatchesComponents(target, schema, graphId, component
1079
1085
  }
1080
1086
  }
1081
1087
  function selfAssertionError(relation) {
1082
- return new chunkKCH7WQA5_cjs.ValidationError(
1088
+ return new chunkMRDBBHIZ_cjs.ValidationError(
1083
1089
  `Identity ${relation} assertions require two distinct node references.`,
1084
1090
  {
1085
1091
  issues: [
@@ -1098,7 +1104,7 @@ function selfAssertionError(relation) {
1098
1104
  async function requireLiveEndpoint(target, graphId, ref) {
1099
1105
  const row = await target.getNode(graphId, ref.kind, ref.id);
1100
1106
  if (row === void 0 || row.deleted_at !== void 0) {
1101
- throw new chunkKCH7WQA5_cjs.NodeNotFoundError(ref.kind, ref.id);
1107
+ throw new chunkMRDBBHIZ_cjs.NodeNotFoundError(ref.kind, ref.id);
1102
1108
  }
1103
1109
  }
1104
1110
  async function loadLiveReferences(target, schema, graphId, references) {
@@ -1110,15 +1116,15 @@ async function loadLiveReferences(target, schema, graphId, references) {
1110
1116
  });
1111
1117
  if (references.length > chunkSize) {
1112
1118
  const byKey = /* @__PURE__ */ new Map();
1113
- for (const refChunk of chunkGVAMRRZR_cjs.chunk(references, chunkSize)) {
1119
+ for (const refChunk of chunkJR6SX5RH_cjs.chunk(references, chunkSize)) {
1114
1120
  const live = await loadLiveReferences(target, schema, graphId, refChunk);
1115
1121
  for (const ref of live) byKey.set(refKey(ref), ref);
1116
1122
  }
1117
1123
  return [...byKey.values()];
1118
1124
  }
1119
- const matches = referenceCondition(chunk2ZWM2RFH_cjs.sql`kind`, chunk2ZWM2RFH_cjs.sql`id`, references);
1125
+ const matches = referenceCondition(chunkEDN4Y4ZG_cjs.sql`kind`, chunkEDN4Y4ZG_cjs.sql`id`, references);
1120
1126
  const rows = await target.execute(
1121
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
1127
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1122
1128
  SELECT kind, id
1123
1129
  FROM ${schema.nodesTable}
1124
1130
  WHERE graph_id = ${graphId}
@@ -1134,7 +1140,7 @@ async function requireLiveEndpoints(target, schema, graphId, references) {
1134
1140
  const live = await loadLiveReferences(target, schema, graphId, references);
1135
1141
  const liveKeys = new Set(live.map((ref) => refKey(ref)));
1136
1142
  for (const [key, ref] of uniqueByKey) {
1137
- if (!liveKeys.has(key)) throw new chunkKCH7WQA5_cjs.NodeNotFoundError(ref.kind, ref.id);
1143
+ if (!liveKeys.has(key)) throw new chunkMRDBBHIZ_cjs.NodeNotFoundError(ref.kind, ref.id);
1138
1144
  }
1139
1145
  }
1140
1146
  async function requireStructuralEndpoints(target, schema, graphId, references) {
@@ -1148,10 +1154,10 @@ async function requireStructuralEndpoints(target, schema, graphId, references) {
1148
1154
  parametersPerItem: 2
1149
1155
  });
1150
1156
  const presentKeys = /* @__PURE__ */ new Set();
1151
- for (const refChunk of chunkGVAMRRZR_cjs.chunk(unique, chunkSize)) {
1152
- const matches = referenceCondition(chunk2ZWM2RFH_cjs.sql`kind`, chunk2ZWM2RFH_cjs.sql`id`, refChunk);
1157
+ for (const refChunk of chunkJR6SX5RH_cjs.chunk(unique, chunkSize)) {
1158
+ const matches = referenceCondition(chunkEDN4Y4ZG_cjs.sql`kind`, chunkEDN4Y4ZG_cjs.sql`id`, refChunk);
1153
1159
  const rows = await target.execute(
1154
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
1160
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1155
1161
  SELECT kind, id
1156
1162
  FROM ${schema.nodesTable}
1157
1163
  WHERE graph_id = ${graphId}
@@ -1163,7 +1169,7 @@ async function requireStructuralEndpoints(target, schema, graphId, references) {
1163
1169
  }
1164
1170
  }
1165
1171
  for (const [key, ref] of uniqueByKey) {
1166
- if (!presentKeys.has(key)) throw new chunkKCH7WQA5_cjs.NodeNotFoundError(ref.kind, ref.id);
1172
+ if (!presentKeys.has(key)) throw new chunkMRDBBHIZ_cjs.NodeNotFoundError(ref.kind, ref.id);
1167
1173
  }
1168
1174
  }
1169
1175
 
@@ -1177,7 +1183,7 @@ function pairKey(pair) {
1177
1183
  return `${pair.low}${PAIR_KEY_SEPARATOR}${pair.high}`;
1178
1184
  }
1179
1185
  function orderedPair(first, second) {
1180
- return chunkA4R3H7RU_cjs.compareCodePoints(first, second) <= 0 ? { low: first, high: second } : { low: second, high: first };
1186
+ return chunkOIFSOPSR_cjs.compareCodePoints(first, second) <= 0 ? { low: first, high: second } : { low: second, high: first };
1181
1187
  }
1182
1188
  function buildSeparationProjection(assertions, classKeyOf) {
1183
1189
  const pairs = /* @__PURE__ */ new Map();
@@ -1202,7 +1208,7 @@ function buildSeparationProjection(assertions, classKeyOf) {
1202
1208
  async function deleteSeparationForGraph(target, schema, graphId) {
1203
1209
  await executeIdentityStatement(
1204
1210
  target,
1205
- chunk2ZWM2RFH_cjs.sql`DELETE FROM ${schema.identitySeparationTable} WHERE graph_id = ${graphId}`
1211
+ chunkEDN4Y4ZG_cjs.sql`DELETE FROM ${schema.identitySeparationTable} WHERE graph_id = ${graphId}`
1206
1212
  );
1207
1213
  }
1208
1214
  async function deleteSeparationForClassKeys(target, schema, graphId, classKeys) {
@@ -1213,14 +1219,14 @@ async function deleteSeparationForClassKeys(target, schema, graphId, classKeys)
1213
1219
  maxItems: MAX_REFERENCE_CHUNK_SIZE,
1214
1220
  parametersPerItem: 2
1215
1221
  });
1216
- for (const keyChunk of chunkGVAMRRZR_cjs.chunk(unique, chunkSize)) {
1217
- const keyList = chunk2ZWM2RFH_cjs.sql.join(
1218
- keyChunk.map((key) => chunk2ZWM2RFH_cjs.sql`${key}`),
1219
- chunk2ZWM2RFH_cjs.sql`, `
1222
+ for (const keyChunk of chunkJR6SX5RH_cjs.chunk(unique, chunkSize)) {
1223
+ const keyList = chunkEDN4Y4ZG_cjs.sql.join(
1224
+ keyChunk.map((key) => chunkEDN4Y4ZG_cjs.sql`${key}`),
1225
+ chunkEDN4Y4ZG_cjs.sql`, `
1220
1226
  );
1221
1227
  await executeIdentityStatement(
1222
1228
  target,
1223
- chunk2ZWM2RFH_cjs.sql`
1229
+ chunkEDN4Y4ZG_cjs.sql`
1224
1230
  DELETE FROM ${schema.identitySeparationTable}
1225
1231
  WHERE graph_id = ${graphId}
1226
1232
  AND (class_key_low IN (${keyList}) OR class_key_high IN (${keyList}))
@@ -1257,7 +1263,7 @@ function proveSeparationReadiness(registry, graphId) {
1257
1263
  async function probeSeparationPair(target, schema, graphId, pair) {
1258
1264
  try {
1259
1265
  const rows = await target.execute(
1260
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
1266
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1261
1267
  SELECT
1262
1268
  (
1263
1269
  SELECT COUNT(*) FROM ${schema.identitySeparationTable}
@@ -1280,7 +1286,7 @@ async function probeSeparationPair(target, schema, graphId, pair) {
1280
1286
  pairSeparated: countOf(row, "pair_rows") > 0
1281
1287
  };
1282
1288
  } catch (error) {
1283
- if (!chunkGVAMRRZR_cjs.isMissingTableError(error)) throw error;
1289
+ if (!chunkJR6SX5RH_cjs.isMissingTableError(error)) throw error;
1284
1290
  throw separationUnreadableError(graphId, schema, error);
1285
1291
  }
1286
1292
  }
@@ -1288,7 +1294,7 @@ function countOf(row, column) {
1288
1294
  return Number(row?.[column] ?? 0);
1289
1295
  }
1290
1296
  function separationUnreadableError(graphId, schema, cause) {
1291
- return new chunkKCH7WQA5_cjs.ConfigurationError(
1297
+ return new chunkMRDBBHIZ_cjs.ConfigurationError(
1292
1298
  "Operational Identity could not read the materialized separation relation.",
1293
1299
  {
1294
1300
  code: "IDENTITY_STORAGE_MISSING",
@@ -1302,7 +1308,7 @@ function separationUnreadableError(graphId, schema, cause) {
1302
1308
  );
1303
1309
  }
1304
1310
  function separationUnfilledError(graphId, schema) {
1305
- return new chunkKCH7WQA5_cjs.ConfigurationError(
1311
+ return new chunkMRDBBHIZ_cjs.ConfigurationError(
1306
1312
  "Operational Identity found the separation relation present but never filled for this graph.",
1307
1313
  {
1308
1314
  code: "IDENTITY_STORAGE_MISSING",
@@ -1328,7 +1334,7 @@ async function separationRebuildRequired(target, schema, graphId, options) {
1328
1334
  }
1329
1335
  async function hasSeparationRows(target, schema, graphId) {
1330
1336
  const rows = await target.execute(
1331
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
1337
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1332
1338
  SELECT 1 AS present
1333
1339
  FROM ${schema.identitySeparationTable}
1334
1340
  WHERE graph_id = ${graphId}
@@ -1341,7 +1347,7 @@ async function hasLiveDifferentAssertions(target, schema, graphId, registry) {
1341
1347
  if (!await probeAnyLiveDifferent(target, schema, graphId)) return false;
1342
1348
  const activeKinds = [...identityActiveKinds(registry)];
1343
1349
  if (activeKinds.length === 0) return false;
1344
- const kindChunks = chunkGVAMRRZR_cjs.chunk(activeKinds, owedProbeChunkSize(target));
1350
+ const kindChunks = chunkJR6SX5RH_cjs.chunk(activeKinds, owedProbeChunkSize(target));
1345
1351
  for (const first of kindChunks) {
1346
1352
  for (const second of kindChunks) {
1347
1353
  if (await probeOwedSeparation(target, schema, graphId, [first, second])) {
@@ -1355,7 +1361,7 @@ var IDENTITY_SNAPSHOT_PARAMETERS = 4;
1355
1361
  var OWED_SEPARATION_PROBE_PARAMETERS = IDENTITY_SNAPSHOT_PARAMETERS + 2;
1356
1362
  async function probeAnyLiveDifferent(target, schema, graphId) {
1357
1363
  const rows = await target.execute(
1358
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
1364
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1359
1365
  SELECT 1 AS present
1360
1366
  FROM (${liveDifferentSource(schema, graphId)}) live_different
1361
1367
  LIMIT 1
@@ -1365,7 +1371,7 @@ async function probeAnyLiveDifferent(target, schema, graphId) {
1365
1371
  }
1366
1372
  async function probeOwedSeparation(target, schema, graphId, kinds) {
1367
1373
  const rows = await target.execute(
1368
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
1374
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1369
1375
  SELECT 1 AS present
1370
1376
  FROM (${liveDifferentSource(schema, graphId)}) live_different
1371
1377
  LEFT JOIN ${schema.identityClosureTable} class_a
@@ -1397,22 +1403,22 @@ function owedProbeChunkSize(target) {
1397
1403
  });
1398
1404
  }
1399
1405
  function liveDifferentSource(schema, graphId) {
1400
- return chunkA4R3H7RU_cjs.identityAssertionSnapshotSource(
1406
+ return chunkOIFSOPSR_cjs.identityAssertionSnapshotSource(
1401
1407
  schema,
1402
1408
  graphId,
1403
- chunkA4R3H7RU_cjs.identitySqlCoordinate(void 0, chunk5PDSCELM_cjs.nowIso()),
1409
+ chunkOIFSOPSR_cjs.identitySqlCoordinate(void 0, chunk425IZOQ5_cjs.nowIso()),
1404
1410
  "different"
1405
1411
  );
1406
1412
  }
1407
1413
  function kindList(kinds) {
1408
- return chunk2ZWM2RFH_cjs.sql.join(
1409
- kinds.map((kind) => chunk2ZWM2RFH_cjs.sql`${kind}`),
1410
- chunk2ZWM2RFH_cjs.sql`, `
1414
+ return chunkEDN4Y4ZG_cjs.sql.join(
1415
+ kinds.map((kind) => chunkEDN4Y4ZG_cjs.sql`${kind}`),
1416
+ chunkEDN4Y4ZG_cjs.sql`, `
1411
1417
  );
1412
1418
  }
1413
1419
  async function readSeparationForGraph(target, schema, graphId) {
1414
1420
  const rows = await target.execute(
1415
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
1421
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1416
1422
  SELECT class_key_low, class_key_high
1417
1423
  FROM ${schema.identitySeparationTable}
1418
1424
  WHERE graph_id = ${graphId}
@@ -1429,23 +1435,23 @@ async function insertSeparationRows(target, schema, graphId, projection) {
1429
1435
  maxItems: MAX_SEPARATION_INSERT_CHUNK_SIZE,
1430
1436
  parametersPerItem: 3
1431
1437
  });
1432
- for (const pairChunk of chunkGVAMRRZR_cjs.chunk(projection.pairs, chunkSize)) {
1438
+ for (const pairChunk of chunkJR6SX5RH_cjs.chunk(projection.pairs, chunkSize)) {
1433
1439
  const values = pairChunk.map(
1434
- (pair) => chunk2ZWM2RFH_cjs.sql`(${graphId}, ${pair.low}, ${pair.high})`
1440
+ (pair) => chunkEDN4Y4ZG_cjs.sql`(${graphId}, ${pair.low}, ${pair.high})`
1435
1441
  );
1436
1442
  try {
1437
1443
  await executeIdentityStatement(
1438
1444
  target,
1439
- chunk2ZWM2RFH_cjs.sql`
1445
+ chunkEDN4Y4ZG_cjs.sql`
1440
1446
  INSERT INTO ${schema.identitySeparationTable} (
1441
1447
  graph_id, class_key_low, class_key_high
1442
- ) VALUES ${chunk2ZWM2RFH_cjs.sql.join(values, chunk2ZWM2RFH_cjs.sql`, `)}
1448
+ ) VALUES ${chunkEDN4Y4ZG_cjs.sql.join(values, chunkEDN4Y4ZG_cjs.sql`, `)}
1443
1449
  `
1444
1450
  );
1445
1451
  } catch (error) {
1446
1452
  const collapsed = collapsedIn(projection, pairChunk);
1447
1453
  if (collapsed === void 0) throw error;
1448
- throw new chunkKCH7WQA5_cjs.IdentitySeparationViolationError(
1454
+ throw new chunkMRDBBHIZ_cjs.IdentitySeparationViolationError(
1449
1455
  { graphId, enforcedBy: "database", ...collapsed },
1450
1456
  { cause: error }
1451
1457
  );
@@ -1453,7 +1459,7 @@ async function insertSeparationRows(target, schema, graphId, projection) {
1453
1459
  }
1454
1460
  const accepted = projection.collapsed[0];
1455
1461
  if (accepted === void 0) return;
1456
- throw new chunkKCH7WQA5_cjs.IdentitySeparationViolationError({
1462
+ throw new chunkMRDBBHIZ_cjs.IdentitySeparationViolationError({
1457
1463
  graphId,
1458
1464
  enforcedBy: "writer",
1459
1465
  ...accepted
@@ -1483,7 +1489,7 @@ function assertSeparationMatchesProjection(graphId, persisted, projection) {
1483
1489
  }
1484
1490
  }
1485
1491
  function separationMismatchError(graphId, detail) {
1486
- return new chunkKCH7WQA5_cjs.ConfigurationError(
1492
+ return new chunkMRDBBHIZ_cjs.ConfigurationError(
1487
1493
  "Operational Identity materialized separation relation does not match the assertion ledger.",
1488
1494
  { code: "IDENTITY_SCHEMA_CONTRADICTION", graphId, ...detail },
1489
1495
  {
@@ -1492,6 +1498,51 @@ function separationMismatchError(graphId, detail) {
1492
1498
  );
1493
1499
  }
1494
1500
 
1501
+ // src/identity/validity-window.ts
1502
+ function hasExplicitIdentityValidityWindow(window) {
1503
+ return window?.validFrom !== void 0 || window?.validTo !== void 0;
1504
+ }
1505
+ function resolveIdentityValidityWindow(window, operationInstant) {
1506
+ const validFrom = chunk425IZOQ5_cjs.validateOptionalCanonicalIsoDate(window?.validFrom, "validFrom") ?? operationInstant;
1507
+ const validTo = chunk425IZOQ5_cjs.validateOptionalCanonicalIsoDate(window?.validTo, "validTo");
1508
+ if (chunkOIFSOPSR_cjs.compareCodePoints(validFrom, operationInstant) > 0) {
1509
+ throw new chunkMRDBBHIZ_cjs.IdentityValidityWindowError({
1510
+ reason: "future-valid-from",
1511
+ validFrom,
1512
+ ...validTo === void 0 ? {} : { validTo },
1513
+ operationInstant
1514
+ });
1515
+ }
1516
+ if (validTo !== void 0 && chunkOIFSOPSR_cjs.compareCodePoints(validTo, operationInstant) > 0) {
1517
+ throw new chunkMRDBBHIZ_cjs.IdentityValidityWindowError({
1518
+ reason: "future-valid-to",
1519
+ validFrom,
1520
+ validTo,
1521
+ operationInstant
1522
+ });
1523
+ }
1524
+ if (validTo !== void 0 && chunkOIFSOPSR_cjs.compareCodePoints(validTo, validFrom) < 0) {
1525
+ throw new chunkMRDBBHIZ_cjs.IdentityValidityWindowError({
1526
+ reason: "inverted",
1527
+ validFrom,
1528
+ validTo,
1529
+ operationInstant
1530
+ });
1531
+ }
1532
+ const effective = validTo === validFrom ? "empty" : validTo === void 0 ? "current" : "historical";
1533
+ return {
1534
+ validFrom,
1535
+ ...validTo === void 0 ? {} : { validTo },
1536
+ effective
1537
+ };
1538
+ }
1539
+ function identityValidityWindowsOverlap(left, right) {
1540
+ if (left.validFrom === left.validTo || right.validFrom === right.validTo) {
1541
+ return false;
1542
+ }
1543
+ return (right.validTo === void 0 || left.validFrom < right.validTo) && (left.validTo === void 0 || right.validFrom < left.validTo);
1544
+ }
1545
+
1495
1546
  // src/identity/service-mutation.ts
1496
1547
  async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
1497
1548
  const classes = await loadCurrentStructuralClasses(
@@ -1504,7 +1555,7 @@ async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
1504
1555
  const bClass = chunkN66HCGCY_cjs.requireDefined(classes.get(refKey(b)));
1505
1556
  if (relation === "different") {
1506
1557
  if (!containsRef(aClass, b)) return;
1507
- throw new chunkKCH7WQA5_cjs.IdentityContradictionError({
1558
+ throw new chunkMRDBBHIZ_cjs.IdentityContradictionError({
1508
1559
  operation,
1509
1560
  a,
1510
1561
  b,
@@ -1523,7 +1574,7 @@ async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
1523
1574
  );
1524
1575
  if (different === void 0)
1525
1576
  throw unexpectedSeparationError(ctx.graphId, aKey, bKey);
1526
- throw new chunkKCH7WQA5_cjs.IdentityContradictionError({
1577
+ throw new chunkMRDBBHIZ_cjs.IdentityContradictionError({
1527
1578
  operation,
1528
1579
  a,
1529
1580
  b,
@@ -1533,7 +1584,7 @@ async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
1533
1584
  }
1534
1585
  const disjointKinds = classHasDisjointKinds(ctx.registry, aClass, bClass);
1535
1586
  if (disjointKinds === void 0) return;
1536
- throw new chunkKCH7WQA5_cjs.IdentityContradictionError({
1587
+ throw new chunkMRDBBHIZ_cjs.IdentityContradictionError({
1537
1588
  operation,
1538
1589
  a,
1539
1590
  b,
@@ -1543,8 +1594,8 @@ async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
1543
1594
  }
1544
1595
  async function currentAssertionForPair(target, schema, graphId, relation, a, b) {
1545
1596
  const rows = await target.execute(
1546
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
1547
- SELECT ${chunkA4R3H7RU_cjs.IDENTITY_ASSERTION_COLUMNS}
1597
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1598
+ SELECT ${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS}
1548
1599
  FROM ${schema.identityAssertionsTable}
1549
1600
  WHERE graph_id = ${graphId}
1550
1601
  AND rel = ${relation}
@@ -1559,23 +1610,50 @@ async function currentAssertionForPair(target, schema, graphId, relation, a, b)
1559
1610
  );
1560
1611
  return rows[0] === void 0 ? void 0 : normalizeIdentityAssertionRow(rows[0]);
1561
1612
  }
1562
- async function insertAssertion(target, schema, graphId, relation, a, b, timestamp, touch, preserved) {
1563
- const row = buildAssertionRow(graphId, relation, a, b, timestamp, preserved);
1613
+ async function assertionForExactWindow(target, schema, graphId, relation, a, b, window) {
1614
+ const validToMatch = window.validTo === void 0 ? chunkEDN4Y4ZG_cjs.sql`valid_to IS NULL` : chunkEDN4Y4ZG_cjs.sql`valid_to = ${window.validTo}`;
1615
+ const rows = await target.execute(
1616
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1617
+ SELECT ${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS}
1618
+ FROM ${schema.identityAssertionsTable}
1619
+ WHERE graph_id = ${graphId}
1620
+ AND rel = ${relation}
1621
+ AND a_kind = ${a.kind}
1622
+ AND a_id = ${a.id}
1623
+ AND b_kind = ${b.kind}
1624
+ AND b_id = ${b.id}
1625
+ AND valid_from = ${window.validFrom}
1626
+ AND ${validToMatch}
1627
+ AND deleted_at IS NULL
1628
+ LIMIT 1
1629
+ `)
1630
+ );
1631
+ return rows[0] === void 0 ? void 0 : normalizeIdentityAssertionRow(rows[0]);
1632
+ }
1633
+ async function insertAssertion(target, schema, graphId, relation, a, b, operationInstant, touch, options) {
1634
+ const row = buildAssertionRow(
1635
+ graphId,
1636
+ relation,
1637
+ a,
1638
+ b,
1639
+ operationInstant,
1640
+ options
1641
+ );
1564
1642
  await insertAssertionRows(target, schema, [row]);
1565
1643
  touch(graphId, row.id, row);
1566
1644
  return row;
1567
1645
  }
1568
- function buildAssertionRow(graphId, relation, a, b, timestamp, preserved) {
1646
+ function buildAssertionRow(graphId, relation, a, b, timestamp, options) {
1569
1647
  return {
1570
1648
  graph_id: graphId,
1571
- id: preserved?.id ?? chunkA4R3H7RU_cjs.generateId(),
1649
+ id: options?.id ?? chunkOIFSOPSR_cjs.generateId(),
1572
1650
  rel: relation,
1573
1651
  a_kind: a.kind,
1574
1652
  a_id: a.id,
1575
1653
  b_kind: b.kind,
1576
1654
  b_id: b.id,
1577
- valid_from: preserved?.validFrom ?? timestamp,
1578
- valid_to: void 0,
1655
+ valid_from: options?.validFrom ?? timestamp,
1656
+ valid_to: options?.validTo,
1579
1657
  created_at: timestamp,
1580
1658
  updated_at: timestamp,
1581
1659
  deleted_at: void 0,
@@ -1583,8 +1661,331 @@ function buildAssertionRow(graphId, relation, a, b, timestamp, preserved) {
1583
1661
  ended_by_id: void 0
1584
1662
  };
1585
1663
  }
1664
+ function canonicalEndpointTimestamp(value) {
1665
+ if (value === void 0 || value === null) return void 0;
1666
+ return chunk425IZOQ5_cjs.canonicalizeDatabaseTimestamp(value);
1667
+ }
1668
+ async function requireEndpointsCoverIdentityWindow(target, graphId, references, window) {
1669
+ for (const ref of references) {
1670
+ const row = await target.getNode(graphId, ref.kind, ref.id);
1671
+ if (row === void 0) throw new chunkMRDBBHIZ_cjs.NodeNotFoundError(ref.kind, ref.id);
1672
+ if (window.effective === "empty") continue;
1673
+ const validFrom = canonicalEndpointTimestamp(row.valid_from);
1674
+ const validTo = canonicalEndpointTimestamp(row.valid_to);
1675
+ const deletedAt = canonicalEndpointTimestamp(row.deleted_at);
1676
+ const endpointWindow = {
1677
+ ...validFrom === void 0 ? {} : { validFrom },
1678
+ ...validTo === void 0 ? {} : { validTo },
1679
+ ...deletedAt === void 0 ? {} : { deletedAt }
1680
+ };
1681
+ const startsTooLate = endpointWindow.validFrom !== void 0 && endpointWindow.validFrom > window.validFrom;
1682
+ const effectiveEnd = [endpointWindow.validTo, endpointWindow.deletedAt].filter((value) => value !== void 0).toSorted()[0];
1683
+ const endsTooEarly = window.validTo === void 0 ? effectiveEnd !== void 0 : effectiveEnd !== void 0 && effectiveEnd < window.validTo;
1684
+ if (!startsTooLate && !endsTooEarly) continue;
1685
+ throw new chunkMRDBBHIZ_cjs.IdentityEndpointValidityError({
1686
+ endpoint: ref,
1687
+ assertionWindow: {
1688
+ validFrom: window.validFrom,
1689
+ ...window.validTo === void 0 ? {} : { validTo: window.validTo }
1690
+ },
1691
+ endpointWindow
1692
+ });
1693
+ }
1694
+ }
1695
+ function windowOverlapSql(alias, lowerBoundary, upperBoundary) {
1696
+ const column = (name) => chunkEDN4Y4ZG_cjs.sql`${chunkEDN4Y4ZG_cjs.sql.identifier(alias)}.${chunkEDN4Y4ZG_cjs.sql.identifier(name)}`;
1697
+ return chunkEDN4Y4ZG_cjs.sql`
1698
+ ${column("deleted_at")} IS NULL
1699
+ AND ${column("valid_from")} <= ${upperBoundary}
1700
+ AND (${column("valid_to")} IS NULL OR ${column("valid_to")} > ${lowerBoundary})
1701
+ `;
1702
+ }
1703
+ async function loadIdentityWindowLedger(target, schema, graphId, requests, operationInstant, sameIdAcrossKinds) {
1704
+ const activeRequests = requests.filter(
1705
+ (request) => request.window.effective !== "empty"
1706
+ );
1707
+ if (activeRequests.length === 0) return { nodes: [], assertions: [] };
1708
+ const referencesByKey = /* @__PURE__ */ new Map();
1709
+ for (const request of activeRequests) {
1710
+ for (const reference of request.references) {
1711
+ referencesByKey.set(refKey(reference), reference);
1712
+ }
1713
+ }
1714
+ const references = [...referencesByKey.values()];
1715
+ const lowerBoundary = chunkN66HCGCY_cjs.requireDefined(
1716
+ activeRequests.map((request) => request.window.validFrom).toSorted()[0]
1717
+ );
1718
+ const upperBoundary = chunkN66HCGCY_cjs.requireDefined(
1719
+ activeRequests.map((request) => request.window.validTo ?? operationInstant).toSorted().at(-1)
1720
+ );
1721
+ const seedChunkSize = identityChunkSize(target, {
1722
+ fixedParameters: 20,
1723
+ maxItems: MAX_REFERENCE_CHUNK_SIZE,
1724
+ parametersPerItem: 2
1725
+ });
1726
+ const rows = [];
1727
+ for (const referenceChunk of chunkJR6SX5RH_cjs.chunk(references, seedChunkSize)) {
1728
+ const seedRows = chunkEDN4Y4ZG_cjs.sql.join(
1729
+ referenceChunk.map(
1730
+ (reference) => chunkEDN4Y4ZG_cjs.sql`(${reference.kind}, ${reference.id})`
1731
+ ),
1732
+ chunkEDN4Y4ZG_cjs.sql`, `
1733
+ );
1734
+ const component = sameIdAcrossKinds === "fold" ? chunkEDN4Y4ZG_cjs.sql`
1735
+ neighbor_modes(mode) AS (
1736
+ VALUES ('assertion'), ('fold')
1737
+ ),
1738
+ component(kind, id) AS (
1739
+ SELECT seed_kind, seed_id FROM seeds
1740
+ UNION
1741
+ SELECT CASE
1742
+ WHEN neighbor_modes.mode = 'fold' THEN folded.kind
1743
+ WHEN assertion.a_kind = component.kind AND assertion.a_id = component.id
1744
+ THEN assertion.b_kind
1745
+ ELSE assertion.a_kind
1746
+ END,
1747
+ CASE
1748
+ WHEN neighbor_modes.mode = 'fold' THEN folded.id
1749
+ WHEN assertion.a_kind = component.kind AND assertion.a_id = component.id
1750
+ THEN assertion.b_id
1751
+ ELSE assertion.a_id
1752
+ END
1753
+ FROM component
1754
+ JOIN neighbor_modes ON 1 = 1
1755
+ LEFT JOIN ${schema.identityAssertionsTable} assertion
1756
+ ON neighbor_modes.mode = 'assertion'
1757
+ AND assertion.graph_id = ${graphId}
1758
+ AND assertion.rel = 'same'
1759
+ AND ${windowOverlapSql("assertion", lowerBoundary, upperBoundary)}
1760
+ AND ((assertion.a_kind = component.kind AND assertion.a_id = component.id)
1761
+ OR (assertion.b_kind = component.kind AND assertion.b_id = component.id))
1762
+ LEFT JOIN ${schema.nodesTable} folded
1763
+ ON neighbor_modes.mode = 'fold'
1764
+ AND folded.graph_id = ${graphId}
1765
+ AND folded.id = component.id
1766
+ WHERE assertion.id IS NOT NULL OR folded.id IS NOT NULL
1767
+ )
1768
+ ` : chunkEDN4Y4ZG_cjs.sql`
1769
+ component(kind, id) AS (
1770
+ SELECT seed_kind, seed_id FROM seeds
1771
+ UNION
1772
+ SELECT CASE
1773
+ WHEN assertion.a_kind = component.kind AND assertion.a_id = component.id
1774
+ THEN assertion.b_kind
1775
+ ELSE assertion.a_kind
1776
+ END,
1777
+ CASE
1778
+ WHEN assertion.a_kind = component.kind AND assertion.a_id = component.id
1779
+ THEN assertion.b_id
1780
+ ELSE assertion.a_id
1781
+ END
1782
+ FROM component
1783
+ JOIN ${schema.identityAssertionsTable} assertion
1784
+ ON assertion.graph_id = ${graphId}
1785
+ AND assertion.rel = 'same'
1786
+ AND ${windowOverlapSql("assertion", lowerBoundary, upperBoundary)}
1787
+ AND ((assertion.a_kind = component.kind AND assertion.a_id = component.id)
1788
+ OR (assertion.b_kind = component.kind AND assertion.b_id = component.id))
1789
+ )
1790
+ `;
1791
+ rows.push(
1792
+ ...await target.execute(
1793
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1794
+ WITH RECURSIVE
1795
+ seeds(seed_kind, seed_id) AS (VALUES ${seedRows}),
1796
+ ${component},
1797
+ selected_assertions AS (
1798
+ SELECT DISTINCT assertion.*
1799
+ FROM ${schema.identityAssertionsTable} assertion
1800
+ JOIN component
1801
+ ON (assertion.a_kind = component.kind AND assertion.a_id = component.id)
1802
+ OR (assertion.b_kind = component.kind AND assertion.b_id = component.id)
1803
+ WHERE assertion.graph_id = ${graphId}
1804
+ AND ${windowOverlapSql("assertion", lowerBoundary, upperBoundary)}
1805
+ )
1806
+ SELECT 'assertion' AS row_type, ${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS},
1807
+ NULL AS node_kind, NULL AS node_id,
1808
+ NULL AS node_created_at, NULL AS node_deleted_at
1809
+ FROM selected_assertions
1810
+ UNION ALL
1811
+ SELECT 'node', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1812
+ NULL, NULL, NULL, NULL, NULL,
1813
+ node.kind, node.id, node.created_at, node.deleted_at
1814
+ FROM ${schema.nodesTable} node
1815
+ JOIN component ON component.kind = node.kind AND component.id = node.id
1816
+ WHERE node.graph_id = ${graphId}
1817
+ `)
1818
+ )
1819
+ );
1820
+ }
1821
+ const nodesByKey = /* @__PURE__ */ new Map();
1822
+ const assertionsById = /* @__PURE__ */ new Map();
1823
+ for (const row of rows) {
1824
+ if (row.row_type === "assertion") {
1825
+ const assertion = normalizeIdentityAssertionRow(row);
1826
+ assertionsById.set(assertion.id, assertion);
1827
+ continue;
1828
+ }
1829
+ if (typeof row.node_kind !== "string" || typeof row.node_id !== "string")
1830
+ continue;
1831
+ const createdAt = canonicalEndpointTimestamp(row.node_created_at);
1832
+ if (createdAt === void 0) continue;
1833
+ const deletedAt = canonicalEndpointTimestamp(row.node_deleted_at);
1834
+ const node = {
1835
+ ref: { kind: row.node_kind, id: row.node_id },
1836
+ createdAt,
1837
+ ...deletedAt === void 0 ? {} : { deletedAt }
1838
+ };
1839
+ nodesByKey.set(refKey(node.ref), node);
1840
+ }
1841
+ return {
1842
+ nodes: [...nodesByKey.values()],
1843
+ assertions: [...assertionsById.values()]
1844
+ };
1845
+ }
1846
+ function identityWindowCheckpoints(window, operationInstant, nodes, assertions) {
1847
+ if (window.effective === "empty") return [];
1848
+ const checkpoints = /* @__PURE__ */ new Set([window.validFrom]);
1849
+ if (window.validTo === void 0) checkpoints.add(operationInstant);
1850
+ for (const row of [...assertions, ...nodes]) {
1851
+ for (const value of [
1852
+ "valid_from" in row ? row.valid_from : void 0,
1853
+ "valid_to" in row ? row.valid_to : void 0,
1854
+ "createdAt" in row ? row.createdAt : void 0,
1855
+ "deletedAt" in row ? row.deletedAt : void 0
1856
+ ]) {
1857
+ const boundary = canonicalEndpointTimestamp(value);
1858
+ if (boundary === void 0 || boundary < window.validFrom) continue;
1859
+ if (window.validTo !== void 0 && boundary >= window.validTo) continue;
1860
+ if (boundary > operationInstant) continue;
1861
+ checkpoints.add(boundary);
1862
+ }
1863
+ }
1864
+ return [...checkpoints].toSorted();
1865
+ }
1866
+ function validateRelationAgainstLedger(ctx, nodes, assertions, relation, operation, a, b, window, operationInstant) {
1867
+ const checkpoints = identityWindowCheckpoints(
1868
+ window,
1869
+ operationInstant,
1870
+ nodes,
1871
+ assertions
1872
+ );
1873
+ for (const instant of checkpoints) {
1874
+ const structuralNodes = nodes.map((node) => node.ref);
1875
+ const activeAssertions = assertions.filter(
1876
+ (assertion) => assertion.deleted_at === void 0 && assertion.valid_from <= instant && (assertion.valid_to === void 0 || assertion.valid_to > instant)
1877
+ );
1878
+ const activeFoldReferences = nodes.filter(
1879
+ (node) => node.createdAt <= instant && (node.deletedAt === void 0 || node.deletedAt > instant)
1880
+ ).map((node) => node.ref);
1881
+ const foldAssertions = [];
1882
+ if (ctx.sameIdAcrossKinds === "fold") {
1883
+ const byId = /* @__PURE__ */ new Map();
1884
+ for (const reference of activeFoldReferences) {
1885
+ const sameId = byId.get(reference.id) ?? [];
1886
+ sameId.push(reference);
1887
+ byId.set(reference.id, sameId);
1888
+ }
1889
+ for (const sameId of byId.values()) {
1890
+ const first = sameId[0];
1891
+ if (first === void 0) continue;
1892
+ for (const other of sameId.slice(1)) {
1893
+ foldAssertions.push({
1894
+ rel: "same",
1895
+ a_kind: first.kind,
1896
+ a_id: first.id,
1897
+ b_kind: other.kind,
1898
+ b_id: other.id
1899
+ });
1900
+ }
1901
+ }
1902
+ }
1903
+ const components = buildComponents(
1904
+ structuralNodes,
1905
+ [...activeAssertions, ...foldAssertions],
1906
+ "ignore"
1907
+ );
1908
+ const aClass = components.get(refKey(a)) ?? [];
1909
+ const bClass = components.get(refKey(b)) ?? [];
1910
+ if (relation === "different") {
1911
+ if (!containsRef(aClass, b)) continue;
1912
+ throw new chunkMRDBBHIZ_cjs.IdentityContradictionError({
1913
+ operation,
1914
+ a,
1915
+ b,
1916
+ reason: "same-class"
1917
+ });
1918
+ }
1919
+ const different = spanningDifferentAssertion(
1920
+ activeAssertions,
1921
+ aClass,
1922
+ bClass
1923
+ );
1924
+ if (different !== void 0) {
1925
+ throw new chunkMRDBBHIZ_cjs.IdentityContradictionError({
1926
+ operation,
1927
+ a,
1928
+ b,
1929
+ reason: "different-assertion",
1930
+ conflictingAssertionId: different.id
1931
+ });
1932
+ }
1933
+ const disjointKinds = classHasDisjointKinds(ctx.registry, aClass, bClass);
1934
+ if (disjointKinds === void 0) continue;
1935
+ throw new chunkMRDBBHIZ_cjs.IdentityContradictionError({
1936
+ operation,
1937
+ a,
1938
+ b,
1939
+ reason: "disjoint-kinds",
1940
+ conflictingKinds: disjointKinds
1941
+ });
1942
+ }
1943
+ }
1944
+ async function createIdentityWindowValidator(ctx, target, requests, operationInstant, ignoredAssertionIds = /* @__PURE__ */ new Set()) {
1945
+ const ledger = await loadIdentityWindowLedger(
1946
+ target,
1947
+ ctx.schema,
1948
+ ctx.graphId,
1949
+ requests,
1950
+ operationInstant,
1951
+ ctx.sameIdAcrossKinds
1952
+ );
1953
+ if (ignoredAssertionIds.size > 0) {
1954
+ const retained = ledger.assertions.filter(
1955
+ (assertion) => !ignoredAssertionIds.has(assertion.id)
1956
+ );
1957
+ ledger.assertions.splice(0, ledger.assertions.length, ...retained);
1958
+ }
1959
+ return {
1960
+ validate(relation, operation, a, b, window) {
1961
+ validateRelationAgainstLedger(
1962
+ ctx,
1963
+ ledger.nodes,
1964
+ ledger.assertions,
1965
+ relation,
1966
+ operation,
1967
+ a,
1968
+ b,
1969
+ window,
1970
+ operationInstant
1971
+ );
1972
+ },
1973
+ record(assertion) {
1974
+ ledger.assertions.push(assertion);
1975
+ }
1976
+ };
1977
+ }
1978
+ async function validateRelationThroughoutIdentityWindow(ctx, target, relation, operation, a, b, window, operationInstant) {
1979
+ const validator = await createIdentityWindowValidator(
1980
+ ctx,
1981
+ target,
1982
+ [{ references: [a, b], window }],
1983
+ operationInstant
1984
+ );
1985
+ validator.validate(relation, operation, a, b, window);
1986
+ }
1586
1987
  function nullableAssertionValue(value) {
1587
- return value === void 0 ? chunk2ZWM2RFH_cjs.sql`NULL` : chunk2ZWM2RFH_cjs.sql`${value}`;
1988
+ return value === void 0 ? chunkEDN4Y4ZG_cjs.sql`NULL` : chunkEDN4Y4ZG_cjs.sql`${value}`;
1588
1989
  }
1589
1990
  async function insertAssertionRows(target, schema, rows) {
1590
1991
  if (rows.length === 0) return;
@@ -1593,9 +1994,9 @@ async function insertAssertionRows(target, schema, rows) {
1593
1994
  maxItems: MAX_ASSERTION_INSERT_CHUNK_SIZE,
1594
1995
  parametersPerItem: 14
1595
1996
  });
1596
- for (const rowChunk of chunkGVAMRRZR_cjs.chunk(rows, chunkSize)) {
1997
+ for (const rowChunk of chunkJR6SX5RH_cjs.chunk(rows, chunkSize)) {
1597
1998
  const values = rowChunk.map(
1598
- (row) => chunk2ZWM2RFH_cjs.sql`
1999
+ (row) => chunkEDN4Y4ZG_cjs.sql`
1599
2000
  (
1600
2001
  ${row.graph_id}, ${row.id}, ${row.rel}, ${row.a_kind}, ${row.a_id},
1601
2002
  ${row.b_kind}, ${row.b_id}, ${row.valid_from},
@@ -1609,8 +2010,8 @@ async function insertAssertionRows(target, schema, rows) {
1609
2010
  );
1610
2011
  await executeIdentityStatement(
1611
2012
  target,
1612
- chunk2ZWM2RFH_cjs.sql`
1613
- INSERT INTO ${schema.identityAssertionsTable} (${chunkA4R3H7RU_cjs.IDENTITY_ASSERTION_COLUMNS}) VALUES ${chunk2ZWM2RFH_cjs.sql.join(values, chunk2ZWM2RFH_cjs.sql`, `)}
2013
+ chunkEDN4Y4ZG_cjs.sql`
2014
+ INSERT INTO ${schema.identityAssertionsTable} (${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS}) VALUES ${chunkEDN4Y4ZG_cjs.sql.join(values, chunkEDN4Y4ZG_cjs.sql`, `)}
1614
2015
  `
1615
2016
  );
1616
2017
  }
@@ -1624,14 +2025,14 @@ async function loadAssertionsByIds(target, schema, graphId, ids) {
1624
2025
  maxItems: MAX_REFERENCE_CHUNK_SIZE,
1625
2026
  parametersPerItem: 1
1626
2027
  });
1627
- for (const idChunk of chunkGVAMRRZR_cjs.chunk(uniqueIds, chunkSize)) {
1628
- const idList = chunk2ZWM2RFH_cjs.sql.join(
1629
- idChunk.map((id) => chunk2ZWM2RFH_cjs.sql`${id}`),
1630
- chunk2ZWM2RFH_cjs.sql`, `
2028
+ for (const idChunk of chunkJR6SX5RH_cjs.chunk(uniqueIds, chunkSize)) {
2029
+ const idList = chunkEDN4Y4ZG_cjs.sql.join(
2030
+ idChunk.map((id) => chunkEDN4Y4ZG_cjs.sql`${id}`),
2031
+ chunkEDN4Y4ZG_cjs.sql`, `
1631
2032
  );
1632
2033
  const rows = await target.execute(
1633
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
1634
- SELECT ${chunkA4R3H7RU_cjs.IDENTITY_ASSERTION_COLUMNS}
2034
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
2035
+ SELECT ${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS}
1635
2036
  FROM ${schema.identityAssertionsTable}
1636
2037
  WHERE graph_id = ${graphId} AND id IN (${idList})
1637
2038
  `)
@@ -1653,13 +2054,13 @@ async function loadCurrentClassAnchors(target, schema, graphId, references) {
1653
2054
  maxItems: MAX_REFERENCE_CHUNK_SIZE,
1654
2055
  parametersPerItem: 2
1655
2056
  });
1656
- for (const refChunk of chunkGVAMRRZR_cjs.chunk(uniqueReferences, chunkSize)) {
1657
- const seedRows = chunk2ZWM2RFH_cjs.sql.join(
1658
- refChunk.map((ref) => chunk2ZWM2RFH_cjs.sql`(${ref.kind}, ${ref.id})`),
1659
- chunk2ZWM2RFH_cjs.sql`, `
2057
+ for (const refChunk of chunkJR6SX5RH_cjs.chunk(uniqueReferences, chunkSize)) {
2058
+ const seedRows = chunkEDN4Y4ZG_cjs.sql.join(
2059
+ refChunk.map((ref) => chunkEDN4Y4ZG_cjs.sql`(${ref.kind}, ${ref.id})`),
2060
+ chunkEDN4Y4ZG_cjs.sql`, `
1660
2061
  );
1661
2062
  const rows = await target.execute(
1662
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
2063
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
1663
2064
  WITH seeds(seed_kind, seed_id) AS (
1664
2065
  VALUES ${seedRows}
1665
2066
  )
@@ -1754,7 +2155,7 @@ async function replaceClosure(target, schema, graphId, allowedKinds, sameIdAcros
1754
2155
  );
1755
2156
  await executeIdentityStatement(
1756
2157
  target,
1757
- chunk2ZWM2RFH_cjs.sql`DELETE FROM ${schema.identityClosureTable} WHERE graph_id = ${graphId}`
2158
+ chunkEDN4Y4ZG_cjs.sql`DELETE FROM ${schema.identityClosureTable} WHERE graph_id = ${graphId}`
1758
2159
  );
1759
2160
  await insertClosureComponents(target, schema, graphId, snapshot.components);
1760
2161
  await deleteSeparationForGraph(target, schema, graphId);
@@ -1777,7 +2178,7 @@ async function insertClosureComponents(target, schema, graphId, components) {
1777
2178
  for (const member of component) {
1778
2179
  emitted.add(refKey(member));
1779
2180
  values.push(
1780
- chunk2ZWM2RFH_cjs.sql`(${graphId}, ${member.kind}, ${member.id}, ${canonical.kind}, ${canonical.id})`
2181
+ chunkEDN4Y4ZG_cjs.sql`(${graphId}, ${member.kind}, ${member.id}, ${canonical.kind}, ${canonical.id})`
1781
2182
  );
1782
2183
  }
1783
2184
  }
@@ -1787,13 +2188,13 @@ async function insertClosureComponents(target, schema, graphId, components) {
1787
2188
  maxItems: MAX_CLOSURE_INSERT_CHUNK_SIZE,
1788
2189
  parametersPerItem: 5
1789
2190
  });
1790
- for (const valueChunk of chunkGVAMRRZR_cjs.chunk(values, chunkSize)) {
2191
+ for (const valueChunk of chunkJR6SX5RH_cjs.chunk(values, chunkSize)) {
1791
2192
  await executeIdentityStatement(
1792
2193
  target,
1793
- chunk2ZWM2RFH_cjs.sql`
2194
+ chunkEDN4Y4ZG_cjs.sql`
1794
2195
  INSERT INTO ${schema.identityClosureTable} (
1795
2196
  graph_id, member_kind, member_id, class_kind, class_id
1796
- ) VALUES ${chunk2ZWM2RFH_cjs.sql.join(valueChunk, chunk2ZWM2RFH_cjs.sql`, `)}
2197
+ ) VALUES ${chunkEDN4Y4ZG_cjs.sql.join(valueChunk, chunkEDN4Y4ZG_cjs.sql`, `)}
1797
2198
  `
1798
2199
  );
1799
2200
  }
@@ -1832,15 +2233,15 @@ async function replaceAffectedClosure(target, schema, graphId, references, sameI
1832
2233
  maxItems: MAX_REFERENCE_CHUNK_SIZE,
1833
2234
  parametersPerItem: 2
1834
2235
  });
1835
- for (const affectedChunk of chunkGVAMRRZR_cjs.chunk(affected, chunkSize)) {
2236
+ for (const affectedChunk of chunkJR6SX5RH_cjs.chunk(affected, chunkSize)) {
1836
2237
  const matches = referenceCondition(
1837
- chunk2ZWM2RFH_cjs.sql`member_kind`,
1838
- chunk2ZWM2RFH_cjs.sql`member_id`,
2238
+ chunkEDN4Y4ZG_cjs.sql`member_kind`,
2239
+ chunkEDN4Y4ZG_cjs.sql`member_id`,
1839
2240
  affectedChunk
1840
2241
  );
1841
2242
  await executeIdentityStatement(
1842
2243
  target,
1843
- chunk2ZWM2RFH_cjs.sql`
2244
+ chunkEDN4Y4ZG_cjs.sql`
1844
2245
  DELETE FROM ${schema.identityClosureTable}
1845
2246
  WHERE graph_id = ${graphId} AND ${matches}
1846
2247
  `
@@ -1876,7 +2277,7 @@ async function mergeCurrentClasses(target, schema, graphId, a, b) {
1876
2277
  if (refKey(previousCanonical) === refKey(canonical)) return;
1877
2278
  await executeIdentityStatement(
1878
2279
  target,
1879
- chunk2ZWM2RFH_cjs.sql`
2280
+ chunkEDN4Y4ZG_cjs.sql`
1880
2281
  UPDATE ${schema.identityClosureTable}
1881
2282
  SET class_kind = ${canonical.kind}, class_id = ${canonical.id}
1882
2283
  WHERE graph_id = ${graphId}
@@ -1892,47 +2293,120 @@ async function mergeCurrentClasses(target, schema, graphId, a, b) {
1892
2293
  );
1893
2294
  if (singletonMembers.length > 0) {
1894
2295
  const values = singletonMembers.map(
1895
- (member) => chunk2ZWM2RFH_cjs.sql`(${graphId}, ${member.kind}, ${member.id}, ${canonical.kind}, ${canonical.id})`
2296
+ (member) => chunkEDN4Y4ZG_cjs.sql`(${graphId}, ${member.kind}, ${member.id}, ${canonical.kind}, ${canonical.id})`
1896
2297
  );
1897
2298
  await executeIdentityStatement(
1898
2299
  target,
1899
- chunk2ZWM2RFH_cjs.sql`
2300
+ chunkEDN4Y4ZG_cjs.sql`
1900
2301
  INSERT INTO ${schema.identityClosureTable} (
1901
2302
  graph_id, member_kind, member_id, class_kind, class_id
1902
- ) VALUES ${chunk2ZWM2RFH_cjs.sql.join(values, chunk2ZWM2RFH_cjs.sql`, `)}
2303
+ ) VALUES ${chunkEDN4Y4ZG_cjs.sql.join(values, chunkEDN4Y4ZG_cjs.sql`, `)}
1903
2304
  `
1904
2305
  );
1905
2306
  }
1906
2307
  await replaceSeparationForMembers(target, schema, graphId, fusedMembers);
1907
2308
  }
1908
- async function assertPair(ctx, target, relation, firstInput, secondInput, touch) {
2309
+ async function assertPair(ctx, target, relation, firstInput, secondInput, touch, windowInput, operationInstant, windowValidator) {
1909
2310
  const first = registeredPlainRef(ctx, firstInput);
1910
2311
  const second = registeredPlainRef(ctx, secondInput);
1911
2312
  if (refKey(first) === refKey(second)) throw selfAssertionError(relation);
1912
2313
  const [a, b] = normalizePair(first, second);
1913
- await Promise.all([
1914
- requireLiveEndpoint(target, ctx.graphId, a),
1915
- requireLiveEndpoint(target, ctx.graphId, b)
1916
- ]);
1917
- const existing = await currentAssertionForPair(
2314
+ if (windowInput === void 0) {
2315
+ const current = await currentAssertionForPair(
2316
+ target,
2317
+ ctx.schema,
2318
+ ctx.graphId,
2319
+ relation,
2320
+ a,
2321
+ b
2322
+ );
2323
+ if (current !== void 0) {
2324
+ return assertionResult(publicAssertion(current), "existing");
2325
+ }
2326
+ await Promise.all([
2327
+ requireLiveEndpoint(target, ctx.graphId, a),
2328
+ requireLiveEndpoint(target, ctx.graphId, b)
2329
+ ]);
2330
+ await validateCurrentRelation(
2331
+ ctx,
2332
+ target,
2333
+ relation,
2334
+ relation === "same" ? "assertSame" : "assertDifferent",
2335
+ a,
2336
+ b
2337
+ );
2338
+ const row2 = await insertAssertion(
2339
+ target,
2340
+ ctx.schema,
2341
+ ctx.graphId,
2342
+ relation,
2343
+ a,
2344
+ b,
2345
+ operationInstant,
2346
+ touch
2347
+ );
2348
+ windowValidator?.record(row2);
2349
+ if (relation === "same") {
2350
+ await mergeCurrentClasses(target, ctx.schema, ctx.graphId, a, b);
2351
+ } else {
2352
+ await replaceSeparationForReferences(target, ctx.schema, ctx.graphId, [
2353
+ a,
2354
+ b
2355
+ ]);
2356
+ }
2357
+ return assertionResult(publicAssertion(row2), "created");
2358
+ }
2359
+ const window = resolveIdentityValidityWindow(windowInput, operationInstant);
2360
+ await requireEndpointsCoverIdentityWindow(
2361
+ target,
2362
+ ctx.graphId,
2363
+ [a, b],
2364
+ window
2365
+ );
2366
+ const existing = await assertionForExactWindow(
1918
2367
  target,
1919
2368
  ctx.schema,
1920
2369
  ctx.graphId,
1921
2370
  relation,
1922
2371
  a,
1923
- b
2372
+ b,
2373
+ window
1924
2374
  );
1925
2375
  if (existing !== void 0) {
1926
2376
  return assertionResult(publicAssertion(existing), "existing");
1927
2377
  }
1928
- await validateCurrentRelation(
1929
- ctx,
1930
- target,
1931
- relation,
1932
- relation === "same" ? "assertSame" : "assertDifferent",
1933
- a,
1934
- b
1935
- );
2378
+ if (window.effective === "current") {
2379
+ const current = await currentAssertionForPair(
2380
+ target,
2381
+ ctx.schema,
2382
+ ctx.graphId,
2383
+ relation,
2384
+ a,
2385
+ b
2386
+ );
2387
+ if (current !== void 0) {
2388
+ throw new chunkMRDBBHIZ_cjs.IdentityValidityWindowError({
2389
+ reason: "overlapping-open-window",
2390
+ validFrom: window.validFrom,
2391
+ operationInstant
2392
+ });
2393
+ }
2394
+ }
2395
+ const operation = relation === "same" ? "assertSame" : "assertDifferent";
2396
+ if (windowValidator === void 0) {
2397
+ await validateRelationThroughoutIdentityWindow(
2398
+ ctx,
2399
+ target,
2400
+ relation,
2401
+ operation,
2402
+ a,
2403
+ b,
2404
+ window,
2405
+ operationInstant
2406
+ );
2407
+ } else {
2408
+ windowValidator.validate(relation, operation, a, b, window);
2409
+ }
1936
2410
  const row = await insertAssertion(
1937
2411
  target,
1938
2412
  ctx.schema,
@@ -1940,9 +2414,17 @@ async function assertPair(ctx, target, relation, firstInput, secondInput, touch)
1940
2414
  relation,
1941
2415
  a,
1942
2416
  b,
1943
- chunk5PDSCELM_cjs.nowIso(),
1944
- touch
2417
+ operationInstant,
2418
+ touch,
2419
+ {
2420
+ validFrom: window.validFrom,
2421
+ ...window.validTo === void 0 ? {} : { validTo: window.validTo }
2422
+ }
1945
2423
  );
2424
+ windowValidator?.record(row);
2425
+ if (window.effective !== "current") {
2426
+ return assertionResult(publicAssertion(row), "created");
2427
+ }
1946
2428
  if (relation === "same") {
1947
2429
  await mergeCurrentClasses(target, ctx.schema, ctx.graphId, a, b);
1948
2430
  } else {
@@ -2053,7 +2535,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
2053
2535
  const createdRows = [];
2054
2536
  const results = [];
2055
2537
  const closureReferences = [];
2056
- const timestamp = chunk5PDSCELM_cjs.nowIso();
2538
+ const timestamp = chunk425IZOQ5_cjs.nowIso();
2057
2539
  const operation = relation === "same" ? "assertSame" : "assertDifferent";
2058
2540
  for (const [a, b] of normalizedPairs) {
2059
2541
  const semanticKey = assertionSemanticKey(relation, a, b);
@@ -2066,7 +2548,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
2066
2548
  const rootB = unionFind.root(b);
2067
2549
  if (relation === "different") {
2068
2550
  if (rootA === rootB) {
2069
- throw new chunkKCH7WQA5_cjs.IdentityContradictionError({
2551
+ throw new chunkMRDBBHIZ_cjs.IdentityContradictionError({
2070
2552
  operation,
2071
2553
  a,
2072
2554
  b,
@@ -2076,7 +2558,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
2076
2558
  } else {
2077
2559
  const spanning = differentByRoot.get(rootA)?.get(rootB);
2078
2560
  if (spanning !== void 0) {
2079
- throw new chunkKCH7WQA5_cjs.IdentityContradictionError({
2561
+ throw new chunkMRDBBHIZ_cjs.IdentityContradictionError({
2080
2562
  operation,
2081
2563
  a,
2082
2564
  b,
@@ -2090,7 +2572,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
2090
2572
  kindsByRoot.get(rootB) ?? /* @__PURE__ */ new Set([b.kind])
2091
2573
  );
2092
2574
  if (disjointKinds !== void 0) {
2093
- throw new chunkKCH7WQA5_cjs.IdentityContradictionError({
2575
+ throw new chunkMRDBBHIZ_cjs.IdentityContradictionError({
2094
2576
  operation,
2095
2577
  a,
2096
2578
  b,
@@ -2147,10 +2629,44 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
2147
2629
  }
2148
2630
  return results;
2149
2631
  }
2632
+ async function bulkAssertWindowedPairs(ctx, target, relation, pairs, touch, operationInstant) {
2633
+ const windowRequests = pairs.map((pair) => {
2634
+ const first = registeredPlainRef(ctx, pair.a);
2635
+ const second = registeredPlainRef(ctx, pair.b);
2636
+ return {
2637
+ references: normalizePair(first, second),
2638
+ window: resolveIdentityValidityWindow(pair, operationInstant)
2639
+ };
2640
+ });
2641
+ const windowValidator = await createIdentityWindowValidator(
2642
+ ctx,
2643
+ target,
2644
+ windowRequests,
2645
+ operationInstant
2646
+ );
2647
+ const results = [];
2648
+ for (const pair of pairs) {
2649
+ const window = hasExplicitIdentityValidityWindow(pair) ? pair : void 0;
2650
+ results.push(
2651
+ await assertPair(
2652
+ ctx,
2653
+ target,
2654
+ relation,
2655
+ pair.a,
2656
+ pair.b,
2657
+ touch,
2658
+ window,
2659
+ operationInstant,
2660
+ windowValidator
2661
+ )
2662
+ );
2663
+ }
2664
+ return results;
2665
+ }
2150
2666
  async function findCurrentAssertionById(target, schema, graphId, id) {
2151
2667
  const rows = await target.execute(
2152
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
2153
- SELECT ${chunkA4R3H7RU_cjs.IDENTITY_ASSERTION_COLUMNS}
2668
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
2669
+ SELECT ${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS}
2154
2670
  FROM ${schema.identityAssertionsTable}
2155
2671
  WHERE graph_id = ${graphId}
2156
2672
  AND id = ${id}
@@ -2169,12 +2685,12 @@ async function retractById(ctx, target, id, touch) {
2169
2685
  id
2170
2686
  );
2171
2687
  if (existing === void 0) return void 0;
2172
- const now = chunk5PDSCELM_cjs.nowIso();
2688
+ const now = chunk425IZOQ5_cjs.nowIso();
2173
2689
  const validTo = clampValidTo(now, existing.valid_from);
2174
2690
  const ended = { ...existing, valid_to: validTo, updated_at: now };
2175
2691
  await executeIdentityStatement(
2176
2692
  target,
2177
- chunk2ZWM2RFH_cjs.sql`
2693
+ chunkEDN4Y4ZG_cjs.sql`
2178
2694
  UPDATE ${ctx.schema.identityAssertionsTable}
2179
2695
  SET valid_to = ${validTo}, updated_at = ${now}
2180
2696
  WHERE graph_id = ${ctx.graphId}
@@ -2185,7 +2701,7 @@ async function retractById(ctx, target, id, touch) {
2185
2701
  touch(ctx.graphId, id, ended);
2186
2702
  return ended;
2187
2703
  }
2188
- async function retractByIds(ctx, target, ids, touch) {
2704
+ async function retractCurrentAssertions(ctx, target, ids, touch, resolveValidTo) {
2189
2705
  const uniqueIds = [...new Set(ids)];
2190
2706
  if (uniqueIds.length === 0) return [];
2191
2707
  const current = [];
@@ -2194,14 +2710,14 @@ async function retractByIds(ctx, target, ids, touch) {
2194
2710
  maxItems: MAX_REFERENCE_CHUNK_SIZE,
2195
2711
  parametersPerItem: 1
2196
2712
  });
2197
- for (const idChunk of chunkGVAMRRZR_cjs.chunk(uniqueIds, readChunkSize)) {
2198
- const placeholders = chunk2ZWM2RFH_cjs.sql.join(
2199
- idChunk.map((id) => chunk2ZWM2RFH_cjs.sql`${id}`),
2200
- chunk2ZWM2RFH_cjs.sql`, `
2713
+ for (const idChunk of chunkJR6SX5RH_cjs.chunk(uniqueIds, readChunkSize)) {
2714
+ const placeholders = chunkEDN4Y4ZG_cjs.sql.join(
2715
+ idChunk.map((id) => chunkEDN4Y4ZG_cjs.sql`${id}`),
2716
+ chunkEDN4Y4ZG_cjs.sql`, `
2201
2717
  );
2202
2718
  const rows = await target.execute(
2203
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
2204
- SELECT ${chunkA4R3H7RU_cjs.IDENTITY_ASSERTION_COLUMNS}
2719
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
2720
+ SELECT ${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS}
2205
2721
  FROM ${ctx.schema.identityAssertionsTable}
2206
2722
  WHERE graph_id = ${ctx.graphId}
2207
2723
  AND id IN (${placeholders})
@@ -2212,11 +2728,11 @@ async function retractByIds(ctx, target, ids, touch) {
2212
2728
  current.push(...rows.map((row) => normalizeIdentityAssertionRow(row)));
2213
2729
  }
2214
2730
  if (current.length === 0) return [];
2215
- const now = chunk5PDSCELM_cjs.nowIso();
2731
+ const operationInstant = chunk425IZOQ5_cjs.nowIso();
2216
2732
  const byValidTo = /* @__PURE__ */ new Map();
2217
2733
  const endedById = /* @__PURE__ */ new Map();
2218
2734
  for (const row of current) {
2219
- const validTo = clampValidTo(now, row.valid_from);
2735
+ const validTo = resolveValidTo(row, operationInstant);
2220
2736
  endedById.set(row.id, validTo);
2221
2737
  const group = byValidTo.get(validTo) ?? [];
2222
2738
  group.push(row.id);
@@ -2228,16 +2744,16 @@ async function retractByIds(ctx, target, ids, touch) {
2228
2744
  parametersPerItem: 1
2229
2745
  });
2230
2746
  for (const [validTo, ids2] of byValidTo) {
2231
- for (const idChunk of chunkGVAMRRZR_cjs.chunk(ids2, updateChunkSize)) {
2232
- const placeholders = chunk2ZWM2RFH_cjs.sql.join(
2233
- idChunk.map((id) => chunk2ZWM2RFH_cjs.sql`${id}`),
2234
- chunk2ZWM2RFH_cjs.sql`, `
2747
+ for (const idChunk of chunkJR6SX5RH_cjs.chunk(ids2, updateChunkSize)) {
2748
+ const placeholders = chunkEDN4Y4ZG_cjs.sql.join(
2749
+ idChunk.map((id) => chunkEDN4Y4ZG_cjs.sql`${id}`),
2750
+ chunkEDN4Y4ZG_cjs.sql`, `
2235
2751
  );
2236
2752
  await executeIdentityStatement(
2237
2753
  target,
2238
- chunk2ZWM2RFH_cjs.sql`
2754
+ chunkEDN4Y4ZG_cjs.sql`
2239
2755
  UPDATE ${ctx.schema.identityAssertionsTable}
2240
- SET valid_to = ${validTo}, updated_at = ${now}
2756
+ SET valid_to = ${validTo}, updated_at = ${operationInstant}
2241
2757
  WHERE graph_id = ${ctx.graphId}
2242
2758
  AND id IN (${placeholders})
2243
2759
  AND valid_to IS NULL
@@ -2253,7 +2769,7 @@ async function retractByIds(ctx, target, ids, touch) {
2253
2769
  {
2254
2770
  ...row,
2255
2771
  valid_to: chunkN66HCGCY_cjs.requireDefined(endedById.get(row.id)),
2256
- updated_at: now
2772
+ updated_at: operationInstant
2257
2773
  }
2258
2774
  ];
2259
2775
  });
@@ -2262,6 +2778,44 @@ async function retractByIds(ctx, target, ids, touch) {
2262
2778
  }
2263
2779
  return ended;
2264
2780
  }
2781
+ async function retractByIds(ctx, target, ids, touch) {
2782
+ return retractCurrentAssertions(
2783
+ ctx,
2784
+ target,
2785
+ ids,
2786
+ touch,
2787
+ (row, operationInstant) => clampValidTo(operationInstant, row.valid_from)
2788
+ );
2789
+ }
2790
+ async function retractPlannedAssertions(ctx, target, retractions, touch) {
2791
+ const retractionById = new Map(
2792
+ retractions.map((retraction) => [retraction.id, retraction])
2793
+ );
2794
+ return retractCurrentAssertions(
2795
+ ctx,
2796
+ target,
2797
+ retractions.map((retraction) => retraction.id),
2798
+ touch,
2799
+ (row, operationInstant) => {
2800
+ const retraction = chunkN66HCGCY_cjs.requireDefined(retractionById.get(row.id));
2801
+ if (retraction.validTo === void 0) {
2802
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
2803
+ `Identity merge retraction ${retraction.id} is missing validTo.`,
2804
+ {
2805
+ code: "IDENTITY_MERGE_RETRACTION_REQUIRES_END",
2806
+ assertionId: retraction.id
2807
+ }
2808
+ );
2809
+ }
2810
+ return chunkN66HCGCY_cjs.requireDefined(
2811
+ resolveIdentityValidityWindow(
2812
+ { validFrom: row.valid_from, validTo: retraction.validTo },
2813
+ operationInstant
2814
+ ).validTo
2815
+ );
2816
+ }
2817
+ );
2818
+ }
2265
2819
  async function runIdentityMutation(ctx, fn) {
2266
2820
  let touched = false;
2267
2821
  return runInWriteTransaction(
@@ -2275,7 +2829,7 @@ async function runIdentityMutation(ctx, fn) {
2275
2829
  ctx.backend,
2276
2830
  async (target) => {
2277
2831
  await lockIdentityGraph(target, ctx.graphId);
2278
- return chunkA4R3H7RU_cjs.withRecordedIdentityMutationTarget(
2832
+ return chunkOIFSOPSR_cjs.withRecordedIdentityMutationTarget(
2279
2833
  target,
2280
2834
  (rawTarget, touch) => fn(
2281
2835
  rawTarget,
@@ -2400,7 +2954,7 @@ function createIdentityReadFacade(ctx) {
2400
2954
  );
2401
2955
  return assertions.filter(
2402
2956
  (assertion) => assertion.a_kind === ref.kind && assertion.a_id === ref.id || assertion.b_kind === ref.kind && assertion.b_id === ref.id
2403
- ).toSorted((left, right) => chunkA4R3H7RU_cjs.compareCodePoints(left.id, right.id)).map((assertion) => publicAssertion(assertion));
2957
+ ).toSorted((left, right) => chunkOIFSOPSR_cjs.compareCodePoints(left.id, right.id)).map((assertion) => publicAssertion(assertion));
2404
2958
  }
2405
2959
  };
2406
2960
  }
@@ -2423,29 +2977,65 @@ function partitionRetractedEndpoints(retracted) {
2423
2977
  function createIdentityFacade(ctx) {
2424
2978
  return {
2425
2979
  ...createIdentityReadFacade(ctx),
2426
- assertSame(a, b) {
2427
- return runIdentityMutation(
2428
- ctx,
2429
- (target, touch) => assertPair(ctx, target, "same", a, b, touch)
2430
- );
2980
+ assertSame(a, b, window) {
2981
+ return runIdentityMutation(ctx, (target, touch) => {
2982
+ const operationInstant = chunk425IZOQ5_cjs.nowIso();
2983
+ return assertPair(
2984
+ ctx,
2985
+ target,
2986
+ "same",
2987
+ a,
2988
+ b,
2989
+ touch,
2990
+ hasExplicitIdentityValidityWindow(window) ? window : void 0,
2991
+ operationInstant
2992
+ );
2993
+ });
2431
2994
  },
2432
- assertDifferent(a, b) {
2433
- return runIdentityMutation(
2434
- ctx,
2435
- (target, touch) => assertPair(ctx, target, "different", a, b, touch)
2436
- );
2995
+ assertDifferent(a, b, window) {
2996
+ return runIdentityMutation(ctx, (target, touch) => {
2997
+ const operationInstant = chunk425IZOQ5_cjs.nowIso();
2998
+ return assertPair(
2999
+ ctx,
3000
+ target,
3001
+ "different",
3002
+ a,
3003
+ b,
3004
+ touch,
3005
+ hasExplicitIdentityValidityWindow(window) ? window : void 0,
3006
+ operationInstant
3007
+ );
3008
+ });
2437
3009
  },
2438
3010
  bulkAssertSame(pairs) {
2439
- return runIdentityMutation(
2440
- ctx,
2441
- (target, touch) => bulkAssertPairs(ctx, target, "same", pairs, touch)
2442
- );
3011
+ return runIdentityMutation(ctx, (target, touch) => {
3012
+ if (!pairs.some((pair) => hasExplicitIdentityValidityWindow(pair))) {
3013
+ return bulkAssertPairs(ctx, target, "same", pairs, touch);
3014
+ }
3015
+ return bulkAssertWindowedPairs(
3016
+ ctx,
3017
+ target,
3018
+ "same",
3019
+ pairs,
3020
+ touch,
3021
+ chunk425IZOQ5_cjs.nowIso()
3022
+ );
3023
+ });
2443
3024
  },
2444
3025
  bulkAssertDifferent(pairs) {
2445
- return runIdentityMutation(
2446
- ctx,
2447
- (target, touch) => bulkAssertPairs(ctx, target, "different", pairs, touch)
2448
- );
3026
+ return runIdentityMutation(ctx, (target, touch) => {
3027
+ if (!pairs.some((pair) => hasExplicitIdentityValidityWindow(pair))) {
3028
+ return bulkAssertPairs(ctx, target, "different", pairs, touch);
3029
+ }
3030
+ return bulkAssertWindowedPairs(
3031
+ ctx,
3032
+ target,
3033
+ "different",
3034
+ pairs,
3035
+ touch,
3036
+ chunk425IZOQ5_cjs.nowIso()
3037
+ );
3038
+ });
2449
3039
  },
2450
3040
  retractAssertion(id) {
2451
3041
  return runIdentityMutation(ctx, async (target, touch) => {
@@ -2551,7 +3141,7 @@ function createIdentityFacade(ctx) {
2551
3141
 
2552
3142
  // src/identity/service-interchange-write.ts
2553
3143
  function transferShapeError(assertion, message, issue) {
2554
- return new chunkKCH7WQA5_cjs.ValidationError(message, {
3144
+ return new chunkMRDBBHIZ_cjs.ValidationError(message, {
2555
3145
  issues: [
2556
3146
  {
2557
3147
  path: "identity.assertions",
@@ -2562,7 +3152,7 @@ function transferShapeError(assertion, message, issue) {
2562
3152
  ]
2563
3153
  });
2564
3154
  }
2565
- function validateTransferShape(ctx, assertion, mode) {
3155
+ function validateTransferShape(ctx, assertion, mode, operationInstant) {
2566
3156
  if (!ctx.registry.nodeKinds.has(assertion.a.kind) || !ctx.registry.nodeKinds.has(assertion.b.kind)) {
2567
3157
  throw transferShapeError(
2568
3158
  assertion,
@@ -2604,25 +3194,31 @@ function validateTransferShape(ctx, assertion, mode) {
2604
3194
  }
2605
3195
  );
2606
3196
  }
2607
- const now = chunk5PDSCELM_cjs.nowIso();
2608
- if (assertion.validTo === void 0 && chunkA4R3H7RU_cjs.compareCodePoints(assertion.validFrom, now) > 0) {
2609
- throw transferShapeError(
2610
- assertion,
2611
- "Identity import cannot contain future-dated open assertions.",
3197
+ let window;
3198
+ try {
3199
+ window = resolveIdentityValidityWindow(
2612
3200
  {
2613
- message: `Assertion ${assertion.id} validFrom is in the future`,
2614
- code: "IDENTITY_IMPORT_FUTURE_VALID_FROM"
2615
- }
3201
+ validFrom: assertion.validFrom,
3202
+ ...assertion.validTo === void 0 ? {} : { validTo: assertion.validTo }
3203
+ },
3204
+ operationInstant
2616
3205
  );
2617
- }
2618
- if (assertion.validTo !== void 0 && chunkA4R3H7RU_cjs.compareCodePoints(assertion.validTo, assertion.validFrom) < 0) {
3206
+ } catch (error) {
3207
+ if (!(error instanceof chunkMRDBBHIZ_cjs.IdentityValidityWindowError)) throw error;
3208
+ const issue = error.details.reason === "future-valid-from" ? {
3209
+ code: "IDENTITY_IMPORT_FUTURE_VALID_FROM",
3210
+ message: `Assertion ${assertion.id} validFrom is in the future`
3211
+ } : error.details.reason === "future-valid-to" ? {
3212
+ code: "IDENTITY_IMPORT_FUTURE_VALID_TO",
3213
+ message: `Assertion ${assertion.id} validTo is in the future`
3214
+ } : {
3215
+ code: "IDENTITY_IMPORT_INVALID_WINDOW",
3216
+ message: `Assertion ${assertion.id} validTo must not precede validFrom`
3217
+ };
2619
3218
  throw transferShapeError(
2620
3219
  assertion,
2621
- "Identity assertion validity window is empty.",
2622
- {
2623
- message: `Assertion ${assertion.id} validTo must not precede validFrom`,
2624
- code: "IDENTITY_IMPORT_INVALID_WINDOW"
2625
- }
3220
+ "Identity import contains an unsupported validity window.",
3221
+ issue
2626
3222
  );
2627
3223
  }
2628
3224
  if (assertion.endedBy !== void 0) {
@@ -2648,17 +3244,7 @@ function validateTransferShape(ctx, assertion, mode) {
2648
3244
  );
2649
3245
  }
2650
3246
  }
2651
- if (assertion.validTo !== void 0 && chunkA4R3H7RU_cjs.compareCodePoints(assertion.validTo, now) > 0) {
2652
- throw transferShapeError(
2653
- assertion,
2654
- "Identity import cannot contain assertions that end in the future.",
2655
- {
2656
- message: `Assertion ${assertion.id} validTo is in the future`,
2657
- code: "IDENTITY_IMPORT_FUTURE_VALID_TO"
2658
- }
2659
- );
2660
- }
2661
- return normalized;
3247
+ return { endpoints: normalized, window };
2662
3248
  }
2663
3249
  var IDENTITY_IMPORT_FAILED_ASSERTION = /* @__PURE__ */ Symbol(
2664
3250
  "typegraph.identity.failedAssertionId"
@@ -2681,13 +3267,14 @@ function rethrowTaggedWithAssertion(error, assertionId, progress) {
2681
3267
  }
2682
3268
  throw error;
2683
3269
  }
2684
- async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode) {
3270
+ async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode, ignoredAssertionIds = /* @__PURE__ */ new Set()) {
2685
3271
  let created = 0;
2686
3272
  let skipped = 0;
2687
- await chunkA4R3H7RU_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget, touch) => {
3273
+ await chunkOIFSOPSR_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget, touch) => {
3274
+ const operationInstant = chunk425IZOQ5_cjs.nowIso();
2688
3275
  const normalized = assertions.map((assertion) => ({
2689
3276
  assertion,
2690
- endpoints: validateTransferShape(ctx, assertion, mode)
3277
+ ...validateTransferShape(ctx, assertion, mode, operationInstant)
2691
3278
  }));
2692
3279
  const existingById = await loadAssertionsByIds(
2693
3280
  rawTarget,
@@ -2706,7 +3293,7 @@ async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode)
2706
3293
  }
2707
3294
  }
2708
3295
  const attributeMissingEndpoint = (error, ended) => {
2709
- if (error instanceof chunkKCH7WQA5_cjs.NodeNotFoundError) {
3296
+ if (error instanceof chunkMRDBBHIZ_cjs.NodeNotFoundError) {
2710
3297
  const missing = { kind: error.details.kind, id: error.details.id };
2711
3298
  const failing = normalized.find(
2712
3299
  ({ assertion, endpoints }) => assertion.validTo !== void 0 === ended && endpoints.some(
@@ -2742,7 +3329,17 @@ async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode)
2742
3329
  } catch (error) {
2743
3330
  attributeMissingEndpoint(error, true);
2744
3331
  }
2745
- for (const { assertion, endpoints } of normalized) {
3332
+ const windowValidator = await createIdentityWindowValidator(
3333
+ ctx,
3334
+ rawTarget,
3335
+ normalized.map(({ endpoints, window }) => ({
3336
+ references: endpoints,
3337
+ window
3338
+ })),
3339
+ operationInstant,
3340
+ ignoredAssertionIds
3341
+ );
3342
+ for (const { assertion, endpoints, window } of normalized) {
2746
3343
  const [a, b] = endpoints;
2747
3344
  try {
2748
3345
  const sameId = existingById.get(assertion.id);
@@ -2752,7 +3349,7 @@ async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode)
2752
3349
  skipped += 1;
2753
3350
  continue;
2754
3351
  }
2755
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
3352
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
2756
3353
  `Identity assertion id ${assertion.id} already identifies different truth.`,
2757
3354
  {
2758
3355
  code: "IDENTITY_IMPORT_ID_CONFLICT",
@@ -2761,73 +3358,102 @@ async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode)
2761
3358
  }
2762
3359
  );
2763
3360
  }
2764
- if (assertion.validTo !== void 0) {
2765
- const timestamp = assertion.validFrom;
2766
- const row = {
2767
- graph_id: ctx.graphId,
2768
- id: assertion.id,
2769
- rel: assertion.relation,
2770
- a_kind: a.kind,
2771
- a_id: a.id,
2772
- b_kind: b.kind,
2773
- b_id: b.id,
2774
- valid_from: assertion.validFrom,
2775
- valid_to: assertion.validTo,
2776
- created_at: timestamp,
2777
- updated_at: assertion.validTo,
2778
- deleted_at: void 0,
2779
- ended_by_kind: assertion.endedBy?.kind,
2780
- ended_by_id: assertion.endedBy?.id
2781
- };
2782
- await insertAssertionRows(rawTarget, ctx.schema, [row]);
2783
- touch(ctx.graphId, row.id, row);
2784
- existingById.set(row.id, row);
2785
- created += 1;
2786
- continue;
2787
- }
2788
- const existing = await currentAssertionForPair(
3361
+ const exactWindow = await assertionForExactWindow(
2789
3362
  rawTarget,
2790
3363
  ctx.schema,
2791
3364
  ctx.graphId,
2792
3365
  assertion.relation,
2793
3366
  a,
2794
- b
3367
+ b,
3368
+ window
2795
3369
  );
2796
- if (existing !== void 0) {
3370
+ if (exactWindow !== void 0) {
2797
3371
  skipped += 1;
2798
3372
  continue;
2799
3373
  }
2800
- await validateCurrentRelation(
2801
- ctx,
2802
- rawTarget,
2803
- assertion.relation,
2804
- "import",
2805
- a,
2806
- b
2807
- );
2808
- const inserted = await insertAssertion(
2809
- rawTarget,
2810
- ctx.schema,
2811
- ctx.graphId,
2812
- assertion.relation,
2813
- a,
2814
- b,
2815
- chunk5PDSCELM_cjs.nowIso(),
2816
- touch,
2817
- { id: assertion.id, validFrom: assertion.validFrom }
2818
- );
2819
- existingById.set(inserted.id, inserted);
2820
- created += 1;
2821
- if (assertion.relation === "same") {
2822
- await mergeCurrentClasses(rawTarget, ctx.schema, ctx.graphId, a, b);
2823
- } else {
2824
- await replaceSeparationForReferences(
3374
+ if (window.effective === "current") {
3375
+ const current = await currentAssertionForPair(
2825
3376
  rawTarget,
2826
3377
  ctx.schema,
2827
3378
  ctx.graphId,
2828
- [a, b]
3379
+ assertion.relation,
3380
+ a,
3381
+ b
2829
3382
  );
3383
+ if (current !== void 0) {
3384
+ skipped += 1;
3385
+ continue;
3386
+ }
3387
+ await requireEndpointsCoverIdentityWindow(
3388
+ rawTarget,
3389
+ ctx.graphId,
3390
+ [a, b],
3391
+ window
3392
+ );
3393
+ windowValidator.validate(assertion.relation, "import", a, b, window);
3394
+ await validateCurrentRelation(
3395
+ ctx,
3396
+ rawTarget,
3397
+ assertion.relation,
3398
+ "import",
3399
+ a,
3400
+ b
3401
+ );
3402
+ const inserted = await insertAssertion(
3403
+ rawTarget,
3404
+ ctx.schema,
3405
+ ctx.graphId,
3406
+ assertion.relation,
3407
+ a,
3408
+ b,
3409
+ operationInstant,
3410
+ touch,
3411
+ { id: assertion.id, validFrom: window.validFrom }
3412
+ );
3413
+ existingById.set(inserted.id, inserted);
3414
+ windowValidator.record(inserted);
3415
+ created += 1;
3416
+ if (assertion.relation === "same") {
3417
+ await mergeCurrentClasses(rawTarget, ctx.schema, ctx.graphId, a, b);
3418
+ } else {
3419
+ await replaceSeparationForReferences(
3420
+ rawTarget,
3421
+ ctx.schema,
3422
+ ctx.graphId,
3423
+ [a, b]
3424
+ );
3425
+ }
3426
+ continue;
2830
3427
  }
3428
+ await requireEndpointsCoverIdentityWindow(
3429
+ rawTarget,
3430
+ ctx.graphId,
3431
+ [a, b],
3432
+ window
3433
+ );
3434
+ windowValidator.validate(assertion.relation, "import", a, b, window);
3435
+ const timestamp = window.validFrom;
3436
+ const row = {
3437
+ graph_id: ctx.graphId,
3438
+ id: assertion.id,
3439
+ rel: assertion.relation,
3440
+ a_kind: a.kind,
3441
+ a_id: a.id,
3442
+ b_kind: b.kind,
3443
+ b_id: b.id,
3444
+ valid_from: window.validFrom,
3445
+ valid_to: window.validTo,
3446
+ created_at: timestamp,
3447
+ updated_at: window.validTo ?? window.validFrom,
3448
+ deleted_at: void 0,
3449
+ ended_by_kind: assertion.endedBy?.kind,
3450
+ ended_by_id: assertion.endedBy?.id
3451
+ };
3452
+ await insertAssertionRows(rawTarget, ctx.schema, [row]);
3453
+ touch(ctx.graphId, row.id, row);
3454
+ existingById.set(row.id, row);
3455
+ windowValidator.record(row);
3456
+ created += 1;
2831
3457
  } catch (error) {
2832
3458
  rethrowTaggedWithAssertion(error, assertion.id, { created, skipped });
2833
3459
  }
@@ -2835,12 +3461,17 @@ async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode)
2835
3461
  });
2836
3462
  return { created, skipped };
2837
3463
  }
2838
- async function applyIdentityChangesForContext(ctx, retractionIds, assertions) {
2839
- if (retractionIds.length === 0 && assertions.length === 0) {
3464
+ async function applyIdentityChangesForContext(ctx, retractions, assertions) {
3465
+ if (retractions.length === 0 && assertions.length === 0) {
2840
3466
  return { created: 0, retracted: 0 };
2841
3467
  }
2842
3468
  return runIdentityMutation(ctx, async (target, touch, markWritten) => {
2843
- const retracted = await retractByIds(ctx, target, retractionIds, touch);
3469
+ const retracted = await retractPlannedAssertions(
3470
+ ctx,
3471
+ target,
3472
+ retractions,
3473
+ touch
3474
+ );
2844
3475
  const { closureReferences, separationReferences } = partitionRetractedEndpoints(retracted);
2845
3476
  if (closureReferences.length > 0) {
2846
3477
  await replaceAffectedClosure(
@@ -2861,7 +3492,8 @@ async function applyIdentityChangesForContext(ctx, retractionIds, assertions) {
2861
3492
  ctx,
2862
3493
  target,
2863
3494
  assertions,
2864
- "state"
3495
+ "archival",
3496
+ new Set(retracted.map((assertion) => assertion.id))
2865
3497
  );
2866
3498
  if (summary.created > 0) markWritten();
2867
3499
  return { created: summary.created, retracted: retracted.length };
@@ -2871,7 +3503,7 @@ async function applyIdentityChangesForContext(ctx, retractionIds, assertions) {
2871
3503
  // src/identity/service-maintenance.ts
2872
3504
  function requireAtomicIdentityBackend(backend, graphId) {
2873
3505
  if (!backend.capabilities.transactions) {
2874
- throw new chunkKCH7WQA5_cjs.ConfigurationError(
3506
+ throw new chunkMRDBBHIZ_cjs.ConfigurationError(
2875
3507
  "Operational Identity requires atomic transaction support.",
2876
3508
  { code: "IDENTITY_REQUIRES_ATOMIC_BACKEND", graphId }
2877
3509
  );
@@ -2888,7 +3520,7 @@ async function rebuildIdentityClosureForContext(ctx) {
2888
3520
  requireAtomicIdentityBackend(ctx.backend, ctx.graphId);
2889
3521
  async function rebuildAtTarget(target) {
2890
3522
  await lockIdentityGraph(target, ctx.graphId);
2891
- await chunkA4R3H7RU_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
3523
+ await chunkOIFSOPSR_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
2892
3524
  const activeKinds = identityActiveKinds(ctx.registry);
2893
3525
  const snapshot = await loadSnapshot(
2894
3526
  rawTarget,
@@ -2986,7 +3618,7 @@ async function findAffectedClassInconsistency(ctx, target, seeds) {
2986
3618
  const [leftKind, rightKind] = conflictingKinds;
2987
3619
  return {
2988
3620
  kind: "contradiction",
2989
- error: new chunkKCH7WQA5_cjs.IdentityContradictionError({
3621
+ error: new chunkMRDBBHIZ_cjs.IdentityContradictionError({
2990
3622
  operation: "merge",
2991
3623
  a: firstMemberOfKind(members, leftKind),
2992
3624
  b: firstMemberOfKind(members, rightKind),
@@ -3012,7 +3644,7 @@ async function findAffectedClassInconsistency(ctx, target, seeds) {
3012
3644
  if (aClassKey === void 0 || aClassKey !== bClassKey) continue;
3013
3645
  return {
3014
3646
  kind: "contradiction",
3015
- error: new chunkKCH7WQA5_cjs.IdentityContradictionError({
3647
+ error: new chunkMRDBBHIZ_cjs.IdentityContradictionError({
3016
3648
  operation: "merge",
3017
3649
  a,
3018
3650
  b,
@@ -3080,7 +3712,7 @@ async function assertAffectedIdentityClassesConsistent(ctx, target, seeds) {
3080
3712
  await lockIdentityGraph(target, ctx.graphId);
3081
3713
  const observed = await findAffectedClassInconsistency(ctx, target, seeds);
3082
3714
  if (observed === void 0) return;
3083
- await chunkA4R3H7RU_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
3715
+ await chunkOIFSOPSR_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
3084
3716
  await replaceClosure(
3085
3717
  rawTarget,
3086
3718
  ctx.schema,
@@ -3103,14 +3735,14 @@ async function deleteAssertionsTouchingKinds(target, schema, graphId, kinds, tou
3103
3735
  maxItems: MAX_REFERENCE_CHUNK_SIZE,
3104
3736
  parametersPerItem: 2
3105
3737
  });
3106
- for (const kindChunk of chunkGVAMRRZR_cjs.chunk(removedKinds, kindChunkSize)) {
3107
- const kindList2 = chunk2ZWM2RFH_cjs.sql.join(
3108
- kindChunk.map((kind) => chunk2ZWM2RFH_cjs.sql`${kind}`),
3109
- chunk2ZWM2RFH_cjs.sql`, `
3738
+ for (const kindChunk of chunkJR6SX5RH_cjs.chunk(removedKinds, kindChunkSize)) {
3739
+ const kindList2 = chunkEDN4Y4ZG_cjs.sql.join(
3740
+ kindChunk.map((kind) => chunkEDN4Y4ZG_cjs.sql`${kind}`),
3741
+ chunkEDN4Y4ZG_cjs.sql`, `
3110
3742
  );
3111
3743
  const rows = await target.execute(
3112
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
3113
- SELECT ${chunkA4R3H7RU_cjs.IDENTITY_ASSERTION_COLUMNS}
3744
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
3745
+ SELECT ${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS}
3114
3746
  FROM ${schema.identityAssertionsTable}
3115
3747
  WHERE graph_id = ${graphId}
3116
3748
  AND (a_kind IN (${kindList2}) OR b_kind IN (${kindList2}))
@@ -3127,14 +3759,14 @@ async function deleteAssertionsTouchingKinds(target, schema, graphId, kinds, tou
3127
3759
  maxItems: MAX_REFERENCE_CHUNK_SIZE,
3128
3760
  parametersPerItem: 1
3129
3761
  });
3130
- for (const idChunk of chunkGVAMRRZR_cjs.chunk(ids, idChunkSize)) {
3131
- const idList = chunk2ZWM2RFH_cjs.sql.join(
3132
- idChunk.map((id) => chunk2ZWM2RFH_cjs.sql`${id}`),
3133
- chunk2ZWM2RFH_cjs.sql`, `
3762
+ for (const idChunk of chunkJR6SX5RH_cjs.chunk(ids, idChunkSize)) {
3763
+ const idList = chunkEDN4Y4ZG_cjs.sql.join(
3764
+ idChunk.map((id) => chunkEDN4Y4ZG_cjs.sql`${id}`),
3765
+ chunkEDN4Y4ZG_cjs.sql`, `
3134
3766
  );
3135
3767
  await executeIdentityStatement(
3136
3768
  target,
3137
- chunk2ZWM2RFH_cjs.sql`
3769
+ chunkEDN4Y4ZG_cjs.sql`
3138
3770
  DELETE FROM ${schema.identityAssertionsTable}
3139
3771
  WHERE graph_id = ${graphId} AND id IN (${idList})
3140
3772
  `
@@ -3151,13 +3783,13 @@ async function hasAssertionsTouchingKinds(target, schema, graphId, kinds) {
3151
3783
  maxItems: MAX_REFERENCE_CHUNK_SIZE,
3152
3784
  parametersPerItem: 2
3153
3785
  });
3154
- for (const kindChunk of chunkGVAMRRZR_cjs.chunk(probedKinds, kindChunkSize)) {
3155
- const kindList2 = chunk2ZWM2RFH_cjs.sql.join(
3156
- kindChunk.map((kind) => chunk2ZWM2RFH_cjs.sql`${kind}`),
3157
- chunk2ZWM2RFH_cjs.sql`, `
3786
+ for (const kindChunk of chunkJR6SX5RH_cjs.chunk(probedKinds, kindChunkSize)) {
3787
+ const kindList2 = chunkEDN4Y4ZG_cjs.sql.join(
3788
+ kindChunk.map((kind) => chunkEDN4Y4ZG_cjs.sql`${kind}`),
3789
+ chunkEDN4Y4ZG_cjs.sql`, `
3158
3790
  );
3159
3791
  const rows = await target.execute(
3160
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
3792
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
3161
3793
  SELECT id
3162
3794
  FROM ${schema.identityAssertionsTable}
3163
3795
  WHERE graph_id = ${graphId}
@@ -3171,7 +3803,7 @@ async function hasAssertionsTouchingKinds(target, schema, graphId, kinds) {
3171
3803
  }
3172
3804
  async function purgeAssertionsWithUnregisteredKinds(target, schema, graphId, registeredKinds, touch) {
3173
3805
  const pairs = await target.execute(
3174
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
3806
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
3175
3807
  SELECT DISTINCT a_kind, b_kind
3176
3808
  FROM ${schema.identityAssertionsTable}
3177
3809
  WHERE graph_id = ${graphId}
@@ -3221,13 +3853,13 @@ async function liveNodeKindsSharingIds(ctx, target, ids) {
3221
3853
  maxItems: MAX_REFERENCE_CHUNK_SIZE,
3222
3854
  parametersPerItem: 1
3223
3855
  });
3224
- for (const idChunk of chunkGVAMRRZR_cjs.chunk(uniqueIds, chunkSize)) {
3225
- const idList = chunk2ZWM2RFH_cjs.sql.join(
3226
- idChunk.map((id) => chunk2ZWM2RFH_cjs.sql`${id}`),
3227
- chunk2ZWM2RFH_cjs.sql`, `
3856
+ for (const idChunk of chunkJR6SX5RH_cjs.chunk(uniqueIds, chunkSize)) {
3857
+ const idList = chunkEDN4Y4ZG_cjs.sql.join(
3858
+ idChunk.map((id) => chunkEDN4Y4ZG_cjs.sql`${id}`),
3859
+ chunkEDN4Y4ZG_cjs.sql`, `
3228
3860
  );
3229
3861
  const rows = await target.execute(
3230
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
3862
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
3231
3863
  SELECT kind, id
3232
3864
  FROM ${ctx.schema.nodesTable}
3233
3865
  WHERE graph_id = ${ctx.graphId}
@@ -3247,7 +3879,7 @@ async function liveNodeKindsSharingIds(ctx, target, ids) {
3247
3879
  async function foldIdentityForCreatedNodes(ctx, target, references) {
3248
3880
  if (references.length === 0 || ctx.sameIdAcrossKinds === "ignore") return;
3249
3881
  await lockIdentityGraph(target, ctx.graphId);
3250
- await chunkA4R3H7RU_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
3882
+ await chunkOIFSOPSR_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
3251
3883
  const liveKindsById = await liveNodeKindsSharingIds(
3252
3884
  ctx,
3253
3885
  rawTarget,
@@ -3287,7 +3919,7 @@ async function foldIdentityForCreatedNodes(ctx, target, references) {
3287
3919
  }
3288
3920
  async function hasMaterializedIdentityClass(target, schema, graphId, ref) {
3289
3921
  const rows = await target.execute(
3290
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
3922
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
3291
3923
  SELECT member_kind, member_id
3292
3924
  FROM ${schema.identityClosureTable}
3293
3925
  WHERE graph_id = ${graphId}
@@ -3300,7 +3932,7 @@ async function hasMaterializedIdentityClass(target, schema, graphId, ref) {
3300
3932
  }
3301
3933
  async function readNodeDeletionInstant(target, schema, graphId, ref) {
3302
3934
  const rows = await target.execute(
3303
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
3935
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
3304
3936
  SELECT deleted_at
3305
3937
  FROM ${schema.nodesTable}
3306
3938
  WHERE graph_id = ${graphId}
@@ -3312,19 +3944,47 @@ async function readNodeDeletionInstant(target, schema, graphId, ref) {
3312
3944
  const row = rows.at(0);
3313
3945
  return row === void 0 ? void 0 : optionalIdentityTimestamp(row.deleted_at);
3314
3946
  }
3947
+ async function requireNodeValidityEndCompatible(ctx, target, ref, validTo) {
3948
+ const rows = await target.execute(
3949
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
3950
+ SELECT ${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS}
3951
+ FROM ${ctx.schema.identityAssertionsTable}
3952
+ WHERE graph_id = ${ctx.graphId}
3953
+ AND deleted_at IS NULL
3954
+ AND (valid_to IS NULL OR valid_to > ${validTo})
3955
+ AND (
3956
+ (a_kind = ${ref.kind} AND a_id = ${ref.id})
3957
+ OR (b_kind = ${ref.kind} AND b_id = ${ref.id})
3958
+ )
3959
+ ORDER BY id
3960
+ LIMIT 1
3961
+ `)
3962
+ );
3963
+ const row = rows.at(0);
3964
+ if (row === void 0) return;
3965
+ const assertion = normalizeIdentityAssertionRow(row);
3966
+ throw new chunkMRDBBHIZ_cjs.IdentityEndpointValidityError({
3967
+ endpoint: ref,
3968
+ assertionWindow: {
3969
+ validFrom: assertion.valid_from,
3970
+ ...assertion.valid_to === void 0 ? {} : { validTo: assertion.valid_to }
3971
+ },
3972
+ endpointWindow: { validTo }
3973
+ });
3974
+ }
3315
3975
  async function detachIdentityForNode(ctx, target, ref, mode) {
3316
3976
  await lockIdentityGraph(target, ctx.graphId);
3317
- await chunkA4R3H7RU_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget, touch) => {
3318
- const touchesNode = chunk2ZWM2RFH_cjs.sql`
3977
+ await chunkOIFSOPSR_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget, touch) => {
3978
+ const touchesNode = chunkEDN4Y4ZG_cjs.sql`
3319
3979
  (
3320
3980
  (a_kind = ${ref.kind} AND a_id = ${ref.id})
3321
3981
  OR (b_kind = ${ref.kind} AND b_id = ${ref.id})
3322
3982
  )
3323
3983
  `;
3324
- const scope = mode === "hard" ? chunk2ZWM2RFH_cjs.sql`` : chunk2ZWM2RFH_cjs.sql`AND valid_to IS NULL AND deleted_at IS NULL`;
3984
+ const scope = mode === "hard" ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`AND valid_to IS NULL AND deleted_at IS NULL`;
3325
3985
  const rows = await rawTarget.execute(
3326
- chunk2ZWM2RFH_cjs.asCompiledRowsSql(chunk2ZWM2RFH_cjs.sql`
3327
- SELECT ${chunkA4R3H7RU_cjs.IDENTITY_ASSERTION_COLUMNS}
3986
+ chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
3987
+ SELECT ${chunkOIFSOPSR_cjs.IDENTITY_ASSERTION_COLUMNS}
3328
3988
  FROM ${ctx.schema.identityAssertionsTable}
3329
3989
  WHERE graph_id = ${ctx.graphId}
3330
3990
  ${scope}
@@ -3339,7 +3999,7 @@ async function detachIdentityForNode(ctx, target, ref, mode) {
3339
3999
  )) {
3340
4000
  return;
3341
4001
  }
3342
- const now = chunk5PDSCELM_cjs.nowIso();
4002
+ const now = chunk425IZOQ5_cjs.nowIso();
3343
4003
  const cascadeInstant = mode === "hard" || rows.length === 0 ? now : await readNodeDeletionInstant(
3344
4004
  rawTarget,
3345
4005
  ctx.schema,
@@ -3351,7 +4011,7 @@ async function detachIdentityForNode(ctx, target, ref, mode) {
3351
4011
  if (mode === "hard") {
3352
4012
  await executeIdentityStatement(
3353
4013
  rawTarget,
3354
- chunk2ZWM2RFH_cjs.sql`
4014
+ chunkEDN4Y4ZG_cjs.sql`
3355
4015
  DELETE FROM ${ctx.schema.identityAssertionsTable}
3356
4016
  WHERE graph_id = ${ctx.graphId} AND id = ${row.id}
3357
4017
  `
@@ -3368,7 +4028,7 @@ async function detachIdentityForNode(ctx, target, ref, mode) {
3368
4028
  };
3369
4029
  await executeIdentityStatement(
3370
4030
  rawTarget,
3371
- chunk2ZWM2RFH_cjs.sql`
4031
+ chunkEDN4Y4ZG_cjs.sql`
3372
4032
  UPDATE ${ctx.schema.identityAssertionsTable}
3373
4033
  SET valid_to = ${validTo},
3374
4034
  updated_at = ${now},
@@ -3401,9 +4061,11 @@ exports.deleteAssertionsTouchingKinds = deleteAssertionsTouchingKinds;
3401
4061
  exports.detachIdentityForNode = detachIdentityForNode;
3402
4062
  exports.encodeTupleKey = encodeTupleKey;
3403
4063
  exports.foldIdentityForCreatedNodes = foldIdentityForCreatedNodes;
4064
+ exports.forceWriteTransactionRevision = forceWriteTransactionRevision;
3404
4065
  exports.hasAssertionsTouchingKinds = hasAssertionsTouchingKinds;
3405
4066
  exports.identityAssertionSemanticKey = identityAssertionSemanticKey;
3406
4067
  exports.identityReferenceKey = identityReferenceKey;
4068
+ exports.identityValidityWindowsOverlap = identityValidityWindowsOverlap;
3407
4069
  exports.importIdentityAssertionsIntoTarget = importIdentityAssertionsIntoTarget;
3408
4070
  exports.liveNodeKindsSharingIds = liveNodeKindsSharingIds;
3409
4071
  exports.loadAssertionsByIds = loadAssertionsByIds;
@@ -3418,6 +4080,7 @@ exports.readIdentityAssertionsForInterchange = readIdentityAssertionsForIntercha
3418
4080
  exports.rebuildIdentityClosureForContext = rebuildIdentityClosureForContext;
3419
4081
  exports.refKey = refKey;
3420
4082
  exports.removeIdentityKindsForContext = removeIdentityKindsForContext;
4083
+ exports.requireNodeValidityEndCompatible = requireNodeValidityEndCompatible;
3421
4084
  exports.runHookedWriteOperation = runHookedWriteOperation;
3422
4085
  exports.runInWriteTransaction = runInWriteTransaction;
3423
4086
  exports.separationRebuildRequired = separationRebuildRequired;
@@ -3428,5 +4091,5 @@ exports.validateNodeProps = validateNodeProps;
3428
4091
  exports.validateProps = validateProps;
3429
4092
  exports.withWriteTransactionSession = withWriteTransactionSession;
3430
4093
  exports.wrapZodError = wrapZodError;
3431
- //# sourceMappingURL=chunk-QPOQX2DI.cjs.map
3432
- //# sourceMappingURL=chunk-QPOQX2DI.cjs.map
4094
+ //# sourceMappingURL=chunk-MX4DHSQP.cjs.map
4095
+ //# sourceMappingURL=chunk-MX4DHSQP.cjs.map