@nicia-ai/typegraph 0.44.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/drizzle/indexes.cjs +11 -11
- 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 -7
- package/dist/backend/index.cjs +53 -54
- package/dist/backend/index.d.cts +3 -3
- package/dist/backend/index.d.ts +3 -3
- package/dist/backend/index.js +13 -14
- package/dist/backend/postgres/index.cjs +29 -30
- package/dist/backend/postgres/index.d.cts +7 -7
- package/dist/backend/postgres/index.d.ts +7 -7
- package/dist/backend/postgres/index.js +16 -17
- package/dist/backend/postgres/pglite-store.cjs +48 -43
- package/dist/backend/postgres/pglite-store.cjs.map +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +15 -9
- package/dist/backend/postgres/pglite-store.d.ts +15 -9
- package/dist/backend/postgres/pglite-store.js +44 -39
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +18 -19
- package/dist/backend/postgres/pglite.d.cts +4 -4
- package/dist/backend/postgres/pglite.d.ts +4 -4
- package/dist/backend/postgres/pglite.js +17 -18
- package/dist/backend/sqlite/index.cjs +26 -27
- package/dist/backend/sqlite/index.d.cts +6 -6
- package/dist/backend/sqlite/index.d.ts +6 -6
- package/dist/backend/sqlite/index.js +14 -15
- package/dist/backend/sqlite/libsql.cjs +21 -22
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +15 -8
- package/dist/backend/sqlite/libsql.d.ts +15 -8
- package/dist/backend/sqlite/libsql.js +17 -18
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +49 -44
- package/dist/backend/sqlite/local-store.cjs.map +1 -1
- package/dist/backend/sqlite/local-store.d.cts +15 -10
- package/dist/backend/sqlite/local-store.d.ts +15 -10
- package/dist/backend/sqlite/local-store.js +45 -40
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +19 -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 +17 -18
- package/dist/{chunk-XMYJY7NI.js → chunk-2LG2XB2M.js} +3 -3
- package/dist/{chunk-XMYJY7NI.js.map → chunk-2LG2XB2M.js.map} +1 -1
- package/dist/{chunk-QGKILWGZ.cjs → chunk-2NA5DYLO.cjs} +4 -4
- package/dist/{chunk-QGKILWGZ.cjs.map → chunk-2NA5DYLO.cjs.map} +1 -1
- package/dist/{chunk-5MUSU4ZP.cjs → chunk-3DHZCOT7.cjs} +20 -20
- package/dist/chunk-3DHZCOT7.cjs.map +1 -0
- package/dist/{chunk-OVUUTCPJ.cjs → chunk-4UGOKMI5.cjs} +268 -150
- package/dist/chunk-4UGOKMI5.cjs.map +1 -0
- package/dist/{chunk-FRHHDHKH.js → chunk-5262ZMTR.js} +26 -5
- package/dist/chunk-5262ZMTR.js.map +1 -0
- package/dist/{chunk-HOIFFY4M.js → chunk-5763DULU.js} +248 -76
- package/dist/chunk-5763DULU.js.map +1 -0
- package/dist/{chunk-7G32LIQM.js → chunk-5UVRGXD3.js} +277 -7
- package/dist/chunk-5UVRGXD3.js.map +1 -0
- package/dist/{chunk-IIT5K7SK.cjs → chunk-62ZP23AW.cjs} +15 -15
- package/dist/{chunk-IIT5K7SK.cjs.map → chunk-62ZP23AW.cjs.map} +1 -1
- package/dist/{chunk-S4KQ5LV4.js → chunk-775A4ZMN.js} +40 -6
- package/dist/chunk-775A4ZMN.js.map +1 -0
- package/dist/{chunk-QYWINYEA.cjs → chunk-7BQXPCGN.cjs} +830 -170
- package/dist/chunk-7BQXPCGN.cjs.map +1 -0
- package/dist/{chunk-FJMPR3OH.cjs → chunk-7EO3TCQB.cjs} +33 -7
- package/dist/chunk-7EO3TCQB.cjs.map +1 -0
- package/dist/chunk-7GT72YHH.cjs +1979 -0
- package/dist/chunk-7GT72YHH.cjs.map +1 -0
- package/dist/{chunk-SQRD2CYF.js → chunk-7VQXLT5O.js} +717 -76
- package/dist/chunk-7VQXLT5O.js.map +1 -0
- package/dist/{chunk-BCP7LLOY.js → chunk-7Z5OR7KO.js} +2706 -625
- package/dist/chunk-7Z5OR7KO.js.map +1 -0
- package/dist/chunk-A4OC4DVN.cjs +12 -0
- package/dist/{chunk-4SZ6XPTG.cjs.map → chunk-A4OC4DVN.cjs.map} +1 -1
- package/dist/{chunk-TDXIBCGY.cjs → chunk-A7J2YDDI.cjs} +5 -3
- package/dist/chunk-A7J2YDDI.cjs.map +1 -0
- package/dist/{chunk-FMMIX6N4.js → chunk-AKLS3BYZ.js} +56 -5
- package/dist/chunk-AKLS3BYZ.js.map +1 -0
- package/dist/{chunk-D7PG5D5K.js → chunk-AMKPPFUO.js} +32 -6
- package/dist/chunk-AMKPPFUO.js.map +1 -0
- package/dist/{chunk-PAW2XUZN.js → chunk-ASTI57H3.js} +3 -3
- package/dist/{chunk-PAW2XUZN.js.map → chunk-ASTI57H3.js.map} +1 -1
- package/dist/{chunk-FMGEZBAQ.js → chunk-BKCUOV7A.js} +27 -5
- package/dist/chunk-BKCUOV7A.js.map +1 -0
- package/dist/chunk-BSFJMMV3.cjs +268 -0
- package/dist/chunk-BSFJMMV3.cjs.map +1 -0
- package/dist/{chunk-63KCKSSH.js → chunk-C23WSN5E.js} +209 -24
- package/dist/chunk-C23WSN5E.js.map +1 -0
- package/dist/{chunk-JRP3VGHS.js → chunk-CBTIUB76.js} +3 -3
- package/dist/{chunk-JRP3VGHS.js.map → chunk-CBTIUB76.js.map} +1 -1
- package/dist/chunk-CNV4TXJG.js +58 -0
- package/dist/chunk-CNV4TXJG.js.map +1 -0
- package/dist/{chunk-QB6VMOJ2.cjs → chunk-CXBHOOIQ.cjs} +45 -10
- package/dist/chunk-CXBHOOIQ.cjs.map +1 -0
- package/dist/{chunk-46GDII45.js → chunk-DCQVHAYQ.js} +5 -5
- package/dist/{chunk-46GDII45.js.map → chunk-DCQVHAYQ.js.map} +1 -1
- package/dist/chunk-DLNROMQ7.js +306 -0
- package/dist/chunk-DLNROMQ7.js.map +1 -0
- package/dist/chunk-DYATYRY4.js +47 -0
- package/dist/chunk-DYATYRY4.js.map +1 -0
- package/dist/chunk-E4WNQBEF.cjs +217 -0
- package/dist/chunk-E4WNQBEF.cjs.map +1 -0
- package/dist/{chunk-G6Q5UM7U.js → chunk-FWJKWH6U.js} +5 -3
- package/dist/chunk-FWJKWH6U.js.map +1 -0
- package/dist/{chunk-BNUFUFAU.js → chunk-HFHTMECK.js} +7 -7
- package/dist/chunk-HFHTMECK.js.map +1 -0
- package/dist/{chunk-TFMVL4QH.js → chunk-I5MOXA4H.js} +20 -14
- package/dist/chunk-I5MOXA4H.js.map +1 -0
- package/dist/{chunk-4MB3AQAQ.js → chunk-J3WZ3FA2.js} +77 -3
- package/dist/chunk-J3WZ3FA2.js.map +1 -0
- package/dist/{chunk-UR7W5YQK.js → chunk-JBQQ7THH.js} +5 -3
- package/dist/chunk-JBQQ7THH.js.map +1 -0
- package/dist/chunk-JIVMTW7W.js +3393 -0
- package/dist/chunk-JIVMTW7W.js.map +1 -0
- package/dist/{chunk-2Y4IFKW7.js → chunk-JXA2ZP2Q.js} +6 -17
- package/dist/chunk-JXA2ZP2Q.js.map +1 -0
- package/dist/{chunk-GYA4JRP5.js → chunk-JXXDZTMN.js} +2 -2
- package/dist/chunk-JXXDZTMN.js.map +1 -0
- package/dist/chunk-JZUR7ZWE.js +254 -0
- package/dist/chunk-JZUR7ZWE.js.map +1 -0
- package/dist/chunk-K5ELX2GT.js +248 -0
- package/dist/chunk-K5ELX2GT.js.map +1 -0
- package/dist/chunk-LBJKZXDE.cjs +257 -0
- package/dist/chunk-LBJKZXDE.cjs.map +1 -0
- package/dist/{chunk-FGO5JFVJ.cjs → chunk-M4BDU5RX.cjs} +12 -12
- package/dist/{chunk-FGO5JFVJ.cjs.map → chunk-M4BDU5RX.cjs.map} +1 -1
- package/dist/{chunk-MIJKEVV7.js → chunk-MSY7FSX4.js} +37 -4
- package/dist/chunk-MSY7FSX4.js.map +1 -0
- package/dist/{chunk-ST3LPB2V.cjs → chunk-MUK4BU7K.cjs} +788 -146
- package/dist/chunk-MUK4BU7K.cjs.map +1 -0
- package/dist/{chunk-MCHP7RHZ.cjs → chunk-MXJDTH5B.cjs} +64 -41
- package/dist/chunk-MXJDTH5B.cjs.map +1 -0
- package/dist/{chunk-2VLBGQBY.cjs → chunk-N3257XE6.cjs} +724 -577
- package/dist/chunk-N3257XE6.cjs.map +1 -0
- package/dist/chunk-N66HCGCY.cjs +57 -0
- package/dist/chunk-N66HCGCY.cjs.map +1 -0
- package/dist/{chunk-CPEL3YIR.cjs → chunk-NFCVHQ5P.cjs} +55 -22
- package/dist/chunk-NFCVHQ5P.cjs.map +1 -0
- package/dist/{chunk-C4F7VJ5D.cjs → chunk-NI72YOJB.cjs} +84 -2
- package/dist/chunk-NI72YOJB.cjs.map +1 -0
- package/dist/{chunk-EE7N5XXQ.cjs → chunk-NK5Q7UNE.cjs} +10 -21
- package/dist/chunk-NK5Q7UNE.cjs.map +1 -0
- package/dist/{chunk-PHXITZE4.js → chunk-NMWDXFPH.js} +4 -4
- package/dist/{chunk-PHXITZE4.js.map → chunk-NMWDXFPH.js.map} +1 -1
- package/dist/{chunk-FSXTPBRN.js → chunk-NQ6BRJBE.js} +416 -850
- package/dist/chunk-NQ6BRJBE.js.map +1 -0
- package/dist/chunk-OH5E5KIO.js +2057 -0
- package/dist/chunk-OH5E5KIO.js.map +1 -0
- package/dist/chunk-ONU3HIED.cjs +2082 -0
- package/dist/chunk-ONU3HIED.cjs.map +1 -0
- package/dist/{chunk-STQ3BSED.cjs → chunk-PNN7RHVR.cjs} +66 -44
- package/dist/chunk-PNN7RHVR.cjs.map +1 -0
- package/dist/{chunk-6DCB664D.js → chunk-PQBQG7IM.js} +3 -3
- package/dist/{chunk-6DCB664D.js.map → chunk-PQBQG7IM.js.map} +1 -1
- package/dist/{chunk-ACSVZPK7.cjs → chunk-PWLJ77UV.cjs} +5 -3
- package/dist/chunk-PWLJ77UV.cjs.map +1 -0
- package/dist/chunk-Q7Q4WSLJ.cjs +328 -0
- package/dist/chunk-Q7Q4WSLJ.cjs.map +1 -0
- package/dist/{chunk-BEFM74L2.js → chunk-QLRESYPU.js} +637 -493
- package/dist/chunk-QLRESYPU.js.map +1 -0
- package/dist/{chunk-SBPC5IP3.js → chunk-QWX5YA3K.js} +784 -202
- package/dist/chunk-QWX5YA3K.js.map +1 -0
- package/dist/{chunk-TCRIQMBU.js → chunk-RJS7DECT.js} +8 -9
- package/dist/chunk-RJS7DECT.js.map +1 -0
- package/dist/{chunk-6JZUSDY2.cjs → chunk-RMQLSPA2.cjs} +297 -27
- package/dist/chunk-RMQLSPA2.cjs.map +1 -0
- package/dist/{chunk-SJDMVITW.cjs → chunk-RT5ZY4XA.cjs} +6 -5
- package/dist/chunk-RT5ZY4XA.cjs.map +1 -0
- package/dist/{chunk-IJTLXNGJ.js → chunk-T4XNKYXB.js} +780 -127
- package/dist/chunk-T4XNKYXB.js.map +1 -0
- package/dist/{chunk-PDGEXGS6.cjs → chunk-TQR4KBY2.cjs} +354 -182
- package/dist/chunk-TQR4KBY2.cjs.map +1 -0
- package/dist/chunk-TTAITEPJ.cjs +755 -0
- package/dist/chunk-TTAITEPJ.cjs.map +1 -0
- package/dist/{chunk-NN3QSOVS.cjs → chunk-U5SON7R2.cjs} +27 -27
- package/dist/{chunk-NN3QSOVS.cjs.map → chunk-U5SON7R2.cjs.map} +1 -1
- package/dist/{chunk-A2I2XO52.cjs → chunk-U63GDNRC.cjs} +32 -26
- package/dist/chunk-U63GDNRC.cjs.map +1 -0
- package/dist/{chunk-YNULOIR5.cjs → chunk-UDISNXDL.cjs} +64 -43
- package/dist/chunk-UDISNXDL.cjs.map +1 -0
- package/dist/{chunk-GWEDD3DH.js → chunk-UV3SN74I.js} +5 -5
- package/dist/{chunk-GWEDD3DH.js.map → chunk-UV3SN74I.js.map} +1 -1
- package/dist/{chunk-U5W4LKZV.cjs → chunk-VCRRKBLN.cjs} +9 -9
- package/dist/{chunk-U5W4LKZV.cjs.map → chunk-VCRRKBLN.cjs.map} +1 -1
- package/dist/{chunk-EFELJVLA.js → chunk-VGTJPTIC.js} +28 -5
- package/dist/chunk-VGTJPTIC.js.map +1 -0
- package/dist/chunk-VQH4VAWD.cjs +12 -0
- package/dist/{chunk-EPTSMFH7.cjs.map → chunk-VQH4VAWD.cjs.map} +1 -1
- package/dist/{chunk-SNXVDZAJ.js → chunk-W6OG3HDG.js} +5 -4
- package/dist/chunk-W6OG3HDG.js.map +1 -0
- package/dist/chunk-WDGA7IYB.js +207 -0
- package/dist/chunk-WDGA7IYB.js.map +1 -0
- package/dist/chunk-WEVQJ5LH.js +736 -0
- package/dist/chunk-WEVQJ5LH.js.map +1 -0
- package/dist/{chunk-3PRKZW6D.cjs → chunk-XBYVV3MP.cjs} +60 -5
- package/dist/chunk-XBYVV3MP.cjs.map +1 -0
- package/dist/{chunk-GFRGG2US.cjs → chunk-XCAGZAKP.cjs} +7 -7
- package/dist/{chunk-GFRGG2US.cjs.map → chunk-XCAGZAKP.cjs.map} +1 -1
- package/dist/{chunk-XR4YZFKW.cjs → chunk-XDF2UPEQ.cjs} +3864 -1783
- package/dist/chunk-XDF2UPEQ.cjs.map +1 -0
- package/dist/{chunk-7V2FGGI2.cjs → chunk-XMQSEJCF.cjs} +632 -1080
- package/dist/chunk-XMQSEJCF.cjs.map +1 -0
- package/dist/chunk-XNLIZYRZ.cjs +3432 -0
- package/dist/chunk-XNLIZYRZ.cjs.map +1 -0
- package/dist/{chunk-66UVLHQA.cjs → chunk-XNSI2FJO.cjs} +99 -100
- package/dist/chunk-XNSI2FJO.cjs.map +1 -0
- package/dist/chunk-XQSCL77R.cjs +60 -0
- package/dist/chunk-XQSCL77R.cjs.map +1 -0
- package/dist/{chunk-SVJ5GEXW.cjs → chunk-XUO3KQFO.cjs} +2 -2
- package/dist/chunk-XUO3KQFO.cjs.map +1 -0
- package/dist/{chunk-HJH3RMXG.cjs → chunk-YAAM3M2S.cjs} +10 -10
- package/dist/{chunk-HJH3RMXG.cjs.map → chunk-YAAM3M2S.cjs.map} +1 -1
- package/dist/{chunk-ATLN63JA.js → chunk-YBFHZUXX.js} +6 -6
- package/dist/{chunk-ATLN63JA.js.map → chunk-YBFHZUXX.js.map} +1 -1
- package/dist/{chunk-K3BUWSFR.js → chunk-YDFDBE6D.js} +119 -6
- package/dist/chunk-YDFDBE6D.js.map +1 -0
- package/dist/{chunk-OSZPLZIV.cjs → chunk-YVWGEQJE.cjs} +318 -132
- package/dist/chunk-YVWGEQJE.cjs.map +1 -0
- package/dist/{chunk-QT6V3YRH.js → chunk-YWGVVALJ.js} +3 -3
- package/dist/{chunk-QT6V3YRH.js.map → chunk-YWGVVALJ.js.map} +1 -1
- package/dist/core/index.cjs +40 -41
- package/dist/core/index.d.cts +4 -5
- package/dist/core/index.d.ts +4 -5
- package/dist/core/index.js +8 -9
- package/dist/{ddl-eWg7hx6R.d.cts → ddl-BJcOp4WZ.d.cts} +3 -3
- package/dist/{ddl-D5369kOY.d.ts → ddl-BXfGHbPN.d.ts} +3 -3
- package/dist/graph-extension/index.cjs +26 -23
- package/dist/graph-extension/index.d.cts +16 -6
- package/dist/graph-extension/index.d.ts +16 -6
- package/dist/graph-extension/index.js +7 -8
- package/dist/graph-merge/index.cjs +2459 -655
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +170 -33
- package/dist/graph-merge/index.d.ts +170 -33
- package/dist/graph-merge/index.js +2269 -468
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-By89Sezh.d.ts → index-BSHvKfok.d.ts} +221 -10
- package/dist/{index-DcQ3Sxs-.d.cts → index-DxaYCv8Y.d.cts} +221 -10
- package/dist/index.cjs +330 -269
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +590 -576
- package/dist/index.d.ts +590 -576
- package/dist/index.js +73 -50
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +17 -17
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/indexes/index.js +10 -10
- package/dist/interchange/index.cjs +165 -50
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +261 -16
- package/dist/interchange/index.d.ts +261 -16
- package/dist/interchange/index.js +128 -24
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-B0KjKE93.d.ts → manager-CfZAimti.d.ts} +36 -5
- package/dist/{manager-Cn0NFIhN.d.cts → manager-HGk6E_HW.d.cts} +36 -5
- package/dist/{materialize-indexes-BD4V3svD.d.ts → materialize-indexes-6A7dWGtb.d.cts} +10 -2
- package/dist/{materialize-indexes-DVRhd5h4.d.cts → materialize-indexes-BMJP6Tms.d.ts} +10 -2
- package/dist/{postgres-DaEWvN4x.d.cts → postgres-DFYWENdR.d.cts} +1961 -439
- package/dist/{postgres-u0a0HN2D.d.ts → postgres-e7a9TdvR.d.ts} +1961 -439
- package/dist/profiler/index.cjs +15 -15
- package/dist/profiler/index.d.cts +9 -10
- package/dist/profiler/index.d.ts +9 -10
- package/dist/profiler/index.js +4 -4
- package/dist/provenance/index.cjs +46 -48
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +7 -7
- package/dist/provenance/index.d.ts +7 -7
- package/dist/provenance/index.js +12 -14
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +50 -49
- package/dist/schema/index.d.cts +9 -16
- package/dist/schema/index.d.ts +9 -16
- package/dist/schema/index.js +23 -22
- package/dist/{searchable-CnYEancP.d.ts → searchable-9OQoPuRs.d.ts} +1 -2
- package/dist/{searchable-BT7j9_IK.d.cts → searchable-CIje5XYD.d.cts} +1 -2
- package/dist/{sqlite-BrMoSsI7.d.cts → sqlite-DerU5tc7.d.ts} +2029 -347
- package/dist/{sqlite-CHhZUyO5.d.ts → sqlite-DitnISa9.d.cts} +2029 -347
- package/dist/{store-view-Bvdku0Ht.d.ts → store-DawaWWjJ.d.ts} +3145 -2556
- package/dist/{store-view-w-md0nQ4.d.cts → store-RwTJx8LX.d.cts} +3145 -2556
- package/dist/{temporal-BCORwUau.d.cts → temporal-Bn-Fi8FJ.d.cts} +1 -1
- package/dist/{temporal--x9T8K4S.d.ts → temporal-BtM4UALv.d.ts} +1 -1
- package/dist/{types-6-WJmSD4.d.cts → types-CoIx8HX5.d.cts} +1 -1
- package/dist/{types-Cjvkj0jA.d.ts → types-HkveCCx0.d.cts} +866 -21
- package/dist/{types-Cjvkj0jA.d.cts → types-HkveCCx0.d.ts} +866 -21
- package/dist/{types-COODtTJU.d.ts → types-KFfk-8Ah.d.ts} +1 -1
- package/dist/{where-CUQmCR6d.d.cts → where--fk7_0kv.d.cts} +1 -1
- package/dist/{where-5xVawAwL.d.ts → where-ws5hf-Ov.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-2BIG7U6E.cjs +0 -83
- package/dist/chunk-2BIG7U6E.cjs.map +0 -1
- package/dist/chunk-2L54C2C2.js +0 -144
- package/dist/chunk-2L54C2C2.js.map +0 -1
- package/dist/chunk-2VLBGQBY.cjs.map +0 -1
- package/dist/chunk-2WDD2NO3.js +0 -59
- package/dist/chunk-2WDD2NO3.js.map +0 -1
- package/dist/chunk-2Y4IFKW7.js.map +0 -1
- package/dist/chunk-35S6P5ZU.js +0 -27
- package/dist/chunk-35S6P5ZU.js.map +0 -1
- package/dist/chunk-3PRKZW6D.cjs.map +0 -1
- package/dist/chunk-4MB3AQAQ.js.map +0 -1
- package/dist/chunk-4SZ6XPTG.cjs +0 -12
- package/dist/chunk-5MUSU4ZP.cjs.map +0 -1
- package/dist/chunk-63KCKSSH.js.map +0 -1
- package/dist/chunk-66UVLHQA.cjs.map +0 -1
- package/dist/chunk-6JZUSDY2.cjs.map +0 -1
- package/dist/chunk-764JHTLT.cjs +0 -15
- package/dist/chunk-764JHTLT.cjs.map +0 -1
- package/dist/chunk-7G32LIQM.js.map +0 -1
- package/dist/chunk-7V2FGGI2.cjs.map +0 -1
- package/dist/chunk-A2I2XO52.cjs.map +0 -1
- package/dist/chunk-A4PBRX4C.cjs +0 -100
- package/dist/chunk-A4PBRX4C.cjs.map +0 -1
- package/dist/chunk-ACSVZPK7.cjs.map +0 -1
- package/dist/chunk-ALFUGRYB.cjs +0 -1282
- package/dist/chunk-ALFUGRYB.cjs.map +0 -1
- package/dist/chunk-B75XRV3O.js +0 -125
- package/dist/chunk-B75XRV3O.js.map +0 -1
- package/dist/chunk-BCP7LLOY.js.map +0 -1
- package/dist/chunk-BEFM74L2.js.map +0 -1
- package/dist/chunk-BNUFUFAU.js.map +0 -1
- package/dist/chunk-C4F7VJ5D.cjs.map +0 -1
- package/dist/chunk-CPEL3YIR.cjs.map +0 -1
- package/dist/chunk-D7PG5D5K.js.map +0 -1
- package/dist/chunk-DI74SMXS.cjs +0 -29
- package/dist/chunk-DI74SMXS.cjs.map +0 -1
- package/dist/chunk-DK2S42XB.js +0 -77
- package/dist/chunk-DK2S42XB.js.map +0 -1
- package/dist/chunk-DRACN6XG.js +0 -27
- package/dist/chunk-DRACN6XG.js.map +0 -1
- package/dist/chunk-EE7N5XXQ.cjs.map +0 -1
- package/dist/chunk-EFELJVLA.js.map +0 -1
- package/dist/chunk-EPTSMFH7.cjs +0 -12
- package/dist/chunk-EQ7JKLZO.cjs +0 -157
- package/dist/chunk-EQ7JKLZO.cjs.map +0 -1
- package/dist/chunk-FJMPR3OH.cjs.map +0 -1
- package/dist/chunk-FMGEZBAQ.js.map +0 -1
- package/dist/chunk-FMMIX6N4.js.map +0 -1
- package/dist/chunk-FRHHDHKH.js.map +0 -1
- package/dist/chunk-FSXTPBRN.js.map +0 -1
- package/dist/chunk-G6Q5UM7U.js.map +0 -1
- package/dist/chunk-GYA4JRP5.js.map +0 -1
- package/dist/chunk-HOHAJ2NR.cjs +0 -61
- package/dist/chunk-HOHAJ2NR.cjs.map +0 -1
- package/dist/chunk-HOIFFY4M.js.map +0 -1
- package/dist/chunk-IIMQJYAM.js +0 -81
- package/dist/chunk-IIMQJYAM.js.map +0 -1
- package/dist/chunk-IJTLXNGJ.js.map +0 -1
- package/dist/chunk-ITE4IXAK.js +0 -25
- package/dist/chunk-ITE4IXAK.js.map +0 -1
- package/dist/chunk-K3BUWSFR.js.map +0 -1
- package/dist/chunk-KCO5EFJU.js +0 -79
- package/dist/chunk-KCO5EFJU.js.map +0 -1
- package/dist/chunk-KKYELPZ2.cjs +0 -83
- package/dist/chunk-KKYELPZ2.cjs.map +0 -1
- package/dist/chunk-MCHP7RHZ.cjs.map +0 -1
- package/dist/chunk-MIJKEVV7.js.map +0 -1
- package/dist/chunk-NCX65HBY.cjs +0 -1396
- package/dist/chunk-NCX65HBY.cjs.map +0 -1
- package/dist/chunk-OSZPLZIV.cjs.map +0 -1
- package/dist/chunk-OVUUTCPJ.cjs.map +0 -1
- package/dist/chunk-PDGEXGS6.cjs.map +0 -1
- package/dist/chunk-QB6VMOJ2.cjs.map +0 -1
- package/dist/chunk-QMQLUA66.js +0 -12
- package/dist/chunk-QMQLUA66.js.map +0 -1
- package/dist/chunk-QYWINYEA.cjs.map +0 -1
- package/dist/chunk-S4KQ5LV4.js.map +0 -1
- package/dist/chunk-SBPC5IP3.js.map +0 -1
- package/dist/chunk-SJDMVITW.cjs.map +0 -1
- package/dist/chunk-SNXVDZAJ.js.map +0 -1
- package/dist/chunk-SQRD2CYF.js.map +0 -1
- package/dist/chunk-ST3LPB2V.cjs.map +0 -1
- package/dist/chunk-STQ3BSED.cjs.map +0 -1
- package/dist/chunk-SVJ5GEXW.cjs.map +0 -1
- package/dist/chunk-TCRIQMBU.js.map +0 -1
- package/dist/chunk-TDXIBCGY.cjs.map +0 -1
- package/dist/chunk-TFMVL4QH.js.map +0 -1
- package/dist/chunk-TRF4EBJT.cjs +0 -30
- package/dist/chunk-TRF4EBJT.cjs.map +0 -1
- package/dist/chunk-TVLKA4AY.js +0 -94
- package/dist/chunk-TVLKA4AY.js.map +0 -1
- package/dist/chunk-UR7W5YQK.js.map +0 -1
- package/dist/chunk-VITTKBWF.js +0 -1263
- package/dist/chunk-VITTKBWF.js.map +0 -1
- package/dist/chunk-WBUFJ7BS.cjs +0 -131
- package/dist/chunk-WBUFJ7BS.cjs.map +0 -1
- package/dist/chunk-XR4YZFKW.cjs.map +0 -1
- package/dist/chunk-YNULOIR5.cjs.map +0 -1
- package/dist/chunk-ZDH3DX3C.cjs +0 -30
- package/dist/chunk-ZDH3DX3C.cjs.map +0 -1
- package/dist/chunk-ZTAJL4DT.cjs +0 -85
- package/dist/chunk-ZTAJL4DT.cjs.map +0 -1
- package/dist/define-graph-DVF-oN1i.d.cts +0 -173
- package/dist/define-graph-SvYXOl78.d.ts +0 -173
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { fnv1aBase36 } from './chunk-K34OPSJK.js';
|
|
2
2
|
import { MAX_PG_IDENTIFIER_LENGTH, TRUNCATED_IDENTIFIER_MAX_LENGTH, IDENTIFIER_COMPONENT_MAX_LENGTH } from './chunk-2EBMPJBO.js';
|
|
3
|
-
import { getNodeScopeColumns } from './chunk-
|
|
4
|
-
import { createSchemaIntrospector } from './chunk-
|
|
5
|
-
import { resolveFieldTypeInfoAtJsonPointer } from './chunk-
|
|
6
|
-
import { jsonPointer, normalizeJsonPointer, parseJsonPointer } from './chunk-
|
|
3
|
+
import { getNodeScopeColumns } from './chunk-YDFDBE6D.js';
|
|
4
|
+
import { createSchemaIntrospector } from './chunk-AMKPPFUO.js';
|
|
5
|
+
import { resolveFieldTypeInfoAtJsonPointer } from './chunk-W6OG3HDG.js';
|
|
6
|
+
import { jsonPointer, normalizeJsonPointer, parseJsonPointer } from './chunk-FWJKWH6U.js';
|
|
7
|
+
import { isInteropProbeKey, hasOwnKey } from './chunk-DYATYRY4.js';
|
|
7
8
|
|
|
8
9
|
// src/system-fields.ts
|
|
9
10
|
var NODE_META_KEYS = [
|
|
@@ -244,7 +245,7 @@ function createNodeWhereBuilder(node, schemaIntrospector) {
|
|
|
244
245
|
valueType: systemColumn.valueType
|
|
245
246
|
};
|
|
246
247
|
}
|
|
247
|
-
if (!(key
|
|
248
|
+
if (!hasOwnKey(shape, key)) {
|
|
248
249
|
throw new Error(
|
|
249
250
|
`Unknown field "${key}" in node index WHERE clause for "${node.kind}"`
|
|
250
251
|
);
|
|
@@ -257,7 +258,10 @@ function createNodeWhereBuilder(node, schemaIntrospector) {
|
|
|
257
258
|
valueType
|
|
258
259
|
};
|
|
259
260
|
}
|
|
260
|
-
return createWhereProxy(
|
|
261
|
+
return createWhereProxy(
|
|
262
|
+
(key) => getOperand(key),
|
|
263
|
+
(key) => system.has(key) || hasOwnKey(shape, key)
|
|
264
|
+
);
|
|
261
265
|
}
|
|
262
266
|
function createEdgeWhereBuilder(edge, schemaIntrospector) {
|
|
263
267
|
const shape = getSchemaShape(edge.schema);
|
|
@@ -271,7 +275,7 @@ function createEdgeWhereBuilder(edge, schemaIntrospector) {
|
|
|
271
275
|
valueType: systemColumn.valueType
|
|
272
276
|
};
|
|
273
277
|
}
|
|
274
|
-
if (!(key
|
|
278
|
+
if (!hasOwnKey(shape, key)) {
|
|
275
279
|
throw new Error(
|
|
276
280
|
`Unknown field "${key}" in edge index WHERE clause for "${edge.kind}"`
|
|
277
281
|
);
|
|
@@ -284,14 +288,16 @@ function createEdgeWhereBuilder(edge, schemaIntrospector) {
|
|
|
284
288
|
valueType
|
|
285
289
|
};
|
|
286
290
|
}
|
|
287
|
-
return createWhereProxy(
|
|
291
|
+
return createWhereProxy(
|
|
292
|
+
(key) => getOperand(key),
|
|
293
|
+
(key) => system.has(key) || hasOwnKey(shape, key)
|
|
294
|
+
);
|
|
288
295
|
}
|
|
289
|
-
function createWhereProxy(getOperand) {
|
|
290
|
-
return new Proxy(
|
|
296
|
+
function createWhereProxy(getOperand, declaresField) {
|
|
297
|
+
return new Proxy({}, {
|
|
291
298
|
get: (_target, property) => {
|
|
292
299
|
if (typeof property !== "string") return;
|
|
293
|
-
if (property
|
|
294
|
-
if (property === "toJSON") return;
|
|
300
|
+
if (isInteropProbeKey(property) && !declaresField(property)) return;
|
|
295
301
|
const operand = getOperand(property);
|
|
296
302
|
return createIndexWhereFieldBuilder(operand);
|
|
297
303
|
}
|
|
@@ -609,5 +615,5 @@ function sanitizeIdentifierComponent(value) {
|
|
|
609
615
|
}
|
|
610
616
|
|
|
611
617
|
export { EDGE_META_KEYS, NODE_META_KEYS, defineEdgeIndex, defineNodeIndex };
|
|
612
|
-
//# sourceMappingURL=chunk-
|
|
613
|
-
//# sourceMappingURL=chunk-
|
|
618
|
+
//# sourceMappingURL=chunk-I5MOXA4H.js.map
|
|
619
|
+
//# sourceMappingURL=chunk-I5MOXA4H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/system-fields.ts","../src/indexes/define-index.ts"],"names":[],"mappings":";;;;;;;;;AAAO,IAAM,cAAA,GAAiB;AAAA,EAC5B,SAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF;AAEO,IAAM,cAAA,GAAiB;AAAA,EAC5B,WAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF;;;AC0CA,IAAM,0BAAyD,IAAI,GAAA;AAAA,EACjE,CAAC,GAAG,4BAAA,EAA6B,CAAE,MAAA,EAAQ,CAAA,CAAE,GAAA,CAAI,CAAC,KAAA,KAAU,KAAA,CAAM,MAAM;AAC1E,CAAA;AAMO,SAAS,eAAA,CACd,MACA,MAAA,EACsB;AACtB,EAAA,MAAM,KAAA,GAAQ,OAAO,KAAA,IAAS,cAAA;AAC9B,EAAA,MAAM,MAAA,GAAS,OAAO,MAAA,IAAU,KAAA;AAChC,EAAA,MAAM,gBAAA,GAAmB,gCAAA;AAAA,IACv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A,KAAc,MAAA,GAAS,MAAA,GAAY,KAAA,CAAM,SAAA;AAAA,IAC/C,KAAA,CAAM,SAAS,MAAA,GAAS,MAAA;AAAA,IACxB,MAAM,KAAA,KAAU,cAAA,GACd,MAAA,GACA,2BAAA,CAA4B,MAAM,KAAK,CAAA;AAAA,IACzC;AAAA,GACF,CAAE,MAAA,CAAO,CAAC,IAAA,KAAS,SAAS,MAAS,CAAA;AAErC,EAAA,MAAM,MAAA,GAAS,SAAA,CAAU,IAAA,CAAK,GAAG,CAAA;AACjC,EAAA,OAAO,MAAA,CAAO,MAAA,IAAU,wBAAA,GACpB,MAAA,GACA,CAAA,EAAG,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,+BAA+B,CAAC,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AACjE;AAEA,SAAS,4BAA4B,KAAA,EAAuB;AAC1D,EAAA,OAAO,KAAA,CACJ,WAAA,EAAY,CACZ,UAAA,CAAW,cAAA,EAAgB,GAAG,CAAA,CAC9B,UAAA,CAAW,UAAA,EAAY,EAAE,CAAA,CACzB,KAAA,CAAM,GAAG,+BAA+B,CAAA;AAC7C","file":"chunk-I5MOXA4H.js","sourcesContent":["export const NODE_META_KEYS = [\n \"version\",\n \"validFrom\",\n \"validTo\",\n \"createdAt\",\n \"updatedAt\",\n \"deletedAt\",\n] as const;\n\nexport const EDGE_META_KEYS = [\n \"validFrom\",\n \"validTo\",\n \"createdAt\",\n \"updatedAt\",\n \"deletedAt\",\n] as const;\n","import { type z } from \"zod\";\n\nimport {\n IDENTIFIER_COMPONENT_MAX_LENGTH,\n MAX_PG_IDENTIFIER_LENGTH,\n TRUNCATED_IDENTIFIER_MAX_LENGTH,\n} from \"../constants\";\nimport {\n type AnyEdgeType,\n type KindEntity,\n type NodeType,\n} from \"../core/types\";\nimport { type ValueType } from \"../query/ast\";\nimport { resolveFieldTypeInfoAtJsonPointer } from \"../query/field-type-info\";\nimport {\n type JsonPointer,\n jsonPointer,\n type JsonPointerInput,\n type JsonPointerSegment,\n normalizeJsonPointer,\n parseJsonPointer,\n} from \"../query/json-pointer\";\nimport {\n createSchemaIntrospector,\n type FieldTypeInfo,\n} from \"../query/schema-introspector\";\nimport { EDGE_META_KEYS, NODE_META_KEYS } from \"../system-fields\";\nimport { fnv1aBase36 } from \"../utils/hash\";\nimport { hasOwnKey, isInteropProbeKey } from \"../utils/object\";\nimport { getNodeScopeColumns } from \"./compiler\";\nimport {\n type EdgeIndexConfig,\n type EdgeIndexDeclaration,\n type EdgeIndexDirection,\n type EdgeIndexWhereBuilder,\n type IndexFieldInput,\n type IndexScope,\n type IndexWhereExpression,\n type IndexWhereFieldBuilder,\n type IndexWhereLiteral,\n type IndexWhereOp,\n type IndexWhereOperand,\n type NodeIndexConfig,\n type NodeIndexDeclaration,\n type NodeIndexWhereBuilder,\n type RelationalIndexMethod,\n type SystemColumnName,\n} from \"./types\";\n\n// `keySystemColumns` on a node index must fail closed: reject anything that\n// isn't a known node-valid column, not just the known edge-only ones. A\n// caller whose array escapes TypeScript's literal-union checking (`any`-typed\n// data, a value round-tripped through JSON) could otherwise pass a typo'd or\n// otherwise-invalid column that silently reaches SQL DDL generation instead\n// of failing here with a clear error. Derived from the single source of\n// truth (`createSystemColumnMapForNode`, hoisted — see below) rather than a\n// second hand-maintained list, so it can't drift from it.\nconst NODE_KEY_SYSTEM_COLUMNS: ReadonlySet<SystemColumnName> = new Set(\n [...createSystemColumnMapForNode().values()].map((entry) => entry.column),\n);\n\n// ============================================================\n// Public API\n// ============================================================\n\nexport function defineNodeIndex<N extends NodeType>(\n node: N,\n config: NodeIndexConfig<N>,\n): NodeIndexDeclaration {\n const scope = config.scope ?? \"graphAndKind\";\n const unique = config.unique ?? false;\n const keySystemColumns = normalizeKeySystemColumnsOrThrow(\n config.keySystemColumns ?? [],\n scope,\n unique,\n );\n\n const schemaIntrospector = createSchemaIntrospector(\n new Map([[node.kind, { schema: node.schema }]]),\n );\n\n const { pointers: fields, valueTypes: fieldValueTypes } =\n normalizeNodeIndexFieldsOrThrow(\n node,\n config.fields ?? [],\n schemaIntrospector,\n \"fields\",\n // GIN containment indexes exist precisely for array/object fields,\n // which the btree guard otherwise rejects.\n { allowJsonFields: config.method === \"gin\" },\n );\n\n const { pointers: coveringFields, valueTypes: coveringFieldValueTypes } =\n normalizeNodeIndexFieldsOrThrow(\n node,\n config.coveringFields ?? [],\n schemaIntrospector,\n \"coveringFields\",\n {},\n );\n assertNoOverlap(fields, coveringFields, \"fields\", \"coveringFields\");\n\n if (\n fields.length === 0 &&\n coveringFields.length === 0 &&\n keySystemColumns.length === 0\n ) {\n throw new Error(\n \"Index must declare at least one of fields, coveringFields, or keySystemColumns\",\n );\n }\n\n const where = normalizeWhereInput(config.where, () =>\n createNodeWhereBuilder(node, schemaIntrospector),\n );\n\n const method = resolveAdvancedIndexMethod(config.method, {\n fieldCount: fields.length,\n fieldValueType: fieldValueTypes[0],\n coveringFieldCount: coveringFields.length,\n keySystemColumnCount: keySystemColumns.length,\n unique,\n hasWhere: where !== undefined,\n });\n\n const defaultName = generateDefaultIndexName({\n kind: \"node\",\n kindName: node.kind,\n unique,\n scope,\n direction: \"none\",\n fields,\n coveringFields,\n keySystemColumns,\n });\n const name =\n config.name ??\n (method === undefined ? defaultName : `${defaultName}_${method}`);\n\n // `origin` is intentionally omitted: `\"compile-time\"` is the default\n // and is canonicalized by absence so the serialized form stays\n // byte-identical for legacy graphs. `method` and `keySystemColumns`\n // follow the same rule (absence == \"btree\" / no system key columns).\n return {\n entity: \"node\",\n kind: node.kind,\n name,\n fields,\n fieldValueTypes,\n coveringFields,\n coveringFieldValueTypes,\n unique,\n scope,\n where,\n ...(method === undefined ? {} : { method }),\n ...(keySystemColumns.length === 0 ? {} : { keySystemColumns }),\n };\n}\n\n/**\n * Validates `keySystemColumns`: must be node system columns (not\n * edge-only `from_kind`/`from_id`/`to_kind`/`to_id`), must not repeat\n * each other, must not repeat a column `scope` already prefixes the key\n * with, and must not combine `\"id\"` with `unique` (every node's `id` is\n * already unique per row, so that combination can never enforce a\n * meaningful constraint across the index's other key columns).\n */\nfunction normalizeKeySystemColumnsOrThrow(\n columns: readonly SystemColumnName[],\n scope: IndexScope,\n unique: boolean,\n): readonly SystemColumnName[] {\n if (columns.length === 0) return [];\n\n for (const column of columns) {\n if (!NODE_KEY_SYSTEM_COLUMNS.has(column)) {\n throw new Error(\n `Node index keySystemColumns does not support \"${column}\" (edge-only system column)`,\n );\n }\n }\n assertUnique(columns, \"keySystemColumns\");\n\n const scopeColumns = new Set(getNodeScopeColumns(scope));\n for (const column of columns) {\n if (scopeColumns.has(column)) {\n throw new Error(\n `Node index keySystemColumns must not repeat a column already implied by scope \"${scope}\": \"${column}\"`,\n );\n }\n }\n\n if (unique && columns.includes(\"id\")) {\n throw new Error(\n `unique node indexes cannot include keySystemColumns: [\"id\"]; id is already unique per node, so including it defeats uniqueness across the prop fields`,\n );\n }\n\n // Return a fresh array: the declaration must own an immutable snapshot, not\n // a reference to the caller's array. Otherwise a post-call mutation of the\n // original `config.keySystemColumns` bypasses these checks and desyncs the\n // already-computed name/hash from the compiled index keys.\n return [...columns];\n}\n\nexport function defineEdgeIndex<E extends AnyEdgeType>(\n edge: E,\n config: EdgeIndexConfig<E>,\n): EdgeIndexDeclaration {\n const scope = config.scope ?? \"graphAndKind\";\n const unique = config.unique ?? false;\n const direction = config.direction ?? \"none\";\n\n const schemaIntrospector = createSchemaIntrospector(\n new Map(),\n new Map([[edge.kind, { schema: edge.schema }]]),\n );\n\n const { pointers: fields, valueTypes: fieldValueTypes } =\n normalizeEdgeIndexFieldsOrThrow(\n edge,\n config.fields,\n schemaIntrospector,\n \"fields\",\n { allowEmpty: false, allowJsonFields: config.method === \"gin\" },\n );\n\n const { pointers: coveringFields, valueTypes: coveringFieldValueTypes } =\n normalizeEdgeIndexFieldsOrThrow(\n edge,\n config.coveringFields ?? [],\n schemaIntrospector,\n \"coveringFields\",\n { allowEmpty: true },\n );\n assertNoOverlap(fields, coveringFields, \"fields\", \"coveringFields\");\n\n const where = normalizeWhereInput(config.where, () =>\n createEdgeWhereBuilder(edge, schemaIntrospector),\n );\n\n const method = resolveAdvancedIndexMethod(config.method, {\n fieldCount: fields.length,\n fieldValueType: fieldValueTypes[0],\n coveringFieldCount: coveringFields.length,\n keySystemColumnCount: 0,\n unique,\n hasWhere: where !== undefined,\n });\n\n const defaultName = generateDefaultIndexName({\n kind: \"edge\",\n kindName: edge.kind,\n unique,\n scope,\n direction,\n fields,\n coveringFields,\n });\n const name =\n config.name ??\n (method === undefined ? defaultName : `${defaultName}_${method}`);\n\n return {\n entity: \"edge\",\n kind: edge.kind,\n name,\n fields,\n fieldValueTypes,\n coveringFields,\n coveringFieldValueTypes,\n unique,\n scope,\n direction,\n where,\n ...(method === undefined ? {} : { method }),\n };\n}\n\n/**\n * Validates and canonicalizes a declaration's index method. `\"btree\"` (or\n * absent) canonicalizes to `undefined` so serialized declarations and\n * materialization signatures from before `method` existed stay\n * byte-identical. GIN-family methods index one expression and have no\n * ordered key columns, so multi-field, covering, unique, and partial\n * variants are rejected at declaration time rather than failing as\n * confusing DDL errors at materialization time.\n */\nfunction resolveAdvancedIndexMethod(\n method: RelationalIndexMethod | undefined,\n details: Readonly<{\n fieldCount: number;\n fieldValueType: ValueType | undefined;\n coveringFieldCount: number;\n keySystemColumnCount: number;\n unique: boolean;\n hasWhere: boolean;\n }>,\n): Exclude<RelationalIndexMethod, \"btree\"> | undefined {\n const resolved = method ?? \"btree\";\n if (resolved === \"btree\") return undefined;\n if (details.fieldCount !== 1) {\n throw new Error(\n `Index method \"${resolved}\" requires exactly one field (a GIN indexes one expression), got ${details.fieldCount}`,\n );\n }\n // Enforce the field-type contract the methods advertise: gin serves the\n // array containment predicates, trigram serves the string substring /\n // case-insensitive predicates. Anything else (including unresolvable\n // field types) would materialize an index no documented predicate can\n // ever use, so it is rejected here rather than silently costing write\n // amplification for nothing.\n if (resolved === \"gin\" && details.fieldValueType !== \"array\") {\n throw new Error(\n details.fieldValueType === \"string\" ?\n 'Index method \"gin\" serves array containment; for substring or case-insensitive matching on a string field use method: \"trigram\"'\n : `Index method \"gin\" requires an array field (it serves the array containment predicates), got field type \"${details.fieldValueType ?? \"unresolved\"}\"`,\n );\n }\n if (resolved === \"trigram\" && details.fieldValueType !== \"string\") {\n throw new Error(\n details.fieldValueType === \"array\" ?\n 'Index method \"trigram\" serves substring matching on string fields; for array containment use method: \"gin\"'\n : `Index method \"trigram\" requires a string field (it serves substring and case-insensitive matches), got field type \"${details.fieldValueType ?? \"unresolved\"}\"`,\n );\n }\n const extraKeyColumns: readonly [string, number][] = [\n [\"coveringFields\", details.coveringFieldCount],\n [\"keySystemColumns\", details.keySystemColumnCount],\n ];\n for (const [label, count] of extraKeyColumns) {\n if (count > 0) {\n throw new Error(\n `Index method \"${resolved}\" does not support ${label} (GIN indexes cannot serve index-only scans over extra columns)`,\n );\n }\n }\n if (details.unique) {\n throw new Error(\n `Index method \"${resolved}\" does not support unique (GIN indexes cannot enforce uniqueness)`,\n );\n }\n if (details.hasWhere) {\n throw new Error(\n `Index method \"${resolved}\" does not support a partial where clause`,\n );\n }\n return resolved;\n}\n\n// ============================================================\n// WHERE Builder\n// ============================================================\n\n/**\n * The WHERE builder currently only supports top-level fields.\n * Nested field access (e.g., `where.metadata.priority.gt(5)`) is not supported.\n * Use top-level field predicates like `where.status.eq(\"active\")`.\n *\n * For complex nested predicates, use `andWhere()`, `orWhere()`, and `notWhere()`\n * to compose multiple top-level conditions.\n */\n\nfunction normalizeWhereInput<Builder>(\n input:\n | ((where: Builder) => IndexWhereExpression)\n | IndexWhereExpression\n | undefined,\n createBuilder: () => Builder,\n): IndexWhereExpression | undefined {\n if (input === undefined) {\n return undefined;\n }\n\n if (typeof input === \"function\") {\n return input(createBuilder());\n }\n\n return input;\n}\n\ntype NodeShape = Readonly<Record<string, z.ZodType>>;\ntype EdgeShape = Readonly<Record<string, z.ZodType>>;\n\nfunction createNodeWhereBuilder<N extends NodeType>(\n node: N,\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n): NodeIndexWhereBuilder<N> {\n const shape = getSchemaShape(node.schema);\n const system = createSystemColumnMapForNode();\n\n function getOperand(key: string): IndexWhereOperand {\n const systemColumn = system.get(key);\n if (systemColumn) {\n return {\n __type: \"index_operand_system\",\n column: systemColumn.column,\n valueType: systemColumn.valueType,\n };\n }\n\n if (!hasOwnKey(shape, key)) {\n throw new Error(\n `Unknown field \"${key}\" in node index WHERE clause for \"${node.kind}\"`,\n );\n }\n\n const info = schemaIntrospector.getFieldTypeInfo(node.kind, key);\n const valueType = info?.valueType;\n\n return {\n __type: \"index_operand_prop\",\n field: key,\n valueType,\n };\n }\n\n return createWhereProxy<NodeIndexWhereBuilder<N>>(\n (key) => getOperand(key),\n (key) => system.has(key) || hasOwnKey(shape, key),\n );\n}\n\nfunction createEdgeWhereBuilder<E extends AnyEdgeType>(\n edge: E,\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n): EdgeIndexWhereBuilder<E> {\n const shape = getSchemaShape(edge.schema);\n const system = createSystemColumnMapForEdge();\n\n function getOperand(key: string): IndexWhereOperand {\n const systemColumn = system.get(key);\n if (systemColumn) {\n return {\n __type: \"index_operand_system\",\n column: systemColumn.column,\n valueType: systemColumn.valueType,\n };\n }\n\n if (!hasOwnKey(shape, key)) {\n throw new Error(\n `Unknown field \"${key}\" in edge index WHERE clause for \"${edge.kind}\"`,\n );\n }\n\n const info = schemaIntrospector.getEdgeFieldTypeInfo(edge.kind, key);\n const valueType = info?.valueType;\n\n return {\n __type: \"index_operand_prop\",\n field: key,\n valueType,\n };\n }\n\n return createWhereProxy<EdgeIndexWhereBuilder<E>>(\n (key) => getOperand(key),\n (key) => system.has(key) || hasOwnKey(shape, key),\n );\n}\n\nfunction createWhereProxy<TBuilder extends object>(\n getOperand: (key: string) => IndexWhereOperand,\n declaresField: (key: string) => boolean,\n): TBuilder {\n // An ORDINARY object target, even though the target is never read: a proxy's\n // target is what `instanceof`, `Object.getPrototypeOf` and every other\n // internal method resolve against, and this proxy is handed to the CALLER's\n // `where:` callback. A null-prototype target made `builder instanceof Object`\n // answer `false` for no benefit — nothing is ever written to it, so it was\n // not even the `__proto__`-write protection a data-keyed bag exists for.\n return new Proxy({} as TBuilder, {\n get: (_target, property: string | symbol) => {\n if (typeof property !== \"string\") return;\n\n // A DECLARED field wins over the interop exemption, for the reason\n // `isInteropProbeKey` documents: `then` and `toJSON` are legal schema\n // field names, and refusing them here left a partial index unable to\n // reference a field the schema declares. Only an UNDECLARED probe\n // resolves to `undefined`, keeping the builder safe to await or\n // stringify.\n if (isInteropProbeKey(property) && !declaresField(property)) return;\n\n const operand = getOperand(property);\n return createIndexWhereFieldBuilder(operand);\n },\n });\n}\n\nfunction createIndexWhereFieldBuilder<T>(\n operand: IndexWhereOperand,\n): IndexWhereFieldBuilder<T> {\n function isNull(): IndexWhereExpression {\n return { __type: \"index_where_null_check\", operand, op: \"isNull\" };\n }\n\n function isNotNull(): IndexWhereExpression {\n return { __type: \"index_where_null_check\", operand, op: \"isNotNull\" };\n }\n\n function comparison(op: IndexWhereOp, value: unknown): IndexWhereExpression {\n return {\n __type: \"index_where_comparison\",\n left: operand,\n op,\n right: toLiteralOrThrow(value, operand.valueType),\n };\n }\n\n function listComparison(\n op: IndexWhereOp,\n values: readonly unknown[],\n ): IndexWhereExpression {\n const literals = values.map((value) =>\n toLiteralOrThrow(value, operand.valueType),\n );\n return {\n __type: \"index_where_comparison\",\n left: operand,\n op,\n right: literals,\n };\n }\n\n return {\n eq: (value) => comparison(\"eq\", value),\n neq: (value) => comparison(\"neq\", value),\n gt: (value) => comparison(\"gt\", value),\n gte: (value) => comparison(\"gte\", value),\n lt: (value) => comparison(\"lt\", value),\n lte: (value) => comparison(\"lte\", value),\n in: (values) => listComparison(\"in\", values),\n notIn: (values) => listComparison(\"notIn\", values),\n isNull,\n isNotNull,\n };\n}\n\nfunction toLiteralOrThrow(\n value: unknown,\n preferredType: ValueType | undefined,\n): IndexWhereLiteral {\n if (value instanceof Date) {\n return {\n __type: \"index_where_literal\",\n value: value.toISOString(),\n valueType: \"date\",\n };\n }\n\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ) {\n const valueType = inferValueType(value, preferredType);\n return { __type: \"index_where_literal\", value, valueType };\n }\n\n throw new Error(\n `Unsupported literal value type in index WHERE clause: ${String(value)}`,\n );\n}\n\nfunction inferValueType(\n value: string | number | boolean,\n preferredType: ValueType | undefined,\n): ValueType {\n if (preferredType === \"date\" && typeof value === \"string\") {\n return \"date\";\n }\n if (preferredType === \"number\" && typeof value === \"string\") {\n return \"number\";\n }\n if (preferredType === \"boolean\" && typeof value === \"string\") {\n return \"boolean\";\n }\n\n if (typeof value === \"string\") return \"string\";\n if (typeof value === \"number\") return \"number\";\n return \"boolean\";\n}\n\nfunction toSystemColumnName(metaKey: string): SystemColumnName {\n const snake = metaKey.replaceAll(/([A-Z])/g, \"_$1\").toLowerCase();\n\n switch (snake) {\n case \"deleted_at\":\n case \"valid_from\":\n case \"valid_to\":\n case \"created_at\":\n case \"updated_at\": {\n return snake;\n }\n default: {\n throw new Error(`Unsupported system meta key: ${metaKey}`);\n }\n }\n}\n\nfunction createSystemColumnMapForNode(): Map<\n string,\n Readonly<{ column: SystemColumnName; valueType: ValueType | undefined }>\n> {\n const entries: (readonly [\n string,\n Readonly<{ column: SystemColumnName; valueType: ValueType | undefined }>,\n ])[] = [\n [\"graphId\", { column: \"graph_id\", valueType: \"string\" }],\n [\"kind\", { column: \"kind\", valueType: \"string\" }],\n [\"id\", { column: \"id\", valueType: \"string\" }],\n ];\n\n for (const key of NODE_META_KEYS) {\n if (key === \"version\") {\n entries.push([key, { column: \"version\", valueType: \"number\" }]);\n continue;\n }\n entries.push([key, { column: toSystemColumnName(key), valueType: \"date\" }]);\n }\n\n return new Map(entries);\n}\n\nfunction createSystemColumnMapForEdge(): Map<\n string,\n Readonly<{ column: SystemColumnName; valueType: ValueType | undefined }>\n> {\n const entries: (readonly [\n string,\n Readonly<{ column: SystemColumnName; valueType: ValueType | undefined }>,\n ])[] = [\n [\"graphId\", { column: \"graph_id\", valueType: \"string\" }],\n [\"kind\", { column: \"kind\", valueType: \"string\" }],\n [\"id\", { column: \"id\", valueType: \"string\" }],\n [\"fromKind\", { column: \"from_kind\", valueType: \"string\" }],\n [\"fromId\", { column: \"from_id\", valueType: \"string\" }],\n [\"toKind\", { column: \"to_kind\", valueType: \"string\" }],\n [\"toId\", { column: \"to_id\", valueType: \"string\" }],\n ];\n\n for (const key of EDGE_META_KEYS) {\n entries.push([key, { column: toSystemColumnName(key), valueType: \"date\" }]);\n }\n\n return new Map(entries);\n}\n\nfunction getSchemaShape(schema: z.ZodType): NodeShape | EdgeShape {\n if (schema.type !== \"object\") {\n throw new Error(\"Index definitions require an object schema\");\n }\n\n const def = schema.def as { shape?: Record<string, z.ZodType> };\n const shape = def.shape;\n if (!shape) {\n throw new Error(\"Index definitions require a resolvable object shape\");\n }\n\n return shape;\n}\n\n// ============================================================\n// Validation\n// ============================================================\n\nfunction assertNonEmpty(values: readonly unknown[], label: string): void {\n if (values.length === 0) {\n throw new Error(`Index ${label} must not be empty`);\n }\n}\n\nfunction assertUnique(values: readonly string[], label: string): void {\n const set = new Set<string>();\n for (const value of values) {\n if (set.has(value)) {\n throw new Error(`Index ${label} contains duplicate value: ${value}`);\n }\n set.add(value);\n }\n}\n\nfunction assertNoOverlap(\n a: readonly string[],\n b: readonly string[],\n aLabel: string,\n bLabel: string,\n): void {\n const set = new Set(a);\n for (const value of b) {\n if (set.has(value)) {\n throw new Error(`Index ${bLabel} must not overlap ${aLabel}: ${value}`);\n }\n }\n}\n\nfunction assertIndexableValueType(\n valueType: ValueType,\n context: string,\n options: Readonly<{ allowJsonFields: boolean }>,\n): void {\n if (valueType === \"embedding\") {\n throw new Error(\n `Cannot create props index for embedding field (${context}); embedding() fields are indexed automatically in the vector strategy's per-(kind, field) storage`,\n );\n }\n\n if (\n (valueType === \"array\" || valueType === \"object\") &&\n !options.allowJsonFields\n ) {\n throw new Error(\n `Cannot create btree props index for ${valueType} field (${context}); use method: \"gin\" instead`,\n );\n }\n}\n\ntype NormalizedIndexFields = Readonly<{\n pointers: readonly JsonPointer[];\n valueTypes: readonly (ValueType | undefined)[];\n}>;\n\nfunction normalizeNodeIndexFieldsOrThrow<N extends NodeType>(\n node: N,\n inputs: readonly IndexFieldInput<z.infer<N[\"schema\"]>>[],\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n label: string,\n options: Readonly<{ allowJsonFields?: boolean }>,\n): NormalizedIndexFields {\n // Node `fields`/`coveringFields` are both optional (an index can be keyed\n // by `keySystemColumns` alone), so unlike the edge equivalent below, an\n // empty input is always valid here — `defineNodeIndex` enforces that at\n // least one of `fields`/`coveringFields`/`keySystemColumns` is non-empty.\n if (inputs.length === 0) {\n return { pointers: [], valueTypes: [] };\n }\n\n const pointers: JsonPointer[] = [];\n const valueTypes: (ValueType | undefined)[] = [];\n\n for (const input of inputs) {\n const pointer = normalizeIndexFieldPointer(input);\n const info = resolveNodeFieldTypeInfoOrThrow(\n node.kind,\n pointer,\n schemaIntrospector,\n );\n assertIndexableValueType(info.valueType, `node \"${node.kind}\" ${pointer}`, {\n allowJsonFields: options.allowJsonFields ?? false,\n });\n pointers.push(pointer);\n valueTypes.push(info.valueType);\n }\n\n assertUnique(pointers, label);\n\n return { pointers, valueTypes };\n}\n\nfunction normalizeEdgeIndexFieldsOrThrow<E extends AnyEdgeType>(\n edge: E,\n inputs: readonly IndexFieldInput<z.infer<E[\"schema\"]>>[],\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n label: string,\n options: Readonly<{ allowEmpty: boolean; allowJsonFields?: boolean }>,\n): NormalizedIndexFields {\n if (inputs.length === 0 && options.allowEmpty) {\n return { pointers: [], valueTypes: [] };\n }\n assertNonEmpty(inputs, label);\n\n const pointers: JsonPointer[] = [];\n const valueTypes: (ValueType | undefined)[] = [];\n\n for (const input of inputs) {\n const pointer = normalizeIndexFieldPointer(input);\n const info = resolveEdgeFieldTypeInfoOrThrow(\n edge.kind,\n pointer,\n schemaIntrospector,\n );\n assertIndexableValueType(info.valueType, `edge \"${edge.kind}\" ${pointer}`, {\n allowJsonFields: options.allowJsonFields ?? false,\n });\n pointers.push(pointer);\n valueTypes.push(info.valueType);\n }\n\n assertUnique(pointers, label);\n\n return { pointers, valueTypes };\n}\n\nfunction normalizeIndexFieldPointer<T>(input: IndexFieldInput<T>): JsonPointer {\n if (Array.isArray(input)) {\n if (input.length === 0) {\n throw new Error(\"Index field JSON pointer must not be empty\");\n }\n return jsonPointer(input as readonly JsonPointerSegment[]);\n }\n\n if (typeof input === \"string\") {\n if (input.startsWith(\"/\")) {\n const pointer = normalizeJsonPointer(\n input as JsonPointerInput<Record<string, unknown>>,\n );\n if (pointer === \"\") {\n throw new Error(\"Index field JSON pointer must not be empty\");\n }\n return pointer;\n }\n return jsonPointer([input]);\n }\n\n throw new Error(`Unsupported index field input: ${String(input)}`);\n}\n\nfunction resolveNodeFieldTypeInfoOrThrow(\n nodeKind: string,\n pointer: JsonPointer,\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n): FieldTypeInfo {\n const segments = parseJsonPointer(pointer);\n const [first, ...rest] = segments;\n if (!first) {\n throw new Error(\"Index field JSON pointer must not be empty\");\n }\n\n const rootInfo = schemaIntrospector.getFieldTypeInfo(nodeKind, first);\n if (!rootInfo) {\n throw new Error(\n `Unknown field \"${first}\" for node \"${nodeKind}\" in index definition`,\n );\n }\n\n if (rest.length === 0) {\n return rootInfo;\n }\n\n const resolved = resolveFieldTypeInfoAtJsonPointer(\n rootInfo,\n jsonPointer(rest),\n );\n if (!resolved) {\n throw new Error(\n `Unknown JSON pointer \"${pointer}\" for node \"${nodeKind}\" in index definition`,\n );\n }\n\n return resolved;\n}\n\nfunction resolveEdgeFieldTypeInfoOrThrow(\n edgeKind: string,\n pointer: JsonPointer,\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n): FieldTypeInfo {\n const segments = parseJsonPointer(pointer);\n const [first, ...rest] = segments;\n if (!first) {\n throw new Error(\"Index field JSON pointer must not be empty\");\n }\n\n const rootInfo = schemaIntrospector.getEdgeFieldTypeInfo(edgeKind, first);\n if (!rootInfo) {\n throw new Error(\n `Unknown field \"${first}\" for edge \"${edgeKind}\" in index definition`,\n );\n }\n\n if (rest.length === 0) {\n return rootInfo;\n }\n\n const resolved = resolveFieldTypeInfoAtJsonPointer(\n rootInfo,\n jsonPointer(rest),\n );\n if (!resolved) {\n throw new Error(\n `Unknown JSON pointer \"${pointer}\" for edge \"${edgeKind}\" in index definition`,\n );\n }\n\n return resolved;\n}\n\n// ============================================================\n// Default Name Generation\n// ============================================================\n\ntype DefaultNameParts = Readonly<{\n kind: KindEntity;\n kindName: string;\n unique: boolean;\n scope: IndexScope;\n direction: EdgeIndexDirection;\n fields: readonly string[];\n coveringFields: readonly string[];\n /**\n * Node-only, defaults to `[]` for edges. Folded into the hash/name only\n * when non-empty so indexes that don't use it keep byte-identical\n * default names to before this field existed.\n */\n keySystemColumns?: readonly string[];\n}>;\n\nfunction generateDefaultIndexName(parts: DefaultNameParts): string {\n const keySystemColumns = parts.keySystemColumns ?? [];\n const hash = fnv1aBase36(\n JSON.stringify({\n kind: parts.kind,\n kindName: parts.kindName,\n unique: parts.unique,\n scope: parts.scope,\n direction: parts.direction,\n fields: parts.fields,\n covering: parts.coveringFields,\n ...(keySystemColumns.length > 0 ? { keySystemColumns } : {}),\n }),\n );\n\n const nameParts = [\n \"idx\",\n \"tg\",\n parts.kind,\n sanitizeIdentifierComponent(parts.kindName),\n parts.fields.length > 0 ?\n sanitizeIdentifierComponent(parts.fields.join(\"_\"))\n : undefined,\n parts.coveringFields.length > 0 ?\n `cov_${sanitizeIdentifierComponent(parts.coveringFields.join(\"_\"))}`\n : undefined,\n keySystemColumns.length > 0 ?\n `sys_${sanitizeIdentifierComponent(keySystemColumns.join(\"_\"))}`\n : undefined,\n parts.direction === \"none\" ? undefined : parts.direction,\n parts.unique ? \"uniq\" : undefined,\n parts.scope === \"graphAndKind\" ?\n undefined\n : sanitizeIdentifierComponent(parts.scope),\n hash,\n ].filter((part) => part !== undefined);\n\n const joined = nameParts.join(\"_\");\n return joined.length <= MAX_PG_IDENTIFIER_LENGTH ?\n joined\n : `${joined.slice(0, TRUNCATED_IDENTIFIER_MAX_LENGTH)}_${hash}`;\n}\n\nfunction sanitizeIdentifierComponent(value: string): string {\n return value\n .toLowerCase()\n .replaceAll(/[^a-z0-9_]+/g, \"_\")\n .replaceAll(/^_+|_+$/g, \"\")\n .slice(0, IDENTIFIER_COMPONENT_MAX_LENGTH);\n}\n"]}
|
|
@@ -72,6 +72,10 @@ Suggestion: ${this.suggestion}`;
|
|
|
72
72
|
return lines.join("\n");
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
+
var INVERTED_VALIDITY_WINDOW_CODE = "INVERTED_VALIDITY_WINDOW";
|
|
76
|
+
var IMMUTABLE_VALIDITY_LOWER_BOUND_CODE = "IMMUTABLE_VALIDITY_LOWER_BOUND";
|
|
77
|
+
var EDGE_IDENTITY_MISMATCH_CODE = "EDGE_IDENTITY_MISMATCH";
|
|
78
|
+
var ENTITY_ALREADY_EXISTS_CODE = "ENTITY_ALREADY_EXISTS";
|
|
75
79
|
var ValidationError = class extends TypeGraphError {
|
|
76
80
|
constructor(message, details, options) {
|
|
77
81
|
const fieldList = details.issues.length > 0 ? details.issues.map((index) => index.path || "(root)").join(", ") : "unknown";
|
|
@@ -237,6 +241,36 @@ var DisjointError = class extends TypeGraphError {
|
|
|
237
241
|
this.name = "DisjointError";
|
|
238
242
|
}
|
|
239
243
|
};
|
|
244
|
+
var IdentityContradictionError = class extends TypeGraphError {
|
|
245
|
+
constructor(details, options) {
|
|
246
|
+
super(
|
|
247
|
+
`Identity contradiction: ${details.a.kind}/${details.a.id} and ${details.b.kind}/${details.b.id} cannot satisfy ${details.operation}.`,
|
|
248
|
+
"IDENTITY_CONTRADICTION",
|
|
249
|
+
{
|
|
250
|
+
details,
|
|
251
|
+
category: "constraint",
|
|
252
|
+
suggestion: "Retract the conflicting identity assertion or correct the graph ontology before retrying.",
|
|
253
|
+
cause: options?.cause
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
this.name = "IdentityContradictionError";
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
var IdentitySeparationViolationError = class extends TypeGraphError {
|
|
260
|
+
constructor(details, options) {
|
|
261
|
+
super(
|
|
262
|
+
`Identity separation violated: ${details.a.kind}/${details.a.id} and ${details.b.kind}/${details.b.id} are held apart by assertion ${details.assertionId}, but this write would put both in identity class ${details.classKey}.`,
|
|
263
|
+
"IDENTITY_SEPARATION_VIOLATION",
|
|
264
|
+
{
|
|
265
|
+
details,
|
|
266
|
+
category: "constraint",
|
|
267
|
+
suggestion: "Retract the conflicting different assertion before merging these identity classes. If no application call requested this merge, the write reached the ledger through a path that skipped identity validation.",
|
|
268
|
+
cause: options?.cause
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
this.name = "IdentitySeparationViolationError";
|
|
272
|
+
}
|
|
273
|
+
};
|
|
240
274
|
var RestrictedDeleteError = class extends TypeGraphError {
|
|
241
275
|
constructor(details, options) {
|
|
242
276
|
const edgeList = details.edgeKinds.join(", ");
|
|
@@ -396,6 +430,35 @@ var ConfigurationError = class extends TypeGraphError {
|
|
|
396
430
|
this.name = "ConfigurationError";
|
|
397
431
|
}
|
|
398
432
|
};
|
|
433
|
+
var CONTRIBUTION_REBUILD_REFUSAL_MESSAGE = {
|
|
434
|
+
"vector-source-unavailable": "Vector contributions cannot be rebuilt: TypeGraph stores the vectors callers supply and never the inputs that produced them, so the embeddings exist only in the storage a rebuild would drop.",
|
|
435
|
+
"no-drop-ddl": "The active strategy declares no teardown DDL for this contribution, so its storage cannot be dropped and recreated.",
|
|
436
|
+
"no-schema-fence": "This backend exposes no transactional schema fence, so a rebuild's drop, recreate, refill, and marker stamp cannot be made atomic.",
|
|
437
|
+
"shared-storage-in-use": "This contribution's storage is provisioned at a different shape than the current declaration, and the only repair \u2014 recreating it \u2014 would destroy fulltext content belonging to other graphs that share the same table and can only be rebuilt from their own processes."
|
|
438
|
+
};
|
|
439
|
+
var CONTRIBUTION_REBUILD_REFUSAL_SUGGESTION = {
|
|
440
|
+
"vector-source-unavailable": "Run store.reembedVectorField(kind, fieldPath, { embed }) instead: it recreates the field's storage and takes the callback that regenerates the embeddings the recreate discards.",
|
|
441
|
+
"no-drop-ddl": "Declare dropDdl on the contribution returned from the strategy's ownedTables(), or drop and recreate the table out of band and then run store.repairContributions() to re-stamp its marker.",
|
|
442
|
+
"no-schema-fence": "Use a backend that implements schemaWriteTransaction, or perform the drop and recreate out of band during a maintenance window and then run store.repairContributions() followed by store.search.rebuildFulltext().",
|
|
443
|
+
"shared-storage-in-use": `Recreate the shared table during a maintenance window with every graph that uses it offline: drop it out of band, then run store.rebuildContribution("fulltext") once per graph on this database. Each run recreates the table from the current DDL and refills that graph's rows from its own nodes.`
|
|
444
|
+
};
|
|
445
|
+
var ContributionRebuildUnsupportedError = class extends TypeGraphError {
|
|
446
|
+
reason;
|
|
447
|
+
constructor(reason, details = {}, options) {
|
|
448
|
+
super(
|
|
449
|
+
CONTRIBUTION_REBUILD_REFUSAL_MESSAGE[reason],
|
|
450
|
+
"CONTRIBUTION_REBUILD_UNSUPPORTED",
|
|
451
|
+
{
|
|
452
|
+
details: { ...details, reason },
|
|
453
|
+
category: "user",
|
|
454
|
+
suggestion: CONTRIBUTION_REBUILD_REFUSAL_SUGGESTION[reason],
|
|
455
|
+
cause: options?.cause
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
this.name = "ContributionRebuildUnsupportedError";
|
|
459
|
+
this.reason = reason;
|
|
460
|
+
}
|
|
461
|
+
};
|
|
399
462
|
var GraphAlgorithmConvergenceError = class extends TypeGraphError {
|
|
400
463
|
constructor(algorithm, maxIterations, options = {}) {
|
|
401
464
|
const oscillating = options.oscillating === true;
|
|
@@ -472,6 +535,17 @@ var TrustedImportError = class extends TypeGraphError {
|
|
|
472
535
|
this.name = "TrustedImportError";
|
|
473
536
|
}
|
|
474
537
|
};
|
|
538
|
+
var ExportStreamCancelledError = class extends TypeGraphError {
|
|
539
|
+
constructor(message, details = {}, options) {
|
|
540
|
+
super(message, "INTERCHANGE_EXPORT_STREAM_ABORTED", {
|
|
541
|
+
details,
|
|
542
|
+
category: "user",
|
|
543
|
+
suggestion: options?.suggestion ?? "Start a new export; the aborted one released its snapshot transaction and the connection it held.",
|
|
544
|
+
cause: options?.cause
|
|
545
|
+
});
|
|
546
|
+
this.name = "ExportStreamCancelledError";
|
|
547
|
+
}
|
|
548
|
+
};
|
|
475
549
|
var RECORDED_CAPTURE_GUARD_CODES = [
|
|
476
550
|
"RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION",
|
|
477
551
|
"RECORDED_CAPTURE_RAW_SQL_DISABLED",
|
|
@@ -618,6 +692,6 @@ function getErrorSuggestion(error) {
|
|
|
618
692
|
return isTypeGraphError(error) ? error.suggestion : void 0;
|
|
619
693
|
}
|
|
620
694
|
|
|
621
|
-
export { BackendDisposedError, CardinalityError, CompilerInvariantError, ConfigurationError, DatabaseOperationError, DisjointError, EagerMaterializationError, EdgeNotFoundError, EmbeddingDimensionChangedError, EndpointError, EndpointNotFoundError, GraphAlgorithmConvergenceError, InvalidEdgeWeightError, KindNotFoundError, MIGRATION_FAILURE_REASONS, MigrationError, NodeConstraintNotFoundError, NodeIndexNotFoundError, NodeNotFoundError, RECORDED_CAPTURE_GUARD_CODES, RestrictedDeleteError, SchemaContentConflictError, SchemaMismatchError, StaleVersionError, StoreNotInitializedError, TransactionClosedError, TrustedImportError, TypeGraphError, UniquenessError, UnsupportedBackendCapabilityError, UnsupportedPredicateError, ValidationError, VersionConflictError, getErrorSuggestion, isConstraintError, isRecordedCaptureGuardError, isSystemError, isTypeGraphError, isUserRecoverable };
|
|
622
|
-
//# sourceMappingURL=chunk-
|
|
623
|
-
//# sourceMappingURL=chunk-
|
|
695
|
+
export { BackendDisposedError, CardinalityError, CompilerInvariantError, ConfigurationError, ContributionRebuildUnsupportedError, DatabaseOperationError, DisjointError, EDGE_IDENTITY_MISMATCH_CODE, ENTITY_ALREADY_EXISTS_CODE, EagerMaterializationError, EdgeNotFoundError, EmbeddingDimensionChangedError, EndpointError, EndpointNotFoundError, ExportStreamCancelledError, GraphAlgorithmConvergenceError, IMMUTABLE_VALIDITY_LOWER_BOUND_CODE, INVERTED_VALIDITY_WINDOW_CODE, IdentityContradictionError, IdentitySeparationViolationError, InvalidEdgeWeightError, KindNotFoundError, MIGRATION_FAILURE_REASONS, MigrationError, NodeConstraintNotFoundError, NodeIndexNotFoundError, NodeNotFoundError, RECORDED_CAPTURE_GUARD_CODES, RestrictedDeleteError, SchemaContentConflictError, SchemaMismatchError, StaleVersionError, StoreNotInitializedError, TransactionClosedError, TrustedImportError, TypeGraphError, UniquenessError, UnsupportedBackendCapabilityError, UnsupportedPredicateError, ValidationError, VersionConflictError, getErrorSuggestion, isConstraintError, isRecordedCaptureGuardError, isSystemError, isTypeGraphError, isUserRecoverable };
|
|
696
|
+
//# sourceMappingURL=chunk-J3WZ3FA2.js.map
|
|
697
|
+
//# sourceMappingURL=chunk-J3WZ3FA2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors/index.ts"],"names":[],"mappings":";AA0DA,SAAS,YAAY,KAAA,EAAwB;AAC3C,EAAA,IAAI,iBAAiB,KAAA,EAAO;AAC1B,IAAA,OAAO,KAAA,CAAM,SAAS,KAAA,CAAM,OAAA;AAAA,EAC9B;AACA,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IACE,OAAO,UAAU,QAAA,IACjB,OAAO,UAAU,SAAA,IACjB,OAAO,UAAU,QAAA,EACjB;AACA,IAAA,OAAO,OAAO,KAAK,CAA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A,OAAO,gBAAA,CAAiB,KAAK,CAAA,IAAK,KAAA,CAAM,QAAA,KAAa,QAAA;AACvD;AAKO,SAAS,kBAAkB,KAAA,EAAyB;AACzD,EAAA,OAAO,gBAAA,CAAiB,KAAK,CAAA,IAAK,KAAA,CAAM,QAAA,KAAa,YAAA;AACvD;AAKO,SAAS,mBAAmB,KAAA,EAAoC;AACrE,EAAA,OAAO,gBAAA,CAAiB,KAAK,CAAA,GAAI,KAAA,CAAM,UAAA,GAAa,MAAA;AACtD","file":"chunk-J3WZ3FA2.js","sourcesContent":["/**\n * TypeGraph Error Hierarchy\n *\n * All errors extend TypeGraphError with:\n * - `code`: Machine-readable error code for programmatic handling\n * - `category`: Classification for error handling strategies\n * - `suggestion`: Optional recovery guidance for users\n * - `details`: Structured context about the error\n *\n * @example\n * ```typescript\n * try {\n * await store.nodes.Person.create({ name: \"\" });\n * } catch (error) {\n * if (isTypeGraphError(error)) {\n * console.error(error.toUserMessage());\n * if (isUserRecoverable(error)) {\n * // Show to user for correction\n * }\n * }\n * }\n * ```\n */\n\nimport type { KindEntity } from \"../core/types\";\nimport type { SchemaDiff } from \"../schema/migration\";\n// Type-only import: `materialize-indexes.ts` value-imports\n// `ConfigurationError` from this file, but type-only imports are erased\n// at runtime so this back-edge does not create a value cycle.\nimport type { MaterializeIndexesResult } from \"../store/materialize-indexes\";\n\n// ============================================================\n// Types\n// ============================================================\n\n/**\n * Error category for programmatic handling.\n *\n * - `user`: Caused by invalid input or incorrect usage. Recoverable by fixing input.\n * - `constraint`: Business rule or schema constraint violation. Recoverable by changing data.\n * - `system`: Internal error or infrastructure issue. May require investigation or retry.\n */\nexport type ErrorCategory = \"user\" | \"constraint\" | \"system\";\n\n/**\n * Options for TypeGraphError constructor.\n */\nexport type TypeGraphErrorOptions = Readonly<{\n /** Structured context about the error */\n details?: Record<string, unknown>;\n /** Error category for handling strategies */\n category: ErrorCategory;\n /** Recovery guidance for users */\n suggestion?: string;\n /** Underlying cause of the error */\n cause?: unknown;\n}>;\n\nfunction formatCause(cause: unknown): string {\n if (cause instanceof Error) {\n return cause.stack ?? cause.message;\n }\n if (typeof cause === \"string\") {\n return cause;\n }\n if (\n typeof cause === \"number\" ||\n typeof cause === \"boolean\" ||\n typeof cause === \"bigint\"\n ) {\n return String(cause);\n }\n if (typeof cause === \"symbol\") {\n return cause.description ?? \"Symbol\";\n }\n if (cause === undefined) {\n return \"Unknown cause\";\n }\n\n try {\n return JSON.stringify(cause);\n } catch (error) {\n return `Unserializable cause: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`;\n }\n}\n\n// ============================================================\n// Base Error\n// ============================================================\n\n/**\n * Base error class for all TypeGraph errors.\n *\n * Provides structured error information for both programmatic handling\n * and user-friendly messages.\n */\nexport class TypeGraphError extends Error {\n /** Machine-readable error code (e.g., \"VALIDATION_ERROR\") */\n readonly code: string;\n\n /** Error category for handling strategies */\n readonly category: ErrorCategory;\n\n /** Structured context about the error */\n readonly details: Readonly<Record<string, unknown>>;\n\n /** Recovery guidance for users */\n readonly suggestion?: string;\n\n constructor(message: string, code: string, options: TypeGraphErrorOptions) {\n super(message, options.cause ? { cause: options.cause } : undefined);\n this.name = \"TypeGraphError\";\n this.code = code;\n this.category = options.category;\n this.details = Object.freeze(options.details ?? {});\n if (options.suggestion !== undefined) {\n this.suggestion = options.suggestion;\n }\n }\n\n /**\n * Returns a user-friendly error message with suggestion if available.\n */\n toUserMessage(): string {\n if (this.suggestion) {\n return `${this.message}\\n\\nSuggestion: ${this.suggestion}`;\n }\n return this.message;\n }\n\n /**\n * Returns a detailed string representation for logging.\n */\n toLogString(): string {\n const lines = [\n `[${this.code}] ${this.message}`,\n ` Category: ${this.category}`,\n ];\n\n if (this.suggestion) {\n lines.push(` Suggestion: ${this.suggestion}`);\n }\n\n const detailKeys = Object.keys(this.details);\n if (detailKeys.length > 0) {\n lines.push(` Details: ${JSON.stringify(this.details)}`);\n }\n\n if (this.cause) {\n lines.push(` Cause: ${formatCause(this.cause)}`);\n }\n\n return lines.join(\"\\n\");\n }\n}\n\n// ============================================================\n// Validation Errors (category: \"user\")\n// ============================================================\n\n/**\n * Validation issue from Zod or custom validation.\n */\nexport type ValidationIssue = Readonly<{\n /** Path to the invalid field (e.g., \"address.city\") */\n path: string;\n /** Human-readable error message */\n message: string;\n /** Zod error code if from Zod validation */\n code?: string;\n /**\n * The identity assertion the issue is about, carried structurally so\n * consumers (e.g. interchange import error reporting) never have to parse\n * the human-readable message for it.\n */\n assertionId?: string;\n}>;\n\n/**\n * The stable {@link ValidationIssue.code} every inverted-validity-window\n * refusal carries, so a caller can recognize that specific failure without\n * matching on the message. `ValidationError`'s own code is the family-wide\n * `VALIDATION_ERROR`, so the discriminator lives on the issue — mirroring the\n * identity-import window refusal (`IDENTITY_IMPORT_INVALID_WINDOW`).\n *\n * A write carrying it was refused because `validTo` precedes the row's\n * effective `validFrom`: the row would have stopped being true before it\n * started, observable at no `asOf` coordinate at all. Zero-width windows\n * (`validTo === validFrom`) are legal and never raise it.\n */\nexport const INVERTED_VALIDITY_WINDOW_CODE = \"INVERTED_VALIDITY_WINDOW\";\n\n/**\n * The stable {@link ValidationIssue.code} carried by a refusal to accept a\n * `validFrom` the write cannot apply: the target row is LIVE, and an in-place\n * update never rewrites a live row's lower bound — that bound is history.\n * `ValidationError`'s own code is the family-wide `VALIDATION_ERROR`, so the\n * discriminator lives on the issue — mirroring\n * {@link INVERTED_VALIDITY_WINDOW_CODE}.\n *\n * Only a bound naming a DIFFERENT instant than the row already stores raises it.\n * Restating the stored bound is legal and writes nothing new, and a resurrection\n * — which does rewrite `valid_from` — applies a stated bound rather than\n * refusing it.\n *\n * The message names both instants: the one stated and the one the row stores, so\n * the caller can restate the stored bound without a second read.\n */\nexport const IMMUTABLE_VALIDITY_LOWER_BOUND_CODE =\n \"IMMUTABLE_VALIDITY_LOWER_BOUND\";\n\n/**\n * Stable {@link ValidationIssue.code} for an edge-id ownership mismatch.\n *\n * Edge ids are graph-global. A collection-scoped write therefore has to prove\n * that the stored row has the collection's kind and, when the caller supplies\n * endpoints, the same immutable endpoints. This refusal prevents a collection\n * from mutating another kind's row and prevents an upsert from silently\n * ignoring an attempted repoint.\n */\nexport const EDGE_IDENTITY_MISMATCH_CODE = \"EDGE_IDENTITY_MISMATCH\";\n\n/**\n * The stable {@link ValidationIssue.code} every \"this id is already taken\"\n * create refusal carries, whichever way the create found out: its own existence\n * probe, or the engine refusing the INSERT. `ValidationError`'s own code is the\n * family-wide `VALIDATION_ERROR`, so the discriminator lives on the issue —\n * mirroring {@link INVERTED_VALIDITY_WINDOW_CODE}.\n *\n * `details.entityType` says whether a node or an edge was refused and\n * `details.kind` names its kind. `details.id` names the taken id, and is absent\n * only when the refused statement inserted MORE THAN ONE row: the engine reports\n * that the statement collided without saying which row did.\n */\nexport const ENTITY_ALREADY_EXISTS_CODE = \"ENTITY_ALREADY_EXISTS\";\n\n/**\n * Details for ValidationError.\n */\nexport type ValidationErrorDetails = Readonly<{\n /** Type of entity being validated */\n entityType?: KindEntity;\n /** Kind/type name of the entity */\n kind?: string;\n /** Operation being performed */\n operation?: \"create\" | \"update\" | \"delete\" | \"hardDelete\";\n /** Entity ID if updating */\n id?: string;\n /** Individual validation issues */\n issues: readonly ValidationIssue[];\n}>;\n\n/**\n * Thrown when schema validation fails during node or edge operations.\n *\n * @example\n * ```typescript\n * try {\n * await store.nodes.Person.create({ email: \"invalid\" });\n * } catch (error) {\n * if (error instanceof ValidationError) {\n * console.log(error.details.issues);\n * // [{ path: \"email\", message: \"Invalid email\" }]\n * }\n * }\n * ```\n */\nexport class ValidationError extends TypeGraphError {\n declare readonly details: ValidationErrorDetails;\n\n constructor(\n message: string,\n details: ValidationErrorDetails,\n options?: { cause?: unknown; suggestion?: string },\n ) {\n const fieldList =\n details.issues.length > 0 ?\n details.issues.map((index) => index.path || \"(root)\").join(\", \")\n : \"unknown\";\n\n super(message, \"VALIDATION_ERROR\", {\n details,\n category: \"user\",\n suggestion:\n options?.suggestion ??\n `Check the following fields: ${fieldList}. See error.details.issues for specific validation failures.`,\n cause: options?.cause,\n });\n this.name = \"ValidationError\";\n }\n}\n\n// ============================================================\n// Not Found Errors (category: \"user\")\n// ============================================================\n\n/**\n * Details for NodeNotFoundError.\n */\nexport type NodeNotFoundErrorDetails = Readonly<{\n kind: string;\n id: string;\n}>;\n\n/**\n * Thrown when a node is not found.\n *\n * @example\n * ```typescript\n * try {\n * await store.nodes.Person.get(\"nonexistent-id\");\n * } catch (error) {\n * if (error instanceof NodeNotFoundError) {\n * console.log(error.details.kind, error.details.id);\n * }\n * }\n * ```\n */\nexport class NodeNotFoundError extends TypeGraphError {\n declare readonly details: NodeNotFoundErrorDetails;\n\n constructor(kind: string, id: string, options?: { cause?: unknown }) {\n super(`Node not found: ${kind}/${id}`, \"NODE_NOT_FOUND\", {\n details: { kind, id },\n category: \"user\",\n suggestion: `Verify the node ID \"${id}\" exists and has not been deleted.`,\n cause: options?.cause,\n });\n this.name = \"NodeNotFoundError\";\n }\n}\n\n/**\n * Details for EdgeNotFoundError.\n */\nexport type EdgeNotFoundErrorDetails = Readonly<{\n kind: string;\n id: string;\n}>;\n\n/**\n * Thrown when an edge is not found.\n */\nexport class EdgeNotFoundError extends TypeGraphError {\n declare readonly details: EdgeNotFoundErrorDetails;\n\n constructor(kind: string, id: string, options?: { cause?: unknown }) {\n super(`Edge not found: ${kind}/${id}`, \"EDGE_NOT_FOUND\", {\n details: { kind, id },\n category: \"user\",\n suggestion: `Verify the edge ID \"${id}\" exists and has not been deleted.`,\n cause: options?.cause,\n });\n this.name = \"EdgeNotFoundError\";\n }\n}\n\n/**\n * Details for KindNotFoundError.\n */\nexport type KindNotFoundErrorDetails = Readonly<{\n kindName: string;\n entity: KindEntity;\n graphId?: string;\n}>;\n\n/**\n * Thrown when an operation references a kind that isn't registered on\n * the graph — `getNodeCollectionOrThrow` against an unknown kind, a\n * `materializeIndexes({ kinds })` filter naming a missing kind, an\n * extension referencing an unresolved endpoint, search facade typos,\n * etc. Carries the offending `kindName` and `entity` plus the host\n * `graphId` so logs are unambiguous when multiple stores share a\n * process.\n */\nexport class KindNotFoundError extends TypeGraphError {\n declare readonly details: KindNotFoundErrorDetails;\n readonly kindName: string;\n readonly entity: KindEntity;\n\n constructor(\n kindName: string,\n entity: KindEntity,\n options?: Readonly<{\n graphId?: string;\n suggestion?: string;\n cause?: unknown;\n }>,\n ) {\n const where =\n options?.graphId === undefined ? \"\" : ` on graph \"${options.graphId}\"`;\n super(\n `${entity === \"node\" ? \"Node\" : \"Edge\"} kind \"${kindName}\" is not registered${where}.`,\n \"KIND_NOT_FOUND\",\n {\n details: {\n kindName,\n entity,\n ...(options?.graphId === undefined ?\n {}\n : { graphId: options.graphId }),\n },\n category: \"user\",\n suggestion:\n options?.suggestion ??\n \"Compile-time kinds come from defineGraph; extension kinds appear after store.evolve() returns. Check store.introspect() for the registered set.\",\n cause: options?.cause,\n },\n );\n this.name = \"KindNotFoundError\";\n this.kindName = kindName;\n this.entity = entity;\n }\n}\n\n/**\n * Details for NodeConstraintNotFoundError.\n */\nexport type NodeConstraintNotFoundErrorDetails = Readonly<{\n constraintName: string;\n kind: string;\n}>;\n\n/**\n * Thrown when a uniqueness constraint name is not found on a node kind.\n */\nexport class NodeConstraintNotFoundError extends TypeGraphError {\n declare readonly details: NodeConstraintNotFoundErrorDetails;\n\n constructor(\n constraintName: string,\n kind: string,\n options?: { cause?: unknown },\n ) {\n super(\n `Constraint not found: \"${constraintName}\" on node kind \"${kind}\"`,\n \"CONSTRAINT_NOT_FOUND\",\n {\n details: { constraintName, kind },\n category: \"user\",\n suggestion: `Verify the constraint name \"${constraintName}\" is defined in the unique constraints for \"${kind}\".`,\n cause: options?.cause,\n },\n );\n this.name = \"NodeConstraintNotFoundError\";\n }\n}\n\n/**\n * Details for NodeIndexNotFoundError.\n */\nexport type NodeIndexNotFoundErrorDetails = Readonly<{\n indexName: string;\n kind: string;\n}>;\n\n/**\n * Thrown when a declared node index name is not found on a node kind.\n */\nexport class NodeIndexNotFoundError extends TypeGraphError {\n declare readonly details: NodeIndexNotFoundErrorDetails;\n\n constructor(indexName: string, kind: string, options?: { cause?: unknown }) {\n super(\n `Index not found: \"${indexName}\" on node kind \"${kind}\"`,\n \"INDEX_NOT_FOUND\",\n {\n details: { indexName, kind },\n category: \"user\",\n suggestion: `Verify the index name \"${indexName}\" is declared via defineNodeIndex for \"${kind}\" and passed to defineGraph({ indexes }).`,\n cause: options?.cause,\n },\n );\n this.name = \"NodeIndexNotFoundError\";\n }\n}\n\n// ============================================================\n// Constraint Errors (category: \"constraint\")\n// ============================================================\n\n/**\n * Details for EndpointNotFoundError.\n */\nexport type EndpointNotFoundErrorDetails = Readonly<{\n edgeKind: string;\n endpoint: \"from\" | \"to\";\n nodeKind: string;\n nodeId: string;\n}>;\n\n/**\n * Thrown when edge endpoint node does not exist or is deleted.\n */\nexport class EndpointNotFoundError extends TypeGraphError {\n declare readonly details: EndpointNotFoundErrorDetails;\n\n constructor(\n details: EndpointNotFoundErrorDetails,\n options?: { cause?: unknown },\n ) {\n super(\n `Endpoint node not found for edge \"${details.edgeKind}\": ${details.nodeKind}/${details.nodeId} (${details.endpoint})`,\n \"ENDPOINT_NOT_FOUND\",\n {\n details,\n category: \"constraint\",\n suggestion: `Ensure the ${details.endpoint} node exists before creating the edge.`,\n cause: options?.cause,\n },\n );\n this.name = \"EndpointNotFoundError\";\n }\n}\n\n/**\n * Details for EndpointError.\n */\nexport type EndpointErrorDetails = Readonly<{\n edgeKind: string;\n endpoint: \"from\" | \"to\";\n actualKind: string;\n expectedKinds: readonly string[];\n}>;\n\n/**\n * Thrown when edge endpoint has wrong node type.\n */\nexport class EndpointError extends TypeGraphError {\n declare readonly details: EndpointErrorDetails;\n\n constructor(details: EndpointErrorDetails, options?: { cause?: unknown }) {\n const expected = details.expectedKinds.join(\" | \");\n super(\n `Invalid ${details.endpoint} endpoint for edge \"${details.edgeKind}\": got \"${details.actualKind}\", expected ${expected}`,\n \"ENDPOINT_ERROR\",\n {\n details,\n category: \"constraint\",\n suggestion: `Use a node of type ${expected} as the ${details.endpoint} endpoint.`,\n cause: options?.cause,\n },\n );\n this.name = \"EndpointError\";\n }\n}\n\n/**\n * Details for UniquenessError.\n */\nexport type UniquenessErrorDetails = Readonly<{\n constraintName: string;\n kind: string;\n existingId: string;\n newId: string;\n fields: readonly string[];\n}>;\n\n/**\n * Thrown when uniqueness constraint is violated.\n */\nexport class UniquenessError extends TypeGraphError {\n declare readonly details: UniquenessErrorDetails;\n\n constructor(details: UniquenessErrorDetails, options?: { cause?: unknown }) {\n const fieldList = details.fields.join(\", \");\n super(\n `Uniqueness violation on \"${details.kind}\": constraint \"${details.constraintName}\" (fields: ${fieldList}) conflicts with existing node ${details.existingId}`,\n \"UNIQUENESS_VIOLATION\",\n {\n details,\n category: \"constraint\",\n suggestion: `Change the values for fields [${fieldList}] to be unique, or update the existing node ${details.existingId} instead.`,\n cause: options?.cause,\n },\n );\n this.name = \"UniquenessError\";\n }\n}\n\n/**\n * Details for CardinalityError.\n */\nexport type CardinalityErrorDetails = Readonly<{\n edgeKind: string;\n fromKind: string;\n fromId: string;\n cardinality: string;\n existingCount: number;\n}>;\n\n/**\n * Thrown when cardinality constraint is violated.\n */\nexport class CardinalityError extends TypeGraphError {\n declare readonly details: CardinalityErrorDetails;\n\n constructor(details: CardinalityErrorDetails, options?: { cause?: unknown }) {\n super(\n `Cardinality violation: \"${details.edgeKind}\" from ${details.fromKind}/${details.fromId} allows \"${details.cardinality}\" but ${details.existingCount} edge(s) already exist`,\n \"CARDINALITY_ERROR\",\n {\n details,\n category: \"constraint\",\n suggestion:\n details.cardinality === \"one\" || details.cardinality === \"unique\" ?\n `Delete the existing edge before creating a new one, or use cardinality \"many\".`\n : `Check if the cardinality constraint \"${details.cardinality}\" is correct for your use case.`,\n cause: options?.cause,\n },\n );\n this.name = \"CardinalityError\";\n }\n}\n\n/**\n * Details for DisjointError.\n */\nexport type DisjointErrorDetails = Readonly<{\n nodeId: string;\n attemptedKind: string;\n conflictingKind: string;\n}>;\n\n/**\n * Thrown when disjointness constraint is violated.\n *\n * Disjoint types cannot share the same ID - a node cannot be both\n * a Person and an Organization if they are declared disjoint.\n */\nexport class DisjointError extends TypeGraphError {\n declare readonly details: DisjointErrorDetails;\n\n constructor(details: DisjointErrorDetails, options?: { cause?: unknown }) {\n super(\n `Disjoint constraint violation: cannot create ${details.attemptedKind} with ID \"${details.nodeId}\" - conflicts with existing ${details.conflictingKind}`,\n \"DISJOINT_ERROR\",\n {\n details,\n category: \"constraint\",\n suggestion: `Use a different ID for the new ${details.attemptedKind} node, or delete the existing ${details.conflictingKind}/${details.nodeId} first.`,\n cause: options?.cause,\n },\n );\n this.name = \"DisjointError\";\n }\n}\n\nexport type IdentityContradictionErrorDetails = Readonly<{\n /**\n * The identity write that could not stand. `merge` is the post-write\n * affected-class assertion a graph merge runs inside its commit\n * transaction, which names the whole merge rather than a single assertion\n * because the contradiction is a property of the state the merge would\n * leave behind.\n */\n operation: \"assertSame\" | \"assertDifferent\" | \"fold\" | \"import\" | \"merge\";\n a: Readonly<{ kind: string; id: string }>;\n b: Readonly<{ kind: string; id: string }>;\n reason: \"different-assertion\" | \"same-class\" | \"disjoint-kinds\";\n conflictingAssertionId?: string;\n conflictingKinds?: readonly [string, string];\n}>;\n\n/** Thrown when an identity mutation would make the ledger contradictory. */\nexport class IdentityContradictionError extends TypeGraphError {\n declare readonly details: IdentityContradictionErrorDetails;\n\n constructor(\n details: IdentityContradictionErrorDetails,\n options?: Readonly<{ cause?: unknown }>,\n ) {\n super(\n `Identity contradiction: ${details.a.kind}/${details.a.id} and ${details.b.kind}/${details.b.id} cannot satisfy ${details.operation}.`,\n \"IDENTITY_CONTRADICTION\",\n {\n details,\n category: \"constraint\",\n suggestion:\n \"Retract the conflicting identity assertion or correct the graph ontology before retrying.\",\n cause: options?.cause,\n },\n );\n this.name = \"IdentityContradictionError\";\n }\n}\n\nexport type IdentitySeparationViolationErrorDetails = Readonly<{\n graphId: string;\n /**\n * `\"database\"` when the CHECK constraint on the separation relation aborted\n * the write — the backstop firing as designed. `\"writer\"` when the write was\n * accepted, which means the relation was provisioned without its constraint\n * and only the writer's own re-check caught the contradiction.\n */\n enforcedBy: \"database\" | \"writer\";\n /** The single class key both endpoints collapsed onto. */\n classKey: string;\n /** The `different` assertion whose endpoints landed in one class. */\n assertionId: string;\n a: Readonly<{ kind: string; id: string }>;\n b: Readonly<{ kind: string; id: string }>;\n}>;\n\n/**\n * Thrown when the derived separation relation refuses a write that would place\n * both endpoints of a current `different` assertion in one identity class.\n *\n * This is the database-level backstop beneath the plan-time simulation and the\n * applier's validation. Reaching it means an earlier layer let a contradiction\n * through: the transaction is aborted rather than committed, but the layer that\n * should have refused it typed and early is worth investigating.\n */\nexport class IdentitySeparationViolationError extends TypeGraphError {\n declare readonly details: IdentitySeparationViolationErrorDetails;\n\n constructor(\n details: IdentitySeparationViolationErrorDetails,\n options?: Readonly<{ cause?: unknown }>,\n ) {\n super(\n `Identity separation violated: ${details.a.kind}/${details.a.id} and ${details.b.kind}/${details.b.id} are held apart by assertion ${details.assertionId}, but this write would put both in identity class ${details.classKey}.`,\n \"IDENTITY_SEPARATION_VIOLATION\",\n {\n details,\n category: \"constraint\",\n suggestion:\n \"Retract the conflicting different assertion before merging these identity classes. If no application call requested this merge, the write reached the ledger through a path that skipped identity validation.\",\n cause: options?.cause,\n },\n );\n this.name = \"IdentitySeparationViolationError\";\n }\n}\n\n/**\n * Details for RestrictedDeleteError.\n */\nexport type RestrictedDeleteErrorDetails = Readonly<{\n nodeKind: string;\n nodeId: string;\n edgeCount: number;\n edgeKinds: readonly string[];\n}>;\n\n/**\n * Thrown when deletion is blocked due to existing edges (restrict behavior).\n */\nexport class RestrictedDeleteError extends TypeGraphError {\n declare readonly details: RestrictedDeleteErrorDetails;\n\n constructor(\n details: RestrictedDeleteErrorDetails,\n options?: { cause?: unknown },\n ) {\n const edgeList = details.edgeKinds.join(\", \");\n super(\n `Cannot delete ${details.nodeKind}/${details.nodeId}: ${details.edgeCount} connected edge(s) exist (${edgeList})`,\n \"RESTRICTED_DELETE\",\n {\n details,\n category: \"constraint\",\n suggestion: `Delete the connected edges first, or change onDelete behavior to \"cascade\" (auto-delete edges) or \"disconnect\" (soft-delete edges).`,\n cause: options?.cause,\n },\n );\n this.name = \"RestrictedDeleteError\";\n }\n}\n\n// ============================================================\n// Concurrency Errors (category: \"system\")\n// ============================================================\n\n/**\n * Details for VersionConflictError.\n */\nexport type VersionConflictErrorDetails = Readonly<{\n kind: string;\n id: string;\n expectedVersion: number;\n actualVersion: number;\n}>;\n\n/**\n * Thrown when optimistic locking detects a concurrent modification.\n *\n * This occurs when two operations try to update the same entity simultaneously.\n * The operation with the stale version fails.\n */\nexport class VersionConflictError extends TypeGraphError {\n declare readonly details: VersionConflictErrorDetails;\n\n constructor(\n details: VersionConflictErrorDetails,\n options?: { cause?: unknown },\n ) {\n super(\n `Version conflict on ${details.kind}/${details.id}: expected version ${details.expectedVersion}, found ${details.actualVersion}`,\n \"VERSION_CONFLICT\",\n {\n details,\n category: \"system\",\n suggestion: `Fetch the latest version of the entity and retry the operation. This error indicates concurrent modification.`,\n cause: options?.cause,\n },\n );\n this.name = \"VersionConflictError\";\n }\n}\n\n// ============================================================\n// Schema Errors (category: \"system\")\n// ============================================================\n\n/**\n * Details for SchemaMismatchError.\n */\nexport type SchemaMismatchErrorDetails = Readonly<{\n graphId: string;\n expectedHash: string;\n actualHash: string;\n}>;\n\n/**\n * Thrown when the schema in code doesn't match the schema in the database.\n */\nexport class SchemaMismatchError extends TypeGraphError {\n declare readonly details: SchemaMismatchErrorDetails;\n\n constructor(\n details: SchemaMismatchErrorDetails,\n options?: { cause?: unknown },\n ) {\n super(\n `Schema mismatch for graph \"${details.graphId}\": code schema differs from database schema`,\n \"SCHEMA_MISMATCH\",\n {\n details,\n category: \"system\",\n suggestion: `Run schema migration to update the database, or use createStoreWithSchema() for automatic migration.`,\n cause: options?.cause,\n },\n );\n this.name = \"SchemaMismatchError\";\n }\n}\n\n/**\n * Details for MigrationError.\n */\n/**\n * Why a migration operation failed. A stable discriminant so callers can\n * branch on the outcome instead of matching the message text, which is free\n * to be reworded in any release.\n */\nexport const MIGRATION_FAILURE_REASONS = [\n /**\n * The persisted schema is behind the code graph. Raised on the\n * least-privilege runtime path, which cannot run DDL — a privileged\n * migrator must advance the schema first. Inspect `details.diff`\n * (`hasBreakingChanges`) to tell an additive change from an incompatible\n * one.\n */\n \"schema-behind\",\n /** Breaking changes were detected while `throwOnBreaking` was set. */\n \"breaking-change\",\n /** No active schema version exists for the graph. */\n \"no-active-version\",\n /** The requested schema version does not exist for the graph. */\n \"version-not-found\",\n /**\n * The schema about to be committed drops node or edge kinds that still\n * hold rows. Committing would make those rows unreachable, and the next\n * `materializeRemovals()` — which re-derives removals from schema history —\n * would delete them. Inspect `details.droppedKinds` for the names. Use\n * `Store.removeKinds()`, the removal path that queues cleanup explicitly,\n * or pass `discardDroppedKindRows` to `migrateSchema` if losing the rows is\n * the intent.\n */\n \"kind-removal\",\n] as const;\n\nexport type MigrationFailureReason = (typeof MIGRATION_FAILURE_REASONS)[number];\n\n/**\n * Structured context for a {@link MigrationError}, discriminated on `reason`.\n *\n * Modelled as a union rather than one shape with optional fields so the\n * payload a reason promises is the payload it must carry: narrowing on\n * `reason === \"kind-removal\"` gives you a non-optional `droppedKinds`, and the\n * constructor cannot be handed a `kind-removal` without one.\n *\n * The common fields are repeated per member rather than factored into a shared\n * base alias, which would be a hoisted-unexported symbol on the public\n * entrypoint.\n */\nexport type MigrationErrorDetails =\n | Readonly<{\n graphId: string;\n fromVersion: number;\n toVersion: number;\n /** Stable discriminant — branch on this, not the message. */\n reason: \"schema-behind\" | \"breaking-change\";\n /**\n * The structured diff behind the failure. Carries per-change `severity`\n * alongside `hasChanges` / `hasBreakingChanges`, so a caller can decide\n * \"additive → proceed, incompatible → ask the user\" without re-querying.\n */\n diff?: SchemaDiff;\n }>\n | Readonly<{\n graphId: string;\n fromVersion: number;\n toVersion: number;\n reason: \"no-active-version\" | \"version-not-found\";\n }>\n | Readonly<{\n graphId: string;\n fromVersion: number;\n toVersion: number;\n reason: \"kind-removal\";\n /**\n * The dropped kinds that still held rows, and so caused the refusal. A\n * kind the commit drops but that is already empty is permitted and does\n * NOT appear here. Both lists are sorted; at least one is non-empty.\n */\n droppedKinds: Readonly<{\n nodes: readonly string[];\n edges: readonly string[];\n }>;\n }>;\n\n/**\n * Thrown when schema migration fails.\n */\nexport class MigrationError extends TypeGraphError {\n declare readonly details: MigrationErrorDetails;\n\n constructor(\n message: string,\n details: MigrationErrorDetails,\n options?: { cause?: unknown },\n ) {\n super(message, \"MIGRATION_ERROR\", {\n details,\n category: \"system\",\n suggestion: `Review the schema changes and ensure they are backwards compatible, or implement a data migration.`,\n cause: options?.cause,\n });\n this.name = \"MigrationError\";\n }\n}\n\n/**\n * Details for EagerMaterializationError.\n */\nexport type EagerMaterializationErrorDetails = Readonly<{\n graphId: string;\n failedIndexNames: readonly string[];\n}>;\n\n/**\n * Thrown by `Store.evolve(extension, { eager })` when the schema\n * commit succeeded but the follow-on `materializeIndexes()` produced\n * one or more failed entries.\n *\n * Recovery: the schema commit is NOT rolled back. The new `Store` is\n * fully constructed and (when `options.ref` was supplied) `ref.current`\n * already points to it — the caller can read the new store via the ref\n * and decide how to handle the failed indexes (retry, skip, alert).\n * The full `MaterializeIndexesResult` is attached as `.materialization`.\n *\n * @example\n * ```ts\n * const ref = { current: store };\n * try {\n * await store.evolve(extension, { ref, eager: {} });\n * } catch (error) {\n * if (error instanceof EagerMaterializationError) {\n * // schema is committed; ref.current is the new store\n * log.warn(\n * { failed: error.failedIndexNames },\n * \"indexes did not materialize; will retry\",\n * );\n * await ref.current.materializeIndexes();\n * } else {\n * throw error;\n * }\n * }\n * ```\n */\nexport class EagerMaterializationError extends TypeGraphError {\n declare readonly details: EagerMaterializationErrorDetails;\n\n /**\n * The full materialization result, including successful and failed\n * entries. Same shape as `Store.materializeIndexes()` returns.\n */\n readonly materialization: MaterializeIndexesResult;\n\n constructor(materialization: MaterializeIndexesResult, graphId: string) {\n const names = collectFailedIndexNames(materialization);\n super(\n `Eager materialization failed for ${names.length} index(es) on graph \"${graphId}\": ${names.join(\", \")}. The schema commit succeeded; the new Store is available via the ref handle (when supplied) and the failed indexes can be retried via store.materializeIndexes().`,\n \"EAGER_MATERIALIZATION_FAILED\",\n {\n details: { graphId, failedIndexNames: names },\n category: \"system\",\n suggestion: `Inspect error.materialization for per-index errors. Each failure preserves any prior successful materialization timestamp; the schema is committed regardless.`,\n },\n );\n this.name = \"EagerMaterializationError\";\n this.materialization = materialization;\n }\n\n /**\n * Names of just the indexes that failed — derived from\n * `materialization.results` so the two views can never disagree.\n */\n get failedIndexNames(): readonly string[] {\n return collectFailedIndexNames(this.materialization);\n }\n}\n\nfunction collectFailedIndexNames(\n materialization: MaterializeIndexesResult,\n): readonly string[] {\n const names: string[] = [];\n for (const entry of materialization.results) {\n if (entry.status === \"failed\") names.push(entry.indexName);\n }\n return names;\n}\n\n/**\n * Details for StaleVersionError. `actual` is the active version the rejecting\n * read observed, and is `0` only when the graph genuinely has no active version\n * (an initial-commit race where another writer initialized first, or a graph\n * whose schema rows were removed out of band). A concurrent advance always\n * reports the newly active version, so `0` is a reliable signal of absence\n * rather than of contention.\n */\nexport type StaleVersionErrorDetails = Readonly<{\n graphId: string;\n expected: number;\n actual: number;\n}>;\n\n/**\n * Thrown by `commitSchemaVersion`, `setActiveVersion`, and the schema write\n * fence a schema-managed Store write takes, when the caller's view of the\n * active schema version is out of date — another writer has already advanced\n * it.\n *\n * Recovery: re-read the active version with `getActiveSchema(graphId)`,\n * recompute against the new baseline, and retry. This is a routine\n * concurrency signal, not a bug.\n */\nexport class StaleVersionError extends TypeGraphError {\n declare readonly details: StaleVersionErrorDetails;\n\n constructor(\n details: StaleVersionErrorDetails,\n options?: { cause?: unknown },\n ) {\n super(\n `Schema version was advanced by another writer for graph \"${details.graphId}\": expected active version ${details.expected}, actual is ${details.actual}`,\n \"STALE_SCHEMA_VERSION\",\n {\n details,\n category: \"system\",\n suggestion: `Re-read the active schema version, recompute the new version against that baseline, and retry the commit.`,\n cause: options?.cause,\n },\n );\n this.name = \"StaleVersionError\";\n }\n}\n\n/**\n * Details for SchemaContentConflictError.\n */\nexport type SchemaContentConflictErrorDetails = Readonly<{\n graphId: string;\n version: number;\n existingHash: string;\n incomingHash: string;\n}>;\n\n/**\n * Thrown by `commitSchemaVersion` when a row already exists at the\n * target version with a *different* schema hash — i.e. two writers\n * committed materially different schemas at the same version number.\n *\n * Distinct from `StaleVersionError`: this is not a refetch-and-retry\n * situation, it's a content disagreement that needs operator\n * intervention. Typically caused by inconsistent application\n * deployments writing schemas that hash differently.\n */\nexport class SchemaContentConflictError extends TypeGraphError {\n declare readonly details: SchemaContentConflictErrorDetails;\n\n constructor(\n details: SchemaContentConflictErrorDetails,\n options?: { cause?: unknown },\n ) {\n super(\n `Schema content conflict for graph \"${details.graphId}\" at version ${details.version}: existing hash ${details.existingHash} differs from incoming hash ${details.incomingHash}`,\n \"SCHEMA_CONTENT_CONFLICT\",\n {\n details,\n category: \"system\",\n suggestion: `Two writers committed different schemas at the same version. Reconcile the application deployments so they produce the same canonical schema, then retry.`,\n cause: options?.cause,\n },\n );\n this.name = \"SchemaContentConflictError\";\n }\n}\n\n// ============================================================\n// Configuration Errors (category: \"user\")\n// ============================================================\n\n/**\n * Thrown when graph configuration is invalid.\n *\n * This includes invalid schema definitions, ontology conflicts,\n * and other configuration issues detected at graph creation time.\n */\nexport class ConfigurationError extends TypeGraphError {\n constructor(\n message: string,\n details: Record<string, unknown> = {},\n options?: { cause?: unknown; suggestion?: string },\n ) {\n super(message, \"CONFIGURATION_ERROR\", {\n details,\n category: \"user\",\n suggestion:\n options?.suggestion ?? `Review your graph definition for errors.`,\n cause: options?.cause,\n });\n this.name = \"ConfigurationError\";\n }\n}\n\n/**\n * Why a destructive contribution rebuild is refused.\n *\n * - `vector-source-unavailable` — the projection is vector storage.\n * TypeGraph stores caller-supplied embeddings and nothing else: the\n * vectors exist only in the table a rebuild would drop, so there is no\n * source to reconstruct them from. Dropping anyway would silently\n * destroy the embeddings and hand back storage that looks healthy and\n * returns nothing. `store.reembedVectorField(kind, fieldPath, {\n * embed })` is the sanctioned destructive path — it takes the callback\n * that can regenerate what the drop destroys.\n * - `no-drop-ddl` — the active strategy declares no `dropDdl` for the\n * contribution, so TypeGraph does not know how to tear its storage\n * down. Synthesizing a `DROP TABLE` from the resolved name would\n * guess at a teardown the strategy never sanctioned.\n * - `no-schema-fence` — the backend exposes no transactional schema\n * fence (`schemaWriteTransaction`), so the drop, recreate, refill, and\n * stamp could not be made atomic. Running them unfenced could leave\n * storage attested but empty, or a concurrent schema writer\n * interleaved with the drop.\n * - `shared-storage-in-use` — the contribution's recorded shape is stale,\n * so only recreating its storage repairs it, but that storage is one\n * table holding other graphs' rows as well. Their content is derived\n * from their own nodes through their own schemas, so this process cannot\n * put it back. A rebuild that dropped anyway would leave every other\n * graph's search silently empty; one that re-stamped this graph's marker\n * without the drop would bless a physical shape nothing verified.\n */\nexport type ContributionRebuildRefusal =\n | \"vector-source-unavailable\"\n | \"no-drop-ddl\"\n | \"no-schema-fence\"\n | \"shared-storage-in-use\";\n\nconst CONTRIBUTION_REBUILD_REFUSAL_MESSAGE: Readonly<\n Record<ContributionRebuildRefusal, string>\n> = {\n \"vector-source-unavailable\":\n \"Vector contributions cannot be rebuilt: TypeGraph stores the vectors \" +\n \"callers supply and never the inputs that produced them, so the \" +\n \"embeddings exist only in the storage a rebuild would drop.\",\n \"no-drop-ddl\":\n \"The active strategy declares no teardown DDL for this contribution, so \" +\n \"its storage cannot be dropped and recreated.\",\n \"no-schema-fence\":\n \"This backend exposes no transactional schema fence, so a rebuild's \" +\n \"drop, recreate, refill, and marker stamp cannot be made atomic.\",\n \"shared-storage-in-use\":\n \"This contribution's storage is provisioned at a different shape than \" +\n \"the current declaration, and the only repair — recreating it — would \" +\n \"destroy fulltext content belonging to other graphs that share the same \" +\n \"table and can only be rebuilt from their own processes.\",\n};\n\nconst CONTRIBUTION_REBUILD_REFUSAL_SUGGESTION: Readonly<\n Record<ContributionRebuildRefusal, string>\n> = {\n \"vector-source-unavailable\":\n \"Run store.reembedVectorField(kind, fieldPath, { embed }) instead: it \" +\n \"recreates the field's storage and takes the callback that regenerates \" +\n \"the embeddings the recreate discards.\",\n \"no-drop-ddl\":\n \"Declare dropDdl on the contribution returned from the strategy's \" +\n \"ownedTables(), or drop and recreate the table out of band and then run \" +\n \"store.repairContributions() to re-stamp its marker.\",\n \"no-schema-fence\":\n \"Use a backend that implements schemaWriteTransaction, or perform the \" +\n \"drop and recreate out of band during a maintenance window and then run \" +\n \"store.repairContributions() followed by store.search.rebuildFulltext().\",\n \"shared-storage-in-use\":\n \"Recreate the shared table during a maintenance window with every graph \" +\n \"that uses it offline: drop it out of band, then run \" +\n 'store.rebuildContribution(\"fulltext\") once per graph on this database. ' +\n \"Each run recreates the table from the current DDL and refills that \" +\n \"graph's rows from its own nodes.\",\n};\n\n/**\n * Thrown when `store.rebuildContribution()` cannot honor a rebuild.\n *\n * A refusal, never a partial attempt: nothing has been dropped when this\n * throws. The point is that the alternative — proceeding — destroys data\n * that cannot be reconstructed, so the operation declines instead of\n * quietly doing less than its name promises.\n */\nexport class ContributionRebuildUnsupportedError extends TypeGraphError {\n readonly reason: ContributionRebuildRefusal;\n\n constructor(\n reason: ContributionRebuildRefusal,\n details: Readonly<Record<string, unknown>> = {},\n options?: { cause?: unknown },\n ) {\n super(\n CONTRIBUTION_REBUILD_REFUSAL_MESSAGE[reason],\n \"CONTRIBUTION_REBUILD_UNSUPPORTED\",\n {\n details: { ...details, reason },\n category: \"user\",\n suggestion: CONTRIBUTION_REBUILD_REFUSAL_SUGGESTION[reason],\n cause: options?.cause,\n },\n );\n this.name = \"ContributionRebuildUnsupportedError\";\n this.reason = reason;\n }\n}\n\n/**\n * Thrown when an iterative graph algorithm exhausts its caller-visible round\n * budget before reaching its convergence predicate.\n */\nexport class GraphAlgorithmConvergenceError extends TypeGraphError {\n constructor(\n algorithm: string,\n maxIterations: number,\n options: Readonly<{ oscillating?: boolean }> = {},\n ) {\n const oscillating = options.oscillating === true;\n super(\n oscillating ?\n `${algorithm} entered a periodic label oscillation and can never converge.`\n : `${algorithm} did not converge within ${maxIterations} iterations.`,\n \"GRAPH_ALGORITHM_CONVERGENCE_ERROR\",\n {\n details: {\n algorithm,\n maxIterations,\n ...(oscillating ? { oscillating } : {}),\n },\n category: \"user\",\n suggestion:\n oscillating ?\n 'Pass onMaxIterations: \"return\" to accept the fixed-round labeling, or exclude the oscillating component from the selection.'\n : \"Increase maxIterations or reduce the selected graph before retrying.\",\n },\n );\n this.name = \"GraphAlgorithmConvergenceError\";\n }\n}\n\n/** Stable reasons a weighted traversal can reject an edge's weight value. */\nexport type InvalidEdgeWeightReason =\n \"missing\" | \"negative\" | \"non_numeric\" | \"out_of_range\";\n\n/** Details for InvalidEdgeWeightError. */\nexport type InvalidEdgeWeightErrorDetails = Readonly<{\n /** Id of the first offending edge, in binary-collation order. */\n edgeId: string;\n /** Kind of the offending edge. */\n edgeKind: string;\n /** The audited weight property. */\n property: string;\n /** Why the weight was rejected. */\n reason: InvalidEdgeWeightReason;\n /** The offending value, when one was present and renderable. */\n value?: string;\n}>;\n\nconst EDGE_WEIGHT_REASONS: Readonly<\n Record<\n InvalidEdgeWeightReason,\n Readonly<{ message: string; suggestion: string }>\n >\n> = {\n missing: {\n message: \"has no value for weight property\",\n suggestion:\n \"Set the property on every selected edge, or provide defaultWeight for edges without it.\",\n },\n negative: {\n message: \"has a negative value for weight property\",\n suggestion:\n \"Weighted traversal requires non-negative weights; repair the edge data before retrying.\",\n },\n non_numeric: {\n message: \"has a non-numeric value for weight property\",\n suggestion:\n \"Store the weight property as a JSON number on every selected edge before retrying.\",\n },\n out_of_range: {\n message: \"has a value outside the supported range for weight property\",\n suggestion:\n \"Keep weight magnitudes within the range weightedShortestPath documents (large enough to be a normal IEEE 754 double, small enough that path sums cannot overflow).\",\n },\n};\n\n/**\n * Thrown when a weighted graph algorithm finds an edge whose weight property\n * violates the weighted-traversal contract (missing without a default,\n * non-numeric, or negative). Raised before any traversal rounds run, so a\n * weighted call either observes a fully valid weight domain or fails fast.\n */\nexport class InvalidEdgeWeightError extends TypeGraphError {\n declare readonly details: InvalidEdgeWeightErrorDetails;\n\n constructor(details: InvalidEdgeWeightErrorDetails) {\n super(\n `Edge '${details.edgeId}' (kind '${details.edgeKind}') ${EDGE_WEIGHT_REASONS[details.reason].message} '${details.property}'${\n details.value === undefined ? \"\" : ` (value: ${details.value})`\n }.`,\n \"INVALID_EDGE_WEIGHT\",\n {\n details: { ...details },\n category: \"user\",\n suggestion: EDGE_WEIGHT_REASONS[details.reason].suggestion,\n },\n );\n this.name = \"InvalidEdgeWeightError\";\n }\n}\n\n/** Thrown when an operation requires a backend capability it does not expose. */\nexport class UnsupportedBackendCapabilityError extends TypeGraphError {\n constructor(\n operation: string,\n capability: string,\n details: Readonly<Record<string, unknown>> = {},\n suggestion?: string,\n ) {\n super(\n `${operation} requires backend capability '${capability}'.`,\n \"UNSUPPORTED_BACKEND_CAPABILITY\",\n {\n details: { operation, capability, ...details },\n category: \"user\",\n suggestion:\n suggestion ??\n \"Use a backend that advertises this capability before invoking the operation.\",\n },\n );\n this.name = \"UnsupportedBackendCapabilityError\";\n }\n}\n\n/** Stable reasons an intentionally trusted initial import can be rejected. */\nexport type TrustedImportErrorReason =\n | \"backend_unsupported\"\n | \"database_not_empty\"\n | \"fulltext_unsupported\"\n | \"history_unsupported\"\n | \"identity_unsupported\"\n | \"invalid_stream\"\n | \"revision_tracking_unsupported\"\n | \"uniqueness_unsupported\"\n | \"vector_unsupported\";\n\n/** Thrown when the trusted initial-import contract is unavailable or violated. */\nexport class TrustedImportError extends TypeGraphError {\n constructor(\n message: string,\n reason: TrustedImportErrorReason,\n details: Readonly<Record<string, unknown>> = {},\n options?: Readonly<{ cause?: unknown; suggestion?: string }>,\n ) {\n super(message, \"TRUSTED_IMPORT_ERROR\", {\n details: { ...details, reason },\n category: \"user\",\n suggestion:\n options?.suggestion ??\n \"Use the validating bulk or interchange import APIs unless every trusted-import precondition is satisfied.\",\n cause: options?.cause,\n });\n this.name = \"TrustedImportError\";\n }\n}\n\n/**\n * Thrown to a graph export stream's consumer when the caller's `AbortSignal`\n * settled the stream instead of it reaching its end.\n *\n * Raised only after the export has given back everything it took, so receiving\n * it means the connection is already usable again. WHAT it took depends on the\n * backend: an export on one reporting `capabilities.transactions` holds a\n * repeatable-read snapshot (and, on a serialized connection, that connection's\n * stream lease), and both are settled before this is thrown; an export on a\n * backend without transactions holds neither, and its remaining reads are\n * simply abandoned — its already-delivered chunks were never one snapshot to\n * begin with. The message says which case applies. `cause` carries the signal's\n * own `reason` when the caller supplied one.\n */\nexport class ExportStreamCancelledError extends TypeGraphError {\n constructor(\n message: string,\n details: Readonly<Record<string, unknown>> = {},\n options?: Readonly<{ cause?: unknown; suggestion?: string }>,\n ) {\n super(message, \"INTERCHANGE_EXPORT_STREAM_ABORTED\", {\n details,\n category: \"user\",\n suggestion:\n options?.suggestion ??\n \"Start a new export; the aborted one released its snapshot transaction and the connection it held.\",\n cause: options?.cause,\n });\n this.name = \"ExportStreamCancelledError\";\n }\n}\n\n/**\n * The stable `details.code` values raised by the recorded-capture guards on a\n * history- or revision-tracked store. These are the sanctioned branch points\n * for a portable caller that must pick a transaction strategy without\n * substring-matching {@link ConfigurationError} messages.\n *\n * - `RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION`: `store.withTransaction`\n * was called on a history-enabled store, which has no flush point before the\n * caller commits — use `store.withRecordedTransaction` instead.\n * - `RECORDED_CAPTURE_RAW_SQL_DISABLED`: a raw SQL escape (`tx.sql`,\n * `backend.executeStatement`/`executeDdl`) was reached on a history-enabled\n * store, where it would bypass recorded-time capture.\n * - `REVISION_TRACKING_RAW_SQL_DISABLED`: the same raw SQL escape on a\n * revision-tracked store, where it would bypass the revision anchor.\n *\n * @see isRecordedCaptureGuardError\n */\nexport const RECORDED_CAPTURE_GUARD_CODES = [\n \"RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION\",\n \"RECORDED_CAPTURE_RAW_SQL_DISABLED\",\n \"REVISION_TRACKING_RAW_SQL_DISABLED\",\n] as const;\n\n/** A stable, branchable code raised by a recorded-capture guard. */\nexport type RecordedCaptureGuardCode =\n (typeof RECORDED_CAPTURE_GUARD_CODES)[number];\n\n/**\n * A {@link ConfigurationError} narrowed to carry a {@link RecordedCaptureGuardCode}\n * in `details.code` — the shape {@link isRecordedCaptureGuardError} guarantees.\n * `C` narrows `details.code` to a single code when the guard was called with a\n * specific one; it defaults to the full union.\n */\nexport type RecordedCaptureGuardError<\n C extends RecordedCaptureGuardCode = RecordedCaptureGuardCode,\n> = ConfigurationError & Readonly<{ details: Readonly<{ code: C }> }>;\n\nfunction isRecordedCaptureGuardCode(\n value: unknown,\n): value is RecordedCaptureGuardCode {\n // Widen the readonly tuple so `includes` accepts an `unknown` needle.\n return (RECORDED_CAPTURE_GUARD_CODES as readonly unknown[]).includes(value);\n}\n\n/**\n * Type guard for the recorded-capture guard errors, so a portable caller can\n * branch on the invariant a store enforced instead of substring-matching the\n * message. Pass `code` to narrow to a single guard; omit it to match any.\n *\n * Distinguishes \"history capture forbids raw SQL here\" from \"this backend has\n * no transactions\" (the latter carries no guard code — see\n * `TransactionContext.sqlAvailability` for the capability discriminant).\n *\n * Passing `code` also narrows `details.code` to that literal on the guarded\n * branch, so a caller can read the payload without re-checking.\n *\n * @example\n * ```typescript\n * // `withTransaction` is a compile error on a history-enabled store, so widen\n * // to the base Store surface to reach the runtime guard this branches on.\n * const store: Store<typeof graph> = historyStore;\n * try {\n * store.withTransaction(externalTx);\n * } catch (error) {\n * if (\n * isRecordedCaptureGuardError(\n * error,\n * \"RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION\",\n * )\n * ) {\n * // error.details.code is now the literal, not the union.\n * await historyStore.withRecordedTransaction(externalTx, run);\n * } else {\n * throw error;\n * }\n * }\n * ```\n */\nexport function isRecordedCaptureGuardError<C extends RecordedCaptureGuardCode>(\n error: unknown,\n code: C,\n): error is RecordedCaptureGuardError<C>;\nexport function isRecordedCaptureGuardError(\n error: unknown,\n): error is RecordedCaptureGuardError;\nexport function isRecordedCaptureGuardError(\n error: unknown,\n code?: RecordedCaptureGuardCode,\n): error is RecordedCaptureGuardError {\n if (!(error instanceof ConfigurationError)) return false;\n const actual = error.details[\"code\"];\n if (!isRecordedCaptureGuardCode(actual)) return false;\n return code === undefined || actual === code;\n}\n\n/**\n * Why a store's strategy-owned storage is not usable on the current\n * connection. Drives the {@link StoreNotInitializedError} message and\n * is surfaced in `details.reason` for programmatic handling.\n *\n * - `missing`: no durable materialization marker exists — the database\n * was never initialized for this graph's runtime contributions.\n * - `stale`: a marker exists but its recorded signature no longer\n * matches the resolved contribution DDL (strategy swap or DDL drift).\n * The hot path refuses rather than silently re-materializing.\n * - `failed`: the most recent boot-time materialization attempt\n * recorded an error. Boot may retry; the hot path refuses.\n */\nexport type StoreNotInitializedReason = \"missing\" | \"stale\" | \"failed\";\n\nconst STORE_NOT_INITIALIZED_REASON_PHRASE: Readonly<\n Record<StoreNotInitializedReason, string>\n> = {\n missing: \"is not initialized\",\n stale: \"is stale (recorded materialization signature no longer matches)\",\n failed: \"failed its last initialization attempt\",\n};\n\n/**\n * Details for StoreNotInitializedError. `graphId`/`reason` are always\n * present; callers may merge additional context (e.g. `logicalName`) via\n * `options.details`.\n */\nexport type StoreNotInitializedErrorDetails = Readonly<{\n graphId: string;\n reason: StoreNotInitializedReason;\n}> &\n Readonly<Record<string, unknown>>;\n\n/**\n * Thrown when a fulltext- or vector-dependent operation runs against a\n * connection whose strategy-owned storage has not been durably materialized.\n *\n * `createStore()` is a synchronous, zero-I/O attach: it never creates\n * tables, repairs DDL, or writes materialization markers. The durable\n * marker is written exclusively by the async boot path\n * (`createStoreWithSchema`). When a fulltext or embedding read/write — or\n * an adopted/business transaction — observes no valid marker, it refuses\n * loudly here instead of lazily emitting DDL on the hot path.\n */\nexport class StoreNotInitializedError extends TypeGraphError {\n declare readonly details: StoreNotInitializedErrorDetails;\n\n // `graphId`/`reason` are positional and required: both are\n // load-bearing for the message and for programmatic handling via\n // `details.reason`. Caller `details` merge underneath — spread first\n // so `graphId`/`reason` win and can't be clobbered by an\n // accidentally-colliding extra key.\n constructor(\n graphId: string,\n reason: StoreNotInitializedReason,\n options?: {\n cause?: unknown;\n details?: Readonly<Record<string, unknown>> &\n Readonly<{ graphId?: never; reason?: never }>;\n },\n ) {\n super(\n `${storageLabelFromLogicalName(options?.details?.[\"logicalName\"])} for ` +\n `graph \"${graphId}\" ${STORE_NOT_INITIALIZED_REASON_PHRASE[reason]}. ` +\n storeNotInitializedAction(reason, options?.details?.[\"logicalName\"]),\n \"STORE_NOT_INITIALIZED\",\n {\n details: { ...options?.details, graphId, reason },\n category: \"user\",\n suggestion:\n isStaleVectorSlot(reason, options?.details?.[\"logicalName\"]) ?\n \"The field's declared shape (e.g. its dimension) changed after \" +\n \"its storage was provisioned. Run store.reembedVectorField(\" +\n \"kind, fieldPath) to recreate the storage at the new shape and \" +\n \"re-embed.\"\n : \"Call createStoreWithSchema(graph, backend) once at application \" +\n \"startup. createStore() attaches to an already-initialized \" +\n \"database and does not materialize storage itself.\",\n cause: options?.cause,\n },\n );\n this.name = \"StoreNotInitializedError\";\n }\n}\n\nconst VECTOR_LOGICAL_NAME_PREFIX = \"vector:\";\n\n/**\n * A stale VECTOR slot is its own failure mode: the storage exists but was\n * provisioned at a different shape (the declared dimension changed), and\n * the fix is `store.reembedVectorField`, not a re-run of\n * `createStoreWithSchema` (whose boot pass deliberately skips drifted\n * slots). Drives the action sentence and the suggestion.\n */\nfunction isStaleVectorSlot(\n reason: StoreNotInitializedReason,\n logicalName: unknown,\n): boolean {\n return (\n reason === \"stale\" &&\n typeof logicalName === \"string\" &&\n logicalName.startsWith(VECTOR_LOGICAL_NAME_PREFIX)\n );\n}\n\n/** The actionable trailing sentence of the error message, per failure mode. */\nfunction storeNotInitializedAction(\n reason: StoreNotInitializedReason,\n logicalName: unknown,\n): string {\n if (isStaleVectorSlot(reason, logicalName)) {\n return (\n `The declared shape changed after provisioning — run ` +\n `store.reembedVectorField(kind, fieldPath) to recreate the storage ` +\n `at the new shape.`\n );\n }\n return (\n `Run createStoreWithSchema(graph, backend) during application boot, ` +\n `outside request handlers and adopted transactions, before using createStore().`\n );\n}\n\n/**\n * Human label for the un-materialized storage, derived from the\n * contribution `logicalName`: fulltext keeps \"fulltext storage\"; a vector\n * slot (\"vector:<kind>.<field>\") reads as `vector storage\n * \"<kind>.<field>\"` so the message names the exact embedding\n * field. Falls back to a neutral phrase when no logical name is supplied.\n */\nfunction storageLabelFromLogicalName(logicalName: unknown): string {\n if (typeof logicalName !== \"string\") return \"runtime storage\";\n if (logicalName.startsWith(VECTOR_LOGICAL_NAME_PREFIX)) {\n return `vector storage \"${logicalName.slice(VECTOR_LOGICAL_NAME_PREFIX.length)}\"`;\n }\n if (logicalName === \"fulltext\") return \"fulltext storage\";\n return `\"${logicalName}\" storage`;\n}\n\n// ============================================================\n// Database Errors (category: \"system\")\n// ============================================================\n\n/**\n * Details for DatabaseOperationError.\n */\nexport type DatabaseOperationErrorDetails = Readonly<{\n operation: string;\n entity: string;\n /**\n * `\"duplicate_key\"` means the engine refused the write because the entity's\n * identity is already taken — the shape a concurrent create of the same new id\n * produces on an engine that does not serialize the two writers. It is a\n * *classified* driver failure, so callers that own a better error for the\n * condition (the create paths, which report it as \"already exists\") translate\n * it rather than surfacing it.\n */\n reason?: \"no_row_returned\" | \"duplicate_key\";\n /**\n * The entities the failed statement tried to insert, carried structurally so a\n * translating caller never has to parse the driver's message for them. One\n * element for a single insert; for a batch, every row in the failing chunk —\n * the engine reports the collision without saying which row lost.\n */\n attempted?: readonly Readonly<{ kind: string; id: string }>[];\n}>;\n\n/**\n * Thrown when a database operation fails unexpectedly.\n *\n * This indicates a system-level failure in the database backend,\n * not a user-recoverable error.\n */\nexport class DatabaseOperationError extends TypeGraphError {\n declare readonly details: DatabaseOperationErrorDetails;\n\n constructor(\n message: string,\n details: DatabaseOperationErrorDetails,\n options?: { cause?: unknown },\n ) {\n super(message, \"DATABASE_OPERATION_ERROR\", {\n details,\n category: \"system\",\n suggestion: `This is a system-level database error. Check the database connection and retry the operation. If the problem persists, investigate the underlying cause.`,\n cause: options?.cause,\n });\n this.name = \"DatabaseOperationError\";\n }\n}\n\n// ============================================================\n// Vector / Embedding Errors (category: \"user\")\n// ============================================================\n\n/**\n * Details for EmbeddingDimensionChangedError.\n */\nexport type EmbeddingDimensionChangedErrorDetails = Readonly<{\n kind: string;\n fieldPath: string;\n declaredDimensions?: number;\n storedDimensions?: number;\n}>;\n\n/**\n * Thrown when an embedding field's declared dimension no longer matches the\n * dimension of its materialized per-field storage — i.e. a field's\n * `embedding(N)` was changed to `embedding(M)`. The stored vectors are invalid\n * under the new dimension and cannot be converted, only recomputed, so this is\n * a deliberate app-driven migration: call\n * `store.reembedVectorField(kind, fieldPath, ...)` to recreate the storage at\n * the new dimension and re-embed existing rows.\n */\nexport class EmbeddingDimensionChangedError extends TypeGraphError {\n declare readonly details: EmbeddingDimensionChangedErrorDetails;\n\n constructor(\n message: string,\n details: EmbeddingDimensionChangedErrorDetails,\n options?: { cause?: unknown },\n ) {\n super(message, \"EMBEDDING_DIMENSION_CHANGED\", {\n details,\n category: \"user\",\n suggestion: `Run store.reembedVectorField(\"${details.kind}\", \"${details.fieldPath}\", { embed }) to recreate the field's storage at the new dimension and re-embed existing rows.`,\n cause: options?.cause,\n });\n this.name = \"EmbeddingDimensionChangedError\";\n }\n}\n\n// ============================================================\n// Query Errors (category: \"system\")\n// ============================================================\n\n/**\n * Thrown when a query predicate cannot be compiled for the target database.\n */\nexport class UnsupportedPredicateError extends TypeGraphError {\n constructor(\n message: string,\n details: Readonly<Record<string, unknown>> = {},\n options?: { cause?: unknown; suggestion?: string },\n ) {\n super(message, \"UNSUPPORTED_PREDICATE\", {\n details,\n category: \"system\",\n suggestion:\n options?.suggestion ??\n `This predicate may not be supported by your database backend. Check the documentation for supported predicates.`,\n cause: options?.cause,\n });\n this.name = \"UnsupportedPredicateError\";\n }\n}\n\n// ============================================================\n// Compiler Errors (category: \"system\")\n// ============================================================\n\n/**\n * Thrown when a compiler invariant is violated.\n *\n * This indicates a bug in the query compiler — the compiler reached\n * a state that should be unreachable. These errors are not user-recoverable.\n */\nexport class CompilerInvariantError extends TypeGraphError {\n constructor(\n message: string,\n details?: Readonly<Record<string, unknown>>,\n options?: { cause?: unknown },\n ) {\n super(message, \"COMPILER_INVARIANT_ERROR\", {\n details: details ?? {},\n category: \"system\",\n suggestion: `This is an internal compiler error. Please report it as a bug with the query that triggered it.`,\n cause: options?.cause,\n });\n this.name = \"CompilerInvariantError\";\n }\n}\n\n// ============================================================\n// Lifecycle Errors (category: \"system\")\n// ============================================================\n\n/**\n * Thrown when an operation is attempted on a backend that has been disposed.\n *\n * This typically occurs during runtime teardown — for example, when a\n * Cloudflare Workers test runner resets Durable Object storage while\n * the TypeGraph backend still has queued operations.\n */\nexport class BackendDisposedError extends TypeGraphError {\n constructor(options?: { cause?: unknown }) {\n super(\n \"Backend has been disposed — the underlying database connection is no longer available\",\n \"BACKEND_DISPOSED\",\n {\n category: \"system\",\n suggestion:\n \"Ensure all store operations complete before calling backend.close(). \" +\n \"In test environments, await store teardown before resetting the database.\",\n cause: options?.cause,\n },\n );\n this.name = \"BackendDisposedError\";\n }\n}\n\n/**\n * Thrown when a statement is issued on a transaction-scoped backend after\n * its transaction boundary has already returned.\n *\n * The usual source is a callback that lets work escape it. `Promise.all`\n * rejects on its first rejection while its siblings keep running, so\n *\n * ```typescript\n * await store.transaction(async (tx) => {\n * await Promise.all([tx.nodes.Doc.create(a), tx.nodes.Doc.create(b)]);\n * });\n * ```\n *\n * leaves `b`'s remaining statements in flight when `a` fails. Those\n * statements have nowhere safe to go: the driver is about to emit `ROLLBACK`\n * on the same pinned connection and then hand it back to the pool, where a\n * late arrival would execute inside somebody else's transaction. TypeGraph\n * refuses them here instead.\n *\n * The error is normally invisible — `Promise.all` has already rejected with\n * the original failure, and discards this one.\n */\nexport class TransactionClosedError extends TypeGraphError {\n constructor(options?: { cause?: unknown }) {\n super(\n \"Statement issued on a transaction-scoped backend after its transaction \" +\n \"boundary returned. The connection has been released; the statement was not run.\",\n \"TRANSACTION_CLOSED\",\n {\n category: \"user\",\n suggestion:\n \"Await every write started inside store.transaction(...) before the \" +\n \"callback returns. Prefer awaiting a Promise.allSettled(...) over a \" +\n \"Promise.all(...) whose rejection would orphan its siblings.\",\n cause: options?.cause,\n },\n );\n this.name = \"TransactionClosedError\";\n }\n}\n\n// ============================================================\n// Utility Functions\n// ============================================================\n\n/**\n * Type guard for TypeGraphError.\n *\n * @example\n * ```typescript\n * try {\n * await store.nodes.Person.create({});\n * } catch (error) {\n * if (isTypeGraphError(error)) {\n * console.log(error.code, error.category);\n * }\n * }\n * ```\n */\nexport function isTypeGraphError(error: unknown): error is TypeGraphError {\n return error instanceof TypeGraphError;\n}\n\n/**\n * Check if error is recoverable by user action (user or constraint error).\n *\n * User-recoverable errors can typically be resolved by:\n * - Fixing invalid input data\n * - Using different IDs or values\n * - Deleting conflicting data first\n *\n * @example\n * ```typescript\n * if (isUserRecoverable(error)) {\n * showErrorToUser(error.toUserMessage());\n * } else {\n * logAndAlertOps(error);\n * }\n * ```\n */\nexport function isUserRecoverable(error: unknown): boolean {\n if (!isTypeGraphError(error)) return false;\n return error.category === \"user\" || error.category === \"constraint\";\n}\n\n/**\n * Check if error indicates a system/infrastructure issue.\n *\n * System errors typically require:\n * - Retry logic (for transient failures)\n * - Investigation (for persistent failures)\n * - Ops team notification\n */\nexport function isSystemError(error: unknown): boolean {\n return isTypeGraphError(error) && error.category === \"system\";\n}\n\n/**\n * Check if error is a constraint violation.\n */\nexport function isConstraintError(error: unknown): boolean {\n return isTypeGraphError(error) && error.category === \"constraint\";\n}\n\n/**\n * Extract suggestion from error if available.\n */\nexport function getErrorSuggestion(error: unknown): string | undefined {\n return isTypeGraphError(error) ? error.suggestion : undefined;\n}\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { createDataKeyedBag } from './chunk-DYATYRY4.js';
|
|
2
|
+
|
|
1
3
|
// src/schema/canonical.ts
|
|
2
4
|
function sortedReplacer(_key, value) {
|
|
3
5
|
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
4
|
-
const sorted =
|
|
6
|
+
const sorted = createDataKeyedBag();
|
|
5
7
|
for (const key of Object.keys(value).toSorted()) {
|
|
6
8
|
sorted[key] = value[key];
|
|
7
9
|
}
|
|
@@ -14,5 +16,5 @@ function canonicalEqual(a, b) {
|
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export { canonicalEqual, sortedReplacer };
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
19
|
+
//# sourceMappingURL=chunk-JBQQ7THH.js.map
|
|
20
|
+
//# sourceMappingURL=chunk-JBQQ7THH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schema/canonical.ts"],"names":[],"mappings":";;;AA6BO,SAAS,cAAA,CAAe,MAAc,KAAA,EAAyB;AACpE,EAAA,IAAI,KAAA,KAAU,QAAQ,OAAO,KAAA,KAAU,YAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxE,IAAA,MAAM,SAAS,kBAAA,EAA4B;AAC3C,IAAA,KAAA,MAAW,OAAO,MAAA,CAAO,IAAA,CAAK,KAAK,CAAA,CAAE,UAAS,EAAG;AAC/C,MAAA,MAAA,CAAO,GAAG,CAAA,GAAK,KAAA,CAAkC,GAAG,CAAA;AAAA,IACtD;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,KAAA;AACT;AAaO,SAAS,cAAA,CAAe,GAAY,CAAA,EAAqB;AAC9D,EAAA,OACE,IAAA,CAAK,UAAU,CAAA,EAAG,cAAc,MAAM,IAAA,CAAK,SAAA,CAAU,GAAG,cAAc,CAAA;AAE1E","file":"chunk-JBQQ7THH.js","sourcesContent":["/**\n * Canonical-form helpers for deterministic schema serialization.\n *\n * Used by both content-hashing (`computeSchemaHash`) and structural diffing\n * (`computeSchemaDiff`) to ensure that semantically-equivalent objects with\n * differently-ordered keys produce identical canonical strings.\n */\n\nimport { createDataKeyedBag } from \"../utils/object\";\n\n/**\n * `JSON.stringify` replacer that sorts object keys recursively.\n *\n * Apply via `JSON.stringify(value, sortedReplacer)` to obtain output in\n * which sibling keys at every depth appear in lexicographic order.\n *\n * Arrays are passed through unchanged — array order is semantically\n * meaningful and must not be normalized.\n *\n * The re-keyed object is null-prototype ({@link createDataKeyedBag}): every key\n * here is DATA — a kind name, a property name, a JSON-Schema keyword — and\n * `sorted[\"__proto__\"] = value` on a `{}` literal reaches the prototype setter\n * instead of creating an entry. The key would then be missing from the\n * canonical string, so a schema declaring such a property would hash and\n * compare equal to one that does not: `computeSchemaHash` would report\n * \"unchanged\" and `computeSchemaDiff` would find no change to migrate. Output\n * is byte-identical for every value without such a key, so no existing\n * schema's hash moves.\n */\nexport function sortedReplacer(_key: string, value: unknown): unknown {\n if (value !== null && typeof value === \"object\" && !Array.isArray(value)) {\n const sorted = createDataKeyedBag<unknown>();\n for (const key of Object.keys(value).toSorted()) {\n sorted[key] = (value as Record<string, unknown>)[key];\n }\n return sorted;\n }\n return value;\n}\n\n/**\n * Compare two values for canonical-form equality.\n *\n * Returns `true` when both values produce identical JSON under `sortedReplacer`\n * — i.e., they have the same JSON structure regardless of object key order.\n * Used by diff machinery to detect semantic changes in JSON-shaped fields.\n *\n * Note: callers must handle `undefined` themselves — `JSON.stringify(undefined)`\n * returns `undefined`, so two `undefined` inputs would compare equal here, which\n * may or may not be the desired semantics depending on context.\n */\nexport function canonicalEqual(a: unknown, b: unknown): boolean {\n return (\n JSON.stringify(a, sortedReplacer) === JSON.stringify(b, sortedReplacer)\n );\n}\n"]}
|