@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,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
3
|
+
var chunkTUVD4DFR_cjs = require('./chunk-TUVD4DFR.cjs');
|
|
4
|
+
var chunk7PRMDZIA_cjs = require('./chunk-7PRMDZIA.cjs');
|
|
5
|
+
var chunk5OWHU7Z7_cjs = require('./chunk-5OWHU7Z7.cjs');
|
|
6
|
+
var chunkRDP6ZRSM_cjs = require('./chunk-RDP6ZRSM.cjs');
|
|
7
|
+
var chunkZBFZGLZE_cjs = require('./chunk-ZBFZGLZE.cjs');
|
|
8
|
+
var chunkIHK5KA2Q_cjs = require('./chunk-IHK5KA2Q.cjs');
|
|
9
|
+
var chunkGHZPZNFC_cjs = require('./chunk-GHZPZNFC.cjs');
|
|
10
|
+
var chunkLLVOQOWE_cjs = require('./chunk-LLVOQOWE.cjs');
|
|
11
|
+
var chunkM5MSP3BI_cjs = require('./chunk-M5MSP3BI.cjs');
|
|
12
|
+
var chunkTEC24ZDA_cjs = require('./chunk-TEC24ZDA.cjs');
|
|
13
|
+
var chunkOJHD3LXJ_cjs = require('./chunk-OJHD3LXJ.cjs');
|
|
14
14
|
var chunkHAHNRASW_cjs = require('./chunk-HAHNRASW.cjs');
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var chunkVLBTRXA2_cjs = require('./chunk-VLBTRXA2.cjs');
|
|
16
|
+
var chunkX4GDXBOP_cjs = require('./chunk-X4GDXBOP.cjs');
|
|
17
17
|
var chunkA7J2YDDI_cjs = require('./chunk-A7J2YDDI.cjs');
|
|
18
18
|
var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
|
|
19
19
|
|
|
@@ -22,8 +22,8 @@ function nullToUndefined(value) {
|
|
|
22
22
|
return value === null ? void 0 : value;
|
|
23
23
|
}
|
|
24
24
|
function rowToNode(row) {
|
|
25
|
-
const rawProps =
|
|
26
|
-
const props =
|
|
25
|
+
const rawProps = chunkGHZPZNFC_cjs.rowPropsToObject(row.props);
|
|
26
|
+
const props = chunkVLBTRXA2_cjs.filterReservedKeys(rawProps, chunkVLBTRXA2_cjs.RESERVED_NODE_KEYS);
|
|
27
27
|
return {
|
|
28
28
|
kind: row.kind,
|
|
29
29
|
id: row.id,
|
|
@@ -42,8 +42,8 @@ function rowToNodeMeta(row) {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
function rowToEdge(row) {
|
|
45
|
-
const rawProps =
|
|
46
|
-
const props =
|
|
45
|
+
const rawProps = chunkGHZPZNFC_cjs.rowPropsToObject(row.props);
|
|
46
|
+
const props = chunkVLBTRXA2_cjs.filterReservedKeys(rawProps, chunkVLBTRXA2_cjs.RESERVED_EDGE_KEYS);
|
|
47
47
|
return {
|
|
48
48
|
id: row.id,
|
|
49
49
|
kind: row.kind,
|
|
@@ -70,96 +70,476 @@ function edgeWriteNeedsConstraintFence(cardinality) {
|
|
|
70
70
|
return cardinality === "many" ? void 0 : "edgeCardinality";
|
|
71
71
|
}
|
|
72
72
|
function nodeWriteNeedsConstraintFence(registry, kind, uniqueConstraints, operation) {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
return chunkTUVD4DFR_cjs.nodeClaimSites(registry, kind, uniqueConstraints, operation).find(
|
|
74
|
+
(site) => site.needsLockFence
|
|
75
|
+
)?.refusalReason;
|
|
76
|
+
}
|
|
77
|
+
function graphOwesClaims(graph, registry) {
|
|
78
|
+
for (const [kind, registration] of Object.entries(graph.nodes)) {
|
|
79
|
+
for (const operation of ["create", "update"]) {
|
|
80
|
+
const gating = chunkTUVD4DFR_cjs.nodeClaimSites(
|
|
81
|
+
registry,
|
|
82
|
+
kind,
|
|
83
|
+
registration.unique ?? [],
|
|
84
|
+
operation
|
|
85
|
+
).find((site) => site.placement === "pre-insert");
|
|
86
|
+
if (gating !== void 0) return gating.refusalReason;
|
|
87
|
+
}
|
|
75
88
|
}
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
89
|
+
for (const registration of Object.values(graph.edges)) {
|
|
90
|
+
const reason = edgeWriteNeedsConstraintFence(
|
|
91
|
+
registration.cardinality ?? "many"
|
|
92
|
+
);
|
|
93
|
+
if (reason !== void 0) return reason;
|
|
94
|
+
}
|
|
95
|
+
return void 0;
|
|
80
96
|
}
|
|
81
97
|
async function checkDisjointnessConstraint(ctx, kind, id) {
|
|
82
98
|
const disjointKinds = ctx.registry.getDisjointKinds(kind);
|
|
83
99
|
for (const disjointKind of disjointKinds) {
|
|
84
100
|
const existing = await ctx.backend.getNode(ctx.graphId, disjointKind, id);
|
|
85
101
|
if (existing && !existing.deleted_at) {
|
|
86
|
-
const error =
|
|
102
|
+
const error = chunkLLVOQOWE_cjs.checkDisjointness(id, kind, [disjointKind], ctx.registry);
|
|
87
103
|
if (error) throw error;
|
|
88
104
|
}
|
|
89
105
|
}
|
|
90
106
|
}
|
|
91
107
|
async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind, fromId, toKind, toId, validTo) {
|
|
92
|
-
|
|
93
|
-
|
|
108
|
+
if (cardinality === "many") return;
|
|
109
|
+
const spec = chunk7PRMDZIA_cjs.EDGE_CARDINALITY_SPECS[cardinality];
|
|
110
|
+
if (!spec.claimsWhenBornEnded && validTo !== void 0) return;
|
|
111
|
+
if (spec.keyShape === "fromAndTo") {
|
|
112
|
+
const exists = await ctx.backend.edgeExistsBetween({
|
|
113
|
+
graphId: ctx.graphId,
|
|
114
|
+
edgeKind,
|
|
115
|
+
fromKind,
|
|
116
|
+
fromId,
|
|
117
|
+
toKind,
|
|
118
|
+
toId
|
|
119
|
+
});
|
|
120
|
+
const error2 = chunkLLVOQOWE_cjs.checkUniqueEdge(
|
|
121
|
+
edgeKind,
|
|
122
|
+
fromKind,
|
|
123
|
+
fromId,
|
|
124
|
+
toKind,
|
|
125
|
+
toId,
|
|
126
|
+
exists ? 1 : 0
|
|
127
|
+
);
|
|
128
|
+
if (error2) throw error2;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const count = await ctx.backend.countEdgesFrom({
|
|
132
|
+
graphId: ctx.graphId,
|
|
133
|
+
edgeKind,
|
|
134
|
+
fromKind,
|
|
135
|
+
fromId,
|
|
136
|
+
activeOnly: spec.holderLiveness === "liveAndActive"
|
|
137
|
+
});
|
|
138
|
+
const error = chunkLLVOQOWE_cjs.checkCardinality(
|
|
139
|
+
edgeKind,
|
|
140
|
+
fromKind,
|
|
141
|
+
fromId,
|
|
142
|
+
cardinality,
|
|
143
|
+
count,
|
|
144
|
+
count > 0
|
|
145
|
+
);
|
|
146
|
+
if (error) throw error;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// src/store/operations/edge-batch-validation.ts
|
|
150
|
+
function buildEdgeEndpointCacheKey(graphId, kind, id) {
|
|
151
|
+
return chunkLLVOQOWE_cjs.encodeTupleKey([graphId, kind, id]);
|
|
152
|
+
}
|
|
153
|
+
function buildEdgeFromCacheKey(graphId, edgeKind, fromKind, fromId) {
|
|
154
|
+
return chunkLLVOQOWE_cjs.encodeTupleKey([graphId, edgeKind, fromKind, fromId]);
|
|
155
|
+
}
|
|
156
|
+
function buildEdgeBetweenCacheKey(graphId, edgeKind, fromKind, fromId, toKind, toId) {
|
|
157
|
+
return chunkLLVOQOWE_cjs.encodeTupleKey([graphId, edgeKind, fromKind, fromId, toKind, toId]);
|
|
158
|
+
}
|
|
159
|
+
function buildCountEdgesFromCacheKey(params) {
|
|
160
|
+
const activeOnly = params.activeOnly === true ? "1" : "0";
|
|
161
|
+
return chunkLLVOQOWE_cjs.encodeTupleKey([
|
|
162
|
+
params.graphId,
|
|
163
|
+
params.edgeKind,
|
|
164
|
+
params.fromKind,
|
|
165
|
+
params.fromId,
|
|
166
|
+
activeOnly
|
|
167
|
+
]);
|
|
168
|
+
}
|
|
169
|
+
function incrementPendingCount(counts, key) {
|
|
170
|
+
const previous = counts.get(key) ?? 0;
|
|
171
|
+
counts.set(key, previous + 1);
|
|
172
|
+
}
|
|
173
|
+
function createEdgeBatchValidationBackend(backend) {
|
|
174
|
+
const endpointCache = /* @__PURE__ */ new Map();
|
|
175
|
+
const countEdgesFromCache = /* @__PURE__ */ new Map();
|
|
176
|
+
const edgeExistsCache = /* @__PURE__ */ new Map();
|
|
177
|
+
const pendingOneCounts = /* @__PURE__ */ new Map();
|
|
178
|
+
const pendingOneActiveCounts = /* @__PURE__ */ new Map();
|
|
179
|
+
const pendingUniquePairs = /* @__PURE__ */ new Set();
|
|
180
|
+
async function getNodeCached(graphId, kind, id) {
|
|
181
|
+
const cacheKey = buildEdgeEndpointCacheKey(graphId, kind, id);
|
|
182
|
+
if (endpointCache.has(cacheKey)) {
|
|
183
|
+
return endpointCache.get(cacheKey);
|
|
184
|
+
}
|
|
185
|
+
const node = await backend.getNode(graphId, kind, id);
|
|
186
|
+
endpointCache.set(cacheKey, node);
|
|
187
|
+
return node;
|
|
188
|
+
}
|
|
189
|
+
function seedEndpointRow(graphId, kind, id, row) {
|
|
190
|
+
const cacheKey = buildEdgeEndpointCacheKey(graphId, kind, id);
|
|
191
|
+
if (endpointCache.has(cacheKey)) return;
|
|
192
|
+
endpointCache.set(cacheKey, row);
|
|
193
|
+
}
|
|
194
|
+
async function countEdgesFromCached(params) {
|
|
195
|
+
const cacheKey = buildCountEdgesFromCacheKey(params);
|
|
196
|
+
let baseCount = countEdgesFromCache.get(cacheKey);
|
|
197
|
+
if (baseCount === void 0) {
|
|
198
|
+
baseCount = await backend.countEdgesFrom(params);
|
|
199
|
+
countEdgesFromCache.set(cacheKey, baseCount);
|
|
200
|
+
}
|
|
201
|
+
const pendingKey = buildEdgeFromCacheKey(
|
|
202
|
+
params.graphId,
|
|
203
|
+
params.edgeKind,
|
|
204
|
+
params.fromKind,
|
|
205
|
+
params.fromId
|
|
206
|
+
);
|
|
207
|
+
const pendingCount = params.activeOnly === true ? pendingOneActiveCounts.get(pendingKey) ?? 0 : pendingOneCounts.get(pendingKey) ?? 0;
|
|
208
|
+
return baseCount + pendingCount;
|
|
209
|
+
}
|
|
210
|
+
async function edgeExistsBetweenCached(params) {
|
|
211
|
+
const cacheKey = buildEdgeBetweenCacheKey(
|
|
212
|
+
params.graphId,
|
|
213
|
+
params.edgeKind,
|
|
214
|
+
params.fromKind,
|
|
215
|
+
params.fromId,
|
|
216
|
+
params.toKind,
|
|
217
|
+
params.toId
|
|
218
|
+
);
|
|
219
|
+
if (pendingUniquePairs.has(cacheKey)) {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
if (edgeExistsCache.has(cacheKey)) {
|
|
223
|
+
return edgeExistsCache.get(cacheKey) ?? false;
|
|
224
|
+
}
|
|
225
|
+
const exists = await backend.edgeExistsBetween(params);
|
|
226
|
+
edgeExistsCache.set(cacheKey, exists);
|
|
227
|
+
return exists;
|
|
228
|
+
}
|
|
229
|
+
function registerPendingEdgeForCardinality(insertParams, cardinality) {
|
|
230
|
+
const fromCacheKey = buildEdgeFromCacheKey(
|
|
231
|
+
insertParams.graphId,
|
|
232
|
+
insertParams.kind,
|
|
233
|
+
insertParams.fromKind,
|
|
234
|
+
insertParams.fromId
|
|
235
|
+
);
|
|
236
|
+
if (cardinality === "one") {
|
|
237
|
+
incrementPendingCount(pendingOneCounts, fromCacheKey);
|
|
94
238
|
return;
|
|
95
239
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
fromKind,
|
|
101
|
-
fromId
|
|
102
|
-
});
|
|
103
|
-
const error = chunkFQPEMEWX_cjs.checkCardinality(
|
|
104
|
-
edgeKind,
|
|
105
|
-
fromKind,
|
|
106
|
-
fromId,
|
|
107
|
-
"one",
|
|
108
|
-
count,
|
|
109
|
-
false
|
|
110
|
-
);
|
|
111
|
-
if (error) throw error;
|
|
240
|
+
if (cardinality === "oneActive") {
|
|
241
|
+
if (insertParams.validTo === void 0) {
|
|
242
|
+
incrementPendingCount(pendingOneActiveCounts, fromCacheKey);
|
|
243
|
+
}
|
|
112
244
|
return;
|
|
113
245
|
}
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
fromKind,
|
|
119
|
-
fromId,
|
|
120
|
-
toKind,
|
|
121
|
-
toId
|
|
122
|
-
});
|
|
123
|
-
const error = chunkFQPEMEWX_cjs.checkUniqueEdge(
|
|
124
|
-
edgeKind,
|
|
125
|
-
fromKind,
|
|
126
|
-
fromId,
|
|
127
|
-
toKind,
|
|
128
|
-
toId,
|
|
129
|
-
exists ? 1 : 0
|
|
246
|
+
if (cardinality === "unique") {
|
|
247
|
+
const uniqueCacheKey = buildEdgeBetweenCacheKey(
|
|
248
|
+
insertParams.graphId,
|
|
249
|
+
insertParams.kind,
|
|
250
|
+
insertParams.fromKind,
|
|
251
|
+
insertParams.fromId,
|
|
252
|
+
insertParams.toKind,
|
|
253
|
+
insertParams.toId
|
|
130
254
|
);
|
|
131
|
-
|
|
132
|
-
return;
|
|
255
|
+
pendingUniquePairs.add(uniqueCacheKey);
|
|
133
256
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
257
|
+
}
|
|
258
|
+
const validationBackend = chunkZBFZGLZE_cjs.deriveBackend(backend, {
|
|
259
|
+
getNode: getNodeCached,
|
|
260
|
+
countEdgesFrom: countEdgesFromCached,
|
|
261
|
+
edgeExistsBetween: edgeExistsBetweenCached
|
|
262
|
+
});
|
|
263
|
+
return {
|
|
264
|
+
backend: validationBackend,
|
|
265
|
+
registerPendingEdgeForCardinality,
|
|
266
|
+
seedEndpointRow
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// src/store/operations/edge-write-pipeline.ts
|
|
271
|
+
function createEdgeWriteContext(graphId, lock) {
|
|
272
|
+
return { graphId, lock };
|
|
273
|
+
}
|
|
274
|
+
async function applyEdgeUpdate(ctx, args, backend) {
|
|
275
|
+
const { claim, ...rowWork } = args;
|
|
276
|
+
if (claim !== void 0) await chunk7PRMDZIA_cjs.claimEdgeCardinality(backend, claim);
|
|
277
|
+
const updateParams = { graphId: ctx.graphId, ...rowWork };
|
|
278
|
+
return backend.updateEdge(updateParams);
|
|
279
|
+
}
|
|
280
|
+
function applyEdgeSoftDelete(ctx, work, backend) {
|
|
281
|
+
return backend.deleteEdge({
|
|
282
|
+
graphId: ctx.graphId,
|
|
283
|
+
id: work.id,
|
|
284
|
+
kind: work.kind
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
async function applyEdgeHardDelete(ctx, work, backend) {
|
|
288
|
+
await backend.hardDeleteEdge({
|
|
289
|
+
graphId: ctx.graphId,
|
|
290
|
+
id: work.id,
|
|
291
|
+
kind: work.kind
|
|
292
|
+
});
|
|
293
|
+
if (work.holdsCardinalityClaim) {
|
|
294
|
+
await chunk7PRMDZIA_cjs.purgeEdgeClaims(backend, ctx.graphId, [work.id]);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// src/store/operations/write-fences.ts
|
|
299
|
+
function createWriteParamsDraft() {
|
|
300
|
+
return {};
|
|
301
|
+
}
|
|
302
|
+
function assertsStoredWindowState(fences) {
|
|
303
|
+
return chunkM5MSP3BI_cjs.assertsStoredLowerBound(fences.validityLowerBound) || chunkM5MSP3BI_cjs.assertsStoredUpperBound(fences.validityUpperBound);
|
|
304
|
+
}
|
|
305
|
+
var UnsupportedWriteFenceError = class extends Error {
|
|
306
|
+
fence;
|
|
307
|
+
kind;
|
|
308
|
+
constructor(fence, kind) {
|
|
309
|
+
super(
|
|
310
|
+
`The ${kind} statement cannot carry the "${fence}" fence, so the write is refused rather than run unfenced. Assert nothing ({}) or use a write shape whose statement carries it.`
|
|
311
|
+
);
|
|
312
|
+
this.name = "UnsupportedWriteFenceError";
|
|
313
|
+
this.fence = fence;
|
|
314
|
+
this.kind = kind;
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
function applyValidityLowerBound(fence, draft) {
|
|
318
|
+
if (!chunkM5MSP3BI_cjs.assertsStoredLowerBound(fence)) return;
|
|
319
|
+
draft.expectedValidFrom = fence.expectedValidFrom;
|
|
320
|
+
}
|
|
321
|
+
var NODE_UPDATE_FENCE_APPLIERS = {
|
|
322
|
+
validityLowerBound: applyValidityLowerBound
|
|
323
|
+
};
|
|
324
|
+
var NODE_SET_UPDATE_FENCE_APPLIERS = {
|
|
325
|
+
validityLowerBound: (fence) => {
|
|
326
|
+
if (!chunkM5MSP3BI_cjs.assertsStoredLowerBound(fence)) return;
|
|
327
|
+
throw new UnsupportedWriteFenceError("validityLowerBound", "nodeSetUpdate");
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
function applyEdgeIdentity(fence, draft) {
|
|
331
|
+
draft.kind = fence.kind;
|
|
332
|
+
if (fence.fromKind !== void 0) draft.fromKind = fence.fromKind;
|
|
333
|
+
if (fence.fromId !== void 0) draft.fromId = fence.fromId;
|
|
334
|
+
if (fence.toKind !== void 0) draft.toKind = fence.toKind;
|
|
335
|
+
if (fence.toId !== void 0) draft.toId = fence.toId;
|
|
336
|
+
}
|
|
337
|
+
function applyValidityUpperBound(fence, draft) {
|
|
338
|
+
if (!chunkM5MSP3BI_cjs.assertsStoredUpperBound(fence)) return;
|
|
339
|
+
draft.expectedValidTo = fence.expectedValidTo;
|
|
340
|
+
}
|
|
341
|
+
var EDGE_UPDATE_FENCE_APPLIERS = {
|
|
342
|
+
validityLowerBound: applyValidityLowerBound,
|
|
343
|
+
validityUpperBound: applyValidityUpperBound,
|
|
344
|
+
edgeIdentity: applyEdgeIdentity
|
|
345
|
+
};
|
|
346
|
+
function applyWriteFences(appliers, fences, draft) {
|
|
347
|
+
for (const key of Object.keys(appliers)) {
|
|
348
|
+
const applier = appliers[key];
|
|
349
|
+
applier(fences[key], draft);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// src/store/operations/write-session.ts
|
|
354
|
+
function unfencedTarget(target) {
|
|
355
|
+
return target;
|
|
356
|
+
}
|
|
357
|
+
function edgeBatchClaims(work) {
|
|
358
|
+
return work.flatMap((item) => item.claim === void 0 ? [] : [item.claim]);
|
|
359
|
+
}
|
|
360
|
+
function createWriteSession(ctx, target, lock) {
|
|
361
|
+
const writeContext = chunkTUVD4DFR_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock);
|
|
362
|
+
const dispatch = chunkRDP6ZRSM_cjs.nodeInsertDispatch(target);
|
|
363
|
+
const edgeContext = createEdgeWriteContext(ctx.graphId, lock);
|
|
364
|
+
const edgeDispatch = chunkRDP6ZRSM_cjs.edgeInsertDispatch(target);
|
|
365
|
+
return {
|
|
366
|
+
// The pinned coordination order, spelled once per insert shape:
|
|
367
|
+
// pre-insert claims, the row, post-insert claims, the sync fans. The claim
|
|
368
|
+
// seam owns the two groups and the compensation between them; this surface
|
|
369
|
+
// owns only "the row write it gates is THIS one".
|
|
370
|
+
createNode: async (work) => {
|
|
371
|
+
const row = await chunkTUVD4DFR_cjs.withNodeCreateClaims(
|
|
372
|
+
writeContext,
|
|
373
|
+
work.claim,
|
|
374
|
+
target,
|
|
375
|
+
() => dispatch.one(work.params)
|
|
376
|
+
);
|
|
377
|
+
await chunkTUVD4DFR_cjs.applyNodeInsertSyncFans(writeContext, work.sideEffects, target);
|
|
378
|
+
return row;
|
|
379
|
+
},
|
|
380
|
+
createNodeNoReturn: async (work) => {
|
|
381
|
+
await chunkTUVD4DFR_cjs.withNodeCreateClaims(
|
|
382
|
+
writeContext,
|
|
383
|
+
work.claim,
|
|
384
|
+
target,
|
|
385
|
+
() => chunkRDP6ZRSM_cjs.runInsertNoReturn(dispatch, work.params)
|
|
386
|
+
);
|
|
387
|
+
await chunkTUVD4DFR_cjs.applyNodeInsertSyncFans(writeContext, work.sideEffects, target);
|
|
388
|
+
},
|
|
389
|
+
createNodes: async (work) => {
|
|
390
|
+
const rows = await chunkTUVD4DFR_cjs.withNodeCreateClaimsBatch(
|
|
391
|
+
writeContext,
|
|
392
|
+
work.map((item) => item.claim),
|
|
393
|
+
target,
|
|
394
|
+
() => chunkRDP6ZRSM_cjs.runInsertBatchReturning(
|
|
395
|
+
dispatch,
|
|
396
|
+
work.map((item) => item.params)
|
|
397
|
+
)
|
|
398
|
+
);
|
|
399
|
+
await chunkTUVD4DFR_cjs.applyNodeInsertSyncFansBatch(
|
|
400
|
+
writeContext,
|
|
401
|
+
work.map((item) => item.sideEffects),
|
|
402
|
+
target
|
|
403
|
+
);
|
|
404
|
+
return rows;
|
|
405
|
+
},
|
|
406
|
+
createNodesNoReturn: async (work) => {
|
|
407
|
+
await chunkTUVD4DFR_cjs.withNodeCreateClaimsBatch(
|
|
408
|
+
writeContext,
|
|
409
|
+
work.map((item) => item.claim),
|
|
410
|
+
target,
|
|
411
|
+
() => chunkRDP6ZRSM_cjs.runInsertBatch(
|
|
412
|
+
dispatch,
|
|
413
|
+
work.map((item) => item.params)
|
|
414
|
+
)
|
|
415
|
+
);
|
|
416
|
+
await chunkTUVD4DFR_cjs.applyNodeInsertSyncFansBatch(
|
|
417
|
+
writeContext,
|
|
418
|
+
work.map((item) => item.sideEffects),
|
|
419
|
+
target
|
|
420
|
+
);
|
|
421
|
+
},
|
|
422
|
+
reviseNode: (work, fences) => {
|
|
423
|
+
const draft = createWriteParamsDraft();
|
|
424
|
+
applyWriteFences(NODE_UPDATE_FENCE_APPLIERS, fences, draft);
|
|
425
|
+
return chunkTUVD4DFR_cjs.applyNodeUpdate(writeContext, { ...work, ...draft }, target);
|
|
426
|
+
},
|
|
427
|
+
retireNode: (work, policy) => chunkTUVD4DFR_cjs.applyNodeSoftDelete(writeContext, work, target, policy),
|
|
428
|
+
purgeNode: (work) => chunkTUVD4DFR_cjs.applyNodeHardDelete(writeContext, work, target),
|
|
429
|
+
reviveNode: (work) => chunkTUVD4DFR_cjs.applyNodeResurrect(writeContext, work, target),
|
|
430
|
+
reviseNodeSet: (work, fences) => {
|
|
431
|
+
applyWriteFences(
|
|
432
|
+
NODE_SET_UPDATE_FENCE_APPLIERS,
|
|
433
|
+
fences,
|
|
434
|
+
createWriteParamsDraft()
|
|
435
|
+
);
|
|
436
|
+
return chunkTUVD4DFR_cjs.applyNodeSetUpdate(writeContext, work, target);
|
|
437
|
+
},
|
|
438
|
+
// An edge write obliges no DERIVED data, so these apply no sync fans — but a
|
|
439
|
+
// constrained kind owes its cardinality claim, at the same PRE-INSERT
|
|
440
|
+
// placement a node's scope-spanning claim takes and for the same reason: the
|
|
441
|
+
// probe that authorised the insert read a population no key fences. The
|
|
442
|
+
// batch issues ONE sorted statement (`claimEdgeCardinalityBatch` orders by
|
|
443
|
+
// `compareClaimTargets`), so a batch and a peer batch take their row locks
|
|
444
|
+
// in the same order.
|
|
445
|
+
createEdge: async (work) => {
|
|
446
|
+
if (work.claim !== void 0) {
|
|
447
|
+
await chunk7PRMDZIA_cjs.claimEdgeCardinality(target, work.claim);
|
|
137
448
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
count > 0
|
|
449
|
+
return edgeDispatch.one(work.params);
|
|
450
|
+
},
|
|
451
|
+
createEdgeNoReturn: async (work) => {
|
|
452
|
+
if (work.claim !== void 0) {
|
|
453
|
+
await chunk7PRMDZIA_cjs.claimEdgeCardinality(target, work.claim);
|
|
454
|
+
}
|
|
455
|
+
await chunkRDP6ZRSM_cjs.runInsertNoReturn(edgeDispatch, work.params);
|
|
456
|
+
},
|
|
457
|
+
createEdges: async (work) => {
|
|
458
|
+
await chunk7PRMDZIA_cjs.claimEdgeCardinalityBatch(target, edgeBatchClaims(work));
|
|
459
|
+
return chunkRDP6ZRSM_cjs.runInsertBatchReturning(
|
|
460
|
+
edgeDispatch,
|
|
461
|
+
work.map((item) => item.params)
|
|
152
462
|
);
|
|
153
|
-
|
|
154
|
-
|
|
463
|
+
},
|
|
464
|
+
createEdgesNoReturn: async (work) => {
|
|
465
|
+
await chunk7PRMDZIA_cjs.claimEdgeCardinalityBatch(target, edgeBatchClaims(work));
|
|
466
|
+
await chunkRDP6ZRSM_cjs.runInsertBatch(
|
|
467
|
+
edgeDispatch,
|
|
468
|
+
work.map((item) => item.params)
|
|
469
|
+
);
|
|
470
|
+
},
|
|
471
|
+
reviseEdge: (work, fences) => {
|
|
472
|
+
const draft = createWriteParamsDraft();
|
|
473
|
+
applyWriteFences(EDGE_UPDATE_FENCE_APPLIERS, fences, draft);
|
|
474
|
+
return applyEdgeUpdate(edgeContext, { ...work, ...draft }, target);
|
|
475
|
+
},
|
|
476
|
+
retireEdge: (work) => applyEdgeSoftDelete(edgeContext, work, target),
|
|
477
|
+
purgeEdge: (work) => applyEdgeHardDelete(edgeContext, work, target)
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// src/store/operations/write-executor.ts
|
|
482
|
+
function planFrame(ctx, plan, rowWork) {
|
|
483
|
+
return async (target, lock) => {
|
|
484
|
+
if (plan.requiresIdentityLock) {
|
|
485
|
+
const acquireIdentityLock = chunkN66HCGCY_cjs.requireDefined(
|
|
486
|
+
ctx.identityLock,
|
|
487
|
+
"write plan declares identity participation with no acquirer"
|
|
488
|
+
);
|
|
489
|
+
await acquireIdentityLock(target);
|
|
155
490
|
}
|
|
156
|
-
|
|
491
|
+
const mintSessionOver = (sessionTarget) => createWriteSession(ctx, sessionTarget, lock);
|
|
492
|
+
const mintOverlaidSession = (reads) => mintSessionOver(chunkZBFZGLZE_cjs.deriveBackend(target, reads));
|
|
493
|
+
return rowWork(
|
|
494
|
+
mintSessionOver(target),
|
|
495
|
+
target,
|
|
496
|
+
mintOverlaidSession
|
|
497
|
+
);
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
function planTransactionOptions(plan, options) {
|
|
501
|
+
return { ...options, fencesConstraintProbe: plan.constraintProbe };
|
|
502
|
+
}
|
|
503
|
+
function runWritePlan(ctx, plan, backend, rowWork, options) {
|
|
504
|
+
return chunkRDP6ZRSM_cjs.runInWriteTransaction(
|
|
505
|
+
ctx,
|
|
506
|
+
backend,
|
|
507
|
+
planFrame(ctx, plan, rowWork),
|
|
508
|
+
planTransactionOptions(plan, options)
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
function runHookedWritePlan(ctx, opContext, plan, backend, rowWork, options) {
|
|
512
|
+
return chunkRDP6ZRSM_cjs.runHookedWriteOperation(
|
|
513
|
+
ctx,
|
|
514
|
+
opContext,
|
|
515
|
+
backend,
|
|
516
|
+
planFrame(ctx, plan, rowWork),
|
|
517
|
+
planTransactionOptions(plan, options)
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// src/store/operations/write-plan.ts
|
|
522
|
+
function nodeWritePlan(constraintProbe, requiresIdentityLock) {
|
|
523
|
+
return { entity: "node", constraintProbe, requiresIdentityLock };
|
|
524
|
+
}
|
|
525
|
+
function nodeBatchWritePlan(constraintProbes, requiresIdentityLock) {
|
|
526
|
+
return {
|
|
527
|
+
entity: "node",
|
|
528
|
+
constraintProbe: constraintProbes.find((probe) => probe !== void 0),
|
|
529
|
+
requiresIdentityLock
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
function edgeWritePlan(constraintProbe) {
|
|
533
|
+
return { entity: "edge", constraintProbe, requiresIdentityLock: false };
|
|
534
|
+
}
|
|
535
|
+
function mixedWritePlan(constraintProbe, requiresIdentityLock) {
|
|
536
|
+
return { entity: "mixed", constraintProbe, requiresIdentityLock };
|
|
157
537
|
}
|
|
158
538
|
|
|
159
539
|
// src/store/validity-end.ts
|
|
160
540
|
function assertValidityEndMutation(input, context) {
|
|
161
541
|
if (input.validTo === void 0 || input.clearValidTo !== true) return;
|
|
162
|
-
throw new
|
|
542
|
+
throw new chunkX4GDXBOP_cjs.ValidationError(
|
|
163
543
|
'"validTo" and "clearValidTo" are mutually exclusive',
|
|
164
544
|
{
|
|
165
545
|
...context,
|
|
@@ -179,7 +559,7 @@ function validityEndAfterMutation(input, current) {
|
|
|
179
559
|
}
|
|
180
560
|
function assertClearValidToSupported(backend, entityType) {
|
|
181
561
|
if (backend.capabilities.clearValidTo === true) return;
|
|
182
|
-
throw new
|
|
562
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
183
563
|
`This backend does not support clearing ${entityType} validTo`,
|
|
184
564
|
{
|
|
185
565
|
code: "CLEAR_VALID_TO_UNSUPPORTED",
|
|
@@ -195,7 +575,7 @@ var ENTITY_LABELS = {
|
|
|
195
575
|
};
|
|
196
576
|
function alreadyExistsError(entity, kind, id, detail, cause) {
|
|
197
577
|
const label = ENTITY_LABELS[entity];
|
|
198
|
-
return new
|
|
578
|
+
return new chunkX4GDXBOP_cjs.ValidationError(
|
|
199
579
|
`${label.title} already exists: ${detail}`,
|
|
200
580
|
{
|
|
201
581
|
entityType: entity,
|
|
@@ -205,7 +585,7 @@ function alreadyExistsError(entity, kind, id, detail, cause) {
|
|
|
205
585
|
issues: [
|
|
206
586
|
{
|
|
207
587
|
path: "id",
|
|
208
|
-
code:
|
|
588
|
+
code: chunkX4GDXBOP_cjs.ENTITY_ALREADY_EXISTS_CODE,
|
|
209
589
|
message: `${label.article} with this ID already exists`
|
|
210
590
|
}
|
|
211
591
|
]
|
|
@@ -220,7 +600,7 @@ function createAlreadyExistsError(entity, kind, id) {
|
|
|
220
600
|
return alreadyExistsError(entity, kind, id, `${kind}/${id}`, void 0);
|
|
221
601
|
}
|
|
222
602
|
function isDuplicateKeyInsertError(error, entity) {
|
|
223
|
-
return error instanceof
|
|
603
|
+
return error instanceof chunkX4GDXBOP_cjs.DatabaseOperationError && error.details.operation === "insert" && error.details.entity === entity && error.details.reason === "duplicate_key";
|
|
224
604
|
}
|
|
225
605
|
function rethrowAsAlreadyExists(error, entity) {
|
|
226
606
|
if (!isDuplicateKeyInsertError(error, entity)) throw error;
|
|
@@ -254,9 +634,9 @@ async function withAlreadyExistsTranslation(entity, run) {
|
|
|
254
634
|
|
|
255
635
|
// src/store/operations/node-operations.ts
|
|
256
636
|
function getNodeRegistration(graph, kind) {
|
|
257
|
-
if (!chunkN66HCGCY_cjs.hasOwnKey(graph.nodes, kind)) throw new
|
|
637
|
+
if (!chunkN66HCGCY_cjs.hasOwnKey(graph.nodes, kind)) throw new chunkX4GDXBOP_cjs.KindNotFoundError(kind, "node");
|
|
258
638
|
const registration = graph.nodes[kind];
|
|
259
|
-
if (registration === void 0) throw new
|
|
639
|
+
if (registration === void 0) throw new chunkX4GDXBOP_cjs.KindNotFoundError(kind, "node");
|
|
260
640
|
return registration;
|
|
261
641
|
}
|
|
262
642
|
function nodeFencesConstraintProbe(ctx, kind, operation) {
|
|
@@ -268,18 +648,24 @@ function nodeFencesConstraintProbe(ctx, kind, operation) {
|
|
|
268
648
|
operation
|
|
269
649
|
);
|
|
270
650
|
}
|
|
271
|
-
function
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
651
|
+
function nodeBatchConstraintProbes(ctx, inputs, operation) {
|
|
652
|
+
return inputs.map(
|
|
653
|
+
(input) => nodeFencesConstraintProbe(ctx, input.kind, operation)
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
function nodeWritePlanContext(ctx) {
|
|
657
|
+
const identity = ctx.identity;
|
|
658
|
+
if (identity === void 0) return ctx;
|
|
659
|
+
return { ...ctx, identityLock: identity.lock };
|
|
660
|
+
}
|
|
661
|
+
function nodeRequiresIdentityLock(ctx) {
|
|
662
|
+
return ctx.identity !== void 0;
|
|
277
663
|
}
|
|
278
664
|
function buildNodeCacheKey(graphId, kind, id) {
|
|
279
|
-
return
|
|
665
|
+
return chunkLLVOQOWE_cjs.encodeTupleKey([graphId, kind, id]);
|
|
280
666
|
}
|
|
281
667
|
function buildUniqueCacheKey(graphId, nodeKind, constraintName, key) {
|
|
282
|
-
return
|
|
668
|
+
return chunkLLVOQOWE_cjs.encodeTupleKey([graphId, nodeKind, constraintName, key]);
|
|
283
669
|
}
|
|
284
670
|
function buildInsertNodeParams(graphId, kind, id, props, validFrom, validTo) {
|
|
285
671
|
const insertParams = {
|
|
@@ -292,14 +678,14 @@ function buildInsertNodeParams(graphId, kind, id, props, validFrom, validTo) {
|
|
|
292
678
|
if (validTo !== void 0) insertParams.validTo = validTo;
|
|
293
679
|
return insertParams;
|
|
294
680
|
}
|
|
295
|
-
function createPendingUniqueRow(graphId, nodeKind, constraintName, key,
|
|
681
|
+
function createPendingUniqueRow(graphId, nodeKind, constraintName, key, owner) {
|
|
296
682
|
return {
|
|
297
683
|
graph_id: graphId,
|
|
298
684
|
node_kind: nodeKind,
|
|
299
685
|
constraint_name: constraintName,
|
|
300
686
|
key,
|
|
301
|
-
node_id: nodeId,
|
|
302
|
-
concrete_kind:
|
|
687
|
+
node_id: owner.nodeId,
|
|
688
|
+
concrete_kind: owner.concreteKind,
|
|
303
689
|
deleted_at: void 0
|
|
304
690
|
};
|
|
305
691
|
}
|
|
@@ -310,11 +696,11 @@ function resolveConstraint(graph, kind, constraintName) {
|
|
|
310
696
|
(candidate) => candidate.name === constraintName
|
|
311
697
|
);
|
|
312
698
|
if (constraint === void 0) {
|
|
313
|
-
throw new
|
|
699
|
+
throw new chunkX4GDXBOP_cjs.NodeConstraintNotFoundError(constraintName, kind);
|
|
314
700
|
}
|
|
315
701
|
return constraint;
|
|
316
702
|
}
|
|
317
|
-
function
|
|
703
|
+
function createNodeBatchValidationSeams(graphId, registry, backend) {
|
|
318
704
|
const nodeCache = /* @__PURE__ */ new Map();
|
|
319
705
|
const pendingNodes = /* @__PURE__ */ new Map();
|
|
320
706
|
const uniqueCache = /* @__PURE__ */ new Map();
|
|
@@ -370,71 +756,72 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
370
756
|
});
|
|
371
757
|
}
|
|
372
758
|
function registerPendingUniqueEntries(kind, id, props, constraints) {
|
|
373
|
-
for (const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
759
|
+
for (const entry of chunkTUVD4DFR_cjs.nodeClaimEntries(
|
|
760
|
+
registry,
|
|
761
|
+
kind,
|
|
762
|
+
id,
|
|
763
|
+
props,
|
|
764
|
+
constraints,
|
|
765
|
+
"create"
|
|
766
|
+
)) {
|
|
767
|
+
pendingUniqueOwners.set(
|
|
768
|
+
buildUniqueCacheKey(
|
|
769
|
+
graphId,
|
|
770
|
+
entry.axis,
|
|
771
|
+
entry.constraintName,
|
|
772
|
+
entry.key
|
|
773
|
+
),
|
|
774
|
+
{ concreteKind: kind, nodeId: id }
|
|
385
775
|
);
|
|
386
|
-
pendingUniqueOwners.set(concreteEntryKey, id);
|
|
387
|
-
if (constraint.scope !== "kind") {
|
|
388
|
-
const kindsToCheck = chunkFQPEMEWX_cjs.getKindsForUniquenessCheck(
|
|
389
|
-
kind,
|
|
390
|
-
constraint.scope,
|
|
391
|
-
registry
|
|
392
|
-
);
|
|
393
|
-
for (const kindToCheck of kindsToCheck) {
|
|
394
|
-
const inheritedEntryKey = buildUniqueCacheKey(
|
|
395
|
-
graphId,
|
|
396
|
-
kindToCheck,
|
|
397
|
-
constraint.name,
|
|
398
|
-
key
|
|
399
|
-
);
|
|
400
|
-
pendingUniqueOwners.set(inheritedEntryKey, id);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
776
|
}
|
|
404
777
|
}
|
|
405
778
|
function registerAppliedNodeUpdate(kind, id, oldProps, newProps, constraints) {
|
|
779
|
+
const owner = { concreteKind: kind, nodeId: id };
|
|
780
|
+
const oldEntries = new Map(
|
|
781
|
+
chunkTUVD4DFR_cjs.nodeClaimEntries(registry, kind, id, oldProps, constraints, "update").map(
|
|
782
|
+
(entry) => [entry.constraintName, entry]
|
|
783
|
+
)
|
|
784
|
+
);
|
|
785
|
+
const newEntries = new Map(
|
|
786
|
+
chunkTUVD4DFR_cjs.nodeClaimEntries(registry, kind, id, newProps, constraints, "update").map(
|
|
787
|
+
(entry) => [entry.constraintName, entry]
|
|
788
|
+
)
|
|
789
|
+
);
|
|
406
790
|
for (const constraint of constraints) {
|
|
407
|
-
const
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
const
|
|
411
|
-
if (oldKey === newKey) continue;
|
|
412
|
-
const kindsToCheck = chunkFQPEMEWX_cjs.getKindsForUniquenessCheck(
|
|
791
|
+
const oldEntry = oldEntries.get(constraint.name);
|
|
792
|
+
const newEntry = newEntries.get(constraint.name);
|
|
793
|
+
if (oldEntry?.key === newEntry?.key) continue;
|
|
794
|
+
const kindsToCheck = chunkLLVOQOWE_cjs.uniquenessProbeKinds(
|
|
413
795
|
kind,
|
|
414
796
|
constraint.scope,
|
|
415
797
|
registry
|
|
416
798
|
);
|
|
417
|
-
if (
|
|
799
|
+
if (oldEntry !== void 0) {
|
|
418
800
|
for (const kindToCheck of kindsToCheck) {
|
|
419
801
|
const cacheKey = buildUniqueCacheKey(
|
|
420
802
|
graphId,
|
|
421
803
|
kindToCheck,
|
|
422
804
|
constraint.name,
|
|
423
|
-
|
|
805
|
+
oldEntry.key
|
|
424
806
|
);
|
|
425
807
|
pendingUniqueOwners.delete(cacheKey);
|
|
426
808
|
uniqueCache.set(cacheKey, void 0);
|
|
427
809
|
}
|
|
428
810
|
}
|
|
429
|
-
if (
|
|
811
|
+
if (newEntry !== void 0) {
|
|
430
812
|
for (const kindToCheck of kindsToCheck) {
|
|
431
813
|
const cacheKey = buildUniqueCacheKey(
|
|
432
814
|
graphId,
|
|
433
815
|
kindToCheck,
|
|
434
816
|
constraint.name,
|
|
435
|
-
|
|
817
|
+
newEntry.key
|
|
436
818
|
);
|
|
437
|
-
|
|
819
|
+
if (kindToCheck === newEntry.axis) {
|
|
820
|
+
pendingUniqueOwners.set(cacheKey, owner);
|
|
821
|
+
continue;
|
|
822
|
+
}
|
|
823
|
+
pendingUniqueOwners.delete(cacheKey);
|
|
824
|
+
uniqueCache.set(cacheKey, void 0);
|
|
438
825
|
}
|
|
439
826
|
}
|
|
440
827
|
}
|
|
@@ -449,12 +836,13 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
449
836
|
if (uniqueCache.has(cacheKey)) return;
|
|
450
837
|
uniqueCache.set(cacheKey, row);
|
|
451
838
|
}
|
|
452
|
-
const
|
|
839
|
+
const reads = {
|
|
453
840
|
getNode: getNodeCached,
|
|
454
841
|
checkUnique: checkUniqueCached
|
|
455
|
-
}
|
|
842
|
+
};
|
|
456
843
|
return {
|
|
457
|
-
|
|
844
|
+
reads,
|
|
845
|
+
reader: chunkZBFZGLZE_cjs.deriveBackend(backend, reads),
|
|
458
846
|
registerPendingNode,
|
|
459
847
|
registerPendingUniqueEntries,
|
|
460
848
|
registerAppliedNodeUpdate,
|
|
@@ -466,16 +854,16 @@ function draftNodeCreate(ctx, input, id, options) {
|
|
|
466
854
|
const kind = input.kind;
|
|
467
855
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
468
856
|
const nodeKind = registration.type;
|
|
469
|
-
const validatedProps = options?.propsPreValidated === true ? input.props :
|
|
857
|
+
const validatedProps = options?.propsPreValidated === true ? input.props : chunkRDP6ZRSM_cjs.validateNodeProps(nodeKind.schema, input.props, {
|
|
470
858
|
kind,
|
|
471
859
|
operation: "create"
|
|
472
860
|
});
|
|
473
|
-
const validFrom =
|
|
861
|
+
const validFrom = chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(
|
|
474
862
|
input.validFrom,
|
|
475
863
|
"validFrom"
|
|
476
864
|
);
|
|
477
|
-
const validTo =
|
|
478
|
-
|
|
865
|
+
const validTo = chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
866
|
+
chunkM5MSP3BI_cjs.assertOrderedValidityWindow(`${kind} "${id}"`, validFrom, validTo);
|
|
479
867
|
return {
|
|
480
868
|
kind,
|
|
481
869
|
id,
|
|
@@ -499,8 +887,8 @@ async function finishNodeCreatePreparation(ctx, draft, backend) {
|
|
|
499
887
|
backend
|
|
500
888
|
};
|
|
501
889
|
await checkDisjointnessConstraint(constraintContext, kind, id);
|
|
502
|
-
await
|
|
503
|
-
|
|
890
|
+
await chunkTUVD4DFR_cjs.checkUniquenessConstraints(
|
|
891
|
+
chunkTUVD4DFR_cjs.createUniquenessContext(ctx.graphId, ctx.registry, backend),
|
|
504
892
|
kind,
|
|
505
893
|
id,
|
|
506
894
|
validatedProps,
|
|
@@ -531,38 +919,36 @@ async function validateAndPrepareNodeCreate(ctx, input, id, backend, options) {
|
|
|
531
919
|
backend
|
|
532
920
|
);
|
|
533
921
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
922
|
+
function nodeCreateSideEffectItem(prepared) {
|
|
923
|
+
return {
|
|
924
|
+
kind: prepared.kind,
|
|
925
|
+
id: prepared.id,
|
|
926
|
+
schema: prepared.nodeKind.schema,
|
|
927
|
+
props: prepared.validatedProps,
|
|
928
|
+
uniqueConstraints: prepared.uniqueConstraints
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
function nodeCreateClaimItem(prepared) {
|
|
932
|
+
return {
|
|
933
|
+
kind: prepared.kind,
|
|
934
|
+
id: prepared.id,
|
|
935
|
+
props: prepared.validatedProps,
|
|
936
|
+
constraints: prepared.uniqueConstraints
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
function nodeInsertWork(prepared) {
|
|
940
|
+
return {
|
|
941
|
+
params: prepared.insertParams,
|
|
942
|
+
claim: nodeCreateClaimItem(prepared),
|
|
943
|
+
sideEffects: nodeCreateSideEffectItem(prepared)
|
|
944
|
+
};
|
|
546
945
|
}
|
|
547
946
|
function foldReferences(preparedCreates) {
|
|
548
947
|
return preparedCreates.filter((prepared) => prepared.idProvided).map((prepared) => ({ kind: prepared.kind, id: prepared.id }));
|
|
549
948
|
}
|
|
550
|
-
async function finalizeNodeCreate(ctx, prepared, backend, lock) {
|
|
551
|
-
await chunk3KOY4FH3_cjs.applyNodeInsertSideEffects(
|
|
552
|
-
chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
553
|
-
{
|
|
554
|
-
kind: prepared.kind,
|
|
555
|
-
id: prepared.id,
|
|
556
|
-
schema: prepared.nodeKind.schema,
|
|
557
|
-
props: prepared.validatedProps,
|
|
558
|
-
uniqueConstraints: prepared.uniqueConstraints
|
|
559
|
-
},
|
|
560
|
-
backend
|
|
561
|
-
);
|
|
562
|
-
}
|
|
563
949
|
function computeNodeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
564
950
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
565
|
-
const validatedProps =
|
|
951
|
+
const validatedProps = chunkRDP6ZRSM_cjs.validateNodeProps(
|
|
566
952
|
registration.type.schema,
|
|
567
953
|
{ ...existingProps, ...inputProps },
|
|
568
954
|
{ kind, operation: "update", id }
|
|
@@ -570,7 +956,7 @@ function computeNodeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
|
570
956
|
return { registration, validatedProps };
|
|
571
957
|
}
|
|
572
958
|
function resolveNodeUpdateProps(ctx, existing, inputProps) {
|
|
573
|
-
const existingProps =
|
|
959
|
+
const existingProps = chunkGHZPZNFC_cjs.rowPropsToObject(existing.props);
|
|
574
960
|
const { registration, validatedProps } = computeNodeUpdate(
|
|
575
961
|
ctx,
|
|
576
962
|
existing.kind,
|
|
@@ -590,30 +976,30 @@ function nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
|
|
|
590
976
|
);
|
|
591
977
|
return {
|
|
592
978
|
validatedProps,
|
|
593
|
-
unchanged:
|
|
979
|
+
unchanged: chunkZBFZGLZE_cjs.canonicalEqual(validatedProps, existingProps)
|
|
594
980
|
};
|
|
595
981
|
}
|
|
596
|
-
async function performNodeUpdate(ctx, input,
|
|
982
|
+
async function performNodeUpdate(ctx, input, session, target, options) {
|
|
597
983
|
const { kind, id } = input;
|
|
598
984
|
assertValidityEndMutation(input, { entityType: "node", kind, id });
|
|
599
|
-
const existing = await
|
|
600
|
-
if (!existing) throw new
|
|
985
|
+
const existing = await target.getNode(ctx.graphId, kind, id);
|
|
986
|
+
if (!existing) throw new chunkX4GDXBOP_cjs.NodeNotFoundError(kind, id);
|
|
601
987
|
const { registration, validatedProps } = resolveNodeUpdateProps(
|
|
602
988
|
ctx,
|
|
603
989
|
existing,
|
|
604
990
|
input.props
|
|
605
991
|
);
|
|
606
992
|
const nodeKind = registration.type;
|
|
607
|
-
const validTo =
|
|
608
|
-
const resurrectionInstant = options?.clearDeleted === true && existing.deleted_at !== void 0 ?
|
|
609
|
-
const preservesLiveLowerBound = resurrectionInstant === void 0 &&
|
|
610
|
-
const statedValidFrom =
|
|
993
|
+
const validTo = chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
994
|
+
const resurrectionInstant = options?.clearDeleted === true && existing.deleted_at !== void 0 ? chunkM5MSP3BI_cjs.nowIso() : void 0;
|
|
995
|
+
const preservesLiveLowerBound = resurrectionInstant === void 0 && chunkM5MSP3BI_cjs.preservesImmutableLowerBound(input.onImmutableLowerBound);
|
|
996
|
+
const statedValidFrom = chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(
|
|
611
997
|
input.validFrom,
|
|
612
998
|
"validFrom"
|
|
613
999
|
);
|
|
614
1000
|
const validFrom = preservesLiveLowerBound ? void 0 : statedValidFrom;
|
|
615
|
-
const resurrectionBound = resurrectionInstant === void 0 ? void 0 :
|
|
616
|
-
const windowVerdict =
|
|
1001
|
+
const resurrectionBound = resurrectionInstant === void 0 ? void 0 : chunkM5MSP3BI_cjs.resolveStampedValidityLowerBound(validFrom, validTo, resurrectionInstant);
|
|
1002
|
+
const windowVerdict = chunkM5MSP3BI_cjs.assertWritableValidityWindow(
|
|
617
1003
|
`${kind} "${id}"`,
|
|
618
1004
|
validFrom,
|
|
619
1005
|
resurrectionInstant === void 0 ? {
|
|
@@ -628,55 +1014,44 @@ async function performNodeUpdate(ctx, input, backend, lock, options) {
|
|
|
628
1014
|
},
|
|
629
1015
|
validTo
|
|
630
1016
|
);
|
|
631
|
-
const writeContext = chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock);
|
|
632
1017
|
const shared = {
|
|
633
1018
|
schema: nodeKind.schema,
|
|
634
1019
|
validatedProps,
|
|
635
1020
|
uniqueConstraints: registration.unique ?? [],
|
|
636
1021
|
...validTo !== void 0 && { validTo },
|
|
637
|
-
...input.clearValidTo === true && { clearValidTo: true }
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
// the verdict consult the effective bound, and WAS that bound the row's
|
|
642
|
-
// stored one — are answered where they are known. A plain
|
|
643
|
-
// `update({ props })` states no window, reads no bound, and stays unfenced:
|
|
644
|
-
// the same rule `UpdateEdgeParams`'s identity components follow, for the
|
|
645
|
-
// same reason. The resurrecting leg is judged against `resurrectionInstant`
|
|
646
|
-
// and so fences on `deleted_at IS NOT NULL` alone, converging through the
|
|
647
|
-
// recovery below.
|
|
648
|
-
...windowVerdict.storedLowerBoundFence
|
|
1022
|
+
...input.clearValidTo === true && { clearValidTo: true }
|
|
1023
|
+
};
|
|
1024
|
+
const fences = {
|
|
1025
|
+
validityLowerBound: windowVerdict.storedLowerBoundFence
|
|
649
1026
|
};
|
|
650
1027
|
if (options?.clearDeleted) {
|
|
651
1028
|
const resurrectionLowerBound = resurrectionInstant === void 0 ? validFrom !== void 0 && { validFrom } : { validFrom: resurrectionBound ?? null };
|
|
652
|
-
const row2 = await
|
|
653
|
-
writeContext,
|
|
1029
|
+
const row2 = await session.reviseNode(
|
|
654
1030
|
{ ...shared, existing, clearDeleted: true, ...resurrectionLowerBound },
|
|
655
|
-
|
|
1031
|
+
fences
|
|
656
1032
|
);
|
|
657
1033
|
return rowToNode(row2);
|
|
658
1034
|
}
|
|
659
|
-
if (!
|
|
660
|
-
const row = await
|
|
661
|
-
writeContext,
|
|
1035
|
+
if (!chunkGHZPZNFC_cjs.isLiveNodeRow(existing)) throw new chunkX4GDXBOP_cjs.NodeNotFoundError(kind, id);
|
|
1036
|
+
const row = await session.reviseNode(
|
|
662
1037
|
// An in-place update must not rewrite the stored bound, so it keeps the
|
|
663
1038
|
// conditional spread: `buildUpdateNode` ignores `validFrom` off the
|
|
664
1039
|
// resurrection leg, and stating one here would claim a rewrite that no
|
|
665
1040
|
// statement performs.
|
|
666
1041
|
{ ...shared, existing, ...validFrom !== void 0 && { validFrom } },
|
|
667
|
-
|
|
1042
|
+
fences
|
|
668
1043
|
);
|
|
669
1044
|
return rowToNode(row);
|
|
670
1045
|
}
|
|
671
1046
|
var NODE_UPDATE_ATTEMPTS = 2;
|
|
672
|
-
async function performNodeUpdateWithResurrectionRecovery(ctx, input,
|
|
1047
|
+
async function performNodeUpdateWithResurrectionRecovery(ctx, input, session, target, options) {
|
|
673
1048
|
for (let attempt = 1; attempt <= NODE_UPDATE_ATTEMPTS; attempt += 1) {
|
|
674
1049
|
try {
|
|
675
1050
|
return await performNodeUpdate(
|
|
676
1051
|
ctx,
|
|
677
1052
|
input,
|
|
1053
|
+
session,
|
|
678
1054
|
target,
|
|
679
|
-
lock,
|
|
680
1055
|
attempt === 1 ? options : void 0
|
|
681
1056
|
);
|
|
682
1057
|
} catch (error) {
|
|
@@ -685,15 +1060,15 @@ async function performNodeUpdateWithResurrectionRecovery(ctx, input, target, loc
|
|
|
685
1060
|
}
|
|
686
1061
|
const current = await target.getNode(ctx.graphId, input.kind, input.id);
|
|
687
1062
|
if (current === void 0 || current.deleted_at !== void 0) {
|
|
688
|
-
throw new
|
|
1063
|
+
throw new chunkX4GDXBOP_cjs.NodeNotFoundError(input.kind, input.id);
|
|
689
1064
|
}
|
|
690
1065
|
}
|
|
691
1066
|
}
|
|
692
|
-
throw new
|
|
1067
|
+
throw new chunkX4GDXBOP_cjs.NodeNotFoundError(input.kind, input.id);
|
|
693
1068
|
}
|
|
694
1069
|
function nodeUpdateRaceError(input, error) {
|
|
695
1070
|
if (!isNodeUpdateNoRowError(error)) return error;
|
|
696
|
-
return new
|
|
1071
|
+
return new chunkX4GDXBOP_cjs.DatabaseOperationError(
|
|
697
1072
|
`Node update for ${input.kind} "${input.id}" could not be applied to a stable row after ${NODE_UPDATE_ATTEMPTS} attempts: the row was removed and recreated between each read and its write. A concurrent writer is replacing this node faster than it can be read; serialize the writers, or retry.`,
|
|
698
1073
|
{
|
|
699
1074
|
operation: "update",
|
|
@@ -723,20 +1098,24 @@ async function primeBatchValidationCaches(ctx, drafts, backend, seams) {
|
|
|
723
1098
|
if (backend.checkUniqueBatch !== void 0) {
|
|
724
1099
|
const groups = /* @__PURE__ */ new Map();
|
|
725
1100
|
for (const draft of drafts) {
|
|
726
|
-
for (const
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
1101
|
+
for (const entry of chunkTUVD4DFR_cjs.nodeClaimEntries(
|
|
1102
|
+
ctx.registry,
|
|
1103
|
+
draft.kind,
|
|
1104
|
+
draft.id,
|
|
1105
|
+
draft.validatedProps,
|
|
1106
|
+
draft.uniqueConstraints,
|
|
1107
|
+
"create"
|
|
1108
|
+
)) {
|
|
1109
|
+
if (entry.refusal.kind !== "uniqueness") continue;
|
|
1110
|
+
const constraint = entry.refusal.constraint;
|
|
1111
|
+
const key = entry.key;
|
|
1112
|
+
const kindsToCheck = chunkLLVOQOWE_cjs.uniquenessProbeKinds(
|
|
734
1113
|
draft.kind,
|
|
735
1114
|
constraint.scope,
|
|
736
1115
|
ctx.registry
|
|
737
1116
|
);
|
|
738
1117
|
for (const kindToCheck of kindsToCheck) {
|
|
739
|
-
const groupKey =
|
|
1118
|
+
const groupKey = chunkLLVOQOWE_cjs.encodeTupleKey([kindToCheck, constraint.name]);
|
|
740
1119
|
const group = groups.get(groupKey) ?? {
|
|
741
1120
|
nodeKind: kindToCheck,
|
|
742
1121
|
constraintName: constraint.name,
|
|
@@ -769,14 +1148,14 @@ async function primeBatchValidationCaches(ctx, drafts, backend, seams) {
|
|
|
769
1148
|
}
|
|
770
1149
|
async function prepareBatchCreates(ctx, inputs, backend, options) {
|
|
771
1150
|
const {
|
|
772
|
-
|
|
1151
|
+
reader: validationBackend,
|
|
773
1152
|
registerPendingNode,
|
|
774
1153
|
registerPendingUniqueEntries,
|
|
775
1154
|
seedNodeRow,
|
|
776
1155
|
seedUniqueRow
|
|
777
|
-
} =
|
|
1156
|
+
} = createNodeBatchValidationSeams(ctx.graphId, ctx.registry, backend);
|
|
778
1157
|
const drafts = inputs.map(
|
|
779
|
-
(input) => draftNodeCreate(ctx, input, input.id ??
|
|
1158
|
+
(input) => draftNodeCreate(ctx, input, input.id ?? chunkRDP6ZRSM_cjs.generateId(), options)
|
|
780
1159
|
);
|
|
781
1160
|
await primeBatchValidationCaches(ctx, drafts, backend, {
|
|
782
1161
|
seedNodeRow,
|
|
@@ -813,12 +1192,12 @@ function partitionCreates(preparedCreates) {
|
|
|
813
1192
|
return { inserts, resurrections };
|
|
814
1193
|
}
|
|
815
1194
|
function isNodeUpdateNoRowError(error) {
|
|
816
|
-
return error instanceof
|
|
1195
|
+
return error instanceof chunkX4GDXBOP_cjs.DatabaseOperationError && error.details.operation === "update" && error.details.entity === "node" && error.details.reason === "no_row_returned";
|
|
817
1196
|
}
|
|
818
|
-
async function resurrectPreparedNode(ctx,
|
|
1197
|
+
async function resurrectPreparedNode(ctx, session, target, prepared) {
|
|
819
1198
|
const current = await target.getNode(ctx.graphId, prepared.kind, prepared.id);
|
|
820
1199
|
if (current === void 0) {
|
|
821
|
-
throw new
|
|
1200
|
+
throw new chunkX4GDXBOP_cjs.DatabaseOperationError(
|
|
822
1201
|
`Node tombstone disappeared before resurrection: ${prepared.kind} ${prepared.id}`,
|
|
823
1202
|
{ operation: "update", entity: "node" }
|
|
824
1203
|
);
|
|
@@ -826,15 +1205,14 @@ async function resurrectPreparedNode(ctx, target, lock, prepared) {
|
|
|
826
1205
|
if (current.deleted_at === void 0) {
|
|
827
1206
|
throw createAlreadyExistsError("node", prepared.kind, prepared.id);
|
|
828
1207
|
}
|
|
829
|
-
const resurrectionInstant =
|
|
830
|
-
const resurrectionBound =
|
|
1208
|
+
const resurrectionInstant = chunkM5MSP3BI_cjs.nowIso();
|
|
1209
|
+
const resurrectionBound = chunkM5MSP3BI_cjs.resolveStampedValidityLowerBound(
|
|
831
1210
|
prepared.insertParams.validFrom,
|
|
832
1211
|
prepared.insertParams.validTo,
|
|
833
1212
|
resurrectionInstant
|
|
834
1213
|
);
|
|
835
1214
|
try {
|
|
836
|
-
return await
|
|
837
|
-
chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
1215
|
+
return await session.reviseNode(
|
|
838
1216
|
{
|
|
839
1217
|
existing: current,
|
|
840
1218
|
clearDeleted: true,
|
|
@@ -847,7 +1225,11 @@ async function resurrectPreparedNode(ctx, target, lock, prepared) {
|
|
|
847
1225
|
validFrom: resurrectionBound ?? null,
|
|
848
1226
|
...prepared.insertParams.validTo === void 0 ? {} : { validTo: prepared.insertParams.validTo }
|
|
849
1227
|
},
|
|
850
|
-
|
|
1228
|
+
// This resurrection reads no stored bound: it rewrites the whole window
|
|
1229
|
+
// and is fenced by the UPDATE's own `deleted_at IS NOT NULL` predicate,
|
|
1230
|
+
// so it asserts nothing about `valid_from`. `{}` is how a write states
|
|
1231
|
+
// that, and it is the only way to state it.
|
|
1232
|
+
{ validityLowerBound: {} }
|
|
851
1233
|
);
|
|
852
1234
|
} catch (error) {
|
|
853
1235
|
if (!isNodeUpdateNoRowError(error)) throw error;
|
|
@@ -862,7 +1244,12 @@ async function resurrectPreparedNode(ctx, target, lock, prepared) {
|
|
|
862
1244
|
throw error;
|
|
863
1245
|
}
|
|
864
1246
|
}
|
|
1247
|
+
function prefersClaimRow(incumbent, candidate) {
|
|
1248
|
+
if (incumbent === void 0) return true;
|
|
1249
|
+
return incumbent.deleted_at !== void 0 && candidate.deleted_at === void 0;
|
|
1250
|
+
}
|
|
865
1251
|
async function findUniqueRowAcrossKinds(backend, graphId, constraintName, key, kindsToCheck, includeDeleted) {
|
|
1252
|
+
let preferred;
|
|
866
1253
|
for (const kindToCheck of kindsToCheck) {
|
|
867
1254
|
const row = await backend.checkUnique({
|
|
868
1255
|
graphId,
|
|
@@ -871,16 +1258,22 @@ async function findUniqueRowAcrossKinds(backend, graphId, constraintName, key, k
|
|
|
871
1258
|
key,
|
|
872
1259
|
includeDeleted
|
|
873
1260
|
});
|
|
874
|
-
if (row
|
|
1261
|
+
if (row === void 0) continue;
|
|
1262
|
+
if (!prefersClaimRow(preferred, row)) continue;
|
|
1263
|
+
preferred = row;
|
|
1264
|
+
if (row.deleted_at === void 0) return row;
|
|
875
1265
|
}
|
|
876
|
-
return
|
|
1266
|
+
return preferred;
|
|
877
1267
|
}
|
|
878
1268
|
async function batchCheckUniqueAcrossKinds(backend, graphId, constraintName, uniqueKeys, kindsToCheck, includeDeleted) {
|
|
879
1269
|
const existingByKey = /* @__PURE__ */ new Map();
|
|
880
1270
|
for (const kindToCheck of kindsToCheck) {
|
|
881
1271
|
if (backend.checkUniqueBatch === void 0) {
|
|
882
1272
|
for (const key of uniqueKeys) {
|
|
883
|
-
|
|
1273
|
+
const incumbent = existingByKey.get(key);
|
|
1274
|
+
if (incumbent !== void 0 && incumbent.deleted_at === void 0) {
|
|
1275
|
+
continue;
|
|
1276
|
+
}
|
|
884
1277
|
const row = await backend.checkUnique({
|
|
885
1278
|
graphId,
|
|
886
1279
|
nodeKind: kindToCheck,
|
|
@@ -888,7 +1281,7 @@ async function batchCheckUniqueAcrossKinds(backend, graphId, constraintName, uni
|
|
|
888
1281
|
key,
|
|
889
1282
|
includeDeleted
|
|
890
1283
|
});
|
|
891
|
-
if (row !== void 0) {
|
|
1284
|
+
if (row !== void 0 && prefersClaimRow(incumbent, row)) {
|
|
892
1285
|
existingByKey.set(row.key, row);
|
|
893
1286
|
}
|
|
894
1287
|
}
|
|
@@ -901,7 +1294,7 @@ async function batchCheckUniqueAcrossKinds(backend, graphId, constraintName, uni
|
|
|
901
1294
|
includeDeleted
|
|
902
1295
|
});
|
|
903
1296
|
for (const row of rows) {
|
|
904
|
-
if (
|
|
1297
|
+
if (prefersClaimRow(existingByKey.get(row.key), row)) {
|
|
905
1298
|
existingByKey.set(row.key, row);
|
|
906
1299
|
}
|
|
907
1300
|
}
|
|
@@ -911,16 +1304,19 @@ async function batchCheckUniqueAcrossKinds(backend, graphId, constraintName, uni
|
|
|
911
1304
|
}
|
|
912
1305
|
async function executeNodeCreateInternal(ctx, input, backend, options) {
|
|
913
1306
|
const kind = input.kind;
|
|
914
|
-
const id = input.id ??
|
|
1307
|
+
const id = input.id ?? chunkRDP6ZRSM_cjs.generateId();
|
|
915
1308
|
const opContext = ctx.createOperationContext("create", "node", kind, id);
|
|
916
1309
|
const shouldReturnRow = options?.returnRow ?? true;
|
|
917
|
-
return
|
|
918
|
-
ctx,
|
|
1310
|
+
return runHookedWritePlan(
|
|
1311
|
+
nodeWritePlanContext(ctx),
|
|
919
1312
|
opContext,
|
|
1313
|
+
nodeWritePlan(
|
|
1314
|
+
nodeFencesConstraintProbe(ctx, kind, "create"),
|
|
1315
|
+
nodeRequiresIdentityLock(ctx)
|
|
1316
|
+
),
|
|
920
1317
|
backend,
|
|
921
|
-
async (
|
|
1318
|
+
async (session, target) => {
|
|
922
1319
|
const identity = ctx.identity;
|
|
923
|
-
if (identity !== void 0) await identity.lock(target);
|
|
924
1320
|
const prepared = await validateAndPrepareNodeCreate(
|
|
925
1321
|
ctx,
|
|
926
1322
|
input,
|
|
@@ -932,8 +1328,8 @@ async function executeNodeCreateInternal(ctx, input, backend, options) {
|
|
|
932
1328
|
if (existing !== void 0) {
|
|
933
1329
|
const resurrected = await resurrectPreparedNode(
|
|
934
1330
|
ctx,
|
|
1331
|
+
session,
|
|
935
1332
|
target,
|
|
936
|
-
lock,
|
|
937
1333
|
prepared
|
|
938
1334
|
);
|
|
939
1335
|
if (identity !== void 0) {
|
|
@@ -942,22 +1338,16 @@ async function executeNodeCreateInternal(ctx, input, backend, options) {
|
|
|
942
1338
|
return shouldReturnRow ? rowToNode(resurrected) : void 0;
|
|
943
1339
|
}
|
|
944
1340
|
const row = await withAlreadyExistsTranslation("node", async () => {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
prepared.insertParams
|
|
949
|
-
);
|
|
1341
|
+
const work = nodeInsertWork(prepared);
|
|
1342
|
+
if (shouldReturnRow) return session.createNode(work);
|
|
1343
|
+
await session.createNodeNoReturn(work);
|
|
950
1344
|
return;
|
|
951
1345
|
});
|
|
952
|
-
await finalizeNodeCreate(ctx, prepared, target, lock);
|
|
953
1346
|
if (identity !== void 0) {
|
|
954
1347
|
await identity.foldCreated(target, foldReferences([prepared]));
|
|
955
1348
|
}
|
|
956
1349
|
if (row === void 0) return;
|
|
957
1350
|
return rowToNode(row);
|
|
958
|
-
},
|
|
959
|
-
{
|
|
960
|
-
fencesConstraintProbe: nodeFencesConstraintProbe(ctx, kind, "create")
|
|
961
1351
|
}
|
|
962
1352
|
);
|
|
963
1353
|
}
|
|
@@ -967,7 +1357,7 @@ async function executeNodeCreate(ctx, input, backend, options) {
|
|
|
967
1357
|
...options
|
|
968
1358
|
});
|
|
969
1359
|
if (!result) {
|
|
970
|
-
throw new
|
|
1360
|
+
throw new chunkX4GDXBOP_cjs.DatabaseOperationError(
|
|
971
1361
|
"Node create failed: expected created node row",
|
|
972
1362
|
{ operation: "insert", entity: "node" }
|
|
973
1363
|
);
|
|
@@ -976,46 +1366,43 @@ async function executeNodeCreate(ctx, input, backend, options) {
|
|
|
976
1366
|
}
|
|
977
1367
|
async function executeNodeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
978
1368
|
if (inputs.length === 0) return;
|
|
979
|
-
await
|
|
980
|
-
ctx,
|
|
1369
|
+
await runWritePlan(
|
|
1370
|
+
nodeWritePlanContext(ctx),
|
|
1371
|
+
nodeBatchWritePlan(
|
|
1372
|
+
nodeBatchConstraintProbes(ctx, inputs, "create"),
|
|
1373
|
+
nodeRequiresIdentityLock(ctx)
|
|
1374
|
+
),
|
|
981
1375
|
backend,
|
|
982
|
-
async (
|
|
1376
|
+
async (session, target) => {
|
|
983
1377
|
const identity = ctx.identity;
|
|
984
|
-
if (identity !== void 0) await identity.lock(target);
|
|
985
1378
|
const preparedCreates = await prepareBatchCreates(ctx, inputs, target);
|
|
986
1379
|
const partition = partitionCreates(preparedCreates);
|
|
987
1380
|
await withAlreadyExistsTranslation(
|
|
988
1381
|
"node",
|
|
989
|
-
() =>
|
|
990
|
-
|
|
991
|
-
partition.inserts.map((prepared) => prepared.insertParams)
|
|
1382
|
+
() => session.createNodesNoReturn(
|
|
1383
|
+
partition.inserts.map((prepared) => nodeInsertWork(prepared))
|
|
992
1384
|
)
|
|
993
1385
|
);
|
|
994
1386
|
for (const prepared of partition.resurrections) {
|
|
995
|
-
await resurrectPreparedNode(ctx,
|
|
1387
|
+
await resurrectPreparedNode(ctx, session, target, prepared);
|
|
996
1388
|
}
|
|
997
|
-
await finalizeNodeCreateBatch(ctx, partition.inserts, target, lock);
|
|
998
1389
|
if (identity !== void 0) {
|
|
999
1390
|
await identity.foldCreated(target, foldReferences(preparedCreates));
|
|
1000
1391
|
}
|
|
1001
|
-
},
|
|
1002
|
-
{
|
|
1003
|
-
fencesConstraintProbe: nodeBatchFencesConstraintProbe(
|
|
1004
|
-
ctx,
|
|
1005
|
-
inputs,
|
|
1006
|
-
"create"
|
|
1007
|
-
)
|
|
1008
1392
|
}
|
|
1009
1393
|
);
|
|
1010
1394
|
}
|
|
1011
1395
|
async function executeNodeCreateBatch(ctx, inputs, backend, options) {
|
|
1012
1396
|
if (inputs.length === 0) return [];
|
|
1013
|
-
return
|
|
1014
|
-
ctx,
|
|
1397
|
+
return runWritePlan(
|
|
1398
|
+
nodeWritePlanContext(ctx),
|
|
1399
|
+
nodeBatchWritePlan(
|
|
1400
|
+
nodeBatchConstraintProbes(ctx, inputs, "create"),
|
|
1401
|
+
nodeRequiresIdentityLock(ctx)
|
|
1402
|
+
),
|
|
1015
1403
|
backend,
|
|
1016
|
-
async (
|
|
1404
|
+
async (session, target) => {
|
|
1017
1405
|
const identity = ctx.identity;
|
|
1018
|
-
if (identity !== void 0) await identity.lock(target);
|
|
1019
1406
|
const preparedCreates = await prepareBatchCreates(
|
|
1020
1407
|
ctx,
|
|
1021
1408
|
inputs,
|
|
@@ -1025,27 +1412,25 @@ async function executeNodeCreateBatch(ctx, inputs, backend, options) {
|
|
|
1025
1412
|
const partition = partitionCreates(preparedCreates);
|
|
1026
1413
|
const inserted = await withAlreadyExistsTranslation(
|
|
1027
1414
|
"node",
|
|
1028
|
-
() =>
|
|
1029
|
-
|
|
1030
|
-
partition.inserts.map((prepared) => prepared.insertParams)
|
|
1415
|
+
() => session.createNodes(
|
|
1416
|
+
partition.inserts.map((prepared) => nodeInsertWork(prepared))
|
|
1031
1417
|
)
|
|
1032
1418
|
);
|
|
1033
1419
|
const resurrected = [];
|
|
1034
1420
|
for (const prepared of partition.resurrections) {
|
|
1035
1421
|
resurrected.push(
|
|
1036
|
-
await resurrectPreparedNode(ctx,
|
|
1422
|
+
await resurrectPreparedNode(ctx, session, target, prepared)
|
|
1037
1423
|
);
|
|
1038
1424
|
}
|
|
1039
|
-
await finalizeNodeCreateBatch(ctx, partition.inserts, target, lock);
|
|
1040
1425
|
const byReference = new Map(
|
|
1041
1426
|
[...inserted, ...resurrected].map((row) => [
|
|
1042
|
-
|
|
1427
|
+
chunk5OWHU7Z7_cjs.refKey({ kind: row.kind, id: row.id }),
|
|
1043
1428
|
row
|
|
1044
1429
|
])
|
|
1045
1430
|
);
|
|
1046
1431
|
const rows = preparedCreates.map(
|
|
1047
1432
|
(prepared) => chunkN66HCGCY_cjs.requireDefined(
|
|
1048
|
-
byReference.get(
|
|
1433
|
+
byReference.get(chunk5OWHU7Z7_cjs.refKey({ kind: prepared.kind, id: prepared.id })),
|
|
1049
1434
|
`Missing written row for ${prepared.kind} ${prepared.id}`
|
|
1050
1435
|
)
|
|
1051
1436
|
);
|
|
@@ -1053,39 +1438,36 @@ async function executeNodeCreateBatch(ctx, inputs, backend, options) {
|
|
|
1053
1438
|
await identity.foldCreated(target, foldReferences(preparedCreates));
|
|
1054
1439
|
}
|
|
1055
1440
|
return rows.map((row) => rowToNode(row));
|
|
1056
|
-
},
|
|
1057
|
-
{
|
|
1058
|
-
fencesConstraintProbe: nodeBatchFencesConstraintProbe(
|
|
1059
|
-
ctx,
|
|
1060
|
-
inputs,
|
|
1061
|
-
"create"
|
|
1062
|
-
)
|
|
1063
1441
|
}
|
|
1064
1442
|
);
|
|
1065
1443
|
}
|
|
1066
1444
|
async function executeNodeUpdate(ctx, input, backend, options) {
|
|
1445
|
+
if (input.clearValidTo === true) {
|
|
1446
|
+
assertClearValidToSupported(backend, "node");
|
|
1447
|
+
}
|
|
1067
1448
|
const opContext = ctx.createOperationContext(
|
|
1068
1449
|
"update",
|
|
1069
1450
|
"node",
|
|
1070
1451
|
input.kind,
|
|
1071
1452
|
input.id
|
|
1072
1453
|
);
|
|
1073
|
-
return
|
|
1074
|
-
ctx,
|
|
1454
|
+
return runHookedWritePlan(
|
|
1455
|
+
nodeWritePlanContext(ctx),
|
|
1075
1456
|
opContext,
|
|
1457
|
+
nodeWritePlan(
|
|
1458
|
+
nodeFencesConstraintProbe(ctx, input.kind, "update"),
|
|
1459
|
+
// Identity participates in an update when it RESURRECTS, and when it
|
|
1460
|
+
// states a validity end: a live-row update cannot change a node's kind, so
|
|
1461
|
+
// nothing folds, but an end reads the identity assertions that touch it.
|
|
1462
|
+
options?.clearDeleted === true || input.validTo !== void 0 ? nodeRequiresIdentityLock(ctx) : false
|
|
1463
|
+
),
|
|
1076
1464
|
backend,
|
|
1077
|
-
async (
|
|
1078
|
-
|
|
1079
|
-
assertClearValidToSupported(backend, "node");
|
|
1080
|
-
}
|
|
1081
|
-
const validTo = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
|
|
1465
|
+
async (session, target) => {
|
|
1466
|
+
const validTo = chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(
|
|
1082
1467
|
input.validTo,
|
|
1083
1468
|
"validTo"
|
|
1084
1469
|
);
|
|
1085
1470
|
const identity = ctx.identity;
|
|
1086
|
-
if (identity !== void 0 && (options?.clearDeleted === true || input.validTo !== void 0)) {
|
|
1087
|
-
await identity.lock(target);
|
|
1088
|
-
}
|
|
1089
1471
|
if (identity !== void 0 && validTo !== void 0) {
|
|
1090
1472
|
await identity.requireValidityEndCompatible(
|
|
1091
1473
|
target,
|
|
@@ -1096,8 +1478,8 @@ async function executeNodeUpdate(ctx, input, backend, options) {
|
|
|
1096
1478
|
const node = await performNodeUpdateWithResurrectionRecovery(
|
|
1097
1479
|
ctx,
|
|
1098
1480
|
input,
|
|
1481
|
+
session,
|
|
1099
1482
|
target,
|
|
1100
|
-
lock,
|
|
1101
1483
|
options
|
|
1102
1484
|
);
|
|
1103
1485
|
if (options?.clearDeleted && identity !== void 0) {
|
|
@@ -1106,13 +1488,6 @@ async function executeNodeUpdate(ctx, input, backend, options) {
|
|
|
1106
1488
|
]);
|
|
1107
1489
|
}
|
|
1108
1490
|
return node;
|
|
1109
|
-
},
|
|
1110
|
-
{
|
|
1111
|
-
fencesConstraintProbe: nodeFencesConstraintProbe(
|
|
1112
|
-
ctx,
|
|
1113
|
-
input.kind,
|
|
1114
|
-
"update"
|
|
1115
|
-
)
|
|
1116
1491
|
}
|
|
1117
1492
|
);
|
|
1118
1493
|
}
|
|
@@ -1121,19 +1496,19 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1121
1496
|
const schema = registration.type.schema;
|
|
1122
1497
|
const uniqueConstraints = registration.unique ?? [];
|
|
1123
1498
|
if (!backend.capabilities.transactions) {
|
|
1124
|
-
throw new
|
|
1499
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1125
1500
|
"updateWhere() requires a transactional backend so validation and sidecars are atomic",
|
|
1126
1501
|
{ code: "SET_UPDATE_TRANSACTIONS_REQUIRED", kind }
|
|
1127
1502
|
);
|
|
1128
1503
|
}
|
|
1129
1504
|
if (backend.updateNodeSet === void 0) {
|
|
1130
|
-
throw new
|
|
1505
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1131
1506
|
"This backend does not support set-based node updates",
|
|
1132
1507
|
{ code: "SET_UPDATE_UNSUPPORTED", kind }
|
|
1133
1508
|
);
|
|
1134
1509
|
}
|
|
1135
1510
|
if (Object.keys(inputPatch).length === 0) {
|
|
1136
|
-
throw new
|
|
1511
|
+
throw new chunkX4GDXBOP_cjs.ValidationError("updateWhere() patch must not be empty", {
|
|
1137
1512
|
entityType: "node",
|
|
1138
1513
|
kind,
|
|
1139
1514
|
operation: "update",
|
|
@@ -1144,7 +1519,7 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1144
1519
|
(property) => !Object.hasOwn(schema.shape, property)
|
|
1145
1520
|
);
|
|
1146
1521
|
if (unknownProperty !== void 0) {
|
|
1147
|
-
throw new
|
|
1522
|
+
throw new chunkX4GDXBOP_cjs.ValidationError(
|
|
1148
1523
|
`Unknown ${kind} property in updateWhere() patch: ${unknownProperty}`,
|
|
1149
1524
|
{
|
|
1150
1525
|
entityType: "node",
|
|
@@ -1159,7 +1534,7 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1159
1534
|
}
|
|
1160
1535
|
);
|
|
1161
1536
|
}
|
|
1162
|
-
const parsedPatch =
|
|
1537
|
+
const parsedPatch = chunkRDP6ZRSM_cjs.validateNodeProps(schema.partial(), inputPatch, {
|
|
1163
1538
|
kind,
|
|
1164
1539
|
operation: "update"
|
|
1165
1540
|
});
|
|
@@ -1170,11 +1545,11 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1170
1545
|
unsetProperties.push(property);
|
|
1171
1546
|
continue;
|
|
1172
1547
|
}
|
|
1173
|
-
|
|
1548
|
+
chunkVLBTRXA2_cjs.assertJsonValue(value, property, `Node "${kind}" updateWhere patch`);
|
|
1174
1549
|
patch[property] = value;
|
|
1175
1550
|
}
|
|
1176
1551
|
if (Object.keys(patch).length === 0 && unsetProperties.length === 0) {
|
|
1177
|
-
throw new
|
|
1552
|
+
throw new chunkX4GDXBOP_cjs.ValidationError(
|
|
1178
1553
|
"updateWhere() patch has no recognized properties",
|
|
1179
1554
|
{
|
|
1180
1555
|
entityType: "node",
|
|
@@ -1187,19 +1562,19 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1187
1562
|
);
|
|
1188
1563
|
}
|
|
1189
1564
|
if (uniqueConstraints.length > 0 && (backend.hardDeleteUniquesByNodeIds === void 0 || backend.insertUniqueBatch === void 0 || backend.checkUniqueBatch === void 0)) {
|
|
1190
|
-
throw new
|
|
1565
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1191
1566
|
"updateWhere() requires batched uniqueness sidecar operations for constrained nodes",
|
|
1192
1567
|
{ code: "SET_UPDATE_UNIQUENESS_UNSUPPORTED", kind }
|
|
1193
1568
|
);
|
|
1194
1569
|
}
|
|
1195
1570
|
if (chunkHAHNRASW_cjs.getSearchableFields(schema).length > 0 && (backend.upsertFulltext === void 0 || backend.deleteFulltext === void 0 || backend.upsertFulltextBatch === void 0 || backend.deleteFulltextBatch === void 0)) {
|
|
1196
|
-
throw new
|
|
1571
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1197
1572
|
"updateWhere() requires batched fulltext sidecar operations for searchable nodes",
|
|
1198
1573
|
{ code: "SET_UPDATE_FULLTEXT_UNSUPPORTED", kind }
|
|
1199
1574
|
);
|
|
1200
1575
|
}
|
|
1201
|
-
if (
|
|
1202
|
-
throw new
|
|
1576
|
+
if (chunkTUVD4DFR_cjs.getEmbeddingFields(schema).length > 0 && (backend.upsertEmbedding === void 0 || backend.deleteEmbedding === void 0 || backend.upsertEmbeddingBatch === void 0 || backend.deleteEmbeddingBatch === void 0)) {
|
|
1577
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1203
1578
|
"updateWhere() requires batched vector sidecar operations for embedded nodes",
|
|
1204
1579
|
{ code: "SET_UPDATE_VECTOR_UNSUPPORTED", kind }
|
|
1205
1580
|
);
|
|
@@ -1207,107 +1582,32 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1207
1582
|
const hookContext = ctx.createBulkOperationContext("updateWhere", kind);
|
|
1208
1583
|
return ctx.withBulkOperationHooks(
|
|
1209
1584
|
hookContext,
|
|
1210
|
-
() =>
|
|
1211
|
-
ctx,
|
|
1585
|
+
() => runWritePlan(
|
|
1586
|
+
nodeWritePlanContext(ctx),
|
|
1587
|
+
// The set update re-checks every changed unique key across the
|
|
1588
|
+
// constraint's scope before rebuilding the sidecars, so a shared-scope
|
|
1589
|
+
// constraint makes it a constrained write like any other update.
|
|
1590
|
+
// Identity does not participate: a set update rewrites props, and no
|
|
1591
|
+
// patch can change a node's kind.
|
|
1592
|
+
nodeWritePlan(nodeFencesConstraintProbe(ctx, kind, "update"), false),
|
|
1212
1593
|
backend,
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
if (updateNodeSet === void 0) {
|
|
1216
|
-
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1217
|
-
"The transaction backend does not support set-based node updates",
|
|
1218
|
-
{ code: "SET_UPDATE_UNSUPPORTED", kind }
|
|
1219
|
-
);
|
|
1220
|
-
}
|
|
1221
|
-
const hardDeleteUniquesByNodeIds = target.hardDeleteUniquesByNodeIds;
|
|
1222
|
-
if (uniqueConstraints.length > 0 && (hardDeleteUniquesByNodeIds === void 0 || target.insertUniqueBatch === void 0 || target.checkUniqueBatch === void 0)) {
|
|
1223
|
-
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1224
|
-
"The transaction backend lacks batched uniqueness operations",
|
|
1225
|
-
{ code: "SET_UPDATE_UNIQUENESS_UNSUPPORTED", kind }
|
|
1226
|
-
);
|
|
1227
|
-
}
|
|
1228
|
-
if (chunkHAHNRASW_cjs.getSearchableFields(schema).length > 0 && (target.upsertFulltext === void 0 || target.deleteFulltext === void 0 || target.upsertFulltextBatch === void 0 || target.deleteFulltextBatch === void 0)) {
|
|
1229
|
-
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1230
|
-
"The transaction backend lacks batched fulltext operations",
|
|
1231
|
-
{ code: "SET_UPDATE_FULLTEXT_UNSUPPORTED", kind }
|
|
1232
|
-
);
|
|
1233
|
-
}
|
|
1234
|
-
if (chunk3KOY4FH3_cjs.getEmbeddingFields(schema).length > 0 && (target.upsertEmbedding === void 0 || target.deleteEmbedding === void 0 || target.upsertEmbeddingBatch === void 0 || target.deleteEmbeddingBatch === void 0)) {
|
|
1235
|
-
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1236
|
-
"The transaction backend lacks batched vector operations",
|
|
1237
|
-
{ code: "SET_UPDATE_VECTOR_UNSUPPORTED", kind }
|
|
1238
|
-
);
|
|
1239
|
-
}
|
|
1240
|
-
const result = await updateNodeSet({
|
|
1241
|
-
graphId: ctx.graphId,
|
|
1594
|
+
(session) => session.reviseNodeSet(
|
|
1595
|
+
{
|
|
1242
1596
|
kind,
|
|
1597
|
+
schema,
|
|
1598
|
+
uniqueConstraints,
|
|
1243
1599
|
patch,
|
|
1244
1600
|
unsetProperties,
|
|
1245
1601
|
candidateIds,
|
|
1246
1602
|
candidateIdColumn
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
});
|
|
1256
|
-
if (!chunkPWLJ77UV_cjs.canonicalEqual(validatedProps, props)) {
|
|
1257
|
-
throw new chunkMRDBBHIZ_cjs.ValidationError(
|
|
1258
|
-
`Set update would persist a non-canonical ${kind} row`,
|
|
1259
|
-
{
|
|
1260
|
-
entityType: "node",
|
|
1261
|
-
kind,
|
|
1262
|
-
operation: "update",
|
|
1263
|
-
id: row.id,
|
|
1264
|
-
issues: [
|
|
1265
|
-
{
|
|
1266
|
-
path: "props",
|
|
1267
|
-
message: "The complete row requires schema normalization"
|
|
1268
|
-
}
|
|
1269
|
-
]
|
|
1270
|
-
}
|
|
1271
|
-
);
|
|
1272
|
-
}
|
|
1273
|
-
return {
|
|
1274
|
-
kind,
|
|
1275
|
-
id: row.id,
|
|
1276
|
-
schema,
|
|
1277
|
-
props: validatedProps,
|
|
1278
|
-
uniqueConstraints
|
|
1279
|
-
};
|
|
1280
|
-
});
|
|
1281
|
-
if (uniqueConstraints.length > 0) {
|
|
1282
|
-
await chunk3KOY4FH3_cjs.validateResolvedNodeUniqueness(
|
|
1283
|
-
chunk3KOY4FH3_cjs.createUniquenessContext(ctx.graphId, ctx.registry, target),
|
|
1284
|
-
sidecarItems.map((item) => ({
|
|
1285
|
-
kind: item.kind,
|
|
1286
|
-
id: item.id,
|
|
1287
|
-
props: item.props,
|
|
1288
|
-
constraints: item.uniqueConstraints
|
|
1289
|
-
}))
|
|
1290
|
-
);
|
|
1291
|
-
await chunkN66HCGCY_cjs.requireDefined(hardDeleteUniquesByNodeIds)({
|
|
1292
|
-
graphId: ctx.graphId,
|
|
1293
|
-
concreteKind: kind,
|
|
1294
|
-
nodeIds: result.rows.map((row) => row.id)
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
|
-
await chunk3KOY4FH3_cjs.applyNodeInsertSideEffectsBatch(
|
|
1298
|
-
chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
1299
|
-
sidecarItems,
|
|
1300
|
-
target
|
|
1301
|
-
);
|
|
1302
|
-
return { affectedCount: result.affectedCount };
|
|
1303
|
-
},
|
|
1304
|
-
{
|
|
1305
|
-
didWrite: (result) => result.affectedCount > 0,
|
|
1306
|
-
// The set update re-checks every changed unique key across the
|
|
1307
|
-
// constraint's scope before rebuilding the sidecars, so a shared-scope
|
|
1308
|
-
// constraint makes it a constrained write like any other update.
|
|
1309
|
-
fencesConstraintProbe: nodeFencesConstraintProbe(ctx, kind, "update")
|
|
1310
|
-
}
|
|
1603
|
+
},
|
|
1604
|
+
// This path states no window — it patches properties — so the write
|
|
1605
|
+
// asserts no stored lower bound. The set UPDATE has no field to
|
|
1606
|
+
// carry one, so a future windowed set update is refused here rather
|
|
1607
|
+
// than run unfenced.
|
|
1608
|
+
{ validityLowerBound: {} }
|
|
1609
|
+
),
|
|
1610
|
+
{ didWrite: (result) => result.affectedCount > 0 }
|
|
1311
1611
|
)
|
|
1312
1612
|
);
|
|
1313
1613
|
}
|
|
@@ -1315,18 +1615,22 @@ async function executeNodeUpsertUpdate(ctx, input, backend, options) {
|
|
|
1315
1615
|
if (input.clearValidTo === true) {
|
|
1316
1616
|
assertClearValidToSupported(backend, "node");
|
|
1317
1617
|
}
|
|
1318
|
-
return
|
|
1319
|
-
ctx,
|
|
1618
|
+
return runWritePlan(
|
|
1619
|
+
nodeWritePlanContext(ctx),
|
|
1620
|
+
nodeWritePlan(
|
|
1621
|
+
nodeFencesConstraintProbe(ctx, input.kind, "update"),
|
|
1622
|
+
// Conditional for the same reason as {@link executeNodeUpdate}: a
|
|
1623
|
+
// resurrecting upsert folds, and stating a validity end reads the
|
|
1624
|
+
// identity's other members, so both take the lock.
|
|
1625
|
+
options?.clearDeleted === true || input.validTo !== void 0 ? nodeRequiresIdentityLock(ctx) : false
|
|
1626
|
+
),
|
|
1320
1627
|
backend,
|
|
1321
|
-
async (
|
|
1322
|
-
const validTo =
|
|
1628
|
+
async (session, target) => {
|
|
1629
|
+
const validTo = chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(
|
|
1323
1630
|
input.validTo,
|
|
1324
1631
|
"validTo"
|
|
1325
1632
|
);
|
|
1326
1633
|
const identity = ctx.identity;
|
|
1327
|
-
if (identity !== void 0 && (options?.clearDeleted === true || input.validTo !== void 0)) {
|
|
1328
|
-
await identity.lock(target);
|
|
1329
|
-
}
|
|
1330
1634
|
if (identity !== void 0 && validTo !== void 0) {
|
|
1331
1635
|
await identity.requireValidityEndCompatible(
|
|
1332
1636
|
target,
|
|
@@ -1337,8 +1641,8 @@ async function executeNodeUpsertUpdate(ctx, input, backend, options) {
|
|
|
1337
1641
|
const node = await performNodeUpdateWithResurrectionRecovery(
|
|
1338
1642
|
ctx,
|
|
1339
1643
|
input,
|
|
1644
|
+
session,
|
|
1340
1645
|
target,
|
|
1341
|
-
lock,
|
|
1342
1646
|
options
|
|
1343
1647
|
);
|
|
1344
1648
|
if (options?.clearDeleted && identity !== void 0) {
|
|
@@ -1347,13 +1651,6 @@ async function executeNodeUpsertUpdate(ctx, input, backend, options) {
|
|
|
1347
1651
|
]);
|
|
1348
1652
|
}
|
|
1349
1653
|
return node;
|
|
1350
|
-
},
|
|
1351
|
-
{
|
|
1352
|
-
fencesConstraintProbe: nodeFencesConstraintProbe(
|
|
1353
|
-
ctx,
|
|
1354
|
-
input.kind,
|
|
1355
|
-
"update"
|
|
1356
|
-
)
|
|
1357
1654
|
}
|
|
1358
1655
|
);
|
|
1359
1656
|
}
|
|
@@ -1361,26 +1658,22 @@ async function executeNodeDelete(ctx, kind, id, backend) {
|
|
|
1361
1658
|
const gate = await backend.getNode(ctx.graphId, kind, id);
|
|
1362
1659
|
if (!gate || gate.deleted_at) return;
|
|
1363
1660
|
const opContext = ctx.createOperationContext("delete", "node", kind, id);
|
|
1364
|
-
return
|
|
1365
|
-
ctx,
|
|
1661
|
+
return runHookedWritePlan(
|
|
1662
|
+
nodeWritePlanContext(ctx),
|
|
1366
1663
|
opContext,
|
|
1664
|
+
nodeWritePlan(void 0, nodeRequiresIdentityLock(ctx)),
|
|
1367
1665
|
backend,
|
|
1368
|
-
async (
|
|
1666
|
+
async (session, target) => {
|
|
1369
1667
|
const identity = ctx.identity;
|
|
1370
|
-
if (identity !== void 0) await identity.lock(target);
|
|
1371
1668
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
1372
1669
|
const preflight = await target.getNode(ctx.graphId, kind, id);
|
|
1373
|
-
if (!preflight || !
|
|
1374
|
-
await
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
onDelete: registration.onDelete
|
|
1381
|
-
},
|
|
1382
|
-
target
|
|
1383
|
-
);
|
|
1670
|
+
if (!preflight || !chunkGHZPZNFC_cjs.isLiveNodeRow(preflight)) return;
|
|
1671
|
+
await session.retireNode({
|
|
1672
|
+
existing: preflight,
|
|
1673
|
+
schema: registration.type.schema,
|
|
1674
|
+
uniqueConstraints: registration.unique ?? [],
|
|
1675
|
+
onDelete: registration.onDelete
|
|
1676
|
+
});
|
|
1384
1677
|
if (identity !== void 0) {
|
|
1385
1678
|
await identity.detachDeleted(target, { kind, id }, "soft");
|
|
1386
1679
|
}
|
|
@@ -1388,32 +1681,23 @@ async function executeNodeDelete(ctx, kind, id, backend) {
|
|
|
1388
1681
|
);
|
|
1389
1682
|
}
|
|
1390
1683
|
async function executeNodeDeleteBatch(ctx, kind, ids, backend) {
|
|
1391
|
-
await
|
|
1392
|
-
ctx,
|
|
1684
|
+
await runWritePlan(
|
|
1685
|
+
nodeWritePlanContext(ctx),
|
|
1686
|
+
nodeWritePlan(void 0, nodeRequiresIdentityLock(ctx)),
|
|
1393
1687
|
backend,
|
|
1394
|
-
async (
|
|
1688
|
+
async (session, target) => {
|
|
1395
1689
|
const identity = ctx.identity;
|
|
1396
|
-
if (identity !== void 0) await identity.lock(target);
|
|
1397
1690
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
1398
|
-
const writeContext = chunk3KOY4FH3_cjs.createNodeWriteContext(
|
|
1399
|
-
ctx.graphId,
|
|
1400
|
-
ctx.registry,
|
|
1401
|
-
lock
|
|
1402
|
-
);
|
|
1403
1691
|
let affectedCount = 0;
|
|
1404
1692
|
for (const id of ids) {
|
|
1405
1693
|
const preflight = await target.getNode(ctx.graphId, kind, id);
|
|
1406
|
-
if (!preflight || !
|
|
1407
|
-
await
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
onDelete: registration.onDelete
|
|
1414
|
-
},
|
|
1415
|
-
target
|
|
1416
|
-
);
|
|
1694
|
+
if (!preflight || !chunkGHZPZNFC_cjs.isLiveNodeRow(preflight)) continue;
|
|
1695
|
+
await session.retireNode({
|
|
1696
|
+
existing: preflight,
|
|
1697
|
+
schema: registration.type.schema,
|
|
1698
|
+
uniqueConstraints: registration.unique ?? [],
|
|
1699
|
+
onDelete: registration.onDelete
|
|
1700
|
+
});
|
|
1417
1701
|
if (identity !== void 0) {
|
|
1418
1702
|
await identity.detachDeleted(target, { kind, id }, "soft");
|
|
1419
1703
|
}
|
|
@@ -1428,24 +1712,20 @@ async function executeNodeHardDelete(ctx, kind, id, backend) {
|
|
|
1428
1712
|
const gate = await backend.getNode(ctx.graphId, kind, id);
|
|
1429
1713
|
if (!gate) return;
|
|
1430
1714
|
const opContext = ctx.createOperationContext("delete", "node", kind, id);
|
|
1431
|
-
return
|
|
1432
|
-
ctx,
|
|
1715
|
+
return runHookedWritePlan(
|
|
1716
|
+
nodeWritePlanContext(ctx),
|
|
1433
1717
|
opContext,
|
|
1718
|
+
nodeWritePlan(void 0, nodeRequiresIdentityLock(ctx)),
|
|
1434
1719
|
backend,
|
|
1435
|
-
async (
|
|
1720
|
+
async (session, target) => {
|
|
1436
1721
|
const identity = ctx.identity;
|
|
1437
|
-
if (identity !== void 0) await identity.lock(target);
|
|
1438
1722
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
1439
|
-
await
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
onDelete: registration.onDelete
|
|
1446
|
-
},
|
|
1447
|
-
target
|
|
1448
|
-
);
|
|
1723
|
+
await session.purgeNode({
|
|
1724
|
+
kind,
|
|
1725
|
+
id,
|
|
1726
|
+
schema: registration.type.schema,
|
|
1727
|
+
onDelete: registration.onDelete
|
|
1728
|
+
});
|
|
1449
1729
|
if (identity !== void 0) {
|
|
1450
1730
|
await identity.detachDeleted(target, { kind, id }, "hard");
|
|
1451
1731
|
}
|
|
@@ -1456,12 +1736,12 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
1456
1736
|
const ifExists = options?.ifExists ?? "return";
|
|
1457
1737
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
1458
1738
|
const nodeKind = registration.type;
|
|
1459
|
-
const validatedProps =
|
|
1739
|
+
const validatedProps = chunkRDP6ZRSM_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
1460
1740
|
kind,
|
|
1461
1741
|
operation: "create"
|
|
1462
1742
|
});
|
|
1463
1743
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
1464
|
-
if (!
|
|
1744
|
+
if (!chunkLLVOQOWE_cjs.checkWherePredicate(constraint, validatedProps)) {
|
|
1465
1745
|
const node = await executeNodeCreate(
|
|
1466
1746
|
ctx,
|
|
1467
1747
|
{ kind, props: validatedProps },
|
|
@@ -1470,12 +1750,12 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
1470
1750
|
);
|
|
1471
1751
|
return { node, action: "created" };
|
|
1472
1752
|
}
|
|
1473
|
-
const key =
|
|
1753
|
+
const key = chunkLLVOQOWE_cjs.computeUniqueKey(
|
|
1474
1754
|
validatedProps,
|
|
1475
1755
|
constraint.fields,
|
|
1476
1756
|
constraint.collation
|
|
1477
1757
|
);
|
|
1478
|
-
const kindsToCheck =
|
|
1758
|
+
const kindsToCheck = chunkLLVOQOWE_cjs.uniquenessProbeKinds(
|
|
1479
1759
|
kind,
|
|
1480
1760
|
constraint.scope,
|
|
1481
1761
|
ctx.registry
|
|
@@ -1532,25 +1812,25 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
1532
1812
|
try {
|
|
1533
1813
|
return await attempt();
|
|
1534
1814
|
} catch (error) {
|
|
1535
|
-
if (!(error instanceof
|
|
1815
|
+
if (!(error instanceof chunkX4GDXBOP_cjs.UniquenessError)) throw error;
|
|
1536
1816
|
return attempt();
|
|
1537
1817
|
}
|
|
1538
1818
|
}
|
|
1539
1819
|
async function executeNodeFindByConstraint(ctx, kind, constraintName, props, backend) {
|
|
1540
1820
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
1541
1821
|
const nodeKind = registration.type;
|
|
1542
|
-
const validatedProps =
|
|
1822
|
+
const validatedProps = chunkRDP6ZRSM_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
1543
1823
|
kind,
|
|
1544
1824
|
operation: "create"
|
|
1545
1825
|
});
|
|
1546
1826
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
1547
|
-
if (!
|
|
1548
|
-
const key =
|
|
1827
|
+
if (!chunkLLVOQOWE_cjs.checkWherePredicate(constraint, validatedProps)) return void 0;
|
|
1828
|
+
const key = chunkLLVOQOWE_cjs.computeUniqueKey(
|
|
1549
1829
|
validatedProps,
|
|
1550
1830
|
constraint.fields,
|
|
1551
1831
|
constraint.collation
|
|
1552
1832
|
);
|
|
1553
|
-
const kindsToCheck =
|
|
1833
|
+
const kindsToCheck = chunkLLVOQOWE_cjs.uniquenessProbeKinds(
|
|
1554
1834
|
kind,
|
|
1555
1835
|
constraint.scope,
|
|
1556
1836
|
ctx.registry
|
|
@@ -1576,12 +1856,12 @@ async function executeNodeFindByConstraint(ctx, kind, constraintName, props, bac
|
|
|
1576
1856
|
function validateAndComputeKeys(nodeKind, kind, constraint, items) {
|
|
1577
1857
|
const validated = [];
|
|
1578
1858
|
for (const item of items) {
|
|
1579
|
-
const validatedProps =
|
|
1859
|
+
const validatedProps = chunkRDP6ZRSM_cjs.validateNodeProps(nodeKind.schema, item.props, {
|
|
1580
1860
|
kind,
|
|
1581
1861
|
operation: "create"
|
|
1582
1862
|
});
|
|
1583
|
-
const applies =
|
|
1584
|
-
const key = applies ?
|
|
1863
|
+
const applies = chunkLLVOQOWE_cjs.checkWherePredicate(constraint, validatedProps);
|
|
1864
|
+
const key = applies ? chunkLLVOQOWE_cjs.computeUniqueKey(
|
|
1585
1865
|
validatedProps,
|
|
1586
1866
|
constraint.fields,
|
|
1587
1867
|
constraint.collation
|
|
@@ -1604,7 +1884,7 @@ async function executeNodeBulkFindByConstraint(ctx, kind, constraintName, items,
|
|
|
1604
1884
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
1605
1885
|
const validated = validateAndComputeKeys(nodeKind, kind, constraint, items);
|
|
1606
1886
|
const uniqueKeys = collectUniqueKeys(validated);
|
|
1607
|
-
const kindsToCheck =
|
|
1887
|
+
const kindsToCheck = chunkLLVOQOWE_cjs.uniquenessProbeKinds(
|
|
1608
1888
|
kind,
|
|
1609
1889
|
constraint.scope,
|
|
1610
1890
|
ctx.registry
|
|
@@ -1654,10 +1934,10 @@ function resolveNodeIndex(graph, kind, indexName) {
|
|
|
1654
1934
|
(candidate) => candidate.entity === "node" && candidate.kind === kind && candidate.name === indexName
|
|
1655
1935
|
);
|
|
1656
1936
|
if (declaration?.entity !== "node") {
|
|
1657
|
-
throw new
|
|
1937
|
+
throw new chunkX4GDXBOP_cjs.NodeIndexNotFoundError(indexName, kind);
|
|
1658
1938
|
}
|
|
1659
1939
|
if (declaration.method !== void 0) {
|
|
1660
|
-
throw new
|
|
1940
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1661
1941
|
`bulkFindByIndex cannot probe index "${indexName}" (method "${declaration.method}"): only btree indexes serve equality probes.`,
|
|
1662
1942
|
{ indexName, kind, method: declaration.method }
|
|
1663
1943
|
);
|
|
@@ -1695,7 +1975,7 @@ function validateIndexProbeValue(value, valueType, pointer, kind) {
|
|
|
1695
1975
|
}
|
|
1696
1976
|
}
|
|
1697
1977
|
function indexProbeTypeError(pointer, kind, expected, value) {
|
|
1698
|
-
return new
|
|
1978
|
+
return new chunkX4GDXBOP_cjs.ValidationError(
|
|
1699
1979
|
`Index probe value for "${pointer}" on node kind "${kind}" has an incompatible type`,
|
|
1700
1980
|
{
|
|
1701
1981
|
entityType: "node",
|
|
@@ -1729,7 +2009,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1729
2009
|
if (items.length === 0) return [];
|
|
1730
2010
|
const index = resolveNodeIndex(ctx.graph, kind, indexName);
|
|
1731
2011
|
if (index.fields.length === 0) {
|
|
1732
|
-
throw new
|
|
2012
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1733
2013
|
`bulkFindByIndex requires an index with at least one prop-based field on index "${indexName}" (node kind "${kind}")`,
|
|
1734
2014
|
{ indexName, kind },
|
|
1735
2015
|
{
|
|
@@ -1738,7 +2018,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1738
2018
|
);
|
|
1739
2019
|
}
|
|
1740
2020
|
if (index.fieldValueTypes.includes("date")) {
|
|
1741
|
-
throw new
|
|
2021
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1742
2022
|
`bulkFindByIndex does not support date-typed key fields on index "${indexName}" (node kind "${kind}")`,
|
|
1743
2023
|
{ indexName, kind },
|
|
1744
2024
|
{
|
|
@@ -1748,7 +2028,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1748
2028
|
}
|
|
1749
2029
|
const limitPerInput = options?.limitPerInput;
|
|
1750
2030
|
if (limitPerInput !== void 0 && (!Number.isInteger(limitPerInput) || limitPerInput <= 0)) {
|
|
1751
|
-
throw new
|
|
2031
|
+
throw new chunkX4GDXBOP_cjs.ValidationError(
|
|
1752
2032
|
"bulkFindByIndex limitPerInput must be a positive integer",
|
|
1753
2033
|
{
|
|
1754
2034
|
entityType: "node",
|
|
@@ -1763,7 +2043,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1763
2043
|
}
|
|
1764
2044
|
);
|
|
1765
2045
|
}
|
|
1766
|
-
const adapter =
|
|
2046
|
+
const adapter = chunkTEC24ZDA_cjs.getDialect(backend.dialect);
|
|
1767
2047
|
const probes = items.map(
|
|
1768
2048
|
(item) => index.fields.map((pointer, position) => {
|
|
1769
2049
|
const value = chunkA7J2YDDI_cjs.resolveJsonPointer(item.props, pointer);
|
|
@@ -1790,47 +2070,47 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1790
2070
|
}
|
|
1791
2071
|
groupToInputs[existing]?.push(inputIndex);
|
|
1792
2072
|
}
|
|
1793
|
-
const schema = backend.tableNames ?
|
|
2073
|
+
const schema = backend.tableNames ? chunkIHK5KA2Q_cjs.createSqlSchema(backend.tableNames) : chunkIHK5KA2Q_cjs.DEFAULT_SQL_SCHEMA;
|
|
1794
2074
|
const compileContext = {
|
|
1795
2075
|
dialect: backend.dialect,
|
|
1796
|
-
propsColumn:
|
|
1797
|
-
systemColumn: (column) =>
|
|
2076
|
+
propsColumn: chunkOJHD3LXJ_cjs.sql.raw(`"props"`),
|
|
2077
|
+
systemColumn: (column) => chunkOJHD3LXJ_cjs.sql.raw(`"${column}"`)
|
|
1798
2078
|
};
|
|
1799
|
-
const fieldKeys =
|
|
2079
|
+
const fieldKeys = chunkTEC24ZDA_cjs.compileNodeIndexFieldKeys(index, compileContext);
|
|
1800
2080
|
const groupPredicates = groupProbes.map(
|
|
1801
|
-
(probe) =>
|
|
2081
|
+
(probe) => chunkOJHD3LXJ_cjs.sql`(${chunkOJHD3LXJ_cjs.sql.join(
|
|
1802
2082
|
fieldKeys.map((fieldKey, position) => {
|
|
1803
2083
|
const value = probe[position];
|
|
1804
2084
|
if (value === void 0 || value === null) {
|
|
1805
|
-
return
|
|
2085
|
+
return chunkOJHD3LXJ_cjs.sql`${fieldKey} IS NULL`;
|
|
1806
2086
|
}
|
|
1807
2087
|
return adapter.nullSafeEquals(
|
|
1808
2088
|
fieldKey,
|
|
1809
|
-
|
|
2089
|
+
chunkOJHD3LXJ_cjs.sql`${coerceIndexProbeBind(value, adapter)}`
|
|
1810
2090
|
);
|
|
1811
2091
|
}),
|
|
1812
|
-
|
|
2092
|
+
chunkOJHD3LXJ_cjs.sql` AND `
|
|
1813
2093
|
)})`
|
|
1814
2094
|
);
|
|
1815
2095
|
const caseBranches = groupPredicates.map(
|
|
1816
|
-
(predicate, group) =>
|
|
2096
|
+
(predicate, group) => chunkOJHD3LXJ_cjs.sql`WHEN ${predicate} THEN ${chunkOJHD3LXJ_cjs.sql.raw(String(group))}`
|
|
1817
2097
|
);
|
|
1818
|
-
const probeIndexExpr =
|
|
2098
|
+
const probeIndexExpr = chunkOJHD3LXJ_cjs.sql`CASE ${chunkOJHD3LXJ_cjs.sql.join(caseBranches, chunkOJHD3LXJ_cjs.sql` `)} ELSE NULL END`;
|
|
1819
2099
|
const conditions = [
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
2100
|
+
chunkOJHD3LXJ_cjs.sql`"graph_id" = ${ctx.graphId}`,
|
|
2101
|
+
chunkOJHD3LXJ_cjs.sql`"kind" = ${kind}`,
|
|
2102
|
+
chunkOJHD3LXJ_cjs.sql`"deleted_at" IS NULL`
|
|
1823
2103
|
];
|
|
1824
2104
|
if (index.where !== void 0) {
|
|
1825
|
-
conditions.push(
|
|
2105
|
+
conditions.push(chunkTEC24ZDA_cjs.compileIndexWhere(compileContext, index.where));
|
|
1826
2106
|
}
|
|
1827
|
-
conditions.push(
|
|
1828
|
-
const whereClause =
|
|
1829
|
-
const probedSelect =
|
|
2107
|
+
conditions.push(chunkOJHD3LXJ_cjs.sql`(${chunkOJHD3LXJ_cjs.sql.join(groupPredicates, chunkOJHD3LXJ_cjs.sql` OR `)})`);
|
|
2108
|
+
const whereClause = chunkOJHD3LXJ_cjs.sql.join(conditions, chunkOJHD3LXJ_cjs.sql` AND `);
|
|
2109
|
+
const probedSelect = chunkOJHD3LXJ_cjs.sql`SELECT "id", ${probeIndexExpr} AS probe_idx FROM ${schema.nodesTable} WHERE ${whereClause}`;
|
|
1830
2110
|
const capInSql = limitPerInput !== void 0 && backend.capabilities.windowFunctions;
|
|
1831
|
-
const query = capInSql ?
|
|
2111
|
+
const query = capInSql ? chunkOJHD3LXJ_cjs.sql`SELECT "id", probe_idx FROM (SELECT "id", probe_idx, ROW_NUMBER() OVER (PARTITION BY probe_idx ORDER BY "id") AS probe_rank FROM (${probedSelect}) AS probed) AS ranked WHERE probe_rank <= ${limitPerInput} ORDER BY probe_idx, "id"` : chunkOJHD3LXJ_cjs.sql`${probedSelect} ORDER BY probe_idx, "id"`;
|
|
1832
2112
|
const rawMatches = await backend.execute(
|
|
1833
|
-
|
|
2113
|
+
chunkOJHD3LXJ_cjs.asCompiledRowsSql(query)
|
|
1834
2114
|
);
|
|
1835
2115
|
const matches = limitPerInput !== void 0 && !capInSql ? capMatchesPerGroup(rawMatches, limitPerInput) : rawMatches;
|
|
1836
2116
|
const nodesById = await hydrateNodesById(
|
|
@@ -1863,7 +2143,7 @@ function capMatchesPerGroup(matches, limitPerInput) {
|
|
|
1863
2143
|
return capped;
|
|
1864
2144
|
}
|
|
1865
2145
|
async function hydrateNodesById(backend, graphId, kind, ids) {
|
|
1866
|
-
const rowsById = await
|
|
2146
|
+
const rowsById = await chunkRDP6ZRSM_cjs.getNodeRowsByIds(backend, graphId, kind, ids);
|
|
1867
2147
|
const nodesById = /* @__PURE__ */ new Map();
|
|
1868
2148
|
for (const [id, row] of rowsById) {
|
|
1869
2149
|
if (row.deleted_at !== void 0) continue;
|
|
@@ -1879,7 +2159,7 @@ async function executeNodeBulkGetOrCreateByConstraint(ctx, kind, constraintName,
|
|
|
1879
2159
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
1880
2160
|
const validated = validateAndComputeKeys(nodeKind, kind, constraint, items);
|
|
1881
2161
|
const uniqueKeys = collectUniqueKeys(validated);
|
|
1882
|
-
const kindsToCheck =
|
|
2162
|
+
const kindsToCheck = chunkLLVOQOWE_cjs.uniquenessProbeKinds(
|
|
1883
2163
|
kind,
|
|
1884
2164
|
constraint.scope,
|
|
1885
2165
|
ctx.registry
|
|
@@ -1982,16 +2262,20 @@ async function executeNodeBulkGetOrCreateByConstraint(ctx, kind, constraintName,
|
|
|
1982
2262
|
try {
|
|
1983
2263
|
return await attempt();
|
|
1984
2264
|
} catch (error) {
|
|
1985
|
-
if (!(error instanceof
|
|
2265
|
+
if (!(error instanceof chunkX4GDXBOP_cjs.UniquenessError)) throw error;
|
|
1986
2266
|
return attempt();
|
|
1987
2267
|
}
|
|
1988
2268
|
}
|
|
1989
2269
|
|
|
1990
2270
|
exports.assertClearValidToSupported = assertClearValidToSupported;
|
|
1991
2271
|
exports.assertValidityEndMutation = assertValidityEndMutation;
|
|
2272
|
+
exports.assertsStoredWindowState = assertsStoredWindowState;
|
|
1992
2273
|
exports.checkCardinalityConstraint = checkCardinalityConstraint;
|
|
1993
|
-
exports.
|
|
2274
|
+
exports.checkDisjointnessConstraint = checkDisjointnessConstraint;
|
|
2275
|
+
exports.createEdgeBatchValidationBackend = createEdgeBatchValidationBackend;
|
|
2276
|
+
exports.createNodeBatchValidationSeams = createNodeBatchValidationSeams;
|
|
1994
2277
|
exports.edgeWriteNeedsConstraintFence = edgeWriteNeedsConstraintFence;
|
|
2278
|
+
exports.edgeWritePlan = edgeWritePlan;
|
|
1995
2279
|
exports.executeNodeBulkFindByConstraint = executeNodeBulkFindByConstraint;
|
|
1996
2280
|
exports.executeNodeBulkFindByIndex = executeNodeBulkFindByIndex;
|
|
1997
2281
|
exports.executeNodeBulkGetOrCreateByConstraint = executeNodeBulkGetOrCreateByConstraint;
|
|
@@ -2006,13 +2290,18 @@ exports.executeNodeHardDelete = executeNodeHardDelete;
|
|
|
2006
2290
|
exports.executeNodeUpdate = executeNodeUpdate;
|
|
2007
2291
|
exports.executeNodeUpdateWhere = executeNodeUpdateWhere;
|
|
2008
2292
|
exports.executeNodeUpsertUpdate = executeNodeUpsertUpdate;
|
|
2293
|
+
exports.graphOwesClaims = graphOwesClaims;
|
|
2294
|
+
exports.mixedWritePlan = mixedWritePlan;
|
|
2009
2295
|
exports.nodeUpsertDirtyCheck = nodeUpsertDirtyCheck;
|
|
2010
2296
|
exports.primeBatchValidationCaches = primeBatchValidationCaches;
|
|
2011
2297
|
exports.rowToEdge = rowToEdge;
|
|
2012
2298
|
exports.rowToEdgeMeta = rowToEdgeMeta;
|
|
2013
2299
|
exports.rowToNode = rowToNode;
|
|
2014
2300
|
exports.rowToNodeMeta = rowToNodeMeta;
|
|
2301
|
+
exports.runHookedWritePlan = runHookedWritePlan;
|
|
2302
|
+
exports.runWritePlan = runWritePlan;
|
|
2303
|
+
exports.unfencedTarget = unfencedTarget;
|
|
2015
2304
|
exports.validityEndAfterMutation = validityEndAfterMutation;
|
|
2016
2305
|
exports.withAlreadyExistsTranslation = withAlreadyExistsTranslation;
|
|
2017
|
-
//# sourceMappingURL=chunk-
|
|
2018
|
-
//# sourceMappingURL=chunk-
|
|
2306
|
+
//# sourceMappingURL=chunk-C76WFIVZ.cjs.map
|
|
2307
|
+
//# sourceMappingURL=chunk-C76WFIVZ.cjs.map
|