@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,46 +1,47 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
require('../chunk-
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
require('../chunk-
|
|
19
|
-
var
|
|
20
|
-
require('../chunk-
|
|
21
|
-
require('../chunk-
|
|
22
|
-
require('../chunk-
|
|
3
|
+
var chunkWCLMKNQE_cjs = require('../chunk-WCLMKNQE.cjs');
|
|
4
|
+
require('../chunk-EH3JZJUM.cjs');
|
|
5
|
+
var chunkCS6JTQQ2_cjs = require('../chunk-CS6JTQQ2.cjs');
|
|
6
|
+
require('../chunk-C76WFIVZ.cjs');
|
|
7
|
+
var chunkTUVD4DFR_cjs = require('../chunk-TUVD4DFR.cjs');
|
|
8
|
+
require('../chunk-7PRMDZIA.cjs');
|
|
9
|
+
var chunk7CCMCMJO_cjs = require('../chunk-7CCMCMJO.cjs');
|
|
10
|
+
var chunkIPRP6TDL_cjs = require('../chunk-IPRP6TDL.cjs');
|
|
11
|
+
var chunk5OWHU7Z7_cjs = require('../chunk-5OWHU7Z7.cjs');
|
|
12
|
+
var chunkRDP6ZRSM_cjs = require('../chunk-RDP6ZRSM.cjs');
|
|
13
|
+
var chunkZBFZGLZE_cjs = require('../chunk-ZBFZGLZE.cjs');
|
|
14
|
+
var chunkIHK5KA2Q_cjs = require('../chunk-IHK5KA2Q.cjs');
|
|
15
|
+
require('../chunk-GHZPZNFC.cjs');
|
|
16
|
+
var chunkG2TLHH6T_cjs = require('../chunk-G2TLHH6T.cjs');
|
|
17
|
+
var chunkLLVOQOWE_cjs = require('../chunk-LLVOQOWE.cjs');
|
|
18
|
+
require('../chunk-DWUDZ66O.cjs');
|
|
19
|
+
var chunkM5MSP3BI_cjs = require('../chunk-M5MSP3BI.cjs');
|
|
20
|
+
require('../chunk-CSNOYIB4.cjs');
|
|
21
|
+
require('../chunk-SHC7BCG5.cjs');
|
|
22
|
+
require('../chunk-HY5BNOUN.cjs');
|
|
23
23
|
var chunkZY4GXIVN_cjs = require('../chunk-ZY4GXIVN.cjs');
|
|
24
24
|
require('../chunk-NAUA4PW5.cjs');
|
|
25
|
-
require('../chunk-
|
|
26
|
-
var
|
|
25
|
+
require('../chunk-TEC24ZDA.cjs');
|
|
26
|
+
var chunkOJHD3LXJ_cjs = require('../chunk-OJHD3LXJ.cjs');
|
|
27
27
|
require('../chunk-7EO3TCQB.cjs');
|
|
28
28
|
require('../chunk-RT5ZY4XA.cjs');
|
|
29
29
|
require('../chunk-HAHNRASW.cjs');
|
|
30
|
-
var
|
|
30
|
+
var chunkRJMHU2MG_cjs = require('../chunk-RJMHU2MG.cjs');
|
|
31
31
|
var chunkXUO3KQFO_cjs = require('../chunk-XUO3KQFO.cjs');
|
|
32
|
-
require('../chunk-
|
|
33
|
-
var
|
|
32
|
+
require('../chunk-VLBTRXA2.cjs');
|
|
33
|
+
var chunkRWUWTJQY_cjs = require('../chunk-RWUWTJQY.cjs');
|
|
34
|
+
var chunkX4GDXBOP_cjs = require('../chunk-X4GDXBOP.cjs');
|
|
34
35
|
require('../chunk-A7J2YDDI.cjs');
|
|
35
36
|
var chunkN66HCGCY_cjs = require('../chunk-N66HCGCY.cjs');
|
|
36
37
|
var zod = require('zod');
|
|
37
38
|
|
|
38
39
|
// src/graph-merge/canonical-props.ts
|
|
39
40
|
function canonicalizeProps(props) {
|
|
40
|
-
return JSON.stringify(props,
|
|
41
|
+
return JSON.stringify(props, chunkZBFZGLZE_cjs.sortedReplacer);
|
|
41
42
|
}
|
|
42
43
|
function canonicalValueKey(value) {
|
|
43
|
-
return JSON.stringify(value,
|
|
44
|
+
return JSON.stringify(value, chunkZBFZGLZE_cjs.sortedReplacer);
|
|
44
45
|
}
|
|
45
46
|
function edgeStateSignature(edge) {
|
|
46
47
|
return JSON.stringify([
|
|
@@ -131,7 +132,7 @@ function toTypeGraphErrorOptions(category, options) {
|
|
|
131
132
|
...options.cause === void 0 ? {} : { cause: options.cause }
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
|
-
var MergeError = class extends
|
|
135
|
+
var MergeError = class extends chunkX4GDXBOP_cjs.TypeGraphError {
|
|
135
136
|
static errorCategory = "system";
|
|
136
137
|
constructor(message, options = {}) {
|
|
137
138
|
const errorClass = new.target;
|
|
@@ -151,7 +152,7 @@ var InvalidMergeOptionsError = class extends MergeError {
|
|
|
151
152
|
this.name = "InvalidMergeOptionsError";
|
|
152
153
|
}
|
|
153
154
|
};
|
|
154
|
-
var BranchError = class extends
|
|
155
|
+
var BranchError = class extends chunkX4GDXBOP_cjs.TypeGraphError {
|
|
155
156
|
constructor(message, options = {}) {
|
|
156
157
|
super(
|
|
157
158
|
message,
|
|
@@ -197,7 +198,7 @@ var MergeConstraintConflictError = class extends MergeError {
|
|
|
197
198
|
};
|
|
198
199
|
function translateMergeCommitError(error) {
|
|
199
200
|
if (error instanceof MergeError) return error;
|
|
200
|
-
if (!(error instanceof
|
|
201
|
+
if (!(error instanceof chunkX4GDXBOP_cjs.TypeGraphError)) return error;
|
|
201
202
|
if (error.category !== "constraint" || error.code.startsWith("IDENTITY_")) {
|
|
202
203
|
return error;
|
|
203
204
|
}
|
|
@@ -716,10 +717,10 @@ function endpointTuple(assertion) {
|
|
|
716
717
|
return [assertion.a.kind, assertion.a.id, assertion.b.kind, assertion.b.id];
|
|
717
718
|
}
|
|
718
719
|
function identityEndpointKey(assertion) {
|
|
719
|
-
return
|
|
720
|
+
return chunkLLVOQOWE_cjs.encodeTupleKey(endpointTuple(assertion));
|
|
720
721
|
}
|
|
721
722
|
function identitySemanticKey(assertion) {
|
|
722
|
-
return
|
|
723
|
+
return chunk5OWHU7Z7_cjs.identityAssertionSemanticKey(
|
|
723
724
|
assertion.relation,
|
|
724
725
|
assertion.a,
|
|
725
726
|
assertion.b
|
|
@@ -728,11 +729,11 @@ function identitySemanticKey(assertion) {
|
|
|
728
729
|
function identityDedupeKey(assertion) {
|
|
729
730
|
const semantic = identitySemanticKey(assertion);
|
|
730
731
|
if (assertion.validTo === void 0) return semantic;
|
|
731
|
-
return
|
|
732
|
+
return chunkLLVOQOWE_cjs.encodeTupleKey([semantic, assertion.validFrom, assertion.validTo]);
|
|
732
733
|
}
|
|
733
734
|
function compareIdentitySurvivors(left, right) {
|
|
734
|
-
const byValidity =
|
|
735
|
-
return byValidity === 0 ?
|
|
735
|
+
const byValidity = chunkRWUWTJQY_cjs.compareCodePoints(left.validFrom, right.validFrom);
|
|
736
|
+
return byValidity === 0 ? chunkRWUWTJQY_cjs.compareCodePoints(left.id, right.id) : byValidity;
|
|
736
737
|
}
|
|
737
738
|
var DUPLICATE_IDENTITY_ASSERTION_DROP_REASON = "identity:duplicate-assertion";
|
|
738
739
|
var REDUNDANT_IDENTITY_ASSERTION_DROP_REASON = "identity:endpoints-collapsed";
|
|
@@ -763,7 +764,7 @@ function dedupeIdentityAssertions(assertions, committedIds) {
|
|
|
763
764
|
}
|
|
764
765
|
return {
|
|
765
766
|
survivors: [...survivorBySemantic.values()].toSorted(
|
|
766
|
-
(left, right) =>
|
|
767
|
+
(left, right) => chunkRWUWTJQY_cjs.compareCodePoints(identityDedupeKey(left), identityDedupeKey(right))
|
|
767
768
|
),
|
|
768
769
|
dropped
|
|
769
770
|
};
|
|
@@ -783,7 +784,7 @@ function assertNoOpposingIdentityRelations(assertions) {
|
|
|
783
784
|
);
|
|
784
785
|
for (const sameAssertion of same) {
|
|
785
786
|
for (const differentAssertion of different) {
|
|
786
|
-
if (!
|
|
787
|
+
if (!chunk5OWHU7Z7_cjs.identityValidityWindowsOverlap(sameAssertion, differentAssertion)) {
|
|
787
788
|
continue;
|
|
788
789
|
}
|
|
789
790
|
throw new IdentityMergeConflictError(
|
|
@@ -900,7 +901,7 @@ function planIdentityChanges(staging, storedIdentityRowsById) {
|
|
|
900
901
|
return {
|
|
901
902
|
assertions: deduped.survivors,
|
|
902
903
|
retractions: retractions.toSorted(
|
|
903
|
-
(left, right) =>
|
|
904
|
+
(left, right) => chunkRWUWTJQY_cjs.compareCodePoints(left.id, right.id)
|
|
904
905
|
),
|
|
905
906
|
dropped: [...deduped.dropped, ...retractionDropped]
|
|
906
907
|
};
|
|
@@ -943,7 +944,7 @@ function remapIdentityAssertionEndpoints(assertions, canonicalOf, retypeMap, sto
|
|
|
943
944
|
);
|
|
944
945
|
continue;
|
|
945
946
|
}
|
|
946
|
-
const [a, b] =
|
|
947
|
+
const [a, b] = chunk5OWHU7Z7_cjs.normalizeIdentityPair(remappedA, remappedB);
|
|
947
948
|
const endpointWindowA = endpointWindows.get(mergeKeyOf(a));
|
|
948
949
|
const endpointWindowB = endpointWindows.get(mergeKeyOf(b));
|
|
949
950
|
const validFrom = [
|
|
@@ -951,17 +952,17 @@ function remapIdentityAssertionEndpoints(assertions, canonicalOf, retypeMap, sto
|
|
|
951
952
|
endpointWindowA?.validFrom,
|
|
952
953
|
endpointWindowB?.validFrom
|
|
953
954
|
].filter((bound) => bound !== void 0).reduce(
|
|
954
|
-
(latest, bound) =>
|
|
955
|
+
(latest, bound) => chunkRWUWTJQY_cjs.compareCodePoints(latest, bound) < 0 ? bound : latest
|
|
955
956
|
);
|
|
956
957
|
const validTo = [
|
|
957
958
|
assertion.validTo,
|
|
958
959
|
endpointWindowA?.validTo,
|
|
959
960
|
endpointWindowB?.validTo
|
|
960
961
|
].filter((bound) => bound !== void 0).reduce(
|
|
961
|
-
(earliest, bound) => earliest === void 0 ||
|
|
962
|
+
(earliest, bound) => earliest === void 0 || chunkRWUWTJQY_cjs.compareCodePoints(bound, earliest) < 0 ? bound : earliest,
|
|
962
963
|
void 0
|
|
963
964
|
);
|
|
964
|
-
if (validTo !== void 0 &&
|
|
965
|
+
if (validTo !== void 0 && chunkRWUWTJQY_cjs.compareCodePoints(validFrom, validTo) >= 0) {
|
|
965
966
|
dropped.push(
|
|
966
967
|
droppedIdentityAssertion(
|
|
967
968
|
assertion,
|
|
@@ -1098,7 +1099,7 @@ async function buildIdentityPeerProbe(target, probedIds, targetPeers, plan, prof
|
|
|
1098
1099
|
(group) => group.map((member) => mergeKey(member.kind, member.id))
|
|
1099
1100
|
)
|
|
1100
1101
|
]);
|
|
1101
|
-
const ledger = (await relevantLedgerAssertions(target, memberKeys,
|
|
1102
|
+
const ledger = (await relevantLedgerAssertions(target, memberKeys, chunkTUVD4DFR_cjs.storeBackend(target))).filter(
|
|
1102
1103
|
(assertion) => !plannedDeletions.has(mergeKey(assertion.a.kind, assertion.a.id)) && !plannedDeletions.has(mergeKey(assertion.b.kind, assertion.b.id))
|
|
1103
1104
|
);
|
|
1104
1105
|
return {
|
|
@@ -1119,7 +1120,7 @@ async function buildIdentityPeerProbe(target, probedIds, targetPeers, plan, prof
|
|
|
1119
1120
|
};
|
|
1120
1121
|
}
|
|
1121
1122
|
async function snapshotIdentityClasses(target, seeds, liveKeys, plannedDeletions, txBackend) {
|
|
1122
|
-
const classes = await
|
|
1123
|
+
const classes = await chunkTUVD4DFR_cjs.storeRuntime(target).structuralIdentityClasses(
|
|
1123
1124
|
seeds,
|
|
1124
1125
|
txBackend
|
|
1125
1126
|
);
|
|
@@ -1127,7 +1128,7 @@ async function snapshotIdentityClasses(target, seeds, liveKeys, plannedDeletions
|
|
|
1127
1128
|
const groups = [];
|
|
1128
1129
|
for (const seed of seeds) {
|
|
1129
1130
|
const key = mergeKey(seed.kind, seed.id);
|
|
1130
|
-
const members = (classes.get(
|
|
1131
|
+
const members = (classes.get(chunk5OWHU7Z7_cjs.identityReferenceKey(seed)) ?? [seed]).filter(
|
|
1131
1132
|
(member) => !plannedDeletions.has(mergeKey(member.kind, member.id))
|
|
1132
1133
|
);
|
|
1133
1134
|
groups.push(members);
|
|
@@ -1136,7 +1137,7 @@ async function snapshotIdentityClasses(target, seeds, liveKeys, plannedDeletions
|
|
|
1136
1137
|
return { fingerprints, groups };
|
|
1137
1138
|
}
|
|
1138
1139
|
async function relevantLedgerAssertions(target, memberKeys, backend) {
|
|
1139
|
-
const current = await
|
|
1140
|
+
const current = await chunkTUVD4DFR_cjs.storeRuntime(target).identityAssertionsAtTarget(
|
|
1140
1141
|
backend,
|
|
1141
1142
|
"state"
|
|
1142
1143
|
);
|
|
@@ -1147,7 +1148,7 @@ async function relevantLedgerAssertions(target, memberKeys, backend) {
|
|
|
1147
1148
|
function differentLedgerFingerprint(assertions) {
|
|
1148
1149
|
return JSON.stringify(
|
|
1149
1150
|
assertions.filter((assertion) => assertion.relation === "different").map((assertion) => [assertion.id, ...endpointTuple(assertion)]).toSorted(
|
|
1150
|
-
(left, right) =>
|
|
1151
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(chunkLLVOQOWE_cjs.encodeTupleKey(left), chunkLLVOQOWE_cjs.encodeTupleKey(right))
|
|
1151
1152
|
)
|
|
1152
1153
|
);
|
|
1153
1154
|
}
|
|
@@ -1209,7 +1210,7 @@ async function assertPlannedIdentityIdsFresh(target, txBackend, plan) {
|
|
|
1209
1210
|
...plan.identityRetractions.map((retraction) => retraction.id)
|
|
1210
1211
|
];
|
|
1211
1212
|
if (plannedIds.length === 0) return;
|
|
1212
|
-
const storedById = await
|
|
1213
|
+
const storedById = await chunkTUVD4DFR_cjs.storeRuntime(target).identityAssertionRowsByIds(
|
|
1213
1214
|
plannedIds,
|
|
1214
1215
|
txBackend
|
|
1215
1216
|
);
|
|
@@ -1262,7 +1263,7 @@ function affectedIdentityClassSeeds(plan, profile) {
|
|
|
1262
1263
|
return [...seedsByKey.values()];
|
|
1263
1264
|
}
|
|
1264
1265
|
async function assertMergedIdentityClassesConsistent(target, txBackend, plan) {
|
|
1265
|
-
await
|
|
1266
|
+
await chunkTUVD4DFR_cjs.storeRuntime(target).assertIdentityClassesConsistentAtTarget(
|
|
1266
1267
|
txBackend,
|
|
1267
1268
|
affectedIdentityClassSeeds(plan, target.graph.identity?.sameIdAcrossKinds)
|
|
1268
1269
|
);
|
|
@@ -1301,9 +1302,9 @@ function identityRefusalCode(error) {
|
|
|
1301
1302
|
}
|
|
1302
1303
|
function translateIdentityCommitError(error) {
|
|
1303
1304
|
if (error instanceof MergeError) return error;
|
|
1304
|
-
if (!(error instanceof
|
|
1305
|
+
if (!(error instanceof chunkX4GDXBOP_cjs.TypeGraphError)) return error;
|
|
1305
1306
|
const identityCode = identityRefusalCode(error);
|
|
1306
|
-
const identityRefusal = error instanceof
|
|
1307
|
+
const identityRefusal = error instanceof chunkX4GDXBOP_cjs.IdentityContradictionError || error instanceof chunkX4GDXBOP_cjs.NodeNotFoundError || identityCode !== void 0 && !IDENTITY_ENVIRONMENT_CODES.has(identityCode);
|
|
1307
1308
|
if (!identityRefusal) return error;
|
|
1308
1309
|
return new IdentityMergeConflictError(
|
|
1309
1310
|
`The identity applier refused the resolved plan inside the commit transaction \u2014 identity truth on the target is incompatible with the plan. Cause: ${describeCause(error)}`,
|
|
@@ -1316,7 +1317,7 @@ function translateIdentityCommitError(error) {
|
|
|
1316
1317
|
}
|
|
1317
1318
|
async function assertIdentityPeersStable(target, txBackend, probe, plan) {
|
|
1318
1319
|
if (probe === void 0) return;
|
|
1319
|
-
const live = (await
|
|
1320
|
+
const live = (await chunkTUVD4DFR_cjs.storeRuntime(target).liveNodesSharingIds(probe.ids, txBackend)).filter((peer) => !probe.plannedDeletions.has(mergeKey(peer.kind, peer.id)));
|
|
1320
1321
|
const seedKindsById = /* @__PURE__ */ new Map();
|
|
1321
1322
|
for (const seed of probe.seeds) {
|
|
1322
1323
|
const kinds = seedKindsById.get(seed.id) ?? /* @__PURE__ */ new Set();
|
|
@@ -1341,7 +1342,7 @@ async function assertIdentityPeersStable(target, txBackend, probe, plan) {
|
|
|
1341
1342
|
probe.plannedDeletions,
|
|
1342
1343
|
txBackend
|
|
1343
1344
|
);
|
|
1344
|
-
const drifted = [...probe.classFingerprints].filter(([key, fingerprint]) => liveFingerprints.get(key) !== fingerprint).map(([key]) => key).sort((left, right) =>
|
|
1345
|
+
const drifted = [...probe.classFingerprints].filter(([key, fingerprint]) => liveFingerprints.get(key) !== fingerprint).map(([key]) => key).sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
1345
1346
|
if (drifted.length > 0) {
|
|
1346
1347
|
throw new BaseVersionMismatchError(
|
|
1347
1348
|
`mergeIncremental() validated identity against the classes visible at planning, but the identity class of ${drifted.length} node(s) the plan folds on changed before the commit transaction. Committing the plan could contradict identity truth it never validated.`,
|
|
@@ -1385,8 +1386,8 @@ var ENUMERATION_PAGE_SIZE = 1e3;
|
|
|
1385
1386
|
var EXPLICIT_RETRACTION = { kind: "explicit" };
|
|
1386
1387
|
function validWindowOf(row) {
|
|
1387
1388
|
return {
|
|
1388
|
-
validFrom:
|
|
1389
|
-
validTo:
|
|
1389
|
+
validFrom: chunkM5MSP3BI_cjs.canonicalizeDatabaseTimestamp(row.valid_from),
|
|
1390
|
+
validTo: chunkM5MSP3BI_cjs.canonicalizeDatabaseTimestamp(row.valid_to)
|
|
1390
1391
|
};
|
|
1391
1392
|
}
|
|
1392
1393
|
function windowsDiffer(left, right) {
|
|
@@ -1498,7 +1499,7 @@ function diffNodeKind(kind, baseRows, forkRows) {
|
|
|
1498
1499
|
deleted.push({
|
|
1499
1500
|
id: baseRow.id,
|
|
1500
1501
|
kind,
|
|
1501
|
-
deletedAt: forkRow === void 0 ? void 0 :
|
|
1502
|
+
deletedAt: forkRow === void 0 ? void 0 : chunkM5MSP3BI_cjs.canonicalizeDatabaseTimestamp(forkRow.deleted_at)
|
|
1502
1503
|
});
|
|
1503
1504
|
}
|
|
1504
1505
|
}
|
|
@@ -1609,15 +1610,15 @@ function classifyRetractions(retracted, deletedNodes, forkRowsById) {
|
|
|
1609
1610
|
});
|
|
1610
1611
|
}
|
|
1611
1612
|
function byId(left, right) {
|
|
1612
|
-
return
|
|
1613
|
+
return chunkRWUWTJQY_cjs.compareStrings(left.id, right.id);
|
|
1613
1614
|
}
|
|
1614
1615
|
async function diffAgainstBase(baseStore, forkStore, captureForkState = true) {
|
|
1615
1616
|
const graph = baseStore.graph;
|
|
1616
|
-
const nodeKinds =
|
|
1617
|
-
const edgeKinds =
|
|
1617
|
+
const nodeKinds = chunkG2TLHH6T_cjs.getNodeKinds(graph);
|
|
1618
|
+
const edgeKinds = chunkG2TLHH6T_cjs.getEdgeKinds(graph);
|
|
1618
1619
|
const [baseIdentity, forkIdentity] = await Promise.all([
|
|
1619
|
-
|
|
1620
|
-
|
|
1620
|
+
chunkTUVD4DFR_cjs.storeRuntime(baseStore).readCurrentIdentityAssertions("archival"),
|
|
1621
|
+
chunkTUVD4DFR_cjs.storeRuntime(forkStore).readCurrentIdentityAssertions("archival")
|
|
1621
1622
|
]);
|
|
1622
1623
|
const baseIdentityById = new Map(
|
|
1623
1624
|
baseIdentity.map((assertion) => [assertion.id, assertion])
|
|
@@ -1632,12 +1633,12 @@ async function diffAgainstBase(baseStore, forkStore, captureForkState = true) {
|
|
|
1632
1633
|
const forkNodeVersions = /* @__PURE__ */ new Map();
|
|
1633
1634
|
for (const kind of nodeKinds) {
|
|
1634
1635
|
const baseRows = await enumerateAllNodes(
|
|
1635
|
-
|
|
1636
|
+
chunkTUVD4DFR_cjs.storeBackend(baseStore),
|
|
1636
1637
|
baseStore.graphId,
|
|
1637
1638
|
kind
|
|
1638
1639
|
);
|
|
1639
1640
|
const forkRows = await enumerateAllNodes(
|
|
1640
|
-
|
|
1641
|
+
chunkTUVD4DFR_cjs.storeBackend(forkStore),
|
|
1641
1642
|
forkStore.graphId,
|
|
1642
1643
|
kind
|
|
1643
1644
|
);
|
|
@@ -1667,12 +1668,12 @@ async function diffAgainstBase(baseStore, forkStore, captureForkState = true) {
|
|
|
1667
1668
|
const forkEdgeSignatures = /* @__PURE__ */ new Map();
|
|
1668
1669
|
for (const kind of edgeKinds) {
|
|
1669
1670
|
const baseRows = await enumerateAllEdges(
|
|
1670
|
-
|
|
1671
|
+
chunkTUVD4DFR_cjs.storeBackend(baseStore),
|
|
1671
1672
|
baseStore.graphId,
|
|
1672
1673
|
kind
|
|
1673
1674
|
);
|
|
1674
1675
|
const forkRows = await enumerateAllEdges(
|
|
1675
|
-
|
|
1676
|
+
chunkTUVD4DFR_cjs.storeBackend(forkStore),
|
|
1676
1677
|
forkStore.graphId,
|
|
1677
1678
|
kind
|
|
1678
1679
|
);
|
|
@@ -1708,7 +1709,7 @@ async function diffAgainstBase(baseStore, forkStore, captureForkState = true) {
|
|
|
1708
1709
|
const retractedAssertions = baseIdentity.filter((assertion) => {
|
|
1709
1710
|
const fork = forkIdentityById.get(assertion.id);
|
|
1710
1711
|
return fork === void 0 || assertionTruthKey(fork) !== assertionTruthKey(assertion);
|
|
1711
|
-
}).toSorted((left, right) =>
|
|
1712
|
+
}).toSorted((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id));
|
|
1712
1713
|
const classifiedRetractions = classifyRetractions(
|
|
1713
1714
|
retractedAssertions,
|
|
1714
1715
|
deletedNodes,
|
|
@@ -1739,7 +1740,7 @@ async function diffAgainstBase(baseStore, forkStore, captureForkState = true) {
|
|
|
1739
1740
|
new: forkIdentity.filter((assertion) => {
|
|
1740
1741
|
const base = baseIdentityById.get(assertion.id);
|
|
1741
1742
|
return base === void 0 || assertionIdentityKey(base) !== assertionIdentityKey(assertion) && assertionTruthKey(base) !== assertionTruthKey(assertion);
|
|
1742
|
-
}).toSorted((left, right) =>
|
|
1743
|
+
}).toSorted((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)),
|
|
1743
1744
|
retracted: classifiedRetractions
|
|
1744
1745
|
},
|
|
1745
1746
|
forkNodeVersions,
|
|
@@ -1769,19 +1770,19 @@ async function readActiveSchemaVersion(backend, graphId) {
|
|
|
1769
1770
|
}
|
|
1770
1771
|
async function computeSchemaComponent(store) {
|
|
1771
1772
|
const version = await readActiveSchemaVersion(
|
|
1772
|
-
|
|
1773
|
+
chunkTUVD4DFR_cjs.storeBackend(store),
|
|
1773
1774
|
store.graphId
|
|
1774
1775
|
);
|
|
1775
|
-
return
|
|
1776
|
+
return chunk7CCMCMJO_cjs.computeSchemaHash(chunk7CCMCMJO_cjs.serializeSchema(store.graph, version));
|
|
1776
1777
|
}
|
|
1777
1778
|
function byDigestEntry(left, right) {
|
|
1778
|
-
const byKind =
|
|
1779
|
-
return byKind === 0 ?
|
|
1779
|
+
const byKind = chunkRWUWTJQY_cjs.compareStrings(left.kind, right.kind);
|
|
1780
|
+
return byKind === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.id, right.id) : byKind;
|
|
1780
1781
|
}
|
|
1781
1782
|
var CONTENT_FINGERPRINT_BYTES = 16;
|
|
1782
1783
|
async function computeContentComponent(backend, graphId, graph, identityAssertions) {
|
|
1783
|
-
const nodeKinds =
|
|
1784
|
-
const edgeKinds =
|
|
1784
|
+
const nodeKinds = chunkG2TLHH6T_cjs.getNodeKinds(graph);
|
|
1785
|
+
const edgeKinds = chunkG2TLHH6T_cjs.getEdgeKinds(graph);
|
|
1785
1786
|
const nodeDigest = [];
|
|
1786
1787
|
for (const kind of nodeKinds) {
|
|
1787
1788
|
const rows = await enumerateAllNodes(backend, graphId, kind);
|
|
@@ -1831,7 +1832,7 @@ async function computeBaseVersion(store) {
|
|
|
1831
1832
|
computeSchemaComponent(store),
|
|
1832
1833
|
store.revisionOriginNow(),
|
|
1833
1834
|
store.revisionNow(),
|
|
1834
|
-
readActiveSchemaVersion(
|
|
1835
|
+
readActiveSchemaVersion(chunkTUVD4DFR_cjs.storeBackend(store), store.graphId)
|
|
1835
1836
|
]);
|
|
1836
1837
|
return asBaseVersion(
|
|
1837
1838
|
`${schemaComponent2}${SCHEMA_VERSION_TAG}${activeVersion}${TOKEN_SEPARATOR}${revisionComponent(origin, revision)}`
|
|
@@ -1846,9 +1847,9 @@ async function computeBaseVersion(store) {
|
|
|
1846
1847
|
);
|
|
1847
1848
|
}
|
|
1848
1849
|
async function computeStoreContentComponent(store) {
|
|
1849
|
-
const identityAssertions = await
|
|
1850
|
+
const identityAssertions = await chunkTUVD4DFR_cjs.storeRuntime(store).readCurrentIdentityAssertions("state");
|
|
1850
1851
|
return computeContentComponent(
|
|
1851
|
-
|
|
1852
|
+
chunkTUVD4DFR_cjs.storeBackend(store),
|
|
1852
1853
|
store.graphId,
|
|
1853
1854
|
store.graph,
|
|
1854
1855
|
identityAssertions
|
|
@@ -1902,7 +1903,7 @@ function cloneWorkingCopyWithGraphStrategy(makeBackend, graphForClone) {
|
|
|
1902
1903
|
create: async (baseStore) => {
|
|
1903
1904
|
const backend = await makeBackend();
|
|
1904
1905
|
try {
|
|
1905
|
-
const [freshStore] = await
|
|
1906
|
+
const [freshStore] = await chunkWCLMKNQE_cjs.createStoreWithSchema(
|
|
1906
1907
|
graphForClone(baseStore),
|
|
1907
1908
|
backend,
|
|
1908
1909
|
{
|
|
@@ -1923,16 +1924,16 @@ function cloneWorkingCopyWithGraphStrategy(makeBackend, graphForClone) {
|
|
|
1923
1924
|
validateReferences: true,
|
|
1924
1925
|
batchSize: CLONE_IMPORT_BATCH_SIZE
|
|
1925
1926
|
};
|
|
1926
|
-
const result =
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
) === void 0 ? await
|
|
1927
|
+
const result = chunkZBFZGLZE_cjs.snapshotExportContention(
|
|
1928
|
+
chunkTUVD4DFR_cjs.storeBackend(baseStore),
|
|
1929
|
+
chunkTUVD4DFR_cjs.storeBackend(freshStore)
|
|
1930
|
+
) === void 0 ? await chunkCS6JTQQ2_cjs.importGraphStream(
|
|
1930
1931
|
freshStore,
|
|
1931
|
-
|
|
1932
|
+
chunkCS6JTQQ2_cjs.exportGraphStream(baseStore, exportOptions),
|
|
1932
1933
|
importOptions
|
|
1933
|
-
) : await
|
|
1934
|
+
) : await chunkCS6JTQQ2_cjs.importGraph(
|
|
1934
1935
|
freshStore,
|
|
1935
|
-
await
|
|
1936
|
+
await chunkCS6JTQQ2_cjs.exportGraph(baseStore, exportOptions),
|
|
1936
1937
|
importOptions
|
|
1937
1938
|
);
|
|
1938
1939
|
if (!result.success) {
|
|
@@ -1981,18 +1982,18 @@ function graphWithoutNodeUniqueness(graph) {
|
|
|
1981
1982
|
async function branch(baseStore, makeBackend, options, strategy) {
|
|
1982
1983
|
try {
|
|
1983
1984
|
const base = await computeBaseVersion(baseStore);
|
|
1984
|
-
const id = options?.id ?? asBranchId(
|
|
1985
|
+
const id = options?.id ?? asBranchId(chunkRDP6ZRSM_cjs.generateId());
|
|
1985
1986
|
const workingCopyStrategy = strategy ?? cloneWorkingCopyStrategy(makeBackend);
|
|
1986
1987
|
const store = await workingCopyStrategy.create(baseStore);
|
|
1987
1988
|
const schemaAnchor = await captureBranchSchemaAnchor(store);
|
|
1988
|
-
return
|
|
1989
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
1989
1990
|
id,
|
|
1990
1991
|
base,
|
|
1991
1992
|
store,
|
|
1992
1993
|
...schemaAnchor === void 0 ? { schemaAnchor: void 0 } : { schemaAnchor }
|
|
1993
1994
|
});
|
|
1994
1995
|
} catch (error) {
|
|
1995
|
-
return
|
|
1996
|
+
return chunkRJMHU2MG_cjs.err(
|
|
1996
1997
|
new BranchError("Failed to create working-copy branch of base store", {
|
|
1997
1998
|
cause: error
|
|
1998
1999
|
})
|
|
@@ -2001,11 +2002,11 @@ async function branch(baseStore, makeBackend, options, strategy) {
|
|
|
2001
2002
|
}
|
|
2002
2003
|
async function captureBranchSchemaAnchor(store) {
|
|
2003
2004
|
try {
|
|
2004
|
-
const schemaRow = await
|
|
2005
|
+
const schemaRow = await chunkTUVD4DFR_cjs.storeBackend(store).getActiveSchema(store.graphId);
|
|
2005
2006
|
return schemaRow === void 0 ? void 0 : { version: schemaRow.version, hash: schemaRow.schema_hash };
|
|
2006
2007
|
} catch (error) {
|
|
2007
2008
|
try {
|
|
2008
|
-
await
|
|
2009
|
+
await chunkTUVD4DFR_cjs.storeBackend(store).close();
|
|
2009
2010
|
} catch {
|
|
2010
2011
|
}
|
|
2011
2012
|
throw error;
|
|
@@ -2014,6 +2015,22 @@ async function captureBranchSchemaAnchor(store) {
|
|
|
2014
2015
|
|
|
2015
2016
|
// src/graph-merge/ingestion-branch.ts
|
|
2016
2017
|
var PRIVATE_BRANCHES = /* @__PURE__ */ new WeakMap();
|
|
2018
|
+
function createIngestionIdentityFacade(identity) {
|
|
2019
|
+
return Object.freeze({
|
|
2020
|
+
assertSame(a, b, window) {
|
|
2021
|
+
return identity.assertSame(a, b, window);
|
|
2022
|
+
},
|
|
2023
|
+
assertDifferent(a, b, window) {
|
|
2024
|
+
return identity.assertDifferent(a, b, window);
|
|
2025
|
+
},
|
|
2026
|
+
bulkAssertSame(pairs) {
|
|
2027
|
+
return identity.bulkAssertSame(pairs);
|
|
2028
|
+
},
|
|
2029
|
+
bulkAssertDifferent(pairs) {
|
|
2030
|
+
return identity.bulkAssertDifferent(pairs);
|
|
2031
|
+
}
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2017
2034
|
async function ingestionBranch(baseStore, makeBackend, options) {
|
|
2018
2035
|
try {
|
|
2019
2036
|
const created = await branch(
|
|
@@ -2022,8 +2039,8 @@ async function ingestionBranch(baseStore, makeBackend, options) {
|
|
|
2022
2039
|
options,
|
|
2023
2040
|
cloneIngestionWorkingCopyStrategy(makeBackend)
|
|
2024
2041
|
);
|
|
2025
|
-
if (
|
|
2026
|
-
return
|
|
2042
|
+
if (chunkRJMHU2MG_cjs.isErr(created)) {
|
|
2043
|
+
return chunkRJMHU2MG_cjs.err(
|
|
2027
2044
|
new BranchError("Failed to create constraint-aware ingestion branch", {
|
|
2028
2045
|
cause: created.error
|
|
2029
2046
|
})
|
|
@@ -2031,17 +2048,24 @@ async function ingestionBranch(baseStore, makeBackend, options) {
|
|
|
2031
2048
|
}
|
|
2032
2049
|
const privateBranch = created.data;
|
|
2033
2050
|
const { base, id, store } = privateBranch;
|
|
2051
|
+
const identityAccess = store.graph.identity === void 0 ? {} : {
|
|
2052
|
+
identity: createIngestionIdentityFacade(
|
|
2053
|
+
store.identity
|
|
2054
|
+
)
|
|
2055
|
+
};
|
|
2034
2056
|
const handle = Object.freeze({
|
|
2035
2057
|
id,
|
|
2036
2058
|
base,
|
|
2037
2059
|
nodes: store.nodes,
|
|
2038
2060
|
edges: store.edges,
|
|
2039
|
-
|
|
2061
|
+
...identityAccess,
|
|
2062
|
+
close: async () => chunkTUVD4DFR_cjs.storeBackend(store).close()
|
|
2040
2063
|
});
|
|
2041
2064
|
PRIVATE_BRANCHES.set(handle, privateBranch);
|
|
2042
|
-
|
|
2065
|
+
chunkCS6JTQQ2_cjs.registerIngestionImportTarget(handle, store);
|
|
2066
|
+
return chunkRJMHU2MG_cjs.ok(handle);
|
|
2043
2067
|
} catch (error) {
|
|
2044
|
-
return
|
|
2068
|
+
return chunkRJMHU2MG_cjs.err(
|
|
2045
2069
|
new BranchError("Failed to create constraint-aware ingestion branch", {
|
|
2046
2070
|
cause: error
|
|
2047
2071
|
})
|
|
@@ -2083,7 +2107,7 @@ function constraintSignature(node, constraint) {
|
|
|
2083
2107
|
return void 0;
|
|
2084
2108
|
}
|
|
2085
2109
|
}
|
|
2086
|
-
return `${constraint.name}${KEY_PART_SEPARATOR}${
|
|
2110
|
+
return `${constraint.name}${KEY_PART_SEPARATOR}${chunkLLVOQOWE_cjs.computeUniqueKey(
|
|
2087
2111
|
props,
|
|
2088
2112
|
constraint.fields,
|
|
2089
2113
|
constraint.collation
|
|
@@ -2120,12 +2144,12 @@ function blockNodes(newNodes, resolveConfig, uniqueConstraints = []) {
|
|
|
2120
2144
|
}
|
|
2121
2145
|
}
|
|
2122
2146
|
const sortedKeys = [...buckets.keys()].sort(
|
|
2123
|
-
(left, right) =>
|
|
2147
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
2124
2148
|
);
|
|
2125
2149
|
const ordered = /* @__PURE__ */ new Map();
|
|
2126
2150
|
for (const key of sortedKeys) {
|
|
2127
2151
|
const members = [...chunkN66HCGCY_cjs.requireDefined(buckets.get(key))].sort(
|
|
2128
|
-
(left, right) =>
|
|
2152
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
2129
2153
|
);
|
|
2130
2154
|
ordered.set(key, members);
|
|
2131
2155
|
}
|
|
@@ -2142,7 +2166,7 @@ function buildBranchRank(branchOrder, allBranchIds) {
|
|
|
2142
2166
|
next += 1;
|
|
2143
2167
|
}
|
|
2144
2168
|
}
|
|
2145
|
-
const remaining = allBranchIds.filter((branchId) => !rank.has(branchId)).sort((left, right) =>
|
|
2169
|
+
const remaining = allBranchIds.filter((branchId) => !rank.has(branchId)).sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
2146
2170
|
for (const branchId of remaining) {
|
|
2147
2171
|
if (!rank.has(branchId)) {
|
|
2148
2172
|
rank.set(branchId, next);
|
|
@@ -2214,8 +2238,8 @@ function collectConflictingValues(property, contributions) {
|
|
|
2214
2238
|
values.push({ branchId, value });
|
|
2215
2239
|
}
|
|
2216
2240
|
return [...values].sort((left, right) => {
|
|
2217
|
-
const byBranch =
|
|
2218
|
-
return byBranch === 0 ?
|
|
2241
|
+
const byBranch = chunkRWUWTJQY_cjs.compareStrings(left.branchId, right.branchId);
|
|
2242
|
+
return byBranch === 0 ? chunkRWUWTJQY_cjs.compareStrings(
|
|
2219
2243
|
canonicalValueKey(left.value),
|
|
2220
2244
|
canonicalValueKey(right.value)
|
|
2221
2245
|
) : byBranch;
|
|
@@ -2345,7 +2369,7 @@ function unionProperties(canonicalMember, members, context, baseContext, branchR
|
|
|
2345
2369
|
const props = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
2346
2370
|
const conflicts = [];
|
|
2347
2371
|
for (const property of [...propertyNames].sort(
|
|
2348
|
-
(left, right) =>
|
|
2372
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
2349
2373
|
)) {
|
|
2350
2374
|
const values = collectConflictingValues(property, members);
|
|
2351
2375
|
if (values.length === 0) {
|
|
@@ -2410,14 +2434,14 @@ function canonicalizeCluster(cluster, members, policy, branchRank, weights, cano
|
|
|
2410
2434
|
);
|
|
2411
2435
|
const memberIds = [
|
|
2412
2436
|
...new Set(cluster.members.map((member) => idOf(member)))
|
|
2413
|
-
].sort((left, right) =>
|
|
2437
|
+
].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
2414
2438
|
const branchOrigins = [
|
|
2415
2439
|
...new Set(
|
|
2416
2440
|
members.map((member) => member.branchId).filter(
|
|
2417
2441
|
(branchId) => branchId !== BASE_PROVENANCE_BRANCH && branchId !== preferredBranchId
|
|
2418
2442
|
)
|
|
2419
2443
|
)
|
|
2420
|
-
].sort((left, right) =>
|
|
2444
|
+
].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
2421
2445
|
const resolution = {
|
|
2422
2446
|
canonicalId,
|
|
2423
2447
|
memberIds,
|
|
@@ -2497,7 +2521,7 @@ var EQUIVALENCE_META_EDGES = /* @__PURE__ */ new Set([
|
|
|
2497
2521
|
chunkXUO3KQFO_cjs.META_EDGE_SAME_AS
|
|
2498
2522
|
]);
|
|
2499
2523
|
function buildSubClassClosure(ontology) {
|
|
2500
|
-
const unionFind = new UnionFind(
|
|
2524
|
+
const unionFind = new UnionFind(chunkRWUWTJQY_cjs.compareStrings);
|
|
2501
2525
|
for (const relation of ontology) {
|
|
2502
2526
|
unionFind.add(relation.from);
|
|
2503
2527
|
unionFind.add(relation.to);
|
|
@@ -2528,7 +2552,7 @@ function buildSubClassClosure(ontology) {
|
|
|
2528
2552
|
relations.push([child, parent]);
|
|
2529
2553
|
}
|
|
2530
2554
|
return {
|
|
2531
|
-
closure:
|
|
2555
|
+
closure: chunkRJMHU2MG_cjs.computeTransitiveClosure(relations),
|
|
2532
2556
|
canonicalOf
|
|
2533
2557
|
};
|
|
2534
2558
|
}
|
|
@@ -2541,7 +2565,7 @@ function isReachable2(closure, from, to) {
|
|
|
2541
2565
|
if (fromRep === toRep) {
|
|
2542
2566
|
return from !== to;
|
|
2543
2567
|
}
|
|
2544
|
-
return
|
|
2568
|
+
return chunkRJMHU2MG_cjs.isReachable(closure.closure, fromRep, toRep);
|
|
2545
2569
|
}
|
|
2546
2570
|
|
|
2547
2571
|
// src/graph-merge/evidence.ts
|
|
@@ -2593,7 +2617,7 @@ function sourceKey(source) {
|
|
|
2593
2617
|
}
|
|
2594
2618
|
}
|
|
2595
2619
|
function compareMatchSources(left, right) {
|
|
2596
|
-
return
|
|
2620
|
+
return chunkRWUWTJQY_cjs.compareStrings(sourceKey(left), sourceKey(right));
|
|
2597
2621
|
}
|
|
2598
2622
|
function compareEntityRefs(left, right) {
|
|
2599
2623
|
return compareMergeKeys(
|
|
@@ -2822,7 +2846,7 @@ function scorePrepared(left, right, strategy, ctx) {
|
|
|
2822
2846
|
try {
|
|
2823
2847
|
raw = strategy.score(left.node, right.node);
|
|
2824
2848
|
} catch (error) {
|
|
2825
|
-
return
|
|
2849
|
+
return chunkRJMHU2MG_cjs.err(
|
|
2826
2850
|
new MatchEvidenceError("Custom similarity scorer failed.", {
|
|
2827
2851
|
details: {
|
|
2828
2852
|
kind: left.node.kind,
|
|
@@ -2834,7 +2858,7 @@ function scorePrepared(left, right, strategy, ctx) {
|
|
|
2834
2858
|
);
|
|
2835
2859
|
}
|
|
2836
2860
|
if (!Number.isFinite(raw)) {
|
|
2837
|
-
return
|
|
2861
|
+
return chunkRJMHU2MG_cjs.err(
|
|
2838
2862
|
new MatchEvidenceError(
|
|
2839
2863
|
"Custom similarity scorer returned a non-finite score.",
|
|
2840
2864
|
{
|
|
@@ -2848,37 +2872,37 @@ function scorePrepared(left, right, strategy, ctx) {
|
|
|
2848
2872
|
)
|
|
2849
2873
|
);
|
|
2850
2874
|
}
|
|
2851
|
-
return
|
|
2875
|
+
return chunkRJMHU2MG_cjs.ok(clampScore(raw));
|
|
2852
2876
|
}
|
|
2853
2877
|
case "fulltext": {
|
|
2854
2878
|
if (left.text.length === 0 || right.text.length === 0) {
|
|
2855
|
-
return
|
|
2879
|
+
return chunkRJMHU2MG_cjs.ok(NO_EVIDENCE_SCORE);
|
|
2856
2880
|
}
|
|
2857
|
-
return
|
|
2881
|
+
return chunkRJMHU2MG_cjs.ok(clampScore(diceFromMultisets(left.grams, right.grams)));
|
|
2858
2882
|
}
|
|
2859
2883
|
case "vector": {
|
|
2860
2884
|
if (ctx.embeddings === void 0) {
|
|
2861
|
-
return
|
|
2885
|
+
return chunkRJMHU2MG_cjs.err(embedderUnavailable("vector", ctx));
|
|
2862
2886
|
}
|
|
2863
2887
|
if (left.text.length === 0 || right.text.length === 0) {
|
|
2864
|
-
return
|
|
2888
|
+
return chunkRJMHU2MG_cjs.ok(NO_EVIDENCE_SCORE);
|
|
2865
2889
|
}
|
|
2866
2890
|
const cosine = cosineFromLookup(ctx.embeddings, left.text, right.text);
|
|
2867
|
-
return
|
|
2891
|
+
return chunkRJMHU2MG_cjs.ok(clampScore(cosine));
|
|
2868
2892
|
}
|
|
2869
2893
|
case "hybrid": {
|
|
2870
2894
|
if (ctx.embeddings === void 0) {
|
|
2871
|
-
return
|
|
2895
|
+
return chunkRJMHU2MG_cjs.err(embedderUnavailable("hybrid", ctx));
|
|
2872
2896
|
}
|
|
2873
2897
|
if (left.text.length === 0 || right.text.length === 0) {
|
|
2874
|
-
return
|
|
2898
|
+
return chunkRJMHU2MG_cjs.ok(NO_EVIDENCE_SCORE);
|
|
2875
2899
|
}
|
|
2876
2900
|
const vectorScore = clampScore(
|
|
2877
2901
|
cosineFromLookup(ctx.embeddings, left.text, right.text)
|
|
2878
2902
|
);
|
|
2879
2903
|
const fulltextScore = diceFromMultisets(left.grams, right.grams);
|
|
2880
2904
|
const weights = normalizeHybridWeights(strategy.weights);
|
|
2881
|
-
return
|
|
2905
|
+
return chunkRJMHU2MG_cjs.ok(
|
|
2882
2906
|
clampScore(
|
|
2883
2907
|
weights.vector * vectorScore + weights.fulltext * fulltextScore
|
|
2884
2908
|
)
|
|
@@ -2962,7 +2986,7 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
2962
2986
|
});
|
|
2963
2987
|
if (maxComparisonsPerKind !== void 0 && fuzzy.length > maxComparisonsPerKind) {
|
|
2964
2988
|
if (ceilingPolicy === "error") {
|
|
2965
|
-
return
|
|
2989
|
+
return chunkRJMHU2MG_cjs.err(
|
|
2966
2990
|
new MergeError(
|
|
2967
2991
|
`Comparison ceiling exceeded: ${fuzzy.length} candidate pairs > maxComparisonsPerKind ${maxComparisonsPerKind}.`,
|
|
2968
2992
|
{
|
|
@@ -2975,7 +2999,7 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
2975
2999
|
)
|
|
2976
3000
|
);
|
|
2977
3001
|
}
|
|
2978
|
-
return
|
|
3002
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
2979
3003
|
edges: [...forced].sort(
|
|
2980
3004
|
(left, right) => compareCandidateEdges(left, right)
|
|
2981
3005
|
),
|
|
@@ -2997,9 +3021,9 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
2997
3021
|
let diagnosticsTotal = 0;
|
|
2998
3022
|
for (const { left, right, a, b, sources } of fuzzy) {
|
|
2999
3023
|
const scored = scorer(a, left, b, right);
|
|
3000
|
-
if (
|
|
3024
|
+
if (chunkRJMHU2MG_cjs.isErr(scored)) {
|
|
3001
3025
|
if (similarity.kind === "custom" && scored.error instanceof MatchEvidenceError) {
|
|
3002
|
-
return
|
|
3026
|
+
return chunkRJMHU2MG_cjs.err(
|
|
3003
3027
|
new MatchEvidenceError(scored.error.message, {
|
|
3004
3028
|
cause: scored.error,
|
|
3005
3029
|
details: {
|
|
@@ -3013,10 +3037,10 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
3013
3037
|
})
|
|
3014
3038
|
);
|
|
3015
3039
|
}
|
|
3016
|
-
return
|
|
3040
|
+
return chunkRJMHU2MG_cjs.err(scored.error);
|
|
3017
3041
|
}
|
|
3018
3042
|
if (!Number.isFinite(scored.data)) {
|
|
3019
|
-
return
|
|
3043
|
+
return chunkRJMHU2MG_cjs.err(
|
|
3020
3044
|
new MatchEvidenceError(
|
|
3021
3045
|
"Similarity scorer returned a non-finite score.",
|
|
3022
3046
|
{
|
|
@@ -3056,7 +3080,7 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
3056
3080
|
});
|
|
3057
3081
|
}
|
|
3058
3082
|
}
|
|
3059
|
-
return
|
|
3083
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
3060
3084
|
edges: edges.sort((left, right) => compareCandidateEdges(left, right)),
|
|
3061
3085
|
warnings: [],
|
|
3062
3086
|
diagnostics,
|
|
@@ -3335,7 +3359,7 @@ function pickHighestPriorityBranch(branchIds, branchRank) {
|
|
|
3335
3359
|
let chosenRank = branchRank.get(chosen) ?? Number.MAX_SAFE_INTEGER;
|
|
3336
3360
|
for (const candidate of branchIds.slice(1)) {
|
|
3337
3361
|
const candidateRank = branchRank.get(candidate) ?? Number.MAX_SAFE_INTEGER;
|
|
3338
|
-
if (candidateRank < chosenRank || candidateRank === chosenRank &&
|
|
3362
|
+
if (candidateRank < chosenRank || candidateRank === chosenRank && chunkRWUWTJQY_cjs.compareStrings(candidate, chosen) < 0) {
|
|
3339
3363
|
chosen = candidate;
|
|
3340
3364
|
chosenRank = candidateRank;
|
|
3341
3365
|
}
|
|
@@ -3428,20 +3452,20 @@ function resolveDeleteModifyOver(modified, deleted, modifiedEntity, deletedEntit
|
|
|
3428
3452
|
}
|
|
3429
3453
|
return {
|
|
3430
3454
|
survivingModifications: [...survivingModifications].sort((left, right) => {
|
|
3431
|
-
const byId2 =
|
|
3455
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(
|
|
3432
3456
|
modifiedEntity(left).id,
|
|
3433
3457
|
modifiedEntity(right).id
|
|
3434
3458
|
);
|
|
3435
|
-
return byId2 === 0 ?
|
|
3459
|
+
return byId2 === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
3436
3460
|
}),
|
|
3437
3461
|
deletions: [...deletions].sort(
|
|
3438
|
-
(left, right) =>
|
|
3462
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
3439
3463
|
),
|
|
3440
3464
|
conflicts: [...conflicts].sort(
|
|
3441
|
-
(left, right) =>
|
|
3465
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.entityId, right.entityId)
|
|
3442
3466
|
),
|
|
3443
3467
|
dropped: [...dropped].sort(
|
|
3444
|
-
(left, right) =>
|
|
3468
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
3445
3469
|
)
|
|
3446
3470
|
};
|
|
3447
3471
|
}
|
|
@@ -3485,11 +3509,11 @@ function reconcileOver(survivingModifications, entityOf, rebuild, policy, branch
|
|
|
3485
3509
|
}
|
|
3486
3510
|
return {
|
|
3487
3511
|
survivingModifications: [...out].sort((left, right) => {
|
|
3488
|
-
const byId2 =
|
|
3489
|
-
return byId2 === 0 ?
|
|
3512
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(entityOf(left).id, entityOf(right).id);
|
|
3513
|
+
return byId2 === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
3490
3514
|
}),
|
|
3491
3515
|
conflicts: conflicts.sort(
|
|
3492
|
-
(left, right) =>
|
|
3516
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(
|
|
3493
3517
|
`${left.entityId}|${left.property}`,
|
|
3494
3518
|
`${right.entityId}|${right.property}`
|
|
3495
3519
|
)
|
|
@@ -3523,7 +3547,7 @@ function threeWayMergeProps(entityId, kind, baseProps, contributions, context, b
|
|
|
3523
3547
|
propertyNames.add(name);
|
|
3524
3548
|
}
|
|
3525
3549
|
}
|
|
3526
|
-
for (const property of [...propertyNames].sort(
|
|
3550
|
+
for (const property of [...propertyNames].sort(chunkRWUWTJQY_cjs.compareStrings)) {
|
|
3527
3551
|
const baseHas = chunkN66HCGCY_cjs.hasOwnKey(baseProps, property);
|
|
3528
3552
|
const baseKey = baseHas ? canonicalValueKey(chunkN66HCGCY_cjs.requireDefined(baseProps[property])) : void 0;
|
|
3529
3553
|
const changed = contributions.filter((contribution) => {
|
|
@@ -3623,7 +3647,7 @@ function earliestEnd(claims) {
|
|
|
3623
3647
|
let earliest;
|
|
3624
3648
|
for (const claim of claims) {
|
|
3625
3649
|
if (claim.change.kind !== "set") continue;
|
|
3626
|
-
if (earliest === void 0 ||
|
|
3650
|
+
if (earliest === void 0 || chunkRWUWTJQY_cjs.compareStrings(claim.change.validTo, earliest) < 0) {
|
|
3627
3651
|
earliest = claim.change.validTo;
|
|
3628
3652
|
}
|
|
3629
3653
|
}
|
|
@@ -3639,7 +3663,7 @@ function resolveEndClaims(claims, preferredBranchId) {
|
|
|
3639
3663
|
}
|
|
3640
3664
|
function claimingBranches(claims) {
|
|
3641
3665
|
return [...new Set(claims.map((claim) => claim.branchId))].sort(
|
|
3642
|
-
(left, right) =>
|
|
3666
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
3643
3667
|
);
|
|
3644
3668
|
}
|
|
3645
3669
|
function sameValidToChange(left, right) {
|
|
@@ -3736,7 +3760,7 @@ function resolvePopulation(entity, deltas, deletions, preferredBranchId, dropIte
|
|
|
3736
3760
|
mergeKey(right.kind, right.id)
|
|
3737
3761
|
)
|
|
3738
3762
|
),
|
|
3739
|
-
dropped: dropped.sort((left, right) =>
|
|
3763
|
+
dropped: dropped.sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id))
|
|
3740
3764
|
};
|
|
3741
3765
|
}
|
|
3742
3766
|
function resolveValidWindows(staging, nodeDeletions, edgeDeletions, preferredBranchId) {
|
|
@@ -3825,7 +3849,7 @@ function rowsById(groupEdges) {
|
|
|
3825
3849
|
function sourcePairByRow(rows) {
|
|
3826
3850
|
const pairs = /* @__PURE__ */ new Map();
|
|
3827
3851
|
for (const [id, members] of rows) {
|
|
3828
|
-
const sorted = members.map((member) => member.sourcePair).sort((left, right) =>
|
|
3852
|
+
const sorted = members.map((member) => member.sourcePair).sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
3829
3853
|
pairs.set(id, chunkN66HCGCY_cjs.requireDefined(sorted[0]));
|
|
3830
3854
|
}
|
|
3831
3855
|
return pairs;
|
|
@@ -3836,14 +3860,14 @@ function foldSets(groupEdges) {
|
|
|
3836
3860
|
const representatives = /* @__PURE__ */ new Map();
|
|
3837
3861
|
for (const [id, pair] of sourcePairs) {
|
|
3838
3862
|
const representative = representatives.get(pair);
|
|
3839
|
-
if (representative === void 0 ||
|
|
3863
|
+
if (representative === void 0 || chunkRWUWTJQY_cjs.compareStrings(id, representative) < 0) {
|
|
3840
3864
|
representatives.set(pair, id);
|
|
3841
3865
|
}
|
|
3842
3866
|
}
|
|
3843
3867
|
const collapsed = [];
|
|
3844
3868
|
const parallel = [];
|
|
3845
3869
|
for (const id of [...rows.keys()].sort(
|
|
3846
|
-
(left, right) =>
|
|
3870
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
3847
3871
|
)) {
|
|
3848
3872
|
const members = chunkN66HCGCY_cjs.requireDefined(rows.get(id));
|
|
3849
3873
|
const pair = chunkN66HCGCY_cjs.requireDefined(sourcePairs.get(id));
|
|
@@ -3856,7 +3880,7 @@ function foldSets(groupEdges) {
|
|
|
3856
3880
|
return [collapsed, ...parallel];
|
|
3857
3881
|
}
|
|
3858
3882
|
function compareMembers(left, right, preferredBranchId) {
|
|
3859
|
-
const byId2 =
|
|
3883
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(left.staged.id, right.staged.id);
|
|
3860
3884
|
if (byId2 !== 0) {
|
|
3861
3885
|
return byId2;
|
|
3862
3886
|
}
|
|
@@ -3865,7 +3889,7 @@ function compareMembers(left, right, preferredBranchId) {
|
|
|
3865
3889
|
if (leftPreferred !== rightPreferred) {
|
|
3866
3890
|
return leftPreferred ? -1 : 1;
|
|
3867
3891
|
}
|
|
3868
|
-
return
|
|
3892
|
+
return chunkRWUWTJQY_cjs.compareStrings(left.staged.branchId, right.staged.branchId);
|
|
3869
3893
|
}
|
|
3870
3894
|
function pickSurvivor(edges, preferredBranchId) {
|
|
3871
3895
|
const inherited = edges.filter(
|
|
@@ -3891,8 +3915,8 @@ function authoredProperty(edge, property) {
|
|
|
3891
3915
|
}
|
|
3892
3916
|
function unauthoredValue(property, edges) {
|
|
3893
3917
|
const carriers = edges.filter((edge) => chunkN66HCGCY_cjs.hasOwnKey(edge.staged.props, property)).sort((left, right) => {
|
|
3894
|
-
const byId2 =
|
|
3895
|
-
return byId2 === 0 ?
|
|
3918
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(left.staged.id, right.staged.id);
|
|
3919
|
+
return byId2 === 0 ? chunkRWUWTJQY_cjs.compareStrings(
|
|
3896
3920
|
canonicalValueKey(left.staged.props[property]),
|
|
3897
3921
|
canonicalValueKey(right.staged.props[property])
|
|
3898
3922
|
) : byId2;
|
|
@@ -3909,7 +3933,7 @@ function unionEdgeProps(survivorId, kind, survivor, edges, context, branchRank,
|
|
|
3909
3933
|
const props = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
3910
3934
|
const conflicts = [];
|
|
3911
3935
|
for (const property of [...propertyNames].sort(
|
|
3912
|
-
(left, right) =>
|
|
3936
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
3913
3937
|
)) {
|
|
3914
3938
|
const claimants = edges.filter((edge) => authoredProperty(edge, property)).map((edge) => edge.staged);
|
|
3915
3939
|
const values = collectConflictingValues(property, claimants);
|
|
@@ -3942,7 +3966,7 @@ function unionEdgeProps(survivorId, kind, survivor, edges, context, branchRank,
|
|
|
3942
3966
|
function foldEdgeSet(foldSet, context, branchRank, preferredBranchId) {
|
|
3943
3967
|
const survivor = pickSurvivor(foldSet, preferredBranchId);
|
|
3944
3968
|
const survivorId = survivor.staged.id;
|
|
3945
|
-
const mergedIds = foldSet.map((edge) => edge.staged.id).sort((left, right) =>
|
|
3969
|
+
const mergedIds = foldSet.map((edge) => edge.staged.id).sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
3946
3970
|
const fromId = idOf(survivor.fromKey);
|
|
3947
3971
|
const fromKind = kindOf(survivor.fromKey);
|
|
3948
3972
|
const toId = idOf(survivor.toKey);
|
|
@@ -4040,7 +4064,7 @@ function repointEdges(stagedEdges, canonicalOf, deletedNodeIds, policy, branchRa
|
|
|
4040
4064
|
const merged = [];
|
|
4041
4065
|
const conflicts = [];
|
|
4042
4066
|
const sortedGroups = [...liveByGroup.keys()].sort(
|
|
4043
|
-
(left, right) =>
|
|
4067
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
4044
4068
|
);
|
|
4045
4069
|
for (const group of sortedGroups) {
|
|
4046
4070
|
const groupEdges = chunkN66HCGCY_cjs.requireDefined(liveByGroup.get(group));
|
|
@@ -4068,12 +4092,12 @@ function repointEdges(stagedEdges, canonicalOf, deletedNodeIds, policy, branchRa
|
|
|
4068
4092
|
),
|
|
4069
4093
|
edge.id
|
|
4070
4094
|
])
|
|
4071
|
-
})).sort((left, right) =>
|
|
4095
|
+
})).sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.sortKey, right.sortKey)).map(({ edge }) => edge);
|
|
4072
4096
|
return {
|
|
4073
4097
|
edges: sortedEdges,
|
|
4074
|
-
dropped: dropped.sort((left, right) =>
|
|
4098
|
+
dropped: dropped.sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)),
|
|
4075
4099
|
conflicts: conflicts.sort(
|
|
4076
|
-
(left, right) =>
|
|
4100
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(
|
|
4077
4101
|
`${left.entityId}|${left.property}`,
|
|
4078
4102
|
`${right.entityId}|${right.property}`
|
|
4079
4103
|
)
|
|
@@ -4744,7 +4768,7 @@ var mergePlanArtifactV1Schema = mergePlanArtifactV1BaseSchema.superRefine(
|
|
|
4744
4768
|
// src/graph-merge/plan-canonical.ts
|
|
4745
4769
|
function canonicalMergePlanJson(artifact) {
|
|
4746
4770
|
const digestless = "digest" in artifact ? omitDigest(artifact) : artifact;
|
|
4747
|
-
return JSON.stringify(digestless,
|
|
4771
|
+
return JSON.stringify(digestless, chunkZBFZGLZE_cjs.sortedReplacer);
|
|
4748
4772
|
}
|
|
4749
4773
|
async function computeMergePlanDigest(artifact) {
|
|
4750
4774
|
return chunkZY4GXIVN_cjs.sha256Hex(canonicalMergePlanJson(artifact), 32);
|
|
@@ -4758,7 +4782,7 @@ async function finalizeMergePlanArtifact(artifact) {
|
|
|
4758
4782
|
}
|
|
4759
4783
|
};
|
|
4760
4784
|
const canonical = JSON.parse(
|
|
4761
|
-
JSON.stringify(finalized,
|
|
4785
|
+
JSON.stringify(finalized, chunkZBFZGLZE_cjs.sortedReplacer)
|
|
4762
4786
|
);
|
|
4763
4787
|
return canonical;
|
|
4764
4788
|
}
|
|
@@ -4823,7 +4847,7 @@ function readFormatVersion(input) {
|
|
|
4823
4847
|
}
|
|
4824
4848
|
var PROVENANCE_KIND = "Provenance";
|
|
4825
4849
|
var PROVENANCE_OWNER_KIND = "ProvenanceOwner";
|
|
4826
|
-
var Provenance =
|
|
4850
|
+
var Provenance = chunkIPRP6TDL_cjs.defineNode(PROVENANCE_KIND, {
|
|
4827
4851
|
schema: zod.z.object({
|
|
4828
4852
|
targetGraphId: zod.z.string(),
|
|
4829
4853
|
role: zod.z.enum(["node", "edge"]),
|
|
@@ -4836,7 +4860,7 @@ var Provenance = chunk26YKDNUD_cjs.defineNode(PROVENANCE_KIND, {
|
|
|
4836
4860
|
var PROVENANCE_OWNER = "@nicia-ai/typegraph/merge-provenance";
|
|
4837
4861
|
var PROVENANCE_OWNER_VERSION = 1;
|
|
4838
4862
|
var PROVENANCE_OWNER_ID = "merge-provenance-owner";
|
|
4839
|
-
var ProvenanceOwner =
|
|
4863
|
+
var ProvenanceOwner = chunkIPRP6TDL_cjs.defineNode(PROVENANCE_OWNER_KIND, {
|
|
4840
4864
|
schema: zod.z.object({
|
|
4841
4865
|
owner: zod.z.literal(PROVENANCE_OWNER),
|
|
4842
4866
|
version: zod.z.literal(PROVENANCE_OWNER_VERSION),
|
|
@@ -4847,7 +4871,7 @@ function provenanceGraphId(targetGraphId) {
|
|
|
4847
4871
|
return `${targetGraphId}::merge-provenance`;
|
|
4848
4872
|
}
|
|
4849
4873
|
function buildOwnedProvenanceGraph(targetGraphId) {
|
|
4850
|
-
return
|
|
4874
|
+
return chunkG2TLHH6T_cjs.defineInternalGraph({
|
|
4851
4875
|
id: provenanceGraphId(targetGraphId),
|
|
4852
4876
|
nodes: {
|
|
4853
4877
|
Provenance: { type: Provenance },
|
|
@@ -4857,14 +4881,14 @@ function buildOwnedProvenanceGraph(targetGraphId) {
|
|
|
4857
4881
|
});
|
|
4858
4882
|
}
|
|
4859
4883
|
function buildProvenanceGraph(targetGraphId) {
|
|
4860
|
-
return
|
|
4884
|
+
return chunkG2TLHH6T_cjs.defineInternalGraph({
|
|
4861
4885
|
id: provenanceGraphId(targetGraphId),
|
|
4862
4886
|
nodes: { Provenance: { type: Provenance } },
|
|
4863
4887
|
edges: {}
|
|
4864
4888
|
});
|
|
4865
4889
|
}
|
|
4866
4890
|
async function openProvenanceStore(...args) {
|
|
4867
|
-
const [backend, targetGraphId] = args.length === 1 ? [
|
|
4891
|
+
const [backend, targetGraphId] = args.length === 1 ? [chunkTUVD4DFR_cjs.storeBackend(args[0]), args[0].graphId] : args;
|
|
4868
4892
|
const graph = buildOwnedProvenanceGraph(targetGraphId);
|
|
4869
4893
|
const preflight = await inspectSidecarGraphId(backend, graph, targetGraphId);
|
|
4870
4894
|
if (preflight.state === "refuse") {
|
|
@@ -4876,7 +4900,7 @@ async function openProvenanceStore(...args) {
|
|
|
4876
4900
|
throw provenanceGraphIdCollision(graph.id, targetGraphId, claim.reason);
|
|
4877
4901
|
}
|
|
4878
4902
|
}
|
|
4879
|
-
const [store] = await
|
|
4903
|
+
const [store] = await chunkWCLMKNQE_cjs.createStoreWithSchema(graph, backend);
|
|
4880
4904
|
return store;
|
|
4881
4905
|
}
|
|
4882
4906
|
async function claimSidecarOwnership(backend, graph, targetGraphId) {
|
|
@@ -4903,10 +4927,10 @@ async function claimSidecarOwnership(backend, graph, targetGraphId) {
|
|
|
4903
4927
|
}
|
|
4904
4928
|
async function drainUnfencedRowWriters(tx) {
|
|
4905
4929
|
if (tx.dialect !== "postgres") return;
|
|
4906
|
-
const schema =
|
|
4930
|
+
const schema = chunkIHK5KA2Q_cjs.createSqlSchema(tx.tableNames);
|
|
4907
4931
|
await tx.executeStatement(
|
|
4908
|
-
|
|
4909
|
-
|
|
4932
|
+
chunkOJHD3LXJ_cjs.asCompiledStatementSql(
|
|
4933
|
+
chunkOJHD3LXJ_cjs.sql`LOCK TABLE ${schema.nodesTable}, ${schema.edgesTable} IN SHARE ROW EXCLUSIVE MODE`
|
|
4910
4934
|
)
|
|
4911
4935
|
);
|
|
4912
4936
|
}
|
|
@@ -4925,14 +4949,14 @@ async function inspectSidecarGraphId(port, graph, targetGraphId) {
|
|
|
4925
4949
|
if (activeSchema === void 0) {
|
|
4926
4950
|
return { state: "refuse", reason: "application-graph" };
|
|
4927
4951
|
}
|
|
4928
|
-
const ownedHash = await
|
|
4929
|
-
|
|
4952
|
+
const ownedHash = await chunk7CCMCMJO_cjs.computeSchemaHash(
|
|
4953
|
+
chunk7CCMCMJO_cjs.serializeSchema(graph, activeSchema.version)
|
|
4930
4954
|
);
|
|
4931
4955
|
if (activeSchema.schema_hash === ownedHash) {
|
|
4932
4956
|
return { state: "refuse", reason: "unowned-exact-schema-graph" };
|
|
4933
4957
|
}
|
|
4934
|
-
const legacyHash = await
|
|
4935
|
-
|
|
4958
|
+
const legacyHash = await chunk7CCMCMJO_cjs.computeSchemaHash(
|
|
4959
|
+
chunk7CCMCMJO_cjs.serializeSchema(buildProvenanceGraph(targetGraphId), activeSchema.version)
|
|
4936
4960
|
);
|
|
4937
4961
|
if (activeSchema.schema_hash !== legacyHash) {
|
|
4938
4962
|
return { state: "refuse", reason: "application-graph" };
|
|
@@ -4972,7 +4996,7 @@ var SIDECAR_REFUSALS = {
|
|
|
4972
4996
|
};
|
|
4973
4997
|
function provenanceGraphIdCollision(graphId, targetGraphId, reason) {
|
|
4974
4998
|
const refusal = SIDECAR_REFUSALS[reason];
|
|
4975
|
-
return new
|
|
4999
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
4976
5000
|
refusal.describe(graphId, targetGraphId),
|
|
4977
5001
|
{
|
|
4978
5002
|
code: "GRAPH_MERGE_PROVENANCE_ID_COLLISION",
|
|
@@ -4984,7 +5008,7 @@ function provenanceGraphIdCollision(graphId, targetGraphId, reason) {
|
|
|
4984
5008
|
);
|
|
4985
5009
|
}
|
|
4986
5010
|
function provenanceClaimUnfenced(graphId, targetGraphId) {
|
|
4987
|
-
return new
|
|
5011
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
4988
5012
|
`Claiming graph id "${graphId}" for merge provenance requires a transactional schema fence, which this backend does not provide.`,
|
|
4989
5013
|
{
|
|
4990
5014
|
code: "GRAPH_MERGE_PROVENANCE_CLAIM_UNFENCED",
|
|
@@ -5036,12 +5060,12 @@ async function* readRowsOfKind(port, graphId, kind) {
|
|
|
5036
5060
|
}
|
|
5037
5061
|
}
|
|
5038
5062
|
async function hasRowsUnderGraphId(port, graphId, scope) {
|
|
5039
|
-
const schema =
|
|
5040
|
-
const kindFilter = scope === "any" ?
|
|
5063
|
+
const schema = chunkIHK5KA2Q_cjs.createSqlSchema(port.tableNames);
|
|
5064
|
+
const kindFilter = scope === "any" ? chunkOJHD3LXJ_cjs.sql.empty() : chunkOJHD3LXJ_cjs.sql` AND kind <> ${PROVENANCE_KIND}`;
|
|
5041
5065
|
if (await hasRowsInTable(port, schema.tables.nodes, graphId, kindFilter)) {
|
|
5042
5066
|
return true;
|
|
5043
5067
|
}
|
|
5044
|
-
if (await hasRowsInTable(port, schema.tables.edges, graphId,
|
|
5068
|
+
if (await hasRowsInTable(port, schema.tables.edges, graphId, chunkOJHD3LXJ_cjs.sql.empty())) {
|
|
5045
5069
|
return true;
|
|
5046
5070
|
}
|
|
5047
5071
|
for (const tableName of secondaryRowTableNames(schema.tables)) {
|
|
@@ -5061,14 +5085,15 @@ function secondaryRowTableNames(tables) {
|
|
|
5061
5085
|
tables.identityClosure,
|
|
5062
5086
|
tables.identitySeparation,
|
|
5063
5087
|
tables.fulltext,
|
|
5064
|
-
tables.uniques
|
|
5088
|
+
tables.uniques,
|
|
5089
|
+
tables.edgeClaims
|
|
5065
5090
|
])
|
|
5066
5091
|
];
|
|
5067
5092
|
}
|
|
5068
5093
|
async function hasRowsInTable(port, tableName, graphId, filter) {
|
|
5069
5094
|
const rows = await port.execute(
|
|
5070
|
-
|
|
5071
|
-
|
|
5095
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(
|
|
5096
|
+
chunkOJHD3LXJ_cjs.sql`SELECT 1 AS present FROM ${chunkOJHD3LXJ_cjs.sql.identifier(tableName)} WHERE graph_id = ${graphId}${filter} LIMIT 1`
|
|
5072
5097
|
)
|
|
5073
5098
|
);
|
|
5074
5099
|
return rows.length > 0;
|
|
@@ -5076,10 +5101,10 @@ async function hasRowsInTable(port, tableName, graphId, filter) {
|
|
|
5076
5101
|
async function hasRowsInSecondaryTable(port, tableName, graphId) {
|
|
5077
5102
|
const tableExists = port.tableExists;
|
|
5078
5103
|
if (tableExists !== void 0) {
|
|
5079
|
-
return await tableExists(tableName) && await hasRowsInTable(port, tableName, graphId,
|
|
5104
|
+
return await tableExists(tableName) && await hasRowsInTable(port, tableName, graphId, chunkOJHD3LXJ_cjs.sql.empty());
|
|
5080
5105
|
}
|
|
5081
5106
|
try {
|
|
5082
|
-
return await hasRowsInTable(port, tableName, graphId,
|
|
5107
|
+
return await hasRowsInTable(port, tableName, graphId, chunkOJHD3LXJ_cjs.sql.empty());
|
|
5083
5108
|
} catch {
|
|
5084
5109
|
return false;
|
|
5085
5110
|
}
|
|
@@ -5124,7 +5149,7 @@ function contributionKey(record) {
|
|
|
5124
5149
|
]);
|
|
5125
5150
|
}
|
|
5126
5151
|
function encodeProvenanceTuple(values) {
|
|
5127
|
-
return values.some((value) => value.includes(ID_SEPARATOR)) ?
|
|
5152
|
+
return values.some((value) => value.includes(ID_SEPARATOR)) ? chunkLLVOQOWE_cjs.encodeTupleKey(values) : values.join(ID_SEPARATOR);
|
|
5128
5153
|
}
|
|
5129
5154
|
async function provenanceNodeId(targetGraphId, record) {
|
|
5130
5155
|
const tuple = encodeProvenanceTuple([
|
|
@@ -5167,7 +5192,7 @@ async function readProvenance(store, query = {}) {
|
|
|
5167
5192
|
const all = await store.nodes.Provenance.find();
|
|
5168
5193
|
return all.filter(
|
|
5169
5194
|
(node) => (query.branchId === void 0 || node.branchId === query.branchId) && (query.canonicalId === void 0 || node.canonicalId === query.canonicalId) && (query.role === void 0 || node.role === query.role)
|
|
5170
|
-
).sort((left, right) =>
|
|
5195
|
+
).sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id));
|
|
5171
5196
|
}
|
|
5172
5197
|
|
|
5173
5198
|
// src/graph-merge/sources.ts
|
|
@@ -5177,10 +5202,10 @@ function orderEndpoints(left, right, sources) {
|
|
|
5177
5202
|
return compareMergeKeys(leftKey, rightKey) <= 0 ? { a: leftKey, b: rightKey, left, right, sources } : { a: rightKey, b: leftKey, left: right, right: left, sources };
|
|
5178
5203
|
}
|
|
5179
5204
|
function sortMembersById(members) {
|
|
5180
|
-
return [...members].sort((left, right) =>
|
|
5205
|
+
return [...members].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id));
|
|
5181
5206
|
}
|
|
5182
5207
|
function sortedBucketKeys(blocks) {
|
|
5183
|
-
return [...blocks.keys()].sort((left, right) =>
|
|
5208
|
+
return [...blocks.keys()].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
5184
5209
|
}
|
|
5185
5210
|
var NODE_SYSTEM_FIELDS = /* @__PURE__ */ new Set(["id", "kind", "meta"]);
|
|
5186
5211
|
function nodeProps(node) {
|
|
@@ -5208,7 +5233,7 @@ function windowedPairs(members, config) {
|
|
|
5208
5233
|
key: fieldText(node, config.sortFields)
|
|
5209
5234
|
}));
|
|
5210
5235
|
keyed.sort(
|
|
5211
|
-
(left, right) => left.key === right.key ?
|
|
5236
|
+
(left, right) => left.key === right.key ? chunkRWUWTJQY_cjs.compareStrings(left.node.id, right.node.id) : chunkRWUWTJQY_cjs.compareStrings(left.key, right.key)
|
|
5212
5237
|
);
|
|
5213
5238
|
const pairs = [];
|
|
5214
5239
|
for (let index = 0; index < keyed.length; index += 1) {
|
|
@@ -5319,7 +5344,7 @@ function ontologyRetypeEdges(stagedIdentities, isRetypeCompatible) {
|
|
|
5319
5344
|
}
|
|
5320
5345
|
}
|
|
5321
5346
|
const edges = [];
|
|
5322
|
-
for (const id of [...identitiesById.keys()].sort(
|
|
5347
|
+
for (const id of [...identitiesById.keys()].sort(chunkRWUWTJQY_cjs.compareStrings)) {
|
|
5323
5348
|
const identities = [...new Set(identitiesById.get(id))].sort(
|
|
5324
5349
|
compareMergeKeys
|
|
5325
5350
|
);
|
|
@@ -5427,7 +5452,7 @@ var baseUniqueSource = {
|
|
|
5427
5452
|
const forcedEdges = [];
|
|
5428
5453
|
const baseMembers = /* @__PURE__ */ new Map();
|
|
5429
5454
|
const constraints = [...uniqueConstraints].sort(
|
|
5430
|
-
(left, right) =>
|
|
5455
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.name, right.name)
|
|
5431
5456
|
);
|
|
5432
5457
|
const items = nodes.map((node) => ({ props: nodeProps(node) }));
|
|
5433
5458
|
const matchesByConstraint = await Promise.all(
|
|
@@ -5497,7 +5522,7 @@ var baseUniqueSource = {
|
|
|
5497
5522
|
pairs: [],
|
|
5498
5523
|
forcedEdges,
|
|
5499
5524
|
baseMembers: [...baseMembers.values()].sort(
|
|
5500
|
-
(left, right) =>
|
|
5525
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
5501
5526
|
)
|
|
5502
5527
|
};
|
|
5503
5528
|
}
|
|
@@ -5575,7 +5600,7 @@ var baseKeySource = {
|
|
|
5575
5600
|
pairs,
|
|
5576
5601
|
forcedEdges: [],
|
|
5577
5602
|
baseMembers: [...baseMembers.values()].sort(
|
|
5578
|
-
(left, right) =>
|
|
5603
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
5579
5604
|
)
|
|
5580
5605
|
};
|
|
5581
5606
|
}
|
|
@@ -5587,16 +5612,16 @@ var CANDIDATE_SOURCES = [
|
|
|
5587
5612
|
|
|
5588
5613
|
// src/graph-merge/staging.ts
|
|
5589
5614
|
function compareByIdThenBranch(left, right) {
|
|
5590
|
-
const byId2 =
|
|
5591
|
-
return byId2 === 0 ?
|
|
5615
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(left.id, right.id);
|
|
5616
|
+
return byId2 === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
5592
5617
|
}
|
|
5593
5618
|
function compareByKindIdBranch(left, right) {
|
|
5594
|
-
const byKind =
|
|
5619
|
+
const byKind = chunkRWUWTJQY_cjs.compareStrings(left.kind, right.kind);
|
|
5595
5620
|
if (byKind !== 0) {
|
|
5596
5621
|
return byKind;
|
|
5597
5622
|
}
|
|
5598
|
-
const byId2 =
|
|
5599
|
-
return byId2 === 0 ?
|
|
5623
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(left.id, right.id);
|
|
5624
|
+
return byId2 === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
5600
5625
|
}
|
|
5601
5626
|
function groupByKind(items) {
|
|
5602
5627
|
const buckets = /* @__PURE__ */ new Map();
|
|
@@ -5610,7 +5635,7 @@ function groupByKind(items) {
|
|
|
5610
5635
|
}
|
|
5611
5636
|
const ordered = /* @__PURE__ */ new Map();
|
|
5612
5637
|
for (const kind of [...buckets.keys()].sort(
|
|
5613
|
-
(left, right) =>
|
|
5638
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
5614
5639
|
)) {
|
|
5615
5640
|
ordered.set(
|
|
5616
5641
|
kind,
|
|
@@ -5632,7 +5657,7 @@ async function stageBranches(baseStore, branches, captureTargetStateFor) {
|
|
|
5632
5657
|
const windowedEdges = [];
|
|
5633
5658
|
const newIdentityAssertions = [];
|
|
5634
5659
|
const retractedIdentityAssertions = [];
|
|
5635
|
-
const baseIdentityAssertions = await
|
|
5660
|
+
const baseIdentityAssertions = await chunkTUVD4DFR_cjs.storeRuntime(baseStore).readCurrentIdentityAssertions("state");
|
|
5636
5661
|
let targetNodeVersions = /* @__PURE__ */ new Map();
|
|
5637
5662
|
let targetEdgeSignatures = /* @__PURE__ */ new Map();
|
|
5638
5663
|
for (const branch2 of branches) {
|
|
@@ -5703,17 +5728,17 @@ async function stageBranches(baseStore, branches, captureTargetStateFor) {
|
|
|
5703
5728
|
(left, right) => compareByKindIdBranch(left, right)
|
|
5704
5729
|
),
|
|
5705
5730
|
newIdentityAssertions: newIdentityAssertions.toSorted((left, right) => {
|
|
5706
|
-
const byId2 =
|
|
5707
|
-
return byId2 === 0 ?
|
|
5731
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(left.assertion.id, right.assertion.id);
|
|
5732
|
+
return byId2 === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
5708
5733
|
}),
|
|
5709
5734
|
retractedIdentityAssertions: retractedIdentityAssertions.toSorted(
|
|
5710
5735
|
(left, right) => {
|
|
5711
|
-
const byId2 =
|
|
5712
|
-
return byId2 === 0 ?
|
|
5736
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(left.assertion.id, right.assertion.id);
|
|
5737
|
+
return byId2 === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
5713
5738
|
}
|
|
5714
5739
|
),
|
|
5715
5740
|
baseIdentityAssertions: baseIdentityAssertions.toSorted(
|
|
5716
|
-
(left, right) =>
|
|
5741
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
5717
5742
|
),
|
|
5718
5743
|
targetNodeVersions,
|
|
5719
5744
|
targetEdgeSignatures
|
|
@@ -5765,7 +5790,7 @@ async function withTxConflictRetry(commit) {
|
|
|
5765
5790
|
// src/graph-merge/type-reconcile.ts
|
|
5766
5791
|
var INCOMPATIBLE_TYPES_FLAG_REASON = "type-reconcile:incompatible-kinds";
|
|
5767
5792
|
function distinctKinds(kinds) {
|
|
5768
|
-
return [...new Set(kinds)].sort((left, right) =>
|
|
5793
|
+
return [...new Set(kinds)].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
5769
5794
|
}
|
|
5770
5795
|
function areEquivalent(closure, left, right) {
|
|
5771
5796
|
return left !== right && isReachable2(closure, left, right) && isReachable2(closure, right, left);
|
|
@@ -5784,7 +5809,7 @@ function mostSpecificCommonKind(closure, kinds) {
|
|
|
5784
5809
|
return void 0;
|
|
5785
5810
|
}
|
|
5786
5811
|
return chunkN66HCGCY_cjs.requireDefined(
|
|
5787
|
-
[...qualifiers].sort((left, right) =>
|
|
5812
|
+
[...qualifiers].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right))[0]
|
|
5788
5813
|
);
|
|
5789
5814
|
}
|
|
5790
5815
|
function reconcileTypes(clusters, closure, mode) {
|
|
@@ -5822,10 +5847,10 @@ function reconcileTypes(clusters, closure, mode) {
|
|
|
5822
5847
|
}
|
|
5823
5848
|
return {
|
|
5824
5849
|
reconciliations: reconciliations.sort(
|
|
5825
|
-
(left, right) =>
|
|
5850
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.entityId, right.entityId)
|
|
5826
5851
|
),
|
|
5827
5852
|
retypeMap,
|
|
5828
|
-
dropped: dropped.sort((left, right) =>
|
|
5853
|
+
dropped: dropped.sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id))
|
|
5829
5854
|
};
|
|
5830
5855
|
}
|
|
5831
5856
|
|
|
@@ -5843,8 +5868,8 @@ function newNodesByKind(staging) {
|
|
|
5843
5868
|
ordered.set(
|
|
5844
5869
|
kind,
|
|
5845
5870
|
[...items].sort((left, right) => {
|
|
5846
|
-
const byId2 =
|
|
5847
|
-
return byId2 === 0 ?
|
|
5871
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(left.node.id, right.node.id);
|
|
5872
|
+
return byId2 === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
5848
5873
|
})
|
|
5849
5874
|
);
|
|
5850
5875
|
}
|
|
@@ -5878,7 +5903,7 @@ async function precomputeEmbeddings(byKind, resolve, embedder) {
|
|
|
5878
5903
|
}
|
|
5879
5904
|
async function embedSortedTexts(texts, embedder) {
|
|
5880
5905
|
const orderedTexts = [...texts].sort(
|
|
5881
|
-
(left, right) =>
|
|
5906
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
5882
5907
|
);
|
|
5883
5908
|
const vectors = await embedder(orderedTexts);
|
|
5884
5909
|
if (vectors.length !== orderedTexts.length) {
|
|
@@ -5930,7 +5955,7 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
5930
5955
|
async ([kind, items]) => {
|
|
5931
5956
|
const resolveConfig = options.resolve[kind];
|
|
5932
5957
|
if (resolveConfig === void 0) {
|
|
5933
|
-
return
|
|
5958
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
5934
5959
|
edges: [],
|
|
5935
5960
|
warnings: [],
|
|
5936
5961
|
baseMembers: [],
|
|
@@ -5980,10 +6005,10 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
5980
6005
|
options.maxComparisonsPerKind,
|
|
5981
6006
|
options.candidateDiagnostics?.limit ?? 0
|
|
5982
6007
|
);
|
|
5983
|
-
if (
|
|
5984
|
-
return
|
|
6008
|
+
if (chunkRJMHU2MG_cjs.isErr(scored)) {
|
|
6009
|
+
return chunkRJMHU2MG_cjs.err(scored.error);
|
|
5985
6010
|
}
|
|
5986
|
-
return
|
|
6011
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
5987
6012
|
edges: scored.data.edges,
|
|
5988
6013
|
warnings: scored.data.warnings.map(
|
|
5989
6014
|
(warning) => `[${kind}] ${warning.message}`
|
|
@@ -5996,8 +6021,8 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
5996
6021
|
)
|
|
5997
6022
|
);
|
|
5998
6023
|
for (const result of perKind) {
|
|
5999
|
-
if (
|
|
6000
|
-
return
|
|
6024
|
+
if (chunkRJMHU2MG_cjs.isErr(result)) {
|
|
6025
|
+
return chunkRJMHU2MG_cjs.err(result.error);
|
|
6001
6026
|
}
|
|
6002
6027
|
allEdges.push(...result.data.edges);
|
|
6003
6028
|
warnings.push(...result.data.warnings);
|
|
@@ -6011,7 +6036,7 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
6011
6036
|
}
|
|
6012
6037
|
diagnosticsTotal += result.data.diagnosticsTotal;
|
|
6013
6038
|
}
|
|
6014
|
-
return
|
|
6039
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
6015
6040
|
// The ONE shared `(a, b)` edge comparator (id-first `(kind, id)` order), so this
|
|
6016
6041
|
// stage emits edges in exactly the order clustering consumes them.
|
|
6017
6042
|
edges: allEdges.sort((left, right) => compareCandidateEdges(left, right)),
|
|
@@ -6153,9 +6178,9 @@ function buildProvenanceIndex(records) {
|
|
|
6153
6178
|
for (const [branchId, sets] of byBranch) {
|
|
6154
6179
|
frozen.set(branchId, {
|
|
6155
6180
|
nodeIds: [...sets.nodeIds].sort(
|
|
6156
|
-
(left, right) =>
|
|
6181
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
6157
6182
|
),
|
|
6158
|
-
edgeIds: [...sets.edgeIds].sort((left, right) =>
|
|
6183
|
+
edgeIds: [...sets.edgeIds].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)).map((id) => id)
|
|
6159
6184
|
});
|
|
6160
6185
|
}
|
|
6161
6186
|
return {
|
|
@@ -6555,7 +6580,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
6555
6580
|
...identityRemap.dropped,
|
|
6556
6581
|
...validWindows.dropped
|
|
6557
6582
|
].sort(
|
|
6558
|
-
(left, right) =>
|
|
6583
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(`${left.kind}|${left.id}`, `${right.kind}|${right.id}`)
|
|
6559
6584
|
);
|
|
6560
6585
|
return {
|
|
6561
6586
|
canonicalEntities,
|
|
@@ -6592,7 +6617,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
6592
6617
|
mergeKey(left.kind, left.entityId),
|
|
6593
6618
|
mergeKey(right.kind, right.entityId)
|
|
6594
6619
|
);
|
|
6595
|
-
return byEntity === 0 ?
|
|
6620
|
+
return byEntity === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.property, right.property) : byEntity;
|
|
6596
6621
|
}
|
|
6597
6622
|
),
|
|
6598
6623
|
deleteModifyConflicts: [
|
|
@@ -6775,7 +6800,7 @@ async function applyNodeRows(target, txBackend, nodesApi, deletions, upserts) {
|
|
|
6775
6800
|
afterImages.set(mergeKey(kind, item.id), props);
|
|
6776
6801
|
}
|
|
6777
6802
|
}
|
|
6778
|
-
return
|
|
6803
|
+
return chunkTUVD4DFR_cjs.storeRuntime(target).applyResolvedNodeUniqueness(
|
|
6779
6804
|
txBackend,
|
|
6780
6805
|
{
|
|
6781
6806
|
upserts: upserts.map((upsert) => ({
|
|
@@ -6823,7 +6848,7 @@ async function applyEdgeRows(edgesApi, deletions, upserts) {
|
|
|
6823
6848
|
}
|
|
6824
6849
|
async function applyIdentityRows(target, txBackend, assertions, retractions, assertConsistent) {
|
|
6825
6850
|
try {
|
|
6826
|
-
const applied = await
|
|
6851
|
+
const applied = await chunkTUVD4DFR_cjs.storeRuntime(target).applyIdentityMergeAtTarget(
|
|
6827
6852
|
txBackend,
|
|
6828
6853
|
retractions,
|
|
6829
6854
|
assertions
|
|
@@ -6871,7 +6896,7 @@ async function applyInternalMergePlan(plan, nodesApi, edgesApi, target, txBacken
|
|
|
6871
6896
|
nodeUpserts
|
|
6872
6897
|
);
|
|
6873
6898
|
} catch (error) {
|
|
6874
|
-
throw error instanceof
|
|
6899
|
+
throw error instanceof chunkX4GDXBOP_cjs.IdentityEndpointValidityError ? translateIdentityCommitError(error) : error;
|
|
6875
6900
|
}
|
|
6876
6901
|
const edgeDeletions = [...plan.edgeDeletions].map(([identity, kind]) => ({
|
|
6877
6902
|
kind,
|
|
@@ -6921,7 +6946,7 @@ async function applyInternalMergePlan(plan, nodesApi, edgesApi, target, txBacken
|
|
|
6921
6946
|
};
|
|
6922
6947
|
}
|
|
6923
6948
|
async function commitPlan(target, plan, expectedBaseVersion) {
|
|
6924
|
-
if (!
|
|
6949
|
+
if (!chunkTUVD4DFR_cjs.storeBackend(target).capabilities.transactions) {
|
|
6925
6950
|
throw new MergeError(
|
|
6926
6951
|
"merge() requires a transaction-capable target backend. The merged plan (canonical upserts, soft-deletes, edge upserts) must commit atomically; a non-transactional fallback would leave a partially-merged graph on a mid-commit failure. (mergeIncremental() enforces the same requirement.)",
|
|
6927
6952
|
{ details: { capability: "transactions" } }
|
|
@@ -6932,14 +6957,14 @@ async function commitPlan(target, plan, expectedBaseVersion) {
|
|
|
6932
6957
|
() => target.transaction(async (tx) => {
|
|
6933
6958
|
if (expectedBaseVersion !== void 0) {
|
|
6934
6959
|
await assertTargetUnchanged(
|
|
6935
|
-
|
|
6960
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx),
|
|
6936
6961
|
target,
|
|
6937
6962
|
expectedBaseVersion
|
|
6938
6963
|
);
|
|
6939
6964
|
}
|
|
6940
6965
|
await assertPlannedIdentityIdsFresh(
|
|
6941
6966
|
target,
|
|
6942
|
-
|
|
6967
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx),
|
|
6943
6968
|
plan
|
|
6944
6969
|
);
|
|
6945
6970
|
return applyInternalMergePlan(
|
|
@@ -6947,7 +6972,7 @@ async function commitPlan(target, plan, expectedBaseVersion) {
|
|
|
6947
6972
|
tx.nodes,
|
|
6948
6973
|
tx.edges,
|
|
6949
6974
|
target,
|
|
6950
|
-
|
|
6975
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx)
|
|
6951
6976
|
);
|
|
6952
6977
|
}, mergeCommitTransactionOptions(target))
|
|
6953
6978
|
)
|
|
@@ -6968,9 +6993,9 @@ function mergeCommitTransactionOptions(target) {
|
|
|
6968
6993
|
}
|
|
6969
6994
|
async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
6970
6995
|
if (hasRevisionAnchor(expectedBaseVersion)) {
|
|
6971
|
-
await
|
|
6996
|
+
await chunkRDP6ZRSM_cjs.lockRecordedGraphWrite(txBackend, target.graphId);
|
|
6972
6997
|
const expectedOrigin = revisionOriginOf(expectedBaseVersion);
|
|
6973
|
-
const liveOrigin = await
|
|
6998
|
+
const liveOrigin = await chunkRDP6ZRSM_cjs.readRevisionOrigin(
|
|
6974
6999
|
txBackend,
|
|
6975
7000
|
target.revisionSchema,
|
|
6976
7001
|
target.graphId
|
|
@@ -6984,7 +7009,7 @@ async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
|
6984
7009
|
}
|
|
6985
7010
|
);
|
|
6986
7011
|
}
|
|
6987
|
-
const liveRevision = await
|
|
7012
|
+
const liveRevision = await chunkRDP6ZRSM_cjs.readRecordedClock(
|
|
6988
7013
|
txBackend,
|
|
6989
7014
|
target.revisionSchema,
|
|
6990
7015
|
target.graphId
|
|
@@ -7005,7 +7030,7 @@ async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
|
7005
7030
|
txBackend,
|
|
7006
7031
|
target.graphId,
|
|
7007
7032
|
target.graph,
|
|
7008
|
-
await
|
|
7033
|
+
await chunkTUVD4DFR_cjs.storeRuntime(target).identityAssertionsAtTarget(txBackend, "state")
|
|
7009
7034
|
);
|
|
7010
7035
|
const expectedContent = contentComponentOf(expectedBaseVersion);
|
|
7011
7036
|
if (liveContent !== expectedContent) {
|
|
@@ -7043,7 +7068,7 @@ async function validateBaseVersions(target, branches) {
|
|
|
7043
7068
|
const targetVersion = await computeBaseVersion(target);
|
|
7044
7069
|
for (const branch2 of branches) {
|
|
7045
7070
|
if (branch2.base !== targetVersion) {
|
|
7046
|
-
return
|
|
7071
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7047
7072
|
new BaseVersionMismatchError(
|
|
7048
7073
|
`Branch "${branch2.id}" forked from base@V "${branch2.base}", which does not match the merge target's current base@V "${targetVersion}".`,
|
|
7049
7074
|
{
|
|
@@ -7057,14 +7082,14 @@ async function validateBaseVersions(target, branches) {
|
|
|
7057
7082
|
);
|
|
7058
7083
|
}
|
|
7059
7084
|
}
|
|
7060
|
-
return
|
|
7085
|
+
return chunkRJMHU2MG_cjs.ok(targetVersion);
|
|
7061
7086
|
}
|
|
7062
7087
|
function tryNormalize(optionsInput, refusedOptions = []) {
|
|
7063
7088
|
const refusedOption = refusedOptions.find(
|
|
7064
7089
|
(option) => chunkN66HCGCY_cjs.hasOwnKey(optionsInput, option)
|
|
7065
7090
|
);
|
|
7066
7091
|
if (refusedOption !== void 0) {
|
|
7067
|
-
return
|
|
7092
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7068
7093
|
new InvalidMergeOptionsError(
|
|
7069
7094
|
`This merge operation does not accept options.${refusedOption}.`,
|
|
7070
7095
|
{ details: { option: refusedOption } }
|
|
@@ -7072,18 +7097,18 @@ function tryNormalize(optionsInput, refusedOptions = []) {
|
|
|
7072
7097
|
);
|
|
7073
7098
|
}
|
|
7074
7099
|
try {
|
|
7075
|
-
return
|
|
7100
|
+
return chunkRJMHU2MG_cjs.ok(normalizeMergeOptions(optionsInput));
|
|
7076
7101
|
} catch (error) {
|
|
7077
|
-
return
|
|
7102
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7078
7103
|
new InvalidMergeOptionsError("Invalid merge options.", { cause: error })
|
|
7079
7104
|
);
|
|
7080
7105
|
}
|
|
7081
7106
|
}
|
|
7082
7107
|
async function tryOpenProvenanceStore(target) {
|
|
7083
7108
|
try {
|
|
7084
|
-
return
|
|
7109
|
+
return chunkRJMHU2MG_cjs.ok(await openProvenanceStore(target));
|
|
7085
7110
|
} catch (error) {
|
|
7086
|
-
const code = error instanceof
|
|
7111
|
+
const code = error instanceof chunkX4GDXBOP_cjs.TypeGraphError ? error.details?.code : void 0;
|
|
7087
7112
|
const details = {
|
|
7088
7113
|
option: "persistProvenance",
|
|
7089
7114
|
graphId: provenanceGraphId(target.graphId),
|
|
@@ -7091,13 +7116,13 @@ async function tryOpenProvenanceStore(target) {
|
|
|
7091
7116
|
...typeof code === "string" ? { provenanceErrorCode: code } : {}
|
|
7092
7117
|
};
|
|
7093
7118
|
const message = `options.persistProvenance was requested but the merge-provenance sidecar cannot be opened: ${describeCause(error)}`;
|
|
7094
|
-
return
|
|
7119
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7095
7120
|
code === "GRAPH_MERGE_PROVENANCE_ID_COLLISION" || code === "GRAPH_MERGE_PROVENANCE_CLAIM_UNFENCED" ? new InvalidMergeOptionsError(message, { details, cause: error }) : new MergeError(message, { details, cause: error })
|
|
7096
7121
|
);
|
|
7097
7122
|
}
|
|
7098
7123
|
}
|
|
7099
7124
|
function assertPublicPlanCapability(target) {
|
|
7100
|
-
if (!
|
|
7125
|
+
if (!chunkTUVD4DFR_cjs.storeBackend(target).capabilities.transactions) {
|
|
7101
7126
|
throw new MergePlanCapabilityError(
|
|
7102
7127
|
"Public merge plans require a transaction-capable target backend.",
|
|
7103
7128
|
{ details: { capability: "transactions" } }
|
|
@@ -7116,7 +7141,7 @@ function assertPublicPlanCapability(target) {
|
|
|
7116
7141
|
async function captureMergePlanTargetFence(target) {
|
|
7117
7142
|
assertPublicPlanCapability(target);
|
|
7118
7143
|
const [activeSchema, schemaHash, origin, revision] = await Promise.all([
|
|
7119
|
-
|
|
7144
|
+
chunkTUVD4DFR_cjs.storeBackend(target).getActiveSchema(target.graphId),
|
|
7120
7145
|
computeSchemaComponent(target),
|
|
7121
7146
|
target.revisionOriginNow(),
|
|
7122
7147
|
target.revisionNow()
|
|
@@ -7145,7 +7170,7 @@ async function assertPlanningFenceUnchanged(target, startingFence) {
|
|
|
7145
7170
|
function splitWireProps(props) {
|
|
7146
7171
|
const setProps = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
7147
7172
|
const unsetProps = [];
|
|
7148
|
-
for (const key of Object.keys(props).sort(
|
|
7173
|
+
for (const key of Object.keys(props).sort(chunkRWUWTJQY_cjs.compareStrings)) {
|
|
7149
7174
|
const value = props[key];
|
|
7150
7175
|
if (value === void 0) {
|
|
7151
7176
|
unsetProps.push(key);
|
|
@@ -7262,7 +7287,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7262
7287
|
let targetBranchSeen = false;
|
|
7263
7288
|
for (const branch2 of branches) {
|
|
7264
7289
|
if (branch2.id === BASE_PROVENANCE_BRANCH) {
|
|
7265
|
-
return
|
|
7290
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7266
7291
|
new MergeError(
|
|
7267
7292
|
`Branch id "${BASE_PROVENANCE_BRANCH}" is reserved for committed-base provenance and cannot be used as a branch id.`,
|
|
7268
7293
|
{ details: { branchId: branch2.id } }
|
|
@@ -7271,7 +7296,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7271
7296
|
}
|
|
7272
7297
|
if (branch2.id === COMMITTED_TARGET_BRANCH) {
|
|
7273
7298
|
if (incremental?.targetBranchId !== COMMITTED_TARGET_BRANCH || targetBranchSeen) {
|
|
7274
|
-
return
|
|
7299
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7275
7300
|
new MergeError(
|
|
7276
7301
|
`Branch id "${COMMITTED_TARGET_BRANCH}" is reserved for the committed incremental target and cannot be used as a branch id.`,
|
|
7277
7302
|
{ details: { branchId: branch2.id } }
|
|
@@ -7282,7 +7307,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7282
7307
|
}
|
|
7283
7308
|
}
|
|
7284
7309
|
for (const branch2 of branches) {
|
|
7285
|
-
const branchSchemaRow = await
|
|
7310
|
+
const branchSchemaRow = await chunkTUVD4DFR_cjs.storeBackend(branch2.store).getActiveSchema(
|
|
7286
7311
|
branch2.store.graphId
|
|
7287
7312
|
);
|
|
7288
7313
|
let drifted;
|
|
@@ -7290,13 +7315,13 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7290
7315
|
const anchor = branch2.schemaAnchor;
|
|
7291
7316
|
drifted = anchor === void 0 ? branchSchemaRow !== void 0 : branchSchemaRow?.version !== anchor.version || branchSchemaRow.schema_hash !== anchor.hash;
|
|
7292
7317
|
} else {
|
|
7293
|
-
const sourceSchemaRow = await
|
|
7318
|
+
const sourceSchemaRow = await chunkTUVD4DFR_cjs.storeBackend(store).getActiveSchema(
|
|
7294
7319
|
store.graphId
|
|
7295
7320
|
);
|
|
7296
7321
|
drifted = branchSchemaRow?.schema_hash !== sourceSchemaRow?.schema_hash;
|
|
7297
7322
|
}
|
|
7298
7323
|
if (drifted) {
|
|
7299
|
-
return
|
|
7324
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7300
7325
|
new BaseVersionMismatchError(
|
|
7301
7326
|
`Branch "${branch2.id}"'s store has a committed schema different from its at-fork state \u2014 a schema operation ran on the branch after forking. Merge carries data changes only; apply the schema change to the target first (or re-fork), then merge.`,
|
|
7302
7327
|
{
|
|
@@ -7335,7 +7360,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7335
7360
|
options.embedder
|
|
7336
7361
|
);
|
|
7337
7362
|
const ctx = {
|
|
7338
|
-
backend:
|
|
7363
|
+
backend: chunkTUVD4DFR_cjs.storeBackend(store),
|
|
7339
7364
|
...embeddings === void 0 ? {} : { embeddings }
|
|
7340
7365
|
};
|
|
7341
7366
|
const candidates = await generateAllCandidates(
|
|
@@ -7347,8 +7372,8 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7347
7372
|
useBaseSources,
|
|
7348
7373
|
options.embedder
|
|
7349
7374
|
);
|
|
7350
|
-
if (
|
|
7351
|
-
return
|
|
7375
|
+
if (chunkRJMHU2MG_cjs.isErr(candidates)) {
|
|
7376
|
+
return chunkRJMHU2MG_cjs.err(candidates.error);
|
|
7352
7377
|
}
|
|
7353
7378
|
const identityProbeIds = target.graph.identity === void 0 ? void 0 : [
|
|
7354
7379
|
.../* @__PURE__ */ new Set([
|
|
@@ -7363,7 +7388,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7363
7388
|
])
|
|
7364
7389
|
])
|
|
7365
7390
|
];
|
|
7366
|
-
const targetPeers = identityProbeIds === void 0 ? [] : await
|
|
7391
|
+
const targetPeers = identityProbeIds === void 0 ? [] : await chunkTUVD4DFR_cjs.storeRuntime(target).liveNodesSharingIds(identityProbeIds);
|
|
7367
7392
|
const stagedIdentityIds = [
|
|
7368
7393
|
.../* @__PURE__ */ new Set([
|
|
7369
7394
|
...staging.newIdentityAssertions.map((staged) => staged.assertion.id),
|
|
@@ -7372,7 +7397,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7372
7397
|
)
|
|
7373
7398
|
])
|
|
7374
7399
|
];
|
|
7375
|
-
const storedIdentityRowsById = stagedIdentityIds.length === 0 || target.graph.identity === void 0 ? NO_STORED_ASSERTIONS : await
|
|
7400
|
+
const storedIdentityRowsById = stagedIdentityIds.length === 0 || target.graph.identity === void 0 ? NO_STORED_ASSERTIONS : await chunkTUVD4DFR_cjs.storeRuntime(target).identityAssertionRowsByIds(
|
|
7376
7401
|
stagedIdentityIds
|
|
7377
7402
|
);
|
|
7378
7403
|
const identityContext = {
|
|
@@ -7397,14 +7422,14 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7397
7422
|
if (plan.identityAssertions.length > 0) {
|
|
7398
7423
|
assertOneIdOneTruth(
|
|
7399
7424
|
plan.identityAssertions,
|
|
7400
|
-
await
|
|
7425
|
+
await chunkTUVD4DFR_cjs.storeRuntime(target).identityAssertionRowsByIds(
|
|
7401
7426
|
plan.identityAssertions.map((assertion) => assertion.id)
|
|
7402
7427
|
)
|
|
7403
7428
|
);
|
|
7404
7429
|
}
|
|
7405
7430
|
let identityGuard;
|
|
7406
7431
|
if (identityProbeIds !== void 0 && incremental !== void 0) {
|
|
7407
|
-
const freshPeers = await
|
|
7432
|
+
const freshPeers = await chunkTUVD4DFR_cjs.storeRuntime(target).liveNodesSharingIds(identityProbeIds);
|
|
7408
7433
|
const built = await buildIdentityPeerProbe(
|
|
7409
7434
|
target,
|
|
7410
7435
|
identityProbeIds,
|
|
@@ -7452,7 +7477,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7452
7477
|
targetNodeVersions: staging.targetNodeVersions,
|
|
7453
7478
|
targetEdgeSignatures: staging.targetEdgeSignatures
|
|
7454
7479
|
};
|
|
7455
|
-
return
|
|
7480
|
+
return chunkRJMHU2MG_cjs.ok(
|
|
7456
7481
|
await complete({
|
|
7457
7482
|
target,
|
|
7458
7483
|
plan,
|
|
@@ -7463,9 +7488,9 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7463
7488
|
);
|
|
7464
7489
|
} catch (error) {
|
|
7465
7490
|
if (error instanceof MergeError) {
|
|
7466
|
-
return
|
|
7491
|
+
return chunkRJMHU2MG_cjs.err(error);
|
|
7467
7492
|
}
|
|
7468
|
-
return
|
|
7493
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7469
7494
|
new MergeError(
|
|
7470
7495
|
`Merge failed while staging or committing: ${describeCause(error)}`,
|
|
7471
7496
|
{ cause: error }
|
|
@@ -7476,14 +7501,14 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7476
7501
|
async function commitResolvedMerge(resolved) {
|
|
7477
7502
|
const { target, plan, options } = resolved;
|
|
7478
7503
|
const provenanceStore = options.persistProvenance ? await tryOpenProvenanceStore(target) : void 0;
|
|
7479
|
-
if (provenanceStore !== void 0 &&
|
|
7504
|
+
if (provenanceStore !== void 0 && chunkRJMHU2MG_cjs.isErr(provenanceStore)) {
|
|
7480
7505
|
throw provenanceStore.error;
|
|
7481
7506
|
}
|
|
7482
7507
|
const merged = resolved.incrementalGuard === void 0 ? await commitPlan(target, plan, resolved.expectedBaseVersion) : await commitIncrementalPlan(target, plan, resolved.incrementalGuard);
|
|
7483
7508
|
const provenance = options.provenance ? buildProvenanceIndex(plan.provenanceRecords) : { byBranch: () => ({ nodeIds: [], edgeIds: [] }) };
|
|
7484
7509
|
const warnings = [...plan.warnings];
|
|
7485
7510
|
let provenancePersisted;
|
|
7486
|
-
if (provenanceStore !== void 0 && !
|
|
7511
|
+
if (provenanceStore !== void 0 && !chunkRJMHU2MG_cjs.isErr(provenanceStore)) {
|
|
7487
7512
|
try {
|
|
7488
7513
|
const count = await persistProvenanceRecords(
|
|
7489
7514
|
provenanceStore.data,
|
|
@@ -7536,14 +7561,14 @@ function incrementalSchemaError() {
|
|
|
7536
7561
|
async function planMerge(store, branchInputs, optionsInput = {}) {
|
|
7537
7562
|
const branches = unwrapMergeBranches(branchInputs);
|
|
7538
7563
|
const normalized = tryNormalize(optionsInput);
|
|
7539
|
-
if (
|
|
7564
|
+
if (chunkRJMHU2MG_cjs.isErr(normalized)) return chunkRJMHU2MG_cjs.err(normalized.error);
|
|
7540
7565
|
const options = normalized.data;
|
|
7541
7566
|
const target = options.target ?? store;
|
|
7542
7567
|
let targetFence;
|
|
7543
7568
|
try {
|
|
7544
7569
|
targetFence = await captureMergePlanTargetFence(target);
|
|
7545
7570
|
} catch (error) {
|
|
7546
|
-
return
|
|
7571
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7547
7572
|
error instanceof MergeError ? error : new MergePlanCapabilityError(
|
|
7548
7573
|
`Unable to capture the target's durable plan fence: ${describeCause(error)}`,
|
|
7549
7574
|
{ cause: error }
|
|
@@ -7551,11 +7576,11 @@ async function planMerge(store, branchInputs, optionsInput = {}) {
|
|
|
7551
7576
|
);
|
|
7552
7577
|
}
|
|
7553
7578
|
const precondition = await validateBaseVersions(target, branches);
|
|
7554
|
-
if (
|
|
7579
|
+
if (chunkRJMHU2MG_cjs.isErr(precondition)) return chunkRJMHU2MG_cjs.err(precondition.error);
|
|
7555
7580
|
const anchors = {
|
|
7556
7581
|
kind: "snapshot",
|
|
7557
7582
|
base: { graphId: store.graphId, baseVersion: precondition.data },
|
|
7558
|
-
branches: [...branches].sort((left, right) =>
|
|
7583
|
+
branches: [...branches].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)).map((branch2) => ({
|
|
7559
7584
|
branchId: branch2.id,
|
|
7560
7585
|
baseVersion: branch2.base
|
|
7561
7586
|
}))
|
|
@@ -7578,16 +7603,16 @@ async function planMergeIncremental(args) {
|
|
|
7578
7603
|
const { forkPoint, target } = args;
|
|
7579
7604
|
const branches = unwrapMergeBranches(args.branches);
|
|
7580
7605
|
const normalized = tryNormalize(args.options ?? {}, ["target"]);
|
|
7581
|
-
if (
|
|
7606
|
+
if (chunkRJMHU2MG_cjs.isErr(normalized)) return chunkRJMHU2MG_cjs.err(normalized.error);
|
|
7582
7607
|
const options = normalized.data;
|
|
7583
7608
|
if (options.onBasePropertyConflict !== "flag") {
|
|
7584
|
-
return
|
|
7609
|
+
return chunkRJMHU2MG_cjs.err(incrementalBaseConflictPolicyError(options));
|
|
7585
7610
|
}
|
|
7586
7611
|
let targetFence;
|
|
7587
7612
|
try {
|
|
7588
7613
|
targetFence = await captureMergePlanTargetFence(target);
|
|
7589
7614
|
} catch (error) {
|
|
7590
|
-
return
|
|
7615
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7591
7616
|
error instanceof MergeError ? error : new MergePlanCapabilityError(
|
|
7592
7617
|
`Unable to capture the target's durable plan fence: ${describeCause(error)}`,
|
|
7593
7618
|
{ cause: error }
|
|
@@ -7595,14 +7620,14 @@ async function planMergeIncremental(args) {
|
|
|
7595
7620
|
);
|
|
7596
7621
|
}
|
|
7597
7622
|
const forkPrecondition = await validateForkPointVersions(forkPoint, branches);
|
|
7598
|
-
if (
|
|
7623
|
+
if (chunkRJMHU2MG_cjs.isErr(forkPrecondition)) return chunkRJMHU2MG_cjs.err(forkPrecondition.error);
|
|
7599
7624
|
const forkVersion = forkPrecondition.data;
|
|
7600
7625
|
const [forkSchema, targetSchema] = await Promise.all([
|
|
7601
7626
|
computeSchemaComponent(forkPoint),
|
|
7602
7627
|
computeSchemaComponent(target)
|
|
7603
7628
|
]);
|
|
7604
|
-
if (forkSchema !== targetSchema) return
|
|
7605
|
-
const forkActiveSchema = await
|
|
7629
|
+
if (forkSchema !== targetSchema) return chunkRJMHU2MG_cjs.err(incrementalSchemaError());
|
|
7630
|
+
const forkActiveSchema = await chunkTUVD4DFR_cjs.storeBackend(forkPoint).getActiveSchema(
|
|
7606
7631
|
forkPoint.graphId
|
|
7607
7632
|
);
|
|
7608
7633
|
const targetBranch = {
|
|
@@ -7621,7 +7646,7 @@ async function planMergeIncremental(args) {
|
|
|
7621
7646
|
hash: forkActiveSchema?.schema_hash ?? forkSchema
|
|
7622
7647
|
}
|
|
7623
7648
|
},
|
|
7624
|
-
branches: [...branches].sort((left, right) =>
|
|
7649
|
+
branches: [...branches].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)).map((branch2) => ({
|
|
7625
7650
|
branchId: branch2.id,
|
|
7626
7651
|
baseVersion: branch2.base
|
|
7627
7652
|
}))
|
|
@@ -7843,7 +7868,7 @@ async function preflightWireMergeWrites(target, nodesApi, edgesApi, artifact) {
|
|
|
7843
7868
|
}
|
|
7844
7869
|
for (const upsert of artifact.writes.edgeUpserts) {
|
|
7845
7870
|
const registration = chunkN66HCGCY_cjs.requireDefined(graphEdges[upsert.kind]);
|
|
7846
|
-
const endpointError =
|
|
7871
|
+
const endpointError = chunkLLVOQOWE_cjs.validateEdgeEndpoints(
|
|
7847
7872
|
upsert.kind,
|
|
7848
7873
|
upsert.from.kind,
|
|
7849
7874
|
upsert.to.kind,
|
|
@@ -7946,7 +7971,7 @@ async function preflightWireMergeWrites(target, nodesApi, edgesApi, artifact) {
|
|
|
7946
7971
|
}
|
|
7947
7972
|
}
|
|
7948
7973
|
async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact) {
|
|
7949
|
-
await
|
|
7974
|
+
await chunkRDP6ZRSM_cjs.lockRecordedGraphWrite(txBackend, target.graphId);
|
|
7950
7975
|
const activeSchema = await txBackend.getActiveSchema(target.graphId);
|
|
7951
7976
|
const liveSchema = {
|
|
7952
7977
|
managed: activeSchema !== void 0,
|
|
@@ -7959,7 +7984,7 @@ async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact
|
|
|
7959
7984
|
{ details: { expected: artifact.target.schema, live: liveSchema } }
|
|
7960
7985
|
);
|
|
7961
7986
|
}
|
|
7962
|
-
const liveOrigin = await
|
|
7987
|
+
const liveOrigin = await chunkRDP6ZRSM_cjs.readRevisionOrigin(
|
|
7963
7988
|
txBackend,
|
|
7964
7989
|
target.revisionSchema,
|
|
7965
7990
|
target.graphId
|
|
@@ -7975,7 +8000,7 @@ async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact
|
|
|
7975
8000
|
}
|
|
7976
8001
|
);
|
|
7977
8002
|
}
|
|
7978
|
-
const liveRevision = await
|
|
8003
|
+
const liveRevision = await chunkRDP6ZRSM_cjs.readRecordedClock(
|
|
7979
8004
|
txBackend,
|
|
7980
8005
|
target.revisionSchema,
|
|
7981
8006
|
target.graphId
|
|
@@ -8051,7 +8076,7 @@ async function applyWireMergeWrites(target, nodesApi, edgesApi, txBackend, artif
|
|
|
8051
8076
|
txBackend,
|
|
8052
8077
|
identityAssertions,
|
|
8053
8078
|
identityRetractions,
|
|
8054
|
-
() =>
|
|
8079
|
+
() => chunkTUVD4DFR_cjs.storeRuntime(target).assertIdentityClassesConsistentAtTarget(
|
|
8055
8080
|
txBackend,
|
|
8056
8081
|
identityConsistencySeeds(
|
|
8057
8082
|
artifact,
|
|
@@ -8059,8 +8084,8 @@ async function applyWireMergeWrites(target, nodesApi, edgesApi, txBackend, artif
|
|
|
8059
8084
|
)
|
|
8060
8085
|
)
|
|
8061
8086
|
);
|
|
8062
|
-
if (!
|
|
8063
|
-
await
|
|
8087
|
+
if (!chunkRDP6ZRSM_cjs.forceRecordedGraphRevision(txBackend, target.graphId) && !chunkRDP6ZRSM_cjs.forceWriteTransactionRevision(txBackend)) {
|
|
8088
|
+
await chunkRDP6ZRSM_cjs.advanceRevisionClock(
|
|
8064
8089
|
txBackend,
|
|
8065
8090
|
target.revisionSchema,
|
|
8066
8091
|
target.graphId,
|
|
@@ -8100,7 +8125,7 @@ async function applyMergePlan(target, input) {
|
|
|
8100
8125
|
try {
|
|
8101
8126
|
validation = await validateMergePlanArtifact(input);
|
|
8102
8127
|
} catch (error) {
|
|
8103
|
-
return
|
|
8128
|
+
return chunkRJMHU2MG_cjs.err(
|
|
8104
8129
|
new InvalidMergePlanError(
|
|
8105
8130
|
`Merge plan validation failed: ${describeCause(error)}`,
|
|
8106
8131
|
{ cause: error }
|
|
@@ -8108,10 +8133,10 @@ async function applyMergePlan(target, input) {
|
|
|
8108
8133
|
);
|
|
8109
8134
|
}
|
|
8110
8135
|
if (!validation.success)
|
|
8111
|
-
return
|
|
8136
|
+
return chunkRJMHU2MG_cjs.err(mergePlanValidationError(validation.error));
|
|
8112
8137
|
const artifact = validation.artifact;
|
|
8113
8138
|
if (artifact.target.graphId !== target.graphId) {
|
|
8114
|
-
return
|
|
8139
|
+
return chunkRJMHU2MG_cjs.err(
|
|
8115
8140
|
new MergePlanTargetMismatchError(
|
|
8116
8141
|
"The merge plan names a different target graph.",
|
|
8117
8142
|
{
|
|
@@ -8126,12 +8151,12 @@ async function applyMergePlan(target, input) {
|
|
|
8126
8151
|
try {
|
|
8127
8152
|
assertPublicPlanCapability(target);
|
|
8128
8153
|
const provenanceStore = artifact.provenance.persist ? await tryOpenProvenanceStore(target) : void 0;
|
|
8129
|
-
if (provenanceStore !== void 0 &&
|
|
8130
|
-
return
|
|
8154
|
+
if (provenanceStore !== void 0 && chunkRJMHU2MG_cjs.isErr(provenanceStore)) {
|
|
8155
|
+
return chunkRJMHU2MG_cjs.err(provenanceStore.error);
|
|
8131
8156
|
}
|
|
8132
8157
|
const merged = await withTxConflictRetry(
|
|
8133
8158
|
() => target.transaction(async (tx) => {
|
|
8134
|
-
const txBackend =
|
|
8159
|
+
const txBackend = chunkTUVD4DFR_cjs.transactionBackend(tx);
|
|
8135
8160
|
await assertMergePlanFenceInsideTransaction(
|
|
8136
8161
|
target,
|
|
8137
8162
|
txBackend,
|
|
@@ -8158,7 +8183,7 @@ async function applyMergePlan(target, input) {
|
|
|
8158
8183
|
);
|
|
8159
8184
|
const warnings = [...artifact.review.warnings];
|
|
8160
8185
|
let provenancePersisted;
|
|
8161
|
-
if (provenanceStore !== void 0 && !
|
|
8186
|
+
if (provenanceStore !== void 0 && !chunkRJMHU2MG_cjs.isErr(provenanceStore)) {
|
|
8162
8187
|
try {
|
|
8163
8188
|
const records = artifact.review.provenanceRecords;
|
|
8164
8189
|
const count = await persistProvenanceRecords(
|
|
@@ -8176,12 +8201,12 @@ async function applyMergePlan(target, input) {
|
|
|
8176
8201
|
);
|
|
8177
8202
|
}
|
|
8178
8203
|
}
|
|
8179
|
-
return
|
|
8204
|
+
return chunkRJMHU2MG_cjs.ok(
|
|
8180
8205
|
reportFromArtifact(artifact, merged, warnings, provenancePersisted)
|
|
8181
8206
|
);
|
|
8182
8207
|
} catch (error) {
|
|
8183
8208
|
const translated = translateMergeCommitError(error);
|
|
8184
|
-
return
|
|
8209
|
+
return chunkRJMHU2MG_cjs.err(
|
|
8185
8210
|
translated instanceof MergeError ? translated : new MergeError(
|
|
8186
8211
|
`Merge plan apply failed: ${describeCause(translated)}`,
|
|
8187
8212
|
{
|
|
@@ -8194,14 +8219,14 @@ async function applyMergePlan(target, input) {
|
|
|
8194
8219
|
async function merge(store, branchInputs, optionsInput = {}) {
|
|
8195
8220
|
const branches = unwrapMergeBranches(branchInputs);
|
|
8196
8221
|
const normalized = tryNormalize(optionsInput);
|
|
8197
|
-
if (
|
|
8198
|
-
return
|
|
8222
|
+
if (chunkRJMHU2MG_cjs.isErr(normalized)) {
|
|
8223
|
+
return chunkRJMHU2MG_cjs.err(normalized.error);
|
|
8199
8224
|
}
|
|
8200
8225
|
const options = normalized.data;
|
|
8201
8226
|
const target = options.target ?? store;
|
|
8202
8227
|
const precondition = await validateBaseVersions(target, branches);
|
|
8203
|
-
if (
|
|
8204
|
-
return
|
|
8228
|
+
if (chunkRJMHU2MG_cjs.isErr(precondition)) {
|
|
8229
|
+
return chunkRJMHU2MG_cjs.err(precondition.error);
|
|
8205
8230
|
}
|
|
8206
8231
|
return resolveMerge(
|
|
8207
8232
|
store,
|
|
@@ -8218,7 +8243,7 @@ async function validateForkPointVersions(forkPoint, branches) {
|
|
|
8218
8243
|
const forkVersion = await computeBaseVersion(forkPoint);
|
|
8219
8244
|
for (const branch2 of branches) {
|
|
8220
8245
|
if (branch2.base !== forkVersion) {
|
|
8221
|
-
return
|
|
8246
|
+
return chunkRJMHU2MG_cjs.err(
|
|
8222
8247
|
new BaseVersionMismatchError(
|
|
8223
8248
|
`Branch "${branch2.id}" forked from base@V "${branch2.base}", which does not match the fork-point's base@V "${forkVersion}". mergeIncremental() requires every branch to have forked from the supplied forkPoint.`,
|
|
8224
8249
|
{
|
|
@@ -8232,7 +8257,7 @@ async function validateForkPointVersions(forkPoint, branches) {
|
|
|
8232
8257
|
);
|
|
8233
8258
|
}
|
|
8234
8259
|
}
|
|
8235
|
-
return
|
|
8260
|
+
return chunkRJMHU2MG_cjs.ok(forkVersion);
|
|
8236
8261
|
}
|
|
8237
8262
|
function nodeSchemaFor(target, kind) {
|
|
8238
8263
|
const registry = target.graph.nodes;
|
|
@@ -8387,7 +8412,7 @@ async function validateIncrementalEdgeWrites(target, edgesApi, plan) {
|
|
|
8387
8412
|
}
|
|
8388
8413
|
}
|
|
8389
8414
|
}
|
|
8390
|
-
const notFound = [...plannedKindById.keys()].filter((id) => !existingById.has(id)).sort((left, right) =>
|
|
8415
|
+
const notFound = [...plannedKindById.keys()].filter((id) => !existingById.has(id)).sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
8391
8416
|
if (notFound.length > 0) {
|
|
8392
8417
|
const crossKindById = /* @__PURE__ */ new Map();
|
|
8393
8418
|
for (const kind of Object.keys(target.graph.edges)) {
|
|
@@ -8624,7 +8649,7 @@ async function assertForkPointUnchanged(precondition) {
|
|
|
8624
8649
|
);
|
|
8625
8650
|
}
|
|
8626
8651
|
async function commitIncrementalPlan(target, plan, guard) {
|
|
8627
|
-
if (!
|
|
8652
|
+
if (!chunkTUVD4DFR_cjs.storeBackend(target).capabilities.transactions) {
|
|
8628
8653
|
throw new MergeError(
|
|
8629
8654
|
"mergeIncremental() requires a transaction-capable target backend. Incremental writes must preflight existing rows and commit atomically; non-transactional fallback would allow partial graph writes.",
|
|
8630
8655
|
{ details: { capability: "transactions" } }
|
|
@@ -8634,7 +8659,7 @@ async function commitIncrementalPlan(target, plan, guard) {
|
|
|
8634
8659
|
() => withTxConflictRetry(
|
|
8635
8660
|
() => target.transaction(async (tx) => {
|
|
8636
8661
|
if (target.revisionTrackingEnabled) {
|
|
8637
|
-
await
|
|
8662
|
+
await chunkRDP6ZRSM_cjs.lockRecordedGraphWrite(chunkTUVD4DFR_cjs.transactionBackend(tx), target.graphId);
|
|
8638
8663
|
}
|
|
8639
8664
|
await assertForkPointUnchanged(guard.forkPoint);
|
|
8640
8665
|
const nodesApi = tx.nodes;
|
|
@@ -8645,12 +8670,12 @@ async function commitIncrementalPlan(target, plan, guard) {
|
|
|
8645
8670
|
);
|
|
8646
8671
|
await assertPlannedIdentityIdsFresh(
|
|
8647
8672
|
target,
|
|
8648
|
-
|
|
8673
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx),
|
|
8649
8674
|
plan
|
|
8650
8675
|
);
|
|
8651
8676
|
await assertIdentityPeersStable(
|
|
8652
8677
|
target,
|
|
8653
|
-
|
|
8678
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx),
|
|
8654
8679
|
guard.identityPeerProbe,
|
|
8655
8680
|
plan
|
|
8656
8681
|
);
|
|
@@ -8662,7 +8687,7 @@ async function commitIncrementalPlan(target, plan, guard) {
|
|
|
8662
8687
|
nodesApi,
|
|
8663
8688
|
edgesApi,
|
|
8664
8689
|
target,
|
|
8665
|
-
|
|
8690
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx)
|
|
8666
8691
|
);
|
|
8667
8692
|
}, mergeCommitTransactionOptions(target))
|
|
8668
8693
|
)
|
|
@@ -8672,16 +8697,16 @@ async function mergeIncremental(args) {
|
|
|
8672
8697
|
const { forkPoint, target } = args;
|
|
8673
8698
|
const branches = unwrapMergeBranches(args.branches);
|
|
8674
8699
|
const normalized = tryNormalize(args.options ?? {}, ["target"]);
|
|
8675
|
-
if (
|
|
8676
|
-
return
|
|
8700
|
+
if (chunkRJMHU2MG_cjs.isErr(normalized)) {
|
|
8701
|
+
return chunkRJMHU2MG_cjs.err(normalized.error);
|
|
8677
8702
|
}
|
|
8678
8703
|
const options = normalized.data;
|
|
8679
8704
|
if (options.onBasePropertyConflict !== "flag") {
|
|
8680
|
-
return
|
|
8705
|
+
return chunkRJMHU2MG_cjs.err(incrementalBaseConflictPolicyError(options));
|
|
8681
8706
|
}
|
|
8682
8707
|
const forkPrecondition = await validateForkPointVersions(forkPoint, branches);
|
|
8683
|
-
if (
|
|
8684
|
-
return
|
|
8708
|
+
if (chunkRJMHU2MG_cjs.isErr(forkPrecondition)) {
|
|
8709
|
+
return chunkRJMHU2MG_cjs.err(forkPrecondition.error);
|
|
8685
8710
|
}
|
|
8686
8711
|
const forkVersion = forkPrecondition.data;
|
|
8687
8712
|
const [forkSchema, targetSchema] = await Promise.all([
|
|
@@ -8689,7 +8714,7 @@ async function mergeIncremental(args) {
|
|
|
8689
8714
|
computeSchemaComponent(target)
|
|
8690
8715
|
]);
|
|
8691
8716
|
if (forkSchema !== targetSchema) {
|
|
8692
|
-
return
|
|
8717
|
+
return chunkRJMHU2MG_cjs.err(incrementalSchemaError());
|
|
8693
8718
|
}
|
|
8694
8719
|
const targetBranch = {
|
|
8695
8720
|
id: COMMITTED_TARGET_BRANCH,
|
|
@@ -8716,15 +8741,15 @@ async function mergeIncremental(args) {
|
|
|
8716
8741
|
|
|
8717
8742
|
Object.defineProperty(exports, "isErr", {
|
|
8718
8743
|
enumerable: true,
|
|
8719
|
-
get: function () { return
|
|
8744
|
+
get: function () { return chunkRJMHU2MG_cjs.isErr; }
|
|
8720
8745
|
});
|
|
8721
8746
|
Object.defineProperty(exports, "isOk", {
|
|
8722
8747
|
enumerable: true,
|
|
8723
|
-
get: function () { return
|
|
8748
|
+
get: function () { return chunkRJMHU2MG_cjs.isOk; }
|
|
8724
8749
|
});
|
|
8725
8750
|
Object.defineProperty(exports, "unwrap", {
|
|
8726
8751
|
enumerable: true,
|
|
8727
|
-
get: function () { return
|
|
8752
|
+
get: function () { return chunkRJMHU2MG_cjs.unwrap; }
|
|
8728
8753
|
});
|
|
8729
8754
|
exports.BaseVersionMismatchError = BaseVersionMismatchError;
|
|
8730
8755
|
exports.BranchError = BranchError;
|