@nicia-ai/typegraph 0.49.0 → 0.51.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 +12 -0
- package/dist/backend/drizzle/indexes.cjs +11 -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 +7 -5
- package/dist/backend/index.cjs +190 -53
- package/dist/backend/index.d.cts +90 -4
- package/dist/backend/index.d.ts +90 -4
- package/dist/backend/index.js +9 -12
- package/dist/backend/postgres/index.cjs +36 -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 +19 -15
- package/dist/backend/postgres/pglite-store.cjs +7 -62
- 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 +7 -62
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +21 -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 +20 -16
- package/dist/backend/sqlite/index.cjs +33 -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 +17 -13
- package/dist/backend/sqlite/libsql.cjs +24 -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 +19 -15
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +9 -64
- 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 +8 -64
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +25 -20
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +21 -16
- package/dist/chunk-2CVDZCXH.cjs +1278 -0
- package/dist/chunk-2CVDZCXH.cjs.map +1 -0
- package/dist/{chunk-MYKHJI2J.js → chunk-2DWTBNSH.js} +3 -3
- package/dist/{chunk-MYKHJI2J.js.map → chunk-2DWTBNSH.js.map} +1 -1
- package/dist/{chunk-JB6T4GLL.cjs → chunk-2KCTP3U2.cjs} +870 -528
- package/dist/chunk-2KCTP3U2.cjs.map +1 -0
- package/dist/{chunk-OORXGFL5.cjs → chunk-322TBTOQ.cjs} +48 -48
- package/dist/{chunk-OORXGFL5.cjs.map → chunk-322TBTOQ.cjs.map} +1 -1
- package/dist/{chunk-FA2AFWLP.cjs → chunk-36SX6QXP.cjs} +31 -12
- package/dist/chunk-36SX6QXP.cjs.map +1 -0
- package/dist/{chunk-SDBBMD4N.js → chunk-36VYWVQU.js} +3 -3
- package/dist/{chunk-SDBBMD4N.js.map → chunk-36VYWVQU.js.map} +1 -1
- package/dist/chunk-4DKY6RIU.js +1253 -0
- package/dist/chunk-4DKY6RIU.js.map +1 -0
- package/dist/chunk-4QKOZYMV.js +9 -0
- package/dist/chunk-4QKOZYMV.js.map +1 -0
- package/dist/{chunk-WIC7DRXW.js → chunk-57JM6NW3.js} +9 -19
- package/dist/chunk-57JM6NW3.js.map +1 -0
- package/dist/chunk-5WWEYV4H.cjs +5113 -0
- package/dist/chunk-5WWEYV4H.cjs.map +1 -0
- package/dist/chunk-6KQEICJ6.cjs +12 -0
- package/dist/{chunk-MKJ4KXL5.cjs.map → chunk-6KQEICJ6.cjs.map} +1 -1
- 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-KKBDXCLQ.js → chunk-6NLYIMJO.js} +4 -4
- package/dist/{chunk-KKBDXCLQ.js.map → chunk-6NLYIMJO.js.map} +1 -1
- package/dist/{chunk-BFUOME67.cjs → chunk-7B7I7YAW.cjs} +20 -11
- package/dist/chunk-7B7I7YAW.cjs.map +1 -0
- package/dist/{chunk-ZDKTPBGV.js → chunk-7G5IYROL.js} +6 -548
- package/dist/chunk-7G5IYROL.js.map +1 -0
- package/dist/{chunk-3DMMGT6S.js → chunk-7QFRK6PU.js} +4 -8
- package/dist/chunk-7QFRK6PU.js.map +1 -0
- package/dist/chunk-A4C4NJ5U.cjs +12 -0
- package/dist/chunk-A4C4NJ5U.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-UGHQV7MP.cjs → chunk-B3MN7EJR.cjs} +228 -162
- package/dist/chunk-B3MN7EJR.cjs.map +1 -0
- package/dist/{chunk-TZEGUG6D.cjs → chunk-BZ5MVITP.cjs} +4 -4
- package/dist/{chunk-TZEGUG6D.cjs.map → chunk-BZ5MVITP.cjs.map} +1 -1
- package/dist/{chunk-YVF2EM7B.js → chunk-CAI6SMP6.js} +3 -3
- package/dist/{chunk-YVF2EM7B.js.map → chunk-CAI6SMP6.js.map} +1 -1
- package/dist/{chunk-JONXFAPO.js → chunk-CBOD7TXH.js} +5 -5
- package/dist/{chunk-JONXFAPO.js.map → chunk-CBOD7TXH.js.map} +1 -1
- package/dist/{chunk-FQPEMEWX.cjs → chunk-CRZ56SZU.cjs} +81 -32
- package/dist/chunk-CRZ56SZU.cjs.map +1 -0
- package/dist/{chunk-DO7SAMEK.cjs → chunk-D3GWARN7.cjs} +47 -47
- package/dist/{chunk-DO7SAMEK.cjs.map → chunk-D3GWARN7.cjs.map} +1 -1
- package/dist/{chunk-QTD6HX4O.js → chunk-D3OUDFU7.js} +5 -5
- package/dist/{chunk-QTD6HX4O.js.map → chunk-D3OUDFU7.js.map} +1 -1
- 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-EKG2UXNX.cjs +23 -0
- package/dist/chunk-EKG2UXNX.cjs.map +1 -0
- package/dist/chunk-FMMW3KX7.cjs +148 -0
- package/dist/chunk-FMMW3KX7.cjs.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-H2VWDQWC.cjs +571 -0
- package/dist/chunk-H2VWDQWC.cjs.map +1 -0
- package/dist/chunk-H4FY6OZK.js +13 -0
- package/dist/chunk-H4FY6OZK.js.map +1 -0
- package/dist/{chunk-EDN4Y4ZG.cjs → chunk-H5IJSROF.cjs} +9 -15
- package/dist/chunk-H5IJSROF.cjs.map +1 -0
- package/dist/chunk-HZUB5CON.js +27 -0
- package/dist/chunk-HZUB5CON.js.map +1 -0
- package/dist/{chunk-NACVVDWB.js → chunk-I5IOSA27.js} +103 -105
- package/dist/chunk-I5IOSA27.js.map +1 -0
- package/dist/{chunk-OI2GQ25X.cjs → chunk-I7YAY2VQ.cjs} +7 -7
- package/dist/{chunk-OI2GQ25X.cjs.map → chunk-I7YAY2VQ.cjs.map} +1 -1
- package/dist/chunk-IRCWIA3R.js +20 -0
- package/dist/chunk-IRCWIA3R.js.map +1 -0
- package/dist/chunk-IVQBLXBK.cjs +55 -0
- package/dist/chunk-IVQBLXBK.cjs.map +1 -0
- package/dist/{chunk-7SQSZN2J.js → chunk-IZD4HTCP.js} +5 -5
- package/dist/{chunk-7SQSZN2J.js.map → chunk-IZD4HTCP.js.map} +1 -1
- package/dist/{chunk-3FPR224C.cjs → chunk-JHRUZ73O.cjs} +116 -107
- package/dist/chunk-JHRUZ73O.cjs.map +1 -0
- package/dist/{chunk-EZEEWCFJ.cjs → chunk-JQKMEKKW.cjs} +525 -298
- package/dist/chunk-JQKMEKKW.cjs.map +1 -0
- package/dist/chunk-JVA3KDEA.cjs +691 -0
- package/dist/chunk-JVA3KDEA.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-7LZJNLA5.js → chunk-K67P5DLL.js} +108 -42
- package/dist/chunk-K67P5DLL.js.map +1 -0
- package/dist/{chunk-3G5W2U2L.cjs → chunk-KACEYDYV.cjs} +335 -258
- package/dist/chunk-KACEYDYV.cjs.map +1 -0
- package/dist/{chunk-JFRT7S3B.cjs → chunk-L6EVYIID.cjs} +318 -478
- package/dist/chunk-L6EVYIID.cjs.map +1 -0
- package/dist/{chunk-SHFBB23Q.js → chunk-LI4K2KEJ.js} +6 -4
- package/dist/chunk-LI4K2KEJ.js.map +1 -0
- package/dist/chunk-LKZDQ2B4.js +1581 -0
- package/dist/chunk-LKZDQ2B4.js.map +1 -0
- package/dist/{chunk-WODMN3Q2.cjs → chunk-LLFPQOBA.cjs} +27 -27
- package/dist/{chunk-WODMN3Q2.cjs.map → chunk-LLFPQOBA.cjs.map} +1 -1
- package/dist/{chunk-P6YLZTRE.js → chunk-LZMQ3SFK.js} +3 -3
- package/dist/{chunk-P6YLZTRE.js.map → chunk-LZMQ3SFK.js.map} +1 -1
- package/dist/{chunk-HEV35TGT.js → chunk-M3VTS3F6.js} +13 -4
- package/dist/chunk-M3VTS3F6.js.map +1 -0
- package/dist/{chunk-TQHGE7UC.cjs → chunk-M5MSP3BI.cjs} +18 -10
- package/dist/chunk-M5MSP3BI.cjs.map +1 -0
- package/dist/{chunk-D4QLTJSM.js → chunk-NBOS7BY3.js} +63 -23
- package/dist/chunk-NBOS7BY3.js.map +1 -0
- package/dist/chunk-NGQDGL5X.js +140 -0
- package/dist/chunk-NGQDGL5X.js.map +1 -0
- package/dist/{chunk-SIT26LAZ.cjs → chunk-NLX5OWK7.cjs} +33 -5
- package/dist/chunk-NLX5OWK7.cjs.map +1 -0
- package/dist/chunk-NUQ2YFFH.cjs +1637 -0
- package/dist/chunk-NUQ2YFFH.cjs.map +1 -0
- package/dist/{chunk-UMGZDVOA.cjs → chunk-OGL4X4PH.cjs} +206 -208
- package/dist/chunk-OGL4X4PH.cjs.map +1 -0
- package/dist/{chunk-LRQKXRXO.cjs → chunk-OTNTGEXR.cjs} +4 -4
- package/dist/{chunk-LRQKXRXO.cjs.map → chunk-OTNTGEXR.cjs.map} +1 -1
- package/dist/chunk-OTWE63BW.js +53 -0
- package/dist/chunk-OTWE63BW.js.map +1 -0
- package/dist/chunk-PC5NGH5A.js +549 -0
- package/dist/chunk-PC5NGH5A.js.map +1 -0
- package/dist/{chunk-26YKDNUD.cjs → chunk-PS3TUWJM.cjs} +12 -10
- package/dist/chunk-PS3TUWJM.cjs.map +1 -0
- package/dist/{chunk-OMZ37BM2.js → chunk-PVFFH7TL.js} +5 -5
- package/dist/{chunk-OMZ37BM2.js.map → chunk-PVFFH7TL.js.map} +1 -1
- package/dist/chunk-QCD5JKU4.cjs +15 -0
- package/dist/chunk-QCD5JKU4.cjs.map +1 -0
- package/dist/{chunk-UGHG7PGX.js → chunk-QG5VEOKX.js} +30 -4
- package/dist/chunk-QG5VEOKX.js.map +1 -0
- package/dist/{chunk-TUNPBZY3.cjs → chunk-QLLZM5I3.cjs} +4 -4
- package/dist/{chunk-TUNPBZY3.cjs.map → chunk-QLLZM5I3.cjs.map} +1 -1
- package/dist/{chunk-BRRP76WO.js → chunk-RCBG6YMT.js} +781 -375
- package/dist/chunk-RCBG6YMT.js.map +1 -0
- package/dist/{chunk-LTXQOEIC.js → chunk-RI7RJH4G.js} +281 -204
- package/dist/chunk-RI7RJH4G.js.map +1 -0
- package/dist/{chunk-GYEG3ZLZ.cjs → chunk-RJMHU2MG.cjs} +121 -18
- package/dist/chunk-RJMHU2MG.cjs.map +1 -0
- package/dist/{chunk-GLHXM7C4.js → chunk-RVUL2HXY.js} +61 -23
- package/dist/chunk-RVUL2HXY.js.map +1 -0
- package/dist/chunk-RWUWTJQY.cjs +30 -0
- package/dist/chunk-RWUWTJQY.cjs.map +1 -0
- package/dist/{chunk-2O4PCIZ6.cjs → chunk-S5GU4LUN.cjs} +13 -13
- package/dist/{chunk-2O4PCIZ6.cjs.map → chunk-S5GU4LUN.cjs.map} +1 -1
- package/dist/{chunk-JPD2CTC3.js → chunk-SDPWO2Z5.js} +7 -7
- package/dist/{chunk-JPD2CTC3.js.map → chunk-SDPWO2Z5.js.map} +1 -1
- package/dist/{chunk-OVI7IXYX.js → chunk-SLGGT2XD.js} +3 -3
- package/dist/{chunk-OVI7IXYX.js.map → chunk-SLGGT2XD.js.map} +1 -1
- package/dist/{chunk-ROR5ZR6A.cjs → chunk-TIJUA4I6.cjs} +45 -45
- package/dist/{chunk-ROR5ZR6A.cjs.map → chunk-TIJUA4I6.cjs.map} +1 -1
- package/dist/{chunk-AOSSQDVO.cjs → chunk-TM54OBHX.cjs} +13 -13
- package/dist/{chunk-AOSSQDVO.cjs.map → chunk-TM54OBHX.cjs.map} +1 -1
- package/dist/{chunk-KF6K7TGH.js → chunk-TYEYRCXL.js} +766 -433
- package/dist/chunk-TYEYRCXL.js.map +1 -0
- package/dist/{chunk-Z2JCLZFJ.js → chunk-UKOVGCRN.js} +2151 -570
- package/dist/chunk-UKOVGCRN.js.map +1 -0
- package/dist/chunk-UYKDYE5D.cjs +12 -0
- package/dist/{chunk-CICO5GXD.cjs.map → chunk-UYKDYE5D.cjs.map} +1 -1
- package/dist/{chunk-S5TERQVW.js → chunk-VAAC7L57.js} +284 -66
- package/dist/chunk-VAAC7L57.js.map +1 -0
- package/dist/{chunk-7UOLHNWC.cjs → chunk-VKHXYVN7.cjs} +22 -33
- package/dist/chunk-VKHXYVN7.cjs.map +1 -0
- 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-YIURNGXI.js → chunk-VUQZNUHU.js} +22 -6
- package/dist/chunk-VUQZNUHU.js.map +1 -0
- package/dist/{chunk-YYUHLYM2.cjs → chunk-WDM5WQK4.cjs} +183 -143
- package/dist/chunk-WDM5WQK4.cjs.map +1 -0
- package/dist/{chunk-ZFMCDJGB.js → chunk-WFSYYU4W.js} +70 -220
- package/dist/chunk-WFSYYU4W.js.map +1 -0
- package/dist/{chunk-SR725PWF.cjs → chunk-WRBV2FNH.cjs} +2065 -1659
- package/dist/chunk-WRBV2FNH.cjs.map +1 -0
- package/dist/{chunk-MRDBBHIZ.cjs → chunk-X4GDXBOP.cjs} +2 -2
- package/dist/chunk-X4GDXBOP.cjs.map +1 -0
- package/dist/chunk-XORONCV3.js +202 -0
- package/dist/chunk-XORONCV3.js.map +1 -0
- package/dist/{chunk-D5R42W5D.js → chunk-XZW2CTNO.js} +115 -12
- package/dist/chunk-XZW2CTNO.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-2TYSSBU5.js → chunk-YT2IVFAI.js} +30 -21
- package/dist/chunk-YT2IVFAI.js.map +1 -0
- package/dist/chunk-ZGVTNKTX.cjs +217 -0
- package/dist/chunk-ZGVTNKTX.cjs.map +1 -0
- 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-BvcbgzHo.d.ts} +3 -3
- package/dist/{ddl-BL1NZLMY.d.cts → ddl-Ufebz5q5.d.cts} +3 -3
- package/dist/graph-extension/index.cjs +21 -20
- package/dist/graph-extension/index.d.cts +2 -4
- package/dist/graph-extension/index.d.ts +2 -4
- package/dist/graph-extension/index.js +5 -4
- package/dist/graph-merge/index.cjs +324 -307
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +8 -9
- package/dist/graph-merge/index.d.ts +8 -9
- package/dist/graph-merge/index.js +51 -34
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/index.cjs +224 -222
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -12
- package/dist/index.d.ts +11 -12
- package/dist/index.js +38 -36
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +15 -13
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/indexes/index.js +8 -6
- package/dist/{ingestion-import-target-dNeL7iAv.d.ts → ingestion-import-target-CAs1OX-l.d.cts} +1 -1
- package/dist/{ingestion-import-target-XPxZYw89.d.cts → ingestion-import-target-DCQSPfNx.d.ts} +1 -1
- package/dist/interchange/index.cjs +57 -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 +21 -18
- package/dist/interchange/index.js.map +1 -1
- package/dist/local-store-impl-6DDTFM32.cjs +77 -0
- package/dist/local-store-impl-6DDTFM32.cjs.map +1 -0
- package/dist/local-store-impl-OXTOVU2J.js +75 -0
- package/dist/local-store-impl-OXTOVU2J.js.map +1 -0
- package/dist/{manager-CYaff3n3.d.cts → manager-B68OrPR2.d.ts} +29 -2
- package/dist/{manager-D9eRT_ns.d.ts → manager-D_t7oK69.d.cts} +29 -2
- package/dist/pglite-store-impl-6EMZGL7K.js +73 -0
- package/dist/pglite-store-impl-6EMZGL7K.js.map +1 -0
- package/dist/pglite-store-impl-GJG3Y7RP.cjs +75 -0
- package/dist/pglite-store-impl-GJG3Y7RP.cjs.map +1 -0
- package/dist/{postgres-CcL4bAHS.d.ts → postgres-BPLSVyHM.d.ts} +279 -2
- package/dist/{postgres-DMj39MEu.d.cts → postgres-CqvtFC2y.d.cts} +279 -2
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +59 -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 +28 -13
- package/dist/provenance/index.js.map +1 -1
- package/dist/{repair-validity-windows-BFNZvd_H.d.cts → repair-validity-windows-DEzCKAdy.d.cts} +7 -3
- package/dist/{repair-validity-windows-DlUSqwCg.d.ts → repair-validity-windows-GMdaS2AH.d.ts} +7 -3
- package/dist/resolve-D_H8MHtq.d.ts +1805 -0
- package/dist/resolve-WEW8gWws.d.cts +1805 -0
- package/dist/schema/index.cjs +48 -46
- package/dist/schema/index.d.cts +4 -6
- package/dist/schema/index.d.ts +4 -6
- package/dist/schema/index.js +21 -19
- package/dist/{searchable-bpE1bBfc.d.ts → searchable-C_UREI9K.d.ts} +1 -1
- package/dist/{searchable-DHJMh_nj.d.cts → searchable-ClgET_i7.d.cts} +1 -1
- package/dist/{sqlite-YppHrNFb.d.cts → sqlite-D1mXO9Kp.d.cts} +310 -2
- package/dist/{sqlite-D7Oz0SQh.d.ts → sqlite-MZA3oZNB.d.ts} +310 -2
- package/dist/{store-bphCSo7z.d.cts → store-CuFX7fCx.d.cts} +117 -31
- package/dist/{store-DRrFCx5x.d.ts → store-D-ZjXQpW.d.ts} +117 -31
- package/dist/{temporal-CbnLzTmM.d.ts → temporal-CpyEiRY8.d.cts} +1 -1
- package/dist/{temporal-5GqpYCk2.d.cts → temporal-y0Aep9Su.d.ts} +1 -1
- package/dist/{types-BqFZTQmV.d.cts → types-6yf0Vv-_.d.cts} +2016 -94
- package/dist/{types-BqFZTQmV.d.ts → types-6yf0Vv-_.d.ts} +2016 -94
- package/dist/{types-Bx74kaTt.d.ts → types-DzJ4dlzk.d.cts} +1 -1
- package/dist/{types-CXAhpW-c.d.cts → types-_vVSB9k-.d.ts} +1 -1
- package/dist/{where-O-k2wgYm.d.ts → where-DuG2LCLe.d.ts} +1 -1
- package/dist/{where-DI_Fqz-X.d.cts → where-Mhf_yyKX.d.cts} +1 -1
- package/package.json +7 -2
- package/dist/chunk-26YKDNUD.cjs.map +0 -1
- package/dist/chunk-2TYSSBU5.js.map +0 -1
- package/dist/chunk-3DMMGT6S.js.map +0 -1
- package/dist/chunk-3FPR224C.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 +0 -3502
- package/dist/chunk-3QNZ5SAJ.cjs.map +0 -1
- package/dist/chunk-3U5ABFDW.cjs +0 -259
- package/dist/chunk-3U5ABFDW.cjs.map +0 -1
- package/dist/chunk-5K2BKEBD.js.map +0 -1
- package/dist/chunk-5PRKMB24.cjs +0 -124
- package/dist/chunk-5PRKMB24.cjs.map +0 -1
- package/dist/chunk-6LN7FIVU.js +0 -107
- package/dist/chunk-6LN7FIVU.js.map +0 -1
- package/dist/chunk-6SWPJEYN.js +0 -1126
- package/dist/chunk-6SWPJEYN.js.map +0 -1
- package/dist/chunk-7LZJNLA5.js.map +0 -1
- package/dist/chunk-7UOLHNWC.cjs.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-EDN4Y4ZG.cjs.map +0 -1
- package/dist/chunk-EZEEWCFJ.cjs.map +0 -1
- 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 +0 -1156
- 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-L3LQNR34.cjs +0 -1254
- package/dist/chunk-L3LQNR34.cjs.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-NACVVDWB.js.map +0 -1
- package/dist/chunk-NVY5CJFP.js +0 -244
- 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-UMGZDVOA.cjs.map +0 -1
- package/dist/chunk-WIC7DRXW.js.map +0 -1
- 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-ZDKTPBGV.js.map +0 -1
- package/dist/chunk-ZFMCDJGB.js.map +0 -1
- package/dist/chunk-ZLONH2UD.js.map +0 -1
- package/dist/index-COs_z6nV.d.cts +0 -1132
- package/dist/index-D7d1u2gr.d.ts +0 -1132
- package/dist/materialize-indexes-DJ3ykH59.d.ts +0 -266
- package/dist/materialize-indexes-DTtAnvfY.d.cts +0 -266
|
@@ -1,91 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
3
|
+
var chunkJQKMEKKW_cjs = require('./chunk-JQKMEKKW.cjs');
|
|
4
|
+
var chunkNLX5OWK7_cjs = require('./chunk-NLX5OWK7.cjs');
|
|
5
|
+
var chunkZGVTNKTX_cjs = require('./chunk-ZGVTNKTX.cjs');
|
|
6
|
+
var chunkNUQ2YFFH_cjs = require('./chunk-NUQ2YFFH.cjs');
|
|
7
|
+
var chunkCRZ56SZU_cjs = require('./chunk-CRZ56SZU.cjs');
|
|
8
|
+
var chunkM5MSP3BI_cjs = require('./chunk-M5MSP3BI.cjs');
|
|
9
|
+
var chunkJVA3KDEA_cjs = require('./chunk-JVA3KDEA.cjs');
|
|
10
|
+
var chunkH5IJSROF_cjs = require('./chunk-H5IJSROF.cjs');
|
|
11
|
+
var chunkRWUWTJQY_cjs = require('./chunk-RWUWTJQY.cjs');
|
|
12
|
+
var chunkX4GDXBOP_cjs = require('./chunk-X4GDXBOP.cjs');
|
|
10
13
|
var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
|
|
11
14
|
|
|
12
|
-
// src/errors/validation.ts
|
|
13
|
-
function zodIssuesToValidationIssues(error) {
|
|
14
|
-
return error.issues.map((issue) => ({
|
|
15
|
-
path: issue.path.join("."),
|
|
16
|
-
message: issue.message,
|
|
17
|
-
code: issue.code
|
|
18
|
-
}));
|
|
19
|
-
}
|
|
20
|
-
function buildLocationString(context) {
|
|
21
|
-
if (context.id) {
|
|
22
|
-
return `${context.kind}/${context.id}`;
|
|
23
|
-
}
|
|
24
|
-
return `new ${context.kind}`;
|
|
25
|
-
}
|
|
26
|
-
function validateProps(schema, props, context) {
|
|
27
|
-
const result = schema.safeParse(props);
|
|
28
|
-
if (result.success) {
|
|
29
|
-
return result.data;
|
|
30
|
-
}
|
|
31
|
-
const issues = zodIssuesToValidationIssues(result.error);
|
|
32
|
-
const location = buildLocationString(context);
|
|
33
|
-
throw new chunkMRDBBHIZ_cjs.ValidationError(
|
|
34
|
-
`Invalid ${context.entityType} props for ${location}: ${result.error.message}`,
|
|
35
|
-
{
|
|
36
|
-
entityType: context.entityType,
|
|
37
|
-
kind: context.kind,
|
|
38
|
-
operation: context.operation,
|
|
39
|
-
...context.id !== void 0 && { id: context.id },
|
|
40
|
-
issues
|
|
41
|
-
},
|
|
42
|
-
{ cause: result.error }
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
function validateNodeProps(schema, props, context) {
|
|
46
|
-
return validateProps(schema, props, {
|
|
47
|
-
entityType: "node",
|
|
48
|
-
...context
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function validateEdgeProps(schema, props, context) {
|
|
52
|
-
return validateProps(schema, props, {
|
|
53
|
-
entityType: "edge",
|
|
54
|
-
...context
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function wrapZodError(error, context) {
|
|
58
|
-
const issues = zodIssuesToValidationIssues(error);
|
|
59
|
-
const location = buildLocationString(context);
|
|
60
|
-
return new chunkMRDBBHIZ_cjs.ValidationError(
|
|
61
|
-
`Validation failed for ${context.entityType} ${location}: ${error.message}`,
|
|
62
|
-
{
|
|
63
|
-
entityType: context.entityType,
|
|
64
|
-
kind: context.kind,
|
|
65
|
-
operation: context.operation,
|
|
66
|
-
...context.id !== void 0 && { id: context.id },
|
|
67
|
-
issues
|
|
68
|
-
},
|
|
69
|
-
{ cause: error }
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
function createValidationError(message, issues, context) {
|
|
73
|
-
return new chunkMRDBBHIZ_cjs.ValidationError(message, {
|
|
74
|
-
...context?.entityType !== void 0 && {
|
|
75
|
-
entityType: context.entityType
|
|
76
|
-
},
|
|
77
|
-
...context?.kind !== void 0 && { kind: context.kind },
|
|
78
|
-
...context?.operation !== void 0 && { operation: context.operation },
|
|
79
|
-
...context?.id !== void 0 && { id: context.id },
|
|
80
|
-
issues
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
15
|
// src/identity/row-codec.ts
|
|
85
16
|
function toCanonicalIdentityTimestamp(value) {
|
|
86
|
-
const canonical =
|
|
17
|
+
const canonical = chunkM5MSP3BI_cjs.canonicalizeDatabaseTimestamp(value);
|
|
87
18
|
if (canonical === void 0) {
|
|
88
|
-
throw new
|
|
19
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
89
20
|
"Identity relation returned a timestamp that is not a representable instant.",
|
|
90
21
|
{ value },
|
|
91
22
|
{
|
|
@@ -130,11 +61,11 @@ function toTransferAssertion(row) {
|
|
|
130
61
|
|
|
131
62
|
// src/identity/reference.ts
|
|
132
63
|
function identityReferenceKey(ref) {
|
|
133
|
-
return
|
|
64
|
+
return chunkCRZ56SZU_cjs.encodeTupleKey([ref.kind, ref.id]);
|
|
134
65
|
}
|
|
135
66
|
function compareIdentityReferences(left, right) {
|
|
136
|
-
const kindOrder =
|
|
137
|
-
return kindOrder === 0 ?
|
|
67
|
+
const kindOrder = chunkRWUWTJQY_cjs.compareCodePoints(left.kind, right.kind);
|
|
68
|
+
return kindOrder === 0 ? chunkRWUWTJQY_cjs.compareCodePoints(left.id, right.id) : kindOrder;
|
|
138
69
|
}
|
|
139
70
|
function normalizeIdentityPair(first, second) {
|
|
140
71
|
return compareIdentityReferences(first, second) <= 0 ? [first, second] : [second, first];
|
|
@@ -169,12 +100,12 @@ function spanningDifferentAssertion(assertions, first, second) {
|
|
|
169
100
|
// src/identity/sql-target.ts
|
|
170
101
|
var MAX_REFERENCE_CHUNK_SIZE = 200;
|
|
171
102
|
function identityChunkSize(target, input) {
|
|
172
|
-
const parameterLimit =
|
|
103
|
+
const parameterLimit = chunkJQKMEKKW_cjs.recordedBindParamBudget(target);
|
|
173
104
|
const chunkSize = Math.floor(
|
|
174
105
|
(parameterLimit - input.fixedParameters) / input.parametersPerItem
|
|
175
106
|
);
|
|
176
107
|
if (chunkSize < 1) {
|
|
177
|
-
throw new
|
|
108
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
178
109
|
"Operational Identity cannot fit this statement within the backend bind-parameter limit.",
|
|
179
110
|
{
|
|
180
111
|
code: "IDENTITY_BIND_BUDGET_TOO_SMALL",
|
|
@@ -188,7 +119,7 @@ function identityChunkSize(target, input) {
|
|
|
188
119
|
}
|
|
189
120
|
function requireStatementTarget(target) {
|
|
190
121
|
if (target.executeStatement === void 0) {
|
|
191
|
-
throw new
|
|
122
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
192
123
|
"Operational Identity requires statement execution support.",
|
|
193
124
|
{ code: "IDENTITY_REQUIRES_STATEMENT_EXECUTION" },
|
|
194
125
|
{
|
|
@@ -198,7 +129,7 @@ function requireStatementTarget(target) {
|
|
|
198
129
|
}
|
|
199
130
|
}
|
|
200
131
|
function identityWriterSlotError(cause) {
|
|
201
|
-
return new
|
|
132
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
202
133
|
"Operational Identity could not take the SQLite writer slot: this transaction was begun DEFERRED and another connection committed before the identity write, so its read snapshot is stale.",
|
|
203
134
|
{
|
|
204
135
|
code: "IDENTITY_TRANSACTION_NOT_WRITE_FENCED",
|
|
@@ -213,9 +144,9 @@ function identityWriterSlotError(cause) {
|
|
|
213
144
|
async function executeIdentityStatement(target, statement) {
|
|
214
145
|
requireStatementTarget(target);
|
|
215
146
|
try {
|
|
216
|
-
await target.executeStatement(
|
|
147
|
+
await target.executeStatement(chunkH5IJSROF_cjs.asCompiledStatementSql(statement));
|
|
217
148
|
} catch (error) {
|
|
218
|
-
if (!
|
|
149
|
+
if (!chunkNLX5OWK7_cjs.isSqliteStaleSnapshotError(error)) throw error;
|
|
219
150
|
throw identityWriterSlotError(error);
|
|
220
151
|
}
|
|
221
152
|
}
|
|
@@ -229,7 +160,7 @@ function plainRef(ref) {
|
|
|
229
160
|
function registeredPlainRef(ctx, ref) {
|
|
230
161
|
const result = plainRef(ref);
|
|
231
162
|
if (!ctx.registry.nodeKinds.has(result.kind)) {
|
|
232
|
-
throw new
|
|
163
|
+
throw new chunkX4GDXBOP_cjs.KindNotFoundError(result.kind, "node", {
|
|
233
164
|
graphId: ctx.graphId
|
|
234
165
|
});
|
|
235
166
|
}
|
|
@@ -248,7 +179,7 @@ function normalizePair(first, second) {
|
|
|
248
179
|
return normalizeIdentityPair(first, second);
|
|
249
180
|
}
|
|
250
181
|
function clampValidTo(timestamp, validFrom) {
|
|
251
|
-
return
|
|
182
|
+
return chunkRWUWTJQY_cjs.compareCodePoints(timestamp, validFrom) < 0 ? validFrom : timestamp;
|
|
252
183
|
}
|
|
253
184
|
function publicAssertion(row) {
|
|
254
185
|
return {
|
|
@@ -267,28 +198,50 @@ function publicNodeRef(ref) {
|
|
|
267
198
|
return ref;
|
|
268
199
|
}
|
|
269
200
|
async function lockIdentityGraph(target, graphId) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
201
|
+
const plan = chunkNUQ2YFFH_cjs.resolveWriteFencePlan(target);
|
|
202
|
+
const fence = chunkNUQ2YFFH_cjs.requireWriteFence(plan, "identity graph lock", "advisory-lock");
|
|
203
|
+
switch (fence.kind) {
|
|
204
|
+
case "lock": {
|
|
205
|
+
await target.execute(
|
|
206
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
207
|
+
SELECT pg_advisory_xact_lock(
|
|
208
|
+
hashtext('typegraph:identity'),
|
|
209
|
+
hashtext(${graphId})
|
|
210
|
+
)
|
|
211
|
+
`)
|
|
212
|
+
);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
case "engine-serialized": {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
279
219
|
}
|
|
280
220
|
async function lockIdentityEnablementNodes(target, schema) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
221
|
+
const plan = chunkNUQ2YFFH_cjs.resolveWriteFencePlan(target);
|
|
222
|
+
const fence = chunkNUQ2YFFH_cjs.requireWriteFence(
|
|
223
|
+
plan,
|
|
224
|
+
"identity enablement drain",
|
|
225
|
+
"table-lock"
|
|
226
|
+
);
|
|
227
|
+
switch (fence.kind) {
|
|
228
|
+
case "lock": {
|
|
229
|
+
await executeIdentityStatement(
|
|
230
|
+
target,
|
|
231
|
+
chunkH5IJSROF_cjs.sql`LOCK TABLE ${schema.nodesTable} IN SHARE MODE`
|
|
232
|
+
);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
case "engine-serialized": {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
286
239
|
}
|
|
287
240
|
async function loadNodeSnapshot(target, schema, graphId, coordinate) {
|
|
288
|
-
const sqlCoordinate =
|
|
241
|
+
const sqlCoordinate = chunkJQKMEKKW_cjs.identitySqlCoordinate(coordinate, chunkM5MSP3BI_cjs.nowIso());
|
|
289
242
|
const rows = await target.execute(
|
|
290
|
-
|
|
291
|
-
|
|
243
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(
|
|
244
|
+
chunkJQKMEKKW_cjs.identityNodeSnapshotSource(schema, graphId, sqlCoordinate)
|
|
292
245
|
)
|
|
293
246
|
);
|
|
294
247
|
return rows.map((row) => ({
|
|
@@ -314,7 +267,7 @@ async function loadCurrentStructuralClasses(target, schema, graphId, references)
|
|
|
314
267
|
});
|
|
315
268
|
if (uniqueReferences.length > chunkSize) {
|
|
316
269
|
const combined = /* @__PURE__ */ new Map();
|
|
317
|
-
for (const refChunk of
|
|
270
|
+
for (const refChunk of chunkNLX5OWK7_cjs.chunk(uniqueReferences, chunkSize)) {
|
|
318
271
|
const classes2 = await loadCurrentStructuralClasses(
|
|
319
272
|
target,
|
|
320
273
|
schema,
|
|
@@ -325,12 +278,12 @@ async function loadCurrentStructuralClasses(target, schema, graphId, references)
|
|
|
325
278
|
}
|
|
326
279
|
return combined;
|
|
327
280
|
}
|
|
328
|
-
const seedRows =
|
|
329
|
-
uniqueReferences.map((ref) =>
|
|
330
|
-
|
|
281
|
+
const seedRows = chunkH5IJSROF_cjs.sql.join(
|
|
282
|
+
uniqueReferences.map((ref) => chunkH5IJSROF_cjs.sql`(${ref.kind}, ${ref.id})`),
|
|
283
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
331
284
|
);
|
|
332
285
|
const rows = await target.execute(
|
|
333
|
-
|
|
286
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
334
287
|
WITH seeds(seed_kind, seed_id) AS (
|
|
335
288
|
VALUES ${seedRows}
|
|
336
289
|
), anchors AS (
|
|
@@ -368,10 +321,10 @@ async function loadCurrentStructuralClasses(target, schema, graphId, references)
|
|
|
368
321
|
);
|
|
369
322
|
}
|
|
370
323
|
async function loadCurrentVisibleMembers(target, schema, graphId, ref) {
|
|
371
|
-
const now =
|
|
372
|
-
const coordinate =
|
|
324
|
+
const now = chunkM5MSP3BI_cjs.nowIso();
|
|
325
|
+
const coordinate = chunkJQKMEKKW_cjs.identitySqlCoordinate(void 0, now);
|
|
373
326
|
const rows = await target.execute(
|
|
374
|
-
|
|
327
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
375
328
|
WITH anchor AS (
|
|
376
329
|
SELECT class_kind, class_id
|
|
377
330
|
FROM ${schema.identityClosureTable}
|
|
@@ -395,7 +348,7 @@ async function loadCurrentVisibleMembers(target, schema, graphId, ref) {
|
|
|
395
348
|
WHERE n.graph_id = ${graphId}
|
|
396
349
|
AND n.kind = m.kind
|
|
397
350
|
AND n.id = m.id
|
|
398
|
-
AND ${
|
|
351
|
+
AND ${chunkJQKMEKKW_cjs.identityNodeVisibilitySql(coordinate, "n")}
|
|
399
352
|
`)
|
|
400
353
|
);
|
|
401
354
|
const members = rows.map((row) => ({ kind: row.kind, id: row.id })).toSorted((left, right) => compareReferences(left, right));
|
|
@@ -430,7 +383,7 @@ async function loadHistoricalClasses(target, schema, graphId, references, coordi
|
|
|
430
383
|
});
|
|
431
384
|
if (uniqueReferences.length > chunkSize) {
|
|
432
385
|
const combined = /* @__PURE__ */ new Map();
|
|
433
|
-
for (const refChunk of
|
|
386
|
+
for (const refChunk of chunkNLX5OWK7_cjs.chunk(uniqueReferences, chunkSize)) {
|
|
434
387
|
const classes = await loadHistoricalClasses(
|
|
435
388
|
target,
|
|
436
389
|
schema,
|
|
@@ -443,26 +396,27 @@ async function loadHistoricalClasses(target, schema, graphId, references, coordi
|
|
|
443
396
|
}
|
|
444
397
|
return combined;
|
|
445
398
|
}
|
|
446
|
-
const currentInstant =
|
|
447
|
-
const sqlCoordinate =
|
|
448
|
-
const seeds =
|
|
449
|
-
uniqueReferences.map((ref) =>
|
|
450
|
-
|
|
399
|
+
const currentInstant = chunkM5MSP3BI_cjs.nowIso();
|
|
400
|
+
const sqlCoordinate = chunkJQKMEKKW_cjs.identitySqlCoordinate(coordinate, currentInstant);
|
|
401
|
+
const seeds = chunkH5IJSROF_cjs.sql.join(
|
|
402
|
+
uniqueReferences.map((ref) => chunkH5IJSROF_cjs.sql`(${ref.kind}, ${ref.id})`),
|
|
403
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
451
404
|
);
|
|
452
|
-
const reconstruction =
|
|
405
|
+
const reconstruction = chunkJQKMEKKW_cjs.historicalIdentityReconstructionCtes({
|
|
453
406
|
schema,
|
|
454
407
|
graphId,
|
|
455
408
|
coordinate: sqlCoordinate,
|
|
456
|
-
seedSource:
|
|
457
|
-
sameIdAcrossKinds
|
|
409
|
+
seedSource: chunkH5IJSROF_cjs.sql`VALUES ${seeds}`,
|
|
410
|
+
sameIdAcrossKinds,
|
|
411
|
+
recursiveTraversal: chunkZGVTNKTX_cjs.resolveRecursiveTraversal(target.capabilities)
|
|
458
412
|
});
|
|
459
413
|
const rows = await target.execute(
|
|
460
|
-
|
|
414
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
461
415
|
WITH RECURSIVE
|
|
462
416
|
${reconstruction}
|
|
463
417
|
SELECT member.seed_kind, member.seed_id,
|
|
464
418
|
member.kind AS member_kind, member.id AS member_id,
|
|
465
|
-
CASE WHEN ${
|
|
419
|
+
CASE WHEN ${chunkJQKMEKKW_cjs.identityNodeVisibilitySql(sqlCoordinate, "n")}
|
|
466
420
|
THEN 1 ELSE 0 END AS is_visible
|
|
467
421
|
FROM identity_members member
|
|
468
422
|
JOIN node_snapshot n ON n.kind = member.kind AND n.id = member.id
|
|
@@ -513,24 +467,24 @@ function visibleMembersAtCoordinate(ctx, ref) {
|
|
|
513
467
|
);
|
|
514
468
|
}
|
|
515
469
|
async function loadAssertions(target, schema, graphId, coordinate, currentInstant) {
|
|
516
|
-
const source =
|
|
470
|
+
const source = chunkJQKMEKKW_cjs.identityAssertionSnapshotSource(
|
|
517
471
|
schema,
|
|
518
472
|
graphId,
|
|
519
|
-
|
|
473
|
+
chunkJQKMEKKW_cjs.identitySqlCoordinate(coordinate, currentInstant),
|
|
520
474
|
void 0
|
|
521
475
|
);
|
|
522
476
|
const rows = await target.execute(
|
|
523
|
-
|
|
477
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(source)
|
|
524
478
|
);
|
|
525
479
|
return rows.map((row) => normalizeIdentityAssertionRow(row));
|
|
526
480
|
}
|
|
527
481
|
function referenceCondition(kindColumn, idColumn, references) {
|
|
528
|
-
if (references.length === 0) return
|
|
529
|
-
return
|
|
482
|
+
if (references.length === 0) return chunkH5IJSROF_cjs.sql`1 = 0`;
|
|
483
|
+
return chunkH5IJSROF_cjs.sql`(${chunkH5IJSROF_cjs.sql.join(
|
|
530
484
|
references.map(
|
|
531
|
-
(ref) =>
|
|
485
|
+
(ref) => chunkH5IJSROF_cjs.sql`(${kindColumn} = ${ref.kind} AND ${idColumn} = ${ref.id})`
|
|
532
486
|
),
|
|
533
|
-
|
|
487
|
+
chunkH5IJSROF_cjs.sql` OR `
|
|
534
488
|
)})`;
|
|
535
489
|
}
|
|
536
490
|
async function loadAssertionsTouching(target, schema, graphId, references, coordinate, relation) {
|
|
@@ -542,7 +496,7 @@ async function loadAssertionsTouching(target, schema, graphId, references, coord
|
|
|
542
496
|
});
|
|
543
497
|
if (references.length > chunkSize) {
|
|
544
498
|
const byId = /* @__PURE__ */ new Map();
|
|
545
|
-
for (const refChunk of
|
|
499
|
+
for (const refChunk of chunkNLX5OWK7_cjs.chunk(references, chunkSize)) {
|
|
546
500
|
const assertions = await loadAssertionsTouching(
|
|
547
501
|
target,
|
|
548
502
|
schema,
|
|
@@ -555,25 +509,25 @@ async function loadAssertionsTouching(target, schema, graphId, references, coord
|
|
|
555
509
|
}
|
|
556
510
|
return [...byId.values()];
|
|
557
511
|
}
|
|
558
|
-
const source =
|
|
512
|
+
const source = chunkJQKMEKKW_cjs.identityAssertionSnapshotSource(
|
|
559
513
|
schema,
|
|
560
514
|
graphId,
|
|
561
|
-
|
|
515
|
+
chunkJQKMEKKW_cjs.identitySqlCoordinate(coordinate, chunkM5MSP3BI_cjs.nowIso()),
|
|
562
516
|
relation
|
|
563
517
|
);
|
|
564
518
|
const aMatches = referenceCondition(
|
|
565
|
-
|
|
566
|
-
|
|
519
|
+
chunkH5IJSROF_cjs.sql`identity_assertions.a_kind`,
|
|
520
|
+
chunkH5IJSROF_cjs.sql`identity_assertions.a_id`,
|
|
567
521
|
references
|
|
568
522
|
);
|
|
569
523
|
const bMatches = referenceCondition(
|
|
570
|
-
|
|
571
|
-
|
|
524
|
+
chunkH5IJSROF_cjs.sql`identity_assertions.b_kind`,
|
|
525
|
+
chunkH5IJSROF_cjs.sql`identity_assertions.b_id`,
|
|
572
526
|
references
|
|
573
527
|
);
|
|
574
528
|
const rows = await target.execute(
|
|
575
|
-
|
|
576
|
-
SELECT ${
|
|
529
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
530
|
+
SELECT ${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
577
531
|
FROM (${source}) identity_assertions
|
|
578
532
|
WHERE ${aMatches} OR ${bMatches}
|
|
579
533
|
`)
|
|
@@ -594,11 +548,11 @@ async function loadSpanningDifferentAssertion(target, schema, graphId, firstClas
|
|
|
594
548
|
|
|
595
549
|
// src/identity/interchange-read.ts
|
|
596
550
|
function codePointOrderedAssertionId(target) {
|
|
597
|
-
return
|
|
551
|
+
return chunkJVA3KDEA_cjs.getDialect(target.dialect).binaryText(chunkH5IJSROF_cjs.sql`identity_assertions.id`);
|
|
598
552
|
}
|
|
599
553
|
async function readIdentityAssertionPageAtTarget(ctx, target, mode, options) {
|
|
600
554
|
if (!Number.isSafeInteger(options.limit) || options.limit <= 0) {
|
|
601
|
-
throw new
|
|
555
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
602
556
|
"Identity assertion page limit must be a positive safe integer.",
|
|
603
557
|
{ limit: options.limit }
|
|
604
558
|
);
|
|
@@ -610,17 +564,17 @@ async function readIdentityAssertionPageAtTarget(ctx, target, mode, options) {
|
|
|
610
564
|
parametersPerItem: 2
|
|
611
565
|
});
|
|
612
566
|
const filterKindsInMemory = nodeKinds !== void 0 && nodeKinds.length > kindFilterChunkSize;
|
|
613
|
-
const kindFilter = nodeKinds === void 0 ?
|
|
614
|
-
AND identity_assertions.a_kind IN (${
|
|
615
|
-
nodeKinds.map((kind) =>
|
|
616
|
-
|
|
567
|
+
const kindFilter = nodeKinds === void 0 ? chunkH5IJSROF_cjs.sql`` : nodeKinds.length === 0 ? chunkH5IJSROF_cjs.sql`AND 1 = 0` : filterKindsInMemory ? chunkH5IJSROF_cjs.sql`` : chunkH5IJSROF_cjs.sql`
|
|
568
|
+
AND identity_assertions.a_kind IN (${chunkH5IJSROF_cjs.sql.join(
|
|
569
|
+
nodeKinds.map((kind) => chunkH5IJSROF_cjs.sql`${kind}`),
|
|
570
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
617
571
|
)})
|
|
618
|
-
AND identity_assertions.b_kind IN (${
|
|
619
|
-
nodeKinds.map((kind) =>
|
|
620
|
-
|
|
572
|
+
AND identity_assertions.b_kind IN (${chunkH5IJSROF_cjs.sql.join(
|
|
573
|
+
nodeKinds.map((kind) => chunkH5IJSROF_cjs.sql`${kind}`),
|
|
574
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
621
575
|
)})
|
|
622
576
|
`;
|
|
623
|
-
const liveEndpointJoins = options.includeDeleted === false ?
|
|
577
|
+
const liveEndpointJoins = options.includeDeleted === false ? chunkH5IJSROF_cjs.sql`
|
|
624
578
|
JOIN ${ctx.schema.nodesTable} identity_a_node
|
|
625
579
|
ON identity_a_node.graph_id = identity_assertions.graph_id
|
|
626
580
|
AND identity_a_node.kind = identity_assertions.a_kind
|
|
@@ -631,10 +585,10 @@ async function readIdentityAssertionPageAtTarget(ctx, target, mode, options) {
|
|
|
631
585
|
AND identity_b_node.kind = identity_assertions.b_kind
|
|
632
586
|
AND identity_b_node.id = identity_assertions.b_id
|
|
633
587
|
AND identity_b_node.deleted_at IS NULL
|
|
634
|
-
` :
|
|
588
|
+
` : chunkH5IJSROF_cjs.sql``;
|
|
635
589
|
const assertionIdKey = codePointOrderedAssertionId(target);
|
|
636
590
|
const rows = await target.execute(
|
|
637
|
-
|
|
591
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
638
592
|
SELECT identity_assertions.graph_id AS graph_id,
|
|
639
593
|
identity_assertions.id AS id,
|
|
640
594
|
identity_assertions.rel AS rel,
|
|
@@ -653,8 +607,8 @@ async function readIdentityAssertionPageAtTarget(ctx, target, mode, options) {
|
|
|
653
607
|
${liveEndpointJoins}
|
|
654
608
|
WHERE identity_assertions.graph_id = ${ctx.graphId}
|
|
655
609
|
AND identity_assertions.deleted_at IS NULL
|
|
656
|
-
${options.after === void 0 ?
|
|
657
|
-
${mode === "state" ?
|
|
610
|
+
${options.after === void 0 ? chunkH5IJSROF_cjs.sql`` : chunkH5IJSROF_cjs.sql`AND ${assertionIdKey} > ${options.after}`}
|
|
611
|
+
${mode === "state" ? chunkH5IJSROF_cjs.sql`AND identity_assertions.valid_to IS NULL` : chunkH5IJSROF_cjs.sql``}
|
|
658
612
|
${kindFilter}
|
|
659
613
|
ORDER BY ${assertionIdKey} ASC
|
|
660
614
|
LIMIT ${options.limit}
|
|
@@ -679,123 +633,6 @@ async function readIdentityAssertionsForInterchange(ctx, mode, options) {
|
|
|
679
633
|
return page.assertions;
|
|
680
634
|
}
|
|
681
635
|
|
|
682
|
-
// src/store/operations/write-transaction.ts
|
|
683
|
-
var writeTransactionSessions = /* @__PURE__ */ new WeakMap();
|
|
684
|
-
function forceWriteTransactionRevision(target) {
|
|
685
|
-
const session = writeTransactionSessions.get(target);
|
|
686
|
-
if (session === void 0) return false;
|
|
687
|
-
session.wrote = true;
|
|
688
|
-
return true;
|
|
689
|
-
}
|
|
690
|
-
var heldGraphWriteLocks = /* @__PURE__ */ new WeakMap();
|
|
691
|
-
async function withWriteTransactionSession(target, ctx, fn) {
|
|
692
|
-
const session = {
|
|
693
|
-
lock: void 0,
|
|
694
|
-
wrote: false
|
|
695
|
-
};
|
|
696
|
-
writeTransactionSessions.set(target, session);
|
|
697
|
-
try {
|
|
698
|
-
const result = await fn();
|
|
699
|
-
if (session.wrote && ctx.revisionTrackingEnabled && !ctx.historyEnabled) {
|
|
700
|
-
await chunkEZEEWCFJ_cjs.advanceRevisionClock(target, ctx.revisionSchema, ctx.graphId, true);
|
|
701
|
-
}
|
|
702
|
-
return result;
|
|
703
|
-
} finally {
|
|
704
|
-
writeTransactionSessions.delete(target);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
async function lockSchemaVersionForStoreWrite(ctx, backend) {
|
|
708
|
-
const expectedVersion = ctx.schemaVersion;
|
|
709
|
-
if (expectedVersion === void 0) return;
|
|
710
|
-
if ("transaction" in backend && !backend.capabilities.transactions) {
|
|
711
|
-
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
712
|
-
"Schema-managed Store writes require a transactional backend so schema changes and entity writes can share one fence.",
|
|
713
|
-
{
|
|
714
|
-
code: "SCHEMA_WRITE_FENCE_UNSUPPORTED",
|
|
715
|
-
graphId: ctx.graphId
|
|
716
|
-
}
|
|
717
|
-
);
|
|
718
|
-
}
|
|
719
|
-
const lockSchemaVersionForWrite = backend.lockSchemaVersionForWrite;
|
|
720
|
-
if (lockSchemaVersionForWrite === void 0) {
|
|
721
|
-
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
722
|
-
"This backend cannot fence schema-managed Store writes against a concurrent schema change.",
|
|
723
|
-
{
|
|
724
|
-
code: "SCHEMA_WRITE_FENCE_UNSUPPORTED",
|
|
725
|
-
graphId: ctx.graphId
|
|
726
|
-
}
|
|
727
|
-
);
|
|
728
|
-
}
|
|
729
|
-
await lockSchemaVersionForWrite({
|
|
730
|
-
graphId: ctx.graphId,
|
|
731
|
-
expectedVersion
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
var CONSTRAINT_FENCE_ADVICE = {
|
|
735
|
-
edgeCardinality: 'declare the edge `cardinality: "many"` and enforce the limit in application code',
|
|
736
|
-
edgeMatchKeyConvergence: "use `create` with a caller-chosen id, whose uniqueness the edges primary key enforces, instead of `getOrCreateByEndpoints`",
|
|
737
|
-
nodeDisjointness: "drop the `disjointWith` axiom and keep ids distinct across those kinds yourself",
|
|
738
|
-
nodeUniquenessScope: 'scope the unique constraint to `"kind"`, which the uniques primary key enforces on its own'
|
|
739
|
-
};
|
|
740
|
-
function graphWriteFenceRefusal(ctx, backend, reason) {
|
|
741
|
-
if (!("transaction" in backend) || backend.capabilities.transactions) {
|
|
742
|
-
return void 0;
|
|
743
|
-
}
|
|
744
|
-
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
745
|
-
"This backend cannot fence a constrained write: enforcing a declared constraint requires a transaction to scope the per-graph write lock to, and this backend has no transactions.",
|
|
746
|
-
{
|
|
747
|
-
code: "CONSTRAINT_WRITE_FENCE_UNSUPPORTED",
|
|
748
|
-
graphId: ctx.graphId,
|
|
749
|
-
constraint: reason
|
|
750
|
-
},
|
|
751
|
-
{
|
|
752
|
-
suggestion: `Use a transactional backend, or ${CONSTRAINT_FENCE_ADVICE[reason]}. Unconstrained writes need no fence and keep working on this backend.`
|
|
753
|
-
}
|
|
754
|
-
);
|
|
755
|
-
}
|
|
756
|
-
function runInWriteTransaction(ctx, backend, fn, options) {
|
|
757
|
-
const ownsWriteLock = "transaction" in backend && backend.capabilities.transactions;
|
|
758
|
-
const fenceReason = options?.fencesConstraintProbe;
|
|
759
|
-
const refusal = fenceReason === void 0 ? void 0 : graphWriteFenceRefusal(ctx, backend, fenceReason);
|
|
760
|
-
if (refusal !== void 0) return Promise.reject(refusal);
|
|
761
|
-
const needsGraphWriteLock = ctx.historyEnabled || ctx.revisionTrackingEnabled || fenceReason !== void 0;
|
|
762
|
-
return chunk5PRKMB24_cjs.runOptionallyInTransaction(backend, async (target) => {
|
|
763
|
-
await lockSchemaVersionForStoreWrite(ctx, target);
|
|
764
|
-
const session = needsGraphWriteLock ? writeTransactionSessions.get(target) : void 0;
|
|
765
|
-
const held = heldGraphWriteLocks.get(target) ?? /* @__PURE__ */ new Set();
|
|
766
|
-
heldGraphWriteLocks.set(target, held);
|
|
767
|
-
const acquiresLock = needsGraphWriteLock && session?.lock === void 0 && !held.has(ctx.graphId);
|
|
768
|
-
if (acquiresLock) held.add(ctx.graphId);
|
|
769
|
-
const lock = acquiresLock ? await chunkEZEEWCFJ_cjs.lockRecordedGraphWrite(target, ctx.graphId).catch(
|
|
770
|
-
(error) => {
|
|
771
|
-
held.delete(ctx.graphId);
|
|
772
|
-
throw error;
|
|
773
|
-
}
|
|
774
|
-
) : session?.lock ?? chunkEZEEWCFJ_cjs.uncapturedGraphWriteLock();
|
|
775
|
-
if (session !== void 0) session.lock = lock;
|
|
776
|
-
const result = await (acquiresLock ? fn(target, lock).finally(() => held.delete(ctx.graphId)) : fn(target, lock));
|
|
777
|
-
if (session !== void 0) {
|
|
778
|
-
session.wrote ||= options?.didWrite?.(result) ?? true;
|
|
779
|
-
return result;
|
|
780
|
-
}
|
|
781
|
-
if (ctx.revisionTrackingEnabled && !ctx.historyEnabled && (options?.didWrite?.(result) ?? true)) {
|
|
782
|
-
await chunkEZEEWCFJ_cjs.advanceRevisionClock(
|
|
783
|
-
target,
|
|
784
|
-
ctx.revisionSchema,
|
|
785
|
-
ctx.graphId,
|
|
786
|
-
ownsWriteLock
|
|
787
|
-
);
|
|
788
|
-
}
|
|
789
|
-
return result;
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
|
-
function runHookedWriteOperation(ctx, opContext, backend, body, options) {
|
|
793
|
-
return ctx.withOperationHooks(
|
|
794
|
-
opContext,
|
|
795
|
-
() => runInWriteTransaction(ctx, backend, body, options)
|
|
796
|
-
);
|
|
797
|
-
}
|
|
798
|
-
|
|
799
636
|
// src/identity/service-components.ts
|
|
800
637
|
var UnionFind = class {
|
|
801
638
|
#parents = /* @__PURE__ */ new Map();
|
|
@@ -898,7 +735,7 @@ function identityActiveKinds(registry) {
|
|
|
898
735
|
return new Set(registry.nodeKinds.keys());
|
|
899
736
|
}
|
|
900
737
|
async function loadSnapshot(target, schema, graphId, coordinate, allowedKinds, sameIdAcrossKinds = "fold") {
|
|
901
|
-
const currentInstant =
|
|
738
|
+
const currentInstant = chunkM5MSP3BI_cjs.nowIso();
|
|
902
739
|
const [nodes, assertions] = await Promise.all([
|
|
903
740
|
loadNodeSnapshot(target, schema, graphId, coordinate),
|
|
904
741
|
loadAssertions(target, schema, graphId, coordinate, currentInstant)
|
|
@@ -982,7 +819,7 @@ function validateSnapshotIntegrity(snapshot, registry, graphId) {
|
|
|
982
819
|
const a = { kind: assertion.a_kind, id: assertion.a_id };
|
|
983
820
|
const b = { kind: assertion.b_kind, id: assertion.b_id };
|
|
984
821
|
if (!structuralKeys.has(refKey(a)) || !structuralKeys.has(refKey(b))) {
|
|
985
|
-
throw new
|
|
822
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
986
823
|
"Operational Identity contains a current assertion with a missing or deleted endpoint.",
|
|
987
824
|
{
|
|
988
825
|
code: "IDENTITY_SCHEMA_CONTRADICTION",
|
|
@@ -994,7 +831,7 @@ function validateSnapshotIntegrity(snapshot, registry, graphId) {
|
|
|
994
831
|
);
|
|
995
832
|
}
|
|
996
833
|
if (assertion.rel === "different" && sameComponent(snapshot, a, b)) {
|
|
997
|
-
throw new
|
|
834
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
998
835
|
"Operational Identity contains a different assertion within one identity class.",
|
|
999
836
|
{
|
|
1000
837
|
code: "IDENTITY_SCHEMA_CONTRADICTION",
|
|
@@ -1016,7 +853,7 @@ function validateSnapshotIntegrity(snapshot, registry, graphId) {
|
|
|
1016
853
|
component
|
|
1017
854
|
);
|
|
1018
855
|
if (conflictingKinds !== void 0) {
|
|
1019
|
-
throw new
|
|
856
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1020
857
|
"Operational Identity class conflicts with ontology disjointness.",
|
|
1021
858
|
{
|
|
1022
859
|
code: "IDENTITY_SCHEMA_CONTRADICTION",
|
|
@@ -1029,7 +866,7 @@ function validateSnapshotIntegrity(snapshot, registry, graphId) {
|
|
|
1029
866
|
}
|
|
1030
867
|
}
|
|
1031
868
|
function closureMismatchError(graphId, detail) {
|
|
1032
|
-
return new
|
|
869
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1033
870
|
"Operational Identity materialized closure does not match computed identity components.",
|
|
1034
871
|
{ code: "IDENTITY_SCHEMA_CONTRADICTION", graphId, ...detail },
|
|
1035
872
|
{
|
|
@@ -1050,7 +887,7 @@ async function assertClosureMatchesComponents(target, schema, graphId, component
|
|
|
1050
887
|
}
|
|
1051
888
|
}
|
|
1052
889
|
const rows = await target.execute(
|
|
1053
|
-
|
|
890
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1054
891
|
SELECT member_kind, member_id, class_kind, class_id
|
|
1055
892
|
FROM ${schema.identityClosureTable}
|
|
1056
893
|
WHERE graph_id = ${graphId}
|
|
@@ -1080,7 +917,7 @@ async function assertClosureMatchesComponents(target, schema, graphId, component
|
|
|
1080
917
|
}
|
|
1081
918
|
}
|
|
1082
919
|
function selfAssertionError(relation) {
|
|
1083
|
-
return new
|
|
920
|
+
return new chunkX4GDXBOP_cjs.ValidationError(
|
|
1084
921
|
`Identity ${relation} assertions require two distinct node references.`,
|
|
1085
922
|
{
|
|
1086
923
|
issues: [
|
|
@@ -1099,7 +936,7 @@ function selfAssertionError(relation) {
|
|
|
1099
936
|
async function requireLiveEndpoint(target, graphId, ref) {
|
|
1100
937
|
const row = await target.getNode(graphId, ref.kind, ref.id);
|
|
1101
938
|
if (row === void 0 || row.deleted_at !== void 0) {
|
|
1102
|
-
throw new
|
|
939
|
+
throw new chunkX4GDXBOP_cjs.NodeNotFoundError(ref.kind, ref.id);
|
|
1103
940
|
}
|
|
1104
941
|
}
|
|
1105
942
|
async function loadLiveReferences(target, schema, graphId, references) {
|
|
@@ -1111,15 +948,15 @@ async function loadLiveReferences(target, schema, graphId, references) {
|
|
|
1111
948
|
});
|
|
1112
949
|
if (references.length > chunkSize) {
|
|
1113
950
|
const byKey = /* @__PURE__ */ new Map();
|
|
1114
|
-
for (const refChunk of
|
|
951
|
+
for (const refChunk of chunkNLX5OWK7_cjs.chunk(references, chunkSize)) {
|
|
1115
952
|
const live = await loadLiveReferences(target, schema, graphId, refChunk);
|
|
1116
953
|
for (const ref of live) byKey.set(refKey(ref), ref);
|
|
1117
954
|
}
|
|
1118
955
|
return [...byKey.values()];
|
|
1119
956
|
}
|
|
1120
|
-
const matches = referenceCondition(
|
|
957
|
+
const matches = referenceCondition(chunkH5IJSROF_cjs.sql`kind`, chunkH5IJSROF_cjs.sql`id`, references);
|
|
1121
958
|
const rows = await target.execute(
|
|
1122
|
-
|
|
959
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1123
960
|
SELECT kind, id
|
|
1124
961
|
FROM ${schema.nodesTable}
|
|
1125
962
|
WHERE graph_id = ${graphId}
|
|
@@ -1135,7 +972,7 @@ async function requireLiveEndpoints(target, schema, graphId, references) {
|
|
|
1135
972
|
const live = await loadLiveReferences(target, schema, graphId, references);
|
|
1136
973
|
const liveKeys = new Set(live.map((ref) => refKey(ref)));
|
|
1137
974
|
for (const [key, ref] of uniqueByKey) {
|
|
1138
|
-
if (!liveKeys.has(key)) throw new
|
|
975
|
+
if (!liveKeys.has(key)) throw new chunkX4GDXBOP_cjs.NodeNotFoundError(ref.kind, ref.id);
|
|
1139
976
|
}
|
|
1140
977
|
}
|
|
1141
978
|
async function requireStructuralEndpoints(target, schema, graphId, references) {
|
|
@@ -1149,10 +986,10 @@ async function requireStructuralEndpoints(target, schema, graphId, references) {
|
|
|
1149
986
|
parametersPerItem: 2
|
|
1150
987
|
});
|
|
1151
988
|
const presentKeys = /* @__PURE__ */ new Set();
|
|
1152
|
-
for (const refChunk of
|
|
1153
|
-
const matches = referenceCondition(
|
|
989
|
+
for (const refChunk of chunkNLX5OWK7_cjs.chunk(unique, chunkSize)) {
|
|
990
|
+
const matches = referenceCondition(chunkH5IJSROF_cjs.sql`kind`, chunkH5IJSROF_cjs.sql`id`, refChunk);
|
|
1154
991
|
const rows = await target.execute(
|
|
1155
|
-
|
|
992
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1156
993
|
SELECT kind, id
|
|
1157
994
|
FROM ${schema.nodesTable}
|
|
1158
995
|
WHERE graph_id = ${graphId}
|
|
@@ -1164,21 +1001,21 @@ async function requireStructuralEndpoints(target, schema, graphId, references) {
|
|
|
1164
1001
|
}
|
|
1165
1002
|
}
|
|
1166
1003
|
for (const [key, ref] of uniqueByKey) {
|
|
1167
|
-
if (!presentKeys.has(key)) throw new
|
|
1004
|
+
if (!presentKeys.has(key)) throw new chunkX4GDXBOP_cjs.NodeNotFoundError(ref.kind, ref.id);
|
|
1168
1005
|
}
|
|
1169
1006
|
}
|
|
1170
1007
|
|
|
1171
1008
|
// src/identity/separation.ts
|
|
1172
1009
|
var MAX_SEPARATION_INSERT_CHUNK_SIZE = 100;
|
|
1173
1010
|
function identityClassKey(ref) {
|
|
1174
|
-
return
|
|
1011
|
+
return chunkCRZ56SZU_cjs.encodeTupleKey([ref.kind, ref.id]);
|
|
1175
1012
|
}
|
|
1176
1013
|
var PAIR_KEY_SEPARATOR = "\0";
|
|
1177
1014
|
function pairKey(pair) {
|
|
1178
1015
|
return `${pair.low}${PAIR_KEY_SEPARATOR}${pair.high}`;
|
|
1179
1016
|
}
|
|
1180
1017
|
function orderedPair(first, second) {
|
|
1181
|
-
return
|
|
1018
|
+
return chunkRWUWTJQY_cjs.compareCodePoints(first, second) <= 0 ? { low: first, high: second } : { low: second, high: first };
|
|
1182
1019
|
}
|
|
1183
1020
|
function buildSeparationProjection(assertions, classKeyOf) {
|
|
1184
1021
|
const pairs = /* @__PURE__ */ new Map();
|
|
@@ -1203,7 +1040,7 @@ function buildSeparationProjection(assertions, classKeyOf) {
|
|
|
1203
1040
|
async function deleteSeparationForGraph(target, schema, graphId) {
|
|
1204
1041
|
await executeIdentityStatement(
|
|
1205
1042
|
target,
|
|
1206
|
-
|
|
1043
|
+
chunkH5IJSROF_cjs.sql`DELETE FROM ${schema.identitySeparationTable} WHERE graph_id = ${graphId}`
|
|
1207
1044
|
);
|
|
1208
1045
|
}
|
|
1209
1046
|
async function deleteSeparationForClassKeys(target, schema, graphId, classKeys) {
|
|
@@ -1214,14 +1051,14 @@ async function deleteSeparationForClassKeys(target, schema, graphId, classKeys)
|
|
|
1214
1051
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
1215
1052
|
parametersPerItem: 2
|
|
1216
1053
|
});
|
|
1217
|
-
for (const keyChunk of
|
|
1218
|
-
const keyList =
|
|
1219
|
-
keyChunk.map((key) =>
|
|
1220
|
-
|
|
1054
|
+
for (const keyChunk of chunkNLX5OWK7_cjs.chunk(unique, chunkSize)) {
|
|
1055
|
+
const keyList = chunkH5IJSROF_cjs.sql.join(
|
|
1056
|
+
keyChunk.map((key) => chunkH5IJSROF_cjs.sql`${key}`),
|
|
1057
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
1221
1058
|
);
|
|
1222
1059
|
await executeIdentityStatement(
|
|
1223
1060
|
target,
|
|
1224
|
-
|
|
1061
|
+
chunkH5IJSROF_cjs.sql`
|
|
1225
1062
|
DELETE FROM ${schema.identitySeparationTable}
|
|
1226
1063
|
WHERE graph_id = ${graphId}
|
|
1227
1064
|
AND (class_key_low IN (${keyList}) OR class_key_high IN (${keyList}))
|
|
@@ -1258,7 +1095,7 @@ function proveSeparationReadiness(registry, graphId) {
|
|
|
1258
1095
|
async function probeSeparationPair(target, schema, graphId, pair) {
|
|
1259
1096
|
try {
|
|
1260
1097
|
const rows = await target.execute(
|
|
1261
|
-
|
|
1098
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1262
1099
|
SELECT
|
|
1263
1100
|
(
|
|
1264
1101
|
SELECT COUNT(*) FROM ${schema.identitySeparationTable}
|
|
@@ -1281,7 +1118,7 @@ async function probeSeparationPair(target, schema, graphId, pair) {
|
|
|
1281
1118
|
pairSeparated: countOf(row, "pair_rows") > 0
|
|
1282
1119
|
};
|
|
1283
1120
|
} catch (error) {
|
|
1284
|
-
if (!
|
|
1121
|
+
if (!chunkNLX5OWK7_cjs.isMissingTableError(error)) throw error;
|
|
1285
1122
|
throw separationUnreadableError(graphId, schema, error);
|
|
1286
1123
|
}
|
|
1287
1124
|
}
|
|
@@ -1289,7 +1126,7 @@ function countOf(row, column) {
|
|
|
1289
1126
|
return Number(row?.[column] ?? 0);
|
|
1290
1127
|
}
|
|
1291
1128
|
function separationUnreadableError(graphId, schema, cause) {
|
|
1292
|
-
return new
|
|
1129
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1293
1130
|
"Operational Identity could not read the materialized separation relation.",
|
|
1294
1131
|
{
|
|
1295
1132
|
code: "IDENTITY_STORAGE_MISSING",
|
|
@@ -1303,7 +1140,7 @@ function separationUnreadableError(graphId, schema, cause) {
|
|
|
1303
1140
|
);
|
|
1304
1141
|
}
|
|
1305
1142
|
function separationUnfilledError(graphId, schema) {
|
|
1306
|
-
return new
|
|
1143
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1307
1144
|
"Operational Identity found the separation relation present but never filled for this graph.",
|
|
1308
1145
|
{
|
|
1309
1146
|
code: "IDENTITY_STORAGE_MISSING",
|
|
@@ -1329,7 +1166,7 @@ async function separationRebuildRequired(target, schema, graphId, options) {
|
|
|
1329
1166
|
}
|
|
1330
1167
|
async function hasSeparationRows(target, schema, graphId) {
|
|
1331
1168
|
const rows = await target.execute(
|
|
1332
|
-
|
|
1169
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1333
1170
|
SELECT 1 AS present
|
|
1334
1171
|
FROM ${schema.identitySeparationTable}
|
|
1335
1172
|
WHERE graph_id = ${graphId}
|
|
@@ -1342,7 +1179,7 @@ async function hasLiveDifferentAssertions(target, schema, graphId, registry) {
|
|
|
1342
1179
|
if (!await probeAnyLiveDifferent(target, schema, graphId)) return false;
|
|
1343
1180
|
const activeKinds = [...identityActiveKinds(registry)];
|
|
1344
1181
|
if (activeKinds.length === 0) return false;
|
|
1345
|
-
const kindChunks =
|
|
1182
|
+
const kindChunks = chunkNLX5OWK7_cjs.chunk(activeKinds, owedProbeChunkSize(target));
|
|
1346
1183
|
for (const first of kindChunks) {
|
|
1347
1184
|
for (const second of kindChunks) {
|
|
1348
1185
|
if (await probeOwedSeparation(target, schema, graphId, [first, second])) {
|
|
@@ -1356,7 +1193,7 @@ var IDENTITY_SNAPSHOT_PARAMETERS = 4;
|
|
|
1356
1193
|
var OWED_SEPARATION_PROBE_PARAMETERS = IDENTITY_SNAPSHOT_PARAMETERS + 2;
|
|
1357
1194
|
async function probeAnyLiveDifferent(target, schema, graphId) {
|
|
1358
1195
|
const rows = await target.execute(
|
|
1359
|
-
|
|
1196
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1360
1197
|
SELECT 1 AS present
|
|
1361
1198
|
FROM (${liveDifferentSource(schema, graphId)}) live_different
|
|
1362
1199
|
LIMIT 1
|
|
@@ -1366,7 +1203,7 @@ async function probeAnyLiveDifferent(target, schema, graphId) {
|
|
|
1366
1203
|
}
|
|
1367
1204
|
async function probeOwedSeparation(target, schema, graphId, kinds) {
|
|
1368
1205
|
const rows = await target.execute(
|
|
1369
|
-
|
|
1206
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1370
1207
|
SELECT 1 AS present
|
|
1371
1208
|
FROM (${liveDifferentSource(schema, graphId)}) live_different
|
|
1372
1209
|
LEFT JOIN ${schema.identityClosureTable} class_a
|
|
@@ -1398,22 +1235,22 @@ function owedProbeChunkSize(target) {
|
|
|
1398
1235
|
});
|
|
1399
1236
|
}
|
|
1400
1237
|
function liveDifferentSource(schema, graphId) {
|
|
1401
|
-
return
|
|
1238
|
+
return chunkJQKMEKKW_cjs.identityAssertionSnapshotSource(
|
|
1402
1239
|
schema,
|
|
1403
1240
|
graphId,
|
|
1404
|
-
|
|
1241
|
+
chunkJQKMEKKW_cjs.identitySqlCoordinate(void 0, chunkM5MSP3BI_cjs.nowIso()),
|
|
1405
1242
|
"different"
|
|
1406
1243
|
);
|
|
1407
1244
|
}
|
|
1408
1245
|
function kindList(kinds) {
|
|
1409
|
-
return
|
|
1410
|
-
kinds.map((kind) =>
|
|
1411
|
-
|
|
1246
|
+
return chunkH5IJSROF_cjs.sql.join(
|
|
1247
|
+
kinds.map((kind) => chunkH5IJSROF_cjs.sql`${kind}`),
|
|
1248
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
1412
1249
|
);
|
|
1413
1250
|
}
|
|
1414
1251
|
async function readSeparationForGraph(target, schema, graphId) {
|
|
1415
1252
|
const rows = await target.execute(
|
|
1416
|
-
|
|
1253
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1417
1254
|
SELECT class_key_low, class_key_high
|
|
1418
1255
|
FROM ${schema.identitySeparationTable}
|
|
1419
1256
|
WHERE graph_id = ${graphId}
|
|
@@ -1430,23 +1267,23 @@ async function insertSeparationRows(target, schema, graphId, projection) {
|
|
|
1430
1267
|
maxItems: MAX_SEPARATION_INSERT_CHUNK_SIZE,
|
|
1431
1268
|
parametersPerItem: 3
|
|
1432
1269
|
});
|
|
1433
|
-
for (const pairChunk of
|
|
1270
|
+
for (const pairChunk of chunkNLX5OWK7_cjs.chunk(projection.pairs, chunkSize)) {
|
|
1434
1271
|
const values = pairChunk.map(
|
|
1435
|
-
(pair) =>
|
|
1272
|
+
(pair) => chunkH5IJSROF_cjs.sql`(${graphId}, ${pair.low}, ${pair.high})`
|
|
1436
1273
|
);
|
|
1437
1274
|
try {
|
|
1438
1275
|
await executeIdentityStatement(
|
|
1439
1276
|
target,
|
|
1440
|
-
|
|
1277
|
+
chunkH5IJSROF_cjs.sql`
|
|
1441
1278
|
INSERT INTO ${schema.identitySeparationTable} (
|
|
1442
1279
|
graph_id, class_key_low, class_key_high
|
|
1443
|
-
) VALUES ${
|
|
1280
|
+
) VALUES ${chunkH5IJSROF_cjs.sql.join(values, chunkH5IJSROF_cjs.sql`, `)}
|
|
1444
1281
|
`
|
|
1445
1282
|
);
|
|
1446
1283
|
} catch (error) {
|
|
1447
1284
|
const collapsed = collapsedIn(projection, pairChunk);
|
|
1448
1285
|
if (collapsed === void 0) throw error;
|
|
1449
|
-
throw new
|
|
1286
|
+
throw new chunkX4GDXBOP_cjs.IdentitySeparationViolationError(
|
|
1450
1287
|
{ graphId, enforcedBy: "database", ...collapsed },
|
|
1451
1288
|
{ cause: error }
|
|
1452
1289
|
);
|
|
@@ -1454,7 +1291,7 @@ async function insertSeparationRows(target, schema, graphId, projection) {
|
|
|
1454
1291
|
}
|
|
1455
1292
|
const accepted = projection.collapsed[0];
|
|
1456
1293
|
if (accepted === void 0) return;
|
|
1457
|
-
throw new
|
|
1294
|
+
throw new chunkX4GDXBOP_cjs.IdentitySeparationViolationError({
|
|
1458
1295
|
graphId,
|
|
1459
1296
|
enforcedBy: "writer",
|
|
1460
1297
|
...accepted
|
|
@@ -1484,7 +1321,7 @@ function assertSeparationMatchesProjection(graphId, persisted, projection) {
|
|
|
1484
1321
|
}
|
|
1485
1322
|
}
|
|
1486
1323
|
function separationMismatchError(graphId, detail) {
|
|
1487
|
-
return new
|
|
1324
|
+
return new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
1488
1325
|
"Operational Identity materialized separation relation does not match the assertion ledger.",
|
|
1489
1326
|
{ code: "IDENTITY_SCHEMA_CONTRADICTION", graphId, ...detail },
|
|
1490
1327
|
{
|
|
@@ -1498,26 +1335,26 @@ function hasExplicitIdentityValidityWindow(window) {
|
|
|
1498
1335
|
return window?.validFrom !== void 0 || window?.validTo !== void 0;
|
|
1499
1336
|
}
|
|
1500
1337
|
function resolveIdentityValidityWindow(window, operationInstant) {
|
|
1501
|
-
const validFrom =
|
|
1502
|
-
const validTo =
|
|
1503
|
-
if (
|
|
1504
|
-
throw new
|
|
1338
|
+
const validFrom = chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(window?.validFrom, "validFrom") ?? operationInstant;
|
|
1339
|
+
const validTo = chunkM5MSP3BI_cjs.validateOptionalCanonicalIsoDate(window?.validTo, "validTo");
|
|
1340
|
+
if (chunkRWUWTJQY_cjs.compareCodePoints(validFrom, operationInstant) > 0) {
|
|
1341
|
+
throw new chunkX4GDXBOP_cjs.IdentityValidityWindowError({
|
|
1505
1342
|
reason: "future-valid-from",
|
|
1506
1343
|
validFrom,
|
|
1507
1344
|
...validTo === void 0 ? {} : { validTo },
|
|
1508
1345
|
operationInstant
|
|
1509
1346
|
});
|
|
1510
1347
|
}
|
|
1511
|
-
if (validTo !== void 0 &&
|
|
1512
|
-
throw new
|
|
1348
|
+
if (validTo !== void 0 && chunkRWUWTJQY_cjs.compareCodePoints(validTo, operationInstant) > 0) {
|
|
1349
|
+
throw new chunkX4GDXBOP_cjs.IdentityValidityWindowError({
|
|
1513
1350
|
reason: "future-valid-to",
|
|
1514
1351
|
validFrom,
|
|
1515
1352
|
validTo,
|
|
1516
1353
|
operationInstant
|
|
1517
1354
|
});
|
|
1518
1355
|
}
|
|
1519
|
-
if (validTo !== void 0 &&
|
|
1520
|
-
throw new
|
|
1356
|
+
if (validTo !== void 0 && chunkRWUWTJQY_cjs.compareCodePoints(validTo, validFrom) < 0) {
|
|
1357
|
+
throw new chunkX4GDXBOP_cjs.IdentityValidityWindowError({
|
|
1521
1358
|
reason: "inverted",
|
|
1522
1359
|
validFrom,
|
|
1523
1360
|
validTo,
|
|
@@ -1550,7 +1387,7 @@ async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
|
|
|
1550
1387
|
const bClass = chunkN66HCGCY_cjs.requireDefined(classes.get(refKey(b)));
|
|
1551
1388
|
if (relation === "different") {
|
|
1552
1389
|
if (!containsRef(aClass, b)) return;
|
|
1553
|
-
throw new
|
|
1390
|
+
throw new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
1554
1391
|
operation,
|
|
1555
1392
|
a,
|
|
1556
1393
|
b,
|
|
@@ -1569,7 +1406,7 @@ async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
|
|
|
1569
1406
|
);
|
|
1570
1407
|
if (different === void 0)
|
|
1571
1408
|
throw unexpectedSeparationError(ctx.graphId, aKey, bKey);
|
|
1572
|
-
throw new
|
|
1409
|
+
throw new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
1573
1410
|
operation,
|
|
1574
1411
|
a,
|
|
1575
1412
|
b,
|
|
@@ -1579,7 +1416,7 @@ async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
|
|
|
1579
1416
|
}
|
|
1580
1417
|
const disjointKinds = classHasDisjointKinds(ctx.registry, aClass, bClass);
|
|
1581
1418
|
if (disjointKinds === void 0) return;
|
|
1582
|
-
throw new
|
|
1419
|
+
throw new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
1583
1420
|
operation,
|
|
1584
1421
|
a,
|
|
1585
1422
|
b,
|
|
@@ -1589,8 +1426,8 @@ async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
|
|
|
1589
1426
|
}
|
|
1590
1427
|
async function currentAssertionForPair(target, schema, graphId, relation, a, b) {
|
|
1591
1428
|
const rows = await target.execute(
|
|
1592
|
-
|
|
1593
|
-
SELECT ${
|
|
1429
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1430
|
+
SELECT ${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
1594
1431
|
FROM ${schema.identityAssertionsTable}
|
|
1595
1432
|
WHERE graph_id = ${graphId}
|
|
1596
1433
|
AND rel = ${relation}
|
|
@@ -1606,10 +1443,10 @@ async function currentAssertionForPair(target, schema, graphId, relation, a, b)
|
|
|
1606
1443
|
return rows[0] === void 0 ? void 0 : normalizeIdentityAssertionRow(rows[0]);
|
|
1607
1444
|
}
|
|
1608
1445
|
async function assertionForExactWindow(target, schema, graphId, relation, a, b, window) {
|
|
1609
|
-
const validToMatch = window.validTo === void 0 ?
|
|
1446
|
+
const validToMatch = window.validTo === void 0 ? chunkH5IJSROF_cjs.sql`valid_to IS NULL` : chunkH5IJSROF_cjs.sql`valid_to = ${window.validTo}`;
|
|
1610
1447
|
const rows = await target.execute(
|
|
1611
|
-
|
|
1612
|
-
SELECT ${
|
|
1448
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1449
|
+
SELECT ${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
1613
1450
|
FROM ${schema.identityAssertionsTable}
|
|
1614
1451
|
WHERE graph_id = ${graphId}
|
|
1615
1452
|
AND rel = ${relation}
|
|
@@ -1641,7 +1478,7 @@ async function insertAssertion(target, schema, graphId, relation, a, b, operatio
|
|
|
1641
1478
|
function buildAssertionRow(graphId, relation, a, b, timestamp, options) {
|
|
1642
1479
|
return {
|
|
1643
1480
|
graph_id: graphId,
|
|
1644
|
-
id: options?.id ??
|
|
1481
|
+
id: options?.id ?? chunkJQKMEKKW_cjs.generateId(),
|
|
1645
1482
|
rel: relation,
|
|
1646
1483
|
a_kind: a.kind,
|
|
1647
1484
|
a_id: a.id,
|
|
@@ -1658,12 +1495,12 @@ function buildAssertionRow(graphId, relation, a, b, timestamp, options) {
|
|
|
1658
1495
|
}
|
|
1659
1496
|
function canonicalEndpointTimestamp(value) {
|
|
1660
1497
|
if (value === void 0 || value === null) return void 0;
|
|
1661
|
-
return
|
|
1498
|
+
return chunkM5MSP3BI_cjs.canonicalizeDatabaseTimestamp(value);
|
|
1662
1499
|
}
|
|
1663
1500
|
async function requireEndpointsCoverIdentityWindow(target, graphId, references, window) {
|
|
1664
1501
|
for (const ref of references) {
|
|
1665
1502
|
const row = await target.getNode(graphId, ref.kind, ref.id);
|
|
1666
|
-
if (row === void 0) throw new
|
|
1503
|
+
if (row === void 0) throw new chunkX4GDXBOP_cjs.NodeNotFoundError(ref.kind, ref.id);
|
|
1667
1504
|
if (window.effective === "empty") continue;
|
|
1668
1505
|
const validFrom = canonicalEndpointTimestamp(row.valid_from);
|
|
1669
1506
|
const validTo = canonicalEndpointTimestamp(row.valid_to);
|
|
@@ -1677,7 +1514,7 @@ async function requireEndpointsCoverIdentityWindow(target, graphId, references,
|
|
|
1677
1514
|
const effectiveEnd = [endpointWindow.validTo, endpointWindow.deletedAt].filter((value) => value !== void 0).toSorted()[0];
|
|
1678
1515
|
const endsTooEarly = window.validTo === void 0 ? effectiveEnd !== void 0 : effectiveEnd !== void 0 && effectiveEnd < window.validTo;
|
|
1679
1516
|
if (!startsTooLate && !endsTooEarly) continue;
|
|
1680
|
-
throw new
|
|
1517
|
+
throw new chunkX4GDXBOP_cjs.IdentityEndpointValidityError({
|
|
1681
1518
|
endpoint: ref,
|
|
1682
1519
|
assertionWindow: {
|
|
1683
1520
|
validFrom: window.validFrom,
|
|
@@ -1688,14 +1525,26 @@ async function requireEndpointsCoverIdentityWindow(target, graphId, references,
|
|
|
1688
1525
|
}
|
|
1689
1526
|
}
|
|
1690
1527
|
function windowOverlapSql(alias, lowerBoundary, upperBoundary) {
|
|
1691
|
-
const column = (name) =>
|
|
1692
|
-
return
|
|
1528
|
+
const column = (name) => chunkH5IJSROF_cjs.sql`${chunkH5IJSROF_cjs.sql.identifier(alias)}.${chunkH5IJSROF_cjs.sql.identifier(name)}`;
|
|
1529
|
+
return chunkH5IJSROF_cjs.sql`
|
|
1693
1530
|
${column("deleted_at")} IS NULL
|
|
1694
1531
|
AND ${column("valid_from")} <= ${upperBoundary}
|
|
1695
1532
|
AND (${column("valid_to")} IS NULL OR ${column("valid_to")} > ${lowerBoundary})
|
|
1696
1533
|
`;
|
|
1697
1534
|
}
|
|
1698
|
-
async function loadIdentityWindowLedger(
|
|
1535
|
+
async function loadIdentityWindowLedger(input) {
|
|
1536
|
+
chunkZGVTNKTX_cjs.assertRecursiveTraversal(
|
|
1537
|
+
input.recursiveTraversal,
|
|
1538
|
+
"identity window ledger read"
|
|
1539
|
+
);
|
|
1540
|
+
const {
|
|
1541
|
+
target,
|
|
1542
|
+
schema,
|
|
1543
|
+
graphId,
|
|
1544
|
+
requests,
|
|
1545
|
+
operationInstant,
|
|
1546
|
+
sameIdAcrossKinds
|
|
1547
|
+
} = input;
|
|
1699
1548
|
const activeRequests = requests.filter(
|
|
1700
1549
|
(request) => request.window.effective !== "empty"
|
|
1701
1550
|
);
|
|
@@ -1719,14 +1568,14 @@ async function loadIdentityWindowLedger(target, schema, graphId, requests, opera
|
|
|
1719
1568
|
parametersPerItem: 2
|
|
1720
1569
|
});
|
|
1721
1570
|
const rows = [];
|
|
1722
|
-
for (const referenceChunk of
|
|
1723
|
-
const seedRows =
|
|
1571
|
+
for (const referenceChunk of chunkNLX5OWK7_cjs.chunk(references, seedChunkSize)) {
|
|
1572
|
+
const seedRows = chunkH5IJSROF_cjs.sql.join(
|
|
1724
1573
|
referenceChunk.map(
|
|
1725
|
-
(reference) =>
|
|
1574
|
+
(reference) => chunkH5IJSROF_cjs.sql`(${reference.kind}, ${reference.id})`
|
|
1726
1575
|
),
|
|
1727
|
-
|
|
1576
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
1728
1577
|
);
|
|
1729
|
-
const component = sameIdAcrossKinds === "fold" ?
|
|
1578
|
+
const component = sameIdAcrossKinds === "fold" ? chunkH5IJSROF_cjs.sql`
|
|
1730
1579
|
neighbor_modes(mode) AS (
|
|
1731
1580
|
VALUES ('assertion'), ('fold')
|
|
1732
1581
|
),
|
|
@@ -1760,7 +1609,7 @@ async function loadIdentityWindowLedger(target, schema, graphId, requests, opera
|
|
|
1760
1609
|
AND folded.id = component.id
|
|
1761
1610
|
WHERE assertion.id IS NOT NULL OR folded.id IS NOT NULL
|
|
1762
1611
|
)
|
|
1763
|
-
` :
|
|
1612
|
+
` : chunkH5IJSROF_cjs.sql`
|
|
1764
1613
|
component(kind, id) AS (
|
|
1765
1614
|
SELECT seed_kind, seed_id FROM seeds
|
|
1766
1615
|
UNION
|
|
@@ -1785,7 +1634,7 @@ async function loadIdentityWindowLedger(target, schema, graphId, requests, opera
|
|
|
1785
1634
|
`;
|
|
1786
1635
|
rows.push(
|
|
1787
1636
|
...await target.execute(
|
|
1788
|
-
|
|
1637
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1789
1638
|
WITH RECURSIVE
|
|
1790
1639
|
seeds(seed_kind, seed_id) AS (VALUES ${seedRows}),
|
|
1791
1640
|
${component},
|
|
@@ -1798,7 +1647,7 @@ async function loadIdentityWindowLedger(target, schema, graphId, requests, opera
|
|
|
1798
1647
|
WHERE assertion.graph_id = ${graphId}
|
|
1799
1648
|
AND ${windowOverlapSql("assertion", lowerBoundary, upperBoundary)}
|
|
1800
1649
|
)
|
|
1801
|
-
SELECT 'assertion' AS row_type, ${
|
|
1650
|
+
SELECT 'assertion' AS row_type, ${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS},
|
|
1802
1651
|
NULL AS node_kind, NULL AS node_id,
|
|
1803
1652
|
NULL AS node_created_at, NULL AS node_deleted_at
|
|
1804
1653
|
FROM selected_assertions
|
|
@@ -1904,7 +1753,7 @@ function validateRelationAgainstLedger(ctx, nodes, assertions, relation, operati
|
|
|
1904
1753
|
const bClass = components.get(refKey(b)) ?? [];
|
|
1905
1754
|
if (relation === "different") {
|
|
1906
1755
|
if (!containsRef(aClass, b)) continue;
|
|
1907
|
-
throw new
|
|
1756
|
+
throw new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
1908
1757
|
operation,
|
|
1909
1758
|
a,
|
|
1910
1759
|
b,
|
|
@@ -1917,7 +1766,7 @@ function validateRelationAgainstLedger(ctx, nodes, assertions, relation, operati
|
|
|
1917
1766
|
bClass
|
|
1918
1767
|
);
|
|
1919
1768
|
if (different !== void 0) {
|
|
1920
|
-
throw new
|
|
1769
|
+
throw new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
1921
1770
|
operation,
|
|
1922
1771
|
a,
|
|
1923
1772
|
b,
|
|
@@ -1927,7 +1776,7 @@ function validateRelationAgainstLedger(ctx, nodes, assertions, relation, operati
|
|
|
1927
1776
|
}
|
|
1928
1777
|
const disjointKinds = classHasDisjointKinds(ctx.registry, aClass, bClass);
|
|
1929
1778
|
if (disjointKinds === void 0) continue;
|
|
1930
|
-
throw new
|
|
1779
|
+
throw new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
1931
1780
|
operation,
|
|
1932
1781
|
a,
|
|
1933
1782
|
b,
|
|
@@ -1937,14 +1786,15 @@ function validateRelationAgainstLedger(ctx, nodes, assertions, relation, operati
|
|
|
1937
1786
|
}
|
|
1938
1787
|
}
|
|
1939
1788
|
async function createIdentityWindowValidator(ctx, target, requests, operationInstant, ignoredAssertionIds = /* @__PURE__ */ new Set()) {
|
|
1940
|
-
const ledger = await loadIdentityWindowLedger(
|
|
1789
|
+
const ledger = await loadIdentityWindowLedger({
|
|
1941
1790
|
target,
|
|
1942
|
-
ctx.schema,
|
|
1943
|
-
ctx.graphId,
|
|
1791
|
+
schema: ctx.schema,
|
|
1792
|
+
graphId: ctx.graphId,
|
|
1944
1793
|
requests,
|
|
1945
1794
|
operationInstant,
|
|
1946
|
-
ctx.sameIdAcrossKinds
|
|
1947
|
-
|
|
1795
|
+
sameIdAcrossKinds: ctx.sameIdAcrossKinds,
|
|
1796
|
+
recursiveTraversal: chunkZGVTNKTX_cjs.resolveRecursiveTraversal(target.capabilities)
|
|
1797
|
+
});
|
|
1948
1798
|
if (ignoredAssertionIds.size > 0) {
|
|
1949
1799
|
const retained = ledger.assertions.filter(
|
|
1950
1800
|
(assertion) => !ignoredAssertionIds.has(assertion.id)
|
|
@@ -1980,7 +1830,7 @@ async function validateRelationThroughoutIdentityWindow(ctx, target, relation, o
|
|
|
1980
1830
|
validator.validate(relation, operation, a, b, window);
|
|
1981
1831
|
}
|
|
1982
1832
|
function nullableAssertionValue(value) {
|
|
1983
|
-
return value === void 0 ?
|
|
1833
|
+
return value === void 0 ? chunkH5IJSROF_cjs.sql`NULL` : chunkH5IJSROF_cjs.sql`${value}`;
|
|
1984
1834
|
}
|
|
1985
1835
|
async function insertAssertionRows(target, schema, rows) {
|
|
1986
1836
|
if (rows.length === 0) return;
|
|
@@ -1989,9 +1839,9 @@ async function insertAssertionRows(target, schema, rows) {
|
|
|
1989
1839
|
maxItems: MAX_ASSERTION_INSERT_CHUNK_SIZE,
|
|
1990
1840
|
parametersPerItem: 14
|
|
1991
1841
|
});
|
|
1992
|
-
for (const rowChunk of
|
|
1842
|
+
for (const rowChunk of chunkNLX5OWK7_cjs.chunk(rows, chunkSize)) {
|
|
1993
1843
|
const values = rowChunk.map(
|
|
1994
|
-
(row) =>
|
|
1844
|
+
(row) => chunkH5IJSROF_cjs.sql`
|
|
1995
1845
|
(
|
|
1996
1846
|
${row.graph_id}, ${row.id}, ${row.rel}, ${row.a_kind}, ${row.a_id},
|
|
1997
1847
|
${row.b_kind}, ${row.b_id}, ${row.valid_from},
|
|
@@ -2005,8 +1855,8 @@ async function insertAssertionRows(target, schema, rows) {
|
|
|
2005
1855
|
);
|
|
2006
1856
|
await executeIdentityStatement(
|
|
2007
1857
|
target,
|
|
2008
|
-
|
|
2009
|
-
INSERT INTO ${schema.identityAssertionsTable} (${
|
|
1858
|
+
chunkH5IJSROF_cjs.sql`
|
|
1859
|
+
INSERT INTO ${schema.identityAssertionsTable} (${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS}) VALUES ${chunkH5IJSROF_cjs.sql.join(values, chunkH5IJSROF_cjs.sql`, `)}
|
|
2010
1860
|
`
|
|
2011
1861
|
);
|
|
2012
1862
|
}
|
|
@@ -2020,14 +1870,14 @@ async function loadAssertionsByIds(target, schema, graphId, ids) {
|
|
|
2020
1870
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
2021
1871
|
parametersPerItem: 1
|
|
2022
1872
|
});
|
|
2023
|
-
for (const idChunk of
|
|
2024
|
-
const idList =
|
|
2025
|
-
idChunk.map((id) =>
|
|
2026
|
-
|
|
1873
|
+
for (const idChunk of chunkNLX5OWK7_cjs.chunk(uniqueIds, chunkSize)) {
|
|
1874
|
+
const idList = chunkH5IJSROF_cjs.sql.join(
|
|
1875
|
+
idChunk.map((id) => chunkH5IJSROF_cjs.sql`${id}`),
|
|
1876
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
2027
1877
|
);
|
|
2028
1878
|
const rows = await target.execute(
|
|
2029
|
-
|
|
2030
|
-
SELECT ${
|
|
1879
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
1880
|
+
SELECT ${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
2031
1881
|
FROM ${schema.identityAssertionsTable}
|
|
2032
1882
|
WHERE graph_id = ${graphId} AND id IN (${idList})
|
|
2033
1883
|
`)
|
|
@@ -2049,13 +1899,13 @@ async function loadCurrentClassAnchors(target, schema, graphId, references) {
|
|
|
2049
1899
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
2050
1900
|
parametersPerItem: 2
|
|
2051
1901
|
});
|
|
2052
|
-
for (const refChunk of
|
|
2053
|
-
const seedRows =
|
|
2054
|
-
refChunk.map((ref) =>
|
|
2055
|
-
|
|
1902
|
+
for (const refChunk of chunkNLX5OWK7_cjs.chunk(uniqueReferences, chunkSize)) {
|
|
1903
|
+
const seedRows = chunkH5IJSROF_cjs.sql.join(
|
|
1904
|
+
refChunk.map((ref) => chunkH5IJSROF_cjs.sql`(${ref.kind}, ${ref.id})`),
|
|
1905
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
2056
1906
|
);
|
|
2057
1907
|
const rows = await target.execute(
|
|
2058
|
-
|
|
1908
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
2059
1909
|
WITH seeds(seed_kind, seed_id) AS (
|
|
2060
1910
|
VALUES ${seedRows}
|
|
2061
1911
|
)
|
|
@@ -2150,7 +2000,7 @@ async function replaceClosure(target, schema, graphId, allowedKinds, sameIdAcros
|
|
|
2150
2000
|
);
|
|
2151
2001
|
await executeIdentityStatement(
|
|
2152
2002
|
target,
|
|
2153
|
-
|
|
2003
|
+
chunkH5IJSROF_cjs.sql`DELETE FROM ${schema.identityClosureTable} WHERE graph_id = ${graphId}`
|
|
2154
2004
|
);
|
|
2155
2005
|
await insertClosureComponents(target, schema, graphId, snapshot.components);
|
|
2156
2006
|
await deleteSeparationForGraph(target, schema, graphId);
|
|
@@ -2173,7 +2023,7 @@ async function insertClosureComponents(target, schema, graphId, components) {
|
|
|
2173
2023
|
for (const member of component) {
|
|
2174
2024
|
emitted.add(refKey(member));
|
|
2175
2025
|
values.push(
|
|
2176
|
-
|
|
2026
|
+
chunkH5IJSROF_cjs.sql`(${graphId}, ${member.kind}, ${member.id}, ${canonical.kind}, ${canonical.id})`
|
|
2177
2027
|
);
|
|
2178
2028
|
}
|
|
2179
2029
|
}
|
|
@@ -2183,13 +2033,13 @@ async function insertClosureComponents(target, schema, graphId, components) {
|
|
|
2183
2033
|
maxItems: MAX_CLOSURE_INSERT_CHUNK_SIZE,
|
|
2184
2034
|
parametersPerItem: 5
|
|
2185
2035
|
});
|
|
2186
|
-
for (const valueChunk of
|
|
2036
|
+
for (const valueChunk of chunkNLX5OWK7_cjs.chunk(values, chunkSize)) {
|
|
2187
2037
|
await executeIdentityStatement(
|
|
2188
2038
|
target,
|
|
2189
|
-
|
|
2039
|
+
chunkH5IJSROF_cjs.sql`
|
|
2190
2040
|
INSERT INTO ${schema.identityClosureTable} (
|
|
2191
2041
|
graph_id, member_kind, member_id, class_kind, class_id
|
|
2192
|
-
) VALUES ${
|
|
2042
|
+
) VALUES ${chunkH5IJSROF_cjs.sql.join(valueChunk, chunkH5IJSROF_cjs.sql`, `)}
|
|
2193
2043
|
`
|
|
2194
2044
|
);
|
|
2195
2045
|
}
|
|
@@ -2228,15 +2078,15 @@ async function replaceAffectedClosure(target, schema, graphId, references, sameI
|
|
|
2228
2078
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
2229
2079
|
parametersPerItem: 2
|
|
2230
2080
|
});
|
|
2231
|
-
for (const affectedChunk of
|
|
2081
|
+
for (const affectedChunk of chunkNLX5OWK7_cjs.chunk(affected, chunkSize)) {
|
|
2232
2082
|
const matches = referenceCondition(
|
|
2233
|
-
|
|
2234
|
-
|
|
2083
|
+
chunkH5IJSROF_cjs.sql`member_kind`,
|
|
2084
|
+
chunkH5IJSROF_cjs.sql`member_id`,
|
|
2235
2085
|
affectedChunk
|
|
2236
2086
|
);
|
|
2237
2087
|
await executeIdentityStatement(
|
|
2238
2088
|
target,
|
|
2239
|
-
|
|
2089
|
+
chunkH5IJSROF_cjs.sql`
|
|
2240
2090
|
DELETE FROM ${schema.identityClosureTable}
|
|
2241
2091
|
WHERE graph_id = ${graphId} AND ${matches}
|
|
2242
2092
|
`
|
|
@@ -2272,7 +2122,7 @@ async function mergeCurrentClasses(target, schema, graphId, a, b) {
|
|
|
2272
2122
|
if (refKey(previousCanonical) === refKey(canonical)) return;
|
|
2273
2123
|
await executeIdentityStatement(
|
|
2274
2124
|
target,
|
|
2275
|
-
|
|
2125
|
+
chunkH5IJSROF_cjs.sql`
|
|
2276
2126
|
UPDATE ${schema.identityClosureTable}
|
|
2277
2127
|
SET class_kind = ${canonical.kind}, class_id = ${canonical.id}
|
|
2278
2128
|
WHERE graph_id = ${graphId}
|
|
@@ -2288,14 +2138,14 @@ async function mergeCurrentClasses(target, schema, graphId, a, b) {
|
|
|
2288
2138
|
);
|
|
2289
2139
|
if (singletonMembers.length > 0) {
|
|
2290
2140
|
const values = singletonMembers.map(
|
|
2291
|
-
(member) =>
|
|
2141
|
+
(member) => chunkH5IJSROF_cjs.sql`(${graphId}, ${member.kind}, ${member.id}, ${canonical.kind}, ${canonical.id})`
|
|
2292
2142
|
);
|
|
2293
2143
|
await executeIdentityStatement(
|
|
2294
2144
|
target,
|
|
2295
|
-
|
|
2145
|
+
chunkH5IJSROF_cjs.sql`
|
|
2296
2146
|
INSERT INTO ${schema.identityClosureTable} (
|
|
2297
2147
|
graph_id, member_kind, member_id, class_kind, class_id
|
|
2298
|
-
) VALUES ${
|
|
2148
|
+
) VALUES ${chunkH5IJSROF_cjs.sql.join(values, chunkH5IJSROF_cjs.sql`, `)}
|
|
2299
2149
|
`
|
|
2300
2150
|
);
|
|
2301
2151
|
}
|
|
@@ -2380,7 +2230,7 @@ async function assertPair(ctx, target, relation, firstInput, secondInput, touch,
|
|
|
2380
2230
|
b
|
|
2381
2231
|
);
|
|
2382
2232
|
if (current !== void 0) {
|
|
2383
|
-
throw new
|
|
2233
|
+
throw new chunkX4GDXBOP_cjs.IdentityValidityWindowError({
|
|
2384
2234
|
reason: "overlapping-open-window",
|
|
2385
2235
|
validFrom: window.validFrom,
|
|
2386
2236
|
operationInstant
|
|
@@ -2433,7 +2283,7 @@ async function assertPair(ctx, target, relation, firstInput, secondInput, touch,
|
|
|
2433
2283
|
|
|
2434
2284
|
// src/identity/assertion-key.ts
|
|
2435
2285
|
function identityAssertionSemanticKey(relation, a, b) {
|
|
2436
|
-
return
|
|
2286
|
+
return chunkCRZ56SZU_cjs.encodeTupleKey([relation, a.kind, a.id, b.kind, b.id]);
|
|
2437
2287
|
}
|
|
2438
2288
|
|
|
2439
2289
|
// src/identity/service-facade.ts
|
|
@@ -2530,7 +2380,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
|
|
|
2530
2380
|
const createdRows = [];
|
|
2531
2381
|
const results = [];
|
|
2532
2382
|
const closureReferences = [];
|
|
2533
|
-
const timestamp =
|
|
2383
|
+
const timestamp = chunkM5MSP3BI_cjs.nowIso();
|
|
2534
2384
|
const operation = relation === "same" ? "assertSame" : "assertDifferent";
|
|
2535
2385
|
for (const [a, b] of normalizedPairs) {
|
|
2536
2386
|
const semanticKey = assertionSemanticKey(relation, a, b);
|
|
@@ -2543,7 +2393,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
|
|
|
2543
2393
|
const rootB = unionFind.root(b);
|
|
2544
2394
|
if (relation === "different") {
|
|
2545
2395
|
if (rootA === rootB) {
|
|
2546
|
-
throw new
|
|
2396
|
+
throw new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
2547
2397
|
operation,
|
|
2548
2398
|
a,
|
|
2549
2399
|
b,
|
|
@@ -2553,7 +2403,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
|
|
|
2553
2403
|
} else {
|
|
2554
2404
|
const spanning = differentByRoot.get(rootA)?.get(rootB);
|
|
2555
2405
|
if (spanning !== void 0) {
|
|
2556
|
-
throw new
|
|
2406
|
+
throw new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
2557
2407
|
operation,
|
|
2558
2408
|
a,
|
|
2559
2409
|
b,
|
|
@@ -2567,7 +2417,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
|
|
|
2567
2417
|
kindsByRoot.get(rootB) ?? /* @__PURE__ */ new Set([b.kind])
|
|
2568
2418
|
);
|
|
2569
2419
|
if (disjointKinds !== void 0) {
|
|
2570
|
-
throw new
|
|
2420
|
+
throw new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
2571
2421
|
operation,
|
|
2572
2422
|
a,
|
|
2573
2423
|
b,
|
|
@@ -2660,8 +2510,8 @@ async function bulkAssertWindowedPairs(ctx, target, relation, pairs, touch, oper
|
|
|
2660
2510
|
}
|
|
2661
2511
|
async function findCurrentAssertionById(target, schema, graphId, id) {
|
|
2662
2512
|
const rows = await target.execute(
|
|
2663
|
-
|
|
2664
|
-
SELECT ${
|
|
2513
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
2514
|
+
SELECT ${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
2665
2515
|
FROM ${schema.identityAssertionsTable}
|
|
2666
2516
|
WHERE graph_id = ${graphId}
|
|
2667
2517
|
AND id = ${id}
|
|
@@ -2680,12 +2530,12 @@ async function retractById(ctx, target, id, touch) {
|
|
|
2680
2530
|
id
|
|
2681
2531
|
);
|
|
2682
2532
|
if (existing === void 0) return void 0;
|
|
2683
|
-
const now =
|
|
2533
|
+
const now = chunkM5MSP3BI_cjs.nowIso();
|
|
2684
2534
|
const validTo = clampValidTo(now, existing.valid_from);
|
|
2685
2535
|
const ended = { ...existing, valid_to: validTo, updated_at: now };
|
|
2686
2536
|
await executeIdentityStatement(
|
|
2687
2537
|
target,
|
|
2688
|
-
|
|
2538
|
+
chunkH5IJSROF_cjs.sql`
|
|
2689
2539
|
UPDATE ${ctx.schema.identityAssertionsTable}
|
|
2690
2540
|
SET valid_to = ${validTo}, updated_at = ${now}
|
|
2691
2541
|
WHERE graph_id = ${ctx.graphId}
|
|
@@ -2705,14 +2555,14 @@ async function retractCurrentAssertions(ctx, target, ids, touch, resolveValidTo)
|
|
|
2705
2555
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
2706
2556
|
parametersPerItem: 1
|
|
2707
2557
|
});
|
|
2708
|
-
for (const idChunk of
|
|
2709
|
-
const placeholders =
|
|
2710
|
-
idChunk.map((id) =>
|
|
2711
|
-
|
|
2558
|
+
for (const idChunk of chunkNLX5OWK7_cjs.chunk(uniqueIds, readChunkSize)) {
|
|
2559
|
+
const placeholders = chunkH5IJSROF_cjs.sql.join(
|
|
2560
|
+
idChunk.map((id) => chunkH5IJSROF_cjs.sql`${id}`),
|
|
2561
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
2712
2562
|
);
|
|
2713
2563
|
const rows = await target.execute(
|
|
2714
|
-
|
|
2715
|
-
SELECT ${
|
|
2564
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
2565
|
+
SELECT ${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
2716
2566
|
FROM ${ctx.schema.identityAssertionsTable}
|
|
2717
2567
|
WHERE graph_id = ${ctx.graphId}
|
|
2718
2568
|
AND id IN (${placeholders})
|
|
@@ -2723,7 +2573,7 @@ async function retractCurrentAssertions(ctx, target, ids, touch, resolveValidTo)
|
|
|
2723
2573
|
current.push(...rows.map((row) => normalizeIdentityAssertionRow(row)));
|
|
2724
2574
|
}
|
|
2725
2575
|
if (current.length === 0) return [];
|
|
2726
|
-
const operationInstant =
|
|
2576
|
+
const operationInstant = chunkM5MSP3BI_cjs.nowIso();
|
|
2727
2577
|
const byValidTo = /* @__PURE__ */ new Map();
|
|
2728
2578
|
const endedById = /* @__PURE__ */ new Map();
|
|
2729
2579
|
for (const row of current) {
|
|
@@ -2739,14 +2589,14 @@ async function retractCurrentAssertions(ctx, target, ids, touch, resolveValidTo)
|
|
|
2739
2589
|
parametersPerItem: 1
|
|
2740
2590
|
});
|
|
2741
2591
|
for (const [validTo, ids2] of byValidTo) {
|
|
2742
|
-
for (const idChunk of
|
|
2743
|
-
const placeholders =
|
|
2744
|
-
idChunk.map((id) =>
|
|
2745
|
-
|
|
2592
|
+
for (const idChunk of chunkNLX5OWK7_cjs.chunk(ids2, updateChunkSize)) {
|
|
2593
|
+
const placeholders = chunkH5IJSROF_cjs.sql.join(
|
|
2594
|
+
idChunk.map((id) => chunkH5IJSROF_cjs.sql`${id}`),
|
|
2595
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
2746
2596
|
);
|
|
2747
2597
|
await executeIdentityStatement(
|
|
2748
2598
|
target,
|
|
2749
|
-
|
|
2599
|
+
chunkH5IJSROF_cjs.sql`
|
|
2750
2600
|
UPDATE ${ctx.schema.identityAssertionsTable}
|
|
2751
2601
|
SET valid_to = ${validTo}, updated_at = ${operationInstant}
|
|
2752
2602
|
WHERE graph_id = ${ctx.graphId}
|
|
@@ -2794,7 +2644,7 @@ async function retractPlannedAssertions(ctx, target, retractions, touch) {
|
|
|
2794
2644
|
(row, operationInstant) => {
|
|
2795
2645
|
const retraction = chunkN66HCGCY_cjs.requireDefined(retractionById.get(row.id));
|
|
2796
2646
|
if (retraction.validTo === void 0) {
|
|
2797
|
-
throw new
|
|
2647
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
2798
2648
|
`Identity merge retraction ${retraction.id} is missing validTo.`,
|
|
2799
2649
|
{
|
|
2800
2650
|
code: "IDENTITY_MERGE_RETRACTION_REQUIRES_END",
|
|
@@ -2813,7 +2663,7 @@ async function retractPlannedAssertions(ctx, target, retractions, touch) {
|
|
|
2813
2663
|
}
|
|
2814
2664
|
async function runIdentityMutation(ctx, fn) {
|
|
2815
2665
|
let touched = false;
|
|
2816
|
-
return runInWriteTransaction(
|
|
2666
|
+
return chunkJQKMEKKW_cjs.runInWriteTransaction(
|
|
2817
2667
|
{
|
|
2818
2668
|
graphId: ctx.graphId,
|
|
2819
2669
|
schemaVersion: ctx.schemaVersion,
|
|
@@ -2824,7 +2674,7 @@ async function runIdentityMutation(ctx, fn) {
|
|
|
2824
2674
|
ctx.backend,
|
|
2825
2675
|
async (target) => {
|
|
2826
2676
|
await lockIdentityGraph(target, ctx.graphId);
|
|
2827
|
-
return
|
|
2677
|
+
return chunkJQKMEKKW_cjs.withRecordedIdentityMutationTarget(
|
|
2828
2678
|
target,
|
|
2829
2679
|
(rawTarget, touch) => fn(
|
|
2830
2680
|
rawTarget,
|
|
@@ -2949,7 +2799,7 @@ function createIdentityReadFacade(ctx) {
|
|
|
2949
2799
|
);
|
|
2950
2800
|
return assertions.filter(
|
|
2951
2801
|
(assertion) => assertion.a_kind === ref.kind && assertion.a_id === ref.id || assertion.b_kind === ref.kind && assertion.b_id === ref.id
|
|
2952
|
-
).toSorted((left, right) =>
|
|
2802
|
+
).toSorted((left, right) => chunkRWUWTJQY_cjs.compareCodePoints(left.id, right.id)).map((assertion) => publicAssertion(assertion));
|
|
2953
2803
|
}
|
|
2954
2804
|
};
|
|
2955
2805
|
}
|
|
@@ -2974,7 +2824,7 @@ function createIdentityFacade(ctx) {
|
|
|
2974
2824
|
...createIdentityReadFacade(ctx),
|
|
2975
2825
|
assertSame(a, b, window) {
|
|
2976
2826
|
return runIdentityMutation(ctx, (target, touch) => {
|
|
2977
|
-
const operationInstant =
|
|
2827
|
+
const operationInstant = chunkM5MSP3BI_cjs.nowIso();
|
|
2978
2828
|
return assertPair(
|
|
2979
2829
|
ctx,
|
|
2980
2830
|
target,
|
|
@@ -2989,7 +2839,7 @@ function createIdentityFacade(ctx) {
|
|
|
2989
2839
|
},
|
|
2990
2840
|
assertDifferent(a, b, window) {
|
|
2991
2841
|
return runIdentityMutation(ctx, (target, touch) => {
|
|
2992
|
-
const operationInstant =
|
|
2842
|
+
const operationInstant = chunkM5MSP3BI_cjs.nowIso();
|
|
2993
2843
|
return assertPair(
|
|
2994
2844
|
ctx,
|
|
2995
2845
|
target,
|
|
@@ -3013,7 +2863,7 @@ function createIdentityFacade(ctx) {
|
|
|
3013
2863
|
"same",
|
|
3014
2864
|
pairs,
|
|
3015
2865
|
touch,
|
|
3016
|
-
|
|
2866
|
+
chunkM5MSP3BI_cjs.nowIso()
|
|
3017
2867
|
);
|
|
3018
2868
|
});
|
|
3019
2869
|
},
|
|
@@ -3028,7 +2878,7 @@ function createIdentityFacade(ctx) {
|
|
|
3028
2878
|
"different",
|
|
3029
2879
|
pairs,
|
|
3030
2880
|
touch,
|
|
3031
|
-
|
|
2881
|
+
chunkM5MSP3BI_cjs.nowIso()
|
|
3032
2882
|
);
|
|
3033
2883
|
});
|
|
3034
2884
|
},
|
|
@@ -3136,7 +2986,7 @@ function createIdentityFacade(ctx) {
|
|
|
3136
2986
|
|
|
3137
2987
|
// src/identity/service-interchange-write.ts
|
|
3138
2988
|
function transferShapeError(assertion, message, issue) {
|
|
3139
|
-
return new
|
|
2989
|
+
return new chunkX4GDXBOP_cjs.ValidationError(message, {
|
|
3140
2990
|
issues: [
|
|
3141
2991
|
{
|
|
3142
2992
|
path: "identity.assertions",
|
|
@@ -3199,7 +3049,7 @@ function validateTransferShape(ctx, assertion, mode, operationInstant) {
|
|
|
3199
3049
|
operationInstant
|
|
3200
3050
|
);
|
|
3201
3051
|
} catch (error) {
|
|
3202
|
-
if (!(error instanceof
|
|
3052
|
+
if (!(error instanceof chunkX4GDXBOP_cjs.IdentityValidityWindowError)) throw error;
|
|
3203
3053
|
const issue = error.details.reason === "future-valid-from" ? {
|
|
3204
3054
|
code: "IDENTITY_IMPORT_FUTURE_VALID_FROM",
|
|
3205
3055
|
message: `Assertion ${assertion.id} validFrom is in the future`
|
|
@@ -3265,8 +3115,8 @@ function rethrowTaggedWithAssertion(error, assertionId, progress) {
|
|
|
3265
3115
|
async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode, ignoredAssertionIds = /* @__PURE__ */ new Set()) {
|
|
3266
3116
|
let created = 0;
|
|
3267
3117
|
let skipped = 0;
|
|
3268
|
-
await
|
|
3269
|
-
const operationInstant =
|
|
3118
|
+
await chunkJQKMEKKW_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget, touch) => {
|
|
3119
|
+
const operationInstant = chunkM5MSP3BI_cjs.nowIso();
|
|
3270
3120
|
const normalized = assertions.map((assertion) => ({
|
|
3271
3121
|
assertion,
|
|
3272
3122
|
...validateTransferShape(ctx, assertion, mode, operationInstant)
|
|
@@ -3288,7 +3138,7 @@ async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode,
|
|
|
3288
3138
|
}
|
|
3289
3139
|
}
|
|
3290
3140
|
const attributeMissingEndpoint = (error, ended) => {
|
|
3291
|
-
if (error instanceof
|
|
3141
|
+
if (error instanceof chunkX4GDXBOP_cjs.NodeNotFoundError) {
|
|
3292
3142
|
const missing = { kind: error.details.kind, id: error.details.id };
|
|
3293
3143
|
const failing = normalized.find(
|
|
3294
3144
|
({ assertion, endpoints }) => assertion.validTo !== void 0 === ended && endpoints.some(
|
|
@@ -3344,7 +3194,7 @@ async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode,
|
|
|
3344
3194
|
skipped += 1;
|
|
3345
3195
|
continue;
|
|
3346
3196
|
}
|
|
3347
|
-
throw new
|
|
3197
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
3348
3198
|
`Identity assertion id ${assertion.id} already identifies different truth.`,
|
|
3349
3199
|
{
|
|
3350
3200
|
code: "IDENTITY_IMPORT_ID_CONFLICT",
|
|
@@ -3498,7 +3348,7 @@ async function applyIdentityChangesForContext(ctx, retractions, assertions) {
|
|
|
3498
3348
|
// src/identity/service-maintenance.ts
|
|
3499
3349
|
function requireAtomicIdentityBackend(backend, graphId) {
|
|
3500
3350
|
if (!backend.capabilities.transactions) {
|
|
3501
|
-
throw new
|
|
3351
|
+
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
3502
3352
|
"Operational Identity requires atomic transaction support.",
|
|
3503
3353
|
{ code: "IDENTITY_REQUIRES_ATOMIC_BACKEND", graphId }
|
|
3504
3354
|
);
|
|
@@ -3515,7 +3365,7 @@ async function rebuildIdentityClosureForContext(ctx) {
|
|
|
3515
3365
|
requireAtomicIdentityBackend(ctx.backend, ctx.graphId);
|
|
3516
3366
|
async function rebuildAtTarget(target) {
|
|
3517
3367
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3518
|
-
await
|
|
3368
|
+
await chunkJQKMEKKW_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
|
|
3519
3369
|
const activeKinds = identityActiveKinds(ctx.registry);
|
|
3520
3370
|
const snapshot = await loadSnapshot(
|
|
3521
3371
|
rawTarget,
|
|
@@ -3613,7 +3463,7 @@ async function findAffectedClassInconsistency(ctx, target, seeds) {
|
|
|
3613
3463
|
const [leftKind, rightKind] = conflictingKinds;
|
|
3614
3464
|
return {
|
|
3615
3465
|
kind: "contradiction",
|
|
3616
|
-
error: new
|
|
3466
|
+
error: new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
3617
3467
|
operation: "merge",
|
|
3618
3468
|
a: firstMemberOfKind(members, leftKind),
|
|
3619
3469
|
b: firstMemberOfKind(members, rightKind),
|
|
@@ -3639,7 +3489,7 @@ async function findAffectedClassInconsistency(ctx, target, seeds) {
|
|
|
3639
3489
|
if (aClassKey === void 0 || aClassKey !== bClassKey) continue;
|
|
3640
3490
|
return {
|
|
3641
3491
|
kind: "contradiction",
|
|
3642
|
-
error: new
|
|
3492
|
+
error: new chunkX4GDXBOP_cjs.IdentityContradictionError({
|
|
3643
3493
|
operation: "merge",
|
|
3644
3494
|
a,
|
|
3645
3495
|
b,
|
|
@@ -3707,7 +3557,7 @@ async function assertAffectedIdentityClassesConsistent(ctx, target, seeds) {
|
|
|
3707
3557
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3708
3558
|
const observed = await findAffectedClassInconsistency(ctx, target, seeds);
|
|
3709
3559
|
if (observed === void 0) return;
|
|
3710
|
-
await
|
|
3560
|
+
await chunkJQKMEKKW_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
|
|
3711
3561
|
await replaceClosure(
|
|
3712
3562
|
rawTarget,
|
|
3713
3563
|
ctx.schema,
|
|
@@ -3730,14 +3580,14 @@ async function deleteAssertionsTouchingKinds(target, schema, graphId, kinds, tou
|
|
|
3730
3580
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
3731
3581
|
parametersPerItem: 2
|
|
3732
3582
|
});
|
|
3733
|
-
for (const kindChunk of
|
|
3734
|
-
const kindList2 =
|
|
3735
|
-
kindChunk.map((kind) =>
|
|
3736
|
-
|
|
3583
|
+
for (const kindChunk of chunkNLX5OWK7_cjs.chunk(removedKinds, kindChunkSize)) {
|
|
3584
|
+
const kindList2 = chunkH5IJSROF_cjs.sql.join(
|
|
3585
|
+
kindChunk.map((kind) => chunkH5IJSROF_cjs.sql`${kind}`),
|
|
3586
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
3737
3587
|
);
|
|
3738
3588
|
const rows = await target.execute(
|
|
3739
|
-
|
|
3740
|
-
SELECT ${
|
|
3589
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
3590
|
+
SELECT ${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
3741
3591
|
FROM ${schema.identityAssertionsTable}
|
|
3742
3592
|
WHERE graph_id = ${graphId}
|
|
3743
3593
|
AND (a_kind IN (${kindList2}) OR b_kind IN (${kindList2}))
|
|
@@ -3754,14 +3604,14 @@ async function deleteAssertionsTouchingKinds(target, schema, graphId, kinds, tou
|
|
|
3754
3604
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
3755
3605
|
parametersPerItem: 1
|
|
3756
3606
|
});
|
|
3757
|
-
for (const idChunk of
|
|
3758
|
-
const idList =
|
|
3759
|
-
idChunk.map((id) =>
|
|
3760
|
-
|
|
3607
|
+
for (const idChunk of chunkNLX5OWK7_cjs.chunk(ids, idChunkSize)) {
|
|
3608
|
+
const idList = chunkH5IJSROF_cjs.sql.join(
|
|
3609
|
+
idChunk.map((id) => chunkH5IJSROF_cjs.sql`${id}`),
|
|
3610
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
3761
3611
|
);
|
|
3762
3612
|
await executeIdentityStatement(
|
|
3763
3613
|
target,
|
|
3764
|
-
|
|
3614
|
+
chunkH5IJSROF_cjs.sql`
|
|
3765
3615
|
DELETE FROM ${schema.identityAssertionsTable}
|
|
3766
3616
|
WHERE graph_id = ${graphId} AND id IN (${idList})
|
|
3767
3617
|
`
|
|
@@ -3778,13 +3628,13 @@ async function hasAssertionsTouchingKinds(target, schema, graphId, kinds) {
|
|
|
3778
3628
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
3779
3629
|
parametersPerItem: 2
|
|
3780
3630
|
});
|
|
3781
|
-
for (const kindChunk of
|
|
3782
|
-
const kindList2 =
|
|
3783
|
-
kindChunk.map((kind) =>
|
|
3784
|
-
|
|
3631
|
+
for (const kindChunk of chunkNLX5OWK7_cjs.chunk(probedKinds, kindChunkSize)) {
|
|
3632
|
+
const kindList2 = chunkH5IJSROF_cjs.sql.join(
|
|
3633
|
+
kindChunk.map((kind) => chunkH5IJSROF_cjs.sql`${kind}`),
|
|
3634
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
3785
3635
|
);
|
|
3786
3636
|
const rows = await target.execute(
|
|
3787
|
-
|
|
3637
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
3788
3638
|
SELECT id
|
|
3789
3639
|
FROM ${schema.identityAssertionsTable}
|
|
3790
3640
|
WHERE graph_id = ${graphId}
|
|
@@ -3798,7 +3648,7 @@ async function hasAssertionsTouchingKinds(target, schema, graphId, kinds) {
|
|
|
3798
3648
|
}
|
|
3799
3649
|
async function purgeAssertionsWithUnregisteredKinds(target, schema, graphId, registeredKinds, touch) {
|
|
3800
3650
|
const pairs = await target.execute(
|
|
3801
|
-
|
|
3651
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
3802
3652
|
SELECT DISTINCT a_kind, b_kind
|
|
3803
3653
|
FROM ${schema.identityAssertionsTable}
|
|
3804
3654
|
WHERE graph_id = ${graphId}
|
|
@@ -3848,13 +3698,13 @@ async function liveNodeKindsSharingIds(ctx, target, ids) {
|
|
|
3848
3698
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
3849
3699
|
parametersPerItem: 1
|
|
3850
3700
|
});
|
|
3851
|
-
for (const idChunk of
|
|
3852
|
-
const idList =
|
|
3853
|
-
idChunk.map((id) =>
|
|
3854
|
-
|
|
3701
|
+
for (const idChunk of chunkNLX5OWK7_cjs.chunk(uniqueIds, chunkSize)) {
|
|
3702
|
+
const idList = chunkH5IJSROF_cjs.sql.join(
|
|
3703
|
+
idChunk.map((id) => chunkH5IJSROF_cjs.sql`${id}`),
|
|
3704
|
+
chunkH5IJSROF_cjs.sql`, `
|
|
3855
3705
|
);
|
|
3856
3706
|
const rows = await target.execute(
|
|
3857
|
-
|
|
3707
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
3858
3708
|
SELECT kind, id
|
|
3859
3709
|
FROM ${ctx.schema.nodesTable}
|
|
3860
3710
|
WHERE graph_id = ${ctx.graphId}
|
|
@@ -3874,7 +3724,7 @@ async function liveNodeKindsSharingIds(ctx, target, ids) {
|
|
|
3874
3724
|
async function foldIdentityForCreatedNodes(ctx, target, references) {
|
|
3875
3725
|
if (references.length === 0 || ctx.sameIdAcrossKinds === "ignore") return;
|
|
3876
3726
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3877
|
-
await
|
|
3727
|
+
await chunkJQKMEKKW_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
|
|
3878
3728
|
const liveKindsById = await liveNodeKindsSharingIds(
|
|
3879
3729
|
ctx,
|
|
3880
3730
|
rawTarget,
|
|
@@ -3914,7 +3764,7 @@ async function foldIdentityForCreatedNodes(ctx, target, references) {
|
|
|
3914
3764
|
}
|
|
3915
3765
|
async function hasMaterializedIdentityClass(target, schema, graphId, ref) {
|
|
3916
3766
|
const rows = await target.execute(
|
|
3917
|
-
|
|
3767
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
3918
3768
|
SELECT member_kind, member_id
|
|
3919
3769
|
FROM ${schema.identityClosureTable}
|
|
3920
3770
|
WHERE graph_id = ${graphId}
|
|
@@ -3927,7 +3777,7 @@ async function hasMaterializedIdentityClass(target, schema, graphId, ref) {
|
|
|
3927
3777
|
}
|
|
3928
3778
|
async function readNodeDeletionInstant(target, schema, graphId, ref) {
|
|
3929
3779
|
const rows = await target.execute(
|
|
3930
|
-
|
|
3780
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
3931
3781
|
SELECT deleted_at
|
|
3932
3782
|
FROM ${schema.nodesTable}
|
|
3933
3783
|
WHERE graph_id = ${graphId}
|
|
@@ -3941,8 +3791,8 @@ async function readNodeDeletionInstant(target, schema, graphId, ref) {
|
|
|
3941
3791
|
}
|
|
3942
3792
|
async function requireNodeValidityEndCompatible(ctx, target, ref, validTo) {
|
|
3943
3793
|
const rows = await target.execute(
|
|
3944
|
-
|
|
3945
|
-
SELECT ${
|
|
3794
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
3795
|
+
SELECT ${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
3946
3796
|
FROM ${ctx.schema.identityAssertionsTable}
|
|
3947
3797
|
WHERE graph_id = ${ctx.graphId}
|
|
3948
3798
|
AND deleted_at IS NULL
|
|
@@ -3958,7 +3808,7 @@ async function requireNodeValidityEndCompatible(ctx, target, ref, validTo) {
|
|
|
3958
3808
|
const row = rows.at(0);
|
|
3959
3809
|
if (row === void 0) return;
|
|
3960
3810
|
const assertion = normalizeIdentityAssertionRow(row);
|
|
3961
|
-
throw new
|
|
3811
|
+
throw new chunkX4GDXBOP_cjs.IdentityEndpointValidityError({
|
|
3962
3812
|
endpoint: ref,
|
|
3963
3813
|
assertionWindow: {
|
|
3964
3814
|
validFrom: assertion.valid_from,
|
|
@@ -3969,17 +3819,17 @@ async function requireNodeValidityEndCompatible(ctx, target, ref, validTo) {
|
|
|
3969
3819
|
}
|
|
3970
3820
|
async function detachIdentityForNode(ctx, target, ref, mode) {
|
|
3971
3821
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3972
|
-
await
|
|
3973
|
-
const touchesNode =
|
|
3822
|
+
await chunkJQKMEKKW_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget, touch) => {
|
|
3823
|
+
const touchesNode = chunkH5IJSROF_cjs.sql`
|
|
3974
3824
|
(
|
|
3975
3825
|
(a_kind = ${ref.kind} AND a_id = ${ref.id})
|
|
3976
3826
|
OR (b_kind = ${ref.kind} AND b_id = ${ref.id})
|
|
3977
3827
|
)
|
|
3978
3828
|
`;
|
|
3979
|
-
const scope = mode === "hard" ?
|
|
3829
|
+
const scope = mode === "hard" ? chunkH5IJSROF_cjs.sql`` : chunkH5IJSROF_cjs.sql`AND valid_to IS NULL AND deleted_at IS NULL`;
|
|
3980
3830
|
const rows = await rawTarget.execute(
|
|
3981
|
-
|
|
3982
|
-
SELECT ${
|
|
3831
|
+
chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
|
|
3832
|
+
SELECT ${chunkJQKMEKKW_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
3983
3833
|
FROM ${ctx.schema.identityAssertionsTable}
|
|
3984
3834
|
WHERE graph_id = ${ctx.graphId}
|
|
3985
3835
|
${scope}
|
|
@@ -3994,7 +3844,7 @@ async function detachIdentityForNode(ctx, target, ref, mode) {
|
|
|
3994
3844
|
)) {
|
|
3995
3845
|
return;
|
|
3996
3846
|
}
|
|
3997
|
-
const now =
|
|
3847
|
+
const now = chunkM5MSP3BI_cjs.nowIso();
|
|
3998
3848
|
const cascadeInstant = mode === "hard" || rows.length === 0 ? now : await readNodeDeletionInstant(
|
|
3999
3849
|
rawTarget,
|
|
4000
3850
|
ctx.schema,
|
|
@@ -4006,7 +3856,7 @@ async function detachIdentityForNode(ctx, target, ref, mode) {
|
|
|
4006
3856
|
if (mode === "hard") {
|
|
4007
3857
|
await executeIdentityStatement(
|
|
4008
3858
|
rawTarget,
|
|
4009
|
-
|
|
3859
|
+
chunkH5IJSROF_cjs.sql`
|
|
4010
3860
|
DELETE FROM ${ctx.schema.identityAssertionsTable}
|
|
4011
3861
|
WHERE graph_id = ${ctx.graphId} AND id = ${row.id}
|
|
4012
3862
|
`
|
|
@@ -4023,7 +3873,7 @@ async function detachIdentityForNode(ctx, target, ref, mode) {
|
|
|
4023
3873
|
};
|
|
4024
3874
|
await executeIdentityStatement(
|
|
4025
3875
|
rawTarget,
|
|
4026
|
-
|
|
3876
|
+
chunkH5IJSROF_cjs.sql`
|
|
4027
3877
|
UPDATE ${ctx.schema.identityAssertionsTable}
|
|
4028
3878
|
SET valid_to = ${validTo},
|
|
4029
3879
|
updated_at = ${now},
|
|
@@ -4051,11 +3901,9 @@ exports.applyIdentityChangesForContext = applyIdentityChangesForContext;
|
|
|
4051
3901
|
exports.assertAffectedIdentityClassesConsistent = assertAffectedIdentityClassesConsistent;
|
|
4052
3902
|
exports.createIdentityFacade = createIdentityFacade;
|
|
4053
3903
|
exports.createIdentityReadFacade = createIdentityReadFacade;
|
|
4054
|
-
exports.createValidationError = createValidationError;
|
|
4055
3904
|
exports.deleteAssertionsTouchingKinds = deleteAssertionsTouchingKinds;
|
|
4056
3905
|
exports.detachIdentityForNode = detachIdentityForNode;
|
|
4057
3906
|
exports.foldIdentityForCreatedNodes = foldIdentityForCreatedNodes;
|
|
4058
|
-
exports.forceWriteTransactionRevision = forceWriteTransactionRevision;
|
|
4059
3907
|
exports.hasAssertionsTouchingKinds = hasAssertionsTouchingKinds;
|
|
4060
3908
|
exports.identityAssertionSemanticKey = identityAssertionSemanticKey;
|
|
4061
3909
|
exports.identityReferenceKey = identityReferenceKey;
|
|
@@ -4066,7 +3914,6 @@ exports.loadAssertionsByIds = loadAssertionsByIds;
|
|
|
4066
3914
|
exports.loadCurrentStructuralClasses = loadCurrentStructuralClasses;
|
|
4067
3915
|
exports.lockIdentityEnablementNodes = lockIdentityEnablementNodes;
|
|
4068
3916
|
exports.lockIdentityGraph = lockIdentityGraph;
|
|
4069
|
-
exports.lockSchemaVersionForStoreWrite = lockSchemaVersionForStoreWrite;
|
|
4070
3917
|
exports.normalizeIdentityPair = normalizeIdentityPair;
|
|
4071
3918
|
exports.purgeAssertionsWithUnregisteredKinds = purgeAssertionsWithUnregisteredKinds;
|
|
4072
3919
|
exports.readIdentityAssertionPageAtTarget = readIdentityAssertionPageAtTarget;
|
|
@@ -4075,15 +3922,8 @@ exports.rebuildIdentityClosureForContext = rebuildIdentityClosureForContext;
|
|
|
4075
3922
|
exports.refKey = refKey;
|
|
4076
3923
|
exports.removeIdentityKindsForContext = removeIdentityKindsForContext;
|
|
4077
3924
|
exports.requireNodeValidityEndCompatible = requireNodeValidityEndCompatible;
|
|
4078
|
-
exports.runHookedWriteOperation = runHookedWriteOperation;
|
|
4079
|
-
exports.runInWriteTransaction = runInWriteTransaction;
|
|
4080
3925
|
exports.separationRebuildRequired = separationRebuildRequired;
|
|
4081
3926
|
exports.toTransferAssertion = toTransferAssertion;
|
|
4082
|
-
exports.validateEdgeProps = validateEdgeProps;
|
|
4083
3927
|
exports.validateIdentityForContext = validateIdentityForContext;
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
exports.withWriteTransactionSession = withWriteTransactionSession;
|
|
4087
|
-
exports.wrapZodError = wrapZodError;
|
|
4088
|
-
//# sourceMappingURL=chunk-JFRT7S3B.cjs.map
|
|
4089
|
-
//# sourceMappingURL=chunk-JFRT7S3B.cjs.map
|
|
3928
|
+
//# sourceMappingURL=chunk-L6EVYIID.cjs.map
|
|
3929
|
+
//# sourceMappingURL=chunk-L6EVYIID.cjs.map
|