@nicia-ai/typegraph 0.48.0 → 0.50.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.
- package/dist/backend/drizzle/indexes.cjs +9 -9
- package/dist/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/drizzle/indexes.js +5 -5
- package/dist/backend/index.cjs +56 -52
- package/dist/backend/index.d.cts +3 -3
- package/dist/backend/index.d.ts +3 -3
- package/dist/backend/index.js +11 -11
- package/dist/backend/postgres/index.cjs +34 -28
- package/dist/backend/postgres/index.d.cts +7 -7
- package/dist/backend/postgres/index.d.ts +7 -7
- package/dist/backend/postgres/index.js +17 -15
- package/dist/backend/postgres/pglite-store.cjs +36 -35
- package/dist/backend/postgres/pglite-store.cjs.map +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +8 -8
- package/dist/backend/postgres/pglite-store.d.ts +8 -8
- package/dist/backend/postgres/pglite-store.js +32 -31
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +19 -17
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +18 -16
- package/dist/backend/sqlite/index.cjs +31 -25
- package/dist/backend/sqlite/index.d.cts +7 -7
- package/dist/backend/sqlite/index.d.ts +7 -7
- package/dist/backend/sqlite/index.js +15 -13
- package/dist/backend/sqlite/libsql.cjs +22 -20
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +17 -15
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +37 -36
- package/dist/backend/sqlite/local-store.cjs.map +1 -1
- package/dist/backend/sqlite/local-store.d.cts +8 -8
- package/dist/backend/sqlite/local-store.d.ts +8 -8
- package/dist/backend/sqlite/local-store.js +33 -32
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +20 -18
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +18 -16
- package/dist/{chunk-AX6JGVTZ.js → chunk-2CYI5HRH.js} +276 -206
- package/dist/chunk-2CYI5HRH.js.map +1 -0
- package/dist/{chunk-KF6K7TGH.js → chunk-2GIV5X4P.js} +702 -422
- package/dist/chunk-2GIV5X4P.js.map +1 -0
- package/dist/{chunk-2TYSSBU5.js → chunk-2Q45FAIE.js} +15 -15
- package/dist/{chunk-2TYSSBU5.js.map → chunk-2Q45FAIE.js.map} +1 -1
- package/dist/{chunk-WODMN3Q2.cjs → chunk-45YZXI6X.cjs} +27 -27
- package/dist/{chunk-WODMN3Q2.cjs.map → chunk-45YZXI6X.cjs.map} +1 -1
- package/dist/{chunk-3DMMGT6S.js → chunk-46UGOVRW.js} +3 -3
- package/dist/{chunk-3DMMGT6S.js.map → chunk-46UGOVRW.js.map} +1 -1
- package/dist/{chunk-GLHXM7C4.js → chunk-5LKOVCPP.js} +60 -23
- package/dist/chunk-5LKOVCPP.js.map +1 -0
- package/dist/{chunk-JFRT7S3B.cjs → chunk-5OWHU7Z7.cjs} +261 -459
- package/dist/chunk-5OWHU7Z7.cjs.map +1 -0
- package/dist/{chunk-7SQSZN2J.js → chunk-5PP4KRPV.js} +5 -5
- package/dist/{chunk-7SQSZN2J.js.map → chunk-5PP4KRPV.js.map} +1 -1
- package/dist/chunk-6KQEICJ6.cjs +12 -0
- package/dist/{chunk-MKJ4KXL5.cjs.map → chunk-6KQEICJ6.cjs.map} +1 -1
- package/dist/{chunk-6SWPJEYN.js → chunk-6LEOAIIB.js} +40 -6
- package/dist/chunk-6LEOAIIB.js.map +1 -0
- package/dist/{chunk-DZAICA5J.js → chunk-6NKSE5AU.js} +4 -4
- package/dist/{chunk-DZAICA5J.js.map → chunk-6NKSE5AU.js.map} +1 -1
- package/dist/{chunk-OVI7IXYX.js → chunk-6S3PTHL4.js} +3 -3
- package/dist/{chunk-OVI7IXYX.js.map → chunk-6S3PTHL4.js.map} +1 -1
- package/dist/{chunk-3FPR224C.cjs → chunk-7CCMCMJO.cjs} +102 -102
- package/dist/{chunk-3FPR224C.cjs.map → chunk-7CCMCMJO.cjs.map} +1 -1
- package/dist/{chunk-SHFBB23Q.js → chunk-7OWE7WD6.js} +6 -4
- package/dist/chunk-7OWE7WD6.js.map +1 -0
- package/dist/chunk-7PRMDZIA.cjs +182 -0
- package/dist/chunk-7PRMDZIA.cjs.map +1 -0
- package/dist/{chunk-CHAOFCHV.js → chunk-AH2A74OZ.js} +3 -3
- package/dist/{chunk-CHAOFCHV.js.map → chunk-AH2A74OZ.js.map} +1 -1
- package/dist/{chunk-OORXGFL5.cjs → chunk-BYBDM423.cjs} +48 -48
- package/dist/{chunk-OORXGFL5.cjs.map → chunk-BYBDM423.cjs.map} +1 -1
- package/dist/{chunk-JB6T4GLL.cjs → chunk-C76WFIVZ.cjs} +808 -519
- package/dist/chunk-C76WFIVZ.cjs.map +1 -0
- package/dist/{chunk-OTUPEF2W.cjs → chunk-CS6JTQQ2.cjs} +328 -257
- package/dist/chunk-CS6JTQQ2.cjs.map +1 -0
- package/dist/{chunk-AOSSQDVO.cjs → chunk-CSNOYIB4.cjs} +13 -13
- package/dist/{chunk-AOSSQDVO.cjs.map → chunk-CSNOYIB4.cjs.map} +1 -1
- package/dist/{chunk-HEV35TGT.js → chunk-DI6VC62F.js} +13 -4
- package/dist/chunk-DI6VC62F.js.map +1 -0
- package/dist/{chunk-2QGYQBS2.cjs → chunk-DWUDZ66O.cjs} +10 -10
- package/dist/{chunk-2QGYQBS2.cjs.map → chunk-DWUDZ66O.cjs.map} +1 -1
- package/dist/{chunk-ZDKTPBGV.js → chunk-EDLKIQRI.js} +4 -4
- package/dist/{chunk-ZDKTPBGV.js.map → chunk-EDLKIQRI.js.map} +1 -1
- package/dist/chunk-EH3JZJUM.cjs +567 -0
- package/dist/chunk-EH3JZJUM.cjs.map +1 -0
- package/dist/{chunk-S5TERQVW.js → chunk-FX5ZW6PN.js} +196 -33
- package/dist/chunk-FX5ZW6PN.js.map +1 -0
- package/dist/{chunk-XVWOYKIK.js → chunk-FZHF5UWR.js} +3 -3
- package/dist/{chunk-XVWOYKIK.js.map → chunk-FZHF5UWR.js.map} +1 -1
- package/dist/{chunk-BFUOME67.cjs → chunk-G2TLHH6T.cjs} +20 -11
- package/dist/chunk-G2TLHH6T.cjs.map +1 -0
- package/dist/{chunk-5PRKMB24.cjs → chunk-GHZPZNFC.cjs} +12 -4
- package/dist/chunk-GHZPZNFC.cjs.map +1 -0
- package/dist/{chunk-ZFMCDJGB.js → chunk-GVYVGGPJ.js} +11 -199
- package/dist/chunk-GVYVGGPJ.js.map +1 -0
- package/dist/{chunk-SDBBMD4N.js → chunk-H3XP6BAV.js} +3 -3
- package/dist/{chunk-SDBBMD4N.js.map → chunk-H3XP6BAV.js.map} +1 -1
- package/dist/{chunk-ROR5ZR6A.cjs → chunk-HSEZ7X6Y.cjs} +45 -45
- package/dist/{chunk-ROR5ZR6A.cjs.map → chunk-HSEZ7X6Y.cjs.map} +1 -1
- package/dist/{chunk-LRQKXRXO.cjs → chunk-HY5BNOUN.cjs} +4 -4
- package/dist/{chunk-LRQKXRXO.cjs.map → chunk-HY5BNOUN.cjs.map} +1 -1
- package/dist/chunk-HZUB5CON.js +27 -0
- package/dist/chunk-HZUB5CON.js.map +1 -0
- package/dist/{chunk-MYKHJI2J.js → chunk-I5C6OTKR.js} +3 -3
- package/dist/{chunk-MYKHJI2J.js.map → chunk-I5C6OTKR.js.map} +1 -1
- package/dist/{chunk-3U5ABFDW.cjs → chunk-IHK5KA2Q.cjs} +31 -28
- package/dist/chunk-IHK5KA2Q.cjs.map +1 -0
- package/dist/{chunk-26YKDNUD.cjs → chunk-IPRP6TDL.cjs} +12 -10
- package/dist/chunk-IPRP6TDL.cjs.map +1 -0
- package/dist/{chunk-UGHG7PGX.js → chunk-IRPYOHRC.js} +26 -4
- package/dist/chunk-IRPYOHRC.js.map +1 -0
- package/dist/{chunk-7XUYFFR4.cjs → chunk-ISKCIQF2.cjs} +20 -20
- package/dist/{chunk-7XUYFFR4.cjs.map → chunk-ISKCIQF2.cjs.map} +1 -1
- package/dist/{chunk-OD4SSY2U.js → chunk-JG5XIJDY.js} +57 -31
- package/dist/chunk-JG5XIJDY.js.map +1 -0
- package/dist/{chunk-2HIYYMWY.cjs → chunk-K2XYLVVB.cjs} +134 -133
- package/dist/chunk-K2XYLVVB.cjs.map +1 -0
- package/dist/{chunk-5K2BKEBD.js → chunk-K46SDNQD.js} +10 -4
- package/dist/chunk-K46SDNQD.js.map +1 -0
- package/dist/{chunk-TZEGUG6D.cjs → chunk-K6VKTBST.cjs} +4 -4
- package/dist/{chunk-TZEGUG6D.cjs.map → chunk-K6VKTBST.cjs.map} +1 -1
- package/dist/chunk-KWNWG4RC.cjs +12 -0
- package/dist/{chunk-CICO5GXD.cjs.map → chunk-KWNWG4RC.cjs.map} +1 -1
- package/dist/{chunk-FQPEMEWX.cjs → chunk-LLVOQOWE.cjs} +80 -32
- package/dist/chunk-LLVOQOWE.cjs.map +1 -0
- package/dist/{chunk-TQHGE7UC.cjs → chunk-M5MSP3BI.cjs} +18 -10
- package/dist/chunk-M5MSP3BI.cjs.map +1 -0
- package/dist/{chunk-ACGSAMD3.js → chunk-MJPZNEJZ.js} +274 -292
- package/dist/chunk-MJPZNEJZ.js.map +1 -0
- package/dist/{chunk-TUNPBZY3.cjs → chunk-MM3JHVKZ.cjs} +4 -4
- package/dist/{chunk-TUNPBZY3.cjs.map → chunk-MM3JHVKZ.cjs.map} +1 -1
- package/dist/{chunk-BRRP76WO.js → chunk-MX7EKQPM.js} +457 -299
- package/dist/chunk-MX7EKQPM.js.map +1 -0
- package/dist/{chunk-2SYZXD54.js → chunk-MZ34E2GN.js} +13 -12
- package/dist/chunk-MZ34E2GN.js.map +1 -0
- package/dist/{chunk-EDN4Y4ZG.cjs → chunk-OJHD3LXJ.cjs} +9 -9
- package/dist/{chunk-EDN4Y4ZG.cjs.map → chunk-OJHD3LXJ.cjs.map} +1 -1
- package/dist/{chunk-DO7SAMEK.cjs → chunk-ON47CBE4.cjs} +47 -47
- package/dist/{chunk-DO7SAMEK.cjs.map → chunk-ON47CBE4.cjs.map} +1 -1
- package/dist/{chunk-6LN7FIVU.js → chunk-PALYTHGM.js} +11 -4
- package/dist/chunk-PALYTHGM.js.map +1 -0
- package/dist/{chunk-YVF2EM7B.js → chunk-R7MRFE5P.js} +3 -3
- package/dist/{chunk-YVF2EM7B.js.map → chunk-R7MRFE5P.js.map} +1 -1
- package/dist/{chunk-EZEEWCFJ.cjs → chunk-RDP6ZRSM.cjs} +435 -265
- package/dist/chunk-RDP6ZRSM.cjs.map +1 -0
- package/dist/{chunk-GYEG3ZLZ.cjs → chunk-RJMHU2MG.cjs} +121 -18
- package/dist/chunk-RJMHU2MG.cjs.map +1 -0
- package/dist/chunk-RWUWTJQY.cjs +30 -0
- package/dist/chunk-RWUWTJQY.cjs.map +1 -0
- package/dist/{chunk-CT3ZKTOF.js → chunk-S33YQEL7.js} +7 -7
- package/dist/{chunk-CT3ZKTOF.js.map → chunk-S33YQEL7.js.map} +1 -1
- package/dist/chunk-S3SDEQMC.js +532 -0
- package/dist/chunk-S3SDEQMC.js.map +1 -0
- package/dist/{chunk-OI2GQ25X.cjs → chunk-SHC7BCG5.cjs} +7 -7
- package/dist/{chunk-OI2GQ25X.cjs.map → chunk-SHC7BCG5.cjs.map} +1 -1
- package/dist/{chunk-L3LQNR34.cjs → chunk-TEC24ZDA.cjs} +161 -161
- package/dist/{chunk-L3LQNR34.cjs.map → chunk-TEC24ZDA.cjs.map} +1 -1
- package/dist/{chunk-HDL2ARHX.cjs → chunk-TP4NJTI3.cjs} +63 -27
- package/dist/chunk-TP4NJTI3.cjs.map +1 -0
- package/dist/{chunk-UMGZDVOA.cjs → chunk-TTCOPKUL.cjs} +124 -124
- package/dist/{chunk-UMGZDVOA.cjs.map → chunk-TTCOPKUL.cjs.map} +1 -1
- package/dist/chunk-TUVD4DFR.cjs +1207 -0
- package/dist/chunk-TUVD4DFR.cjs.map +1 -0
- package/dist/{chunk-PFBRJBUL.cjs → chunk-TYGGUWMS.cjs} +178 -152
- package/dist/chunk-TYGGUWMS.cjs.map +1 -0
- package/dist/{chunk-4WMMBDS5.js → chunk-U3Z7XKAG.js} +7 -7
- package/dist/{chunk-4WMMBDS5.js.map → chunk-U3Z7XKAG.js.map} +1 -1
- package/dist/{chunk-NACVVDWB.js → chunk-U5EL6JUV.js} +10 -10
- package/dist/{chunk-NACVVDWB.js.map → chunk-U5EL6JUV.js.map} +1 -1
- package/dist/{chunk-OMZ37BM2.js → chunk-V76FGHY3.js} +5 -5
- package/dist/{chunk-OMZ37BM2.js.map → chunk-V76FGHY3.js.map} +1 -1
- package/dist/{chunk-6NGW27EO.cjs → chunk-VLBTRXA2.cjs} +10 -10
- package/dist/{chunk-6NGW27EO.cjs.map → chunk-VLBTRXA2.cjs.map} +1 -1
- package/dist/chunk-VTJVMP4I.js +1182 -0
- package/dist/chunk-VTJVMP4I.js.map +1 -0
- package/dist/{chunk-QTD6HX4O.js → chunk-W5SOCUBL.js} +5 -5
- package/dist/{chunk-QTD6HX4O.js.map → chunk-W5SOCUBL.js.map} +1 -1
- package/dist/{chunk-SR725PWF.cjs → chunk-WCLMKNQE.cjs} +1750 -1592
- package/dist/chunk-WCLMKNQE.cjs.map +1 -0
- package/dist/{chunk-TKZXMWQF.cjs → chunk-WK23PGTP.cjs} +13 -13
- package/dist/{chunk-TKZXMWQF.cjs.map → chunk-WK23PGTP.cjs.map} +1 -1
- package/dist/{chunk-KKBDXCLQ.js → chunk-WQBAQZHR.js} +4 -4
- package/dist/{chunk-KKBDXCLQ.js.map → chunk-WQBAQZHR.js.map} +1 -1
- package/dist/{chunk-MRDBBHIZ.cjs → chunk-X4GDXBOP.cjs} +2 -2
- package/dist/chunk-X4GDXBOP.cjs.map +1 -0
- package/dist/{chunk-WCCATHMB.cjs → chunk-XMY2SXOH.cjs} +438 -456
- package/dist/chunk-XMY2SXOH.cjs.map +1 -0
- package/dist/{chunk-D5R42W5D.js → chunk-XZW2CTNO.js} +115 -12
- package/dist/chunk-XZW2CTNO.js.map +1 -0
- package/dist/{chunk-NVY5CJFP.js → chunk-Y55DLLEG.js} +9 -6
- package/dist/chunk-Y55DLLEG.js.map +1 -0
- package/dist/chunk-YA36ABIL.js +174 -0
- package/dist/chunk-YA36ABIL.js.map +1 -0
- package/dist/{chunk-ZLONH2UD.js → chunk-YDEJQWOL.js} +2 -2
- package/dist/chunk-YDEJQWOL.js.map +1 -0
- package/dist/{chunk-JONXFAPO.js → chunk-ZAQUKCUC.js} +5 -5
- package/dist/{chunk-JONXFAPO.js.map → chunk-ZAQUKCUC.js.map} +1 -1
- package/dist/{chunk-SIT26LAZ.cjs → chunk-ZBFZGLZE.cjs} +29 -5
- package/dist/chunk-ZBFZGLZE.cjs.map +1 -0
- package/dist/{chunk-P6YLZTRE.js → chunk-ZRJTM7MT.js} +3 -3
- package/dist/{chunk-P6YLZTRE.js.map → chunk-ZRJTM7MT.js.map} +1 -1
- package/dist/core/index.cjs +29 -28
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +9 -8
- package/dist/{ddl-D_oW-EVO.d.ts → ddl-B49O7dB_.d.ts} +3 -3
- package/dist/{ddl-BL1NZLMY.d.cts → ddl-DcZG660s.d.cts} +3 -3
- package/dist/graph-extension/index.cjs +21 -20
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +5 -4
- package/dist/graph-merge/index.cjs +327 -302
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +14 -11
- package/dist/graph-merge/index.d.ts +14 -11
- package/dist/graph-merge/index.js +52 -27
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-D7d1u2gr.d.ts → index-B0PrmE3K.d.cts} +16 -2
- package/dist/{index-COs_z6nV.d.cts → index-CwcXsL5R.d.ts} +16 -2
- package/dist/index.cjs +223 -222
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +37 -36
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +13 -13
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/indexes/index.js +6 -6
- package/dist/ingestion-import-target-CI8OWIkM.d.ts +17 -0
- package/dist/ingestion-import-target-DCpfM1PX.d.cts +17 -0
- package/dist/interchange/index.cjs +55 -54
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +26 -12
- package/dist/interchange/index.d.ts +26 -12
- package/dist/interchange/index.js +19 -18
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-D9eRT_ns.d.ts → manager-Cfg1ENj1.d.ts} +30 -2
- package/dist/{manager-CYaff3n3.d.cts → manager-D348fa6W.d.cts} +30 -2
- package/dist/{materialize-indexes-DJ3ykH59.d.ts → materialize-indexes-C9GG3O3C.d.ts} +1 -1
- package/dist/{materialize-indexes-DTtAnvfY.d.cts → materialize-indexes-CrSiW_lT.d.cts} +1 -1
- package/dist/{postgres-DMj39MEu.d.cts → postgres-CH1kkM5J.d.cts} +279 -2
- package/dist/{postgres-CcL4bAHS.d.ts → postgres-UStOycLI.d.ts} +279 -2
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +46 -44
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +7 -7
- package/dist/provenance/index.d.ts +7 -7
- package/dist/provenance/index.js +12 -10
- package/dist/provenance/index.js.map +1 -1
- package/dist/{repair-validity-windows-DlUSqwCg.d.ts → repair-validity-windows-BtOEe2pS.d.ts} +2 -2
- package/dist/{repair-validity-windows-BFNZvd_H.d.cts → repair-validity-windows-aWX7VNvv.d.cts} +2 -2
- package/dist/schema/index.cjs +46 -46
- package/dist/schema/index.d.cts +6 -6
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.js +19 -19
- package/dist/{searchable-DHJMh_nj.d.cts → searchable-C8-RrL3l.d.cts} +1 -1
- package/dist/{searchable-bpE1bBfc.d.ts → searchable-z4BiFfHI.d.ts} +1 -1
- package/dist/{sqlite-D7Oz0SQh.d.ts → sqlite-Cyx9j9o6.d.cts} +309 -2
- package/dist/{sqlite-YppHrNFb.d.cts → sqlite-axLw5Lo5.d.ts} +309 -2
- package/dist/{store-JUVvtmR4.d.cts → store-CTfQ9taw.d.ts} +110 -13
- package/dist/{store-UzrGvZOo.d.ts → store-DR9J7JVB.d.cts} +110 -13
- package/dist/{temporal-5GqpYCk2.d.cts → temporal-B4Ky4wzh.d.cts} +1 -1
- package/dist/{temporal-CbnLzTmM.d.ts → temporal-CBOrERz5.d.ts} +1 -1
- package/dist/{types-CXAhpW-c.d.cts → types-BE921wRl.d.cts} +1 -1
- package/dist/{types-Bx74kaTt.d.ts → types-BScHXVM7.d.ts} +1 -1
- package/dist/{types-BqFZTQmV.d.cts → types-CWg4dTjj.d.cts} +257 -6
- package/dist/{types-BqFZTQmV.d.ts → types-CWg4dTjj.d.ts} +257 -6
- package/dist/{where-O-k2wgYm.d.ts → where-BWXUPV3C.d.ts} +1 -1
- package/dist/{where-DI_Fqz-X.d.cts → where-CNtx1aLc.d.cts} +1 -1
- package/package.json +4 -4
- package/dist/chunk-26YKDNUD.cjs.map +0 -1
- package/dist/chunk-2HIYYMWY.cjs.map +0 -1
- package/dist/chunk-2SYZXD54.js.map +0 -1
- package/dist/chunk-3KOY4FH3.cjs +0 -934
- package/dist/chunk-3KOY4FH3.cjs.map +0 -1
- package/dist/chunk-3U5ABFDW.cjs.map +0 -1
- package/dist/chunk-5K2BKEBD.js.map +0 -1
- package/dist/chunk-5PRKMB24.cjs.map +0 -1
- package/dist/chunk-6LN7FIVU.js.map +0 -1
- package/dist/chunk-6SWPJEYN.js.map +0 -1
- package/dist/chunk-ACGSAMD3.js.map +0 -1
- package/dist/chunk-AX6JGVTZ.js.map +0 -1
- package/dist/chunk-BFUOME67.cjs.map +0 -1
- package/dist/chunk-BRRP76WO.js.map +0 -1
- package/dist/chunk-CICO5GXD.cjs +0 -12
- package/dist/chunk-D5R42W5D.js.map +0 -1
- package/dist/chunk-EZEEWCFJ.cjs.map +0 -1
- package/dist/chunk-FA2AFWLP.cjs +0 -167
- package/dist/chunk-FA2AFWLP.cjs.map +0 -1
- package/dist/chunk-FQPEMEWX.cjs.map +0 -1
- package/dist/chunk-GLHXM7C4.js.map +0 -1
- package/dist/chunk-GYEG3ZLZ.cjs.map +0 -1
- package/dist/chunk-HDL2ARHX.cjs.map +0 -1
- package/dist/chunk-HEV35TGT.js.map +0 -1
- package/dist/chunk-I4GAZH5Z.js +0 -913
- package/dist/chunk-I4GAZH5Z.js.map +0 -1
- package/dist/chunk-JB6T4GLL.cjs.map +0 -1
- package/dist/chunk-JBQQ7THH.js +0 -20
- package/dist/chunk-JBQQ7THH.js.map +0 -1
- package/dist/chunk-JFRT7S3B.cjs.map +0 -1
- package/dist/chunk-KF6K7TGH.js.map +0 -1
- package/dist/chunk-MKJ4KXL5.cjs +0 -12
- package/dist/chunk-MRDBBHIZ.cjs.map +0 -1
- package/dist/chunk-NVY5CJFP.js.map +0 -1
- package/dist/chunk-OD4SSY2U.js.map +0 -1
- package/dist/chunk-OTUPEF2W.cjs.map +0 -1
- package/dist/chunk-PFBRJBUL.cjs.map +0 -1
- package/dist/chunk-PWLJ77UV.cjs +0 -23
- package/dist/chunk-PWLJ77UV.cjs.map +0 -1
- package/dist/chunk-S5TERQVW.js.map +0 -1
- package/dist/chunk-SHFBB23Q.js.map +0 -1
- package/dist/chunk-SIT26LAZ.cjs.map +0 -1
- package/dist/chunk-SR725PWF.cjs.map +0 -1
- package/dist/chunk-TQHGE7UC.cjs.map +0 -1
- package/dist/chunk-UGHG7PGX.js.map +0 -1
- package/dist/chunk-WCCATHMB.cjs.map +0 -1
- package/dist/chunk-YIURNGXI.js +0 -155
- package/dist/chunk-YIURNGXI.js.map +0 -1
- package/dist/chunk-ZFMCDJGB.js.map +0 -1
- package/dist/chunk-ZLONH2UD.js.map +0 -1
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import { createEdgeRowMapper, createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, POSTGRES_ROW_MAPPER_CONFIG, normalizeRowTimestamp, normalizeRequiredRowTimestamp } from './chunk-
|
|
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-
|
|
3
|
-
import { storeRuntime, STORE_RUNTIME,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { withRecordedRelationsPrecondition, projectGraphBackend, deriveBackend, projectBackend, chunk, postgresReadWriteRefusedSqlState, isMissingTableError, groupBy, postgresTemporaryTableUnavailableSqlState, isPostgresConcurrentDdlRaceError } from './chunk-
|
|
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-
|
|
11
|
-
import { runOptionallyInTransaction, createTransactionReadBackend, rowPropsToObject, INTERNAL_TEMPORARY_WRITES } from './chunk-
|
|
12
|
-
import { isKnownKind } from './chunk-
|
|
13
|
-
import { validateEdgeEndpoints } from './chunk-
|
|
14
|
-
import { resolveReadCoordinate, withRecordedCoordinate, describeCoordinate, coordinateContext, recordedInstantWallTime, asRecordedInstant, assertValidRecordedInstant, optionalRecordedInstantParts } from './chunk-
|
|
15
|
-
import { nowIso, validityWindowContainsInstant, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow, preservesImmutableLowerBound, assertWritableValidityWindow, isCanonicalIsoDate, statedBoundMatchesStored } from './chunk-
|
|
16
|
-
import { generateIndexDDL } from './chunk-
|
|
17
|
-
import { SYSTEM_INDEX_DECLARATIONS, resolveSystemIndexTableName, systemIndexName, resolveSystemIndexNames, generateSystemIndexDDL } from './chunk-
|
|
18
|
-
import { NODE_META_KEYS, EDGE_META_KEYS } from './chunk-
|
|
1
|
+
import { createEdgeRowMapper, createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, POSTGRES_ROW_MAPPER_CONFIG, normalizeRowTimestamp, normalizeRequiredRowTimestamp, buildHardDeleteEdgeClaimsByNodeKind, buildHardDeleteUniquesByConcreteKind, buildHardDeleteEdgeClaimsByEdgeKind } from './chunk-S3SDEQMC.js';
|
|
2
|
+
import { rowToNode, executeNodeBulkFindByIndex, executeNodeBulkFindByConstraint, executeNodeFindByConstraint, executeNodeBulkGetOrCreateByConstraint, executeNodeGetOrCreateByConstraint, executeNodeHardDelete, executeNodeDeleteBatch, executeNodeDelete, nodeUpsertDirtyCheck, executeNodeUpsertUpdate, executeNodeUpdateWhere, executeNodeUpdate, executeNodeCreateNoReturnBatch, executeNodeCreateBatch, executeNodeCreate, rowToEdge, assertValidityEndMutation, assertClearValidToSupported, runHookedWritePlan, edgeWritePlan, runWritePlan, edgeWriteNeedsConstraintFence, withAlreadyExistsTranslation, createEdgeBatchValidationBackend, rowToNodeMeta, rowToEdgeMeta, unfencedTarget, validityEndAfterMutation, checkCardinalityConstraint, assertsStoredWindowState } from './chunk-2GIV5X4P.js';
|
|
3
|
+
import { storeRuntime, STORE_RUNTIME, applyResolvedNodeClaims, TRANSACTION_RUNTIME, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, getEmbeddingFields, computeFulltextContent } from './chunk-VTJVMP4I.js';
|
|
4
|
+
import { edgeCardinalityClaimTarget, edgeCardinalityClaim } from './chunk-YA36ABIL.js';
|
|
5
|
+
import { loadAndMergeGraphExtensionDocument, serializeSchema, buildKindRegistry, ensureIdentitySchemaStorage, loadAndVerifyGraph, identitySchemaCommitPreflight, getSchemaChanges, requiresMigration, mergeGraphExtension, commitNewSchemaVersion, commitNewSchemaVersionWithPreflight, parseSerializedSchema, planRemovals, stripGraphExtension, applyDeprecatedKinds, identityKindCascadeNeeded, ensureSchema, loadActiveSchemaWithBootstrap, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, commitNewSchemaVersionIfKindsEmpty, serializeIndexDeclaration } from './chunk-2Q45FAIE.js';
|
|
6
|
+
import { getTypeName } from './chunk-7OWE7WD6.js';
|
|
7
|
+
import { rebuildIdentityClosureForContext, loadCurrentStructuralClasses, loadAssertionsByIds, toTransferAssertion, liveNodeKindsSharingIds, createIdentityFacade, createIdentityReadFacade, validateIdentityForContext, removeIdentityKindsForContext, readIdentityAssertionsForInterchange, readIdentityAssertionPageAtTarget, lockIdentityGraph, foldIdentityForCreatedNodes, importIdentityAssertionsIntoTarget, assertAffectedIdentityClassesConsistent, applyIdentityChangesForContext, refKey, requireNodeValidityEndCompatible, detachIdentityForNode } from './chunk-GVYVGGPJ.js';
|
|
8
|
+
import { isParameterRef, resolveParameterValueType, fieldRef, buildFieldBuilderForTypeInfo, stringField, createFulltextAccessor, CURRENT_READ_INSTANT_PLACEHOLDER, withPinnedReadInstant, assertRevisionTrackableBackend, createRecordedBackend, lockRecordedGraphWrite, runInWriteTransaction, createRecordedTransactionScope, readRecordedClock, ensureRevisionOrigin, withRecordedFlushObserver, withWriteTransactionSession, recordedCaptureRequiresCallbackTransactionError, assertRecordedCaptureTransactionIsolation, lockSchemaVersionForStoreWrite, generateId, assertCurrentRecordedSchema, baseField, objectField, arrayField, dateField, numberField, advanceRevisionClock, validateEdgeProps, sqlValueList, getNodeRowsByIds, getEdgeRowsByIds, compileKindFilter, 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-FX5ZW6PN.js';
|
|
9
|
+
import { withRecordedRelationsPrecondition, projectGraphBackend, deriveBackend, canonicalEqual, sortedReplacer, projectBackend, chunk, postgresReadWriteRefusedSqlState, isMissingTableError, groupBy, postgresTemporaryTableUnavailableSqlState, isPostgresConcurrentDdlRaceError } from './chunk-IRPYOHRC.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-Y55DLLEG.js';
|
|
11
|
+
import { runOptionallyInTransaction, createTransactionReadBackend, rowPropsToObject, INTERNAL_TEMPORARY_WRITES } from './chunk-PALYTHGM.js';
|
|
12
|
+
import { isKnownKind } from './chunk-DI6VC62F.js';
|
|
13
|
+
import { compareClaimTargets, encodeTupleKey, uniquenessClaimTarget, subClassComponent, isSameClaimOwner, DISJOINT_CONSTRAINT_NAME, disjointnessClaimAxis, validateEdgeEndpoints } from './chunk-5LKOVCPP.js';
|
|
14
|
+
import { resolveReadCoordinate, withRecordedCoordinate, describeCoordinate, coordinateContext, recordedInstantWallTime, asRecordedInstant, assertValidRecordedInstant, optionalRecordedInstantParts } from './chunk-6NKSE5AU.js';
|
|
15
|
+
import { nowIso, validityWindowContainsInstant, validateOptionalCanonicalIsoDate, assertOrderedValidityWindow, preservesImmutableLowerBound, assertWritableValidityWindow, isCanonicalIsoDate, statedBoundMatchesStored } from './chunk-K46SDNQD.js';
|
|
16
|
+
import { generateIndexDDL } from './chunk-WQBAQZHR.js';
|
|
17
|
+
import { SYSTEM_INDEX_DECLARATIONS, resolveSystemIndexTableName, systemIndexName, resolveSystemIndexNames, generateSystemIndexDDL } from './chunk-H3XP6BAV.js';
|
|
18
|
+
import { NODE_META_KEYS, EDGE_META_KEYS } from './chunk-ZRJTM7MT.js';
|
|
19
19
|
import { sha256Hex, fnv1aBase36 } from './chunk-K34OPSJK.js';
|
|
20
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';
|
|
21
|
-
import { getDialect, assertVectorMinScore, assertApproximateMetricSupported, vectorScoreExpression, vectorMinScoreCondition } from './chunk-
|
|
22
|
-
import { isSqlPlaceholder, bindSqlValue, markAnnIndexScan, asCompiledSelectSql, isRawExecutable, renderSql, annIndexScanTypes, sql, asCompiledRowsSql, markForceCustomPlan, asCompiledStatementSql, asCompiledTemporaryStatementSql } from './chunk-
|
|
21
|
+
import { getDialect, assertVectorMinScore, assertApproximateMetricSupported, vectorScoreExpression, vectorMinScoreCondition } from './chunk-EDLKIQRI.js';
|
|
22
|
+
import { isSqlPlaceholder, bindSqlValue, markAnnIndexScan, asCompiledSelectSql, isRawExecutable, renderSql, annIndexScanTypes, sql, asCompiledRowsSql, markForceCustomPlan, asCompiledStatementSql, asCompiledTemporaryStatementSql } from './chunk-46UGOVRW.js';
|
|
23
23
|
import { createSchemaIntrospector } from './chunk-AMKPPFUO.js';
|
|
24
24
|
import { resolveEmbeddingFields, resolveGraphVectorSlots, resolveDeclaredFulltextLanguage, getSearchableFields } from './chunk-PC2UBAUB.js';
|
|
25
|
-
import { IncompatibleChangeError } from './chunk-
|
|
25
|
+
import { IncompatibleChangeError } from './chunk-XZW2CTNO.js';
|
|
26
26
|
import { META_EDGE_DISJOINT_WITH, META_EDGE_EQUIVALENT_TO, META_EDGE_SAME_AS, META_EDGE_SUB_CLASS_OF } from './chunk-JXXDZTMN.js';
|
|
27
|
-
import { validateProjectionField } from './chunk-
|
|
28
|
-
import {
|
|
27
|
+
import { validateProjectionField } from './chunk-FZHF5UWR.js';
|
|
28
|
+
import { compareStrings, compareCodePoints } from './chunk-HZUB5CON.js';
|
|
29
|
+
import { ConfigurationError, UnsupportedPredicateError, ValidationError, KindNotFoundError, EndpointError, EagerMaterializationError, ContributionRebuildUnsupportedError, CompilerInvariantError, CardinalityError, DatabaseOperationError, EdgeNotFoundError, MigrationError, EDGE_IDENTITY_MISMATCH_CODE, UnsupportedBackendCapabilityError, EndpointNotFoundError, GraphAlgorithmConvergenceError, InvalidEdgeWeightError } from './chunk-YDEJQWOL.js';
|
|
29
30
|
import { jsonPointer, parseJsonPointer, resolveJsonPointer } from './chunk-FWJKWH6U.js';
|
|
30
31
|
import { readOwnProperty, requireDefined, createDataKeyedBag, isInteropProbeKey, hasOwnKey, isPresent } from './chunk-DYATYRY4.js';
|
|
31
32
|
|
|
@@ -13918,6 +13919,155 @@ function createGraphAlgorithms(params) {
|
|
|
13918
13919
|
};
|
|
13919
13920
|
}
|
|
13920
13921
|
|
|
13922
|
+
// src/store/claims/verify.ts
|
|
13923
|
+
function uniquenessAxisGroups(graph, registry) {
|
|
13924
|
+
const groups = /* @__PURE__ */ new Map();
|
|
13925
|
+
for (const [kind, registration] of Object.entries(graph.nodes)) {
|
|
13926
|
+
for (const constraint of registration.unique ?? []) {
|
|
13927
|
+
const target = uniquenessClaimTarget(kind, constraint.scope, registry);
|
|
13928
|
+
const coveredKinds = constraint.scope === "kind" ? [kind] : subClassComponent(kind, registry);
|
|
13929
|
+
const identity = `${constraint.name}\0${target.axis}`;
|
|
13930
|
+
const existing = groups.get(identity);
|
|
13931
|
+
groups.set(identity, {
|
|
13932
|
+
constraintName: constraint.name,
|
|
13933
|
+
axis: target.axis,
|
|
13934
|
+
coveredKinds: /* @__PURE__ */ new Set([
|
|
13935
|
+
...existing?.coveredKinds ?? [],
|
|
13936
|
+
...coveredKinds
|
|
13937
|
+
])
|
|
13938
|
+
});
|
|
13939
|
+
}
|
|
13940
|
+
}
|
|
13941
|
+
return [...groups.values()];
|
|
13942
|
+
}
|
|
13943
|
+
function uniquenessAxisFor(row, groups) {
|
|
13944
|
+
const covering = groups.filter(
|
|
13945
|
+
(group) => group.constraintName === row.constraintName && group.coveredKinds.has(row.nodeKind)
|
|
13946
|
+
).toSorted(
|
|
13947
|
+
(left, right) => right.coveredKinds.size - left.coveredKinds.size || compareStrings(left.axis, right.axis)
|
|
13948
|
+
);
|
|
13949
|
+
return covering[0]?.axis ?? row.nodeKind;
|
|
13950
|
+
}
|
|
13951
|
+
function sortedOwners(owners) {
|
|
13952
|
+
return owners.toSorted(
|
|
13953
|
+
(left, right) => compareStrings(left.concreteKind, right.concreteKind) || compareStrings(left.nodeId, right.nodeId)
|
|
13954
|
+
);
|
|
13955
|
+
}
|
|
13956
|
+
function targetIdentity(target) {
|
|
13957
|
+
return [
|
|
13958
|
+
target.relation,
|
|
13959
|
+
target.axis,
|
|
13960
|
+
target.constraintName ?? "",
|
|
13961
|
+
target.key
|
|
13962
|
+
].join("\0");
|
|
13963
|
+
}
|
|
13964
|
+
function uniquenessViolations(rows, groups, graphId) {
|
|
13965
|
+
const byAxis = /* @__PURE__ */ new Map();
|
|
13966
|
+
for (const row of rows) {
|
|
13967
|
+
const target = {
|
|
13968
|
+
relation: "uniques",
|
|
13969
|
+
graphId,
|
|
13970
|
+
axis: uniquenessAxisFor(row, groups),
|
|
13971
|
+
constraintName: row.constraintName,
|
|
13972
|
+
key: row.key
|
|
13973
|
+
};
|
|
13974
|
+
const identity = targetIdentity(target);
|
|
13975
|
+
const entry2 = byAxis.get(identity) ?? { target, owners: [] };
|
|
13976
|
+
const owner = {
|
|
13977
|
+
concreteKind: row.concreteKind,
|
|
13978
|
+
nodeId: row.nodeId
|
|
13979
|
+
};
|
|
13980
|
+
if (!entry2.owners.some((held) => isSameClaimOwner(held, owner)))
|
|
13981
|
+
entry2.owners.push(owner);
|
|
13982
|
+
byAxis.set(identity, entry2);
|
|
13983
|
+
}
|
|
13984
|
+
return [...byAxis.values()].filter((entry2) => entry2.owners.length > 1).map((entry2) => ({
|
|
13985
|
+
family: "nodeUniqueness",
|
|
13986
|
+
target: entry2.target,
|
|
13987
|
+
owners: sortedOwners(entry2.owners)
|
|
13988
|
+
}));
|
|
13989
|
+
}
|
|
13990
|
+
function disjointnessViolations(overlaps, registry, graphId) {
|
|
13991
|
+
return overlaps.map((overlap) => ({
|
|
13992
|
+
family: "nodeDisjointness",
|
|
13993
|
+
target: {
|
|
13994
|
+
relation: "uniques",
|
|
13995
|
+
graphId,
|
|
13996
|
+
axis: disjointnessClaimAxis(overlap.kinds[0], overlap.kinds[1], registry),
|
|
13997
|
+
constraintName: DISJOINT_CONSTRAINT_NAME,
|
|
13998
|
+
key: overlap.nodeId
|
|
13999
|
+
},
|
|
14000
|
+
owners: sortedOwners([
|
|
14001
|
+
{ concreteKind: overlap.kinds[0], nodeId: overlap.nodeId },
|
|
14002
|
+
{ concreteKind: overlap.kinds[1], nodeId: overlap.nodeId }
|
|
14003
|
+
])
|
|
14004
|
+
}));
|
|
14005
|
+
}
|
|
14006
|
+
function edgeCardinalityViolations(rows, graphId) {
|
|
14007
|
+
const byAxis = /* @__PURE__ */ new Map();
|
|
14008
|
+
for (const row of rows) {
|
|
14009
|
+
const target = edgeCardinalityClaimTarget({ ...row, graphId });
|
|
14010
|
+
const identity = targetIdentity(target);
|
|
14011
|
+
const entry2 = byAxis.get(identity) ?? { target, edgeIds: [] };
|
|
14012
|
+
entry2.edgeIds.push(row.edgeId);
|
|
14013
|
+
byAxis.set(identity, entry2);
|
|
14014
|
+
}
|
|
14015
|
+
return [...byAxis.values()].filter((entry2) => entry2.edgeIds.length > 1).map((entry2) => ({
|
|
14016
|
+
family: "edgeCardinality",
|
|
14017
|
+
target: entry2.target,
|
|
14018
|
+
edgeIds: entry2.edgeIds.toSorted(
|
|
14019
|
+
(left, right) => compareStrings(left, right)
|
|
14020
|
+
)
|
|
14021
|
+
}));
|
|
14022
|
+
}
|
|
14023
|
+
function fenceDeclarations(graph, registry, graphId) {
|
|
14024
|
+
const uniqueConstraintNames = new Set(
|
|
14025
|
+
Object.values(graph.nodes).flatMap(
|
|
14026
|
+
(registration) => (registration.unique ?? []).map((constraint) => constraint.name)
|
|
14027
|
+
)
|
|
14028
|
+
);
|
|
14029
|
+
const edgeCardinalities = Object.entries(graph.edges).flatMap(
|
|
14030
|
+
([edgeKind, registration]) => {
|
|
14031
|
+
const cardinality = registration.cardinality ?? "many";
|
|
14032
|
+
return cardinality === "many" ? [] : [{ edgeKind, cardinality }];
|
|
14033
|
+
}
|
|
14034
|
+
);
|
|
14035
|
+
return {
|
|
14036
|
+
graphId,
|
|
14037
|
+
uniqueConstraintNames: [...uniqueConstraintNames],
|
|
14038
|
+
disjointKindPairs: registry.disjointKindPairs(),
|
|
14039
|
+
edgeCardinalities
|
|
14040
|
+
};
|
|
14041
|
+
}
|
|
14042
|
+
async function verifyConstraintFences(context) {
|
|
14043
|
+
const audit = context.backend.readConstraintFenceViolations;
|
|
14044
|
+
if (audit === void 0) {
|
|
14045
|
+
throw new ConfigurationError(
|
|
14046
|
+
"This backend cannot audit constraint fences: it does not implement `readConstraintFenceViolations`.",
|
|
14047
|
+
{ code: "CONSTRAINT_FENCE_AUDIT_UNSUPPORTED" },
|
|
14048
|
+
{
|
|
14049
|
+
suggestion: "Run the audit through a backend built by `createSqliteBackend` or `createPostgresBackend`, or implement the member."
|
|
14050
|
+
}
|
|
14051
|
+
);
|
|
14052
|
+
}
|
|
14053
|
+
const declarations = fenceDeclarations(
|
|
14054
|
+
context.graph,
|
|
14055
|
+
context.registry,
|
|
14056
|
+
context.graphId
|
|
14057
|
+
);
|
|
14058
|
+
const rows = await audit(declarations);
|
|
14059
|
+
const groups = uniquenessAxisGroups(context.graph, context.registry);
|
|
14060
|
+
return [
|
|
14061
|
+
...uniquenessViolations(rows.contendedUniqueRows, groups, context.graphId),
|
|
14062
|
+
...disjointnessViolations(
|
|
14063
|
+
rows.disjointOverlaps,
|
|
14064
|
+
context.registry,
|
|
14065
|
+
context.graphId
|
|
14066
|
+
),
|
|
14067
|
+
...edgeCardinalityViolations(rows.contendedEdgeRows, context.graphId)
|
|
14068
|
+
].toSorted((left, right) => compareClaimTargets(left.target, right.target));
|
|
14069
|
+
}
|
|
14070
|
+
|
|
13921
14071
|
// src/store/operations/edge-identity.ts
|
|
13922
14072
|
function edgeIdentityFromRow(row) {
|
|
13923
14073
|
return {
|
|
@@ -15135,6 +15285,12 @@ var HISTORY_STORE_BACKEND_KEYS = [
|
|
|
15135
15285
|
"capabilities",
|
|
15136
15286
|
"checkUnique",
|
|
15137
15287
|
"checkUniqueBatch",
|
|
15288
|
+
// The edge cardinality fence. Both members write only the claim relation —
|
|
15289
|
+
// a reservation whose holder is a graph row, never a graph row itself — so
|
|
15290
|
+
// neither can bypass a capture flush, and a history-enabled store that could
|
|
15291
|
+
// not reach them would write constrained edges unfenced.
|
|
15292
|
+
"claimEdgeCardinality",
|
|
15293
|
+
"claimEdgeCardinalityBatch",
|
|
15138
15294
|
"claimIndexMaterialization",
|
|
15139
15295
|
"close",
|
|
15140
15296
|
"commitSchemaVersion",
|
|
@@ -15159,12 +15315,19 @@ var HISTORY_STORE_BACKEND_KEYS = [
|
|
|
15159
15315
|
"dropVectorIndex",
|
|
15160
15316
|
"edgeExistsBetween",
|
|
15161
15317
|
"ensureContributionMaterializationsTable",
|
|
15318
|
+
// Installs a database-global extension — and `ensureTrigramExtension` is the
|
|
15319
|
+
// same operation under its deprecated `pg_trgm`-only name, so the two are
|
|
15320
|
+
// classified together or not at all. Like the `ensure*Table` members they sit
|
|
15321
|
+
// beside, they create storage-level scaffolding and write no graph row, so
|
|
15322
|
+
// neither can bypass a capture flush.
|
|
15323
|
+
"ensureExtension",
|
|
15162
15324
|
"ensureFulltextTable",
|
|
15163
15325
|
"ensureIndexMaterializationsTable",
|
|
15164
15326
|
"ensureKindRemovalsTable",
|
|
15165
15327
|
"ensureReconciliationMarkersTable",
|
|
15166
15328
|
"ensureRevisionOriginsTable",
|
|
15167
15329
|
"ensureRuntimeContributions",
|
|
15330
|
+
"ensureTrigramExtension",
|
|
15168
15331
|
"ensureVectorSlotContribution",
|
|
15169
15332
|
"ensureVectorSlotContributions",
|
|
15170
15333
|
"execute",
|
|
@@ -15191,6 +15354,10 @@ var HISTORY_STORE_BACKEND_KEYS = [
|
|
|
15191
15354
|
"hardDeleteEdge",
|
|
15192
15355
|
"hardDeleteEdgesBatch",
|
|
15193
15356
|
"hardDeleteNode",
|
|
15357
|
+
// Reaps the claims a removed kind's nodes own. Like the sibling
|
|
15358
|
+
// `hardDeleteUniquesByNodeIds` beside it, it clears sidecar rows whose
|
|
15359
|
+
// entity rows are already gone, so it cannot bypass a capture flush.
|
|
15360
|
+
"hardDeleteUniquesByConcreteKind",
|
|
15194
15361
|
"hardDeleteUniquesByNodeIds",
|
|
15195
15362
|
"hybridSearch",
|
|
15196
15363
|
"insertEdge",
|
|
@@ -15204,6 +15371,13 @@ var HISTORY_STORE_BACKEND_KEYS = [
|
|
|
15204
15371
|
"insertUnique",
|
|
15205
15372
|
"insertUniqueBatch",
|
|
15206
15373
|
"probeContributions",
|
|
15374
|
+
// Housekeeping for the relation above: drops claim rows whose holders are
|
|
15375
|
+
// already gone. Writes no graph row.
|
|
15376
|
+
"purgeEdgeClaims",
|
|
15377
|
+
// Read-only fence audit. Writes nothing at all, so it can bypass no capture
|
|
15378
|
+
// flush, and a history-enabled store that could not reach it would have no
|
|
15379
|
+
// way to report which declared constraint its data already violates.
|
|
15380
|
+
"readConstraintFenceViolations",
|
|
15207
15381
|
"recordContributionMaterialization",
|
|
15208
15382
|
"recordIndexMaterialization",
|
|
15209
15383
|
"recordKindRemoval",
|
|
@@ -15348,6 +15522,10 @@ function delay(ms) {
|
|
|
15348
15522
|
});
|
|
15349
15523
|
}
|
|
15350
15524
|
async function ensureTrigramExtension(backend) {
|
|
15525
|
+
if (backend.ensureExtension !== void 0) {
|
|
15526
|
+
await backend.ensureExtension("pg_trgm");
|
|
15527
|
+
return;
|
|
15528
|
+
}
|
|
15351
15529
|
if (backend.ensureTrigramExtension !== void 0) {
|
|
15352
15530
|
await backend.ensureTrigramExtension();
|
|
15353
15531
|
return;
|
|
@@ -16073,6 +16251,7 @@ async function materializeRemovals(context, options = {}) {
|
|
|
16073
16251
|
const edgesTable = tableNames?.edges ?? "typegraph_edges";
|
|
16074
16252
|
const fulltextTable = tableNames?.fulltext ?? "typegraph_node_fulltext";
|
|
16075
16253
|
const uniquesTable = tableNames?.uniques ?? "typegraph_node_uniques";
|
|
16254
|
+
const edgeClaimsTable = tableNames?.edgeClaims ?? "typegraph_edge_claims";
|
|
16076
16255
|
const captureRecordedRemovals = context.captureRecordedRemovals === true;
|
|
16077
16256
|
const ctx = {
|
|
16078
16257
|
backend,
|
|
@@ -16081,6 +16260,7 @@ async function materializeRemovals(context, options = {}) {
|
|
|
16081
16260
|
edgesTable,
|
|
16082
16261
|
fulltextTable,
|
|
16083
16262
|
uniquesTable,
|
|
16263
|
+
edgeClaimsTable,
|
|
16084
16264
|
captureRecordedRemovals,
|
|
16085
16265
|
recordedSchema: captureRecordedRemovals ? context.recordedSchema ?? createSqlSchema(backend.tableNames) : void 0
|
|
16086
16266
|
};
|
|
@@ -16236,7 +16416,12 @@ async function materializeOne2(row, ctx) {
|
|
|
16236
16416
|
}
|
|
16237
16417
|
}
|
|
16238
16418
|
async function closeRecordedAndDeleteLiveRows(ctx, row, target) {
|
|
16239
|
-
const
|
|
16419
|
+
const reapsEdgeClaims = await target.tableExists(ctx.edgeClaimsTable);
|
|
16420
|
+
const deleteStatements = buildRemovedKindLiveDeleteStatements(
|
|
16421
|
+
ctx,
|
|
16422
|
+
row,
|
|
16423
|
+
reapsEdgeClaims
|
|
16424
|
+
);
|
|
16240
16425
|
if (!ctx.captureRecordedRemovals || ctx.recordedSchema === void 0) {
|
|
16241
16426
|
await executeDeleteStatements(target, deleteStatements);
|
|
16242
16427
|
return;
|
|
@@ -16263,24 +16448,54 @@ async function closeRecordedAndDeleteLiveRows(ctx, row, target) {
|
|
|
16263
16448
|
);
|
|
16264
16449
|
await executeDeleteStatements(target, deleteStatements);
|
|
16265
16450
|
}
|
|
16266
|
-
function buildRemovedKindLiveDeleteStatements(ctx, row) {
|
|
16451
|
+
function buildRemovedKindLiveDeleteStatements(ctx, row, reapsEdgeClaims) {
|
|
16267
16452
|
const graphLit = literal(ctx.graphId);
|
|
16268
16453
|
const kindLit = literal(row.kindName);
|
|
16269
16454
|
if (row.entity === "node") {
|
|
16270
16455
|
return [
|
|
16271
|
-
|
|
16272
|
-
|
|
16273
|
-
|
|
16274
|
-
|
|
16456
|
+
// Must precede the edge delete: ownership is discovered by selecting the
|
|
16457
|
+
// connected edge ids, which no longer exist afterward.
|
|
16458
|
+
...reapsEdgeClaims ? [
|
|
16459
|
+
buildHardDeleteEdgeClaimsByNodeKind(
|
|
16460
|
+
ctx.edgeClaimsTable,
|
|
16461
|
+
ctx.edgesTable,
|
|
16462
|
+
{ graphId: ctx.graphId, nodeKind: row.kindName }
|
|
16463
|
+
)
|
|
16464
|
+
] : [],
|
|
16465
|
+
sql.raw(
|
|
16466
|
+
`DELETE FROM ${quote(ctx.nodesTable)} WHERE graph_id = ${graphLit} AND kind = ${kindLit}`
|
|
16467
|
+
),
|
|
16468
|
+
sql.raw(
|
|
16469
|
+
`DELETE FROM ${quote(ctx.edgesTable)} WHERE graph_id = ${graphLit} AND (from_kind = ${kindLit} OR to_kind = ${kindLit})`
|
|
16470
|
+
),
|
|
16471
|
+
sql.raw(
|
|
16472
|
+
`DELETE FROM ${quote(ctx.fulltextTable)} WHERE graph_id = ${graphLit} AND node_kind = ${kindLit}`
|
|
16473
|
+
),
|
|
16474
|
+
buildHardDeleteUniquesByConcreteKind(ctx.uniquesTable, {
|
|
16475
|
+
graphId: ctx.graphId,
|
|
16476
|
+
concreteKind: row.kindName
|
|
16477
|
+
})
|
|
16275
16478
|
];
|
|
16276
16479
|
}
|
|
16277
16480
|
return [
|
|
16278
|
-
|
|
16481
|
+
sql.raw(
|
|
16482
|
+
`DELETE FROM ${quote(ctx.edgesTable)} WHERE graph_id = ${graphLit} AND kind = ${kindLit}`
|
|
16483
|
+
),
|
|
16484
|
+
// Housekeeping, on the same one-owner terms as the uniqueness reap: the
|
|
16485
|
+
// rows this kind's edges held are takeable the moment those edges are gone,
|
|
16486
|
+
// but nothing would ever reap them, so the relation would grow by one row
|
|
16487
|
+
// per removed constrained kind forever.
|
|
16488
|
+
...reapsEdgeClaims ? [
|
|
16489
|
+
buildHardDeleteEdgeClaimsByEdgeKind(ctx.edgeClaimsTable, {
|
|
16490
|
+
graphId: ctx.graphId,
|
|
16491
|
+
edgeKind: row.kindName
|
|
16492
|
+
})
|
|
16493
|
+
] : []
|
|
16279
16494
|
];
|
|
16280
16495
|
}
|
|
16281
16496
|
async function executeDeleteStatements(target, statements) {
|
|
16282
16497
|
for (const statement of statements) {
|
|
16283
|
-
await target.executeStatement(asCompiledStatementSql(
|
|
16498
|
+
await target.executeStatement(asCompiledStatementSql(statement));
|
|
16284
16499
|
}
|
|
16285
16500
|
}
|
|
16286
16501
|
async function dropEmbeddingTableStorage(ctx, row, target) {
|
|
@@ -16443,6 +16658,39 @@ function literal(value) {
|
|
|
16443
16658
|
return `'${value.replaceAll("'", "''")}'`;
|
|
16444
16659
|
}
|
|
16445
16660
|
|
|
16661
|
+
// src/store/operations/edge-write-fences.ts
|
|
16662
|
+
var EdgeUpdateTargetMoved = class extends Error {
|
|
16663
|
+
constructor(kind, id) {
|
|
16664
|
+
super(
|
|
16665
|
+
`The ${kind} edge "${id}" was replaced between this update's read and its write; re-resolving it. This is internal and is never returned to a caller.`
|
|
16666
|
+
);
|
|
16667
|
+
this.name = "EdgeUpdateTargetMoved";
|
|
16668
|
+
}
|
|
16669
|
+
};
|
|
16670
|
+
function isEdgeUpdateNoRowError(error) {
|
|
16671
|
+
return error instanceof DatabaseOperationError && error.details.operation === "update" && error.details.entity === "edge" && error.details.reason === "no_row_returned";
|
|
16672
|
+
}
|
|
16673
|
+
async function withUnmatchedEdgeUpdateRefusal(graphId, target, id, expected, assertedValidFrom, write) {
|
|
16674
|
+
try {
|
|
16675
|
+
return await write();
|
|
16676
|
+
} catch (error) {
|
|
16677
|
+
if (!isEdgeUpdateNoRowError(error)) throw error;
|
|
16678
|
+
const current = await target.getEdge(graphId, id);
|
|
16679
|
+
if (current !== void 0) {
|
|
16680
|
+
assertEdgeIdentityMatches(
|
|
16681
|
+
id,
|
|
16682
|
+
expected,
|
|
16683
|
+
edgeIdentityFromRow(current),
|
|
16684
|
+
"update"
|
|
16685
|
+
);
|
|
16686
|
+
if (assertedValidFrom && current.deleted_at === void 0) {
|
|
16687
|
+
throw new EdgeUpdateTargetMoved(expected.kind, id);
|
|
16688
|
+
}
|
|
16689
|
+
}
|
|
16690
|
+
throw new EdgeNotFoundError(expected.kind, id);
|
|
16691
|
+
}
|
|
16692
|
+
}
|
|
16693
|
+
|
|
16446
16694
|
// src/store/operations/edge-operations.ts
|
|
16447
16695
|
function getEdgeRegistration(graph, kind) {
|
|
16448
16696
|
if (!hasOwnKey(graph.edges, kind)) throw new KindNotFoundError(kind, "edge");
|
|
@@ -16450,24 +16698,15 @@ function getEdgeRegistration(graph, kind) {
|
|
|
16450
16698
|
if (registration === void 0) throw new KindNotFoundError(kind, "edge");
|
|
16451
16699
|
return registration;
|
|
16452
16700
|
}
|
|
16453
|
-
function
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
|
|
16459
|
-
|
|
16460
|
-
|
|
16461
|
-
}
|
|
16462
|
-
function buildCountEdgesFromCacheKey(params) {
|
|
16463
|
-
const activeOnly = params.activeOnly === true ? "1" : "0";
|
|
16464
|
-
return encodeTupleKey([
|
|
16465
|
-
params.graphId,
|
|
16466
|
-
params.edgeKind,
|
|
16467
|
-
params.fromKind,
|
|
16468
|
-
params.fromId,
|
|
16469
|
-
activeOnly
|
|
16470
|
-
]);
|
|
16701
|
+
function edgeInsertWork(prepared) {
|
|
16702
|
+
const claim = edgeCardinalityClaim(
|
|
16703
|
+
prepared.cardinality,
|
|
16704
|
+
prepared.insertParams
|
|
16705
|
+
);
|
|
16706
|
+
return {
|
|
16707
|
+
params: prepared.insertParams,
|
|
16708
|
+
...claim === void 0 ? {} : { claim }
|
|
16709
|
+
};
|
|
16471
16710
|
}
|
|
16472
16711
|
function buildInsertEdgeParams(graphId, id, kind, fromKind, fromId, toKind, toId, props, validFrom, validTo) {
|
|
16473
16712
|
const insertParams = {
|
|
@@ -16484,106 +16723,6 @@ function buildInsertEdgeParams(graphId, id, kind, fromKind, fromId, toKind, toId
|
|
|
16484
16723
|
if (validTo !== void 0) insertParams.validTo = validTo;
|
|
16485
16724
|
return insertParams;
|
|
16486
16725
|
}
|
|
16487
|
-
function incrementPendingCount(counts, key) {
|
|
16488
|
-
const previous = counts.get(key) ?? 0;
|
|
16489
|
-
counts.set(key, previous + 1);
|
|
16490
|
-
}
|
|
16491
|
-
function createEdgeBatchValidationBackend(backend) {
|
|
16492
|
-
const endpointCache = /* @__PURE__ */ new Map();
|
|
16493
|
-
const countEdgesFromCache = /* @__PURE__ */ new Map();
|
|
16494
|
-
const edgeExistsCache = /* @__PURE__ */ new Map();
|
|
16495
|
-
const pendingOneCounts = /* @__PURE__ */ new Map();
|
|
16496
|
-
const pendingOneActiveCounts = /* @__PURE__ */ new Map();
|
|
16497
|
-
const pendingUniquePairs = /* @__PURE__ */ new Set();
|
|
16498
|
-
async function getNodeCached(graphId, kind, id) {
|
|
16499
|
-
const cacheKey = buildEdgeEndpointCacheKey(graphId, kind, id);
|
|
16500
|
-
if (endpointCache.has(cacheKey)) {
|
|
16501
|
-
return endpointCache.get(cacheKey);
|
|
16502
|
-
}
|
|
16503
|
-
const node = await backend.getNode(graphId, kind, id);
|
|
16504
|
-
endpointCache.set(cacheKey, node);
|
|
16505
|
-
return node;
|
|
16506
|
-
}
|
|
16507
|
-
function seedEndpointRow(graphId, kind, id, row) {
|
|
16508
|
-
const cacheKey = buildEdgeEndpointCacheKey(graphId, kind, id);
|
|
16509
|
-
if (endpointCache.has(cacheKey)) return;
|
|
16510
|
-
endpointCache.set(cacheKey, row);
|
|
16511
|
-
}
|
|
16512
|
-
async function countEdgesFromCached(params) {
|
|
16513
|
-
const cacheKey = buildCountEdgesFromCacheKey(params);
|
|
16514
|
-
let baseCount = countEdgesFromCache.get(cacheKey);
|
|
16515
|
-
if (baseCount === void 0) {
|
|
16516
|
-
baseCount = await backend.countEdgesFrom(params);
|
|
16517
|
-
countEdgesFromCache.set(cacheKey, baseCount);
|
|
16518
|
-
}
|
|
16519
|
-
const pendingKey = buildEdgeFromCacheKey(
|
|
16520
|
-
params.graphId,
|
|
16521
|
-
params.edgeKind,
|
|
16522
|
-
params.fromKind,
|
|
16523
|
-
params.fromId
|
|
16524
|
-
);
|
|
16525
|
-
const pendingCount = params.activeOnly === true ? pendingOneActiveCounts.get(pendingKey) ?? 0 : pendingOneCounts.get(pendingKey) ?? 0;
|
|
16526
|
-
return baseCount + pendingCount;
|
|
16527
|
-
}
|
|
16528
|
-
async function edgeExistsBetweenCached(params) {
|
|
16529
|
-
const cacheKey = buildEdgeBetweenCacheKey(
|
|
16530
|
-
params.graphId,
|
|
16531
|
-
params.edgeKind,
|
|
16532
|
-
params.fromKind,
|
|
16533
|
-
params.fromId,
|
|
16534
|
-
params.toKind,
|
|
16535
|
-
params.toId
|
|
16536
|
-
);
|
|
16537
|
-
if (pendingUniquePairs.has(cacheKey)) {
|
|
16538
|
-
return true;
|
|
16539
|
-
}
|
|
16540
|
-
if (edgeExistsCache.has(cacheKey)) {
|
|
16541
|
-
return edgeExistsCache.get(cacheKey) ?? false;
|
|
16542
|
-
}
|
|
16543
|
-
const exists = await backend.edgeExistsBetween(params);
|
|
16544
|
-
edgeExistsCache.set(cacheKey, exists);
|
|
16545
|
-
return exists;
|
|
16546
|
-
}
|
|
16547
|
-
function registerPendingEdgeForCardinality(insertParams, cardinality) {
|
|
16548
|
-
const fromCacheKey = buildEdgeFromCacheKey(
|
|
16549
|
-
insertParams.graphId,
|
|
16550
|
-
insertParams.kind,
|
|
16551
|
-
insertParams.fromKind,
|
|
16552
|
-
insertParams.fromId
|
|
16553
|
-
);
|
|
16554
|
-
if (cardinality === "one") {
|
|
16555
|
-
incrementPendingCount(pendingOneCounts, fromCacheKey);
|
|
16556
|
-
return;
|
|
16557
|
-
}
|
|
16558
|
-
if (cardinality === "oneActive") {
|
|
16559
|
-
if (insertParams.validTo === void 0) {
|
|
16560
|
-
incrementPendingCount(pendingOneActiveCounts, fromCacheKey);
|
|
16561
|
-
}
|
|
16562
|
-
return;
|
|
16563
|
-
}
|
|
16564
|
-
if (cardinality === "unique") {
|
|
16565
|
-
const uniqueCacheKey = buildEdgeBetweenCacheKey(
|
|
16566
|
-
insertParams.graphId,
|
|
16567
|
-
insertParams.kind,
|
|
16568
|
-
insertParams.fromKind,
|
|
16569
|
-
insertParams.fromId,
|
|
16570
|
-
insertParams.toKind,
|
|
16571
|
-
insertParams.toId
|
|
16572
|
-
);
|
|
16573
|
-
pendingUniquePairs.add(uniqueCacheKey);
|
|
16574
|
-
}
|
|
16575
|
-
}
|
|
16576
|
-
const validationBackend = deriveBackend(backend, {
|
|
16577
|
-
getNode: getNodeCached,
|
|
16578
|
-
countEdgesFrom: countEdgesFromCached,
|
|
16579
|
-
edgeExistsBetween: edgeExistsBetweenCached
|
|
16580
|
-
});
|
|
16581
|
-
return {
|
|
16582
|
-
backend: validationBackend,
|
|
16583
|
-
registerPendingEdgeForCardinality,
|
|
16584
|
-
seedEndpointRow
|
|
16585
|
-
};
|
|
16586
|
-
}
|
|
16587
16726
|
async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
16588
16727
|
const kind = input.kind;
|
|
16589
16728
|
const fromKind = input.fromKind;
|
|
@@ -16676,11 +16815,17 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
16676
16815
|
const opContext = ctx.createOperationContext("create", "edge", kind, id);
|
|
16677
16816
|
const shouldReturnRow = options?.returnRow ?? true;
|
|
16678
16817
|
const convergeOn = options?.convergeOn;
|
|
16679
|
-
return
|
|
16818
|
+
return runHookedWritePlan(
|
|
16680
16819
|
ctx,
|
|
16681
16820
|
opContext,
|
|
16821
|
+
// A create that runs a cardinality probe, or one converging on a match
|
|
16822
|
+
// key, decides something the write must not have invalidated. A plain
|
|
16823
|
+
// `many` create decides nothing and takes no lock.
|
|
16824
|
+
edgeWritePlan(
|
|
16825
|
+
convergeOn === void 0 ? edgeWriteNeedsConstraintFence(edgeCardinality(ctx, kind)) : "edgeMatchKeyConvergence"
|
|
16826
|
+
),
|
|
16682
16827
|
backend,
|
|
16683
|
-
async (target) => {
|
|
16828
|
+
async (session, target) => {
|
|
16684
16829
|
if (convergeOn !== void 0) {
|
|
16685
16830
|
const candidateRows = await target.findEdgesByKind({
|
|
16686
16831
|
graphId: ctx.graphId,
|
|
@@ -16707,21 +16852,13 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
16707
16852
|
id,
|
|
16708
16853
|
target
|
|
16709
16854
|
);
|
|
16855
|
+
const work = edgeInsertWork(prepared);
|
|
16710
16856
|
const row = await withAlreadyExistsTranslation("edge", async () => {
|
|
16711
|
-
if (shouldReturnRow) return
|
|
16712
|
-
await
|
|
16713
|
-
edgeInsertDispatch(target),
|
|
16714
|
-
prepared.insertParams
|
|
16715
|
-
);
|
|
16857
|
+
if (shouldReturnRow) return session.createEdge(work);
|
|
16858
|
+
await session.createEdgeNoReturn(work);
|
|
16716
16859
|
return;
|
|
16717
16860
|
});
|
|
16718
16861
|
return row === void 0 ? void 0 : rowToEdge(row);
|
|
16719
|
-
},
|
|
16720
|
-
{
|
|
16721
|
-
// A create that runs a cardinality probe, or one converging on a match
|
|
16722
|
-
// key, decides something the write must not have invalidated. A plain
|
|
16723
|
-
// `many` create decides nothing and takes no lock.
|
|
16724
|
-
fencesConstraintProbe: convergeOn === void 0 ? edgeWriteNeedsConstraintFence(edgeCardinality(ctx, kind)) : "edgeMatchKeyConvergence"
|
|
16725
16862
|
}
|
|
16726
16863
|
);
|
|
16727
16864
|
}
|
|
@@ -16780,52 +16917,52 @@ async function prepareEdgeBatchCreates(ctx, inputs, backend) {
|
|
|
16780
16917
|
prepared.cardinality
|
|
16781
16918
|
);
|
|
16782
16919
|
}
|
|
16783
|
-
const
|
|
16784
|
-
(prepared) => prepared
|
|
16920
|
+
const batchInsertWork = preparedCreates.map(
|
|
16921
|
+
(prepared) => edgeInsertWork(prepared)
|
|
16785
16922
|
);
|
|
16786
|
-
return { preparedCreates,
|
|
16923
|
+
return { preparedCreates, batchInsertWork };
|
|
16787
16924
|
}
|
|
16788
16925
|
async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
16789
16926
|
if (inputs.length === 0) {
|
|
16790
16927
|
return;
|
|
16791
16928
|
}
|
|
16792
|
-
await
|
|
16929
|
+
await runWritePlan(
|
|
16793
16930
|
ctx,
|
|
16931
|
+
edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
|
|
16794
16932
|
backend,
|
|
16795
|
-
async (target) => {
|
|
16796
|
-
const {
|
|
16933
|
+
async (session, target) => {
|
|
16934
|
+
const { batchInsertWork } = await prepareEdgeBatchCreates(
|
|
16797
16935
|
ctx,
|
|
16798
16936
|
inputs,
|
|
16799
16937
|
target
|
|
16800
16938
|
);
|
|
16801
16939
|
await withAlreadyExistsTranslation(
|
|
16802
16940
|
"edge",
|
|
16803
|
-
() =>
|
|
16941
|
+
() => session.createEdgesNoReturn(batchInsertWork)
|
|
16804
16942
|
);
|
|
16805
|
-
}
|
|
16806
|
-
{ fencesConstraintProbe: batchFencesConstraintProbe(ctx, inputs) }
|
|
16943
|
+
}
|
|
16807
16944
|
);
|
|
16808
16945
|
}
|
|
16809
16946
|
async function executeEdgeCreateBatch(ctx, inputs, backend) {
|
|
16810
16947
|
if (inputs.length === 0) {
|
|
16811
16948
|
return [];
|
|
16812
16949
|
}
|
|
16813
|
-
return
|
|
16950
|
+
return runWritePlan(
|
|
16814
16951
|
ctx,
|
|
16952
|
+
edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
|
|
16815
16953
|
backend,
|
|
16816
|
-
async (target) => {
|
|
16817
|
-
const {
|
|
16954
|
+
async (session, target) => {
|
|
16955
|
+
const { batchInsertWork } = await prepareEdgeBatchCreates(
|
|
16818
16956
|
ctx,
|
|
16819
16957
|
inputs,
|
|
16820
16958
|
target
|
|
16821
16959
|
);
|
|
16822
16960
|
const rows = await withAlreadyExistsTranslation(
|
|
16823
16961
|
"edge",
|
|
16824
|
-
() =>
|
|
16962
|
+
() => session.createEdges(batchInsertWork)
|
|
16825
16963
|
);
|
|
16826
16964
|
return rows.map((row) => rowToEdge(row));
|
|
16827
|
-
}
|
|
16828
|
-
{ fencesConstraintProbe: batchFencesConstraintProbe(ctx, inputs) }
|
|
16965
|
+
}
|
|
16829
16966
|
);
|
|
16830
16967
|
}
|
|
16831
16968
|
function batchFencesConstraintProbe(ctx, inputs) {
|
|
@@ -16869,7 +17006,7 @@ function edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
|
|
|
16869
17006
|
unchanged: canonicalEqual(validatedProps, existingProps)
|
|
16870
17007
|
};
|
|
16871
17008
|
}
|
|
16872
|
-
async function performEdgeUpdate(ctx, input, target, options) {
|
|
17009
|
+
async function performEdgeUpdate(ctx, input, session, target, options) {
|
|
16873
17010
|
const id = input.id;
|
|
16874
17011
|
assertValidityEndMutation(input, {
|
|
16875
17012
|
entityType: "edge",
|
|
@@ -16900,6 +17037,7 @@ async function performEdgeUpdate(ctx, input, target, options) {
|
|
|
16900
17037
|
);
|
|
16901
17038
|
const cardinality = edgeCardinality(ctx, input.identity.kind);
|
|
16902
17039
|
const reentersLivePopulation = options?.clearDeleted === true && existing.deleted_at !== void 0;
|
|
17040
|
+
let reentryClaim;
|
|
16903
17041
|
const reentersActivePopulation = cardinality === "oneActive" && effectiveValidTo === void 0 && (existing.deleted_at !== void 0 || existing.valid_to !== void 0);
|
|
16904
17042
|
if (reentersLivePopulation || reentersActivePopulation) {
|
|
16905
17043
|
await checkCardinalityConstraint(
|
|
@@ -16916,6 +17054,16 @@ async function performEdgeUpdate(ctx, input, target, options) {
|
|
|
16916
17054
|
existing.to_id,
|
|
16917
17055
|
effectiveValidTo
|
|
16918
17056
|
);
|
|
17057
|
+
reentryClaim = edgeCardinalityClaim(cardinality, {
|
|
17058
|
+
graphId: ctx.graphId,
|
|
17059
|
+
id,
|
|
17060
|
+
kind: input.identity.kind,
|
|
17061
|
+
fromKind: existing.from_kind,
|
|
17062
|
+
fromId: existing.from_id,
|
|
17063
|
+
toKind: existing.to_kind,
|
|
17064
|
+
toId: existing.to_id,
|
|
17065
|
+
...effectiveValidTo === void 0 ? {} : { validTo: effectiveValidTo }
|
|
17066
|
+
});
|
|
16919
17067
|
}
|
|
16920
17068
|
const windowVerdict = assertWritableValidityWindow(
|
|
16921
17069
|
`edge "${id}"`,
|
|
@@ -16930,85 +17078,39 @@ async function performEdgeUpdate(ctx, input, target, options) {
|
|
|
16930
17078
|
},
|
|
16931
17079
|
validTo
|
|
16932
17080
|
);
|
|
16933
|
-
const
|
|
16934
|
-
|
|
17081
|
+
const fences = {
|
|
17082
|
+
validityLowerBound: windowVerdict.storedLowerBoundFence,
|
|
17083
|
+
validityUpperBound: reentersActivePopulation && existing.valid_to !== void 0 ? { expectedValidTo: existing.valid_to } : {},
|
|
17084
|
+
edgeIdentity: input.identity
|
|
17085
|
+
};
|
|
17086
|
+
const work = {
|
|
16935
17087
|
id,
|
|
16936
|
-
kind: input.identity.kind,
|
|
16937
17088
|
props: validatedProps,
|
|
16938
|
-
|
|
16939
|
-
//
|
|
16940
|
-
//
|
|
16941
|
-
|
|
16942
|
-
...
|
|
17089
|
+
...appliedValidFrom !== void 0 && { validFrom: appliedValidFrom },
|
|
17090
|
+
// `validTo` and `clearValidTo` are mutually exclusive in the params, so the
|
|
17091
|
+
// work states exactly one of them.
|
|
17092
|
+
...input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo },
|
|
17093
|
+
...options?.clearDeleted === true && { clearDeleted: true },
|
|
17094
|
+
...reentryClaim === void 0 ? {} : { claim: reentryClaim }
|
|
16943
17095
|
};
|
|
16944
|
-
if (input.identity.fromKind !== void 0) {
|
|
16945
|
-
updateParams.fromKind = input.identity.fromKind;
|
|
16946
|
-
}
|
|
16947
|
-
if (input.identity.fromId !== void 0) {
|
|
16948
|
-
updateParams.fromId = input.identity.fromId;
|
|
16949
|
-
}
|
|
16950
|
-
if (input.identity.toKind !== void 0) {
|
|
16951
|
-
updateParams.toKind = input.identity.toKind;
|
|
16952
|
-
}
|
|
16953
|
-
if (input.identity.toId !== void 0) {
|
|
16954
|
-
updateParams.toId = input.identity.toId;
|
|
16955
|
-
}
|
|
16956
|
-
if (appliedValidFrom !== void 0) {
|
|
16957
|
-
updateParams.validFrom = appliedValidFrom;
|
|
16958
|
-
}
|
|
16959
|
-
if (reentersActivePopulation && existing.valid_to !== void 0) {
|
|
16960
|
-
updateParams.expectedValidTo = existing.valid_to;
|
|
16961
|
-
}
|
|
16962
|
-
if (options?.clearDeleted) updateParams.clearDeleted = true;
|
|
16963
17096
|
const row = await withUnmatchedEdgeUpdateRefusal(
|
|
16964
|
-
ctx,
|
|
17097
|
+
ctx.graphId,
|
|
16965
17098
|
target,
|
|
16966
17099
|
id,
|
|
16967
17100
|
input.identity,
|
|
16968
|
-
|
|
16969
|
-
|
|
16970
|
-
|
|
16971
|
-
|
|
16972
|
-
|
|
17101
|
+
// "Did this write assert any window state?" is one predicate with one
|
|
17102
|
+
// owner, consulted here and by the fence appliers that carry it, rather
|
|
17103
|
+
// than re-derived from the params the diagnosis never sees.
|
|
17104
|
+
assertsStoredWindowState(fences),
|
|
17105
|
+
() => session.reviseEdge(work, fences)
|
|
16973
17106
|
);
|
|
16974
17107
|
return rowToEdge(row);
|
|
16975
17108
|
}
|
|
16976
|
-
function isEdgeUpdateNoRowError(error) {
|
|
16977
|
-
return error instanceof DatabaseOperationError && error.details.operation === "update" && error.details.entity === "edge" && error.details.reason === "no_row_returned";
|
|
16978
|
-
}
|
|
16979
|
-
async function withUnmatchedEdgeUpdateRefusal(ctx, target, id, expected, assertedWindowState, write) {
|
|
16980
|
-
try {
|
|
16981
|
-
return await write();
|
|
16982
|
-
} catch (error) {
|
|
16983
|
-
if (!isEdgeUpdateNoRowError(error)) throw error;
|
|
16984
|
-
const current = await target.getEdge(ctx.graphId, id);
|
|
16985
|
-
if (current !== void 0) {
|
|
16986
|
-
assertEdgeIdentityMatches(
|
|
16987
|
-
id,
|
|
16988
|
-
expected,
|
|
16989
|
-
edgeIdentityFromRow(current),
|
|
16990
|
-
"update"
|
|
16991
|
-
);
|
|
16992
|
-
if (assertedWindowState && current.deleted_at === void 0) {
|
|
16993
|
-
throw new EdgeUpdateTargetMoved(expected.kind, id);
|
|
16994
|
-
}
|
|
16995
|
-
}
|
|
16996
|
-
throw new EdgeNotFoundError(expected.kind, id);
|
|
16997
|
-
}
|
|
16998
|
-
}
|
|
16999
|
-
var EdgeUpdateTargetMoved = class extends Error {
|
|
17000
|
-
constructor(kind, id) {
|
|
17001
|
-
super(
|
|
17002
|
-
`The ${kind} edge "${id}" was replaced between this update's read and its write; re-resolving it. This is internal and is never returned to a caller.`
|
|
17003
|
-
);
|
|
17004
|
-
this.name = "EdgeUpdateTargetMoved";
|
|
17005
|
-
}
|
|
17006
|
-
};
|
|
17007
17109
|
var EDGE_UPDATE_ATTEMPTS = 2;
|
|
17008
|
-
async function performEdgeUpdateConverging(ctx, input, target, options) {
|
|
17110
|
+
async function performEdgeUpdateConverging(ctx, input, session, target, options) {
|
|
17009
17111
|
for (let attempt = 1; attempt <= EDGE_UPDATE_ATTEMPTS; attempt += 1) {
|
|
17010
17112
|
try {
|
|
17011
|
-
return await performEdgeUpdate(ctx, input, target, options);
|
|
17113
|
+
return await performEdgeUpdate(ctx, input, session, target, options);
|
|
17012
17114
|
} catch (error) {
|
|
17013
17115
|
if (!(error instanceof EdgeUpdateTargetMoved)) throw error;
|
|
17014
17116
|
if (attempt === EDGE_UPDATE_ATTEMPTS) {
|
|
@@ -17035,29 +17137,38 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
17035
17137
|
"update"
|
|
17036
17138
|
);
|
|
17037
17139
|
const opContext = ctx.createOperationContext("update", "edge", gate.kind, id);
|
|
17038
|
-
|
|
17140
|
+
if (input.clearValidTo === true) {
|
|
17141
|
+
assertClearValidToSupported(backend, "edge");
|
|
17142
|
+
}
|
|
17143
|
+
return runHookedWritePlan(
|
|
17039
17144
|
ctx,
|
|
17040
17145
|
opContext,
|
|
17146
|
+
// An in-place props update on a live edge re-derives no constraint verdict.
|
|
17147
|
+
// Clearing an `oneActive` edge's end DOES: it re-admits the row to the
|
|
17148
|
+
// counted active population.
|
|
17149
|
+
edgeWritePlan(
|
|
17150
|
+
input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? edgeWriteNeedsConstraintFence("oneActive") : void 0
|
|
17151
|
+
),
|
|
17041
17152
|
backend,
|
|
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
|
-
}
|
|
17153
|
+
(session, target) => performEdgeUpdateConverging(ctx, input, session, target)
|
|
17051
17154
|
);
|
|
17052
17155
|
}
|
|
17053
17156
|
async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options) {
|
|
17054
17157
|
if (input.clearValidTo === true) {
|
|
17055
17158
|
assertClearValidToSupported(backend, "edge");
|
|
17056
17159
|
}
|
|
17057
|
-
return
|
|
17160
|
+
return runWritePlan(
|
|
17058
17161
|
ctx,
|
|
17162
|
+
// An in-place props update re-derives no constraint verdict: endpoints
|
|
17163
|
+
// are immutable, so cardinality cannot change under it. A coalescing upsert
|
|
17164
|
+
// converges on a match key no database key backs; a resurrect or a cleared
|
|
17165
|
+
// end re-admits the row to the counted population its cardinality
|
|
17166
|
+
// constrains.
|
|
17167
|
+
edgeWritePlan(
|
|
17168
|
+
options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? edgeWriteNeedsConstraintFence(edgeCardinality(ctx, input.identity.kind)) : void 0
|
|
17169
|
+
),
|
|
17059
17170
|
backend,
|
|
17060
|
-
async (target) => {
|
|
17171
|
+
async (session, target) => {
|
|
17061
17172
|
if (options?.coalesceUnchanged === true && !options.clearDeleted) {
|
|
17062
17173
|
const existing = options.coalesceCandidate ?? await target.getEdge(ctx.graphId, input.id);
|
|
17063
17174
|
if (existing !== void 0 && existing.deleted_at === void 0) {
|
|
@@ -17082,17 +17193,13 @@ async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options)
|
|
|
17082
17193
|
const edge = await performEdgeUpdateConverging(
|
|
17083
17194
|
ctx,
|
|
17084
17195
|
input,
|
|
17196
|
+
session,
|
|
17085
17197
|
target,
|
|
17086
17198
|
options
|
|
17087
17199
|
);
|
|
17088
17200
|
return { edge, wrote: true };
|
|
17089
17201
|
},
|
|
17090
17202
|
{
|
|
17091
|
-
// An in-place props update re-derives no constraint verdict: endpoints
|
|
17092
|
-
// are immutable, so cardinality cannot change under it.
|
|
17093
|
-
fencesConstraintProbe: options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? edgeWriteNeedsConstraintFence(
|
|
17094
|
-
edgeCardinality(ctx, input.identity.kind)
|
|
17095
|
-
) : void 0,
|
|
17096
17203
|
didWrite: (outcome) => outcome.wrote
|
|
17097
17204
|
}
|
|
17098
17205
|
);
|
|
@@ -17117,19 +17224,23 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
|
|
|
17117
17224
|
);
|
|
17118
17225
|
if (gate.deleted_at) return;
|
|
17119
17226
|
const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
|
|
17120
|
-
return
|
|
17121
|
-
|
|
17122
|
-
|
|
17123
|
-
|
|
17124
|
-
|
|
17125
|
-
|
|
17126
|
-
|
|
17227
|
+
return runHookedWritePlan(
|
|
17228
|
+
ctx,
|
|
17229
|
+
opContext,
|
|
17230
|
+
// A soft delete decides nothing a concurrent write could invalidate.
|
|
17231
|
+
edgeWritePlan(void 0),
|
|
17232
|
+
backend,
|
|
17233
|
+
async (session) => {
|
|
17234
|
+
await session.retireEdge({ id, kind: expectedKind });
|
|
17235
|
+
}
|
|
17236
|
+
);
|
|
17127
17237
|
}
|
|
17128
17238
|
async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
|
|
17129
|
-
await
|
|
17239
|
+
await runWritePlan(
|
|
17130
17240
|
ctx,
|
|
17241
|
+
edgeWritePlan(void 0),
|
|
17131
17242
|
backend,
|
|
17132
|
-
async (target) => {
|
|
17243
|
+
async (session, target) => {
|
|
17133
17244
|
let affectedCount = 0;
|
|
17134
17245
|
for (const id of ids) {
|
|
17135
17246
|
const current = await target.getEdge(ctx.graphId, id);
|
|
@@ -17141,11 +17252,7 @@ async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
|
|
|
17141
17252
|
"delete"
|
|
17142
17253
|
);
|
|
17143
17254
|
if (current.deleted_at) continue;
|
|
17144
|
-
await
|
|
17145
|
-
graphId: ctx.graphId,
|
|
17146
|
-
id,
|
|
17147
|
-
kind: expectedKind
|
|
17148
|
-
});
|
|
17255
|
+
await session.retireEdge({ id, kind: expectedKind });
|
|
17149
17256
|
affectedCount += 1;
|
|
17150
17257
|
}
|
|
17151
17258
|
return affectedCount;
|
|
@@ -17163,13 +17270,24 @@ async function executeEdgeHardDelete(ctx, expectedKind, id, backend) {
|
|
|
17163
17270
|
"hardDelete"
|
|
17164
17271
|
);
|
|
17165
17272
|
const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
|
|
17166
|
-
return
|
|
17167
|
-
|
|
17168
|
-
|
|
17169
|
-
|
|
17170
|
-
|
|
17171
|
-
|
|
17172
|
-
|
|
17273
|
+
return runHookedWritePlan(
|
|
17274
|
+
ctx,
|
|
17275
|
+
opContext,
|
|
17276
|
+
edgeWritePlan(void 0),
|
|
17277
|
+
backend,
|
|
17278
|
+
async (session) => {
|
|
17279
|
+
await session.purgeEdge({
|
|
17280
|
+
id,
|
|
17281
|
+
kind: expectedKind,
|
|
17282
|
+
// Housekeeping, not a fence: this edge's claim is already takeable — its
|
|
17283
|
+
// liveness predicate reads a row that no longer exists — so dropping the
|
|
17284
|
+
// row only keeps the relation from growing by one row per hard-deleted
|
|
17285
|
+
// constrained edge. An unconstrained kind holds no claim and pays no
|
|
17286
|
+
// statement for one, the same rule its create follows.
|
|
17287
|
+
holdsCardinalityClaim: edgeCardinality(ctx, expectedKind) !== "many"
|
|
17288
|
+
});
|
|
17289
|
+
}
|
|
17290
|
+
);
|
|
17173
17291
|
}
|
|
17174
17292
|
var UNDEFINED_SENTINEL = "";
|
|
17175
17293
|
function validateMatchOnFields(schema, matchOn, edgeKind) {
|
|
@@ -17638,10 +17756,15 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17638
17756
|
}
|
|
17639
17757
|
}
|
|
17640
17758
|
function runBatch() {
|
|
17641
|
-
return
|
|
17759
|
+
return runWritePlan(
|
|
17642
17760
|
ctx,
|
|
17761
|
+
// A bulk getOrCreate always converges on a match key no database key
|
|
17762
|
+
// backs, whatever its cardinality — the same reason the single-item path
|
|
17763
|
+
// fences unconditionally.
|
|
17764
|
+
edgeWritePlan("edgeMatchKeyConvergence"),
|
|
17643
17765
|
backend,
|
|
17644
|
-
async (target) => {
|
|
17766
|
+
async (session, target) => {
|
|
17767
|
+
const rawTarget = unfencedTarget(target);
|
|
17645
17768
|
const { toCreate, toFetch, duplicateOf } = partitionEntries(
|
|
17646
17769
|
await fetchRowsByEndpoint(target)
|
|
17647
17770
|
);
|
|
@@ -17652,7 +17775,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17652
17775
|
const createdEdges = await executeEdgeCreateBatch(
|
|
17653
17776
|
ctx,
|
|
17654
17777
|
createInputs,
|
|
17655
|
-
|
|
17778
|
+
rawTarget
|
|
17656
17779
|
);
|
|
17657
17780
|
for (const [batchIndex, entry2] of toCreate.entries()) {
|
|
17658
17781
|
results[entry2.index] = {
|
|
@@ -17687,7 +17810,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17687
17810
|
onImmutableLowerBound: entry2.onImmutableLowerBound
|
|
17688
17811
|
}
|
|
17689
17812
|
},
|
|
17690
|
-
|
|
17813
|
+
rawTarget,
|
|
17691
17814
|
{ clearDeleted: true }
|
|
17692
17815
|
);
|
|
17693
17816
|
results[entry2.index] = { edge, action: "resurrected" };
|
|
@@ -17716,7 +17839,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17716
17839
|
onImmutableLowerBound: entry2.onImmutableLowerBound
|
|
17717
17840
|
}
|
|
17718
17841
|
},
|
|
17719
|
-
|
|
17842
|
+
rawTarget,
|
|
17720
17843
|
{
|
|
17721
17844
|
coalesceUnchanged: ctx.coalesceUnchangedUpsertsEnabled,
|
|
17722
17845
|
coalesceCandidate: entry2.row
|
|
@@ -17748,13 +17871,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17748
17871
|
}
|
|
17749
17872
|
return { results, writes };
|
|
17750
17873
|
},
|
|
17751
|
-
|
|
17752
|
-
// backs, whatever its cardinality — the same reason the single-item path
|
|
17753
|
-
// fences unconditionally.
|
|
17754
|
-
{
|
|
17755
|
-
fencesConstraintProbe: "edgeMatchKeyConvergence",
|
|
17756
|
-
didWrite: (outcome) => outcome.writes > 0
|
|
17757
|
-
}
|
|
17874
|
+
{ didWrite: (outcome) => outcome.writes > 0 }
|
|
17758
17875
|
);
|
|
17759
17876
|
}
|
|
17760
17877
|
async function runBatchResults() {
|
|
@@ -18543,8 +18660,10 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18543
18660
|
if (upserts.every((upsert) => upsert.constraints.length === 0) && releases.length === 0) {
|
|
18544
18661
|
return apply();
|
|
18545
18662
|
}
|
|
18546
|
-
|
|
18547
|
-
|
|
18663
|
+
const lock = await lockRecordedGraphWrite(target, this.graphId);
|
|
18664
|
+
return applyResolvedNodeClaims(
|
|
18665
|
+
{ graphId: this.graphId, registry: this.#registry, lock },
|
|
18666
|
+
target,
|
|
18548
18667
|
upserts,
|
|
18549
18668
|
releases,
|
|
18550
18669
|
apply
|
|
@@ -18791,7 +18910,11 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18791
18910
|
);
|
|
18792
18911
|
}
|
|
18793
18912
|
return importIdentityAssertionsIntoTarget(
|
|
18794
|
-
|
|
18913
|
+
// The slice the coordinator reads — graph, registry, schema, folding
|
|
18914
|
+
// mode — none of which depend on the target. The target it writes
|
|
18915
|
+
// through is the parameter beside it, which is why this method can take
|
|
18916
|
+
// the narrow statement projection an import frame is able to offer.
|
|
18917
|
+
this.#identityContext(this.#baseBackend),
|
|
18795
18918
|
target,
|
|
18796
18919
|
assertions,
|
|
18797
18920
|
mode
|
|
@@ -20822,6 +20945,41 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20822
20945
|
const vectorSlots = backend.capabilities.vector?.supported === true ? resolveGraphVectorSlots(this.#graph) : [];
|
|
20823
20946
|
return verify(this.graphId, vectorSlots);
|
|
20824
20947
|
}
|
|
20948
|
+
/**
|
|
20949
|
+
* Read-only diagnostic: every claim axis this graph's data ALREADY contends
|
|
20950
|
+
* for — a scoped unique key two live nodes hold, an id live under both kinds
|
|
20951
|
+
* of a `disjointWith` pair, or a declared edge cardinality two live edges
|
|
20952
|
+
* exceed.
|
|
20953
|
+
*
|
|
20954
|
+
* The claim relations refuse a second claimant from the first write after
|
|
20955
|
+
* upgrade onward, but they repair nothing that predates them: a database that
|
|
20956
|
+
* carried a violation keeps carrying it until a write touches that axis, and
|
|
20957
|
+
* is then refused with the ordinary typed error naming the incumbent. This is
|
|
20958
|
+
* how an operator sees that state before a user does.
|
|
20959
|
+
*
|
|
20960
|
+
* Reports; never repairs. Which of two live claimants keeps the axis is a
|
|
20961
|
+
* data-loss decision that belongs to the operator.
|
|
20962
|
+
*
|
|
20963
|
+
* Declarations are resolved from the active persisted schema, not this
|
|
20964
|
+
* Store's construction-time graph snapshot. A Store left stale by another
|
|
20965
|
+
* instance's `evolve()` therefore audits the constraints that currently
|
|
20966
|
+
* govern the database instead of returning a false clean report.
|
|
20967
|
+
*
|
|
20968
|
+
* @throws {ConfigurationError} `CONSTRAINT_FENCE_AUDIT_UNSUPPORTED` when the
|
|
20969
|
+
* backend cannot run the audit — an empty report from a backend that never
|
|
20970
|
+
* looked is indistinguishable from a clean database.
|
|
20971
|
+
*/
|
|
20972
|
+
async verifyConstraintFences() {
|
|
20973
|
+
const activeRow = await this.#baseBackend.getActiveSchema(this.graphId);
|
|
20974
|
+
const graph = activeRow === void 0 ? this.#graph : this.#catchUpToStored(parseSerializedSchema(activeRow.schema_doc));
|
|
20975
|
+
const registry = graph === this.#graph ? this.#registry : buildKindRegistry(graph);
|
|
20976
|
+
return verifyConstraintFences({
|
|
20977
|
+
graph,
|
|
20978
|
+
registry,
|
|
20979
|
+
graphId: this.graphId,
|
|
20980
|
+
backend: this.#baseBackend
|
|
20981
|
+
});
|
|
20982
|
+
}
|
|
20825
20983
|
/**
|
|
20826
20984
|
* Non-destructively repairs contribution states whose physical storage can
|
|
20827
20985
|
* be preserved: `missing-marker` and `failed-materialization`.
|
|
@@ -21988,5 +22146,5 @@ async function createVerifiedAdapterStore(graph, backend, options) {
|
|
|
21988
22146
|
}
|
|
21989
22147
|
|
|
21990
22148
|
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 };
|
|
21991
|
-
//# sourceMappingURL=chunk-
|
|
21992
|
-
//# sourceMappingURL=chunk-
|
|
22149
|
+
//# sourceMappingURL=chunk-MX7EKQPM.js.map
|
|
22150
|
+
//# sourceMappingURL=chunk-MX7EKQPM.js.map
|