@nicia-ai/typegraph 0.46.2 → 0.48.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 (310) 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 +58 -49
  7. package/dist/backend/index.d.cts +37 -55
  8. package/dist/backend/index.d.ts +37 -55
  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 +21 -7
  12. package/dist/backend/postgres/index.d.ts +21 -7
  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 +20 -7
  26. package/dist/backend/sqlite/index.d.ts +20 -7
  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-E4OSGBCM.cjs → chunk-2HIYYMWY.cjs} +139 -136
  47. package/dist/chunk-2HIYYMWY.cjs.map +1 -0
  48. package/dist/chunk-2QGYQBS2.cjs +161 -0
  49. package/dist/chunk-2QGYQBS2.cjs.map +1 -0
  50. package/dist/{chunk-GWXXHOLU.js → chunk-2SYZXD54.js} +21 -18
  51. package/dist/chunk-2SYZXD54.js.map +1 -0
  52. package/dist/{chunk-KA4L2NZ3.js → chunk-2TYSSBU5.js} +14 -14
  53. package/dist/{chunk-KA4L2NZ3.js.map → chunk-2TYSSBU5.js.map} +1 -1
  54. package/dist/{chunk-QOJ2L2AD.js → chunk-3DMMGT6S.js} +3 -3
  55. package/dist/{chunk-QOJ2L2AD.js.map → chunk-3DMMGT6S.js.map} +1 -1
  56. package/dist/{chunk-F36KZDFX.cjs → chunk-3FPR224C.cjs} +91 -91
  57. package/dist/{chunk-F36KZDFX.cjs.map → chunk-3FPR224C.cjs.map} +1 -1
  58. package/dist/{chunk-32UETY6S.cjs → chunk-3KOY4FH3.cjs} +207 -28
  59. package/dist/chunk-3KOY4FH3.cjs.map +1 -0
  60. package/dist/{chunk-QU7QLJA4.cjs → chunk-3U5ABFDW.cjs} +26 -26
  61. package/dist/{chunk-QU7QLJA4.cjs.map → chunk-3U5ABFDW.cjs.map} +1 -1
  62. package/dist/{chunk-RFDEYLIK.js → chunk-4WMMBDS5.js} +7 -7
  63. package/dist/chunk-4WMMBDS5.js.map +1 -0
  64. package/dist/{chunk-R7EWHKID.js → chunk-5K2BKEBD.js} +19 -145
  65. package/dist/chunk-5K2BKEBD.js.map +1 -0
  66. package/dist/chunk-5PRKMB24.cjs +124 -0
  67. package/dist/chunk-5PRKMB24.cjs.map +1 -0
  68. package/dist/chunk-6LN7FIVU.js +107 -0
  69. package/dist/chunk-6LN7FIVU.js.map +1 -0
  70. package/dist/{chunk-D6GCNNMK.cjs → chunk-6NGW27EO.cjs} +10 -10
  71. package/dist/{chunk-D6GCNNMK.cjs.map → chunk-6NGW27EO.cjs.map} +1 -1
  72. package/dist/{chunk-WHS2Y43J.js → chunk-6SWPJEYN.js} +5 -5
  73. package/dist/{chunk-WHS2Y43J.js.map → chunk-6SWPJEYN.js.map} +1 -1
  74. package/dist/{chunk-7TKNK32B.js → chunk-7SQSZN2J.js} +5 -5
  75. package/dist/{chunk-7TKNK32B.js.map → chunk-7SQSZN2J.js.map} +1 -1
  76. package/dist/{chunk-UTVQPZPN.cjs → chunk-7XUYFFR4.cjs} +20 -20
  77. package/dist/chunk-7XUYFFR4.cjs.map +1 -0
  78. package/dist/{chunk-KXSMF6PL.js → chunk-ACGSAMD3.js} +39 -34
  79. package/dist/chunk-ACGSAMD3.js.map +1 -0
  80. package/dist/{chunk-PYKF7UIL.cjs → chunk-AOSSQDVO.cjs} +13 -13
  81. package/dist/{chunk-PYKF7UIL.cjs.map → chunk-AOSSQDVO.cjs.map} +1 -1
  82. package/dist/{chunk-AT3MLMJV.js → chunk-AX6JGVTZ.js} +91 -20
  83. package/dist/chunk-AX6JGVTZ.js.map +1 -0
  84. package/dist/{chunk-WA64ZSCA.cjs → chunk-BFUOME67.cjs} +11 -11
  85. package/dist/{chunk-WA64ZSCA.cjs.map → chunk-BFUOME67.cjs.map} +1 -1
  86. package/dist/{chunk-YQ4JONWE.js → chunk-BRRP76WO.js} +401 -131
  87. package/dist/chunk-BRRP76WO.js.map +1 -0
  88. package/dist/{chunk-FCIZNUW5.js → chunk-CHAOFCHV.js} +3 -3
  89. package/dist/{chunk-FCIZNUW5.js.map → chunk-CHAOFCHV.js.map} +1 -1
  90. package/dist/chunk-CICO5GXD.cjs +12 -0
  91. package/dist/{chunk-73MWKDFK.cjs.map → chunk-CICO5GXD.cjs.map} +1 -1
  92. package/dist/{chunk-S3G5VLSW.js → chunk-CT3ZKTOF.js} +7 -6
  93. package/dist/chunk-CT3ZKTOF.js.map +1 -0
  94. package/dist/{chunk-SXWLLQ3D.js → chunk-D5R42W5D.js} +4 -4
  95. package/dist/{chunk-SXWLLQ3D.js.map → chunk-D5R42W5D.js.map} +1 -1
  96. package/dist/{chunk-BZZI7B43.cjs → chunk-DO7SAMEK.cjs} +47 -47
  97. package/dist/{chunk-BZZI7B43.cjs.map → chunk-DO7SAMEK.cjs.map} +1 -1
  98. package/dist/chunk-DZAICA5J.js +147 -0
  99. package/dist/chunk-DZAICA5J.js.map +1 -0
  100. package/dist/{chunk-2ZWM2RFH.cjs → chunk-EDN4Y4ZG.cjs} +9 -9
  101. package/dist/{chunk-2ZWM2RFH.cjs.map → chunk-EDN4Y4ZG.cjs.map} +1 -1
  102. package/dist/{chunk-A4R3H7RU.cjs → chunk-EZEEWCFJ.cjs} +264 -361
  103. package/dist/chunk-EZEEWCFJ.cjs.map +1 -0
  104. package/dist/{chunk-BEB4OFZF.cjs → chunk-FA2AFWLP.cjs} +51 -59
  105. package/dist/chunk-FA2AFWLP.cjs.map +1 -0
  106. package/dist/{chunk-ZBVZ7HXD.cjs → chunk-FQPEMEWX.cjs} +12 -12
  107. package/dist/{chunk-ZBVZ7HXD.cjs.map → chunk-FQPEMEWX.cjs.map} +1 -1
  108. package/dist/{chunk-LNIWCQR4.js → chunk-GLHXM7C4.js} +3 -3
  109. package/dist/{chunk-LNIWCQR4.js.map → chunk-GLHXM7C4.js.map} +1 -1
  110. package/dist/{chunk-6BD6ZBKT.cjs → chunk-GYEG3ZLZ.cjs} +10 -10
  111. package/dist/{chunk-6BD6ZBKT.cjs.map → chunk-GYEG3ZLZ.cjs.map} +1 -1
  112. package/dist/{chunk-A7NMUYEL.cjs → chunk-HDL2ARHX.cjs} +27 -27
  113. package/dist/{chunk-A7NMUYEL.cjs.map → chunk-HDL2ARHX.cjs.map} +1 -1
  114. package/dist/{chunk-5ZJOB5YS.js → chunk-HEV35TGT.js} +4 -4
  115. package/dist/{chunk-5ZJOB5YS.js.map → chunk-HEV35TGT.js.map} +1 -1
  116. package/dist/{chunk-LHYSY6SE.js → chunk-I4GAZH5Z.js} +186 -9
  117. package/dist/chunk-I4GAZH5Z.js.map +1 -0
  118. package/dist/{chunk-BQM5P2NO.cjs → chunk-JB6T4GLL.cjs} +260 -223
  119. package/dist/chunk-JB6T4GLL.cjs.map +1 -0
  120. package/dist/{chunk-QPOQX2DI.cjs → chunk-JFRT7S3B.cjs} +1026 -369
  121. package/dist/chunk-JFRT7S3B.cjs.map +1 -0
  122. package/dist/{chunk-JCNTKRAK.js → chunk-JONXFAPO.js} +5 -5
  123. package/dist/{chunk-JCNTKRAK.js.map → chunk-JONXFAPO.js.map} +1 -1
  124. package/dist/{chunk-WEJHA7AD.js → chunk-KF6K7TGH.js} +109 -75
  125. package/dist/chunk-KF6K7TGH.js.map +1 -0
  126. package/dist/{chunk-EDJDDY6H.js → chunk-KKBDXCLQ.js} +4 -4
  127. package/dist/{chunk-EDJDDY6H.js.map → chunk-KKBDXCLQ.js.map} +1 -1
  128. package/dist/{chunk-ZHOAZD7Q.cjs → chunk-L3LQNR34.cjs} +161 -161
  129. package/dist/{chunk-ZHOAZD7Q.cjs.map → chunk-L3LQNR34.cjs.map} +1 -1
  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-MKJ4KXL5.cjs +12 -0
  133. package/dist/{chunk-6LAXM4J2.cjs.map → chunk-MKJ4KXL5.cjs.map} +1 -1
  134. package/dist/{chunk-KCH7WQA5.cjs → chunk-MRDBBHIZ.cjs} +48 -2
  135. package/dist/chunk-MRDBBHIZ.cjs.map +1 -0
  136. package/dist/{chunk-FXNHZFZV.js → chunk-MYKHJI2J.js} +3 -3
  137. package/dist/{chunk-FXNHZFZV.js.map → chunk-MYKHJI2J.js.map} +1 -1
  138. package/dist/{chunk-Z43KWLZF.js → chunk-NACVVDWB.js} +213 -12
  139. package/dist/chunk-NACVVDWB.js.map +1 -0
  140. package/dist/{chunk-72WUT4GG.js → chunk-NVY5CJFP.js} +4 -4
  141. package/dist/{chunk-72WUT4GG.js.map → chunk-NVY5CJFP.js.map} +1 -1
  142. package/dist/{chunk-WYFB7BN3.js → chunk-OD4SSY2U.js} +166 -48
  143. package/dist/chunk-OD4SSY2U.js.map +1 -0
  144. package/dist/{chunk-ZIH42CRX.cjs → chunk-OI2GQ25X.cjs} +7 -7
  145. package/dist/{chunk-ZIH42CRX.cjs.map → chunk-OI2GQ25X.cjs.map} +1 -1
  146. package/dist/{chunk-AU3IJNNP.js → chunk-OMZ37BM2.js} +5 -5
  147. package/dist/{chunk-AU3IJNNP.js.map → chunk-OMZ37BM2.js.map} +1 -1
  148. package/dist/{chunk-C4DYN2SD.cjs → chunk-OORXGFL5.cjs} +48 -48
  149. package/dist/{chunk-C4DYN2SD.cjs.map → chunk-OORXGFL5.cjs.map} +1 -1
  150. package/dist/{chunk-HNYLMPQQ.cjs → chunk-OTUPEF2W.cjs} +149 -78
  151. package/dist/chunk-OTUPEF2W.cjs.map +1 -0
  152. package/dist/{chunk-BRN3RGD2.js → chunk-OVI7IXYX.js} +3 -3
  153. package/dist/{chunk-BRN3RGD2.js.map → chunk-OVI7IXYX.js.map} +1 -1
  154. package/dist/{chunk-WMKEGJG4.js → chunk-P6YLZTRE.js} +3 -3
  155. package/dist/{chunk-WMKEGJG4.js.map → chunk-P6YLZTRE.js.map} +1 -1
  156. package/dist/{chunk-C2ZP5YS6.cjs → chunk-PFBRJBUL.cjs} +278 -160
  157. package/dist/chunk-PFBRJBUL.cjs.map +1 -0
  158. package/dist/{chunk-EJSYWAEV.js → chunk-QTD6HX4O.js} +5 -5
  159. package/dist/{chunk-EJSYWAEV.js.map → chunk-QTD6HX4O.js.map} +1 -1
  160. package/dist/{chunk-JL5UEBWT.cjs → chunk-ROR5ZR6A.cjs} +45 -45
  161. package/dist/{chunk-JL5UEBWT.cjs.map → chunk-ROR5ZR6A.cjs.map} +1 -1
  162. package/dist/{chunk-EDHV4CBU.js → chunk-S5TERQVW.js} +37 -134
  163. package/dist/chunk-S5TERQVW.js.map +1 -0
  164. package/dist/{chunk-FSLTU57P.js → chunk-SDBBMD4N.js} +3 -3
  165. package/dist/{chunk-FSLTU57P.js.map → chunk-SDBBMD4N.js.map} +1 -1
  166. package/dist/{chunk-36LIJXWC.js → chunk-SHFBB23Q.js} +4 -4
  167. package/dist/{chunk-36LIJXWC.js.map → chunk-SHFBB23Q.js.map} +1 -1
  168. package/dist/chunk-SIT26LAZ.cjs +614 -0
  169. package/dist/chunk-SIT26LAZ.cjs.map +1 -0
  170. package/dist/{chunk-C6KE2HSQ.cjs → chunk-SR725PWF.cjs} +1662 -1392
  171. package/dist/chunk-SR725PWF.cjs.map +1 -0
  172. package/dist/{chunk-S7WIRFNS.cjs → chunk-TKZXMWQF.cjs} +13 -12
  173. package/dist/chunk-TKZXMWQF.cjs.map +1 -0
  174. package/dist/{chunk-5PDSCELM.cjs → chunk-TQHGE7UC.cjs} +29 -164
  175. package/dist/chunk-TQHGE7UC.cjs.map +1 -0
  176. package/dist/{chunk-XBHRKLZU.cjs → chunk-TUNPBZY3.cjs} +4 -4
  177. package/dist/{chunk-XBHRKLZU.cjs.map → chunk-TUNPBZY3.cjs.map} +1 -1
  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-UGHG7PGX.js +592 -0
  181. package/dist/chunk-UGHG7PGX.js.map +1 -0
  182. package/dist/{chunk-N3QTGPC7.cjs → chunk-UMGZDVOA.cjs} +303 -101
  183. package/dist/chunk-UMGZDVOA.cjs.map +1 -0
  184. package/dist/{chunk-RHDOAQCT.cjs → chunk-WCCATHMB.cjs} +140 -135
  185. package/dist/chunk-WCCATHMB.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-IHRDX7K6.js → chunk-YIURNGXI.js} +46 -56
  191. package/dist/chunk-YIURNGXI.js.map +1 -0
  192. package/dist/{chunk-GWUWRZXW.js → chunk-YVF2EM7B.js} +3 -3
  193. package/dist/{chunk-GWUWRZXW.js.map → chunk-YVF2EM7B.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-A2LJG5GM.js → chunk-ZFMCDJGB.js} +803 -148
  197. package/dist/chunk-ZFMCDJGB.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-BL1NZLMY.d.cts +78 -0
  205. package/dist/ddl-D_oW-EVO.d.ts +78 -0
  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 +3418 -706
  211. package/dist/graph-merge/index.cjs.map +1 -1
  212. package/dist/graph-merge/index.d.cts +550 -58
  213. package/dist/graph-merge/index.d.ts +550 -58
  214. package/dist/graph-merge/index.js +3191 -497
  215. package/dist/graph-merge/index.js.map +1 -1
  216. package/dist/{index-Deyu8IXL.d.ts → index-COs_z6nV.d.cts} +47 -3
  217. package/dist/{index-DrRS51Ld.d.cts → index-D7d1u2gr.d.ts} +47 -3
  218. package/dist/index.cjs +233 -216
  219. package/dist/index.cjs.map +1 -1
  220. package/dist/index.d.cts +12 -12
  221. package/dist/index.d.ts +12 -12
  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-ptr3JLRP.d.cts → manager-CYaff3n3.d.cts} +2 -2
  235. package/dist/{manager-DX983gJ0.d.ts → manager-D9eRT_ns.d.ts} +2 -2
  236. package/dist/{materialize-indexes-CpXoggWU.d.ts → materialize-indexes-DJ3ykH59.d.ts} +1 -1
  237. package/dist/{materialize-indexes-BXz77YqO.d.cts → materialize-indexes-DTtAnvfY.d.cts} +1 -1
  238. package/dist/{postgres-DwgEXSPI.d.cts → postgres-CcL4bAHS.d.ts} +1 -1
  239. package/dist/{postgres-QdOMHTBz.d.ts → postgres-DMj39MEu.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 +46 -46
  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 +13 -13
  247. package/dist/provenance/index.js.map +1 -1
  248. package/dist/repair-validity-windows-BFNZvd_H.d.cts +166 -0
  249. package/dist/repair-validity-windows-DlUSqwCg.d.ts +166 -0
  250. package/dist/schema/index.cjs +45 -44
  251. package/dist/schema/index.d.cts +6 -6
  252. package/dist/schema/index.d.ts +6 -6
  253. package/dist/schema/index.js +18 -17
  254. package/dist/{searchable-BOUuA83f.d.ts → searchable-DHJMh_nj.d.cts} +1 -1
  255. package/dist/{searchable-BrUh0pdc.d.cts → searchable-bpE1bBfc.d.ts} +1 -1
  256. package/dist/{sqlite-BfYcV61E.d.cts → sqlite-D7Oz0SQh.d.ts} +1 -1
  257. package/dist/{sqlite-DK40XVR1.d.ts → sqlite-YppHrNFb.d.cts} +1 -1
  258. package/dist/{store-FTqBpuJD.d.cts → store-JUVvtmR4.d.cts} +228 -92
  259. package/dist/{store-Bo1psfVZ.d.ts → store-UzrGvZOo.d.ts} +228 -92
  260. package/dist/{temporal-DPtn0HOu.d.ts → temporal-5GqpYCk2.d.cts} +1 -1
  261. package/dist/{temporal-CXewwLTB.d.cts → temporal-CbnLzTmM.d.ts} +1 -1
  262. package/dist/{types-Du78EvpN.d.ts → types-BqFZTQmV.d.cts} +60 -9
  263. package/dist/{types-Du78EvpN.d.cts → types-BqFZTQmV.d.ts} +60 -9
  264. package/dist/{types-CeT7xM4M.d.ts → types-Bx74kaTt.d.ts} +1 -1
  265. package/dist/{types-XR1nHERK.d.cts → types-CXAhpW-c.d.cts} +1 -1
  266. package/dist/{where-CJsp-YUf.d.cts → where-DI_Fqz-X.d.cts} +1 -1
  267. package/dist/{where-CMbFiWwp.d.ts → where-O-k2wgYm.d.ts} +1 -1
  268. package/package.json +1 -1
  269. package/dist/chunk-32UETY6S.cjs.map +0 -1
  270. package/dist/chunk-5PDSCELM.cjs.map +0 -1
  271. package/dist/chunk-62ZXBMSD.js.map +0 -1
  272. package/dist/chunk-6LAXM4J2.cjs +0 -12
  273. package/dist/chunk-73MWKDFK.cjs +0 -12
  274. package/dist/chunk-A2LJG5GM.js.map +0 -1
  275. package/dist/chunk-A4R3H7RU.cjs.map +0 -1
  276. package/dist/chunk-ANKOXPCC.cjs +0 -267
  277. package/dist/chunk-ANKOXPCC.cjs.map +0 -1
  278. package/dist/chunk-AT3MLMJV.js.map +0 -1
  279. package/dist/chunk-BEB4OFZF.cjs.map +0 -1
  280. package/dist/chunk-BQM5P2NO.cjs.map +0 -1
  281. package/dist/chunk-C2ZP5YS6.cjs.map +0 -1
  282. package/dist/chunk-C6KE2HSQ.cjs.map +0 -1
  283. package/dist/chunk-DSAWGCMP.js +0 -254
  284. package/dist/chunk-DSAWGCMP.js.map +0 -1
  285. package/dist/chunk-E4OSGBCM.cjs.map +0 -1
  286. package/dist/chunk-EDHV4CBU.js.map +0 -1
  287. package/dist/chunk-FA6Z7B5L.js +0 -244
  288. package/dist/chunk-FA6Z7B5L.js.map +0 -1
  289. package/dist/chunk-GVAMRRZR.cjs +0 -268
  290. package/dist/chunk-GVAMRRZR.cjs.map +0 -1
  291. package/dist/chunk-GWXXHOLU.js.map +0 -1
  292. package/dist/chunk-HNYLMPQQ.cjs.map +0 -1
  293. package/dist/chunk-IHRDX7K6.js.map +0 -1
  294. package/dist/chunk-KCH7WQA5.cjs.map +0 -1
  295. package/dist/chunk-KXSMF6PL.js.map +0 -1
  296. package/dist/chunk-LHYSY6SE.js.map +0 -1
  297. package/dist/chunk-N3QTGPC7.cjs.map +0 -1
  298. package/dist/chunk-QPOQX2DI.cjs.map +0 -1
  299. package/dist/chunk-R7EWHKID.js.map +0 -1
  300. package/dist/chunk-RFDEYLIK.js.map +0 -1
  301. package/dist/chunk-RHDOAQCT.cjs.map +0 -1
  302. package/dist/chunk-S3G5VLSW.js.map +0 -1
  303. package/dist/chunk-S7WIRFNS.cjs.map +0 -1
  304. package/dist/chunk-UTVQPZPN.cjs.map +0 -1
  305. package/dist/chunk-WEJHA7AD.js.map +0 -1
  306. package/dist/chunk-WYFB7BN3.js.map +0 -1
  307. package/dist/chunk-YQ4JONWE.js.map +0 -1
  308. package/dist/chunk-Z43KWLZF.js.map +0 -1
  309. package/dist/ddl-mE07h_EM.d.cts +0 -38
  310. package/dist/ddl-opIn8DfX.d.ts +0 -38
@@ -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-YIURNGXI.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-KF6K7TGH.js';
3
+ import { storeRuntime, STORE_RUNTIME, applyResolvedNodeUniqueness, createUniquenessContext, TRANSACTION_RUNTIME, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, getEmbeddingFields, computeFulltextContent } from './chunk-I4GAZH5Z.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-2TYSSBU5.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 } from './chunk-ZFMCDJGB.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, generateId, assertCurrentRecordedSchema, baseField, objectField, arrayField, dateField, numberField, advanceRevisionClock, runInsertBatch, edgeInsertDispatch, runInsertBatchReturning, sqlValueList, getNodeRowsByIds, getEdgeRowsByIds, compileKindFilter, encodeTupleKey, 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-S5TERQVW.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, projectGraphBackend, deriveBackend, projectBackend, chunk, postgresReadWriteRefusedSqlState, isMissingTableError, groupBy, postgresTemporaryTableUnavailableSqlState, isPostgresConcurrentDdlRaceError } from './chunk-UGHG7PGX.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, rowPropsToObject, INTERNAL_TEMPORARY_WRITES } from './chunk-6LN7FIVU.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-DZAICA5J.js';
15
+ import { nowIso, validityWindowContainsInstant, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow, preservesImmutableLowerBound, assertWritableValidityWindow, isCanonicalIsoDate, statedBoundMatchesStored } from './chunk-5K2BKEBD.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`
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
@@ -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();
@@ -15145,9 +15224,7 @@ var HISTORY_STORE_BACKEND_KEYS = [
15145
15224
  "verifyContributions"
15146
15225
  ];
15147
15226
  function createHistoryStoreBackendProjection(backend) {
15148
- return Object.freeze(
15149
- projectBackendMembers(backend, HISTORY_STORE_BACKEND_KEYS)
15150
- );
15227
+ return Object.freeze(projectBackend(backend, HISTORY_STORE_BACKEND_KEYS));
15151
15228
  }
15152
15229
 
15153
15230
  // src/store/introspect.ts
@@ -15249,6 +15326,7 @@ async function runBucketedMaterialization(items, options, bucketKey, runOne) {
15249
15326
  var CLAIM_LEASE_MS = 15 * 6e4;
15250
15327
  var CLAIM_RETRY_DELAY_MS = 200;
15251
15328
  var CLAIM_WAIT_TIMEOUT_MS = CLAIM_LEASE_MS + 6e4;
15329
+ var TRIGRAM_EXTENSION_DDL = "CREATE EXTENSION IF NOT EXISTS pg_trgm;";
15252
15330
  var INDEX_DIALECT_BEHAVIOR = {
15253
15331
  postgres: {
15254
15332
  concurrentBuilds: true,
@@ -15269,6 +15347,19 @@ function delay(ms) {
15269
15347
  setTimeout(resolve, ms);
15270
15348
  });
15271
15349
  }
15350
+ async function ensureTrigramExtension(backend) {
15351
+ if (backend.ensureTrigramExtension !== void 0) {
15352
+ await backend.ensureTrigramExtension();
15353
+ return;
15354
+ }
15355
+ const executeDdl = requireDefined(backend.executeDdl);
15356
+ try {
15357
+ await executeDdl(TRIGRAM_EXTENSION_DDL);
15358
+ } catch (error) {
15359
+ if (!isPostgresConcurrentDdlRaceError(error)) throw error;
15360
+ await executeDdl(TRIGRAM_EXTENSION_DDL);
15361
+ }
15362
+ }
15272
15363
  async function materializeIndexes(context, options = {}) {
15273
15364
  const { graph, graphId, backend, schemaVersion } = context;
15274
15365
  assertBackendSupportsIndexMaterialization(
@@ -15408,9 +15499,7 @@ async function materializeRelationalIndex(declaration, backend, dialect, ddlOpti
15408
15499
  driftLabel: "Index",
15409
15500
  run: async () => {
15410
15501
  if (declaration.method === "trigram") {
15411
- await requireDefined(backend.executeDdl)(
15412
- "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
15413
- );
15502
+ await ensureTrigramExtension(backend);
15414
15503
  }
15415
15504
  await requireDefined(backend.executeDdl)(ddl);
15416
15505
  },
@@ -16484,7 +16573,7 @@ function createEdgeBatchValidationBackend(backend) {
16484
16573
  pendingUniquePairs.add(uniqueCacheKey);
16485
16574
  }
16486
16575
  }
16487
- const validationBackend = createBackendOverlay(backend, {
16576
+ const validationBackend = deriveBackend(backend, {
16488
16577
  getNode: getNodeCached,
16489
16578
  countEdgesFrom: countEdgesFromCached,
16490
16579
  edgeExistsBetween: edgeExistsBetweenCached
@@ -16782,6 +16871,11 @@ function edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
16782
16871
  }
16783
16872
  async function performEdgeUpdate(ctx, input, target, options) {
16784
16873
  const id = input.id;
16874
+ assertValidityEndMutation(input, {
16875
+ entityType: "edge",
16876
+ kind: input.identity.kind,
16877
+ id
16878
+ });
16785
16879
  const existing = await target.getEdge(ctx.graphId, id);
16786
16880
  if (!existing || !options?.clearDeleted && existing.deleted_at) {
16787
16881
  throw new EdgeNotFoundError(input.identity.kind, id);
@@ -16800,6 +16894,29 @@ async function performEdgeUpdate(ctx, input, target, options) {
16800
16894
  const preservesLiveLowerBound = options?.clearDeleted !== true && preservesImmutableLowerBound(input.onImmutableLowerBound);
16801
16895
  const appliedValidFrom = preservesLiveLowerBound ? void 0 : statedValidFrom;
16802
16896
  const validTo = validateOptionalCanonicalIsoDate(input.validTo, "validTo");
16897
+ const effectiveValidTo = options?.clearDeleted === true && appliedValidFrom !== void 0 ? validTo : validityEndAfterMutation(
16898
+ input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo },
16899
+ existing.valid_to
16900
+ );
16901
+ const cardinality = edgeCardinality(ctx, input.identity.kind);
16902
+ const reentersLivePopulation = options?.clearDeleted === true && existing.deleted_at !== void 0;
16903
+ const reentersActivePopulation = cardinality === "oneActive" && effectiveValidTo === void 0 && (existing.deleted_at !== void 0 || existing.valid_to !== void 0);
16904
+ if (reentersLivePopulation || reentersActivePopulation) {
16905
+ await checkCardinalityConstraint(
16906
+ {
16907
+ graphId: ctx.graphId,
16908
+ registry: ctx.registry,
16909
+ backend: target
16910
+ },
16911
+ input.identity.kind,
16912
+ cardinality,
16913
+ existing.from_kind,
16914
+ existing.from_id,
16915
+ existing.to_kind,
16916
+ existing.to_id,
16917
+ effectiveValidTo
16918
+ );
16919
+ }
16803
16920
  const windowVerdict = assertWritableValidityWindow(
16804
16921
  `edge "${id}"`,
16805
16922
  appliedValidFrom,
@@ -16839,22 +16956,27 @@ async function performEdgeUpdate(ctx, input, target, options) {
16839
16956
  if (appliedValidFrom !== void 0) {
16840
16957
  updateParams.validFrom = appliedValidFrom;
16841
16958
  }
16842
- if (validTo !== void 0) updateParams.validTo = validTo;
16959
+ if (reentersActivePopulation && existing.valid_to !== void 0) {
16960
+ updateParams.expectedValidTo = existing.valid_to;
16961
+ }
16843
16962
  if (options?.clearDeleted) updateParams.clearDeleted = true;
16844
16963
  const row = await withUnmatchedEdgeUpdateRefusal(
16845
16964
  ctx,
16846
16965
  target,
16847
16966
  id,
16848
16967
  input.identity,
16849
- updateParams.expectedValidFrom !== void 0,
16850
- () => target.updateEdge(updateParams)
16968
+ updateParams.expectedValidFrom !== void 0 || updateParams.expectedValidTo !== void 0,
16969
+ () => target.updateEdge({
16970
+ ...updateParams,
16971
+ ...input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo }
16972
+ })
16851
16973
  );
16852
16974
  return rowToEdge(row);
16853
16975
  }
16854
16976
  function isEdgeUpdateNoRowError(error) {
16855
16977
  return error instanceof DatabaseOperationError && error.details.operation === "update" && error.details.entity === "edge" && error.details.reason === "no_row_returned";
16856
16978
  }
16857
- async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, assertedValidFrom, write) {
16979
+ async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, assertedWindowState, write) {
16858
16980
  try {
16859
16981
  return await write();
16860
16982
  } catch (error) {
@@ -16867,7 +16989,7 @@ async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, asserte
16867
16989
  edgeIdentityFromRow(current),
16868
16990
  "update"
16869
16991
  );
16870
- if (assertedValidFrom && current.deleted_at === void 0) {
16992
+ if (assertedWindowState && current.deleted_at === void 0) {
16871
16993
  throw new EdgeUpdateTargetMoved(expected.kind, id);
16872
16994
  }
16873
16995
  }
@@ -16917,40 +17039,73 @@ async function executeEdgeUpdate(ctx, input, backend) {
16917
17039
  ctx,
16918
17040
  opContext,
16919
17041
  backend,
16920
- (target) => performEdgeUpdateConverging(ctx, input, target)
17042
+ (target) => {
17043
+ if (input.clearValidTo === true) {
17044
+ assertClearValidToSupported(backend, "edge");
17045
+ }
17046
+ return performEdgeUpdateConverging(ctx, input, target);
17047
+ },
17048
+ {
17049
+ fencesConstraintProbe: input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? edgeWriteNeedsConstraintFence("oneActive") : void 0
17050
+ }
16921
17051
  );
16922
17052
  }
16923
- async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
16924
- const resurrectCardinality = options?.resurrectCardinality;
17053
+ async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options) {
17054
+ if (input.clearValidTo === true) {
17055
+ assertClearValidToSupported(backend, "edge");
17056
+ }
16925
17057
  return runInWriteTransaction(
16926
17058
  ctx,
16927
17059
  backend,
16928
17060
  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
- );
17061
+ if (options?.coalesceUnchanged === true && !options.clearDeleted) {
17062
+ const existing = options.coalesceCandidate ?? await target.getEdge(ctx.graphId, input.id);
17063
+ if (existing !== void 0 && existing.deleted_at === void 0) {
17064
+ assertEdgeIdentityMatches(
17065
+ input.id,
17066
+ input.identity,
17067
+ edgeIdentityFromRow(existing),
17068
+ "update"
17069
+ );
17070
+ const runDirtyCheck = () => edgeUpsertDirtyCheck(
17071
+ ctx,
17072
+ existing.kind,
17073
+ existing.id,
17074
+ rowPropsToObject(existing.props),
17075
+ input.props
17076
+ );
17077
+ if (shouldCoalesceUpsert(existing, input, runDirtyCheck)) {
17078
+ return { edge: rowToEdge(existing), wrote: false };
17079
+ }
17080
+ }
16944
17081
  }
16945
- return performEdgeUpdateConverging(ctx, input, target, options);
17082
+ const edge = await performEdgeUpdateConverging(
17083
+ ctx,
17084
+ input,
17085
+ target,
17086
+ options
17087
+ );
17088
+ return { edge, wrote: true };
16946
17089
  },
16947
17090
  {
16948
17091
  // An in-place props update re-derives no constraint verdict: endpoints
16949
17092
  // are immutable, so cardinality cannot change under it.
16950
- fencesConstraintProbe: resurrectCardinality === void 0 ? void 0 : edgeWriteNeedsConstraintFence(resurrectCardinality.cardinality)
17093
+ fencesConstraintProbe: options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? edgeWriteNeedsConstraintFence(
17094
+ edgeCardinality(ctx, input.identity.kind)
17095
+ ) : void 0,
17096
+ didWrite: (outcome) => outcome.wrote
16951
17097
  }
16952
17098
  );
16953
17099
  }
17100
+ async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
17101
+ const outcome = await executeEdgeUpsertUpdateWithOutcome(
17102
+ ctx,
17103
+ input,
17104
+ backend,
17105
+ options
17106
+ );
17107
+ return outcome.edge;
17108
+ }
16954
17109
  async function executeEdgeDelete(ctx, expectedKind, id, backend) {
16955
17110
  const gate = await backend.getEdge(ctx.graphId, id);
16956
17111
  if (!gate) return;
@@ -17125,11 +17280,26 @@ async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, t
17125
17280
  function defersEndpointWindowOrdering(ifExists, onImmutableLowerBound) {
17126
17281
  return ifExists === "update" && preservesImmutableLowerBound(onImmutableLowerBound);
17127
17282
  }
17283
+ function assertEndpointClearCanApply(ifExists, clearValidTo, kind) {
17284
+ if (ifExists !== "return" || clearValidTo !== true) return;
17285
+ throw new ConfigurationError(
17286
+ `clearValidTo requires ifExists: "update" for getOrCreateByEndpoints on edge kind "${kind}"; ifExists: "return" never mutates a matching edge.`,
17287
+ {
17288
+ code: "CLEAR_VALID_TO_REQUIRES_UPDATE",
17289
+ kind,
17290
+ ifExists
17291
+ }
17292
+ );
17293
+ }
17128
17294
  async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, toKind, toId, props, backend, options) {
17129
17295
  const ifExists = options?.ifExists ?? "return";
17130
17296
  const matchOn = options?.matchOn ?? [];
17131
17297
  const registration = getEdgeRegistration(ctx.graph, kind);
17132
17298
  const edgeKind = registration.type;
17299
+ assertValidityEndMutation(options ?? {}, { entityType: "edge", kind });
17300
+ if (options?.clearValidTo === true) {
17301
+ assertClearValidToSupported(backend, "edge");
17302
+ }
17133
17303
  const validatedProps = validateEdgeProps(edgeKind.schema, props, {
17134
17304
  kind,
17135
17305
  operation: "create"
@@ -17164,6 +17334,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17164
17334
  validatedProps
17165
17335
  );
17166
17336
  if (probedLiveRow !== void 0) {
17337
+ assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
17167
17338
  return { edge: rowToEdge(probedLiveRow), action: "found" };
17168
17339
  }
17169
17340
  }
@@ -17208,9 +17379,10 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17208
17379
  }
17209
17380
  if (liveRow !== void 0) {
17210
17381
  if (ifExists === "return") {
17382
+ assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
17211
17383
  return { edge: rowToEdge(liveRow), action: "found" };
17212
17384
  }
17213
- const edge2 = await executeEdgeUpsertUpdate(
17385
+ const outcome = await executeEdgeUpsertUpdateWithOutcome(
17214
17386
  ctx,
17215
17387
  {
17216
17388
  id: liveRow.id,
@@ -17218,20 +17390,37 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17218
17390
  props: validatedProps,
17219
17391
  ...validFrom !== void 0 && { validFrom },
17220
17392
  ...validTo !== void 0 && { validTo },
17393
+ ...options?.clearValidTo === true && {
17394
+ clearValidTo: true
17395
+ },
17221
17396
  ...options?.onImmutableLowerBound !== void 0 && {
17222
17397
  onImmutableLowerBound: options.onImmutableLowerBound
17223
17398
  }
17224
17399
  },
17225
- backend
17400
+ backend,
17401
+ {
17402
+ coalesceUnchanged: ctx.coalesceUnchangedUpsertsEnabled && shouldCoalesceUpsert(
17403
+ liveRow,
17404
+ options,
17405
+ () => edgeUpsertDirtyCheck(
17406
+ ctx,
17407
+ liveRow.kind,
17408
+ liveRow.id,
17409
+ rowPropsToObject(liveRow.props),
17410
+ validatedProps
17411
+ )
17412
+ )
17413
+ }
17226
17414
  );
17227
- return { edge: edge2, action: "updated" };
17415
+ return {
17416
+ edge: outcome.edge,
17417
+ action: outcome.wrote ? "updated" : "found"
17418
+ };
17228
17419
  }
17229
- const cardinality = registration.cardinality ?? "many";
17230
17420
  if (deletedRow === void 0) {
17231
17421
  throw new Error("Expected deletedRow to be defined");
17232
17422
  }
17233
17423
  const matchedDeletedRow = deletedRow;
17234
- const effectiveValidTo = validTo ?? matchedDeletedRow.valid_to;
17235
17424
  const edge = await executeEdgeUpsertUpdate(
17236
17425
  ctx,
17237
17426
  {
@@ -17240,22 +17429,15 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
17240
17429
  props: validatedProps,
17241
17430
  ...validFrom !== void 0 && { validFrom },
17242
17431
  ...validTo !== void 0 && { validTo },
17432
+ ...options?.clearValidTo === true && {
17433
+ clearValidTo: true
17434
+ },
17243
17435
  ...options?.onImmutableLowerBound !== void 0 && {
17244
17436
  onImmutableLowerBound: options.onImmutableLowerBound
17245
17437
  }
17246
17438
  },
17247
17439
  backend,
17248
- {
17249
- clearDeleted: true,
17250
- resurrectCardinality: {
17251
- cardinality,
17252
- fromKind,
17253
- fromId,
17254
- toKind,
17255
- toId,
17256
- effectiveValidTo
17257
- }
17258
- }
17440
+ { clearDeleted: true }
17259
17441
  );
17260
17442
  return { edge, action: "resurrected" };
17261
17443
  }
@@ -17286,10 +17468,13 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17286
17468
  const matchOn = options?.matchOn ?? [];
17287
17469
  const registration = getEdgeRegistration(ctx.graph, kind);
17288
17470
  const edgeKind = registration.type;
17289
- const cardinality = registration.cardinality ?? "many";
17290
17471
  validateMatchOnFields(edgeKind.schema, matchOn, kind);
17291
17472
  const validated = [];
17292
17473
  for (const item of items) {
17474
+ assertValidityEndMutation(item, { entityType: "edge", kind });
17475
+ if (item.clearValidTo === true) {
17476
+ assertClearValidToSupported(backend, "edge");
17477
+ }
17293
17478
  const validatedProps = validateEdgeProps(edgeKind.schema, item.props, {
17294
17479
  kind,
17295
17480
  operation: "create"
@@ -17330,6 +17515,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17330
17515
  endpointKey: endpointKey2,
17331
17516
  ...validFrom !== void 0 && { validFrom },
17332
17517
  ...validTo !== void 0 && { validTo },
17518
+ ...item.clearValidTo === true && { clearValidTo: true },
17333
17519
  ...item.onImmutableLowerBound !== void 0 && {
17334
17520
  onImmutableLowerBound: item.onImmutableLowerBound
17335
17521
  }
@@ -17422,6 +17608,9 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17422
17608
  validFrom: entry2.validFrom
17423
17609
  },
17424
17610
  ...entry2.validTo !== void 0 && { validTo: entry2.validTo },
17611
+ ...entry2.clearValidTo === true && {
17612
+ clearValidTo: true
17613
+ },
17425
17614
  ...entry2.onImmutableLowerBound !== void 0 && {
17426
17615
  onImmutableLowerBound: entry2.onImmutableLowerBound
17427
17616
  }
@@ -17436,6 +17625,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17436
17625
  if (allFoundLive) {
17437
17626
  const found = Array.from({ length: items.length });
17438
17627
  for (const entry2 of probe.toFetch) {
17628
+ assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
17439
17629
  found[entry2.index] = { edge: rowToEdge(entry2.row), action: "found" };
17440
17630
  }
17441
17631
  for (const { index, sourceIndex } of probe.duplicateOf) {
@@ -17456,6 +17646,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17456
17646
  await fetchRowsByEndpoint(target)
17457
17647
  );
17458
17648
  const results = Array.from({ length: items.length });
17649
+ let writes = 0;
17459
17650
  if (toCreate.length > 0) {
17460
17651
  const createInputs = toCreate.map((entry2) => entry2.input);
17461
17652
  const createdEdges = await executeEdgeCreateBatch(
@@ -17469,6 +17660,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17469
17660
  action: "created"
17470
17661
  };
17471
17662
  }
17663
+ writes += toCreate.length;
17472
17664
  }
17473
17665
  for (const entry2 of toFetch) {
17474
17666
  if (entry2.isDeleted) {
@@ -17488,26 +17680,20 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17488
17680
  validFrom: entry2.validFrom
17489
17681
  },
17490
17682
  ...entry2.validTo !== void 0 && { validTo: entry2.validTo },
17683
+ ...entry2.clearValidTo === true && {
17684
+ clearValidTo: true
17685
+ },
17491
17686
  ...entry2.onImmutableLowerBound !== void 0 && {
17492
17687
  onImmutableLowerBound: entry2.onImmutableLowerBound
17493
17688
  }
17494
17689
  },
17495
17690
  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
- }
17691
+ { clearDeleted: true }
17507
17692
  );
17508
17693
  results[entry2.index] = { edge, action: "resurrected" };
17694
+ writes += 1;
17509
17695
  } else if (ifExists === "update") {
17510
- const edge = await executeEdgeUpsertUpdate(
17696
+ const outcome = await executeEdgeUpsertUpdateWithOutcome(
17511
17697
  ctx,
17512
17698
  {
17513
17699
  id: entry2.row.id,
@@ -17523,14 +17709,26 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17523
17709
  validFrom: entry2.validFrom
17524
17710
  },
17525
17711
  ...entry2.validTo !== void 0 && { validTo: entry2.validTo },
17712
+ ...entry2.clearValidTo === true && {
17713
+ clearValidTo: true
17714
+ },
17526
17715
  ...entry2.onImmutableLowerBound !== void 0 && {
17527
17716
  onImmutableLowerBound: entry2.onImmutableLowerBound
17528
17717
  }
17529
17718
  },
17530
- target
17719
+ target,
17720
+ {
17721
+ coalesceUnchanged: ctx.coalesceUnchangedUpsertsEnabled,
17722
+ coalesceCandidate: entry2.row
17723
+ }
17531
17724
  );
17532
- results[entry2.index] = { edge, action: "updated" };
17725
+ results[entry2.index] = {
17726
+ edge: outcome.edge,
17727
+ action: outcome.wrote ? "updated" : "found"
17728
+ };
17729
+ if (outcome.wrote) writes += 1;
17533
17730
  } else {
17731
+ assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
17534
17732
  results[entry2.index] = {
17535
17733
  edge: rowToEdge(entry2.row),
17536
17734
  action: "found"
@@ -17539,21 +17737,35 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
17539
17737
  }
17540
17738
  for (const { index, sourceIndex } of duplicateOf) {
17541
17739
  const sourceResult = requireDefined(results[sourceIndex]);
17740
+ if (sourceResult.action === "found") {
17741
+ assertEndpointClearCanApply(
17742
+ ifExists,
17743
+ items[index]?.clearValidTo,
17744
+ kind
17745
+ );
17746
+ }
17542
17747
  results[index] = { edge: sourceResult.edge, action: "found" };
17543
17748
  }
17544
- return results;
17749
+ return { results, writes };
17545
17750
  },
17546
17751
  // A bulk getOrCreate always converges on a match key no database key
17547
17752
  // backs, whatever its cardinality — the same reason the single-item path
17548
17753
  // fences unconditionally.
17549
- { fencesConstraintProbe: "edgeMatchKeyConvergence" }
17754
+ {
17755
+ fencesConstraintProbe: "edgeMatchKeyConvergence",
17756
+ didWrite: (outcome) => outcome.writes > 0
17757
+ }
17550
17758
  );
17551
17759
  }
17760
+ async function runBatchResults() {
17761
+ const outcome = await runBatch();
17762
+ return outcome.results;
17763
+ }
17552
17764
  try {
17553
- return await runBatch();
17765
+ return await runBatchResults();
17554
17766
  } catch (error) {
17555
17767
  if (!(error instanceof CardinalityError)) throw error;
17556
- return runBatch();
17768
+ return runBatchResults();
17557
17769
  }
17558
17770
  }
17559
17771
 
@@ -17574,8 +17786,8 @@ function withRelationsPrecondition(backend, promise, surface) {
17574
17786
  );
17575
17787
  }
17576
17788
  function createRecordedReadBackend(backend, surface) {
17577
- const projectedBackend = createGraphBackendProjection(backend);
17578
- return createBackendOverlay(projectedBackend, {
17789
+ const projectedBackend = projectGraphBackend(backend);
17790
+ return deriveBackend(projectedBackend, {
17579
17791
  execute: (query) => withRelationsPrecondition(backend, backend.execute(query), surface),
17580
17792
  ...backend.executeRaw === void 0 ? {} : {
17581
17793
  executeRaw: (sqlText, params) => withRelationsPrecondition(
@@ -18281,6 +18493,10 @@ var StoreImplementation = class _StoreImplementation {
18281
18493
  this.#schemaMetadata = schemaMetadata ?? UNKNOWN_SCHEMA_METADATA;
18282
18494
  this[STORE_RUNTIME] = {
18283
18495
  backend: this.#backend,
18496
+ // The query path's own construction, not a second spelling of it: a
18497
+ // caller that could only rebuild this object could not observe the one
18498
+ // the queries actually run on.
18499
+ queryBackend: (target) => this.#createHookedQueryBackend(target ?? this[STORE_RUNTIME].backend),
18284
18500
  sealedQuery: (coordinate) => this.sealedQuery(coordinate),
18285
18501
  recordedNodeGetById: (kind, id, coordinate) => this.recordedNodeGetById(kind, id, coordinate),
18286
18502
  recordedNodeGetByIds: (kind, ids, coordinate) => this.recordedNodeGetByIds(kind, ids, coordinate),
@@ -18293,6 +18509,47 @@ var StoreImplementation = class _StoreImplementation {
18293
18509
  identityAtCoordinate: (coordinate) => this.identityAtCoordinate(coordinate),
18294
18510
  rebuildIdentityClosure: () => this.rebuildIdentityClosure(),
18295
18511
  validateIdentity: () => this.validateIdentity(),
18512
+ applyResolvedNodeUniqueness: async (target, writes, apply) => {
18513
+ const upserts = writes.upserts.map((upsert) => {
18514
+ if (!hasOwnKey(this.#graph.nodes, upsert.kind)) {
18515
+ throw new KindNotFoundError(upsert.kind, "node", {
18516
+ graphId: this.graphId
18517
+ });
18518
+ }
18519
+ const registration = this.#graph.nodes[upsert.kind];
18520
+ if (registration === void 0) {
18521
+ throw new KindNotFoundError(upsert.kind, "node", {
18522
+ graphId: this.graphId
18523
+ });
18524
+ }
18525
+ return {
18526
+ ...upsert,
18527
+ constraints: registration.unique ?? []
18528
+ };
18529
+ });
18530
+ const constrainedKinds = new Set(
18531
+ Object.entries(this.#graph.nodes).filter(
18532
+ ([, registration]) => (registration.unique ?? []).length > 0
18533
+ ).map(([kind]) => kind)
18534
+ );
18535
+ const releases = writes.releases.filter((release) => {
18536
+ if (!Object.hasOwn(this.#graph.nodes, release.kind)) {
18537
+ throw new KindNotFoundError(release.kind, "node", {
18538
+ graphId: this.graphId
18539
+ });
18540
+ }
18541
+ return constrainedKinds.has(release.kind);
18542
+ });
18543
+ if (upserts.every((upsert) => upsert.constraints.length === 0) && releases.length === 0) {
18544
+ return apply();
18545
+ }
18546
+ return applyResolvedNodeUniqueness(
18547
+ createUniquenessContext(this.graphId, this.#registry, target),
18548
+ upserts,
18549
+ releases,
18550
+ apply
18551
+ );
18552
+ },
18296
18553
  liveNodesSharingIds: async (ids, target) => {
18297
18554
  const backend2 = target ?? this.#baseBackend;
18298
18555
  const liveKindsById = await liveNodeKindsSharingIds(
@@ -18337,7 +18594,7 @@ var StoreImplementation = class _StoreImplementation {
18337
18594
  lockIdentityImportTarget: (target) => this.lockIdentityImportTarget(target),
18338
18595
  foldImportedIdentityNodes: (target, references) => this.foldImportedIdentityNodes(target, references),
18339
18596
  importIdentityAssertionsAtTarget: (target, assertions, mode) => this.importIdentityAssertionsAtTarget(target, assertions, mode),
18340
- applyIdentityMergeAtTarget: (target, retractionIds, assertions) => this.applyIdentityMergeAtTarget(target, retractionIds, assertions),
18597
+ applyIdentityMergeAtTarget: (target, retractions, assertions) => this.applyIdentityMergeAtTarget(target, retractions, assertions),
18341
18598
  assertIdentityClassesConsistentAtTarget: (target, seeds) => this.assertIdentityClassesConsistentAtTarget(target, seeds)
18342
18599
  };
18343
18600
  Object.defineProperty(this, STORE_RUNTIME, {
@@ -18556,8 +18813,8 @@ var StoreImplementation = class _StoreImplementation {
18556
18813
  );
18557
18814
  }
18558
18815
  /** @internal Mechanical graph-merge apply through the mutation coordinator. */
18559
- applyIdentityMergeAtTarget(target, retractionIds, assertions) {
18560
- if (retractionIds.length === 0 && assertions.length === 0) {
18816
+ applyIdentityMergeAtTarget(target, retractions, assertions) {
18817
+ if (retractions.length === 0 && assertions.length === 0) {
18561
18818
  return Promise.resolve({ created: 0, retracted: 0 });
18562
18819
  }
18563
18820
  if (this.#graph.identity === void 0) {
@@ -18568,7 +18825,7 @@ var StoreImplementation = class _StoreImplementation {
18568
18825
  }
18569
18826
  return applyIdentityChangesForContext(
18570
18827
  this.#identityContext(target),
18571
- retractionIds,
18828
+ retractions,
18572
18829
  assertions
18573
18830
  );
18574
18831
  }
@@ -18940,7 +19197,7 @@ var StoreImplementation = class _StoreImplementation {
18940
19197
  options
18941
19198
  ),
18942
19199
  // Present only when opted in; its absence is the coalesce off switch.
18943
- ...this.#options?.coalesceUnchangedUpserts === true && {
19200
+ ...ctx.coalesceUnchangedUpsertsEnabled && {
18944
19201
  upsertDirtyCheck: (kind, id, existingProps, inputProps) => nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
18945
19202
  },
18946
19203
  executeDelete: (kind, id, backend) => executeNodeDelete(ctx, kind, id, backend),
@@ -18999,7 +19256,7 @@ var StoreImplementation = class _StoreImplementation {
18999
19256
  executeUpdate: (input, backend) => executeEdgeUpdate(ctx, input, backend),
19000
19257
  executeUpsertUpdate: (input, backend, options) => executeEdgeUpsertUpdate(ctx, input, backend, options),
19001
19258
  // Present only when opted in; its absence is the coalesce off switch.
19002
- ...this.#options?.coalesceUnchangedUpserts === true && {
19259
+ ...ctx.coalesceUnchangedUpsertsEnabled && {
19003
19260
  upsertDirtyCheck: (kind, id, existingProps, inputProps) => edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
19004
19261
  },
19005
19262
  executeDelete: (kind, id, backend) => executeEdgeDelete(ctx, kind, id, backend),
@@ -21056,6 +21313,7 @@ var StoreImplementation = class _StoreImplementation {
21056
21313
  schemaVersion: this.#schemaMetadata.schemaVersion,
21057
21314
  historyEnabled: this.#captureEnabled,
21058
21315
  revisionTrackingEnabled: this.#revisionTrackingEnabled,
21316
+ coalesceUnchangedUpsertsEnabled: this.#coalescesUnchangedUpserts(),
21059
21317
  revisionSchema: this.#sqlSchema(),
21060
21318
  registry: this.#registry,
21061
21319
  ...identityConfig === void 0 ? {} : {
@@ -21080,6 +21338,15 @@ var StoreImplementation = class _StoreImplementation {
21080
21338
  target,
21081
21339
  ref,
21082
21340
  mode
21341
+ ),
21342
+ requireValidityEndCompatible: (target, ref, validTo) => requireNodeValidityEndCompatible(
21343
+ {
21344
+ graphId: this.graphId,
21345
+ schema: this.#sqlSchema()
21346
+ },
21347
+ target,
21348
+ ref,
21349
+ validTo
21083
21350
  )
21084
21351
  }
21085
21352
  },
@@ -21101,19 +21368,24 @@ var StoreImplementation = class _StoreImplementation {
21101
21368
  schemaVersion: this.#schemaMetadata.schemaVersion,
21102
21369
  historyEnabled: this.#captureEnabled,
21103
21370
  revisionTrackingEnabled: this.#revisionTrackingEnabled,
21371
+ coalesceUnchangedUpsertsEnabled: this.#coalescesUnchangedUpserts(),
21104
21372
  revisionSchema: this.#sqlSchema(),
21105
21373
  registry: this.#registry,
21106
21374
  createOperationContext: (operation, entity, kind, id) => this.#createOperationContext(operation, entity, kind, id),
21107
21375
  withOperationHooks: runHooks
21108
21376
  };
21109
21377
  }
21378
+ /** The single owner of the store-wide unchanged-upsert enablement decision. */
21379
+ #coalescesUnchangedUpserts() {
21380
+ return this.#options?.coalesceUnchangedUpserts === true;
21381
+ }
21110
21382
  // === Internal: Hook Helpers ===
21111
21383
  /**
21112
21384
  * Decorates the query execution port so hooks observe each statement the
21113
21385
  * query builder submits to the backend. A selective-projection retry
21114
21386
  * therefore emits two independent start/end pairs with their actual SQL.
21115
21387
  *
21116
- * Decoration goes through {@link createBackendOverlay}, which carries the
21388
+ * Decoration goes through {@link deriveBackend}, which carries the
21117
21389
  * projection's serialized-resource ownership: the hooked backend still
21118
21390
  * executes on the source's connection, so it must answer the same "shares one
21119
21391
  * serialized connection" question as its source.
@@ -21124,8 +21396,8 @@ var StoreImplementation = class _StoreImplementation {
21124
21396
  }
21125
21397
  const executeRaw = backend.executeRaw;
21126
21398
  const compileSql = backend.compileSql;
21127
- const projected = createGraphBackendProjection(backend);
21128
- return createBackendOverlay(projected, {
21399
+ const projected = projectGraphBackend(backend);
21400
+ return deriveBackend(projected, {
21129
21401
  execute: (query) => {
21130
21402
  const compiled = compileSql === void 0 ? renderSql(query, backend.dialect) : compileSql(query);
21131
21403
  return this.#withQueryHooks(
@@ -21266,12 +21538,12 @@ var StoreImplementation = class _StoreImplementation {
21266
21538
  switch (temporalMode) {
21267
21539
  case "current":
21268
21540
  case "asOf": {
21269
- if (row.deleted_at) return false;
21270
- if (asOf !== void 0 && row.valid_from && asOf < row.valid_from)
21271
- return false;
21272
- if (asOf !== void 0 && row.valid_to && asOf >= row.valid_to)
21273
- return false;
21274
- return true;
21541
+ if (row.deleted_at || asOf === void 0) return false;
21542
+ return validityWindowContainsInstant(
21543
+ row.valid_from,
21544
+ row.valid_to,
21545
+ asOf
21546
+ );
21275
21547
  }
21276
21548
  case "includeEnded": {
21277
21549
  return !row.deleted_at;
@@ -21306,9 +21578,7 @@ var AdapterStoreImplementation = class _AdapterStoreImplementation extends Store
21306
21578
  backend;
21307
21579
  constructor(graph, backend, options, schemaMetadata) {
21308
21580
  super(graph, backend, options, schemaMetadata, backend);
21309
- this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[STORE_RUNTIME].backend) : Object.freeze(
21310
- createGraphBackendProjection(this[STORE_RUNTIME].backend)
21311
- );
21581
+ this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[STORE_RUNTIME].backend) : Object.freeze(projectGraphBackend(this[STORE_RUNTIME].backend));
21312
21582
  }
21313
21583
  /**
21314
21584
  * Rebind this store's already-reconciled schema onto a fresh backend/
@@ -21718,5 +21988,5 @@ async function createVerifiedAdapterStore(graph, backend, options) {
21718
21988
  }
21719
21989
 
21720
21990
  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
21991
+ //# sourceMappingURL=chunk-BRRP76WO.js.map
21992
+ //# sourceMappingURL=chunk-BRRP76WO.js.map