@nicia-ai/typegraph 0.46.2 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -1
- 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 +58 -49
- package/dist/backend/index.d.cts +37 -55
- package/dist/backend/index.d.ts +37 -55
- package/dist/backend/index.js +11 -10
- package/dist/backend/postgres/index.cjs +27 -26
- package/dist/backend/postgres/index.d.cts +21 -7
- package/dist/backend/postgres/index.d.ts +21 -7
- package/dist/backend/postgres/index.js +14 -13
- package/dist/backend/postgres/pglite-store.cjs +34 -33
- 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 +30 -29
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +16 -15
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +15 -14
- package/dist/backend/sqlite/index.cjs +24 -23
- package/dist/backend/sqlite/index.d.cts +20 -7
- package/dist/backend/sqlite/index.d.ts +20 -7
- package/dist/backend/sqlite/index.js +12 -11
- package/dist/backend/sqlite/libsql.cjs +19 -18
- 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 +14 -13
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +35 -34
- 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 +31 -30
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +17 -16
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +15 -14
- package/dist/{chunk-TCT66A7N.cjs → chunk-26YKDNUD.cjs} +10 -10
- package/dist/{chunk-TCT66A7N.cjs.map → chunk-26YKDNUD.cjs.map} +1 -1
- package/dist/{chunk-E4OSGBCM.cjs → chunk-2HIYYMWY.cjs} +139 -136
- package/dist/chunk-2HIYYMWY.cjs.map +1 -0
- package/dist/chunk-2QGYQBS2.cjs +161 -0
- package/dist/chunk-2QGYQBS2.cjs.map +1 -0
- package/dist/{chunk-GWXXHOLU.js → chunk-2SYZXD54.js} +21 -18
- package/dist/chunk-2SYZXD54.js.map +1 -0
- package/dist/{chunk-KA4L2NZ3.js → chunk-2TYSSBU5.js} +14 -14
- package/dist/{chunk-KA4L2NZ3.js.map → chunk-2TYSSBU5.js.map} +1 -1
- package/dist/{chunk-QOJ2L2AD.js → chunk-3DMMGT6S.js} +3 -3
- package/dist/{chunk-QOJ2L2AD.js.map → chunk-3DMMGT6S.js.map} +1 -1
- package/dist/{chunk-F36KZDFX.cjs → chunk-3FPR224C.cjs} +91 -91
- package/dist/{chunk-F36KZDFX.cjs.map → chunk-3FPR224C.cjs.map} +1 -1
- package/dist/{chunk-32UETY6S.cjs → chunk-3KOY4FH3.cjs} +207 -28
- package/dist/chunk-3KOY4FH3.cjs.map +1 -0
- package/dist/{chunk-QU7QLJA4.cjs → chunk-3U5ABFDW.cjs} +26 -26
- package/dist/{chunk-QU7QLJA4.cjs.map → chunk-3U5ABFDW.cjs.map} +1 -1
- package/dist/{chunk-RFDEYLIK.js → chunk-4WMMBDS5.js} +7 -7
- package/dist/chunk-4WMMBDS5.js.map +1 -0
- package/dist/{chunk-R7EWHKID.js → chunk-5K2BKEBD.js} +19 -145
- package/dist/chunk-5K2BKEBD.js.map +1 -0
- package/dist/chunk-5PRKMB24.cjs +124 -0
- package/dist/chunk-5PRKMB24.cjs.map +1 -0
- package/dist/chunk-6LN7FIVU.js +107 -0
- package/dist/chunk-6LN7FIVU.js.map +1 -0
- package/dist/{chunk-D6GCNNMK.cjs → chunk-6NGW27EO.cjs} +10 -10
- package/dist/{chunk-D6GCNNMK.cjs.map → chunk-6NGW27EO.cjs.map} +1 -1
- package/dist/{chunk-WHS2Y43J.js → chunk-6SWPJEYN.js} +5 -5
- package/dist/{chunk-WHS2Y43J.js.map → chunk-6SWPJEYN.js.map} +1 -1
- package/dist/{chunk-7TKNK32B.js → chunk-7SQSZN2J.js} +5 -5
- package/dist/{chunk-7TKNK32B.js.map → chunk-7SQSZN2J.js.map} +1 -1
- package/dist/{chunk-UTVQPZPN.cjs → chunk-7XUYFFR4.cjs} +20 -20
- package/dist/chunk-7XUYFFR4.cjs.map +1 -0
- package/dist/{chunk-KXSMF6PL.js → chunk-ACGSAMD3.js} +39 -34
- package/dist/chunk-ACGSAMD3.js.map +1 -0
- package/dist/{chunk-PYKF7UIL.cjs → chunk-AOSSQDVO.cjs} +13 -13
- package/dist/{chunk-PYKF7UIL.cjs.map → chunk-AOSSQDVO.cjs.map} +1 -1
- package/dist/{chunk-AT3MLMJV.js → chunk-AX6JGVTZ.js} +91 -20
- package/dist/chunk-AX6JGVTZ.js.map +1 -0
- package/dist/{chunk-WA64ZSCA.cjs → chunk-BFUOME67.cjs} +11 -11
- package/dist/{chunk-WA64ZSCA.cjs.map → chunk-BFUOME67.cjs.map} +1 -1
- package/dist/{chunk-YQ4JONWE.js → chunk-BRRP76WO.js} +401 -131
- package/dist/chunk-BRRP76WO.js.map +1 -0
- package/dist/{chunk-FCIZNUW5.js → chunk-CHAOFCHV.js} +3 -3
- package/dist/{chunk-FCIZNUW5.js.map → chunk-CHAOFCHV.js.map} +1 -1
- package/dist/chunk-CICO5GXD.cjs +12 -0
- package/dist/{chunk-73MWKDFK.cjs.map → chunk-CICO5GXD.cjs.map} +1 -1
- package/dist/{chunk-S3G5VLSW.js → chunk-CT3ZKTOF.js} +7 -6
- package/dist/chunk-CT3ZKTOF.js.map +1 -0
- package/dist/{chunk-SXWLLQ3D.js → chunk-D5R42W5D.js} +4 -4
- package/dist/{chunk-SXWLLQ3D.js.map → chunk-D5R42W5D.js.map} +1 -1
- package/dist/{chunk-BZZI7B43.cjs → chunk-DO7SAMEK.cjs} +47 -47
- package/dist/{chunk-BZZI7B43.cjs.map → chunk-DO7SAMEK.cjs.map} +1 -1
- package/dist/chunk-DZAICA5J.js +147 -0
- package/dist/chunk-DZAICA5J.js.map +1 -0
- package/dist/{chunk-2ZWM2RFH.cjs → chunk-EDN4Y4ZG.cjs} +9 -9
- package/dist/{chunk-2ZWM2RFH.cjs.map → chunk-EDN4Y4ZG.cjs.map} +1 -1
- package/dist/{chunk-A4R3H7RU.cjs → chunk-EZEEWCFJ.cjs} +264 -361
- package/dist/chunk-EZEEWCFJ.cjs.map +1 -0
- package/dist/{chunk-BEB4OFZF.cjs → chunk-FA2AFWLP.cjs} +51 -59
- package/dist/chunk-FA2AFWLP.cjs.map +1 -0
- package/dist/{chunk-ZBVZ7HXD.cjs → chunk-FQPEMEWX.cjs} +12 -12
- package/dist/{chunk-ZBVZ7HXD.cjs.map → chunk-FQPEMEWX.cjs.map} +1 -1
- package/dist/{chunk-LNIWCQR4.js → chunk-GLHXM7C4.js} +3 -3
- package/dist/{chunk-LNIWCQR4.js.map → chunk-GLHXM7C4.js.map} +1 -1
- package/dist/{chunk-6BD6ZBKT.cjs → chunk-GYEG3ZLZ.cjs} +10 -10
- package/dist/{chunk-6BD6ZBKT.cjs.map → chunk-GYEG3ZLZ.cjs.map} +1 -1
- package/dist/{chunk-A7NMUYEL.cjs → chunk-HDL2ARHX.cjs} +27 -27
- package/dist/{chunk-A7NMUYEL.cjs.map → chunk-HDL2ARHX.cjs.map} +1 -1
- package/dist/{chunk-5ZJOB5YS.js → chunk-HEV35TGT.js} +4 -4
- package/dist/{chunk-5ZJOB5YS.js.map → chunk-HEV35TGT.js.map} +1 -1
- package/dist/{chunk-LHYSY6SE.js → chunk-I4GAZH5Z.js} +186 -9
- package/dist/chunk-I4GAZH5Z.js.map +1 -0
- package/dist/{chunk-BQM5P2NO.cjs → chunk-JB6T4GLL.cjs} +260 -223
- package/dist/chunk-JB6T4GLL.cjs.map +1 -0
- package/dist/{chunk-QPOQX2DI.cjs → chunk-JFRT7S3B.cjs} +1026 -369
- package/dist/chunk-JFRT7S3B.cjs.map +1 -0
- package/dist/{chunk-JCNTKRAK.js → chunk-JONXFAPO.js} +5 -5
- package/dist/{chunk-JCNTKRAK.js.map → chunk-JONXFAPO.js.map} +1 -1
- package/dist/{chunk-WEJHA7AD.js → chunk-KF6K7TGH.js} +109 -75
- package/dist/chunk-KF6K7TGH.js.map +1 -0
- package/dist/{chunk-EDJDDY6H.js → chunk-KKBDXCLQ.js} +4 -4
- package/dist/{chunk-EDJDDY6H.js.map → chunk-KKBDXCLQ.js.map} +1 -1
- package/dist/{chunk-ZHOAZD7Q.cjs → chunk-L3LQNR34.cjs} +161 -161
- package/dist/{chunk-ZHOAZD7Q.cjs.map → chunk-L3LQNR34.cjs.map} +1 -1
- package/dist/{chunk-AF3TWL5C.cjs → chunk-LRQKXRXO.cjs} +4 -4
- package/dist/{chunk-AF3TWL5C.cjs.map → chunk-LRQKXRXO.cjs.map} +1 -1
- package/dist/chunk-MKJ4KXL5.cjs +12 -0
- package/dist/{chunk-6LAXM4J2.cjs.map → chunk-MKJ4KXL5.cjs.map} +1 -1
- package/dist/{chunk-KCH7WQA5.cjs → chunk-MRDBBHIZ.cjs} +48 -2
- package/dist/chunk-MRDBBHIZ.cjs.map +1 -0
- package/dist/{chunk-FXNHZFZV.js → chunk-MYKHJI2J.js} +3 -3
- package/dist/{chunk-FXNHZFZV.js.map → chunk-MYKHJI2J.js.map} +1 -1
- package/dist/{chunk-Z43KWLZF.js → chunk-NACVVDWB.js} +213 -12
- package/dist/chunk-NACVVDWB.js.map +1 -0
- package/dist/{chunk-72WUT4GG.js → chunk-NVY5CJFP.js} +4 -4
- package/dist/{chunk-72WUT4GG.js.map → chunk-NVY5CJFP.js.map} +1 -1
- package/dist/{chunk-WYFB7BN3.js → chunk-OD4SSY2U.js} +166 -48
- package/dist/chunk-OD4SSY2U.js.map +1 -0
- package/dist/{chunk-ZIH42CRX.cjs → chunk-OI2GQ25X.cjs} +7 -7
- package/dist/{chunk-ZIH42CRX.cjs.map → chunk-OI2GQ25X.cjs.map} +1 -1
- package/dist/{chunk-AU3IJNNP.js → chunk-OMZ37BM2.js} +5 -5
- package/dist/{chunk-AU3IJNNP.js.map → chunk-OMZ37BM2.js.map} +1 -1
- package/dist/{chunk-C4DYN2SD.cjs → chunk-OORXGFL5.cjs} +48 -48
- package/dist/{chunk-C4DYN2SD.cjs.map → chunk-OORXGFL5.cjs.map} +1 -1
- package/dist/{chunk-HNYLMPQQ.cjs → chunk-OTUPEF2W.cjs} +149 -78
- package/dist/chunk-OTUPEF2W.cjs.map +1 -0
- package/dist/{chunk-BRN3RGD2.js → chunk-OVI7IXYX.js} +3 -3
- package/dist/{chunk-BRN3RGD2.js.map → chunk-OVI7IXYX.js.map} +1 -1
- package/dist/{chunk-WMKEGJG4.js → chunk-P6YLZTRE.js} +3 -3
- package/dist/{chunk-WMKEGJG4.js.map → chunk-P6YLZTRE.js.map} +1 -1
- package/dist/{chunk-C2ZP5YS6.cjs → chunk-PFBRJBUL.cjs} +278 -160
- package/dist/chunk-PFBRJBUL.cjs.map +1 -0
- package/dist/{chunk-EJSYWAEV.js → chunk-QTD6HX4O.js} +5 -5
- package/dist/{chunk-EJSYWAEV.js.map → chunk-QTD6HX4O.js.map} +1 -1
- package/dist/{chunk-JL5UEBWT.cjs → chunk-ROR5ZR6A.cjs} +45 -45
- package/dist/{chunk-JL5UEBWT.cjs.map → chunk-ROR5ZR6A.cjs.map} +1 -1
- package/dist/{chunk-EDHV4CBU.js → chunk-S5TERQVW.js} +37 -134
- package/dist/chunk-S5TERQVW.js.map +1 -0
- package/dist/{chunk-FSLTU57P.js → chunk-SDBBMD4N.js} +3 -3
- package/dist/{chunk-FSLTU57P.js.map → chunk-SDBBMD4N.js.map} +1 -1
- package/dist/{chunk-36LIJXWC.js → chunk-SHFBB23Q.js} +4 -4
- package/dist/{chunk-36LIJXWC.js.map → chunk-SHFBB23Q.js.map} +1 -1
- package/dist/chunk-SIT26LAZ.cjs +614 -0
- package/dist/chunk-SIT26LAZ.cjs.map +1 -0
- package/dist/{chunk-C6KE2HSQ.cjs → chunk-SR725PWF.cjs} +1662 -1392
- package/dist/chunk-SR725PWF.cjs.map +1 -0
- package/dist/{chunk-S7WIRFNS.cjs → chunk-TKZXMWQF.cjs} +13 -12
- package/dist/chunk-TKZXMWQF.cjs.map +1 -0
- package/dist/{chunk-5PDSCELM.cjs → chunk-TQHGE7UC.cjs} +29 -164
- package/dist/chunk-TQHGE7UC.cjs.map +1 -0
- package/dist/{chunk-XBHRKLZU.cjs → chunk-TUNPBZY3.cjs} +4 -4
- package/dist/{chunk-XBHRKLZU.cjs.map → chunk-TUNPBZY3.cjs.map} +1 -1
- package/dist/{chunk-KOAI3KIV.cjs → chunk-TZEGUG6D.cjs} +4 -4
- package/dist/{chunk-KOAI3KIV.cjs.map → chunk-TZEGUG6D.cjs.map} +1 -1
- package/dist/chunk-UGHG7PGX.js +592 -0
- package/dist/chunk-UGHG7PGX.js.map +1 -0
- package/dist/{chunk-N3QTGPC7.cjs → chunk-UMGZDVOA.cjs} +303 -101
- package/dist/chunk-UMGZDVOA.cjs.map +1 -0
- package/dist/{chunk-RHDOAQCT.cjs → chunk-WCCATHMB.cjs} +140 -135
- package/dist/chunk-WCCATHMB.cjs.map +1 -0
- package/dist/{chunk-DYPRZ53S.cjs → chunk-WODMN3Q2.cjs} +27 -27
- package/dist/{chunk-DYPRZ53S.cjs.map → chunk-WODMN3Q2.cjs.map} +1 -1
- package/dist/{chunk-OZJCH7ZS.js → chunk-XVWOYKIK.js} +3 -3
- package/dist/{chunk-OZJCH7ZS.js.map → chunk-XVWOYKIK.js.map} +1 -1
- package/dist/{chunk-IHRDX7K6.js → chunk-YIURNGXI.js} +46 -56
- package/dist/chunk-YIURNGXI.js.map +1 -0
- package/dist/{chunk-GWUWRZXW.js → chunk-YVF2EM7B.js} +3 -3
- package/dist/{chunk-GWUWRZXW.js.map → chunk-YVF2EM7B.js.map} +1 -1
- package/dist/{chunk-EAMVXR5B.js → chunk-ZDKTPBGV.js} +4 -4
- package/dist/{chunk-EAMVXR5B.js.map → chunk-ZDKTPBGV.js.map} +1 -1
- package/dist/{chunk-A2LJG5GM.js → chunk-ZFMCDJGB.js} +803 -148
- package/dist/chunk-ZFMCDJGB.js.map +1 -0
- package/dist/{chunk-62ZXBMSD.js → chunk-ZLONH2UD.js} +46 -3
- package/dist/chunk-ZLONH2UD.js.map +1 -0
- package/dist/core/index.cjs +28 -27
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +8 -7
- package/dist/ddl-BL1NZLMY.d.cts +78 -0
- package/dist/ddl-D_oW-EVO.d.ts +78 -0
- package/dist/graph-extension/index.cjs +20 -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 +4 -4
- package/dist/graph-merge/index.cjs +3418 -706
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +550 -58
- package/dist/graph-merge/index.d.ts +550 -58
- package/dist/graph-merge/index.js +3191 -497
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-Deyu8IXL.d.ts → index-COs_z6nV.d.cts} +47 -3
- package/dist/{index-DrRS51Ld.d.cts → index-D7d1u2gr.d.ts} +47 -3
- package/dist/index.cjs +233 -216
- 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 +35 -34
- 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/interchange/index.cjs +53 -52
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +17 -13
- package/dist/interchange/index.d.ts +17 -13
- package/dist/interchange/index.js +17 -16
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-ptr3JLRP.d.cts → manager-CYaff3n3.d.cts} +2 -2
- package/dist/{manager-DX983gJ0.d.ts → manager-D9eRT_ns.d.ts} +2 -2
- package/dist/{materialize-indexes-CpXoggWU.d.ts → materialize-indexes-DJ3ykH59.d.ts} +1 -1
- package/dist/{materialize-indexes-BXz77YqO.d.cts → materialize-indexes-DTtAnvfY.d.cts} +1 -1
- package/dist/{postgres-DwgEXSPI.d.cts → postgres-CcL4bAHS.d.ts} +1 -1
- package/dist/{postgres-QdOMHTBz.d.ts → postgres-DMj39MEu.d.cts} +1 -1
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +46 -46
- 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 +13 -13
- package/dist/provenance/index.js.map +1 -1
- package/dist/repair-validity-windows-BFNZvd_H.d.cts +166 -0
- package/dist/repair-validity-windows-DlUSqwCg.d.ts +166 -0
- package/dist/schema/index.cjs +45 -44
- package/dist/schema/index.d.cts +6 -6
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.js +18 -17
- package/dist/{searchable-BOUuA83f.d.ts → searchable-DHJMh_nj.d.cts} +1 -1
- package/dist/{searchable-BrUh0pdc.d.cts → searchable-bpE1bBfc.d.ts} +1 -1
- package/dist/{sqlite-BfYcV61E.d.cts → sqlite-D7Oz0SQh.d.ts} +1 -1
- package/dist/{sqlite-DK40XVR1.d.ts → sqlite-YppHrNFb.d.cts} +1 -1
- package/dist/{store-FTqBpuJD.d.cts → store-JUVvtmR4.d.cts} +228 -92
- package/dist/{store-Bo1psfVZ.d.ts → store-UzrGvZOo.d.ts} +228 -92
- package/dist/{temporal-DPtn0HOu.d.ts → temporal-5GqpYCk2.d.cts} +1 -1
- package/dist/{temporal-CXewwLTB.d.cts → temporal-CbnLzTmM.d.ts} +1 -1
- package/dist/{types-Du78EvpN.d.ts → types-BqFZTQmV.d.cts} +60 -9
- package/dist/{types-Du78EvpN.d.cts → types-BqFZTQmV.d.ts} +60 -9
- package/dist/{types-CeT7xM4M.d.ts → types-Bx74kaTt.d.ts} +1 -1
- package/dist/{types-XR1nHERK.d.cts → types-CXAhpW-c.d.cts} +1 -1
- package/dist/{where-CJsp-YUf.d.cts → where-DI_Fqz-X.d.cts} +1 -1
- package/dist/{where-CMbFiWwp.d.ts → where-O-k2wgYm.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-32UETY6S.cjs.map +0 -1
- package/dist/chunk-5PDSCELM.cjs.map +0 -1
- package/dist/chunk-62ZXBMSD.js.map +0 -1
- package/dist/chunk-6LAXM4J2.cjs +0 -12
- package/dist/chunk-73MWKDFK.cjs +0 -12
- package/dist/chunk-A2LJG5GM.js.map +0 -1
- package/dist/chunk-A4R3H7RU.cjs.map +0 -1
- package/dist/chunk-ANKOXPCC.cjs +0 -267
- package/dist/chunk-ANKOXPCC.cjs.map +0 -1
- package/dist/chunk-AT3MLMJV.js.map +0 -1
- package/dist/chunk-BEB4OFZF.cjs.map +0 -1
- package/dist/chunk-BQM5P2NO.cjs.map +0 -1
- package/dist/chunk-C2ZP5YS6.cjs.map +0 -1
- package/dist/chunk-C6KE2HSQ.cjs.map +0 -1
- package/dist/chunk-DSAWGCMP.js +0 -254
- package/dist/chunk-DSAWGCMP.js.map +0 -1
- package/dist/chunk-E4OSGBCM.cjs.map +0 -1
- package/dist/chunk-EDHV4CBU.js.map +0 -1
- package/dist/chunk-FA6Z7B5L.js +0 -244
- package/dist/chunk-FA6Z7B5L.js.map +0 -1
- package/dist/chunk-GVAMRRZR.cjs +0 -268
- package/dist/chunk-GVAMRRZR.cjs.map +0 -1
- package/dist/chunk-GWXXHOLU.js.map +0 -1
- package/dist/chunk-HNYLMPQQ.cjs.map +0 -1
- package/dist/chunk-IHRDX7K6.js.map +0 -1
- package/dist/chunk-KCH7WQA5.cjs.map +0 -1
- package/dist/chunk-KXSMF6PL.js.map +0 -1
- package/dist/chunk-LHYSY6SE.js.map +0 -1
- package/dist/chunk-N3QTGPC7.cjs.map +0 -1
- package/dist/chunk-QPOQX2DI.cjs.map +0 -1
- package/dist/chunk-R7EWHKID.js.map +0 -1
- package/dist/chunk-RFDEYLIK.js.map +0 -1
- package/dist/chunk-RHDOAQCT.cjs.map +0 -1
- package/dist/chunk-S3G5VLSW.js.map +0 -1
- package/dist/chunk-S7WIRFNS.cjs.map +0 -1
- package/dist/chunk-UTVQPZPN.cjs.map +0 -1
- package/dist/chunk-WEJHA7AD.js.map +0 -1
- package/dist/chunk-WYFB7BN3.js.map +0 -1
- package/dist/chunk-YQ4JONWE.js.map +0 -1
- package/dist/chunk-Z43KWLZF.js.map +0 -1
- package/dist/ddl-mE07h_EM.d.cts +0 -38
- package/dist/ddl-opIn8DfX.d.ts +0 -38
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk3KOY4FH3_cjs = require('./chunk-3KOY4FH3.cjs');
|
|
4
|
+
var chunkJFRT7S3B_cjs = require('./chunk-JFRT7S3B.cjs');
|
|
5
|
+
var chunkEZEEWCFJ_cjs = require('./chunk-EZEEWCFJ.cjs');
|
|
6
6
|
var chunkPWLJ77UV_cjs = require('./chunk-PWLJ77UV.cjs');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
7
|
+
var chunkSIT26LAZ_cjs = require('./chunk-SIT26LAZ.cjs');
|
|
8
|
+
var chunk3U5ABFDW_cjs = require('./chunk-3U5ABFDW.cjs');
|
|
9
|
+
var chunk5PRKMB24_cjs = require('./chunk-5PRKMB24.cjs');
|
|
10
|
+
var chunkFQPEMEWX_cjs = require('./chunk-FQPEMEWX.cjs');
|
|
11
|
+
var chunkTQHGE7UC_cjs = require('./chunk-TQHGE7UC.cjs');
|
|
12
|
+
var chunkL3LQNR34_cjs = require('./chunk-L3LQNR34.cjs');
|
|
13
|
+
var chunkEDN4Y4ZG_cjs = require('./chunk-EDN4Y4ZG.cjs');
|
|
13
14
|
var chunkHAHNRASW_cjs = require('./chunk-HAHNRASW.cjs');
|
|
14
|
-
var
|
|
15
|
-
var
|
|
15
|
+
var chunk6NGW27EO_cjs = require('./chunk-6NGW27EO.cjs');
|
|
16
|
+
var chunkMRDBBHIZ_cjs = require('./chunk-MRDBBHIZ.cjs');
|
|
16
17
|
var chunkA7J2YDDI_cjs = require('./chunk-A7J2YDDI.cjs');
|
|
17
18
|
var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
|
|
18
19
|
|
|
@@ -21,8 +22,8 @@ function nullToUndefined(value) {
|
|
|
21
22
|
return value === null ? void 0 : value;
|
|
22
23
|
}
|
|
23
24
|
function rowToNode(row) {
|
|
24
|
-
const rawProps =
|
|
25
|
-
const props =
|
|
25
|
+
const rawProps = chunk5PRKMB24_cjs.rowPropsToObject(row.props);
|
|
26
|
+
const props = chunk6NGW27EO_cjs.filterReservedKeys(rawProps, chunk6NGW27EO_cjs.RESERVED_NODE_KEYS);
|
|
26
27
|
return {
|
|
27
28
|
kind: row.kind,
|
|
28
29
|
id: row.id,
|
|
@@ -41,8 +42,8 @@ function rowToNodeMeta(row) {
|
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
function rowToEdge(row) {
|
|
44
|
-
const rawProps =
|
|
45
|
-
const props =
|
|
45
|
+
const rawProps = chunk5PRKMB24_cjs.rowPropsToObject(row.props);
|
|
46
|
+
const props = chunk6NGW27EO_cjs.filterReservedKeys(rawProps, chunk6NGW27EO_cjs.RESERVED_EDGE_KEYS);
|
|
46
47
|
return {
|
|
47
48
|
id: row.id,
|
|
48
49
|
kind: row.kind,
|
|
@@ -73,7 +74,7 @@ function nodeWriteNeedsConstraintFence(registry, kind, uniqueConstraints, operat
|
|
|
73
74
|
return "nodeDisjointness";
|
|
74
75
|
}
|
|
75
76
|
const sharedScope = uniqueConstraints.some(
|
|
76
|
-
(constraint) =>
|
|
77
|
+
(constraint) => chunkFQPEMEWX_cjs.getKindsForUniquenessCheck(kind, constraint.scope, registry).length > 1
|
|
77
78
|
);
|
|
78
79
|
return sharedScope ? "nodeUniquenessScope" : void 0;
|
|
79
80
|
}
|
|
@@ -82,7 +83,7 @@ async function checkDisjointnessConstraint(ctx, kind, id) {
|
|
|
82
83
|
for (const disjointKind of disjointKinds) {
|
|
83
84
|
const existing = await ctx.backend.getNode(ctx.graphId, disjointKind, id);
|
|
84
85
|
if (existing && !existing.deleted_at) {
|
|
85
|
-
const error =
|
|
86
|
+
const error = chunkFQPEMEWX_cjs.checkDisjointness(id, kind, [disjointKind], ctx.registry);
|
|
86
87
|
if (error) throw error;
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -99,7 +100,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
99
100
|
fromKind,
|
|
100
101
|
fromId
|
|
101
102
|
});
|
|
102
|
-
const error =
|
|
103
|
+
const error = chunkFQPEMEWX_cjs.checkCardinality(
|
|
103
104
|
edgeKind,
|
|
104
105
|
fromKind,
|
|
105
106
|
fromId,
|
|
@@ -119,7 +120,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
119
120
|
toKind,
|
|
120
121
|
toId
|
|
121
122
|
});
|
|
122
|
-
const error =
|
|
123
|
+
const error = chunkFQPEMEWX_cjs.checkUniqueEdge(
|
|
123
124
|
edgeKind,
|
|
124
125
|
fromKind,
|
|
125
126
|
fromId,
|
|
@@ -141,7 +142,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
141
142
|
fromId,
|
|
142
143
|
activeOnly: true
|
|
143
144
|
});
|
|
144
|
-
const error =
|
|
145
|
+
const error = chunkFQPEMEWX_cjs.checkCardinality(
|
|
145
146
|
edgeKind,
|
|
146
147
|
fromKind,
|
|
147
148
|
fromId,
|
|
@@ -155,6 +156,38 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
|
|
159
|
+
// src/store/validity-end.ts
|
|
160
|
+
function assertValidityEndMutation(input, context) {
|
|
161
|
+
if (input.validTo === void 0 || input.clearValidTo !== true) return;
|
|
162
|
+
throw new chunkMRDBBHIZ_cjs.ValidationError(
|
|
163
|
+
'"validTo" and "clearValidTo" are mutually exclusive',
|
|
164
|
+
{
|
|
165
|
+
...context,
|
|
166
|
+
operation: "update",
|
|
167
|
+
issues: [
|
|
168
|
+
{
|
|
169
|
+
path: "clearValidTo",
|
|
170
|
+
message: 'Pass either "validTo" or "clearValidTo", not both'
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
function validityEndAfterMutation(input, current) {
|
|
177
|
+
if (input.clearValidTo === true) return void 0;
|
|
178
|
+
return input.validTo ?? current;
|
|
179
|
+
}
|
|
180
|
+
function assertClearValidToSupported(backend, entityType) {
|
|
181
|
+
if (backend.capabilities.clearValidTo === true) return;
|
|
182
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
183
|
+
`This backend does not support clearing ${entityType} validTo`,
|
|
184
|
+
{
|
|
185
|
+
code: "CLEAR_VALID_TO_UNSUPPORTED",
|
|
186
|
+
entityType
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
158
191
|
// src/store/operations/already-exists.ts
|
|
159
192
|
var ENTITY_LABELS = {
|
|
160
193
|
node: { title: "Node", article: "A node" },
|
|
@@ -162,7 +195,7 @@ var ENTITY_LABELS = {
|
|
|
162
195
|
};
|
|
163
196
|
function alreadyExistsError(entity, kind, id, detail, cause) {
|
|
164
197
|
const label = ENTITY_LABELS[entity];
|
|
165
|
-
return new
|
|
198
|
+
return new chunkMRDBBHIZ_cjs.ValidationError(
|
|
166
199
|
`${label.title} already exists: ${detail}`,
|
|
167
200
|
{
|
|
168
201
|
entityType: entity,
|
|
@@ -172,7 +205,7 @@ function alreadyExistsError(entity, kind, id, detail, cause) {
|
|
|
172
205
|
issues: [
|
|
173
206
|
{
|
|
174
207
|
path: "id",
|
|
175
|
-
code:
|
|
208
|
+
code: chunkMRDBBHIZ_cjs.ENTITY_ALREADY_EXISTS_CODE,
|
|
176
209
|
message: `${label.article} with this ID already exists`
|
|
177
210
|
}
|
|
178
211
|
]
|
|
@@ -187,7 +220,7 @@ function createAlreadyExistsError(entity, kind, id) {
|
|
|
187
220
|
return alreadyExistsError(entity, kind, id, `${kind}/${id}`, void 0);
|
|
188
221
|
}
|
|
189
222
|
function isDuplicateKeyInsertError(error, entity) {
|
|
190
|
-
return error instanceof
|
|
223
|
+
return error instanceof chunkMRDBBHIZ_cjs.DatabaseOperationError && error.details.operation === "insert" && error.details.entity === entity && error.details.reason === "duplicate_key";
|
|
191
224
|
}
|
|
192
225
|
function rethrowAsAlreadyExists(error, entity) {
|
|
193
226
|
if (!isDuplicateKeyInsertError(error, entity)) throw error;
|
|
@@ -221,9 +254,9 @@ async function withAlreadyExistsTranslation(entity, run) {
|
|
|
221
254
|
|
|
222
255
|
// src/store/operations/node-operations.ts
|
|
223
256
|
function getNodeRegistration(graph, kind) {
|
|
224
|
-
if (!chunkN66HCGCY_cjs.hasOwnKey(graph.nodes, kind)) throw new
|
|
257
|
+
if (!chunkN66HCGCY_cjs.hasOwnKey(graph.nodes, kind)) throw new chunkMRDBBHIZ_cjs.KindNotFoundError(kind, "node");
|
|
225
258
|
const registration = graph.nodes[kind];
|
|
226
|
-
if (registration === void 0) throw new
|
|
259
|
+
if (registration === void 0) throw new chunkMRDBBHIZ_cjs.KindNotFoundError(kind, "node");
|
|
227
260
|
return registration;
|
|
228
261
|
}
|
|
229
262
|
function nodeFencesConstraintProbe(ctx, kind, operation) {
|
|
@@ -243,10 +276,10 @@ function nodeBatchFencesConstraintProbe(ctx, inputs, operation) {
|
|
|
243
276
|
return void 0;
|
|
244
277
|
}
|
|
245
278
|
function buildNodeCacheKey(graphId, kind, id) {
|
|
246
|
-
return
|
|
279
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([graphId, kind, id]);
|
|
247
280
|
}
|
|
248
281
|
function buildUniqueCacheKey(graphId, nodeKind, constraintName, key) {
|
|
249
|
-
return
|
|
282
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([graphId, nodeKind, constraintName, key]);
|
|
250
283
|
}
|
|
251
284
|
function buildInsertNodeParams(graphId, kind, id, props, validFrom, validTo) {
|
|
252
285
|
const insertParams = {
|
|
@@ -277,7 +310,7 @@ function resolveConstraint(graph, kind, constraintName) {
|
|
|
277
310
|
(candidate) => candidate.name === constraintName
|
|
278
311
|
);
|
|
279
312
|
if (constraint === void 0) {
|
|
280
|
-
throw new
|
|
313
|
+
throw new chunkMRDBBHIZ_cjs.NodeConstraintNotFoundError(constraintName, kind);
|
|
281
314
|
}
|
|
282
315
|
return constraint;
|
|
283
316
|
}
|
|
@@ -338,8 +371,8 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
338
371
|
}
|
|
339
372
|
function registerPendingUniqueEntries(kind, id, props, constraints) {
|
|
340
373
|
for (const constraint of constraints) {
|
|
341
|
-
if (!
|
|
342
|
-
const key =
|
|
374
|
+
if (!chunkFQPEMEWX_cjs.checkWherePredicate(constraint, props)) continue;
|
|
375
|
+
const key = chunkFQPEMEWX_cjs.computeUniqueKey(
|
|
343
376
|
props,
|
|
344
377
|
constraint.fields,
|
|
345
378
|
constraint.collation
|
|
@@ -352,7 +385,7 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
352
385
|
);
|
|
353
386
|
pendingUniqueOwners.set(concreteEntryKey, id);
|
|
354
387
|
if (constraint.scope !== "kind") {
|
|
355
|
-
const kindsToCheck =
|
|
388
|
+
const kindsToCheck = chunkFQPEMEWX_cjs.getKindsForUniquenessCheck(
|
|
356
389
|
kind,
|
|
357
390
|
constraint.scope,
|
|
358
391
|
registry
|
|
@@ -371,12 +404,12 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
371
404
|
}
|
|
372
405
|
function registerAppliedNodeUpdate(kind, id, oldProps, newProps, constraints) {
|
|
373
406
|
for (const constraint of constraints) {
|
|
374
|
-
const oldApplies =
|
|
375
|
-
const newApplies =
|
|
376
|
-
const oldKey = oldApplies ?
|
|
377
|
-
const newKey = newApplies ?
|
|
407
|
+
const oldApplies = chunkFQPEMEWX_cjs.checkWherePredicate(constraint, oldProps);
|
|
408
|
+
const newApplies = chunkFQPEMEWX_cjs.checkWherePredicate(constraint, newProps);
|
|
409
|
+
const oldKey = oldApplies ? chunkFQPEMEWX_cjs.computeUniqueKey(oldProps, constraint.fields, constraint.collation) : void 0;
|
|
410
|
+
const newKey = newApplies ? chunkFQPEMEWX_cjs.computeUniqueKey(newProps, constraint.fields, constraint.collation) : void 0;
|
|
378
411
|
if (oldKey === newKey) continue;
|
|
379
|
-
const kindsToCheck =
|
|
412
|
+
const kindsToCheck = chunkFQPEMEWX_cjs.getKindsForUniquenessCheck(
|
|
380
413
|
kind,
|
|
381
414
|
constraint.scope,
|
|
382
415
|
registry
|
|
@@ -416,7 +449,7 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
416
449
|
if (uniqueCache.has(cacheKey)) return;
|
|
417
450
|
uniqueCache.set(cacheKey, row);
|
|
418
451
|
}
|
|
419
|
-
const validationBackend =
|
|
452
|
+
const validationBackend = chunkSIT26LAZ_cjs.deriveBackend(backend, {
|
|
420
453
|
getNode: getNodeCached,
|
|
421
454
|
checkUnique: checkUniqueCached
|
|
422
455
|
});
|
|
@@ -433,16 +466,16 @@ function draftNodeCreate(ctx, input, id, options) {
|
|
|
433
466
|
const kind = input.kind;
|
|
434
467
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
435
468
|
const nodeKind = registration.type;
|
|
436
|
-
const validatedProps = options?.propsPreValidated === true ? input.props :
|
|
469
|
+
const validatedProps = options?.propsPreValidated === true ? input.props : chunkJFRT7S3B_cjs.validateNodeProps(nodeKind.schema, input.props, {
|
|
437
470
|
kind,
|
|
438
471
|
operation: "create"
|
|
439
472
|
});
|
|
440
|
-
const validFrom =
|
|
473
|
+
const validFrom = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
|
|
441
474
|
input.validFrom,
|
|
442
475
|
"validFrom"
|
|
443
476
|
);
|
|
444
|
-
const validTo =
|
|
445
|
-
|
|
477
|
+
const validTo = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
478
|
+
chunkTQHGE7UC_cjs.assertOrderedValidityWindow(`${kind} "${id}"`, validFrom, validTo);
|
|
446
479
|
return {
|
|
447
480
|
kind,
|
|
448
481
|
id,
|
|
@@ -466,8 +499,8 @@ async function finishNodeCreatePreparation(ctx, draft, backend) {
|
|
|
466
499
|
backend
|
|
467
500
|
};
|
|
468
501
|
await checkDisjointnessConstraint(constraintContext, kind, id);
|
|
469
|
-
await
|
|
470
|
-
|
|
502
|
+
await chunk3KOY4FH3_cjs.checkUniquenessConstraints(
|
|
503
|
+
chunk3KOY4FH3_cjs.createUniquenessContext(ctx.graphId, ctx.registry, backend),
|
|
471
504
|
kind,
|
|
472
505
|
id,
|
|
473
506
|
validatedProps,
|
|
@@ -499,8 +532,8 @@ async function validateAndPrepareNodeCreate(ctx, input, id, backend, options) {
|
|
|
499
532
|
);
|
|
500
533
|
}
|
|
501
534
|
async function finalizeNodeCreateBatch(ctx, preparedCreates, backend, lock) {
|
|
502
|
-
await
|
|
503
|
-
|
|
535
|
+
await chunk3KOY4FH3_cjs.applyNodeInsertSideEffectsBatch(
|
|
536
|
+
chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
504
537
|
preparedCreates.map((prepared) => ({
|
|
505
538
|
kind: prepared.kind,
|
|
506
539
|
id: prepared.id,
|
|
@@ -515,8 +548,8 @@ function foldReferences(preparedCreates) {
|
|
|
515
548
|
return preparedCreates.filter((prepared) => prepared.idProvided).map((prepared) => ({ kind: prepared.kind, id: prepared.id }));
|
|
516
549
|
}
|
|
517
550
|
async function finalizeNodeCreate(ctx, prepared, backend, lock) {
|
|
518
|
-
await
|
|
519
|
-
|
|
551
|
+
await chunk3KOY4FH3_cjs.applyNodeInsertSideEffects(
|
|
552
|
+
chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
520
553
|
{
|
|
521
554
|
kind: prepared.kind,
|
|
522
555
|
id: prepared.id,
|
|
@@ -529,7 +562,7 @@ async function finalizeNodeCreate(ctx, prepared, backend, lock) {
|
|
|
529
562
|
}
|
|
530
563
|
function computeNodeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
531
564
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
532
|
-
const validatedProps =
|
|
565
|
+
const validatedProps = chunkJFRT7S3B_cjs.validateNodeProps(
|
|
533
566
|
registration.type.schema,
|
|
534
567
|
{ ...existingProps, ...inputProps },
|
|
535
568
|
{ kind, operation: "update", id }
|
|
@@ -537,7 +570,7 @@ function computeNodeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
|
537
570
|
return { registration, validatedProps };
|
|
538
571
|
}
|
|
539
572
|
function resolveNodeUpdateProps(ctx, existing, inputProps) {
|
|
540
|
-
const existingProps =
|
|
573
|
+
const existingProps = chunk5PRKMB24_cjs.rowPropsToObject(existing.props);
|
|
541
574
|
const { registration, validatedProps } = computeNodeUpdate(
|
|
542
575
|
ctx,
|
|
543
576
|
existing.kind,
|
|
@@ -562,23 +595,25 @@ function nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
|
|
|
562
595
|
}
|
|
563
596
|
async function performNodeUpdate(ctx, input, backend, lock, options) {
|
|
564
597
|
const { kind, id } = input;
|
|
598
|
+
assertValidityEndMutation(input, { entityType: "node", kind, id });
|
|
565
599
|
const existing = await backend.getNode(ctx.graphId, kind, id);
|
|
566
|
-
if (!existing) throw new
|
|
600
|
+
if (!existing) throw new chunkMRDBBHIZ_cjs.NodeNotFoundError(kind, id);
|
|
567
601
|
const { registration, validatedProps } = resolveNodeUpdateProps(
|
|
568
602
|
ctx,
|
|
569
603
|
existing,
|
|
570
604
|
input.props
|
|
571
605
|
);
|
|
572
606
|
const nodeKind = registration.type;
|
|
573
|
-
const validTo =
|
|
574
|
-
const resurrectionInstant = options?.clearDeleted === true && existing.deleted_at !== void 0 ?
|
|
575
|
-
const preservesLiveLowerBound = resurrectionInstant === void 0 &&
|
|
576
|
-
const statedValidFrom =
|
|
607
|
+
const validTo = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
608
|
+
const resurrectionInstant = options?.clearDeleted === true && existing.deleted_at !== void 0 ? chunkTQHGE7UC_cjs.nowIso() : void 0;
|
|
609
|
+
const preservesLiveLowerBound = resurrectionInstant === void 0 && chunkTQHGE7UC_cjs.preservesImmutableLowerBound(input.onImmutableLowerBound);
|
|
610
|
+
const statedValidFrom = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
|
|
577
611
|
input.validFrom,
|
|
578
612
|
"validFrom"
|
|
579
613
|
);
|
|
580
614
|
const validFrom = preservesLiveLowerBound ? void 0 : statedValidFrom;
|
|
581
|
-
const
|
|
615
|
+
const resurrectionBound = resurrectionInstant === void 0 ? void 0 : chunkTQHGE7UC_cjs.resolveStampedValidityLowerBound(validFrom, validTo, resurrectionInstant);
|
|
616
|
+
const windowVerdict = chunkTQHGE7UC_cjs.assertWritableValidityWindow(
|
|
582
617
|
`${kind} "${id}"`,
|
|
583
618
|
validFrom,
|
|
584
619
|
resurrectionInstant === void 0 ? {
|
|
@@ -586,21 +621,20 @@ async function performNodeUpdate(ctx, input, backend, lock, options) {
|
|
|
586
621
|
appliesStatedValidFrom: false,
|
|
587
622
|
effectiveBoundIsStored: true
|
|
588
623
|
} : {
|
|
589
|
-
effectiveValidFrom:
|
|
624
|
+
effectiveValidFrom: resurrectionBound,
|
|
590
625
|
appliesStatedValidFrom: true,
|
|
591
|
-
// The
|
|
626
|
+
// The bound this write is about to stamp, not one the row holds.
|
|
592
627
|
effectiveBoundIsStored: false
|
|
593
628
|
},
|
|
594
629
|
validTo
|
|
595
630
|
);
|
|
596
|
-
const writeContext =
|
|
597
|
-
const effectiveValidFrom = validFrom ?? resurrectionInstant;
|
|
631
|
+
const writeContext = chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock);
|
|
598
632
|
const shared = {
|
|
599
633
|
schema: nodeKind.schema,
|
|
600
634
|
validatedProps,
|
|
601
635
|
uniqueConstraints: registration.unique ?? [],
|
|
602
|
-
...effectiveValidFrom !== void 0 && { validFrom: effectiveValidFrom },
|
|
603
636
|
...validTo !== void 0 && { validTo },
|
|
637
|
+
...input.clearValidTo === true && { clearValidTo: true },
|
|
604
638
|
// The bound the verdict above READ, carried into the UPDATE's own `WHERE`
|
|
605
639
|
// so the row this writes is the row that was judged. The verdict hands over
|
|
606
640
|
// the predicate rather than a flag, so both conditions that decide it — did
|
|
@@ -614,17 +648,22 @@ async function performNodeUpdate(ctx, input, backend, lock, options) {
|
|
|
614
648
|
...windowVerdict.storedLowerBoundFence
|
|
615
649
|
};
|
|
616
650
|
if (options?.clearDeleted) {
|
|
617
|
-
const
|
|
651
|
+
const resurrectionLowerBound = resurrectionInstant === void 0 ? validFrom !== void 0 && { validFrom } : { validFrom: resurrectionBound ?? null };
|
|
652
|
+
const row2 = await chunk3KOY4FH3_cjs.applyNodeUpdate(
|
|
618
653
|
writeContext,
|
|
619
|
-
{ ...shared, existing, clearDeleted: true },
|
|
654
|
+
{ ...shared, existing, clearDeleted: true, ...resurrectionLowerBound },
|
|
620
655
|
backend
|
|
621
656
|
);
|
|
622
657
|
return rowToNode(row2);
|
|
623
658
|
}
|
|
624
|
-
if (!
|
|
625
|
-
const row = await
|
|
659
|
+
if (!chunk5PRKMB24_cjs.isLiveNodeRow(existing)) throw new chunkMRDBBHIZ_cjs.NodeNotFoundError(kind, id);
|
|
660
|
+
const row = await chunk3KOY4FH3_cjs.applyNodeUpdate(
|
|
626
661
|
writeContext,
|
|
627
|
-
|
|
662
|
+
// An in-place update must not rewrite the stored bound, so it keeps the
|
|
663
|
+
// conditional spread: `buildUpdateNode` ignores `validFrom` off the
|
|
664
|
+
// resurrection leg, and stating one here would claim a rewrite that no
|
|
665
|
+
// statement performs.
|
|
666
|
+
{ ...shared, existing, ...validFrom !== void 0 && { validFrom } },
|
|
628
667
|
backend
|
|
629
668
|
);
|
|
630
669
|
return rowToNode(row);
|
|
@@ -646,15 +685,15 @@ async function performNodeUpdateWithResurrectionRecovery(ctx, input, target, loc
|
|
|
646
685
|
}
|
|
647
686
|
const current = await target.getNode(ctx.graphId, input.kind, input.id);
|
|
648
687
|
if (current === void 0 || current.deleted_at !== void 0) {
|
|
649
|
-
throw new
|
|
688
|
+
throw new chunkMRDBBHIZ_cjs.NodeNotFoundError(input.kind, input.id);
|
|
650
689
|
}
|
|
651
690
|
}
|
|
652
691
|
}
|
|
653
|
-
throw new
|
|
692
|
+
throw new chunkMRDBBHIZ_cjs.NodeNotFoundError(input.kind, input.id);
|
|
654
693
|
}
|
|
655
694
|
function nodeUpdateRaceError(input, error) {
|
|
656
695
|
if (!isNodeUpdateNoRowError(error)) return error;
|
|
657
|
-
return new
|
|
696
|
+
return new chunkMRDBBHIZ_cjs.DatabaseOperationError(
|
|
658
697
|
`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.`,
|
|
659
698
|
{
|
|
660
699
|
operation: "update",
|
|
@@ -685,19 +724,19 @@ async function primeBatchValidationCaches(ctx, drafts, backend, seams) {
|
|
|
685
724
|
const groups = /* @__PURE__ */ new Map();
|
|
686
725
|
for (const draft of drafts) {
|
|
687
726
|
for (const constraint of draft.uniqueConstraints) {
|
|
688
|
-
if (!
|
|
689
|
-
const key =
|
|
727
|
+
if (!chunkFQPEMEWX_cjs.checkWherePredicate(constraint, draft.validatedProps)) continue;
|
|
728
|
+
const key = chunkFQPEMEWX_cjs.computeUniqueKey(
|
|
690
729
|
draft.validatedProps,
|
|
691
730
|
constraint.fields,
|
|
692
731
|
constraint.collation
|
|
693
732
|
);
|
|
694
|
-
const kindsToCheck =
|
|
733
|
+
const kindsToCheck = chunkFQPEMEWX_cjs.getKindsForUniquenessCheck(
|
|
695
734
|
draft.kind,
|
|
696
735
|
constraint.scope,
|
|
697
736
|
ctx.registry
|
|
698
737
|
);
|
|
699
738
|
for (const kindToCheck of kindsToCheck) {
|
|
700
|
-
const groupKey =
|
|
739
|
+
const groupKey = chunkEZEEWCFJ_cjs.encodeTupleKey([kindToCheck, constraint.name]);
|
|
701
740
|
const group = groups.get(groupKey) ?? {
|
|
702
741
|
nodeKind: kindToCheck,
|
|
703
742
|
constraintName: constraint.name,
|
|
@@ -737,7 +776,7 @@ async function prepareBatchCreates(ctx, inputs, backend, options) {
|
|
|
737
776
|
seedUniqueRow
|
|
738
777
|
} = createNodeBatchValidationBackend(ctx.graphId, ctx.registry, backend);
|
|
739
778
|
const drafts = inputs.map(
|
|
740
|
-
(input) => draftNodeCreate(ctx, input, input.id ??
|
|
779
|
+
(input) => draftNodeCreate(ctx, input, input.id ?? chunkEZEEWCFJ_cjs.generateId(), options)
|
|
741
780
|
);
|
|
742
781
|
await primeBatchValidationCaches(ctx, drafts, backend, {
|
|
743
782
|
seedNodeRow,
|
|
@@ -774,12 +813,12 @@ function partitionCreates(preparedCreates) {
|
|
|
774
813
|
return { inserts, resurrections };
|
|
775
814
|
}
|
|
776
815
|
function isNodeUpdateNoRowError(error) {
|
|
777
|
-
return error instanceof
|
|
816
|
+
return error instanceof chunkMRDBBHIZ_cjs.DatabaseOperationError && error.details.operation === "update" && error.details.entity === "node" && error.details.reason === "no_row_returned";
|
|
778
817
|
}
|
|
779
818
|
async function resurrectPreparedNode(ctx, target, lock, prepared) {
|
|
780
819
|
const current = await target.getNode(ctx.graphId, prepared.kind, prepared.id);
|
|
781
820
|
if (current === void 0) {
|
|
782
|
-
throw new
|
|
821
|
+
throw new chunkMRDBBHIZ_cjs.DatabaseOperationError(
|
|
783
822
|
`Node tombstone disappeared before resurrection: ${prepared.kind} ${prepared.id}`,
|
|
784
823
|
{ operation: "update", entity: "node" }
|
|
785
824
|
);
|
|
@@ -787,16 +826,25 @@ async function resurrectPreparedNode(ctx, target, lock, prepared) {
|
|
|
787
826
|
if (current.deleted_at === void 0) {
|
|
788
827
|
throw createAlreadyExistsError("node", prepared.kind, prepared.id);
|
|
789
828
|
}
|
|
829
|
+
const resurrectionInstant = chunkTQHGE7UC_cjs.nowIso();
|
|
830
|
+
const resurrectionBound = chunkTQHGE7UC_cjs.resolveStampedValidityLowerBound(
|
|
831
|
+
prepared.insertParams.validFrom,
|
|
832
|
+
prepared.insertParams.validTo,
|
|
833
|
+
resurrectionInstant
|
|
834
|
+
);
|
|
790
835
|
try {
|
|
791
|
-
return await
|
|
792
|
-
|
|
836
|
+
return await chunk3KOY4FH3_cjs.applyNodeUpdate(
|
|
837
|
+
chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
793
838
|
{
|
|
794
839
|
existing: current,
|
|
795
840
|
clearDeleted: true,
|
|
796
841
|
schema: prepared.nodeKind.schema,
|
|
797
842
|
validatedProps: prepared.validatedProps,
|
|
798
843
|
uniqueConstraints: prepared.uniqueConstraints,
|
|
799
|
-
|
|
844
|
+
// The decision itself, never an absence — see the same spelling on
|
|
845
|
+
// `performNodeUpdate`'s resurrection leg.
|
|
846
|
+
// eslint-disable-next-line unicorn/no-null -- `validFrom: null` means "store NULL"; omitting the key means "decide for me", and this path has already decided. See UpdateNodeParams.validFrom.
|
|
847
|
+
validFrom: resurrectionBound ?? null,
|
|
800
848
|
...prepared.insertParams.validTo === void 0 ? {} : { validTo: prepared.insertParams.validTo }
|
|
801
849
|
},
|
|
802
850
|
target
|
|
@@ -863,10 +911,10 @@ async function batchCheckUniqueAcrossKinds(backend, graphId, constraintName, uni
|
|
|
863
911
|
}
|
|
864
912
|
async function executeNodeCreateInternal(ctx, input, backend, options) {
|
|
865
913
|
const kind = input.kind;
|
|
866
|
-
const id = input.id ??
|
|
914
|
+
const id = input.id ?? chunkEZEEWCFJ_cjs.generateId();
|
|
867
915
|
const opContext = ctx.createOperationContext("create", "node", kind, id);
|
|
868
916
|
const shouldReturnRow = options?.returnRow ?? true;
|
|
869
|
-
return
|
|
917
|
+
return chunkJFRT7S3B_cjs.runHookedWriteOperation(
|
|
870
918
|
ctx,
|
|
871
919
|
opContext,
|
|
872
920
|
backend,
|
|
@@ -895,8 +943,8 @@ async function executeNodeCreateInternal(ctx, input, backend, options) {
|
|
|
895
943
|
}
|
|
896
944
|
const row = await withAlreadyExistsTranslation("node", async () => {
|
|
897
945
|
if (shouldReturnRow) return target.insertNode(prepared.insertParams);
|
|
898
|
-
await
|
|
899
|
-
|
|
946
|
+
await chunkEZEEWCFJ_cjs.runInsertNoReturn(
|
|
947
|
+
chunkEZEEWCFJ_cjs.nodeInsertDispatch(target),
|
|
900
948
|
prepared.insertParams
|
|
901
949
|
);
|
|
902
950
|
return;
|
|
@@ -919,7 +967,7 @@ async function executeNodeCreate(ctx, input, backend, options) {
|
|
|
919
967
|
...options
|
|
920
968
|
});
|
|
921
969
|
if (!result) {
|
|
922
|
-
throw new
|
|
970
|
+
throw new chunkMRDBBHIZ_cjs.DatabaseOperationError(
|
|
923
971
|
"Node create failed: expected created node row",
|
|
924
972
|
{ operation: "insert", entity: "node" }
|
|
925
973
|
);
|
|
@@ -928,7 +976,7 @@ async function executeNodeCreate(ctx, input, backend, options) {
|
|
|
928
976
|
}
|
|
929
977
|
async function executeNodeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
930
978
|
if (inputs.length === 0) return;
|
|
931
|
-
await
|
|
979
|
+
await chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
932
980
|
ctx,
|
|
933
981
|
backend,
|
|
934
982
|
async (target, lock) => {
|
|
@@ -938,8 +986,8 @@ async function executeNodeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
938
986
|
const partition = partitionCreates(preparedCreates);
|
|
939
987
|
await withAlreadyExistsTranslation(
|
|
940
988
|
"node",
|
|
941
|
-
() =>
|
|
942
|
-
|
|
989
|
+
() => chunkEZEEWCFJ_cjs.runInsertBatch(
|
|
990
|
+
chunkEZEEWCFJ_cjs.nodeInsertDispatch(target),
|
|
943
991
|
partition.inserts.map((prepared) => prepared.insertParams)
|
|
944
992
|
)
|
|
945
993
|
);
|
|
@@ -962,7 +1010,7 @@ async function executeNodeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
962
1010
|
}
|
|
963
1011
|
async function executeNodeCreateBatch(ctx, inputs, backend, options) {
|
|
964
1012
|
if (inputs.length === 0) return [];
|
|
965
|
-
return
|
|
1013
|
+
return chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
966
1014
|
ctx,
|
|
967
1015
|
backend,
|
|
968
1016
|
async (target, lock) => {
|
|
@@ -977,8 +1025,8 @@ async function executeNodeCreateBatch(ctx, inputs, backend, options) {
|
|
|
977
1025
|
const partition = partitionCreates(preparedCreates);
|
|
978
1026
|
const inserted = await withAlreadyExistsTranslation(
|
|
979
1027
|
"node",
|
|
980
|
-
() =>
|
|
981
|
-
|
|
1028
|
+
() => chunkEZEEWCFJ_cjs.runInsertBatchReturning(
|
|
1029
|
+
chunkEZEEWCFJ_cjs.nodeInsertDispatch(target),
|
|
982
1030
|
partition.inserts.map((prepared) => prepared.insertParams)
|
|
983
1031
|
)
|
|
984
1032
|
);
|
|
@@ -991,13 +1039,13 @@ async function executeNodeCreateBatch(ctx, inputs, backend, options) {
|
|
|
991
1039
|
await finalizeNodeCreateBatch(ctx, partition.inserts, target, lock);
|
|
992
1040
|
const byReference = new Map(
|
|
993
1041
|
[...inserted, ...resurrected].map((row) => [
|
|
994
|
-
|
|
1042
|
+
chunkJFRT7S3B_cjs.refKey({ kind: row.kind, id: row.id }),
|
|
995
1043
|
row
|
|
996
1044
|
])
|
|
997
1045
|
);
|
|
998
1046
|
const rows = preparedCreates.map(
|
|
999
1047
|
(prepared) => chunkN66HCGCY_cjs.requireDefined(
|
|
1000
|
-
byReference.get(
|
|
1048
|
+
byReference.get(chunkJFRT7S3B_cjs.refKey({ kind: prepared.kind, id: prepared.id })),
|
|
1001
1049
|
`Missing written row for ${prepared.kind} ${prepared.id}`
|
|
1002
1050
|
)
|
|
1003
1051
|
);
|
|
@@ -1022,15 +1070,29 @@ async function executeNodeUpdate(ctx, input, backend, options) {
|
|
|
1022
1070
|
input.kind,
|
|
1023
1071
|
input.id
|
|
1024
1072
|
);
|
|
1025
|
-
return
|
|
1073
|
+
return chunkJFRT7S3B_cjs.runHookedWriteOperation(
|
|
1026
1074
|
ctx,
|
|
1027
1075
|
opContext,
|
|
1028
1076
|
backend,
|
|
1029
1077
|
async (target, lock) => {
|
|
1078
|
+
if (input.clearValidTo === true) {
|
|
1079
|
+
assertClearValidToSupported(backend, "node");
|
|
1080
|
+
}
|
|
1081
|
+
const validTo = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
|
|
1082
|
+
input.validTo,
|
|
1083
|
+
"validTo"
|
|
1084
|
+
);
|
|
1030
1085
|
const identity = ctx.identity;
|
|
1031
|
-
if (options?.clearDeleted
|
|
1086
|
+
if (identity !== void 0 && (options?.clearDeleted === true || input.validTo !== void 0)) {
|
|
1032
1087
|
await identity.lock(target);
|
|
1033
1088
|
}
|
|
1089
|
+
if (identity !== void 0 && validTo !== void 0) {
|
|
1090
|
+
await identity.requireValidityEndCompatible(
|
|
1091
|
+
target,
|
|
1092
|
+
{ kind: input.kind, id: input.id },
|
|
1093
|
+
validTo
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1034
1096
|
const node = await performNodeUpdateWithResurrectionRecovery(
|
|
1035
1097
|
ctx,
|
|
1036
1098
|
input,
|
|
@@ -1059,19 +1121,19 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1059
1121
|
const schema = registration.type.schema;
|
|
1060
1122
|
const uniqueConstraints = registration.unique ?? [];
|
|
1061
1123
|
if (!backend.capabilities.transactions) {
|
|
1062
|
-
throw new
|
|
1124
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1063
1125
|
"updateWhere() requires a transactional backend so validation and sidecars are atomic",
|
|
1064
1126
|
{ code: "SET_UPDATE_TRANSACTIONS_REQUIRED", kind }
|
|
1065
1127
|
);
|
|
1066
1128
|
}
|
|
1067
1129
|
if (backend.updateNodeSet === void 0) {
|
|
1068
|
-
throw new
|
|
1130
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1069
1131
|
"This backend does not support set-based node updates",
|
|
1070
1132
|
{ code: "SET_UPDATE_UNSUPPORTED", kind }
|
|
1071
1133
|
);
|
|
1072
1134
|
}
|
|
1073
1135
|
if (Object.keys(inputPatch).length === 0) {
|
|
1074
|
-
throw new
|
|
1136
|
+
throw new chunkMRDBBHIZ_cjs.ValidationError("updateWhere() patch must not be empty", {
|
|
1075
1137
|
entityType: "node",
|
|
1076
1138
|
kind,
|
|
1077
1139
|
operation: "update",
|
|
@@ -1082,7 +1144,7 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1082
1144
|
(property) => !Object.hasOwn(schema.shape, property)
|
|
1083
1145
|
);
|
|
1084
1146
|
if (unknownProperty !== void 0) {
|
|
1085
|
-
throw new
|
|
1147
|
+
throw new chunkMRDBBHIZ_cjs.ValidationError(
|
|
1086
1148
|
`Unknown ${kind} property in updateWhere() patch: ${unknownProperty}`,
|
|
1087
1149
|
{
|
|
1088
1150
|
entityType: "node",
|
|
@@ -1097,7 +1159,7 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1097
1159
|
}
|
|
1098
1160
|
);
|
|
1099
1161
|
}
|
|
1100
|
-
const parsedPatch =
|
|
1162
|
+
const parsedPatch = chunkJFRT7S3B_cjs.validateNodeProps(schema.partial(), inputPatch, {
|
|
1101
1163
|
kind,
|
|
1102
1164
|
operation: "update"
|
|
1103
1165
|
});
|
|
@@ -1108,11 +1170,11 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1108
1170
|
unsetProperties.push(property);
|
|
1109
1171
|
continue;
|
|
1110
1172
|
}
|
|
1111
|
-
|
|
1173
|
+
chunk6NGW27EO_cjs.assertJsonValue(value, property, `Node "${kind}" updateWhere patch`);
|
|
1112
1174
|
patch[property] = value;
|
|
1113
1175
|
}
|
|
1114
1176
|
if (Object.keys(patch).length === 0 && unsetProperties.length === 0) {
|
|
1115
|
-
throw new
|
|
1177
|
+
throw new chunkMRDBBHIZ_cjs.ValidationError(
|
|
1116
1178
|
"updateWhere() patch has no recognized properties",
|
|
1117
1179
|
{
|
|
1118
1180
|
entityType: "node",
|
|
@@ -1125,19 +1187,19 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1125
1187
|
);
|
|
1126
1188
|
}
|
|
1127
1189
|
if (uniqueConstraints.length > 0 && (backend.hardDeleteUniquesByNodeIds === void 0 || backend.insertUniqueBatch === void 0 || backend.checkUniqueBatch === void 0)) {
|
|
1128
|
-
throw new
|
|
1190
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1129
1191
|
"updateWhere() requires batched uniqueness sidecar operations for constrained nodes",
|
|
1130
1192
|
{ code: "SET_UPDATE_UNIQUENESS_UNSUPPORTED", kind }
|
|
1131
1193
|
);
|
|
1132
1194
|
}
|
|
1133
1195
|
if (chunkHAHNRASW_cjs.getSearchableFields(schema).length > 0 && (backend.upsertFulltext === void 0 || backend.deleteFulltext === void 0 || backend.upsertFulltextBatch === void 0 || backend.deleteFulltextBatch === void 0)) {
|
|
1134
|
-
throw new
|
|
1196
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1135
1197
|
"updateWhere() requires batched fulltext sidecar operations for searchable nodes",
|
|
1136
1198
|
{ code: "SET_UPDATE_FULLTEXT_UNSUPPORTED", kind }
|
|
1137
1199
|
);
|
|
1138
1200
|
}
|
|
1139
|
-
if (
|
|
1140
|
-
throw new
|
|
1201
|
+
if (chunk3KOY4FH3_cjs.getEmbeddingFields(schema).length > 0 && (backend.upsertEmbedding === void 0 || backend.deleteEmbedding === void 0 || backend.upsertEmbeddingBatch === void 0 || backend.deleteEmbeddingBatch === void 0)) {
|
|
1202
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1141
1203
|
"updateWhere() requires batched vector sidecar operations for embedded nodes",
|
|
1142
1204
|
{ code: "SET_UPDATE_VECTOR_UNSUPPORTED", kind }
|
|
1143
1205
|
);
|
|
@@ -1145,32 +1207,32 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1145
1207
|
const hookContext = ctx.createBulkOperationContext("updateWhere", kind);
|
|
1146
1208
|
return ctx.withBulkOperationHooks(
|
|
1147
1209
|
hookContext,
|
|
1148
|
-
() =>
|
|
1210
|
+
() => chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
1149
1211
|
ctx,
|
|
1150
1212
|
backend,
|
|
1151
1213
|
async (target, lock) => {
|
|
1152
1214
|
const updateNodeSet = target.updateNodeSet;
|
|
1153
1215
|
if (updateNodeSet === void 0) {
|
|
1154
|
-
throw new
|
|
1216
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1155
1217
|
"The transaction backend does not support set-based node updates",
|
|
1156
1218
|
{ code: "SET_UPDATE_UNSUPPORTED", kind }
|
|
1157
1219
|
);
|
|
1158
1220
|
}
|
|
1159
1221
|
const hardDeleteUniquesByNodeIds = target.hardDeleteUniquesByNodeIds;
|
|
1160
1222
|
if (uniqueConstraints.length > 0 && (hardDeleteUniquesByNodeIds === void 0 || target.insertUniqueBatch === void 0 || target.checkUniqueBatch === void 0)) {
|
|
1161
|
-
throw new
|
|
1223
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1162
1224
|
"The transaction backend lacks batched uniqueness operations",
|
|
1163
1225
|
{ code: "SET_UPDATE_UNIQUENESS_UNSUPPORTED", kind }
|
|
1164
1226
|
);
|
|
1165
1227
|
}
|
|
1166
1228
|
if (chunkHAHNRASW_cjs.getSearchableFields(schema).length > 0 && (target.upsertFulltext === void 0 || target.deleteFulltext === void 0 || target.upsertFulltextBatch === void 0 || target.deleteFulltextBatch === void 0)) {
|
|
1167
|
-
throw new
|
|
1229
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1168
1230
|
"The transaction backend lacks batched fulltext operations",
|
|
1169
1231
|
{ code: "SET_UPDATE_FULLTEXT_UNSUPPORTED", kind }
|
|
1170
1232
|
);
|
|
1171
1233
|
}
|
|
1172
|
-
if (
|
|
1173
|
-
throw new
|
|
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(
|
|
1174
1236
|
"The transaction backend lacks batched vector operations",
|
|
1175
1237
|
{ code: "SET_UPDATE_VECTOR_UNSUPPORTED", kind }
|
|
1176
1238
|
);
|
|
@@ -1185,14 +1247,14 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1185
1247
|
});
|
|
1186
1248
|
if (result.affectedCount === 0) return { affectedCount: 0 };
|
|
1187
1249
|
const sidecarItems = result.rows.map((row) => {
|
|
1188
|
-
const props =
|
|
1189
|
-
const validatedProps =
|
|
1250
|
+
const props = chunk5PRKMB24_cjs.rowPropsToObject(row.props);
|
|
1251
|
+
const validatedProps = chunkJFRT7S3B_cjs.validateNodeProps(schema, props, {
|
|
1190
1252
|
kind,
|
|
1191
1253
|
operation: "update",
|
|
1192
1254
|
id: row.id
|
|
1193
1255
|
});
|
|
1194
1256
|
if (!chunkPWLJ77UV_cjs.canonicalEqual(validatedProps, props)) {
|
|
1195
|
-
throw new
|
|
1257
|
+
throw new chunkMRDBBHIZ_cjs.ValidationError(
|
|
1196
1258
|
`Set update would persist a non-canonical ${kind} row`,
|
|
1197
1259
|
{
|
|
1198
1260
|
entityType: "node",
|
|
@@ -1217,65 +1279,23 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1217
1279
|
};
|
|
1218
1280
|
});
|
|
1219
1281
|
if (uniqueConstraints.length > 0) {
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
);
|
|
1230
|
-
const priorId = keyToId.get(key);
|
|
1231
|
-
if (priorId !== void 0 && priorId !== item.id) {
|
|
1232
|
-
throw new chunkKCH7WQA5_cjs.UniquenessError({
|
|
1233
|
-
constraintName: constraint.name,
|
|
1234
|
-
kind,
|
|
1235
|
-
existingId: priorId,
|
|
1236
|
-
newId: item.id,
|
|
1237
|
-
fields: constraint.fields
|
|
1238
|
-
});
|
|
1239
|
-
}
|
|
1240
|
-
keyToId.set(key, item.id);
|
|
1241
|
-
}
|
|
1242
|
-
const keys = [...keyToId.keys()];
|
|
1243
|
-
if (keys.length === 0) continue;
|
|
1244
|
-
for (const kindToCheck of chunkZBVZ7HXD_cjs.getKindsForUniquenessCheck(
|
|
1245
|
-
kind,
|
|
1246
|
-
constraint.scope,
|
|
1247
|
-
ctx.registry
|
|
1248
|
-
)) {
|
|
1249
|
-
const existingRows = await chunkN66HCGCY_cjs.requireDefined(
|
|
1250
|
-
target.checkUniqueBatch
|
|
1251
|
-
)({
|
|
1252
|
-
graphId: ctx.graphId,
|
|
1253
|
-
nodeKind: kindToCheck,
|
|
1254
|
-
constraintName: constraint.name,
|
|
1255
|
-
keys
|
|
1256
|
-
});
|
|
1257
|
-
for (const existing of existingRows) {
|
|
1258
|
-
if (existing.concrete_kind === kind && affectedIds.has(existing.node_id)) {
|
|
1259
|
-
continue;
|
|
1260
|
-
}
|
|
1261
|
-
throw new chunkKCH7WQA5_cjs.UniquenessError({
|
|
1262
|
-
constraintName: constraint.name,
|
|
1263
|
-
kind: kindToCheck,
|
|
1264
|
-
existingId: existing.node_id,
|
|
1265
|
-
newId: chunkN66HCGCY_cjs.requireDefined(keyToId.get(existing.key)),
|
|
1266
|
-
fields: constraint.fields
|
|
1267
|
-
});
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
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
|
+
);
|
|
1271
1291
|
await chunkN66HCGCY_cjs.requireDefined(hardDeleteUniquesByNodeIds)({
|
|
1272
1292
|
graphId: ctx.graphId,
|
|
1273
1293
|
concreteKind: kind,
|
|
1274
1294
|
nodeIds: result.rows.map((row) => row.id)
|
|
1275
1295
|
});
|
|
1276
1296
|
}
|
|
1277
|
-
await
|
|
1278
|
-
|
|
1297
|
+
await chunk3KOY4FH3_cjs.applyNodeInsertSideEffectsBatch(
|
|
1298
|
+
chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
1279
1299
|
sidecarItems,
|
|
1280
1300
|
target
|
|
1281
1301
|
);
|
|
@@ -1292,14 +1312,28 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
|
|
|
1292
1312
|
);
|
|
1293
1313
|
}
|
|
1294
1314
|
async function executeNodeUpsertUpdate(ctx, input, backend, options) {
|
|
1295
|
-
|
|
1315
|
+
if (input.clearValidTo === true) {
|
|
1316
|
+
assertClearValidToSupported(backend, "node");
|
|
1317
|
+
}
|
|
1318
|
+
return chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
1296
1319
|
ctx,
|
|
1297
1320
|
backend,
|
|
1298
1321
|
async (target, lock) => {
|
|
1322
|
+
const validTo = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
|
|
1323
|
+
input.validTo,
|
|
1324
|
+
"validTo"
|
|
1325
|
+
);
|
|
1299
1326
|
const identity = ctx.identity;
|
|
1300
|
-
if (options?.clearDeleted
|
|
1327
|
+
if (identity !== void 0 && (options?.clearDeleted === true || input.validTo !== void 0)) {
|
|
1301
1328
|
await identity.lock(target);
|
|
1302
1329
|
}
|
|
1330
|
+
if (identity !== void 0 && validTo !== void 0) {
|
|
1331
|
+
await identity.requireValidityEndCompatible(
|
|
1332
|
+
target,
|
|
1333
|
+
{ kind: input.kind, id: input.id },
|
|
1334
|
+
validTo
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1303
1337
|
const node = await performNodeUpdateWithResurrectionRecovery(
|
|
1304
1338
|
ctx,
|
|
1305
1339
|
input,
|
|
@@ -1327,7 +1361,7 @@ async function executeNodeDelete(ctx, kind, id, backend) {
|
|
|
1327
1361
|
const gate = await backend.getNode(ctx.graphId, kind, id);
|
|
1328
1362
|
if (!gate || gate.deleted_at) return;
|
|
1329
1363
|
const opContext = ctx.createOperationContext("delete", "node", kind, id);
|
|
1330
|
-
return
|
|
1364
|
+
return chunkJFRT7S3B_cjs.runHookedWriteOperation(
|
|
1331
1365
|
ctx,
|
|
1332
1366
|
opContext,
|
|
1333
1367
|
backend,
|
|
@@ -1336,9 +1370,9 @@ async function executeNodeDelete(ctx, kind, id, backend) {
|
|
|
1336
1370
|
if (identity !== void 0) await identity.lock(target);
|
|
1337
1371
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
1338
1372
|
const preflight = await target.getNode(ctx.graphId, kind, id);
|
|
1339
|
-
if (!preflight || !
|
|
1340
|
-
await
|
|
1341
|
-
|
|
1373
|
+
if (!preflight || !chunk5PRKMB24_cjs.isLiveNodeRow(preflight)) return;
|
|
1374
|
+
await chunk3KOY4FH3_cjs.applyNodeSoftDelete(
|
|
1375
|
+
chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
1342
1376
|
{
|
|
1343
1377
|
existing: preflight,
|
|
1344
1378
|
schema: registration.type.schema,
|
|
@@ -1354,14 +1388,14 @@ async function executeNodeDelete(ctx, kind, id, backend) {
|
|
|
1354
1388
|
);
|
|
1355
1389
|
}
|
|
1356
1390
|
async function executeNodeDeleteBatch(ctx, kind, ids, backend) {
|
|
1357
|
-
await
|
|
1391
|
+
await chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
1358
1392
|
ctx,
|
|
1359
1393
|
backend,
|
|
1360
1394
|
async (target, lock) => {
|
|
1361
1395
|
const identity = ctx.identity;
|
|
1362
1396
|
if (identity !== void 0) await identity.lock(target);
|
|
1363
1397
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
1364
|
-
const writeContext =
|
|
1398
|
+
const writeContext = chunk3KOY4FH3_cjs.createNodeWriteContext(
|
|
1365
1399
|
ctx.graphId,
|
|
1366
1400
|
ctx.registry,
|
|
1367
1401
|
lock
|
|
@@ -1369,8 +1403,8 @@ async function executeNodeDeleteBatch(ctx, kind, ids, backend) {
|
|
|
1369
1403
|
let affectedCount = 0;
|
|
1370
1404
|
for (const id of ids) {
|
|
1371
1405
|
const preflight = await target.getNode(ctx.graphId, kind, id);
|
|
1372
|
-
if (!preflight || !
|
|
1373
|
-
await
|
|
1406
|
+
if (!preflight || !chunk5PRKMB24_cjs.isLiveNodeRow(preflight)) continue;
|
|
1407
|
+
await chunk3KOY4FH3_cjs.applyNodeSoftDelete(
|
|
1374
1408
|
writeContext,
|
|
1375
1409
|
{
|
|
1376
1410
|
existing: preflight,
|
|
@@ -1394,7 +1428,7 @@ async function executeNodeHardDelete(ctx, kind, id, backend) {
|
|
|
1394
1428
|
const gate = await backend.getNode(ctx.graphId, kind, id);
|
|
1395
1429
|
if (!gate) return;
|
|
1396
1430
|
const opContext = ctx.createOperationContext("delete", "node", kind, id);
|
|
1397
|
-
return
|
|
1431
|
+
return chunkJFRT7S3B_cjs.runHookedWriteOperation(
|
|
1398
1432
|
ctx,
|
|
1399
1433
|
opContext,
|
|
1400
1434
|
backend,
|
|
@@ -1402,8 +1436,8 @@ async function executeNodeHardDelete(ctx, kind, id, backend) {
|
|
|
1402
1436
|
const identity = ctx.identity;
|
|
1403
1437
|
if (identity !== void 0) await identity.lock(target);
|
|
1404
1438
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
1405
|
-
await
|
|
1406
|
-
|
|
1439
|
+
await chunk3KOY4FH3_cjs.applyNodeHardDelete(
|
|
1440
|
+
chunk3KOY4FH3_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
1407
1441
|
{
|
|
1408
1442
|
kind,
|
|
1409
1443
|
id,
|
|
@@ -1422,12 +1456,12 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
1422
1456
|
const ifExists = options?.ifExists ?? "return";
|
|
1423
1457
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
1424
1458
|
const nodeKind = registration.type;
|
|
1425
|
-
const validatedProps =
|
|
1459
|
+
const validatedProps = chunkJFRT7S3B_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
1426
1460
|
kind,
|
|
1427
1461
|
operation: "create"
|
|
1428
1462
|
});
|
|
1429
1463
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
1430
|
-
if (!
|
|
1464
|
+
if (!chunkFQPEMEWX_cjs.checkWherePredicate(constraint, validatedProps)) {
|
|
1431
1465
|
const node = await executeNodeCreate(
|
|
1432
1466
|
ctx,
|
|
1433
1467
|
{ kind, props: validatedProps },
|
|
@@ -1436,12 +1470,12 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
1436
1470
|
);
|
|
1437
1471
|
return { node, action: "created" };
|
|
1438
1472
|
}
|
|
1439
|
-
const key =
|
|
1473
|
+
const key = chunkFQPEMEWX_cjs.computeUniqueKey(
|
|
1440
1474
|
validatedProps,
|
|
1441
1475
|
constraint.fields,
|
|
1442
1476
|
constraint.collation
|
|
1443
1477
|
);
|
|
1444
|
-
const kindsToCheck =
|
|
1478
|
+
const kindsToCheck = chunkFQPEMEWX_cjs.getKindsForUniquenessCheck(
|
|
1445
1479
|
kind,
|
|
1446
1480
|
constraint.scope,
|
|
1447
1481
|
ctx.registry
|
|
@@ -1498,25 +1532,25 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
1498
1532
|
try {
|
|
1499
1533
|
return await attempt();
|
|
1500
1534
|
} catch (error) {
|
|
1501
|
-
if (!(error instanceof
|
|
1535
|
+
if (!(error instanceof chunkMRDBBHIZ_cjs.UniquenessError)) throw error;
|
|
1502
1536
|
return attempt();
|
|
1503
1537
|
}
|
|
1504
1538
|
}
|
|
1505
1539
|
async function executeNodeFindByConstraint(ctx, kind, constraintName, props, backend) {
|
|
1506
1540
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
1507
1541
|
const nodeKind = registration.type;
|
|
1508
|
-
const validatedProps =
|
|
1542
|
+
const validatedProps = chunkJFRT7S3B_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
1509
1543
|
kind,
|
|
1510
1544
|
operation: "create"
|
|
1511
1545
|
});
|
|
1512
1546
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
1513
|
-
if (!
|
|
1514
|
-
const key =
|
|
1547
|
+
if (!chunkFQPEMEWX_cjs.checkWherePredicate(constraint, validatedProps)) return void 0;
|
|
1548
|
+
const key = chunkFQPEMEWX_cjs.computeUniqueKey(
|
|
1515
1549
|
validatedProps,
|
|
1516
1550
|
constraint.fields,
|
|
1517
1551
|
constraint.collation
|
|
1518
1552
|
);
|
|
1519
|
-
const kindsToCheck =
|
|
1553
|
+
const kindsToCheck = chunkFQPEMEWX_cjs.getKindsForUniquenessCheck(
|
|
1520
1554
|
kind,
|
|
1521
1555
|
constraint.scope,
|
|
1522
1556
|
ctx.registry
|
|
@@ -1542,12 +1576,12 @@ async function executeNodeFindByConstraint(ctx, kind, constraintName, props, bac
|
|
|
1542
1576
|
function validateAndComputeKeys(nodeKind, kind, constraint, items) {
|
|
1543
1577
|
const validated = [];
|
|
1544
1578
|
for (const item of items) {
|
|
1545
|
-
const validatedProps =
|
|
1579
|
+
const validatedProps = chunkJFRT7S3B_cjs.validateNodeProps(nodeKind.schema, item.props, {
|
|
1546
1580
|
kind,
|
|
1547
1581
|
operation: "create"
|
|
1548
1582
|
});
|
|
1549
|
-
const applies =
|
|
1550
|
-
const key = applies ?
|
|
1583
|
+
const applies = chunkFQPEMEWX_cjs.checkWherePredicate(constraint, validatedProps);
|
|
1584
|
+
const key = applies ? chunkFQPEMEWX_cjs.computeUniqueKey(
|
|
1551
1585
|
validatedProps,
|
|
1552
1586
|
constraint.fields,
|
|
1553
1587
|
constraint.collation
|
|
@@ -1570,7 +1604,7 @@ async function executeNodeBulkFindByConstraint(ctx, kind, constraintName, items,
|
|
|
1570
1604
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
1571
1605
|
const validated = validateAndComputeKeys(nodeKind, kind, constraint, items);
|
|
1572
1606
|
const uniqueKeys = collectUniqueKeys(validated);
|
|
1573
|
-
const kindsToCheck =
|
|
1607
|
+
const kindsToCheck = chunkFQPEMEWX_cjs.getKindsForUniquenessCheck(
|
|
1574
1608
|
kind,
|
|
1575
1609
|
constraint.scope,
|
|
1576
1610
|
ctx.registry
|
|
@@ -1620,10 +1654,10 @@ function resolveNodeIndex(graph, kind, indexName) {
|
|
|
1620
1654
|
(candidate) => candidate.entity === "node" && candidate.kind === kind && candidate.name === indexName
|
|
1621
1655
|
);
|
|
1622
1656
|
if (declaration?.entity !== "node") {
|
|
1623
|
-
throw new
|
|
1657
|
+
throw new chunkMRDBBHIZ_cjs.NodeIndexNotFoundError(indexName, kind);
|
|
1624
1658
|
}
|
|
1625
1659
|
if (declaration.method !== void 0) {
|
|
1626
|
-
throw new
|
|
1660
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1627
1661
|
`bulkFindByIndex cannot probe index "${indexName}" (method "${declaration.method}"): only btree indexes serve equality probes.`,
|
|
1628
1662
|
{ indexName, kind, method: declaration.method }
|
|
1629
1663
|
);
|
|
@@ -1661,7 +1695,7 @@ function validateIndexProbeValue(value, valueType, pointer, kind) {
|
|
|
1661
1695
|
}
|
|
1662
1696
|
}
|
|
1663
1697
|
function indexProbeTypeError(pointer, kind, expected, value) {
|
|
1664
|
-
return new
|
|
1698
|
+
return new chunkMRDBBHIZ_cjs.ValidationError(
|
|
1665
1699
|
`Index probe value for "${pointer}" on node kind "${kind}" has an incompatible type`,
|
|
1666
1700
|
{
|
|
1667
1701
|
entityType: "node",
|
|
@@ -1695,7 +1729,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1695
1729
|
if (items.length === 0) return [];
|
|
1696
1730
|
const index = resolveNodeIndex(ctx.graph, kind, indexName);
|
|
1697
1731
|
if (index.fields.length === 0) {
|
|
1698
|
-
throw new
|
|
1732
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1699
1733
|
`bulkFindByIndex requires an index with at least one prop-based field on index "${indexName}" (node kind "${kind}")`,
|
|
1700
1734
|
{ indexName, kind },
|
|
1701
1735
|
{
|
|
@@ -1704,7 +1738,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1704
1738
|
);
|
|
1705
1739
|
}
|
|
1706
1740
|
if (index.fieldValueTypes.includes("date")) {
|
|
1707
|
-
throw new
|
|
1741
|
+
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1708
1742
|
`bulkFindByIndex does not support date-typed key fields on index "${indexName}" (node kind "${kind}")`,
|
|
1709
1743
|
{ indexName, kind },
|
|
1710
1744
|
{
|
|
@@ -1714,7 +1748,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1714
1748
|
}
|
|
1715
1749
|
const limitPerInput = options?.limitPerInput;
|
|
1716
1750
|
if (limitPerInput !== void 0 && (!Number.isInteger(limitPerInput) || limitPerInput <= 0)) {
|
|
1717
|
-
throw new
|
|
1751
|
+
throw new chunkMRDBBHIZ_cjs.ValidationError(
|
|
1718
1752
|
"bulkFindByIndex limitPerInput must be a positive integer",
|
|
1719
1753
|
{
|
|
1720
1754
|
entityType: "node",
|
|
@@ -1729,7 +1763,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1729
1763
|
}
|
|
1730
1764
|
);
|
|
1731
1765
|
}
|
|
1732
|
-
const adapter =
|
|
1766
|
+
const adapter = chunkL3LQNR34_cjs.getDialect(backend.dialect);
|
|
1733
1767
|
const probes = items.map(
|
|
1734
1768
|
(item) => index.fields.map((pointer, position) => {
|
|
1735
1769
|
const value = chunkA7J2YDDI_cjs.resolveJsonPointer(item.props, pointer);
|
|
@@ -1756,47 +1790,47 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1756
1790
|
}
|
|
1757
1791
|
groupToInputs[existing]?.push(inputIndex);
|
|
1758
1792
|
}
|
|
1759
|
-
const schema = backend.tableNames ?
|
|
1793
|
+
const schema = backend.tableNames ? chunk3U5ABFDW_cjs.createSqlSchema(backend.tableNames) : chunk3U5ABFDW_cjs.DEFAULT_SQL_SCHEMA;
|
|
1760
1794
|
const compileContext = {
|
|
1761
1795
|
dialect: backend.dialect,
|
|
1762
|
-
propsColumn:
|
|
1763
|
-
systemColumn: (column) =>
|
|
1796
|
+
propsColumn: chunkEDN4Y4ZG_cjs.sql.raw(`"props"`),
|
|
1797
|
+
systemColumn: (column) => chunkEDN4Y4ZG_cjs.sql.raw(`"${column}"`)
|
|
1764
1798
|
};
|
|
1765
|
-
const fieldKeys =
|
|
1799
|
+
const fieldKeys = chunkL3LQNR34_cjs.compileNodeIndexFieldKeys(index, compileContext);
|
|
1766
1800
|
const groupPredicates = groupProbes.map(
|
|
1767
|
-
(probe) =>
|
|
1801
|
+
(probe) => chunkEDN4Y4ZG_cjs.sql`(${chunkEDN4Y4ZG_cjs.sql.join(
|
|
1768
1802
|
fieldKeys.map((fieldKey, position) => {
|
|
1769
1803
|
const value = probe[position];
|
|
1770
1804
|
if (value === void 0 || value === null) {
|
|
1771
|
-
return
|
|
1805
|
+
return chunkEDN4Y4ZG_cjs.sql`${fieldKey} IS NULL`;
|
|
1772
1806
|
}
|
|
1773
1807
|
return adapter.nullSafeEquals(
|
|
1774
1808
|
fieldKey,
|
|
1775
|
-
|
|
1809
|
+
chunkEDN4Y4ZG_cjs.sql`${coerceIndexProbeBind(value, adapter)}`
|
|
1776
1810
|
);
|
|
1777
1811
|
}),
|
|
1778
|
-
|
|
1812
|
+
chunkEDN4Y4ZG_cjs.sql` AND `
|
|
1779
1813
|
)})`
|
|
1780
1814
|
);
|
|
1781
1815
|
const caseBranches = groupPredicates.map(
|
|
1782
|
-
(predicate, group) =>
|
|
1816
|
+
(predicate, group) => chunkEDN4Y4ZG_cjs.sql`WHEN ${predicate} THEN ${chunkEDN4Y4ZG_cjs.sql.raw(String(group))}`
|
|
1783
1817
|
);
|
|
1784
|
-
const probeIndexExpr =
|
|
1818
|
+
const probeIndexExpr = chunkEDN4Y4ZG_cjs.sql`CASE ${chunkEDN4Y4ZG_cjs.sql.join(caseBranches, chunkEDN4Y4ZG_cjs.sql` `)} ELSE NULL END`;
|
|
1785
1819
|
const conditions = [
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1820
|
+
chunkEDN4Y4ZG_cjs.sql`"graph_id" = ${ctx.graphId}`,
|
|
1821
|
+
chunkEDN4Y4ZG_cjs.sql`"kind" = ${kind}`,
|
|
1822
|
+
chunkEDN4Y4ZG_cjs.sql`"deleted_at" IS NULL`
|
|
1789
1823
|
];
|
|
1790
1824
|
if (index.where !== void 0) {
|
|
1791
|
-
conditions.push(
|
|
1825
|
+
conditions.push(chunkL3LQNR34_cjs.compileIndexWhere(compileContext, index.where));
|
|
1792
1826
|
}
|
|
1793
|
-
conditions.push(
|
|
1794
|
-
const whereClause =
|
|
1795
|
-
const probedSelect =
|
|
1827
|
+
conditions.push(chunkEDN4Y4ZG_cjs.sql`(${chunkEDN4Y4ZG_cjs.sql.join(groupPredicates, chunkEDN4Y4ZG_cjs.sql` OR `)})`);
|
|
1828
|
+
const whereClause = chunkEDN4Y4ZG_cjs.sql.join(conditions, chunkEDN4Y4ZG_cjs.sql` AND `);
|
|
1829
|
+
const probedSelect = chunkEDN4Y4ZG_cjs.sql`SELECT "id", ${probeIndexExpr} AS probe_idx FROM ${schema.nodesTable} WHERE ${whereClause}`;
|
|
1796
1830
|
const capInSql = limitPerInput !== void 0 && backend.capabilities.windowFunctions;
|
|
1797
|
-
const query = capInSql ?
|
|
1831
|
+
const query = capInSql ? chunkEDN4Y4ZG_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"` : chunkEDN4Y4ZG_cjs.sql`${probedSelect} ORDER BY probe_idx, "id"`;
|
|
1798
1832
|
const rawMatches = await backend.execute(
|
|
1799
|
-
|
|
1833
|
+
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(query)
|
|
1800
1834
|
);
|
|
1801
1835
|
const matches = limitPerInput !== void 0 && !capInSql ? capMatchesPerGroup(rawMatches, limitPerInput) : rawMatches;
|
|
1802
1836
|
const nodesById = await hydrateNodesById(
|
|
@@ -1829,7 +1863,7 @@ function capMatchesPerGroup(matches, limitPerInput) {
|
|
|
1829
1863
|
return capped;
|
|
1830
1864
|
}
|
|
1831
1865
|
async function hydrateNodesById(backend, graphId, kind, ids) {
|
|
1832
|
-
const rowsById = await
|
|
1866
|
+
const rowsById = await chunkEZEEWCFJ_cjs.getNodeRowsByIds(backend, graphId, kind, ids);
|
|
1833
1867
|
const nodesById = /* @__PURE__ */ new Map();
|
|
1834
1868
|
for (const [id, row] of rowsById) {
|
|
1835
1869
|
if (row.deleted_at !== void 0) continue;
|
|
@@ -1845,7 +1879,7 @@ async function executeNodeBulkGetOrCreateByConstraint(ctx, kind, constraintName,
|
|
|
1845
1879
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
1846
1880
|
const validated = validateAndComputeKeys(nodeKind, kind, constraint, items);
|
|
1847
1881
|
const uniqueKeys = collectUniqueKeys(validated);
|
|
1848
|
-
const kindsToCheck =
|
|
1882
|
+
const kindsToCheck = chunkFQPEMEWX_cjs.getKindsForUniquenessCheck(
|
|
1849
1883
|
kind,
|
|
1850
1884
|
constraint.scope,
|
|
1851
1885
|
ctx.registry
|
|
@@ -1948,11 +1982,13 @@ async function executeNodeBulkGetOrCreateByConstraint(ctx, kind, constraintName,
|
|
|
1948
1982
|
try {
|
|
1949
1983
|
return await attempt();
|
|
1950
1984
|
} catch (error) {
|
|
1951
|
-
if (!(error instanceof
|
|
1985
|
+
if (!(error instanceof chunkMRDBBHIZ_cjs.UniquenessError)) throw error;
|
|
1952
1986
|
return attempt();
|
|
1953
1987
|
}
|
|
1954
1988
|
}
|
|
1955
1989
|
|
|
1990
|
+
exports.assertClearValidToSupported = assertClearValidToSupported;
|
|
1991
|
+
exports.assertValidityEndMutation = assertValidityEndMutation;
|
|
1956
1992
|
exports.checkCardinalityConstraint = checkCardinalityConstraint;
|
|
1957
1993
|
exports.createNodeBatchValidationBackend = createNodeBatchValidationBackend;
|
|
1958
1994
|
exports.edgeWriteNeedsConstraintFence = edgeWriteNeedsConstraintFence;
|
|
@@ -1976,6 +2012,7 @@ exports.rowToEdge = rowToEdge;
|
|
|
1976
2012
|
exports.rowToEdgeMeta = rowToEdgeMeta;
|
|
1977
2013
|
exports.rowToNode = rowToNode;
|
|
1978
2014
|
exports.rowToNodeMeta = rowToNodeMeta;
|
|
2015
|
+
exports.validityEndAfterMutation = validityEndAfterMutation;
|
|
1979
2016
|
exports.withAlreadyExistsTranslation = withAlreadyExistsTranslation;
|
|
1980
|
-
//# sourceMappingURL=chunk-
|
|
1981
|
-
//# sourceMappingURL=chunk-
|
|
2017
|
+
//# sourceMappingURL=chunk-JB6T4GLL.cjs.map
|
|
2018
|
+
//# sourceMappingURL=chunk-JB6T4GLL.cjs.map
|