@nicia-ai/typegraph 0.49.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-LTXQOEIC.js → chunk-2CYI5HRH.js} +248 -203
- 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-3G5W2U2L.cjs → chunk-CS6JTQQ2.cjs} +302 -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-7UOLHNWC.cjs → chunk-ISKCIQF2.cjs} +20 -20
- package/dist/{chunk-7UOLHNWC.cjs.map → chunk-ISKCIQF2.cjs.map} +1 -1
- package/dist/{chunk-7LZJNLA5.js → chunk-JG5XIJDY.js} +57 -31
- package/dist/chunk-JG5XIJDY.js.map +1 -0
- package/dist/{chunk-YYUHLYM2.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-Z2JCLZFJ.js → chunk-MJPZNEJZ.js} +273 -291
- 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-D4QLTJSM.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-JPD2CTC3.js → chunk-S33YQEL7.js} +7 -7
- package/dist/{chunk-JPD2CTC3.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-UGHQV7MP.cjs → chunk-TYGGUWMS.cjs} +178 -152
- package/dist/chunk-TYGGUWMS.cjs.map +1 -0
- package/dist/{chunk-WIC7DRXW.js → chunk-U3Z7XKAG.js} +7 -7
- package/dist/{chunk-WIC7DRXW.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-2O4PCIZ6.cjs → chunk-WK23PGTP.cjs} +13 -13
- package/dist/{chunk-2O4PCIZ6.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-3QNZ5SAJ.cjs → chunk-XMY2SXOH.cjs} +437 -455
- 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 +305 -303
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +9 -9
- package/dist/graph-merge/index.d.ts +9 -9
- package/dist/graph-merge/index.js +29 -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-dNeL7iAv.d.ts → ingestion-import-target-CI8OWIkM.d.ts} +1 -1
- package/dist/{ingestion-import-target-XPxZYw89.d.cts → ingestion-import-target-DCpfM1PX.d.cts} +1 -1
- package/dist/interchange/index.cjs +55 -54
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +19 -8
- package/dist/interchange/index.d.ts +19 -8
- 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-CcL4bAHS.d.ts → postgres-CH1kkM5J.d.cts} +279 -2
- package/dist/{postgres-DMj39MEu.d.cts → 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-YppHrNFb.d.cts → sqlite-Cyx9j9o6.d.cts} +309 -2
- package/dist/{sqlite-D7Oz0SQh.d.ts → sqlite-axLw5Lo5.d.ts} +309 -2
- package/dist/{store-bphCSo7z.d.cts → store-CTfQ9taw.d.ts} +102 -13
- package/dist/{store-DRrFCx5x.d.ts → store-DR9J7JVB.d.cts} +102 -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 +3 -2
- package/dist/chunk-26YKDNUD.cjs.map +0 -1
- package/dist/chunk-3G5W2U2L.cjs.map +0 -1
- package/dist/chunk-3KOY4FH3.cjs +0 -934
- package/dist/chunk-3KOY4FH3.cjs.map +0 -1
- package/dist/chunk-3QNZ5SAJ.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-7LZJNLA5.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-D4QLTJSM.js.map +0 -1
- 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-LTXQOEIC.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-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-UGHQV7MP.cjs.map +0 -1
- package/dist/chunk-YIURNGXI.js +0 -155
- package/dist/chunk-YIURNGXI.js.map +0 -1
- package/dist/chunk-YYUHLYM2.cjs.map +0 -1
- package/dist/chunk-Z2JCLZFJ.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;
|
|
@@ -2038,8 +2039,8 @@ async function ingestionBranch(baseStore, makeBackend, options) {
|
|
|
2038
2039
|
options,
|
|
2039
2040
|
cloneIngestionWorkingCopyStrategy(makeBackend)
|
|
2040
2041
|
);
|
|
2041
|
-
if (
|
|
2042
|
-
return
|
|
2042
|
+
if (chunkRJMHU2MG_cjs.isErr(created)) {
|
|
2043
|
+
return chunkRJMHU2MG_cjs.err(
|
|
2043
2044
|
new BranchError("Failed to create constraint-aware ingestion branch", {
|
|
2044
2045
|
cause: created.error
|
|
2045
2046
|
})
|
|
@@ -2058,13 +2059,13 @@ async function ingestionBranch(baseStore, makeBackend, options) {
|
|
|
2058
2059
|
nodes: store.nodes,
|
|
2059
2060
|
edges: store.edges,
|
|
2060
2061
|
...identityAccess,
|
|
2061
|
-
close: async () =>
|
|
2062
|
+
close: async () => chunkTUVD4DFR_cjs.storeBackend(store).close()
|
|
2062
2063
|
});
|
|
2063
2064
|
PRIVATE_BRANCHES.set(handle, privateBranch);
|
|
2064
|
-
|
|
2065
|
-
return
|
|
2065
|
+
chunkCS6JTQQ2_cjs.registerIngestionImportTarget(handle, store);
|
|
2066
|
+
return chunkRJMHU2MG_cjs.ok(handle);
|
|
2066
2067
|
} catch (error) {
|
|
2067
|
-
return
|
|
2068
|
+
return chunkRJMHU2MG_cjs.err(
|
|
2068
2069
|
new BranchError("Failed to create constraint-aware ingestion branch", {
|
|
2069
2070
|
cause: error
|
|
2070
2071
|
})
|
|
@@ -2106,7 +2107,7 @@ function constraintSignature(node, constraint) {
|
|
|
2106
2107
|
return void 0;
|
|
2107
2108
|
}
|
|
2108
2109
|
}
|
|
2109
|
-
return `${constraint.name}${KEY_PART_SEPARATOR}${
|
|
2110
|
+
return `${constraint.name}${KEY_PART_SEPARATOR}${chunkLLVOQOWE_cjs.computeUniqueKey(
|
|
2110
2111
|
props,
|
|
2111
2112
|
constraint.fields,
|
|
2112
2113
|
constraint.collation
|
|
@@ -2143,12 +2144,12 @@ function blockNodes(newNodes, resolveConfig, uniqueConstraints = []) {
|
|
|
2143
2144
|
}
|
|
2144
2145
|
}
|
|
2145
2146
|
const sortedKeys = [...buckets.keys()].sort(
|
|
2146
|
-
(left, right) =>
|
|
2147
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
2147
2148
|
);
|
|
2148
2149
|
const ordered = /* @__PURE__ */ new Map();
|
|
2149
2150
|
for (const key of sortedKeys) {
|
|
2150
2151
|
const members = [...chunkN66HCGCY_cjs.requireDefined(buckets.get(key))].sort(
|
|
2151
|
-
(left, right) =>
|
|
2152
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
2152
2153
|
);
|
|
2153
2154
|
ordered.set(key, members);
|
|
2154
2155
|
}
|
|
@@ -2165,7 +2166,7 @@ function buildBranchRank(branchOrder, allBranchIds) {
|
|
|
2165
2166
|
next += 1;
|
|
2166
2167
|
}
|
|
2167
2168
|
}
|
|
2168
|
-
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));
|
|
2169
2170
|
for (const branchId of remaining) {
|
|
2170
2171
|
if (!rank.has(branchId)) {
|
|
2171
2172
|
rank.set(branchId, next);
|
|
@@ -2237,8 +2238,8 @@ function collectConflictingValues(property, contributions) {
|
|
|
2237
2238
|
values.push({ branchId, value });
|
|
2238
2239
|
}
|
|
2239
2240
|
return [...values].sort((left, right) => {
|
|
2240
|
-
const byBranch =
|
|
2241
|
-
return byBranch === 0 ?
|
|
2241
|
+
const byBranch = chunkRWUWTJQY_cjs.compareStrings(left.branchId, right.branchId);
|
|
2242
|
+
return byBranch === 0 ? chunkRWUWTJQY_cjs.compareStrings(
|
|
2242
2243
|
canonicalValueKey(left.value),
|
|
2243
2244
|
canonicalValueKey(right.value)
|
|
2244
2245
|
) : byBranch;
|
|
@@ -2368,7 +2369,7 @@ function unionProperties(canonicalMember, members, context, baseContext, branchR
|
|
|
2368
2369
|
const props = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
2369
2370
|
const conflicts = [];
|
|
2370
2371
|
for (const property of [...propertyNames].sort(
|
|
2371
|
-
(left, right) =>
|
|
2372
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
2372
2373
|
)) {
|
|
2373
2374
|
const values = collectConflictingValues(property, members);
|
|
2374
2375
|
if (values.length === 0) {
|
|
@@ -2433,14 +2434,14 @@ function canonicalizeCluster(cluster, members, policy, branchRank, weights, cano
|
|
|
2433
2434
|
);
|
|
2434
2435
|
const memberIds = [
|
|
2435
2436
|
...new Set(cluster.members.map((member) => idOf(member)))
|
|
2436
|
-
].sort((left, right) =>
|
|
2437
|
+
].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
2437
2438
|
const branchOrigins = [
|
|
2438
2439
|
...new Set(
|
|
2439
2440
|
members.map((member) => member.branchId).filter(
|
|
2440
2441
|
(branchId) => branchId !== BASE_PROVENANCE_BRANCH && branchId !== preferredBranchId
|
|
2441
2442
|
)
|
|
2442
2443
|
)
|
|
2443
|
-
].sort((left, right) =>
|
|
2444
|
+
].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
2444
2445
|
const resolution = {
|
|
2445
2446
|
canonicalId,
|
|
2446
2447
|
memberIds,
|
|
@@ -2520,7 +2521,7 @@ var EQUIVALENCE_META_EDGES = /* @__PURE__ */ new Set([
|
|
|
2520
2521
|
chunkXUO3KQFO_cjs.META_EDGE_SAME_AS
|
|
2521
2522
|
]);
|
|
2522
2523
|
function buildSubClassClosure(ontology) {
|
|
2523
|
-
const unionFind = new UnionFind(
|
|
2524
|
+
const unionFind = new UnionFind(chunkRWUWTJQY_cjs.compareStrings);
|
|
2524
2525
|
for (const relation of ontology) {
|
|
2525
2526
|
unionFind.add(relation.from);
|
|
2526
2527
|
unionFind.add(relation.to);
|
|
@@ -2551,7 +2552,7 @@ function buildSubClassClosure(ontology) {
|
|
|
2551
2552
|
relations.push([child, parent]);
|
|
2552
2553
|
}
|
|
2553
2554
|
return {
|
|
2554
|
-
closure:
|
|
2555
|
+
closure: chunkRJMHU2MG_cjs.computeTransitiveClosure(relations),
|
|
2555
2556
|
canonicalOf
|
|
2556
2557
|
};
|
|
2557
2558
|
}
|
|
@@ -2564,7 +2565,7 @@ function isReachable2(closure, from, to) {
|
|
|
2564
2565
|
if (fromRep === toRep) {
|
|
2565
2566
|
return from !== to;
|
|
2566
2567
|
}
|
|
2567
|
-
return
|
|
2568
|
+
return chunkRJMHU2MG_cjs.isReachable(closure.closure, fromRep, toRep);
|
|
2568
2569
|
}
|
|
2569
2570
|
|
|
2570
2571
|
// src/graph-merge/evidence.ts
|
|
@@ -2616,7 +2617,7 @@ function sourceKey(source) {
|
|
|
2616
2617
|
}
|
|
2617
2618
|
}
|
|
2618
2619
|
function compareMatchSources(left, right) {
|
|
2619
|
-
return
|
|
2620
|
+
return chunkRWUWTJQY_cjs.compareStrings(sourceKey(left), sourceKey(right));
|
|
2620
2621
|
}
|
|
2621
2622
|
function compareEntityRefs(left, right) {
|
|
2622
2623
|
return compareMergeKeys(
|
|
@@ -2845,7 +2846,7 @@ function scorePrepared(left, right, strategy, ctx) {
|
|
|
2845
2846
|
try {
|
|
2846
2847
|
raw = strategy.score(left.node, right.node);
|
|
2847
2848
|
} catch (error) {
|
|
2848
|
-
return
|
|
2849
|
+
return chunkRJMHU2MG_cjs.err(
|
|
2849
2850
|
new MatchEvidenceError("Custom similarity scorer failed.", {
|
|
2850
2851
|
details: {
|
|
2851
2852
|
kind: left.node.kind,
|
|
@@ -2857,7 +2858,7 @@ function scorePrepared(left, right, strategy, ctx) {
|
|
|
2857
2858
|
);
|
|
2858
2859
|
}
|
|
2859
2860
|
if (!Number.isFinite(raw)) {
|
|
2860
|
-
return
|
|
2861
|
+
return chunkRJMHU2MG_cjs.err(
|
|
2861
2862
|
new MatchEvidenceError(
|
|
2862
2863
|
"Custom similarity scorer returned a non-finite score.",
|
|
2863
2864
|
{
|
|
@@ -2871,37 +2872,37 @@ function scorePrepared(left, right, strategy, ctx) {
|
|
|
2871
2872
|
)
|
|
2872
2873
|
);
|
|
2873
2874
|
}
|
|
2874
|
-
return
|
|
2875
|
+
return chunkRJMHU2MG_cjs.ok(clampScore(raw));
|
|
2875
2876
|
}
|
|
2876
2877
|
case "fulltext": {
|
|
2877
2878
|
if (left.text.length === 0 || right.text.length === 0) {
|
|
2878
|
-
return
|
|
2879
|
+
return chunkRJMHU2MG_cjs.ok(NO_EVIDENCE_SCORE);
|
|
2879
2880
|
}
|
|
2880
|
-
return
|
|
2881
|
+
return chunkRJMHU2MG_cjs.ok(clampScore(diceFromMultisets(left.grams, right.grams)));
|
|
2881
2882
|
}
|
|
2882
2883
|
case "vector": {
|
|
2883
2884
|
if (ctx.embeddings === void 0) {
|
|
2884
|
-
return
|
|
2885
|
+
return chunkRJMHU2MG_cjs.err(embedderUnavailable("vector", ctx));
|
|
2885
2886
|
}
|
|
2886
2887
|
if (left.text.length === 0 || right.text.length === 0) {
|
|
2887
|
-
return
|
|
2888
|
+
return chunkRJMHU2MG_cjs.ok(NO_EVIDENCE_SCORE);
|
|
2888
2889
|
}
|
|
2889
2890
|
const cosine = cosineFromLookup(ctx.embeddings, left.text, right.text);
|
|
2890
|
-
return
|
|
2891
|
+
return chunkRJMHU2MG_cjs.ok(clampScore(cosine));
|
|
2891
2892
|
}
|
|
2892
2893
|
case "hybrid": {
|
|
2893
2894
|
if (ctx.embeddings === void 0) {
|
|
2894
|
-
return
|
|
2895
|
+
return chunkRJMHU2MG_cjs.err(embedderUnavailable("hybrid", ctx));
|
|
2895
2896
|
}
|
|
2896
2897
|
if (left.text.length === 0 || right.text.length === 0) {
|
|
2897
|
-
return
|
|
2898
|
+
return chunkRJMHU2MG_cjs.ok(NO_EVIDENCE_SCORE);
|
|
2898
2899
|
}
|
|
2899
2900
|
const vectorScore = clampScore(
|
|
2900
2901
|
cosineFromLookup(ctx.embeddings, left.text, right.text)
|
|
2901
2902
|
);
|
|
2902
2903
|
const fulltextScore = diceFromMultisets(left.grams, right.grams);
|
|
2903
2904
|
const weights = normalizeHybridWeights(strategy.weights);
|
|
2904
|
-
return
|
|
2905
|
+
return chunkRJMHU2MG_cjs.ok(
|
|
2905
2906
|
clampScore(
|
|
2906
2907
|
weights.vector * vectorScore + weights.fulltext * fulltextScore
|
|
2907
2908
|
)
|
|
@@ -2985,7 +2986,7 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
2985
2986
|
});
|
|
2986
2987
|
if (maxComparisonsPerKind !== void 0 && fuzzy.length > maxComparisonsPerKind) {
|
|
2987
2988
|
if (ceilingPolicy === "error") {
|
|
2988
|
-
return
|
|
2989
|
+
return chunkRJMHU2MG_cjs.err(
|
|
2989
2990
|
new MergeError(
|
|
2990
2991
|
`Comparison ceiling exceeded: ${fuzzy.length} candidate pairs > maxComparisonsPerKind ${maxComparisonsPerKind}.`,
|
|
2991
2992
|
{
|
|
@@ -2998,7 +2999,7 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
2998
2999
|
)
|
|
2999
3000
|
);
|
|
3000
3001
|
}
|
|
3001
|
-
return
|
|
3002
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
3002
3003
|
edges: [...forced].sort(
|
|
3003
3004
|
(left, right) => compareCandidateEdges(left, right)
|
|
3004
3005
|
),
|
|
@@ -3020,9 +3021,9 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
3020
3021
|
let diagnosticsTotal = 0;
|
|
3021
3022
|
for (const { left, right, a, b, sources } of fuzzy) {
|
|
3022
3023
|
const scored = scorer(a, left, b, right);
|
|
3023
|
-
if (
|
|
3024
|
+
if (chunkRJMHU2MG_cjs.isErr(scored)) {
|
|
3024
3025
|
if (similarity.kind === "custom" && scored.error instanceof MatchEvidenceError) {
|
|
3025
|
-
return
|
|
3026
|
+
return chunkRJMHU2MG_cjs.err(
|
|
3026
3027
|
new MatchEvidenceError(scored.error.message, {
|
|
3027
3028
|
cause: scored.error,
|
|
3028
3029
|
details: {
|
|
@@ -3036,10 +3037,10 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
3036
3037
|
})
|
|
3037
3038
|
);
|
|
3038
3039
|
}
|
|
3039
|
-
return
|
|
3040
|
+
return chunkRJMHU2MG_cjs.err(scored.error);
|
|
3040
3041
|
}
|
|
3041
3042
|
if (!Number.isFinite(scored.data)) {
|
|
3042
|
-
return
|
|
3043
|
+
return chunkRJMHU2MG_cjs.err(
|
|
3043
3044
|
new MatchEvidenceError(
|
|
3044
3045
|
"Similarity scorer returned a non-finite score.",
|
|
3045
3046
|
{
|
|
@@ -3079,7 +3080,7 @@ function scoreCandidates(input, resolveConfig, ctx, ceilingPolicy, maxComparison
|
|
|
3079
3080
|
});
|
|
3080
3081
|
}
|
|
3081
3082
|
}
|
|
3082
|
-
return
|
|
3083
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
3083
3084
|
edges: edges.sort((left, right) => compareCandidateEdges(left, right)),
|
|
3084
3085
|
warnings: [],
|
|
3085
3086
|
diagnostics,
|
|
@@ -3358,7 +3359,7 @@ function pickHighestPriorityBranch(branchIds, branchRank) {
|
|
|
3358
3359
|
let chosenRank = branchRank.get(chosen) ?? Number.MAX_SAFE_INTEGER;
|
|
3359
3360
|
for (const candidate of branchIds.slice(1)) {
|
|
3360
3361
|
const candidateRank = branchRank.get(candidate) ?? Number.MAX_SAFE_INTEGER;
|
|
3361
|
-
if (candidateRank < chosenRank || candidateRank === chosenRank &&
|
|
3362
|
+
if (candidateRank < chosenRank || candidateRank === chosenRank && chunkRWUWTJQY_cjs.compareStrings(candidate, chosen) < 0) {
|
|
3362
3363
|
chosen = candidate;
|
|
3363
3364
|
chosenRank = candidateRank;
|
|
3364
3365
|
}
|
|
@@ -3451,20 +3452,20 @@ function resolveDeleteModifyOver(modified, deleted, modifiedEntity, deletedEntit
|
|
|
3451
3452
|
}
|
|
3452
3453
|
return {
|
|
3453
3454
|
survivingModifications: [...survivingModifications].sort((left, right) => {
|
|
3454
|
-
const byId2 =
|
|
3455
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(
|
|
3455
3456
|
modifiedEntity(left).id,
|
|
3456
3457
|
modifiedEntity(right).id
|
|
3457
3458
|
);
|
|
3458
|
-
return byId2 === 0 ?
|
|
3459
|
+
return byId2 === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.branchId, right.branchId) : byId2;
|
|
3459
3460
|
}),
|
|
3460
3461
|
deletions: [...deletions].sort(
|
|
3461
|
-
(left, right) =>
|
|
3462
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
3462
3463
|
),
|
|
3463
3464
|
conflicts: [...conflicts].sort(
|
|
3464
|
-
(left, right) =>
|
|
3465
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.entityId, right.entityId)
|
|
3465
3466
|
),
|
|
3466
3467
|
dropped: [...dropped].sort(
|
|
3467
|
-
(left, right) =>
|
|
3468
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
3468
3469
|
)
|
|
3469
3470
|
};
|
|
3470
3471
|
}
|
|
@@ -3508,11 +3509,11 @@ function reconcileOver(survivingModifications, entityOf, rebuild, policy, branch
|
|
|
3508
3509
|
}
|
|
3509
3510
|
return {
|
|
3510
3511
|
survivingModifications: [...out].sort((left, right) => {
|
|
3511
|
-
const byId2 =
|
|
3512
|
-
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;
|
|
3513
3514
|
}),
|
|
3514
3515
|
conflicts: conflicts.sort(
|
|
3515
|
-
(left, right) =>
|
|
3516
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(
|
|
3516
3517
|
`${left.entityId}|${left.property}`,
|
|
3517
3518
|
`${right.entityId}|${right.property}`
|
|
3518
3519
|
)
|
|
@@ -3546,7 +3547,7 @@ function threeWayMergeProps(entityId, kind, baseProps, contributions, context, b
|
|
|
3546
3547
|
propertyNames.add(name);
|
|
3547
3548
|
}
|
|
3548
3549
|
}
|
|
3549
|
-
for (const property of [...propertyNames].sort(
|
|
3550
|
+
for (const property of [...propertyNames].sort(chunkRWUWTJQY_cjs.compareStrings)) {
|
|
3550
3551
|
const baseHas = chunkN66HCGCY_cjs.hasOwnKey(baseProps, property);
|
|
3551
3552
|
const baseKey = baseHas ? canonicalValueKey(chunkN66HCGCY_cjs.requireDefined(baseProps[property])) : void 0;
|
|
3552
3553
|
const changed = contributions.filter((contribution) => {
|
|
@@ -3646,7 +3647,7 @@ function earliestEnd(claims) {
|
|
|
3646
3647
|
let earliest;
|
|
3647
3648
|
for (const claim of claims) {
|
|
3648
3649
|
if (claim.change.kind !== "set") continue;
|
|
3649
|
-
if (earliest === void 0 ||
|
|
3650
|
+
if (earliest === void 0 || chunkRWUWTJQY_cjs.compareStrings(claim.change.validTo, earliest) < 0) {
|
|
3650
3651
|
earliest = claim.change.validTo;
|
|
3651
3652
|
}
|
|
3652
3653
|
}
|
|
@@ -3662,7 +3663,7 @@ function resolveEndClaims(claims, preferredBranchId) {
|
|
|
3662
3663
|
}
|
|
3663
3664
|
function claimingBranches(claims) {
|
|
3664
3665
|
return [...new Set(claims.map((claim) => claim.branchId))].sort(
|
|
3665
|
-
(left, right) =>
|
|
3666
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
3666
3667
|
);
|
|
3667
3668
|
}
|
|
3668
3669
|
function sameValidToChange(left, right) {
|
|
@@ -3759,7 +3760,7 @@ function resolvePopulation(entity, deltas, deletions, preferredBranchId, dropIte
|
|
|
3759
3760
|
mergeKey(right.kind, right.id)
|
|
3760
3761
|
)
|
|
3761
3762
|
),
|
|
3762
|
-
dropped: dropped.sort((left, right) =>
|
|
3763
|
+
dropped: dropped.sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id))
|
|
3763
3764
|
};
|
|
3764
3765
|
}
|
|
3765
3766
|
function resolveValidWindows(staging, nodeDeletions, edgeDeletions, preferredBranchId) {
|
|
@@ -3848,7 +3849,7 @@ function rowsById(groupEdges) {
|
|
|
3848
3849
|
function sourcePairByRow(rows) {
|
|
3849
3850
|
const pairs = /* @__PURE__ */ new Map();
|
|
3850
3851
|
for (const [id, members] of rows) {
|
|
3851
|
-
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));
|
|
3852
3853
|
pairs.set(id, chunkN66HCGCY_cjs.requireDefined(sorted[0]));
|
|
3853
3854
|
}
|
|
3854
3855
|
return pairs;
|
|
@@ -3859,14 +3860,14 @@ function foldSets(groupEdges) {
|
|
|
3859
3860
|
const representatives = /* @__PURE__ */ new Map();
|
|
3860
3861
|
for (const [id, pair] of sourcePairs) {
|
|
3861
3862
|
const representative = representatives.get(pair);
|
|
3862
|
-
if (representative === void 0 ||
|
|
3863
|
+
if (representative === void 0 || chunkRWUWTJQY_cjs.compareStrings(id, representative) < 0) {
|
|
3863
3864
|
representatives.set(pair, id);
|
|
3864
3865
|
}
|
|
3865
3866
|
}
|
|
3866
3867
|
const collapsed = [];
|
|
3867
3868
|
const parallel = [];
|
|
3868
3869
|
for (const id of [...rows.keys()].sort(
|
|
3869
|
-
(left, right) =>
|
|
3870
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
3870
3871
|
)) {
|
|
3871
3872
|
const members = chunkN66HCGCY_cjs.requireDefined(rows.get(id));
|
|
3872
3873
|
const pair = chunkN66HCGCY_cjs.requireDefined(sourcePairs.get(id));
|
|
@@ -3879,7 +3880,7 @@ function foldSets(groupEdges) {
|
|
|
3879
3880
|
return [collapsed, ...parallel];
|
|
3880
3881
|
}
|
|
3881
3882
|
function compareMembers(left, right, preferredBranchId) {
|
|
3882
|
-
const byId2 =
|
|
3883
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(left.staged.id, right.staged.id);
|
|
3883
3884
|
if (byId2 !== 0) {
|
|
3884
3885
|
return byId2;
|
|
3885
3886
|
}
|
|
@@ -3888,7 +3889,7 @@ function compareMembers(left, right, preferredBranchId) {
|
|
|
3888
3889
|
if (leftPreferred !== rightPreferred) {
|
|
3889
3890
|
return leftPreferred ? -1 : 1;
|
|
3890
3891
|
}
|
|
3891
|
-
return
|
|
3892
|
+
return chunkRWUWTJQY_cjs.compareStrings(left.staged.branchId, right.staged.branchId);
|
|
3892
3893
|
}
|
|
3893
3894
|
function pickSurvivor(edges, preferredBranchId) {
|
|
3894
3895
|
const inherited = edges.filter(
|
|
@@ -3914,8 +3915,8 @@ function authoredProperty(edge, property) {
|
|
|
3914
3915
|
}
|
|
3915
3916
|
function unauthoredValue(property, edges) {
|
|
3916
3917
|
const carriers = edges.filter((edge) => chunkN66HCGCY_cjs.hasOwnKey(edge.staged.props, property)).sort((left, right) => {
|
|
3917
|
-
const byId2 =
|
|
3918
|
-
return byId2 === 0 ?
|
|
3918
|
+
const byId2 = chunkRWUWTJQY_cjs.compareStrings(left.staged.id, right.staged.id);
|
|
3919
|
+
return byId2 === 0 ? chunkRWUWTJQY_cjs.compareStrings(
|
|
3919
3920
|
canonicalValueKey(left.staged.props[property]),
|
|
3920
3921
|
canonicalValueKey(right.staged.props[property])
|
|
3921
3922
|
) : byId2;
|
|
@@ -3932,7 +3933,7 @@ function unionEdgeProps(survivorId, kind, survivor, edges, context, branchRank,
|
|
|
3932
3933
|
const props = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
3933
3934
|
const conflicts = [];
|
|
3934
3935
|
for (const property of [...propertyNames].sort(
|
|
3935
|
-
(left, right) =>
|
|
3936
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
3936
3937
|
)) {
|
|
3937
3938
|
const claimants = edges.filter((edge) => authoredProperty(edge, property)).map((edge) => edge.staged);
|
|
3938
3939
|
const values = collectConflictingValues(property, claimants);
|
|
@@ -3965,7 +3966,7 @@ function unionEdgeProps(survivorId, kind, survivor, edges, context, branchRank,
|
|
|
3965
3966
|
function foldEdgeSet(foldSet, context, branchRank, preferredBranchId) {
|
|
3966
3967
|
const survivor = pickSurvivor(foldSet, preferredBranchId);
|
|
3967
3968
|
const survivorId = survivor.staged.id;
|
|
3968
|
-
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));
|
|
3969
3970
|
const fromId = idOf(survivor.fromKey);
|
|
3970
3971
|
const fromKind = kindOf(survivor.fromKey);
|
|
3971
3972
|
const toId = idOf(survivor.toKey);
|
|
@@ -4063,7 +4064,7 @@ function repointEdges(stagedEdges, canonicalOf, deletedNodeIds, policy, branchRa
|
|
|
4063
4064
|
const merged = [];
|
|
4064
4065
|
const conflicts = [];
|
|
4065
4066
|
const sortedGroups = [...liveByGroup.keys()].sort(
|
|
4066
|
-
(left, right) =>
|
|
4067
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
4067
4068
|
);
|
|
4068
4069
|
for (const group of sortedGroups) {
|
|
4069
4070
|
const groupEdges = chunkN66HCGCY_cjs.requireDefined(liveByGroup.get(group));
|
|
@@ -4091,12 +4092,12 @@ function repointEdges(stagedEdges, canonicalOf, deletedNodeIds, policy, branchRa
|
|
|
4091
4092
|
),
|
|
4092
4093
|
edge.id
|
|
4093
4094
|
])
|
|
4094
|
-
})).sort((left, right) =>
|
|
4095
|
+
})).sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.sortKey, right.sortKey)).map(({ edge }) => edge);
|
|
4095
4096
|
return {
|
|
4096
4097
|
edges: sortedEdges,
|
|
4097
|
-
dropped: dropped.sort((left, right) =>
|
|
4098
|
+
dropped: dropped.sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)),
|
|
4098
4099
|
conflicts: conflicts.sort(
|
|
4099
|
-
(left, right) =>
|
|
4100
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(
|
|
4100
4101
|
`${left.entityId}|${left.property}`,
|
|
4101
4102
|
`${right.entityId}|${right.property}`
|
|
4102
4103
|
)
|
|
@@ -4767,7 +4768,7 @@ var mergePlanArtifactV1Schema = mergePlanArtifactV1BaseSchema.superRefine(
|
|
|
4767
4768
|
// src/graph-merge/plan-canonical.ts
|
|
4768
4769
|
function canonicalMergePlanJson(artifact) {
|
|
4769
4770
|
const digestless = "digest" in artifact ? omitDigest(artifact) : artifact;
|
|
4770
|
-
return JSON.stringify(digestless,
|
|
4771
|
+
return JSON.stringify(digestless, chunkZBFZGLZE_cjs.sortedReplacer);
|
|
4771
4772
|
}
|
|
4772
4773
|
async function computeMergePlanDigest(artifact) {
|
|
4773
4774
|
return chunkZY4GXIVN_cjs.sha256Hex(canonicalMergePlanJson(artifact), 32);
|
|
@@ -4781,7 +4782,7 @@ async function finalizeMergePlanArtifact(artifact) {
|
|
|
4781
4782
|
}
|
|
4782
4783
|
};
|
|
4783
4784
|
const canonical = JSON.parse(
|
|
4784
|
-
JSON.stringify(finalized,
|
|
4785
|
+
JSON.stringify(finalized, chunkZBFZGLZE_cjs.sortedReplacer)
|
|
4785
4786
|
);
|
|
4786
4787
|
return canonical;
|
|
4787
4788
|
}
|
|
@@ -4846,7 +4847,7 @@ function readFormatVersion(input) {
|
|
|
4846
4847
|
}
|
|
4847
4848
|
var PROVENANCE_KIND = "Provenance";
|
|
4848
4849
|
var PROVENANCE_OWNER_KIND = "ProvenanceOwner";
|
|
4849
|
-
var Provenance =
|
|
4850
|
+
var Provenance = chunkIPRP6TDL_cjs.defineNode(PROVENANCE_KIND, {
|
|
4850
4851
|
schema: zod.z.object({
|
|
4851
4852
|
targetGraphId: zod.z.string(),
|
|
4852
4853
|
role: zod.z.enum(["node", "edge"]),
|
|
@@ -4859,7 +4860,7 @@ var Provenance = chunk26YKDNUD_cjs.defineNode(PROVENANCE_KIND, {
|
|
|
4859
4860
|
var PROVENANCE_OWNER = "@nicia-ai/typegraph/merge-provenance";
|
|
4860
4861
|
var PROVENANCE_OWNER_VERSION = 1;
|
|
4861
4862
|
var PROVENANCE_OWNER_ID = "merge-provenance-owner";
|
|
4862
|
-
var ProvenanceOwner =
|
|
4863
|
+
var ProvenanceOwner = chunkIPRP6TDL_cjs.defineNode(PROVENANCE_OWNER_KIND, {
|
|
4863
4864
|
schema: zod.z.object({
|
|
4864
4865
|
owner: zod.z.literal(PROVENANCE_OWNER),
|
|
4865
4866
|
version: zod.z.literal(PROVENANCE_OWNER_VERSION),
|
|
@@ -4870,7 +4871,7 @@ function provenanceGraphId(targetGraphId) {
|
|
|
4870
4871
|
return `${targetGraphId}::merge-provenance`;
|
|
4871
4872
|
}
|
|
4872
4873
|
function buildOwnedProvenanceGraph(targetGraphId) {
|
|
4873
|
-
return
|
|
4874
|
+
return chunkG2TLHH6T_cjs.defineInternalGraph({
|
|
4874
4875
|
id: provenanceGraphId(targetGraphId),
|
|
4875
4876
|
nodes: {
|
|
4876
4877
|
Provenance: { type: Provenance },
|
|
@@ -4880,14 +4881,14 @@ function buildOwnedProvenanceGraph(targetGraphId) {
|
|
|
4880
4881
|
});
|
|
4881
4882
|
}
|
|
4882
4883
|
function buildProvenanceGraph(targetGraphId) {
|
|
4883
|
-
return
|
|
4884
|
+
return chunkG2TLHH6T_cjs.defineInternalGraph({
|
|
4884
4885
|
id: provenanceGraphId(targetGraphId),
|
|
4885
4886
|
nodes: { Provenance: { type: Provenance } },
|
|
4886
4887
|
edges: {}
|
|
4887
4888
|
});
|
|
4888
4889
|
}
|
|
4889
4890
|
async function openProvenanceStore(...args) {
|
|
4890
|
-
const [backend, targetGraphId] = args.length === 1 ? [
|
|
4891
|
+
const [backend, targetGraphId] = args.length === 1 ? [chunkTUVD4DFR_cjs.storeBackend(args[0]), args[0].graphId] : args;
|
|
4891
4892
|
const graph = buildOwnedProvenanceGraph(targetGraphId);
|
|
4892
4893
|
const preflight = await inspectSidecarGraphId(backend, graph, targetGraphId);
|
|
4893
4894
|
if (preflight.state === "refuse") {
|
|
@@ -4899,7 +4900,7 @@ async function openProvenanceStore(...args) {
|
|
|
4899
4900
|
throw provenanceGraphIdCollision(graph.id, targetGraphId, claim.reason);
|
|
4900
4901
|
}
|
|
4901
4902
|
}
|
|
4902
|
-
const [store] = await
|
|
4903
|
+
const [store] = await chunkWCLMKNQE_cjs.createStoreWithSchema(graph, backend);
|
|
4903
4904
|
return store;
|
|
4904
4905
|
}
|
|
4905
4906
|
async function claimSidecarOwnership(backend, graph, targetGraphId) {
|
|
@@ -4926,10 +4927,10 @@ async function claimSidecarOwnership(backend, graph, targetGraphId) {
|
|
|
4926
4927
|
}
|
|
4927
4928
|
async function drainUnfencedRowWriters(tx) {
|
|
4928
4929
|
if (tx.dialect !== "postgres") return;
|
|
4929
|
-
const schema =
|
|
4930
|
+
const schema = chunkIHK5KA2Q_cjs.createSqlSchema(tx.tableNames);
|
|
4930
4931
|
await tx.executeStatement(
|
|
4931
|
-
|
|
4932
|
-
|
|
4932
|
+
chunkOJHD3LXJ_cjs.asCompiledStatementSql(
|
|
4933
|
+
chunkOJHD3LXJ_cjs.sql`LOCK TABLE ${schema.nodesTable}, ${schema.edgesTable} IN SHARE ROW EXCLUSIVE MODE`
|
|
4933
4934
|
)
|
|
4934
4935
|
);
|
|
4935
4936
|
}
|
|
@@ -4948,14 +4949,14 @@ async function inspectSidecarGraphId(port, graph, targetGraphId) {
|
|
|
4948
4949
|
if (activeSchema === void 0) {
|
|
4949
4950
|
return { state: "refuse", reason: "application-graph" };
|
|
4950
4951
|
}
|
|
4951
|
-
const ownedHash = await
|
|
4952
|
-
|
|
4952
|
+
const ownedHash = await chunk7CCMCMJO_cjs.computeSchemaHash(
|
|
4953
|
+
chunk7CCMCMJO_cjs.serializeSchema(graph, activeSchema.version)
|
|
4953
4954
|
);
|
|
4954
4955
|
if (activeSchema.schema_hash === ownedHash) {
|
|
4955
4956
|
return { state: "refuse", reason: "unowned-exact-schema-graph" };
|
|
4956
4957
|
}
|
|
4957
|
-
const legacyHash = await
|
|
4958
|
-
|
|
4958
|
+
const legacyHash = await chunk7CCMCMJO_cjs.computeSchemaHash(
|
|
4959
|
+
chunk7CCMCMJO_cjs.serializeSchema(buildProvenanceGraph(targetGraphId), activeSchema.version)
|
|
4959
4960
|
);
|
|
4960
4961
|
if (activeSchema.schema_hash !== legacyHash) {
|
|
4961
4962
|
return { state: "refuse", reason: "application-graph" };
|
|
@@ -4995,7 +4996,7 @@ var SIDECAR_REFUSALS = {
|
|
|
4995
4996
|
};
|
|
4996
4997
|
function provenanceGraphIdCollision(graphId, targetGraphId, reason) {
|
|
4997
4998
|
const refusal = SIDECAR_REFUSALS[reason];
|
|
4998
|
-
return new
|
|
4999
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
4999
5000
|
refusal.describe(graphId, targetGraphId),
|
|
5000
5001
|
{
|
|
5001
5002
|
code: "GRAPH_MERGE_PROVENANCE_ID_COLLISION",
|
|
@@ -5007,7 +5008,7 @@ function provenanceGraphIdCollision(graphId, targetGraphId, reason) {
|
|
|
5007
5008
|
);
|
|
5008
5009
|
}
|
|
5009
5010
|
function provenanceClaimUnfenced(graphId, targetGraphId) {
|
|
5010
|
-
return new
|
|
5011
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
5011
5012
|
`Claiming graph id "${graphId}" for merge provenance requires a transactional schema fence, which this backend does not provide.`,
|
|
5012
5013
|
{
|
|
5013
5014
|
code: "GRAPH_MERGE_PROVENANCE_CLAIM_UNFENCED",
|
|
@@ -5059,12 +5060,12 @@ async function* readRowsOfKind(port, graphId, kind) {
|
|
|
5059
5060
|
}
|
|
5060
5061
|
}
|
|
5061
5062
|
async function hasRowsUnderGraphId(port, graphId, scope) {
|
|
5062
|
-
const schema =
|
|
5063
|
-
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}`;
|
|
5064
5065
|
if (await hasRowsInTable(port, schema.tables.nodes, graphId, kindFilter)) {
|
|
5065
5066
|
return true;
|
|
5066
5067
|
}
|
|
5067
|
-
if (await hasRowsInTable(port, schema.tables.edges, graphId,
|
|
5068
|
+
if (await hasRowsInTable(port, schema.tables.edges, graphId, chunkOJHD3LXJ_cjs.sql.empty())) {
|
|
5068
5069
|
return true;
|
|
5069
5070
|
}
|
|
5070
5071
|
for (const tableName of secondaryRowTableNames(schema.tables)) {
|
|
@@ -5084,14 +5085,15 @@ function secondaryRowTableNames(tables) {
|
|
|
5084
5085
|
tables.identityClosure,
|
|
5085
5086
|
tables.identitySeparation,
|
|
5086
5087
|
tables.fulltext,
|
|
5087
|
-
tables.uniques
|
|
5088
|
+
tables.uniques,
|
|
5089
|
+
tables.edgeClaims
|
|
5088
5090
|
])
|
|
5089
5091
|
];
|
|
5090
5092
|
}
|
|
5091
5093
|
async function hasRowsInTable(port, tableName, graphId, filter) {
|
|
5092
5094
|
const rows = await port.execute(
|
|
5093
|
-
|
|
5094
|
-
|
|
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`
|
|
5095
5097
|
)
|
|
5096
5098
|
);
|
|
5097
5099
|
return rows.length > 0;
|
|
@@ -5099,10 +5101,10 @@ async function hasRowsInTable(port, tableName, graphId, filter) {
|
|
|
5099
5101
|
async function hasRowsInSecondaryTable(port, tableName, graphId) {
|
|
5100
5102
|
const tableExists = port.tableExists;
|
|
5101
5103
|
if (tableExists !== void 0) {
|
|
5102
|
-
return await tableExists(tableName) && await hasRowsInTable(port, tableName, graphId,
|
|
5104
|
+
return await tableExists(tableName) && await hasRowsInTable(port, tableName, graphId, chunkOJHD3LXJ_cjs.sql.empty());
|
|
5103
5105
|
}
|
|
5104
5106
|
try {
|
|
5105
|
-
return await hasRowsInTable(port, tableName, graphId,
|
|
5107
|
+
return await hasRowsInTable(port, tableName, graphId, chunkOJHD3LXJ_cjs.sql.empty());
|
|
5106
5108
|
} catch {
|
|
5107
5109
|
return false;
|
|
5108
5110
|
}
|
|
@@ -5147,7 +5149,7 @@ function contributionKey(record) {
|
|
|
5147
5149
|
]);
|
|
5148
5150
|
}
|
|
5149
5151
|
function encodeProvenanceTuple(values) {
|
|
5150
|
-
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);
|
|
5151
5153
|
}
|
|
5152
5154
|
async function provenanceNodeId(targetGraphId, record) {
|
|
5153
5155
|
const tuple = encodeProvenanceTuple([
|
|
@@ -5190,7 +5192,7 @@ async function readProvenance(store, query = {}) {
|
|
|
5190
5192
|
const all = await store.nodes.Provenance.find();
|
|
5191
5193
|
return all.filter(
|
|
5192
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)
|
|
5193
|
-
).sort((left, right) =>
|
|
5195
|
+
).sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id));
|
|
5194
5196
|
}
|
|
5195
5197
|
|
|
5196
5198
|
// src/graph-merge/sources.ts
|
|
@@ -5200,10 +5202,10 @@ function orderEndpoints(left, right, sources) {
|
|
|
5200
5202
|
return compareMergeKeys(leftKey, rightKey) <= 0 ? { a: leftKey, b: rightKey, left, right, sources } : { a: rightKey, b: leftKey, left: right, right: left, sources };
|
|
5201
5203
|
}
|
|
5202
5204
|
function sortMembersById(members) {
|
|
5203
|
-
return [...members].sort((left, right) =>
|
|
5205
|
+
return [...members].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id));
|
|
5204
5206
|
}
|
|
5205
5207
|
function sortedBucketKeys(blocks) {
|
|
5206
|
-
return [...blocks.keys()].sort((left, right) =>
|
|
5208
|
+
return [...blocks.keys()].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
5207
5209
|
}
|
|
5208
5210
|
var NODE_SYSTEM_FIELDS = /* @__PURE__ */ new Set(["id", "kind", "meta"]);
|
|
5209
5211
|
function nodeProps(node) {
|
|
@@ -5231,7 +5233,7 @@ function windowedPairs(members, config) {
|
|
|
5231
5233
|
key: fieldText(node, config.sortFields)
|
|
5232
5234
|
}));
|
|
5233
5235
|
keyed.sort(
|
|
5234
|
-
(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)
|
|
5235
5237
|
);
|
|
5236
5238
|
const pairs = [];
|
|
5237
5239
|
for (let index = 0; index < keyed.length; index += 1) {
|
|
@@ -5342,7 +5344,7 @@ function ontologyRetypeEdges(stagedIdentities, isRetypeCompatible) {
|
|
|
5342
5344
|
}
|
|
5343
5345
|
}
|
|
5344
5346
|
const edges = [];
|
|
5345
|
-
for (const id of [...identitiesById.keys()].sort(
|
|
5347
|
+
for (const id of [...identitiesById.keys()].sort(chunkRWUWTJQY_cjs.compareStrings)) {
|
|
5346
5348
|
const identities = [...new Set(identitiesById.get(id))].sort(
|
|
5347
5349
|
compareMergeKeys
|
|
5348
5350
|
);
|
|
@@ -5450,7 +5452,7 @@ var baseUniqueSource = {
|
|
|
5450
5452
|
const forcedEdges = [];
|
|
5451
5453
|
const baseMembers = /* @__PURE__ */ new Map();
|
|
5452
5454
|
const constraints = [...uniqueConstraints].sort(
|
|
5453
|
-
(left, right) =>
|
|
5455
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.name, right.name)
|
|
5454
5456
|
);
|
|
5455
5457
|
const items = nodes.map((node) => ({ props: nodeProps(node) }));
|
|
5456
5458
|
const matchesByConstraint = await Promise.all(
|
|
@@ -5520,7 +5522,7 @@ var baseUniqueSource = {
|
|
|
5520
5522
|
pairs: [],
|
|
5521
5523
|
forcedEdges,
|
|
5522
5524
|
baseMembers: [...baseMembers.values()].sort(
|
|
5523
|
-
(left, right) =>
|
|
5525
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
5524
5526
|
)
|
|
5525
5527
|
};
|
|
5526
5528
|
}
|
|
@@ -5598,7 +5600,7 @@ var baseKeySource = {
|
|
|
5598
5600
|
pairs,
|
|
5599
5601
|
forcedEdges: [],
|
|
5600
5602
|
baseMembers: [...baseMembers.values()].sort(
|
|
5601
|
-
(left, right) =>
|
|
5603
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
5602
5604
|
)
|
|
5603
5605
|
};
|
|
5604
5606
|
}
|
|
@@ -5610,16 +5612,16 @@ var CANDIDATE_SOURCES = [
|
|
|
5610
5612
|
|
|
5611
5613
|
// src/graph-merge/staging.ts
|
|
5612
5614
|
function compareByIdThenBranch(left, right) {
|
|
5613
|
-
const byId2 =
|
|
5614
|
-
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;
|
|
5615
5617
|
}
|
|
5616
5618
|
function compareByKindIdBranch(left, right) {
|
|
5617
|
-
const byKind =
|
|
5619
|
+
const byKind = chunkRWUWTJQY_cjs.compareStrings(left.kind, right.kind);
|
|
5618
5620
|
if (byKind !== 0) {
|
|
5619
5621
|
return byKind;
|
|
5620
5622
|
}
|
|
5621
|
-
const byId2 =
|
|
5622
|
-
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;
|
|
5623
5625
|
}
|
|
5624
5626
|
function groupByKind(items) {
|
|
5625
5627
|
const buckets = /* @__PURE__ */ new Map();
|
|
@@ -5633,7 +5635,7 @@ function groupByKind(items) {
|
|
|
5633
5635
|
}
|
|
5634
5636
|
const ordered = /* @__PURE__ */ new Map();
|
|
5635
5637
|
for (const kind of [...buckets.keys()].sort(
|
|
5636
|
-
(left, right) =>
|
|
5638
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
5637
5639
|
)) {
|
|
5638
5640
|
ordered.set(
|
|
5639
5641
|
kind,
|
|
@@ -5655,7 +5657,7 @@ async function stageBranches(baseStore, branches, captureTargetStateFor) {
|
|
|
5655
5657
|
const windowedEdges = [];
|
|
5656
5658
|
const newIdentityAssertions = [];
|
|
5657
5659
|
const retractedIdentityAssertions = [];
|
|
5658
|
-
const baseIdentityAssertions = await
|
|
5660
|
+
const baseIdentityAssertions = await chunkTUVD4DFR_cjs.storeRuntime(baseStore).readCurrentIdentityAssertions("state");
|
|
5659
5661
|
let targetNodeVersions = /* @__PURE__ */ new Map();
|
|
5660
5662
|
let targetEdgeSignatures = /* @__PURE__ */ new Map();
|
|
5661
5663
|
for (const branch2 of branches) {
|
|
@@ -5726,17 +5728,17 @@ async function stageBranches(baseStore, branches, captureTargetStateFor) {
|
|
|
5726
5728
|
(left, right) => compareByKindIdBranch(left, right)
|
|
5727
5729
|
),
|
|
5728
5730
|
newIdentityAssertions: newIdentityAssertions.toSorted((left, right) => {
|
|
5729
|
-
const byId2 =
|
|
5730
|
-
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;
|
|
5731
5733
|
}),
|
|
5732
5734
|
retractedIdentityAssertions: retractedIdentityAssertions.toSorted(
|
|
5733
5735
|
(left, right) => {
|
|
5734
|
-
const byId2 =
|
|
5735
|
-
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;
|
|
5736
5738
|
}
|
|
5737
5739
|
),
|
|
5738
5740
|
baseIdentityAssertions: baseIdentityAssertions.toSorted(
|
|
5739
|
-
(left, right) =>
|
|
5741
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)
|
|
5740
5742
|
),
|
|
5741
5743
|
targetNodeVersions,
|
|
5742
5744
|
targetEdgeSignatures
|
|
@@ -5788,7 +5790,7 @@ async function withTxConflictRetry(commit) {
|
|
|
5788
5790
|
// src/graph-merge/type-reconcile.ts
|
|
5789
5791
|
var INCOMPATIBLE_TYPES_FLAG_REASON = "type-reconcile:incompatible-kinds";
|
|
5790
5792
|
function distinctKinds(kinds) {
|
|
5791
|
-
return [...new Set(kinds)].sort((left, right) =>
|
|
5793
|
+
return [...new Set(kinds)].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right));
|
|
5792
5794
|
}
|
|
5793
5795
|
function areEquivalent(closure, left, right) {
|
|
5794
5796
|
return left !== right && isReachable2(closure, left, right) && isReachable2(closure, right, left);
|
|
@@ -5807,7 +5809,7 @@ function mostSpecificCommonKind(closure, kinds) {
|
|
|
5807
5809
|
return void 0;
|
|
5808
5810
|
}
|
|
5809
5811
|
return chunkN66HCGCY_cjs.requireDefined(
|
|
5810
|
-
[...qualifiers].sort((left, right) =>
|
|
5812
|
+
[...qualifiers].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right))[0]
|
|
5811
5813
|
);
|
|
5812
5814
|
}
|
|
5813
5815
|
function reconcileTypes(clusters, closure, mode) {
|
|
@@ -5845,10 +5847,10 @@ function reconcileTypes(clusters, closure, mode) {
|
|
|
5845
5847
|
}
|
|
5846
5848
|
return {
|
|
5847
5849
|
reconciliations: reconciliations.sort(
|
|
5848
|
-
(left, right) =>
|
|
5850
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left.entityId, right.entityId)
|
|
5849
5851
|
),
|
|
5850
5852
|
retypeMap,
|
|
5851
|
-
dropped: dropped.sort((left, right) =>
|
|
5853
|
+
dropped: dropped.sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id))
|
|
5852
5854
|
};
|
|
5853
5855
|
}
|
|
5854
5856
|
|
|
@@ -5866,8 +5868,8 @@ function newNodesByKind(staging) {
|
|
|
5866
5868
|
ordered.set(
|
|
5867
5869
|
kind,
|
|
5868
5870
|
[...items].sort((left, right) => {
|
|
5869
|
-
const byId2 =
|
|
5870
|
-
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;
|
|
5871
5873
|
})
|
|
5872
5874
|
);
|
|
5873
5875
|
}
|
|
@@ -5901,7 +5903,7 @@ async function precomputeEmbeddings(byKind, resolve, embedder) {
|
|
|
5901
5903
|
}
|
|
5902
5904
|
async function embedSortedTexts(texts, embedder) {
|
|
5903
5905
|
const orderedTexts = [...texts].sort(
|
|
5904
|
-
(left, right) =>
|
|
5906
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
5905
5907
|
);
|
|
5906
5908
|
const vectors = await embedder(orderedTexts);
|
|
5907
5909
|
if (vectors.length !== orderedTexts.length) {
|
|
@@ -5953,7 +5955,7 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
5953
5955
|
async ([kind, items]) => {
|
|
5954
5956
|
const resolveConfig = options.resolve[kind];
|
|
5955
5957
|
if (resolveConfig === void 0) {
|
|
5956
|
-
return
|
|
5958
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
5957
5959
|
edges: [],
|
|
5958
5960
|
warnings: [],
|
|
5959
5961
|
baseMembers: [],
|
|
@@ -6003,10 +6005,10 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
6003
6005
|
options.maxComparisonsPerKind,
|
|
6004
6006
|
options.candidateDiagnostics?.limit ?? 0
|
|
6005
6007
|
);
|
|
6006
|
-
if (
|
|
6007
|
-
return
|
|
6008
|
+
if (chunkRJMHU2MG_cjs.isErr(scored)) {
|
|
6009
|
+
return chunkRJMHU2MG_cjs.err(scored.error);
|
|
6008
6010
|
}
|
|
6009
|
-
return
|
|
6011
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
6010
6012
|
edges: scored.data.edges,
|
|
6011
6013
|
warnings: scored.data.warnings.map(
|
|
6012
6014
|
(warning) => `[${kind}] ${warning.message}`
|
|
@@ -6019,8 +6021,8 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
6019
6021
|
)
|
|
6020
6022
|
);
|
|
6021
6023
|
for (const result of perKind) {
|
|
6022
|
-
if (
|
|
6023
|
-
return
|
|
6024
|
+
if (chunkRJMHU2MG_cjs.isErr(result)) {
|
|
6025
|
+
return chunkRJMHU2MG_cjs.err(result.error);
|
|
6024
6026
|
}
|
|
6025
6027
|
allEdges.push(...result.data.edges);
|
|
6026
6028
|
warnings.push(...result.data.warnings);
|
|
@@ -6034,7 +6036,7 @@ async function generateAllCandidates(target, staging, options, introspectionKind
|
|
|
6034
6036
|
}
|
|
6035
6037
|
diagnosticsTotal += result.data.diagnosticsTotal;
|
|
6036
6038
|
}
|
|
6037
|
-
return
|
|
6039
|
+
return chunkRJMHU2MG_cjs.ok({
|
|
6038
6040
|
// The ONE shared `(a, b)` edge comparator (id-first `(kind, id)` order), so this
|
|
6039
6041
|
// stage emits edges in exactly the order clustering consumes them.
|
|
6040
6042
|
edges: allEdges.sort((left, right) => compareCandidateEdges(left, right)),
|
|
@@ -6176,9 +6178,9 @@ function buildProvenanceIndex(records) {
|
|
|
6176
6178
|
for (const [branchId, sets] of byBranch) {
|
|
6177
6179
|
frozen.set(branchId, {
|
|
6178
6180
|
nodeIds: [...sets.nodeIds].sort(
|
|
6179
|
-
(left, right) =>
|
|
6181
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)
|
|
6180
6182
|
),
|
|
6181
|
-
edgeIds: [...sets.edgeIds].sort((left, right) =>
|
|
6183
|
+
edgeIds: [...sets.edgeIds].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left, right)).map((id) => id)
|
|
6182
6184
|
});
|
|
6183
6185
|
}
|
|
6184
6186
|
return {
|
|
@@ -6578,7 +6580,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
6578
6580
|
...identityRemap.dropped,
|
|
6579
6581
|
...validWindows.dropped
|
|
6580
6582
|
].sort(
|
|
6581
|
-
(left, right) =>
|
|
6583
|
+
(left, right) => chunkRWUWTJQY_cjs.compareStrings(`${left.kind}|${left.id}`, `${right.kind}|${right.id}`)
|
|
6582
6584
|
);
|
|
6583
6585
|
return {
|
|
6584
6586
|
canonicalEntities,
|
|
@@ -6615,7 +6617,7 @@ function buildInternalMergePlan(staging, candidateEdges, candidateWarnings, cand
|
|
|
6615
6617
|
mergeKey(left.kind, left.entityId),
|
|
6616
6618
|
mergeKey(right.kind, right.entityId)
|
|
6617
6619
|
);
|
|
6618
|
-
return byEntity === 0 ?
|
|
6620
|
+
return byEntity === 0 ? chunkRWUWTJQY_cjs.compareStrings(left.property, right.property) : byEntity;
|
|
6619
6621
|
}
|
|
6620
6622
|
),
|
|
6621
6623
|
deleteModifyConflicts: [
|
|
@@ -6798,7 +6800,7 @@ async function applyNodeRows(target, txBackend, nodesApi, deletions, upserts) {
|
|
|
6798
6800
|
afterImages.set(mergeKey(kind, item.id), props);
|
|
6799
6801
|
}
|
|
6800
6802
|
}
|
|
6801
|
-
return
|
|
6803
|
+
return chunkTUVD4DFR_cjs.storeRuntime(target).applyResolvedNodeUniqueness(
|
|
6802
6804
|
txBackend,
|
|
6803
6805
|
{
|
|
6804
6806
|
upserts: upserts.map((upsert) => ({
|
|
@@ -6846,7 +6848,7 @@ async function applyEdgeRows(edgesApi, deletions, upserts) {
|
|
|
6846
6848
|
}
|
|
6847
6849
|
async function applyIdentityRows(target, txBackend, assertions, retractions, assertConsistent) {
|
|
6848
6850
|
try {
|
|
6849
|
-
const applied = await
|
|
6851
|
+
const applied = await chunkTUVD4DFR_cjs.storeRuntime(target).applyIdentityMergeAtTarget(
|
|
6850
6852
|
txBackend,
|
|
6851
6853
|
retractions,
|
|
6852
6854
|
assertions
|
|
@@ -6894,7 +6896,7 @@ async function applyInternalMergePlan(plan, nodesApi, edgesApi, target, txBacken
|
|
|
6894
6896
|
nodeUpserts
|
|
6895
6897
|
);
|
|
6896
6898
|
} catch (error) {
|
|
6897
|
-
throw error instanceof
|
|
6899
|
+
throw error instanceof chunkX4GDXBOP_cjs.IdentityEndpointValidityError ? translateIdentityCommitError(error) : error;
|
|
6898
6900
|
}
|
|
6899
6901
|
const edgeDeletions = [...plan.edgeDeletions].map(([identity, kind]) => ({
|
|
6900
6902
|
kind,
|
|
@@ -6944,7 +6946,7 @@ async function applyInternalMergePlan(plan, nodesApi, edgesApi, target, txBacken
|
|
|
6944
6946
|
};
|
|
6945
6947
|
}
|
|
6946
6948
|
async function commitPlan(target, plan, expectedBaseVersion) {
|
|
6947
|
-
if (!
|
|
6949
|
+
if (!chunkTUVD4DFR_cjs.storeBackend(target).capabilities.transactions) {
|
|
6948
6950
|
throw new MergeError(
|
|
6949
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.)",
|
|
6950
6952
|
{ details: { capability: "transactions" } }
|
|
@@ -6955,14 +6957,14 @@ async function commitPlan(target, plan, expectedBaseVersion) {
|
|
|
6955
6957
|
() => target.transaction(async (tx) => {
|
|
6956
6958
|
if (expectedBaseVersion !== void 0) {
|
|
6957
6959
|
await assertTargetUnchanged(
|
|
6958
|
-
|
|
6960
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx),
|
|
6959
6961
|
target,
|
|
6960
6962
|
expectedBaseVersion
|
|
6961
6963
|
);
|
|
6962
6964
|
}
|
|
6963
6965
|
await assertPlannedIdentityIdsFresh(
|
|
6964
6966
|
target,
|
|
6965
|
-
|
|
6967
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx),
|
|
6966
6968
|
plan
|
|
6967
6969
|
);
|
|
6968
6970
|
return applyInternalMergePlan(
|
|
@@ -6970,7 +6972,7 @@ async function commitPlan(target, plan, expectedBaseVersion) {
|
|
|
6970
6972
|
tx.nodes,
|
|
6971
6973
|
tx.edges,
|
|
6972
6974
|
target,
|
|
6973
|
-
|
|
6975
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx)
|
|
6974
6976
|
);
|
|
6975
6977
|
}, mergeCommitTransactionOptions(target))
|
|
6976
6978
|
)
|
|
@@ -6991,9 +6993,9 @@ function mergeCommitTransactionOptions(target) {
|
|
|
6991
6993
|
}
|
|
6992
6994
|
async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
6993
6995
|
if (hasRevisionAnchor(expectedBaseVersion)) {
|
|
6994
|
-
await
|
|
6996
|
+
await chunkRDP6ZRSM_cjs.lockRecordedGraphWrite(txBackend, target.graphId);
|
|
6995
6997
|
const expectedOrigin = revisionOriginOf(expectedBaseVersion);
|
|
6996
|
-
const liveOrigin = await
|
|
6998
|
+
const liveOrigin = await chunkRDP6ZRSM_cjs.readRevisionOrigin(
|
|
6997
6999
|
txBackend,
|
|
6998
7000
|
target.revisionSchema,
|
|
6999
7001
|
target.graphId
|
|
@@ -7007,7 +7009,7 @@ async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
|
7007
7009
|
}
|
|
7008
7010
|
);
|
|
7009
7011
|
}
|
|
7010
|
-
const liveRevision = await
|
|
7012
|
+
const liveRevision = await chunkRDP6ZRSM_cjs.readRecordedClock(
|
|
7011
7013
|
txBackend,
|
|
7012
7014
|
target.revisionSchema,
|
|
7013
7015
|
target.graphId
|
|
@@ -7028,7 +7030,7 @@ async function assertTargetUnchanged(txBackend, target, expectedBaseVersion) {
|
|
|
7028
7030
|
txBackend,
|
|
7029
7031
|
target.graphId,
|
|
7030
7032
|
target.graph,
|
|
7031
|
-
await
|
|
7033
|
+
await chunkTUVD4DFR_cjs.storeRuntime(target).identityAssertionsAtTarget(txBackend, "state")
|
|
7032
7034
|
);
|
|
7033
7035
|
const expectedContent = contentComponentOf(expectedBaseVersion);
|
|
7034
7036
|
if (liveContent !== expectedContent) {
|
|
@@ -7066,7 +7068,7 @@ async function validateBaseVersions(target, branches) {
|
|
|
7066
7068
|
const targetVersion = await computeBaseVersion(target);
|
|
7067
7069
|
for (const branch2 of branches) {
|
|
7068
7070
|
if (branch2.base !== targetVersion) {
|
|
7069
|
-
return
|
|
7071
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7070
7072
|
new BaseVersionMismatchError(
|
|
7071
7073
|
`Branch "${branch2.id}" forked from base@V "${branch2.base}", which does not match the merge target's current base@V "${targetVersion}".`,
|
|
7072
7074
|
{
|
|
@@ -7080,14 +7082,14 @@ async function validateBaseVersions(target, branches) {
|
|
|
7080
7082
|
);
|
|
7081
7083
|
}
|
|
7082
7084
|
}
|
|
7083
|
-
return
|
|
7085
|
+
return chunkRJMHU2MG_cjs.ok(targetVersion);
|
|
7084
7086
|
}
|
|
7085
7087
|
function tryNormalize(optionsInput, refusedOptions = []) {
|
|
7086
7088
|
const refusedOption = refusedOptions.find(
|
|
7087
7089
|
(option) => chunkN66HCGCY_cjs.hasOwnKey(optionsInput, option)
|
|
7088
7090
|
);
|
|
7089
7091
|
if (refusedOption !== void 0) {
|
|
7090
|
-
return
|
|
7092
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7091
7093
|
new InvalidMergeOptionsError(
|
|
7092
7094
|
`This merge operation does not accept options.${refusedOption}.`,
|
|
7093
7095
|
{ details: { option: refusedOption } }
|
|
@@ -7095,18 +7097,18 @@ function tryNormalize(optionsInput, refusedOptions = []) {
|
|
|
7095
7097
|
);
|
|
7096
7098
|
}
|
|
7097
7099
|
try {
|
|
7098
|
-
return
|
|
7100
|
+
return chunkRJMHU2MG_cjs.ok(normalizeMergeOptions(optionsInput));
|
|
7099
7101
|
} catch (error) {
|
|
7100
|
-
return
|
|
7102
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7101
7103
|
new InvalidMergeOptionsError("Invalid merge options.", { cause: error })
|
|
7102
7104
|
);
|
|
7103
7105
|
}
|
|
7104
7106
|
}
|
|
7105
7107
|
async function tryOpenProvenanceStore(target) {
|
|
7106
7108
|
try {
|
|
7107
|
-
return
|
|
7109
|
+
return chunkRJMHU2MG_cjs.ok(await openProvenanceStore(target));
|
|
7108
7110
|
} catch (error) {
|
|
7109
|
-
const code = error instanceof
|
|
7111
|
+
const code = error instanceof chunkX4GDXBOP_cjs.TypeGraphError ? error.details?.code : void 0;
|
|
7110
7112
|
const details = {
|
|
7111
7113
|
option: "persistProvenance",
|
|
7112
7114
|
graphId: provenanceGraphId(target.graphId),
|
|
@@ -7114,13 +7116,13 @@ async function tryOpenProvenanceStore(target) {
|
|
|
7114
7116
|
...typeof code === "string" ? { provenanceErrorCode: code } : {}
|
|
7115
7117
|
};
|
|
7116
7118
|
const message = `options.persistProvenance was requested but the merge-provenance sidecar cannot be opened: ${describeCause(error)}`;
|
|
7117
|
-
return
|
|
7119
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7118
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 })
|
|
7119
7121
|
);
|
|
7120
7122
|
}
|
|
7121
7123
|
}
|
|
7122
7124
|
function assertPublicPlanCapability(target) {
|
|
7123
|
-
if (!
|
|
7125
|
+
if (!chunkTUVD4DFR_cjs.storeBackend(target).capabilities.transactions) {
|
|
7124
7126
|
throw new MergePlanCapabilityError(
|
|
7125
7127
|
"Public merge plans require a transaction-capable target backend.",
|
|
7126
7128
|
{ details: { capability: "transactions" } }
|
|
@@ -7139,7 +7141,7 @@ function assertPublicPlanCapability(target) {
|
|
|
7139
7141
|
async function captureMergePlanTargetFence(target) {
|
|
7140
7142
|
assertPublicPlanCapability(target);
|
|
7141
7143
|
const [activeSchema, schemaHash, origin, revision] = await Promise.all([
|
|
7142
|
-
|
|
7144
|
+
chunkTUVD4DFR_cjs.storeBackend(target).getActiveSchema(target.graphId),
|
|
7143
7145
|
computeSchemaComponent(target),
|
|
7144
7146
|
target.revisionOriginNow(),
|
|
7145
7147
|
target.revisionNow()
|
|
@@ -7168,7 +7170,7 @@ async function assertPlanningFenceUnchanged(target, startingFence) {
|
|
|
7168
7170
|
function splitWireProps(props) {
|
|
7169
7171
|
const setProps = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
7170
7172
|
const unsetProps = [];
|
|
7171
|
-
for (const key of Object.keys(props).sort(
|
|
7173
|
+
for (const key of Object.keys(props).sort(chunkRWUWTJQY_cjs.compareStrings)) {
|
|
7172
7174
|
const value = props[key];
|
|
7173
7175
|
if (value === void 0) {
|
|
7174
7176
|
unsetProps.push(key);
|
|
@@ -7285,7 +7287,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7285
7287
|
let targetBranchSeen = false;
|
|
7286
7288
|
for (const branch2 of branches) {
|
|
7287
7289
|
if (branch2.id === BASE_PROVENANCE_BRANCH) {
|
|
7288
|
-
return
|
|
7290
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7289
7291
|
new MergeError(
|
|
7290
7292
|
`Branch id "${BASE_PROVENANCE_BRANCH}" is reserved for committed-base provenance and cannot be used as a branch id.`,
|
|
7291
7293
|
{ details: { branchId: branch2.id } }
|
|
@@ -7294,7 +7296,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7294
7296
|
}
|
|
7295
7297
|
if (branch2.id === COMMITTED_TARGET_BRANCH) {
|
|
7296
7298
|
if (incremental?.targetBranchId !== COMMITTED_TARGET_BRANCH || targetBranchSeen) {
|
|
7297
|
-
return
|
|
7299
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7298
7300
|
new MergeError(
|
|
7299
7301
|
`Branch id "${COMMITTED_TARGET_BRANCH}" is reserved for the committed incremental target and cannot be used as a branch id.`,
|
|
7300
7302
|
{ details: { branchId: branch2.id } }
|
|
@@ -7305,7 +7307,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7305
7307
|
}
|
|
7306
7308
|
}
|
|
7307
7309
|
for (const branch2 of branches) {
|
|
7308
|
-
const branchSchemaRow = await
|
|
7310
|
+
const branchSchemaRow = await chunkTUVD4DFR_cjs.storeBackend(branch2.store).getActiveSchema(
|
|
7309
7311
|
branch2.store.graphId
|
|
7310
7312
|
);
|
|
7311
7313
|
let drifted;
|
|
@@ -7313,13 +7315,13 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7313
7315
|
const anchor = branch2.schemaAnchor;
|
|
7314
7316
|
drifted = anchor === void 0 ? branchSchemaRow !== void 0 : branchSchemaRow?.version !== anchor.version || branchSchemaRow.schema_hash !== anchor.hash;
|
|
7315
7317
|
} else {
|
|
7316
|
-
const sourceSchemaRow = await
|
|
7318
|
+
const sourceSchemaRow = await chunkTUVD4DFR_cjs.storeBackend(store).getActiveSchema(
|
|
7317
7319
|
store.graphId
|
|
7318
7320
|
);
|
|
7319
7321
|
drifted = branchSchemaRow?.schema_hash !== sourceSchemaRow?.schema_hash;
|
|
7320
7322
|
}
|
|
7321
7323
|
if (drifted) {
|
|
7322
|
-
return
|
|
7324
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7323
7325
|
new BaseVersionMismatchError(
|
|
7324
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.`,
|
|
7325
7327
|
{
|
|
@@ -7358,7 +7360,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7358
7360
|
options.embedder
|
|
7359
7361
|
);
|
|
7360
7362
|
const ctx = {
|
|
7361
|
-
backend:
|
|
7363
|
+
backend: chunkTUVD4DFR_cjs.storeBackend(store),
|
|
7362
7364
|
...embeddings === void 0 ? {} : { embeddings }
|
|
7363
7365
|
};
|
|
7364
7366
|
const candidates = await generateAllCandidates(
|
|
@@ -7370,8 +7372,8 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7370
7372
|
useBaseSources,
|
|
7371
7373
|
options.embedder
|
|
7372
7374
|
);
|
|
7373
|
-
if (
|
|
7374
|
-
return
|
|
7375
|
+
if (chunkRJMHU2MG_cjs.isErr(candidates)) {
|
|
7376
|
+
return chunkRJMHU2MG_cjs.err(candidates.error);
|
|
7375
7377
|
}
|
|
7376
7378
|
const identityProbeIds = target.graph.identity === void 0 ? void 0 : [
|
|
7377
7379
|
.../* @__PURE__ */ new Set([
|
|
@@ -7386,7 +7388,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7386
7388
|
])
|
|
7387
7389
|
])
|
|
7388
7390
|
];
|
|
7389
|
-
const targetPeers = identityProbeIds === void 0 ? [] : await
|
|
7391
|
+
const targetPeers = identityProbeIds === void 0 ? [] : await chunkTUVD4DFR_cjs.storeRuntime(target).liveNodesSharingIds(identityProbeIds);
|
|
7390
7392
|
const stagedIdentityIds = [
|
|
7391
7393
|
.../* @__PURE__ */ new Set([
|
|
7392
7394
|
...staging.newIdentityAssertions.map((staged) => staged.assertion.id),
|
|
@@ -7395,7 +7397,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7395
7397
|
)
|
|
7396
7398
|
])
|
|
7397
7399
|
];
|
|
7398
|
-
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(
|
|
7399
7401
|
stagedIdentityIds
|
|
7400
7402
|
);
|
|
7401
7403
|
const identityContext = {
|
|
@@ -7420,14 +7422,14 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7420
7422
|
if (plan.identityAssertions.length > 0) {
|
|
7421
7423
|
assertOneIdOneTruth(
|
|
7422
7424
|
plan.identityAssertions,
|
|
7423
|
-
await
|
|
7425
|
+
await chunkTUVD4DFR_cjs.storeRuntime(target).identityAssertionRowsByIds(
|
|
7424
7426
|
plan.identityAssertions.map((assertion) => assertion.id)
|
|
7425
7427
|
)
|
|
7426
7428
|
);
|
|
7427
7429
|
}
|
|
7428
7430
|
let identityGuard;
|
|
7429
7431
|
if (identityProbeIds !== void 0 && incremental !== void 0) {
|
|
7430
|
-
const freshPeers = await
|
|
7432
|
+
const freshPeers = await chunkTUVD4DFR_cjs.storeRuntime(target).liveNodesSharingIds(identityProbeIds);
|
|
7431
7433
|
const built = await buildIdentityPeerProbe(
|
|
7432
7434
|
target,
|
|
7433
7435
|
identityProbeIds,
|
|
@@ -7475,7 +7477,7 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7475
7477
|
targetNodeVersions: staging.targetNodeVersions,
|
|
7476
7478
|
targetEdgeSignatures: staging.targetEdgeSignatures
|
|
7477
7479
|
};
|
|
7478
|
-
return
|
|
7480
|
+
return chunkRJMHU2MG_cjs.ok(
|
|
7479
7481
|
await complete({
|
|
7480
7482
|
target,
|
|
7481
7483
|
plan,
|
|
@@ -7486,9 +7488,9 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7486
7488
|
);
|
|
7487
7489
|
} catch (error) {
|
|
7488
7490
|
if (error instanceof MergeError) {
|
|
7489
|
-
return
|
|
7491
|
+
return chunkRJMHU2MG_cjs.err(error);
|
|
7490
7492
|
}
|
|
7491
|
-
return
|
|
7493
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7492
7494
|
new MergeError(
|
|
7493
7495
|
`Merge failed while staging or committing: ${describeCause(error)}`,
|
|
7494
7496
|
{ cause: error }
|
|
@@ -7499,14 +7501,14 @@ async function resolveMerge(store, target, branches, options, useBaseSources, in
|
|
|
7499
7501
|
async function commitResolvedMerge(resolved) {
|
|
7500
7502
|
const { target, plan, options } = resolved;
|
|
7501
7503
|
const provenanceStore = options.persistProvenance ? await tryOpenProvenanceStore(target) : void 0;
|
|
7502
|
-
if (provenanceStore !== void 0 &&
|
|
7504
|
+
if (provenanceStore !== void 0 && chunkRJMHU2MG_cjs.isErr(provenanceStore)) {
|
|
7503
7505
|
throw provenanceStore.error;
|
|
7504
7506
|
}
|
|
7505
7507
|
const merged = resolved.incrementalGuard === void 0 ? await commitPlan(target, plan, resolved.expectedBaseVersion) : await commitIncrementalPlan(target, plan, resolved.incrementalGuard);
|
|
7506
7508
|
const provenance = options.provenance ? buildProvenanceIndex(plan.provenanceRecords) : { byBranch: () => ({ nodeIds: [], edgeIds: [] }) };
|
|
7507
7509
|
const warnings = [...plan.warnings];
|
|
7508
7510
|
let provenancePersisted;
|
|
7509
|
-
if (provenanceStore !== void 0 && !
|
|
7511
|
+
if (provenanceStore !== void 0 && !chunkRJMHU2MG_cjs.isErr(provenanceStore)) {
|
|
7510
7512
|
try {
|
|
7511
7513
|
const count = await persistProvenanceRecords(
|
|
7512
7514
|
provenanceStore.data,
|
|
@@ -7559,14 +7561,14 @@ function incrementalSchemaError() {
|
|
|
7559
7561
|
async function planMerge(store, branchInputs, optionsInput = {}) {
|
|
7560
7562
|
const branches = unwrapMergeBranches(branchInputs);
|
|
7561
7563
|
const normalized = tryNormalize(optionsInput);
|
|
7562
|
-
if (
|
|
7564
|
+
if (chunkRJMHU2MG_cjs.isErr(normalized)) return chunkRJMHU2MG_cjs.err(normalized.error);
|
|
7563
7565
|
const options = normalized.data;
|
|
7564
7566
|
const target = options.target ?? store;
|
|
7565
7567
|
let targetFence;
|
|
7566
7568
|
try {
|
|
7567
7569
|
targetFence = await captureMergePlanTargetFence(target);
|
|
7568
7570
|
} catch (error) {
|
|
7569
|
-
return
|
|
7571
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7570
7572
|
error instanceof MergeError ? error : new MergePlanCapabilityError(
|
|
7571
7573
|
`Unable to capture the target's durable plan fence: ${describeCause(error)}`,
|
|
7572
7574
|
{ cause: error }
|
|
@@ -7574,11 +7576,11 @@ async function planMerge(store, branchInputs, optionsInput = {}) {
|
|
|
7574
7576
|
);
|
|
7575
7577
|
}
|
|
7576
7578
|
const precondition = await validateBaseVersions(target, branches);
|
|
7577
|
-
if (
|
|
7579
|
+
if (chunkRJMHU2MG_cjs.isErr(precondition)) return chunkRJMHU2MG_cjs.err(precondition.error);
|
|
7578
7580
|
const anchors = {
|
|
7579
7581
|
kind: "snapshot",
|
|
7580
7582
|
base: { graphId: store.graphId, baseVersion: precondition.data },
|
|
7581
|
-
branches: [...branches].sort((left, right) =>
|
|
7583
|
+
branches: [...branches].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)).map((branch2) => ({
|
|
7582
7584
|
branchId: branch2.id,
|
|
7583
7585
|
baseVersion: branch2.base
|
|
7584
7586
|
}))
|
|
@@ -7601,16 +7603,16 @@ async function planMergeIncremental(args) {
|
|
|
7601
7603
|
const { forkPoint, target } = args;
|
|
7602
7604
|
const branches = unwrapMergeBranches(args.branches);
|
|
7603
7605
|
const normalized = tryNormalize(args.options ?? {}, ["target"]);
|
|
7604
|
-
if (
|
|
7606
|
+
if (chunkRJMHU2MG_cjs.isErr(normalized)) return chunkRJMHU2MG_cjs.err(normalized.error);
|
|
7605
7607
|
const options = normalized.data;
|
|
7606
7608
|
if (options.onBasePropertyConflict !== "flag") {
|
|
7607
|
-
return
|
|
7609
|
+
return chunkRJMHU2MG_cjs.err(incrementalBaseConflictPolicyError(options));
|
|
7608
7610
|
}
|
|
7609
7611
|
let targetFence;
|
|
7610
7612
|
try {
|
|
7611
7613
|
targetFence = await captureMergePlanTargetFence(target);
|
|
7612
7614
|
} catch (error) {
|
|
7613
|
-
return
|
|
7615
|
+
return chunkRJMHU2MG_cjs.err(
|
|
7614
7616
|
error instanceof MergeError ? error : new MergePlanCapabilityError(
|
|
7615
7617
|
`Unable to capture the target's durable plan fence: ${describeCause(error)}`,
|
|
7616
7618
|
{ cause: error }
|
|
@@ -7618,14 +7620,14 @@ async function planMergeIncremental(args) {
|
|
|
7618
7620
|
);
|
|
7619
7621
|
}
|
|
7620
7622
|
const forkPrecondition = await validateForkPointVersions(forkPoint, branches);
|
|
7621
|
-
if (
|
|
7623
|
+
if (chunkRJMHU2MG_cjs.isErr(forkPrecondition)) return chunkRJMHU2MG_cjs.err(forkPrecondition.error);
|
|
7622
7624
|
const forkVersion = forkPrecondition.data;
|
|
7623
7625
|
const [forkSchema, targetSchema] = await Promise.all([
|
|
7624
7626
|
computeSchemaComponent(forkPoint),
|
|
7625
7627
|
computeSchemaComponent(target)
|
|
7626
7628
|
]);
|
|
7627
|
-
if (forkSchema !== targetSchema) return
|
|
7628
|
-
const forkActiveSchema = await
|
|
7629
|
+
if (forkSchema !== targetSchema) return chunkRJMHU2MG_cjs.err(incrementalSchemaError());
|
|
7630
|
+
const forkActiveSchema = await chunkTUVD4DFR_cjs.storeBackend(forkPoint).getActiveSchema(
|
|
7629
7631
|
forkPoint.graphId
|
|
7630
7632
|
);
|
|
7631
7633
|
const targetBranch = {
|
|
@@ -7644,7 +7646,7 @@ async function planMergeIncremental(args) {
|
|
|
7644
7646
|
hash: forkActiveSchema?.schema_hash ?? forkSchema
|
|
7645
7647
|
}
|
|
7646
7648
|
},
|
|
7647
|
-
branches: [...branches].sort((left, right) =>
|
|
7649
|
+
branches: [...branches].sort((left, right) => chunkRWUWTJQY_cjs.compareStrings(left.id, right.id)).map((branch2) => ({
|
|
7648
7650
|
branchId: branch2.id,
|
|
7649
7651
|
baseVersion: branch2.base
|
|
7650
7652
|
}))
|
|
@@ -7866,7 +7868,7 @@ async function preflightWireMergeWrites(target, nodesApi, edgesApi, artifact) {
|
|
|
7866
7868
|
}
|
|
7867
7869
|
for (const upsert of artifact.writes.edgeUpserts) {
|
|
7868
7870
|
const registration = chunkN66HCGCY_cjs.requireDefined(graphEdges[upsert.kind]);
|
|
7869
|
-
const endpointError =
|
|
7871
|
+
const endpointError = chunkLLVOQOWE_cjs.validateEdgeEndpoints(
|
|
7870
7872
|
upsert.kind,
|
|
7871
7873
|
upsert.from.kind,
|
|
7872
7874
|
upsert.to.kind,
|
|
@@ -7969,7 +7971,7 @@ async function preflightWireMergeWrites(target, nodesApi, edgesApi, artifact) {
|
|
|
7969
7971
|
}
|
|
7970
7972
|
}
|
|
7971
7973
|
async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact) {
|
|
7972
|
-
await
|
|
7974
|
+
await chunkRDP6ZRSM_cjs.lockRecordedGraphWrite(txBackend, target.graphId);
|
|
7973
7975
|
const activeSchema = await txBackend.getActiveSchema(target.graphId);
|
|
7974
7976
|
const liveSchema = {
|
|
7975
7977
|
managed: activeSchema !== void 0,
|
|
@@ -7982,7 +7984,7 @@ async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact
|
|
|
7982
7984
|
{ details: { expected: artifact.target.schema, live: liveSchema } }
|
|
7983
7985
|
);
|
|
7984
7986
|
}
|
|
7985
|
-
const liveOrigin = await
|
|
7987
|
+
const liveOrigin = await chunkRDP6ZRSM_cjs.readRevisionOrigin(
|
|
7986
7988
|
txBackend,
|
|
7987
7989
|
target.revisionSchema,
|
|
7988
7990
|
target.graphId
|
|
@@ -7998,7 +8000,7 @@ async function assertMergePlanFenceInsideTransaction(target, txBackend, artifact
|
|
|
7998
8000
|
}
|
|
7999
8001
|
);
|
|
8000
8002
|
}
|
|
8001
|
-
const liveRevision = await
|
|
8003
|
+
const liveRevision = await chunkRDP6ZRSM_cjs.readRecordedClock(
|
|
8002
8004
|
txBackend,
|
|
8003
8005
|
target.revisionSchema,
|
|
8004
8006
|
target.graphId
|
|
@@ -8074,7 +8076,7 @@ async function applyWireMergeWrites(target, nodesApi, edgesApi, txBackend, artif
|
|
|
8074
8076
|
txBackend,
|
|
8075
8077
|
identityAssertions,
|
|
8076
8078
|
identityRetractions,
|
|
8077
|
-
() =>
|
|
8079
|
+
() => chunkTUVD4DFR_cjs.storeRuntime(target).assertIdentityClassesConsistentAtTarget(
|
|
8078
8080
|
txBackend,
|
|
8079
8081
|
identityConsistencySeeds(
|
|
8080
8082
|
artifact,
|
|
@@ -8082,8 +8084,8 @@ async function applyWireMergeWrites(target, nodesApi, edgesApi, txBackend, artif
|
|
|
8082
8084
|
)
|
|
8083
8085
|
)
|
|
8084
8086
|
);
|
|
8085
|
-
if (!
|
|
8086
|
-
await
|
|
8087
|
+
if (!chunkRDP6ZRSM_cjs.forceRecordedGraphRevision(txBackend, target.graphId) && !chunkRDP6ZRSM_cjs.forceWriteTransactionRevision(txBackend)) {
|
|
8088
|
+
await chunkRDP6ZRSM_cjs.advanceRevisionClock(
|
|
8087
8089
|
txBackend,
|
|
8088
8090
|
target.revisionSchema,
|
|
8089
8091
|
target.graphId,
|
|
@@ -8123,7 +8125,7 @@ async function applyMergePlan(target, input) {
|
|
|
8123
8125
|
try {
|
|
8124
8126
|
validation = await validateMergePlanArtifact(input);
|
|
8125
8127
|
} catch (error) {
|
|
8126
|
-
return
|
|
8128
|
+
return chunkRJMHU2MG_cjs.err(
|
|
8127
8129
|
new InvalidMergePlanError(
|
|
8128
8130
|
`Merge plan validation failed: ${describeCause(error)}`,
|
|
8129
8131
|
{ cause: error }
|
|
@@ -8131,10 +8133,10 @@ async function applyMergePlan(target, input) {
|
|
|
8131
8133
|
);
|
|
8132
8134
|
}
|
|
8133
8135
|
if (!validation.success)
|
|
8134
|
-
return
|
|
8136
|
+
return chunkRJMHU2MG_cjs.err(mergePlanValidationError(validation.error));
|
|
8135
8137
|
const artifact = validation.artifact;
|
|
8136
8138
|
if (artifact.target.graphId !== target.graphId) {
|
|
8137
|
-
return
|
|
8139
|
+
return chunkRJMHU2MG_cjs.err(
|
|
8138
8140
|
new MergePlanTargetMismatchError(
|
|
8139
8141
|
"The merge plan names a different target graph.",
|
|
8140
8142
|
{
|
|
@@ -8149,12 +8151,12 @@ async function applyMergePlan(target, input) {
|
|
|
8149
8151
|
try {
|
|
8150
8152
|
assertPublicPlanCapability(target);
|
|
8151
8153
|
const provenanceStore = artifact.provenance.persist ? await tryOpenProvenanceStore(target) : void 0;
|
|
8152
|
-
if (provenanceStore !== void 0 &&
|
|
8153
|
-
return
|
|
8154
|
+
if (provenanceStore !== void 0 && chunkRJMHU2MG_cjs.isErr(provenanceStore)) {
|
|
8155
|
+
return chunkRJMHU2MG_cjs.err(provenanceStore.error);
|
|
8154
8156
|
}
|
|
8155
8157
|
const merged = await withTxConflictRetry(
|
|
8156
8158
|
() => target.transaction(async (tx) => {
|
|
8157
|
-
const txBackend =
|
|
8159
|
+
const txBackend = chunkTUVD4DFR_cjs.transactionBackend(tx);
|
|
8158
8160
|
await assertMergePlanFenceInsideTransaction(
|
|
8159
8161
|
target,
|
|
8160
8162
|
txBackend,
|
|
@@ -8181,7 +8183,7 @@ async function applyMergePlan(target, input) {
|
|
|
8181
8183
|
);
|
|
8182
8184
|
const warnings = [...artifact.review.warnings];
|
|
8183
8185
|
let provenancePersisted;
|
|
8184
|
-
if (provenanceStore !== void 0 && !
|
|
8186
|
+
if (provenanceStore !== void 0 && !chunkRJMHU2MG_cjs.isErr(provenanceStore)) {
|
|
8185
8187
|
try {
|
|
8186
8188
|
const records = artifact.review.provenanceRecords;
|
|
8187
8189
|
const count = await persistProvenanceRecords(
|
|
@@ -8199,12 +8201,12 @@ async function applyMergePlan(target, input) {
|
|
|
8199
8201
|
);
|
|
8200
8202
|
}
|
|
8201
8203
|
}
|
|
8202
|
-
return
|
|
8204
|
+
return chunkRJMHU2MG_cjs.ok(
|
|
8203
8205
|
reportFromArtifact(artifact, merged, warnings, provenancePersisted)
|
|
8204
8206
|
);
|
|
8205
8207
|
} catch (error) {
|
|
8206
8208
|
const translated = translateMergeCommitError(error);
|
|
8207
|
-
return
|
|
8209
|
+
return chunkRJMHU2MG_cjs.err(
|
|
8208
8210
|
translated instanceof MergeError ? translated : new MergeError(
|
|
8209
8211
|
`Merge plan apply failed: ${describeCause(translated)}`,
|
|
8210
8212
|
{
|
|
@@ -8217,14 +8219,14 @@ async function applyMergePlan(target, input) {
|
|
|
8217
8219
|
async function merge(store, branchInputs, optionsInput = {}) {
|
|
8218
8220
|
const branches = unwrapMergeBranches(branchInputs);
|
|
8219
8221
|
const normalized = tryNormalize(optionsInput);
|
|
8220
|
-
if (
|
|
8221
|
-
return
|
|
8222
|
+
if (chunkRJMHU2MG_cjs.isErr(normalized)) {
|
|
8223
|
+
return chunkRJMHU2MG_cjs.err(normalized.error);
|
|
8222
8224
|
}
|
|
8223
8225
|
const options = normalized.data;
|
|
8224
8226
|
const target = options.target ?? store;
|
|
8225
8227
|
const precondition = await validateBaseVersions(target, branches);
|
|
8226
|
-
if (
|
|
8227
|
-
return
|
|
8228
|
+
if (chunkRJMHU2MG_cjs.isErr(precondition)) {
|
|
8229
|
+
return chunkRJMHU2MG_cjs.err(precondition.error);
|
|
8228
8230
|
}
|
|
8229
8231
|
return resolveMerge(
|
|
8230
8232
|
store,
|
|
@@ -8241,7 +8243,7 @@ async function validateForkPointVersions(forkPoint, branches) {
|
|
|
8241
8243
|
const forkVersion = await computeBaseVersion(forkPoint);
|
|
8242
8244
|
for (const branch2 of branches) {
|
|
8243
8245
|
if (branch2.base !== forkVersion) {
|
|
8244
|
-
return
|
|
8246
|
+
return chunkRJMHU2MG_cjs.err(
|
|
8245
8247
|
new BaseVersionMismatchError(
|
|
8246
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.`,
|
|
8247
8249
|
{
|
|
@@ -8255,7 +8257,7 @@ async function validateForkPointVersions(forkPoint, branches) {
|
|
|
8255
8257
|
);
|
|
8256
8258
|
}
|
|
8257
8259
|
}
|
|
8258
|
-
return
|
|
8260
|
+
return chunkRJMHU2MG_cjs.ok(forkVersion);
|
|
8259
8261
|
}
|
|
8260
8262
|
function nodeSchemaFor(target, kind) {
|
|
8261
8263
|
const registry = target.graph.nodes;
|
|
@@ -8410,7 +8412,7 @@ async function validateIncrementalEdgeWrites(target, edgesApi, plan) {
|
|
|
8410
8412
|
}
|
|
8411
8413
|
}
|
|
8412
8414
|
}
|
|
8413
|
-
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));
|
|
8414
8416
|
if (notFound.length > 0) {
|
|
8415
8417
|
const crossKindById = /* @__PURE__ */ new Map();
|
|
8416
8418
|
for (const kind of Object.keys(target.graph.edges)) {
|
|
@@ -8647,7 +8649,7 @@ async function assertForkPointUnchanged(precondition) {
|
|
|
8647
8649
|
);
|
|
8648
8650
|
}
|
|
8649
8651
|
async function commitIncrementalPlan(target, plan, guard) {
|
|
8650
|
-
if (!
|
|
8652
|
+
if (!chunkTUVD4DFR_cjs.storeBackend(target).capabilities.transactions) {
|
|
8651
8653
|
throw new MergeError(
|
|
8652
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.",
|
|
8653
8655
|
{ details: { capability: "transactions" } }
|
|
@@ -8657,7 +8659,7 @@ async function commitIncrementalPlan(target, plan, guard) {
|
|
|
8657
8659
|
() => withTxConflictRetry(
|
|
8658
8660
|
() => target.transaction(async (tx) => {
|
|
8659
8661
|
if (target.revisionTrackingEnabled) {
|
|
8660
|
-
await
|
|
8662
|
+
await chunkRDP6ZRSM_cjs.lockRecordedGraphWrite(chunkTUVD4DFR_cjs.transactionBackend(tx), target.graphId);
|
|
8661
8663
|
}
|
|
8662
8664
|
await assertForkPointUnchanged(guard.forkPoint);
|
|
8663
8665
|
const nodesApi = tx.nodes;
|
|
@@ -8668,12 +8670,12 @@ async function commitIncrementalPlan(target, plan, guard) {
|
|
|
8668
8670
|
);
|
|
8669
8671
|
await assertPlannedIdentityIdsFresh(
|
|
8670
8672
|
target,
|
|
8671
|
-
|
|
8673
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx),
|
|
8672
8674
|
plan
|
|
8673
8675
|
);
|
|
8674
8676
|
await assertIdentityPeersStable(
|
|
8675
8677
|
target,
|
|
8676
|
-
|
|
8678
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx),
|
|
8677
8679
|
guard.identityPeerProbe,
|
|
8678
8680
|
plan
|
|
8679
8681
|
);
|
|
@@ -8685,7 +8687,7 @@ async function commitIncrementalPlan(target, plan, guard) {
|
|
|
8685
8687
|
nodesApi,
|
|
8686
8688
|
edgesApi,
|
|
8687
8689
|
target,
|
|
8688
|
-
|
|
8690
|
+
chunkTUVD4DFR_cjs.transactionBackend(tx)
|
|
8689
8691
|
);
|
|
8690
8692
|
}, mergeCommitTransactionOptions(target))
|
|
8691
8693
|
)
|
|
@@ -8695,16 +8697,16 @@ async function mergeIncremental(args) {
|
|
|
8695
8697
|
const { forkPoint, target } = args;
|
|
8696
8698
|
const branches = unwrapMergeBranches(args.branches);
|
|
8697
8699
|
const normalized = tryNormalize(args.options ?? {}, ["target"]);
|
|
8698
|
-
if (
|
|
8699
|
-
return
|
|
8700
|
+
if (chunkRJMHU2MG_cjs.isErr(normalized)) {
|
|
8701
|
+
return chunkRJMHU2MG_cjs.err(normalized.error);
|
|
8700
8702
|
}
|
|
8701
8703
|
const options = normalized.data;
|
|
8702
8704
|
if (options.onBasePropertyConflict !== "flag") {
|
|
8703
|
-
return
|
|
8705
|
+
return chunkRJMHU2MG_cjs.err(incrementalBaseConflictPolicyError(options));
|
|
8704
8706
|
}
|
|
8705
8707
|
const forkPrecondition = await validateForkPointVersions(forkPoint, branches);
|
|
8706
|
-
if (
|
|
8707
|
-
return
|
|
8708
|
+
if (chunkRJMHU2MG_cjs.isErr(forkPrecondition)) {
|
|
8709
|
+
return chunkRJMHU2MG_cjs.err(forkPrecondition.error);
|
|
8708
8710
|
}
|
|
8709
8711
|
const forkVersion = forkPrecondition.data;
|
|
8710
8712
|
const [forkSchema, targetSchema] = await Promise.all([
|
|
@@ -8712,7 +8714,7 @@ async function mergeIncremental(args) {
|
|
|
8712
8714
|
computeSchemaComponent(target)
|
|
8713
8715
|
]);
|
|
8714
8716
|
if (forkSchema !== targetSchema) {
|
|
8715
|
-
return
|
|
8717
|
+
return chunkRJMHU2MG_cjs.err(incrementalSchemaError());
|
|
8716
8718
|
}
|
|
8717
8719
|
const targetBranch = {
|
|
8718
8720
|
id: COMMITTED_TARGET_BRANCH,
|
|
@@ -8739,15 +8741,15 @@ async function mergeIncremental(args) {
|
|
|
8739
8741
|
|
|
8740
8742
|
Object.defineProperty(exports, "isErr", {
|
|
8741
8743
|
enumerable: true,
|
|
8742
|
-
get: function () { return
|
|
8744
|
+
get: function () { return chunkRJMHU2MG_cjs.isErr; }
|
|
8743
8745
|
});
|
|
8744
8746
|
Object.defineProperty(exports, "isOk", {
|
|
8745
8747
|
enumerable: true,
|
|
8746
|
-
get: function () { return
|
|
8748
|
+
get: function () { return chunkRJMHU2MG_cjs.isOk; }
|
|
8747
8749
|
});
|
|
8748
8750
|
Object.defineProperty(exports, "unwrap", {
|
|
8749
8751
|
enumerable: true,
|
|
8750
|
-
get: function () { return
|
|
8752
|
+
get: function () { return chunkRJMHU2MG_cjs.unwrap; }
|
|
8751
8753
|
});
|
|
8752
8754
|
exports.BaseVersionMismatchError = BaseVersionMismatchError;
|
|
8753
8755
|
exports.BranchError = BranchError;
|