@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,30 +1,31 @@
1
- import { createEdgeRowMapper, createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, POSTGRES_ROW_MAPPER_CONFIG } from './chunk-IHRDX7K6.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-WEJHA7AD.js';
3
- import { storeRuntime, STORE_RUNTIME, TRANSACTION_RUNTIME, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, getEmbeddingFields, computeFulltextContent } from './chunk-LHYSY6SE.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-KA4L2NZ3.js';
5
- import { getTypeName } from './chunk-36LIJXWC.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-A2LJG5GM.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-EDHV4CBU.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-DSAWGCMP.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-72WUT4GG.js';
11
- import { runOptionallyInTransaction, createTransactionReadBackend, createBackendOverlay, rowPropsToObject, INTERNAL_TEMPORARY_WRITES } from './chunk-FA6Z7B5L.js';
12
- import { isKnownKind } from './chunk-5ZJOB5YS.js';
13
- import { validateEdgeEndpoints } from './chunk-LNIWCQR4.js';
14
- import { resolveReadCoordinate, withRecordedCoordinate, describeCoordinate, coordinateContext, nowIso, recordedInstantWallTime, asRecordedInstant, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow, preservesImmutableLowerBound, assertWritableValidityWindow, assertValidRecordedInstant, optionalRecordedInstantParts, isCanonicalIsoDate, statedBoundMatchesStored } from './chunk-R7EWHKID.js';
15
- import { generateIndexDDL } from './chunk-EDJDDY6H.js';
16
- import { SYSTEM_INDEX_DECLARATIONS, resolveSystemIndexTableName, systemIndexName, resolveSystemIndexNames, generateSystemIndexDDL } from './chunk-FSLTU57P.js';
17
- import { NODE_META_KEYS, EDGE_META_KEYS } from './chunk-WMKEGJG4.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-EAMVXR5B.js';
21
- import { isSqlPlaceholder, bindSqlValue, markAnnIndexScan, asCompiledSelectSql, isRawExecutable, renderSql, annIndexScanTypes, sql, asCompiledRowsSql, markForceCustomPlan, asCompiledStatementSql, asCompiledTemporaryStatementSql } from './chunk-QOJ2L2AD.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-SXWLLQ3D.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-OZJCH7ZS.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-62ZXBMSD.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`
5302
5309
  );
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`]
5310
+ const updatedAt = normalizeRequiredRowTimestamp(
5311
+ row[`${alias}_updated_at`],
5312
+ `${alias}_updated_at`
5313
+ );
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`
5353
+ );
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`
5343
5365
  );
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`]
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
@@ -14450,6 +14501,7 @@ function createEdgeCollection(config) {
14450
14501
  validFrom: options.validFrom
14451
14502
  },
14452
14503
  ...options?.validTo !== void 0 && { validTo: options.validTo },
14504
+ ...options?.clearValidTo === true && { clearValidTo: true },
14453
14505
  ...options?.onImmutableLowerBound !== void 0 && {
14454
14506
  onImmutableLowerBound: options.onImmutableLowerBound
14455
14507
  }
@@ -14468,6 +14520,12 @@ function createEdgeCollection(config) {
14468
14520
  },
14469
14521
  async bulkGetOrCreateByEndpoints(items, options) {
14470
14522
  if (items.length === 0) return [];
14523
+ for (const item of items) {
14524
+ assertValidityEndMutation(item, {
14525
+ entityType: "edge",
14526
+ kind
14527
+ });
14528
+ }
14471
14529
  const mappedItems = items.map((item) => ({
14472
14530
  fromKind: item.from.kind,
14473
14531
  fromId: item.from.id,
@@ -14476,6 +14534,7 @@ function createEdgeCollection(config) {
14476
14534
  props: item.props,
14477
14535
  ...item.validFrom !== void 0 && { validFrom: item.validFrom },
14478
14536
  ...item.validTo !== void 0 && { validTo: item.validTo },
14537
+ ...item.clearValidTo === true && { clearValidTo: true },
14479
14538
  ...item.onImmutableLowerBound !== void 0 && {
14480
14539
  onImmutableLowerBound: item.onImmutableLowerBound
14481
14540
  }
@@ -14555,12 +14614,14 @@ function buildCreateInput(kind, props, options) {
14555
14614
  function buildUpdateInput(kind, id, props, options) {
14556
14615
  const input = { kind, id, props };
14557
14616
  if (options?.validTo !== void 0) input.validTo = options.validTo;
14617
+ if (options?.clearValidTo === true) input.clearValidTo = true;
14558
14618
  return input;
14559
14619
  }
14560
14620
  function buildUpsertUpdateInput(kind, id, props, options) {
14561
14621
  const input = { kind, id, props };
14562
14622
  if (options?.validFrom !== void 0) input.validFrom = options.validFrom;
14563
14623
  if (options?.validTo !== void 0) input.validTo = options.validTo;
14624
+ if (options?.clearValidTo === true) input.clearValidTo = true;
14564
14625
  if (options?.onImmutableLowerBound !== void 0) {
14565
14626
  input.onImmutableLowerBound = options.onImmutableLowerBound;
14566
14627
  }
@@ -14753,6 +14814,14 @@ function createNodeCollection(config) {
14753
14814
  return this.upsertByIdFromRecord(id, props, options);
14754
14815
  },
14755
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
+ }
14756
14825
  const existing = await backend.getNode(graphId, kind, id);
14757
14826
  const coalesces = (row) => {
14758
14827
  const runDirtyCheck = config.upsertDirtyCheck && (() => requireDefined(config.upsertDirtyCheck)(
@@ -14802,6 +14871,16 @@ function createNodeCollection(config) {
14802
14871
  },
14803
14872
  async bulkUpsertById(items) {
14804
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
+ }
14805
14884
  const upsertAll = async (target) => {
14806
14885
  const ids = items.map((item) => item.id);
14807
14886
  const existingMap = /* @__PURE__ */ new Map();
@@ -15249,6 +15328,7 @@ async function runBucketedMaterialization(items, options, bucketKey, runOne) {
15249
15328
  var CLAIM_LEASE_MS = 15 * 6e4;
15250
15329
  var CLAIM_RETRY_DELAY_MS = 200;
15251
15330
  var CLAIM_WAIT_TIMEOUT_MS = CLAIM_LEASE_MS + 6e4;
15331
+ var TRIGRAM_EXTENSION_DDL = "CREATE EXTENSION IF NOT EXISTS pg_trgm;";
15252
15332
  var INDEX_DIALECT_BEHAVIOR = {
15253
15333
  postgres: {
15254
15334
  concurrentBuilds: true,
@@ -15269,6 +15349,19 @@ function delay(ms) {
15269
15349
  setTimeout(resolve, ms);
15270
15350
  });
15271
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
+ }
15272
15365
  async function materializeIndexes(context, options = {}) {
15273
15366
  const { graph, graphId, backend, schemaVersion } = context;
15274
15367
  assertBackendSupportsIndexMaterialization(
@@ -15408,9 +15501,7 @@ async function materializeRelationalIndex(declaration, backend, dialect, ddlOpti
15408
15501
  driftLabel: "Index",
15409
15502
  run: async () => {
15410
15503
  if (declaration.method === "trigram") {
15411
- await requireDefined(backend.executeDdl)(
15412
- "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
15413
- );
15504
+ await ensureTrigramExtension(backend);
15414
15505
  }
15415
15506
  await requireDefined(backend.executeDdl)(ddl);
15416
15507
  },
@@ -16782,6 +16873,11 @@ function edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
16782
16873
  }
16783
16874
  async function performEdgeUpdate(ctx, input, target, options) {
16784
16875
  const id = input.id;
16876
+ assertValidityEndMutation(input, {
16877
+ entityType: "edge",
16878
+ kind: input.identity.kind,
16879
+ id
16880
+ });
16785
16881
  const existing = await target.getEdge(ctx.graphId, id);
16786
16882
  if (!existing || !options?.clearDeleted && existing.deleted_at) {
16787
16883
  throw new EdgeNotFoundError(input.identity.kind, id);
@@ -16800,6 +16896,29 @@ async function performEdgeUpdate(ctx, input, target, options) {
16800
16896
  const preservesLiveLowerBound = options?.clearDeleted !== true && preservesImmutableLowerBound(input.onImmutableLowerBound);
16801
16897
  const appliedValidFrom = preservesLiveLowerBound ? void 0 : statedValidFrom;
16802
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
+ }
16803
16922
  const windowVerdict = assertWritableValidityWindow(
16804
16923
  `edge "${id}"`,
16805
16924
  appliedValidFrom,
@@ -16839,22 +16958,27 @@ async function performEdgeUpdate(ctx, input, target, options) {
16839
16958
  if (appliedValidFrom !== void 0) {
16840
16959
  updateParams.validFrom = appliedValidFrom;
16841
16960
  }
16842
- if (validTo !== void 0) updateParams.validTo = validTo;
16961
+ if (reentersActivePopulation && existing.valid_to !== void 0) {
16962
+ updateParams.expectedValidTo = existing.valid_to;
16963
+ }
16843
16964
  if (options?.clearDeleted) updateParams.clearDeleted = true;
16844
16965
  const row = await withUnmatchedEdgeUpdateRefusal(
16845
16966
  ctx,
16846
16967
  target,
16847
16968
  id,
16848
16969
  input.identity,
16849
- updateParams.expectedValidFrom !== void 0,
16850
- () => 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
+ })
16851
16975
  );
16852
16976
  return rowToEdge(row);
16853
16977
  }
16854
16978
  function isEdgeUpdateNoRowError(error) {
16855
16979
  return error instanceof DatabaseOperationError && error.details.operation === "update" && error.details.entity === "edge" && error.details.reason === "no_row_returned";
16856
16980
  }
16857
- async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, assertedValidFrom, write) {
16981
+ async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, assertedWindowState, write) {
16858
16982
  try {
16859
16983
  return await write();
16860
16984
  } catch (error) {
@@ -16867,7 +16991,7 @@ async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, asserte
16867
16991
  edgeIdentityFromRow(current),
16868
16992
  "update"
16869
16993
  );
16870
- if (assertedValidFrom && current.deleted_at === void 0) {
16994
+ if (assertedWindowState && current.deleted_at === void 0) {
16871
16995
  throw new EdgeUpdateTargetMoved(expected.kind, id);
16872
16996
  }
16873
16997
  }
@@ -16917,40 +17041,73 @@ async function executeEdgeUpdate(ctx, input, backend) {
16917
17041
  ctx,
16918
17042
  opContext,
16919
17043
  backend,
16920
- (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
+ }
16921
17053
  );
16922
17054
  }
16923
- async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
16924
- const resurrectCardinality = options?.resurrectCardinality;
17055
+ async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options) {
17056
+ if (input.clearValidTo === true) {
17057
+ assertClearValidToSupported(backend, "edge");
17058
+ }
16925
17059
  return runInWriteTransaction(
16926
17060
  ctx,
16927
17061
  backend,
16928
17062
  async (target) => {
16929
- if (resurrectCardinality !== void 0) {
16930
- await checkCardinalityConstraint(
16931
- {
16932
- graphId: ctx.graphId,
16933
- registry: ctx.registry,
16934
- backend: target
16935
- },
16936
- input.identity.kind,
16937
- resurrectCardinality.cardinality,
16938
- resurrectCardinality.fromKind,
16939
- resurrectCardinality.fromId,
16940
- resurrectCardinality.toKind,
16941
- resurrectCardinality.toId,
16942
- resurrectCardinality.effectiveValidTo
16943
- );
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
+ }
16944
17083
  }
16945
- 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 };
16946
17091
  },
16947
17092
  {
16948
17093
  // An in-place props update re-derives no constraint verdict: endpoints
16949
17094
  // are immutable, so cardinality cannot change under it.
16950
- 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
16951
17099
  }
16952
17100
  );
16953
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
+ }
16954
17111
  async function executeEdgeDelete(ctx, expectedKind, id, backend) {
16955
17112
  const gate = await backend.getEdge(ctx.graphId, id);
16956
17113
  if (!gate) return;
@@ -17125,11 +17282,26 @@ async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, t
17125
17282
  function defersEndpointWindowOrdering(ifExists, onImmutableLowerBound) {
17126
17283
  return ifExists === "update" && preservesImmutableLowerBound(onImmutableLowerBound);
17127
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
+ }
17128
17296
  async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, toKind, toId, props, backend, options) {
17129
17297
  const ifExists = options?.ifExists ?? "return";
17130
17298
  const matchOn = options?.matchOn ?? [];
17131
17299
  const registration = getEdgeRegistration(ctx.graph, kind);
17132
17300
  const edgeKind = registration.type;
17301
+ assertValidityEndMutation(options ?? {}, { entityType: "edge", kind });
17302
+ if (options?.clearValidTo === true) {
17303
+ assertClearValidToSupported(backend, "edge");
17304
+ }
17133
17305
  const validatedProps = validateEdgeProps(edgeKind.schema, props, {
17134
17306
  kind,
17135
17307
  operation: "create"
@@ -17164,6 +17336,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17164
17336
  validatedProps
17165
17337
  );
17166
17338
  if (probedLiveRow !== void 0) {
17339
+ assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
17167
17340
  return { edge: rowToEdge(probedLiveRow), action: "found" };
17168
17341
  }
17169
17342
  }
@@ -17208,9 +17381,10 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17208
17381
  }
17209
17382
  if (liveRow !== void 0) {
17210
17383
  if (ifExists === "return") {
17384
+ assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
17211
17385
  return { edge: rowToEdge(liveRow), action: "found" };
17212
17386
  }
17213
- const edge2 = await executeEdgeUpsertUpdate(
17387
+ const outcome = await executeEdgeUpsertUpdateWithOutcome(
17214
17388
  ctx,
17215
17389
  {
17216
17390
  id: liveRow.id,
@@ -17218,20 +17392,37 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17218
17392
  props: validatedProps,
17219
17393
  ...validFrom !== void 0 && { validFrom },
17220
17394
  ...validTo !== void 0 && { validTo },
17395
+ ...options?.clearValidTo === true && {
17396
+ clearValidTo: true
17397
+ },
17221
17398
  ...options?.onImmutableLowerBound !== void 0 && {
17222
17399
  onImmutableLowerBound: options.onImmutableLowerBound
17223
17400
  }
17224
17401
  },
17225
- 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
+ }
17226
17416
  );
17227
- return { edge: edge2, action: "updated" };
17417
+ return {
17418
+ edge: outcome.edge,
17419
+ action: outcome.wrote ? "updated" : "found"
17420
+ };
17228
17421
  }
17229
- const cardinality = registration.cardinality ?? "many";
17230
17422
  if (deletedRow === void 0) {
17231
17423
  throw new Error("Expected deletedRow to be defined");
17232
17424
  }
17233
17425
  const matchedDeletedRow = deletedRow;
17234
- const effectiveValidTo = validTo ?? matchedDeletedRow.valid_to;
17235
17426
  const edge = await executeEdgeUpsertUpdate(
17236
17427
  ctx,
17237
17428
  {
@@ -17240,22 +17431,15 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17240
17431
  props: validatedProps,
17241
17432
  ...validFrom !== void 0 && { validFrom },
17242
17433
  ...validTo !== void 0 && { validTo },
17434
+ ...options?.clearValidTo === true && {
17435
+ clearValidTo: true
17436
+ },
17243
17437
  ...options?.onImmutableLowerBound !== void 0 && {
17244
17438
  onImmutableLowerBound: options.onImmutableLowerBound
17245
17439
  }
17246
17440
  },
17247
17441
  backend,
17248
- {
17249
- clearDeleted: true,
17250
- resurrectCardinality: {
17251
- cardinality,
17252
- fromKind,
17253
- fromId,
17254
- toKind,
17255
- toId,
17256
- effectiveValidTo
17257
- }
17258
- }
17442
+ { clearDeleted: true }
17259
17443
  );
17260
17444
  return { edge, action: "resurrected" };
17261
17445
  }
@@ -17286,10 +17470,13 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17286
17470
  const matchOn = options?.matchOn ?? [];
17287
17471
  const registration = getEdgeRegistration(ctx.graph, kind);
17288
17472
  const edgeKind = registration.type;
17289
- const cardinality = registration.cardinality ?? "many";
17290
17473
  validateMatchOnFields(edgeKind.schema, matchOn, kind);
17291
17474
  const validated = [];
17292
17475
  for (const item of items) {
17476
+ assertValidityEndMutation(item, { entityType: "edge", kind });
17477
+ if (item.clearValidTo === true) {
17478
+ assertClearValidToSupported(backend, "edge");
17479
+ }
17293
17480
  const validatedProps = validateEdgeProps(edgeKind.schema, item.props, {
17294
17481
  kind,
17295
17482
  operation: "create"
@@ -17330,6 +17517,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17330
17517
  endpointKey: endpointKey2,
17331
17518
  ...validFrom !== void 0 && { validFrom },
17332
17519
  ...validTo !== void 0 && { validTo },
17520
+ ...item.clearValidTo === true && { clearValidTo: true },
17333
17521
  ...item.onImmutableLowerBound !== void 0 && {
17334
17522
  onImmutableLowerBound: item.onImmutableLowerBound
17335
17523
  }
@@ -17422,6 +17610,9 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17422
17610
  validFrom: entry2.validFrom
17423
17611
  },
17424
17612
  ...entry2.validTo !== void 0 && { validTo: entry2.validTo },
17613
+ ...entry2.clearValidTo === true && {
17614
+ clearValidTo: true
17615
+ },
17425
17616
  ...entry2.onImmutableLowerBound !== void 0 && {
17426
17617
  onImmutableLowerBound: entry2.onImmutableLowerBound
17427
17618
  }
@@ -17436,6 +17627,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17436
17627
  if (allFoundLive) {
17437
17628
  const found = Array.from({ length: items.length });
17438
17629
  for (const entry2 of probe.toFetch) {
17630
+ assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
17439
17631
  found[entry2.index] = { edge: rowToEdge(entry2.row), action: "found" };
17440
17632
  }
17441
17633
  for (const { index, sourceIndex } of probe.duplicateOf) {
@@ -17456,6 +17648,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17456
17648
  await fetchRowsByEndpoint(target)
17457
17649
  );
17458
17650
  const results = Array.from({ length: items.length });
17651
+ let writes = 0;
17459
17652
  if (toCreate.length > 0) {
17460
17653
  const createInputs = toCreate.map((entry2) => entry2.input);
17461
17654
  const createdEdges = await executeEdgeCreateBatch(
@@ -17469,6 +17662,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17469
17662
  action: "created"
17470
17663
  };
17471
17664
  }
17665
+ writes += toCreate.length;
17472
17666
  }
17473
17667
  for (const entry2 of toFetch) {
17474
17668
  if (entry2.isDeleted) {
@@ -17488,26 +17682,20 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17488
17682
  validFrom: entry2.validFrom
17489
17683
  },
17490
17684
  ...entry2.validTo !== void 0 && { validTo: entry2.validTo },
17685
+ ...entry2.clearValidTo === true && {
17686
+ clearValidTo: true
17687
+ },
17491
17688
  ...entry2.onImmutableLowerBound !== void 0 && {
17492
17689
  onImmutableLowerBound: entry2.onImmutableLowerBound
17493
17690
  }
17494
17691
  },
17495
17692
  target,
17496
- {
17497
- clearDeleted: true,
17498
- resurrectCardinality: {
17499
- cardinality,
17500
- fromKind: entry2.fromKind,
17501
- fromId: entry2.fromId,
17502
- toKind: entry2.toKind,
17503
- toId: entry2.toId,
17504
- effectiveValidTo: entry2.validTo ?? entry2.row.valid_to
17505
- }
17506
- }
17693
+ { clearDeleted: true }
17507
17694
  );
17508
17695
  results[entry2.index] = { edge, action: "resurrected" };
17696
+ writes += 1;
17509
17697
  } else if (ifExists === "update") {
17510
- const edge = await executeEdgeUpsertUpdate(
17698
+ const outcome = await executeEdgeUpsertUpdateWithOutcome(
17511
17699
  ctx,
17512
17700
  {
17513
17701
  id: entry2.row.id,
@@ -17523,14 +17711,26 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17523
17711
  validFrom: entry2.validFrom
17524
17712
  },
17525
17713
  ...entry2.validTo !== void 0 && { validTo: entry2.validTo },
17714
+ ...entry2.clearValidTo === true && {
17715
+ clearValidTo: true
17716
+ },
17526
17717
  ...entry2.onImmutableLowerBound !== void 0 && {
17527
17718
  onImmutableLowerBound: entry2.onImmutableLowerBound
17528
17719
  }
17529
17720
  },
17530
- target
17721
+ target,
17722
+ {
17723
+ coalesceUnchanged: ctx.coalesceUnchangedUpsertsEnabled,
17724
+ coalesceCandidate: entry2.row
17725
+ }
17531
17726
  );
17532
- 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;
17533
17732
  } else {
17733
+ assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
17534
17734
  results[entry2.index] = {
17535
17735
  edge: rowToEdge(entry2.row),
17536
17736
  action: "found"
@@ -17539,21 +17739,35 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17539
17739
  }
17540
17740
  for (const { index, sourceIndex } of duplicateOf) {
17541
17741
  const sourceResult = requireDefined(results[sourceIndex]);
17742
+ if (sourceResult.action === "found") {
17743
+ assertEndpointClearCanApply(
17744
+ ifExists,
17745
+ items[index]?.clearValidTo,
17746
+ kind
17747
+ );
17748
+ }
17542
17749
  results[index] = { edge: sourceResult.edge, action: "found" };
17543
17750
  }
17544
- return results;
17751
+ return { results, writes };
17545
17752
  },
17546
17753
  // A bulk getOrCreate always converges on a match key no database key
17547
17754
  // backs, whatever its cardinality — the same reason the single-item path
17548
17755
  // fences unconditionally.
17549
- { fencesConstraintProbe: "edgeMatchKeyConvergence" }
17756
+ {
17757
+ fencesConstraintProbe: "edgeMatchKeyConvergence",
17758
+ didWrite: (outcome) => outcome.writes > 0
17759
+ }
17550
17760
  );
17551
17761
  }
17762
+ async function runBatchResults() {
17763
+ const outcome = await runBatch();
17764
+ return outcome.results;
17765
+ }
17552
17766
  try {
17553
- return await runBatch();
17767
+ return await runBatchResults();
17554
17768
  } catch (error) {
17555
17769
  if (!(error instanceof CardinalityError)) throw error;
17556
- return runBatch();
17770
+ return runBatchResults();
17557
17771
  }
17558
17772
  }
17559
17773
 
@@ -18337,7 +18551,7 @@ var StoreImplementation = class _StoreImplementation {
18337
18551
  lockIdentityImportTarget: (target) => this.lockIdentityImportTarget(target),
18338
18552
  foldImportedIdentityNodes: (target, references) => this.foldImportedIdentityNodes(target, references),
18339
18553
  importIdentityAssertionsAtTarget: (target, assertions, mode) => this.importIdentityAssertionsAtTarget(target, assertions, mode),
18340
- applyIdentityMergeAtTarget: (target, retractionIds, assertions) => this.applyIdentityMergeAtTarget(target, retractionIds, assertions),
18554
+ applyIdentityMergeAtTarget: (target, retractions, assertions) => this.applyIdentityMergeAtTarget(target, retractions, assertions),
18341
18555
  assertIdentityClassesConsistentAtTarget: (target, seeds) => this.assertIdentityClassesConsistentAtTarget(target, seeds)
18342
18556
  };
18343
18557
  Object.defineProperty(this, STORE_RUNTIME, {
@@ -18556,8 +18770,8 @@ var StoreImplementation = class _StoreImplementation {
18556
18770
  );
18557
18771
  }
18558
18772
  /** @internal Mechanical graph-merge apply through the mutation coordinator. */
18559
- applyIdentityMergeAtTarget(target, retractionIds, assertions) {
18560
- if (retractionIds.length === 0 && assertions.length === 0) {
18773
+ applyIdentityMergeAtTarget(target, retractions, assertions) {
18774
+ if (retractions.length === 0 && assertions.length === 0) {
18561
18775
  return Promise.resolve({ created: 0, retracted: 0 });
18562
18776
  }
18563
18777
  if (this.#graph.identity === void 0) {
@@ -18568,7 +18782,7 @@ var StoreImplementation = class _StoreImplementation {
18568
18782
  }
18569
18783
  return applyIdentityChangesForContext(
18570
18784
  this.#identityContext(target),
18571
- retractionIds,
18785
+ retractions,
18572
18786
  assertions
18573
18787
  );
18574
18788
  }
@@ -18940,7 +19154,7 @@ var StoreImplementation = class _StoreImplementation {
18940
19154
  options
18941
19155
  ),
18942
19156
  // Present only when opted in; its absence is the coalesce off switch.
18943
- ...this.#options?.coalesceUnchangedUpserts === true && {
19157
+ ...ctx.coalesceUnchangedUpsertsEnabled && {
18944
19158
  upsertDirtyCheck: (kind, id, existingProps, inputProps) => nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
18945
19159
  },
18946
19160
  executeDelete: (kind, id, backend) => executeNodeDelete(ctx, kind, id, backend),
@@ -18999,7 +19213,7 @@ var StoreImplementation = class _StoreImplementation {
18999
19213
  executeUpdate: (input, backend) => executeEdgeUpdate(ctx, input, backend),
19000
19214
  executeUpsertUpdate: (input, backend, options) => executeEdgeUpsertUpdate(ctx, input, backend, options),
19001
19215
  // Present only when opted in; its absence is the coalesce off switch.
19002
- ...this.#options?.coalesceUnchangedUpserts === true && {
19216
+ ...ctx.coalesceUnchangedUpsertsEnabled && {
19003
19217
  upsertDirtyCheck: (kind, id, existingProps, inputProps) => edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
19004
19218
  },
19005
19219
  executeDelete: (kind, id, backend) => executeEdgeDelete(ctx, kind, id, backend),
@@ -21056,6 +21270,7 @@ var StoreImplementation = class _StoreImplementation {
21056
21270
  schemaVersion: this.#schemaMetadata.schemaVersion,
21057
21271
  historyEnabled: this.#captureEnabled,
21058
21272
  revisionTrackingEnabled: this.#revisionTrackingEnabled,
21273
+ coalesceUnchangedUpsertsEnabled: this.#coalescesUnchangedUpserts(),
21059
21274
  revisionSchema: this.#sqlSchema(),
21060
21275
  registry: this.#registry,
21061
21276
  ...identityConfig === void 0 ? {} : {
@@ -21080,6 +21295,15 @@ var StoreImplementation = class _StoreImplementation {
21080
21295
  target,
21081
21296
  ref,
21082
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
21083
21307
  )
21084
21308
  }
21085
21309
  },
@@ -21101,12 +21325,17 @@ var StoreImplementation = class _StoreImplementation {
21101
21325
  schemaVersion: this.#schemaMetadata.schemaVersion,
21102
21326
  historyEnabled: this.#captureEnabled,
21103
21327
  revisionTrackingEnabled: this.#revisionTrackingEnabled,
21328
+ coalesceUnchangedUpsertsEnabled: this.#coalescesUnchangedUpserts(),
21104
21329
  revisionSchema: this.#sqlSchema(),
21105
21330
  registry: this.#registry,
21106
21331
  createOperationContext: (operation, entity, kind, id) => this.#createOperationContext(operation, entity, kind, id),
21107
21332
  withOperationHooks: runHooks
21108
21333
  };
21109
21334
  }
21335
+ /** The single owner of the store-wide unchanged-upsert enablement decision. */
21336
+ #coalescesUnchangedUpserts() {
21337
+ return this.#options?.coalesceUnchangedUpserts === true;
21338
+ }
21110
21339
  // === Internal: Hook Helpers ===
21111
21340
  /**
21112
21341
  * Decorates the query execution port so hooks observe each statement the
@@ -21718,5 +21947,5 @@ async function createVerifiedAdapterStore(graph, backend, options) {
21718
21947
  }
21719
21948
 
21720
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 };
21721
- //# sourceMappingURL=chunk-YQ4JONWE.js.map
21722
- //# sourceMappingURL=chunk-YQ4JONWE.js.map
21950
+ //# sourceMappingURL=chunk-DJZTXBWY.js.map
21951
+ //# sourceMappingURL=chunk-DJZTXBWY.js.map