@nicia-ai/typegraph 0.46.1 → 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 (296) 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-NK5Q7UNE.cjs → chunk-26YKDNUD.cjs} +10 -10
  45. package/dist/{chunk-NK5Q7UNE.cjs.map → chunk-26YKDNUD.cjs.map} +1 -1
  46. package/dist/{chunk-PQBQG7IM.js → chunk-3DMMGT6S.js} +3 -3
  47. package/dist/{chunk-PQBQG7IM.js.map → chunk-3DMMGT6S.js.map} +1 -1
  48. package/dist/{chunk-XBYVV3MP.cjs → chunk-3HGRTCDU.cjs} +6 -4
  49. package/dist/chunk-3HGRTCDU.cjs.map +1 -0
  50. package/dist/{chunk-NFCVHQ5P.cjs → chunk-3U5ABFDW.cjs} +26 -26
  51. package/dist/{chunk-NFCVHQ5P.cjs.map → chunk-3U5ABFDW.cjs.map} +1 -1
  52. package/dist/{chunk-MCLYU6BN.cjs → chunk-425IZOQ5.cjs} +11 -164
  53. package/dist/chunk-425IZOQ5.cjs.map +1 -0
  54. package/dist/{chunk-M4BDU5RX.cjs → chunk-5FBRVORR.cjs} +12 -12
  55. package/dist/{chunk-M4BDU5RX.cjs.map → chunk-5FBRVORR.cjs.map} +1 -1
  56. package/dist/{chunk-C23WSN5E.js → chunk-5FT3TLPK.js} +20 -14
  57. package/dist/chunk-5FT3TLPK.js.map +1 -0
  58. package/dist/{chunk-YBFHZUXX.js → chunk-5UMTUOM5.js} +6 -6
  59. package/dist/{chunk-YBFHZUXX.js.map → chunk-5UMTUOM5.js.map} +1 -1
  60. package/dist/{chunk-HFHTMECK.js → chunk-6FWSNSRE.js} +7 -7
  61. package/dist/{chunk-HFHTMECK.js.map → chunk-6FWSNSRE.js.map} +1 -1
  62. package/dist/{chunk-65E3XWGF.cjs → chunk-6JVZSOHQ.cjs} +91 -91
  63. package/dist/{chunk-65E3XWGF.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-LBJKZXDE.cjs → chunk-6NGW27EO.cjs} +10 -10
  67. package/dist/{chunk-LBJKZXDE.cjs.map → chunk-6NGW27EO.cjs.map} +1 -1
  68. package/dist/{chunk-5UVRGXD3.js → chunk-6SWPJEYN.js} +5 -5
  69. package/dist/{chunk-5UVRGXD3.js.map → chunk-6SWPJEYN.js.map} +1 -1
  70. package/dist/{chunk-BKCUOV7A.js → chunk-7SQSZN2J.js} +5 -5
  71. package/dist/{chunk-BKCUOV7A.js.map → chunk-7SQSZN2J.js.map} +1 -1
  72. package/dist/{chunk-YAAM3M2S.cjs → chunk-AMMWA76F.cjs} +51 -59
  73. package/dist/chunk-AMMWA76F.cjs.map +1 -0
  74. package/dist/{chunk-62ZP23AW.cjs → chunk-AOSSQDVO.cjs} +13 -13
  75. package/dist/{chunk-62ZP23AW.cjs.map → chunk-AOSSQDVO.cjs.map} +1 -1
  76. package/dist/{chunk-NLI2AVEF.js → chunk-AVGUJWVX.js} +30 -10
  77. package/dist/chunk-AVGUJWVX.js.map +1 -0
  78. package/dist/{chunk-TQR4KBY2.cjs → chunk-BCQ76AXA.cjs} +262 -155
  79. package/dist/chunk-BCQ76AXA.cjs.map +1 -0
  80. package/dist/{chunk-CXBHOOIQ.cjs → chunk-BFUOME67.cjs} +11 -11
  81. package/dist/{chunk-CXBHOOIQ.cjs.map → chunk-BFUOME67.cjs.map} +1 -1
  82. package/dist/{chunk-PNTCATDE.cjs → chunk-BR7SHKGM.cjs} +1672 -1400
  83. package/dist/chunk-BR7SHKGM.cjs.map +1 -0
  84. package/dist/{chunk-ASTI57H3.js → chunk-CHAOFCHV.js} +3 -3
  85. package/dist/{chunk-ASTI57H3.js.map → chunk-CHAOFCHV.js.map} +1 -1
  86. package/dist/chunk-CICO5GXD.cjs +12 -0
  87. package/dist/{chunk-A4OC4DVN.cjs.map → chunk-CICO5GXD.cjs.map} +1 -1
  88. package/dist/{chunk-T4XNKYXB.js → chunk-D5R42W5D.js} +4 -4
  89. package/dist/{chunk-T4XNKYXB.js.map → chunk-D5R42W5D.js.map} +1 -1
  90. package/dist/{chunk-S6PW7VV5.js → chunk-DJZTXBWY.js} +410 -138
  91. package/dist/chunk-DJZTXBWY.js.map +1 -0
  92. package/dist/{chunk-UDISNXDL.cjs → chunk-DO7SAMEK.cjs} +47 -47
  93. package/dist/{chunk-UDISNXDL.cjs.map → chunk-DO7SAMEK.cjs.map} +1 -1
  94. package/dist/{chunk-VCRRKBLN.cjs → chunk-EDN4Y4ZG.cjs} +9 -9
  95. package/dist/{chunk-VCRRKBLN.cjs.map → chunk-EDN4Y4ZG.cjs.map} +1 -1
  96. package/dist/{chunk-YVWGEQJE.cjs → chunk-EMIB2RXD.cjs} +139 -133
  97. package/dist/chunk-EMIB2RXD.cjs.map +1 -0
  98. package/dist/{chunk-2Z2Z3ZD6.js → chunk-EP4RUYD6.js} +3 -3
  99. package/dist/{chunk-2Z2Z3ZD6.js.map → chunk-EP4RUYD6.js.map} +1 -1
  100. package/dist/{chunk-M3WP7RQZ.js → chunk-FNOMT74T.js} +10 -8
  101. package/dist/chunk-FNOMT74T.js.map +1 -0
  102. package/dist/{chunk-E4WNQBEF.cjs → chunk-FQPEMEWX.cjs} +12 -12
  103. package/dist/{chunk-E4WNQBEF.cjs.map → chunk-FQPEMEWX.cjs.map} +1 -1
  104. package/dist/{chunk-WDGA7IYB.js → chunk-GLHXM7C4.js} +3 -3
  105. package/dist/{chunk-WDGA7IYB.js.map → chunk-GLHXM7C4.js.map} +1 -1
  106. package/dist/{chunk-7BQXPCGN.cjs → chunk-GYEG3ZLZ.cjs} +10 -10
  107. package/dist/{chunk-7BQXPCGN.cjs.map → chunk-GYEG3ZLZ.cjs.map} +1 -1
  108. package/dist/{chunk-VLT6PEWR.cjs → chunk-GYUJZARH.cjs} +4 -4
  109. package/dist/{chunk-VLT6PEWR.cjs.map → chunk-GYUJZARH.cjs.map} +1 -1
  110. package/dist/{chunk-RMQLSPA2.cjs → chunk-HDL2ARHX.cjs} +27 -27
  111. package/dist/{chunk-RMQLSPA2.cjs.map → chunk-HDL2ARHX.cjs.map} +1 -1
  112. package/dist/{chunk-775A4ZMN.js → chunk-HEV35TGT.js} +4 -4
  113. package/dist/{chunk-775A4ZMN.js.map → chunk-HEV35TGT.js.map} +1 -1
  114. package/dist/{chunk-3DHZCOT7.cjs → chunk-I4G3SQPF.cjs} +20 -20
  115. package/dist/{chunk-3DHZCOT7.cjs.map → chunk-I4G3SQPF.cjs.map} +1 -1
  116. package/dist/{chunk-VGTJPTIC.js → chunk-JONXFAPO.js} +5 -5
  117. package/dist/{chunk-VGTJPTIC.js.map → chunk-JONXFAPO.js.map} +1 -1
  118. package/dist/{chunk-BSFJMMV3.cjs → chunk-JR6SX5RH.cjs} +4 -4
  119. package/dist/{chunk-BSFJMMV3.cjs.map → chunk-JR6SX5RH.cjs.map} +1 -1
  120. package/dist/{chunk-YBQOHKHN.cjs → chunk-KABFHAL7.cjs} +100 -99
  121. package/dist/chunk-KABFHAL7.cjs.map +1 -0
  122. package/dist/{chunk-7VQXLT5O.js → chunk-KH7XW7VV.js} +111 -27
  123. package/dist/chunk-KH7XW7VV.js.map +1 -0
  124. package/dist/{chunk-DCQVHAYQ.js → chunk-KKBDXCLQ.js} +4 -4
  125. package/dist/{chunk-DCQVHAYQ.js.map → chunk-KKBDXCLQ.js.map} +1 -1
  126. package/dist/{chunk-4UGOKMI5.cjs → chunk-L3LQNR34.cjs} +161 -161
  127. package/dist/{chunk-4UGOKMI5.cjs.map → chunk-L3LQNR34.cjs.map} +1 -1
  128. package/dist/{chunk-NMWDXFPH.js → chunk-LEWHMOUY.js} +46 -56
  129. package/dist/chunk-LEWHMOUY.js.map +1 -0
  130. package/dist/{chunk-U63GDNRC.cjs → chunk-LRQKXRXO.cjs} +4 -4
  131. package/dist/{chunk-U63GDNRC.cjs.map → chunk-LRQKXRXO.cjs.map} +1 -1
  132. package/dist/{chunk-5763DULU.js → chunk-M35DF33T.js} +147 -40
  133. package/dist/chunk-M35DF33T.js.map +1 -0
  134. package/dist/{chunk-Q3G6A4I3.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-VQH4VAWD.cjs.map → chunk-MKJ4KXL5.cjs.map} +1 -1
  138. package/dist/{chunk-NI72YOJB.cjs → chunk-MRDBBHIZ.cjs} +70 -2
  139. package/dist/chunk-MRDBBHIZ.cjs.map +1 -0
  140. package/dist/{chunk-DTVWX77L.cjs → chunk-MX4DHSQP.cjs} +1023 -360
  141. package/dist/chunk-MX4DHSQP.cjs.map +1 -0
  142. package/dist/{chunk-2LG2XB2M.js → chunk-MYKHJI2J.js} +3 -3
  143. package/dist/{chunk-2LG2XB2M.js.map → chunk-MYKHJI2J.js.map} +1 -1
  144. package/dist/{chunk-JZUR7ZWE.js → chunk-NAZ2RA4L.js} +3 -3
  145. package/dist/{chunk-JZUR7ZWE.js.map → chunk-NAZ2RA4L.js.map} +1 -1
  146. package/dist/{chunk-XL7SLCXS.js → chunk-NG2RB5WL.js} +4 -145
  147. package/dist/chunk-NG2RB5WL.js.map +1 -0
  148. package/dist/{chunk-GF3KXUTW.js → chunk-NNQ6A3RM.js} +803 -143
  149. package/dist/chunk-NNQ6A3RM.js.map +1 -0
  150. package/dist/{chunk-MSY7FSX4.js → chunk-NVY5CJFP.js} +4 -4
  151. package/dist/{chunk-MSY7FSX4.js.map → chunk-NVY5CJFP.js.map} +1 -1
  152. package/dist/{chunk-XCAGZAKP.cjs → chunk-OI2GQ25X.cjs} +7 -7
  153. package/dist/{chunk-XCAGZAKP.cjs.map → chunk-OI2GQ25X.cjs.map} +1 -1
  154. package/dist/{chunk-PF6F5NLJ.cjs → chunk-OIFSOPSR.cjs} +259 -238
  155. package/dist/chunk-OIFSOPSR.cjs.map +1 -0
  156. package/dist/{chunk-UV3SN74I.js → chunk-OMZ37BM2.js} +5 -5
  157. package/dist/{chunk-UV3SN74I.js.map → chunk-OMZ37BM2.js.map} +1 -1
  158. package/dist/{chunk-PNN7RHVR.cjs → chunk-OORXGFL5.cjs} +48 -48
  159. package/dist/{chunk-PNN7RHVR.cjs.map → chunk-OORXGFL5.cjs.map} +1 -1
  160. package/dist/{chunk-YWGVVALJ.js → chunk-OVI7IXYX.js} +3 -3
  161. package/dist/{chunk-YWGVVALJ.js.map → chunk-OVI7IXYX.js.map} +1 -1
  162. package/dist/{chunk-I5MOXA4H.js → chunk-P6YLZTRE.js} +3 -3
  163. package/dist/{chunk-I5MOXA4H.js.map → chunk-P6YLZTRE.js.map} +1 -1
  164. package/dist/{chunk-WQZLUGVR.js → chunk-QS3NQZVC.js} +82 -16
  165. package/dist/chunk-QS3NQZVC.js.map +1 -0
  166. package/dist/{chunk-5262ZMTR.js → chunk-QTD6HX4O.js} +5 -5
  167. package/dist/{chunk-5262ZMTR.js.map → chunk-QTD6HX4O.js.map} +1 -1
  168. package/dist/{chunk-MXJDTH5B.cjs → chunk-ROR5ZR6A.cjs} +45 -45
  169. package/dist/{chunk-MXJDTH5B.cjs.map → chunk-ROR5ZR6A.cjs.map} +1 -1
  170. package/dist/{chunk-CBTIUB76.js → chunk-SDBBMD4N.js} +3 -3
  171. package/dist/{chunk-CBTIUB76.js.map → chunk-SDBBMD4N.js.map} +1 -1
  172. package/dist/{chunk-L65OU2U3.js → chunk-SE6EGQSD.js} +78 -16
  173. package/dist/chunk-SE6EGQSD.js.map +1 -0
  174. package/dist/{chunk-JXA2ZP2Q.js → chunk-SHFBB23Q.js} +4 -4
  175. package/dist/{chunk-JXA2ZP2Q.js.map → chunk-SHFBB23Q.js.map} +1 -1
  176. package/dist/{chunk-AKLS3BYZ.js → chunk-SHSSRCFR.js} +5 -3
  177. package/dist/chunk-SHSSRCFR.js.map +1 -0
  178. package/dist/{chunk-2NA5DYLO.cjs → chunk-TZEGUG6D.cjs} +4 -4
  179. package/dist/{chunk-2NA5DYLO.cjs.map → chunk-TZEGUG6D.cjs.map} +1 -1
  180. package/dist/{chunk-CMWHLBVN.cjs → chunk-U5EDAVOJ.cjs} +140 -74
  181. package/dist/chunk-U5EDAVOJ.cjs.map +1 -0
  182. package/dist/{chunk-MUK4BU7K.cjs → chunk-UPAJHMW3.cjs} +210 -126
  183. package/dist/chunk-UPAJHMW3.cjs.map +1 -0
  184. package/dist/{chunk-PT7RIRIZ.cjs → chunk-WGX7JH7E.cjs} +235 -170
  185. package/dist/chunk-WGX7JH7E.cjs.map +1 -0
  186. package/dist/{chunk-U5SON7R2.cjs → chunk-WODMN3Q2.cjs} +27 -27
  187. package/dist/{chunk-U5SON7R2.cjs.map → chunk-WODMN3Q2.cjs.map} +1 -1
  188. package/dist/{chunk-K5ELX2GT.js → chunk-XVWOYKIK.js} +3 -3
  189. package/dist/{chunk-K5ELX2GT.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-LGHCOKTT.js → chunk-XYBQI6LE.js} +14 -14
  193. package/dist/{chunk-LGHCOKTT.js.map → chunk-XYBQI6LE.js.map} +1 -1
  194. package/dist/{chunk-YDFDBE6D.js → chunk-ZDKTPBGV.js} +4 -4
  195. package/dist/{chunk-YDFDBE6D.js.map → chunk-ZDKTPBGV.js.map} +1 -1
  196. package/dist/{chunk-MZLPX2R7.js → chunk-ZHNXLS3C.js} +9 -8
  197. package/dist/chunk-ZHNXLS3C.js.map +1 -0
  198. package/dist/{chunk-J3WZ3FA2.js → chunk-ZLONH2UD.js} +67 -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-BXfGHbPN.d.ts → ddl-CprnMXJ-.d.ts} +3 -3
  205. package/dist/{ddl-BJcOp4WZ.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-BSHvKfok.d.ts → index-CHTv4XMZ.d.cts} +64 -3
  217. package/dist/{index-DxaYCv8Y.d.cts → index-CzoJ3MUw.d.ts} +64 -3
  218. package/dist/index.cjs +232 -215
  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-CfZAimti.d.ts → manager-B6sOQzcQ.d.ts} +2 -2
  235. package/dist/{manager-HGk6E_HW.d.cts → manager-DlY1vlla.d.cts} +2 -2
  236. package/dist/{materialize-indexes-BMJP6Tms.d.ts → materialize-indexes-DQL4xcpf.d.ts} +1 -1
  237. package/dist/{materialize-indexes-6A7dWGtb.d.cts → materialize-indexes-sskhp-c_.d.cts} +1 -1
  238. package/dist/{postgres-DFYWENdR.d.cts → postgres-B6YOUcaK.d.ts} +1 -1
  239. package/dist/{postgres-e7a9TdvR.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-CIje5XYD.d.cts → searchable-0Cn_lY8U.d.cts} +1 -1
  253. package/dist/{searchable-9OQoPuRs.d.ts → searchable-D9gMiwcS.d.ts} +1 -1
  254. package/dist/{sqlite-DerU5tc7.d.ts → sqlite-ClXuBYAj.d.ts} +1 -1
  255. package/dist/{sqlite-DitnISa9.d.cts → sqlite-DioSxaPe.d.cts} +1 -1
  256. package/dist/{store-ClQ-MZQS.d.ts → store-5j-w5onJ.d.ts} +128 -69
  257. package/dist/{store-B0h6x7wo.d.cts → store-CFedKGU5.d.cts} +128 -69
  258. package/dist/{temporal-Bn-Fi8FJ.d.cts → temporal-Ce1pG0S1.d.cts} +1 -1
  259. package/dist/{temporal-BtM4UALv.d.ts → temporal-CjO9FH1l.d.ts} +1 -1
  260. package/dist/{types-KFfk-8Ah.d.ts → types-BrdOFu48.d.ts} +1 -1
  261. package/dist/{types-HkveCCx0.d.ts → types-DKkMJZjR.d.cts} +39 -12
  262. package/dist/{types-HkveCCx0.d.cts → types-DKkMJZjR.d.ts} +39 -12
  263. package/dist/{types-CoIx8HX5.d.cts → types-oj_OGAaZ.d.cts} +1 -1
  264. package/dist/{where-ws5hf-Ov.d.ts → where-C8w2627G.d.ts} +1 -1
  265. package/dist/{where--fk7_0kv.d.cts → where-D1wKCJ4Q.d.cts} +1 -1
  266. package/package.json +1 -1
  267. package/dist/chunk-5763DULU.js.map +0 -1
  268. package/dist/chunk-7VQXLT5O.js.map +0 -1
  269. package/dist/chunk-A4OC4DVN.cjs +0 -12
  270. package/dist/chunk-AKLS3BYZ.js.map +0 -1
  271. package/dist/chunk-C23WSN5E.js.map +0 -1
  272. package/dist/chunk-CMWHLBVN.cjs.map +0 -1
  273. package/dist/chunk-DTVWX77L.cjs.map +0 -1
  274. package/dist/chunk-GF3KXUTW.js.map +0 -1
  275. package/dist/chunk-J3WZ3FA2.js.map +0 -1
  276. package/dist/chunk-L65OU2U3.js.map +0 -1
  277. package/dist/chunk-M3WP7RQZ.js.map +0 -1
  278. package/dist/chunk-MCLYU6BN.cjs.map +0 -1
  279. package/dist/chunk-MUK4BU7K.cjs.map +0 -1
  280. package/dist/chunk-MZLPX2R7.js.map +0 -1
  281. package/dist/chunk-NI72YOJB.cjs.map +0 -1
  282. package/dist/chunk-NLI2AVEF.js.map +0 -1
  283. package/dist/chunk-NMWDXFPH.js.map +0 -1
  284. package/dist/chunk-PF6F5NLJ.cjs.map +0 -1
  285. package/dist/chunk-PNTCATDE.cjs.map +0 -1
  286. package/dist/chunk-PT7RIRIZ.cjs.map +0 -1
  287. package/dist/chunk-Q3G6A4I3.cjs.map +0 -1
  288. package/dist/chunk-S6PW7VV5.js.map +0 -1
  289. package/dist/chunk-TQR4KBY2.cjs.map +0 -1
  290. package/dist/chunk-VQH4VAWD.cjs +0 -12
  291. package/dist/chunk-WQZLUGVR.js.map +0 -1
  292. package/dist/chunk-XBYVV3MP.cjs.map +0 -1
  293. package/dist/chunk-XL7SLCXS.js.map +0 -1
  294. package/dist/chunk-YAAM3M2S.cjs.map +0 -1
  295. package/dist/chunk-YBQOHKHN.cjs.map +0 -1
  296. package/dist/chunk-YVWGEQJE.cjs.map +0 -1
@@ -1,30 +1,31 @@
1
- import { createEdgeRowMapper, createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, POSTGRES_ROW_MAPPER_CONFIG } from './chunk-NMWDXFPH.js';
2
- import { rowToNode, executeNodeBulkFindByIndex, executeNodeBulkFindByConstraint, executeNodeFindByConstraint, executeNodeBulkGetOrCreateByConstraint, executeNodeGetOrCreateByConstraint, executeNodeHardDelete, executeNodeDeleteBatch, executeNodeDelete, nodeUpsertDirtyCheck, executeNodeUpsertUpdate, executeNodeUpdateWhere, executeNodeUpdate, executeNodeCreateNoReturnBatch, executeNodeCreateBatch, executeNodeCreate, rowToEdge, checkCardinalityConstraint, edgeWriteNeedsConstraintFence, withAlreadyExistsTranslation, rowToNodeMeta, rowToEdgeMeta } from './chunk-L65OU2U3.js';
3
- import { storeRuntime, STORE_RUNTIME, TRANSACTION_RUNTIME, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, getEmbeddingFields, computeFulltextContent } from './chunk-M3WP7RQZ.js';
4
- import { loadAndMergeGraphExtensionDocument, serializeSchema, buildKindRegistry, ensureIdentitySchemaStorage, loadAndVerifyGraph, identitySchemaCommitPreflight, getSchemaChanges, requiresMigration, mergeGraphExtension, commitNewSchemaVersion, commitNewSchemaVersionWithPreflight, planRemovals, stripGraphExtension, applyDeprecatedKinds, identityKindCascadeNeeded, ensureSchema, loadActiveSchemaWithBootstrap, parseSerializedSchema, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, commitNewSchemaVersionIfKindsEmpty, serializeIndexDeclaration } from './chunk-LGHCOKTT.js';
5
- import { getTypeName } from './chunk-JXA2ZP2Q.js';
6
- import { rebuildIdentityClosureForContext, loadCurrentStructuralClasses, loadAssertionsByIds, toTransferAssertion, liveNodeKindsSharingIds, createIdentityFacade, createIdentityReadFacade, runInWriteTransaction, validateIdentityForContext, removeIdentityKindsForContext, readIdentityAssertionsForInterchange, readIdentityAssertionPageAtTarget, lockIdentityGraph, foldIdentityForCreatedNodes, importIdentityAssertionsIntoTarget, assertAffectedIdentityClassesConsistent, applyIdentityChangesForContext, withWriteTransactionSession, lockSchemaVersionForStoreWrite, refKey, detachIdentityForNode, validateEdgeProps, runHookedWriteOperation, encodeTupleKey } from './chunk-GF3KXUTW.js';
7
- import { isParameterRef, resolveParameterValueType, fieldRef, compareStrings, buildFieldBuilderForTypeInfo, stringField, createFulltextAccessor, CURRENT_READ_INSTANT_PLACEHOLDER, withPinnedReadInstant, compareCodePoints, assertRevisionTrackableBackend, createRecordedBackend, createRecordedTransactionScope, readRecordedClock, ensureRevisionOrigin, withRecordedFlushObserver, recordedCaptureRequiresCallbackTransactionError, assertRecordedCaptureTransactionIsolation, lockRecordedGraphWrite, createGraphBackendProjection, generateId, assertCurrentRecordedSchema, baseField, objectField, arrayField, dateField, numberField, advanceRevisionClock, runInsertBatch, edgeInsertDispatch, runInsertBatchReturning, projectBackendMembers, sqlValueList, getNodeRowsByIds, getEdgeRowsByIds, compileKindFilter, runInsertNoReturn, currentReadInstant, compileTemporalFilter, closeRecordedHardDeletedKind, buildPredicateIndex, historicalIdentityPeerClassQuery, IDENTITY_PEER_CLASS_COLUMNS, compileFieldValue, recordedBindParamBudget, extractVectorSimilarityPredicates, extractFulltextMatchPredicates, currentReadInstantFor, extractTemporalOptions, compilePredicateExpression, getPredicatesForAlias, getFieldPointer, getNodeKindsForAlias, getHybridTargetAlias, throwHistoryUnsafeSqlAccess, throwRevisionTrackingUnsafeSqlAccess, compilePredicateClauses } from './chunk-NLI2AVEF.js';
1
+ import { createEdgeRowMapper, createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, POSTGRES_ROW_MAPPER_CONFIG, normalizeRowTimestamp, normalizeRequiredRowTimestamp } from './chunk-LEWHMOUY.js';
2
+ import { rowToNode, executeNodeBulkFindByIndex, executeNodeBulkFindByConstraint, executeNodeFindByConstraint, executeNodeBulkGetOrCreateByConstraint, executeNodeGetOrCreateByConstraint, executeNodeHardDelete, executeNodeDeleteBatch, executeNodeDelete, nodeUpsertDirtyCheck, executeNodeUpsertUpdate, executeNodeUpdateWhere, executeNodeUpdate, executeNodeCreateNoReturnBatch, executeNodeCreateBatch, executeNodeCreate, rowToEdge, assertValidityEndMutation, assertClearValidToSupported, edgeWriteNeedsConstraintFence, withAlreadyExistsTranslation, rowToNodeMeta, rowToEdgeMeta, validityEndAfterMutation, checkCardinalityConstraint } from './chunk-SE6EGQSD.js';
3
+ import { storeRuntime, STORE_RUNTIME, TRANSACTION_RUNTIME, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, getEmbeddingFields, computeFulltextContent } from './chunk-FNOMT74T.js';
4
+ import { loadAndMergeGraphExtensionDocument, serializeSchema, buildKindRegistry, ensureIdentitySchemaStorage, loadAndVerifyGraph, identitySchemaCommitPreflight, getSchemaChanges, requiresMigration, mergeGraphExtension, commitNewSchemaVersion, commitNewSchemaVersionWithPreflight, planRemovals, stripGraphExtension, applyDeprecatedKinds, identityKindCascadeNeeded, ensureSchema, loadActiveSchemaWithBootstrap, parseSerializedSchema, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, commitNewSchemaVersionIfKindsEmpty, serializeIndexDeclaration } from './chunk-XYBQI6LE.js';
5
+ import { getTypeName } from './chunk-SHFBB23Q.js';
6
+ import { rebuildIdentityClosureForContext, loadCurrentStructuralClasses, loadAssertionsByIds, toTransferAssertion, liveNodeKindsSharingIds, createIdentityFacade, createIdentityReadFacade, runInWriteTransaction, validateIdentityForContext, removeIdentityKindsForContext, readIdentityAssertionsForInterchange, readIdentityAssertionPageAtTarget, lockIdentityGraph, foldIdentityForCreatedNodes, importIdentityAssertionsIntoTarget, assertAffectedIdentityClassesConsistent, applyIdentityChangesForContext, withWriteTransactionSession, lockSchemaVersionForStoreWrite, refKey, requireNodeValidityEndCompatible, detachIdentityForNode, validateEdgeProps, runHookedWriteOperation, encodeTupleKey } from './chunk-NNQ6A3RM.js';
7
+ import { isParameterRef, resolveParameterValueType, fieldRef, compareStrings, buildFieldBuilderForTypeInfo, stringField, createFulltextAccessor, CURRENT_READ_INSTANT_PLACEHOLDER, withPinnedReadInstant, compareCodePoints, assertRevisionTrackableBackend, createRecordedBackend, createRecordedTransactionScope, readRecordedClock, ensureRevisionOrigin, withRecordedFlushObserver, recordedCaptureRequiresCallbackTransactionError, assertRecordedCaptureTransactionIsolation, lockRecordedGraphWrite, createGraphBackendProjection, generateId, assertCurrentRecordedSchema, baseField, objectField, arrayField, dateField, numberField, advanceRevisionClock, runInsertBatch, edgeInsertDispatch, runInsertBatchReturning, projectBackendMembers, sqlValueList, getNodeRowsByIds, getEdgeRowsByIds, compileKindFilter, runInsertNoReturn, currentReadInstant, compileTemporalFilter, closeRecordedHardDeletedKind, buildPredicateIndex, historicalIdentityPeerClassQuery, IDENTITY_PEER_CLASS_COLUMNS, compileFieldValue, recordedBindParamBudget, extractVectorSimilarityPredicates, extractFulltextMatchPredicates, currentReadInstantFor, extractTemporalOptions, compilePredicateExpression, getPredicatesForAlias, getFieldPointer, getNodeKindsForAlias, getHybridTargetAlias, throwHistoryUnsafeSqlAccess, throwRevisionTrackingUnsafeSqlAccess, compilePredicateClauses } from './chunk-AVGUJWVX.js';
8
8
  import { canonicalEqual, sortedReplacer } from './chunk-JBQQ7THH.js';
9
- import { withRecordedRelationsPrecondition, chunk, postgresReadWriteRefusedSqlState, isMissingTableError, groupBy, postgresTemporaryTableUnavailableSqlState } from './chunk-JZUR7ZWE.js';
10
- import { createSqlSchema, requireSqlSchema, DEFAULT_SQL_SCHEMA, recordedReadSchemaFor, requireExternalRecordedReadSource, createRecordedReadBinding, vectorSlotKey, recordedReadSqlSchema, requireRecordedReadBinding, ALIAS_CTE_PREFIX, EMBEDDINGS_CTE_ALIAS, FULLTEXT_CTE_ALIAS, HYBRID_CANDIDATES_CTE_ALIAS } from './chunk-MSY7FSX4.js';
11
- import { runOptionallyInTransaction, createTransactionReadBackend, createBackendOverlay, rowPropsToObject, INTERNAL_TEMPORARY_WRITES } from './chunk-AKLS3BYZ.js';
12
- import { isKnownKind } from './chunk-775A4ZMN.js';
13
- import { validateEdgeEndpoints } from './chunk-WDGA7IYB.js';
14
- import { resolveReadCoordinate, withRecordedCoordinate, describeCoordinate, coordinateContext, nowIso, recordedInstantWallTime, asRecordedInstant, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow, assertWritableValidityWindow, assertValidRecordedInstant, optionalRecordedInstantParts, preservesImmutableLowerBound, isCanonicalIsoDate, statedBoundMatchesStored } from './chunk-XL7SLCXS.js';
15
- import { generateIndexDDL } from './chunk-DCQVHAYQ.js';
16
- import { SYSTEM_INDEX_DECLARATIONS, resolveSystemIndexTableName, systemIndexName, resolveSystemIndexNames, generateSystemIndexDDL } from './chunk-CBTIUB76.js';
17
- import { NODE_META_KEYS, EDGE_META_KEYS } from './chunk-I5MOXA4H.js';
9
+ import { withRecordedRelationsPrecondition, chunk, postgresReadWriteRefusedSqlState, isMissingTableError, groupBy, postgresTemporaryTableUnavailableSqlState, isPostgresConcurrentDdlRaceError } from './chunk-NAZ2RA4L.js';
10
+ import { createSqlSchema, requireSqlSchema, DEFAULT_SQL_SCHEMA, recordedReadSchemaFor, requireExternalRecordedReadSource, createRecordedReadBinding, vectorSlotKey, recordedReadSqlSchema, requireRecordedReadBinding, ALIAS_CTE_PREFIX, EMBEDDINGS_CTE_ALIAS, FULLTEXT_CTE_ALIAS, HYBRID_CANDIDATES_CTE_ALIAS } from './chunk-NVY5CJFP.js';
11
+ import { runOptionallyInTransaction, createTransactionReadBackend, createBackendOverlay, rowPropsToObject, INTERNAL_TEMPORARY_WRITES } from './chunk-SHSSRCFR.js';
12
+ import { isKnownKind } from './chunk-HEV35TGT.js';
13
+ import { validateEdgeEndpoints } from './chunk-GLHXM7C4.js';
14
+ import { resolveReadCoordinate, withRecordedCoordinate, describeCoordinate, coordinateContext, recordedInstantWallTime, asRecordedInstant, assertValidRecordedInstant, optionalRecordedInstantParts } from './chunk-XY5OMOJD.js';
15
+ import { nowIso, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow, preservesImmutableLowerBound, assertWritableValidityWindow, isCanonicalIsoDate, statedBoundMatchesStored } from './chunk-NG2RB5WL.js';
16
+ import { generateIndexDDL } from './chunk-KKBDXCLQ.js';
17
+ import { SYSTEM_INDEX_DECLARATIONS, resolveSystemIndexTableName, systemIndexName, resolveSystemIndexNames, generateSystemIndexDDL } from './chunk-SDBBMD4N.js';
18
+ import { NODE_META_KEYS, EDGE_META_KEYS } from './chunk-P6YLZTRE.js';
18
19
  import { sha256Hex, fnv1aBase36 } from './chunk-K34OPSJK.js';
19
20
  import { DEFAULT_PAGINATION_LIMIT, DEFAULT_STREAM_BATCH_SIZE, SQLITE_PATH_DELIMITER, PG_ARRAY_START, PG_ARRAY_END, PG_PATH_ELEMENT_SEPARATOR, MAX_PG_IDENTIFIER_LENGTH } from './chunk-2EBMPJBO.js';
20
- import { getDialect, assertVectorMinScore, assertApproximateMetricSupported, vectorScoreExpression, vectorMinScoreCondition } from './chunk-YDFDBE6D.js';
21
- import { isSqlPlaceholder, bindSqlValue, markAnnIndexScan, asCompiledSelectSql, isRawExecutable, renderSql, annIndexScanTypes, sql, asCompiledRowsSql, markForceCustomPlan, asCompiledStatementSql, asCompiledTemporaryStatementSql } from './chunk-PQBQG7IM.js';
21
+ import { getDialect, assertVectorMinScore, assertApproximateMetricSupported, vectorScoreExpression, vectorMinScoreCondition } from './chunk-ZDKTPBGV.js';
22
+ import { isSqlPlaceholder, bindSqlValue, markAnnIndexScan, asCompiledSelectSql, isRawExecutable, renderSql, annIndexScanTypes, sql, asCompiledRowsSql, markForceCustomPlan, asCompiledStatementSql, asCompiledTemporaryStatementSql } from './chunk-3DMMGT6S.js';
22
23
  import { createSchemaIntrospector } from './chunk-AMKPPFUO.js';
23
24
  import { resolveEmbeddingFields, resolveGraphVectorSlots, resolveDeclaredFulltextLanguage, getSearchableFields } from './chunk-PC2UBAUB.js';
24
- import { IncompatibleChangeError } from './chunk-T4XNKYXB.js';
25
+ import { IncompatibleChangeError } from './chunk-D5R42W5D.js';
25
26
  import { META_EDGE_DISJOINT_WITH, META_EDGE_EQUIVALENT_TO, META_EDGE_SAME_AS, META_EDGE_SUB_CLASS_OF } from './chunk-JXXDZTMN.js';
26
- import { validateProjectionField } from './chunk-K5ELX2GT.js';
27
- import { ConfigurationError, UnsupportedPredicateError, ValidationError, KindNotFoundError, EndpointError, EagerMaterializationError, ContributionRebuildUnsupportedError, CompilerInvariantError, CardinalityError, DatabaseOperationError, EdgeNotFoundError, MigrationError, EDGE_IDENTITY_MISMATCH_CODE, UnsupportedBackendCapabilityError, EndpointNotFoundError, GraphAlgorithmConvergenceError, InvalidEdgeWeightError } from './chunk-J3WZ3FA2.js';
27
+ import { validateProjectionField } from './chunk-XVWOYKIK.js';
28
+ import { ConfigurationError, UnsupportedPredicateError, ValidationError, KindNotFoundError, EndpointError, EagerMaterializationError, ContributionRebuildUnsupportedError, CompilerInvariantError, CardinalityError, DatabaseOperationError, EdgeNotFoundError, MigrationError, EDGE_IDENTITY_MISMATCH_CODE, UnsupportedBackendCapabilityError, EndpointNotFoundError, GraphAlgorithmConvergenceError, InvalidEdgeWeightError } from './chunk-ZLONH2UD.js';
28
29
  import { jsonPointer, parseJsonPointer, resolveJsonPointer } from './chunk-FWJKWH6U.js';
29
30
  import { readOwnProperty, requireDefined, createDataKeyedBag, isInteropProbeKey, hasOwnKey, isPresent } from './chunk-DYATYRY4.js';
30
31
 
@@ -5279,9 +5280,6 @@ var RESERVED_EDGE_KEYS = /* @__PURE__ */ new Set([
5279
5280
  "toId",
5280
5281
  "meta"
5281
5282
  ]);
5282
- function nullToUndefined2(value) {
5283
- return value === null ? void 0 : value;
5284
- }
5285
5283
  function propsExcludingReserved(props, reservedKeys) {
5286
5284
  const kept = createDataKeyedBag();
5287
5285
  for (const [key, value] of Object.entries(props)) {
@@ -5297,14 +5295,25 @@ function buildSelectableNode(row, alias) {
5297
5295
  const propsRaw = row[`${alias}_props`];
5298
5296
  const rawProps = typeof propsRaw === "string" ? JSON.parse(propsRaw) : propsRaw ?? {};
5299
5297
  const version = row[`${alias}_version`];
5300
- const validFrom = nullToUndefined2(
5301
- row[`${alias}_valid_from`]
5298
+ const validFrom = normalizeRowTimestamp(
5299
+ row[`${alias}_valid_from`],
5300
+ `${alias}_valid_from`
5301
+ );
5302
+ const validTo = normalizeRowTimestamp(
5303
+ row[`${alias}_valid_to`],
5304
+ `${alias}_valid_to`
5305
+ );
5306
+ const createdAt = normalizeRequiredRowTimestamp(
5307
+ row[`${alias}_created_at`],
5308
+ `${alias}_created_at`
5309
+ );
5310
+ const updatedAt = normalizeRequiredRowTimestamp(
5311
+ row[`${alias}_updated_at`],
5312
+ `${alias}_updated_at`
5302
5313
  );
5303
- const validTo = nullToUndefined2(row[`${alias}_valid_to`]);
5304
- const createdAt = row[`${alias}_created_at`];
5305
- const updatedAt = row[`${alias}_updated_at`];
5306
- const deletedAt = nullToUndefined2(
5307
- row[`${alias}_deleted_at`]
5314
+ const deletedAt = normalizeRowTimestamp(
5315
+ row[`${alias}_deleted_at`],
5316
+ `${alias}_deleted_at`
5308
5317
  );
5309
5318
  const result = {
5310
5319
  id,
@@ -5338,14 +5347,25 @@ function buildSelectableEdge(row, alias) {
5338
5347
  const toId = row[`${alias}_to_id`];
5339
5348
  const propsRaw = row[`${alias}_props`];
5340
5349
  const rawProps = typeof propsRaw === "string" ? JSON.parse(propsRaw) : propsRaw ?? {};
5341
- const validFrom = nullToUndefined2(
5342
- row[`${alias}_valid_from`]
5350
+ const validFrom = normalizeRowTimestamp(
5351
+ row[`${alias}_valid_from`],
5352
+ `${alias}_valid_from`
5343
5353
  );
5344
- const validTo = nullToUndefined2(row[`${alias}_valid_to`]);
5345
- const createdAt = row[`${alias}_created_at`];
5346
- const updatedAt = row[`${alias}_updated_at`];
5347
- const deletedAt = nullToUndefined2(
5348
- row[`${alias}_deleted_at`]
5354
+ const validTo = normalizeRowTimestamp(
5355
+ row[`${alias}_valid_to`],
5356
+ `${alias}_valid_to`
5357
+ );
5358
+ const createdAt = normalizeRequiredRowTimestamp(
5359
+ row[`${alias}_created_at`],
5360
+ `${alias}_created_at`
5361
+ );
5362
+ const updatedAt = normalizeRequiredRowTimestamp(
5363
+ row[`${alias}_updated_at`],
5364
+ `${alias}_updated_at`
5365
+ );
5366
+ const deletedAt = normalizeRowTimestamp(
5367
+ row[`${alias}_deleted_at`],
5368
+ `${alias}_deleted_at`
5349
5369
  );
5350
5370
  const result = {
5351
5371
  id,
@@ -5915,6 +5935,14 @@ var MissingSelectiveFieldError = class extends Error {
5915
5935
  this.field = field2;
5916
5936
  }
5917
5937
  };
5938
+ function normalizeMetaValue(value, metaKey, alias) {
5939
+ if (metaKey === "version") return nullToUndefined(value);
5940
+ const field2 = `${alias}_${metaKey}`;
5941
+ if (metaKey === "createdAt" || metaKey === "updatedAt") {
5942
+ return normalizeRequiredRowTimestamp(value, field2);
5943
+ }
5944
+ return normalizeRowTimestamp(value, field2);
5945
+ }
5918
5946
  var SELECTABLE_ALIAS_MARKER = /* @__PURE__ */ Symbol("selectable_alias_marker");
5919
5947
  function isSelectableAliasObject(value) {
5920
5948
  return typeof value === "object" && value !== null && SELECTABLE_ALIAS_MARKER in value;
@@ -6080,7 +6108,11 @@ function buildRequiredAliasValue(row, plan) {
6080
6108
  if (plan.metaFields.length > 0) {
6081
6109
  const meta = createDataKeyedBag();
6082
6110
  for (const field2 of plan.metaFields) {
6083
- meta[field2.metaKey] = nullToUndefined(row[field2.outputName]);
6111
+ meta[field2.metaKey] = normalizeMetaValue(
6112
+ row[field2.outputName],
6113
+ field2.metaKey,
6114
+ plan.alias
6115
+ );
6084
6116
  }
6085
6117
  base["meta"] = createGuardedProxy(meta, `${plan.alias}.meta`);
6086
6118
  }
@@ -13951,15 +13983,18 @@ function lowerBoundRequiresWrite(requested, stored) {
13951
13983
  return requestedValidFrom !== void 0 && !isCanonicalIsoDate(requestedValidFrom);
13952
13984
  }
13953
13985
  function upsertWindowChanges(requested, current) {
13954
- return lowerBoundRequiresWrite(requested, current.valid_from) || windowFieldChanges(requested?.validTo, current.valid_to);
13986
+ return lowerBoundRequiresWrite(requested, current.valid_from) || requested?.clearValidTo === true && validityEndAfterMutation(requested, current.valid_to) !== current.valid_to || requested?.clearValidTo === true && requested.validTo !== void 0 || windowFieldChanges(requested?.validTo, current.valid_to);
13955
13987
  }
13956
13988
  function windowAfterUpsertCreate(requested) {
13957
- return { valid_from: requested.validFrom, valid_to: requested.validTo };
13989
+ return {
13990
+ valid_from: requested.validFrom,
13991
+ valid_to: validityEndAfterMutation(requested, void 0)
13992
+ };
13958
13993
  }
13959
13994
  function windowAfterUpsertUpdate(current, requested) {
13960
13995
  return {
13961
13996
  valid_from: current.valid_from,
13962
- valid_to: requested.validTo ?? current.valid_to
13997
+ valid_to: validityEndAfterMutation(requested, current.valid_to)
13963
13998
  };
13964
13999
  }
13965
14000
  function shouldCoalesceUpsert(existing, options, runDirtyCheck) {
@@ -13998,6 +14033,7 @@ function buildCreateEdgeInput(kind, from, to, props, options) {
13998
14033
  function buildUpdateEdgeInput(kind, id, props, options) {
13999
14034
  const input = { id, identity: { kind }, props };
14000
14035
  if (options?.validTo !== void 0) input.validTo = options.validTo;
14036
+ if (options?.clearValidTo === true) input.clearValidTo = true;
14001
14037
  return input;
14002
14038
  }
14003
14039
  function buildUpsertUpdateEdgeInput(kind, id, from, to, props, options) {
@@ -14014,6 +14050,7 @@ function buildUpsertUpdateEdgeInput(kind, id, from, to, props, options) {
14014
14050
  };
14015
14051
  if (options?.validFrom !== void 0) input.validFrom = options.validFrom;
14016
14052
  if (options?.validTo !== void 0) input.validTo = options.validTo;
14053
+ if (options?.clearValidTo === true) input.clearValidTo = true;
14017
14054
  return input;
14018
14055
  }
14019
14056
  function endpointKey(endpointKind, id) {
@@ -14267,6 +14304,16 @@ function createEdgeCollection(config) {
14267
14304
  },
14268
14305
  async bulkUpsertById(items) {
14269
14306
  if (items.length === 0) return [];
14307
+ for (const item of items) {
14308
+ assertValidityEndMutation(item, {
14309
+ entityType: "edge",
14310
+ kind,
14311
+ id: item.id
14312
+ });
14313
+ if (item.clearValidTo === true) {
14314
+ assertClearValidToSupported(backend, "edge");
14315
+ }
14316
+ }
14270
14317
  const upsertAll = async (target) => {
14271
14318
  const ids = items.map((item) => item.id);
14272
14319
  const existingMap = await getEdgeRowsByIds(target, graphId, ids);
@@ -14439,6 +14486,10 @@ function createEdgeCollection(config) {
14439
14486
  return result === void 0 ? void 0 : narrowEdge(result);
14440
14487
  },
14441
14488
  async getOrCreateByEndpoints(from, to, props, options) {
14489
+ assertValidityEndMutation(options ?? {}, {
14490
+ entityType: "edge",
14491
+ kind
14492
+ });
14442
14493
  const getOrCreateOptions = {
14443
14494
  ...options?.matchOn !== void 0 && {
14444
14495
  matchOn: options.matchOn
@@ -14449,7 +14500,11 @@ function createEdgeCollection(config) {
14449
14500
  ...options?.validFrom !== void 0 && {
14450
14501
  validFrom: options.validFrom
14451
14502
  },
14452
- ...options?.validTo !== void 0 && { validTo: options.validTo }
14503
+ ...options?.validTo !== void 0 && { validTo: options.validTo },
14504
+ ...options?.clearValidTo === true && { clearValidTo: true },
14505
+ ...options?.onImmutableLowerBound !== void 0 && {
14506
+ onImmutableLowerBound: options.onImmutableLowerBound
14507
+ }
14453
14508
  };
14454
14509
  const result = await config.executeGetOrCreateByEndpoints(
14455
14510
  kind,
@@ -14465,6 +14520,12 @@ function createEdgeCollection(config) {
14465
14520
  },
14466
14521
  async bulkGetOrCreateByEndpoints(items, options) {
14467
14522
  if (items.length === 0) return [];
14523
+ for (const item of items) {
14524
+ assertValidityEndMutation(item, {
14525
+ entityType: "edge",
14526
+ kind
14527
+ });
14528
+ }
14468
14529
  const mappedItems = items.map((item) => ({
14469
14530
  fromKind: item.from.kind,
14470
14531
  fromId: item.from.id,
@@ -14472,7 +14533,11 @@ function createEdgeCollection(config) {
14472
14533
  toId: item.to.id,
14473
14534
  props: item.props,
14474
14535
  ...item.validFrom !== void 0 && { validFrom: item.validFrom },
14475
- ...item.validTo !== void 0 && { validTo: item.validTo }
14536
+ ...item.validTo !== void 0 && { validTo: item.validTo },
14537
+ ...item.clearValidTo === true && { clearValidTo: true },
14538
+ ...item.onImmutableLowerBound !== void 0 && {
14539
+ onImmutableLowerBound: item.onImmutableLowerBound
14540
+ }
14476
14541
  }));
14477
14542
  const getOrCreateOptions = {
14478
14543
  ...options?.matchOn !== void 0 && {
@@ -14549,12 +14614,14 @@ function buildCreateInput(kind, props, options) {
14549
14614
  function buildUpdateInput(kind, id, props, options) {
14550
14615
  const input = { kind, id, props };
14551
14616
  if (options?.validTo !== void 0) input.validTo = options.validTo;
14617
+ if (options?.clearValidTo === true) input.clearValidTo = true;
14552
14618
  return input;
14553
14619
  }
14554
14620
  function buildUpsertUpdateInput(kind, id, props, options) {
14555
14621
  const input = { kind, id, props };
14556
14622
  if (options?.validFrom !== void 0) input.validFrom = options.validFrom;
14557
14623
  if (options?.validTo !== void 0) input.validTo = options.validTo;
14624
+ if (options?.clearValidTo === true) input.clearValidTo = true;
14558
14625
  if (options?.onImmutableLowerBound !== void 0) {
14559
14626
  input.onImmutableLowerBound = options.onImmutableLowerBound;
14560
14627
  }
@@ -14747,6 +14814,14 @@ function createNodeCollection(config) {
14747
14814
  return this.upsertByIdFromRecord(id, props, options);
14748
14815
  },
14749
14816
  async upsertByIdFromRecord(id, data, options) {
14817
+ assertValidityEndMutation(options ?? {}, {
14818
+ entityType: "node",
14819
+ kind,
14820
+ id
14821
+ });
14822
+ if (options?.clearValidTo === true) {
14823
+ assertClearValidToSupported(backend, "node");
14824
+ }
14750
14825
  const existing = await backend.getNode(graphId, kind, id);
14751
14826
  const coalesces = (row) => {
14752
14827
  const runDirtyCheck = config.upsertDirtyCheck && (() => requireDefined(config.upsertDirtyCheck)(
@@ -14796,6 +14871,16 @@ function createNodeCollection(config) {
14796
14871
  },
14797
14872
  async bulkUpsertById(items) {
14798
14873
  if (items.length === 0) return [];
14874
+ for (const item of items) {
14875
+ assertValidityEndMutation(item, {
14876
+ entityType: "node",
14877
+ kind,
14878
+ id: item.id
14879
+ });
14880
+ if (item.clearValidTo === true) {
14881
+ assertClearValidToSupported(backend, "node");
14882
+ }
14883
+ }
14799
14884
  const upsertAll = async (target) => {
14800
14885
  const ids = items.map((item) => item.id);
14801
14886
  const existingMap = /* @__PURE__ */ new Map();
@@ -15243,6 +15328,7 @@ async function runBucketedMaterialization(items, options, bucketKey, runOne) {
15243
15328
  var CLAIM_LEASE_MS = 15 * 6e4;
15244
15329
  var CLAIM_RETRY_DELAY_MS = 200;
15245
15330
  var CLAIM_WAIT_TIMEOUT_MS = CLAIM_LEASE_MS + 6e4;
15331
+ var TRIGRAM_EXTENSION_DDL = "CREATE EXTENSION IF NOT EXISTS pg_trgm;";
15246
15332
  var INDEX_DIALECT_BEHAVIOR = {
15247
15333
  postgres: {
15248
15334
  concurrentBuilds: true,
@@ -15263,6 +15349,19 @@ function delay(ms) {
15263
15349
  setTimeout(resolve, ms);
15264
15350
  });
15265
15351
  }
15352
+ async function ensureTrigramExtension(backend) {
15353
+ if (backend.ensureTrigramExtension !== void 0) {
15354
+ await backend.ensureTrigramExtension();
15355
+ return;
15356
+ }
15357
+ const executeDdl = requireDefined(backend.executeDdl);
15358
+ try {
15359
+ await executeDdl(TRIGRAM_EXTENSION_DDL);
15360
+ } catch (error) {
15361
+ if (!isPostgresConcurrentDdlRaceError(error)) throw error;
15362
+ await executeDdl(TRIGRAM_EXTENSION_DDL);
15363
+ }
15364
+ }
15266
15365
  async function materializeIndexes(context, options = {}) {
15267
15366
  const { graph, graphId, backend, schemaVersion } = context;
15268
15367
  assertBackendSupportsIndexMaterialization(
@@ -15402,9 +15501,7 @@ async function materializeRelationalIndex(declaration, backend, dialect, ddlOpti
15402
15501
  driftLabel: "Index",
15403
15502
  run: async () => {
15404
15503
  if (declaration.method === "trigram") {
15405
- await requireDefined(backend.executeDdl)(
15406
- "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
15407
- );
15504
+ await ensureTrigramExtension(backend);
15408
15505
  }
15409
15506
  await requireDefined(backend.executeDdl)(ddl);
15410
15507
  },
@@ -16776,6 +16873,11 @@ function edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
16776
16873
  }
16777
16874
  async function performEdgeUpdate(ctx, input, target, options) {
16778
16875
  const id = input.id;
16876
+ assertValidityEndMutation(input, {
16877
+ entityType: "edge",
16878
+ kind: input.identity.kind,
16879
+ id
16880
+ });
16779
16881
  const existing = await target.getEdge(ctx.graphId, id);
16780
16882
  if (!existing || !options?.clearDeleted && existing.deleted_at) {
16781
16883
  throw new EdgeNotFoundError(input.identity.kind, id);
@@ -16787,14 +16889,39 @@ async function performEdgeUpdate(ctx, input, target, options) {
16787
16889
  "update"
16788
16890
  );
16789
16891
  const { validatedProps } = resolveEdgeUpdateProps(ctx, existing, input.props);
16790
- const validFrom = validateOptionalCanonicalIsoDate(
16892
+ const statedValidFrom = validateOptionalCanonicalIsoDate(
16791
16893
  input.validFrom,
16792
16894
  "validFrom"
16793
16895
  );
16896
+ const preservesLiveLowerBound = options?.clearDeleted !== true && preservesImmutableLowerBound(input.onImmutableLowerBound);
16897
+ const appliedValidFrom = preservesLiveLowerBound ? void 0 : statedValidFrom;
16794
16898
  const validTo = validateOptionalCanonicalIsoDate(input.validTo, "validTo");
16899
+ const effectiveValidTo = options?.clearDeleted === true && appliedValidFrom !== void 0 ? validTo : validityEndAfterMutation(
16900
+ input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo },
16901
+ existing.valid_to
16902
+ );
16903
+ const cardinality = edgeCardinality(ctx, input.identity.kind);
16904
+ const reentersLivePopulation = options?.clearDeleted === true && existing.deleted_at !== void 0;
16905
+ const reentersActivePopulation = cardinality === "oneActive" && effectiveValidTo === void 0 && (existing.deleted_at !== void 0 || existing.valid_to !== void 0);
16906
+ if (reentersLivePopulation || reentersActivePopulation) {
16907
+ await checkCardinalityConstraint(
16908
+ {
16909
+ graphId: ctx.graphId,
16910
+ registry: ctx.registry,
16911
+ backend: target
16912
+ },
16913
+ input.identity.kind,
16914
+ cardinality,
16915
+ existing.from_kind,
16916
+ existing.from_id,
16917
+ existing.to_kind,
16918
+ existing.to_id,
16919
+ effectiveValidTo
16920
+ );
16921
+ }
16795
16922
  const windowVerdict = assertWritableValidityWindow(
16796
16923
  `edge "${id}"`,
16797
- validFrom,
16924
+ appliedValidFrom,
16798
16925
  {
16799
16926
  effectiveValidFrom: existing.valid_from,
16800
16927
  appliesStatedValidFrom: options?.clearDeleted === true,
@@ -16828,23 +16955,30 @@ async function performEdgeUpdate(ctx, input, target, options) {
16828
16955
  if (input.identity.toId !== void 0) {
16829
16956
  updateParams.toId = input.identity.toId;
16830
16957
  }
16831
- if (validFrom !== void 0) updateParams.validFrom = validFrom;
16832
- if (validTo !== void 0) updateParams.validTo = validTo;
16958
+ if (appliedValidFrom !== void 0) {
16959
+ updateParams.validFrom = appliedValidFrom;
16960
+ }
16961
+ if (reentersActivePopulation && existing.valid_to !== void 0) {
16962
+ updateParams.expectedValidTo = existing.valid_to;
16963
+ }
16833
16964
  if (options?.clearDeleted) updateParams.clearDeleted = true;
16834
16965
  const row = await withUnmatchedEdgeUpdateRefusal(
16835
16966
  ctx,
16836
16967
  target,
16837
16968
  id,
16838
16969
  input.identity,
16839
- updateParams.expectedValidFrom !== void 0,
16840
- () => target.updateEdge(updateParams)
16970
+ updateParams.expectedValidFrom !== void 0 || updateParams.expectedValidTo !== void 0,
16971
+ () => target.updateEdge({
16972
+ ...updateParams,
16973
+ ...input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo }
16974
+ })
16841
16975
  );
16842
16976
  return rowToEdge(row);
16843
16977
  }
16844
16978
  function isEdgeUpdateNoRowError(error) {
16845
16979
  return error instanceof DatabaseOperationError && error.details.operation === "update" && error.details.entity === "edge" && error.details.reason === "no_row_returned";
16846
16980
  }
16847
- async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, assertedValidFrom, write) {
16981
+ async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, assertedWindowState, write) {
16848
16982
  try {
16849
16983
  return await write();
16850
16984
  } catch (error) {
@@ -16857,7 +16991,7 @@ async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, asserte
16857
16991
  edgeIdentityFromRow(current),
16858
16992
  "update"
16859
16993
  );
16860
- if (assertedValidFrom && current.deleted_at === void 0) {
16994
+ if (assertedWindowState && current.deleted_at === void 0) {
16861
16995
  throw new EdgeUpdateTargetMoved(expected.kind, id);
16862
16996
  }
16863
16997
  }
@@ -16907,40 +17041,73 @@ async function executeEdgeUpdate(ctx, input, backend) {
16907
17041
  ctx,
16908
17042
  opContext,
16909
17043
  backend,
16910
- (target) => performEdgeUpdateConverging(ctx, input, target)
17044
+ (target) => {
17045
+ if (input.clearValidTo === true) {
17046
+ assertClearValidToSupported(backend, "edge");
17047
+ }
17048
+ return performEdgeUpdateConverging(ctx, input, target);
17049
+ },
17050
+ {
17051
+ fencesConstraintProbe: input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? edgeWriteNeedsConstraintFence("oneActive") : void 0
17052
+ }
16911
17053
  );
16912
17054
  }
16913
- async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
16914
- const resurrectCardinality = options?.resurrectCardinality;
17055
+ async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options) {
17056
+ if (input.clearValidTo === true) {
17057
+ assertClearValidToSupported(backend, "edge");
17058
+ }
16915
17059
  return runInWriteTransaction(
16916
17060
  ctx,
16917
17061
  backend,
16918
17062
  async (target) => {
16919
- if (resurrectCardinality !== void 0) {
16920
- await checkCardinalityConstraint(
16921
- {
16922
- graphId: ctx.graphId,
16923
- registry: ctx.registry,
16924
- backend: target
16925
- },
16926
- input.identity.kind,
16927
- resurrectCardinality.cardinality,
16928
- resurrectCardinality.fromKind,
16929
- resurrectCardinality.fromId,
16930
- resurrectCardinality.toKind,
16931
- resurrectCardinality.toId,
16932
- resurrectCardinality.effectiveValidTo
16933
- );
17063
+ if (options?.coalesceUnchanged === true && !options.clearDeleted) {
17064
+ const existing = options.coalesceCandidate ?? await target.getEdge(ctx.graphId, input.id);
17065
+ if (existing !== void 0 && existing.deleted_at === void 0) {
17066
+ assertEdgeIdentityMatches(
17067
+ input.id,
17068
+ input.identity,
17069
+ edgeIdentityFromRow(existing),
17070
+ "update"
17071
+ );
17072
+ const runDirtyCheck = () => edgeUpsertDirtyCheck(
17073
+ ctx,
17074
+ existing.kind,
17075
+ existing.id,
17076
+ rowPropsToObject(existing.props),
17077
+ input.props
17078
+ );
17079
+ if (shouldCoalesceUpsert(existing, input, runDirtyCheck)) {
17080
+ return { edge: rowToEdge(existing), wrote: false };
17081
+ }
17082
+ }
16934
17083
  }
16935
- return performEdgeUpdateConverging(ctx, input, target, options);
17084
+ const edge = await performEdgeUpdateConverging(
17085
+ ctx,
17086
+ input,
17087
+ target,
17088
+ options
17089
+ );
17090
+ return { edge, wrote: true };
16936
17091
  },
16937
17092
  {
16938
17093
  // An in-place props update re-derives no constraint verdict: endpoints
16939
17094
  // are immutable, so cardinality cannot change under it.
16940
- fencesConstraintProbe: resurrectCardinality === void 0 ? void 0 : edgeWriteNeedsConstraintFence(resurrectCardinality.cardinality)
17095
+ fencesConstraintProbe: options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? edgeWriteNeedsConstraintFence(
17096
+ edgeCardinality(ctx, input.identity.kind)
17097
+ ) : void 0,
17098
+ didWrite: (outcome) => outcome.wrote
16941
17099
  }
16942
17100
  );
16943
17101
  }
17102
+ async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
17103
+ const outcome = await executeEdgeUpsertUpdateWithOutcome(
17104
+ ctx,
17105
+ input,
17106
+ backend,
17107
+ options
17108
+ );
17109
+ return outcome.edge;
17110
+ }
16944
17111
  async function executeEdgeDelete(ctx, expectedKind, id, backend) {
16945
17112
  const gate = await backend.getEdge(ctx.graphId, id);
16946
17113
  if (!gate) return;
@@ -17112,11 +17279,29 @@ async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, t
17112
17279
  const { liveRow } = findMatchingEdge(candidateRows, matchOn, props);
17113
17280
  return liveRow === void 0 ? void 0 : rowToEdge(liveRow);
17114
17281
  }
17282
+ function defersEndpointWindowOrdering(ifExists, onImmutableLowerBound) {
17283
+ return ifExists === "update" && preservesImmutableLowerBound(onImmutableLowerBound);
17284
+ }
17285
+ function assertEndpointClearCanApply(ifExists, clearValidTo, kind) {
17286
+ if (ifExists !== "return" || clearValidTo !== true) return;
17287
+ throw new ConfigurationError(
17288
+ `clearValidTo requires ifExists: "update" for getOrCreateByEndpoints on edge kind "${kind}"; ifExists: "return" never mutates a matching edge.`,
17289
+ {
17290
+ code: "CLEAR_VALID_TO_REQUIRES_UPDATE",
17291
+ kind,
17292
+ ifExists
17293
+ }
17294
+ );
17295
+ }
17115
17296
  async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, toKind, toId, props, backend, options) {
17116
17297
  const ifExists = options?.ifExists ?? "return";
17117
17298
  const matchOn = options?.matchOn ?? [];
17118
17299
  const registration = getEdgeRegistration(ctx.graph, kind);
17119
17300
  const edgeKind = registration.type;
17301
+ assertValidityEndMutation(options ?? {}, { entityType: "edge", kind });
17302
+ if (options?.clearValidTo === true) {
17303
+ assertClearValidToSupported(backend, "edge");
17304
+ }
17120
17305
  const validatedProps = validateEdgeProps(edgeKind.schema, props, {
17121
17306
  kind,
17122
17307
  operation: "create"
@@ -17127,11 +17312,13 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17127
17312
  "validFrom"
17128
17313
  );
17129
17314
  const validTo = validateOptionalCanonicalIsoDate(options?.validTo, "validTo");
17130
- assertOrderedValidityWindow(
17131
- `${kind} edge between ${fromKind} "${fromId}" and ${toKind} "${toId}"`,
17132
- validFrom,
17133
- validTo
17134
- );
17315
+ if (!defersEndpointWindowOrdering(ifExists, options?.onImmutableLowerBound)) {
17316
+ assertOrderedValidityWindow(
17317
+ `${kind} edge between ${fromKind} "${fromId}" and ${toKind} "${toId}"`,
17318
+ validFrom,
17319
+ validTo
17320
+ );
17321
+ }
17135
17322
  if (ifExists === "return") {
17136
17323
  const probeRows = await backend.findEdgesByKind({
17137
17324
  graphId: ctx.graphId,
@@ -17149,6 +17336,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17149
17336
  validatedProps
17150
17337
  );
17151
17338
  if (probedLiveRow !== void 0) {
17339
+ assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
17152
17340
  return { edge: rowToEdge(probedLiveRow), action: "found" };
17153
17341
  }
17154
17342
  }
@@ -17193,27 +17381,48 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17193
17381
  }
17194
17382
  if (liveRow !== void 0) {
17195
17383
  if (ifExists === "return") {
17384
+ assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
17196
17385
  return { edge: rowToEdge(liveRow), action: "found" };
17197
17386
  }
17198
- const edge2 = await executeEdgeUpsertUpdate(
17387
+ const outcome = await executeEdgeUpsertUpdateWithOutcome(
17199
17388
  ctx,
17200
17389
  {
17201
17390
  id: liveRow.id,
17202
17391
  identity: { kind, fromKind, fromId, toKind, toId },
17203
17392
  props: validatedProps,
17204
17393
  ...validFrom !== void 0 && { validFrom },
17205
- ...validTo !== void 0 && { validTo }
17394
+ ...validTo !== void 0 && { validTo },
17395
+ ...options?.clearValidTo === true && {
17396
+ clearValidTo: true
17397
+ },
17398
+ ...options?.onImmutableLowerBound !== void 0 && {
17399
+ onImmutableLowerBound: options.onImmutableLowerBound
17400
+ }
17206
17401
  },
17207
- backend
17402
+ backend,
17403
+ {
17404
+ coalesceUnchanged: ctx.coalesceUnchangedUpsertsEnabled && shouldCoalesceUpsert(
17405
+ liveRow,
17406
+ options,
17407
+ () => edgeUpsertDirtyCheck(
17408
+ ctx,
17409
+ liveRow.kind,
17410
+ liveRow.id,
17411
+ rowPropsToObject(liveRow.props),
17412
+ validatedProps
17413
+ )
17414
+ )
17415
+ }
17208
17416
  );
17209
- return { edge: edge2, action: "updated" };
17417
+ return {
17418
+ edge: outcome.edge,
17419
+ action: outcome.wrote ? "updated" : "found"
17420
+ };
17210
17421
  }
17211
- const cardinality = registration.cardinality ?? "many";
17212
17422
  if (deletedRow === void 0) {
17213
17423
  throw new Error("Expected deletedRow to be defined");
17214
17424
  }
17215
17425
  const matchedDeletedRow = deletedRow;
17216
- const effectiveValidTo = validTo ?? matchedDeletedRow.valid_to;
17217
17426
  const edge = await executeEdgeUpsertUpdate(
17218
17427
  ctx,
17219
17428
  {
@@ -17221,20 +17430,16 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17221
17430
  identity: { kind, fromKind, fromId, toKind, toId },
17222
17431
  props: validatedProps,
17223
17432
  ...validFrom !== void 0 && { validFrom },
17224
- ...validTo !== void 0 && { validTo }
17433
+ ...validTo !== void 0 && { validTo },
17434
+ ...options?.clearValidTo === true && {
17435
+ clearValidTo: true
17436
+ },
17437
+ ...options?.onImmutableLowerBound !== void 0 && {
17438
+ onImmutableLowerBound: options.onImmutableLowerBound
17439
+ }
17225
17440
  },
17226
17441
  backend,
17227
- {
17228
- clearDeleted: true,
17229
- resurrectCardinality: {
17230
- cardinality,
17231
- fromKind,
17232
- fromId,
17233
- toKind,
17234
- toId,
17235
- effectiveValidTo
17236
- }
17237
- }
17442
+ { clearDeleted: true }
17238
17443
  );
17239
17444
  return { edge, action: "resurrected" };
17240
17445
  }
@@ -17265,10 +17470,13 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17265
17470
  const matchOn = options?.matchOn ?? [];
17266
17471
  const registration = getEdgeRegistration(ctx.graph, kind);
17267
17472
  const edgeKind = registration.type;
17268
- const cardinality = registration.cardinality ?? "many";
17269
17473
  validateMatchOnFields(edgeKind.schema, matchOn, kind);
17270
17474
  const validated = [];
17271
17475
  for (const item of items) {
17476
+ assertValidityEndMutation(item, { entityType: "edge", kind });
17477
+ if (item.clearValidTo === true) {
17478
+ assertClearValidToSupported(backend, "edge");
17479
+ }
17272
17480
  const validatedProps = validateEdgeProps(edgeKind.schema, item.props, {
17273
17481
  kind,
17274
17482
  operation: "create"
@@ -17278,11 +17486,13 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17278
17486
  "validFrom"
17279
17487
  );
17280
17488
  const validTo = validateOptionalCanonicalIsoDate(item.validTo, "validTo");
17281
- assertOrderedValidityWindow(
17282
- `${kind} edge between ${item.fromKind} "${item.fromId}" and ${item.toKind} "${item.toId}"`,
17283
- validFrom,
17284
- validTo
17285
- );
17489
+ if (!defersEndpointWindowOrdering(ifExists, item.onImmutableLowerBound)) {
17490
+ assertOrderedValidityWindow(
17491
+ `${kind} edge between ${item.fromKind} "${item.fromId}" and ${item.toKind} "${item.toId}"`,
17492
+ validFrom,
17493
+ validTo
17494
+ );
17495
+ }
17286
17496
  const compositeKey = buildEdgeCompositeKey(
17287
17497
  item.fromKind,
17288
17498
  item.fromId,
@@ -17306,7 +17516,11 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17306
17516
  compositeKey,
17307
17517
  endpointKey: endpointKey2,
17308
17518
  ...validFrom !== void 0 && { validFrom },
17309
- ...validTo !== void 0 && { validTo }
17519
+ ...validTo !== void 0 && { validTo },
17520
+ ...item.clearValidTo === true && { clearValidTo: true },
17521
+ ...item.onImmutableLowerBound !== void 0 && {
17522
+ onImmutableLowerBound: item.onImmutableLowerBound
17523
+ }
17310
17524
  });
17311
17525
  }
17312
17526
  const uniqueEndpoints = /* @__PURE__ */ new Map();
@@ -17345,6 +17559,13 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17345
17559
  for (const [index, entry2] of validated.entries()) {
17346
17560
  const previousIndex = seenKeys.get(entry2.compositeKey);
17347
17561
  if (previousIndex !== void 0) {
17562
+ if (preservesImmutableLowerBound(entry2.onImmutableLowerBound)) {
17563
+ assertOrderedValidityWindow(
17564
+ `${kind} edge between ${entry2.fromKind} "${entry2.fromId}" and ${entry2.toKind} "${entry2.toId}"`,
17565
+ entry2.validFrom,
17566
+ entry2.validTo
17567
+ );
17568
+ }
17348
17569
  duplicateOf.push({ index, sourceIndex: previousIndex });
17349
17570
  continue;
17350
17571
  }
@@ -17388,7 +17609,13 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17388
17609
  ...entry2.validFrom !== void 0 && {
17389
17610
  validFrom: entry2.validFrom
17390
17611
  },
17391
- ...entry2.validTo !== void 0 && { validTo: entry2.validTo }
17612
+ ...entry2.validTo !== void 0 && { validTo: entry2.validTo },
17613
+ ...entry2.clearValidTo === true && {
17614
+ clearValidTo: true
17615
+ },
17616
+ ...entry2.onImmutableLowerBound !== void 0 && {
17617
+ onImmutableLowerBound: entry2.onImmutableLowerBound
17618
+ }
17392
17619
  });
17393
17620
  }
17394
17621
  }
@@ -17400,6 +17627,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17400
17627
  if (allFoundLive) {
17401
17628
  const found = Array.from({ length: items.length });
17402
17629
  for (const entry2 of probe.toFetch) {
17630
+ assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
17403
17631
  found[entry2.index] = { edge: rowToEdge(entry2.row), action: "found" };
17404
17632
  }
17405
17633
  for (const { index, sourceIndex } of probe.duplicateOf) {
@@ -17420,6 +17648,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17420
17648
  await fetchRowsByEndpoint(target)
17421
17649
  );
17422
17650
  const results = Array.from({ length: items.length });
17651
+ let writes = 0;
17423
17652
  if (toCreate.length > 0) {
17424
17653
  const createInputs = toCreate.map((entry2) => entry2.input);
17425
17654
  const createdEdges = await executeEdgeCreateBatch(
@@ -17433,6 +17662,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17433
17662
  action: "created"
17434
17663
  };
17435
17664
  }
17665
+ writes += toCreate.length;
17436
17666
  }
17437
17667
  for (const entry2 of toFetch) {
17438
17668
  if (entry2.isDeleted) {
@@ -17451,24 +17681,21 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17451
17681
  ...entry2.validFrom !== void 0 && {
17452
17682
  validFrom: entry2.validFrom
17453
17683
  },
17454
- ...entry2.validTo !== void 0 && { validTo: entry2.validTo }
17684
+ ...entry2.validTo !== void 0 && { validTo: entry2.validTo },
17685
+ ...entry2.clearValidTo === true && {
17686
+ clearValidTo: true
17687
+ },
17688
+ ...entry2.onImmutableLowerBound !== void 0 && {
17689
+ onImmutableLowerBound: entry2.onImmutableLowerBound
17690
+ }
17455
17691
  },
17456
17692
  target,
17457
- {
17458
- clearDeleted: true,
17459
- resurrectCardinality: {
17460
- cardinality,
17461
- fromKind: entry2.fromKind,
17462
- fromId: entry2.fromId,
17463
- toKind: entry2.toKind,
17464
- toId: entry2.toId,
17465
- effectiveValidTo: entry2.validTo ?? entry2.row.valid_to
17466
- }
17467
- }
17693
+ { clearDeleted: true }
17468
17694
  );
17469
17695
  results[entry2.index] = { edge, action: "resurrected" };
17696
+ writes += 1;
17470
17697
  } else if (ifExists === "update") {
17471
- const edge = await executeEdgeUpsertUpdate(
17698
+ const outcome = await executeEdgeUpsertUpdateWithOutcome(
17472
17699
  ctx,
17473
17700
  {
17474
17701
  id: entry2.row.id,
@@ -17483,12 +17710,27 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17483
17710
  ...entry2.validFrom !== void 0 && {
17484
17711
  validFrom: entry2.validFrom
17485
17712
  },
17486
- ...entry2.validTo !== void 0 && { validTo: entry2.validTo }
17713
+ ...entry2.validTo !== void 0 && { validTo: entry2.validTo },
17714
+ ...entry2.clearValidTo === true && {
17715
+ clearValidTo: true
17716
+ },
17717
+ ...entry2.onImmutableLowerBound !== void 0 && {
17718
+ onImmutableLowerBound: entry2.onImmutableLowerBound
17719
+ }
17487
17720
  },
17488
- target
17721
+ target,
17722
+ {
17723
+ coalesceUnchanged: ctx.coalesceUnchangedUpsertsEnabled,
17724
+ coalesceCandidate: entry2.row
17725
+ }
17489
17726
  );
17490
- results[entry2.index] = { edge, action: "updated" };
17727
+ results[entry2.index] = {
17728
+ edge: outcome.edge,
17729
+ action: outcome.wrote ? "updated" : "found"
17730
+ };
17731
+ if (outcome.wrote) writes += 1;
17491
17732
  } else {
17733
+ assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
17492
17734
  results[entry2.index] = {
17493
17735
  edge: rowToEdge(entry2.row),
17494
17736
  action: "found"
@@ -17497,21 +17739,35 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17497
17739
  }
17498
17740
  for (const { index, sourceIndex } of duplicateOf) {
17499
17741
  const sourceResult = requireDefined(results[sourceIndex]);
17742
+ if (sourceResult.action === "found") {
17743
+ assertEndpointClearCanApply(
17744
+ ifExists,
17745
+ items[index]?.clearValidTo,
17746
+ kind
17747
+ );
17748
+ }
17500
17749
  results[index] = { edge: sourceResult.edge, action: "found" };
17501
17750
  }
17502
- return results;
17751
+ return { results, writes };
17503
17752
  },
17504
17753
  // A bulk getOrCreate always converges on a match key no database key
17505
17754
  // backs, whatever its cardinality — the same reason the single-item path
17506
17755
  // fences unconditionally.
17507
- { fencesConstraintProbe: "edgeMatchKeyConvergence" }
17756
+ {
17757
+ fencesConstraintProbe: "edgeMatchKeyConvergence",
17758
+ didWrite: (outcome) => outcome.writes > 0
17759
+ }
17508
17760
  );
17509
17761
  }
17762
+ async function runBatchResults() {
17763
+ const outcome = await runBatch();
17764
+ return outcome.results;
17765
+ }
17510
17766
  try {
17511
- return await runBatch();
17767
+ return await runBatchResults();
17512
17768
  } catch (error) {
17513
17769
  if (!(error instanceof CardinalityError)) throw error;
17514
- return runBatch();
17770
+ return runBatchResults();
17515
17771
  }
17516
17772
  }
17517
17773
 
@@ -18295,7 +18551,7 @@ var StoreImplementation = class _StoreImplementation {
18295
18551
  lockIdentityImportTarget: (target) => this.lockIdentityImportTarget(target),
18296
18552
  foldImportedIdentityNodes: (target, references) => this.foldImportedIdentityNodes(target, references),
18297
18553
  importIdentityAssertionsAtTarget: (target, assertions, mode) => this.importIdentityAssertionsAtTarget(target, assertions, mode),
18298
- applyIdentityMergeAtTarget: (target, retractionIds, assertions) => this.applyIdentityMergeAtTarget(target, retractionIds, assertions),
18554
+ applyIdentityMergeAtTarget: (target, retractions, assertions) => this.applyIdentityMergeAtTarget(target, retractions, assertions),
18299
18555
  assertIdentityClassesConsistentAtTarget: (target, seeds) => this.assertIdentityClassesConsistentAtTarget(target, seeds)
18300
18556
  };
18301
18557
  Object.defineProperty(this, STORE_RUNTIME, {
@@ -18514,8 +18770,8 @@ var StoreImplementation = class _StoreImplementation {
18514
18770
  );
18515
18771
  }
18516
18772
  /** @internal Mechanical graph-merge apply through the mutation coordinator. */
18517
- applyIdentityMergeAtTarget(target, retractionIds, assertions) {
18518
- if (retractionIds.length === 0 && assertions.length === 0) {
18773
+ applyIdentityMergeAtTarget(target, retractions, assertions) {
18774
+ if (retractions.length === 0 && assertions.length === 0) {
18519
18775
  return Promise.resolve({ created: 0, retracted: 0 });
18520
18776
  }
18521
18777
  if (this.#graph.identity === void 0) {
@@ -18526,7 +18782,7 @@ var StoreImplementation = class _StoreImplementation {
18526
18782
  }
18527
18783
  return applyIdentityChangesForContext(
18528
18784
  this.#identityContext(target),
18529
- retractionIds,
18785
+ retractions,
18530
18786
  assertions
18531
18787
  );
18532
18788
  }
@@ -18898,7 +19154,7 @@ var StoreImplementation = class _StoreImplementation {
18898
19154
  options
18899
19155
  ),
18900
19156
  // Present only when opted in; its absence is the coalesce off switch.
18901
- ...this.#options?.coalesceUnchangedUpserts === true && {
19157
+ ...ctx.coalesceUnchangedUpsertsEnabled && {
18902
19158
  upsertDirtyCheck: (kind, id, existingProps, inputProps) => nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
18903
19159
  },
18904
19160
  executeDelete: (kind, id, backend) => executeNodeDelete(ctx, kind, id, backend),
@@ -18957,7 +19213,7 @@ var StoreImplementation = class _StoreImplementation {
18957
19213
  executeUpdate: (input, backend) => executeEdgeUpdate(ctx, input, backend),
18958
19214
  executeUpsertUpdate: (input, backend, options) => executeEdgeUpsertUpdate(ctx, input, backend, options),
18959
19215
  // Present only when opted in; its absence is the coalesce off switch.
18960
- ...this.#options?.coalesceUnchangedUpserts === true && {
19216
+ ...ctx.coalesceUnchangedUpsertsEnabled && {
18961
19217
  upsertDirtyCheck: (kind, id, existingProps, inputProps) => edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
18962
19218
  },
18963
19219
  executeDelete: (kind, id, backend) => executeEdgeDelete(ctx, kind, id, backend),
@@ -20477,8 +20733,9 @@ var StoreImplementation = class _StoreImplementation {
20477
20733
  * path. The cost is that a database whose contribution tables were dropped
20478
20734
  * out of band (a partial restore, a hand-run `DROP`, a schema-scoped
20479
20735
  * restore that missed them) opens completely clean and then fails at the
20480
- * first read of the affected slot. This is the explicit, operator-invoked
20481
- * check for that state; it is not, and should not become, a boot step.
20736
+ * first read or write that depends on the affected slot. This is the
20737
+ * explicit, operator-invoked check for that state; it is not, and should not
20738
+ * become, a boot step.
20482
20739
  *
20483
20740
  * Purely read-only: one existence query per distinct contribution table
20484
20741
  * plus one marker read per graph, no DDL and no writes, so it is safe to
@@ -20556,8 +20813,8 @@ var StoreImplementation = class _StoreImplementation {
20556
20813
  return repair(this.graphId, vectorSlots);
20557
20814
  }
20558
20815
  /**
20559
- * Read-only readiness check for the search projections: is search
20560
- * coherent with the graph right now, or is a query about to hit a
20816
+ * Read-only readiness check for the search projections: are dependent reads
20817
+ * and writes coherent with the graph right now, or are they about to hit a
20561
20818
  * degraded index?
20562
20819
  *
20563
20820
  * The read-only half of {@link Store.repairContributions}, and the
@@ -21013,6 +21270,7 @@ var StoreImplementation = class _StoreImplementation {
21013
21270
  schemaVersion: this.#schemaMetadata.schemaVersion,
21014
21271
  historyEnabled: this.#captureEnabled,
21015
21272
  revisionTrackingEnabled: this.#revisionTrackingEnabled,
21273
+ coalesceUnchangedUpsertsEnabled: this.#coalescesUnchangedUpserts(),
21016
21274
  revisionSchema: this.#sqlSchema(),
21017
21275
  registry: this.#registry,
21018
21276
  ...identityConfig === void 0 ? {} : {
@@ -21037,6 +21295,15 @@ var StoreImplementation = class _StoreImplementation {
21037
21295
  target,
21038
21296
  ref,
21039
21297
  mode
21298
+ ),
21299
+ requireValidityEndCompatible: (target, ref, validTo) => requireNodeValidityEndCompatible(
21300
+ {
21301
+ graphId: this.graphId,
21302
+ schema: this.#sqlSchema()
21303
+ },
21304
+ target,
21305
+ ref,
21306
+ validTo
21040
21307
  )
21041
21308
  }
21042
21309
  },
@@ -21058,12 +21325,17 @@ var StoreImplementation = class _StoreImplementation {
21058
21325
  schemaVersion: this.#schemaMetadata.schemaVersion,
21059
21326
  historyEnabled: this.#captureEnabled,
21060
21327
  revisionTrackingEnabled: this.#revisionTrackingEnabled,
21328
+ coalesceUnchangedUpsertsEnabled: this.#coalescesUnchangedUpserts(),
21061
21329
  revisionSchema: this.#sqlSchema(),
21062
21330
  registry: this.#registry,
21063
21331
  createOperationContext: (operation, entity, kind, id) => this.#createOperationContext(operation, entity, kind, id),
21064
21332
  withOperationHooks: runHooks
21065
21333
  };
21066
21334
  }
21335
+ /** The single owner of the store-wide unchanged-upsert enablement decision. */
21336
+ #coalescesUnchangedUpserts() {
21337
+ return this.#options?.coalesceUnchangedUpserts === true;
21338
+ }
21067
21339
  // === Internal: Hook Helpers ===
21068
21340
  /**
21069
21341
  * Decorates the query execution port so hooks observe each statement the
@@ -21675,5 +21947,5 @@ async function createVerifiedAdapterStore(graph, backend, options) {
21675
21947
  }
21676
21948
 
21677
21949
  export { ExecutableAggregateQuery, ExecutableQuery, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, PreparedQuery, QueryBuilder, RecordedStoreView, StoreSearch, StoreView, UnionableQuery, avg, composeFragments, count, countDistinct, countDistinctEdges, countEdges, createAdapterStore, createAdapterStoreWithSchema, createFragment, createQueryBuilder, createStore, createStoreWithSchema, createVerifiedAdapterStore, createVerifiedStore, defineSubgraphProject, field, having, havingEq, havingGt, havingGte, havingLt, havingLte, limitFragment, max, min, offsetFragment, orderByFragment, sum };
21678
- //# sourceMappingURL=chunk-S6PW7VV5.js.map
21679
- //# sourceMappingURL=chunk-S6PW7VV5.js.map
21950
+ //# sourceMappingURL=chunk-DJZTXBWY.js.map
21951
+ //# sourceMappingURL=chunk-DJZTXBWY.js.map